00001
00002
00003
00004
00005
00006
00007
00008
00009
00010
00011
00012
00013
00014
00015
00058
#ifndef __vtkImageReslice_h
00059
#define __vtkImageReslice_h
00060
00061
00062
#include "vtkImageToImageFilter.h"
00063
00064
00065 #define VTK_RESLICE_NEAREST 0
00066 #define VTK_RESLICE_LINEAR 1
00067 #define VTK_RESLICE_CUBIC 3
00068
00069
class vtkImageData;
00070
class vtkAbstractTransform;
00071
class vtkMatrix4x4;
00072
class vtkImageStencilData;
00073
00074 class VTK_IMAGING_EXPORT vtkImageReslice :
public vtkImageToImageFilter
00075 {
00076
public:
00077
static vtkImageReslice *
New();
00078 vtkTypeRevisionMacro(vtkImageReslice,
vtkImageToImageFilter);
00079
00080
virtual void PrintSelf(ostream& os,
vtkIndent indent);
00081
00083
00095
virtual void SetResliceAxes(
vtkMatrix4x4*);
00096 vtkGetObjectMacro(ResliceAxes,
vtkMatrix4x4);
00098
00100
00104
void SetResliceAxesDirectionCosines(
double x0,
double x1,
double x2,
00105
double y0,
double y1,
double y2,
00106
double z0,
double z1,
double z2);
00107 void SetResliceAxesDirectionCosines(
const double x[3],
00108
const double y[3],
00109
const double z[3]) {
00110 this->SetResliceAxesDirectionCosines(x[0], x[1], x[2],
00111 y[0], y[1], y[2],
00112 z[0], z[1], z[2]); };
00113 void SetResliceAxesDirectionCosines(
const double xyz[9]) {
00114 this->SetResliceAxesDirectionCosines(xyz[0], xyz[1], xyz[2],
00115 xyz[3], xyz[4], xyz[5],
00116 xyz[6], xyz[7], xyz[8]); };
00117
void GetResliceAxesDirectionCosines(
double x[3],
double y[3],
double z[3]);
00118 void GetResliceAxesDirectionCosines(
double xyz[9]) {
00119 this->GetResliceAxesDirectionCosines(&xyz[0], &xyz[3], &xyz[6]); };
00120 double *GetResliceAxesDirectionCosines() {
00121 this->GetResliceAxesDirectionCosines(this->ResliceAxesDirectionCosines);
00122
return this->ResliceAxesDirectionCosines; };
00124
00126
00129
void SetResliceAxesOrigin(
double x,
double y,
double z);
00130 void SetResliceAxesOrigin(
const double xyz[3]) {
00131 this->SetResliceAxesOrigin(xyz[0], xyz[1], xyz[2]); };
00132
void GetResliceAxesOrigin(
double xyz[3]);
00133 double *GetResliceAxesOrigin() {
00134 this->GetResliceAxesOrigin(this->ResliceAxesOrigin);
00135
return this->ResliceAxesOrigin; };
00137
00139
00146
virtual void SetResliceTransform(
vtkAbstractTransform*);
00147 vtkGetObjectMacro(ResliceTransform,
vtkAbstractTransform);
00149
00151
00157
virtual void SetInformationInput(
vtkImageData*);
00158 vtkGetObjectMacro(InformationInput,
vtkImageData);
00160
00162
00166 vtkSetMacro(TransformInputSampling,
int);
00167 vtkBooleanMacro(TransformInputSampling,
int);
00168 vtkGetMacro(TransformInputSampling,
int);
00170
00172
00174 vtkSetMacro(AutoCropOutput,
int);
00175 vtkBooleanMacro(AutoCropOutput,
int);
00176 vtkGetMacro(AutoCropOutput,
int);
00178
00180
00181 vtkSetMacro(Wrap,
int);
00182 vtkGetMacro(Wrap,
int);
00183 vtkBooleanMacro(Wrap,
int);
00185
00187
00189 vtkSetMacro(Mirror,
int);
00190 vtkGetMacro(Mirror,
int);
00191 vtkBooleanMacro(Mirror,
int);
00193
00195
00196 vtkSetMacro(InterpolationMode,
int);
00197 vtkGetMacro(InterpolationMode,
int);
00198 void SetInterpolationModeToNearestNeighbor() {
00199 this->SetInterpolationMode(
VTK_RESLICE_NEAREST); };
00200 void SetInterpolationModeToLinear() {
00201 this->SetInterpolationMode(
VTK_RESLICE_LINEAR); };
00202 void SetInterpolationModeToCubic() {
00203 this->SetInterpolationMode(
VTK_RESLICE_CUBIC); };
00204
const char *GetInterpolationModeAsString();
00206
00208
00210 vtkSetMacro(Optimization,
int);
00211 vtkGetMacro(Optimization,
int);
00212 vtkBooleanMacro(Optimization,
int);
00214
00216
00217 vtkSetVector4Macro(BackgroundColor,
float);
00218 vtkGetVector4Macro(BackgroundColor,
float);
00220
00222
00223 void SetBackgroundLevel(
float v) { this->SetBackgroundColor(v,v,v,v); };
00224 float GetBackgroundLevel() {
return this->GetBackgroundColor()[0]; };
00226
00228
00230 vtkSetVector3Macro(OutputSpacing,
float);
00231 vtkGetVector3Macro(OutputSpacing,
float);
00232 void SetOutputSpacingToDefault() {
00233 this->SetOutputSpacing(
VTK_FLOAT_MAX,
VTK_FLOAT_MAX,
VTK_FLOAT_MAX); };
00235
00237
00239 vtkSetVector3Macro(OutputOrigin,
float);
00240 vtkGetVector3Macro(OutputOrigin,
float);
00241 void SetOutputOriginToDefault() {
00242 this->SetOutputOrigin(
VTK_FLOAT_MAX,
VTK_FLOAT_MAX,
VTK_FLOAT_MAX); };
00244
00246
00248 vtkSetVector6Macro(OutputExtent,
int);
00249 vtkGetVector6Macro(OutputExtent,
int);
00250 void SetOutputExtentToDefault() {
00251 this->SetOutputExtent(
VTK_INT_MIN,
VTK_INT_MAX,
00252
VTK_INT_MIN,
VTK_INT_MAX,
00253
VTK_INT_MIN,
VTK_INT_MAX); };
00255
00257
00263 vtkSetMacro(OutputDimensionality,
int);
00264 vtkGetMacro(OutputDimensionality,
int);
00266
00269
unsigned long int GetMTime();
00270
00272
00277 void SetInterpolate(
int t) {
00278
if (t && !this->GetInterpolate()) {
00279 this->SetInterpolationModeToLinear(); }
00280
else if (!t && this->GetInterpolate()) {
00281 this->SetInterpolationModeToNearestNeighbor(); } };
00282 void InterpolateOn() {
00283 this->SetInterpolate(1); };
00284 void InterpolateOff() {
00285 this->SetInterpolate(0); };
00286 int GetInterpolate() {
00287
return (this->GetInterpolationMode() !=
VTK_RESLICE_NEAREST); };
00289
00291
00294
void SetStencil(
vtkImageStencilData *stencil);
00295
vtkImageStencilData *GetStencil();
00297
00298
protected:
00299 vtkImageReslice();
00300 ~vtkImageReslice();
00301
00302 vtkMatrix4x4 *ResliceAxes;
00303 double ResliceAxesDirectionCosines[9];
00304 double ResliceAxesOrigin[3];
00305 vtkAbstractTransform *ResliceTransform;
00306 vtkImageData *InformationInput;
00307 int Wrap;
00308 int Mirror;
00309 int InterpolationMode;
00310 int Optimization;
00311 float BackgroundColor[4];
00312 float OutputOrigin[3];
00313 float OutputSpacing[3];
00314 int OutputExtent[6];
00315 int OutputDimensionality;
00316 int TransformInputSampling;
00317 int AutoCropOutput;
00318
00319 vtkMatrix4x4 *IndexMatrix;
00320 vtkAbstractTransform *OptimizedTransform;
00321
00322
void GetAutoCroppedOutputBounds(
vtkImageData *input,
float bounds[6]);
00323
void ExecuteInformation(
vtkImageData *input,
vtkImageData *output);
00324
void ExecuteInformation();
00325
void ComputeInputUpdateExtents(
vtkDataObject *output);
00326
void ComputeInputUpdateExtent(
int inExt[6],
int outExt[6]);
00327
void ThreadedExecute(
vtkImageData *inData,
vtkImageData *outData,
00328
int ext[6],
int id);
00329
00330
vtkMatrix4x4 *GetIndexMatrix();
00331 vtkAbstractTransform *GetOptimizedTransform() {
00332
return this->OptimizedTransform; };
00333
void OptimizedComputeInputUpdateExtent(
int inExt[6],
int outExt[6]);
00334
void OptimizedThreadedExecute(
vtkImageData *inData,
vtkImageData *outData,
00335
int ext[6],
int id);
00336
private:
00337 vtkImageReslice(
const vtkImageReslice&);
00338
void operator=(
const vtkImageReslice&);
00339 };
00340
00341
00342 inline const char *
vtkImageReslice::GetInterpolationModeAsString()
00343 {
00344
switch (this->
InterpolationMode)
00345 {
00346
case VTK_RESLICE_NEAREST:
00347
return "NearestNeighbor";
00348
case VTK_RESLICE_LINEAR:
00349
return "Linear";
00350
case VTK_RESLICE_CUBIC:
00351
return "Cubic";
00352
default:
00353
return "";
00354 }
00355 }
00356
00357
#endif
00358
00359
00360
00361
00362