00001
00002
00003
00004
00005
00006
00007
00008
00009
00010
00011
00012
00013
00014
00015
00016
00017
00018
00019
00020
00021
00022
00023
00024
00025
00026
00027
00028
00029
00030
00031
00032
00033
00034
00035
00036
00037
00038
00065 #ifndef __vtkImageReslice_h
00066 #define __vtkImageReslice_h
00067
00068
00069 #include "vtkImageToImageFilter.h"
00070 #include "vtkAbstractTransform.h"
00071 #include "vtkMatrix4x4.h"
00072
00073 class vtkMatrix4x4;
00074
00075 #define VTK_RESLICE_NEAREST 0
00076 #define VTK_RESLICE_LINEAR 1
00077 #define VTK_RESLICE_CUBIC 3
00078
00079 class VTK_EXPORT vtkImageReslice : public vtkImageToImageFilter
00080 {
00081 public:
00082 static vtkImageReslice *New();
00083 vtkTypeMacro(vtkImageReslice,vtkImageToImageFilter);
00084
00085 virtual void PrintSelf(ostream& os, vtkIndent indent);
00086
00101 vtkSetObjectMacro(ResliceAxes,vtkMatrix4x4);
00102 vtkGetObjectMacro(ResliceAxes,vtkMatrix4x4);
00103
00109 vtkSetObjectMacro(ResliceTransform,vtkAbstractTransform);
00110 vtkGetObjectMacro(ResliceTransform,vtkAbstractTransform);
00111
00113 vtkSetMacro(Wrap,int);
00114 vtkGetMacro(Wrap,int);
00115 vtkBooleanMacro(Wrap,int);
00116
00119 vtkSetMacro(Mirror,int);
00120 vtkGetMacro(Mirror,int);
00121 vtkBooleanMacro(Mirror,int);
00122
00124 vtkSetMacro(InterpolationMode,int);
00125 vtkGetMacro(InterpolationMode,int);
00126 void SetInterpolationModeToNearestNeighbor()
00127 { this->SetInterpolationMode(VTK_RESLICE_NEAREST); };
00128 void SetInterpolationModeToLinear()
00129 { this->SetInterpolationMode(VTK_RESLICE_LINEAR); };
00130 void SetInterpolationModeToCubic()
00131 { this->SetInterpolationMode(VTK_RESLICE_CUBIC); };
00132 const char *GetInterpolationModeAsString();
00133
00136 vtkSetMacro(Optimization,int);
00137 vtkGetMacro(Optimization,int);
00138 vtkBooleanMacro(Optimization,int);
00139
00141 vtkSetVector4Macro(BackgroundColor, float);
00142 vtkGetVector4Macro(BackgroundColor, float);
00143
00145 void SetBackgroundLevel(float v) {this->SetBackgroundColor(v,v,v,v);};
00146 float GetBackgroundLevel() { return this->GetBackgroundColor()[0]; };
00147
00154 vtkSetVector3Macro(OutputSpacing, float);
00155 vtkGetVector3Macro(OutputSpacing, float);
00156 vtkSetVector3Macro(OutputOrigin, float);
00157 vtkGetVector3Macro(OutputOrigin, float);
00158 vtkSetVector6Macro(OutputExtent, int);
00159 vtkGetVector6Macro(OutputExtent, int);
00160 vtkSetClampMacro( OutputAlwaysCenteredOnInput, int, 0, 1 );
00161 vtkGetMacro( OutputAlwaysCenteredOnInput, int );
00162 vtkBooleanMacro( OutputAlwaysCenteredOnInput, int );
00163
00166 unsigned long int GetMTime();
00167
00168
00170 vtkMatrix4x4 *GetIndexMatrix();
00171 int FindExtent(int& r1, int& r2, float *point, float *xAxis,
00172 int *inMin, int *inMax, int *outExt);
00173
00174
00177 void SetInterpolate(int t) {
00178 this->SetInterpolationMode((t ? VTK_RESLICE_LINEAR :
00179 VTK_RESLICE_NEAREST)); };
00180 void InterpolateOn() {
00181 this->SetInterpolationModeToLinear(); };
00182 void InterpolateOff() {
00183 this->SetInterpolationModeToNearestNeighbor(); };
00184 int GetInterpolate() {
00185 return (this->GetInterpolationMode() != VTK_RESLICE_NEAREST); };
00186
00187 protected:
00188 vtkImageReslice();
00189 ~vtkImageReslice();
00190 vtkImageReslice(const vtkImageReslice&) {};
00191 void operator=(const vtkImageReslice&) {};
00192
00193 vtkMatrix4x4 *ResliceAxes;
00194 vtkAbstractTransform *ResliceTransform;
00195 vtkMatrix4x4 *IndexMatrix;
00196 int Wrap;
00197 int Mirror;
00198 int InterpolationMode;
00199 int Optimization;
00200 float BackgroundColor[4];
00201 float OutputOrigin[3];
00202 float OutputSpacing[3];
00203 int OutputExtent[6];
00204 int OutputAlwaysCenteredOnInput;
00205
00206 void ExecuteInformation(vtkImageData *input, vtkImageData *output);
00207 void ExecuteInformation(){this->vtkImageToImageFilter::ExecuteInformation();};
00208 void ComputeInputUpdateExtent(int inExt[6], int outExt[6]);
00209 void ThreadedExecute(vtkImageData *inData, vtkImageData *outData,
00210 int ext[6], int id);
00211 void OptimizedComputeInputUpdateExtent(int inExt[6], int outExt[6]);
00212 void OptimizedThreadedExecute(vtkImageData *inData, vtkImageData *outData,
00213 int ext[6], int id);
00214 };
00215
00216
00217 inline const char *vtkImageReslice::GetInterpolationModeAsString()
00218 {
00219 switch (this->InterpolationMode)
00220 {
00221 case VTK_RESLICE_NEAREST:
00222 return "NearestNeighbor";
00223 case VTK_RESLICE_LINEAR:
00224 return "Linear";
00225 case VTK_RESLICE_CUBIC:
00226 return "Cubic";
00227 default:
00228 return "";
00229 }
00230 }
00231
00232 #endif
00233
00234
00235
00236
00237