00001
00002
00003
00004
00005
00006
00007
00008
00009
00010
00011
00012
00013
00014
00015
00016
00017
00018
00019
00020
00021
00022
00023
00024
00025
00026
00027
00028
00029
00030
00031
00032
00033
00034
00035
00036
00037
00038
00039
00055 #ifndef __vtkImageData_h
00056 #define __vtkImageData_h
00057
00058 #include "vtkDataSet.h"
00059 #include "vtkStructuredData.h"
00060 class vtkVertex;
00061 class vtkLine;
00062 class vtkPixel;
00063 class vtkVoxel;
00064 class vtkImageToStructuredPoints;
00065
00066
00067 class VTK_EXPORT vtkImageData : public vtkDataSet
00068 {
00069 public:
00070 static vtkImageData *New();
00071
00072 vtkTypeMacro(vtkImageData,vtkDataSet);
00073 void PrintSelf(ostream& os, vtkIndent indent);
00074
00076 vtkDataObject *MakeObject() {return vtkImageData::New();};
00077
00080 void CopyStructure(vtkDataSet *ds);
00081
00083 int GetDataObjectType() {return VTK_IMAGE_DATA;};
00084
00087 void UpdateData();
00088
00090 int GetNumberOfCells();
00091 int GetNumberOfPoints();
00092 float *GetPoint(int ptId);
00093 void GetPoint(int id, float x[3]);
00094 vtkCell *GetCell(int cellId);
00095 void GetCell(int cellId, vtkGenericCell *cell);
00096 void GetCellBounds(int cellId, float bounds[6]);
00097 int FindPoint(float x, float y, float z) { return this->vtkDataSet::FindPoint(x, y, z);};
00098 int FindPoint(float x[3]);
00099 int FindCell(float x[3], vtkCell *cell, int cellId, float tol2, int& subId,
00100 float pcoords[3], float *weights);
00101 int FindCell(float x[3], vtkCell *cell, vtkGenericCell *gencell,
00102 int cellId, float tol2, int& subId,
00103 float pcoords[3], float *weights);
00104 vtkCell *FindAndGetCell(float x[3], vtkCell *cell, int cellId,
00105 float tol2, int& subId, float pcoords[3], float *weights);
00106 int GetCellType(int cellId);
00107 void GetCellPoints(int cellId, vtkIdList *ptIds)
00108 {vtkStructuredData::GetCellPoints(cellId,ptIds,this->DataDescription,
00109 this->GetDimensions());}
00110 void GetPointCells(int ptId, vtkIdList *cellIds)
00111 {vtkStructuredData::GetPointCells(ptId,cellIds,this->GetDimensions());}
00112 void ComputeBounds();
00113 int GetMaxCellSize() {return 8;};
00114
00116 void SetDimensions(int i, int j, int k);
00117
00119 void SetDimensions(int dims[3]);
00120
00123 int *GetDimensions();
00124 void GetDimensions(int dims[3]);
00125
00131 int ComputeStructuredCoordinates(float x[3], int ijk[3], float pcoords[3]);
00132
00141 void GetVoxelGradient(int i,int j,int k, vtkScalars *s, vtkVectors *g);
00142
00148 void GetPointGradient(int i, int j, int k, vtkScalars *s, float g[3]);
00149
00151 int GetDataDimension();
00152
00155 int ComputePointId(int ijk[3]) {
00156 return vtkStructuredData::ComputePointId(this->GetDimensions(),ijk);};
00157
00160 int ComputeCellId(int ijk[3]) {
00161 return vtkStructuredData::ComputeCellId(this->GetDimensions(),ijk);};
00162
00164 void SetAxisUpdateExtent(int axis, int min, int max);
00165 void GetAxisUpdateExtent(int axis, int &min, int &max);
00166
00170 void SetUpdateExtent(int piece, int numPieces, int ghostLevel);
00171 void SetUpdateExtent(int piece, int numPieces)
00172 {this->SetUpdateExtent(piece, numPieces, 0);}
00173
00175 void SetUpdateExtent( int x1, int x2, int y1, int y2, int z1, int z2 )
00176 { this->vtkDataSet::SetUpdateExtent( x1, x2, y1, y2, z1, z2 ); };
00177 void SetUpdateExtent( int ext[6] )
00178 { this->vtkDataSet::SetUpdateExtent( ext ); };
00179
00183 void SetExtent(int extent[6]);
00184 void SetExtent(int x1, int x2, int y1, int y2, int z1, int z2);
00185 vtkGetVector6Macro(Extent,int);
00186
00191 virtual unsigned long GetEstimatedMemorySize();
00192
00195 double GetScalarTypeMin();
00196 double GetScalarTypeMax();
00197
00199 int GetScalarSize();
00200
00204 int *GetIncrements();
00205 void GetIncrements(int &incX, int &incY, int &incZ);
00206 void GetIncrements(int inc[3]);
00207
00212 void GetContinuousIncrements(int extent[6], int &incX, int &incY,
00213 int &incZ);
00214
00216 void *GetScalarPointerForExtent(int coordinates[6]);
00217 void *GetScalarPointer(int coordinates[3]);
00218 void *GetScalarPointer(int x, int y, int z);
00219 void *GetScalarPointer();
00220
00222 float GetScalarComponentAsFloat(int x, int y, int z, int component);
00223
00225 void AllocateScalars();
00226
00231 void CopyAndCastFrom(vtkImageData *inData, int extent[6]);
00232
00235 vtkImageToStructuredPoints *MakeImageToStructuredPoints();
00236
00242 unsigned long GetActualMemorySize();
00243
00246 vtkSetVector3Macro(Spacing,float);
00247 vtkGetVector3Macro(Spacing,float);
00248
00251 vtkSetVector3Macro(Origin,float);
00252 vtkGetVector3Macro(Origin,float);
00253
00255 vtkSetMacro(ScalarType, int);
00256 int GetScalarType();
00257
00259 void SetNumberOfScalarComponents( int n );
00260 vtkGetMacro(NumberOfScalarComponents,int);
00261
00262
00263 void CopyTypeSpecificInformation( vtkDataObject *image );
00264
00268 virtual void PrepareForNewData();
00269
00271 void ShallowCopy(vtkDataObject *src);
00272 void DeepCopy(vtkDataObject *src);
00273
00274 #ifndef VTK_REMOVE_LEGACY_CODE
00275
00276 void GetCellPoints(int cellId, vtkIdList &ptIds)
00277 {VTK_LEGACY_METHOD(GetCellPoints,"3.2");this->GetCellPoints(cellId, &ptIds);}
00278 void GetPointCells(int ptId, vtkIdList &cellIds)
00279 {VTK_LEGACY_METHOD(GetPointCells,"3.2");this->GetPointCells(ptId, &cellIds);}
00280 void GetVoxelGradient(int i,int j,int k, vtkScalars *s, vtkVectors &g)
00281 {VTK_LEGACY_METHOD(GetVoxelGradient,"3.2");this->GetVoxelGradient(i, j, k, s, &g);}
00282 vtkImageData *UpdateAndReturnData()
00283 {VTK_LEGACY_METHOD(UpdateAndReturnData,"3.2");this->Update();return this;}
00284 #endif
00285
00286 protected:
00287 vtkImageData();
00288 ~vtkImageData();
00289 vtkImageData(const vtkImageData&) {};
00290 void operator=(const vtkImageData&) {};
00291
00292 vtkImageToStructuredPoints *ImageToStructuredPoints;
00293
00294
00295 vtkVertex *Vertex;
00296 vtkLine *Line;
00297 vtkPixel *Pixel;
00298 vtkVoxel *Voxel;
00299
00300
00301 int GetExtentType() { return VTK_3D_EXTENT; };
00302
00303
00304
00305
00306 int Dimensions[3];
00307 int DataDescription;
00308 int Increments[3];
00309
00310 float Origin[3];
00311 float Spacing[3];
00312 int ScalarType;
00313 int NumberOfScalarComponents;
00314
00315 void ComputeIncrements();
00316
00317 private:
00318 void InternalImageDataCopy(vtkImageData *src);
00319 };
00320
00321
00322 inline void vtkImageData::GetPoint(int id, float x[3])
00323 {
00324 float *p=this->GetPoint(id);
00325 x[0] = p[0]; x[1] = p[1]; x[2] = p[2];
00326 }
00327
00328
00329
00330 inline int vtkImageData::GetNumberOfPoints()
00331 {
00332 int *dims = this->GetDimensions();
00333 return dims[0]*dims[1]*dims[2];
00334 }
00335
00336 inline int vtkImageData::GetDataDimension()
00337 {
00338 return vtkStructuredData::GetDataDimension(this->DataDescription);
00339 }
00340
00341 #endif
00342
00343
00344