1 / 43

Integration of ITK Into SCIRun

Integration of ITK Into SCIRun. Yarden Livnat Darby Van Uitert Joshua Cates. Aims. Integrate ITK into SCIRun No changes to ITK Minimal changes to SCIRun Easy to apply to all old and new ITK filters. The Players. SCIRun. The Players. SCIRun. ITK. Anisotropic Diffusion Filter.

jerzy
Download Presentation

Integration of ITK Into SCIRun

An Image/Link below is provided (as is) to download presentation Download Policy: Content on the Website is provided to you AS IS for your information and personal use and may not be sold / licensed / shared on other websites without getting consent from its author. Content is provided to you AS IS for your information and personal use only. Download presentation by click this link. While downloading, if for some reason you are not able to download a presentation, the publisher may have deleted the file from their server. During download, if you can't get a presentation, the file might be deleted by the publisher.

E N D

Presentation Transcript


  1. Integration of ITK IntoSCIRun Yarden Livnat Darby Van Uitert Joshua Cates

  2. Aims Integrate ITK into SCIRun • No changes to ITK • Minimal changes to SCIRun • Easy to apply to all old and new ITK filters

  3. The Players SCIRun

  4. The Players SCIRun ITK Anisotropic Diffusion Filter Parameters Watershed Filter Filter Filter

  5. Proposed Solution GUI ITK Filter Automated as much as possible

  6. itk_filter.xml  XSL sci_filter.h sci_filter.cc sci_filter.tcl sci_filter.xml XML

  7. itk_filter.xml  XSL sci_filter.h sci_filter.cc sci_filter_gui.xml  XSL sci_filter.tcl sci_filter.tcl sci_filter.xml XML

  8. itk_filter.xml  XSL sci_filter.h sci_filter.cc sci_filter_gui.xml  XSL sci_filter.tcl sci_filter.tcl sci_filter.xml GUI GUI GUI GUI sci_filter_gui.xml sci_filter_gui.xml sci_filter_gui.xml sci_filter_gui.xml XML

  9. itk_filter.xml  XSL sci_filter.h sci_filter.cc sci_filter_gui.xml  XSL sci_filter.tcl sci_filter.tcl sci_filter.xml XML sci_filter.xml  XSL: • include files, more instantiation information

  10. Trivial • Instantiation information in an XML file to be used during code generation Templated Filters • One module per instantiation 2) Switch statement 3) Dynamic Compilation • Non-templated base classes

  11. Summary Validated with DTD ! XML Files – 3 per filter itk_filter.xml created by ITK developers sci_filter.xml created by developer/ITK user sci_filter_gui.xml created by developer/ITK user

  12. Summary Validated with DTD ! XML Files – 3 per filter itk_filter.xml created by ITK developers sci_filter.xml created by developer/ITK user sci_filter_gui.xml created by developer/ITK user

  13. Summary Validated with DTD ! XML Files – 3 per filter itk_filter.xml created by ITK developers sci_filter.xml created by developer/ITK user sci_filter_gui.xml created by developer/ITK user XSL Files – 3 per system GenerateCC.xsl created by us for GenerateTCL.xsl generating our GenerateXML.xsl specific code

  14. Adding a New Filter ReflectImageFilter Steps: • Write itk_ReflectImageFilter.xml • Write basic sci_ReflectImageFilter.xml • Generate module • Write gui_ReflectImageFilter.xml

  15. <filter-itk name=“itk::ReflectImageFilter”> <description> Reflects an image along a selected direction. </description> <templated> … </templated> <inputs> … </inputs> <outputs> … </outputs> <parameters> … </parameters> <includes> … </includes> </filter-itk> Example – itk_filter.xml

  16. <filter-itk name=“itk::ReflectImageFilter”> <description> Reflects an image along a selected direction. </description> <templated> … </templated> <inputs> … </inputs> <outputs> … </outputs> <parameters> … </parameters> <includes> … </includes> </filter-itk> <templated> <template>InputImageType</template> <template>OutputImageType</template> <defaults> <default> itk::Image< float, 2> </default> <default> itk::Image< float, 2> </default> </defaults> </templated> Example – itk_filter.xml

  17. <filter-itk name=“itk::ReflectImageFilter”> <description> Reflects an image along a selected direction. </description> <templated> … </templated> <inputs> … </inputs> <outputs> … </outputs> <parameters> … </parameters> <includes> … </includes> </filter-itk> <inputs> <input name=“SourceImage” > <type> InputImageType </type> <call> SetInput </call> </input> </inputs> Example – itk_filter.xml

  18. <filter-itk name=“itk::ReflectImageFilter”> <description> Reflects an image along a selected direction. </description> <templated> … </templated> <inputs> … </inputs> <outputs> … </outputs> <parameters> … </parameters> <includes> … </includes> </filter-itk> <parameters> <param> <name> direction </name> <type> int </type> <call> SetDirection </call> </param> </parameters> Example – itk_filter.xml

  19. <filter-itk name=“itk::ReflectImageFilter”> <description> Reflects an image along a selected direction. </description> <templated> … </templated> <inputs> … </inputs> <outputs> … </outputs> <parameters> … </parameters> <includes> … </includes> </filter-itk> <includes> <file> itkReflectImageFilter.h </file> </includes> Example – itk_filter.xml

  20. <filter name=“ReflectImageFilter”> <include href=“” /> <filter-sci> … </filter-sci> </filter> Example – sci_filter.xml

  21. <filter name=“ReflectImageFilter”> <include href=“” /> <filter-sci> … </filter-sci> </filter> <include href=“ITK/itk_ReflectImageFilter.xml”/> Example – sci_filter.xml

  22. <filtername=“ReflectImageFilter”> <include href=“” /> <filter-sci> … </filter-sci> </filter> <filter-sci name=“ReflectImageFilter”> <package> Insight </package> <category> Filters </category> <instantiations use-defaults=“yes”/> <includes> <file>Packages/Insight/Dataflow/ Ports/ITKDatatypePort.h </file> </includes> </filter-sci> Example – sci_filter.xml

  23. Generate Process Steps for module generation • Add to Dataflow/Modules/Filters/sub.mk • Add to Dataflow/GUI/sub.mk Module sub.mk XMLS := \ sci_DiscreteGaussianImageFilter.xml \ sci_ReflectImageFilter.xml \ GUI sub.mk $(SRCDIR)/tclIndex: \ $(SRCDIR)/Switch.tcl \ $(SRCDIR)/ReflectImageFilter.tcl \

  24. Sample Network

  25. Sample Network Default GUI

  26. <filter-gui name=“ReflectImageFilterGUI”> <parameters> <param> … </param> <param> … </param> </parameters> </filter-gui> gui_ReflectImageFilter.xml

  27. <filter-gui name=“ReflectImageFilterGUI”> <parameters> <param> … </param> <param> … </param> </parameters> </filter-gui> <param name= “direction” > <gui> radiobutton </gui> <values> <val> 0 </val> <val> 1 </val> </values> <default> 1 </default> </param> gui_ReflectImageFilter.xml

  28. <filter name=“ReflectImageFilter”> <include href=“” /> <filter-sci> … </filter-sci> </filter> <include href=“ITK/itk_ReflectImageFilter.xml”/> Add GUI to sci_filter.xml itk_filter.xml sci_filter.xml

  29. <filter name=“ReflectImageFilter”> <include href=“” /> <filter-sci> … </filter-sci> </filter> <include href=“ITK/itk_ReflectImageFilter.xml”/> <include href=“Dataflow/Modules/Filters/XML/ gui_ReflectImageFilter.xml”/> Add GUI to sci_filter.xml itk_filter.xml sci_filter.xml gui_filter.xml

  30. Sample Network Defined GUI

  31. ITKDatatype class ITKDatatype : public Datatype { public: string fname; itk::Object::Pointer data_; ITKDatatype(): ITKDatatype(const ITKDatatype); ~ITKDatatype(); virtual void io(Piostream&); static PersistentTypeID type_id; };

  32. ITKField wrap Image ITKField unwrap Image Field copy data Image ITKField wrap Image Field and Image Conversion SCIRun ITK

  33. ITKLatVolField.h template<class Data> class ITKLatVolField : public GenericField< LatVolMesh, ITKFData3d< Data > > { public: ITKLatVolField(); ITKLatVolField(Field::data_location data_at); ITKLatVolField(LatVolMeshHandle mesh, Field::data_location data_at); ITKLatVolField(LatVolMeshHandle mesh, Field::data_location data_at, itk::Object* image); void SetImage(itk::Object* image); . . . private: static Persistent* maker(); };

  34. ITKLatVolField.h template <class Data> class ITKFData3d { public: typedef Data value_type; typedef itk::Image< Data, 3 > image_type; typedef ITKIterator< Data > iterator; typedef ITKConstIterator< Data > const_iterator; iterator *begin_, *end_; const_iterator *const_begin_, *const_end_; const iterator & begin() { return *begin_; } const iterator & end() { return *end_; } … const value_type &operator[]( LatVolMesh::Node::index_type idx) const; … void set_image(itk::Image< Data, 3 >* img); private: typename image_type::Pointer image_; };

  35. ITKLatVolField.h void set_image(itk::Image< Data, 3 >* img) { image_ = img; begin_ = new iterator(image_, image_->GetRequestedRegion()); begin_->GoToBegin(); … } template <class Data> class ITKFData3d { public: typedef Data value_type; typedef itk::Image< Data, 3 > image_type; typedef ITKIterator< Data > iterator; typedef ITKConstIterator< Data > const_iterator; iterator *begin_, *end_; const_iterator *const_begin_, *const_end_; const iterator & begin() { return *begin_; } const iterator & end() { return *end_; } … const value_type &operator[]( LatVolMesh::Node::index_type idx) const; … void set_image(itk::Image< Data, 3 >* img); private: typename image_type::Pointer image_; };

  36. Current ITK Filters DiscreteGaussianImageFilter GradientAnisotropicDiffusionImageFilter CannySegmentationLevelSetImageFilter GradientMagnitudeImageFilter ReflectImageFilter WatershedRelabeler WatershedSegmenter WatershedSegmentTreeGenerator There are almost 200 filters

  37. Example Network

  38. Example Network

  39. Example Network

  40. Example Network

  41. Example Images Diffused Image Source Image Segmented Image

  42. Watershed Filter Filter Filter What’s Left to Do • Finish recursive filters for ITK mini pipeline • Enable complex GUI’s • Have: Slider, Check and Radio Button • Need: Layout Manager • Port Issue – all are of type ITKDatatype • Same base class issue • Write Documentation • Write more ITK filters

  43. Issues • Const pipes • Object base class (e.g. ImageReader ) • SCIRun2 • Common Component Architecture (CCA) • Separable GUIs • GTK • XML description • Dynamic Compilation • TypeDescription • Compile_info

More Related