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
00058 #ifndef __vtkImageData_h
00059 #define __vtkImageData_h
00060
00061 #include "vtkDataSet.h"
00062 #include "vtkStructuredData.h"
00063 class vtkVertex;
00064 class vtkLine;
00065 class vtkPixel;
00066 class vtkVoxel;
00067
00068
00069 class VTK_COMMON_EXPORT vtkImageData : public vtkDataSet
00070 {
00071 public:
00072 static vtkImageData *New();
00073
00074 vtkTypeMacro(vtkImageData,vtkDataSet);
00075 void PrintSelf(ostream& os, vtkIndent indent);
00076
00078 vtkDataObject *MakeObject() {return vtkImageData::New();};
00079
00082 void CopyStructure(vtkDataSet *ds);
00083
00085 int GetDataObjectType() {return VTK_IMAGE_DATA;};
00086
00089 void UpdateData();
00090
00092
00093 vtkIdType GetNumberOfCells();
00094 vtkIdType GetNumberOfPoints();
00095 float *GetPoint(vtkIdType ptId);
00096 void GetPoint(vtkIdType id, float x[3]);
00097 vtkCell *GetCell(vtkIdType cellId);
00098 void GetCell(vtkIdType cellId, vtkGenericCell *cell);
00099 void GetCellBounds(vtkIdType cellId, float bounds[6]);
00100 vtkIdType FindPoint(float x, float y, float z) { return this->vtkDataSet::FindPoint(x, y, z);};
00101 vtkIdType FindPoint(float x[3]);
00102 vtkIdType FindCell(float x[3], vtkCell *cell, vtkIdType cellId, float tol2,
00103 int& subId, float pcoords[3], float *weights);
00104 vtkIdType FindCell(float x[3], vtkCell *cell, vtkGenericCell *gencell,
00105 vtkIdType cellId, float tol2, int& subId,
00106 float pcoords[3], float *weights);
00107 vtkCell *FindAndGetCell(float x[3], vtkCell *cell, vtkIdType cellId,
00108 float tol2, int& subId, float pcoords[3],
00109 float *weights);
00110 int GetCellType(vtkIdType cellId);
00111 void GetCellPoints(vtkIdType cellId, vtkIdList *ptIds)
00112 {vtkStructuredData::GetCellPoints(cellId,ptIds,this->DataDescription,
00113 this->GetDimensions());}
00114 void GetPointCells(vtkIdType ptId, vtkIdList *cellIds)
00115 {vtkStructuredData::GetPointCells(ptId,cellIds,this->GetDimensions());}
00116 void ComputeBounds();
00117 int GetMaxCellSize() {return 8;};
00119
00121 void SetDimensions(int i, int j, int k);
00122
00124 void SetDimensions(int dims[3]);
00125
00127
00129 int *GetDimensions();
00130 void GetDimensions(int dims[3]);
00132
00138 int ComputeStructuredCoordinates(float x[3], int ijk[3], float pcoords[3]);
00139
00148 void GetVoxelGradient(int i,int j,int k, vtkDataArray *s, vtkDataArray *g);
00149
00155 void GetPointGradient(int i, int j, int k, vtkDataArray *s, float g[3]);
00156
00158 int GetDataDimension();
00159
00161
00163 vtkIdType ComputePointId(int ijk[3]) {
00164 return vtkStructuredData::ComputePointId(this->GetDimensions(),ijk);};
00166
00168
00170 vtkIdType ComputeCellId(int ijk[3]) {
00171 return vtkStructuredData::ComputeCellId(this->GetDimensions(),ijk);};
00173
00175
00176 void SetAxisUpdateExtent(int axis, int min, int max);
00177 void GetAxisUpdateExtent(int axis, int &min, int &max);
00179
00181
00184 void SetUpdateExtent(int piece, int numPieces, int ghostLevel);
00185 void SetUpdateExtent(int piece, int numPieces)
00186 {this->SetUpdateExtent(piece, numPieces, 0);}
00188
00190
00191 void SetUpdateExtent( int x1, int x2, int y1, int y2, int z1, int z2 )
00192 { this->vtkDataSet::SetUpdateExtent( x1, x2, y1, y2, z1, z2 ); };
00193 void SetUpdateExtent( int ext[6] )
00194 { this->vtkDataSet::SetUpdateExtent( ext ); };
00196
00198
00201 void SetExtent(int extent[6]);
00202 void SetExtent(int x1, int x2, int y1, int y2, int z1, int z2);
00203 vtkGetVector6Macro(Extent,int);
00205
00210 virtual unsigned long GetEstimatedMemorySize();
00211
00213
00215 double GetScalarTypeMin();
00216 double GetScalarTypeMax();
00218
00220 int GetScalarSize();
00221
00223
00226 int *GetIncrements();
00227 void GetIncrements(int &incX, int &incY, int &incZ);
00228 void GetIncrements(int inc[3]);
00230
00232
00236 void GetContinuousIncrements(int extent[6], int &incX, int &incY,
00237 int &incZ);
00239
00241
00242 void *GetScalarPointerForExtent(int coordinates[6]);
00243 void *GetScalarPointer(int coordinates[3]);
00244 void *GetScalarPointer(int x, int y, int z);
00245 void *GetScalarPointer();
00247
00249 float GetScalarComponentAsFloat(int x, int y, int z, int component);
00250
00252 void AllocateScalars();
00253
00255
00259 void CopyAndCastFrom(vtkImageData *inData, int extent[6]);
00260 void CopyAndCastFrom(vtkImageData *inData, int x0, int x1,
00261 int y0, int y1, int z0, int z1)
00262 {int e[6]; e[0]=x0; e[1]=x1; e[2]=y0; e[3]=y1; e[4]=z0; e[5]=z1;
00263 this->CopyAndCastFrom(inData, e);}
00265
00269 virtual void Crop();
00270
00276 unsigned long GetActualMemorySize();
00277
00279
00281 vtkSetVector3Macro(Spacing,float);
00282 vtkGetVector3Macro(Spacing,float);
00284
00286
00288 vtkSetVector3Macro(Origin,float);
00289 vtkGetVector3Macro(Origin,float);
00291
00293
00294 void SetScalarTypeToFloat(){this->SetScalarType(VTK_FLOAT);};
00295 void SetScalarTypeToDouble(){this->SetScalarType(VTK_DOUBLE);};
00296 void SetScalarTypeToInt(){this->SetScalarType(VTK_INT);};
00297 void SetScalarTypeToUnsignedInt()
00298 {this->SetScalarType(VTK_UNSIGNED_INT);};
00299 void SetScalarTypeToLong(){this->SetScalarType(VTK_LONG);};
00300 void SetScalarTypeToUnsignedLong()
00301 {this->SetScalarType(VTK_UNSIGNED_LONG);};
00302 void SetScalarTypeToShort(){this->SetScalarType(VTK_SHORT);};
00303 void SetScalarTypeToUnsignedShort()
00304 {this->SetScalarType(VTK_UNSIGNED_SHORT);};
00305 void SetScalarTypeToUnsignedChar()
00306 {this->SetScalarType(VTK_UNSIGNED_CHAR);};
00307 void SetScalarTypeToChar()
00308 {this->SetScalarType(VTK_CHAR);};
00309 vtkSetMacro(ScalarType, int);
00310 int GetScalarType();
00312
00314
00315 void SetNumberOfScalarComponents( int n );
00316 vtkGetMacro(NumberOfScalarComponents,int);
00318
00319
00320 void CopyTypeSpecificInformation( vtkDataObject *image );
00321
00325 virtual void PrepareForNewData();
00326
00328
00329 void ShallowCopy(vtkDataObject *src);
00330 void DeepCopy(vtkDataObject *src);
00332
00333 protected:
00334 vtkImageData();
00335 ~vtkImageData();
00336
00337
00338 vtkVertex *Vertex;
00339 vtkLine *Line;
00340 vtkPixel *Pixel;
00341 vtkVoxel *Voxel;
00342
00343
00344 int GetExtentType() { return VTK_3D_EXTENT; };
00345
00346
00347
00348
00349 int Dimensions[3];
00350 int DataDescription;
00351 int Increments[3];
00352
00353 float Origin[3];
00354 float Spacing[3];
00355 int ScalarType;
00356 int NumberOfScalarComponents;
00357
00358 void ComputeIncrements();
00359
00360 private:
00361 void InternalImageDataCopy(vtkImageData *src);
00362 private:
00363 vtkImageData(const vtkImageData&);
00364 void operator=(const vtkImageData&);
00365 };
00366
00367
00368 inline void vtkImageData::GetPoint(vtkIdType id, float x[3])
00369 {
00370 float *p=this->GetPoint(id);
00371 x[0] = p[0]; x[1] = p[1]; x[2] = p[2];
00372 }
00373
00374
00375
00376 inline vtkIdType vtkImageData::GetNumberOfPoints()
00377 {
00378 int *dims = this->GetDimensions();
00379 return dims[0]*dims[1]*dims[2];
00380 }
00381
00382 inline int vtkImageData::GetDataDimension()
00383 {
00384 return vtkStructuredData::GetDataDimension(this->DataDescription);
00385 }
00386
00387 #endif
00388
00389
00390