Download presentation
Presentation is loading. Please wait.
Published byHerbert Richards Modified over 6 years ago
1
Steve Pieper, PhD Raul San Jose, PhD Alex Yarmarkovich, PhD
Slicer and ITK Steve Pieper, PhD Raul San Jose, PhD Alex Yarmarkovich, PhD
2
Overview Embedding ITK Filtering Example Generic Reader Example
vtkITK framework Filtering Example Generic Reader Example
3
How to use ITK? “Conventional Way”: Develop your own application
My application Rendering Library GUI My Algorithm My classes ITK pipeline
4
How to use ITK? “Embedding”: Develop inside your platform (Slicer way)
My platform GUI Module Rendering Module (vtk) ITK Pipeline Core Library (vtk) Library wrappers ITK
5
Slicer and ITK Data Flow: VTK – ITK – VTK VTK ITK VTK
vtkImageExport itk::VTKImageImport itk::VTKImageExport vtkImageImport
6
vtkITK: Overview vtkITKMyFilter itk::MyFilter VTK ITK
vtkImageExport itk::VTKImageImport itk::VTKImageExport vtkImageImport itk::MyFilter vtkITKMyFilter
7
vtkITK: Base classes vtkImageExport vtkImageImport
vtkITKImageToImageFilter2DFF vtkImageToImageFilter vtkITKImageToImageFilterUSUS vtkITKImageToImageFilterF2F2 vtkITKImageToImageFilter vtkITKMyFilter vtkITKImageToImageFilterF3F3 vtkImageExport vtkImageImport vtkITKImageToImageFilterFF itk::VTKImageExport<itk::Image<float>,3>> itk::VTKImageImport<itk::Image<float>,3>>
8
vtkITK: Example Case: Perform a edge-preserving filtering as a preprocessing before segmentation. Algorithm: Anisotropic diffusion process. Code: itk::GradientAnisotropicDiffusionImageFilter.
9
vtkITK: Wrapping #include "vtkITKImageToImageFilterFF.h" #include "itkGradientAnisotropicDiffusionImageFilter.h" #include "vtkObjectFactory.h" class VTK_EXPORT vtkITKGradientAnisotropicDiffusionImageFilter : public vtkITKImageToImageFilterFF { public: static vtkITKGradientAnisotropicDiffusionImageFilter *New(); vtkTypeRevisionMacro(vtkITKGradientAnisotropicDiffusionImageFilter, vtkITKImageToImageFilterFF);
10
vtkITK: Wrapping void SetConductanceParameter ( double value ) { DelegateITKInputMacro ( SetConductanceParameter, value ); }; double GetConductanceParameter () DelegateITKOutputMacro(GetConductanceParameter) ; double GetTimeStep () DelegateITKOutputMacro(GetTimeStep) ; m_Filter.GetPointer()->SetConductanceParameter(value)
11
vtkITK: Wrapping protected: //BTX
typedef itk::GradientAnisotropicDiffusionImageFilter<Superclass::InputImageType, Superclass::InputImageType> ImageFilterType; vtkITKGradientAnisotropicDiffusionImageFilter() : Superclass ( ImageFilterType::New() ){}; ~vtkITKGradientAnisotropicDiffusionImageFilter() {}; ImageFilterType* GetImageFilterPointer() { return dynamic_cast<ImageFilterType*> ( m_Filter.->GetPointer() ); //ETX private: vtkITKGradientAnisotropicDiffusionImageFilter(const vtkITKGradientAnisotropicDiffusionImageFilter&); // Not implemented. void operator=(const vtkITKGradientAnisotropicDiffusionImageFilter&); // Not implemented. }; vtkStandardNewMacro(vtkITKGradientAnisotropicDiffusionImageFilter);
12
Slicer Module ITKFilters.tcl Modules methods: core methods
proc ITKFiltersInit proc ITKFiltersBuildGUI proc ITKFiltersBuildVTK proc ITKFiltersEnter proc ITKFiltersExit Other methods: callback methods proc ITKFiltersApply …..
13
Slicer Module proc ITKFiltersInit set m ITKFilters
set Module($m,author) “NAMIC people" set Module($m,row1List) "Help Main" set Module($m,row1Name) "{Help} {Main}" set Module($m,row1,tab) Main set Module($m,procGUI) ITKFiltersBuildGUI set Module($m,procVTK) ITKFiltersBuildVTK set Module($m,procMRML) ITKFiltersUpdateGUI set Module($m,procEnter) ITKFiltersEnter set Module($m,procExit) ITKFiltersExit
14
Slicer Module proc ITKFiltersInit
set ITKFilters(filters) " GradientAnisotropicDiffusionImageFilter “ set ITKFilters($filter,params) "SetConductanceParameter SetNumberOfIterations \ SetTimeStep" set param SetConductanceParameter set ITKFilters($filter,$param) 1 set ITKFilters($filter,$param,text) "Conductance" set ITKFilters($filter,$param,maxmin) "1 10“ set ITKFilters($filter,$param,res) 0.1 set ITKFilters($filter,$param,widget) "scale"
15
proc ITKFiltersBuildGUI
Slicer Module proc ITKFiltersBuildGUI set fMain $Module(ITKFilters,fMain) set f $fMain foreach frame "Top Middle Floating Bottom" { frame $f.f$frame -bg $Gui(activeWorkspace) pack $f.f$frame -side top -padx 0 -pady $Gui(pad) -fill x } …..
16
proc ITKFiltersBuildGUI
Slicer Module proc ITKFiltersBuildGUI "scale" { eval {label $fwidget.l$param -text $ITKFilters($filter,$param,text) \ -width 12 -justify right } $Gui(WLA) eval {entry $fwidget.e$param -justify right -width 4 \ -textvariable ITKFilters($filter,$param) } $Gui(WEA) eval {scale $fwidget.s$param \ -from [lindex $ITKFilters($filter,$param,maxmin) 0] \ -to [lindex $ITKFilters($filter,$param,maxmin) 1] \ -variable ITKFilters($filter,$param)\ -orient vertical \ -resolution $ITKFilters($filter,$param,res) } $Gui(WSA) pack $fwidget.l$param $fwidget.e$param $fwidget.s$param \ -side left -padx $Gui(pad) -pady 0 }
17
Slicer Module proc ITKFiltersApply #Preparing INPUT and OUTPUT volume
If {$v2 == -5} { set name [Volume($v1,node) GetName] set v2 [DevCreateNewCopiedVolume $v1 "" ${name}_filter ] set node [Volume($v2,vol) GetMrmlNode] Mrml(dataTree) RemoveItem $node set nodeBefore [Volume($v1,vol) GetMrmlNode] Mrml(dataTree) InsertAfterItem $nodeBefore $node MainUpdateMRML } else { set v2name [Volume($v2,node) GetName] set continue [DevOKCancel "Overwrite $v2name?"] if {$continue == "cancel"} { return 1 } # They say it is OK, so overwrite! Volume($v2,node) Copy Volume($v1,node) }
18
Slicer Module proc ITKFiltersApply #Caster vtkImageCast _cast
_cast SetOutputScalarTypeToFloat _cast SetInput [Volume($v1,vol) GetOutput] _cast Update #Create Object vtkITK$filter _filter foreach param $ITKFilters($filter,params) { _filter $param $ITKFilters($filter,$param) } _filter SetInput [_cast GetOutput]
19
Slicer Module proc ITKFiltersApply
_filter AddObserver StartEvent MainStartProgress _filter AddObserver EndEvent MainEndProgress _filter AddObserver ProgressEvent "MainShowProgress _filter" _filter Update #Assign output [Volume($v2,vol) GetOutput] DeepCopy [_filter GetOutput] #Destroy pipeline _cast Delete _filter SetOutput "" _filter Delete
20
Demo
21
Enjoy!
22
vtkConnectVTKITK ITK itkMyFilterFF Slicer Module VTK ITK VTK CableSwig
vtkImageExport itk::VTKImageImport itk::VTKImageExport vtkImageImport
Similar presentations
© 2024 SlidePlayer.com. Inc.
All rights reserved.