00001
00002
00003
00004
00005
00006
00007
00008
00009
00010
00011
00012
00013
00014
00015
00016
00017 #ifndef __igstkImageResliceObjectRepresentation_h
00018 #define __igstkImageResliceObjectRepresentation_h
00019
00020 #include "igstkMacros.h"
00021 #include "igstkObjectRepresentation.h"
00022 #include "igstkImageSpatialObject.h"
00023 #include "igstkStateMachine.h"
00024 #include "igstkReslicerPlaneSpatialObject.h"
00025
00026 class vtkLookupTable;
00027 class vtkImageMapToColors;
00028 class vtkImageReslice;
00029 class vtkTexture;
00030 class vtkActor;
00031 class vtkPlaneSource;
00032 class vtkOutlineFilter;
00033 class vtkPlane;
00034 class vtkPolyData;
00035 class vtkCutter;
00036 class vtkSphereSource;
00037 class vtkProperty;
00038 class vtkImageMapToColors;
00039
00040
00041 namespace igstk
00042 {
00043
00044 #define VTK_NEAREST_RESLICE 0
00045 #define VTK_LINEAR_RESLICE 1
00046 #define VTK_CUBIC_RESLICE 2
00047
00054 template < class TImageSpatialObject >
00055 class ImageResliceObjectRepresentation : public ObjectRepresentation
00056 {
00057
00058 public:
00059
00061 igstkStandardTemplatedClassTraitsMacro(
00062 ImageResliceObjectRepresentation,ObjectRepresentation )
00063
00064 public:
00065
00066 typedef TImageSpatialObject ImageSpatialObjectType;
00067
00068 typedef typename ImageSpatialObjectType::ConstPointer
00069 ImageSpatialObjectConstPointer;
00070
00071 typedef typename ImageSpatialObjectType::PointType PointType;
00072
00073 typedef ReslicerPlaneSpatialObject ReslicerPlaneType;
00074
00075 typedef ReslicerPlaneType::Pointer ReslicerPlanePointerType;
00076
00077 typedef ReslicerPlaneType::VectorType VectorType;
00078
00080 Pointer Copy() const;
00081
00082 void RequestSetReslicePlaneSpatialObject( const ReslicerPlaneType *
00083 planeSpatialObject);
00084
00086 void RequestSetImageSpatialObject( const ImageSpatialObjectType *
00087 ImageSpatialObject );
00088
00090 void SetWindowLevel( double window, double level );
00091
00093 void SetFrameColor(ColorScalarType r, ColorScalarType g, ColorScalarType b);
00094
00096 void SetRestrictPlaneToVolume(int value);
00097
00099 void SetTextureInterpolate(int value);
00100
00105 void SetResliceInterpolate(int value);
00106
00108 virtual void PrintSelf( std::ostream& os, itk::Indent indent ) const;
00109
00110
00111 protected:
00112
00114 ImageResliceObjectRepresentation();
00115
00117 ~ImageResliceObjectRepresentation();
00118
00120 void DeleteActors();
00121
00123 void CreateActors();
00124
00126 ColorScalarType GetFrameRed() const;
00127 ColorScalarType GetFrameGreen() const;
00128 ColorScalarType GetFrameBlue() const;
00129
00132 virtual bool VerifyTimeStamp() const;
00133
00134 private:
00135
00136 ImageResliceObjectRepresentation(const Self&);
00137 void operator=(const Self&);
00138
00140 ImageSpatialObjectConstPointer m_ImageSpatialObject;
00141 ImageSpatialObjectConstPointer m_ImageSpatialObjectToAdd;
00142
00144 ReslicerPlanePointerType m_ReslicePlaneSpatialObjectToBeSet;
00145 ReslicerPlanePointerType m_ReslicePlaneSpatialObject;
00146
00148 vtkImageData *m_ImageData;
00149 vtkImageReslice *m_ImageReslicer;
00150 vtkMatrix4x4 *m_ResliceAxes;
00151 vtkActor *m_ImageActor;
00152 vtkProperty *m_PlaneProperty;
00153 vtkImageMapToColors *m_ColorMap;
00154 vtkTexture *m_Texture;
00155 vtkLookupTable *m_LookupTable;
00156 vtkPlaneSource *m_PlaneSource;
00157 vtkPlane *m_Plane;
00158 vtkImageData *m_Box;
00159 vtkCutter *m_Cutter;
00160
00161
00164 ColorScalarType m_FrameColor[3];
00165
00166 int m_ResliceInterpolate;
00167 int m_TextureInterpolate;
00168 int m_RestrictPlaneToVolume;
00169
00171 double m_Level;
00172 double m_Window;
00173
00175 double m_ImageSpacing[3];
00176 double m_ImageOrigin[3];
00177 int m_ImageExtent[6];
00178 double m_xbounds[2];
00179 double m_ybounds[2];
00180 double m_zbounds[2];
00181
00183 virtual void UpdateRepresentationProcessing();
00184
00186 void NoProcessing();
00187
00189 void SetReslicePlaneSpatialObjectProcessing();
00190
00193 void SetImageSpatialObjectProcessing();
00194
00196 void ReportInvalidImageSpatialObjectProcessing( void );
00197
00199 void ReportInvalidReslicePlaneSpatialObjectProcessing( void );
00200
00202 void ReportInvalidRequestProcessing( void );
00203
00205 void UpdatePlane();
00206
00208 void GetVector1(double v1[3]);
00209
00211 void GetVector2(double v1[3]);
00212
00215 void SetImage( const vtkImageData * image );
00216
00218 void ConnectVTKPipelineProcessing();
00219
00222 igstkObserverMacro( VTKImage, VTKImageModifiedEvent,
00223 EventHelperType::VTKImagePointerType);
00224
00228 igstkObserverMacro( ReslicerPlaneCenter,
00229 ReslicerPlaneType::ReslicerPlaneCenterEvent,
00230 ReslicerPlaneType::VectorType);
00231
00232 typename ReslicerPlaneCenterObserver::Pointer m_ReslicerPlaneCenterObserver;
00233
00234 igstkObserverMacro( ReslicerPlaneNormal,
00235 ReslicerPlaneType::ReslicerPlaneNormalEvent,
00236 ReslicerPlaneType::VectorType);
00237
00238 typename ReslicerPlaneNormalObserver::Pointer m_ReslicerPlaneNormalObserver;
00239
00240
00242 igstkObserverMacro( ImageTransform, CoordinateSystemTransformToEvent,
00243 CoordinateSystemTransformToResult );
00244
00245 typename VTKImageObserver::Pointer m_VTKImageObserver;
00246
00247 private:
00248
00250 igstkDeclareInputMacro( ValidImageSpatialObject );
00251 igstkDeclareInputMacro( InValidImageSpatialObject );
00252 igstkDeclareInputMacro( ValidReslicePlaneSpatialObject );
00253 igstkDeclareInputMacro( InValidReslicePlaneSpatialObject );
00254 igstkDeclareInputMacro( ConnectVTKPipeline );
00255
00257 igstkDeclareStateMacro( Initial );
00258 igstkDeclareStateMacro( ImageSpatialObjectSet );
00259 igstkDeclareStateMacro( ReslicePlaneSpatialObjectSet );
00260 };
00261
00262 }
00263
00264 #ifndef IGSTK_MANUAL_INSTANTIATION
00265 #include "igstkImageResliceObjectRepresentation.txx"
00266 #endif
00267
00268
00269 #endif // __igstkImageResliceObjectRepresentation_h