• Main Page
  • Related Pages
  • Namespaces
  • Classes
  • Files
  • File List
  • File Members

dox/Imaging/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_RESERVED_2 2
00064 #define VTK_RESLICE_CUBIC 3
00065 
00066 class vtkImageData;
00067 class vtkAbstractTransform;
00068 class vtkMatrix4x4;
00069 class vtkImageStencilData;
00070 
00071 class VTK_IMAGING_EXPORT vtkImageReslice : public vtkThreadedImageAlgorithm
00072 {
00073 public:
00074   static vtkImageReslice *New();
00075   vtkTypeRevisionMacro(vtkImageReslice, vtkThreadedImageAlgorithm);
00076 
00077   virtual void PrintSelf(ostream& os, vtkIndent indent);
00078 
00080 
00092   virtual void SetResliceAxes(vtkMatrix4x4*);
00093   vtkGetObjectMacro(ResliceAxes, vtkMatrix4x4);
00095 
00097 
00101   void SetResliceAxesDirectionCosines(double x0, double x1, double x2,
00102                                       double y0, double y1, double y2,
00103                                       double z0, double z1, double z2);
00104   void SetResliceAxesDirectionCosines(const double x[3],
00105                                       const double y[3],
00106                                       const double z[3]) {
00107     this->SetResliceAxesDirectionCosines(x[0], x[1], x[2],
00108                                          y[0], y[1], y[2],
00109                                          z[0], z[1], z[2]); };
00110   void SetResliceAxesDirectionCosines(const double xyz[9]) {
00111     this->SetResliceAxesDirectionCosines(xyz[0], xyz[1], xyz[2],
00112                                          xyz[3], xyz[4], xyz[5],
00113                                          xyz[6], xyz[7], xyz[8]); };
00114   void GetResliceAxesDirectionCosines(double x[3], double y[3], double z[3]);
00115   void GetResliceAxesDirectionCosines(double xyz[9]) {
00116     this->GetResliceAxesDirectionCosines(&xyz[0], &xyz[3], &xyz[6]); };
00117   double *GetResliceAxesDirectionCosines() {
00118     this->GetResliceAxesDirectionCosines(this->ResliceAxesDirectionCosines);
00119     return this->ResliceAxesDirectionCosines; };
00121 
00123 
00126   void SetResliceAxesOrigin(double x, double y, double z);
00127   void SetResliceAxesOrigin(const double xyz[3]) {
00128     this->SetResliceAxesOrigin(xyz[0], xyz[1], xyz[2]); };
00129   void GetResliceAxesOrigin(double xyz[3]);
00130   double *GetResliceAxesOrigin() {
00131     this->GetResliceAxesOrigin(this->ResliceAxesOrigin);
00132     return this->ResliceAxesOrigin; };
00134 
00136 
00143   virtual void SetResliceTransform(vtkAbstractTransform*);
00144   vtkGetObjectMacro(ResliceTransform, vtkAbstractTransform);
00146 
00148 
00154   virtual void SetInformationInput(vtkImageData*);
00155   vtkGetObjectMacro(InformationInput, vtkImageData);
00157 
00159 
00163   vtkSetMacro(TransformInputSampling, int);
00164   vtkBooleanMacro(TransformInputSampling, int);
00165   vtkGetMacro(TransformInputSampling, int);
00167 
00169 
00172   vtkSetMacro(AutoCropOutput, int);
00173   vtkBooleanMacro(AutoCropOutput, int);
00174   vtkGetMacro(AutoCropOutput, int);
00176 
00178 
00179   vtkSetMacro(Wrap, int);
00180   vtkGetMacro(Wrap, int);
00181   vtkBooleanMacro(Wrap, int);
00183 
00185 
00187   vtkSetMacro(Mirror, int);
00188   vtkGetMacro(Mirror, int);
00189   vtkBooleanMacro(Mirror, int);
00191 
00193 
00200   vtkSetMacro(Border, int);
00201   vtkGetMacro(Border, int);
00202   vtkBooleanMacro(Border, int);
00204 
00206 
00207   vtkSetClampMacro(InterpolationMode, int,
00208                    VTK_RESLICE_NEAREST, VTK_RESLICE_CUBIC);
00209   vtkGetMacro(InterpolationMode, int);
00210   void SetInterpolationModeToNearestNeighbor() {
00211     this->SetInterpolationMode(VTK_RESLICE_NEAREST); };
00212   void SetInterpolationModeToLinear() {
00213     this->SetInterpolationMode(VTK_RESLICE_LINEAR); };
00214   void SetInterpolationModeToCubic() {
00215     this->SetInterpolationMode(VTK_RESLICE_CUBIC); };
00216   const char *GetInterpolationModeAsString();
00218 
00220 
00222   vtkSetMacro(Optimization, int);
00223   vtkGetMacro(Optimization, int);
00224   vtkBooleanMacro(Optimization, int);
00226 
00228 
00229   vtkSetVector4Macro(BackgroundColor, double);
00230   vtkGetVector4Macro(BackgroundColor, double);
00232 
00234 
00235   void SetBackgroundLevel(double v) { this->SetBackgroundColor(v,v,v,v); };
00236   double GetBackgroundLevel() { return this->GetBackgroundColor()[0]; };
00238 
00240 
00242   vtkSetVector3Macro(OutputSpacing, double);
00243   vtkGetVector3Macro(OutputSpacing, double);
00244   void SetOutputSpacingToDefault() {
00245     this->SetOutputSpacing(VTK_DOUBLE_MAX, VTK_DOUBLE_MAX, VTK_DOUBLE_MAX); };
00247 
00249 
00251   vtkSetVector3Macro(OutputOrigin, double);
00252   vtkGetVector3Macro(OutputOrigin, double);
00253   void SetOutputOriginToDefault() {
00254     this->SetOutputOrigin(VTK_DOUBLE_MAX, VTK_DOUBLE_MAX, VTK_DOUBLE_MAX); };
00256 
00258 
00260   vtkSetVector6Macro(OutputExtent, int);
00261   vtkGetVector6Macro(OutputExtent, int);
00262   void SetOutputExtentToDefault() {
00263     this->SetOutputExtent(VTK_INT_MIN, VTK_INT_MAX,
00264                           VTK_INT_MIN, VTK_INT_MAX,
00265                           VTK_INT_MIN, VTK_INT_MAX); };
00267 
00269 
00275   vtkSetMacro(OutputDimensionality, int);
00276   vtkGetMacro(OutputDimensionality, int);
00278 
00281   unsigned long int GetMTime();
00282 
00284   virtual void ReportReferences(vtkGarbageCollector*);
00285 
00287 
00292   void SetInterpolate(int t) {
00293     if (t && !this->GetInterpolate()) {
00294       this->SetInterpolationModeToLinear(); }
00295     else if (!t && this->GetInterpolate()) {
00296       this->SetInterpolationModeToNearestNeighbor(); } };
00297   void InterpolateOn() {
00298     this->SetInterpolate(1); };
00299   void InterpolateOff() {
00300     this->SetInterpolate(0); };
00301   int GetInterpolate() {
00302     return (this->GetInterpolationMode() != VTK_RESLICE_NEAREST); };
00304 
00306 
00309   void SetStencil(vtkImageStencilData *stencil);
00310   vtkImageStencilData *GetStencil();
00312 
00313 protected:
00314   vtkImageReslice();
00315   ~vtkImageReslice();
00316 
00317   vtkMatrix4x4 *ResliceAxes;
00318   double ResliceAxesDirectionCosines[9];
00319   double ResliceAxesOrigin[3];
00320   vtkAbstractTransform *ResliceTransform;
00321   vtkImageData *InformationInput;
00322   int Wrap;
00323   int Mirror;
00324   int Border;
00325   int InterpolationMode;
00326   int Optimization;
00327   double BackgroundColor[4];
00328   double OutputOrigin[3];
00329   double OutputSpacing[3];
00330   int OutputExtent[6];
00331   int OutputDimensionality;
00332   int TransformInputSampling;
00333   int AutoCropOutput;
00334   int HitInputExtent;
00335 
00336   vtkMatrix4x4 *IndexMatrix;
00337   vtkAbstractTransform *OptimizedTransform;
00338 
00339   void GetAutoCroppedOutputBounds(vtkInformation *inInfo, double bounds[6]);
00340   virtual int RequestInformation(vtkInformation *, vtkInformationVector **,
00341                                  vtkInformationVector *);
00342   virtual int RequestUpdateExtent(vtkInformation *, vtkInformationVector **,
00343                                   vtkInformationVector *);
00344   virtual void ThreadedRequestData(vtkInformation *request,
00345                                    vtkInformationVector **inputVector,
00346                                    vtkInformationVector *outputVector,
00347                                    vtkImageData ***inData,
00348                                    vtkImageData **outData, int ext[6], int id);
00349   virtual int FillInputPortInformation(int port, vtkInformation *info);
00350 
00351   vtkMatrix4x4 *GetIndexMatrix(vtkInformation *inInfo,
00352                                vtkInformation *outInfo);
00353   vtkAbstractTransform *GetOptimizedTransform() { 
00354     return this->OptimizedTransform; };
00355 
00356 private:
00357   vtkImageReslice(const vtkImageReslice&);  // Not implemented.
00358   void operator=(const vtkImageReslice&);  // Not implemented.
00359 };
00360 
00361 //----------------------------------------------------------------------------
00362 inline const char *vtkImageReslice::GetInterpolationModeAsString()
00363 {
00364   switch (this->InterpolationMode)
00365     {
00366     case VTK_RESLICE_NEAREST:
00367       return "NearestNeighbor";
00368     case VTK_RESLICE_LINEAR:
00369       return "Linear";
00370     case VTK_RESLICE_RESERVED_2:
00371       return "ReservedValue";
00372     case VTK_RESLICE_CUBIC:
00373       return "Cubic";
00374     default:
00375       return "";
00376     }
00377 }  
00378 
00379 #endif
00380 
00381 
00382 
00383 
00384 

Generated by  doxygen 1.7.1