diff --git a/Documentation/Doxygen/Tutorial/Step09.dox b/Documentation/Doxygen/Tutorial/Step09.dox
index f804f36bbab..616b1d1cf04 100644
--- a/Documentation/Doxygen/Tutorial/Step09.dox
+++ b/Documentation/Doxygen/Tutorial/Step09.dox
@@ -2,212 +2,71 @@
\page Step09Page MITK Tutorial - Step 9: A plug-in
-MITK uses a very modular concept to maximize reusability and portability. You start an application (for example mitkWorkbench, the sample application provided by MITK). An application has several bundles (or plug-ins). A bundle can be a functionality, which in turn can be a view, each of these terms specifying certain behaviour and attributes.
+MITK uses a very modular concept to maximize reusability and portability. A MITK application based on the BlueBerry
+application framework (for example the MITK Workbench) consists of several bundles (or plug-ins). A bundle can contain
+resources and program logic. It can also contribute so-called Views to the main application, which provide a specific
+user interface for controlling the bundles functions.
-The creation of a MITK plug-in is considerably facilitated by using the MITK BundleGenerator as described in \ref NewPluginPage .
+The creation of a MITK plug-in is considerably facilitated by using the MITK PluginGenerator as described in \ref NewPluginPage .
-The mentioned tool was used to create a plug-in QmitkRegionGrowing.
-Let's first look at what files the BundleGenerator created:
+The mentioned tool was used to create a plug-in called org.mitk.example.gui.regiongrowing.
+Let's first look at what files the PluginGenerator created:
\verbatim
documentation\doxygen\
- modules.dox............................. Doxygen file for documenting your plug-in
+ modules.dox......................... Doxygen file for documenting your plug-in
resources\
- icon.xpm................................ The icon of your plug-in. GIMP or other programs (including your text editor)
- can be used to change this
+ icon.xpm............................ The icon of your plug-in. GIMP or other programs (including your text editor)
+ can be used to change this
src\internal\
- QmitkMITKRegionGrowingView.cpp.......... The most important file, implementing behaviour
- QmitkMITKRegionGrowingView.h............ Header file of the functionality
- QmitkMITKRegionGrowingViewControls.ui... XML file of the Qt Designer, describes buttons, combo boxes, etc. of your controls
+ QmitkRegionGrowingView.cpp.......... The most important file, implementing behaviour
+ QmitkRegionGrowingView.h............ Header file of the functionality
+ QmitkRegionGrowingViewControls.ui... XML file of the Qt Designer, describes buttons, combo boxes, etc. of your controls
-CMakeLists.txt \.......................... Build system related files for CMake
+CMakeLists.txt \...................... Build system related files for CMake
files.cmake /
-manifest_headers.cmake.................... Information about your plug-in
-plugin.xml ............................... BlueBerry integration
+manifest_headers.cmake................ Information about your plug-in
+plugin.xml ........................... BlueBerry integration
\endverbatim
If you are not familiar with Qt development, please look into
-this Trolltech page describing .ui files (no, forget about the please, DO it!)
+this Digia page describing .ui files (no, forget about the please, DO it!)
The C++ files implement a subclass of QmitkAbstractView. In this special case of QmitkRegionGrowing, we added the ability to set some seed points and run a region grower. If you are interested in the concrete changes necessary to turn a freshly generated QmitkRegionGrowing into an integrated one:
-Since an access to the StdMultiWidget is needed, manifest_headers.cmake has to be edited:
-\verbatim
-set(Require-Plugin org.mitk.gui.qt.common org.mitk.gui.qt.stdmultiwidgeteditor)
-\endverbatim
-
-To add a PointSet for the seed points:
+To add a mitk::PointSet for the seed points:
QmitkRegionGrowingView.h
-Add includes:
-\verbatim
-#include "QmitkPointListWidget.h"
-#include "QmitkStdMultiWidget.h"
-#include "QmitkStdMultiWidgetEditor.h"
-\endverbatim
+Add includes and forward declarations:
+\snippet QmitkRegionGrowingView.h includes
-Add the point set as protected object and add Pointers for a QmitkPointListWidget and a QmitkStdMultiWidget:
-\verbatim
-/// \brief This is the actual seed point data object
-mitk::PointSet::Pointer m_PointSet;
-
-QmitkPointListWidget* lstPoints;
-QmitkStdMultiWidget* m_MultiWidget;
-\endverbatim
+Add the point set and a pointer to a QmitkPointListWidget as a private member:
+\snippet QmitkRegionGrowingView.h members
QmitkRegionGrowingView.cpp
CreateQtPartControl():
-\verbatim
-// create a QmitkPointListWidget and add it to the widget created from .ui file
-lstPoints = new QmitkPointListWidget();
-m_Controls.verticalLayout->addWidget(lstPoints);
-
-// get access to StdMultiWidget by using RenderWindowPart
-QmitkStdMultiWidgetEditor* qSMWE = dynamic_cast(GetRenderWindowPart());
-m_MultiWidget = qSMWE->GetStdMultiWidget();
-
-// let the point set widget know about the multi widget (crosshair updates)
-lstPoints->SetMultiWidget( m_MultiWidget );
-
-// create a new DataTreeNode containing a PointSet with some interaction
-m_PointSet = mitk::PointSet::New();
-
-mitk::DataNode::Pointer pointSetNode = mitk::DataNode::New();
-pointSetNode->SetData( m_PointSet );
-pointSetNode->SetName("seed points for region growing");
-pointSetNode->SetProperty("helper object", mitk::BoolProperty::New(true) );
-pointSetNode->SetProperty("layer", mitk::IntProperty::New(1024) );
-
-// add the pointset to the data tree (for rendering and access by other modules)
-GetDataStorage()->Add( pointSetNode );
-
-// tell the GUI widget about out point set
-lstPoints->SetPointSetNode( pointSetNode );
-\endverbatim
+\snippet QmitkRegionGrowingView.cpp cpp-createqtpartcontrol
To use the ITK region grower:
QmitkRegionGrowingView.h
-Add protected method:
-\verbatim
-/*!
-\brief ITK image processing function
- This function is templated like an ITK image. The MITK-Macro AccessByItk determines the actual pixel type and dimensionality of
- a given MITK image and calls this function for further processing (in our case region growing)
-*/
-template < typename TPixel, unsigned int VImageDimension >
- void ItkImageProcessing( itk::Image< TPixel, VImageDimension >* itkImage, mitk::Geometry3D* imageGeometry );
-\endverbatim
+Add the private method:
+\snippet QmitkRegionGrowingView.h itkimageprocessing
QmitkRegionGrowingView.cpp
Add includes:
-\verbatim
-// MITK
-#include "mitkImageAccessByItk.h"
-#include "mitkITKImageImport.h"
-#include "mitkProperties.h"
-#include "mitkColorProperty.h"
-
-// ITK
-#include
+\snippet QmitkRegionGrowingView.cpp cpp-includes
-\endverbatim
-
-DoImageProcessing();
-\verbatim
-// So we have an image. Let's see if the user has set some seed points already
-if ( m_PointSet->GetSize() == 0 )
-{
- // no points there. Not good for region growing
- QMessageBox::information( NULL, "Region growing functionality",
- "Please set some seed points inside the image first.\n"
- "(hold Shift key and click left mouse button inside the image.)"
- );
- return;
-}
-
-// actually perform region growing. Here we have both an image and some seed points
-AccessByItk_1( image, ItkImageProcessing, image->GetGeometry() ); // some magic to call the correctly templated function
-\endverbatim
+DoImageProcessing():
+\snippet QmitkRegionGrowingView.cpp cpp-doimageprocessing
And add the new method:
-\verbatim
-template < typename TPixel, unsigned int VImageDimension >
-void QmitkRegionGrowingView::ItkImageProcessing( itk::Image< TPixel, VImageDimension >* itkImage, mitk::Geometry3D* imageGeometry )
-{
- typedef itk::Image< TPixel, VImageDimension > InputImageType;
- typedef typename InputImageType::IndexType IndexType;
-
- // instantiate an ITK region growing filter, set its parameters
- typedef itk::ConnectedThresholdImageFilter RegionGrowingFilterType;
- typename RegionGrowingFilterType::Pointer regionGrower = RegionGrowingFilterType::New();
- regionGrower->SetInput( itkImage ); // don't forget this
-
- // determine a thresholding interval
- IndexType seedIndex;
- TPixel min( std::numeric_limits::max() );
- TPixel max( std::numeric_limits::min() );
- mitk::PointSet::PointsContainer* points = m_PointSet->GetPointSet()->GetPoints();
- for ( mitk::PointSet::PointsConstIterator pointsIterator = points->Begin();
- pointsIterator != points->End();
- ++pointsIterator )
- {
- // first test if this point is inside the image at all
- if ( !imageGeometry->IsInside( pointsIterator.Value()) )
- {
- continue;
- }
-
- // convert world coordinates to image indices
- imageGeometry->WorldToIndex( pointsIterator.Value(), seedIndex);
-
- // get the pixel value at this point
- TPixel currentPixelValue = itkImage->GetPixel( seedIndex );
-
- // adjust minimum and maximum values
- if (currentPixelValue > max)
- max = currentPixelValue;
-
- if (currentPixelValue < min)
- min = currentPixelValue;
-
- regionGrower->AddSeed( seedIndex );
- }
-
- MITK_INFO << "Values between " << min << " and " << max;
-
- min -= 30;
- max += 30;
-
- // set thresholds and execute filter
- regionGrower->SetLower( min );
- regionGrower->SetUpper( max );
-
- regionGrower->Update();
-
- mitk::Image::Pointer resultImage = mitk::ImportItkImage( regionGrower->GetOutput() );
- mitk::DataNode::Pointer newNode = mitk::DataNode::New();
- newNode->SetData( resultImage );
-
- // set some properties
- newNode->SetProperty("binary", mitk::BoolProperty::New(true));
- newNode->SetProperty("name", mitk::StringProperty::New("dumb segmentation"));
- newNode->SetProperty("color", mitk::ColorProperty::New(1.0,0.0,0.0));
- newNode->SetProperty("volumerendering", mitk::BoolProperty::New(true));
- newNode->SetProperty("layer", mitk::IntProperty::New(1));
- newNode->SetProperty("opacity", mitk::FloatProperty::New(0.5));
-
- // add result to data tree
- this->GetDataStorage()->Add( newNode );
- mitk::RenderingManager::GetInstance()->RequestUpdateAll();
-}
-
-\endverbatim
+\snippet QmitkRegionGrowingView.cpp cpp-itkimageaccess
Have fun using MITK!
diff --git a/Examples/Plugins/PluginList.cmake b/Examples/Plugins/PluginList.cmake
index b29ba568323..ceb74aeddee 100644
--- a/Examples/Plugins/PluginList.cmake
+++ b/Examples/Plugins/PluginList.cmake
@@ -11,4 +11,5 @@ set(MITK_EXAMPLE_PLUGINS
org.mitk.example.gui.selectionservicemitk.views:ON
org.mitk.example.gui.extensionpointdefinition:ON
org.mitk.example.gui.extensionpointcontribution:ON
+ org.mitk.example.gui.regiongrowing:ON
)
diff --git a/Examples/Plugins/org.mitk.example.gui.regiongrowing/CMakeLists.txt b/Examples/Plugins/org.mitk.example.gui.regiongrowing/CMakeLists.txt
new file mode 100644
index 00000000000..315f17997a5
--- /dev/null
+++ b/Examples/Plugins/org.mitk.example.gui.regiongrowing/CMakeLists.txt
@@ -0,0 +1,7 @@
+project(org_mitk_example_gui_regiongrowing)
+
+MACRO_CREATE_MITK_CTK_PLUGIN(
+ EXPORT_DIRECTIVE REGIONGROWING_EXPORT
+ EXPORTED_INCLUDE_SUFFIXES src
+ MODULE_DEPENDENCIES QmitkExt
+)
diff --git a/Examples/Plugins/org.mitk.example.gui.regiongrowing/documentation/UserManual/Manual.dox b/Examples/Plugins/org.mitk.example.gui.regiongrowing/documentation/UserManual/Manual.dox
new file mode 100644
index 00000000000..b81d4f1a265
--- /dev/null
+++ b/Examples/Plugins/org.mitk.example.gui.regiongrowing/documentation/UserManual/Manual.dox
@@ -0,0 +1,18 @@
+/**
+\page org_mitk_example_gui_regiongrowing Region Grower Example
+
+\image html icon.xpm "Icon of Region Grower Example"
+
+Available sections:
+ - \ref org_mitk_example_gui_regiongrowingOverview
+
+\section org_mitk_example_gui_regiongrowingOverview
+Describe the features of your awesome plugin here
+
+- Increases productivity
+
- Creates beautiful images
+
- Generates PhD thesis
+
- Brings world peace
+
+
+*/
diff --git a/Examples/Plugins/org.mitk.example.gui.regiongrowing/documentation/UserManual/icon.xpm b/Examples/Plugins/org.mitk.example.gui.regiongrowing/documentation/UserManual/icon.xpm
new file mode 100644
index 00000000000..9057c20bc6a
--- /dev/null
+++ b/Examples/Plugins/org.mitk.example.gui.regiongrowing/documentation/UserManual/icon.xpm
@@ -0,0 +1,21 @@
+/* XPM */
+static const char * icon_xpm[] = {
+"16 16 2 1",
+" c #FF0000",
+". c #000000",
+" ",
+" ",
+" ",
+" ",
+" ",
+" ",
+" ",
+" ",
+" ",
+" ",
+" ",
+" ",
+" ",
+" ",
+" ",
+" "};
diff --git a/Examples/Plugins/org.mitk.example.gui.regiongrowing/documentation/doxygen/modules.dox b/Examples/Plugins/org.mitk.example.gui.regiongrowing/documentation/doxygen/modules.dox
new file mode 100644
index 00000000000..22b3a366c0f
--- /dev/null
+++ b/Examples/Plugins/org.mitk.example.gui.regiongrowing/documentation/doxygen/modules.dox
@@ -0,0 +1,16 @@
+/**
+ \defgroup org_mitk_example_gui_regiongrowing org.mitk.example.gui.regiongrowing
+ \ingroup MITKPlugins
+
+ \brief Describe your plugin here.
+
+*/
+
+/**
+ \defgroup org_mitk_example_gui_regiongrowing_internal Internal
+ \ingroup org_mitk_example_gui_regiongrowing
+
+ \brief This subcategory includes the internal classes of the org.mitk.example.gui.regiongrowing plugin. Other
+ plugins must not rely on these classes. They contain implementation details and their interface
+ may change at any time. We mean it.
+*/
diff --git a/Examples/Plugins/org.mitk.example.gui.regiongrowing/files.cmake b/Examples/Plugins/org.mitk.example.gui.regiongrowing/files.cmake
new file mode 100644
index 00000000000..527fc948ccd
--- /dev/null
+++ b/Examples/Plugins/org.mitk.example.gui.regiongrowing/files.cmake
@@ -0,0 +1,42 @@
+set(SRC_CPP_FILES
+
+)
+
+set(INTERNAL_CPP_FILES
+ org_mitk_example_gui_regiongrowing_Activator.cpp
+ QmitkRegionGrowingView.cpp
+)
+
+set(UI_FILES
+ src/internal/QmitkRegionGrowingViewControls.ui
+)
+
+set(MOC_H_FILES
+ src/internal/org_mitk_example_gui_regiongrowing_Activator.h
+ src/internal/QmitkRegionGrowingView.h
+)
+
+# list of resource files which can be used by the plug-in
+# system without loading the plug-ins shared library,
+# for example the icon used in the menu and tabs for the
+# plug-in views in the workbench
+set(CACHED_RESOURCE_FILES
+ resources/icon.xpm
+ plugin.xml
+)
+
+# list of Qt .qrc files which contain additional resources
+# specific to this plugin
+set(QRC_FILES
+
+)
+
+set(CPP_FILES )
+
+foreach(file ${SRC_CPP_FILES})
+ set(CPP_FILES ${CPP_FILES} src/${file})
+endforeach(file ${SRC_CPP_FILES})
+
+foreach(file ${INTERNAL_CPP_FILES})
+ set(CPP_FILES ${CPP_FILES} src/internal/${file})
+endforeach(file ${INTERNAL_CPP_FILES})
diff --git a/Examples/Plugins/org.mitk.example.gui.regiongrowing/manifest_headers.cmake b/Examples/Plugins/org.mitk.example.gui.regiongrowing/manifest_headers.cmake
new file mode 100644
index 00000000000..6698c3c0ec3
--- /dev/null
+++ b/Examples/Plugins/org.mitk.example.gui.regiongrowing/manifest_headers.cmake
@@ -0,0 +1,5 @@
+set(Plugin-Name "Region Grower Example")
+set(Plugin-Version "0.1")
+set(Plugin-Vendor "DKFZ, Medical and Biological Informatics")
+set(Plugin-ContactAddress "")
+set(Require-Plugin org.mitk.gui.qt.common)
diff --git a/Examples/Plugins/org.mitk.example.gui.regiongrowing/plugin.xml b/Examples/Plugins/org.mitk.example.gui.regiongrowing/plugin.xml
new file mode 100644
index 00000000000..2ce18af7c82
--- /dev/null
+++ b/Examples/Plugins/org.mitk.example.gui.regiongrowing/plugin.xml
@@ -0,0 +1,11 @@
+
+
+
+
+
+
+
+
diff --git a/Examples/Plugins/org.mitk.example.gui.regiongrowing/resources/icon.xpm b/Examples/Plugins/org.mitk.example.gui.regiongrowing/resources/icon.xpm
new file mode 100644
index 00000000000..9057c20bc6a
--- /dev/null
+++ b/Examples/Plugins/org.mitk.example.gui.regiongrowing/resources/icon.xpm
@@ -0,0 +1,21 @@
+/* XPM */
+static const char * icon_xpm[] = {
+"16 16 2 1",
+" c #FF0000",
+". c #000000",
+" ",
+" ",
+" ",
+" ",
+" ",
+" ",
+" ",
+" ",
+" ",
+" ",
+" ",
+" ",
+" ",
+" ",
+" ",
+" "};
diff --git a/Examples/Plugins/org.mitk.example.gui.regiongrowing/src/internal/QmitkRegionGrowingView.cpp b/Examples/Plugins/org.mitk.example.gui.regiongrowing/src/internal/QmitkRegionGrowingView.cpp
new file mode 100644
index 00000000000..fd5e271e720
--- /dev/null
+++ b/Examples/Plugins/org.mitk.example.gui.regiongrowing/src/internal/QmitkRegionGrowingView.cpp
@@ -0,0 +1,240 @@
+/*===================================================================
+
+The Medical Imaging Interaction Toolkit (MITK)
+
+Copyright (c) German Cancer Research Center,
+Division of Medical and Biological Informatics.
+All rights reserved.
+
+This software is distributed WITHOUT ANY WARRANTY; without
+even the implied warranty of MERCHANTABILITY or FITNESS FOR
+A PARTICULAR PURPOSE.
+
+See LICENSE.txt or http://www.mitk.org for details.
+
+===================================================================*/
+
+
+// Blueberry
+#include
+#include
+
+// Qmitk
+#include "QmitkRegionGrowingView.h"
+
+//! [cpp-includes]
+// Qmitk
+#include "QmitkPointListWidget.h"
+#include "QmitkRenderWindow.h"
+
+// MITK
+#include "mitkImageAccessByItk.h"
+#include "mitkITKImageImport.h"
+#include "mitkProperties.h"
+#include "mitkColorProperty.h"
+
+// ITK
+#include
+//! [cpp-includes]
+
+// Qt
+#include
+
+
+const std::string QmitkRegionGrowingView::VIEW_ID = "org.mitk.views.example.regiongrowing";
+
+QmitkRegionGrowingView::QmitkRegionGrowingView()
+ : m_PointListWidget(NULL)
+{
+}
+
+void QmitkRegionGrowingView::SetFocus()
+{
+ m_Controls.buttonPerformImageProcessing->setFocus();
+}
+
+void QmitkRegionGrowingView::CreateQtPartControl( QWidget *parent )
+{
+ // create GUI widgets from the Qt Designer's .ui file
+ m_Controls.setupUi( parent );
+ connect( m_Controls.buttonPerformImageProcessing, SIGNAL(clicked()), this, SLOT(DoImageProcessing()) );
+
+ //! [cpp-createqtpartcontrol]
+ // create a QmitkPointListWidget and add it to the widget created from .ui file
+ m_PointListWidget = new QmitkPointListWidget();
+ m_Controls.verticalLayout->addWidget(m_PointListWidget, 1);
+
+ // retrieve a possibly existing IRenderWindowPart
+ if (mitk::IRenderWindowPart* renderWindowPart = GetRenderWindowPart())
+ {
+ // let the point set widget know about the render window part (crosshair updates)
+ RenderWindowPartActivated(renderWindowPart);
+ }
+
+ // create a new DataNode containing a PointSet with some interaction
+ m_PointSet = mitk::PointSet::New();
+ mitk::DataNode::Pointer pointSetNode = mitk::DataNode::New();
+ pointSetNode->SetData( m_PointSet );
+ pointSetNode->SetName("seed points for region growing");
+ pointSetNode->SetProperty("helper object", mitk::BoolProperty::New(true) );
+ pointSetNode->SetProperty("layer", mitk::IntProperty::New(1024) );
+
+ // add the pointset to the data storage (for rendering and access by other modules)
+ GetDataStorage()->Add( pointSetNode );
+
+ // tell the GUI widget about the point set
+ m_PointListWidget->SetPointSetNode( pointSetNode );
+ //! [cpp-createqtpartcontrol]
+}
+
+void QmitkRegionGrowingView::OnSelectionChanged( berry::IWorkbenchPart::Pointer /*source*/,
+ const QList& nodes )
+{
+ // iterate all selected objects, adjust warning visibility
+ foreach( mitk::DataNode::Pointer node, nodes )
+ {
+ if( node.IsNotNull() && dynamic_cast(node->GetData()) )
+ {
+ m_Controls.labelWarning->setVisible( false );
+ m_Controls.buttonPerformImageProcessing->setEnabled( true );
+ return;
+ }
+ }
+
+ m_Controls.labelWarning->setVisible( true );
+ m_Controls.buttonPerformImageProcessing->setEnabled( false );
+}
+
+void QmitkRegionGrowingView::RenderWindowPartActivated(mitk::IRenderWindowPart* renderWindowPart)
+{
+ // let the point set widget know about the slice navigation controllers
+ // in the active render window part (crosshair updates)
+ foreach(QmitkRenderWindow* renderWindow, renderWindowPart->GetQmitkRenderWindows().values())
+ {
+ m_PointListWidget->AddSliceNavigationController(renderWindow->GetSliceNavigationController());
+ }
+}
+
+void QmitkRegionGrowingView::RenderWindowPartDeactivated(mitk::IRenderWindowPart* renderWindowPart)
+{
+ foreach(QmitkRenderWindow* renderWindow, renderWindowPart->GetQmitkRenderWindows().values())
+ {
+ m_PointListWidget->RemoveSliceNavigationController(renderWindow->GetSliceNavigationController());
+ }
+}
+
+void QmitkRegionGrowingView::DoImageProcessing()
+{
+ QList nodes = this->GetDataManagerSelection();
+ if (nodes.empty()) return;
+
+ mitk::DataNode* node = nodes.front();
+
+ if (!node)
+ {
+ // Nothing selected. Inform the user and return
+ QMessageBox::information( NULL, "Template", "Please load and select an image before starting image processing.");
+ return;
+ }
+
+ // here we have a valid mitk::DataNode
+
+ // a node itself is not very useful, we need its data item (the image)
+ mitk::BaseData* data = node->GetData();
+ if (data)
+ {
+ // test if this data item is an image or not (could also be a surface or something totally different)
+ mitk::Image* image = dynamic_cast( data );
+ if (image)
+ {
+ //! [cpp-doimageprocessing]
+ // So we have an image. Let's see if the user has set some seed points already
+ if (m_PointSet->GetSize() == 0)
+ {
+ // no points there. Not good for region growing
+ QMessageBox::information( NULL,
+ "Region growing functionality",
+ "Please set some seed points inside the image first.\n"
+ "(hold Shift key and click left mouse button inside the image.)"
+ );
+ return;
+ }
+
+ // actually perform region growing. Here we have both an image and some seed points
+ AccessByItk_1( image, ItkImageProcessing, image->GetGeometry() ) // some magic to call the correctly templated function
+ //! [cpp-doimageprocessing]
+ }
+ }
+}
+
+//! [cpp-itkimageaccess]
+template < typename TPixel, unsigned int VImageDimension >
+void QmitkRegionGrowingView::ItkImageProcessing( itk::Image< TPixel, VImageDimension >* itkImage, mitk::Geometry3D* imageGeometry )
+{
+ typedef itk::Image< TPixel, VImageDimension > InputImageType;
+ typedef typename InputImageType::IndexType IndexType;
+
+ // instantiate an ITK region growing filter, set its parameters
+ typedef itk::ConnectedThresholdImageFilter RegionGrowingFilterType;
+ typename RegionGrowingFilterType::Pointer regionGrower = RegionGrowingFilterType::New();
+ regionGrower->SetInput( itkImage ); // don't forget this
+
+ // determine a thresholding interval
+ IndexType seedIndex;
+ TPixel min( std::numeric_limits::max() );
+ TPixel max( std::numeric_limits::min() );
+ mitk::PointSet::PointsContainer* points = m_PointSet->GetPointSet()->GetPoints();
+ for ( mitk::PointSet::PointsConstIterator pointsIterator = points->Begin();
+ pointsIterator != points->End();
+ ++pointsIterator )
+ {
+ // first test if this point is inside the image at all
+ if ( !imageGeometry->IsInside( pointsIterator.Value()) )
+ {
+ continue;
+ }
+
+ // convert world coordinates to image indices
+ imageGeometry->WorldToIndex( pointsIterator.Value(), seedIndex);
+
+ // get the pixel value at this point
+ TPixel currentPixelValue = itkImage->GetPixel( seedIndex );
+
+ // adjust minimum and maximum values
+ if (currentPixelValue > max)
+ max = currentPixelValue;
+
+ if (currentPixelValue < min)
+ min = currentPixelValue;
+
+ regionGrower->AddSeed( seedIndex );
+ }
+
+ MITK_INFO << "Values between " << min << " and " << max;
+
+ min -= 30;
+ max += 30;
+
+ // set thresholds and execute filter
+ regionGrower->SetLower( min );
+ regionGrower->SetUpper( max );
+
+ regionGrower->Update();
+
+ mitk::Image::Pointer resultImage = mitk::ImportItkImage( regionGrower->GetOutput() );
+ mitk::DataNode::Pointer newNode = mitk::DataNode::New();
+ newNode->SetData( resultImage );
+
+ // set some properties
+ newNode->SetProperty("binary", mitk::BoolProperty::New(true));
+ newNode->SetProperty("name", mitk::StringProperty::New("dumb segmentation"));
+ newNode->SetProperty("color", mitk::ColorProperty::New(1.0,0.0,0.0));
+ newNode->SetProperty("volumerendering", mitk::BoolProperty::New(true));
+ newNode->SetProperty("layer", mitk::IntProperty::New(1));
+ newNode->SetProperty("opacity", mitk::FloatProperty::New(0.5));
+
+ // add result to data tree
+ this->GetDataStorage()->Add( newNode );
+ mitk::RenderingManager::GetInstance()->RequestUpdateAll();
+}
+//! [cpp-itkimageaccess]
diff --git a/Examples/Plugins/org.mitk.example.gui.regiongrowing/src/internal/QmitkRegionGrowingView.h b/Examples/Plugins/org.mitk.example.gui.regiongrowing/src/internal/QmitkRegionGrowingView.h
new file mode 100644
index 00000000000..2f5c998088f
--- /dev/null
+++ b/Examples/Plugins/org.mitk.example.gui.regiongrowing/src/internal/QmitkRegionGrowingView.h
@@ -0,0 +1,97 @@
+/*===================================================================
+
+The Medical Imaging Interaction Toolkit (MITK)
+
+Copyright (c) German Cancer Research Center,
+Division of Medical and Biological Informatics.
+All rights reserved.
+
+This software is distributed WITHOUT ANY WARRANTY; without
+even the implied warranty of MERCHANTABILITY or FITNESS FOR
+A PARTICULAR PURPOSE.
+
+See LICENSE.txt or http://www.mitk.org for details.
+
+===================================================================*/
+
+
+#ifndef QmitkRegionGrowingView_h
+#define QmitkRegionGrowingView_h
+
+#include
+
+#include
+
+#include "ui_QmitkRegionGrowingViewControls.h"
+
+//! [includes]
+#include "mitkPointSet.h"
+#include "mitkIRenderWindowPartListener.h"
+
+class QmitkPointListWidget;
+//! [includes]
+
+/**
+ \brief QmitkRegionGrowingView
+
+ \warning This class is not yet documented. Use "git blame" and ask the author to provide basic documentation.
+
+ \sa QmitkAbstractView
+ \ingroup ${plugin_target}_internal
+*/
+class QmitkRegionGrowingView : public QmitkAbstractView, public mitk::IRenderWindowPartListener
+{
+ // this is needed for all Qt objects that should have a Qt meta-object
+ // (everything that derives from QObject and wants to have signal/slots)
+ Q_OBJECT
+
+ public:
+
+ static const std::string VIEW_ID;
+
+ QmitkRegionGrowingView();
+
+ protected slots:
+
+ /// \brief Called when the user clicks the GUI button
+ void DoImageProcessing();
+
+ protected:
+
+ virtual void CreateQtPartControl(QWidget *parent);
+
+ virtual void SetFocus();
+
+ /// \brief called by QmitkFunctionality when DataManager's selection has changed
+ virtual void OnSelectionChanged( berry::IWorkbenchPart::Pointer source,
+ const QList& nodes );
+
+ //! [render-window-part-listener]
+ void RenderWindowPartActivated(mitk::IRenderWindowPart* renderWindowPart);
+ void RenderWindowPartDeactivated(mitk::IRenderWindowPart* renderWindowPart);
+ //! [render-window-part-listener]
+
+ Ui::QmitkRegionGrowingViewControls m_Controls;
+
+ private:
+
+ //! [itkimageprocessing]
+ /**
+ \brief ITK image processing function
+ This function is templated like an ITK image. The MITK-Macro AccessByItk determines the actual pixel type and dimensionality of
+ a given MITK image and calls this function for further processing (in our case region growing)
+ */
+ template < typename TPixel, unsigned int VImageDimension >
+ void ItkImageProcessing( itk::Image< TPixel, VImageDimension >* itkImage, mitk::Geometry3D* imageGeometry );
+ //! [itkimageprocessing]
+
+ //! [members]
+ /// \brief This is the actual seed point data object
+ mitk::PointSet::Pointer m_PointSet;
+
+ QmitkPointListWidget* m_PointListWidget;
+ //! [members]
+
+};
+
+#endif // QmitkRegionGrowingView_h
diff --git a/Examples/Plugins/org.mitk.example.gui.regiongrowing/src/internal/QmitkRegionGrowingViewControls.ui b/Examples/Plugins/org.mitk.example.gui.regiongrowing/src/internal/QmitkRegionGrowingViewControls.ui
new file mode 100644
index 00000000000..af93c6a8aa3
--- /dev/null
+++ b/Examples/Plugins/org.mitk.example.gui.regiongrowing/src/internal/QmitkRegionGrowingViewControls.ui
@@ -0,0 +1,48 @@
+
+
+ QmitkRegionGrowingViewControls
+
+
+
+ 0
+ 0
+ 222
+ 161
+
+
+
+
+ 0
+ 0
+
+
+
+ QmitkTemplate
+
+
+ -
+
+
+ QLabel { color: rgb(255, 0, 0) }
+
+
+ Please select an image!
+
+
+
+ -
+
+
+ Do image processing
+
+
+ Do Something
+
+
+
+
+
+
+
+
+
diff --git a/Examples/Plugins/org.mitk.example.gui.regiongrowing/src/internal/org_mitk_example_gui_regiongrowing_Activator.cpp b/Examples/Plugins/org.mitk.example.gui.regiongrowing/src/internal/org_mitk_example_gui_regiongrowing_Activator.cpp
new file mode 100644
index 00000000000..a0d3863e2ec
--- /dev/null
+++ b/Examples/Plugins/org.mitk.example.gui.regiongrowing/src/internal/org_mitk_example_gui_regiongrowing_Activator.cpp
@@ -0,0 +1,38 @@
+/*===================================================================
+
+The Medical Imaging Interaction Toolkit (MITK)
+
+Copyright (c) German Cancer Research Center,
+Division of Medical and Biological Informatics.
+All rights reserved.
+
+This software is distributed WITHOUT ANY WARRANTY; without
+even the implied warranty of MERCHANTABILITY or FITNESS FOR
+A PARTICULAR PURPOSE.
+
+See LICENSE.txt or http://www.mitk.org for details.
+
+===================================================================*/
+
+
+#include "org_mitk_example_gui_regiongrowing_Activator.h"
+
+#include
+
+#include "QmitkRegionGrowingView.h"
+
+namespace mitk {
+
+void org_mitk_example_gui_regiongrowing_Activator::start(ctkPluginContext* context)
+{
+ BERRY_REGISTER_EXTENSION_CLASS(QmitkRegionGrowingView, context)
+}
+
+void org_mitk_example_gui_regiongrowing_Activator::stop(ctkPluginContext* context)
+{
+ Q_UNUSED(context)
+}
+
+}
+
+Q_EXPORT_PLUGIN2(org_mitk_example_gui_regiongrowing, mitk::org_mitk_example_gui_regiongrowing_Activator)
diff --git a/Examples/Plugins/org.mitk.example.gui.regiongrowing/src/internal/org_mitk_example_gui_regiongrowing_Activator.h b/Examples/Plugins/org.mitk.example.gui.regiongrowing/src/internal/org_mitk_example_gui_regiongrowing_Activator.h
new file mode 100644
index 00000000000..29d561d6f54
--- /dev/null
+++ b/Examples/Plugins/org.mitk.example.gui.regiongrowing/src/internal/org_mitk_example_gui_regiongrowing_Activator.h
@@ -0,0 +1,40 @@
+/*===================================================================
+
+The Medical Imaging Interaction Toolkit (MITK)
+
+Copyright (c) German Cancer Research Center,
+Division of Medical and Biological Informatics.
+All rights reserved.
+
+This software is distributed WITHOUT ANY WARRANTY; without
+even the implied warranty of MERCHANTABILITY or FITNESS FOR
+A PARTICULAR PURPOSE.
+
+See LICENSE.txt or http://www.mitk.org for details.
+
+===================================================================*/
+
+
+#ifndef org_mitk_example_gui_regiongrowing_Activator_h
+#define org_mitk_example_gui_regiongrowing_Activator_h
+
+#include
+
+namespace mitk {
+
+class org_mitk_example_gui_regiongrowing_Activator :
+ public QObject, public ctkPluginActivator
+{
+ Q_OBJECT
+ Q_INTERFACES(ctkPluginActivator)
+
+public:
+
+ void start(ctkPluginContext* context);
+ void stop(ctkPluginContext* context);
+
+}; // org_mitk_example_gui_regiongrowing_Activator
+
+}
+
+#endif // org_mitk_example_gui_regiongrowing_Activator_h