#include <LayerImageBase.h>
Public Member Functions | |
LayerImageBase () | |
virtual | ~LayerImageBase () |
void | SetZ (int z) |
void | SetImage (vtkImageData *image) |
void | SetwxVtkBaseView (wxVtkBaseView *baseview) |
void | onThreshold () |
void | onThresholdChange () |
void | onThresholdInterpolation (bool interpolate) |
void | onThresholdChangeOpacity (int opacity) |
void | onThresholdRemove () |
wxVtkBaseView * | GetwxVtkBaseView () |
void | Refresh () |
Protected Member Functions | |
virtual int | GetZ () |
vtkLookupTable * | GetThresholdTable () |
vtkImageData * | GetImage () |
Private Member Functions | |
virtual void | ConfigLookupTable ()=0 |
bool | GetActorPresent () |
int | CleanZ (int z) |
Private Attributes | |
int | _Z |
bool | _actorPresent |
vtkImageData * | _image |
vtkImageReslice * | _imageReslicer |
vtkLookupTable * | _thresholdTable |
vtkImageMapToColors * | _thresholdMapper |
vtkImageActor * | _thresholdActor |
wxVtkBaseView * | _baseView |
Definition at line 24 of file LayerImageBase.h.
LayerImageBase::LayerImageBase | ( | ) |
Definition at line 9 of file LayerImageBase.cxx.
References _actorPresent, _baseView, _image, _imageReslicer, _thresholdActor, _thresholdMapper, _thresholdTable, and _Z.
00010 { 00011 _actorPresent = false; 00012 _Z = 0; 00013 _thresholdTable = NULL; 00014 _thresholdMapper = NULL; 00015 _thresholdActor = NULL; 00016 _image = NULL; 00017 _baseView = NULL; 00018 _imageReslicer = vtkImageReslice::New(); 00019 00020 }
LayerImageBase::~LayerImageBase | ( | ) | [virtual] |
Definition at line 23 of file LayerImageBase.cxx.
int LayerImageBase::CleanZ | ( | int | z | ) | [private] |
Definition at line 88 of file LayerImageBase.cxx.
References _image.
Referenced by onThreshold().
00089 { 00090 int ext[6]; 00091 _image->GetWholeExtent(ext); 00092 00093 if (z<0) 00094 { 00095 z=0; 00096 } 00097 00098 if ( z > (ext[5]-ext[4]) ) 00099 { 00100 z=ext[5]-ext[4]; 00101 } 00102 00103 return z; 00104 }
virtual void LayerImageBase::ConfigLookupTable | ( | ) | [private, pure virtual] |
Implemented in ColorLayerImageView, and ThresholdImageView.
Referenced by onThreshold().
bool LayerImageBase::GetActorPresent | ( | ) | [private] |
Definition at line 46 of file LayerImageBase.cxx.
References _actorPresent.
Referenced by onThreshold().
00047 { 00048 return _actorPresent; 00049 }
vtkImageData * LayerImageBase::GetImage | ( | ) | [protected] |
Definition at line 40 of file LayerImageBase.cxx.
References _image.
Referenced by ThresholdImageView::ConfigLookupTable(), ColorLayerImageView::ConfigLookupTable(), and onThreshold().
00041 { 00042 return _image; 00043 }
vtkLookupTable * LayerImageBase::GetThresholdTable | ( | ) | [protected] |
Definition at line 82 of file LayerImageBase.cxx.
References _thresholdTable.
Referenced by ThresholdImageView::ConfigLookupTable(), and ColorLayerImageView::ConfigLookupTable().
00083 { 00084 return _thresholdTable; 00085 }
wxVtkBaseView * LayerImageBase::GetwxVtkBaseView | ( | ) |
Definition at line 66 of file LayerImageBase.cxx.
References _baseView.
Referenced by ThresholdImageViewPanel::onChangeOpacity(), ThresholdImageViewPanel::onThresholdChange(), ThresholdImageViewPanel::onThresholdInterpolation(), and ThresholdImageViewPanel::onThresholdShow().
00067 { 00068 return _baseView; 00069 }
int LayerImageBase::GetZ | ( | ) | [protected, virtual] |
Reimplemented in ColorLayerImageView.
Definition at line 34 of file LayerImageBase.cxx.
References _Z.
Referenced by onThreshold().
00035 { 00036 return _Z; 00037 }
void LayerImageBase::onThreshold | ( | ) |
Definition at line 107 of file LayerImageBase.cxx.
References _actorPresent, _baseView, _image, _imageReslicer, _thresholdActor, _thresholdMapper, _thresholdTable, CleanZ(), ConfigLookupTable(), GetActorPresent(), GetImage(), wxVtkBaseView::GetRenderer(), and GetZ().
Referenced by ColorLayerImageViewPanel::onReadImage(), ColorLayerImageViewPanel::onSliceFixDinamic(), ColorLayerImageViewPanel::onSliceImage(), onThresholdChange(), ThresholdImageViewPanel::onThresholdShow(), and ColorLayerImageViewPanel::onThresholdShow().
00108 { 00109 00110 if ((_image!=NULL) && (_baseView!=NULL)) 00111 { 00112 int z=CleanZ( GetZ() ); 00113 00114 if (!GetActorPresent()) 00115 { 00116 if (_thresholdTable==NULL) 00117 { 00118 //Lookup Table 00119 _thresholdTable = vtkLookupTable::New(); 00120 } // _thresholdTable 00121 00122 if (_thresholdMapper==NULL) 00123 { 00124 _thresholdMapper = vtkImageMapToColors::New( ); 00125 } 00126 00127 if (_thresholdActor==NULL) 00128 { 00129 _thresholdActor = vtkImageActor::New( ); 00130 _thresholdActor->SetOpacity( 0.6 ); 00131 _thresholdActor->InterpolateOn( ); 00132 _thresholdActor->SetPosition( 0,0, 900-1 ); 00133 } // _thresholdActor 00134 _baseView->GetRenderer()->AddActor( _thresholdActor ); 00135 _actorPresent = true; 00136 } // !GetActorPresent() 00137 00138 ConfigLookupTable(); // virtual method 00139 _imageReslicer->SetInput( GetImage() ); 00140 _imageReslicer->SetInformationInput( GetImage() ); 00141 _imageReslicer->SetResliceAxesDirectionCosines(1,0,0, 0,1,0 ,0,0,1); 00142 _imageReslicer->SetOutputDimensionality(2); 00143 _imageReslicer->SetInterpolationModeToLinear(); 00144 _imageReslicer->SetResliceAxesOrigin(0,0,z); 00145 00146 vtkImageData *img = _imageReslicer->GetOutput(); 00147 img->Update(); 00148 img->UpdateInformation(); 00149 00150 _thresholdMapper->SetInput( img ); 00151 _thresholdMapper->SetLookupTable( _thresholdTable ); 00152 _thresholdActor->SetInput( _thresholdMapper->GetOutput() ); 00153 } // _image 00154 }
void LayerImageBase::onThresholdChange | ( | ) |
Definition at line 159 of file LayerImageBase.cxx.
References _actorPresent, and onThreshold().
Referenced by ThresholdImageViewPanel::onThresholdChange(), and ColorLayerImageViewPanel::onThresholdChange().
00160 { 00161 if (_actorPresent) 00162 { 00163 onThreshold(); 00164 } 00165 }
void LayerImageBase::onThresholdChangeOpacity | ( | int | opacity | ) |
Definition at line 184 of file LayerImageBase.cxx.
References _actorPresent, and _thresholdActor.
Referenced by ThresholdImageViewPanel::onChangeOpacity(), and ColorLayerImageViewPanel::onChangeOpacity().
00185 { 00186 if (_actorPresent) 00187 { 00188 _thresholdActor->SetOpacity(opacity*0.1); 00189 } 00190 }
void LayerImageBase::onThresholdInterpolation | ( | bool | interpolate | ) |
Definition at line 168 of file LayerImageBase.cxx.
References _thresholdActor.
Referenced by ThresholdImageViewPanel::onThresholdInterpolation(), and ColorLayerImageViewPanel::onThresholdInterpolation().
00169 { 00170 if (_thresholdActor!=NULL) 00171 { 00172 if (interpolate) 00173 { 00174 _thresholdActor->InterpolateOn( ); 00175 } 00176 else 00177 { 00178 _thresholdActor->InterpolateOff( ); 00179 } 00180 } 00181 }
void LayerImageBase::onThresholdRemove | ( | ) |
Definition at line 193 of file LayerImageBase.cxx.
References _actorPresent, _baseView, _thresholdActor, and wxVtkBaseView::GetRenderer().
Referenced by ThresholdImageViewPanel::onThresholdShow(), ColorLayerImageViewPanel::onThresholdShow(), ThresholdImageViewPanel::onThresholdStop(), and ColorLayerImageViewPanel::onThresholdStop().
00194 { 00195 if (_actorPresent) 00196 { 00197 wxVtkBaseView * baseView = _baseView; 00198 baseView->GetRenderer()->RemoveActor( _thresholdActor ); 00199 _actorPresent = false; 00200 } 00201 }
void LayerImageBase::Refresh | ( | ) |
Definition at line 72 of file LayerImageBase.cxx.
References _baseView, and wxVtkBaseView::Refresh().
Referenced by ColorLayerImageViewPanel::onChangeOpacity(), ColorLayerImageViewPanel::onReadImage(), ColorLayerImageViewPanel::onSliceFixDinamic(), ColorLayerImageViewPanel::onSliceImage(), ColorLayerImageViewPanel::onThresholdChange(), ColorLayerImageViewPanel::onThresholdInterpolation(), and ColorLayerImageViewPanel::onThresholdShow().
void LayerImageBase::SetImage | ( | vtkImageData * | image | ) |
Definition at line 54 of file LayerImageBase.cxx.
References _image.
Referenced by ColorLayerImageViewPanel::onReadImage().
00055 { 00056 _image = image; 00057 }
void LayerImageBase::SetwxVtkBaseView | ( | wxVtkBaseView * | baseview | ) |
Definition at line 60 of file LayerImageBase.cxx.
References _baseView.
00061 { 00062 _baseView = baseview; 00063 }
void LayerImageBase::SetZ | ( | int | z | ) |
bool LayerImageBase::_actorPresent [private] |
Definition at line 43 of file LayerImageBase.h.
Referenced by GetActorPresent(), LayerImageBase(), onThreshold(), onThresholdChange(), onThresholdChangeOpacity(), and onThresholdRemove().
wxVtkBaseView* LayerImageBase::_baseView [private] |
Definition at line 49 of file LayerImageBase.h.
Referenced by GetwxVtkBaseView(), LayerImageBase(), onThreshold(), onThresholdRemove(), Refresh(), and SetwxVtkBaseView().
vtkImageData* LayerImageBase::_image [private] |
Definition at line 44 of file LayerImageBase.h.
Referenced by CleanZ(), GetImage(), LayerImageBase(), onThreshold(), and SetImage().
vtkImageReslice* LayerImageBase::_imageReslicer [private] |
Definition at line 45 of file LayerImageBase.h.
Referenced by LayerImageBase(), and onThreshold().
vtkImageActor* LayerImageBase::_thresholdActor [private] |
Definition at line 48 of file LayerImageBase.h.
Referenced by LayerImageBase(), onThreshold(), onThresholdChangeOpacity(), onThresholdInterpolation(), and onThresholdRemove().
vtkImageMapToColors* LayerImageBase::_thresholdMapper [private] |
Definition at line 47 of file LayerImageBase.h.
Referenced by LayerImageBase(), and onThreshold().
vtkLookupTable* LayerImageBase::_thresholdTable [private] |
Definition at line 46 of file LayerImageBase.h.
Referenced by GetThresholdTable(), LayerImageBase(), and onThreshold().
int LayerImageBase::_Z [private] |
Definition at line 42 of file LayerImageBase.h.
Referenced by GetZ(), LayerImageBase(), and SetZ().