00001
00002
00003
00004
00005
00006
00007
00008
00009
00010
00011
00012
00013
00014
00041 #ifndef __vtkImageData_h
00042 #define __vtkImageData_h
00043
00044 #include "vtkDataSet.h"
00045
00046 #include "vtkStructuredData.h"
00047
00048 class vtkDataArray;
00049 class vtkLine;
00050 class vtkPixel;
00051 class vtkVertex;
00052 class vtkVoxel;
00053
00054 class VTK_FILTERING_EXPORT vtkImageData : public vtkDataSet
00055 {
00056 public:
00057 static vtkImageData *New();
00058
00059 vtkTypeRevisionMacro(vtkImageData,vtkDataSet);
00060 void PrintSelf(ostream& os, vtkIndent indent);
00061
00064 void CopyStructure(vtkDataSet *ds);
00065
00067 int GetDataObjectType() {return VTK_IMAGE_DATA;};
00068
00070
00071 vtkIdType GetNumberOfCells();
00072 vtkIdType GetNumberOfPoints();
00073 double *GetPoint(vtkIdType ptId);
00074 void GetPoint(vtkIdType id, double x[3]);
00075 vtkCell *GetCell(vtkIdType cellId);
00076 void GetCell(vtkIdType cellId, vtkGenericCell *cell);
00077 void GetCellBounds(vtkIdType cellId, double bounds[6]);
00078 vtkIdType FindPoint(double x, double y, double z) { return this->vtkDataSet::FindPoint(x, y, z);};
00079 vtkIdType FindPoint(double x[3]);
00080 vtkIdType FindCell(double x[3], vtkCell *cell, vtkIdType cellId, double tol2,
00081 int& subId, double pcoords[3], double *weights);
00082 vtkIdType FindCell(double x[3], vtkCell *cell, vtkGenericCell *gencell,
00083 vtkIdType cellId, double tol2, int& subId,
00084 double pcoords[3], double *weights);
00085 vtkCell *FindAndGetCell(double x[3], vtkCell *cell, vtkIdType cellId,
00086 double tol2, int& subId, double pcoords[3],
00087 double *weights);
00088 int GetCellType(vtkIdType cellId);
00089 void GetCellPoints(vtkIdType cellId, vtkIdList *ptIds)
00090 {vtkStructuredData::GetCellPoints(cellId,ptIds,this->DataDescription,
00091 this->GetDimensions());}
00092 void GetPointCells(vtkIdType ptId, vtkIdList *cellIds)
00093 {vtkStructuredData::GetPointCells(ptId,cellIds,this->GetDimensions());}
00094 void ComputeBounds();
00095 int GetMaxCellSize() {return 8;};
00097
00099 void Initialize();
00100
00102 void SetDimensions(int i, int j, int k);
00103
00105 void SetDimensions(int dims[3]);
00106
00108
00110 int *GetDimensions();
00111 void GetDimensions(int dims[3]);
00113
00119 int ComputeStructuredCoordinates(double x[3], int ijk[3], double pcoords[3]);
00120
00129 void GetVoxelGradient(int i,int j,int k, vtkDataArray *s, vtkDataArray *g);
00130
00136 void GetPointGradient(int i, int j, int k, vtkDataArray *s, double g[3]);
00137
00139 int GetDataDimension();
00140
00142
00144 vtkIdType ComputePointId(int ijk[3]) {
00145 return vtkStructuredData::ComputePointId(this->GetDimensions(),ijk);};
00147
00149
00151 vtkIdType ComputeCellId(int ijk[3]) {
00152 return vtkStructuredData::ComputeCellId(this->GetDimensions(),ijk);};
00154
00156
00157 void SetAxisUpdateExtent(int axis, int min, int max);
00158 void GetAxisUpdateExtent(int axis, int &min, int &max);
00160
00162
00165 void SetUpdateExtent(int piece, int numPieces, int ghostLevel);
00166 void SetUpdateExtent(int piece, int numPieces)
00167 {this->SetUpdateExtent(piece, numPieces, 0);}
00169
00171
00172 void SetUpdateExtent( int x1, int x2, int y1, int y2, int z1, int z2 )
00173 { this->vtkDataSet::SetUpdateExtent( x1, x2, y1, y2, z1, z2 ); };
00174 void SetUpdateExtent( int ext[6] )
00175 { this->vtkDataSet::SetUpdateExtent( ext ); };
00177
00179
00182 void SetExtent(int extent[6]);
00183 void SetExtent(int x1, int x2, int y1, int y2, int z1, int z2);
00184 int* GetExtent();
00185 void GetExtent(int& x1, int& x2, int& y1, int& y2, int& z1, int& z2);
00186 void GetExtent(int* extent);
00188
00193 virtual unsigned long GetEstimatedMemorySize();
00194
00196
00198 double GetScalarTypeMin();
00199 double GetScalarTypeMax();
00201
00203 int GetScalarSize();
00204
00206
00209 int *GetIncrements();
00210 void GetIncrements(int &incX, int &incY, int &incZ);
00211 void GetIncrements(int inc[3]);
00213
00223 void GetContinuousIncrements(int extent[6], int &incX, int &incY, int &incZ);
00224
00226
00227 void *GetScalarPointerForExtent(int extent[6]);
00228 void *GetScalarPointer(int coordinates[3]);
00229 void *GetScalarPointer(int x, int y, int z);
00230 void *GetScalarPointer();
00232
00234
00235 double GetScalarComponentAsDouble(int x, int y, int z, int component);
00236 void SetScalarComponentFromDouble(int x, int y, int z, int component, double v);
00238
00240 void AllocateScalars();
00241
00243
00247 void CopyAndCastFrom(vtkImageData *inData, int extent[6]);
00248 void CopyAndCastFrom(vtkImageData *inData, int x0, int x1,
00249 int y0, int y1, int z0, int z1)
00250 {int e[6]; e[0]=x0; e[1]=x1; e[2]=y0; e[3]=y1; e[4]=z0; e[5]=z1;
00251 this->CopyAndCastFrom(inData, e);}
00253
00257 virtual void Crop();
00258
00264 unsigned long GetActualMemorySize();
00265
00267
00269 vtkSetVector3Macro(Spacing,double);
00270 vtkGetVector3Macro(Spacing,double);
00272
00274
00276 vtkSetVector3Macro(Origin,double);
00277 vtkGetVector3Macro(Origin,double);
00279
00281
00282 void SetScalarTypeToFloat(){this->SetScalarType(VTK_FLOAT);};
00283 void SetScalarTypeToDouble(){this->SetScalarType(VTK_DOUBLE);};
00284 void SetScalarTypeToInt(){this->SetScalarType(VTK_INT);};
00285 void SetScalarTypeToUnsignedInt()
00286 {this->SetScalarType(VTK_UNSIGNED_INT);};
00287 void SetScalarTypeToLong(){this->SetScalarType(VTK_LONG);};
00288 void SetScalarTypeToUnsignedLong()
00289 {this->SetScalarType(VTK_UNSIGNED_LONG);};
00290 void SetScalarTypeToShort(){this->SetScalarType(VTK_SHORT);};
00291 void SetScalarTypeToUnsignedShort()
00292 {this->SetScalarType(VTK_UNSIGNED_SHORT);};
00293 void SetScalarTypeToUnsignedChar()
00294 {this->SetScalarType(VTK_UNSIGNED_CHAR);};
00295 void SetScalarTypeToChar()
00296 {this->SetScalarType(VTK_CHAR);};
00297 void SetScalarType(int);
00298 int GetScalarType();
00299 const char* GetScalarTypeAsString() { return vtkImageScalarTypeNameMacro ( this->GetScalarType() ); };
00301
00303 int GetPipelineScalarType();
00304
00306 int GetPipelineNumberOfScalarComponents();
00307
00309
00310 void SetNumberOfScalarComponents( int n );
00311 int GetNumberOfScalarComponents();
00313
00314
00315 void CopyTypeSpecificInformation( vtkDataObject *image );
00316
00320 virtual void PrepareForNewData();
00321
00323
00324 void ShallowCopy(vtkDataObject *src);
00325 void DeepCopy(vtkDataObject *src);
00327
00328
00329
00330
00331
00332
00334
00337 void *GetArrayPointerForExtent(vtkDataArray* array, int extent[6]);
00338 void *GetArrayPointer(vtkDataArray* array, int coordinates[3]);
00340
00343 void GetArrayIncrements(vtkDataArray *array, int increments[3]);
00344
00349 void ComputeInternalExtent(int *intExt, int *tgtExt, int *bnds);
00350
00352 int GetExtentType() { return VTK_3D_EXTENT; };
00353
00354 protected:
00355 vtkImageData();
00356 ~vtkImageData();
00357
00358
00359 vtkVertex *Vertex;
00360 vtkLine *Line;
00361 vtkPixel *Pixel;
00362 vtkVoxel *Voxel;
00363
00364
00365
00366
00367 int Dimensions[3];
00368 int DataDescription;
00369 int Increments[3];
00370
00371 double Origin[3];
00372 double Spacing[3];
00373
00374 void ComputeIncrements();
00375 virtual void CopyPipelineInformation(vtkInformation* oldPInfo,
00376 vtkInformation* newPInfo);
00377
00378 private:
00379 void InternalImageDataCopy(vtkImageData *src);
00380 private:
00381 vtkImageData(const vtkImageData&);
00382 void operator=(const vtkImageData&);
00383 };
00384
00385
00386 inline void vtkImageData::GetPoint(vtkIdType id, double x[3])
00387 {
00388 double *p=this->GetPoint(id);
00389 x[0] = p[0]; x[1] = p[1]; x[2] = p[2];
00390 }
00391
00392
00393
00394 inline vtkIdType vtkImageData::GetNumberOfPoints()
00395 {
00396 int *dims = this->GetDimensions();
00397 return dims[0]*dims[1]*dims[2];
00398 }
00399
00400 inline int vtkImageData::GetDataDimension()
00401 {
00402 return vtkStructuredData::GetDataDimension(this->DataDescription);
00403 }
00404
00405 #endif
00406
00407
00408