00001
00002
00003
00004
00005
00006
00007
00008
00009
00010
00011
00012
00013
00014
00015
00034
#ifndef __vtkImageData_h
00035
#define __vtkImageData_h
00036
00037
#include "vtkDataSet.h"
00038
00039
#include "vtkStructuredData.h"
00040
00041
class vtkDataArray;
00042
class vtkLine;
00043
class vtkPixel;
00044
class vtkVertex;
00045
class vtkVoxel;
00046
00047 class VTK_COMMON_EXPORT vtkImageData :
public vtkDataSet
00048 {
00049
public:
00050
static vtkImageData *
New();
00051
00052 vtkTypeRevisionMacro(vtkImageData,
vtkDataSet);
00053
void PrintSelf(ostream& os,
vtkIndent indent);
00054
00057
void CopyStructure(
vtkDataSet *ds);
00058
00060 int GetDataObjectType() {
return VTK_IMAGE_DATA;};
00061
00064
void UpdateData();
00065
00067
00068
vtkIdType GetNumberOfCells();
00069
vtkIdType GetNumberOfPoints();
00070
float *
GetPoint(
vtkIdType ptId);
00071
void GetPoint(
vtkIdType id,
float x[3]);
00072
vtkCell *
GetCell(
vtkIdType cellId);
00073
void GetCell(
vtkIdType cellId,
vtkGenericCell *cell);
00074
void GetCellBounds(
vtkIdType cellId,
float bounds[6]);
00075 vtkIdType FindPoint(
float x,
float y,
float z) {
return this->
vtkDataSet::FindPoint(x, y, z);};
00076
vtkIdType FindPoint(
float x[3]);
00077
vtkIdType FindCell(
float x[3],
vtkCell *cell,
vtkIdType cellId,
float tol2,
00078
int& subId,
float pcoords[3],
float *weights);
00079
vtkIdType FindCell(
float x[3],
vtkCell *cell,
vtkGenericCell *gencell,
00080
vtkIdType cellId,
float tol2,
int& subId,
00081
float pcoords[3],
float *weights);
00082
vtkCell *
FindAndGetCell(
float x[3],
vtkCell *cell,
vtkIdType cellId,
00083
float tol2,
int& subId,
float pcoords[3],
00084
float *weights);
00085
int GetCellType(
vtkIdType cellId);
00086 void GetCellPoints(
vtkIdType cellId,
vtkIdList *ptIds)
00087 {
vtkStructuredData::GetCellPoints(cellId,ptIds,this->DataDescription,
00088 this->GetDimensions());}
00089 void GetPointCells(
vtkIdType ptId,
vtkIdList *cellIds)
00090 {
vtkStructuredData::GetPointCells(ptId,cellIds,this->GetDimensions());}
00091
void ComputeBounds();
00092 int GetMaxCellSize() {
return 8;};
00094
00096
void SetDimensions(
int i,
int j,
int k);
00097
00099
void SetDimensions(
int dims[3]);
00100
00102
00104
int *GetDimensions();
00105
void GetDimensions(
int dims[3]);
00107
00113
int ComputeStructuredCoordinates(
float x[3],
int ijk[3],
float pcoords[3]);
00114
00123
void GetVoxelGradient(
int i,
int j,
int k,
vtkDataArray *s,
vtkDataArray *g);
00124
00130
void GetPointGradient(
int i,
int j,
int k,
vtkDataArray *s,
float g[3]);
00131
00133
int GetDataDimension();
00134
00136
00138 vtkIdType ComputePointId(
int ijk[3]) {
00139
return vtkStructuredData::ComputePointId(this->GetDimensions(),ijk);};
00141
00143
00145 vtkIdType ComputeCellId(
int ijk[3]) {
00146
return vtkStructuredData::ComputeCellId(this->GetDimensions(),ijk);};
00148
00150
00151
void SetAxisUpdateExtent(
int axis,
int min,
int max);
00152
void GetAxisUpdateExtent(
int axis,
int &min,
int &max);
00154
00156
00159
void SetUpdateExtent(
int piece,
int numPieces,
int ghostLevel);
00160 void SetUpdateExtent(
int piece,
int numPieces)
00161 {this->
SetUpdateExtent(piece, numPieces, 0);}
00163
00165
00166 void SetUpdateExtent(
int x1,
int x2,
int y1,
int y2,
int z1,
int z2 )
00167 { this->
vtkDataSet::SetUpdateExtent( x1, x2, y1, y2, z1, z2 ); };
00168 void SetUpdateExtent(
int ext[6] )
00169 { this->
vtkDataSet::SetUpdateExtent( ext ); };
00171
00173
00176
void SetExtent(
int extent[6]);
00177
void SetExtent(
int x1,
int x2,
int y1,
int y2,
int z1,
int z2);
00178 vtkGetVector6Macro(Extent,
int);
00180
00185
virtual unsigned long GetEstimatedMemorySize();
00186
00188
00190
double GetScalarTypeMin();
00191
double GetScalarTypeMax();
00193
00195
int GetScalarSize();
00196
00198
00201
int *GetIncrements();
00202
void GetIncrements(
int &incX,
int &incY,
int &incZ);
00203
void GetIncrements(
int inc[3]);
00205
00215
void GetContinuousIncrements(
int extent[6],
int &incX,
int &incY,
int &incZ);
00216
00218
00219
void *GetScalarPointerForExtent(
int extent[6]);
00220
void *GetScalarPointer(
int coordinates[3]);
00221
void *GetScalarPointer(
int x,
int y,
int z);
00222
void *GetScalarPointer();
00224
00226
00227
float GetScalarComponentAsFloat(
int x,
int y,
int z,
int component);
00228
void SetScalarComponentFromFloat(
int x,
int y,
int z,
int component,
float v);
00230
00232
void AllocateScalars();
00233
00235
00239
void CopyAndCastFrom(vtkImageData *inData,
int extent[6]);
00240 void CopyAndCastFrom(vtkImageData *inData,
int x0,
int x1,
00241
int y0,
int y1,
int z0,
int z1)
00242 {
int e[6]; e[0]=x0; e[1]=x1; e[2]=y0; e[3]=y1; e[4]=z0; e[5]=z1;
00243 this->CopyAndCastFrom(inData, e);}
00245
00249
virtual void Crop();
00250
00256
unsigned long GetActualMemorySize();
00257
00259
00261 vtkSetVector3Macro(Spacing,
float);
00262 vtkGetVector3Macro(Spacing,
float);
00264
00266
00268 vtkSetVector3Macro(Origin,
float);
00269 vtkGetVector3Macro(Origin,
float);
00271
00273
00274 void SetScalarTypeToFloat(){this->SetScalarType(
VTK_FLOAT);};
00275 void SetScalarTypeToDouble(){this->SetScalarType(
VTK_DOUBLE);};
00276 void SetScalarTypeToInt(){this->SetScalarType(
VTK_INT);};
00277 void SetScalarTypeToUnsignedInt()
00278 {this->SetScalarType(
VTK_UNSIGNED_INT);};
00279 void SetScalarTypeToLong(){this->SetScalarType(
VTK_LONG);};
00280 void SetScalarTypeToUnsignedLong()
00281 {this->SetScalarType(
VTK_UNSIGNED_LONG);};
00282 void SetScalarTypeToShort(){this->SetScalarType(
VTK_SHORT);};
00283 void SetScalarTypeToUnsignedShort()
00284 {this->SetScalarType(
VTK_UNSIGNED_SHORT);};
00285 void SetScalarTypeToUnsignedChar()
00286 {this->SetScalarType(
VTK_UNSIGNED_CHAR);};
00287 void SetScalarTypeToChar()
00288 {this->SetScalarType(
VTK_CHAR);};
00289 vtkSetMacro(ScalarType,
int);
00290
int GetScalarType();
00291 const char* GetScalarTypeAsString() {
return vtkImageScalarTypeNameMacro ( this->GetScalarType() ); };
00293
00295
00296
void SetNumberOfScalarComponents(
int n );
00297 vtkGetMacro(NumberOfScalarComponents,
int);
00299
00300
00301
void CopyTypeSpecificInformation(
vtkDataObject *image );
00302
00306
virtual void PrepareForNewData();
00307
00309
00310
void ShallowCopy(
vtkDataObject *src);
00311
void DeepCopy(
vtkDataObject *src);
00313
00314
00315
00316
00317
00318
00320
00323
void *GetArrayPointerForExtent(
vtkDataArray* array,
int extent[6]);
00324
void *GetArrayPointer(
vtkDataArray* array,
int coordinates[3]);
00326
00329
void GetArrayIncrements(
vtkDataArray *array,
int increments[3]);
00330
00335
void ComputeInternalExtent(
int *intExt,
int *tgtExt,
int *bnds);
00336
00337
protected:
00338 vtkImageData();
00339 ~vtkImageData();
00340
00341
00342 vtkVertex *Vertex;
00343 vtkLine *Line;
00344 vtkPixel *Pixel;
00345 vtkVoxel *Voxel;
00346
00347
00348 int GetExtentType() {
return VTK_3D_EXTENT; };
00349
00350
00351
00352
00353 int Dimensions[3];
00354 int DataDescription;
00355 int Increments[3];
00356
00357 float Origin[3];
00358 float Spacing[3];
00359 int ScalarType;
00360 int NumberOfScalarComponents;
00361
00362
void ComputeIncrements();
00363
00364
private:
00365
void InternalImageDataCopy(vtkImageData *src);
00366
private:
00367 vtkImageData(
const vtkImageData&);
00368
void operator=(
const vtkImageData&);
00369 };
00370
00371
00372 inline void vtkImageData::GetPoint(
vtkIdType id,
float x[3])
00373 {
00374
float *p=this->
GetPoint(
id);
00375 x[0] = p[0]; x[1] = p[1]; x[2] = p[2];
00376 }
00377
00378
00379
00380 inline vtkIdType vtkImageData::GetNumberOfPoints()
00381 {
00382
int *dims = this->
GetDimensions();
00383
return dims[0]*dims[1]*dims[2];
00384 }
00385
00386 inline int vtkImageData::GetDataDimension()
00387 {
00388
return vtkStructuredData::GetDataDimension(this->DataDescription);
00389 }
00390
00391
#endif
00392
00393
00394