00001
00002
00003
00004
00005
00006
00007
00008
00009
00010
00011
00012
00013
00014
00015
00068 #ifndef __vtkImageReslice_h
00069 #define __vtkImageReslice_h
00070
00071
00072 #include "vtkImageToImageFilter.h"
00073
00074
00075 #define VTK_RESLICE_NEAREST 0
00076 #define VTK_RESLICE_LINEAR 1
00077 #define VTK_RESLICE_CUBIC 3
00078
00079 class vtkImageData;
00080 class vtkAbstractTransform;
00081 class vtkMatrix4x4;
00082 class vtkImageStencilData;
00083
00084 class VTK_IMAGING_EXPORT vtkImageReslice : public vtkImageToImageFilter
00085 {
00086 public:
00087 static vtkImageReslice *New();
00088 vtkTypeRevisionMacro(vtkImageReslice, vtkImageToImageFilter);
00089
00090 virtual void PrintSelf(ostream& os, vtkIndent indent);
00091
00093
00105 virtual void SetResliceAxes(vtkMatrix4x4*);
00106 vtkGetObjectMacro(ResliceAxes, vtkMatrix4x4);
00108
00110
00114 void SetResliceAxesDirectionCosines(double x0, double x1, double x2,
00115 double y0, double y1, double y2,
00116 double z0, double z1, double z2);
00117 void SetResliceAxesDirectionCosines(const double x[3],
00118 const double y[3],
00119 const double z[3]) {
00120 this->SetResliceAxesDirectionCosines(x[0], x[1], x[2],
00121 y[0], y[1], y[2],
00122 z[0], z[1], z[2]); };
00123 void SetResliceAxesDirectionCosines(const double xyz[9]) {
00124 this->SetResliceAxesDirectionCosines(xyz[0], xyz[1], xyz[2],
00125 xyz[3], xyz[4], xyz[5],
00126 xyz[6], xyz[7], xyz[8]); };
00127 void GetResliceAxesDirectionCosines(double x[3], double y[3], double z[3]);
00128 void GetResliceAxesDirectionCosines(double xyz[9]) {
00129 this->GetResliceAxesDirectionCosines(&xyz[0], &xyz[3], &xyz[6]); };
00130 double *GetResliceAxesDirectionCosines() {
00131 this->GetResliceAxesDirectionCosines(this->ResliceAxesDirectionCosines);
00132 return this->ResliceAxesDirectionCosines; };
00134
00136
00139 void SetResliceAxesOrigin(double x, double y, double z);
00140 void SetResliceAxesOrigin(const double xyz[3]) {
00141 this->SetResliceAxesOrigin(xyz[0], xyz[1], xyz[2]); };
00142 void GetResliceAxesOrigin(double xyz[3]);
00143 double *GetResliceAxesOrigin() {
00144 this->GetResliceAxesOrigin(this->ResliceAxesOrigin);
00145 return this->ResliceAxesOrigin; };
00147
00149
00156 virtual void SetResliceTransform(vtkAbstractTransform*);
00157 vtkGetObjectMacro(ResliceTransform, vtkAbstractTransform);
00159
00161
00167 virtual void SetInformationInput(vtkImageData*);
00168 vtkGetObjectMacro(InformationInput, vtkImageData);
00170
00172
00176 vtkSetMacro(TransformInputSampling, int);
00177 vtkBooleanMacro(TransformInputSampling, int);
00178 vtkGetMacro(TransformInputSampling, int);
00180
00182
00184 vtkSetMacro(AutoCropOutput, int);
00185 vtkBooleanMacro(AutoCropOutput, int);
00186 vtkGetMacro(AutoCropOutput, int);
00188
00190
00191 vtkSetMacro(Wrap, int);
00192 vtkGetMacro(Wrap, int);
00193 vtkBooleanMacro(Wrap, int);
00195
00197
00199 vtkSetMacro(Mirror, int);
00200 vtkGetMacro(Mirror, int);
00201 vtkBooleanMacro(Mirror, 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, float);
00228 vtkGetVector4Macro(BackgroundColor, float);
00230
00232
00233 void SetBackgroundLevel(float v) { this->SetBackgroundColor(v,v,v,v); };
00234 float GetBackgroundLevel() { return this->GetBackgroundColor()[0]; };
00236
00238
00240 vtkSetVector3Macro(OutputSpacing, float);
00241 vtkGetVector3Macro(OutputSpacing, float);
00242 void SetOutputSpacingToDefault() {
00243 this->SetOutputSpacing(VTK_FLOAT_MAX, VTK_FLOAT_MAX, VTK_FLOAT_MAX); };
00245
00247
00249 vtkSetVector3Macro(OutputOrigin, float);
00250 vtkGetVector3Macro(OutputOrigin, float);
00251 void SetOutputOriginToDefault() {
00252 this->SetOutputOrigin(VTK_FLOAT_MAX, VTK_FLOAT_MAX, VTK_FLOAT_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 InterpolationMode;
00320 int Optimization;
00321 float BackgroundColor[4];
00322 float OutputOrigin[3];
00323 float OutputSpacing[3];
00324 int OutputExtent[6];
00325 int OutputDimensionality;
00326 int TransformInputSampling;
00327 int AutoCropOutput;
00328
00329 vtkMatrix4x4 *IndexMatrix;
00330 vtkAbstractTransform *OptimizedTransform;
00331
00332 void GetAutoCroppedOutputBounds(vtkImageData *input, float bounds[6]);
00333 void ExecuteInformation(vtkImageData *input, vtkImageData *output);
00334 void ExecuteInformation();
00335 void ComputeInputUpdateExtents(vtkDataObject *output);
00336 void ComputeInputUpdateExtent(int inExt[6], int outExt[6]);
00337 void ThreadedExecute(vtkImageData *inData, vtkImageData *outData,
00338 int ext[6], int id);
00339
00340 vtkMatrix4x4 *GetIndexMatrix();
00341 vtkAbstractTransform *GetOptimizedTransform() {
00342 return this->OptimizedTransform; };
00343 void OptimizedComputeInputUpdateExtent(int inExt[6], int outExt[6]);
00344 void OptimizedThreadedExecute(vtkImageData *inData, vtkImageData *outData,
00345 int ext[6], int id);
00346 private:
00347 vtkImageReslice(const vtkImageReslice&);
00348 void operator=(const vtkImageReslice&);
00349 };
00350
00351
00352 inline const char *vtkImageReslice::GetInterpolationModeAsString()
00353 {
00354 switch (this->InterpolationMode)
00355 {
00356 case VTK_RESLICE_NEAREST:
00357 return "NearestNeighbor";
00358 case VTK_RESLICE_LINEAR:
00359 return "Linear";
00360 case VTK_RESLICE_CUBIC:
00361 return "Cubic";
00362 default:
00363 return "";
00364 }
00365 }
00366
00367 #endif
00368
00369
00370
00371
00372