00001
00002
00003
00004
00005
00006
00007
00008
00009
00010
00011
00012
00013
00014
00027 #ifndef __vtkImageData_h
00028 #define __vtkImageData_h
00029
00030 #include "vtkDataSet.h"
00031
00032 #include "vtkStructuredData.h"
00033
00034 class vtkDataArray;
00035 class vtkLine;
00036 class vtkPixel;
00037 class vtkVertex;
00038 class vtkVoxel;
00039
00040 class VTK_FILTERING_EXPORT vtkImageData : public vtkDataSet
00041 {
00042 public:
00043 static vtkImageData *New();
00044
00045 vtkTypeRevisionMacro(vtkImageData,vtkDataSet);
00046 void PrintSelf(ostream& os, vtkIndent indent);
00047
00050 virtual void CopyStructure(vtkDataSet *ds);
00051
00053 virtual int GetDataObjectType() {return VTK_IMAGE_DATA;};
00054
00056
00057 virtual vtkIdType GetNumberOfCells();
00058 virtual vtkIdType GetNumberOfPoints();
00059 virtual double *GetPoint(vtkIdType ptId);
00060 virtual void GetPoint(vtkIdType id, double x[3]);
00061 virtual vtkCell *GetCell(vtkIdType cellId);
00062 virtual void GetCell(vtkIdType cellId, vtkGenericCell *cell);
00063 virtual void GetCellBounds(vtkIdType cellId, double bounds[6]);
00064 virtual vtkIdType FindPoint(double x, double y, double z)
00065 {
00066 return this->vtkDataSet::FindPoint(x, y, z);
00067 }
00068 virtual vtkIdType FindPoint(double x[3]);
00069 virtual vtkIdType FindCell(
00070 double x[3], vtkCell *cell, vtkIdType cellId, double tol2,
00071 int& subId, double pcoords[3], double *weights);
00072 virtual vtkIdType FindCell(
00073 double x[3], vtkCell *cell, vtkGenericCell *gencell,
00074 vtkIdType cellId, double tol2, int& subId,
00075 double pcoords[3], double *weights);
00076 virtual vtkCell *FindAndGetCell(double x[3], vtkCell *cell, vtkIdType cellId,
00077 double tol2, int& subId, double pcoords[3],
00078 double *weights);
00079 virtual int GetCellType(vtkIdType cellId);
00080 virtual void GetCellPoints(vtkIdType cellId, vtkIdList *ptIds)
00081 {vtkStructuredData::GetCellPoints(cellId,ptIds,this->DataDescription,
00082 this->GetDimensions());}
00083 virtual void GetPointCells(vtkIdType ptId, vtkIdList *cellIds)
00084 {vtkStructuredData::GetPointCells(ptId,cellIds,this->GetDimensions());}
00085 virtual void ComputeBounds();
00086 virtual int GetMaxCellSize() {return 8;};
00088
00090 virtual void Initialize();
00091
00093 virtual void SetDimensions(int i, int j, int k);
00094
00096 virtual void SetDimensions(const int dims[3]);
00097
00099
00102 virtual int *GetDimensions();
00103 virtual void GetDimensions(int dims[3]);
00105
00107
00112 virtual int ComputeStructuredCoordinates(
00113 double x[3], int ijk[3], double pcoords[3]);
00115
00117
00125 virtual void GetVoxelGradient(
00126 int i,int j,int k, vtkDataArray *s, vtkDataArray *g);
00128
00130
00135 virtual void GetPointGradient(
00136 int i, int j, int k, vtkDataArray *s, double g[3]);
00138
00140 virtual int GetDataDimension();
00141
00143
00145 virtual vtkIdType ComputePointId(int ijk[3]) {
00146 return vtkStructuredData::ComputePointId(this->GetDimensions(),ijk);};
00148
00150
00152 virtual vtkIdType ComputeCellId(int ijk[3]) {
00153 return vtkStructuredData::ComputeCellId(this->GetDimensions(),ijk);};
00155
00157
00158 virtual void SetAxisUpdateExtent(int axis, int min, int max);
00159 virtual void GetAxisUpdateExtent(int axis, int &min, int &max);
00161
00165 virtual void UpdateInformation();
00166
00168
00176 virtual void SetExtent(int extent[6]);
00177 virtual void SetExtent(int x1, int x2, int y1, int y2, int z1, int z2);
00178 vtkGetVector6Macro(Extent, int);
00180
00185 virtual unsigned long GetEstimatedMemorySize();
00186
00188
00190 virtual double GetScalarTypeMin();
00191 virtual double GetScalarTypeMax();
00193
00195 virtual int GetScalarSize();
00196
00198
00201 virtual vtkIdType *GetIncrements();
00202 virtual void GetIncrements(vtkIdType &incX, vtkIdType &incY, vtkIdType &incZ);
00203 virtual void GetIncrements(vtkIdType inc[3]);
00205
00207
00216 virtual void GetContinuousIncrements(
00217 int extent[6], vtkIdType &incX, vtkIdType &incY, vtkIdType &incZ);
00219
00221
00222 virtual void *GetScalarPointerForExtent(int extent[6]);
00223 virtual void *GetScalarPointer(int coordinates[3]);
00224 virtual void *GetScalarPointer(int x, int y, int z);
00225 virtual void *GetScalarPointer();
00227
00229
00230 virtual float GetScalarComponentAsFloat(int x, int y, int z, int component);
00231 virtual void SetScalarComponentFromFloat(
00232 int x, int y, int z, int component, float v);
00233 virtual double GetScalarComponentAsDouble(int x, int y, int z, int component);
00234 virtual void SetScalarComponentFromDouble(
00235 int x, int y, int z, int component, double v);
00237
00239 virtual void AllocateScalars();
00240
00242
00246 virtual void CopyAndCastFrom(vtkImageData *inData, int extent[6]);
00247 virtual void CopyAndCastFrom(vtkImageData *inData, int x0, int x1,
00248 int y0, int y1, int z0, int z1)
00249 {int e[6]; e[0]=x0; e[1]=x1; e[2]=y0; e[3]=y1; e[4]=z0; e[5]=z1;
00250 this->CopyAndCastFrom(inData, e);}
00252
00256 virtual void Crop();
00257
00263 virtual unsigned long GetActualMemorySize();
00264
00266
00268 vtkSetVector3Macro(Spacing,double);
00269 vtkGetVector3Macro(Spacing,double);
00271
00273
00279 vtkSetVector3Macro(Origin,double);
00280 vtkGetVector3Macro(Origin,double);
00282
00284
00289 void SetScalarTypeToFloat(){this->SetScalarType(VTK_FLOAT);};
00290 void SetScalarTypeToDouble(){this->SetScalarType(VTK_DOUBLE);};
00291 void SetScalarTypeToInt(){this->SetScalarType(VTK_INT);};
00292 void SetScalarTypeToUnsignedInt()
00293 {this->SetScalarType(VTK_UNSIGNED_INT);};
00294 void SetScalarTypeToLong(){this->SetScalarType(VTK_LONG);};
00295 void SetScalarTypeToUnsignedLong()
00296 {this->SetScalarType(VTK_UNSIGNED_LONG);};
00297 void SetScalarTypeToShort(){this->SetScalarType(VTK_SHORT);};
00298 void SetScalarTypeToUnsignedShort()
00299 {this->SetScalarType(VTK_UNSIGNED_SHORT);};
00300 void SetScalarTypeToUnsignedChar()
00301 {this->SetScalarType(VTK_UNSIGNED_CHAR);};
00302 void SetScalarTypeToSignedChar()
00303 {this->SetScalarType(VTK_SIGNED_CHAR);};
00304 void SetScalarTypeToChar()
00305 {this->SetScalarType(VTK_CHAR);};
00306 void SetScalarType(int);
00307 int GetScalarType();
00308 const char* GetScalarTypeAsString()
00309 { return vtkImageScalarTypeNameMacro ( this->GetScalarType() ); };
00311
00313
00315 void SetNumberOfScalarComponents( int n );
00316 int GetNumberOfScalarComponents();
00318
00319
00320 virtual void CopyTypeSpecificInformation( vtkDataObject *image );
00321
00323
00325 virtual void CopyInformationToPipeline(vtkInformation* request,
00326 vtkInformation* input,
00327 vtkInformation* output,
00328 int forceCopy);
00329 virtual void CopyInformationFromPipeline(vtkInformation* request);
00331
00335 virtual void PrepareForNewData();
00336
00338
00339 virtual void ShallowCopy(vtkDataObject *src);
00340 virtual void DeepCopy(vtkDataObject *src);
00342
00343
00344
00345
00346
00347
00349
00352 void *GetArrayPointerForExtent(vtkDataArray* array, int extent[6]);
00353 void *GetArrayPointer(vtkDataArray* array, int coordinates[3]);
00355
00358 void GetArrayIncrements(vtkDataArray *array, vtkIdType increments[3]);
00359
00364 void ComputeInternalExtent(int *intExt, int *tgtExt, int *bnds);
00365
00367 virtual int GetExtentType() { return VTK_3D_EXTENT; };
00368
00369
00371
00372 static vtkImageData* GetData(vtkInformation* info);
00373 static vtkImageData* GetData(vtkInformationVector* v, int i=0);
00374
00376
00377 protected:
00378 vtkImageData();
00379 ~vtkImageData();
00380
00381
00382 vtkVertex *Vertex;
00383 vtkLine *Line;
00384 vtkPixel *Pixel;
00385 vtkVoxel *Voxel;
00386
00387
00388
00389
00390 int Dimensions[3];
00391 int DataDescription;
00392 vtkIdType Increments[3];
00393
00394 double Origin[3];
00395 double Spacing[3];
00396
00397 int Extent[6];
00398
00399 void ComputeIncrements();
00400 void CopyOriginAndSpacingFromPipeline();
00401
00402 vtkTimeStamp ExtentComputeTime;
00403
00404 private:
00405 void InternalImageDataCopy(vtkImageData *src);
00406 private:
00407 vtkImageData(const vtkImageData&);
00408 void operator=(const vtkImageData&);
00409 };
00410
00411
00412
00413 inline void vtkImageData::GetPoint(vtkIdType id, double x[3])
00414 {
00415 const double *p = this->GetPoint(id);
00416 x[0] = p[0]; x[1] = p[1]; x[2] = p[2];
00417 }
00418
00419
00420 inline vtkIdType vtkImageData::GetNumberOfPoints()
00421 {
00422 const int *extent = this->Extent;
00423 vtkIdType dims[3];
00424 dims[0] = extent[1] - extent[0] + 1;
00425 dims[1] = extent[3] - extent[2] + 1;
00426 dims[2] = extent[5] - extent[4] + 1;
00427
00428 return dims[0]*dims[1]*dims[2];
00429 }
00430
00431
00432 inline int vtkImageData::GetDataDimension()
00433 {
00434 return vtkStructuredData::GetDataDimension(this->DataDescription);
00435 }
00436
00437 #endif
00438
00439
00440