VTK
 All Classes Namespaces Files Functions Variables Typedefs Enumerations Enumerator Friends Macros Pages
vtkImageReslice.h
Go to the documentation of this file.
1 /*=========================================================================
2 
3  Program: Visualization Toolkit
4  Module: vtkImageReslice.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 =========================================================================*/
57 #ifndef __vtkImageReslice_h
58 #define __vtkImageReslice_h
59 
60 
61 #include "vtkImagingCoreModule.h" // For export macro
63 
64 // interpolation mode constants
65 #define VTK_RESLICE_NEAREST VTK_NEAREST_INTERPOLATION
66 #define VTK_RESLICE_LINEAR VTK_LINEAR_INTERPOLATION
67 #define VTK_RESLICE_CUBIC VTK_CUBIC_INTERPOLATION
68 
69 class vtkImageData;
71 class vtkMatrix4x4;
73 class vtkScalarsToColors;
75 
77 {
78 public:
79  static vtkImageReslice *New();
81 
82  virtual void PrintSelf(ostream& os, vtkIndent indent);
83 
85 
97  virtual void SetResliceAxes(vtkMatrix4x4*);
98  vtkGetObjectMacro(ResliceAxes, vtkMatrix4x4);
100 
102 
106  void SetResliceAxesDirectionCosines(double x0, double x1, double x2,
107  double y0, double y1, double y2,
108  double z0, double z1, double z2);
109  void SetResliceAxesDirectionCosines(const double x[3],
110  const double y[3],
111  const double z[3]) {
112  this->SetResliceAxesDirectionCosines(x[0], x[1], x[2],
113  y[0], y[1], y[2],
114  z[0], z[1], z[2]); };
115  void SetResliceAxesDirectionCosines(const double xyz[9]) {
116  this->SetResliceAxesDirectionCosines(xyz[0], xyz[1], xyz[2],
117  xyz[3], xyz[4], xyz[5],
118  xyz[6], xyz[7], xyz[8]); };
119  void GetResliceAxesDirectionCosines(double x[3], double y[3], double z[3]);
120  void GetResliceAxesDirectionCosines(double xyz[9]) {
121  this->GetResliceAxesDirectionCosines(&xyz[0], &xyz[3], &xyz[6]); };
123  this->GetResliceAxesDirectionCosines(this->ResliceAxesDirectionCosines);
124  return this->ResliceAxesDirectionCosines; };
126 
128 
131  void SetResliceAxesOrigin(double x, double y, double z);
132  void SetResliceAxesOrigin(const double xyz[3]) {
133  this->SetResliceAxesOrigin(xyz[0], xyz[1], xyz[2]); };
134  void GetResliceAxesOrigin(double xyz[3]);
136  this->GetResliceAxesOrigin(this->ResliceAxesOrigin);
137  return this->ResliceAxesOrigin; };
139 
141 
148  virtual void SetResliceTransform(vtkAbstractTransform*);
149  vtkGetObjectMacro(ResliceTransform, vtkAbstractTransform);
151 
153 
159  virtual void SetInformationInput(vtkImageData*);
160  vtkGetObjectMacro(InformationInput, vtkImageData);
162 
164 
168  vtkSetMacro(TransformInputSampling, int);
169  vtkBooleanMacro(TransformInputSampling, int);
170  vtkGetMacro(TransformInputSampling, int);
172 
174 
177  vtkSetMacro(AutoCropOutput, int);
178  vtkBooleanMacro(AutoCropOutput, int);
179  vtkGetMacro(AutoCropOutput, int);
181 
183 
184  vtkSetMacro(Wrap, int);
185  vtkGetMacro(Wrap, int);
186  vtkBooleanMacro(Wrap, int);
188 
190 
192  vtkSetMacro(Mirror, int);
193  vtkGetMacro(Mirror, int);
194  vtkBooleanMacro(Mirror, int);
196 
198 
205  vtkSetMacro(Border, int);
206  vtkGetMacro(Border, int);
207  vtkBooleanMacro(Border, int);
209 
211 
212  vtkSetClampMacro(InterpolationMode, int,
214  vtkGetMacro(InterpolationMode, int);
216  this->SetInterpolationMode(VTK_RESLICE_NEAREST); };
218  this->SetInterpolationMode(VTK_RESLICE_LINEAR); };
220  this->SetInterpolationMode(VTK_RESLICE_CUBIC); };
221  virtual const char *GetInterpolationModeAsString();
223 
225 
227  virtual void SetInterpolator(vtkAbstractImageInterpolator *sampler);
228  virtual vtkAbstractImageInterpolator *GetInterpolator();
230 
232 
233  vtkSetClampMacro(SlabMode, int, VTK_IMAGE_SLAB_MIN, VTK_IMAGE_SLAB_SUM);
234  vtkGetMacro(SlabMode, int);
236  this->SetSlabMode(VTK_IMAGE_SLAB_MIN); };
238  this->SetSlabMode(VTK_IMAGE_SLAB_MAX); };
240  this->SetSlabMode(VTK_IMAGE_SLAB_MEAN); };
242  this->SetSlabMode(VTK_IMAGE_SLAB_SUM); };
243  virtual const char *GetSlabModeAsString();
245 
247 
248  vtkSetMacro(SlabNumberOfSlices, int);
249  vtkGetMacro(SlabNumberOfSlices, int);
251 
253 
256  vtkSetMacro(SlabTrapezoidIntegration, int);
257  vtkBooleanMacro(SlabTrapezoidIntegration, int);
258  vtkGetMacro(SlabTrapezoidIntegration, int);
260 
262 
264  vtkSetMacro(Optimization, int);
265  vtkGetMacro(Optimization, int);
266  vtkBooleanMacro(Optimization, int);
268 
270 
271  vtkSetVector4Macro(BackgroundColor, double);
272  vtkGetVector4Macro(BackgroundColor, double);
274 
276 
277  void SetBackgroundLevel(double v) { this->SetBackgroundColor(v,v,v,v); };
278  double GetBackgroundLevel() { return this->GetBackgroundColor()[0]; };
280 
282 
284  virtual void SetOutputSpacing(double x, double y, double z);
285  virtual void SetOutputSpacing(const double a[3]) {
286  this->SetOutputSpacing(a[0], a[1], a[2]); };
287  vtkGetVector3Macro(OutputSpacing, double);
288  void SetOutputSpacingToDefault();
290 
292 
294  virtual void SetOutputOrigin(double x, double y, double z);
295  virtual void SetOutputOrigin(const double a[3]) {
296  this->SetOutputOrigin(a[0], a[1], a[2]); };
297  vtkGetVector3Macro(OutputOrigin, double);
298  void SetOutputOriginToDefault();
300 
302 
304  virtual void SetOutputExtent(int a, int b, int c, int d, int e, int f);
305  virtual void SetOutputExtent(const int a[6]) {
306  this->SetOutputExtent(a[0], a[1], a[2], a[3], a[4], a[5]); };
307  vtkGetVector6Macro(OutputExtent, int);
308  void SetOutputExtentToDefault();
310 
312 
318  vtkSetMacro(OutputDimensionality, int);
319  vtkGetMacro(OutputDimensionality, int);
321 
324  unsigned long int GetMTime();
325 
327  virtual void ReportReferences(vtkGarbageCollector*);
328 
330 
335  void SetInterpolate(int t) {
336  if (t && !this->GetInterpolate()) {
337  this->SetInterpolationModeToLinear(); }
338  else if (!t && this->GetInterpolate()) {
339  this->SetInterpolationModeToNearestNeighbor(); } };
340  void InterpolateOn() {
341  this->SetInterpolate(1); };
342  void InterpolateOff() {
343  this->SetInterpolate(0); };
345  return (this->GetInterpolationMode() != VTK_RESLICE_NEAREST); };
347 
349 
352  void SetStencilData(vtkImageStencilData *stencil);
353  vtkImageStencilData *GetStencil();
355 
357 
359  vtkSetMacro(GenerateStencilOutput, int);
360  vtkGetMacro(GenerateStencilOutput, int);
361  vtkBooleanMacro(GenerateStencilOutput, int);
363 
365 
367  return this->GetOutputPort(1); }
368  vtkImageStencilData *GetStencilOutput();
369  void SetStencilOutput(vtkImageStencilData *stencil);
371 
372 protected:
373  vtkImageReslice();
374  ~vtkImageReslice();
375 
377  double ResliceAxesDirectionCosines[9];
378  double ResliceAxesOrigin[3];
382  int Wrap;
383  int Mirror;
384  int Border;
387  int SlabMode;
390  double BackgroundColor[4];
391  double OutputOrigin[3];
392  double OutputSpacing[3];
393  int OutputExtent[6];
404 
407 
411 
414  virtual int ConvertScalarInfo(int &scalarType, int &numComponents);
415 
417 
423  virtual void ConvertScalars(void *inPtr, void *outPtr,
424  int inputType, int inputNumComponents,
425  int count, int idX, int idY, int idZ,
426  int threadId);
428 
429  void ConvertScalarsBase(void *inPtr, void *outPtr,
430  int inputType, int inputNumComponents,
431  int count, int idX, int idY, int idZ, int threadId) {
432  this->ConvertScalars(inPtr, outPtr, inputType, inputNumComponents,
433  count, idX, idY, idZ, threadId); }
434 
435  void GetAutoCroppedOutputBounds(vtkInformation *inInfo, double bounds[6]);
436  virtual void AllocateOutputData(vtkImageData *output, vtkInformation *outInfo, int *uExtent);
444  virtual void ThreadedRequestData(vtkInformation *request,
445  vtkInformationVector **inputVector,
446  vtkInformationVector *outputVector,
447  vtkImageData ***inData,
448  vtkImageData **outData, int ext[6], int id);
451 
452  vtkMatrix4x4 *GetIndexMatrix(vtkInformation *inInfo,
453  vtkInformation *outInfo);
455  return this->OptimizedTransform; };
456 
457 private:
458  vtkImageReslice(const vtkImageReslice&); // Not implemented.
459  void operator=(const vtkImageReslice&); // Not implemented.
460 };
461 
462 #endif
double * GetResliceAxesDirectionCosines()
interpolate data values from images
GLclampf f
Definition: vtkgl.h:14181
#define VTK_IMAGE_SLAB_MAX
GLboolean GLboolean GLboolean b
Definition: vtkgl.h:12312
#define VTK_RESLICE_NEAREST
vtkAlgorithmOutput * GetOutputPort()
Definition: vtkAlgorithm.h:351
represent and manipulate 4x4 transformation matrices
Definition: vtkMatrix4x4.h:38
#define VTK_IMAGE_SLAB_MIN
vtkAbstractTransform * GetOptimizedTransform()
const GLdouble * v
Definition: vtkgl.h:11595
#define VTK_RESLICE_CUBIC
Store vtkAlgorithm input/output information.
vtkMatrix4x4 * IndexMatrix
#define VTK_IMAGE_SLAB_SUM
#define VTK_IMAGE_SLAB_MEAN
void SetInterpolationModeToLinear()
void SetInterpolationModeToCubic()
GLuint GLuint GLsizei count
Definition: vtkgl.h:11315
vtkAlgorithmOutput * GetStencilOutputPort()
double * GetResliceAxesOrigin()
GLdouble GLdouble t
Definition: vtkgl.h:11602
#define VTK_RESLICE_LINEAR
GLint GLint GLint GLint GLint GLint y
Definition: vtkgl.h:11318
Detect and break reference loops.
void PrintSelf(ostream &os, vtkIndent indent)
virtual int RequestUpdateExtent(vtkInformation *, vtkInformationVector **, vtkInformationVector *)
Proxy object to connect input/output ports.
virtual void AllocateOutputData(vtkImageData *out, vtkInformation *outInfo, int *uExtent)
GLdouble GLdouble z
Definition: vtkgl.h:11754
Superclass for mapping scalar values to colors.
virtual void ReportReferences(vtkGarbageCollector *)
Generic filter that has one input..
GLint GLint GLint GLint GLint x
Definition: vtkgl.h:11318
virtual unsigned long GetMTime()
a simple class to control print indentation
Definition: vtkIndent.h:38
const GLubyte * c
Definition: vtkgl.h:15720
efficient description of an image stencil
void ConvertScalarsBase(void *inPtr, void *outPtr, int inputType, int inputNumComponents, int count, int idX, int idY, int idZ, int threadId)
vtkAbstractTransform * OptimizedTransform
topologically and geometrically regular array of data
Definition: vtkImageData.h:44
virtual int RequestInformation(vtkInformation *request, vtkInformationVector **inputVector, vtkInformationVector *outputVector)
superclass for all geometric transformations
virtual int FillOutputPortInformation(int port, vtkInformation *info)
#define VTKIMAGINGCORE_EXPORT
virtual int FillInputPortInformation(int port, vtkInformation *info)
virtual void ThreadedRequestData(vtkInformation *request, vtkInformationVector **inputVector, vtkInformationVector *outputVector, vtkImageData ***inData, vtkImageData **outData, int extent[6], int threadId)
double GetBackgroundLevel()
virtual void SetOutputExtent(const int a[6])
vtkImageData * InformationInput
Reslices a volume along a new set of axes.
void SetResliceAxesDirectionCosines(const double x[3], const double y[3], const double z[3])
void SetBackgroundLevel(double v)
GLboolean GLboolean GLboolean GLboolean a
Definition: vtkgl.h:12312
void SetInterpolate(int t)
vtkMatrix4x4 * ResliceAxes
virtual int RequestData(vtkInformation *request, vtkInformationVector **inputVector, vtkInformationVector *outputVector)
void GetResliceAxesDirectionCosines(double xyz[9])
void SetResliceAxesDirectionCosines(const double xyz[9])
virtual void SetOutputSpacing(const double a[3])
Store zero or more vtkInformation instances.
static vtkAlgorithm * New()
GLuint sampler
Definition: vtkgl.h:13872
general representation of visualization data
Definition: vtkDataObject.h:64
GLint GLfloat GLint stencil
Definition: vtkgl.h:12368
void SetInterpolationModeToNearestNeighbor()
vtkAbstractImageInterpolator * Interpolator
virtual void SetOutputOrigin(const double a[3])
vtkAbstractTransform * ResliceTransform
void SetResliceAxesOrigin(const double xyz[3])