Main Page   Class Hierarchy   Alphabetical List   Compound List   File List   Compound Members   File Members   Related Pages  

contrib/vtkImageReslice.h

Go to the documentation of this file.
00001 /*=========================================================================
00002 
00003   Program:   Visualization Toolkit
00004   Module:    $RCSfile: vtkImageReslice.h,v $
00005   Language:  C++
00006 
00007 Copyright (c) 1993-2001 Ken Martin, Will Schroeder, Bill Lorensen 
00008 All rights reserved.
00009 
00010 Redistribution and use in source and binary forms, with or without
00011 modification, are permitted provided that the following conditions are met:
00012 
00013  * Redistributions of source code must retain the above copyright notice,
00014    this list of conditions and the following disclaimer.
00015 
00016  * Redistributions in binary form must reproduce the above copyright notice,
00017    this list of conditions and the following disclaimer in the documentation
00018    and/or other materials provided with the distribution.
00019 
00020  * Neither name of Ken Martin, Will Schroeder, or Bill Lorensen nor the names
00021    of any contributors may be used to endorse or promote products derived
00022    from this software without specific prior written permission.
00023 
00024  * Modified source versions must be plainly marked as such, and must not be
00025    misrepresented as being the original software.
00026 
00027 THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS ``AS IS''
00028 AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE
00029 IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE
00030 ARE DISCLAIMED. IN NO EVENT SHALL THE AUTHORS OR CONTRIBUTORS BE LIABLE FOR
00031 ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL
00032 DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR
00033 SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER
00034 CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY,
00035 OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE
00036 OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
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 //BTX
00170   vtkMatrix4x4 *GetIndexMatrix();
00171   int FindExtent(int& r1, int& r2, float *point, float *xAxis,
00172             int *inMin, int *inMax, int *outExt);
00173 //ETX
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 

Generated on Wed Nov 21 12:26:55 2001 for VTK by doxygen1.2.11.1 written by Dimitri van Heesch, © 1997-2001