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
00094 virtual void SetDimensions(int i, int j, int k);
00095
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::ComputePointIdForExtent(this->Extent,ijk);};
00151
00153
00155 virtual vtkIdType ComputeCellId(int ijk[3]) {
00156 return vtkStructuredData::ComputeCellIdForExtent(this->Extent,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
00179 virtual void SetExtent(int extent[6]);
00180 virtual void SetExtent(int x1, int x2, int y1, int y2, int z1, int z2);
00181 vtkGetVector6Macro(Extent, int);
00183
00188 virtual unsigned long GetEstimatedMemorySize();
00189
00191
00193 virtual double GetScalarTypeMin();
00194 virtual double GetScalarTypeMax();
00196
00198 virtual int GetScalarSize();
00199
00201
00204 virtual vtkIdType *GetIncrements();
00205 virtual void GetIncrements(vtkIdType &incX, vtkIdType &incY, vtkIdType &incZ);
00206 virtual void GetIncrements(vtkIdType inc[3]);
00208
00210
00219 virtual void GetContinuousIncrements(
00220 int extent[6], vtkIdType &incX, vtkIdType &incY, vtkIdType &incZ);
00222
00224
00225 virtual void *GetScalarPointerForExtent(int extent[6]);
00226 virtual void *GetScalarPointer(int coordinates[3]);
00227 virtual void *GetScalarPointer(int x, int y, int z);
00228 virtual void *GetScalarPointer();
00230
00232
00233 virtual float GetScalarComponentAsFloat(int x, int y, int z, int component);
00234 virtual void SetScalarComponentFromFloat(
00235 int x, int y, int z, int component, float v);
00236 virtual double GetScalarComponentAsDouble(int x, int y, int z, int component);
00237 virtual void SetScalarComponentFromDouble(
00238 int x, int y, int z, int component, double v);
00240
00242 virtual void AllocateScalars();
00243
00245
00249 virtual void CopyAndCastFrom(vtkImageData *inData, int extent[6]);
00250 virtual void CopyAndCastFrom(vtkImageData *inData, int x0, int x1,
00251 int y0, int y1, int z0, int z1)
00252 {int e[6]; e[0]=x0; e[1]=x1; e[2]=y0; e[3]=y1; e[4]=z0; e[5]=z1;
00253 this->CopyAndCastFrom(inData, e);}
00255
00259 virtual void Crop();
00260
00266 virtual unsigned long GetActualMemorySize();
00267
00269
00271 vtkSetVector3Macro(Spacing,double);
00272 vtkGetVector3Macro(Spacing,double);
00274
00276
00282 vtkSetVector3Macro(Origin,double);
00283 vtkGetVector3Macro(Origin,double);
00285
00287
00292 void SetScalarTypeToFloat(){this->SetScalarType(VTK_FLOAT);};
00293 void SetScalarTypeToDouble(){this->SetScalarType(VTK_DOUBLE);};
00294 void SetScalarTypeToInt(){this->SetScalarType(VTK_INT);};
00295 void SetScalarTypeToUnsignedInt()
00296 {this->SetScalarType(VTK_UNSIGNED_INT);};
00297 void SetScalarTypeToLong(){this->SetScalarType(VTK_LONG);};
00298 void SetScalarTypeToUnsignedLong()
00299 {this->SetScalarType(VTK_UNSIGNED_LONG);};
00300 void SetScalarTypeToShort(){this->SetScalarType(VTK_SHORT);};
00301 void SetScalarTypeToUnsignedShort()
00302 {this->SetScalarType(VTK_UNSIGNED_SHORT);};
00303 void SetScalarTypeToUnsignedChar()
00304 {this->SetScalarType(VTK_UNSIGNED_CHAR);};
00305 void SetScalarTypeToSignedChar()
00306 {this->SetScalarType(VTK_SIGNED_CHAR);};
00307 void SetScalarTypeToChar()
00308 {this->SetScalarType(VTK_CHAR);};
00309 void SetScalarType(int);
00310 int GetScalarType();
00311 const char* GetScalarTypeAsString()
00312 { return vtkImageScalarTypeNameMacro ( this->GetScalarType() ); };
00314
00316
00318 void SetNumberOfScalarComponents( int n );
00319 int GetNumberOfScalarComponents();
00321
00322
00323 virtual void CopyTypeSpecificInformation( vtkDataObject *image );
00324
00326
00328 virtual void CopyInformationToPipeline(vtkInformation* request,
00329 vtkInformation* input,
00330 vtkInformation* output,
00331 int forceCopy);
00332 virtual void CopyInformationFromPipeline(vtkInformation* request);
00334
00338 virtual void PrepareForNewData();
00339
00341
00342 virtual void ShallowCopy(vtkDataObject *src);
00343 virtual void DeepCopy(vtkDataObject *src);
00345
00346
00347
00348
00349
00350
00352
00355 void *GetArrayPointerForExtent(vtkDataArray* array, int extent[6]);
00356 void *GetArrayPointer(vtkDataArray* array, int coordinates[3]);
00358
00361 void GetArrayIncrements(vtkDataArray *array, vtkIdType increments[3]);
00362
00367 void ComputeInternalExtent(int *intExt, int *tgtExt, int *bnds);
00368
00370 virtual int GetExtentType() { return VTK_3D_EXTENT; };
00371
00372
00374
00375 static vtkImageData* GetData(vtkInformation* info);
00376 static vtkImageData* GetData(vtkInformationVector* v, int i=0);
00377
00379
00380 protected:
00381 vtkImageData();
00382 ~vtkImageData();
00383
00384
00385 vtkVertex *Vertex;
00386 vtkLine *Line;
00387 vtkPixel *Pixel;
00388 vtkVoxel *Voxel;
00389
00390
00391
00392
00393 int Dimensions[3];
00394 int DataDescription;
00395 vtkIdType Increments[3];
00396
00397 double Origin[3];
00398 double Spacing[3];
00399
00400 int Extent[6];
00401
00402 void ComputeIncrements();
00403 void CopyOriginAndSpacingFromPipeline();
00404
00405 vtkTimeStamp ExtentComputeTime;
00406
00407 private:
00408 void InternalImageDataCopy(vtkImageData *src);
00409 private:
00410 vtkImageData(const vtkImageData&);
00411 void operator=(const vtkImageData&);
00412 };
00413
00414
00415
00416 inline void vtkImageData::GetPoint(vtkIdType id, double x[3])
00417 {
00418 const double *p = this->GetPoint(id);
00419 x[0] = p[0]; x[1] = p[1]; x[2] = p[2];
00420 }
00421
00422
00423 inline vtkIdType vtkImageData::GetNumberOfPoints()
00424 {
00425 const int *extent = this->Extent;
00426 vtkIdType dims[3];
00427 dims[0] = extent[1] - extent[0] + 1;
00428 dims[1] = extent[3] - extent[2] + 1;
00429 dims[2] = extent[5] - extent[4] + 1;
00430
00431 return dims[0]*dims[1]*dims[2];
00432 }
00433
00434
00435 inline int vtkImageData::GetDataDimension()
00436 {
00437 return vtkStructuredData::GetDataDimension(this->DataDescription);
00438 }
00439
00440 #endif
00441
00442
00443