00001
00002
00003
00004
00005
00006
00007
00008
00009
00010
00011
00012
00013
00014
00030 #ifndef __vtkImageData_h
00031 #define __vtkImageData_h
00032
00033 #include "vtkDataSet.h"
00034
00035 #include "vtkStructuredData.h"
00036
00037 class vtkDataArray;
00038 class vtkLine;
00039 class vtkPixel;
00040 class vtkVertex;
00041 class vtkVoxel;
00042
00043 class VTK_FILTERING_EXPORT vtkImageData : public vtkDataSet
00044 {
00045 public:
00046 static vtkImageData *New();
00047
00048 vtkTypeRevisionMacro(vtkImageData,vtkDataSet);
00049 void PrintSelf(ostream& os, vtkIndent indent);
00050
00053 virtual void CopyStructure(vtkDataSet *ds);
00054
00056 virtual int GetDataObjectType() {return VTK_IMAGE_DATA;};
00057
00059
00060 virtual vtkIdType GetNumberOfCells();
00061 virtual vtkIdType GetNumberOfPoints();
00062 virtual double *GetPoint(vtkIdType ptId);
00063 virtual void GetPoint(vtkIdType id, double x[3]);
00064 virtual vtkCell *GetCell(vtkIdType cellId);
00065 virtual void GetCell(vtkIdType cellId, vtkGenericCell *cell);
00066 virtual void GetCellBounds(vtkIdType cellId, double bounds[6]);
00067 virtual vtkIdType FindPoint(double x, double y, double z)
00068 {
00069 return this->vtkDataSet::FindPoint(x, y, z);
00070 }
00071 virtual vtkIdType FindPoint(double x[3]);
00072 virtual vtkIdType FindCell(
00073 double x[3], vtkCell *cell, vtkIdType cellId, double tol2,
00074 int& subId, double pcoords[3], double *weights);
00075 virtual vtkIdType FindCell(
00076 double x[3], vtkCell *cell, vtkGenericCell *gencell,
00077 vtkIdType cellId, double tol2, int& subId,
00078 double pcoords[3], double *weights);
00079 virtual vtkCell *FindAndGetCell(double x[3], vtkCell *cell, vtkIdType cellId,
00080 double tol2, int& subId, double pcoords[3],
00081 double *weights);
00082 virtual int GetCellType(vtkIdType cellId);
00083 virtual void GetCellPoints(vtkIdType cellId, vtkIdList *ptIds)
00084 {vtkStructuredData::GetCellPoints(cellId,ptIds,this->DataDescription,
00085 this->GetDimensions());}
00086 virtual void GetPointCells(vtkIdType ptId, vtkIdList *cellIds)
00087 {vtkStructuredData::GetPointCells(ptId,cellIds,this->GetDimensions());}
00088 virtual void ComputeBounds();
00089 virtual int GetMaxCellSize() {return 8;};
00091
00093 virtual void Initialize();
00094
00096 virtual void SetDimensions(int i, int j, int k);
00097
00099 virtual void SetDimensions(const int dims[3]);
00100
00102
00105 virtual int *GetDimensions();
00106 virtual void GetDimensions(int dims[3]);
00108
00110
00115 virtual int ComputeStructuredCoordinates(
00116 double x[3], int ijk[3], double pcoords[3]);
00118
00120
00128 virtual void GetVoxelGradient(
00129 int i,int j,int k, vtkDataArray *s, vtkDataArray *g);
00131
00133
00138 virtual void GetPointGradient(
00139 int i, int j, int k, vtkDataArray *s, double g[3]);
00141
00143 virtual int GetDataDimension();
00144
00146
00148 virtual vtkIdType ComputePointId(int ijk[3]) {
00149 return vtkStructuredData::ComputePointId(this->GetDimensions(),ijk);};
00151
00153
00155 virtual vtkIdType ComputeCellId(int ijk[3]) {
00156 return vtkStructuredData::ComputeCellId(this->GetDimensions(),ijk);};
00158
00160
00161 virtual void SetAxisUpdateExtent(int axis, int min, int max);
00162 virtual void GetAxisUpdateExtent(int axis, int &min, int &max);
00164
00168 virtual void UpdateInformation();
00169
00171
00175 virtual void SetExtent(int extent[6]);
00176 virtual void SetExtent(int x1, int x2, int y1, int y2, int z1, int z2);
00177 vtkGetVector6Macro(Extent, int);
00179
00184 virtual unsigned long GetEstimatedMemorySize();
00185
00187
00189 virtual double GetScalarTypeMin();
00190 virtual double GetScalarTypeMax();
00192
00194 virtual int GetScalarSize();
00195
00197
00200 virtual vtkIdType *GetIncrements();
00201 virtual void GetIncrements(vtkIdType &incX, vtkIdType &incY, vtkIdType &incZ);
00202 virtual void GetIncrements(vtkIdType inc[3]);
00204
00206
00215 virtual void GetContinuousIncrements(
00216 int extent[6], vtkIdType &incX, vtkIdType &incY, vtkIdType &incZ);
00218
00220
00221 virtual void *GetScalarPointerForExtent(int extent[6]);
00222 virtual void *GetScalarPointer(int coordinates[3]);
00223 virtual void *GetScalarPointer(int x, int y, int z);
00224 virtual void *GetScalarPointer();
00226
00228
00229 virtual float GetScalarComponentAsFloat(int x, int y, int z, int component);
00230 virtual void SetScalarComponentFromFloat(
00231 int x, int y, int z, int component, float v);
00232 virtual double GetScalarComponentAsDouble(int x, int y, int z, int component);
00233 virtual void SetScalarComponentFromDouble(
00234 int x, int y, int z, int component, double v);
00236
00238 virtual void AllocateScalars();
00239
00241
00245 virtual void CopyAndCastFrom(vtkImageData *inData, int extent[6]);
00246 virtual void CopyAndCastFrom(vtkImageData *inData, int x0, int x1,
00247 int y0, int y1, int z0, int z1)
00248 {int e[6]; e[0]=x0; e[1]=x1; e[2]=y0; e[3]=y1; e[4]=z0; e[5]=z1;
00249 this->CopyAndCastFrom(inData, e);}
00251
00255 virtual void Crop();
00256
00262 virtual unsigned long GetActualMemorySize();
00263
00265
00267 vtkSetVector3Macro(Spacing,double);
00268 vtkGetVector3Macro(Spacing,double);
00270
00272
00274 vtkSetVector3Macro(Origin,double);
00275 vtkGetVector3Macro(Origin,double);
00277
00279
00284 void SetScalarTypeToFloat(){this->SetScalarType(VTK_FLOAT);};
00285 void SetScalarTypeToDouble(){this->SetScalarType(VTK_DOUBLE);};
00286 void SetScalarTypeToInt(){this->SetScalarType(VTK_INT);};
00287 void SetScalarTypeToUnsignedInt()
00288 {this->SetScalarType(VTK_UNSIGNED_INT);};
00289 void SetScalarTypeToLong(){this->SetScalarType(VTK_LONG);};
00290 void SetScalarTypeToUnsignedLong()
00291 {this->SetScalarType(VTK_UNSIGNED_LONG);};
00292 void SetScalarTypeToShort(){this->SetScalarType(VTK_SHORT);};
00293 void SetScalarTypeToUnsignedShort()
00294 {this->SetScalarType(VTK_UNSIGNED_SHORT);};
00295 void SetScalarTypeToUnsignedChar()
00296 {this->SetScalarType(VTK_UNSIGNED_CHAR);};
00297 void SetScalarTypeToSignedChar()
00298 {this->SetScalarType(VTK_SIGNED_CHAR);};
00299 void SetScalarTypeToChar()
00300 {this->SetScalarType(VTK_CHAR);};
00301 void SetScalarType(int);
00302 int GetScalarType();
00303 const char* GetScalarTypeAsString()
00304 { return vtkImageScalarTypeNameMacro ( this->GetScalarType() ); };
00306
00308
00310 void SetNumberOfScalarComponents( int n );
00311 int GetNumberOfScalarComponents();
00313
00314
00315 virtual void CopyTypeSpecificInformation( vtkDataObject *image );
00316
00318
00320 virtual void CopyInformationToPipeline(vtkInformation* request,
00321 vtkInformation* input,
00322 vtkInformation* output,
00323 int forceCopy);
00324 virtual void CopyInformationFromPipeline(vtkInformation* request);
00326
00330 virtual void PrepareForNewData();
00331
00333
00334 virtual void ShallowCopy(vtkDataObject *src);
00335 virtual void DeepCopy(vtkDataObject *src);
00337
00338
00339
00340
00341
00342
00344
00347 void *GetArrayPointerForExtent(vtkDataArray* array, int extent[6]);
00348 void *GetArrayPointer(vtkDataArray* array, int coordinates[3]);
00350
00353 void GetArrayIncrements(vtkDataArray *array, vtkIdType increments[3]);
00354
00359 void ComputeInternalExtent(int *intExt, int *tgtExt, int *bnds);
00360
00362 virtual int GetExtentType() { return VTK_3D_EXTENT; };
00363
00364
00366
00367 static vtkImageData* GetData(vtkInformation* info);
00368 static vtkImageData* GetData(vtkInformationVector* v, int i=0);
00369
00371
00372 protected:
00373 vtkImageData();
00374 ~vtkImageData();
00375
00376
00377 vtkVertex *Vertex;
00378 vtkLine *Line;
00379 vtkPixel *Pixel;
00380 vtkVoxel *Voxel;
00381
00382
00383
00384
00385 int Dimensions[3];
00386 int DataDescription;
00387 vtkIdType Increments[3];
00388
00389 double Origin[3];
00390 double Spacing[3];
00391
00392 int Extent[6];
00393
00394 void ComputeIncrements();
00395 void CopyOriginAndSpacingFromPipeline();
00396
00397 vtkTimeStamp ExtentComputeTime;
00398
00399 private:
00400 void InternalImageDataCopy(vtkImageData *src);
00401 private:
00402 vtkImageData(const vtkImageData&);
00403 void operator=(const vtkImageData&);
00404 };
00405
00406
00407
00408 inline void vtkImageData::GetPoint(vtkIdType id, double x[3])
00409 {
00410 const double *p = this->GetPoint(id);
00411 x[0] = p[0]; x[1] = p[1]; x[2] = p[2];
00412 }
00413
00414
00415 inline vtkIdType vtkImageData::GetNumberOfPoints()
00416 {
00417 const int *extent = this->Extent;
00418 vtkIdType dims[3];
00419 dims[0] = extent[1] - extent[0] + 1;
00420 dims[1] = extent[3] - extent[2] + 1;
00421 dims[2] = extent[5] - extent[4] + 1;
00422
00423 return dims[0]*dims[1]*dims[2];
00424 }
00425
00426
00427 inline int vtkImageData::GetDataDimension()
00428 {
00429 return vtkStructuredData::GetDataDimension(this->DataDescription);
00430 }
00431
00432 #endif
00433
00434
00435