1 /*=========================================================================
2 
3   Program:   Visualization Toolkit
4   Module:    vtkImageData.h
5 
6   Copyright (c) Ken Martin, Will Schroeder, Bill Lorensen
7   All rights reserved.
8   See Copyright.txt or http://www.kitware.com/Copyright.htm for details.
9 
10      This software is distributed WITHOUT ANY WARRANTY; without even
11      the implied warranty of MERCHANTABILITY or FITNESS FOR A PARTICULAR
12      PURPOSE.  See the above copyright notice for more information.
13 
14 =========================================================================*/
15 /**
16  * @class   vtkImageData
17  * @brief   topologically and geometrically regular array of data
18  *
19  * vtkImageData is a data object that is a concrete implementation of
20  * vtkDataSet. vtkImageData represents a geometric structure that is
21  * a topological and geometrical regular array of points. Examples include
22  * volumes (voxel data) and pixmaps. This representation supports images
23  * up to three dimensions. The image may also be oriented (see the
24  * DirectionMatrices and related transformation methods). Note however,
25  * that not all filters support oriented images.
26  *
27  * @sa
28  * vtkImageTransform
29  */
30 
31 #ifndef vtkImageData_h
32 #define vtkImageData_h
33 
34 #include "vtkCommonDataModelModule.h" // For export macro
35 #include "vtkDataSet.h"
36 
37 #include "vtkStructuredData.h" // Needed for inline methods
38 
39 class vtkDataArray;
40 class vtkLine;
41 class vtkMatrix3x3;
42 class vtkMatrix4x4;
43 class vtkPixel;
44 class vtkVertex;
45 class vtkVoxel;
46 
47 class VTKCOMMONDATAMODEL_EXPORT vtkImageData : public vtkDataSet
48 {
49 public:
50   static vtkImageData* New();
51   static vtkImageData* ExtendedNew();
52 
53   vtkTypeMacro(vtkImageData, vtkDataSet);
54   void PrintSelf(ostream& os, vtkIndent indent) override;
55 
56   /**
57    * Copy the geometric and topological structure of an input image data
58    * object.
59    */
60   void CopyStructure(vtkDataSet* ds) override;
61 
62   /**
63    * Return what type of dataset this is.
64    */
GetDataObjectType()65   int GetDataObjectType() override { return VTK_IMAGE_DATA; }
66 
67   ///@{
68   /**
69    * Standard vtkDataSet API methods. See vtkDataSet for more information.
70    * \warning If GetCell(int,int,int) gets overridden in a subclass, it is
71    * necessary to override GetCell(vtkIdType) in that class as well since
72    * vtkImageData::GetCell(vtkIdType) will always call
73    * vkImageData::GetCell(int,int,int)
74    */
75   vtkIdType GetNumberOfCells() override;
76   vtkIdType GetNumberOfPoints() override;
77   double* GetPoint(vtkIdType ptId) VTK_SIZEHINT(3) override;
78   void GetPoint(vtkIdType id, double x[3]) override;
79   vtkCell* GetCell(vtkIdType cellId) override;
80   vtkCell* GetCell(int i, int j, int k) override;
81   void GetCell(vtkIdType cellId, vtkGenericCell* cell) override;
82   void GetCellBounds(vtkIdType cellId, double bounds[6]) override;
FindPoint(double x,double y,double z)83   virtual vtkIdType FindPoint(double x, double y, double z)
84   {
85     return this->vtkDataSet::FindPoint(x, y, z);
86   }
87   vtkIdType FindPoint(double x[3]) override;
88   vtkIdType FindCell(double x[3], vtkCell* cell, vtkIdType cellId, double tol2, int& subId,
89     double pcoords[3], double* weights) override;
90   vtkIdType FindCell(double x[3], vtkCell* cell, vtkGenericCell* gencell, vtkIdType cellId,
91     double tol2, int& subId, double pcoords[3], double* weights) override;
92   vtkCell* FindAndGetCell(double x[3], vtkCell* cell, vtkIdType cellId, double tol2, int& subId,
93     double pcoords[3], double* weights) override;
94   int GetCellType(vtkIdType cellId) override;
GetCellPoints(vtkIdType cellId,vtkIdList * ptIds)95   void GetCellPoints(vtkIdType cellId, vtkIdList* ptIds) override
96   {
97     int dimensions[3];
98     this->GetDimensions(dimensions);
99     vtkStructuredData::GetCellPoints(cellId, ptIds, this->DataDescription, dimensions);
100   }
GetPointCells(vtkIdType ptId,vtkIdList * cellIds)101   void GetPointCells(vtkIdType ptId, vtkIdList* cellIds) override
102   {
103     int dimensions[3];
104     this->GetDimensions(dimensions);
105     vtkStructuredData::GetPointCells(ptId, cellIds, dimensions);
106   }
107   void ComputeBounds() override;
GetMaxCellSize()108   int GetMaxCellSize() override { return 8; } // voxel is the largest
109   void GetCellNeighbors(vtkIdType cellId, vtkIdList* ptIds, vtkIdList* cellIds) override;
110   ///@}
111 
112   /**
113    * Get cell neighbors around cell located at `seedloc`, except cell of id `cellId`.
114    *
115    * @warning `seedloc` is the position in the grid with the origin shifted to (0, 0, 0).
116    * This is because the backend of this method is shared with `vtkRectilinearGrid` and
117    * `vtkStructuredGrid`.
118    */
119   void GetCellNeighbors(vtkIdType cellId, vtkIdList* ptIds, vtkIdList* cellIds, int* seedLoc);
120 
121   /**
122    * Restore data object to initial state.
123    */
124   void Initialize() override;
125 
126   /**
127    * Return non-zero value if specified point is visible.
128    * These methods should be called only after the dimensions of the
129    * grid are set.
130    */
131   unsigned char IsPointVisible(vtkIdType ptId);
132 
133   /**
134    * Return non-zero value if specified point is visible.
135    * These methods should be called only after the dimensions of the
136    * grid are set.
137    */
138   unsigned char IsCellVisible(vtkIdType cellId);
139 
140   /**
141    * Returns 1 if there is any visibility constraint on the points,
142    * 0 otherwise.
143    */
144   bool HasAnyBlankPoints() override;
145   /**
146    * Returns 1 if there is any visibility constraint on the cells,
147    * 0 otherwise.
148    */
149   bool HasAnyBlankCells() override;
150 
151   /**
152    * Given the node dimensions of this grid instance, this method computes the
153    * node dimensions. The value in each dimension can will have a lowest value
154    * of "1" such that computing the total number of cells can be achieved by
155    * simply by cellDims[0]*cellDims[1]*cellDims[2].
156    */
157   void GetCellDims(int cellDims[3]);
158 
159   /**
160    * Same as SetExtent(0, i-1, 0, j-1, 0, k-1)
161    */
162   virtual void SetDimensions(int i, int j, int k);
163 
164   /**
165    * Same as SetExtent(0, dims[0]-1, 0, dims[1]-1, 0, dims[2]-1)
166    */
167   virtual void SetDimensions(const int dims[3]);
168 
169   /**
170    * Get dimensions of this structured points dataset.
171    * It is the number of points on each axis.
172    * Dimensions are computed from Extents during this call.
173    * \warning Non thread-safe, use second signature if you want it to be.
174    */
175   virtual int* GetDimensions() VTK_SIZEHINT(3);
176 
177   /**
178    * Get dimensions of this structured points dataset.
179    * It is the number of points on each axis.
180    * This method is thread-safe.
181    * \warning The Dimensions member variable is not updated during this call.
182    */
183   virtual void GetDimensions(int dims[3]);
184 #if VTK_ID_TYPE_IMPL != VTK_INT
185   virtual void GetDimensions(vtkIdType dims[3]);
186 #endif
187 
188   /**
189    * Convenience function computes the structured coordinates for a point x[3].
190    * The voxel is specified by the array ijk[3], and the parametric coordinates
191    * in the cell are specified with pcoords[3]. The function returns a 0 if the
192    * point x is outside of the volume, and a 1 if inside the volume.
193    */
194   virtual int ComputeStructuredCoordinates(const double x[3], int ijk[3], double pcoords[3]);
195 
196   /**
197    * Given structured coordinates (i,j,k) for a voxel cell, compute the eight
198    * gradient values for the voxel corners. The order in which the gradient
199    * vectors are arranged corresponds to the ordering of the voxel points.
200    * Gradient vector is computed by central differences (except on edges of
201    * volume where forward difference is used). The scalars s are the scalars
202    * from which the gradient is to be computed. This method will treat
203    * only 3D structured point datasets (i.e., volumes).
204    */
205   virtual void GetVoxelGradient(int i, int j, int k, vtkDataArray* s, vtkDataArray* g);
206 
207   /**
208    * Given structured coordinates (i,j,k) for a point in a structured point
209    * dataset, compute the gradient vector from the scalar data at that point.
210    * The scalars s are the scalars from which the gradient is to be computed.
211    * This method will treat structured point datasets of any dimension.
212    */
213   virtual void GetPointGradient(int i, int j, int k, vtkDataArray* s, double g[3]);
214 
215   /**
216    * Return the dimensionality of the data.
217    */
218   virtual int GetDataDimension();
219 
220   /**
221    * Given a location in structured coordinates (i-j-k), return the point id.
222    */
ComputePointId(int ijk[3])223   virtual vtkIdType ComputePointId(int ijk[3])
224   {
225     return vtkStructuredData::ComputePointIdForExtent(this->Extent, ijk);
226   }
227 
228   /**
229    * Given a location in structured coordinates (i-j-k), return the cell id.
230    */
ComputeCellId(int ijk[3])231   virtual vtkIdType ComputeCellId(int ijk[3])
232   {
233     return vtkStructuredData::ComputeCellIdForExtent(this->Extent, ijk);
234   }
235 
236   ///@{
237   /**
238    * Set / Get the extent on just one axis
239    */
240   virtual void SetAxisUpdateExtent(
241     int axis, int min, int max, const int* updateExtent, int* axisUpdateExtent);
242   virtual void GetAxisUpdateExtent(int axis, int& min, int& max, const int* updateExtent);
243   ///@}
244 
245   ///@{
246   /**
247    * Set/Get the extent. On each axis, the extent is defined by the index
248    * of the first point and the index of the last point.  The extent should
249    * be set before the "Scalars" are set or allocated.  The Extent is
250    * stored in the order (X, Y, Z).
251    * The dataset extent does not have to start at (0,0,0). (0,0,0) is just the
252    * extent of the origin.
253    * The first point (the one with Id=0) is at extent
254    * (Extent[0],Extent[2],Extent[4]). As for any dataset, a data array on point
255    * data starts at Id=0.
256    */
257   virtual void SetExtent(int extent[6]);
258   virtual void SetExtent(int x1, int x2, int y1, int y2, int z1, int z2);
259   vtkGetVector6Macro(Extent, int);
260   ///@}
261 
262   ///@{
263   /**
264    * These returns the minimum and maximum values the ScalarType can hold
265    * without overflowing.
266    */
267   virtual double GetScalarTypeMin(vtkInformation* meta_data);
268   virtual double GetScalarTypeMin();
269   virtual double GetScalarTypeMax(vtkInformation* meta_data);
270   virtual double GetScalarTypeMax();
271   ///@}
272 
273   ///@{
274   /**
275    * Get the size of the scalar type in bytes.
276    */
277   virtual int GetScalarSize(vtkInformation* meta_data);
278   virtual int GetScalarSize();
279   ///@}
280 
281   ///@{
282   /**
283    * Different ways to get the increments for moving around the data.
284    * GetIncrements() calls ComputeIncrements() to ensure the increments are
285    * up to date.  The first three methods compute the increments based on the
286    * active scalar field while the next three, the scalar field is passed in.
287    */
288   virtual vtkIdType* GetIncrements() VTK_SIZEHINT(3);
289   virtual void GetIncrements(vtkIdType& incX, vtkIdType& incY, vtkIdType& incZ);
290   virtual void GetIncrements(vtkIdType inc[3]);
291   virtual vtkIdType* GetIncrements(vtkDataArray* scalars) VTK_SIZEHINT(3);
292   virtual void GetIncrements(
293     vtkDataArray* scalars, vtkIdType& incX, vtkIdType& incY, vtkIdType& incZ);
294   virtual void GetIncrements(vtkDataArray* scalars, vtkIdType inc[3]);
295   ///@}
296 
297   ///@{
298   /**
299    * Different ways to get the increments for moving around the data.
300    * incX is always returned with 0.  incY is returned with the
301    * increment needed to move from the end of one X scanline of data
302    * to the start of the next line.  incZ is filled in with the
303    * increment needed to move from the end of one image to the start
304    * of the next.  The proper way to use these values is to for a loop
305    * over Z, Y, X, C, incrementing the pointer by 1 after each
306    * component.  When the end of the component is reached, the pointer
307    * is set to the beginning of the next pixel, thus incX is properly set to 0.
308    * The first form of GetContinuousIncrements uses the active scalar field
309    * while the second form allows the scalar array to be passed in.
310    */
311   virtual void GetContinuousIncrements(
312     int extent[6], vtkIdType& incX, vtkIdType& incY, vtkIdType& incZ);
313   virtual void GetContinuousIncrements(
314     vtkDataArray* scalars, int extent[6], vtkIdType& incX, vtkIdType& incY, vtkIdType& incZ);
315   ///@}
316 
317   ///@{
318   /**
319    * Access the native pointer for the scalar data
320    */
321   virtual void* GetScalarPointerForExtent(int extent[6]);
322   virtual void* GetScalarPointer(int coordinates[3]);
323   virtual void* GetScalarPointer(int x, int y, int z);
324   virtual void* GetScalarPointer();
325   ///@}
326 
327   ///@{
328   /**
329    * Access the index for the scalar data
330    */
331   virtual vtkIdType GetScalarIndexForExtent(int extent[6]);
332   virtual vtkIdType GetScalarIndex(int coordinates[3]);
333   virtual vtkIdType GetScalarIndex(int x, int y, int z);
334   ///@}
335 
336   ///@{
337   /**
338    * For access to data from wrappers
339    */
340   virtual float GetScalarComponentAsFloat(int x, int y, int z, int component);
341   virtual void SetScalarComponentFromFloat(int x, int y, int z, int component, float v);
342   virtual double GetScalarComponentAsDouble(int x, int y, int z, int component);
343   virtual void SetScalarComponentFromDouble(int x, int y, int z, int component, double v);
344   ///@}
345 
346   /**
347    * Allocate the point scalars for this dataset. The data type determines
348    * the type of the array (VTK_FLOAT, VTK_INT etc.) where as numComponents
349    * determines its number of components.
350    */
351   virtual void AllocateScalars(int dataType, int numComponents);
352 
353   /**
354    * Allocate the point scalars for this dataset. The data type and the
355    * number of components of the array is determined by the meta-data in
356    * the pipeline information. This is usually produced by a reader/filter
357    * upstream in the pipeline.
358    */
359   virtual void AllocateScalars(vtkInformation* pipeline_info);
360 
361   ///@{
362   /**
363    * This method is passed a input and output region, and executes the filter
364    * algorithm to fill the output from the input.
365    * It just executes a switch statement to call the correct function for
366    * the regions data types.
367    */
368   virtual void CopyAndCastFrom(vtkImageData* inData, int extent[6]);
CopyAndCastFrom(vtkImageData * inData,int x0,int x1,int y0,int y1,int z0,int z1)369   virtual void CopyAndCastFrom(vtkImageData* inData, int x0, int x1, int y0, int y1, int z0, int z1)
370   {
371     int e[6];
372     e[0] = x0;
373     e[1] = x1;
374     e[2] = y0;
375     e[3] = y1;
376     e[4] = z0;
377     e[5] = z1;
378     this->CopyAndCastFrom(inData, e);
379   }
380   ///@}
381 
382   /**
383    * Reallocates and copies to set the Extent to updateExtent.
384    * This is used internally when the exact extent is requested,
385    * and the source generated more than the update extent.
386    */
387   void Crop(const int* updateExtent) override;
388 
389   /**
390    * Return the actual size of the data in kibibytes (1024 bytes). This number
391    * is valid only after the pipeline has updated. The memory size
392    * returned is guaranteed to be greater than or equal to the
393    * memory required to represent the data (e.g., extra space in
394    * arrays, etc. are not included in the return value). THIS METHOD
395    * IS THREAD SAFE.
396    */
397   unsigned long GetActualMemorySize() override;
398 
399   ///@{
400   /**
401    * Set the spacing (width,height,length) of the cubical cells that
402    * compose the data set.
403    */
404   vtkGetVector3Macro(Spacing, double);
405   virtual void SetSpacing(double i, double j, double k);
406   virtual void SetSpacing(const double ijk[3]);
407   ///@}
408 
409   ///@{
410   /**
411    * Set/Get the origin of the dataset. The origin is the position in world
412    * coordinates of the point of extent (0,0,0). This point does not have to be
413    * part of the dataset, in other words, the dataset extent does not have to
414    * start at (0,0,0) and the origin can be outside of the dataset bounding
415    * box.
416    * The origin plus spacing determine the position in space of the points.
417    */
418   vtkGetVector3Macro(Origin, double);
419   virtual void SetOrigin(double i, double j, double k);
420   virtual void SetOrigin(const double ijk[3]);
421   ///@}
422 
423   ///@{
424   /**
425    * Set/Get the direction transform of the dataset. The direction matrix is
426    * a 3x3 transformation matrix supporting scaling and rotation.
427    */
428   vtkGetObjectMacro(DirectionMatrix, vtkMatrix3x3);
429   virtual void SetDirectionMatrix(vtkMatrix3x3* m);
430   virtual void SetDirectionMatrix(const double elements[9]);
431   virtual void SetDirectionMatrix(double e00, double e01, double e02, double e10, double e11,
432     double e12, double e20, double e21, double e22);
433   ///@}
434 
435   ///@{
436   /**
437    * Get the transformation matrix from the index space to the physical space
438    * coordinate system of the dataset. The transform is a 4 by 4 matrix.
439    */
440   vtkGetObjectMacro(IndexToPhysicalMatrix, vtkMatrix4x4);
441   ///@}
442 
443   ///@{
444   /**
445    * Convert coordinates from index space (ijk) to physical space (xyz).
446    */
447   virtual void TransformContinuousIndexToPhysicalPoint(double i, double j, double k, double xyz[3]);
448   virtual void TransformContinuousIndexToPhysicalPoint(const double ijk[3], double xyz[3]);
449   virtual void TransformIndexToPhysicalPoint(int i, int j, int k, double xyz[3]);
450   virtual void TransformIndexToPhysicalPoint(const int ijk[3], double xyz[3]);
451   static void TransformContinuousIndexToPhysicalPoint(double i, double j, double k,
452     double const origin[3], double const spacing[3], double const direction[9], double xyz[3]);
453   ///@}
454 
455   ///@{
456   /**
457    * Get the transformation matrix from the physical space to the index space
458    * coordinate system of the dataset. The transform is a 4 by 4 matrix.
459    */
460   vtkGetObjectMacro(PhysicalToIndexMatrix, vtkMatrix4x4);
461   ///@}
462 
463   ///@{
464   /**
465    * Convert coordinates from physical space (xyz) to index space (ijk).
466    */
467   virtual void TransformPhysicalPointToContinuousIndex(double x, double y, double z, double ijk[3]);
468   virtual void TransformPhysicalPointToContinuousIndex(const double xyz[3], double ijk[3]);
469   ///@}
470 
471   static void ComputeIndexToPhysicalMatrix(
472     double const origin[3], double const spacing[3], double const direction[9], double result[16]);
473 
474   ///@{
475   /**
476    * Convert normal from physical space (xyz) to index space (ijk).
477    */
478   virtual void TransformPhysicalNormalToContinuousIndex(const double xyz[3], double ijk[3]);
479   ///@}
480 
481   /**
482    * Convert a plane from physical to a continuous index. The plane is represented as
483    * n(x-xo)=0; or using a four component normal: pplane=( nx,ny,nz,-(n(x0)) ).
484    */
485   virtual void TransformPhysicalPlaneToContinuousIndex(double const pplane[4], double iplane[4]);
486 
487   static void SetScalarType(int, vtkInformation* meta_data);
488   static int GetScalarType(vtkInformation* meta_data);
489   static bool HasScalarType(vtkInformation* meta_data);
490   int GetScalarType();
GetScalarTypeAsString()491   const char* GetScalarTypeAsString() { return vtkImageScalarTypeNameMacro(this->GetScalarType()); }
492 
493   ///@{
494   /**
495    * Set/Get the number of scalar components for points. As with the
496    * SetScalarType method this is setting pipeline info.
497    */
498   static void SetNumberOfScalarComponents(int n, vtkInformation* meta_data);
499   static int GetNumberOfScalarComponents(vtkInformation* meta_data);
500   static bool HasNumberOfScalarComponents(vtkInformation* meta_data);
501   int GetNumberOfScalarComponents();
502   ///@}
503 
504   /**
505    * Override these to handle origin, spacing, scalar type, and scalar
506    * number of components.  See vtkDataObject for details.
507    */
508   void CopyInformationFromPipeline(vtkInformation* information) override;
509 
510   /**
511    * Copy information from this data object to the pipeline information.
512    * This is used by the vtkTrivialProducer that is created when someone
513    * calls SetInputData() to connect the image to a pipeline.
514    */
515   void CopyInformationToPipeline(vtkInformation* information) override;
516 
517   /**
518    * make the output data ready for new data to be inserted. For most
519    * objects we just call Initialize. But for image data we leave the old
520    * data in case the memory can be reused.
521    */
522   void PrepareForNewData() override;
523 
524   ///@{
525   /**
526    * Shallow and Deep copy.
527    */
528   void ShallowCopy(vtkDataObject* src) override;
529   void DeepCopy(vtkDataObject* src) override;
530   ///@}
531 
532   //--------------------------------------------------------------------------
533   // Methods that apply to any array (not just scalars).
534   // I am starting to experiment with generalizing imaging filters
535   // to operate on more than just scalars.
536 
537   ///@{
538   /**
539    * These are convenience methods for getting a pointer
540    * from any filed array.  It is a start at expanding image filters
541    * to process any array (not just scalars).
542    */
543   void* GetArrayPointerForExtent(vtkDataArray* array, int extent[6]);
544   void* GetArrayPointer(vtkDataArray* array, int coordinates[3]);
545   ///@}
546 
547   ///@{
548   /**
549    * Given a data array and a coordinate, return the index of the tuple in the
550    * array corresponding to that coordinate.
551    *
552    * This method is analogous to GetArrayPointer(), but it conforms to the API
553    * of vtkGenericDataArray.
554    */
555   vtkIdType GetTupleIndex(vtkDataArray* array, int coordinates[3]);
556   ///@}
557 
558   /**
559    * Since various arrays have different number of components,
560    * the will have different increments.
561    */
562   void GetArrayIncrements(vtkDataArray* array, vtkIdType increments[3]);
563 
564   /**
565    * Given how many pixel are required on a side for bounrary conditions (in
566    * bnds), the target extent to traverse, compute the internal extent (the
567    * extent for this ImageData that does not suffer from any boundary
568    * conditions) and place it in intExt
569    */
570   void ComputeInternalExtent(int* intExt, int* tgtExt, int* bnds);
571 
572   /**
573    * The extent type is a 3D extent
574    */
GetExtentType()575   int GetExtentType() override { return VTK_3D_EXTENT; }
576 
577   ///@{
578   /**
579    * Retrieve an instance of this class from an information object.
580    */
581   static vtkImageData* GetData(vtkInformation* info);
582   static vtkImageData* GetData(vtkInformationVector* v, int i = 0);
583   ///@}
584 
585 protected:
586   vtkImageData();
587   ~vtkImageData() override;
588 
589   // The extent of what is currently in the structured grid.
590   // Dimensions is just an array to return a value.
591   // Its contents are out of data until GetDimensions is called.
592   int Dimensions[3];
593   vtkIdType Increments[3];
594 
595   // Variables used to define dataset physical orientation
596   double Origin[3];
597   double Spacing[3];
598   vtkMatrix3x3* DirectionMatrix;
599   vtkMatrix4x4* IndexToPhysicalMatrix;
600   vtkMatrix4x4* PhysicalToIndexMatrix;
601 
602   int Extent[6];
603 
604   // The first method assumes Active Scalars
605   void ComputeIncrements();
606   // This one is given the number of components of the
607   // scalar field explicitly
608   void ComputeIncrements(int numberOfComponents);
609   void ComputeIncrements(vtkDataArray* scalars);
610 
611   // The first method assumes Acitive Scalars
612   void ComputeIncrements(vtkIdType inc[3]);
613   // This one is given the number of components of the
614   // scalar field explicitly
615   void ComputeIncrements(int numberOfComponents, vtkIdType inc[3]);
616   void ComputeIncrements(vtkDataArray* scalars, vtkIdType inc[3]);
617 
618   // for the index to physical methods
619   void ComputeTransforms();
620 
621   // Cell utilities
622   vtkCell* GetCellTemplateForDataDescription();
623   bool GetCellTemplateForDataDescription(vtkGenericCell* cell);
624   bool GetIJKMinForCellId(vtkIdType cellId, int ijkMin[3]);
625   bool GetIJKMaxForIJKMin(int ijkMin[3], int ijkMax[3]);
626   void AddPointsToCellTemplate(vtkCell* cell, int ijkMin[3], int ijkMax[3]);
627 
628   vtkTimeStamp ExtentComputeTime;
629 
630   void SetDataDescription(int desc);
GetDataDescription()631   int GetDataDescription() { return this->DataDescription; }
632 
633 private:
634   void InternalImageDataCopy(vtkImageData* src);
635 
636 private:
637   friend class vtkUniformGrid;
638 
639   // for the GetCell method
640   vtkVertex* Vertex;
641   vtkLine* Line;
642   vtkPixel* Pixel;
643   vtkVoxel* Voxel;
644 
645   // for the GetPoint method
646   double Point[3];
647 
648   int DataDescription;
649 
650   vtkImageData(const vtkImageData&) = delete;
651   void operator=(const vtkImageData&) = delete;
652 };
653 
654 //----------------------------------------------------------------------------
ComputeIncrements()655 inline void vtkImageData::ComputeIncrements()
656 {
657   this->ComputeIncrements(this->Increments);
658 }
659 
660 //----------------------------------------------------------------------------
ComputeIncrements(int numberOfComponents)661 inline void vtkImageData::ComputeIncrements(int numberOfComponents)
662 {
663   this->ComputeIncrements(numberOfComponents, this->Increments);
664 }
665 
666 //----------------------------------------------------------------------------
ComputeIncrements(vtkDataArray * scalars)667 inline void vtkImageData::ComputeIncrements(vtkDataArray* scalars)
668 {
669   this->ComputeIncrements(scalars, this->Increments);
670 }
671 
672 //----------------------------------------------------------------------------
GetPoint(vtkIdType id)673 inline double* vtkImageData::GetPoint(vtkIdType id)
674 {
675   this->GetPoint(id, this->Point);
676   return this->Point;
677 }
678 
679 //----------------------------------------------------------------------------
GetNumberOfPoints()680 inline vtkIdType vtkImageData::GetNumberOfPoints()
681 {
682   const int* extent = this->Extent;
683   vtkIdType dims[3];
684   dims[0] = extent[1] - extent[0] + 1;
685   dims[1] = extent[3] - extent[2] + 1;
686   dims[2] = extent[5] - extent[4] + 1;
687 
688   return dims[0] * dims[1] * dims[2];
689 }
690 
691 //----------------------------------------------------------------------------
GetDataDimension()692 inline int vtkImageData::GetDataDimension()
693 {
694   return vtkStructuredData::GetDataDimension(this->DataDescription);
695 }
696 
697 #endif
698