Main Page | Class Hierarchy | Alphabetical List | Class List | Directories | File List | Class Members | File Members | Related Pages

vtkImageReslice.h

Go to the documentation of this file.
00001 /*=========================================================================
00002 
00003   Program:   Visualization Toolkit
00004   Module:    $RCSfile: vtkImageReslice.h,v $
00005 
00006   Copyright (c) Ken Martin, Will Schroeder, Bill Lorensen
00007   All rights reserved.
00008   See Copyright.txt or http://www.kitware.com/Copyright.htm for details.
00009 
00010      This software is distributed WITHOUT ANY WARRANTY; without even
00011      the implied warranty of MERCHANTABILITY or FITNESS FOR A PARTICULAR
00012      PURPOSE.  See the above copyright notice for more information.
00013 
00014 =========================================================================*/
00054 #ifndef __vtkImageReslice_h
00055 #define __vtkImageReslice_h
00056 
00057 
00058 #include "vtkThreadedImageAlgorithm.h"
00059 
00060 // interpolation mode constants
00061 #define VTK_RESLICE_NEAREST 0
00062 #define VTK_RESLICE_LINEAR 1
00063 #define VTK_RESLICE_CUBIC 3
00064 
00065 class vtkImageData;
00066 class vtkAbstractTransform;
00067 class vtkMatrix4x4;
00068 class vtkImageStencilData;
00069 
00070 class VTK_IMAGING_EXPORT vtkImageReslice : public vtkThreadedImageAlgorithm
00071 {
00072 public:
00073   static vtkImageReslice *New();
00074   vtkTypeRevisionMacro(vtkImageReslice, vtkThreadedImageAlgorithm);
00075 
00076   virtual void PrintSelf(ostream& os, vtkIndent indent);
00077 
00079 
00091   virtual void SetResliceAxes(vtkMatrix4x4*);
00092   vtkGetObjectMacro(ResliceAxes, vtkMatrix4x4);
00094 
00096 
00100   void SetResliceAxesDirectionCosines(double x0, double x1, double x2,
00101                                       double y0, double y1, double y2,
00102                                       double z0, double z1, double z2);
00103   void SetResliceAxesDirectionCosines(const double x[3],
00104                                       const double y[3],
00105                                       const double z[3]) {
00106     this->SetResliceAxesDirectionCosines(x[0], x[1], x[2],
00107                                          y[0], y[1], y[2],
00108                                          z[0], z[1], z[2]); };
00109   void SetResliceAxesDirectionCosines(const double xyz[9]) {
00110     this->SetResliceAxesDirectionCosines(xyz[0], xyz[1], xyz[2],
00111                                          xyz[3], xyz[4], xyz[5],
00112                                          xyz[6], xyz[7], xyz[8]); };
00113   void GetResliceAxesDirectionCosines(double x[3], double y[3], double z[3]);
00114   void GetResliceAxesDirectionCosines(double xyz[9]) {
00115     this->GetResliceAxesDirectionCosines(&xyz[0], &xyz[3], &xyz[6]); };
00116   double *GetResliceAxesDirectionCosines() {
00117     this->GetResliceAxesDirectionCosines(this->ResliceAxesDirectionCosines);
00118     return this->ResliceAxesDirectionCosines; };
00120 
00122 
00125   void SetResliceAxesOrigin(double x, double y, double z);
00126   void SetResliceAxesOrigin(const double xyz[3]) {
00127     this->SetResliceAxesOrigin(xyz[0], xyz[1], xyz[2]); };
00128   void GetResliceAxesOrigin(double xyz[3]);
00129   double *GetResliceAxesOrigin() {
00130     this->GetResliceAxesOrigin(this->ResliceAxesOrigin);
00131     return this->ResliceAxesOrigin; };
00133 
00135 
00142   virtual void SetResliceTransform(vtkAbstractTransform*);
00143   vtkGetObjectMacro(ResliceTransform, vtkAbstractTransform);
00145 
00147 
00153   virtual void SetInformationInput(vtkImageData*);
00154   vtkGetObjectMacro(InformationInput, vtkImageData);
00156 
00158 
00162   vtkSetMacro(TransformInputSampling, int);
00163   vtkBooleanMacro(TransformInputSampling, int);
00164   vtkGetMacro(TransformInputSampling, int);
00166 
00168 
00171   vtkSetMacro(AutoCropOutput, int);
00172   vtkBooleanMacro(AutoCropOutput, int);
00173   vtkGetMacro(AutoCropOutput, int);
00175 
00177 
00178   vtkSetMacro(Wrap, int);
00179   vtkGetMacro(Wrap, int);
00180   vtkBooleanMacro(Wrap, int);
00182 
00184 
00186   vtkSetMacro(Mirror, int);
00187   vtkGetMacro(Mirror, int);
00188   vtkBooleanMacro(Mirror, int);
00190 
00192 
00199   vtkSetMacro(Border, int);
00200   vtkGetMacro(Border, int);
00201   vtkBooleanMacro(Border, int);
00203 
00205 
00206   vtkSetMacro(InterpolationMode, int);
00207   vtkGetMacro(InterpolationMode, int);
00208   void SetInterpolationModeToNearestNeighbor() {
00209     this->SetInterpolationMode(VTK_RESLICE_NEAREST); };
00210   void SetInterpolationModeToLinear() {
00211     this->SetInterpolationMode(VTK_RESLICE_LINEAR); };
00212   void SetInterpolationModeToCubic() {
00213     this->SetInterpolationMode(VTK_RESLICE_CUBIC); };
00214   const char *GetInterpolationModeAsString();
00216 
00218 
00220   vtkSetMacro(Optimization, int);
00221   vtkGetMacro(Optimization, int);
00222   vtkBooleanMacro(Optimization, int);
00224 
00226 
00227   vtkSetVector4Macro(BackgroundColor, double);
00228   vtkGetVector4Macro(BackgroundColor, double);
00230 
00232 
00233   void SetBackgroundLevel(double v) { this->SetBackgroundColor(v,v,v,v); };
00234   double GetBackgroundLevel() { return this->GetBackgroundColor()[0]; };
00236 
00238 
00240   vtkSetVector3Macro(OutputSpacing, double);
00241   vtkGetVector3Macro(OutputSpacing, double);
00242   void SetOutputSpacingToDefault() {
00243     this->SetOutputSpacing(VTK_DOUBLE_MAX, VTK_DOUBLE_MAX, VTK_DOUBLE_MAX); };
00245 
00247 
00249   vtkSetVector3Macro(OutputOrigin, double);
00250   vtkGetVector3Macro(OutputOrigin, double);
00251   void SetOutputOriginToDefault() {
00252     this->SetOutputOrigin(VTK_DOUBLE_MAX, VTK_DOUBLE_MAX, VTK_DOUBLE_MAX); };
00254 
00256 
00258   vtkSetVector6Macro(OutputExtent, int);
00259   vtkGetVector6Macro(OutputExtent, int);
00260   void SetOutputExtentToDefault() {
00261     this->SetOutputExtent(VTK_INT_MIN, VTK_INT_MAX,
00262                           VTK_INT_MIN, VTK_INT_MAX,
00263                           VTK_INT_MIN, VTK_INT_MAX); };
00265 
00267 
00273   vtkSetMacro(OutputDimensionality, int);
00274   vtkGetMacro(OutputDimensionality, int);
00276 
00279   unsigned long int GetMTime();
00280 
00282 
00287   void SetInterpolate(int t) {
00288     if (t && !this->GetInterpolate()) {
00289       this->SetInterpolationModeToLinear(); }
00290     else if (!t && this->GetInterpolate()) {
00291       this->SetInterpolationModeToNearestNeighbor(); } };
00292   void InterpolateOn() {
00293     this->SetInterpolate(1); };
00294   void InterpolateOff() {
00295     this->SetInterpolate(0); };
00296   int GetInterpolate() {
00297     return (this->GetInterpolationMode() != VTK_RESLICE_NEAREST); };
00299 
00301 
00304   void SetStencil(vtkImageStencilData *stencil);
00305   vtkImageStencilData *GetStencil();
00307 
00308 protected:
00309   vtkImageReslice();
00310   ~vtkImageReslice();
00311 
00312   vtkMatrix4x4 *ResliceAxes;
00313   double ResliceAxesDirectionCosines[9];
00314   double ResliceAxesOrigin[3];
00315   vtkAbstractTransform *ResliceTransform;
00316   vtkImageData *InformationInput;
00317   int Wrap;
00318   int Mirror;
00319   int Border;
00320   int InterpolationMode;
00321   int Optimization;
00322   double BackgroundColor[4];
00323   double OutputOrigin[3];
00324   double OutputSpacing[3];
00325   int OutputExtent[6];
00326   int OutputDimensionality;
00327   int TransformInputSampling;
00328   int AutoCropOutput;
00329   int HitInputExtent;
00330 
00331   vtkMatrix4x4 *IndexMatrix;
00332   vtkAbstractTransform *OptimizedTransform;
00333 
00334   void GetAutoCroppedOutputBounds(vtkInformation *inInfo, double bounds[6]);
00335   virtual int RequestInformation(vtkInformation *, vtkInformationVector **,
00336                                  vtkInformationVector *);
00337   virtual int RequestUpdateExtent(vtkInformation *, vtkInformationVector **,
00338                                   vtkInformationVector *);
00339   virtual void ThreadedRequestData(vtkInformation *request,
00340                                    vtkInformationVector **inputVector,
00341                                    vtkInformationVector *outputVector,
00342                                    vtkImageData ***inData,
00343                                    vtkImageData **outData, int ext[6], int id);
00344   virtual int FillInputPortInformation(int port, vtkInformation *info);
00345 
00346   vtkMatrix4x4 *GetIndexMatrix(vtkInformation *inInfo,
00347                                vtkInformation *outInfo);
00348   vtkAbstractTransform *GetOptimizedTransform() { 
00349     return this->OptimizedTransform; };
00350 
00351 private:
00352   vtkImageReslice(const vtkImageReslice&);  // Not implemented.
00353   void operator=(const vtkImageReslice&);  // Not implemented.
00354 };
00355 
00356 //----------------------------------------------------------------------------
00357 inline const char *vtkImageReslice::GetInterpolationModeAsString()
00358 {
00359   switch (this->InterpolationMode)
00360     {
00361     case VTK_RESLICE_NEAREST:
00362       return "NearestNeighbor";
00363     case VTK_RESLICE_LINEAR:
00364       return "Linear";
00365     case VTK_RESLICE_CUBIC:
00366       return "Cubic";
00367     default:
00368       return "";
00369     }
00370 }  
00371 
00372 #endif
00373 
00374 
00375 
00376 
00377 

Generated on Mon Jan 21 23:07:30 2008 for VTK by  doxygen 1.4.3-20050530