00001
00002
00003
00004
00005
00006
00007
00008
00009
00010
00011
00012
00013
00014
00030 #ifndef __vtkImageData_h
00031 #define __vtkImageData_h
00032
00033 #include "vtkDataSet.h"
00034
00035 #include "vtkStructuredData.h"
00036
00037 class vtkDataArray;
00038 class vtkLine;
00039 class vtkPixel;
00040 class vtkVertex;
00041 class vtkVoxel;
00042
00043 class VTK_FILTERING_EXPORT vtkImageData : public vtkDataSet
00044 {
00045 public:
00046 static vtkImageData *New();
00047
00048 vtkTypeRevisionMacro(vtkImageData,vtkDataSet);
00049 void PrintSelf(ostream& os, vtkIndent indent);
00050
00053 virtual void CopyStructure(vtkDataSet *ds);
00054
00056 virtual int GetDataObjectType() {return VTK_IMAGE_DATA;};
00057
00059
00060 virtual vtkIdType GetNumberOfCells();
00061 virtual vtkIdType GetNumberOfPoints();
00062 virtual double *GetPoint(vtkIdType ptId);
00063 virtual void GetPoint(vtkIdType id, double x[3]);
00064 virtual vtkCell *GetCell(vtkIdType cellId);
00065 virtual void GetCell(vtkIdType cellId, vtkGenericCell *cell);
00066 virtual void GetCellBounds(vtkIdType cellId, double bounds[6]);
00067 virtual vtkIdType FindPoint(double x, double y, double z)
00068 {
00069 return this->vtkDataSet::FindPoint(x, y, z);
00070 };
00071 virtual vtkIdType FindPoint(double x[3]);
00072 virtual vtkIdType FindCell(
00073 double x[3], vtkCell *cell, vtkIdType cellId, double tol2,
00074 int& subId, double pcoords[3], double *weights);
00075 virtual vtkIdType FindCell(
00076 double x[3], vtkCell *cell, vtkGenericCell *gencell,
00077 vtkIdType cellId, double tol2, int& subId,
00078 double pcoords[3], double *weights);
00079 virtual vtkCell *FindAndGetCell(double x[3], vtkCell *cell, vtkIdType cellId,
00080 double tol2, int& subId, double pcoords[3],
00081 double *weights);
00082 virtual int GetCellType(vtkIdType cellId);
00083 virtual void GetCellPoints(vtkIdType cellId, vtkIdList *ptIds)
00084 {vtkStructuredData::GetCellPoints(cellId,ptIds,this->DataDescription,
00085 this->GetDimensions());}
00086 virtual void GetPointCells(vtkIdType ptId, vtkIdList *cellIds)
00087 {vtkStructuredData::GetPointCells(ptId,cellIds,this->GetDimensions());}
00088 virtual void ComputeBounds();
00089 virtual int GetMaxCellSize() {return 8;};
00091
00093 virtual void Initialize();
00094
00096 virtual void SetDimensions(int i, int j, int k);
00097
00099 virtual void SetDimensions(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::ComputePointId(this->GetDimensions(),ijk);};
00151
00153
00155 virtual vtkIdType ComputeCellId(int ijk[3]) {
00156 return vtkStructuredData::ComputeCellId(this->GetDimensions(),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
00175 virtual void SetExtent(int extent[6]);
00176 virtual void SetExtent(int x1, int x2, int y1, int y2, int z1, int z2);
00177 vtkGetVector6Macro(Extent, int);
00179
00184 virtual unsigned long GetEstimatedMemorySize();
00185
00187
00189 virtual double GetScalarTypeMin();
00190 virtual double GetScalarTypeMax();
00192
00194 virtual int GetScalarSize();
00195
00197
00200 virtual vtkIdType *GetIncrements();
00201 virtual void GetIncrements(vtkIdType &incX, vtkIdType &incY, vtkIdType &incZ);
00202 virtual void GetIncrements(vtkIdType inc[3]);
00204
00206
00215 virtual void GetContinuousIncrements(
00216 int extent[6], vtkIdType &incX, vtkIdType &incY, vtkIdType &incZ);
00218
00220
00221 virtual void *GetScalarPointerForExtent(int extent[6]);
00222 virtual void *GetScalarPointer(int coordinates[3]);
00223 virtual void *GetScalarPointer(int x, int y, int z);
00224 virtual void *GetScalarPointer();
00226
00228
00229 virtual float GetScalarComponentAsFloat(int x, int y, int z, int component);
00230 virtual void SetScalarComponentFromFloat(
00231 int x, int y, int z, int component, float v);
00232 virtual double GetScalarComponentAsDouble(int x, int y, int z, int component);
00233 virtual void SetScalarComponentFromDouble(
00234 int x, int y, int z, int component, double v);
00236
00238 virtual void AllocateScalars();
00239
00241
00245 virtual void CopyAndCastFrom(vtkImageData *inData, int extent[6]);
00246 virtual void CopyAndCastFrom(vtkImageData *inData, int x0, int x1,
00247 int y0, int y1, int z0, int z1)
00248 {int e[6]; e[0]=x0; e[1]=x1; e[2]=y0; e[3]=y1; e[4]=z0; e[5]=z1;
00249 this->CopyAndCastFrom(inData, e);}
00251
00255 virtual void Crop();
00256
00262 virtual unsigned long GetActualMemorySize();
00263
00265
00267 vtkSetVector3Macro(Spacing,double);
00268 vtkGetVector3Macro(Spacing,double);
00270
00272
00274 vtkSetVector3Macro(Origin,double);
00275 vtkGetVector3Macro(Origin,double);
00277
00279
00284 void SetScalarTypeToFloat(){this->SetScalarType(VTK_FLOAT);};
00285 void SetScalarTypeToDouble(){this->SetScalarType(VTK_DOUBLE);};
00286 void SetScalarTypeToInt(){this->SetScalarType(VTK_INT);};
00287 void SetScalarTypeToUnsignedInt()
00288 {this->SetScalarType(VTK_UNSIGNED_INT);};
00289 void SetScalarTypeToLong(){this->SetScalarType(VTK_LONG);};
00290 void SetScalarTypeToUnsignedLong()
00291 {this->SetScalarType(VTK_UNSIGNED_LONG);};
00292 void SetScalarTypeToShort(){this->SetScalarType(VTK_SHORT);};
00293 void SetScalarTypeToUnsignedShort()
00294 {this->SetScalarType(VTK_UNSIGNED_SHORT);};
00295 void SetScalarTypeToUnsignedChar()
00296 {this->SetScalarType(VTK_UNSIGNED_CHAR);};
00297 void SetScalarTypeToChar()
00298 {this->SetScalarType(VTK_CHAR);};
00299 void SetScalarType(int);
00300 int GetScalarType();
00301 const char* GetScalarTypeAsString()
00302 { return vtkImageScalarTypeNameMacro ( this->GetScalarType() ); };
00304
00306
00308 void SetNumberOfScalarComponents( int n );
00309 int GetNumberOfScalarComponents();
00311
00312
00313 virtual void CopyTypeSpecificInformation( vtkDataObject *image );
00314
00316
00318 virtual void CopyInformationToPipeline(vtkInformation* request,
00319 vtkInformation* input);
00320 virtual void CopyInformationFromPipeline(vtkInformation* request);
00322
00326 virtual void PrepareForNewData();
00327
00329
00330 virtual void ShallowCopy(vtkDataObject *src);
00331 virtual void DeepCopy(vtkDataObject *src);
00333
00334
00335
00336
00337
00338
00340
00343 void *GetArrayPointerForExtent(vtkDataArray* array, int extent[6]);
00344 void *GetArrayPointer(vtkDataArray* array, int coordinates[3]);
00346
00349 void GetArrayIncrements(vtkDataArray *array, vtkIdType increments[3]);
00350
00355 void ComputeInternalExtent(int *intExt, int *tgtExt, int *bnds);
00356
00358 virtual int GetExtentType() { return VTK_3D_EXTENT; };
00359
00360
00362
00363 static vtkImageData* GetData(vtkInformation* info);
00364 static vtkImageData* GetData(vtkInformationVector* v, int i=0);
00365
00367
00368 protected:
00369 vtkImageData();
00370 ~vtkImageData();
00371
00372
00373 vtkVertex *Vertex;
00374 vtkLine *Line;
00375 vtkPixel *Pixel;
00376 vtkVoxel *Voxel;
00377
00378
00379
00380
00381 int Dimensions[3];
00382 int DataDescription;
00383 vtkIdType Increments[3];
00384
00385 double Origin[3];
00386 double Spacing[3];
00387
00388 int Extent[6];
00389
00390 void ComputeIncrements();
00391 void CopyOriginAndSpacingFromPipeline();
00392
00393 vtkTimeStamp ExtentComputeTime;
00394
00395 private:
00396 void InternalImageDataCopy(vtkImageData *src);
00397 private:
00398 vtkImageData(const vtkImageData&);
00399 void operator=(const vtkImageData&);
00400 };
00401
00402
00403 inline void vtkImageData::GetPoint(vtkIdType id, double x[3])
00404 {
00405 double *p=this->GetPoint(id);
00406 x[0] = p[0]; x[1] = p[1]; x[2] = p[2];
00407 }
00408
00409
00410
00411 inline vtkIdType vtkImageData::GetNumberOfPoints()
00412 {
00413 int *dims = this->GetDimensions();
00414 return dims[0]*dims[1]*dims[2];
00415 }
00416
00417 inline int vtkImageData::GetDataDimension()
00418 {
00419 return vtkStructuredData::GetDataDimension(this->DataDescription);
00420 }
00421
00422 #endif
00423
00424
00425