Page MenuHomePhabricator

No OneTemporary

This file is larger than 256 KB, so syntax highlighting was skipped.
This document is not UTF8. It was detected as ISO-8859-1 (Latin 1) and converted to UTF8 for display.
diff --git a/Applications/CoreApp/CMakeLists.txt b/Applications/CoreApp/CMakeLists.txt
index 28a216b791..1c12cbe625 100644
--- a/Applications/CoreApp/CMakeLists.txt
+++ b/Applications/CoreApp/CMakeLists.txt
@@ -1,68 +1,66 @@
FIND_PACKAGE(BlueBerry REQUIRED)
INCLUDE(${QT_USE_FILE})
INCLUDE_DIRECTORIES(
${BLUEBERRY_PLUGIN_SOURCE_DIRS}
${org_blueberry_osgi_INCLUDE_DIRS}
${Poco_INCLUDE_DIRS}
${mbilog_INCLUDE_DIRS}
)
LINK_DIRECTORIES(${Poco_LIBRARY_DIRS})
IF(MITK_SHOW_CONSOLE_WINDOW)
ADD_EXECUTABLE(CoreApp MACOSX_BUNDLE CoreApp.cpp)
ELSE(MITK_SHOW_CONSOLE_WINDOW)
ADD_EXECUTABLE(CoreApp MACOSX_BUNDLE WIN32 CoreApp.cpp)
ENDIF(MITK_SHOW_CONSOLE_WINDOW)
IF (WIN32)
FIND_PACKAGE(Qt4)
TARGET_LINK_LIBRARIES(CoreApp ${QT_QTCORE_LIBRARY} ${QT_QTMAIN_LIBRARY})
ENDIF(WIN32)
TARGET_LINK_LIBRARIES(CoreApp
optimized PocoFoundation debug PocoFoundationd
optimized PocoUtil debug PocoUtild
org_blueberry_osgi)
-SET_TARGET_PROPERTIES(CoreApp PROPERTIES INSTALL_RPATH "${CMAKE_INSTALL_RPATH};${CMAKE_INSTALL_RPATH}/plugins")
-
# subproject support
ADD_DEPENDENCIES(MITK-CoreUI CoreApp)
IF(MITK_ENABLE_GUI_TESTING)
ADD_DEPENDENCIES(MITK-CoreUI solstice)
ENDIF()
SET(_plugin_deps
${BLUEBERRY_ENABLED_PLUGINS}
${MITK_CORE_ENABLED_PLUGINS}
)
IF(_plugin_deps)
# Make sure all enabled plug-ins are up to date
ADD_DEPENDENCIES(CoreApp ${_plugin_deps})
ENDIF()
SET(BLUEBERRY_PLUGIN_CACHE_DIR "${CMAKE_RUNTIME_OUTPUT_DIRECTORY}/plugin_cache")
CONFIGURE_FILE(CoreApp.ini
${CMAKE_RUNTIME_OUTPUT_DIRECTORY}/CoreApp.ini)
IF(WIN32)
FOREACH(COREAPP_BUILD_TYPE debug release)
mitkFunctionCreateWindowsBatchScript(startCoreApp.bat.in
${CMAKE_RUNTIME_OUTPUT_DIRECTORY}/startCoreApp_${COREAPP_BUILD_TYPE}.bat
${COREAPP_BUILD_TYPE})
ENDFOREACH()
ENDIF(WIN32)
MITK_INSTALL_TARGETS(EXECUTABLES CoreApp GLOB_PLUGINS )
mitkFunctionInstallProvisioningFiles(${BLUEBERRY_PLUGIN_PROVISIONING_FILE} ${MITK_COREAPP_PROVISIONING_FILE})
-IF(UNIX AND MITK_INSTALL_RPATH_RELATIVE AND NOT APPLE)
+IF(UNIX AND NOT APPLE)
INSTALL(PROGRAMS "${MITK_SOURCE_DIR}/CMake/RunInstalledApp.sh" DESTINATION "." RENAME CoreApp.sh)
ENDIF()
SET(MITK_CPACK_PACKAGE_EXECUTABLES ${MITK_CPACK_PACKAGE_EXECUTABLES} "CoreApp;MITK - CoreApp Application" CACHE INTERNAL "Collecting windows shortcuts to executables")
diff --git a/Applications/ExtApp/CMakeLists.txt b/Applications/ExtApp/CMakeLists.txt
index cb642d3637..b5e6cdd7c0 100644
--- a/Applications/ExtApp/CMakeLists.txt
+++ b/Applications/ExtApp/CMakeLists.txt
@@ -1,66 +1,64 @@
FIND_PACKAGE(BlueBerry REQUIRED)
# TODO: this can be removed after resolving factory issues, it's only necessary for the registration call in main()
MITK_USE_MODULE(MitkExt)
INCLUDE(${QT_USE_FILE})
INCLUDE_DIRECTORIES(
${BLUEBERRY_PLUGIN_SOURCE_DIRS}
${org_blueberry_osgi_INCLUDE_DIRS}
${Poco_INCLUDE_DIRS}
${ALL_INCLUDE_DIRECTORIES}
)
LINK_DIRECTORIES(${Poco_LIBRARY_DIRS})
IF(MITK_SHOW_CONSOLE_WINDOW)
ADD_EXECUTABLE(ExtApp MACOSX_BUNDLE ExtApp.cpp)
ELSE(MITK_SHOW_CONSOLE_WINDOW)
ADD_EXECUTABLE(ExtApp MACOSX_BUNDLE WIN32 ExtApp.cpp)
ENDIF(MITK_SHOW_CONSOLE_WINDOW)
IF (WIN32)
FIND_PACKAGE(Qt4)
TARGET_LINK_LIBRARIES(ExtApp ${QT_QTCORE_LIBRARY} ${QT_QTMAIN_LIBRARY})
ENDIF(WIN32)
TARGET_LINK_LIBRARIES(ExtApp
optimized PocoFoundation debug PocoFoundationd
optimized PocoUtil debug PocoUtild
org_blueberry_osgi
${ALL_LIBRARIES})
-SET_TARGET_PROPERTIES(ExtApp PROPERTIES INSTALL_RPATH "${CMAKE_INSTALL_RPATH};${CMAKE_INSTALL_RPATH}/plugins")
-
SET(_plugin_deps
${BLUEBERRY_ENABLED_PLUGINS}
${MITK_EXT_ENABLED_PLUGINS}
${MITK_MODULES_ENABLED_PLUGINS}
)
IF(_plugin_deps)
# Make sure all enabled plug-ins are up to date
ADD_DEPENDENCIES(ExtApp ${_plugin_deps})
ENDIF()
SET(BLUEBERRY_PLUGIN_CACHE_DIR "${CMAKE_RUNTIME_OUTPUT_DIRECTORY}/plugin_cache")
CONFIGURE_FILE(ExtApp.ini
${CMAKE_RUNTIME_OUTPUT_DIRECTORY}/ExtApp.ini)
IF(WIN32)
FOREACH(EXTAPP_BUILD_TYPE debug release)
mitkFunctionCreateWindowsBatchScript(startExtApp.bat.in
${CMAKE_RUNTIME_OUTPUT_DIRECTORY}/startExtApp_${EXTAPP_BUILD_TYPE}.bat
${EXTAPP_BUILD_TYPE})
ENDFOREACH()
ENDIF(WIN32)
MITK_INSTALL_TARGETS(EXECUTABLES ExtApp GLOB_PLUGINS )
mitkFunctionInstallProvisioningFiles(${BLUEBERRY_PLUGIN_PROVISIONING_FILE} ${MITK_EXTAPP_PROVISIONING_FILE})
-IF(UNIX AND MITK_INSTALL_RPATH_RELATIVE AND NOT APPLE)
+IF(UNIX AND NOT APPLE)
INSTALL(PROGRAMS "${MITK_SOURCE_DIR}/CMake/RunInstalledApp.sh" DESTINATION "." RENAME ExtApp.sh)
ENDIF()
SET(MITK_CPACK_PACKAGE_EXECUTABLES ${MITK_CPACK_PACKAGE_EXECUTABLES} "ExtApp;MITK - ExtApp Application" CACHE INTERNAL "Collecting windows shortcuts to executables")
diff --git a/Applications/Tutorial/Step6RegionGrowing1.cpp b/Applications/Tutorial/Step6RegionGrowing1.cpp
index 8aeed6b07d..04104e5ac6 100644
--- a/Applications/Tutorial/Step6RegionGrowing1.cpp
+++ b/Applications/Tutorial/Step6RegionGrowing1.cpp
@@ -1,28 +1,33 @@
/*=========================================================================
Program: Medical Imaging & Interaction Toolkit
Language: C++
Date: $Date$
Version: $Revision$
Copyright (c) German Cancer Research Center, Division of Medical and
Biological Informatics. All rights reserved.
See MITKCopyright.txt or http://www.mitk.org/copyright.html for details.
This software is distributed WITHOUT ANY WARRANTY; without even
the implied warranty of MERCHANTABILITY or FITNESS FOR A PARTICULAR
PURPOSE. See the above copyright notices for more information.
=========================================================================*/
#include "Step6RegionGrowing.txx"
+#include <mitkInstantiateAccessFunctions.h>
+
+#define InstantiateAccessFunction_RegionGrowing(pixelType, dim) \
+template void RegionGrowing(itk::Image<pixelType, dim>*, Step6*);
+
/// Instantiate the access function for 2D and all datatypes.
/// Instantiation for 3D is done in Step6RegionGrowing2.
/// Some compilers have memory problems without the explicit
/// instantiation, some even need the separation in 2D/3D.
-InstantiateAccessFunctionForFixedDimension_1(RegionGrowing, 2, Step6*)
+InstantiateAccessFunctionForFixedDimension(RegionGrowing, 2)
/**
\example Step6RegionGrowing1.cpp
*/
diff --git a/Applications/Tutorial/Step6RegionGrowing2.cpp b/Applications/Tutorial/Step6RegionGrowing2.cpp
index b6f2ef0c69..5a2333b575 100644
--- a/Applications/Tutorial/Step6RegionGrowing2.cpp
+++ b/Applications/Tutorial/Step6RegionGrowing2.cpp
@@ -1,28 +1,33 @@
/*=========================================================================
Program: Medical Imaging & Interaction Toolkit
Language: C++
Date: $Date$
Version: $Revision$
Copyright (c) German Cancer Research Center, Division of Medical and
Biological Informatics. All rights reserved.
See MITKCopyright.txt or http://www.mitk.org/copyright.html for details.
This software is distributed WITHOUT ANY WARRANTY; without even
the implied warranty of MERCHANTABILITY or FITNESS FOR A PARTICULAR
PURPOSE. See the above copyright notices for more information.
=========================================================================*/
#include "Step6RegionGrowing.txx"
+#include <mitkInstantiateAccessFunctions.h>
+
+#define InstantiateAccessFunction_RegionGrowing(pixelType, dim) \
+template void RegionGrowing(itk::Image<pixelType, dim>*, Step6*);
+
/// Instantiate the access function for 3D and all datatypes.
/// Instantiation for 2D is done in Step6RegionGrowing1.
/// Some compilers have memory problems without the explicit
/// instantiation, some even need the separation in 2D/3D.
-InstantiateAccessFunctionForFixedDimension_1(RegionGrowing, 3, Step6*)
+InstantiateAccessFunctionForFixedDimension(RegionGrowing, 3)
/**
\example Step6RegionGrowing2.cpp
*/
diff --git a/Applications/Tutorial/mitkWithITKAndVTK.cpp b/Applications/Tutorial/mitkWithITKAndVTK.cpp
index a60ecefcd2..90767280d6 100644
--- a/Applications/Tutorial/mitkWithITKAndVTK.cpp
+++ b/Applications/Tutorial/mitkWithITKAndVTK.cpp
@@ -1,66 +1,67 @@
#include <itkImage.h>
#include <itkDiscreteGaussianImageFilter.h>
#include <itksys/SystemTools.hxx>
#include <mitkPicFileReader.h>
#include <mitkStandaloneDataStorage.h>
+#include <mitkImageCast.h>
#include <mitkImageAccessByItk.h>
#include <vtkImageViewer.h>
#include <vtkRenderWindowInteractor.h>
///
/// Small application for demonstrating the interaction between MITK,
/// ITK and VTK (not necessarily useful).
///
int main( int /*argc*/, char ** argv )
{
// MITK: Read a .pic.gz file, e.g. Core/Code/Testing/Data/Pic3D.pic.gz from
// disk
mitk::PicFileReader::Pointer reader = mitk::PicFileReader::New();
const char * filename = argv[1];
try
{
reader->SetFileName(filename);
reader->Update();
}
catch(...)
{
fprintf( stderr, "Could not open file %s \n\n", filename );
return EXIT_FAILURE;
}
mitk::Image::Pointer mitkImage = reader->GetOutput();
// ITK: Image smoothing
// Create ITK image, cast from MITK image
typedef itk::Image< short , 3 > ImageType;
ImageType::Pointer itkImage = ImageType::New();
mitk::CastToItkImage( mitkImage, itkImage );
typedef itk::DiscreteGaussianImageFilter<ImageType, ImageType > FilterType;
FilterType::Pointer filter = FilterType::New();
filter->SetInput( itkImage );
filter->SetVariance( 2 );
filter->SetMaximumKernelWidth( 5 );
filter->Update(); // run filter
// reimport filtered image data
mitk::CastToMitkImage( filter->GetOutput(), mitkImage );
// VTK: Show result in renderwindow
vtkImageViewer *viewer=vtkImageViewer::New();
vtkRenderWindowInteractor* renderWindowInteractor
=vtkRenderWindowInteractor ::New();
viewer->SetupInteractor(renderWindowInteractor);
viewer->SetInput(mitkImage->GetVtkImageData());
viewer->Render();
viewer->SetColorWindow(255);
viewer->SetColorLevel(128);
renderWindowInteractor->Start();
renderWindowInteractor->Delete();
viewer->Delete();
return EXIT_SUCCESS;
}
diff --git a/BlueBerry/BlueBerryConfig.cmake.in b/BlueBerry/BlueBerryConfig.cmake.in
index 01fe03bdf8..7de9bb803b 100644
--- a/BlueBerry/BlueBerryConfig.cmake.in
+++ b/BlueBerry/BlueBerryConfig.cmake.in
@@ -1,55 +1,58 @@
SET(BLUEBERRY_PLUGINS_SOURCE_DIR "@BLUEBERRY_PLUGINS_SOURCE_DIR@")
SET(BLUEBERRY_PLUGINS_BINARY_DIR "@BLUEBERRY_PLUGINS_BINARY_DIR@")
SET(BLUEBERRY_PLUGIN_SOURCE_DIRS "@BLUEBERRY_PLUGINS_SOURCE_DIR@")
SET(BLUEBERRY_PLUGINS_OUTPUT_DIR "@BLUEBERRY_PLUGINS_OUTPUT_DIR@")
SET(BLUEBERRY_SOURCE_DIR "@BLUEBERRY_SOURCE_DIR@")
SET(BlueBerry_SOURCE_DIR "@BLUEBERRY_SOURCE_DIR@")
SET(BLUEBERRY_BINARY_DIR "@BLUEBERRY_BINARY_DIR@")
INCLUDE("@BB_PLUGIN_USE_FILE@")
IF(NOT BB_PLUGIN_EXPORTS_FILE_INCLUDED AND NOT CMAKE_PROJECT_NAME STREQUAL "MITK")
INCLUDE("@BB_PLUGIN_EXPORTS_FILE@")
SET(BB_PLUGIN_EXPORTS_FILE_INCLUDED 1)
ENDIF()
SET(BLUEBERRY_DEBUG_POSTFIX @BLUEBERRY_DEBUG_POSTFIX@)
SET(BLUEBERRY_USE_QT_HELP @BLUEBERRY_USE_QT_HELP@)
SET(QT_HELPGENERATOR_EXECUTABLE "@QT_HELPGENERATOR_EXECUTABLE@")
SET(QT_COLLECTIONGENERATOR_EXECUTABLE "@QT_COLLECTIONGENERATOR_EXECUTABLE@")
SET(QT_ASSISTANT_EXECUTABLE "@QT_ASSISTANT_EXECUTABLE@")
SET(CTK_DIR "@CTK_DIR@")
FIND_PACKAGE(CTK REQUIRED)
+FIND_PACKAGE(Doxygen)
+
SET(BLUEBERRY_PLUGIN_TARGETS @my_plugin_targets@)
SET(BLUEBERRY_ENABLED_PLUGINS @my_plugin_targets@)
SET(CTK_PLUGIN_LIBRARIES ${CTK_PLUGIN_LIBRARIES} @my_plugin_targets@)
SET(BLUEBERRY_PLUGIN_PROVISIONING_FILE "@BLUEBERRY_PROVISIONING_FILE@")
SET(BLUEBERRY_DOXYGEN_TAGFILE_NAME @BLUEBERRY_DOXYGEN_TAGFILE_NAME@)
SET(CMAKE_MODULE_PATH ${CMAKE_MODULE_PATH} "@BLUEBERRY_SOURCE_DIR@/CMake")
FIND_PACKAGE(Poco REQUIRED)
SET(mbilog_DIR "@mbilog_DIR@")
FIND_PACKAGE(mbilog REQUIRED)
INCLUDE(MacroParseArguments)
INCLUDE(MacroConvertSchema)
INCLUDE(MacroOrganizeSources)
INCLUDE(berryPluginHelpers)
INCLUDE(MacroCollectPlugins)
INCLUDE(MacroParseManifest)
INCLUDE(MacroCreatePlugin)
+INCLUDE(MacroCreateCTKPlugin)
INCLUDE(MacroCreateQtHelp)
INCLUDE(MacroInstallPlugin)
INCLUDE(MacroInstallCTKPlugin)
INCLUDE(MacroInstallThirdPartyPlugins)
INCLUDE(FunctionInstallThirdPartyCTKPlugins)
INCLUDE(FunctionCreateProvisioningFile)
diff --git a/BlueBerry/Bundles/org.blueberry.compat/berryCTKPluginListener.cpp b/BlueBerry/Bundles/org.blueberry.compat/berryCTKPluginListener.cpp
index f7d839eb98..054dc44e7c 100644
--- a/BlueBerry/Bundles/org.blueberry.compat/berryCTKPluginListener.cpp
+++ b/BlueBerry/Bundles/org.blueberry.compat/berryCTKPluginListener.cpp
@@ -1,162 +1,167 @@
/*=========================================================================
Program: BlueBerry Platform
Language: C++
Date: $Date$
Version: $Revision$
Copyright (c) German Cancer Research Center, Division of Medical and
Biological Informatics. All rights reserved.
See MITKCopyright.txt or http://www.mitk.org/copyright.html for details.
This software is distributed WITHOUT ANY WARRANTY; without even
the implied warranty of MERCHANTABILITY or FITNESS FOR A PARTICULAR
PURPOSE. See the above copyright notices for more information.
=========================================================================*/
#include "berryCTKPluginListener_p.h"
#include <ctkPlugin.h>
+#include <QSet>
+
const QString berry::CTKPluginListener::PLUGIN_MANIFEST = "plugin.xml";
namespace berry {
CTKPluginListener::CTKPluginListener(IExtensionPointService::Pointer registry)
: registry(registry)
{
}
void CTKPluginListener::processPlugins(const QList<QSharedPointer<ctkPlugin> >& plugins)
{
// sort the plugins according to their dependencies
const QList<QSharedPointer<ctkPlugin> > sortedPlugins = sortPlugins(plugins);
foreach (QSharedPointer<ctkPlugin> plugin, sortedPlugins)
{
if (isPluginResolved(plugin))
addPlugin(plugin);
else
removePlugin(plugin);
}
}
QList<QSharedPointer<ctkPlugin> >
CTKPluginListener::sortPlugins(const QList<QSharedPointer<ctkPlugin> >& plugins)
{
QList<QSharedPointer<ctkPlugin> > sortedPlugins(plugins);
+ QSet<QString> installedSymbolicNames;
QHash<long, QStringList> mapPluginIdToDeps;
foreach(QSharedPointer<ctkPlugin> plugin, sortedPlugins)
{
+ installedSymbolicNames.insert((plugin->getSymbolicName()));
+
QString requirePlugin = plugin->getHeaders()[ctkPluginConstants::REQUIRE_PLUGIN];
QStringList requiredList = requirePlugin.split(QRegExp("\\s*,\\s*"), QString::SkipEmptyParts);
QStringList requiredSymbolicNames;
foreach(QString require, requiredList)
{
requiredSymbolicNames.append(require.split(';').front());
}
mapPluginIdToDeps[plugin->getPluginId()] = requiredSymbolicNames;
}
- QStringList symbolicNames;
+ QStringList stableSymbolicNames;
for (int i = 0; i < sortedPlugins.size();)
{
QStringList currDeps = mapPluginIdToDeps[sortedPlugins.at(i)->getPluginId()];
bool moved = false;
foreach(QString currDep, currDeps)
{
- if (!symbolicNames.contains(currDep))
+ if (!stableSymbolicNames.contains(currDep) && installedSymbolicNames.contains(currDep))
{
sortedPlugins.move(i, sortedPlugins.size()-1);
moved = true;
break;
}
}
if (!moved)
{
- symbolicNames.append(sortedPlugins.at(i)->getSymbolicName());
+ stableSymbolicNames.append(sortedPlugins.at(i)->getSymbolicName());
++i;
}
}
return sortedPlugins;
}
void CTKPluginListener::pluginChanged(const ctkPluginEvent& event)
{
/* Only should listen for RESOLVED and UNRESOLVED events.
*
* When a plugin is updated the Framework will publish an UNRESOLVED and
* then a RESOLVED event which should cause the plugin to be removed
* and then added back into the registry.
*
* When a plugin is uninstalled the Framework should publish an UNRESOLVED
* event and then an UNINSTALLED event so the plugin will have been removed
* by the UNRESOLVED event before the UNINSTALLED event is published.
*/
QSharedPointer<ctkPlugin> plugin = event.getPlugin();
switch (event.getType())
{
case ctkPluginEvent::RESOLVED :
addPlugin(plugin);
break;
case ctkPluginEvent::UNRESOLVED :
removePlugin(plugin);
break;
}
}
bool CTKPluginListener::isPluginResolved(QSharedPointer<ctkPlugin> plugin)
{
return (plugin->getState() & (ctkPlugin::RESOLVED | ctkPlugin::ACTIVE | ctkPlugin::STARTING | ctkPlugin::STOPPING)) != 0;
}
void CTKPluginListener::removePlugin(QSharedPointer<ctkPlugin> plugin)
{
// The BlueBerry extension point registry does not support the removal of contributions
//registry->remove(plugin->getPluginId(), timestamp);
}
QString CTKPluginListener::getExtensionPath(QSharedPointer<ctkPlugin> plugin)
{
// bail out if system plugin
if (plugin->getPluginId() == 0)
return QString();
// bail out if the plugin does not have a symbolic name
if (plugin->getSymbolicName().isEmpty())
return QString();
return PLUGIN_MANIFEST;
}
void CTKPluginListener::addPlugin(QSharedPointer<ctkPlugin> plugin)
{
// if the given plugin already exists in the registry then return.
// note that this does not work for update cases.
std::string contributor = plugin->getSymbolicName().toStdString();
if (registry->HasContributionFrom(contributor))
{
return;
}
QString pluginManifest = getExtensionPath(plugin);
if (pluginManifest.isEmpty())
return;
QByteArray ba = plugin->getResource(pluginManifest);
if (ba.isEmpty())
return;
std::string strContent(ba.data());
std::stringbuf strBuf(strContent, std::ios_base::in);
std::istream is(&strBuf);
registry->AddContribution(is, contributor);
}
}
diff --git a/BlueBerry/Bundles/org.blueberry.core.runtime/files.cmake b/BlueBerry/Bundles/org.blueberry.core.runtime/files.cmake
index a3453eeec4..3698e6c548 100644
--- a/BlueBerry/Bundles/org.blueberry.core.runtime/files.cmake
+++ b/BlueBerry/Bundles/org.blueberry.core.runtime/files.cmake
@@ -1,32 +1,31 @@
SET(MOC_H_FILES
src/internal/berryPluginActivator.h
src/internal/berryPreferencesService.h
)
SET(SRC_CPP_FILES
berryIAdaptable.cpp
berryIAdapterManager.cpp
berryIPreferencesService.cpp
berryPlatformObject.cpp
berryRuntime.cpp
- berryRuntimePlugin.cpp
berryBackingStoreException.cpp
)
SET(INTERNAL_CPP_FILES
berryAbstractPreferencesStorage.cpp
berryPluginActivator.cpp
berryPreferences.cpp
berryPreferencesService.cpp
berryXMLPreferencesStorage.cpp
)
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/BlueBerry/Bundles/org.blueberry.core.runtime/src/berryRuntimePlugin.cpp b/BlueBerry/Bundles/org.blueberry.core.runtime/src/berryRuntimePlugin.cpp
deleted file mode 100644
index ffcd007670..0000000000
--- a/BlueBerry/Bundles/org.blueberry.core.runtime/src/berryRuntimePlugin.cpp
+++ /dev/null
@@ -1,55 +0,0 @@
-/*=========================================================================
-
-Program: BlueBerry Platform
-Language: C++
-Date: $Date$
-Version: $Revision$
-
-Copyright (c) German Cancer Research Center, Division of Medical and
-Biological Informatics. All rights reserved.
-See MITKCopyright.txt or http://www.mitk.org/copyright.html for details.
-
-This software is distributed WITHOUT ANY WARRANTY; without even
-the implied warranty of MERCHANTABILITY or FITNESS FOR A PARTICULAR
-PURPOSE. See the above copyright notices for more information.
-
-=========================================================================*/
-
-#include "berryRuntimePlugin.h"
-
-#include "berryPlatform.h"
-#include "service/berryIExtensionPointService.h"
-#include "event/berryPlatformEvents.h"
-
-#include "Poco/Delegate.h"
-
-#include <iostream>
-
-namespace berry {
-
-const std::string RuntimePlugin::PLUGIN_ID = "org.blueberry.core.runtime";
-
-void
-RuntimePlugin::Start(IBundleContext::Pointer context)
-{
- //BERRY_INFO << "Runtime plugin activated!\n";
-
- //Platform::GetEvents().platformStarted +=
- // Poco::Delegate<RuntimePlugin, PlatformEvent>(this, &RuntimePlugin::onPlatformStarted);
-
- m_PreferencesService = new PreferencesService();
- context->RegisterService(IPreferencesService::ID, m_PreferencesService);
-}
-
-void
-RuntimePlugin::Stop(IBundleContext::Pointer /*context*/)
-{
- //BERRY_INFO << "Runtime plugin activated!\n";
-
- //Platform::GetEvents().platformStarted +=
- // Poco::Delegate<RuntimePlugin, PlatformEvent>(this, &RuntimePlugin::onPlatformStarted);
-
- m_PreferencesService->ShutDown();
-}
-
-}
diff --git a/BlueBerry/Bundles/org.blueberry.core.runtime/src/berryRuntimePlugin.h b/BlueBerry/Bundles/org.blueberry.core.runtime/src/berryRuntimePlugin.h
deleted file mode 100644
index 6c6e9a0014..0000000000
--- a/BlueBerry/Bundles/org.blueberry.core.runtime/src/berryRuntimePlugin.h
+++ /dev/null
@@ -1,44 +0,0 @@
-/*=========================================================================
-
-Program: BlueBerry Platform
-Language: C++
-Date: $Date$
-Version: $Revision$
-
-Copyright (c) German Cancer Research Center, Division of Medical and
-Biological Informatics. All rights reserved.
-See MITKCopyright.txt or http://www.mitk.org/copyright.html for details.
-
-This software is distributed WITHOUT ANY WARRANTY; without even
-the implied warranty of MERCHANTABILITY or FITNESS FOR A PARTICULAR
-PURPOSE. See the above copyright notices for more information.
-
-=========================================================================*/
-
-#ifndef BERRYRUNTIMEACTIVATOR_H_
-#define BERRYRUNTIMEACTIVATOR_H_
-
-#include <berryPlugin.h>
-#include <berryIBundleContext.h>
-#include <berryPlatformEvent.h>
-
-#include <org_blueberry_core_runtime_Export.h>
-#include "internal/berryPreferencesService.h"
-
-namespace berry {
-
-class BERRY_RUNTIME RuntimePlugin : public Plugin
-{
-public:
-
- static const std::string PLUGIN_ID;
-
- void Start(IBundleContext::Pointer context);
- void Stop(IBundleContext::Pointer context);
-protected:
- PreferencesService::Pointer m_PreferencesService;
-};
-
-}
-
-#endif /*BERRYRUNTIMEACTIVATOR_H_*/
diff --git a/BlueBerry/Bundles/org.blueberry.core.runtime/src/internal/berryPluginActivator.cpp b/BlueBerry/Bundles/org.blueberry.core.runtime/src/internal/berryPluginActivator.cpp
index ffe73f6a83..c13ef008d2 100644
--- a/BlueBerry/Bundles/org.blueberry.core.runtime/src/internal/berryPluginActivator.cpp
+++ b/BlueBerry/Bundles/org.blueberry.core.runtime/src/internal/berryPluginActivator.cpp
@@ -1,45 +1,45 @@
/*=========================================================================
Program: BlueBerry Platform
Language: C++
Date: $Date$
Version: $Revision$
Copyright (c) German Cancer Research Center, Division of Medical and
Biological Informatics. All rights reserved.
See MITKCopyright.txt or http://www.mitk.org/copyright.html for details.
This software is distributed WITHOUT ANY WARRANTY; without even
the implied warranty of MERCHANTABILITY or FITNESS FOR A PARTICULAR
PURPOSE. See the above copyright notices for more information.
=========================================================================*/
#include "berryPluginActivator.h"
#include <QtPlugin>
namespace berry {
org_blueberry_core_runtime_Activator::org_blueberry_core_runtime_Activator()
{
}
void org_blueberry_core_runtime_Activator::start(ctkPluginContext* context)
{
- m_PreferencesService = new PreferencesService();
+ m_PreferencesService = new PreferencesService(context->getDataFile("").absolutePath().toStdString());
m_PrefServiceReg = context->registerService<IPreferencesService>(m_PreferencesService.GetPointer());
}
void org_blueberry_core_runtime_Activator::stop(ctkPluginContext* context)
{
m_PrefServiceReg.unregister();
m_PreferencesService->ShutDown();
m_PreferencesService = 0;
m_PrefServiceReg = 0;
}
}
Q_EXPORT_PLUGIN2(org_blueberry_core_runtime, berry::org_blueberry_core_runtime_Activator)
diff --git a/BlueBerry/Bundles/org.blueberry.osgi/src/berryExtensionType.cpp b/BlueBerry/Bundles/org.blueberry.osgi/src/berryExtensionType.cpp
index 0f0f65b0e5..ab066aaac6 100644
--- a/BlueBerry/Bundles/org.blueberry.osgi/src/berryExtensionType.cpp
+++ b/BlueBerry/Bundles/org.blueberry.osgi/src/berryExtensionType.cpp
@@ -1,202 +1,202 @@
/*=========================================================================
Program: BlueBerry Platform
Language: C++
Date: $Date$
Version: $Revision$
Copyright (c) German Cancer Research Center, Division of Medical and
Biological Informatics. All rights reserved.
See MITKCopyright.txt or http://www.mitk.org/copyright.html for details.
This software is distributed WITHOUT ANY WARRANTY; without even
the implied warranty of MERCHANTABILITY or FITNESS FOR A PARTICULAR
PURPOSE. See the above copyright notices for more information.
=========================================================================*/
#include "berryExtensionType.h"
#include <QVector>
#include <QReadWriteLock>
#include <cstring>
namespace berry {
class CustomTypeInfo
{
public:
CustomTypeInfo() : typeName(), constr(0), destr(0)
{}
QByteArray typeName;
ExtensionType::Constructor constr;
ExtensionType::Destructor destr;
int alias;
};
//Q_DECLARE_TYPEINFO(QCustomTypeInfo, Q_MOVABLE_TYPE);
Q_GLOBAL_STATIC(QVector<CustomTypeInfo>, customTypes)
Q_GLOBAL_STATIC(QReadWriteLock, customTypesLock)
const char* ExtensionType::typeName(int type)
{
const QVector<CustomTypeInfo>* const ct = customTypes();
QReadLocker locker(customTypesLock());
return ct && ct->count() > type && !ct->at(type).typeName.isEmpty()
? ct->at(type).typeName.constData()
: static_cast<const char *>(0);
}
/*! \internal
Similar to ExtensionType::type(), but doesn't lock the mutex.
*/
static int extensionTypeCustomType_unlocked(const char *typeName, int length)
{
const QVector<CustomTypeInfo>* const ct = customTypes();
if (!ct) return 0;
for (int v = 0; v < ct->count(); ++v)
{
const CustomTypeInfo& customInfo = ct->at(v);
if ((length == customInfo.typeName.size())
&& !std::strcmp(typeName, customInfo.typeName.constData()))
{
if (customInfo.alias >= 0)
return customInfo.alias;
- return v;
+ return v+1;
}
}
return 0;
}
int ExtensionType::registerType(const char *typeName, Destructor destructor,
Constructor constructor)
{
QVector<CustomTypeInfo>* ct = customTypes();
if (!ct || !typeName || !destructor || !constructor)
return -1;
QByteArray normalizedTypeName = QMetaObject::normalizedType(typeName);
QWriteLocker locker(customTypesLock());
int idx = extensionTypeCustomType_unlocked(normalizedTypeName.constData(),
normalizedTypeName.size());
if (!idx)
{
CustomTypeInfo inf;
inf.typeName = normalizedTypeName;
inf.constr = constructor;
inf.destr = destructor;
inf.alias = -1;
idx = ct->size();
ct->append(inf);
}
return idx;
}
int ExtensionType::registerTypedef(const char* typeName, int aliasId)
{
QVector<CustomTypeInfo>* ct = customTypes();
if (!ct || !typeName) return -1;
QByteArray normalizedTypeName = QMetaObject::normalizedType(typeName);
QWriteLocker locker(customTypesLock());
int idx = extensionTypeCustomType_unlocked(normalizedTypeName.constData(),
normalizedTypeName.size());
if (idx) return idx;
CustomTypeInfo inf;
inf.typeName = normalizedTypeName;
inf.alias = aliasId;
inf.constr = 0;
inf.destr = 0;
ct->append(inf);
return aliasId;
}
void ExtensionType::unregisterType(const char* typeName)
{
QVector<CustomTypeInfo> *ct = customTypes();
if (!ct || !typeName) return;
QByteArray normalizedTypeName = QMetaObject::normalizedType(typeName);
QWriteLocker locker(customTypesLock());
for (int v = 0; v < ct->count(); ++v)
{
if (ct->at(v).typeName == typeName)
{
CustomTypeInfo &inf = (*ct)[v];
inf.typeName.clear();
inf.constr = 0;
inf.destr = 0;
inf.alias = -1;
}
}
}
bool ExtensionType::isRegistered(int type)
{
QReadLocker locker(customTypesLock());
const QVector<CustomTypeInfo>* const ct = customTypes();
- return ((ct && ct->count() > type) &&
- !ct->at(type).typeName.isEmpty());
+ return ((type > 0) && (ct && ct->count() > type - 1) &&
+ !ct->at(type - 1).typeName.isEmpty());
}
int ExtensionType::type(const char *typeName)
{
int length = std::strlen(typeName);
if (!length) return 0;
QReadLocker locker(customTypesLock());
int type = extensionTypeCustomType_unlocked(typeName, length);
if (!type)
{
const QByteArray normalizedTypeName = QMetaObject::normalizedType(typeName);
type = extensionTypeCustomType_unlocked(normalizedTypeName.constData(),
normalizedTypeName.size());
}
return type;
}
QObject* ExtensionType::construct(int type)
{
const QVector<CustomTypeInfo> * const ct = customTypes();
Constructor constr = 0;
QReadLocker locker(customTypesLock());
- if (!ct || ct->count() <= type)
+ if (!ct || ct->count() <= type - 1)
return 0;
- if (ct->at(type).typeName.isEmpty())
+ if (ct->at(type - 1).typeName.isEmpty())
return 0;
- constr = ct->at(type).constr;
+ constr = ct->at(type - 1).constr;
return constr();
}
void ExtensionType::destroy(int type, QObject* data)
{
if (!data) return;
const QVector<CustomTypeInfo> * const ct = customTypes();
- if (!ct) return;
+ if (!ct || ct->count() <= type - 1) return;
Destructor destr = 0;
QReadLocker locker(customTypesLock());
- if (ct->at(type).typeName.isEmpty())
+ if (ct->at(type - 1).typeName.isEmpty())
return;
- destr = ct->at(type).destr;
+ destr = ct->at(type - 1).destr;
destr(data);
}
} // end namespace berry
diff --git a/BlueBerry/Bundles/org.blueberry.osgi/src/berryPlatform.cpp b/BlueBerry/Bundles/org.blueberry.osgi/src/berryPlatform.cpp
index dfaad0c512..60345997ee 100644
--- a/BlueBerry/Bundles/org.blueberry.osgi/src/berryPlatform.cpp
+++ b/BlueBerry/Bundles/org.blueberry.osgi/src/berryPlatform.cpp
@@ -1,209 +1,211 @@
/*=========================================================================
Program: BlueBerry Platform
Language: C++
Date: $Date$
Version: $Revision$
Copyright (c) German Cancer Research Center, Division of Medical and
Biological Informatics. All rights reserved.
See MITKCopyright.txt or http://www.mitk.org/copyright.html for details.
This software is distributed WITHOUT ANY WARRANTY; without even
the implied warranty of MERCHANTABILITY or FITNESS FOR A PARTICULAR
PURPOSE. See the above copyright notices for more information.
=========================================================================*/
#include <Poco/Path.h>
#include "berryPlatform.h"
#include "service/berryIExtensionPointService.h"
#include "internal/berryInternalPlatform.h"
namespace berry {
int Platform::OS_FREE_BSD = BERRY_OS_FREE_BSD;
int Platform::OS_AIX = BERRY_OS_AIX;
int Platform::OS_HPUX = BERRY_OS_HPUX;
int Platform::OS_TRU64 = BERRY_OS_TRU64;
int Platform::OS_LINUX = BERRY_OS_LINUX;
int Platform::OS_MAC_OS_X = BERRY_OS_MAC_OS_X;
int Platform::OS_NET_BSD = BERRY_OS_NET_BSD;
int Platform::OS_OPEN_BSD = BERRY_OS_OPEN_BSD;
int Platform::OS_IRIX = BERRY_OS_IRIX;
int Platform::OS_SOLARIS = BERRY_OS_SOLARIS;
int Platform::OS_QNX = BERRY_OS_QNX;
int Platform::OS_VXWORKS = BERRY_OS_VXWORKS;
int Platform::OS_CYGWIN = BERRY_OS_CYGWIN;
int Platform::OS_UNKNOWN_UNIX = BERRY_OS_UNKNOWN_UNIX;
int Platform::OS_WINDOWS_NT = BERRY_OS_WINDOWS_NT;
int Platform::OS_WINDOWS_CE = BERRY_OS_WINDOWS_CE;
int Platform::OS_VMS = BERRY_OS_VMS;
int Platform::ARCH_ALPHA = BERRY_ARCH_ALPHA;
int Platform::ARCH_IA32 = BERRY_ARCH_IA32;
int Platform::ARCH_IA64 = BERRY_ARCH_IA64;
int Platform::ARCH_MIPS = BERRY_ARCH_MIPS;
int Platform::ARCH_HPPA = BERRY_ARCH_HPPA;
int Platform::ARCH_PPC = BERRY_ARCH_PPC;
int Platform::ARCH_POWER = BERRY_ARCH_POWER;
int Platform::ARCH_SPARC = BERRY_ARCH_SPARC;
int Platform::ARCH_AMD64 = BERRY_ARCH_AMD64;
int Platform::ARCH_ARM = BERRY_ARCH_ARM;
std::string Platform::ARG_CLEAN = "BlueBerry.clean";
std::string Platform::ARG_APPLICATION = "BlueBerry.application";
std::string Platform::ARG_HOME = "BlueBerry.home";
+std::string Platform::ARG_STORAGE_DIR = "BlueBerry.storageDir";
std::string Platform::ARG_PLUGIN_CACHE = "BlueBerry.plugin_cache_dir";
std::string Platform::ARG_PLUGIN_DIRS = "BlueBerry.plugin_dirs";
+std::string Platform::ARG_FORCE_PLUGIN_INSTALL = "BlueBerry.forcePlugins";
std::string Platform::ARG_PROVISIONING = "BlueBerry.provisioning";
std::string Platform::ARG_CONSOLELOG = "BlueBerry.consoleLog";
std::string Platform::ARG_TESTPLUGIN = "BlueBerry.testplugin";
std::string Platform::ARG_TESTAPPLICATION = "BlueBerry.testapplication";
const Poco::Path& Platform::GetConfigurationPath()
{
return InternalPlatform::GetInstance()->GetConfigurationPath();
}
SmartPointer<IExtensionPointService> Platform::GetExtensionPointService()
{
return InternalPlatform::GetInstance()->GetExtensionPointService();
}
PlatformEvents& Platform::GetEvents()
{
return InternalPlatform::GetInstance()->GetEvents();
}
const Poco::Path& Platform::GetInstallPath()
{
return InternalPlatform::GetInstance()->GetInstallPath();
}
const Poco::Path& Platform::GetInstancePath()
{
return InternalPlatform::GetInstance()->GetInstancePath();
}
int Platform::GetOS()
{
return BERRY_OS;
}
int Platform::GetOSArch()
{
return BERRY_ARCH;
}
bool Platform::IsUnix()
{
#ifdef BERRY_OS_FAMILY_UNIX
return true;
#else
return false;
#endif
}
bool Platform::IsWindows()
{
#ifdef BERRY_OS_FAMILY_WINDOWS
return true;
#else
return false;
#endif
}
bool Platform::IsBSD()
{
#ifdef BERRY_OS_FAMILY_BSD
return true;
#else
return false;
#endif
}
bool Platform::IsLinux()
{
#ifdef BERRY_OS_FAMILY_LINUX
return true;
#else
return false;
#endif
}
bool Platform::IsVMS()
{
#ifdef BERRY_OS_FAMILY_VMS
return true;
#else
return false;
#endif
}
bool Platform::GetStatePath(Poco::Path& statePath, IBundle::Pointer bundle, bool create)
{
return InternalPlatform::GetInstance()->GetStatePath(statePath, bundle, create);
}
const Poco::Path& Platform::GetUserPath()
{
return InternalPlatform::GetInstance()->GetUserPath();
}
std::string Platform::GetProperty(const std::string& /*key*/)
{
return "";
}
bool Platform::IsRunning()
{
return InternalPlatform::GetInstance()->IsRunning();
}
int& Platform::GetRawApplicationArgs(char**& argv)
{
return InternalPlatform::GetInstance()->GetRawApplicationArgs(argv);
}
std::vector<std::string> Platform::GetApplicationArgs()
{
return InternalPlatform::GetInstance()->GetApplicationArgs();
}
Poco::Util::LayeredConfiguration& Platform::GetConfiguration()
{
return InternalPlatform::GetInstance()->GetConfiguration();
}
ServiceRegistry& Platform::GetServiceRegistry()
{
return InternalPlatform::GetInstance()->GetServiceRegistry();
}
IBundle::Pointer Platform::GetBundle(const std::string& id)
{
return InternalPlatform::GetInstance()->GetBundle(id);
}
std::vector<IBundle::Pointer> Platform::GetBundles()
{
return InternalPlatform::GetInstance()->GetBundles();
}
QSharedPointer<ctkPlugin> Platform::GetCTKPlugin(const QString& symbolicName)
{
QList<QSharedPointer<ctkPlugin> > plugins =
InternalPlatform::GetInstance()->GetCTKPluginFrameworkContext()->getPlugins();
foreach(QSharedPointer<ctkPlugin> plugin, plugins)
{
if (plugin->getSymbolicName() == symbolicName)
return plugin;
}
return QSharedPointer<ctkPlugin>(0);
}
}
diff --git a/BlueBerry/Bundles/org.blueberry.osgi/src/berryPlatform.h b/BlueBerry/Bundles/org.blueberry.osgi/src/berryPlatform.h
index 8a063d9b84..d3881f78fa 100644
--- a/BlueBerry/Bundles/org.blueberry.osgi/src/berryPlatform.h
+++ b/BlueBerry/Bundles/org.blueberry.osgi/src/berryPlatform.h
@@ -1,344 +1,346 @@
/*=========================================================================
Program: BlueBerry Platform
Language: C++
Date: $Date$
Version: $Revision$
Copyright (c) German Cancer Research Center, Division of Medical and
Biological Informatics. All rights reserved.
See MITKCopyright.txt or http://www.mitk.org/copyright.html for details.
This software is distributed WITHOUT ANY WARRANTY; without even
the implied warranty of MERCHANTABILITY or FITNESS FOR A PARTICULAR
PURPOSE. See the above copyright notices for more information.
=========================================================================*/
#ifndef BERRY_Platform_INCLUDED
#define BERRY_Platform_INCLUDED
//
// Platform Identification
//
#define BERRY_OS_FREE_BSD 0x0001
#define BERRY_OS_AIX 0x0002
#define BERRY_OS_HPUX 0x0003
#define BERRY_OS_TRU64 0x0004
#define BERRY_OS_LINUX 0x0005
#define BERRY_OS_MAC_OS_X 0x0006
#define BERRY_OS_NET_BSD 0x0007
#define BERRY_OS_OPEN_BSD 0x0008
#define BERRY_OS_IRIX 0x0009
#define BERRY_OS_SOLARIS 0x000a
#define BERRY_OS_QNX 0x000b
#define BERRY_OS_VXWORKS 0x000c
#define BERRY_OS_CYGWIN 0x000d
#define BERRY_OS_UNKNOWN_UNIX 0x00ff
#define BERRY_OS_WINDOWS_NT 0x1001
#define BERRY_OS_WINDOWS_CE 0x1011
#define BERRY_OS_VMS 0x2001
#if defined(__FreeBSD__)
#define BERRY_OS_FAMILY_UNIX 1
#define BERRY_OS_FAMILY_BSD 1
#define BERRY_OS BERRY_OS_FREE_BSD
#elif defined(_AIX) || defined(__TOS_AIX__)
#define BERRY_OS_FAMILY_UNIX 1
#define BERRY_OS BERRY_OS_AIX
#elif defined(hpux) || defined(_hpux)
#define BERRY_OS_FAMILY_UNIX 1
#define BERRY_OS BERRY_OS_HPUX
#elif defined(__digital__) || defined(__osf__)
#define BERRY_OS_FAMILY_UNIX 1
#define BERRY_OS BERRY_OS_TRU64
#elif defined(linux) || defined(__linux) || defined(__linux__) || defined(__TOS_LINUX__)
#define BERRY_OS_FAMILY_UNIX 1
#define BERRY_OS BERRY_OS_LINUX
#elif defined(__APPLE__) || defined(__TOS_MACOS__)
#define BERRY_OS_FAMILY_UNIX 1
#define BERRY_OS_FAMILY_BSD 1
#define BERRY_OS BERRY_OS_MAC_OS_X
#elif defined(__NetBSD__)
#define BERRY_OS_FAMILY_UNIX 1
#define BERRY_OS_FAMILY_BSD 1
#define BERRY_OS BERRY_OS_NET_BSD
#elif defined(__OpenBSD__)
#define BERRY_OS_FAMILY_UNIX 1
#define BERRY_OS_FAMILY_BSD 1
#define BERRY_OS BERRY_OS_OPEN_BSD
#elif defined(sgi) || defined(__sgi)
#define BERRY_OS_FAMILY_UNIX 1
#define BERRY_OS BERRY_OS_IRIX
#elif defined(sun) || defined(__sun)
#define BERRY_OS_FAMILY_UNIX 1
#define BERRY_OS BERRY_OS_SOLARIS
#elif defined(__QNX__)
#define BERRY_OS_FAMILY_UNIX 1
#define BERRY_OS BERRY_OS_QNX
#elif defined(unix) || defined(__unix) || defined(__unix__)
#define BERRY_OS_FAMILY_UNIX 1
#define BERRY_OS BERRY_OS_UNKNOWN_UNIX
#elif defined(_WIN32_WCE)
#define BERRY_OS_FAMILY_WINDOWS 1
#define BERRY_OS BERRY_OS_WINDOWS_CE
#elif defined(_WIN32) || defined(_WIN64)
#define BERRY_OS_FAMILY_WINDOWS 1
#define BERRY_OS BERRY_OS_WINDOWS_NT
#elif defined(__CYGWIN__)
#define BERRY_OS_FAMILY_UNIX 1
#define BERRY_OS BERRY_OS_CYGWIN
#elif defined(__VMS)
#define BERRY_OS_FAMILY_VMS 1
#define BERRY_OS BERRY_OS_VMS
#endif
//
// Hardware Architecture and Byte Order
//
#define BERRY_ARCH_ALPHA 0x01
#define BERRY_ARCH_IA32 0x02
#define BERRY_ARCH_IA64 0x03
#define BERRY_ARCH_MIPS 0x04
#define BERRY_ARCH_HPPA 0x05
#define BERRY_ARCH_PPC 0x06
#define BERRY_ARCH_POWER 0x07
#define BERRY_ARCH_SPARC 0x08
#define BERRY_ARCH_AMD64 0x09
#define BERRY_ARCH_ARM 0x0a
#if defined(__ALPHA) || defined(__alpha) || defined(__alpha__) || defined(_M_ALPHA)
#define BERRY_ARCH BERRY_ARCH_ALPHA
#define BERRY_ARCH_LITTLE_ENDIAN 1
#elif defined(i386) || defined(__i386) || defined(__i386__) || defined(_M_IX86)
#define BERRY_ARCH BERRY_ARCH_IA32
#define BERRY_ARCH_LITTLE_ENDIAN 1
#elif defined(_IA64) || defined(__IA64__) || defined(__ia64__) || defined(__ia64) || defined(_M_IA64)
#define BERRY_ARCH BERRY_ARCH_IA64
#if defined(hpux) || defined(_hpux)
#define BERRY_ARCH_BIG_ENDIAN 1
#else
#define BERRY_ARCH_LITTLE_ENDIAN 1
#endif
#elif defined(__x86_64__)
#define BERRY_ARCH BERRY_ARCH_AMD64
#define BERRY_ARCH_LITTLE_ENDIAN 1
#elif defined(_M_X64)
#define BERRY_ARCH BERRY_ARCH_AMD64
#define BERRY_ARCH_LITTLE_ENDIAN 1
#elif defined(__mips__) || defined(__mips) || defined(__MIPS__) || defined(_M_MRX000)
#define BERRY_ARCH BERRY_ARCH_MIPS
#define BERRY_ARCH_BIG_ENDIAN 1
#elif defined(__hppa) || defined(__hppa__)
#define BERRY_ARCH BERRY_ARCH_HPPA
#define BERRY_ARCH_BIG_ENDIAN 1
#elif defined(__PPC) || defined(__POWERPC__) || defined(__powerpc) || defined(__PPC__) || \
defined(__powerpc__) || defined(__ppc__) || defined(_ARCH_PPC) || defined(_M_PPC)
#define BERRY_ARCH BERRY_ARCH_PPC
#define BERRY_ARCH_BIG_ENDIAN 1
#elif defined(_POWER) || defined(_ARCH_PWR) || defined(_ARCH_PWR2) || defined(_ARCH_PWR3) || \
defined(_ARCH_PWR4) || defined(__THW_RS6000)
#define BERRY_ARCH BERRY_ARCH_POWER
#define BERRY_ARCH_BIG_ENDIAN 1
#elif defined(__sparc__) || defined(__sparc) || defined(sparc)
#define BERRY_ARCH BERRY_ARCH_SPARC
#define BERRY_ARCH_BIG_ENDIAN 1
#elif defined(__arm__) || defined(__arm) || defined(ARM) || defined(_ARM_) || defined(__ARM__) || defined(_M_ARM)
#define BERRY_ARCH BERRY_ARCH_ARM
#if defined(__ARMEB__)
#define BERRY_ARCH_BIG_ENDIAN 1
#else
#define BERRY_ARCH_LITTLE_ENDIAN 1
#endif
#endif
#include <org_blueberry_osgi_Export.h>
#include "event/berryPlatformEvents.h"
#include "service/berryServiceRegistry.h"
#include <Poco/Util/LayeredConfiguration.h>
namespace berry {
struct IExtensionPointService;
/**
* The central class of the BlueBerry Platform Runtime. This class cannot
* be instantiated or subclassed by clients; all functionality is provided
* by static methods. Features include:
* <ul>
* <li>the platform registry of installed plug-ins</li>
* <li>the platform adapter manager</li>
* <li>the platform log</li>
* </ul>
* <p>
* Most users don't have to worry about Platform's lifecycle. However, if your
* code can call methods of this class when Platform is not running, it becomes
* necessary to check {@link #IsRunning()} before making the call. A runtime
* exception might be thrown or incorrect result might be returned if a method
* from this class is called while Platform is not running.
* </p>
*/
class BERRY_OSGI Platform
{
public:
static int OS_FREE_BSD;
static int OS_AIX;
static int OS_HPUX;
static int OS_TRU64;
static int OS_LINUX;
static int OS_MAC_OS_X;
static int OS_NET_BSD;
static int OS_OPEN_BSD;
static int OS_IRIX;
static int OS_SOLARIS;
static int OS_QNX;
static int OS_VXWORKS;
static int OS_CYGWIN;
static int OS_UNKNOWN_UNIX;
static int OS_WINDOWS_NT;
static int OS_WINDOWS_CE;
static int OS_VMS;
static int ARCH_ALPHA;
static int ARCH_IA32;
static int ARCH_IA64;
static int ARCH_MIPS;
static int ARCH_HPPA;
static int ARCH_PPC;
static int ARCH_POWER;
static int ARCH_SPARC;
static int ARCH_AMD64;
static int ARCH_ARM;
static std::string ARG_CLEAN;
static std::string ARG_APPLICATION;
static std::string ARG_HOME;
+ static std::string ARG_STORAGE_DIR;
static std::string ARG_PLUGIN_CACHE;
static std::string ARG_PLUGIN_DIRS;
+ static std::string ARG_FORCE_PLUGIN_INSTALL;
static std::string ARG_PROVISIONING;
static std::string ARG_CONSOLELOG;
static std::string ARG_TESTPLUGIN;
static std::string ARG_TESTAPPLICATION;
static SmartPointer<IExtensionPointService> GetExtensionPointService();
// static IPreferenceService GetPreferenceService();
static PlatformEvents& GetEvents();
/**
* Returns the path of the configuration information
* used to run this instance of the BlueBerry platform.
* The configuration area typically
* contains the list of plug-ins available for use, various settings
* (those shared across different instances of the same configuration)
* and any other such data needed by plug-ins.
* An empty path is returned if the platform is running without a configuration location.
*
* @return the location of the platform's configuration data area
*/
static const Poco::Path& GetConfigurationPath();
/**
* Returns the path of the base installation for the running platform
*
* @return the location of the platform's installation area or <code>null</code> if none
*/
static const Poco::Path& GetInstallPath();
/**
* Returns the path of the platform's working directory (also known as the instance data area).
* An empty path is returned if the platform is running without an instance location.
*
* @return the location of the platform's instance data area or <code>null</code> if none
*/
static const Poco::Path& GetInstancePath();
/**
* Returns the path in the local file system of the
* plug-in state area for the given bundle.
* If the plug-in state area did not exist prior to this call,
* it is created.
* <p>
* The plug-in state area is a file directory within the
* platform's metadata area where a plug-in is free to create files.
* The content and structure of this area is defined by the plug-in,
* and the particular plug-in is solely responsible for any files
* it puts there. It is recommended for plug-in preference settings and
* other configuration parameters.
* </p>
*
* @param bundle the bundle whose state location is returned
* @return a local file system path
* TODO Investigate the usage of a service factory
*/
static bool GetStatePath(Poco::Path& statePath, SmartPointer<IBundle> bundle, bool create = true);
/**
* Returns the path of the platform's user data area. The user data area is a location on the system
* which is specific to the system's current user. By default it is located relative to the
* location given by the System property "user.home".
* An empty path is returned if the platform is running without an user location.
*
* @return the location of the platform's user data area or <code>null</code> if none
*/
static const Poco::Path& GetUserPath();
static int GetOS();
static int GetOSArch();
static bool IsUnix();
static bool IsWindows();
static bool IsBSD();
static bool IsLinux();
static bool IsVMS();
static std::string GetProperty(const std::string& key);
static bool IsRunning();
static Poco::Util::LayeredConfiguration& GetConfiguration();
/**
* Returns the unmodified, original command line arguments
*
*/
static int& GetRawApplicationArgs(char**& argv);
/**
* Returns the applications command line arguments which
* have not been consumed by the platform. The first
* argument still is the application name
*/
static std::vector<std::string> GetApplicationArgs();
static ServiceRegistry& GetServiceRegistry();
/**
* Returns the resolved bundle with the specified symbolic name that has the
* highest version. If no resolved bundles are installed that have the
* specified symbolic name then null is returned.
*
* @param id the symbolic name of the bundle to be returned.
* @return the bundle that has the specified symbolic name with the
* highest version, or <tt>null</tt> if no bundle is found.
*/
static IBundle::Pointer GetBundle(const std::string& id);
static std::vector<IBundle::Pointer> GetBundles();
static QSharedPointer<ctkPlugin> GetCTKPlugin(const QString& symbolicName);
private:
Platform();
};
} // namespace
#endif // BERRY_Platform_INCLUDED
diff --git a/BlueBerry/Bundles/org.blueberry.osgi/src/internal/berryCodeCache.cpp b/BlueBerry/Bundles/org.blueberry.osgi/src/internal/berryCodeCache.cpp
index a62f9a9fbc..eb69cfc069 100644
--- a/BlueBerry/Bundles/org.blueberry.osgi/src/internal/berryCodeCache.cpp
+++ b/BlueBerry/Bundles/org.blueberry.osgi/src/internal/berryCodeCache.cpp
@@ -1,135 +1,138 @@
/*=========================================================================
Program: BlueBerry Platform
Language: C++
Date: $Date$
Version: $Revision$
Copyright (c) German Cancer Research Center, Division of Medical and
Biological Informatics. All rights reserved.
See MITKCopyright.txt or http://www.mitk.org/copyright.html for details.
This software is distributed WITHOUT ANY WARRANTY; without even
the implied warranty of MERCHANTABILITY or FITNESS FOR A PARTICULAR
PURPOSE. See the above copyright notices for more information.
=========================================================================*/
#include "berryLog.h"
#include "berryCodeCache.h"
#include "berryInternalPlatform.h"
#include "Poco/Path.h"
#include "Poco/SharedLibrary.h"
#include <fstream>
#include <iostream>
#include <algorithm>
namespace berry {
CodeCache::CodeCache(const std::string& path) : m_CachePath(path)
{
BERRY_INFO(InternalPlatform::GetInstance()->ConsoleLog()) << "Creating CodeCache with path: " << path << std::endl;
if (!m_CachePath.exists())
{
- m_CachePath.createDirectory();
+ m_CachePath.createDirectories();
}
}
CodeCache::~CodeCache()
{
}
void
CodeCache::Clear()
{
- BERRY_INFO(InternalPlatform::GetInstance()->ConsoleLog()) << "Clearing code cache\n";
- std::vector<Poco::File> files;
- m_CachePath.list(files);
- for (std::vector<Poco::File>::iterator iter = files.begin(); iter != files.end(); ++iter)
+ if (m_CachePath.exists())
{
- iter->remove(true);
+ BERRY_INFO(InternalPlatform::GetInstance()->ConsoleLog()) << "Clearing code cache\n";
+ std::vector<Poco::File> files;
+ m_CachePath.list(files);
+ for (std::vector<Poco::File>::iterator iter = files.begin(); iter != files.end(); ++iter)
+ {
+ iter->remove(true);
+ }
}
}
bool
CodeCache::HasLibrary(const std::string& name)
{
//BERRY_INFO << "HasLibrary checks for: " << name;
std::vector<std::string> files;
m_CachePath.list(files);
std::string libName(name);
//libName.append(Poco::SharedLibrary::suffix());
std::vector<std::string>::iterator iter;
for (iter = files.begin(); iter != files.end(); iter++)
{
if ((*iter) == libName) {
//BERRY_INFO << " FOUND\n";
return true;
}
}
//BERRY_INFO << " NOT FOUND\n";
return false;
}
void
CodeCache::InstallLibrary(const std::string& name, std::istream& istr)
{
//BERRY_INFO << "Installing library " << name << " to " << this->GetPathForLibrary(name).toString() << std::endl;
std::ofstream ostr(this->GetPathForLibrary(name).toString().c_str(), std::ios::binary | std::ios::trunc);
ostr << istr.rdbuf();
}
void
CodeCache::InstallLibrary(const std::string& name, const Poco::File& path)
{
//BERRY_INFO << "Registering library " << name << " in " << path.path() << std::endl;
m_LibPaths.insert(std::make_pair(name, path));
}
void
CodeCache::UnInstallLibrary(const std::string& name)
{
std::map<std::string, Poco::File>::iterator iter = m_LibPaths.find(name);
if (iter == m_LibPaths.end())
{
Poco::File(this->GetPathForLibrary(name)).remove();
}
else
{
m_LibPaths.erase(name);
}
}
Poco::Path
CodeCache::GetPathForLibrary(const std::string& name)
{
// We instructed cmake to replace "." with "_" in library names
// since they are also used for defines (for Windows dll import/export
// stuff) and . is bad in identifiers.
// Hence we must replace all "." with "_" here too
std::string libName(name);
std::replace(libName.begin(), libName.end(), '.', '_');
//BERRY_INFO << "Getting path for library: " << libName << std::endl;
if (m_LibPaths.find(libName) != m_LibPaths.end())
{
return Poco::Path(m_LibPaths[libName].path(), libName + Poco::SharedLibrary::suffix());
}
else
{
return Poco::Path(m_CachePath.path(), libName + Poco::SharedLibrary::suffix());
}
}
}
diff --git a/BlueBerry/Bundles/org.blueberry.osgi/src/internal/berryInternalPlatform.cpp b/BlueBerry/Bundles/org.blueberry.osgi/src/internal/berryInternalPlatform.cpp
index 5b57acb790..a3180c5566 100644
--- a/BlueBerry/Bundles/org.blueberry.osgi/src/internal/berryInternalPlatform.cpp
+++ b/BlueBerry/Bundles/org.blueberry.osgi/src/internal/berryInternalPlatform.cpp
@@ -1,483 +1,552 @@
/*=========================================================================
Program: BlueBerry Platform
Language: C++
Date: $Date$
Version: $Revision$
Copyright (c) German Cancer Research Center, Division of Medical and
Biological Informatics. All rights reserved.
See MITKCopyright.txt or http://www.mitk.org/copyright.html for details.
This software is distributed WITHOUT ANY WARRANTY; without even
the implied warranty of MERCHANTABILITY or FITNESS FOR A PARTICULAR
PURPOSE. See the above copyright notices for more information.
=========================================================================*/
#include "berryInternalPlatform.h"
#include "berryLog.h"
#include <Poco/Exception.h>
#include <Poco/File.h>
#include <Poco/FileStream.h>
#include <Poco/AutoPtr.h>
#include <Poco/Util/PropertyFileConfiguration.h>
#include <Poco/StringTokenizer.h>
#include <Poco/Util/HelpFormatter.h>
#include <Poco/Util/OptionException.h>
#include <ctkPluginFrameworkLauncher.h>
#include <ctkPluginFrameworkFactory.h>
#include <ctkPluginFramework.h>
#include <ctkPluginContext.h>
#include <ctkPlugin.h>
+#include <ctkPluginException.h>
#include <iostream>
#include "../berryPlatform.h"
#include "../berryPlatformException.h"
#include "../berryDebugUtil.h"
#include "../event/berryPlatformEvents.h"
#include "berryPlatformLogChannel.h"
#include "../berryIBundle.h"
#include "berryCodeCache.h"
#include "../berryBundleLoader.h"
#include "berrySystemBundle.h"
#include "berryBundleDirectory.h"
#include "berryProvisioningInfo.h"
+#include <QCoreApplication>
+#include <QDesktopServices>
#include <QDebug>
namespace berry {
Poco::Mutex InternalPlatform::m_Mutex;
InternalPlatform::InternalPlatform() : m_Initialized(false), m_Running(false),
m_ConsoleLog(false), m_ServiceRegistry(0),
m_CodeCache(0), m_BundleLoader(0), m_SystemBundle(0), m_PlatformLogger(0),
m_ctkPluginFrameworkFactory(0),
m_EventStarted(PlatformEvent::EV_PLATFORM_STARTED)
{
}
InternalPlatform::~InternalPlatform()
{
}
InternalPlatform* InternalPlatform::GetInstance()
{
Poco::Mutex::ScopedLock lock(m_Mutex);
static InternalPlatform instance;
return &instance;
}
bool InternalPlatform::ConsoleLog() const
{
return m_ConsoleLog;
}
ctkPluginContext* InternalPlatform::GetCTKPluginFrameworkContext() const
{
if (m_ctkPluginFrameworkFactory)
{
return m_ctkPluginFrameworkFactory->getFramework()->getPluginContext();
}
return 0;
}
ServiceRegistry& InternalPlatform::GetServiceRegistry()
{
AssertInitialized();
return *m_ServiceRegistry;
}
void InternalPlatform::Initialize(int& argc, char** argv, Poco::Util::AbstractConfiguration* config)
{
// initialization
Poco::Mutex::ScopedLock lock(m_Mutex);
m_Argc = &argc;
m_Argv = argv;
try
{
this->init(argc, argv);
}
catch (const Poco::Util::UnknownOptionException& e)
{
BERRY_WARN << e.displayText();
}
this->loadConfiguration();
if (config)
{
this->config().add(config, 50, false);
}
m_ServiceRegistry = new ServiceRegistry();
m_ConsoleLog = this->GetConfiguration().hasProperty(Platform::ARG_CONSOLELOG);
m_ConfigPath.assign(this->GetConfiguration().getString("application.configDir"));
m_InstancePath.assign(this->GetConfiguration().getString("application.dir"));
try
{
m_InstallPath.assign(this->GetConfiguration().getString(Platform::ARG_HOME));
}
catch (Poco::NotFoundException& )
{
m_InstallPath.assign(m_InstancePath);
}
- m_UserPath.assign(Poco::Path::home());
- m_UserPath.pushDirectory("." + this->commandName());
- Poco::File userFile(m_UserPath);
+ if (this->GetConfiguration().hasProperty(Platform::ARG_STORAGE_DIR))
+ {
+ std::string dataLocation = this->GetConfiguration().getString(Platform::ARG_STORAGE_DIR, "");
+ if (dataLocation.at(dataLocation.size()-1) != '/')
+ {
+ dataLocation += '/';
+ }
+ m_UserPath.assign(dataLocation);
+ }
+ else
+ {
+ // Append a hash value of the absolute path of the executable to the data location.
+ // This allows to start the same application from different build or install trees.
+ QString dataLocation = QDesktopServices::storageLocation(QDesktopServices::DataLocation) + '_';
+ dataLocation += QString::number(qHash(QCoreApplication::applicationDirPath())) + "/";
+ m_UserPath.assign(dataLocation.toStdString());
+ }
+
+ Poco::File userFile(m_UserPath);
try
{
- userFile.createDirectory();
+ userFile.createDirectories();
userFile.canWrite();
}
catch(const Poco::IOException& e)
{
BERRY_WARN << e.displayText();
m_UserPath.assign(Poco::Path::temp());
m_UserPath.pushDirectory("." + this->commandName());
userFile = m_UserPath;
}
-
- m_BaseStatePath = m_UserPath;
- m_BaseStatePath.pushDirectory(".metadata");
- m_BaseStatePath.pushDirectory(".plugins");
-
- Poco::Path logPath(m_UserPath);
- logPath.setFileName(this->commandName() + ".log");
- m_PlatformLogChannel = new PlatformLogChannel(logPath.toString());
- m_PlatformLogger = &Poco::Logger::create("PlatformLogger", m_PlatformLogChannel, Poco::Message::PRIO_TRACE);
-
- try
- {
- m_CodeCache = new CodeCache(this->GetConfiguration().getString(Platform::ARG_PLUGIN_CACHE));
- }
- catch (Poco::NotFoundException&)
- {
- Poco::Path cachePath(m_UserPath);
- cachePath.pushDirectory("plugin_cache");
- m_CodeCache = new CodeCache(cachePath.toString());
- }
- m_BundleLoader = new BundleLoader(m_CodeCache, *m_PlatformLogger);
// Initialize the CTK Plugin Framework
ctkProperties fwProps;
fwProps.insert(ctkPluginConstants::FRAMEWORK_STORAGE, QString::fromStdString(userFile.path()));
+#if defined(Q_CC_GNU) && ((__GNUC__ < 4) || ((__GNUC__ == 4) && (__GNUC_MINOR__ < 5)))
+ fwProps.insert(ctkPluginConstants::FRAMEWORK_PLUGIN_LOAD_HINTS, QVariant::fromValue<QLibrary::LoadHints>(QLibrary::ExportExternalSymbolsHint));
+#endif
+ if (this->GetConfiguration().hasProperty(Platform::ARG_CLEAN))
+ {
+ fwProps.insert(ctkPluginConstants::FRAMEWORK_STORAGE_CLEAN, ctkPluginConstants::FRAMEWORK_STORAGE_CLEAN_ONFIRSTINIT);
+ }
m_ctkPluginFrameworkFactory = new ctkPluginFrameworkFactory(fwProps);
QSharedPointer<ctkPluginFramework> pfw = m_ctkPluginFrameworkFactory->getFramework();
pfw->init();
ctkPluginContext* pfwContext = pfw->getPluginContext();
std::string provisioningFile = this->GetConfiguration().getString(Platform::ARG_PROVISIONING);
if (!provisioningFile.empty())
{
ProvisioningInfo provInfo(QString::fromStdString(provisioningFile));
foreach(QString pluginPath, provInfo.getPluginDirs())
{
ctkPluginFrameworkLauncher::addSearchPath(pluginPath);
}
+ bool forcePluginOverwrite = this->GetConfiguration().hasOption(Platform::ARG_FORCE_PLUGIN_INSTALL);
QList<QUrl> pluginsToStart = provInfo.getPluginsToStart();
foreach(QUrl pluginUrl, provInfo.getPluginsToInstall())
{
- QSharedPointer<ctkPlugin> plugin = pfwContext->installPlugin(pluginUrl);
- if (pluginsToStart.contains(pluginUrl))
+ if (forcePluginOverwrite)
+ {
+ uninstallPugin(pluginUrl, pfwContext);
+ }
+ try
+ {
+ QSharedPointer<ctkPlugin> plugin = pfwContext->installPlugin(pluginUrl);
+ if (pluginsToStart.contains(pluginUrl))
+ {
+ m_CTKPluginsToStart << plugin->getPluginId();
+ }
+ }
+ catch (const ctkPluginException& e)
{
- m_CTKPluginsToStart << plugin->getPluginId();
+ BERRY_ERROR << "Failed to install: " << pluginUrl.toString().toStdString() << ",\n" << e.what();
}
}
}
+ m_BaseStatePath = m_UserPath;
+ m_BaseStatePath.pushDirectory("bb-metadata");
+ m_BaseStatePath.pushDirectory("bb-plugins");
+
+ Poco::Path logPath(m_UserPath);
+ logPath.setFileName(this->commandName() + ".log");
+ m_PlatformLogChannel = new PlatformLogChannel(logPath.toString());
+ m_PlatformLogger = &Poco::Logger::create("PlatformLogger", m_PlatformLogChannel, Poco::Message::PRIO_TRACE);
+
+ try
+ {
+ m_CodeCache = new CodeCache(this->GetConfiguration().getString(Platform::ARG_PLUGIN_CACHE));
+ }
+ catch (Poco::NotFoundException&)
+ {
+ Poco::Path cachePath(m_UserPath);
+ cachePath.pushDirectory("bb-plugin_cache");
+ m_CodeCache = new CodeCache(cachePath.toString());
+ }
+ m_BundleLoader = new BundleLoader(m_CodeCache, *m_PlatformLogger);
+
// tell the BundleLoader about the installed CTK plug-ins
QStringList installedCTKPlugins;
foreach(QSharedPointer<ctkPlugin> plugin, pfwContext->getPlugins())
{
installedCTKPlugins << plugin->getSymbolicName();
}
m_BundleLoader->SetCTKPlugins(installedCTKPlugins);
m_Initialized = true;
// Clear the CodeCache
if (this->GetConfiguration().hasProperty(Platform::ARG_CLEAN))
m_CodeCache->Clear();
try
{
// assemble a list of base plugin-directories (which contain
// the real plugins as directories)
std::vector<std::string> pluginBaseDirs;
Poco::StringTokenizer tokenizer(this->GetConfiguration().getString(Platform::ARG_PLUGIN_DIRS, ""), ";",
Poco::StringTokenizer::TOK_IGNORE_EMPTY | Poco::StringTokenizer::TOK_TRIM);
for (Poco::StringTokenizer::Iterator token = tokenizer.begin();
token != tokenizer.end(); ++token)
{
pluginBaseDirs.push_back(*token);
}
std::vector<Poco::Path> pluginPaths;
for (std::vector<std::string>::iterator pluginBaseDir = pluginBaseDirs.begin();
pluginBaseDir != pluginBaseDirs.end(); ++pluginBaseDir)
{
BERRY_INFO(m_ConsoleLog) << "Plugin base directory: " << *pluginBaseDir;
Poco::File pluginDir(*pluginBaseDir);
if (!pluginDir.exists() || !pluginDir.isDirectory())
{
BERRY_WARN(m_ConsoleLog) << *pluginBaseDir << " is not a direcotry or does not exist. SKIPPED.\n";
continue;
}
std::vector<std::string> pluginList;
pluginDir.list(pluginList);
std::vector<std::string>::iterator iter;
for (iter = pluginList.begin(); iter != pluginList.end(); iter++)
{
Poco::Path pluginPath = Poco::Path::forDirectory(*pluginBaseDir);
pluginPath.pushDirectory(*iter);
Poco::File file(pluginPath);
if (file.exists() && file.isDirectory())
{
pluginPaths.push_back(pluginPath);
}
}
}
std::vector<Poco::Path>::iterator pathIter;
for (pathIter = pluginPaths.begin(); pathIter != pluginPaths.end(); pathIter++)
{
try
{
Bundle::Pointer bundle = m_BundleLoader->LoadBundle(*pathIter);
if (bundle)
{
BERRY_INFO(m_ConsoleLog) << "Bundle state (" << pathIter->toString() << "): " << bundle->GetStateString() << std::endl;
}
}
catch (const BundleStateException& exc)
{
BERRY_WARN << exc.displayText() << std::endl;
}
}
// resolve plugins
m_BundleLoader->ResolveAllBundles();
}
catch (Poco::Exception& exc)
{
this->logger().log(exc);
}
#ifdef BLUEBERRY_DEBUG_SMARTPOINTER
DebugUtil::RestoreState();
#endif
}
+void InternalPlatform::uninstallPugin(const QUrl& pluginUrl, ctkPluginContext* pfwContext)
+{
+ QFileInfo libInfo(pluginUrl.toLocalFile());
+ QString libName = libInfo.baseName();
+ if (libName.startsWith("lib"))
+ {
+ libName = libName.mid(3);
+ }
+ QString symbolicName = libName.replace('_', '.');
+
+ foreach(QSharedPointer<ctkPlugin> plugin, pfwContext->getPlugins())
+ {
+ if (plugin->getSymbolicName() == symbolicName &&
+ plugin->getLocation() != pluginUrl.toString())
+ {
+ BERRY_WARN << "A plug-in with the symbolic name " << symbolicName.toStdString() <<
+ " but different location is already installed. Trying to uninstall " << plugin->getLocation().toStdString();
+ plugin->uninstall();
+ return;
+ }
+ }
+}
+
void InternalPlatform::Launch()
{
AssertInitialized();
if (m_Running) return;
m_Running = true;
this->run();
}
void InternalPlatform::Shutdown()
{
Poco::Mutex::ScopedLock lock(m_Mutex);
AssertInitialized();
DebugUtil::SaveState();
m_Initialized = false;
this->uninitialize();
delete m_ServiceRegistry;
delete m_BundleLoader;
delete m_CodeCache;
}
void InternalPlatform::AssertInitialized()
{
if (!m_Initialized)
throw Poco::SystemException("The Platform has not been initialized yet!");
}
IExtensionPointService::Pointer InternalPlatform::GetExtensionPointService()
{
Poco::Mutex::ScopedLock lock(m_Mutex);
this->AssertInitialized();
return m_ServiceRegistry->GetServiceById<IExtensionPointService>(IExtensionPointService::SERVICE_ID);
}
const Poco::Path& InternalPlatform::GetConfigurationPath()
{
return m_ConfigPath;
}
const Poco::Path& InternalPlatform::GetInstallPath()
{
return m_InstallPath;
}
const Poco::Path& InternalPlatform::GetInstancePath()
{
return m_InstancePath;
}
bool InternalPlatform::GetStatePath(Poco::Path& statePath, IBundle::Pointer bundle, bool create)
{
statePath = m_BaseStatePath;
statePath.pushDirectory(bundle->GetSymbolicName());
try
{
Poco::File stateFile(statePath);
if (!stateFile.exists() && create)
stateFile.createDirectories();
}
catch (Poco::FileException&)
{
return false;
}
return true;
}
PlatformEvents& InternalPlatform::GetEvents()
{
return m_Events;
}
const Poco::Path& InternalPlatform::GetUserPath()
{
return m_UserPath;
}
bool InternalPlatform::IsRunning() const
{
Poco::Mutex::ScopedLock lock(m_Mutex);
return (m_Initialized && m_Running);
}
IBundle::Pointer InternalPlatform::GetBundle(const std::string& id)
{
Poco::Mutex::ScopedLock lock(m_Mutex);
AssertInitialized();
return m_BundleLoader->FindBundle(id);
}
std::vector<IBundle::Pointer> InternalPlatform::GetBundles() const
{
return m_BundleLoader->GetBundles();
}
Poco::Logger* InternalPlatform::GetLogger()
{
return m_PlatformLogger;
}
Poco::Util::LayeredConfiguration& InternalPlatform::GetConfiguration() const
{
return this->config();
}
std::vector<std::string> InternalPlatform::GetApplicationArgs() const
{
return m_FilteredArgs;
}
int& InternalPlatform::GetRawApplicationArgs(char**& argv)
{
argv = m_Argv;
return *m_Argc;
}
void InternalPlatform::defineOptions(Poco::Util::OptionSet& options)
{
Poco::Util::Option helpOption("help", "h", "print this help text");
helpOption.callback(Poco::Util::OptionCallback<InternalPlatform>(this, &InternalPlatform::PrintHelp));
options.addOption(helpOption);
Poco::Util::Option cleanOption(Platform::ARG_CLEAN, "", "cleans the plugin cache");
cleanOption.binding(Platform::ARG_CLEAN);
options.addOption(cleanOption);
Poco::Util::Option appOption(Platform::ARG_APPLICATION, "", "the id of the application extension to be executed");
appOption.argument("<id>").binding(Platform::ARG_APPLICATION);
options.addOption(appOption);
+ Poco::Util::Option storageDirOption(Platform::ARG_STORAGE_DIR, "", "the location for storing persistent application data");
+ storageDirOption.argument("<dir>").binding(Platform::ARG_STORAGE_DIR);
+ options.addOption(storageDirOption);
+
Poco::Util::Option consoleLogOption(Platform::ARG_CONSOLELOG, "", "log messages to the console");
consoleLogOption.binding(Platform::ARG_CONSOLELOG);
options.addOption(consoleLogOption);
+ Poco::Util::Option forcePluginOption(Platform::ARG_FORCE_PLUGIN_INSTALL, "", "force installing plug-ins with same symbolic name");
+ forcePluginOption.binding(Platform::ARG_FORCE_PLUGIN_INSTALL);
+ options.addOption(forcePluginOption);
+
Poco::Util::Option testPluginOption(Platform::ARG_TESTPLUGIN, "", "the plug-in to be tested");
testPluginOption.argument("<id>").binding(Platform::ARG_TESTPLUGIN);
options.addOption(testPluginOption);
Poco::Util::Option testAppOption(Platform::ARG_TESTAPPLICATION, "", "the application to be tested");
testAppOption.argument("<id>").binding(Platform::ARG_TESTAPPLICATION);
options.addOption(testAppOption);
Poco::Util::Application::defineOptions(options);
}
int InternalPlatform::main(const std::vector<std::string>& args)
{
m_FilteredArgs = args;
m_FilteredArgs.insert(m_FilteredArgs.begin(), this->config().getString("application.argv[0]"));
ctkPluginContext* context = GetCTKPluginFrameworkContext();
QFileInfo storageDir = context->getDataFile("");
BundleDirectory::Pointer bundleStorage(new BundleDirectory(Poco::Path(storageDir.absolutePath().toStdString())));
SystemBundle::Pointer systemBundle(new SystemBundle(*m_BundleLoader, bundleStorage));
if (systemBundle == 0)
throw PlatformException("Could not find the system bundle");
m_BundleLoader->m_SystemBundle = systemBundle;
m_BundleLoader->LoadBundle(systemBundle);
m_ctkPluginFrameworkFactory->getFramework()->start();
foreach(long pluginId, m_CTKPluginsToStart)
{
// do not change the autostart setting of this plugin
context->getPlugin(pluginId)->start(ctkPlugin::START_TRANSIENT | ctkPlugin::START_ACTIVATION_POLICY);
}
m_BundleLoader->StartSystemBundle(systemBundle);
systemBundle->Resume();
return EXIT_OK;
}
void InternalPlatform::PrintHelp(const std::string&, const std::string&)
{
Poco::Util::HelpFormatter help(this->options());
help.setAutoIndent();
help.setCommand(this->commandName());
help.format(std::cout);
exit(EXIT_OK);
}
}
diff --git a/BlueBerry/Bundles/org.blueberry.osgi/src/internal/berryInternalPlatform.h b/BlueBerry/Bundles/org.blueberry.osgi/src/internal/berryInternalPlatform.h
index 12094e9814..e60e10c756 100644
--- a/BlueBerry/Bundles/org.blueberry.osgi/src/internal/berryInternalPlatform.h
+++ b/BlueBerry/Bundles/org.blueberry.osgi/src/internal/berryInternalPlatform.h
@@ -1,146 +1,148 @@
/*=========================================================================
Program: BlueBerry Platform
Language: C++
Date: $Date$
Version: $Revision$
Copyright (c) German Cancer Research Center, Division of Medical and
Biological Informatics. All rights reserved.
See MITKCopyright.txt or http://www.mitk.org/copyright.html for details.
This software is distributed WITHOUT ANY WARRANTY; without even
the implied warranty of MERCHANTABILITY or FITNESS FOR A PARTICULAR
PURPOSE. See the above copyright notices for more information.
=========================================================================*/
#ifndef BERRYINTERNALPLATFORM_H_
#define BERRYINTERNALPLATFORM_H_
#include <Poco/Path.h>
#include <Poco/Mutex.h>
#include <Poco/AutoPtr.h>
#include <Poco/Logger.h>
#include <Poco/Util/Application.h>
#include "../event/berryPlatformEvents.h"
#include "../service/berryServiceRegistry.h"
#include "berryExtensionPointService.h"
#include <map>
class ctkPluginFrameworkFactory;
class ctkPluginContext;
namespace berry {
struct IBundle;
class CodeCache;
class BundleLoader;
class PlatformLogChannel;
class SystemBundle;
class BERRY_OSGI InternalPlatform : private Poco::Util::Application
{
private:
static Poco::Mutex m_Mutex;
bool m_Initialized;
bool m_Running;
bool m_ConsoleLog;
ServiceRegistry* m_ServiceRegistry;
Poco::Path m_BaseStatePath;
Poco::Path m_InstallPath;
Poco::Path m_InstancePath;
Poco::Path m_UserPath;
Poco::Path m_ConfigPath;
std::vector<std::string> m_FilteredArgs;
CodeCache* m_CodeCache;
BundleLoader* m_BundleLoader;
SystemBundle* m_SystemBundle;
Poco::AutoPtr<PlatformLogChannel> m_PlatformLogChannel;
Poco::Logger* m_PlatformLogger;
ctkPluginFrameworkFactory* m_ctkPluginFrameworkFactory;
QList<long> m_CTKPluginsToStart;
PlatformEvents m_Events;
PlatformEvent m_EventStarted;
int* m_Argc;
char** m_Argv;
//std::map<std::string, std::string> m_ArgMap;
InternalPlatform();
//InternalPlatform(const InternalPlatform&) : m_EventStarted(PlatformEvent::EV_PLATFORM_STARTED) {};
void AssertInitialized();
// Poco::Application method overrides
void defineOptions(Poco::Util::OptionSet& options);
int main(const std::vector<std::string>& args);
+ void uninstallPugin(const QUrl& pluginUrl, ctkPluginContext* pfwContext);
+
public:
virtual ~InternalPlatform();
void PrintHelp(const std::string& name, const std::string& value);
static InternalPlatform* GetInstance();
void Initialize(int& argc, char** argv, Poco::Util::AbstractConfiguration* config = 0);
void Launch();
void Shutdown();
ctkPluginContext* GetCTKPluginFrameworkContext() const;
/// Returns a ServiceRegistry object for registering
/// and accessing services from different plugins
ServiceRegistry& GetServiceRegistry();
/// Convenience method to quickly get the extension
/// point service, which is automatically started
/// by the platform
IExtensionPointService::Pointer GetExtensionPointService();
bool ConsoleLog() const;
const Poco::Path& GetConfigurationPath();
const Poco::Path& GetInstallPath();
const Poco::Path& GetInstancePath();
bool GetStatePath(Poco::Path& statePath, SmartPointer<IBundle> bundle, bool create = true);
const Poco::Path& GetUserPath();
PlatformEvents& GetEvents();
bool IsRunning() const;
Poco::Util::LayeredConfiguration& GetConfiguration() const;
std::vector<std::string> GetApplicationArgs() const;
int& GetRawApplicationArgs(char**& argv);
IBundle::Pointer GetBundle(const std::string& id);
std::vector<IBundle::Pointer> GetBundles() const;
Poco::Logger* GetLogger();
};
} // namespace berry
#endif /*BERRYINTERNALPLATFORM_H_*/
diff --git a/BlueBerry/Bundles/org.blueberry.ui.qt/plugin.xml b/BlueBerry/Bundles/org.blueberry.ui.qt/plugin.xml
index 2dedb50602..f6516dcc1d 100644
--- a/BlueBerry/Bundles/org.blueberry.ui.qt/plugin.xml
+++ b/BlueBerry/Bundles/org.blueberry.ui.qt/plugin.xml
@@ -1,68 +1,68 @@
<?xml version="1.0" encoding="UTF-8"?>
<?BlueBerry version="0.1"?>
<plugin>
<extension point="org.blueberry.ui.tweaklets">
<tweaklet
id="org.blueberry.ui.qt.tweaklets.WorkbenchTweaklet"
name="Qt Workbench Tweaklet"
description="Qt specific Workbench tweaks"
- definition="berryWorkbenchTweaklet"
+ definition="org.blueberry.WorkbenchTweaklet"
implementation="berry::QtWorkbenchTweaklet" />
<tweaklet
id="org.blueberry.ui.qt.tweaklets.WorkbenchPageTweaklet"
name="Qt WorkbenchPage Tweaklet"
description="Qt specific WorkbenchPage tweaks"
- definition="berryWorkbenchPageTweaklet"
+ definition="org.blueberry.WorkbenchPageTweaklet"
implementation="berry::QtWorkbenchPageTweaklet" />
<tweaklet
id="org.blueberry.ui.qt.tweaklets.GuiWidgetsTweaklet"
name="Qt Widgets Tweaklet"
description="Qt specific widget tweaks"
- definition="berryGuiWidgetsTweaklet"
+ definition="org.blueberry.GuiWidgetsTweaklet"
implementation="berry::QtWidgetsTweaklet" />
<tweaklet
id="org.blueberry.ui.qt.tweaklets.DnDTweaklet"
name="Qt DnD Tweaklet"
description="Qt specific DnD tweaks"
- definition="berryDnDTweaklet"
+ definition="org.blueberry.DnDTweaklet"
implementation="berry::QtDnDTweaklet" />
<tweaklet
id="org.blueberry.ui.qt.tweaklets.ImageTweaklet"
name="Qt Image Tweaklet"
description="Qt specific image tweaks"
- definition="berryImageTweaklet"
+ definition="org.blueberry.ImageTweaklet"
implementation="berry::QtImageTweaklet" />
<tweaklet
id="org.blueberry.ui.qt.tweaklets.MessageDialogTweaklet"
name="Qt Message Dialog Tweaklet"
description="Qt specific message dialogs"
- definition="berryMessageDialogTweaklet"
+ definition="org.blueberry.MessageDialogTweaklet"
implementation="berry::QtMessageDialogTweaklet" />
</extension>
<extension
point="org.blueberry.ui.presentationFactories">
<factory
name="Default"
class="berry::QtWorkbenchPresentationFactory"
id="org.blueberry.ui.presentations.default">
</factory>
</extension>
<extension point="org.blueberry.ui.preferencePages">
<page id="org.blueberry.ui.qt.stylepreferencepage" name="Themes" class="berry::QtStylePreferencePage">
<keywordreference id="org.blueberry.ui.qt.styleprefpagekeywords"/>
</page>
</extension>
<extension point="org.blueberry.ui.keywords">
<keyword id="org.blueberry.ui.qt.styleprefpagekeywords" label="theme skin style"></keyword>
</extension>
-</plugin>
\ No newline at end of file
+</plugin>
diff --git a/BlueBerry/Bundles/org.blueberry.ui.qt/src/internal/berryQtShell.cpp b/BlueBerry/Bundles/org.blueberry.ui.qt/src/internal/berryQtShell.cpp
index 23121d0711..8e65e622d3 100755
--- a/BlueBerry/Bundles/org.blueberry.ui.qt/src/internal/berryQtShell.cpp
+++ b/BlueBerry/Bundles/org.blueberry.ui.qt/src/internal/berryQtShell.cpp
@@ -1,224 +1,224 @@
/*=========================================================================
Program: BlueBerry Platform
Language: C++
Date: $Date$
Version: $Revision$
Copyright (c) German Cancer Research Center, Division of Medical and
Biological Informatics. All rights reserved.
See MITKCopyright.txt or http://www.mitk.org/copyright.html for details.
This software is distributed WITHOUT ANY WARRANTY { } without even
the implied warranty of MERCHANTABILITY or FITNESS FOR A PARTICULAR
PURPOSE. See the above copyright notices for more information.
=========================================================================*/
#include "berryQtShell.h"
#include "berryQtWidgetsTweakletImpl.h"
#include "berryQtMainWindowControl.h"
#include "berryQtControlWidget.h"
#include <berryConstants.h>
#include <internal/berryTweaklets.h>
#include <tweaklets/berryGuiWidgetsTweaklet.h>
#include <QApplication>
#include <QVariant>
namespace berry
{
QtShell::QtShell(QWidget* parent, Qt::WindowFlags flags)
: updatesDisabled(false)
{
if (parent == 0 || flags.testFlag(Qt::Window))
{
widget = new QtMainWindowControl(this, parent, flags);
widget->setUpdatesEnabled(false);
updatesDisabled = true;
widget->setAttribute(Qt::WA_DeleteOnClose);
}
else
{
widget = new QtControlWidget(parent, this, flags | Qt::Dialog);
widget->setObjectName("shell widget");
}
}
QtShell::~QtShell()
{
widget->deleteLater();
}
void QtShell::SetBounds(const Rectangle& bounds)
{
widget->move(bounds.x, bounds.y);
widget->resize(bounds.width, bounds.height);
}
Rectangle QtShell::GetBounds() const
{
const QRect& qRect = widget->frameGeometry();
const QSize& size = widget->size();
Rectangle rect(qRect.x(), qRect.y(), size.width(), size.height());
return rect;
}
void QtShell::SetLocation(int x, int y)
{
widget->move(x, y);
}
Point QtShell::ComputeSize(int /*wHint*/, int /*hHint*/, bool changed)
{
if (changed) widget->updateGeometry();
QSize size(widget->size());
Point point(size.width(), size.height());
return point;
}
std::string QtShell::GetText() const
{
return widget->windowTitle().toStdString();
}
void QtShell::SetText(const std::string& text)
{
QString title(QString::fromStdString(text));
widget->setWindowTitle(title);
widget->setObjectName(title);
}
bool QtShell::IsVisible()
{
return widget->isVisible();
}
void QtShell::SetVisible(bool visible)
{
widget->setVisible(visible);
}
void QtShell::SetActive()
{
widget->activateWindow();
widget->raise();
}
void* QtShell::GetControl()
{
return widget;
}
void QtShell::SetImages(const std::vector<void*>& /*images*/)
{
}
bool QtShell::GetMaximized()
{
return widget->isMaximized();
}
bool QtShell::GetMinimized()
{
return widget->isMinimized();
}
void QtShell::SetMaximized(bool maximized)
{
maximized ? widget->showMaximized() : widget->showNormal();
}
void QtShell::SetMinimized(bool minimized)
{
minimized ? widget->showMinimized() : widget->showNormal();
}
void QtShell::AddShellListener(IShellListener::Pointer listener)
{
QVariant variant = widget->property(QtWidgetController::PROPERTY_ID);
poco_assert(variant.isValid());
QtWidgetController::Pointer controller = variant.value<QtWidgetController::Pointer>();
poco_assert(controller != 0);
controller->AddShellListener(listener);
}
void QtShell::RemoveShellListener(IShellListener::Pointer listener)
{
QVariant variant = widget->property(QtWidgetController::PROPERTY_ID);
if (variant.isValid())
{
QtWidgetController::Pointer controller = variant.value<QtWidgetController::Pointer>();
if (controller != 0)
controller->RemoveShellListener(listener);
}
}
void QtShell::Open(bool block)
{
if (updatesDisabled)
{
widget->setUpdatesEnabled(true);
updatesDisabled = false;
}
widget->setWindowModality(block ? Qt::WindowModal : Qt::NonModal);
widget->show();
}
void QtShell::Close()
{
widget->close();
}
std::vector<Shell::Pointer> QtShell::GetShells()
{
- GuiWidgetsTweaklet::Pointer widgetTweaklet = Tweaklets::Get(GuiWidgetsTweaklet::KEY);
+ GuiWidgetsTweaklet* widgetTweaklet = Tweaklets::Get(GuiWidgetsTweaklet::KEY);
std::vector<Shell::Pointer> allShells(widgetTweaklet->GetShells());
std::vector<Shell::Pointer> descendants;
for (std::size_t i = 0; i < allShells.size(); ++i)
{
Shell::Pointer shell = allShells[i];
if (widgetTweaklet->GetShell(shell->GetControl()) == this)
{
descendants.push_back(shell);
}
}
return descendants;
}
int QtShell::GetStyle()
{
Qt::WindowFlags qtFlags = widget->windowFlags();
int berryFlags = 0;
if (!(qtFlags & Qt::FramelessWindowHint))
berryFlags |= Constants::BORDER;
if (qtFlags & Qt::WindowTitleHint)
berryFlags |= Constants::TITLE;
if (qtFlags & Qt::WindowSystemMenuHint)
berryFlags |= Constants::CLOSE;
if (qtFlags & Qt::WindowMinimizeButtonHint)
berryFlags |= Constants::MIN;
if (qtFlags & Qt::WindowMaximizeButtonHint)
berryFlags |= Constants::MAX;
if (widget->windowModality() == Qt::WindowModal)
berryFlags |= Constants::PRIMARY_MODAL;
else if(widget->windowModality() == Qt::ApplicationModal)
berryFlags |= Constants::APPLICATION_MODAL;
return berryFlags;
}
QWidget* QtShell::GetWidget()
{
return widget;
}
}
diff --git a/BlueBerry/Bundles/org.blueberry.ui/files.cmake b/BlueBerry/Bundles/org.blueberry.ui/files.cmake
index 8c39202fa1..e11cedbf06 100644
--- a/BlueBerry/Bundles/org.blueberry.ui/files.cmake
+++ b/BlueBerry/Bundles/org.blueberry.ui/files.cmake
@@ -1,229 +1,231 @@
SET(MOC_H_FILES
src/internal/berryWorkbenchPlugin.h
src/internal/intro/berryEditorIntroAdapterPart.h
src/berryWorkbenchPart.h
src/berryEditorPart.h
src/berryViewPart.h
+ src/intro/berryIntroPart.h
)
SET(CACHED_RESOURCE_FILES
plugin.xml
)
SET(SRC_CPP_FILES
berryAbstractSourceProvider.cpp
berryAbstractUIPlugin.cpp
berryAbstractUICTKPlugin.cpp
berryConstants.cpp
berryDisplay.cpp
berryEditorPart.cpp
berryFileEditorInput.cpp
berryGeometry.cpp
berryIEditorRegistry.cpp
berryImageDescriptor.cpp
berryIMemento.cpp
berryIPageLayout.cpp
berryIPartListener.cpp
berryIPerspectiveListener.cpp
berryIPropertyChangeListener.cpp
berryISaveablePart.cpp
berryISaveablesLifecycleListener.cpp
berryISelectionChangedListener.cpp
berryISelectionListener.cpp
berryIShellListener.cpp
berryISizeProvider.cpp
berryISourceProviderListener.cpp
berryISources.cpp
+ berryIStructuredSelection.cpp
berryIWindowListener.cpp
berryIWorkbenchListener.cpp
berryIWorkbenchPage.cpp
berryIWorkbenchPartConstants.cpp
berryPlatformUI.cpp
berryPoint.cpp
berryPropertyChangeEvent.cpp
berryRectangle.cpp
berrySameShellProvider.cpp
berrySaveable.cpp
berrySaveablesLifecycleEvent.cpp
berrySelectionChangedEvent.cpp
berryShell.cpp
berryShellEvent.cpp
berryUIException.cpp
berryViewPart.cpp
berryWindow.cpp
berryWorkbenchPart.cpp
berryWorkbenchPreferenceConstants.cpp
berryXMLMemento.cpp
#application
application/berryActionBarAdvisor.cpp
application/berryWorkbenchAdvisor.cpp
application/berryWorkbenchWindowAdvisor.cpp
#commands
#commands/berryAbstractContributionFactory.cpp
#commands/berryCommandContributionItem.cpp
#commands/berryCommandContributionItemParameter.cpp
#commands/berryContributionItem.cpp
#commands/berryContributionManager.cpp
#commands/berryICommandImageService.cpp
#commands/berryICommandService.cpp
#commands/berryIContributionManagerOverrides.cpp
#commands/berryIMenuItem.cpp
#commands/berryIMenuItemListener.cpp
#commands/berryIMenuListener.cpp
#commands/berryIToolItemListener.cpp
#commands/berryIUIElementListener.cpp
#commands/berryMenuManager.cpp
#commands/berrySubContributionItem.cpp
#commands/berryUIElement.cpp
#dialogs
dialogs/berryIDialog.cpp
dialogs/berryMessageDialog.cpp
#guitk
guitk/berryGuiTkControlEvent.cpp
guitk/berryGuiTkEvent.cpp
guitk/berryGuiTkIControlListener.cpp
guitk/berryGuiTkIMenuListener.cpp
guitk/berryGuiTkISelectionListener.cpp
guitk/berryGuiTkSelectionEvent.cpp
#handlers
handlers/berryHandlerUtil.cpp
handlers/berryIHandlerActivation.cpp
handlers/berryShowViewHandler.cpp
#src
intro/berryIntroPart.cpp
#tweaklets
tweaklets/berryDnDTweaklet.cpp
tweaklets/berryGuiWidgetsTweaklet.cpp
tweaklets/berryImageTweaklet.cpp
tweaklets/berryMessageDialogTweaklet.cpp
tweaklets/berryWorkbenchPageTweaklet.cpp
tweaklets/berryWorkbenchTweaklet.cpp
#presentations
presentations/berryIPresentablePart.cpp
presentations/berryIPresentationFactory.cpp
presentations/berryIStackPresentationSite.cpp
presentations/berryStackDropResult.cpp
presentations/berryStackPresentation.cpp
#testing
testing/berryTestableObject.cpp
#util
util/berrySafeRunnable.cpp
)
SET(INTERNAL_CPP_FILES
#intro
intro/berryEditorIntroAdapterPart.cpp
intro/berryIntroConstants.cpp
intro/berryIntroDescriptor.cpp
intro/berryIntroPartAdapterSite.cpp
intro/berryIntroRegistry.cpp
intro/berryViewIntroAdapterPart.cpp
intro/berryWorkbenchIntroManager.cpp
berryAbstractPartSelectionTracker.cpp
berryAbstractSelectionService.cpp
berryBundleUtility.cpp
berryContainerPlaceholder.cpp
berryDetachedPlaceHolder.cpp
berryDefaultSaveable.cpp
berryDefaultStackPresentationSite.cpp
berryDetachedWindow.cpp
berryDragUtil.cpp
berryEditorAreaHelper.cpp
berryEditorDescriptor.cpp
berryEditorManager.cpp
berryEditorReference.cpp
berryEditorRegistry.cpp
berryEditorRegistryReader.cpp
berryEditorSashContainer.cpp
berryEditorSite.cpp
berryErrorViewPart.cpp
berryFileEditorMapping.cpp
berryFolderLayout.cpp
berryIDragOverListener.cpp
berryLayoutHelper.cpp
berryLayoutPart.cpp
berryLayoutPartSash.cpp
berryLayoutTree.cpp
berryLayoutTreeNode.cpp
berryNullEditorInput.cpp
berryPageLayout.cpp
berryPagePartSelectionTracker.cpp
berryPageSelectionService.cpp
berryPartList.cpp
berryPartPane.cpp
berryPartPlaceholder.cpp
berryPartSashContainer.cpp
berryPartService.cpp
berryPartSite.cpp
berryPartStack.cpp
berryPartTester.cpp
berryPerspective.cpp
berryPerspectiveDescriptor.cpp
berryPerspectiveExtensionReader.cpp
berryPerspectiveHelper.cpp
berryPerspectiveRegistry.cpp
berryPerspectiveRegistryReader.cpp
berryPlaceholderFolderLayout.cpp
berryPreferenceConstants.cpp
berryPresentablePart.cpp
berryPresentationFactoryUtil.cpp
berryPresentationSerializer.cpp
berryRegistryReader.cpp
berrySaveablesList.cpp
berryServiceLocator.cpp
berryServiceLocatorCreator.cpp
berryShellPool.cpp
berrySourcePriorityNameMapping.cpp
berryStackablePart.cpp
berryStickyViewDescriptor.cpp
berryStickyViewManager.cpp
berryTweaklets.cpp
berryViewDescriptor.cpp
berryViewFactory.cpp
berryViewLayout.cpp
berryViewReference.cpp
berryViewRegistry.cpp
berryViewRegistryReader.cpp
berryViewSashContainer.cpp
berryViewSite.cpp
berryWorkbenchPage.cpp
berryWindowManager.cpp
berryWindowPartSelectionTracker.cpp
berryWindowSelectionService.cpp
berryWorkbench.cpp
berryWorkbenchConfigurer.cpp
berryWorkbenchConstants.cpp
berryWorkbenchPagePartList.cpp
berryWorkbenchPartReference.cpp
berryWorkbenchPlugin.cpp
berryWorkbenchRegistryConstants.cpp
berryWorkbenchServiceRegistry.cpp
berryWorkbenchTestable.cpp
berryWorkbenchWindow.cpp
berryWorkbenchWindowConfigurer.cpp
berryWWinPartService.cpp
)
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/BlueBerry/Bundles/org.blueberry.ui/src/berryGeometry.cpp b/BlueBerry/Bundles/org.blueberry.ui/src/berryGeometry.cpp
index 9cfa13404a..1b71a8a824 100755
--- a/BlueBerry/Bundles/org.blueberry.ui/src/berryGeometry.cpp
+++ b/BlueBerry/Bundles/org.blueberry.ui/src/berryGeometry.cpp
@@ -1,172 +1,172 @@
/*=========================================================================
Program: BlueBerry Platform
Language: C++
Date: $Date$
Version: $Revision$
Copyright (c) German Cancer Research Center, Division of Medical and
Biological Informatics. All rights reserved.
See MITKCopyright.txt or http://www.mitk.org/copyright.html for details.
This software is distributed WITHOUT ANY WARRANTY; without even
the implied warranty of MERCHANTABILITY or FITNESS FOR A PARTICULAR
PURPOSE. See the above copyright notices for more information.
=========================================================================*/
// needed under windows to suppress the definition of the
// min/max macros in windows.h, which would clash with
// std::numeric_limits<>::max()
#define NOMINMAX
+#include "tweaklets/berryGuiWidgetsTweaklet.h"
+
#include "berryGeometry.h"
#include "berryConstants.h"
-#include "tweaklets/berryGuiWidgetsTweaklet.h"
-
#include <limits>
namespace berry
{
int Geometry::GetDimension(const Rectangle& toMeasure, bool width)
{
if (width)
{
return toMeasure.width;
}
return toMeasure.height;
}
bool Geometry::IsHorizontal(int berrySideConstant)
{
return !(berrySideConstant == Constants::LEFT || berrySideConstant
== Constants::RIGHT);
}
Rectangle Geometry::GetExtrudedEdge(const Rectangle& toExtrude, int size,
int orientation)
{
Rectangle bounds(toExtrude);
if (!IsHorizontal(orientation))
{
bounds.width = size;
}
else
{
bounds.height = size;
}
if (orientation == Constants::RIGHT)
{
bounds.x = toExtrude.x + toExtrude.width - bounds.width;
}
else if (orientation == Constants::BOTTOM)
{
bounds.y = toExtrude.y + toExtrude.height - bounds.height;
}
Normalize(bounds);
return bounds;
}
void Geometry::Normalize(Rectangle& rect)
{
if (rect.width < 0)
{
rect.width = -rect.width;
rect.x -= rect.width;
}
if (rect.height < 0)
{
rect.height = -rect.height;
rect.y -= rect.height;
}
}
int Geometry::GetClosestSide(const Rectangle& boundary, const Point& toTest)
{
int sides[] =
{ Constants::LEFT, Constants::RIGHT, Constants::TOP, Constants::BOTTOM };
int closestSide = Constants::LEFT;
int closestDistance = std::numeric_limits<int>::max();
for (unsigned int idx = 0; idx < 4; idx++)
{
int side = sides[idx];
int distance = GetDistanceFromEdge(boundary, toTest, side);
if (distance < closestDistance)
{
closestDistance = distance;
closestSide = side;
}
}
return closestSide;
}
int Geometry::GetDistanceFromEdge(const Rectangle& rectangle,
const Point& testPoint, int edgeOfInterest)
{
if (edgeOfInterest == Constants::TOP)
return testPoint.y - rectangle.y;
else if (edgeOfInterest == Constants::BOTTOM)
return rectangle.y + rectangle.height - testPoint.y;
else if (edgeOfInterest == Constants::LEFT)
return testPoint.x - rectangle.x;
else if (edgeOfInterest == Constants::RIGHT)
return rectangle.x + rectangle.width - testPoint.x;
return 0;
}
int Geometry::GetOppositeSide(int directionConstant)
{
if (directionConstant == Constants::TOP)
return Constants::BOTTOM;
else if (directionConstant == Constants::BOTTOM)
return Constants::TOP;
else if (directionConstant == Constants::LEFT)
return Constants::RIGHT;
else if (directionConstant == Constants::RIGHT)
return Constants::LEFT;
return directionConstant;
}
Rectangle Geometry::ToControl(void* coordinateSystem,
const Rectangle& toConvert)
{
return Tweaklets::Get(GuiWidgetsTweaklet::KEY)->ToControl(coordinateSystem,
toConvert);
}
Point Geometry::ToControl(void* coordinateSystem, const Point& toConvert)
{
return Tweaklets::Get(GuiWidgetsTweaklet::KEY)->ToControl(coordinateSystem,
toConvert);
}
Rectangle Geometry::ToDisplay(void* coordinateSystem,
const Rectangle& toConvert)
{
return Tweaklets::Get(GuiWidgetsTweaklet::KEY)->ToDisplay(coordinateSystem,
toConvert);
}
Point Geometry::ToDisplay(void* coordinateSystem, const Point& toConvert)
{
return Tweaklets::Get(GuiWidgetsTweaklet::KEY)->ToDisplay(coordinateSystem,
toConvert);
}
}
diff --git a/BlueBerry/Bundles/org.blueberry.ui/src/internal/berryTweaklets.cpp b/BlueBerry/Bundles/org.blueberry.ui/src/berryIStructuredSelection.cpp
old mode 100755
new mode 100644
similarity index 77%
copy from BlueBerry/Bundles/org.blueberry.ui/src/internal/berryTweaklets.cpp
copy to BlueBerry/Bundles/org.blueberry.ui/src/berryIStructuredSelection.cpp
index 44b6d8851f..c6482a3c03
--- a/BlueBerry/Bundles/org.blueberry.ui/src/internal/berryTweaklets.cpp
+++ b/BlueBerry/Bundles/org.blueberry.ui/src/berryIStructuredSelection.cpp
@@ -1,26 +1,26 @@
/*=========================================================================
Program: BlueBerry Platform
Language: C++
Date: $Date$
Version: $Revision$
Copyright (c) German Cancer Research Center, Division of Medical and
Biological Informatics. All rights reserved.
See MITKCopyright.txt or http://www.mitk.org/copyright.html for details.
This software is distributed WITHOUT ANY WARRANTY; without even
the implied warranty of MERCHANTABILITY or FITNESS FOR A PARTICULAR
PURPOSE. See the above copyright notices for more information.
=========================================================================*/
-#include "berryTweaklets.h"
+#include "berryIStructuredSelection.h"
-namespace berry
-{
+namespace berry {
-std::map<Tweaklets::TweakKey_base, Object::Pointer> Tweaklets::defaults;
-std::map<Tweaklets::TweakKey_base, Object::Pointer> Tweaklets::tweaklets;
+IStructuredSelection::~IStructuredSelection()
+{
+}
}
diff --git a/BlueBerry/Bundles/org.blueberry.ui/src/berryIStructuredSelection.h b/BlueBerry/Bundles/org.blueberry.ui/src/berryIStructuredSelection.h
index 9d32c4cceb..7dfa3feb54 100755
--- a/BlueBerry/Bundles/org.blueberry.ui/src/berryIStructuredSelection.h
+++ b/BlueBerry/Bundles/org.blueberry.ui/src/berryIStructuredSelection.h
@@ -1,79 +1,88 @@
/*=========================================================================
Program: BlueBerry Platform
Language: C++
Date: $Date$
Version: $Revision$
Copyright (c) German Cancer Research Center, Division of Medical and
Biological Informatics. All rights reserved.
See MITKCopyright.txt or http://www.mitk.org/copyright.html for details.
This software is distributed WITHOUT ANY WARRANTY; without even
the implied warranty of MERCHANTABILITY or FITNESS FOR A PARTICULAR
PURPOSE. See the above copyright notices for more information.
=========================================================================*/
#ifndef BERRYISTRUCTUREDSELECTION_H_
#define BERRYISTRUCTUREDSELECTION_H_
#include "berryISelection.h"
#include <berryObjectVector.h>
-
+#include <org_blueberry_ui_Export.h>
namespace berry
{
/**
* A selection containing elements.
*/
-struct IStructuredSelection : public ISelection {
+struct BERRY_UI IStructuredSelection : public ISelection {
typedef ObjectVector<Object::Pointer> ContainerType;
typedef ContainerType::const_iterator iterator;
berryInterfaceMacro(IStructuredSelection, berry);
/**
* Returns the first element in this selection, or <code>null</code>
* if the selection is empty.
*
* @return an element, or <code>null</code> if none
*/
virtual Object::Pointer GetFirstElement() const = 0;
/**
* Returns an iterator to the beginning of the elements of this selection.
*
* @return an iterator over the selected elements
*/
virtual iterator Begin() const = 0;
/**
* Returns an iterator to the end of the elements of this selection.
*
* @return an iterator over the selected elements
*/
virtual iterator End() const = 0;
/**
* Returns the number of elements selected in this selection.
*
* @return the number of elements selected
*/
virtual int Size() const = 0;
/**
* Returns the elements in this selection as a vector.
*
* @return the selected elements as a vector
*/
virtual ContainerType::Pointer ToVector() const = 0;
+ /*
+ * We need to define at least the destructor in this compilation unit
+ * because of the export macro above. Otherwise Windows throws
+ * a linker error in dependent librraies. The export macro is needed
+ * for gcc < 4.5 to correctly mark the type_info object of this class
+ * as visible (we have default visibility 'hidden') so that dynamic_cast calls work.
+ */
+ virtual ~IStructuredSelection();
+
};
}
#endif /* BERRYISTRUCTUREDSELECTION_H_ */
diff --git a/BlueBerry/Bundles/org.blueberry.ui/src/berryImageDescriptor.cpp b/BlueBerry/Bundles/org.blueberry.ui/src/berryImageDescriptor.cpp
index 2b9b0caeac..66a27f70c1 100755
--- a/BlueBerry/Bundles/org.blueberry.ui/src/berryImageDescriptor.cpp
+++ b/BlueBerry/Bundles/org.blueberry.ui/src/berryImageDescriptor.cpp
@@ -1,44 +1,44 @@
/*=========================================================================
Program: BlueBerry Platform
Language: C++
Date: $Date$
Version: $Revision$
Copyright (c) German Cancer Research Center, Division of Medical and
Biological Informatics. All rights reserved.
See MITKCopyright.txt or http://www.mitk.org/copyright.html for details.
This software is distributed WITHOUT ANY WARRANTY; without even
the implied warranty of MERCHANTABILITY or FITNESS FOR A PARTICULAR
PURPOSE. See the above copyright notices for more information.
=========================================================================*/
-#include "berryImageDescriptor.h"
-
#include "tweaklets/berryImageTweaklet.h"
+#include "berryImageDescriptor.h"
+
namespace berry {
ImageDescriptor::Pointer ImageDescriptor::CreateFromFile(const std::string& filename, const std::string& pluginid)
{
return Tweaklets::Get(ImageTweaklet::KEY)->CreateFromFile(filename, pluginid);
}
ImageDescriptor::Pointer ImageDescriptor::CreateFromImage(void* img)
{
return Tweaklets::Get(ImageTweaklet::KEY)->CreateFromImage(img);
}
ImageDescriptor::Pointer ImageDescriptor::GetMissingImageDescriptor()
{
return Tweaklets::Get(ImageTweaklet::KEY)->GetMissingImageDescriptor();
}
ImageDescriptor::ImageDescriptor()
{
}
}
diff --git a/BlueBerry/Bundles/org.blueberry.ui/src/berryWindow.cpp b/BlueBerry/Bundles/org.blueberry.ui/src/berryWindow.cpp
index ea00ac2a22..8850ca72fb 100755
--- a/BlueBerry/Bundles/org.blueberry.ui/src/berryWindow.cpp
+++ b/BlueBerry/Bundles/org.blueberry.ui/src/berryWindow.cpp
@@ -1,531 +1,531 @@
/*=========================================================================
Program: BlueBerry Platform
Language: C++
Date: $Date$
Version: $Revision$
Copyright (c) German Cancer Research Center, Division of Medical and
Biological Informatics. All rights reserved.
See MITKCopyright.txt or http://www.mitk.org/copyright.html for details.
This software is distributed WITHOUT ANY WARRANTY; without even
the implied warranty of MERCHANTABILITY or FITNESS FOR A PARTICULAR
PURPOSE. See the above copyright notices for more information.
=========================================================================*/
#include "berryWindow.h"
#include "berryConstants.h"
#include "berrySameShellProvider.h"
#include "tweaklets/berryGuiWidgetsTweaklet.h"
namespace berry
{
const int Window::OK = 0;
const int Window::CANCEL = 1;
std::vector<void*> Window::defaultImages = std::vector<void*>();
Window::IExceptionHandler::Pointer Window::exceptionHandler(new DefaultExceptionHandler());
IShellProvider::Pointer Window::defaultModalParent(new DefaultModalParent());
Window::WindowShellListener::WindowShellListener(Window* wnd)
: window(wnd)
{
}
void Window::WindowShellListener::ShellClosed(ShellEvent::Pointer event)
{
event->doit = false; // don't close now
if (window->CanHandleShellCloseEvent())
{
window->HandleShellCloseEvent();
}
}
void Window::DefaultExceptionHandler::HandleException(const std::exception& t)
{
// Try to keep running.
std::cerr << t.what();
}
Shell::Pointer Window::DefaultModalParent::GetShell()
{
Shell::Pointer parent = Tweaklets::Get(GuiWidgetsTweaklet::KEY)->GetActiveShell();
// Make sure we don't pick a parent that has a modal child (this can lock the app)
if (parent == 0)
{
// If this is a top-level window, then there must not be any open modal windows.
parent = Window::GetModalChild(Tweaklets::Get(GuiWidgetsTweaklet::KEY)->GetShells());
}
else
{
// If we picked a parent with a modal child, use the modal child instead
Shell::Pointer modalChild = Window::GetModalChild(parent->GetShells());
if (modalChild != 0)
{
parent = modalChild;
}
}
return parent;
}
Shell::Pointer Window::GetModalChild(const std::vector<Shell::Pointer>& toSearch)
{
int modal = Constants::APPLICATION_MODAL | Constants::SYSTEM_MODAL | Constants::PRIMARY_MODAL;
size_t size = toSearch.size();
for (size_t i = size - 1; i < size; i--)
{
Shell::Pointer shell = toSearch[i];
// Check if this shell has a modal child
std::vector<Shell::Pointer> children = shell->GetShells();
Shell::Pointer modalChild = GetModalChild(children);
if (modalChild != 0)
{
return modalChild;
}
// If not, check if this shell is modal itself
if (shell->IsVisible() && (shell->GetStyle() & modal) != 0)
{
return shell;
}
}
return Shell::Pointer(0);
}
//void Window::RunEventLoop()
//{
//
// //Use the display provided by the shell if possible
// Display display;
// if (shell == null)
// {
// display = Display.getCurrent();
// }
// else
// {
// display = loopShell.getDisplay();
// }
//
// while (loopShell != null && !loopShell.isDisposed())
// {
// try
// {
// if (!display.readAndDispatch())
// {
// display.sleep();
// }
// } catch (Throwable e)
// {
// exceptionHandler.handleException(e);
// }
// }
// display.update();
//}
Window::Window(Shell::Pointer parentShell)
{
this->parentShell = new SameShellProvider(parentShell);
this->Init();
}
Window::Window(IShellProvider::Pointer shellProvider)
{
poco_assert(shellProvider != 0);
this->parentShell = shellProvider;
this->Init();
}
void Window::Init()
{
this->shellStyle = Constants::SHELL_TRIM;
this->returnCode = OK;
this->block = false;
}
bool Window::CanHandleShellCloseEvent()
{
return true;
}
void Window::ConfigureShell(Shell::Pointer newShell)
{
// The single image version of this code had a comment related to bug
// 46624,
// and some code that did nothing if the stored image was already
// disposed.
// The equivalent in the multi-image version seems to be to remove the
// disposed images from the array passed to the shell.
if (defaultImages.size() > 0)
{
// ArrayList nonDisposedImages = new ArrayList(defaultImages.length);
// for (int i = 0; i < defaultImages.length; ++i)
// {
// if (defaultImages[i] != null && !defaultImages[i].isDisposed())
// {
// nonDisposedImages.add(defaultImages[i]);
// }
// }
//
// if (nonDisposedImages.size() <= 0)
// {
// System.err.println("Window.configureShell: images disposed"); //$NON-NLS-1$
// }
// else
// {
// //Image[] array = new Image[nonDisposedImages.size()];
// nonDisposedImages.toArray(array);
newShell->SetImages(defaultImages);
// }
}
// Layout layout = getLayout();
// if (layout != null)
// {
// newShell.setLayout(layout);
// }
}
//voidWindow::ConstrainShellSize()
//{
// // limit the shell size to the display size
// Rectangle bounds = shell.getBounds();
// Rectangle constrained = getConstrainedShellBounds(bounds);
// if (!bounds.equals(constrained))
// {
// shell.setBounds(constrained);
// }
//}
void* Window::CreateContents(Shell::Pointer parent)
{
// by default, just create a composite
//return new Composite(parent, SWT.NONE);
return parent->GetControl();
}
Shell::Pointer Window::CreateShell()
{
Shell::Pointer newParent = this->GetParentShell();
// if (newParent != 0 && newParent.isDisposed())
// {
// parentShell = new SameShellProvider(null);
// newParent = getParentShell();//Find a better parent
// }
//Create the shell
Shell::Pointer newShell = Tweaklets::Get(GuiWidgetsTweaklet::KEY)->CreateShell(newParent, this->GetShellStyle());
// resizeListener = new Listener() {
// public void handleEvent(Event e) {
// resizeHasOccurred = true;
// }
// };
//newShell.addListener(SWT.Resize, resizeListener);
newShell->SetData(Object::Pointer(this));
//Add a listener
newShell->AddShellListener(this->GetShellListener());
//Set the layout
this->ConfigureShell(newShell);
// //Register for font changes
// if (fontChangeListener == null)
// {
// fontChangeListener = new FontChangeListener();
// }
// JFaceResources.getFontRegistry().addListener(fontChangeListener);
return newShell;
}
void* Window::GetContents()
{
return contents;
}
Point Window::GetInitialLocation(const Point& initialSize)
{
void* parent = Tweaklets::Get(GuiWidgetsTweaklet::KEY)->GetParent(shell->GetControl());
Point centerPoint(0,0);
Rectangle parentBounds(0,0,0,0);
if (parent != 0)
{
parentBounds = Tweaklets::Get(GuiWidgetsTweaklet::KEY)->GetBounds(parent);
centerPoint.x = parentBounds.x + parentBounds.width/2;
centerPoint.y = parentBounds.y - parentBounds.height/2;
}
else
{
parentBounds = Tweaklets::Get(GuiWidgetsTweaklet::KEY)
->GetScreenSize(Tweaklets::Get(GuiWidgetsTweaklet::KEY)->GetPrimaryScreenNumber());
centerPoint.x = parentBounds.width/2;
centerPoint.y = parentBounds.height/2;
}
return Point(centerPoint.x - (initialSize.x / 2),
std::max<int>(parentBounds.y,
std::min<int>(centerPoint.y - (initialSize.y * 2 / 3),
parentBounds.y + parentBounds.height - initialSize.y)));
}
Point Window::GetInitialSize()
{
return shell->ComputeSize(Constants::DEFAULT, Constants::DEFAULT, true);
}
Shell::Pointer Window::GetParentShell()
{
Shell::Pointer parent = parentShell->GetShell();
int modal = Constants::APPLICATION_MODAL | Constants::SYSTEM_MODAL | Constants::PRIMARY_MODAL;
if ((this->GetShellStyle() & modal) != 0)
{
// If this is a modal shell with no parent, pick a shell using defaultModalParent.
if (parent == 0)
{
parent = defaultModalParent->GetShell();
}
}
return parent;
}
IShellListener::Pointer Window::GetShellListener()
{
if (windowShellListener == 0)
windowShellListener = new WindowShellListener(this);
return windowShellListener;
}
int Window::GetShellStyle()
{
return shellStyle;
}
void Window::HandleShellCloseEvent()
{
this->SetReturnCode(CANCEL);
this->Close();
}
void Window::InitializeBounds()
{
// if (resizeListener != null)
// {
// shell.removeListener(SWT.Resize, resizeListener);
// }
// if (resizeHasOccurred)
// { // Check if shell size has been set already.
// return;
// }
Point size = this->GetInitialSize();
Point location = this->GetInitialLocation(size);
shell->SetBounds(this->GetConstrainedShellBounds(Rectangle(location.x, location.y, size.x, size.y)));
}
Rectangle Window::GetConstrainedShellBounds(const Rectangle& preferredSize)
{
Rectangle result(preferredSize);
- GuiWidgetsTweaklet::Pointer guiTweaklet(Tweaklets::Get(GuiWidgetsTweaklet::KEY));
+ GuiWidgetsTweaklet* guiTweaklet(Tweaklets::Get(GuiWidgetsTweaklet::KEY));
int screenNum = guiTweaklet->GetClosestScreenNumber(result);
Rectangle bounds(guiTweaklet->GetAvailableScreenSize(screenNum));
if (result.height > bounds.height) {
result.height = bounds.height;
}
if (result.width > bounds.width) {
result.width = bounds.width;
}
result.x = std::max<int>(bounds.x, std::min<int>(result.x, bounds.x
+ bounds.width - result.width));
result.y = std::max<int>(bounds.y, std::min<int>(result.y, bounds.y
+ bounds.height - result.height));
return result;
}
void Window::SetParentShell(Shell::Pointer newParentShell)
{
poco_assert(shell == 0); // "There must not be an existing shell."; //$NON-NLS-1$
parentShell = new SameShellProvider(newParentShell);
}
void Window::SetReturnCode(int code)
{
returnCode = code;
}
void Window::SetShellStyle(int newShellStyle)
{
shellStyle = newShellStyle;
}
bool Window::Close()
{
BERRY_INFO << "Window::Close()";
// // stop listening for font changes
// if (fontChangeListener != null)
// {
// JFaceResources.getFontRegistry().removeListener(fontChangeListener);
// fontChangeListener = null;
// }
// remove this window from a window manager if it has one
if (windowManager != 0)
{
windowManager->Remove(Window::Pointer(this));
windowManager = 0;
}
if (shell == 0)
{
return true;
}
shell->RemoveShellListener(this->GetShellListener());
shell->SetData(Object::Pointer(0));
// If we "close" the shell recursion will occur.
// Instead, we need to "dispose" the shell to remove it from the
// display.
Tweaklets::Get(GuiWidgetsTweaklet::KEY)->DisposeShell(shell);
shell = 0;
contents = 0;
return true;
}
void Window::Create()
{
shell = this->CreateShell();
contents = this->CreateContents(shell);
//initialize the bounds of the shell to that appropriate for the
// contents
this->InitializeBounds();
}
void* Window::GetDefaultImage()
{
return (defaultImages.size() < 1) ? 0
: defaultImages[0];
}
std::vector<void*> Window::GetDefaultImages()
{
return defaultImages;
}
int Window::GetReturnCode()
{
return returnCode;
}
Shell::Pointer Window::GetShell()
{
return shell;
}
WindowManager* Window::GetWindowManager()
{
return windowManager;
}
int Window::Open()
{
if (shell == 0)
{
// create the window
this->Create();
}
// limit the shell size to the display size
//constrainShellSize();
// open the window
shell->Open(block);
// // run the event loop if specified
// if (block)
// {
// this->RunEventLoop();
// }
return returnCode;
}
void Window::SetBlockOnOpen(bool shouldBlock)
{
block = shouldBlock;
}
void Window::SetDefaultImage(void* image)
{
if (image != 0)
defaultImages.push_back(image);
}
void Window::SetDefaultImages(const std::vector<void*>& images)
{
defaultImages = images;
}
void Window::SetWindowManager(WindowManager* manager)
{
windowManager = manager;
// Code to detect invalid usage
if (manager != 0)
{
std::vector<Window::Pointer> windows = manager->GetWindows();
for (unsigned int i = 0; i < windows.size(); i++)
{
if (windows[i] == this)
{
return;
}
}
manager->Add(Window::Pointer(this));
}
}
void Window::SetExceptionHandler(IExceptionHandler::Pointer handler)
{
if (exceptionHandler == 0)
{
exceptionHandler = handler;
}
}
void Window::SetDefaultModalParent(IShellProvider::Pointer provider)
{
defaultModalParent = provider;
}
}
diff --git a/BlueBerry/Bundles/org.blueberry.ui/src/dialogs/berryMessageDialog.cpp b/BlueBerry/Bundles/org.blueberry.ui/src/dialogs/berryMessageDialog.cpp
index 94ce1d14da..2d8e08e7ae 100755
--- a/BlueBerry/Bundles/org.blueberry.ui/src/dialogs/berryMessageDialog.cpp
+++ b/BlueBerry/Bundles/org.blueberry.ui/src/dialogs/berryMessageDialog.cpp
@@ -1,67 +1,68 @@
/*=========================================================================
Program: BlueBerry Platform
Language: C++
Date: $Date$
Version: $Revision$
Copyright (c) German Cancer Research Center, Division of Medical and
Biological Informatics. All rights reserved.
See MITKCopyright.txt or http://www.mitk.org/copyright.html for details.
This software is distributed WITHOUT ANY WARRANTY; without even
the implied warranty of MERCHANTABILITY or FITNESS FOR A PARTICULAR
PURPOSE. See the above copyright notices for more information.
=========================================================================*/
-#include "berryMessageDialog.h"
#include "../tweaklets/berryMessageDialogTweaklet.h"
+#include "berryMessageDialog.h"
+
namespace berry
{
bool MessageDialog::OpenConfirm(Shell::Pointer parent,
const std::string& title, const std::string& message)
{
return Tweaklets::Get(MessageDialogTweaklet::KEY)->OpenConfirm(parent, title,
message);
}
void MessageDialog::OpenError(Shell::Pointer parent, const std::string& title,
const std::string& message)
{
Tweaklets::Get(MessageDialogTweaklet::KEY)->OpenError(parent, title, message);
}
void MessageDialog::OpenInformation(Shell::Pointer parent,
const std::string& title, const std::string& message)
{
Tweaklets::Get(MessageDialogTweaklet::KEY)->OpenInformation(parent, title,
message);
}
bool MessageDialog::OpenQuestion(Shell::Pointer parent,
const std::string& title, const std::string& message)
{
return Tweaklets::Get(MessageDialogTweaklet::KEY)->OpenQuestion(parent, title,
message);
}
void MessageDialog::OpenWarning(Shell::Pointer parent,
const std::string& title, const std::string& message)
{
Tweaklets::Get(MessageDialogTweaklet::KEY)->OpenWarning(parent, title,
message);
}
IDialog::Pointer MessageDialog::CreateMessageDialog(Shell::Pointer parentShell, const std::string& dialogTitle,
void* dialogTitleImage, const std::string& dialogMessage, int dialogImageType,
const std::vector<std::string>& dialogButtonLabels, int defaultIndex)
{
return Tweaklets::Get(MessageDialogTweaklet::KEY)->MessageDialog(parentShell, dialogTitle,
dialogTitleImage, dialogMessage, dialogImageType,
dialogButtonLabels, defaultIndex);
}
}
diff --git a/BlueBerry/Bundles/org.blueberry.ui/src/handlers/berryShowViewHandler.cpp b/BlueBerry/Bundles/org.blueberry.ui/src/handlers/berryShowViewHandler.cpp
index f12109bb2e..78895a1045 100644
--- a/BlueBerry/Bundles/org.blueberry.ui/src/handlers/berryShowViewHandler.cpp
+++ b/BlueBerry/Bundles/org.blueberry.ui/src/handlers/berryShowViewHandler.cpp
@@ -1,118 +1,118 @@
/*=========================================================================
Program: BlueBerry Platform
Language: C++
Date: $Date$
Version: $Revision$
Copyright (c) German Cancer Research Center, Division of Medical and
Biological Informatics. All rights reserved.
See MITKCopyright.txt or http://www.mitk.org/copyright.html for details.
This software is distributed WITHOUT ANY WARRANTY; without even
the implied warranty of MERCHANTABILITY or FITNESS FOR A PARTICULAR
PURPOSE. See the above copyright notices for more information.
=========================================================================*/
#include "berryShowViewHandler.h"
#include "berryHandlerUtil.h"
+#include "../tweaklets/berryWorkbenchTweaklet.h"
+#include "../dialogs/berryIShowViewDialog.h"
+
#include "../berryUIException.h"
#include "../berryIWorkbenchPage.h"
#include "../berryIViewDescriptor.h"
#include "../berryPlatformUI.h"
-#include "../tweaklets/berryWorkbenchTweaklet.h"
-#include "../dialogs/berryIShowViewDialog.h"
-
#include <berryCommandExceptions.h>
#include <vector>
namespace berry
{
const std::string ShowViewHandler::PARAMETER_NAME_VIEW_ID = "org.blueberry.ui.showView.viewId"; //$NON-NLS-1$
ShowViewHandler::ShowViewHandler()
{
}
Object::Pointer ShowViewHandler::Execute(
const ExecutionEvent::Pointer event)
{
IWorkbenchWindow::Pointer window = HandlerUtil::GetActiveWorkbenchWindowChecked(event);
// Get the view identifier, if any.
const ExecutionEvent::ParameterMap& parameters = event->GetParameters();
ExecutionEvent::ParameterMap::const_iterator result = parameters.find(PARAMETER_NAME_VIEW_ID);
std::string value;
if (result != parameters.end()) value = result->second;
if (value == "")
{
this->OpenOther(window);
}
else
{
try
{
this->OpenView(value, window);
}
catch (PartInitException e)
{
throw ExecutionException("Part could not be initialized", e); //$NON-NLS-1$
}
}
return Object::Pointer(0);
}
void ShowViewHandler::OpenOther(IWorkbenchWindow::Pointer window)
{
const IWorkbenchPage::Pointer page = window->GetActivePage();
if (page.IsNull())
{
return;
}
IShowViewDialog::Pointer dialog = Tweaklets::Get(WorkbenchTweaklet::KEY)->CreateStandardDialog(WorkbenchTweaklet::DIALOG_ID_SHOW_VIEW).Cast<IShowViewDialog>();
if (dialog.IsNull()) return;
int returnCode = dialog->Open();
if (returnCode == IDialog::CANCEL)
{
return;
}
const std::vector<IViewDescriptor::Pointer> descriptors =
dialog->GetSelection();
for (unsigned int i = 0; i < descriptors.size(); ++i)
{
try
{
this->OpenView(descriptors[i]->GetId(), window);
}
catch (PartInitException e)
{
// StatusUtil.handleStatus(e.getStatus(),
// WorkbenchMessages.ShowView_errorTitle
// + ": " + e.getMessage(), //$NON-NLS-1$
// StatusManager.SHOW);
}
}
}
void ShowViewHandler::OpenView(const std::string& viewId, IWorkbenchWindow::Pointer activeWorkbenchWindow)
{
const IWorkbenchPage::Pointer activePage = activeWorkbenchWindow->GetActivePage();
if (activePage.IsNull())
{
return;
}
activePage->ShowView(viewId);
}
}
diff --git a/BlueBerry/Bundles/org.blueberry.ui/src/internal/berryEditorReference.cpp b/BlueBerry/Bundles/org.blueberry.ui/src/internal/berryEditorReference.cpp
index 898995a80f..7ba4582f03 100644
--- a/BlueBerry/Bundles/org.blueberry.ui/src/internal/berryEditorReference.cpp
+++ b/BlueBerry/Bundles/org.blueberry.ui/src/internal/berryEditorReference.cpp
@@ -1,560 +1,561 @@
/*=========================================================================
Program: BlueBerry Platform
Language: C++
Date: $Date$
Version: $Revision$
Copyright (c) German Cancer Research Center, Division of Medical and
Biological Informatics. All rights reserved.
See MITKCopyright.txt or http://www.mitk.org/copyright.html for details.
This software is distributed WITHOUT ANY WARRANTY; without even
the implied warranty of MERCHANTABILITY or FITNESS FOR A PARTICULAR
PURPOSE. See the above copyright notices for more information.
=========================================================================*/
#include "berryEditorReference.h"
+#include "../tweaklets/berryWorkbenchPageTweaklet.h"
+
#include "berryEditorManager.h"
#include "berryEditorDescriptor.h"
#include "berryEditorRegistry.h"
#include "berryEditorSite.h"
#include "berryEditorAreaHelper.h"
#include "berryWorkbenchPlugin.h"
#include "berryWorkbenchPage.h"
#include "berryNullEditorInput.h"
#include "berryPartTester.h"
-#include "../tweaklets/berryWorkbenchPageTweaklet.h"
#include "../berryImageDescriptor.h"
#include "../berryPlatformUI.h"
namespace berry
{
EditorReference::EditorReference(EditorManager* man,
IEditorInput::Pointer input, EditorDescriptor::Pointer desc,
IMemento::Pointer editorState) :
manager(man), expectingInputChange(false),
reportedMalfunctioningEditor(false)
{
this->InitListenersAndHandlers();
restoredInput = input;
this->editorState = editorState;
this->Init(desc->GetId(), "", desc->GetImageDescriptor(),
desc->GetLabel(), "");
}
EditorReference::EditorReference(EditorManager* man, IMemento::Pointer memento) :
manager(man), expectingInputChange(false),
reportedMalfunctioningEditor(false)
{
this->InitListenersAndHandlers();
this->editorMemento = memento;
if (manager->UseIPersistableEditor())
{
//editorState = editorMemento->GetChild(WorkbenchConstants::TAG_EDITOR_STATE);
}
else
{
editorState = 0;
}
// String id = memento.getString(IWorkbenchConstants.TAG_ID);
// String title = memento.getString(IWorkbenchConstants.TAG_TITLE);
// String tooltip = Util.safeString(memento
// .getString(IWorkbenchConstants.TAG_TOOLTIP));
// String partName = memento
// .getString(IWorkbenchConstants.TAG_PART_NAME);
//
// IMemento propBag = memento.getChild(IWorkbenchConstants.TAG_PROPERTIES);
// if (propBag != null)
// {
// IMemento[] props = propBag
// .getChildren(IWorkbenchConstants.TAG_PROPERTY);
// for (int i = 0; i < props.length; i++)
// {
// propertyCache.put(props[i].getID(), props[i].getTextData());
// }
// }
// For compatibility set the part name to the title if not found
// if (partName.empty())
// {
// partName = title;
// }
// Get the editor descriptor.
// EditorDescriptor::Pointer desc;
// if (id != null)
// {
// desc = getDescriptor(id);
// }
// // desc may be null if id is null or desc is not found, but findImage below handles this
// String location = memento.getString(IWorkbenchConstants.TAG_PATH);
// IPath path = location == null ? null : new Path(location);
// ImageDescriptor iDesc = this.manager.findImage(desc, path);
//
// this.name = memento.getString(IWorkbenchConstants.TAG_NAME);
// if (this.name == null)
// {
// this.name = title;
// }
// setPinned("true".equals(memento.getString(IWorkbenchConstants.TAG_PINNED))); //$NON-NLS-1$
//
// IMemento inputMem = memento.getChild(IWorkbenchConstants.TAG_INPUT);
// if (inputMem != null)
// {
// this.factoryId = inputMem
// .getString(IWorkbenchConstants.TAG_FACTORY_ID);
// }
//
// init(id, title, tooltip, iDesc, partName, ""); //$NON-NLS-1$
}
EditorDescriptor::Pointer EditorReference::GetDescriptor()
{
return this->GetDescriptor(this->GetId());
}
EditorDescriptor::Pointer EditorReference::GetDescriptor(const std::string& id)
{
EditorDescriptor::Pointer desc;
IEditorRegistry* reg = WorkbenchPlugin::GetDefault()->GetEditorRegistry();
desc = reg->FindEditor(id).Cast<EditorDescriptor> ();
return desc;
}
void EditorReference::InitListenersAndHandlers()
{
// Create a property change listener to track the "close editors automatically"
// preference and show/remove the pin icon on editors
// Only 1 listener will be created in the EditorManager when necessary
//this->manager->CheckCreateEditorPropListener();
// Create a keyboard shortcut handler for pinning editors
// Only 1 handler will be created in the EditorManager when necessary
//this->manager->CheckCreatePinEditorShortcutKeyHandler();
}
PartPane::Pointer EditorReference::CreatePane()
{
PartPane::Pointer pane(
new PartPane(IWorkbenchPartReference::Pointer(this), this->manager->page));
return pane;
//return Tweaklets::Get(WorkbenchTweaklet::KEY)->CreateEditorPane(this,
// this->manager->page);
}
void EditorReference::PinStatusUpdated()
{
//firePropertyChange(IWorkbenchPart.PROP_TITLE);
}
std::string EditorReference::GetFactoryId()
{
// IEditorPart editor = getEditor(false);
// if (editor != null)
// {
// IPersistableElement persistable = editor.getEditorInput()
// .getPersistable();
// if (persistable != null)
// {
// return persistable.getFactoryId();
// }
// return null;
// }
// return factoryId;
return "";
}
std::string EditorReference::ComputePartName()
{
return WorkbenchPartReference::ComputePartName();
}
std::string EditorReference::GetName()
{
if (part.IsNotNull())
{
return this->GetEditor(false)->GetEditorInput()->GetName();
}
return name;
}
IEditorPart::Pointer EditorReference::GetEditor(bool restore)
{
return this->GetPart(restore).Cast<IEditorPart> ();
}
void EditorReference::SetName(const std::string& name)
{
this->name = name;
}
IMemento::Pointer EditorReference::GetMemento()
{
return editorMemento;
}
IWorkbenchPage::Pointer EditorReference::GetPage() const
{
return IWorkbenchPage::Pointer(this->manager->page);
}
IEditorInput::Pointer EditorReference::GetEditorInput()
{
IEditorPart::Pointer part = this->GetEditor(false);
if (part.IsNotNull())
{
return part->GetEditorInput();
}
return this->GetRestoredInput();
}
IEditorInput::Pointer EditorReference::GetRestoredInput()
{
if (restoredInput.IsNotNull())
{
return restoredInput;
}
// Get the input factory.
// IMemento::Pointer editorMem = this->GetMemento();
// if (editorMem == null)
// {
// throw new PartInitException(NLS.bind(WorkbenchMessages.EditorManager_no_persisted_state, getId(), getName()));
// }
// IMemento inputMem = editorMem
// .getChild(IWorkbenchConstants.TAG_INPUT);
// String factoryID = null;
// if (inputMem != null)
// {
// factoryID = inputMem
// .getString(IWorkbenchConstants.TAG_FACTORY_ID);
// }
// if (factoryID == null)
// {
// throw new PartInitException(NLS.bind(WorkbenchMessages.EditorManager_no_input_factory_ID, getId(), getName()));
// }
// IAdaptable input = null;
// String label = null; // debugging only
// if (UIStats.isDebugging(UIStats.CREATE_PART_INPUT))
// {
// label = getName() != null ? getName() : factoryID;
// }
// try
// {
// UIStats.start(UIStats.CREATE_PART_INPUT, label);
// IElementFactory factory = PlatformUI.getWorkbench()
// .getElementFactory(factoryID);
// if (factory == null)
// {
// throw new PartInitException(NLS.bind(WorkbenchMessages.EditorManager_bad_element_factory, new Object[]
// { factoryID, getId(), getName()}));
// }
//
// // Get the input element.
// input = factory.createElement(inputMem);
// if (input == null)
// {
// throw new PartInitException(NLS.bind(WorkbenchMessages.EditorManager_create_element_returned_null, new Object[]
// { factoryID, getId(), getName()}));
// }
// }finally
// {
// UIStats.end(UIStats.CREATE_PART_INPUT, input, label);
// }
// if (!(input instanceof IEditorInput))
// {
// throw new PartInitException(NLS.bind(WorkbenchMessages.EditorManager_wrong_createElement_result, new Object[]
// { factoryID, getId(), getName()}));
// }
// restoredInput = (IEditorInput) input;
return restoredInput;
}
IWorkbenchPart::Pointer EditorReference::CreatePart()
{
if (EditorRegistry::EMPTY_EDITOR_ID == this->GetId())
{
return this->GetEmptyEditor(this->GetDescriptor());
}
IWorkbenchPart::Pointer result;
// Try to restore the editor -- this does the real work of restoring the editor
//
try
{
result = this->CreatePartHelper().Cast<IWorkbenchPart> ();
} catch (PartInitException e)
{
// If unable to create the part, create an error part instead
// and pass the error to the status handling facility
// IStatus originalStatus = exception.getStatus();
// IStatus logStatus = StatusUtil.newStatus(originalStatus,
// NLS.bind("Unable to create editor ID {0}: {1}", //$NON-NLS-1$
// getId(), originalStatus.getMessage()));
// IStatus displayStatus = StatusUtil.newStatus(originalStatus,
// NLS.bind(WorkbenchMessages.EditorManager_unableToCreateEditor,
// originalStatus.getMessage()));
WorkbenchPlugin::Log("Unable to create editor ID " + this->GetId() + ": "
+ e.displayText());
// Pass the error to the status handling facility
//StatusManager.getManager().handle(logStatus);
EditorDescriptor::Pointer descr = this->GetDescriptor();
std::string label = this->GetId();
if (descr.IsNotNull())
label = descr->GetLabel();
IEditorPart::Pointer part =
Tweaklets::Get(WorkbenchPageTweaklet::KEY)->CreateErrorEditorPart(label,
e.displayText());
if (part.IsNotNull())
{
IEditorInput::Pointer input;
try
{
input = this->GetEditorInput();
} catch (PartInitException e1)
{
input = new NullEditorInput(EditorReference::Pointer(this));
}
PartPane::Pointer pane = this->GetPane();
pane->CreateControl(
manager->page->GetEditorPresentation()->GetLayoutPart()->GetControl());
EditorSite::Pointer site(
new EditorSite(IEditorReference::Pointer(this), part, manager->page, descr));
//site.setActionBars(new EditorActionBars(manager.page, site.getWorkbenchWindow(), getId()));
part->Init(site, input);
try
{
part->CreatePartControl(pane->GetControl());
} catch (...)
{
//content.dispose();
//StatusUtil.handleStatus(e, StatusManager.SHOW
// | StatusManager.LOG);
WorkbenchPlugin::Log("Error creating editor");
return IWorkbenchPart::Pointer(0);
}
result = part.Cast<IWorkbenchPart> ();
}
}
return result;
}
bool EditorReference::SetInput(IEditorInput::Pointer input)
{
if (part.IsNotNull())
{
if (part.Cast<IReusableEditor> ().IsNotNull())
{
IReusableEditor::Pointer editor = part.Cast<IReusableEditor> ();
expectingInputChange = true;
editor->SetInput(input);
// If the editor never fired a PROP_INPUT event, log the fact that we've discovered
// a buggy editor and fire the event for free. Firing the event for free isn't required
// and cannot be relied on (it only works if the input change was triggered by this
// method, and there are definitely other cases where events will still be lost),
// but older versions of the workbench did this so we fire it here in the spirit
// of playing nice.
if (expectingInputChange)
{
// Log the fact that this editor is broken
this->ReportMalfunction(
"Editor is not firing a PROP_INPUT event in response to IReusableEditor.setInput(...)"); //$NON-NLS-1$
// Fire the property for free (can't be relied on since there are other ways the input
// can change, but we do it here to be consistent with older versions of the workbench)
//firePropertyChange(IWorkbenchPartConstants.PROP_INPUT);
}
return editor->GetEditorInput() == input;
}
// Can't change the input if the editor already exists and isn't an IReusableEditor
return false;
}
// Changing the input is trivial and always succeeds if the editor doesn't exist yet
if (input != restoredInput)
{
restoredInput = input;
//firePropertyChange(IWorkbenchPartConstants.PROP_INPUT);
}
return true;
}
void EditorReference::ReportMalfunction(const std::string& string)
{
if (!reportedMalfunctioningEditor)
{
reportedMalfunctioningEditor = true;
std::string errorMessage = "Problem detected with part " + this->GetId(); //$NON-NLS-1$
if (part.IsNotNull())
{
errorMessage.append("(class = ").append(part->GetClassName()).append(
")"); //$NON-NLS-1$ //$NON-NLS-2$
}
errorMessage += ": " + string; //$NON-NLS-1$
//StatusManager.getManager().handle(StatusUtil.newStatus(getDescriptor().getPluginId(), errorMessage, null));
BERRY_ERROR << errorMessage << std::endl;
}
}
IEditorPart::Pointer EditorReference::CreatePartHelper()
{
EditorSite::Pointer site;
IEditorPart::Pointer part;
try
{
IEditorInput::Pointer editorInput = this->GetEditorInput();
// Get the editor descriptor.
std::string editorID = this->GetId();
EditorDescriptor::Pointer desc = this->GetDescriptor();
if (desc.IsNull())
{
throw PartInitException("No editor descriptor for id " + editorID);
}
if (desc->IsInternal())
{
// Create an editor instance.
part = manager->CreatePart(desc);
this->CreatePartProperties(part);
}
// else if (desc->GetId() == IEditorRegistry.SYSTEM_INPLACE_EDITOR_ID)
// {
//
// part = ComponentSupport.getSystemInPlaceEditor();
//
// if (part == null)
// {
// throw new PartInitException(WorkbenchMessages.EditorManager_no_in_place_support);
// }
// }
else
{
throw PartInitException("Invalid editor descriptor for id " + editorID);
}
// Create a pane for this part
PartPane::Pointer pane = this->GetPane();
pane->CreateControl(manager->page->GetEditorPresentation()->GetLayoutPart()->GetControl());
// Link everything up to the part reference (the part reference itself should not have
// been modified until this point)
site = manager->CreateSite(IEditorReference::Pointer(this), part, desc, editorInput);
// if there is saved state that's appropriate, pass it on
if (/*part instanceof IPersistableEditor &&*/editorState.IsNotNull())
{
//part->RestoreState(editorState);
}
// Remember the site and the action bars (now that we've created them, we'll need to dispose
// them if an exception occurs)
//actionBars = (EditorActionBars) site.getActionBars();
part->CreatePartControl(pane->GetControl());
// The editor should now be fully created. Exercise its public interface, and sanity-check
// it wherever possible. If it's going to throw exceptions or behave badly, it's much better
// that it does so now while we can still cancel creation of the part.
PartTester::TestEditor(part);
return part;
} catch (std::exception e)
{
throw PartInitException(e.what());
}
}
IEditorPart::Pointer EditorReference::GetEmptyEditor(
EditorDescriptor::Pointer descr)
{
IEditorPart::Pointer part =
Tweaklets::Get(WorkbenchPageTweaklet::KEY)->CreateErrorEditorPart("(Empty)", "");
IEditorInput::Pointer input;
try
{
input = this->GetEditorInput();
} catch (PartInitException e1)
{
input = new NullEditorInput(EditorReference::Pointer(this));
}
PartPane::Pointer pane = this->GetPane();
pane->CreateControl(
manager->page->GetEditorPresentation()->GetLayoutPart()->GetControl());
EditorSite::Pointer site(new EditorSite(IEditorReference::Pointer(this),
part, manager->page, descr));
//site.setActionBars(new EditorActionBars(manager.page, site.getWorkbenchWindow(), getId()));
part->Init(site, input);
try
{
part->CreatePartControl(pane->GetControl());
} catch (std::exception e)
{
//StatusManager.getManager().handle(
// StatusUtil.newStatus(WorkbenchPlugin.PI_WORKBENCH, e));
BERRY_ERROR << e.what() << std::endl;
return IEditorPart::Pointer(0);
}
this->part = part.Cast<IWorkbenchPart> ();
// Add a dispose listener to the part. This dispose listener does nothing but log an exception
// if the part's widgets get disposed unexpectedly. The workbench part reference is the only
// object that should dispose this control, and it will remove the listener before it does so.
this->RefreshFromPart();
//this->ReleaseReferences();
if (this->GetPage().Cast<WorkbenchPage> ()->GetActiveEditorReference()
!= this)
{
//fireInternalPropertyChange(INTERNAL_PROPERTY_OPENED);
}
return part;
}
}
diff --git a/BlueBerry/Bundles/org.blueberry.ui/src/internal/berryErrorViewPart.h b/BlueBerry/Bundles/org.blueberry.ui/src/internal/berryErrorViewPart.h
index 6c04b873a3..a7b82385a6 100644
--- a/BlueBerry/Bundles/org.blueberry.ui/src/internal/berryErrorViewPart.h
+++ b/BlueBerry/Bundles/org.blueberry.ui/src/internal/berryErrorViewPart.h
@@ -1,82 +1,83 @@
/*=========================================================================
Program: BlueBerry Platform
Language: C++
Date: $Date$
Version: $Revision$
Copyright (c) German Cancer Research Center, Division of Medical and
Biological Informatics. All rights reserved.
See MITKCopyright.txt or http://www.mitk.org/copyright.html for details.
This software is distributed WITHOUT ANY WARRANTY; without even
the implied warranty of MERCHANTABILITY or FITNESS FOR A PARTICULAR
PURPOSE. See the above copyright notices for more information.
=========================================================================*/
#ifndef BERRYERRORVIEWPART_H_
#define BERRYERRORVIEWPART_H_
-#include "../berryViewPart.h"
#include "../tweaklets/berryWorkbenchPageTweaklet.h"
+#include "../berryViewPart.h"
+
namespace berry {
/**
* This part is shown instead the views with errors.
*
* @since 3.3
*/
class ErrorViewPart : public ViewPart {
public:
berryObjectMacro(ErrorViewPart)
/**
* Creates instance of the class
*/
ErrorViewPart();
/**
* Creates instance of the class
*
* @param error the status
*/
ErrorViewPart(const std::string& title, const std::string& error);
/*
* (non-Javadoc)
*
* @see org.eclipse.ui.part.WorkbenchPart#createPartControl(org.eclipse.swt.widgets.Composite)
*/
void CreatePartControl(void* parent);
/*
* (non-Javadoc)
*
* @see org.eclipse.ui.part.ViewPart#setPartName(java.lang.String)
*/
void SetPartName(const std::string& newName);
/*
* (non-Javadoc)
*
* @see org.eclipse.ui.part.WorkbenchPart#setFocus()
*/
void SetFocus();
private:
//IStatus error;
std::string title;
std::string error;
Object::Pointer statusPart;
};
}
#endif /* BERRYERRORVIEWPART_H_ */
diff --git a/BlueBerry/Bundles/org.blueberry.ui/src/internal/berryLayoutPart.cpp b/BlueBerry/Bundles/org.blueberry.ui/src/internal/berryLayoutPart.cpp
index 5c32e724ae..e8cfd72bb1 100644
--- a/BlueBerry/Bundles/org.blueberry.ui/src/internal/berryLayoutPart.cpp
+++ b/BlueBerry/Bundles/org.blueberry.ui/src/internal/berryLayoutPart.cpp
@@ -1,338 +1,338 @@
/*=========================================================================
Program: BlueBerry Platform
Language: C++
Date: $Date$
Version: $Revision$
Copyright (c) German Cancer Research Center, Division of Medical and
Biological Informatics. All rights reserved.
See MITKCopyright.txt or http://www.mitk.org/copyright.html for details.
This software is distributed WITHOUT ANY WARRANTY; without even
the implied warranty of MERCHANTABILITY or FITNESS FOR A PARTICULAR
PURPOSE. See the above copyright notices for more information.
=========================================================================*/
#include "berryLayoutPart.h"
#include "berryILayoutContainer.h"
#include "berryDetachedWindow.h"
#include "../tweaklets/berryGuiWidgetsTweaklet.h"
#include "../berryIWorkbenchWindow.h"
#include "../berryConstants.h"
namespace berry
{
const std::string LayoutPart::PROP_VISIBILITY = "PROP_VISIBILITY"; //$NON-NLS-1$
LayoutPart::LayoutPart(const std::string& id_) :
id(id_), deferCount(0)
{
}
LayoutPart::~LayoutPart()
{
}
bool LayoutPart::AllowsAutoFocus()
{
if (container != 0)
{
return container->AllowsAutoFocus();
}
return true;
}
void LayoutPart::Dispose()
{
}
Rectangle LayoutPart::GetBounds()
{
if (this->GetControl() == 0)
return Rectangle();
return Tweaklets::Get(GuiWidgetsTweaklet::KEY)->GetBounds(this->GetControl());
}
ILayoutContainer::Pointer LayoutPart::GetContainer()
{
return container;
}
std::string LayoutPart::GetID() const
{
return id;
}
bool LayoutPart::IsCompressible()
{
return false;
}
Point LayoutPart::GetSize()
{
Rectangle r = this->GetBounds();
Point ptSize(r.width, r.height);
return ptSize;
}
int LayoutPart::GetSizeFlags(bool /*horizontal*/)
{
return Constants::MIN;
}
int LayoutPart::ComputePreferredSize(bool /*width*/, int /*availableParallel*/,
int /*availablePerpendicular*/, int preferredParallel)
{
return preferredParallel;
}
IDropTarget::Pointer LayoutPart::GetDropTarget(Object::Pointer /*draggedObject*/, const Point& /*displayCoordinates*/)
{
return IDropTarget::Pointer(0);
}
bool LayoutPart::IsDocked()
{
Shell::Pointer s = this->GetShell();
if (s == 0) {
return false;
}
return s->GetData().Cast<IWorkbenchWindow>() != 0;
}
Shell::Pointer LayoutPart::GetShell()
{
void* ctrl = this->GetControl();
if (ctrl)
{
return Tweaklets::Get(GuiWidgetsTweaklet::KEY)->GetShell(ctrl);
}
return Shell::Pointer(0);
}
IWorkbenchWindow::Pointer LayoutPart::GetWorkbenchWindow()
{
Shell::Pointer s = this->GetShell();
if (s == 0)
{
return IWorkbenchWindow::Pointer(0);
}
Object::Pointer data = s->GetData();
if (data.Cast<IWorkbenchWindow>() != 0)
{
return data.Cast<IWorkbenchWindow>();
}
else if (data.Cast<DetachedWindow>() != 0)
{
return data.Cast<DetachedWindow>()->GetWorkbenchPage()->GetWorkbenchWindow();
}
return IWorkbenchWindow::Pointer(0);
}
void LayoutPart::MoveAbove(void* /*refControl*/)
{
}
void LayoutPart::Reparent(void* newParent)
{
void* control = this->GetControl();
- GuiWidgetsTweaklet::Pointer guiTweaklet = Tweaklets::Get(GuiWidgetsTweaklet::KEY);
+ GuiWidgetsTweaklet* guiTweaklet = Tweaklets::Get(GuiWidgetsTweaklet::KEY);
if ((control == 0) || (guiTweaklet->GetParent(control) == newParent))
{
return;
}
if (guiTweaklet->IsReparentable(control))
{
// make control small in case it is not resized with other controls
//control.setBounds(0, 0, 0, 0);
// By setting the control to disabled before moving it,
// we ensure that the focus goes away from the control and its children
// and moves somewhere else
bool enabled = guiTweaklet->GetEnabled(control);
guiTweaklet->SetEnabled(control, false);
guiTweaklet->SetParent(control, newParent);
guiTweaklet->SetEnabled(control, enabled);
guiTweaklet->MoveAbove(control, 0);
}
}
bool LayoutPart::GetVisible()
{
void* ctrl = this->GetControl();
if (ctrl)
{
return Tweaklets::Get(GuiWidgetsTweaklet::KEY)->GetVisible(ctrl);
}
return false;
}
bool LayoutPart::IsVisible()
{
void* ctrl = this->GetControl();
if (ctrl)
{
return Tweaklets::Get(GuiWidgetsTweaklet::KEY)->IsVisible(ctrl);
}
return false;
}
void LayoutPart::SetVisible(bool makeVisible)
{
void* ctrl = this->GetControl();
if (ctrl != 0)
{
if (makeVisible == Tweaklets::Get(GuiWidgetsTweaklet::KEY)->GetVisible(ctrl))
{
return;
}
// if (!makeVisible && this->IsFocusAncestor(ctrl))
// {
// // Workaround for Bug 60970 [EditorMgmt] setActive() called on an editor when it does not have focus.
// // Force focus on the shell so that when ctrl is hidden,
// // SWT does not try to send focus elsewhere, which may cause
// // some other part to be activated, which affects the part
// // activation order and can cause flicker.
// ctrl.getShell().forceFocus();
// }
Tweaklets::Get(GuiWidgetsTweaklet::KEY)->SetVisible(ctrl, makeVisible);
}
}
bool LayoutPart::IsFocusAncestor(void* /*ctrl*/)
{
// Control f = ctrl.getDisplay().getFocusControl();
// while (f != null && f != ctrl)
// {
// f = f.getParent();
// }
// return f == ctrl;
return false;
}
void LayoutPart::SetBounds(const Rectangle& r)
{
void* ctrl = this->GetControl();
if (ctrl)
{
return Tweaklets::Get(GuiWidgetsTweaklet::KEY)->SetBounds(ctrl, r);
}
}
void LayoutPart::SetContainer(ILayoutContainer::Pointer container)
{
this->container = container;
//TODO Zoom
// if (container != 0)
// {
// setZoomed(container.childIsZoomed(this));
// }
}
void LayoutPart::SetID(const std::string& str)
{
id = str;
}
LayoutPart::Pointer LayoutPart::GetPart()
{
return LayoutPart::Pointer(this);
}
void LayoutPart::DeferUpdates(bool shouldDefer)
{
if (shouldDefer)
{
if (deferCount == 0)
{
this->StartDeferringEvents();
}
deferCount++;
}
else
{
if (deferCount> 0)
{
deferCount--;
if (deferCount == 0)
{
this->HandleDeferredEvents();
}
}
}
}
void LayoutPart::StartDeferringEvents()
{
}
void LayoutPart::HandleDeferredEvents()
{
}
bool LayoutPart::IsDeferred()
{
return deferCount> 0;
}
void LayoutPart::DescribeLayout(std::string& /*buf*/) const
{
}
std::string LayoutPart::GetPlaceHolderId()
{
return this->GetID();
}
void LayoutPart::ResizeChild(LayoutPart::Pointer /*childThatChanged*/)
{
}
void LayoutPart::FlushLayout()
{
ILayoutContainer::Pointer container = this->GetContainer();
if (container != 0)
{
container->ResizeChild(LayoutPart::Pointer(this));
}
}
bool LayoutPart::AllowsAdd(LayoutPart::Pointer /*toAdd*/)
{
return false;
}
std::string LayoutPart::ToString()
{
return "";
}
void LayoutPart::TestInvariants()
{
}
}
diff --git a/BlueBerry/Bundles/org.blueberry.ui/src/internal/berryPartPane.cpp b/BlueBerry/Bundles/org.blueberry.ui/src/internal/berryPartPane.cpp
index 23db3ffd52..8fb22a4a87 100644
--- a/BlueBerry/Bundles/org.blueberry.ui/src/internal/berryPartPane.cpp
+++ b/BlueBerry/Bundles/org.blueberry.ui/src/internal/berryPartPane.cpp
@@ -1,467 +1,467 @@
/*=========================================================================
Program: BlueBerry Platform
Language: C++
Date: $Date$
Version: $Revision$
Copyright (c) German Cancer Research Center, Division of Medical and
Biological Informatics. All rights reserved.
See MITKCopyright.txt or http://www.mitk.org/copyright.html for details.
This software is distributed WITHOUT ANY WARRANTY; without even
the implied warranty of MERCHANTABILITY or FITNESS FOR A PARTICULAR
PURPOSE. See the above copyright notices for more information.
=========================================================================*/
#include "berryPartPane.h"
+#include "../tweaklets/berryGuiWidgetsTweaklet.h"
+#include "../tweaklets/berryWorkbenchPageTweaklet.h"
+
#include "berryWorkbenchPage.h"
#include "berryPartStack.h"
#include "berryEditorAreaHelper.h"
#include "berryPerspective.h"
#include "berryPartStack.h"
#include "berryDragUtil.h"
-#include "../tweaklets/berryGuiWidgetsTweaklet.h"
-#include "../tweaklets/berryWorkbenchPageTweaklet.h"
-
namespace berry
{
PartPane::Sashes::Sashes() :
left(0), right(0), top(0), bottom(0)
{
}
PartPane::PartPane(IWorkbenchPartReference::Pointer partReference,
WorkbenchPage* workbenchPage)
: StackablePart(partReference->GetId()),
control(0), inLayout(true), busy(false), hasFocus(false)
{
//super(partReference.getId());
this->partReference = partReference;
this->page = workbenchPage;
}
void PartPane::CreateControl(void* parent) {
if (this->GetControl() != 0)
{
return;
}
partReference.Lock()->AddPropertyListener(IPropertyChangeListener::Pointer(this));
// Create view form.
control = Tweaklets::Get(WorkbenchPageTweaklet::KEY)->CreatePaneControl(parent);
// the part should never be visible by default. It will be made visible
// by activation. This allows us to have views appear in tabs without
// becoming active by default.
Tweaklets::Get(GuiWidgetsTweaklet::KEY)->SetVisible(control, false);
Tweaklets::Get(GuiWidgetsTweaklet::KEY)->MoveAbove(control, 0);
// Create a title bar.
//this->CreateTitleBar();
// When the pane or any child gains focus, notify the workbench.
Tweaklets::Get(GuiWidgetsTweaklet::KEY)->AddControlListener(control, GuiTk::IControlListener::Pointer(this));
//control.addTraverseListener(traverseListener);
}
bool PartPane::IsPlaceHolder()
{
return false;
}
PartPane::~PartPane()
{
// super.dispose();
//
this->Register();
if (control != 0)
{
BERRY_DEBUG << "Deleting PartPane control";
Tweaklets::Get(GuiWidgetsTweaklet::KEY)->RemoveControlListener(control, GuiTk::IControlListener::Pointer(this));
// control.removeTraverseListener(traverseListener);
Tweaklets::Get(GuiWidgetsTweaklet::KEY)->Dispose(control);
control = 0;
}
// if ((paneMenuManager != null))
// {
// paneMenuManager.dispose();
// paneMenuManager = null;
// }
//
if (!partReference.Expired())
{
partReference.Lock()->RemovePropertyListener(IPropertyChangeListener::Pointer(this));
}
// partReference.removePartPropertyListener(this);
this->UnRegister(false);
}
void PartPane::DoHide()
{
if (partReference.Lock().Cast<IViewReference>() != 0)
{
this->GetPage()->HideView(partReference.Lock().Cast<IViewReference>());
}
else if (partReference.Lock().Cast<IEditorReference>() != 0)
{
this->GetPage()->CloseEditor(partReference.Lock().Cast<IEditorReference>(), true);
}
}
Rectangle PartPane::GetParentBounds()
{
void* ctrl = this->GetControl();
if (this->GetContainer() != 0 && this->GetContainer().Cast<LayoutPart>() != 0) {
LayoutPart::Pointer part = this->GetContainer().Cast<LayoutPart>();
if (part->GetControl() != 0) {
ctrl = part->GetControl();
}
}
return DragUtil::GetDisplayBounds(ctrl);
}
void* PartPane::GetControl()
{
return control;
}
IWorkbenchPartReference::Pointer PartPane::GetPartReference() const
{
return partReference.Lock();
}
void PartPane::ControlActivated(GuiTk::ControlEvent::Pointer /*e*/)
{
if (inLayout)
{
this->RequestActivation();
}
}
GuiTk::IControlListener::Events::Types PartPane::GetEventTypes() const
{
return GuiTk::IControlListener::Events::ACTIVATED;
}
void PartPane::MoveAbove(void* refControl)
{
if (this->GetControl() != 0)
{
Tweaklets::Get(GuiWidgetsTweaklet::KEY)->MoveAbove(this->GetControl(), refControl);
}
}
void PartPane::RequestActivation()
{
IWorkbenchPart::Pointer part = partReference.Lock()->GetPart(true);
this->page->RequestActivation(part);
}
//PartStack::Pointer PartPane::GetStack()
//{
// return partStack;
//}
PartPane::Sashes PartPane::FindSashes()
{
Sashes result;
IStackableContainer::Pointer container = this->GetContainer();
if (container == 0) {
return result;
}
container->FindSashes(result);
return result;
}
WorkbenchPage::Pointer PartPane::GetPage()
{
return WorkbenchPage::Pointer(page);
}
void PartPane::SetContainer(IStackableContainer::Pointer container)
{
if (hasFocus)
{
IStackableContainer::Pointer oldContainer = this->GetContainer();
if (PartStack::Pointer oldStack = oldContainer.Cast<PartStack>())
{
oldStack->SetActive(StackPresentation::AS_INACTIVE);
}
if (PartStack::Pointer newContainer = container.Cast<PartStack>())
{
newContainer->SetActive(StackPresentation::AS_ACTIVE_FOCUS);
}
}
void* containerControl = container == 0 ? 0 : container.Cast<LayoutPart>()->GetControl();
if (containerControl != 0)
{
void* control = this->GetControl();
void* newParent = Tweaklets::Get(GuiWidgetsTweaklet::KEY)->GetParent(containerControl);
if (control != 0 && newParent != Tweaklets::Get(GuiWidgetsTweaklet::KEY)->GetParent(control))
{
this->Reparent(newParent);
}
}
StackablePart::SetContainer(container);
}
void PartPane::Reparent(void* newParent)
{
void* control = this->GetControl();
- GuiWidgetsTweaklet::Pointer guiTweaklet = Tweaklets::Get(GuiWidgetsTweaklet::KEY);
+ GuiWidgetsTweaklet* guiTweaklet = Tweaklets::Get(GuiWidgetsTweaklet::KEY);
if ((control == 0) || (guiTweaklet->GetParent(control) == newParent))
{
return;
}
if (guiTweaklet->IsReparentable(control))
{
// make control small in case it is not resized with other controls
//control.setBounds(0, 0, 0, 0);
// By setting the control to disabled before moving it,
// we ensure that the focus goes away from the control and its children
// and moves somewhere else
bool enabled = guiTweaklet->GetEnabled(control);
guiTweaklet->SetEnabled(control, false);
guiTweaklet->SetParent(control, newParent);
guiTweaklet->SetEnabled(control, enabled);
guiTweaklet->MoveAbove(control, 0);
}
}
void PartPane::ShowFocus(bool inFocus)
{
if (partReference.Lock().Cast<IViewReference>() != 0)
{
hasFocus = inFocus;
}
if (PartStack::Pointer stack = this->GetContainer().Cast<PartStack>())
{
if (partReference.Lock().Cast<IViewReference>() != 0)
{
stack->SetActive(inFocus ? StackPresentation::AS_ACTIVE_FOCUS
: StackPresentation::AS_INACTIVE);
}
else if (partReference.Lock().Cast<IEditorReference>() != 0)
{
if (inFocus)
{
page->GetEditorPresentation()->SetActiveWorkbook(stack, true);
}
else
{
stack->SetActive(page->GetEditorPresentation()->GetActiveWorkbook() == stack ?
StackPresentation::AS_ACTIVE_NOFOCUS : StackPresentation::AS_INACTIVE);
}
}
}
}
PartStack::Pointer PartPane::GetStack()
{
IStackableContainer::Pointer container = this->GetContainer();
return container.Cast<PartStack>();
}
void PartPane::SetVisible(bool makeVisible)
{
// Avoid redundant visibility changes
if (makeVisible == this->GetVisible())
{
return;
}
if (makeVisible)
{
partReference.Lock()->GetPart(true);
}
if (this->GetControl() != 0)
Tweaklets::Get(GuiWidgetsTweaklet::KEY)->SetVisible(this->GetControl(), makeVisible);
partReference.Lock().Cast<WorkbenchPartReference>()->FireVisibilityChange();
}
bool PartPane::GetVisible()
{
if (this->GetControl() != 0)
return Tweaklets::Get(GuiWidgetsTweaklet::KEY)->GetVisible(this->GetControl());
return false;
}
void PartPane::SetFocus()
{
this->RequestActivation();
IWorkbenchPart::Pointer part = partReference.Lock()->GetPart(true);
if (part.IsNotNull())
{
// Control control = getControl();
// if (!SwtUtil.isFocusAncestor(control))
// {
// First try to call part.setFocus
part->SetFocus();
//}
}
}
void PartPane::SetWorkbenchPage(WorkbenchPage::Pointer workbenchPage)
{
this->page = workbenchPage.GetPointer();
}
void PartPane::DoDock()
{
// do nothing
}
void PartPane::SetBusy(bool isBusy)
{
if (isBusy != busy)
{
busy = isBusy;
//firePropertyChange(IPresentablePart.PROP_BUSY);
}
}
void PartPane::ShowHighlight()
{
//No nothing by default
}
void* PartPane::GetToolBar()
{
return 0;
}
bool PartPane::HasViewMenu()
{
return false;
}
bool PartPane::IsBusy()
{
return busy;
}
void PartPane::DescribeLayout(std::string& buf) const
{
IWorkbenchPartReference::Pointer part = this->GetPartReference();
if (part.IsNotNull())
{
buf.append(part->GetPartName());
return;
}
}
bool PartPane::IsCloseable()
{
if (partReference.Lock().Cast<IViewReference>() != 0)
{
Perspective::Pointer perspective = page->GetActivePerspective();
if (perspective == 0) {
// Shouldn't happen -- can't have a ViewStack without a
// perspective
return true;
}
return perspective->IsCloseable(partReference.Lock().Cast<IViewReference>());
}
return true;
}
void PartPane::SetInLayout(bool inLayout)
{
this->inLayout = inLayout;
}
bool PartPane::GetInLayout()
{
return inLayout;
}
bool PartPane::AllowsAutoFocus()
{
if (!inLayout)
{
return false;
}
//return super.allowsAutoFocus();
return true;
}
void PartPane::RemoveContributions()
{
}
void PartPane::AddPropertyListener(IPropertyChangeListener::Pointer listener)
{
propertyChangeEvents.AddListener(listener);
}
void PartPane::RemovePropertyListener(IPropertyChangeListener::Pointer listener)
{
propertyChangeEvents.RemoveListener(listener);
}
void PartPane::FirePropertyChange(PropertyChangeEvent::Pointer event)
{
propertyChangeEvents.propertyChange(event);
}
void PartPane::PropertyChange(PropertyChangeEvent::Pointer event)
{
this->FirePropertyChange(event);
}
int PartPane::ComputePreferredSize(bool width, int availableParallel,
int availablePerpendicular, int preferredParallel)
{
return partReference.Lock().Cast<WorkbenchPartReference>()->ComputePreferredSize(width,
availableParallel, availablePerpendicular, preferredParallel);
}
int PartPane::GetSizeFlags(bool horizontal)
{
return partReference.Lock().Cast<WorkbenchPartReference>()->GetSizeFlags(horizontal);
}
void PartPane::ShellActivated()
{
}
void PartPane::ShellDeactivated()
{
}
}
diff --git a/BlueBerry/Bundles/org.blueberry.ui/src/internal/berryPartStack.cpp b/BlueBerry/Bundles/org.blueberry.ui/src/internal/berryPartStack.cpp
index bb86eaee8a..bb1dd25b63 100644
--- a/BlueBerry/Bundles/org.blueberry.ui/src/internal/berryPartStack.cpp
+++ b/BlueBerry/Bundles/org.blueberry.ui/src/internal/berryPartStack.cpp
@@ -1,1608 +1,1608 @@
/*=========================================================================
Program: BlueBerry Platform
Language: C++
Date: $Date$
Version: $Revision$
Copyright (c) German Cancer Research Center, Division of Medical and
Biological Informatics. All rights reserved.
See MITKCopyright.txt or http://www.mitk.org/copyright.html for details.
This software is distributed WITHOUT ANY WARRANTY; without even
the implied warranty of MERCHANTABILITY or FITNESS FOR A PARTICULAR
PURPOSE. See the above copyright notices for more information.
=========================================================================*/
#include "berryPartStack.h"
#include "berryPerspective.h"
#include "berryPresentationFactoryUtil.h"
#include "berryWorkbenchPlugin.h"
#include "berryPresentationSerializer.h"
#include "berryDragUtil.h"
#include "berryEditorAreaHelper.h"
#include "berryPerspectiveHelper.h"
#include "berryWorkbenchConstants.h"
#include "../berryXMLMemento.h"
#include "../berryIWorkbenchPartConstants.h"
#include "../berryGeometry.h"
#include "../tweaklets/berryGuiWidgetsTweaklet.h"
#include <berryObjects.h>
#include <Poco/HashSet.h>
namespace berry
{
const int PartStack::PROP_SELECTION = 0x42;
PartStack::PartStackDropResult::Pointer PartStack::dropResult(
new PartStack::PartStackDropResult());
void PartStack::PartStackDropResult::SetTarget(PartStack::Pointer stack,
PartPane::Pointer pane, StackDropResult::Pointer result)
{
this->pane = pane;
this->dropResult = result;
this->stack = stack;
}
void PartStack::PartStackDropResult::Drop()
{
// If we're dragging a pane over itself do nothing
//if (dropResult.getInsertionPoint() == pane.getPresentablePart()) { return; };
Object::Pointer cookie;
if (dropResult != 0)
{
cookie = dropResult->GetCookie();
}
PartPane::Pointer pane(this->pane);
PartStack::Pointer stack(this->stack);
// Handle cross window drops by opening a new editor
if (pane->GetPartReference().Cast<IEditorReference> () != 0)
{
IEditorReference::Pointer editorRef = pane->GetPartReference().Cast<
IEditorReference> ();
if (pane->GetWorkbenchWindow() != stack->GetWorkbenchWindow())
{
try
{
IEditorInput::Pointer input = editorRef->GetEditorInput();
// Close the old editor and capture the actual closed state incase of a 'cancel'
bool editorClosed = pane->GetPage()->CloseEditor(editorRef, true);
// Only open open the new editor if the old one closed
if (editorClosed)
stack->GetPage()->OpenEditor(input, editorRef->GetId());
return;
} catch (PartInitException& e)
{
//e.printStackTrace();
BERRY_ERROR << e.displayText();
}
}
}
if (pane->GetContainer() != stack)
{
// Moving from another stack
stack->DerefPart(pane);
pane->Reparent(stack->GetParent());
stack->Add(pane, cookie);
stack->SetSelection(pane);
pane->SetFocus();
}
else if (cookie != 0)
{
// Rearranging within this stack
stack->GetPresentation()->MovePart(stack->GetPresentablePart(pane), cookie);
}
}
DnDTweaklet::CursorType PartStack::PartStackDropResult::GetCursor()
{
return DnDTweaklet::CURSOR_CENTER;
}
Rectangle PartStack::PartStackDropResult::GetSnapRectangle()
{
if (dropResult == 0)
{
return DragUtil::GetDisplayBounds(stack.Lock()->GetControl());
}
return dropResult->GetSnapRectangle();
}
PartStack::MyStackPresentationSite::MyStackPresentationSite(PartStack* stack) :
partStack(stack)
{
}
void PartStack::MyStackPresentationSite::Close(IPresentablePart::Pointer part)
{
partStack->Close(part);
}
void PartStack::MyStackPresentationSite::Close(const std::vector<
IPresentablePart::Pointer>& parts)
{
partStack->Close(parts);
}
void PartStack::MyStackPresentationSite::DragStart(
IPresentablePart::Pointer beingDragged, Point& initialLocation,
bool keyboard)
{
partStack->DragStart(beingDragged, initialLocation, keyboard);
}
void PartStack::MyStackPresentationSite::DragStart(Point& initialLocation,
bool keyboard)
{
partStack->DragStart(IPresentablePart::Pointer(0), initialLocation, keyboard);
}
bool PartStack::MyStackPresentationSite::IsPartMoveable(
IPresentablePart::Pointer part)
{
return partStack->IsMoveable(part);
}
void PartStack::MyStackPresentationSite::SelectPart(
IPresentablePart::Pointer toSelect)
{
partStack->PresentationSelectionChanged(toSelect);
}
bool PartStack::MyStackPresentationSite::SupportsState(int state)
{
return partStack->SupportsState(state);
}
void PartStack::MyStackPresentationSite::SetState(int newState)
{
partStack->SetState(newState);
}
IPresentablePart::Pointer PartStack::MyStackPresentationSite::GetSelectedPart()
{
return partStack->GetSelectedPart();
}
// void AddSystemActions(IMenuManager menuManager) {
// PartStack.this.addSystemActions(menuManager);
// }
bool PartStack::MyStackPresentationSite::IsStackMoveable()
{
return partStack->CanMoveFolder();
}
void PartStack::MyStackPresentationSite::FlushLayout()
{
partStack->FlushLayout();
}
PartStack::PresentableVector PartStack::MyStackPresentationSite::GetPartList()
{
return partStack->GetPresentableParts();
}
std::string PartStack::MyStackPresentationSite::GetProperty(
const std::string& id)
{
return partStack->GetProperty(id);
}
PartStack::PartStack(WorkbenchPage* p, bool allowsStateChanges,
int appear, IPresentationFactory* fac) :
LayoutPart("PartStack"), page(p), isActive(true), allowStateChanges(
allowsStateChanges), appearance(appear), ignoreSelectionChanges(false),
factory(fac)
{
std::stringstream buf;
buf << "PartStack@" << this;
this->SetID(buf.str());
presentationSite = new MyStackPresentationSite(this);
}
bool PartStack::IsMoveable(IPresentablePart::Pointer part)
{
PartPane::Pointer pane = this->GetPaneFor(part);
Perspective::Pointer perspective = this->GetPage()->GetActivePerspective();
if (perspective == 0)
{
// Shouldn't happen -- can't have a ViewStack without a
// perspective
return true;
}
IWorkbenchPartReference::Pointer partRef = pane->GetPartReference();
if (partRef.Cast<IViewReference> () != 0)
return perspective->IsMoveable(partRef.Cast<IViewReference> ());
return true;
}
bool PartStack::SupportsState(int /*newState*/)
{
if (page->IsFixedLayout())
{
return false;
}
return allowStateChanges;
}
bool PartStack::CanMoveFolder()
{
if (appearance == PresentationFactoryUtil::ROLE_EDITOR)
return true;
Perspective::Pointer perspective = this->GetPage()->GetActivePerspective();
if (perspective == 0)
{
// Shouldn't happen -- can't have a ViewStack without a
// perspective
return false;
}
// We need to search if one of the presentations is not moveable
// if that's the case the whole folder should not be moveable
IStackPresentationSite::Pointer presenationSite;
if ((presenationSite = this->GetPresentationSite()) != 0)
{
std::list<IPresentablePart::Pointer> parts = presenationSite->GetPartList();
for (std::list<IPresentablePart::Pointer>::iterator iter = parts.begin(); iter
!= parts.end(); ++iter)
{
if (!presenationSite->IsPartMoveable(*iter))
{
return false;
}
}
}
return !perspective->IsFixedLayout();
}
void PartStack::DerefPart(StackablePart::Pointer toDeref)
{
if (appearance == PresentationFactoryUtil::ROLE_EDITOR)
EditorAreaHelper::DerefPart(toDeref);
else
this->GetPage()->GetActivePerspective()->GetPresentation()->DerefPart(
toDeref);
}
bool PartStack::AllowsDrop(PartPane::Pointer part)
{
PartStack::Pointer stack = part->GetContainer().Cast<PartStack> ();
if (stack != 0)
{
if (stack->appearance == this->appearance)
return true;
}
return false;
}
void PartStack::AddListener(IPropertyChangeListener::Pointer listener)
{
propEvents.AddListener(listener);
}
void PartStack::RemoveListener(IPropertyChangeListener::Pointer listener)
{
propEvents.RemoveListener(listener);
}
int PartStack::GetAppearance() const
{
return appearance;
}
std::string PartStack::GetID() const
{
return LayoutPart::GetID();
}
bool PartStack::IsStandalone()
{
return (appearance == PresentationFactoryUtil::ROLE_STANDALONE || appearance
== PresentationFactoryUtil::ROLE_STANDALONE_NOTITLE);
}
IPresentablePart::Pointer PartStack::GetSelectedPart()
{
return presentationCurrent.Cast<IPresentablePart> ();
}
IStackPresentationSite::Pointer PartStack::GetPresentationSite()
{
return presentationSite;
}
void PartStack::TestInvariants()
{
void* focusControl =
Tweaklets::Get(GuiWidgetsTweaklet::KEY)->GetFocusControl();
bool currentFound = false;
ChildVector children = this->GetChildren();
for (ChildVector::iterator iter = children.begin(); iter != children.end(); ++iter)
{
StackablePart::Pointer child = *iter;
// No 0 children allowed
poco_assert(child != 0)
; // "0 children are not allowed in PartStack"
// Ensure that all the PartPanes have an associated presentable part
IPresentablePart::Pointer part = this->GetPresentablePart(child);
if (!child->IsPlaceHolder())
{
poco_assert(part != 0); // "All PartPanes must have a non-0 IPresentablePart"
}
// Ensure that the child's backpointer points to this stack
IStackableContainer::Pointer childContainer = child->GetContainer();
// Disable tests for placeholders -- PartPlaceholder backpointers don't
// obey the usual rules -- they sometimes point to a container placeholder
// for this stack instead of the real stack.
if (!child->IsPlaceHolder())
{
// If the widgetry exists, the child's backpointer must point to us
poco_assert(childContainer.GetPointer() == this); // "PartStack has a child that thinks it has a different parent"
// If this child has focus, then ensure that it is selected and that we have
// the active appearance.
if (focusControl && Tweaklets::Get(GuiWidgetsTweaklet::KEY)->IsChild(child->GetControl(), focusControl))
{
poco_assert(child == current); // "The part with focus is not the selected part"
// focus check commented out since it fails when focus workaround in LayoutPart.setVisible is not present
// Assert.isTrue(getActive() == StackPresentation.AS_ACTIVE_FOCUS);
}
}
// Ensure that "current" points to a valid child
if (child == current)
{
currentFound = true;
}
// Test the child's internal state
child->TestInvariants();
}
// If we have at least one child, ensure that the "current" pointer points to one of them
if (this->GetPresentableParts().size()> 0)
{
poco_assert(currentFound);
StackPresentation::Pointer presentation = this->GetPresentation();
// If the presentation controls have focus, ensure that we have the active appearance
if (focusControl && Tweaklets::Get(GuiWidgetsTweaklet::KEY)->IsChild(presentation->GetControl(), focusControl))
{
poco_assert(this->GetActive() == StackPresentation::AS_ACTIVE_FOCUS);
// "The presentation has focus but does not have the active appearance"
}
}
// Check to that we're displaying the zoomed icon iff we're actually maximized
//poco_assert((this->GetState() == IStackPresentationSite::STATE_MAXIMIZED)
// == (this->GetContainer() != 0 && this->GetContainer()->ChildIsZoomed(this)));
}
void PartStack::DescribeLayout(std::string& buf) const
{
int activeState = this->GetActive();
if (activeState == StackPresentation::AS_ACTIVE_FOCUS)
{
buf.append("active "); //$NON-NLS-1$
}
else if (activeState == StackPresentation::AS_ACTIVE_NOFOCUS)
{
buf.append("active_nofocus "); //$NON-NLS-1$
}
buf.append("("); //$NON-NLS-1$
ChildVector children = this->GetChildren();
int visibleChildren = 0;
for (ChildVector::iterator iter = children.begin(); iter != children.end(); ++iter)
{
StackablePart::Pointer next = *iter;
if (!next->IsPlaceHolder())
{
if (iter != children.begin())
{
buf.append(", "); //$NON-NLS-1$
}
if (next == requestedCurrent)
{
buf.append("*"); //$NON-NLS-1$
}
next->DescribeLayout(buf);
visibleChildren++;
}
}
buf.append(")"); //$NON-NLS-1$
}
void PartStack::Add(StackablePart::Pointer child)
{
this->Add(child, Object::Pointer(0));
}
void PartStack::Add(StackablePart::Pointer newChild, Object::Pointer cookie)
{
children.push_back(newChild);
// Fix for bug 78470:
if(newChild->GetContainer().Cast<ContainerPlaceholder>() == 0)
{
newChild->SetContainer(IStackableContainer::Pointer(this));
}
this->ShowPart(newChild, cookie);
}
bool PartStack::AllowsAdd(StackablePart::Pointer /*toAdd*/)
{
return !this->IsStandalone();
}
bool PartStack::AllowsAutoFocus()
{
if (presentationSite->GetState() == IStackPresentationSite::STATE_MINIMIZED)
{
return false;
}
return LayoutPart::AllowsAutoFocus();
}
void PartStack::Close(const std::vector<IPresentablePart::Pointer>& parts)
{
for (unsigned int idx = 0; idx < parts.size(); idx++)
{
IPresentablePart::Pointer part = parts[idx];
this->Close(part);
}
}
void PartStack::Close(IPresentablePart::Pointer part)
{
if (!presentationSite->IsCloseable(part))
{
return;
}
PartPane::Pointer pane = this->GetPaneFor(part);
if (pane != 0)
{
pane->DoHide();
}
}
IPresentationFactory* PartStack::GetFactory()
{
if (factory != 0)
{
return factory;
}
return WorkbenchPlugin::GetDefault()->GetPresentationFactory();
}
void PartStack::CreateControl(void* parent)
{
if (this->GetPresentation() != 0)
{
return;
}
IPresentationFactory* factory = this->GetFactory();
PresentableVector partList = this->GetPresentableParts();
std::vector<IPresentablePart::Pointer> partVec(partList.begin(), partList.end());
PresentationSerializer serializer(partVec);
StackPresentation::Pointer presentation = PresentationFactoryUtil
::CreatePresentation(factory, appearance, parent,
presentationSite, &serializer, savedPresentationState);
this->CreateControl(parent, presentation);
Tweaklets::Get(GuiWidgetsTweaklet::KEY)->MoveBelow(this->GetControl(), 0);
}
IDropTarget::Pointer PartStack::GetDropTarget(Object::Pointer draggedObject, const Point& position)
{
if (draggedObject.Cast<PartPane>() == 0)
{
return IDropTarget::Pointer(0);
}
PartPane::Pointer pane = draggedObject.Cast<PartPane>();
if (this->IsStandalone()
|| !this->AllowsDrop(pane))
{
return IDropTarget::Pointer(0);
}
// Don't allow views to be dragged between windows
bool differentWindows = pane->GetWorkbenchWindow() != this->GetWorkbenchWindow();
bool editorDropOK = ((pane->GetPartReference().Cast<IEditorReference>() != 0) &&
pane->GetWorkbenchWindow()->GetWorkbench() ==
this->GetWorkbenchWindow()->GetWorkbench());
if (differentWindows && !editorDropOK)
{
return IDropTarget::Pointer(0);
}
StackDropResult::Pointer dropResult = this->GetPresentation()->DragOver(
this->GetControl(), position);
if (dropResult == 0)
{
return IDropTarget::Pointer(0);
}
return this->CreateDropTarget(pane, dropResult);
}
void PartStack::SetBounds(const Rectangle& r)
{
if (this->GetPresentation() != 0)
{
this->GetPresentation()->SetBounds(r);
}
}
IDropTarget::Pointer PartStack::CreateDropTarget(PartPane::Pointer pane, StackDropResult::Pointer result)
{
dropResult->SetTarget(PartStack::Pointer(this), pane, result);
return dropResult;
}
void PartStack::SetActive(bool isActive)
{
this->isActive = isActive;
// Add all visible children to the presentation
for(ChildVector::iterator iter = children.begin(); iter != children.end(); ++iter)
{
(*iter)->SetContainer(isActive ? IStackableContainer::Pointer(this) : IStackableContainer::Pointer(0));
}
for (PresentableVector::iterator iter = presentableParts.begin();
iter != presentableParts.end(); ++iter)
{
PresentablePart::Pointer next = iter->Cast<PresentablePart>();
next->EnableInputs(isActive);
next->EnableOutputs(isActive);
}
}
void PartStack::CreateControl(void* /*parent*/, StackPresentation::Pointer presentation)
{
poco_assert(this->GetPresentation() == 0);
if (presentationSite->GetPresentation() != 0)
{
return;
}
presentationSite->SetPresentation(presentation);
// Add all visible children to the presentation
// Use a copy of the current set of children to avoid a ConcurrentModificationException
// if a part is added to the same stack while iterating over the children (bug 78470)
ChildVector childParts(children);
for (ChildVector::iterator iter = childParts.begin(); iter != childParts.end(); ++iter)
{
this->ShowPart(*iter, Object::Pointer(0));
}
if (savedPresentationState != 0)
{
PresentableVector partList = this->GetPresentableParts();
std::vector<IPresentablePart::Pointer> partVec(partList.begin(), partList.end());
PresentationSerializer serializer(partVec);
presentation->RestoreState(&serializer, savedPresentationState);
}
//void* ctrl = this->GetPresentation()->GetControl();
//TODO control setData ?
//ctrl.setData(this);
// We should not have a placeholder selected once we've created the widgetry
if (requestedCurrent != 0 && requestedCurrent->IsPlaceHolder())
{
requestedCurrent = 0;
this->UpdateContainerVisibleTab();
}
this->RefreshPresentationSelection();
}
void PartStack::SavePresentationState()
{
if (this->GetPresentation() == 0)
{
return;
}
{// Save the presentation's state before disposing it
XMLMemento::Pointer memento = XMLMemento
::CreateWriteRoot(WorkbenchConstants::TAG_PRESENTATION);
memento->PutString(WorkbenchConstants::TAG_ID, this->GetFactory()->GetId());
std::list<IPresentablePart::Pointer> parts(this->GetPresentableParts());
PresentationSerializer serializer(std::vector<IPresentablePart::Pointer>(parts.begin(), parts.end()));
this->GetPresentation()->SaveState(&serializer, memento);
// Store the memento in savedPresentationState
savedPresentationState = memento;
}
}
PartStack::~PartStack()
{
//BERRY_INFO << "DELETING PARTSTACK";
}
void PartStack::Dispose()
{
if (this->GetPresentation() == 0)
{
return;
}
this->SavePresentationState();
// for (PresentableVector::iterator iter = presentableParts.begin();
// iter != presentableParts.end(); ++iter)
// {
// iter->Cast<PresentablePart>()->Dispose();
// }
presentableParts.clear();
presentationCurrent = 0;
current = 0;
this->FireInternalPropertyChange(PROP_SELECTION);
}
void PartStack::FindSashes(PartPane::Sashes& sashes)
{
ILayoutContainer::Pointer container = this->GetContainer();
if (container != 0)
{
container->FindSashes(LayoutPart::Pointer(this), sashes);
}
}
Rectangle PartStack::GetBounds()
{
if (this->GetPresentation() == 0)
{
return Rectangle(0, 0, 0, 0);
}
return Tweaklets::Get(GuiWidgetsTweaklet::KEY)->GetBounds(this->GetPresentation()->GetControl());
}
std::list<StackablePart::Pointer> PartStack::GetChildren() const
{
return children;
}
void* PartStack::GetControl()
{
StackPresentation::Pointer presentation = this->GetPresentation();
if (presentation == 0)
{
return 0;
}
return presentation->GetControl();
}
/**
* Answer the number of children.
*/
PartStack::ChildVector::size_type PartStack::GetItemCount()
{
if (this->GetPresentation() == 0)
{
return children.size();
}
return this->GetPresentableParts().size();
}
PartPane::Pointer PartStack::GetPaneFor(IPresentablePart::Pointer part)
{
if (part == 0 || part.Cast<PresentablePart>() == 0)
{
return PartPane::Pointer(0);
}
return part.Cast<PresentablePart>()->GetPane();
}
void* PartStack::GetParent()
{
return Tweaklets::Get(GuiWidgetsTweaklet::KEY)->GetParent(this->GetControl());
}
PartStack::PresentableVector PartStack::GetPresentableParts()
{
return presentableParts;
}
PresentablePart::Pointer PartStack::GetPresentablePart(StackablePart::Pointer pane)
{
for (PresentableVector::iterator iter = presentableParts.begin(); iter != presentableParts.end(); ++iter)
{
PresentablePart::Pointer part = iter->Cast<PresentablePart>();
if (part->GetPane() == pane)
{
return part;
}
}
return PresentablePart::Pointer(0);
}
StackPresentation::Pointer PartStack::GetPresentation()
{
return presentationSite->GetPresentation();
}
StackablePart::Pointer PartStack::GetSelection()
{
return current;
}
void PartStack::PresentationSelectionChanged(IPresentablePart::Pointer newSelection)
{
// Ignore selection changes that occur as a result of removing a part
if (ignoreSelectionChanges)
{
return;
}
PartPane::Pointer newPart = this->GetPaneFor(newSelection);
// This method should only be called on objects that are already in the layout
poco_assert(newPart != 0);
if (newPart == requestedCurrent)
{
return;
}
this->SetSelection(newPart);
if (newPart != 0)
{
newPart->SetFocus();
}
}
void PartStack::Remove(StackablePart::Pointer child)
{
IPresentablePart::Pointer presentablePart = this->GetPresentablePart(child);
// Need to remove it from the list of children before notifying the presentation
// since it may setVisible(false) on the part, leading to a partHidden notification,
// during which findView must not find the view being removed. See bug 60039.
children.remove(child);
StackPresentation::Pointer presentation = this->GetPresentation();
if (presentablePart != 0 && presentation != 0)
{
ignoreSelectionChanges = true;
presentableParts.remove(presentablePart);
presentation->RemovePart(presentablePart);
presentablePart = 0;
ignoreSelectionChanges = false;
}
if (this->GetPresentation() != 0)
{
child->SetContainer(IStackableContainer::Pointer(0));
}
if (child == requestedCurrent)
{
this->UpdateContainerVisibleTab();
}
}
void PartStack::Reparent(void* newParent)
{
void* control = this->GetControl();
- GuiWidgetsTweaklet::Pointer tweaklet = Tweaklets::Get(GuiWidgetsTweaklet::KEY);
+ GuiWidgetsTweaklet* tweaklet = Tweaklets::Get(GuiWidgetsTweaklet::KEY);
if ((control == 0) || (tweaklet->GetParent(control) == newParent)
|| !tweaklet->IsReparentable(control))
{
return;
}
LayoutPart::Reparent(newParent);
for(ChildVector::iterator iter = children.begin();
iter != children.end(); ++iter)
{
(*iter)->Reparent(newParent);
}
}
void PartStack::Replace(StackablePart::Pointer oldChild, StackablePart::Pointer newChild)
{
ChildVector::iterator loc = std::find(children.begin(), children.end(), oldChild);
int idx = 0;
int numPlaceholders = 0;
//subtract the number of placeholders still existing in the list
//before this one - they wont have parts.
for (ChildVector::iterator iter = children.begin(); iter != loc; ++iter, ++idx)
{
if ((*iter)->IsPlaceHolder())
{
numPlaceholders++;
}
}
ObjectInt::Pointer cookie(new ObjectInt(idx - numPlaceholders));
children.insert(loc, newChild);
this->ShowPart(newChild, cookie);
if (oldChild == requestedCurrent && newChild.Cast<PartPane>() != 0)
{
this->SetSelection(newChild.Cast<PartPane>());
}
this->Remove(oldChild);
}
int PartStack::ComputePreferredSize(bool width, int availableParallel,
int availablePerpendicular, int preferredParallel)
{
return this->GetPresentation()->ComputePreferredSize(width, availableParallel,
availablePerpendicular, preferredParallel);
}
int PartStack::GetSizeFlags(bool horizontal)
{
StackPresentation::Pointer presentation = this->GetPresentation();
if (presentation != 0)
{
return presentation->GetSizeFlags(horizontal);
}
return 0;
}
bool PartStack::RestoreState(IMemento::Pointer memento)
{
// Read the active tab.
std::string activeTabID; memento->GetString(WorkbenchConstants::TAG_ACTIVE_PAGE_ID, activeTabID);
// Read the page elements.
std::vector<IMemento::Pointer> children = memento->GetChildren(WorkbenchConstants::TAG_PAGE);
// Loop through the page elements.
for (std::size_t i = 0; i < children.size(); i++)
{
// Get the info details.
IMemento::Pointer childMem = children[i];
std::string partID; childMem->GetString(WorkbenchConstants::TAG_CONTENT, partID);
// Create the part.
StackablePart::Pointer part(new PartPlaceholder(partID));
part->SetContainer(IStackableContainer::Pointer(this));
this->Add(part);
//1FUN70C: ITPUI:WIN - Shouldn't set Container when not active
//part.setContainer(this);
if (partID == activeTabID)
{
this->SetSelection(part);
// Mark this as the active part.
//current = part;
}
}
//IPreferenceStore preferenceStore = PrefUtil.getAPIPreferenceStore();
//boolean useNewMinMax = preferenceStore.getBoolean(IWorkbenchPreferenceConstants.ENABLE_NEW_MIN_MAX);
int expanded;
if (memento->GetInteger(WorkbenchConstants::TAG_EXPANDED, expanded))
{
//StartupThreading.runWithoutExceptions(new StartupRunnable()
// {
// void runWithException() throws Throwable
// {
SetState(expanded != IStackPresentationSite::STATE_MINIMIZED ? IStackPresentationSite::STATE_RESTORED
: IStackPresentationSite::STATE_MINIMIZED);
// }
// });
}
else
{
SetState(IStackPresentationSite::STATE_RESTORED);
}
int appearance;
if (memento->GetInteger(WorkbenchConstants::TAG_APPEARANCE, appearance))
{
this->appearance = appearance;
}
// Determine if the presentation has saved any info here
savedPresentationState = 0;
std::vector<IMemento::Pointer> presentationMementos(memento
->GetChildren(WorkbenchConstants::TAG_PRESENTATION));
for (std::size_t idx = 0; idx < presentationMementos.size(); idx++)
{
IMemento::Pointer child = presentationMementos[idx];
std::string id; child->GetString(WorkbenchConstants::TAG_ID, id);
if (id == GetFactory()->GetId())
{
savedPresentationState = child;
break;
}
}
IMemento::Pointer propertiesState = memento->GetChild(WorkbenchConstants::TAG_PROPERTIES);
if (propertiesState)
{
std::vector<IMemento::Pointer> props(propertiesState->GetChildren(WorkbenchConstants::TAG_PROPERTY));
for (std::size_t i = 0; i < props.size(); i++)
{
std::string id = props[i]->GetID();
properties.insert(std::make_pair(id, props[i]->GetTextData()));
}
}
//return new Status(IStatus.OK, PlatformUI.PLUGIN_ID, 0, "", 0); //$NON-NLS-1$
return true;
}
void PartStack::SetVisible(bool makeVisible)
{
void* ctrl = this->GetControl();
bool useShortcut = makeVisible || !isActive;
if (ctrl != 0 && useShortcut)
{
if (makeVisible == Tweaklets::Get(GuiWidgetsTweaklet::KEY)->GetVisible(ctrl))
{
return;
}
}
if (makeVisible)
{
for (PresentableVector::iterator iter = presentableParts.begin();
iter != presentableParts.end(); ++iter)
{
PresentablePart::Pointer next = iter->Cast<PresentablePart>();
next->EnableInputs(isActive);
next->EnableOutputs(isActive);
}
}
LayoutPart::SetVisible(makeVisible);
StackPresentation::Pointer presentation = this->GetPresentation();
if (presentation != 0)
{
presentation->SetVisible(makeVisible);
}
if (!makeVisible)
{
for (PresentableVector::iterator iter = presentableParts.begin();
iter != presentableParts.end(); ++iter)
{
PresentablePart::Pointer next = iter->Cast<PresentablePart>();
next->EnableInputs(false);
}
}
}
bool PartStack::SaveState(IMemento::Pointer memento)
{
if (GetAppearance() != PresentationFactoryUtil::ROLE_EDITOR)
{
// Save the active tab.
if (requestedCurrent)
{
memento->PutString(WorkbenchConstants::TAG_ACTIVE_PAGE_ID, requestedCurrent
->GetCompoundId());
}
// Write out the presentable parts (in order)
Poco::HashSet<std::string> cachedIds;
PartStack::PresentableVector pparts(GetPresentableParts());
for (PartStack::PresentableVector::iterator ppIter = pparts.begin();
ppIter != pparts.end(); ++ppIter)
{
PresentablePart::Pointer presPart = ppIter->Cast<PresentablePart>();
IMemento::Pointer childMem = memento->CreateChild(WorkbenchConstants::TAG_PAGE);
PartPane::Pointer part = presPart->GetPane();
std::string tabText = part->GetPartReference()->GetPartName();
childMem->PutString(WorkbenchConstants::TAG_LABEL, tabText);
childMem->PutString(WorkbenchConstants::TAG_CONTENT, presPart->GetPane()->GetPlaceHolderId());
// Cache the id so we don't write it out later
cachedIds.insert(presPart->GetPane()->GetPlaceHolderId());
}
for (ChildVector::iterator iter = children.begin();
iter != children.end(); ++iter)
{
StackablePart::Pointer next = *iter;
PartPane::Pointer part;
if (part = next.Cast<PartPane>())
{
// Have we already written it out?
if (cachedIds.find(part->GetPlaceHolderId()) != cachedIds.end())
continue;
}
IMemento::Pointer childMem = memento
->CreateChild(WorkbenchConstants::TAG_PAGE);
std::string tabText = "LabelNotFound";
if (part)
{
tabText = part->GetPartReference()->GetPartName();
}
childMem->PutString(WorkbenchConstants::TAG_LABEL, tabText);
childMem->PutString(WorkbenchConstants::TAG_CONTENT, next->GetId());
}
}
// IPreferenceStore preferenceStore = PrefUtil.getAPIPreferenceStore();
// boolean useNewMinMax = preferenceStore.getBoolean(IWorkbenchPreferenceConstants.ENABLE_NEW_MIN_MAX);
// if (useNewMinMax)
// {
memento->PutInteger(WorkbenchConstants::TAG_EXPANDED, presentationSite->GetState());
// }
// else
// {
// memento
// .putInteger(
// IWorkbenchConstants.TAG_EXPANDED,
// (presentationSite.getState() == IStackPresentationSite.STATE_MINIMIZED) ? IStackPresentationSite.STATE_MINIMIZED
// : IStackPresentationSite.STATE_RESTORED);
// }
memento->PutInteger(WorkbenchConstants::TAG_APPEARANCE, appearance);
this->SavePresentationState();
if (savedPresentationState)
{
IMemento::Pointer presentationState = memento
->CreateChild(WorkbenchConstants::TAG_PRESENTATION);
presentationState->PutMemento(savedPresentationState);
}
if (!properties.empty())
{
IMemento::Pointer propertiesState = memento->CreateChild(WorkbenchConstants::TAG_PROPERTIES);
for (std::map<std::string, std::string>::iterator iterator = properties.begin();
iterator != properties.end(); ++iterator)
{
if (iterator->second.empty()) continue;
IMemento::Pointer prop = propertiesState->CreateChild(WorkbenchConstants::TAG_PROPERTY, iterator->first);
prop->PutTextData(iterator->second);
}
}
//return new Status(IStatus.OK, PlatformUI.PLUGIN_ID, 0, "", 0);
return true;
}
WorkbenchPage::Pointer PartStack::GetPage()
{
// WorkbenchWindow::Pointer window = this->GetWorkbenchWindow().Cast<WorkbenchWindow>();
//
// if (window == 0)
// {
// return 0;
// }
//
// return window->GetActivePage().Cast<WorkbenchPage>();
return WorkbenchPage::Pointer(page);
}
void PartStack::SetActive(int activeState)
{
// if (activeState == StackPresentation::AS_ACTIVE_FOCUS && isMinimized)
// {
// setMinimized(false);
// }
presentationSite->SetActive(activeState);
}
int PartStack::GetActive() const
{
return presentationSite->GetActive();
}
void PartStack::SetSelection(StackablePart::Pointer part)
{
if (part == requestedCurrent)
{
return;
}
requestedCurrent = part;
this->RefreshPresentationSelection();
}
void PartStack::UpdateActions(PresentablePart::Pointer /*current*/)
{
}
void PartStack::HandleDeferredEvents()
{
LayoutPart::HandleDeferredEvents();
this->RefreshPresentationSelection();
}
void PartStack::RefreshPresentationSelection()
{
// If deferring UI updates, exit.
if (this->IsDeferred())
{
return;
}
// If the presentation is already displaying the desired part, then there's nothing
// to do.
if (current == requestedCurrent)
{
return;
}
StackPresentation::Pointer presentation = this->GetPresentation();
if (presentation != 0)
{
presentationCurrent = this->GetPresentablePart(requestedCurrent);
// this->UupdateActions(presentationCurrent);
if (presentationCurrent != 0 && presentation != 0)
{
requestedCurrent->CreateControl(this->GetParent());
- GuiWidgetsTweaklet::Pointer tweaklet = Tweaklets::Get(GuiWidgetsTweaklet::KEY);
+ GuiWidgetsTweaklet* tweaklet = Tweaklets::Get(GuiWidgetsTweaklet::KEY);
if (tweaklet->GetParent(requestedCurrent->GetControl()) !=
tweaklet->GetParent(this->GetControl()))
{
requestedCurrent->Reparent(tweaklet->GetParent(this->GetControl()));
}
presentation->SelectPart(presentationCurrent);
}
// Update the return value of getVisiblePart
current = requestedCurrent;
this->FireInternalPropertyChange(PROP_SELECTION);
}
}
int PartStack::GetState()
{
return presentationSite->GetState();
}
void PartStack::SetState(const int newState)
{
int oldState = presentationSite->GetState();
if (!this->SupportsState(newState) || newState == oldState)
{
return;
}
// WorkbenchWindow::Pointer wbw = this->GetPage()->GetWorkbenchWindow().Cast<WorkbenchWindow>();
// if (wbw == 0 || wbw->GetShell() == 0 || wbw->GetActivePage() == 0)
// return;
//
// WorkbenchPage::Pointer page = wbw->GetActivePage();
//
// bool useNewMinMax = Perspective::UseNewMinMax(page->GetActivePerspective());
//
// // we have to fiddle with the zoom behavior to satisfy Intro req's
// // by usning the old zoom behavior for its stack
// if (newState == IStackPresentationSite::STATE_MAXIMIZED)
// useNewMinMax = useNewMinMax; // && !this->IsIntroInStack();
// else if (newState == IStackPresentationSite::STATE_RESTORED)
// {
// PartStack::Pointer maxStack = page->GetActivePerspective()->GetPresentation()->GetMaximizedStack();
// useNewMinMax = useNewMinMax && maxStack == this;
// }
//
// if (useNewMinMax)
// {
// //StartupThreading.runWithoutExceptions(new StartupRunnable()
// // {
// // void runWithException() throws Throwable
// // {
// wbw->GetPageComposite()->SetRedraw(false);
// try
// {
// if (newState == IStackPresentationSite::STATE_MAXIMIZED)
// {
// smartZoom();
// }
// else if (oldState == IStackPresentationSite::STATE_MAXIMIZED)
// {
// smartUnzoom();
// }
//
// if (newState == IStackPresentationSite::STATE_MINIMIZED)
// {
// setMinimized(true);
// }
//
// wbw.getPageComposite().setRedraw(true);
//
// // Force a redraw (fixes Mac refresh)
// wbw.getShell().redraw();
//
// }
// catch (...)
// {
// wbw.getPageComposite().setRedraw(true);
//
// // Force a redraw (fixes Mac refresh)
// wbw.getShell().redraw();
// }
//
// this->SetPresentationState(newState);
// // }
// // });
// }
// else
// {
//// bool minimized = (newState == IStackPresentationSite::STATE_MINIMIZED);
//// this->SetMinimized(minimized);
////
//// if (newState == IStackPresentationSite::STATE_MAXIMIZED)
//// {
//// requestZoomIn();
//// }
//// else if (oldState == IStackPresentationSite::STATE_MAXIMIZED)
//// {
//// requestZoomOut();
////
//// if (newState == IStackPresentationSite::STATE_MINIMIZED)
//// setMinimized(true);
//// }
// }
}
void PartStack::ShowPart(StackablePart::Pointer part, Object::Pointer cookie)
{
if (this->GetPresentation() == 0)
{
return;
}
if (part->IsPlaceHolder())
{
part->SetContainer(IStackableContainer::Pointer(this));
return;
}
if (part.Cast<PartPane>() == 0)
{
WorkbenchPlugin::Log("Incorrect part " + part->GetId() + "contained in a part stack");
return;
}
PartPane::Pointer pane = part.Cast<PartPane>();
PresentablePart::Pointer presentablePart(new PresentablePart(pane, Tweaklets::Get(GuiWidgetsTweaklet::KEY)->GetParent(this->GetControl())));
presentableParts.push_back(presentablePart);
if (isActive)
{
part->SetContainer(IStackableContainer::Pointer(this));
// The active part should always be enabled
if (part->GetControl() != 0)
Tweaklets::Get(GuiWidgetsTweaklet::KEY)->SetEnabled(part->GetControl(), true);
}
presentationSite->GetPresentation()->AddPart(presentablePart, cookie);
if (requestedCurrent == 0)
{
this->SetSelection(pane);
}
// if (childObscuredByZoom(part))
// {
// presentablePart.enableInputs(false);
// }
}
void PartStack::UpdateContainerVisibleTab()
{
ChildVector parts = this->GetChildren();
if (parts.size() < 1)
{
this->SetSelection(StackablePart::Pointer(0));
return;
}
PartPane::Pointer selPart;
int topIndex = 0;
WorkbenchPage::Pointer page = this->GetPage();
if (page != 0)
{
std::vector<IWorkbenchPartReference::Pointer> sortedParts = page->GetSortedParts();
for (ChildVector::iterator partIter = parts.begin();
partIter != parts.end(); ++partIter)
{
if (partIter->Cast<PartPane>() != 0)
{
IWorkbenchPartReference::Pointer part = partIter->Cast<PartPane>()
->GetPartReference();
int index = static_cast<int>(std::find(sortedParts.begin(), sortedParts.end(), part) - sortedParts.begin());
if (index >= topIndex)
{
topIndex = index;
selPart = partIter->Cast<PartPane>();
}
}
}
}
if (selPart == 0)
{
PresentableVector presentableParts = this->GetPresentableParts();
if (presentableParts.size() != 0)
{
IPresentablePart::Pointer part = presentableParts.front();
selPart = this->GetPaneFor(part);
}
}
this->SetSelection(selPart);
}
void PartStack::ShowSystemMenu()
{
//this->GetPresentation()->ShowSystemMenu();
}
void PartStack::ShowPaneMenu()
{
//this->GetPresentation()->ShowPaneMenu();
}
void PartStack::ShowPartList()
{
this->GetPresentation()->ShowPartList();
}
std::vector<void*> PartStack::GetTabList(StackablePart::Pointer part)
{
if (part != 0)
{
IPresentablePart::Pointer presentablePart = this->GetPresentablePart(part);
StackPresentation::Pointer presentation = this->GetPresentation();
if (presentablePart != 0 && presentation != 0)
{
return presentation->GetTabList(presentablePart);
}
}
return std::vector<void*>();
}
void PartStack::DragStart(IPresentablePart::Pointer beingDragged, Point& initialLocation,
bool keyboard)
{
if (beingDragged == 0)
{
this->PaneDragStart(PartPane::Pointer(0), initialLocation, keyboard);
}
else
{
if (presentationSite->IsPartMoveable(beingDragged))
{
PartPane::Pointer pane = this->GetPaneFor(beingDragged);
if (pane != 0)
{
this->PaneDragStart(pane, initialLocation, keyboard);
}
}
}
}
void PartStack::PaneDragStart(PartPane::Pointer pane, Point& initialLocation,
bool keyboard)
{
if (pane == 0)
{
if (this->CanMoveFolder())
{
if (presentationSite->GetState() == IStackPresentationSite::STATE_MAXIMIZED)
{
// Calculate where the initial location was BEFORE the 'restore'...as a percentage
Rectangle bounds = Geometry::ToDisplay(this->GetParent(),
Tweaklets::Get(GuiWidgetsTweaklet::KEY)->GetBounds(this->GetPresentation()->GetControl()));
float xpct = (initialLocation.x - bounds.x) / (float)(bounds.width);
float ypct = (initialLocation.y - bounds.y) / (float)(bounds.height);
// Only restore if we're dragging views/view stacks
if (this->GetAppearance() != PresentationFactoryUtil::ROLE_EDITOR)
this->SetState(IStackPresentationSite::STATE_RESTORED);
// Now, adjust the initial location to be within the bounds of the restored rect
bounds = Geometry::ToDisplay(this->GetParent(),
Tweaklets::Get(GuiWidgetsTweaklet::KEY)->GetBounds(this->GetPresentation()->GetControl()));
initialLocation.x = (int) (bounds.x + (xpct * bounds.width));
initialLocation.y = (int) (bounds.y + (ypct * bounds.height));
}
DragUtil::PerformDrag(Object::Pointer(this), Geometry::ToDisplay(this->GetParent(),
Tweaklets::Get(GuiWidgetsTweaklet::KEY)->GetBounds(this->GetPresentation()->GetControl())),
initialLocation, !keyboard);
}
}
else
{
if (presentationSite->GetState() == IStackPresentationSite::STATE_MAXIMIZED)
{
// Calculate where the initial location was BEFORE the 'restore'...as a percentage
Rectangle bounds = Geometry::ToDisplay(this->GetParent(),
Tweaklets::Get(GuiWidgetsTweaklet::KEY)->GetBounds(this->GetPresentation()->GetControl()));
float xpct = (initialLocation.x - bounds.x) / (float)(bounds.width);
float ypct = (initialLocation.y - bounds.y) / (float)(bounds.height);
// Only restore if we're dragging views/view stacks
if (this->GetAppearance() != PresentationFactoryUtil::ROLE_EDITOR)
this->SetState(IStackPresentationSite::STATE_RESTORED);
// Now, adjust the initial location to be within the bounds of the restored rect
// See bug 100908
bounds = Geometry::ToDisplay(this->GetParent(),
Tweaklets::Get(GuiWidgetsTweaklet::KEY)->GetBounds(this->GetPresentation()->GetControl()));
initialLocation.x = (int) (bounds.x + (xpct * bounds.width));
initialLocation.y = (int) (bounds.y + (ypct * bounds.height));
}
DragUtil::PerformDrag(pane, Geometry::ToDisplay(this->GetParent(),
Tweaklets::Get(GuiWidgetsTweaklet::KEY)->GetBounds(this->GetPresentation()->GetControl())),
initialLocation, !keyboard);
}
}
IMemento::Pointer PartStack::GetSavedPresentationState()
{
return savedPresentationState;
}
void PartStack::FireInternalPropertyChange(int id)
{
ObjectInt::Pointer val(new ObjectInt(id));
Object::Pointer source(this);
PropertyChangeEvent::Pointer event(new PropertyChangeEvent(source,
IWorkbenchPartConstants::INTEGER_PROPERTY, val, val));
propEvents.propertyChange(event);
}
std::string PartStack::GetProperty(const std::string& id)
{
return properties[id];
}
void PartStack::SetProperty(const std::string& id, const std::string& value)
{
if (value == "")
{
properties.erase(id);
}
else
{
properties.insert(std::make_pair(id, value));
}
}
void PartStack::CopyAppearanceProperties(PartStack::Pointer copyTo)
{
copyTo->appearance = this->appearance;
if (!properties.empty())
{
for (std::map<std::string, std::string>::iterator iter = properties.begin();
iter != properties.end(); ++iter)
{
copyTo->SetProperty(iter->first, iter->second);
}
}
}
void PartStack::ResizeChild(StackablePart::Pointer /*childThatChanged*/)
{
}
}
diff --git a/BlueBerry/Bundles/org.blueberry.ui/src/internal/berryPerspective.cpp b/BlueBerry/Bundles/org.blueberry.ui/src/internal/berryPerspective.cpp
index f8dff83130..9f12ed0d71 100644
--- a/BlueBerry/Bundles/org.blueberry.ui/src/internal/berryPerspective.cpp
+++ b/BlueBerry/Bundles/org.blueberry.ui/src/internal/berryPerspective.cpp
@@ -1,1765 +1,1765 @@
/*=========================================================================
Program: BlueBerry Platform
Language: C++
Date: $Date$
Version: $Revision$
Copyright (c) German Cancer Research Center, Division of Medical and
Biological Informatics. All rights reserved.
See MITKCopyright.txt or http://www.mitk.org/copyright.html for details.
This software is distributed WITHOUT ANY WARRANTY; without even
the implied warranty of MERCHANTABILITY or FITNESS FOR A PARTICULAR
PURPOSE. See the above copyright notices for more information.
=========================================================================*/
+#include "../tweaklets/berryGuiWidgetsTweaklet.h"
+
#include "berryPerspective.h"
#include "berryPerspectiveHelper.h"
#include "berryWorkbenchPlugin.h"
#include "berryWorkbenchConstants.h"
#include "berryPerspectiveExtensionReader.h"
#include "berryEditorSashContainer.h"
#include "berryPartSite.h"
#include "berryViewSite.h"
#include "berryEditorAreaHelper.h"
#include "intro/berryIntroConstants.h"
#include "../dialogs/berryMessageDialog.h"
#include "berryWorkbenchWindow.h"
-#include "../tweaklets/berryGuiWidgetsTweaklet.h"
-
#include "../presentations/berryIStackPresentationSite.h"
namespace berry
{
const std::string Perspective::VERSION_STRING = "0.016";
Perspective::Perspective(PerspectiveDescriptor::Pointer desc,
WorkbenchPage::Pointer page)
: descriptor(desc)
{
this->Init(page);
if (desc.IsNotNull())
{
this->CreatePresentation(desc);
}
}
Perspective::Perspective(WorkbenchPage::Pointer page)
{
this->Init(page);
}
void Perspective::Init(WorkbenchPage::Pointer page)
{
editorHidden = false;
editorAreaState = IStackPresentationSite::STATE_RESTORED;
fixed = false;
presentation = 0;
shouldHideEditorsOnActivate = false;
this->page = page.GetPointer();
this->editorArea = page->GetEditorPresentation()->GetLayoutPart();
this->viewFactory = page->GetViewFactory();
}
bool Perspective::BringToTop(IViewReference::Pointer ref)
{
return presentation->BringPartToTop(this->GetPane(ref));
}
bool Perspective::ContainsView(IViewPart::Pointer view)
{
IViewSite::Pointer site = view->GetViewSite();
IViewReference::Pointer ref = this->FindView(site->GetId(), site->GetSecondaryId());
if (ref.IsNull())
{
return false;
}
return (view.Cast<IWorkbenchPart>() == ref->GetPart(false));
}
void Perspective::CreatePresentation(PerspectiveDescriptor::Pointer persp)
{
if (persp->HasCustomDefinition())
{
this->LoadCustomPersp(persp);
}
else
{
this->LoadPredefinedPersp(persp);
}
}
Perspective::~Perspective()
{
// Get rid of presentation.
if (presentation == 0)
{
DisposeViewRefs();
return;
}
presentation->Deactivate();
// Release each view.
std::vector<IViewReference::Pointer> refs(this->GetViewReferences());
for (std::vector<IViewReference::Pointer>::size_type i = 0, length = refs.size(); i < length; i++)
{
this->GetViewFactory()->ReleaseView(refs[i]);
}
mapIDtoViewLayoutRec.clear();
}
void Perspective::DisposeViewRefs() {
if (!memento) {
return;
}
std::vector<IMemento::Pointer> views(memento->GetChildren(WorkbenchConstants::TAG_VIEW));
for (std::size_t x = 0; x < views.size(); x++) {
// Get the view details.
IMemento::Pointer childMem = views[x];
std::string id; childMem->GetString(WorkbenchConstants::TAG_ID, id);
// skip creation of the intro reference - it's handled elsewhere.
if (id == IntroConstants::INTRO_VIEW_ID) {
continue;
}
std::string secondaryId = ViewFactory::ExtractSecondaryId(id);
if (!secondaryId.empty()) {
id = ViewFactory::ExtractPrimaryId(id);
}
std::string removed;
childMem->GetString(WorkbenchConstants::TAG_REMOVED, removed);
if (removed != "true") {
IViewReference::Pointer ref = viewFactory->GetView(id, secondaryId);
if (ref) {
viewFactory->ReleaseView(ref);
}
}
}
}
IViewReference::Pointer Perspective::FindView(const std::string& viewId)
{
return this->FindView(viewId, "");
}
IViewReference::Pointer Perspective::FindView(const std::string& id, const std::string& secondaryId)
{
std::vector<IViewReference::Pointer> refs(this->GetViewReferences());
for (unsigned int i = 0; i < refs.size(); i++)
{
IViewReference::Pointer ref = refs[i];
if (id == ref->GetId()
&& (secondaryId == ref->GetSecondaryId()))
{
return ref;
}
}
return IViewReference::Pointer(0);
}
void* Perspective::GetClientComposite()
{
return page->GetClientComposite();
}
IPerspectiveDescriptor::Pointer Perspective::GetDesc()
{
return descriptor;
}
PartPane::Pointer Perspective::GetPane(IViewReference::Pointer ref)
{
return ref.Cast<WorkbenchPartReference>()->GetPane();
}
std::vector<std::string> Perspective::GetPerspectiveShortcuts()
{
return perspectiveShortcuts;
}
PerspectiveHelper* Perspective::GetPresentation() const
{
return presentation;
}
std::vector<std::string> Perspective::GetShowViewShortcuts()
{
return showViewShortcuts;
}
ViewFactory* Perspective::GetViewFactory()
{
return viewFactory;
}
std::vector<IViewReference::Pointer> Perspective::GetViewReferences()
{
// Get normal views.
if (presentation == 0)
{
return std::vector<IViewReference::Pointer>();
}
std::vector<PartPane::Pointer> panes;
presentation->CollectViewPanes(panes);
std::vector<IViewReference::Pointer> result;
// List fastViews = (fastViewManager != 0) ?
// fastViewManager.getFastViews(0)
// : new ArrayList();
// IViewReference[] resultArray = new IViewReference[panes.size()
// + fastViews.size()];
//
// // Copy fast views.
// int nView = 0;
// for (int i = 0; i < fastViews.size(); i++)
// {
// resultArray[nView] = (IViewReference) fastViews.get(i);
// ++nView;
// }
// Copy normal views.
for (std::vector<PartPane::Pointer>::iterator iter = panes.begin();
iter != panes.end(); ++iter)
{
PartPane::Pointer pane = *iter;
result.push_back(pane->GetPartReference().Cast<IViewReference>());
}
return result;
}
void Perspective::HideEditorArea()
{
if (!this->IsEditorAreaVisible())
{
return;
}
// Show the editor in the appropriate location
if (this->UseNewMinMax(Perspective::Pointer(this)))
{
// If it's the currently maximized part we have to restore first
// if (this->GetPresentation().getMaximizedStack().Cast<EditorStack>() != 0)
// {
// getPresentation().getMaximizedStack().setState(IStackPresentationSite.STATE_RESTORED);
// }
bool isMinimized = editorAreaState == IStackPresentationSite::STATE_MINIMIZED;
if (!isMinimized)
this->HideEditorAreaLocal();
//else
// this->SetEditorAreaTrimVisibility(false);
}
else
{
this->HideEditorAreaLocal();
}
editorHidden = true;
}
void Perspective::HideEditorAreaLocal()
{
if (editorHolder != 0)
{
return;
}
// Replace the editor area with a placeholder so we
// know where to put it back on show editor area request.
editorHolder = new ContainerPlaceholder(editorArea->GetID());
presentation->GetLayout()->Replace(editorArea, editorHolder);
}
bool Perspective::HideView(IViewReference::Pointer ref)
{
// If the view is locked just return.
PartPane::Pointer pane = this->GetPane(ref);
presentation->RemovePart(pane);
// Dispose view if ref count == 0.
this->GetViewFactory()->ReleaseView(ref);
return true;
}
bool Perspective::IsEditorAreaVisible()
{
return !editorHidden;
}
ViewLayoutRec::Pointer Perspective::GetViewLayoutRec(IViewReference::Pointer ref, bool create)
{
ViewLayoutRec::Pointer result = this->GetViewLayoutRec(ViewFactory::GetKey(ref), create);
if (result.IsNull() && create==false)
{
result = this->GetViewLayoutRec(ref->GetId(), false);
}
return result;
}
ViewLayoutRec::Pointer Perspective::GetViewLayoutRec(const std::string& viewId, bool create)
{
ViewLayoutRec::Pointer rec = mapIDtoViewLayoutRec[viewId];
if (rec.IsNull() && create)
{
rec = new ViewLayoutRec();
mapIDtoViewLayoutRec[viewId] = rec;
}
return rec;
}
bool Perspective::IsFixedLayout()
{
//@issue is there a difference between a fixed
//layout and a fixed perspective?? If not the API
//may need some polish, WorkbenchPage, PageLayout
//and Perspective all have isFixed methods.
//PageLayout and Perspective have their own fixed
//attribute, we are assuming they are always in sync.
//WorkbenchPage delegates to the perspective.
return fixed;
}
bool Perspective::IsStandaloneView(IViewReference::Pointer ref)
{
ViewLayoutRec::Pointer rec = this->GetViewLayoutRec(ref, false);
return rec.IsNotNull() && rec->isStandalone;
}
bool Perspective::GetShowTitleView(IViewReference::Pointer ref)
{
ViewLayoutRec::Pointer rec = this->GetViewLayoutRec(ref, false);
return rec.IsNotNull() && rec->showTitle;
}
void Perspective::LoadCustomPersp(PerspectiveDescriptor::Pointer persp)
{
//get the layout from the registry
PerspectiveRegistry* perspRegistry = dynamic_cast<PerspectiveRegistry*>(WorkbenchPlugin::GetDefault()->GetPerspectiveRegistry());
try
{
IMemento::Pointer memento = perspRegistry->GetCustomPersp(persp->GetId());
// Restore the layout state.
// MultiStatus status = new MultiStatus(
// PlatformUI.PLUGIN_ID,
// IStatus.OK,
// NLS.bind(WorkbenchMessages.Perspective_unableToRestorePerspective, persp.getLabel()),
// 0);
// status.merge(restoreState(memento));
// status.merge(restoreState());
bool okay = true;
okay &= this->RestoreState(memento);
okay &= this->RestoreState();
if (!okay)
{
this->UnableToOpenPerspective(persp, "Unable to open perspective: " + persp->GetLabel());
}
}
//catch (IOException e)
//{
// unableToOpenPerspective(persp, 0);
//}
catch (WorkbenchException& e)
{
this->UnableToOpenPerspective(persp, e.displayText());
}
}
void Perspective::UnableToOpenPerspective(PerspectiveDescriptor::Pointer persp,
const std::string& status)
{
PerspectiveRegistry* perspRegistry = dynamic_cast<PerspectiveRegistry*>(WorkbenchPlugin
::GetDefault()->GetPerspectiveRegistry());
perspRegistry->DeletePerspective(persp);
// If this is a predefined perspective, we will not be able to delete
// the perspective (we wouldn't want to). But make sure to delete the
// customized portion.
persp->DeleteCustomDefinition();
std::string title = "Restoring problems";
std::string msg = "Unable to read workbench state.";
if (status == "")
{
MessageDialog::OpenError(Shell::Pointer(0), title, msg);
}
else
{
//TODO error dialog
//ErrorDialog.openError((Shell) 0, title, msg, status);
MessageDialog::OpenError(Shell::Pointer(0), title, msg + "\n" + status);
}
}
void Perspective::LoadPredefinedPersp(PerspectiveDescriptor::Pointer persp)
{
// Create layout engine.
IPerspectiveFactory::Pointer factory;
try
{
factory = persp->CreateFactory();
}
catch (CoreException& /*e*/)
{
throw WorkbenchException("Unable to load perspective: " + persp->GetId());
}
/*
* IPerspectiveFactory#createFactory() can return 0
*/
if (factory == 0)
{
throw WorkbenchException("Unable to load perspective: " + persp->GetId());
}
// Create layout factory.
ViewSashContainer::Pointer container(new ViewSashContainer(page, this->GetClientComposite()));
layout = new PageLayout(container, this->GetViewFactory(),
editorArea, descriptor);
layout->SetFixed(descriptor->GetFixed());
// // add the placeholders for the sticky folders and their contents
IPlaceholderFolderLayout::Pointer stickyFolderRight, stickyFolderLeft, stickyFolderTop, stickyFolderBottom;
std::vector<IStickyViewDescriptor::Pointer> descs(WorkbenchPlugin::GetDefault()
->GetViewRegistry()->GetStickyViews());
for (std::size_t i = 0; i < descs.size(); i++)
{
IStickyViewDescriptor::Pointer stickyViewDescriptor = descs[i];
std::string id = stickyViewDescriptor->GetId();
int location = stickyViewDescriptor->GetLocation();
if (location == IPageLayout::RIGHT)
{
if (stickyFolderRight == 0)
{
stickyFolderRight = layout
->CreatePlaceholderFolder(
StickyViewDescriptor::STICKY_FOLDER_RIGHT,
IPageLayout::RIGHT, .75f,
IPageLayout::ID_EDITOR_AREA);
}
stickyFolderRight->AddPlaceholder(id);
}
else if (location == IPageLayout::LEFT)
{
if (stickyFolderLeft == 0)
{
stickyFolderLeft = layout->CreatePlaceholderFolder(
StickyViewDescriptor::STICKY_FOLDER_LEFT,
IPageLayout::LEFT, .25f, IPageLayout::ID_EDITOR_AREA);
}
stickyFolderLeft->AddPlaceholder(id);
}
else if (location == IPageLayout::TOP)
{
if (stickyFolderTop == 0)
{
stickyFolderTop = layout->CreatePlaceholderFolder(
StickyViewDescriptor::STICKY_FOLDER_TOP,
IPageLayout::TOP, .25f, IPageLayout::ID_EDITOR_AREA);
}
stickyFolderTop->AddPlaceholder(id);
}
else if (location == IPageLayout::BOTTOM)
{
if (stickyFolderBottom == 0)
{
stickyFolderBottom = layout->CreatePlaceholderFolder(
StickyViewDescriptor::STICKY_FOLDER_BOTTOM,
IPageLayout::BOTTOM, .75f,
IPageLayout::ID_EDITOR_AREA);
}
stickyFolderBottom->AddPlaceholder(id);
}
//should never be 0 as we've just added the view above
IViewLayout::Pointer viewLayout = layout->GetViewLayout(id);
viewLayout->SetCloseable(stickyViewDescriptor->IsCloseable());
viewLayout->SetMoveable(stickyViewDescriptor->IsMoveable());
}
// Run layout engine.
factory->CreateInitialLayout(layout);
PerspectiveExtensionReader extender;
extender.ExtendLayout(descriptor->GetId(), layout);
// Retrieve view layout info stored in the page layout.
std::map<std::string, ViewLayoutRec::Pointer> layoutInfo = layout->GetIDtoViewLayoutRecMap();
mapIDtoViewLayoutRec.insert(layoutInfo.begin(), layoutInfo.end());
//TODO Perspective action sets
// Create action sets.
//List temp = new ArrayList();
//this->CreateInitialActionSets(temp, layout.getActionSets());
// IContextService service = 0;
// if (page != 0)
// {
// service = (IContextService) page.getWorkbenchWindow().getService(
// IContextService.class);
// }
// try
// {
// if (service!=0)
// {
// service.activateContext(ContextAuthority.DEFER_EVENTS);
// }
// for (Iterator iter = temp.iterator(); iter.hasNext();)
// {
// IActionSetDescriptor descriptor = (IActionSetDescriptor) iter
// .next();
// addAlwaysOn(descriptor);
// }
// }finally
// {
// if (service!=0)
// {
// service.activateContext(ContextAuthority.SEND_EVENTS);
// }
// }
// newWizardShortcuts = layout.getNewWizardShortcuts();
// showViewShortcuts = layout.getShowViewShortcuts();
// perspectiveShortcuts = layout.getPerspectiveShortcuts();
// showInPartIds = layout.getShowInPartIds();
//
// // Retrieve fast views
// if (fastViewManager != 0)
// {
// ArrayList fastViews = layout.getFastViews();
// for (Iterator fvIter = fastViews.iterator(); fvIter.hasNext();)
// {
// IViewReference ref = (IViewReference) fvIter.next();
// fastViewManager.addViewReference(FastViewBar.FASTVIEWBAR_ID, -1, ref,
// !fvIter.hasNext());
// }
// }
// Is the layout fixed
fixed = layout->IsFixed();
// Create presentation.
presentation = new PerspectiveHelper(page, container, Perspective::Pointer(this));
// Hide editor area if requested by factory
if (!layout->IsEditorAreaVisible())
{
this->HideEditorArea();
}
}
void Perspective::OnActivate()
{
// Update editor area state.
if (editorArea->GetControl() != 0)
{
bool visible = this->IsEditorAreaVisible();
bool inTrim = editorAreaState == IStackPresentationSite::STATE_MINIMIZED;
editorArea->SetVisible(visible && !inTrim);
}
// // Update fast views.
// // Make sure the control for the fastviews are created so they can
// // be activated.
// if (fastViewManager != 0)
// {
// List fastViews = fastViewManager.getFastViews(0);
// for (int i = 0; i < fastViews.size(); i++)
// {
// ViewPane pane = getPane((IViewReference) fastViews.get(i));
// if (pane != 0)
// {
// Control ctrl = pane.getControl();
// if (ctrl == 0)
// {
// pane.createControl(getClientComposite());
// ctrl = pane.getControl();
// }
// ctrl.setEnabled(false); // Remove focus support.
// }
// }
// }
// // Set the visibility of all fast view pins
// setAllPinsVisible(true);
// Trim Stack Support
bool useNewMinMax = Perspective::UseNewMinMax(Perspective::Pointer(this));
bool hideEditorArea = shouldHideEditorsOnActivate || (editorHidden && editorHolder == 0);
// We have to set the editor area's stack state -before-
// activating the presentation since it's used there to determine
// size of the resulting stack
if (useNewMinMax && !hideEditorArea)
{
this->RefreshEditorAreaVisibility();
}
// Show the layout
presentation->Activate(this->GetClientComposite());
// if (useNewMinMax)
// {
// fastViewManager.activate();
//
// // Move any minimized extension stacks to the trim
// if (layout != 0)
// {
// // Turn aimations off
// IPreferenceStore preferenceStore = PrefUtil.getAPIPreferenceStore();
// bool useAnimations = preferenceStore
// .getbool(IWorkbenchPreferenceConstants.ENABLE_ANIMATIONS);
// preferenceStore.setValue(IWorkbenchPreferenceConstants.ENABLE_ANIMATIONS, false);
//
// List minStacks = layout.getMinimizedStacks();
// for (Iterator msIter = minStacks.iterator(); msIter.hasNext();)
// {
// ViewStack vs = (ViewStack) msIter.next();
// vs.setMinimized(true);
// }
//
// // Restore the animation pref
// preferenceStore.setValue(IWorkbenchPreferenceConstants.ENABLE_ANIMATIONS, useAnimations);
//
// // this is a one-off deal...set during the extension reading
// minStacks.clear();
// layout = 0;
// }
// }
// else
// {
// // Update the FVB only if not using the new min/max
//
// // WorkbenchWindow wbw = (WorkbenchWindow) page.getWorkbenchWindow();
//// if (wbw != 0)
//// {
//// ITrimManager tbm = wbw.getTrimManager();
//// if (tbm != 0)
//// {
//// IWindowTrim fvb = tbm.getTrim(FastViewBar.FASTVIEWBAR_ID);
//// if (fvb instanceof FastViewBar)
//// {
//// ((FastViewBar)fvb).update(true);
//// }
//// }
//// }
// }
// // If we are -not- using the new min/max then ensure that there
// // are no stacks in the trim. This can happen when a user switches
// // back to the 3.0 presentation...
// if (!Perspective.useNewMinMax(this) && fastViewManager != 0)
// {
// bool stacksWereRestored = fastViewManager.restoreAllTrimStacks();
// setEditorAreaTrimVisibility(false);
//
// // Restore any 'maximized' view stack since we've restored
// // the minimized stacks
// if (stacksWereRestored && presentation.getMaximizedStack().Cast<ViewStack>() != 0)
// {
// ViewStack vs = (ViewStack) presentation.getMaximizedStack();
// vs.setPresentationState(IStackPresentationSite.STATE_RESTORED);
// presentation.setMaximizedStack(0);
// }
// }
// We hide the editor area -after- the presentation activates
if (hideEditorArea)
{
// We do this here to ensure that createPartControl is called on the
// top editor
// before it is hidden. See bug 20166.
this->HideEditorArea();
shouldHideEditorsOnActivate = false;
// // this is an override so it should handle both states
// if (useNewMinMax)
// setEditorAreaTrimVisibility(editorAreaState == IStackPresentationSite.STATE_MINIMIZED);
}
layout = 0;
}
void Perspective::OnDeactivate()
{
presentation->Deactivate();
//setActiveFastView(0);
//setAllPinsVisible(false);
// // Update fast views.
// if (fastViewManager != 0)
// {
// List fastViews = fastViewManager.getFastViews(0);
// for (int i = 0; i < fastViews.size(); i++)
// {
// ViewPane pane = getPane((IViewReference) fastViews.get(i));
// if (pane != 0)
// {
// Control ctrl = pane.getControl();
// if (ctrl != 0)
// {
// ctrl.setEnabled(true); // Add focus support.
// }
// }
// }
//
// fastViewManager.deActivate();
// }
//
// // Ensure that the editor area trim is hidden as well
// setEditorAreaTrimVisibility(false);
}
void Perspective::PartActivated(IWorkbenchPart::Pointer /*activePart*/)
{
// // If a fastview is open close it.
// if (activeFastView != 0
// && activeFastView.getPart(false) != activePart)
// {
// setActiveFastView(0);
// }
}
void Perspective::PerformedShowIn(const std::string& /*partId*/)
{
//showInTimes.insert(std::make_pair(partId, new Long(System.currentTimeMillis())));
}
bool Perspective::RestoreState(IMemento::Pointer memento)
{
// MultiStatus result = new MultiStatus(
// PlatformUI.PLUGIN_ID,
// IStatus.OK,
// WorkbenchMessages.Perspective_problemsRestoringPerspective, 0);
bool result = true;
// Create persp descriptor.
descriptor = new PerspectiveDescriptor("", "", PerspectiveDescriptor::Pointer(0));
//result.add(descriptor.restoreState(memento));
result &= descriptor->RestoreState(memento);
PerspectiveDescriptor::Pointer desc = WorkbenchPlugin::GetDefault()->
GetPerspectiveRegistry()->FindPerspectiveWithId(descriptor->GetId()).Cast<PerspectiveDescriptor>();
if (desc)
{
descriptor = desc;
}
this->memento = memento;
// Add the visible views.
std::vector<IMemento::Pointer> views(memento->GetChildren(WorkbenchConstants::TAG_VIEW));
//result.merge(createReferences(views));
result &= this->CreateReferences(views);
memento = memento->GetChild(WorkbenchConstants::TAG_FAST_VIEWS);
if (memento)
{
views = memento->GetChildren(WorkbenchConstants::TAG_VIEW);
//result.merge(createReferences(views));
result &= this->CreateReferences(views);
}
return result;
}
bool Perspective::CreateReferences(const std::vector<IMemento::Pointer>& views)
{
// MultiStatus result = new MultiStatus(PlatformUI.PLUGIN_ID, IStatus.OK,
// WorkbenchMessages.Perspective_problemsRestoringViews, 0);
bool result = true;
for (std::size_t x = 0; x < views.size(); x++)
{
// Get the view details.
IMemento::Pointer childMem = views[x];
std::string id; childMem->GetString(WorkbenchConstants::TAG_ID, id);
// skip creation of the intro reference - it's handled elsewhere.
if (id == IntroConstants::INTRO_VIEW_ID)
{
continue;
}
std::string secondaryId(ViewFactory::ExtractSecondaryId(id));
if (!secondaryId.empty())
{
id = ViewFactory::ExtractPrimaryId(id);
}
// Create and open the view.
try
{
std::string rm; childMem->GetString(WorkbenchConstants::TAG_REMOVED, rm);
if (rm != "true")
{
viewFactory->CreateView(id, secondaryId);
}
}
catch (const PartInitException& e)
{
childMem->PutString(WorkbenchConstants::TAG_REMOVED, "true");
// result.add(StatusUtil.newStatus(IStatus.ERR,
// e.getMessage() == 0 ? "" : e.getMessage(), //$NON-NLS-1$
// e));
WorkbenchPlugin::Log(e.displayText(), e);
result &= true;
}
}
return result;
}
bool Perspective::RestoreState()
{
if (this->memento == 0)
{
//return new Status(IStatus.OK, PlatformUI.PLUGIN_ID, 0, "", 0); //$NON-NLS-1$
return true;
}
// MultiStatus result = new MultiStatus(
// PlatformUI.PLUGIN_ID,
// IStatus.OK,
// WorkbenchMessages.Perspective_problemsRestoringPerspective, 0);
bool result = true;
IMemento::Pointer memento = this->memento;
this->memento = 0;
const IMemento::Pointer boundsMem(memento->GetChild(WorkbenchConstants::TAG_WINDOW));
if (boundsMem)
{
Rectangle r(0, 0, 0, 0);
boundsMem->GetInteger(WorkbenchConstants::TAG_X, r.x);
boundsMem->GetInteger(WorkbenchConstants::TAG_Y, r.y);
boundsMem->GetInteger(WorkbenchConstants::TAG_HEIGHT, r.height);
boundsMem->GetInteger(WorkbenchConstants::TAG_WIDTH, r.width);
//StartupThreading.runWithoutExceptions(new StartupRunnable()
// {
// void runWithException() throws Throwable
// {
if (page->GetWorkbenchWindow()->GetActivePage() == 0)
{
page->GetWorkbenchWindow()->GetShell()->SetBounds(r);
}
// }
// });
}
// Create an empty presentation..
PerspectiveHelper* pres;
//StartupThreading.runWithoutExceptions(new StartupRunnable()
// {
// void runWithException() throws Throwable
// {
ViewSashContainer::Pointer mainLayout(new ViewSashContainer(page, this->GetClientComposite()));
pres = new PerspectiveHelper(page, mainLayout, Perspective::Pointer(this));
// }});
// Read the layout.
// result.merge(pres.restoreState(memento
// .getChild(IWorkbenchConstants.TAG_LAYOUT)));
result &= pres->RestoreState(memento->GetChild(WorkbenchConstants::TAG_LAYOUT));
//StartupThreading.runWithoutExceptions(new StartupRunnable()
// {
// void runWithException() throws Throwable
// {
// Add the editor workbook. Do not hide it now.
pres->ReplacePlaceholderWithPart(editorArea);
// }});
// Add the visible views.
std::vector<IMemento::Pointer> views(memento->GetChildren(WorkbenchConstants::TAG_VIEW));
for (std::size_t x = 0; x < views.size(); x++)
{
// Get the view details.
IMemento::Pointer childMem = views[x];
std::string id; childMem->GetString(WorkbenchConstants::TAG_ID, id);
std::string secondaryId(ViewFactory::ExtractSecondaryId(id));
if (!secondaryId.empty())
{
id = ViewFactory::ExtractPrimaryId(id);
}
// skip the intro as it is restored higher up in workbench.
if (id == IntroConstants::INTRO_VIEW_ID)
{
continue;
}
// Create and open the view.
IViewReference::Pointer viewRef = viewFactory->GetView(id, secondaryId);
WorkbenchPartReference::Pointer ref = viewRef.Cast<WorkbenchPartReference>();
// report error
if (ref == 0)
{
std::string key = ViewFactory::GetKey(id, secondaryId);
// result.add(new Status(IStatus.ERR, PlatformUI.PLUGIN_ID, 0,
// NLS.bind(WorkbenchMessages.Perspective_couldNotFind, key ), 0));
WorkbenchPlugin::Log("Could not find view: " + key);
continue;
}
bool willPartBeVisible = pres->WillPartBeVisible(ref->GetId(),
secondaryId);
if (willPartBeVisible)
{
IViewPart::Pointer view = ref->GetPart(true).Cast<IViewPart>();
if (view)
{
ViewSite::Pointer site = view->GetSite().Cast<ViewSite>();
pres->ReplacePlaceholderWithPart(site->GetPane().Cast<StackablePart>());
}
}
else
{
pres->ReplacePlaceholderWithPart(ref->GetPane().Cast<StackablePart>());
}
}
// // Load the fast views
// if (fastViewManager != 0)
// fastViewManager.restoreState(memento, result);
// Load the view layout recs
std::vector<IMemento::Pointer> recMementos(memento
->GetChildren(WorkbenchConstants::TAG_VIEW_LAYOUT_REC));
for (std::size_t i = 0; i < recMementos.size(); i++)
{
IMemento::Pointer recMemento = recMementos[i];
std::string compoundId;
if (recMemento->GetString(WorkbenchConstants::TAG_ID, compoundId))
{
ViewLayoutRec::Pointer rec = GetViewLayoutRec(compoundId, true);
std::string closeablestr; recMemento->GetString(WorkbenchConstants::TAG_CLOSEABLE, closeablestr);
if (WorkbenchConstants::FALSE_VAL == closeablestr)
{
rec->isCloseable = false;
}
std::string moveablestr; recMemento->GetString(WorkbenchConstants::TAG_MOVEABLE, moveablestr);
if (WorkbenchConstants::FALSE_VAL == moveablestr)
{
rec->isMoveable = false;
}
std::string standalonestr; recMemento->GetString(WorkbenchConstants::TAG_STANDALONE, standalonestr);
if (WorkbenchConstants::TRUE_VAL == standalonestr)
{
rec->isStandalone = true;
std::string showstr; recMemento->GetString(WorkbenchConstants::TAG_SHOW_TITLE, showstr);
rec->showTitle = WorkbenchConstants::FALSE_VAL != showstr;
}
}
}
//final IContextService service = (IContextService)page.getWorkbenchWindow().getService(IContextService.class);
try
{ // one big try block, don't kill me here
// // defer context events
// if (service != 0)
// {
// service.activateContext(ContextAuthority.DEFER_EVENTS);
// }
//
// HashSet knownActionSetIds = new HashSet();
//
// // Load the always on action sets.
std::vector<IMemento::Pointer> actions; // = memento
// .getChildren(IWorkbenchConstants.TAG_ALWAYS_ON_ACTION_SET);
// for (int x = 0; x < actions.length; x++)
// {
// String actionSetID = actions[x]
// .getString(IWorkbenchConstants.TAG_ID);
// final IActionSetDescriptor d = WorkbenchPlugin.getDefault()
// .getActionSetRegistry().findActionSet(actionSetID);
// if (d != 0)
// {
// StartupThreading
// .runWithoutExceptions(new StartupRunnable()
// {
// void runWithException() throws Throwable
// {
// addAlwaysOn(d);
// }
// });
//
// knownActionSetIds.add(actionSetID);
// }
// }
//
// // Load the always off action sets.
// actions = memento
// .getChildren(IWorkbenchConstants.TAG_ALWAYS_OFF_ACTION_SET);
// for (int x = 0; x < actions.length; x++)
// {
// String actionSetID = actions[x]
// .getString(IWorkbenchConstants.TAG_ID);
// final IActionSetDescriptor d = WorkbenchPlugin.getDefault()
// .getActionSetRegistry().findActionSet(actionSetID);
// if (d != 0)
// {
// StartupThreading
// .runWithoutExceptions(new StartupRunnable()
// {
// void runWithException() throws Throwable
// {
// addAlwaysOff(d);
// }
// });
// knownActionSetIds.add(actionSetID);
// }
// }
// Load "show view actions".
actions = memento->GetChildren(WorkbenchConstants::TAG_SHOW_VIEW_ACTION);
for (std::size_t x = 0; x < actions.size(); x++)
{
std::string id; actions[x]->GetString(WorkbenchConstants::TAG_ID, id);
showViewShortcuts.push_back(id);
}
// // Load "show in times".
// actions = memento.getChildren(IWorkbenchConstants.TAG_SHOW_IN_TIME);
// for (int x = 0; x < actions.length; x++)
// {
// String id = actions[x].getString(IWorkbenchConstants.TAG_ID);
// String timeStr = actions[x]
// .getString(IWorkbenchConstants.TAG_TIME);
// if (id != 0 && timeStr != 0)
// {
// try
// {
// long time = Long.parseLong(timeStr);
// showInTimes.put(id, new Long(time));
// }
// catch (NumberFormatException e)
// {
// // skip this one
// }
// }
// }
// Load "show in parts" from registry, not memento
showInPartIds = this->GetShowInIdsFromRegistry();
// // Load "new wizard actions".
// actions = memento
// .getChildren(IWorkbenchConstants.TAG_NEW_WIZARD_ACTION);
// newWizardShortcuts = new ArrayList(actions.length);
// for (int x = 0; x < actions.length; x++)
// {
// String id = actions[x].getString(IWorkbenchConstants.TAG_ID);
// newWizardShortcuts.add(id);
// }
// Load "perspective actions".
actions = memento->GetChildren(WorkbenchConstants::TAG_PERSPECTIVE_ACTION);
for (std::size_t x = 0; x < actions.size(); x++)
{
std::string id; actions[x]->GetString(WorkbenchConstants::TAG_ID, id);
perspectiveShortcuts.push_back(id);
}
// ArrayList extActionSets = getPerspectiveExtensionActionSets();
// for (int i = 0; i < extActionSets.size(); i++)
// {
// String actionSetID = (String) extActionSets.get(i);
// if (knownActionSetIds.contains(actionSetID))
// {
// continue;
// }
// final IActionSetDescriptor d = WorkbenchPlugin.getDefault()
// .getActionSetRegistry().findActionSet(actionSetID);
// if (d != 0)
// {
// StartupThreading
// .runWithoutExceptions(new StartupRunnable()
// {
// void runWithException() throws Throwable
// {
// addAlwaysOn(d);
// }
// });
// knownActionSetIds.add(d.getId());
// }
// }
// // Add the visible set of action sets to our knownActionSetIds
// // Now go through the registry to ensure we pick up any new action
// // sets
// // that have been added but not yet considered by this perspective.
// ActionSetRegistry reg = WorkbenchPlugin.getDefault()
// .getActionSetRegistry();
// IActionSetDescriptor[] array = reg.getActionSets();
// int count = array.length;
// for (int i = 0; i < count; i++)
// {
// IActionSetDescriptor desc = array[i];
// if ((!knownActionSetIds.contains(desc.getId()))
// && (desc.isInitiallyVisible()))
// {
// addActionSet(desc);
// }
// }
}
catch (...)
{
// // restart context changes
// if (service != 0)
// {
// StartupThreading.runWithoutExceptions(new StartupRunnable()
// {
// void runWithException() throws Throwable
// {
// service.activateContext(ContextAuthority.SEND_EVENTS);
// }
// });
// }
}
// Save presentation.
presentation = pres;
// Hide the editor area if needed. Need to wait for the
// presentation to be fully setup first.
int areaVisible = 0;
bool areaVisibleExists = memento->GetInteger(WorkbenchConstants::TAG_AREA_VISIBLE, areaVisible);
// Rather than hiding the editors now we must wait until after their
// controls
// are created. This ensures that if an editor is instantiated,
// createPartControl
// is also called. See bug 20166.
shouldHideEditorsOnActivate = (areaVisibleExists && areaVisible == 0);
// // Restore the trim state of the editor area
// IPreferenceStore preferenceStore = PrefUtil.getAPIPreferenceStore();
// bool useNewMinMax = preferenceStore.getbool(IWorkbenchPreferenceConstants.ENABLE_NEW_MIN_MAX);
// if (useNewMinMax)
// {
// Integer trimStateInt = memento.getInteger(IWorkbenchConstants.TAG_AREA_TRIM_STATE);
// if (trimStateInt != 0)
// {
// editorAreaState = trimStateInt.intValue() & 0x3; // low order two bits contain the state
// editorAreaRestoreOnUnzoom = (trimStateInt.intValue() & 4) != 0;
// }
// }
// restore the fixed state
int isFixed = 0;
fixed = (memento->GetInteger(WorkbenchConstants::TAG_FIXED, isFixed) && isFixed == 1);
return true;
}
std::vector<std::string> Perspective::GetShowInIdsFromRegistry()
{
PerspectiveExtensionReader reader;
std::vector<std::string> tags;
tags.push_back(WorkbenchRegistryConstants::TAG_SHOW_IN_PART);
reader.SetIncludeOnlyTags(tags);
PageLayout::Pointer layout(new PageLayout());
reader.ExtendLayout(descriptor->GetOriginalId(), layout);
return layout->GetShowInPartIds();
}
void Perspective::SaveDesc()
{
this->SaveDescAs(descriptor);
}
void Perspective::SaveDescAs(IPerspectiveDescriptor::Pointer /*desc*/)
{
//TODO Perspective SaveDescAs
// PerspectiveDescriptor::Pointer realDesc = desc.Cast<PerspectiveDescriptor>();
// //get the layout from the registry
// PerspectiveRegistry* perspRegistry = dynamic_cast<PerspectiveRegistry*>(WorkbenchPlugin
// ::GetDefault()->GetPerspectiveRegistry());
// // Capture the layout state.
// XMLMemento memento = XMLMemento.createWriteRoot("perspective");//$NON-NLS-1$
// IStatus status = saveState(memento, realDesc, false);
// if (status.getSeverity() == IStatus.ERR)
// {
// ErrorDialog.openError((Shell) 0, WorkbenchMessages.Perspective_problemSavingTitle,
// WorkbenchMessages.Perspective_problemSavingMessage,
// status);
// return;
// }
// //save it to the preference store
// try
// {
// perspRegistry.saveCustomPersp(realDesc, memento);
// descriptor = realDesc;
// }
// catch (IOException e)
// {
// perspRegistry.deletePerspective(realDesc);
// MessageDialog.openError((Shell) 0, WorkbenchMessages.Perspective_problemSavingTitle,
// WorkbenchMessages.Perspective_problemSavingMessage);
// }
}
bool Perspective::SaveState(IMemento::Pointer memento)
{
// MultiStatus result = new MultiStatus(
// PlatformUI.PLUGIN_ID,
// IStatus.OK,
// WorkbenchMessages.Perspective_problemsSavingPerspective, 0);
//
// result.merge(saveState(memento, descriptor, true));
bool result = true;
result &= this->SaveState(memento, descriptor, true);
return result;
}
bool Perspective::SaveState(IMemento::Pointer memento, PerspectiveDescriptor::Pointer p,
bool saveInnerViewState)
{
// MultiStatus result = new MultiStatus(
// PlatformUI.PLUGIN_ID,
// IStatus.OK,
// WorkbenchMessages.Perspective_problemsSavingPerspective, 0);
bool result = true;
if (this->memento)
{
memento->PutMemento(this->memento);
return result;
}
// Save the version number.
memento->PutString(WorkbenchConstants::TAG_VERSION, VERSION_STRING);
//result.add(p.saveState(memento));
result &= p->SaveState(memento);
if (!saveInnerViewState)
{
Rectangle bounds(page->GetWorkbenchWindow()->GetShell()->GetBounds());
IMemento::Pointer boundsMem = memento
->CreateChild(WorkbenchConstants::TAG_WINDOW);
boundsMem->PutInteger(WorkbenchConstants::TAG_X, bounds.x);
boundsMem->PutInteger(WorkbenchConstants::TAG_Y, bounds.y);
boundsMem->PutInteger(WorkbenchConstants::TAG_HEIGHT, bounds.height);
boundsMem->PutInteger(WorkbenchConstants::TAG_WIDTH, bounds.width);
}
// // Save the "always on" action sets.
// Iterator itr = alwaysOnActionSets.iterator();
// while (itr.hasNext())
// {
// IActionSetDescriptor desc = (IActionSetDescriptor) itr.next();
// IMemento child = memento
// .createChild(IWorkbenchConstants.TAG_ALWAYS_ON_ACTION_SET);
// child.putString(IWorkbenchConstants.TAG_ID, desc.getId());
// }
// // Save the "always off" action sets.
// itr = alwaysOffActionSets.iterator();
// while (itr.hasNext())
// {
// IActionSetDescriptor desc = (IActionSetDescriptor) itr.next();
// IMemento child = memento
// .createChild(IWorkbenchConstants.TAG_ALWAYS_OFF_ACTION_SET);
// child.putString(IWorkbenchConstants.TAG_ID, desc.getId());
// }
// Save "show view actions"
for (std::vector<std::string>::iterator itr = showViewShortcuts.begin();
itr != showViewShortcuts.end(); ++itr)
{
IMemento::Pointer child = memento
->CreateChild(WorkbenchConstants::TAG_SHOW_VIEW_ACTION);
child->PutString(WorkbenchConstants::TAG_ID, *itr);
}
// // Save "show in times"
// itr = showInTimes.keySet().iterator();
// while (itr.hasNext())
// {
// String id = (String) itr.next();
// Long time = (Long) showInTimes.get(id);
// IMemento child = memento
// .createChild(IWorkbenchConstants.TAG_SHOW_IN_TIME);
// child.putString(IWorkbenchConstants.TAG_ID, id);
// child.putString(IWorkbenchConstants.TAG_TIME, time.toString());
// }
// // Save "new wizard actions".
// itr = newWizardShortcuts.iterator();
// while (itr.hasNext())
// {
// String str = (String) itr.next();
// IMemento child = memento
// .createChild(IWorkbenchConstants.TAG_NEW_WIZARD_ACTION);
// child.putString(IWorkbenchConstants.TAG_ID, str);
// }
// Save "perspective actions".
for (std::vector<std::string>::iterator itr = perspectiveShortcuts.begin();
itr != perspectiveShortcuts.end(); ++itr)
{
IMemento::Pointer child = memento
->CreateChild(WorkbenchConstants::TAG_PERSPECTIVE_ACTION);
child->PutString(WorkbenchConstants::TAG_ID, *itr);
}
// Get visible views.
std::vector<PartPane::Pointer> viewPanes;
presentation->CollectViewPanes(viewPanes);
// Save the views.
for (std::vector<PartPane::Pointer>::iterator itr = viewPanes.begin();
itr != viewPanes.end(); ++itr)
{
IWorkbenchPartReference::Pointer ref((*itr)->GetPartReference());
IViewDescriptor::Pointer desc = page->GetViewFactory()->GetViewRegistry()
->Find(ref->GetId());
if(desc && desc->IsRestorable())
{
IMemento::Pointer viewMemento = memento
->CreateChild(WorkbenchConstants::TAG_VIEW);
viewMemento->PutString(WorkbenchConstants::TAG_ID, ViewFactory::GetKey(ref.Cast<IViewReference>()));
}
}
// // save all fastview state
// if (fastViewManager != 0)
// fastViewManager.saveState(memento);
// Save the view layout recs.
for (std::map<std::string, ViewLayoutRec::Pointer>::iterator i = mapIDtoViewLayoutRec.begin();
i != mapIDtoViewLayoutRec.end(); ++i)
{
std::string compoundId(i->first);
ViewLayoutRec::Pointer rec(i->second);
if (rec && (!rec->isCloseable || !rec->isMoveable || rec->isStandalone))
{
IMemento::Pointer layoutMemento(memento
->CreateChild(WorkbenchConstants::TAG_VIEW_LAYOUT_REC));
layoutMemento->PutString(WorkbenchConstants::TAG_ID, compoundId);
if (!rec->isCloseable)
{
layoutMemento->PutString(WorkbenchConstants::TAG_CLOSEABLE,
WorkbenchConstants::FALSE_VAL);
}
if (!rec->isMoveable)
{
layoutMemento->PutString(WorkbenchConstants::TAG_MOVEABLE,
WorkbenchConstants::FALSE_VAL);
}
if (rec->isStandalone)
{
layoutMemento->PutString(WorkbenchConstants::TAG_STANDALONE,
WorkbenchConstants::TRUE_VAL);
layoutMemento->PutString(WorkbenchConstants::TAG_SHOW_TITLE,
rec->showTitle ? WorkbenchConstants::TRUE_VAL : WorkbenchConstants::FALSE_VAL);
}
}
}
// Save the layout.
IMemento::Pointer childMem(memento->CreateChild(WorkbenchConstants::TAG_LAYOUT));
//result.add(presentation.saveState(childMem));
result &= presentation->SaveState(childMem);
// Save the editor visibility state
if (this->IsEditorAreaVisible())
{
memento->PutInteger(WorkbenchConstants::TAG_AREA_VISIBLE, 1);
}
else
{
memento->PutInteger(WorkbenchConstants::TAG_AREA_VISIBLE, 0);
}
// // Save the trim state of the editor area if using the new min/max
// IPreferenceStore preferenceStore = PrefUtil.getAPIPreferenceStore();
// bool useNewMinMax = preferenceStore.getbool(IWorkbenchPreferenceConstants.ENABLE_NEW_MIN_MAX);
// if (useNewMinMax)
// {
// int trimState = editorAreaState;
// trimState |= editorAreaRestoreOnUnzoom ? 4 : 0;
// memento.putInteger(IWorkbenchConstants.TAG_AREA_TRIM_STATE, trimState);
// }
// Save the fixed state
if (fixed)
{
memento->PutInteger(WorkbenchConstants::TAG_FIXED, 1);
}
else
{
memento->PutInteger(WorkbenchConstants::TAG_FIXED, 0);
}
return result;
}
void Perspective::SetPerspectiveActionIds(const std::vector<std::string>& list)
{
perspectiveShortcuts = list;
}
void Perspective::SetShowInPartIds(const std::vector<std::string>& list)
{
showInPartIds = list;
}
void Perspective::SetShowViewActionIds(const std::vector<std::string>& list)
{
showViewShortcuts = list;
}
void Perspective::ShowEditorArea()
{
if (this->IsEditorAreaVisible())
{
return;
}
editorHidden = false;
// Show the editor in the appropriate location
if (this->UseNewMinMax(Perspective::Pointer(this)))
{
bool isMinimized = editorAreaState == IStackPresentationSite::STATE_MINIMIZED;
if (!isMinimized)
{
// If the editor area is going to show then we have to restore
// if (getPresentation().getMaximizedStack() != 0)
// getPresentation().getMaximizedStack().setState(IStackPresentationSite.STATE_RESTORED);
this->ShowEditorAreaLocal();
}
// else
// setEditorAreaTrimVisibility(true);
}
else
{
this->ShowEditorAreaLocal();
}
}
void Perspective::ShowEditorAreaLocal()
{
if (editorHolder == 0 || editorHidden)
{
return;
}
// Replace the part holder with the editor area.
presentation->GetLayout()->Replace(editorHolder, editorArea);
editorHolder = 0;
}
void Perspective::SetEditorAreaState(int newState)
{
if (newState == editorAreaState)
return;
editorAreaState = newState;
// // reset the restore flag if we're not minimized
// if (newState != IStackPresentationSite::STATE_MINIMIZED)
// editorAreaRestoreOnUnzoom = false;
this->RefreshEditorAreaVisibility();
}
int Perspective::GetEditorAreaState()
{
return editorAreaState;
}
void Perspective::RefreshEditorAreaVisibility()
{
// Nothing shows up if the editor area isn't visible at all
if (editorHidden)
{
this->HideEditorAreaLocal();
//setEditorAreaTrimVisibility(false);
return;
}
PartStack::Pointer editorStack = editorArea.Cast<EditorSashContainer>()->GetUpperRightEditorStack();
if (editorStack == 0)
return;
// Whatever we're doing, make the current editor stack match it
//editorStack->SetStateLocal(editorAreaState);
// If it's minimized then it's in the trim
if (editorAreaState == IStackPresentationSite::STATE_MINIMIZED)
{
// Hide the editor area and show its trim
this->HideEditorAreaLocal();
//setEditorAreaTrimVisibility(true);
}
else
{
// Show the editor area and hide its trim
//setEditorAreaTrimVisibility(false);
this->ShowEditorAreaLocal();
// if (editorAreaState == IStackPresentationSite::STATE_MAXIMIZED)
// getPresentation().setMaximizedStack(editorStack);
}
}
IViewReference::Pointer Perspective::GetViewReference(const std::string& viewId, const std::string& secondaryId)
{
IViewReference::Pointer ref = page->FindViewReference(viewId, secondaryId);
if (ref == 0)
{
ViewFactory* factory = this->GetViewFactory();
try
{
ref = factory->CreateView(viewId, secondaryId);
}
catch (PartInitException& /*e*/)
{
// IStatus status = StatusUtil.newStatus(IStatus.ERR,
// e.getMessage() == 0 ? "" : e.getMessage(), //$NON-NLS-1$
// e);
// StatusUtil.handleStatus(status, "Failed to create view: id=" + viewId, //$NON-NLS-1$
// StatusManager.LOG);
//TODO Perspective status message
WorkbenchPlugin::Log("Failed to create view: id=" + viewId);
}
}
return ref;
}
IViewPart::Pointer Perspective::ShowView(const std::string& viewId, const std::string& secondaryId)
{
ViewFactory* factory = this->GetViewFactory();
IViewReference::Pointer ref = factory->CreateView(viewId, secondaryId);
IViewPart::Pointer part = ref->GetPart(true).Cast<IViewPart>();
if (part == 0)
{
throw PartInitException("Could not create view: " + ref->GetId());
}
PartSite::Pointer site = part->GetSite().Cast<PartSite>();
PartPane::Pointer pane = site->GetPane();
//TODO Perspective preference store
// IPreferenceStore store = WorkbenchPlugin.getDefault()
// .getPreferenceStore();
// int openViewMode = store.getInt(IPreferenceConstants.OPEN_VIEW_MODE);
//
// if (openViewMode == IPreferenceConstants.OVM_FAST &&
// fastViewManager != 0)
// {
// fastViewManager.addViewReference(FastViewBar.FASTVIEWBAR_ID, -1, ref, true);
// setActiveFastView(ref);
// }
// else if (openViewMode == IPreferenceConstants.OVM_FLOAT
// && presentation.canDetach())
// {
// presentation.addDetachedPart(pane);
// }
// else
// {
if (this->UseNewMinMax(Perspective::Pointer(this)))
{
// Is this view going to show in the trim?
// LayoutPart vPart = presentation.findPart(viewId, secondaryId);
// Determine if there is a trim stack that should get the view
std::string trimId;
// // If we can locate the correct trim stack then do so
// if (vPart != 0)
// {
// String id = 0;
// ILayoutContainer container = vPart.getContainer();
// if (container.Cast<ContainerPlaceholder>() != 0)
// id = ((ContainerPlaceholder)container).getID();
// else if (container.Cast<ViewStack>() != 0)
// id = ((ViewStack)container).getID();
//
// // Is this place-holder in the trim?
// if (id != 0 && fastViewManager.getFastViews(id).size()> 0)
// {
// trimId = id;
// }
// }
//
// // No explicit trim found; If we're maximized then we either have to find an
// // arbitrary stack...
// if (trimId == 0 && presentation.getMaximizedStack() != 0)
// {
// if (vPart == 0)
// {
// ViewStackTrimToolBar blTrimStack = fastViewManager.getBottomRightTrimStack();
// if (blTrimStack != 0)
// {
// // OK, we've found a trim stack to add it to...
// trimId = blTrimStack.getId();
//
// // Since there was no placeholder we have to add one
// LayoutPart blPart = presentation.findPart(trimId, 0);
// if (blPart.Cast<ContainerPlaceholder>() != 0)
// {
// ContainerPlaceholder cph = (ContainerPlaceholder) blPart;
// if (cph.getRealContainer().Cast<ViewStack>() != 0)
// {
// ViewStack vs = (ViewStack) cph.getRealContainer();
//
// // Create a 'compound' id if this is a multi-instance part
// String compoundId = ref.getId();
// if (ref.getSecondaryId() != 0)
// compoundId = compoundId + ':' + ref.getSecondaryId();
//
// // Add the new placeholder
// vs.add(new PartPlaceholder(compoundId));
// }
// }
// }
// }
// }
//
// // If we have a trim stack located then add the view to it
// if (trimId != "")
// {
// fastViewManager.addViewReference(trimId, -1, ref, true);
// }
// else
// {
// bool inMaximizedStack = vPart != 0 && vPart.getContainer() == presentation.getMaximizedStack();
// Do the default behavior
presentation->AddPart(pane);
// // Now, if we're maximized then we have to minimize the new stack
// if (presentation.getMaximizedStack() != 0 && !inMaximizedStack)
// {
// vPart = presentation.findPart(viewId, secondaryId);
// if (vPart != 0 && vPart.getContainer().Cast<ViewStack>() != 0)
// {
// ViewStack vs = (ViewStack)vPart.getContainer();
// vs.setState(IStackPresentationSite.STATE_MINIMIZED);
//
// // setting the state to minimized will create the trim toolbar
// // so we don't need a 0 pointer check here...
// fastViewManager.getViewStackTrimToolbar(vs.getID()).setRestoreOnUnzoom(true);
// }
// }
// }
}
else
{
presentation->AddPart(pane);
}
//}
// Ensure that the newly showing part is enabled
if (pane != 0 && pane->GetControl() != 0)
Tweaklets::Get(GuiWidgetsTweaklet::KEY)->SetEnabled(pane->GetControl(), true);
return part;
}
IWorkbenchPartReference::Pointer Perspective::GetOldPartRef()
{
return oldPartRef;
}
void Perspective::SetOldPartRef(IWorkbenchPartReference::Pointer oldPartRef)
{
this->oldPartRef = oldPartRef;
}
bool Perspective::IsCloseable(IViewReference::Pointer reference)
{
ViewLayoutRec::Pointer rec = this->GetViewLayoutRec(reference, false);
if (rec != 0)
{
return rec->isCloseable;
}
return true;
}
bool Perspective::IsMoveable(IViewReference::Pointer reference)
{
ViewLayoutRec::Pointer rec = this->GetViewLayoutRec(reference, false);
if (rec != 0)
{
return rec->isMoveable;
}
return true;
}
void Perspective::DescribeLayout(std::string& buf) const
{
// std::vector<IViewReference::Pointer> fastViews = getFastViews();
//
// if (fastViews.length != 0)
// {
// buf.append("fastviews ("); //$NON-NLS-1$
// for (int idx = 0; idx < fastViews.length; idx++)
// {
// IViewReference ref = fastViews[idx];
//
// if (idx> 0)
// {
// buf.append(", "); //$NON-NLS-1$
// }
//
// buf.append(ref.getPartName());
// }
// buf.append("), "); //$NON-NLS-1$
// }
this->GetPresentation()->DescribeLayout(buf);
}
void Perspective::TestInvariants()
{
this->GetPresentation()->GetLayout()->TestInvariants();
}
bool Perspective::UseNewMinMax(Perspective::Pointer activePerspective)
{
// We need to have an active perspective
if (activePerspective == 0)
return false;
// We need to have a trim manager (if we don't then we
// don't create a FastViewManager because it'd be useless)
// if (activePerspective->GetFastViewManager() == 0)
// return false;
// Make sure we don't NPE anyplace
WorkbenchWindow::Pointer wbw = activePerspective->page->GetWorkbenchWindow().Cast<WorkbenchWindow>();
if (wbw == 0)
return false;
// WorkbenchWindowConfigurer* configurer = wbw->GetWindowConfigurer();
// if (configurer == 0)
// return false;
IPresentationFactory* factory = WorkbenchPlugin::GetDefault()->GetPresentationFactory();
if (factory == 0)
return false;
// Ok, we should be good to go, return the pref
//IPreferenceStore preferenceStore = PrefUtil.getAPIPreferenceStore();
//bool useNewMinMax = preferenceStore.getbool(IWorkbenchPreferenceConstants.ENABLE_NEW_MIN_MAX);
return true;
}
}
diff --git a/BlueBerry/Bundles/org.blueberry.ui/src/internal/berryPerspectiveHelper.cpp b/BlueBerry/Bundles/org.blueberry.ui/src/internal/berryPerspectiveHelper.cpp
index 1d7d96b4f6..65115057d9 100755
--- a/BlueBerry/Bundles/org.blueberry.ui/src/internal/berryPerspectiveHelper.cpp
+++ b/BlueBerry/Bundles/org.blueberry.ui/src/internal/berryPerspectiveHelper.cpp
@@ -1,1673 +1,1674 @@
/*=========================================================================
Program: BlueBerry Platform
Language: C++
Date: $Date$
Version: $Revision$
Copyright (c) German Cancer Research Center, Division of Medical and
Biological Informatics. All rights reserved.
See MITKCopyright.txt or http://www.mitk.org/copyright.html for details.
This software is distributed WITHOUT ANY WARRANTY; without even
the implied warranty of MERCHANTABILITY or FITNESS FOR A PARTICULAR
PURPOSE. See the above copyright notices for more information.
=========================================================================*/
+#include "../tweaklets/berryGuiWidgetsTweaklet.h"
+
#include "berryPerspectiveHelper.h"
-#include "../tweaklets/berryGuiWidgetsTweaklet.h"
#include "berryLayoutTree.h"
#include "berryEditorSashContainer.h"
#include "berryDragUtil.h"
#include "berryPresentationFactoryUtil.h"
#include "berryWorkbenchConstants.h"
#include <berryDebugUtil.h>
#include <Poco/RegularExpression.h>
namespace berry
{
const int PerspectiveHelper::MIN_DETACH_WIDTH = 150;
const int PerspectiveHelper::MIN_DETACH_HEIGHT = 250;
PerspectiveHelper::DragOverListener::DragOverListener(PerspectiveHelper* perspHelper) :
perspHelper(perspHelper)
{
}
IDropTarget::Pointer PerspectiveHelper::DragOverListener::Drag(
void* /*currentControl*/, Object::Pointer draggedObject, const Point& /*position*/,
const Rectangle& dragRectangle)
{
if (draggedObject.Cast<PartPane>() != 0)
{
PartPane::Pointer part = draggedObject.Cast<PartPane>();
if (part->GetContainer().Cast<PartStack>()->GetAppearance() == PresentationFactoryUtil::ROLE_EDITOR)
return IDropTarget::Pointer(0);
// Views that haven't been shown yet have no 'control' which causes
// 'GetWorkbenchWindow' to return 'null' so check explicitly
if (part->GetPage() != perspHelper->page)
return IDropTarget::Pointer(0);
else if (part->GetWorkbenchWindow() != perspHelper->page->GetWorkbenchWindow())
return IDropTarget::Pointer(0);
if (perspHelper->dropTarget == 0)
perspHelper->dropTarget = new ActualDropTarget(perspHelper, part, dragRectangle);
else
perspHelper->dropTarget->SetTarget(part, dragRectangle);
}
else if (draggedObject.Cast<PartStack>() != 0)
{
PartStack::Pointer stack = draggedObject.Cast<PartStack>();
if (stack->GetAppearance() == PresentationFactoryUtil::ROLE_EDITOR)
return IDropTarget::Pointer(0);
if (stack->GetWorkbenchWindow() != perspHelper->page->GetWorkbenchWindow())
return IDropTarget::Pointer(0);
if (perspHelper->dropTarget == 0)
perspHelper->dropTarget = new ActualDropTarget(perspHelper, stack, dragRectangle);
else
perspHelper->dropTarget->SetTarget(stack, dragRectangle);
}
return perspHelper->dropTarget;
}
void PerspectiveHelper::ActualDropTarget::SetTarget(PartPane::Pointer part,
const Rectangle& dragRectangle)
{
this->stack = 0;
this->part = part;
this->dragRectangle = dragRectangle;
}
void PerspectiveHelper::ActualDropTarget::SetTarget(PartStack::Pointer stack,
const Rectangle& dragRectangle)
{
this->stack = stack;
this->part = 0;
this->dragRectangle = dragRectangle;
}
PerspectiveHelper::ActualDropTarget::ActualDropTarget(PerspectiveHelper* perspHelper, PartPane::Pointer part,
const Rectangle& dragRectangle)
: AbstractDropTarget(), perspHelper(perspHelper)
{
this->SetTarget(part, dragRectangle);
}
PerspectiveHelper::ActualDropTarget::ActualDropTarget(PerspectiveHelper* perspHelper, PartStack::Pointer stack,
const Rectangle& dragRectangle)
: AbstractDropTarget(), perspHelper(perspHelper)
{
this->SetTarget(stack, dragRectangle);
}
void PerspectiveHelper::ActualDropTarget::Drop()
{
if (part != 0)
{
Shell::Pointer shell = part->GetShell();
if (shell->GetData().Cast<DetachedWindow> () != 0)
{
// if only one view in tab folder then do a window move
IStackableContainer::Pointer container = part->GetContainer();
if (container.Cast<PartStack> () != 0)
{
if (container.Cast<PartStack>()->GetItemCount() == 1)
{
shell->SetLocation(dragRectangle.x, dragRectangle.y);
return;
}
}
}
// // If layout is modified always zoom out.
// if (isZoomed())
// {
// zoomOut();
// }
// do a normal part detach
perspHelper->DetachPart(part, dragRectangle.x, dragRectangle.y);
}
else if (stack != 0)
{
Shell::Pointer shell = stack->GetShell();
if (shell->GetData().Cast<DetachedWindow> () != 0)
{
// only one tab folder in a detach window, so do window
// move
shell->SetLocation(dragRectangle.x, dragRectangle.y);
return;
}
// // If layout is modified always zoom out.
// if (isZoomed())
// {
// zoomOut();
// }
// do a normal part detach
perspHelper->Detach(stack, dragRectangle.x, dragRectangle.y);
}
}
DnDTweaklet::CursorType PerspectiveHelper::ActualDropTarget::GetCursor()
{
return DnDTweaklet::CURSOR_OFFSCREEN;
}
PerspectiveHelper::MatchingPart::MatchingPart(const std::string& pid,
const std::string& sid, StackablePart::Pointer part)
{
this->pid = pid;
this->sid = sid;
this->part = part;
this->len = pid.size() + sid.size();
this->hasWildcard = (pid.find_first_of(PartPlaceholder::WILD_CARD)
!= std::string::npos) || (sid.find_first_of(PartPlaceholder::WILD_CARD)
!= std::string::npos);
}
bool PerspectiveHelper::CompareMatchingParts::operator()(const MatchingPart& m1, const MatchingPart& m2) const
{
// specific ids always outweigh ids with wildcards
if (m1.hasWildcard && !m2.hasWildcard)
{
return true;
}
if (!m1.hasWildcard && m2.hasWildcard)
{
return false;
}
// if both are specific or both have wildcards, simply compare based on length
return m1.len > m2.len;
}
PerspectiveHelper::PerspectiveHelper(WorkbenchPage* workbenchPage,
ViewSashContainer::Pointer mainLayout, Perspective::Pointer persp)
: page(workbenchPage), perspective(persp),
mainLayout(mainLayout),
detachable(false), active(false)
{
// Views can be detached if the feature is enabled (true by default,
// use the plug-in customization file to disable), and if the platform
// supports detaching.
this->dragTarget = new DragOverListener(this);
//TODO preference store
// IPreferenceStore store = PlatformUI.getPreferenceStore();
// this.detachable = store.getBoolean(
// IWorkbenchPreferenceConstants.ENABLE_DETACHED_VIEWS);
this->detachable = true;
if (this->detachable)
{
// Check if some arbitrary Composite supports reparenting. If it
// doesn't, views cannot be detached.
void* client = workbenchPage->GetClientComposite();
if (client == 0)
{
// The workbench page is not initialized. I don't think this can happen,
// but if it does, silently set detachable to false.
this->detachable = false;
}
else
{
this->detachable = Tweaklets::Get(GuiWidgetsTweaklet::KEY)->IsReparentable(client);
}
}
}
void PerspectiveHelper::Activate(void* parent)
{
if (active)
{
return;
}
parentWidget = parent;
// Activate main layout
// make sure all the views have been properly parented
std::vector<PartPane::Pointer> children;
this->CollectViewPanes(children, mainLayout->GetChildren());
for (std::vector<PartPane::Pointer>::iterator iter = children.begin();
iter != children.end(); ++iter)
{
PartPane::Pointer part = *iter;
part->Reparent(parent);
}
mainLayout->CreateControl(parent);
mainLayout->SetActive(true);
// Open the detached windows.
for (DetachedWindowsType::iterator iter = detachedWindowList.begin();
iter != detachedWindowList.end(); ++iter)
{
(*iter)->Open();
}
this->EnableAllDrag();
// // Ensure that the maximized stack's presentation state is correct
// if (maximizedStackId != 0)
// {
// LayoutPart part = this->FindPart(maximizedStackId);
// if (part.Cast<PartStack>() != 0)
// {
// maximizedStack = (PartStack) part;
// maximizedStackId = 0;
// }
// }
//
// // NOTE: we only handle ViewStacks here; Editor Stacks are handled by the
// // perspective
// if (maximizedStack instanceof ViewStack)
// {
// maximizedStack.setPresentationState(IStackPresentationSite.STATE_MAXIMIZED);
// }
active = true;
}
void PerspectiveHelper::AddPart(StackablePart::Pointer part)
{
// Look for a placeholder.
PartPlaceholder::Pointer placeholder;
StackablePart::Pointer testPart;
std::string primaryId = part->GetId();
std::string secondaryId;
IViewReference::Pointer ref;
if (part.Cast<PartPane> () != 0)
{
PartPane::Pointer pane = part.Cast<PartPane> ();
ref = pane->GetPartReference().Cast<IViewReference> ();
if (ref != 0)
secondaryId = ref->GetSecondaryId();
}
if (secondaryId != "")
{
testPart = this->FindPart(primaryId, secondaryId);
}
else
{
testPart = this->FindPart(primaryId);
}
// validate the testPart
if (testPart != 0 && testPart.Cast<PartPlaceholder>() != 0)
{
placeholder = testPart.Cast<PartPlaceholder> ();
}
// If there is no placeholder do a simple add. Otherwise, replace the
// placeholder if its not a pattern matching placholder
if (placeholder == 0)
{
part->Reparent(mainLayout->GetParent());
LayoutPart::Pointer relative = mainLayout->FindBottomRight();
if (relative != 0 && relative.Cast<IStackableContainer>() != 0)
{
IStackableContainer::Pointer stack =
relative.Cast<IStackableContainer> ();
if (stack->AllowsAdd(part))
{
mainLayout->Stack(part, stack);
}
else
{
mainLayout->AddPart(part);
}
}
else
{
mainLayout->AddPart(part);
}
}
else
{
IStackableContainer::Pointer container = placeholder->GetContainer();
if (container != 0)
{
if (container.Cast<DetachedPlaceHolder> () != 0)
{
//Create a detached window add the part on it.
DetachedPlaceHolder::Pointer holder = container.Cast<DetachedPlaceHolder>();
detachedPlaceHolderList.remove(holder);
container->Remove(testPart);
DetachedWindow::Pointer window(new DetachedWindow(page));
detachedWindowList.push_back(window);
window->Create();
part->CreateControl(window->GetShell()->GetControl());
// Open window.
window->GetShell()->SetBounds(holder->GetBounds());
window->Open();
// add part to detached window.
PartPane::Pointer pane = part.Cast<PartPane>();
window->Add(pane);
std::list<StackablePart::Pointer> otherChildren = holder->GetChildren();
for (std::list<StackablePart::Pointer>::iterator iter = otherChildren.begin();
iter != otherChildren.end(); ++iter)
{
part->GetContainer()->Add(*iter);
}
}
else
{
// show parent if necessary
if (container.Cast<ContainerPlaceholder> () != 0)
{
ContainerPlaceholder::Pointer containerPlaceholder =
container.Cast<ContainerPlaceholder>();
ILayoutContainer::Pointer parentContainer =
containerPlaceholder->GetContainer();
container = containerPlaceholder->GetRealContainer();
if (container.Cast<LayoutPart> () != 0)
{
parentContainer->Replace(containerPlaceholder,
container.Cast<LayoutPart>());
}
containerPlaceholder->SetRealContainer(IStackableContainer::Pointer(0));
}
// reparent part.
//if (!(container instanceof ViewStack))
// {
// We don't need to reparent children of PartTabFolders since they will automatically
// reparent their children when they become visible. This if statement used to be
// part of an else branch. Investigate if it is still necessary.
// part.reparent(mainLayout.getParent());
// }
// see if we should replace the placeholder
if (placeholder->HasWildCard())
{
// if (container instanceof PartSashContainer)
// {
// ((PartSashContainer) container) .addChildForPlaceholder(part,
// placeholder);
// }
// else
// {
container->Add(part);
// }
}
else
{
container->Replace(placeholder, part);
}
}
}
}
}
void PerspectiveHelper::AttachPart(IViewReference::Pointer ref)
{
PartPane::Pointer pane = ref.Cast<WorkbenchPartReference>()->GetPane();
// Restore any maximized part before re-attaching.
// Note that 'getMaximizedStack != 0' implies 'useNewMinMax'
// if (getMaximizedStack() != 0)
// {
// getMaximizedStack().setState(IStackPresentationSite.STATE_RESTORED);
// }
this->DerefPart(pane);
this->AddPart(pane);
this->BringPartToTop(pane);
pane->SetFocus();
}
bool PerspectiveHelper::CanDetach()
{
return detachable;
}
bool PerspectiveHelper::BringPartToTop(StackablePart::Pointer part)
{
IStackableContainer::Pointer container = part->GetContainer();
if (container != 0 && container.Cast<PartStack> () != 0)
{
PartStack::Pointer folder = container.Cast<PartStack> ();
if (folder->GetSelection() != part)
{
folder->SetSelection(part);
return true;
}
}
return false;
}
bool PerspectiveHelper::IsPartVisible(IWorkbenchPartReference::Pointer partRef)
{
StackablePart::Pointer foundPart;
if (partRef.Cast<IViewReference> () != 0)
{
foundPart = this->FindPart(partRef->GetId(),
partRef.Cast<IViewReference>()->GetSecondaryId());
}
else
{
foundPart = this->FindPart(partRef->GetId());
}
if (foundPart == 0)
{
return false;
}
if (foundPart.Cast<PartPlaceholder> () != 0)
{
return false;
}
IStackableContainer::Pointer container = foundPart->GetContainer();
if (container.Cast<ContainerPlaceholder> () != 0)
{
return false;
}
if (container.Cast<PartStack> () != 0)
{
PartStack::Pointer folder = container.Cast<PartStack>();
StackablePart::Pointer visiblePart = folder->GetSelection();
if (visiblePart == 0)
{
return false;
}
return partRef == visiblePart.Cast<PartPane>()->GetPartReference();
}
return true;
}
bool PerspectiveHelper::WillPartBeVisible(const std::string& partId)
{
return this->WillPartBeVisible(partId, 0);
}
bool PerspectiveHelper::WillPartBeVisible(const std::string& partId,
const std::string& secondaryId)
{
StackablePart::Pointer part = this->FindPart(partId, secondaryId);
if (part == 0)
{
return false;
}
IStackableContainer::Pointer container = part->GetContainer();
if (container != 0 && container.Cast<ContainerPlaceholder> () != 0)
{
container
= container.Cast<ContainerPlaceholder>()->GetRealContainer();
}
if (container != 0 && container.Cast<PartStack> () != 0)
{
PartStack::Pointer folder = container.Cast<PartStack>();
if (folder->GetSelection() == 0)
{
return false;
}
return part->GetCompoundId() == folder->GetSelection().Cast<PartPane>()->GetCompoundId();
}
return true;
}
std::vector<PartPlaceholder::Pointer> PerspectiveHelper::CollectPlaceholders()
{
// Scan the main window.
std::vector<PartPlaceholder::Pointer> results = this->CollectPlaceholders(
mainLayout->GetChildren());
// Scan each detached window.
if (detachable)
{
for (DetachedWindowsType::iterator winIter = detachedWindowList.begin();
winIter != detachedWindowList.end(); ++winIter)
{
DetachedWindow::Pointer win = *winIter;
std::list<StackablePart::Pointer> moreResults = win->GetChildren();
if (moreResults.size()> 0)
{
for (std::list<StackablePart::Pointer>::iterator iter = moreResults.begin();
iter != moreResults.end(); ++iter)
{
if (iter->Cast<PartPlaceholder>() != 0)
results.push_back(iter->Cast<PartPlaceholder>());
}
}
}
}
return results;
}
std::vector<PartPlaceholder::Pointer> PerspectiveHelper::CollectPlaceholders(
const std::list<LayoutPart::Pointer>& parts)
{
std::vector<PartPlaceholder::Pointer> result;
for (std::list<LayoutPart::Pointer>::const_iterator iter = parts.begin();
iter != parts.end(); ++iter)
{
LayoutPart::Pointer part = *iter;
if (part.Cast<ILayoutContainer> () != 0)
{
// iterate through sub containers to find sub-parts
std::vector<PartPlaceholder::Pointer> newParts = this->CollectPlaceholders(
part.Cast<ILayoutContainer>()->GetChildren());
result.insert(result.end(), newParts.begin(), newParts.end());
}
else if (part.Cast<IStackableContainer> () != 0)
{
std::list<StackablePart::Pointer> children = part.Cast<IStackableContainer>()->GetChildren();
for (std::list<StackablePart::Pointer>::iterator partIter = children.begin();
partIter != children.end(); ++partIter)
{
if (partIter->Cast<PartPlaceholder>() != 0)
result.push_back(partIter->Cast<PartPlaceholder>());
}
}
}
return result;
}
std::vector<ContainerPlaceholder::Pointer> PerspectiveHelper::CollectContainerPlaceholders()
{
// Scan the main window.
std::vector<ContainerPlaceholder::Pointer> results(this->CollectContainerPlaceholders(
mainLayout->GetChildren()));
// // Scan each detached window.
// if (detachable)
// {
// for (DetachedWindowsType::iterator winIter = detachedWindowList.begin();
// winIter != detachedWindowList.end(); ++winIter)
// {
// DetachedWindow::Pointer win = *winIter;
// std::list<StackablePart::Pointer> moreResults = win->GetChildren();
// if (moreResults.size()> 0)
// {
// for (std::list<StackablePart::Pointer>::iterator iter = moreResults.begin();
// iter != moreResults.end(); ++iter)
// {
// if (iter->Cast<PartPlaceholder>() != 0)
// results.push_back(iter->Cast<PartPlaceholder>());
// }
// }
// }
// }
return results;
}
std::vector<ContainerPlaceholder::Pointer> PerspectiveHelper::CollectContainerPlaceholders(
const std::list<LayoutPart::Pointer>& parts)
{
std::vector<ContainerPlaceholder::Pointer> result;
for (std::list<LayoutPart::Pointer>::const_iterator iter = parts.begin();
iter != parts.end(); ++iter)
{
LayoutPart::Pointer part = *iter;
if (part.Cast<ILayoutContainer> () != 0)
{
// iterate through sub containers to find sub-parts
std::vector<ContainerPlaceholder::Pointer> newParts = this->CollectContainerPlaceholders(
part.Cast<ILayoutContainer>()->GetChildren());
result.insert(result.end(), newParts.begin(), newParts.end());
}
else if (part.Cast<ContainerPlaceholder> () != 0)
{
result.push_back(part.Cast<ContainerPlaceholder>());
}
}
return result;
}
void PerspectiveHelper::CollectViewPanes(std::vector<PartPane::Pointer>& result)
{
// Scan the main window.
this->CollectViewPanes(result, mainLayout->GetChildren());
// Scan each detached window.
if (detachable)
{
for (DetachedWindowsType::iterator winIter = detachedWindowList.begin();
winIter != detachedWindowList.end(); ++winIter)
{
DetachedWindow::Pointer win = *winIter;
std::list<StackablePart::Pointer> moreResults = win->GetChildren();
for (std::list<StackablePart::Pointer>::iterator iter = moreResults.begin();
iter != moreResults.end(); ++iter)
{
if (iter->Cast<PartPane>() != 0)
result.push_back(iter->Cast<PartPane>());
}
}
}
}
void PerspectiveHelper::CollectViewPanes(std::vector<PartPane::Pointer>& result,
const std::list<LayoutPart::Pointer>& parts)
{
for (std::list<LayoutPart::Pointer>::const_iterator iter = parts.begin();
iter != parts.end(); ++iter)
{
LayoutPart::Pointer part = *iter;
if (part.Cast<PartStack> () != 0 && part.Cast<PartStack>()->GetAppearance() != PresentationFactoryUtil::ROLE_EDITOR)
{
std::list<StackablePart::Pointer> children = part.Cast<IStackableContainer>()->GetChildren();
for (std::list<StackablePart::Pointer>::iterator partIter = children.begin();
partIter != children.end(); ++partIter)
{
if (partIter->Cast<PartPane>() != 0)
result.push_back(partIter->Cast<PartPane>());
}
}
else if (part.Cast<ILayoutContainer> () != 0)
{
this->CollectViewPanes(result, part.Cast<ILayoutContainer>()->GetChildren());
}
}
}
void PerspectiveHelper::Deactivate()
{
if (!active)
{
return;
}
this->DisableAllDrag();
// Reparent all views to the main window
void* parent = mainLayout->GetParent();
std::vector<PartPane::Pointer> children;
this->CollectViewPanes(children, mainLayout->GetChildren());
for (DetachedWindowsType::iterator winIter = detachedWindowList.begin();
winIter != detachedWindowList.end(); ++winIter)
{
DetachedWindow::Pointer window = *winIter;
std::list<StackablePart::Pointer> moreResults = window->GetChildren();
for (std::list<StackablePart::Pointer>::iterator iter = moreResults.begin();
iter != moreResults.end(); ++iter)
{
if (iter->Cast<PartPane>() != 0)
children.push_back(iter->Cast<PartPane>());
}
}
// *** Do we even need to do this if detached windows not supported?
for (std::vector<PartPane::Pointer>::iterator itr = children.begin();
itr != children.end(); ++itr)
{
PartPane::Pointer part = *itr;
part->Reparent(parent);
}
// Dispose main layout.
mainLayout->SetActive(false);
// Dispose the detached windows
for (DetachedWindowsType::iterator iter = detachedWindowList.begin();
iter != detachedWindowList.end(); ++iter)
{
(*iter)->Close();
}
active = false;
}
PerspectiveHelper::~PerspectiveHelper()
{
mainLayout->Dispose();
mainLayout->DisposeSashes();
}
void PerspectiveHelper::DescribeLayout(std::string& buf) const
{
if (detachable)
{
if (detachedWindowList.size() != 0)
{
buf.append("detachedWindows ("); //$NON-NLS-1$
for (DetachedWindowsType::const_iterator winIter = detachedWindowList.begin();
winIter != detachedWindowList.end(); ++winIter)
{
DetachedWindow::ConstPointer window = *winIter;
std::list<StackablePart::Pointer> children = window->GetChildren();
unsigned int j = 0;
if (children.size() != 0)
{
buf.append("dWindow ("); //$NON-NLS-1$
for (std::list<StackablePart::Pointer>::iterator partIter = children.begin();
partIter != children.end(); ++partIter, ++j)
{
if (partIter->Cast<PartPlaceholder>() != 0)
buf.append(partIter->Cast<PartPlaceholder>()->GetPlaceHolderId());
else if (partIter->Cast<PartPane>() != 0)
buf.append(
partIter->Cast<PartPane>()->GetPartReference()->GetPartName());
if (j < (children.size() - 1))
{
buf.append(", "); //$NON-NLS-1$
}
}
buf.append(")"); //$NON-NLS-1$
}
}
buf.append("), "); //$NON-NLS-1$
}
}
this->GetLayout()->DescribeLayout(buf);
}
void PerspectiveHelper::DerefPart(StackablePart::Pointer part)
{
// if (part.Cast<PartPane> () != 0)
// {
// IViewReference::Pointer ref = ((ViewPane) part).getViewReference();
// if (perspective.isFastView(ref))
// {
// // Special check: if it's a fast view then it's actual ViewStack
// // may only contain placeholders and the stack is represented in
// // the presentation by a container placeholder...make sure the
// // PartPlaceHolder for 'ref' is removed from the ViewStack
// String id = perspective.getFastViewManager().getIdForRef(ref);
// LayoutPart parentPart = findPart(id, 0);
// if (parentPart.Cast<ContainerPlaceholder> () != 0)
// {
// ViewStack vs =
// (ViewStack) ((ContainerPlaceholder) parentPart).getRealContainer();
// std::vector<LayoutPart::Pointer> kids = vs.getChildren();
// for (int i = 0; i < kids.length; i++)
// {
// if (kids[i].Cast<PartPlaceholder> () != 0)
// {
// if (ref.getId().equals(kids[i].id))
// vs.remove(kids[i]);
// }
// }
// }
// perspective.getFastViewManager().removeViewReference(ref, true, true);
// }
// }
// Get vital part stats before reparenting.
IStackableContainer::Pointer oldContainer = part->GetContainer();
bool wasDocked = part->IsDocked();
Shell::Pointer oldShell = part->GetShell();
// Reparent the part back to the main window
part->Reparent(mainLayout->GetParent());
// Update container.
if (oldContainer == 0)
{
return;
}
oldContainer->Remove(part);
IStackableContainer::ChildrenType children = oldContainer->GetChildren();
if (wasDocked)
{
bool hasChildren = (children.size()> 0);
if (hasChildren)
{
// make sure one is at least visible
int childVisible = 0;
for (IStackableContainer::ChildrenType::iterator iter = children.begin();
iter != children.end(); ++iter)
{
if ((*iter)->GetControl() != 0)
{
childVisible++;
}
}
// none visible, then reprarent and remove container
if (oldContainer.Cast<PartStack> () != 0)
{
PartStack::Pointer folder = oldContainer.Cast<PartStack>();
// Is the part in the trim?
bool inTrim = false;
// // Safety check...there may be no FastViewManager
// if (perspective.getFastViewManager() != 0)
// inTrim
// = perspective.getFastViewManager().getFastViews(folder.getID()).size()
// > 0;
if (childVisible == 0 && !inTrim)
{
ILayoutContainer::Pointer parentContainer = folder->GetContainer();
hasChildren = folder->GetChildren().size()> 0;
// We maintain the stack as a place-holder if it has children
// (which at this point would represent view place-holders)
if (hasChildren)
{
folder->Dispose();
// replace the real container with a ContainerPlaceholder
ContainerPlaceholder::Pointer placeholder(
new ContainerPlaceholder(folder->GetID()));
placeholder->SetRealContainer(folder);
parentContainer->Replace(folder, placeholder);
}
}
else if (childVisible == 1)
{
LayoutTree::Pointer layout = mainLayout->GetLayoutTree();
layout = layout->Find(folder);
layout->SetBounds(layout->GetBounds());
}
}
}
if (!hasChildren)
{
// There are no more children in this container, so get rid of
// it
if (oldContainer.Cast<LayoutPart> () != 0)
{
//BERRY_INFO << "No children left, removing container\n";
LayoutPart::Pointer parent = oldContainer.Cast<LayoutPart>();
ILayoutContainer::Pointer parentContainer = parent->GetContainer();
if (parentContainer != 0)
{
parentContainer->Remove(parent);
parent->Print(std::cout);
parent->Dispose();
}
}
}
}
else if (!wasDocked)
{
if (children.empty())
{
// There are no more children in this container, so get rid of
// it
// Turn on redraw again just in case it was off.
//oldShell.setRedraw(true);
DetachedWindow::Pointer w = oldShell->GetData().Cast<DetachedWindow>();
oldShell->Close();
detachedWindowList.remove(w);
}
else
{
// There are children. If none are visible hide detached
// window.
bool allInvisible = true;
for (IStackableContainer::ChildrenType::iterator iter = children.begin();
iter != children.end(); ++iter)
{
if (iter->Cast<PartPlaceholder> () == 0)
{
allInvisible = false;
break;
}
}
if (allInvisible)
{
DetachedPlaceHolder::Pointer placeholder(new DetachedPlaceHolder("",
oldShell->GetBounds()));
for (IStackableContainer::ChildrenType::iterator iter = children.begin();
iter != children.end(); ++iter)
{
oldContainer->Remove(*iter);
(*iter)->SetContainer(placeholder);
placeholder->Add(*iter);
}
detachedPlaceHolderList.push_back(placeholder);
DetachedWindow::Pointer w = oldShell->GetData().Cast<DetachedWindow>();
oldShell->Close();
detachedWindowList.remove(w);
}
}
}
}
void PerspectiveHelper::Detach(LayoutPart::Pointer part, int x, int y)
{
// Detaching is disabled on some platforms ..
if (!detachable)
{
return;
}
// Calculate detached window size.
Point size = part->GetSize();
if (size.x == 0 || size.y == 0)
{
ILayoutContainer::Pointer container = part->GetContainer();
if (container.Cast<LayoutPart> () != 0)
{
size = container.Cast<LayoutPart>()->GetSize();
}
}
int width = std::max<int>(size.x, MIN_DETACH_WIDTH);
int height = std::max<int>(size.y, MIN_DETACH_HEIGHT);
// Create detached window.
DetachedWindow::Pointer window(new DetachedWindow(page));
detachedWindowList.push_back(window);
// Open window.
window->Create();
window->GetShell()->SetBounds(x, y, width, height);
window->Open();
if (part.Cast<PartStack> () != 0)
{
//window.getShell().setRedraw(false);
//parentWidget.setRedraw(false);
PartStack::Pointer stack = part.Cast<PartStack>();
StackablePart::Pointer visiblePart = stack->GetSelection();
IStackableContainer::ChildrenType children = stack->GetChildren();
for (IStackableContainer::ChildrenType::iterator iter = children.begin();
iter != children.end(); ++iter)
{
if (!(*iter)->IsPlaceHolder())
{
// remove the part from its current container
this->DerefPart(*iter);
// add part to detached window.
window->Add(*iter);
}
}
if (visiblePart != 0)
{
this->BringPartToTop(visiblePart);
visiblePart->SetFocus();
}
//window.getShell().setRedraw(true);
//parentWidget.setRedraw(true);
}
}
void PerspectiveHelper::DetachPart(StackablePart::Pointer part, int x, int y)
{
// Detaching is disabled on some platforms ..
if (!detachable)
{
return;
}
// Calculate detached window size.
Point size = part->GetSize();
if (size.x == 0 || size.y == 0)
{
IStackableContainer::Pointer container = part->GetContainer();
if (container.Cast<LayoutPart> () != 0)
{
size = container.Cast<LayoutPart>()->GetSize();
}
}
int width = std::max<int>(size.x, MIN_DETACH_WIDTH);
int height = std::max<int>(size.y, MIN_DETACH_HEIGHT);
// Create detached window.
DetachedWindow::Pointer window(new DetachedWindow(page));
detachedWindowList.push_back(window);
// Open window.
window->Create();
window->GetShell()->SetBounds(x, y, width, height);
window->Open();
// remove the part from its current container
this->DerefPart(part);
// add part to detached window.
window->Add(part);
part->SetFocus();
}
void PerspectiveHelper::DetachPart(IViewReference::Pointer ref)
{
PartPane::Pointer pane = ref.Cast<WorkbenchPartReference>()->GetPane();
if (this->CanDetach() && pane != 0)
{
// if (getMaximizedStack() != 0)
// getMaximizedStack().setState(IStackPresentationSite.STATE_RESTORED);
Rectangle bounds = pane->GetParentBounds();
this->DetachPart(pane, bounds.x, bounds.y);
}
}
void PerspectiveHelper::AddDetachedPart(StackablePart::Pointer part)
{
// Calculate detached window size.
Rectangle bounds = Tweaklets::Get(GuiWidgetsTweaklet::KEY)->GetShell(parentWidget)->GetBounds();
bounds.x = bounds.x + (bounds.width - 300) / 2;
bounds.y = bounds.y + (bounds.height - 300) / 2;
this->AddDetachedPart(part, bounds);
}
void PerspectiveHelper::AddDetachedPart(StackablePart::Pointer part,
const Rectangle& bounds)
{
// Detaching is disabled on some platforms ..
if (!detachable)
{
this->AddPart(part);
return;
}
// Create detached window.
DetachedWindow::Pointer window(new DetachedWindow(page));
detachedWindowList.push_back(window);
window->Create();
// add part to detached window.
part->CreateControl(window->GetShell()->GetControl());
window->Add(part);
// Open window.
window->GetShell()->SetBounds(bounds.x, bounds.y, bounds.width, bounds.height);
window->Open();
part->SetFocus();
}
void PerspectiveHelper::DisableAllDrag()
{
DragUtil::RemoveDragTarget(0, dragTarget);
}
void PerspectiveHelper::EnableAllDrag()
{
DragUtil::AddDragTarget(0, dragTarget);
}
StackablePart::Pointer PerspectiveHelper::FindPart(const std::string& id)
{
return this->FindPart(id, "");
}
StackablePart::Pointer PerspectiveHelper::FindPart(const std::string& primaryId,
const std::string& secondaryId)
{
//BERRY_INFO << "Looking for part: " << primaryId << ":" << secondaryId << std::endl;
// check main window.
std::vector<MatchingPart> matchingParts;
StackablePart::Pointer part = (secondaryId != "") ? this->FindPart(primaryId, secondaryId,
mainLayout->GetChildren(), matchingParts) : this->FindPart(primaryId,
mainLayout->GetChildren(), matchingParts);
if (part != 0)
{
return part;
}
// check each detached windows.
for (DetachedWindowsType::iterator iter = detachedWindowList.begin();
iter != detachedWindowList.end(); ++iter)
{
DetachedWindow::Pointer window = *iter;
part = (secondaryId != "") ? this->FindPart(primaryId, secondaryId,
window->GetChildren(), matchingParts) : this->FindPart(primaryId,
window->GetChildren(), matchingParts);
if (part != 0)
{
return part;
}
}
for (DetachedPlaceHoldersType::iterator iter = detachedPlaceHolderList.begin();
iter != detachedPlaceHolderList.end(); ++iter)
{
DetachedPlaceHolder::Pointer holder = *iter;
part = (secondaryId != "") ? this->FindPart(primaryId, secondaryId,
holder->GetChildren(), matchingParts) : this->FindPart(primaryId,
holder->GetChildren(), matchingParts);
if (part != 0)
{
return part;
}
}
//BERRY_INFO << "Looking through the matched parts (count: " << matchingParts.size() << ")\n";
// sort the matching parts
if (matchingParts.size()> 0)
{
std::partial_sort(matchingParts.begin(), (matchingParts.begin()), matchingParts.end(), CompareMatchingParts());
const MatchingPart& mostSignificantPart = matchingParts.front();
return mostSignificantPart.part;
}
// Not found.
return StackablePart::Pointer(0);
}
StackablePart::Pointer PerspectiveHelper::FindPart(const std::string& id,
const std::list<LayoutPart::Pointer>& parts,
std::vector<MatchingPart>& matchingParts)
{
//BERRY_INFO << "Looking for part " << id << " in a list of layout parts with size " << parts.size() << std::endl;
for (std::list<LayoutPart::Pointer>::const_iterator iter = parts.begin();
iter != parts.end(); ++iter)
{
LayoutPart::Pointer part = *iter;
if (part.Cast<ILayoutContainer> () != 0)
{
StackablePart::Pointer result = this->FindPart(id, part.Cast<ILayoutContainer>()->GetChildren(),
matchingParts);
if (result != 0) return result;
}
else if (part.Cast<IStackableContainer>() != 0)
{
StackablePart::Pointer result = this->FindPart(id, part.Cast<IStackableContainer>()->GetChildren(),
matchingParts);
if (result != 0) return result;
}
}
//BERRY_INFO << "Returning 0\n";
return StackablePart::Pointer(0);
}
LayoutPart::Pointer PerspectiveHelper::FindLayoutPart(const std::string& id,
const std::list<LayoutPart::Pointer>& parts,
std::vector<MatchingPart>& matchingParts)
{
for (std::list<LayoutPart::Pointer>::const_iterator iter = parts.begin();
iter != parts.end(); ++iter)
{
LayoutPart::Pointer part = *iter;
// check for part equality, parts with secondary ids fail
if (part->GetID() == id)
{
return part;
}
else if (part.Cast<EditorSashContainer>() != 0)
{
// Skip.
}
else if (part.Cast<ILayoutContainer> () != 0)
{
part = this->FindLayoutPart(id, part.Cast<ILayoutContainer>()->GetChildren(),
matchingParts);
return part;
}
}
return LayoutPart::Pointer(0);
}
StackablePart::Pointer PerspectiveHelper::FindPart(const std::string& id,
const std::list<StackablePart::Pointer>& parts,
std::vector<MatchingPart>& matchingParts)
{
//BERRY_INFO << "Looking for part " << id << " in a list of stackable parts with size " << parts.size() << std::endl;
for (std::list<StackablePart::Pointer>::const_iterator iter = parts.begin();
iter != parts.end(); ++iter)
{
StackablePart::Pointer part = *iter;
// check for part equality, parts with secondary ids fail
if (part->GetId() == id)
{
if (part.Cast<PartPane> () != 0)
{
PartPane::Pointer pane = part.Cast<PartPane>();
IViewReference::Pointer ref = pane->GetPartReference().Cast<IViewReference>();
if (ref->GetSecondaryId() != "")
{
continue;
}
}
return part;
}
// check pattern matching placeholders
else if (part.Cast<PartPlaceholder>() != 0
&& part.Cast<PartPlaceholder>()->HasWildCard())
{
Poco::RegularExpression re(id, Poco::RegularExpression::RE_CASELESS);
if (re.match(part->GetId()))
{
matchingParts.push_back(MatchingPart(part->GetId(), "", part));
}
// StringMatcher sm = new StringMatcher(part.getID(), true, false);
// if (sm.match(id))
// {
// matchingParts .add(new MatchingPart(part.getID(), 0, part));
// }
}
}
//BERRY_INFO << "Returning 0\n";
return StackablePart::Pointer(0);
}
StackablePart::Pointer PerspectiveHelper::FindPart(const std::string& primaryId,
const std::string& secondaryId,
const std::list<LayoutPart::Pointer>& parts,
std::vector<MatchingPart>& matchingParts)
{
for (std::list<LayoutPart::Pointer>::const_iterator iter = parts.begin();
iter != parts.end(); ++iter)
{
LayoutPart::Pointer part = *iter;
// check containers first
if (part.Cast<EditorSashContainer>() != 0)
{
// skip
}
else if (part.Cast<ILayoutContainer> () != 0)
{
StackablePart::Pointer testPart = this->FindPart(primaryId, secondaryId,
part.Cast<ILayoutContainer>()->GetChildren(), matchingParts);
if (testPart != 0)
{
return testPart;
}
}
}
return StackablePart::Pointer(0);
}
StackablePart::Pointer PerspectiveHelper::FindPart(const std::string& primaryId,
const std::string& secondaryId,
const std::list<StackablePart::Pointer>& parts,
std::vector<MatchingPart>& matchingParts)
{
for (std::list<StackablePart::Pointer>::const_iterator iter = parts.begin();
iter != parts.end(); ++iter)
{
StackablePart::Pointer part = *iter;
// check for view part equality
if (part.Cast<PartPane> () != 0)
{
PartPane::Pointer pane = part.Cast<PartPane>();
IViewReference::Pointer ref = pane->GetPartReference().Cast<IViewReference>();
if (ref->GetId() == primaryId && ref->GetSecondaryId() == secondaryId)
{
return part;
}
}
// check placeholders
else if (part.Cast<PartPlaceholder> () != 0)
{
std::string id = part->GetId();
// optimization: don't bother parsing id if it has no separator -- it can't match
std::string phSecondaryId = ViewFactory::ExtractSecondaryId(id);
if (phSecondaryId == "")
{
// but still need to check for wildcard case
if (id == PartPlaceholder::WILD_CARD)
{
matchingParts.push_back(MatchingPart(id, "", part));
}
continue;
}
std::string phPrimaryId = ViewFactory::ExtractPrimaryId(id);
// perfect matching pair
if (phPrimaryId == primaryId && phSecondaryId == secondaryId)
{
return part;
}
// check for partial matching pair
Poco::RegularExpression pre(phPrimaryId, Poco::RegularExpression::RE_CASELESS);
if (pre.match(primaryId))
{
Poco::RegularExpression sre(phSecondaryId, Poco::RegularExpression::RE_CASELESS);
if (sre.match(secondaryId))
{
matchingParts.push_back(MatchingPart(phPrimaryId, phSecondaryId, part));
}
}
}
}
return StackablePart::Pointer(0);
}
bool PerspectiveHelper::HasPlaceholder(const std::string& id)
{
return this->HasPlaceholder(id, 0);
}
bool PerspectiveHelper::HasPlaceholder(const std::string& primaryId,
const std::string& secondaryId)
{
StackablePart::Pointer testPart;
if (secondaryId == "")
{
testPart = this->FindPart(primaryId);
}
else
{
testPart = this->FindPart(primaryId, secondaryId);
}
return (testPart != 0 && testPart.Cast<PartPlaceholder> () != 0);
}
PartSashContainer::Pointer PerspectiveHelper::GetLayout() const
{
return mainLayout;
}
bool PerspectiveHelper::IsActive()
{
return active;
}
float PerspectiveHelper::GetDockingRatio(StackablePart::Pointer source,
LayoutPart::Pointer target)
{
if ((source.Cast<PartPane> () != 0 || source.Cast<PartStack> () != 0)
&& target.Cast<EditorSashContainer> () != 0)
{
return 0.25f;
}
return 0.5f;
}
void PerspectiveHelper::RemovePart(StackablePart::Pointer part)
{
// Reparent the part back to the main window
void* parent = mainLayout->GetParent();
part->Reparent(parent);
// Replace part with a placeholder
IStackableContainer::Pointer container = part->GetContainer();
if (container != 0)
{
std::string placeHolderId = part->GetPlaceHolderId();
container->Replace(part, StackablePart::Pointer(new PartPlaceholder(placeHolderId)));
// // If the parent is root we're done. Do not try to replace
// // it with placeholder.
// if (container == mainLayout)
// {
// return;
// }
// If the parent is empty replace it with a placeholder.
std::list<StackablePart::Pointer> children = container->GetChildren();
bool allInvisible = true;
for (std::list<StackablePart::Pointer>::iterator childIter = children.begin();
childIter != children.end(); ++childIter)
{
if (childIter->Cast<PartPlaceholder> () == 0)
{
allInvisible = false;
break;
}
}
if (allInvisible && (container.Cast<LayoutPart> () != 0))
{
// what type of window are we in?
LayoutPart::Pointer cPart = container.Cast<LayoutPart>();
//Window oldWindow = cPart.getWindow();
bool wasDocked = cPart->IsDocked();
Shell::Pointer oldShell = cPart->GetShell();
if (wasDocked)
{
// PR 1GDFVBY: ViewStack not disposed when page
// closed.
if (container.Cast<PartStack> () != 0)
{
container.Cast<PartStack>()->Dispose();
}
// replace the real container with a
// ContainerPlaceholder
ILayoutContainer::Pointer parentContainer = cPart->GetContainer();
ContainerPlaceholder::Pointer placeholder(
new ContainerPlaceholder(cPart->GetID()));
placeholder->SetRealContainer(container);
parentContainer->Replace(cPart, placeholder);
}
else
{
DetachedPlaceHolder::Pointer placeholder(
new DetachedPlaceHolder("", oldShell->GetBounds())); //$NON-NLS-1$
for (std::list<StackablePart::Pointer>::iterator childIter2 = children.begin();
childIter2 != children.end(); ++childIter2)
{
(*childIter2)->GetContainer()->Remove(*childIter2);
(*childIter2)->SetContainer(placeholder);
placeholder->Add(*childIter2);
}
detachedPlaceHolderList.push_back(placeholder);
DetachedWindow::Pointer w = oldShell->GetData().Cast<DetachedWindow>();
oldShell->Close();
detachedWindowList.remove(w);
}
}
}
}
void PerspectiveHelper::ReplacePlaceholderWithPart(StackablePart::Pointer part)
{
// Look for a PartPlaceholder that will tell us how to position this
// object
std::vector<PartPlaceholder::Pointer> placeholders = this->CollectPlaceholders();
for (unsigned int i = 0; i < placeholders.size(); i++)
{
if (placeholders[i]->GetCompoundId() == part->GetCompoundId())
{
// found a matching placeholder which we can replace with the
// new View
IStackableContainer::Pointer container = placeholders[i]->GetContainer();
if (container != 0)
{
if (container.Cast<ContainerPlaceholder> () != 0)
{
// One of the children is now visible so replace the
// ContainerPlaceholder with the real container
ContainerPlaceholder::Pointer containerPlaceholder =
container.Cast<ContainerPlaceholder>();
ILayoutContainer::Pointer parentContainer =
containerPlaceholder->GetContainer();
container
= containerPlaceholder->GetRealContainer();
if (container.Cast<LayoutPart> () != 0)
{
parentContainer->Replace(containerPlaceholder,
container.Cast<LayoutPart>());
}
containerPlaceholder->SetRealContainer(IStackableContainer::Pointer(0));
}
container->Replace(placeholders[i], part);
return;
}
}
}
}
void PerspectiveHelper::ReplacePlaceholderWithPart(LayoutPart::Pointer part)
{
// Look for a ContainerPlaceholder that will tell us how to position this
// object
std::vector<ContainerPlaceholder::Pointer> placeholders(this->CollectContainerPlaceholders());
for (std::size_t i = 0; i < placeholders.size(); i++)
{
if (placeholders[i]->GetID() == part->GetID())
{
// found a matching placeholder which we can replace with the
// new container
ILayoutContainer::Pointer container = placeholders[i]->GetContainer();
if (container != 0)
{
// if (container.Cast<ContainerPlaceholder> () != 0)
// {
// // One of the children is now visible so replace the
// // ContainerPlaceholder with the real container
// ContainerPlaceholder::Pointer containerPlaceholder =
// container.Cast<ContainerPlaceholder>();
// ILayoutContainer::Pointer parentContainer =
// containerPlaceholder->GetContainer();
// container
// = containerPlaceholder->GetRealContainer();
// if (container.Cast<LayoutPart> () != 0)
// {
// parentContainer->Replace(containerPlaceholder,
// container.Cast<LayoutPart>());
// }
// containerPlaceholder->SetRealContainer(IStackableContainer::Pointer(0));
// }
container->Replace(placeholders[i], part);
return;
}
}
}
}
bool PerspectiveHelper::RestoreState(IMemento::Pointer memento)
{
// Restore main window.
IMemento::Pointer childMem = memento->GetChild(WorkbenchConstants::TAG_MAIN_WINDOW);
//IStatus r = mainLayout->RestoreState(childMem);
bool r = mainLayout->RestoreState(childMem);
// Restore each floating window.
if (detachable)
{
std::vector<IMemento::Pointer> detachedWindows(memento->GetChildren(
WorkbenchConstants::TAG_DETACHED_WINDOW));
for (std::vector<IMemento::Pointer>::iterator iter = detachedWindows.begin();
iter != detachedWindows.end(); ++iter)
{
DetachedWindow::Pointer win(new DetachedWindow(page));
detachedWindowList.push_back(win);
win->RestoreState(*iter);
}
std::vector<IMemento::Pointer> childrenMem(memento->GetChildren(
WorkbenchConstants::TAG_HIDDEN_WINDOW));
for (std::vector<IMemento::Pointer>::iterator iter = childrenMem.begin();
iter != childrenMem.end(); ++iter)
{
DetachedPlaceHolder::Pointer holder(
new DetachedPlaceHolder("", Rectangle(0, 0, 0, 0)));
holder->RestoreState(*iter);
detachedPlaceHolderList.push_back(holder);
}
}
// Get the cached id of the currently maximized stack
//maximizedStackId = childMem.getString(IWorkbenchConstants.TAG_MAXIMIZED);
return r;
}
bool PerspectiveHelper::SaveState(IMemento::Pointer memento)
{
// Persist main window.
IMemento::Pointer childMem = memento->CreateChild(WorkbenchConstants::TAG_MAIN_WINDOW);
//IStatus r = mainLayout->SaveState(childMem);
bool r = mainLayout->SaveState(childMem);
if (detachable)
{
// Persist each detached window.
for (DetachedWindowsType::iterator iter = detachedWindowList.begin();
iter != detachedWindowList.end(); ++iter)
{
childMem = memento->CreateChild(WorkbenchConstants::TAG_DETACHED_WINDOW);
(*iter)->SaveState(childMem);
}
for (DetachedPlaceHoldersType::iterator iter = detachedPlaceHolderList.begin();
iter != detachedPlaceHolderList.end(); ++iter)
{
childMem = memento->CreateChild(WorkbenchConstants::TAG_HIDDEN_WINDOW);
(*iter)->SaveState(childMem);
}
}
// Write out the id of the maximized (View) stack (if any)
// NOTE: we only write this out if it's a ViewStack since the
// Editor Area is handled by the perspective
// if (maximizedStack.Cast<PartStack> () != 0)
// {
// childMem.putString(IWorkbenchConstants.TAG_MAXIMIZED,
// maximizedStack.getID());
// }
// else if (maximizedStackId != 0)
// {
// // Maintain the cache if the perspective has never been activated
// childMem.putString(IWorkbenchConstants.TAG_MAXIMIZED, maximizedStackId);
// }
return r;
}
void PerspectiveHelper::UpdateBoundsMap()
{
boundsMap.clear();
// Walk the layout gathering the current bounds of each stack
// and the editor area
std::list<LayoutPart::Pointer> kids = mainLayout->GetChildren();
for (std::list<LayoutPart::Pointer>::iterator iter = kids.begin();
iter != kids.end(); ++iter)
{
if (iter->Cast<PartStack> () != 0)
{
PartStack::Pointer vs = iter->Cast<PartStack>();
boundsMap.insert(std::make_pair(vs->GetID(), vs->GetBounds()));
}
else if (iter->Cast<EditorSashContainer> () != 0)
{
EditorSashContainer::Pointer esc = iter->Cast<EditorSashContainer>();
boundsMap.insert(std::make_pair(esc->GetID(), esc->GetBounds()));
}
}
}
void PerspectiveHelper::ResetBoundsMap()
{
boundsMap.clear();
}
Rectangle PerspectiveHelper::GetCachedBoundsFor(const std::string& id)
{
return boundsMap[id];
}
}
diff --git a/BlueBerry/Bundles/org.blueberry.ui/src/internal/berryStackablePart.cpp b/BlueBerry/Bundles/org.blueberry.ui/src/internal/berryStackablePart.cpp
index 4803a6265c..02433d51e6 100755
--- a/BlueBerry/Bundles/org.blueberry.ui/src/internal/berryStackablePart.cpp
+++ b/BlueBerry/Bundles/org.blueberry.ui/src/internal/berryStackablePart.cpp
@@ -1,172 +1,172 @@
/*=========================================================================
Program: BlueBerry Platform
Language: C++
Date: $Date$
Version: $Revision$
Copyright (c) German Cancer Research Center, Division of Medical and
Biological Informatics. All rights reserved.
See MITKCopyright.txt or http://www.mitk.org/copyright.html for details.
This software is distributed WITHOUT ANY WARRANTY; without even
the implied warranty of MERCHANTABILITY or FITNESS FOR A PARTICULAR
PURPOSE. See the above copyright notices for more information.
=========================================================================*/
#include "berryStackablePart.h"
#include "berryIStackableContainer.h"
#include "berryDetachedWindow.h"
#include "../berryIWorkbenchWindow.h"
#include "../tweaklets/berryGuiWidgetsTweaklet.h"
#include "../berryImageDescriptor.h"
namespace berry
{
StackablePart::StackablePart(std::string id_)
: id(id_)
{
}
IStackableContainer::Pointer StackablePart::GetContainer() const
{
return container;
}
void StackablePart::SetContainer(IStackableContainer::Pointer container)
{
this->container = container;
}
void StackablePart::Reparent(void* newParent)
{
void* control = this->GetControl();
- GuiWidgetsTweaklet::Pointer guiTweaklet = Tweaklets::Get(GuiWidgetsTweaklet::KEY);
+ GuiWidgetsTweaklet* guiTweaklet = Tweaklets::Get(GuiWidgetsTweaklet::KEY);
if ((control == 0) || (guiTweaklet->GetParent(control) == newParent))
{
return;
}
if (guiTweaklet->IsReparentable(control))
{
// make control small in case it is not resized with other controls
//control.setBounds(0, 0, 0, 0);
// By setting the control to disabled before moving it,
// we ensure that the focus goes away from the control and its children
// and moves somewhere else
bool enabled = guiTweaklet->GetEnabled(control);
guiTweaklet->SetEnabled(control, false);
guiTweaklet->SetParent(control, newParent);
guiTweaklet->SetEnabled(control, enabled);
guiTweaklet->MoveAbove(control, 0);
}
}
void StackablePart::DescribeLayout(std::string& /*description*/) const
{
}
std::string StackablePart::GetPlaceHolderId() const
{
return this->GetId();
}
std::string StackablePart::GetId() const
{
return id;
}
void StackablePart::SetId(const std::string& id)
{
this->id = id;
}
void StackablePart::SetFocus()
{
}
void StackablePart::SetBounds(const Rectangle& r)
{
void* ctrl = this->GetControl();
if (ctrl)
{
return Tweaklets::Get(GuiWidgetsTweaklet::KEY)->SetBounds(ctrl, r);
}
}
Rectangle StackablePart::GetBounds()
{
return Rectangle();
}
Point StackablePart::GetSize()
{
Rectangle r = this->GetBounds();
Point ptSize(r.width, r.height);
return ptSize;
}
bool StackablePart::IsDocked()
{
Shell::Pointer s = this->GetShell();
if (s == 0)
{
return false;
}
return s->GetData().Cast<IWorkbenchWindow>() != 0;
}
Shell::Pointer StackablePart::GetShell()
{
void* ctrl = this->GetControl();
if (ctrl)
{
return Tweaklets::Get(GuiWidgetsTweaklet::KEY)->GetShell(ctrl);
}
return Shell::Pointer(0);
}
IWorkbenchWindow::Pointer StackablePart::GetWorkbenchWindow()
{
Shell::Pointer s = this->GetShell();
if (s == 0)
{
return IWorkbenchWindow::Pointer(0);
}
Object::Pointer data = s->GetData();
if (data.Cast<IWorkbenchWindow>() != 0)
{
return data.Cast<IWorkbenchWindow>();
}
else if (data.Cast<DetachedWindow>() != 0)
{
return data.Cast<DetachedWindow>()->GetWorkbenchPage()->GetWorkbenchWindow();
}
return IWorkbenchWindow::Pointer(0);
}
std::string StackablePart::GetCompoundId()
{
return this->GetId();
}
bool StackablePart::IsPlaceHolder() const
{
return false;
}
void StackablePart::TestInvariants()
{
}
}
diff --git a/BlueBerry/Bundles/org.blueberry.ui/src/internal/berryTweaklets.cpp b/BlueBerry/Bundles/org.blueberry.ui/src/internal/berryTweaklets.cpp
index 44b6d8851f..8cdd2bc95e 100755
--- a/BlueBerry/Bundles/org.blueberry.ui/src/internal/berryTweaklets.cpp
+++ b/BlueBerry/Bundles/org.blueberry.ui/src/internal/berryTweaklets.cpp
@@ -1,26 +1,62 @@
/*=========================================================================
Program: BlueBerry Platform
Language: C++
Date: $Date$
Version: $Revision$
Copyright (c) German Cancer Research Center, Division of Medical and
Biological Informatics. All rights reserved.
See MITKCopyright.txt or http://www.mitk.org/copyright.html for details.
This software is distributed WITHOUT ANY WARRANTY; without even
the implied warranty of MERCHANTABILITY or FITNESS FOR A PARTICULAR
PURPOSE. See the above copyright notices for more information.
=========================================================================*/
#include "berryTweaklets.h"
namespace berry
{
-std::map<Tweaklets::TweakKey_base, Object::Pointer> Tweaklets::defaults;
-std::map<Tweaklets::TweakKey_base, Object::Pointer> Tweaklets::tweaklets;
+QHash<TweakKey_base, QObject*> Tweaklets::defaults;
+QHash<TweakKey_base, QObject*> Tweaklets::tweaklets;
+
+TweakKey_base::TweakKey_base(const QString& _tweakClass) :
+ tweakClass(_tweakClass)
+{ }
+
+bool TweakKey_base::operator==(const TweakKey_base& obj) const
+{
+ if (this == &obj)
+ return true;
+
+ return tweakClass == obj.tweakClass;
+}
+
+bool TweakKey_base::operator<(const TweakKey_base& obj) const
+{
+ return tweakClass < obj.tweakClass;
+}
+
+void Tweaklets::SetDefault(const TweakKey_base& definition,
+ QObject* implementation)
+{
+ defaults.insert(definition, implementation);
+}
+
+void Tweaklets::Clear()
+{
+ std::cout << "Clearing tweaklets\n";
+ tweaklets.clear();
+ defaults.clear();
+}
+
+}
+
+uint qHash(const berry::TweakKey_base& key)
+{
+ return qHash(key.tweakClass);
}
diff --git a/BlueBerry/Bundles/org.blueberry.ui/src/internal/berryTweaklets.h b/BlueBerry/Bundles/org.blueberry.ui/src/internal/berryTweaklets.h
index f9d37afeb5..1807b7769a 100755
--- a/BlueBerry/Bundles/org.blueberry.ui/src/internal/berryTweaklets.h
+++ b/BlueBerry/Bundles/org.blueberry.ui/src/internal/berryTweaklets.h
@@ -1,188 +1,157 @@
/*=========================================================================
Program: BlueBerry Platform
Language: C++
Date: $Date$
Version: $Revision$
Copyright (c) German Cancer Research Center, Division of Medical and
Biological Informatics. All rights reserved.
See MITKCopyright.txt or http://www.mitk.org/copyright.html for details.
This software is distributed WITHOUT ANY WARRANTY; without even
the implied warranty of MERCHANTABILITY or FITNESS FOR A PARTICULAR
PURPOSE. See the above copyright notices for more information.
=========================================================================*/
#ifndef BERRYTWEAKLETS_H_
#define BERRYTWEAKLETS_H_
-#include <string>
-#include <vector>
-#include <map>
+#include <org_blueberry_ui_Export.h>
-#include <berryObject.h>
-#include <berryIConfigurationElement.h>
-#include <berryIExtensionPointService.h>
-#include <berryPlatform.h>
+#include <QString>
-#include <org_blueberry_ui_Export.h>
+namespace berry {
-namespace berry
+struct BERRY_UI TweakKey_base
{
+ QString tweakClass;
-class BERRY_UI Tweaklets
-{
+ /**
+ * @param tweakClass
+ */
+ TweakKey_base(const QString& _tweakClass);
-public:
+ bool operator==(const TweakKey_base& obj) const;
+ bool operator<(const TweakKey_base& obj) const;
+};
- struct TweakKey_base
- {
- std::string tweakClass;
+}
- /**
- * @param tweakClass
- */
- TweakKey_base(const std::string& _tweakClass) :
- tweakClass(_tweakClass)
- {
+BERRY_UI uint qHash(const berry::TweakKey_base& key);
- }
+#include <berryIConfigurationElement.h>
+#include <berryIExtensionPointService.h>
+#include <berryPlatform.h>
- /* (non-Javadoc)
- * @see java.lang.Object#hashCode()
- */
- // int hashCode() {
- // final int prime = 31;
- // int result = 1;
- // result = prime * result
- // + ((tweakClass == null) ? 0 : tweakClass.hashCode());
- // return result;
- // }
-
- /* (non-Javadoc)
- * @see java.lang.Object#equals(java.lang.Object)
- */
- bool operator==(const TweakKey_base& obj) const
- {
- if (this == &obj)
- return true;
- return tweakClass == obj.tweakClass;
- }
+namespace berry {
- bool operator<(const TweakKey_base& obj) const
- {
- return tweakClass < obj.tweakClass;
- }
- };
+class BERRY_UI Tweaklets
+{
+
+public:
template<typename I>
struct TweakKey: public TweakKey_base
{
TweakKey() :
TweakKey_base("")
{
- tweakClass = I::GetManifestName();
+
+ tweakClass = QString(qobject_interface_iid<I*>());
}
- TweakKey(const std::string& _tweakClass) :
+ TweakKey(const QString& _tweakClass) :
TweakKey_base(_tweakClass)
{
}
};
static void SetDefault(const TweakKey_base& definition,
- Object::Pointer implementation)
- {
- defaults.insert(std::make_pair(definition, implementation));
- }
+ QObject* implementation);
- static void Clear()
- {
- std::cout << "Clearing tweaklets\n";
- tweaklets.clear();
- defaults.clear();
- }
+ static void Clear();
template<typename I>
- static typename I::Pointer Get(const TweakKey<I>& definition)
+ static I* Get(const TweakKey<I>& definition)
{
TweakletMap::const_iterator iter = tweaklets.find(definition);
- typename I::Pointer result;
+ QObject* result;
if (iter == tweaklets.end())
{
result = CreateTweaklet(definition);
- if (result.IsNull())
+ if (result == 0)
{
result = GetDefault(definition);
}
- poco_assert(result.IsNotNull());
- tweaklets.insert(std::make_pair(definition, result));
- return result;
+ Q_ASSERT(result != 0);
+ tweaklets.insert(definition, result);
+ return qobject_cast<I*>(result);
}
- return iter->second.Cast<I>();
+ return qobject_cast<I*>(iter.value());
}
private:
- typedef std::map<TweakKey_base, Object::Pointer> TweakletMap;
+ typedef QHash<TweakKey_base, QObject*> TweakletMap;
static TweakletMap defaults;
static TweakletMap tweaklets;
/**
* @param definition
* @return
*/
template<typename I>
- static typename I::Pointer GetDefault(const TweakKey<I>& definition)
+ static QObject* GetDefault(const TweakKey<I>& definition)
{
TweakletMap::const_iterator iter = defaults.find(definition);
if (iter == defaults.end())
- return typename I::Pointer(0);
+ return 0;
- return iter->second.Cast<I>();
+ return iter.value();
}
/**
* @param definition
* @return
*/
template<typename I>
- static typename I::Pointer CreateTweaklet(const TweakKey<I>& definition)
+ static QObject* CreateTweaklet(const TweakKey<I>& definition)
{
- std::vector<IConfigurationElement::Pointer> elements = Platform
- ::GetExtensionPointService()
- ->GetConfigurationElementsFor("org.blueberry.ui.tweaklets"); //$NON-NLS-1$
+ std::vector<IConfigurationElement::Pointer> elements =
+ Platform::GetExtensionPointService()
+ ->GetConfigurationElementsFor("org.blueberry.ui.tweaklets"); //$NON-NLS-1$
for (unsigned int i = 0; i < elements.size(); i++)
{
std::string attr;
if (elements[i]->GetAttribute("definition", attr) &&
- definition.tweakClass == attr)
+ definition.tweakClass == QString::fromStdString(attr))
{
try
{
- typename I::Pointer tweaklet(elements[i]->CreateExecutableExtension<I>("implementation")); //$NON-NLS-1$
- tweaklets.insert(std::make_pair(definition, tweaklet));
+ QObject* tweaklet = elements[i]->CreateExecutableExtension<QObject>("implementation");
+ tweaklets.insert(definition, tweaklet);
return tweaklet;
}
catch (CoreException e)
{
//StatusManager.getManager().handle(
// StatusUtil.newStatus(IStatus.ERR,
BERRY_ERROR << "Error with extension " << elements[i] << e.what();
// StatusManager.LOG);
}
}
}
- return typename I::Pointer(0);
+ return 0;
}
};
}
+
#endif /* BERRYTWEAKLETS_H_ */
diff --git a/BlueBerry/Bundles/org.blueberry.ui/src/internal/berryWorkbench.cpp b/BlueBerry/Bundles/org.blueberry.ui/src/internal/berryWorkbench.cpp
index 6e87ad8cd7..c870944b5c 100644
--- a/BlueBerry/Bundles/org.blueberry.ui/src/internal/berryWorkbench.cpp
+++ b/BlueBerry/Bundles/org.blueberry.ui/src/internal/berryWorkbench.cpp
@@ -1,1779 +1,1779 @@
/*=========================================================================
Program: BlueBerry Platform
Language: C++
Date: $Date$
Version: $Revision$
Copyright (c) German Cancer Research Center, Division of Medical and
Biological Informatics. All rights reserved.
See MITKCopyright.txt or http://www.mitk.org/copyright.html for details.
This software is distributed WITHOUT ANY WARRANTY; without even
the implied warranty of MERCHANTABILITY or FITNESS FOR A PARTICULAR
PURPOSE. See the above copyright notices for more information.
=========================================================================*/
#include "berryLog.h"
+#include "../tweaklets/berryWorkbenchTweaklet.h"
+
#include "berryWorkbench.h"
#include <berrySafeRunner.h>
-#include "../tweaklets/berryWorkbenchTweaklet.h"
-
#include "berrySaveablesList.h"
#include "berryViewRegistry.h"
#include "berryEditorRegistry.h"
#include "berryServiceLocatorCreator.h"
#include "berryWorkbenchPage.h"
#include "berryPerspective.h"
#include "berryPreferenceConstants.h"
#include "../dialogs/berryMessageDialog.h"
#include "berryWorkbenchWindow.h"
#include "../berryImageDescriptor.h"
#include "../berryDisplay.h"
#include "../services/berryIServiceFactory.h"
#include "../util/berrySafeRunnable.h"
#include "berryWorkbenchPlugin.h"
#include "berryWorkbenchConstants.h"
#include <Poco/Thread.h>
#include <Poco/Bugcheck.h>
#include <Poco/FileStream.h>
namespace berry
{
Workbench* Workbench::instance = 0;
WorkbenchTestable::Pointer Workbench::testableObject;
const unsigned int Workbench::VERSION_STRING_COUNT = 1;
const std::string Workbench::VERSION_STRING[Workbench::VERSION_STRING_COUNT] =
{ "1.0" };
const std::string Workbench::DEFAULT_WORKBENCH_STATE_FILENAME = "workbench.xml";
class RestoreStateRunnable: public SafeRunnable
{
private:
Workbench* workbench;
Poco::File stateFile;
bool& result;
public:
RestoreStateRunnable(Workbench* workbench, const Poco::File& stateFile,
bool& result) :
SafeRunnable(
"Unable to read workbench state. Workbench UI layout will be reset."),
workbench(workbench), stateFile(stateFile), result(result)
{
}
void Run()
{
Poco::FileInputStream input(stateFile.path());
IMemento::Pointer memento = XMLMemento::CreateReadRoot(input);
// Validate known version format
std::string version;
memento->GetString(WorkbenchConstants::TAG_VERSION, version);
bool valid = false;
for (std::size_t i = 0; i < Workbench::VERSION_STRING_COUNT; i++)
{
if (Workbench::VERSION_STRING[i] == version)
{
valid = true;
break;
}
}
if (!valid)
{
input.close();
std::string msg =
"Invalid workbench state version. workbench.xml will be deleted";
MessageDialog::OpenError(Shell::Pointer(0), "Restoring Problems", msg);
stateFile.remove();
// result[0] = new Status(IStatus.ERROR,
// WorkbenchPlugin.PI_WORKBENCH,
// IWorkbenchConfigurer.RESTORE_CODE_RESET, msg, null);
result = false;
return;
}
// // Validate compatible version format
// // We no longer support the release 1.0 format
// if (VERSION_STRING[0].equals(version))
// {
// reader.close();
// std::string msg = "The saved user interface layout is in an "
// "obsolete format and cannot be preserved. Your projects and files "
// "will not be affected. Press OK to convert to the new format. Press "
// "Cancel to exit with no changes.";
// std::vector<std::string> dlgLabels;
// dlgLabels.push_back("Ok");
// dlgLabels.push_back("Cancel");
// IDialog::Pointer dlg = MessageDialog::CreateDialog(Shell::Pointer(0),
// "Cannot Preserve Layout", 0, msg, IDialog::WARNING, dlgLabels, 0);
// IDialog::ReturnCode ignoreSavedState = dlg->Open();
// // OK is the default
// if (ignoreSavedState == IDialog::OK)
// {
// stateFile.remove();
// // result[0] = new Status(IStatus.WARNING,
// // WorkbenchPlugin.PI_WORKBENCH,
// // IWorkbenchConfigurer.RESTORE_CODE_RESET, msg,
// // null);
// result = false;
// }
// else
// {
// // result[0] = new Status(IStatus.WARNING,
// // WorkbenchPlugin.PI_WORKBENCH,
// // IWorkbenchConfigurer.RESTORE_CODE_EXIT, msg,
// // null);
// result = false;
// }
// return;
// }
// Restore the saved state
//final IStatus restoreResult = restoreState(memento);
/*bool restoreResult =*/ workbench->RestoreState(memento);
input.close();
// if (restoreResult.getSeverity() == IStatus.ERROR) {
// StartupThreading
// .runWithoutExceptions(new StartupRunnable() {
//
// public void runWithException() throws Throwable {
// StatusManager.getManager().handle(restoreResult, StatusManager.LOG);
// }
// });
//
// }
}
void HandleException(const std::exception& e)
{
//StartupThreading.runWithoutExceptions(new StartupRunnable() {
//public void runWithException() {
Handle(e);
// std::string msg = e.getMessage() == null ? "" : e.getMessage(); //$NON-NLS-1$
// result[0] = new Status(IStatus.ERROR,
// WorkbenchPlugin.PI_WORKBENCH,
// IWorkbenchConfigurer.RESTORE_CODE_RESET, msg, e);
result = false;
stateFile.remove();
// }});
}
private:
void Handle(const std::exception& e)
{
SafeRunnable::HandleException(e);
}
};
int Workbench::CreateAndRunWorkbench(Display* display,
WorkbenchAdvisor* advisor)
{
// create the workbench instance
Workbench workbench(display, advisor);
// run the workbench event loop
int returnCode = workbench.RunUI();
return returnCode;
}
Display* Workbench::CreateDisplay()
{
// create the display
Display* newDisplay = Tweaklets::Get(WorkbenchTweaklet::KEY)->CreateDisplay();
// workaround for 1GEZ9UR and 1GF07HN
//newDisplay.setWarnings(false);
// Set the priority higher than normal so as to be higher
// than the JobManager.
//Poco::Thread::current()->setPriority(Poco::Thread::PRIO_HIGH);
//initializeImages();
return newDisplay;
}
Workbench::ServiceLocatorOwner::ServiceLocatorOwner(Workbench* wb) :
workbench(wb)
{
}
void Workbench::ServiceLocatorOwner::Dispose()
{
MessageDialog::OpenInformation(
Shell::Pointer(0),
"Restart needed",
"A required plug-in is no longer available and the Workbench needs to be restarted. You will be prompted to save if there is any unsaved work.");
workbench->Close(PlatformUI::RETURN_RESTART, true);
}
Workbench::Workbench(Display* display, WorkbenchAdvisor* advisor) :
progressCount(-1), serviceLocatorOwner(new ServiceLocatorOwner(this)),
largeUpdates(0), introManager(0), isStarting(true), isClosing(false)
{
poco_check_ptr(display)
; poco_check_ptr(advisor);
// the reference count to the one and only workbench instance
// is increased, so that temporary smart pointer to the workbench
// do not delete it
this->Register();
this->display = display;
this->advisor = advisor;
Workbench::instance = this;
IServiceLocatorCreator::Pointer slc(new ServiceLocatorCreator());
this->serviceLocator =
slc->CreateServiceLocator(IServiceLocator::WeakPtr(),
IServiceFactory::ConstPointer(0),
IDisposable::WeakPtr(serviceLocatorOwner)).Cast<ServiceLocator>();
serviceLocator->RegisterService(IServiceLocatorCreator::GetManifestName(), slc);
returnCode = PlatformUI::RETURN_UNSTARTABLE;
}
Display* Workbench::GetDisplay()
{
return display;
}
Workbench* Workbench::GetInstance()
{
return instance;
}
WorkbenchTestable::Pointer Workbench::GetWorkbenchTestable()
{
if (!testableObject)
{
testableObject = new WorkbenchTestable();
}
return testableObject;
}
Workbench::~Workbench()
{
this->UnRegister(false);
}
Object::Pointer Workbench::GetService(const std::string& key)
{
return serviceLocator->GetService(key);
}
bool Workbench::HasService(const std::string& key) const
{
return serviceLocator->HasService(key);
}
bool Workbench::Init()
{
bool bail = false;
// create workbench window manager
//windowManager = new WindowManager();
IIntroRegistry* introRegistry = WorkbenchPlugin::GetDefault()
->GetIntroRegistry();
if (introRegistry->GetIntroCount() > 0) {
//TODO Product support
//IProduct product = Platform.getProduct();
//if (product != null) {
introDescriptor = introRegistry
->GetIntroForProduct("").Cast<IntroDescriptor>(); //product.getId());
//}
}
// TODO Correctly order service initialization
// there needs to be some serious consideration given to
// the services, and hooking them up in the correct order
//final EvaluationService restrictionService = new EvaluationService();
//final EvaluationService evaluationService = new EvaluationService();
// StartupThreading.runWithoutExceptions(new StartupRunnable() {
//
// public void runWithException() {
// serviceLocator.registerService(IRestrictionService.class,
// restrictionService);
// serviceLocator.registerService(IEvaluationService.class,
// evaluationService);
// }
// });
// Initialize the activity support.
//workbenchActivitySupport = new WorkbenchActivitySupport();
//activityHelper = ActivityPersistanceHelper.getInstance();
this->InitializeDefaultServices();
// initializeFonts();
// initializeColors();
// initializeApplicationColors();
// now that the workbench is sufficiently initialized, let the advisor
// have a turn.
advisor->InternalBasicInitialize(this->GetWorkbenchConfigurer());
// attempt to restore a previous workbench state
advisor->PreStartup();
if (!advisor->OpenWindows())
{
bail = true;
}
if (bail)
return false;
//forceOpenPerspective();
return true;
}
bool Workbench::RestoreState()
{
//return false;
if (!GetWorkbenchConfigurer()->GetSaveAndRestore())
{
// std::string msg = "This application does not save and restore previously saved state.";
// return new Status(IStatus.WARNING, WorkbenchPlugin.PI_WORKBENCH,
// IWorkbenchConfigurer.RESTORE_CODE_RESET, msg, null);
return false;
}
// Read the workbench state file.
Poco::File stateFile;
// If there is no state file cause one to open.
if (!GetWorkbenchStateFile(stateFile) || !stateFile.exists())
{
// std::string msg = "No previously saved state to restore.";
// return new Status(IStatus.WARNING, WorkbenchPlugin.PI_WORKBENCH,
// IWorkbenchConfigurer.RESTORE_CODE_RESET, msg, null);
return false;
}
// final IStatus result[] = { new Status(IStatus.OK,
// WorkbenchPlugin.PI_WORKBENCH, IStatus.OK, "", null) }; //$NON-NLS-1$
bool result = true;
ISafeRunnable::Pointer runnable(new RestoreStateRunnable(this, stateFile, result));
SafeRunner::Run(runnable);
// ensure at least one window was opened
//if (result[0].isOK() && windowManager.getWindows().length == 0)
if (result && windowManager.GetWindowCount() == 0)
{
std::string msg = "No windows restored.";
// result[0] = new Status(IStatus.ERROR, WorkbenchPlugin.PI_WORKBENCH,
// IWorkbenchConfigurer.RESTORE_CODE_RESET, msg, null);
result &= false;
}
return result;
}
bool Workbench::RestoreState(IMemento::Pointer memento)
{
// final MultiStatus result = new MultiStatus(PlatformUI.PLUGIN_ID,
// IStatus.OK, WorkbenchMessages.Workbench_problemsRestoring, null);
bool result = true;
const bool showProgress = false;
//TODO restore state progress
// final boolean showProgress = PrefUtil.getAPIPreferenceStore()
// .getBoolean(
// IWorkbenchPreferenceConstants.SHOW_PROGRESS_ON_STARTUP);
try
{
/*
* Restored windows will be set in the createdWindows field to be
* used by the openWindowsAfterRestore() method
*/
if (!showProgress)
{
DoRestoreState(memento, result);
}
else
{
// Retrieve how many plug-ins were loaded while restoring the
// workbench
int lastProgressCount = -1;
memento->GetInteger(WorkbenchConstants::TAG_PROGRESS_COUNT, lastProgressCount);
// If we don't know how many plug-ins were loaded last time,
// assume we are loading half of the installed plug-ins.
/*const std::size_t expectedProgressCount =*/
std::max<std::size_t>(1,
lastProgressCount == -1 ? WorkbenchPlugin::GetDefault()->GetBundleCount() / 2
: lastProgressCount);
//TODO restore state progress
// RunStartupWithProgress(expectedProgressCount, new Runnable() {
// public void Run() {
// DoRestoreState(memento, result);
// }
// });
}
}
catch (...)
{
OpenWindowsAfterRestore();
throw;
}
OpenWindowsAfterRestore();
return result;
}
void Workbench::DoRestoreState(IMemento::Pointer memento, bool& status) // final MultiStatus status)
{
IMemento::Pointer childMem;
try
{
// UIStats.start(UIStats.RESTORE_WORKBENCH, "MRUList"); //$NON-NLS-1$
IMemento::Pointer mruMemento = memento
->GetChild(WorkbenchConstants::TAG_MRU_LIST);
if (mruMemento)
{
// TODO restore editor history
//status.add(getEditorHistory().restoreState(mruMemento));
}
//UIStats.end(UIStats.RESTORE_WORKBENCH, this, "MRUList"); //$NON-NLS-1$
}
catch (...)
{
//UIStats.end(UIStats.RESTORE_WORKBENCH, this, "MRUList"); //$NON-NLS-1$
throw;
}
// Restore advisor state.
IMemento::Pointer advisorState = memento
->GetChild(WorkbenchConstants::TAG_WORKBENCH_ADVISOR);
if (advisorState)
{
//status.add(getAdvisor().restoreState(advisorState));
status &= GetAdvisor()->RestoreState(advisorState);
}
// Get the child windows.
std::vector<IMemento::Pointer> children = memento
->GetChildren(WorkbenchConstants::TAG_WINDOW);
createdWindows.clear();
// Read the workbench windows.
for (std::size_t i = 0; i < children.size(); i++)
{
childMem = children[i];
WorkbenchWindow::Pointer newWindow;
//StartupThreading.runWithoutExceptions(new StartupRunnable() {
// public void runWithException() {
newWindow = NewWorkbenchWindow();
newWindow->Create();
// }});
createdWindows.push_back(newWindow);
// allow the application to specify an initial perspective to open
// @issue temporary workaround for ignoring initial perspective
// String initialPerspectiveId =
// getAdvisor().getInitialWindowPerspectiveId();
// if (initialPerspectiveId != null) {
// IPerspectiveDescriptor desc =
// getPerspectiveRegistry().findPerspectiveWithId(initialPerspectiveId);
// result.merge(newWindow.restoreState(childMem, desc));
// }
// add the window so that any work done in newWindow.restoreState
// that relies on Workbench methods has windows to work with
windowManager.Add(newWindow);
// now that we've added it to the window manager we need to listen
// for any exception that might hose us before we get a chance to
// open it. If one occurs, remove the new window from the manager.
// Assume that the new window is a phantom for now
try
{
//status.merge(newWindow[0].restoreState(childMem, null));
status &= newWindow->RestoreState(childMem, IPerspectiveDescriptor::Pointer(0));
try
{
newWindow->FireWindowRestored();
}
catch (const WorkbenchException& /*e*/)
{
//status.add(e.getStatus());
status &= false;
}
// everything worked so far, don't close now
}
catch (...)
{
// null the window in newWindowHolder so that it won't be
// opened later on
createdWindows[i] = 0;
//StartupThreading.runWithoutExceptions(new StartupRunnable() {
// public void runWithException() throws Throwable {
newWindow->Close();
// }});
}
}
}
void Workbench::OpenWindowsAfterRestore()
{
if (createdWindows.empty())
{
return;
}
// now open the windows (except the ones that were nulled because we
// closed them above)
for (std::size_t i = 0; i < createdWindows.size(); i++)
{
if (createdWindows[i])
{
WorkbenchWindow::Pointer myWindow = createdWindows[i];
//StartupThreading.runWithoutExceptions(new StartupRunnable() {
// public void runWithException() throws Throwable {
try
{
myWindow->Open();
}
catch (...)
{
myWindow->Close();
throw;
}
// }});
}
}
createdWindows.clear();
}
void Workbench::InitializeDefaultServices()
{
// final IContributionService contributionService = new ContributionService(
// getAdvisor());
// serviceLocator.registerService(IContributionService.class,
// contributionService);
//
// // TODO Correctly order service initialization
// // there needs to be some serious consideration given to
// // the services, and hooking them up in the correct order
// final IEvaluationService evaluationService =
// (IEvaluationService) serviceLocator.getService(IEvaluationService.class);
//
//
//
// StartupThreading.runWithoutExceptions(new StartupRunnable() {
//
// public void runWithException() {
Object::Pointer service(new SaveablesList());
serviceLocator->RegisterService(ISaveablesLifecycleListener::GetManifestName(),
service);
// }});
//
// /*
// * Phase 1 of the initialization of commands. When this phase completes,
// * all the services and managers will exist, and be accessible via the
// * getService(Object) method.
// */
// StartupThreading.runWithoutExceptions(new StartupRunnable() {
//
// public void runWithException() {
// Command.DEBUG_COMMAND_EXECUTION = Policy.DEBUG_COMMANDS;
// commandManager = new CommandManager();
// }});
//
// final CommandService [] commandService = new CommandService[1];
// StartupThreading.runWithoutExceptions(new StartupRunnable() {
//
// public void runWithException() {
// commandService[0] = new CommandService(commandManager);
// commandService[0].readRegistry();
// serviceLocator.registerService(ICommandService.class, commandService[0]);
//
// }});
//
// StartupThreading.runWithoutExceptions(new StartupRunnable() {
//
// public void runWithException() {
// ContextManager.DEBUG = Policy.DEBUG_CONTEXTS;
// contextManager = new ContextManager();
// }});
//
// final IContextService contextService = new ContextService(
// contextManager);
//
// StartupThreading.runWithoutExceptions(new StartupRunnable() {
//
// public void runWithException() {
// contextService.readRegistry();
// }});
//
// serviceLocator.registerService(IContextService.class, contextService);
//
//
// final IBindingService [] bindingService = new BindingService[1];
//
// StartupThreading.runWithoutExceptions(new StartupRunnable() {
//
// public void runWithException() {
// BindingManager.DEBUG = Policy.DEBUG_KEY_BINDINGS;
// bindingManager = new BindingManager(contextManager, commandManager);
// bindingService[0] = new BindingService(
// bindingManager, commandService[0], Workbench.this);
//
// }});
//
// bindingService[0].readRegistryAndPreferences(commandService[0]);
// serviceLocator.registerService(IBindingService.class, bindingService[0]);
//
// final CommandImageManager commandImageManager = new CommandImageManager();
// final CommandImageService commandImageService = new CommandImageService(
// commandImageManager, commandService[0]);
// commandImageService.readRegistry();
// serviceLocator.registerService(ICommandImageService.class,
// commandImageService);
//
// final WorkbenchMenuService menuService = new WorkbenchMenuService(serviceLocator);
//
// serviceLocator.registerService(IMenuService.class, menuService);
// // the service must be registered before it is initialized - its
// // initialization uses the service locator to address a dependency on
// // the menu service
// StartupThreading.runWithoutExceptions(new StartupRunnable() {
//
// public void runWithException() {
// menuService.readRegistry();
// }});
//
// /*
// * Phase 2 of the initialization of commands. The source providers that
// * the workbench provides are creating and registered with the above
// * services. These source providers notify the services when particular
// * pieces of workbench state change.
// */
// final SourceProviderService sourceProviderService = new SourceProviderService(serviceLocator);
// serviceLocator.registerService(ISourceProviderService.class,
// sourceProviderService);
// StartupThreading.runWithoutExceptions(new StartupRunnable() {
//
// public void runWithException() {
// // this currently instantiates all players ... sigh
// sourceProviderService.readRegistry();
// ISourceProvider[] sp = sourceProviderService.getSourceProviders();
// for (int i = 0; i < sp.length; i++) {
// evaluationService.addSourceProvider(sp[i]);
// if (!(sp[i] instanceof ActiveContextSourceProvider)) {
// contextService.addSourceProvider(sp[i]);
// }
// }
// }});
//
// StartupThreading.runWithoutExceptions(new StartupRunnable() {
//
// public void runWithException() {
// // these guys are need to provide the variables they say
// // they source
// actionSetSourceProvider = (ActionSetSourceProvider) sourceProviderService
// .getSourceProvider(ISources.ACTIVE_ACTION_SETS_NAME);
//
// FocusControlSourceProvider focusControl = (FocusControlSourceProvider) sourceProviderService
// .getSourceProvider(ISources.ACTIVE_FOCUS_CONTROL_ID_NAME);
// serviceLocator.registerService(IFocusService.class,
// focusControl);
//
// menuSourceProvider = (MenuSourceProvider) sourceProviderService
// .getSourceProvider(ISources.ACTIVE_MENU_NAME);
// }});
//
// /*
// * Phase 3 of the initialization of commands. This handles the creation
// * of wrappers for legacy APIs. By the time this phase completes, any
// * code trying to access commands through legacy APIs should work.
// */
// final IHandlerService[] handlerService = new IHandlerService[1];
// StartupThreading.runWithoutExceptions(new StartupRunnable() {
//
// public void runWithException() {
// handlerService[0] = (IHandlerService) serviceLocator
// .getService(IHandlerService.class);
// }
// });
// workbenchContextSupport = new WorkbenchContextSupport(this,
// contextManager);
// workbenchCommandSupport = new WorkbenchCommandSupport(bindingManager,
// commandManager, contextManager, handlerService[0]);
// initializeCommandResolver();
//
// addWindowListener(windowListener);
// bindingManager.addBindingManagerListener(bindingManagerListener);
//
// serviceLocator.registerService(ISelectionConversionService.class,
// new SelectionConversionService());
}
int Workbench::RunUI()
{
// initialize workbench and restore or open one window
bool initOK = this->Init();
// let the advisor run its start up code
if (initOK)
{
advisor->PostStartup(); // may trigger a close/restart
}
//TODO start eager plug-ins
//startPlugins();
//addStartupRegistryListener();
isStarting = false;
BERRY_INFO << "BlueBerry Workbench ready";
this->GetWorkbenchTestable()->Init(Display::GetDefault(), this);
// spin event loop
return display->RunEventLoop();
}
std::string Workbench::GetDefaultPerspectiveId()
{
return this->GetAdvisor()->GetInitialWindowPerspectiveId();
}
IAdaptable* Workbench::GetDefaultPageInput()
{
return this->GetAdvisor()->GetDefaultPageInput();
}
std::string Workbench::GetPresentationId()
{
if (factoryID != "")
{
return factoryID;
}
//factoryID = PrefUtil.getAPIPreferenceStore().getString(
// IWorkbenchPreferenceConstants.PRESENTATION_FACTORY_ID);
// Workaround for bug 58975 - New preference mechanism does not properly
// initialize defaults
// Ensure that the UI plugin has started too.
factoryID = WorkbenchConstants::DEFAULT_PRESENTATION_ID;
return factoryID;
}
void Workbench::UpdateTheme()
{
WorkbenchPlugin::GetDefault()->GetPresentationFactory()->UpdateTheme();
}
void Workbench::LargeUpdateStart()
{
if (largeUpdates++ == 0)
{
// TODO Consider whether these lines still need to be here.
// workbenchCommandSupport.setProcessing(false);
// workbenchContextSupport.setProcessing(false);
std::vector<IWorkbenchWindow::Pointer> windows = this->GetWorkbenchWindows();
for (unsigned int i = 0; i < windows.size(); i++)
{
IWorkbenchWindow::Pointer window = windows[i];
if (window.Cast<WorkbenchWindow>() != 0)
{
window.Cast<WorkbenchWindow>()->LargeUpdateStart();
}
}
}
}
void Workbench::LargeUpdateEnd()
{
if (--largeUpdates == 0)
{
// TODO Consider whether these lines still need to be here.
// workbenchCommandSupport.setProcessing(true);
// workbenchContextSupport.setProcessing(true);
// Perform window-specific blocking.
std::vector<IWorkbenchWindow::Pointer> windows = this->GetWorkbenchWindows();
for (unsigned int i = 0; i < windows.size(); i++)
{
IWorkbenchWindow::Pointer window = windows[i];
if (window.Cast<WorkbenchWindow>() != 0)
{
window.Cast<WorkbenchWindow>()->LargeUpdateEnd();
}
}
}
}
void Workbench::OpenFirstTimeWindow()
{
try
{
IAdaptable* input;
//StartupThreading.runWithoutExceptions(new StartupRunnable() {
// public void runWithException() throws Throwable {
input = this->GetDefaultPageInput();
// }});
this->BusyOpenWorkbenchWindow(this->GetPerspectiveRegistry()->GetDefaultPerspective(), input);
}
catch (WorkbenchException& e)
{
// Don't use the window's shell as the dialog parent,
// as the window is not open yet (bug 76724).
//StartupThreading.runWithoutExceptions(new StartupRunnable() {
// public void runWithException() throws Throwable {
// ErrorDialog.openError(null,
// WorkbenchMessages.Problems_Opening_Page, e.getMessage(), e
// .getStatus());
// }});
BERRY_ERROR << "Error: Problems opening page. " << e.displayText() << std::endl;
}
}
WorkbenchConfigurer::Pointer Workbench::GetWorkbenchConfigurer()
{
if (workbenchConfigurer.IsNull())
{
workbenchConfigurer = new WorkbenchConfigurer();
}
return workbenchConfigurer;
}
WorkbenchAdvisor* Workbench::GetAdvisor()
{
return advisor;
}
IViewRegistry* Workbench::GetViewRegistry()
{
return WorkbenchPlugin::GetDefault()->GetViewRegistry();
}
IEditorRegistry* Workbench::GetEditorRegistry()
{
return WorkbenchPlugin::GetDefault()->GetEditorRegistry();
}
IPerspectiveRegistry* Workbench::GetPerspectiveRegistry()
{
return WorkbenchPlugin::GetDefault()->GetPerspectiveRegistry();
}
bool Workbench::Close()
{
return this->Close(PlatformUI::RETURN_OK, false);
}
bool Workbench::Close(int returnCode, bool force)
{
std::cout << "Closing workbench..." << std::endl;
this->returnCode = returnCode;
bool ret;
//BusyIndicator.showWhile(null, new Runnable() {
// public void run() {
ret = this->BusyClose(force);
// }
//});
return ret;
}
/**
* Closes the workbench. Assumes that the busy cursor is active.
*
* @param force
* true if the close is mandatory, and false if the close is
* allowed to fail
* @return true if the close succeeded, and false otherwise
*/
bool Workbench::BusyClose(bool force)
{
// notify the advisor of preShutdown and allow it to veto if not forced
isClosing = advisor->PreShutdown();
if (!force && !isClosing)
{
return false;
}
// notify regular workbench clients of preShutdown and allow them to
// veto if not forced
isClosing = this->FirePreShutdown(force);
if (!force && !isClosing)
{
return false;
}
// save any open editors if they are dirty
isClosing = this->SaveAllEditors(!force);
if (!force && !isClosing)
{
return false;
}
bool closeEditors = !force && false; // false is the default for the not yet implemented preference below
// && PrefUtil.getAPIPreferenceStore().getBoolean(
// IWorkbenchPreferenceConstants.CLOSE_EDITORS_ON_EXIT);
if (closeEditors)
{
// SafeRunner.run(new SafeRunnable() {
// public void run() {
std::vector<IWorkbenchWindow::Pointer> windows = this->GetWorkbenchWindows();
for (unsigned int i = 0; i < windows.size(); i++)
{
IWorkbenchPage::Pointer page = windows[i]->GetActivePage();
if (page)
isClosing = isClosing && page->CloseAllEditors(false);
}
// }
//});
if (!force && !isClosing)
{
return false;
}
}
if (this->GetWorkbenchConfigurer()->GetSaveAndRestore())
{
try
{
// SafeRunner.run(new SafeRunnable() {
// public void run() {
XMLMemento::Pointer mem = RecordWorkbenchState();
// Save the IMemento to a file.
SaveMementoToFile(mem);
// }
}
catch(const Poco::Exception& e)
{
// public void handleException(Throwable e) {
std::string message;
if (e.message().empty())
{
message = "An error has occurred. See error log for more details. Do you want to exit?";
}
else
{
message = "An error has occurred: " + e.message() + ". See error log for more details. Do you want to exit?";
}
if (!MessageDialog::OpenQuestion(Shell::Pointer(0), "Error", message))
{
isClosing = false;
}
}
// }
// });
}
if (!force && !isClosing)
{
return false;
}
//SafeRunner.run(new SafeRunnable(WorkbenchMessages.ErrorClosing) {
// public void run() {
if (isClosing || force)
{
isClosing = windowManager.Close();
}
// }
//});
if (!force && !isClosing)
{
return false;
}
this->Shutdown();
display->ExitEventLoop(0);
return true;
}
bool Workbench::GetWorkbenchStateFile(Poco::File& file)
{
Poco::Path path;
if (!WorkbenchPlugin::GetDefault()->GetDataPath(path))
{
return false;
}
path.append(DEFAULT_WORKBENCH_STATE_FILENAME);
file = path;
return true;
}
/*
* Save the workbench UI in a persistence file.
*/
bool Workbench::SaveMementoToFile(XMLMemento::Pointer memento)
{
// Save it to a file.
// XXX: nobody currently checks the return value of this method.
Poco::File stateFile;
if (!GetWorkbenchStateFile(stateFile))
{
return false;
}
BERRY_INFO << "Saving state to: " << stateFile.path() << std::endl;
try
{
Poco::FileOutputStream stream(stateFile.path());
memento->Save(stream);
}
catch (const Poco::IOException& /*e*/)
{
stateFile.remove();
MessageDialog::OpenError(Shell::Pointer(0),
"Saving Problems",
"Unable to store workbench state.");
return false;
}
// Success !
return true;
}
IWorkbenchWindow::Pointer Workbench::GetActiveWorkbenchWindow()
{
// Look for the window that was last known being
// the active one
WorkbenchWindow::Pointer win = this->GetActivatedWindow();
return win;
}
std::size_t Workbench::GetWorkbenchWindowCount()
{
return windowManager.GetWindowCount();
}
std::vector<IWorkbenchWindow::Pointer> Workbench::GetWorkbenchWindows()
{
std::vector<Window::Pointer> windows = windowManager.GetWindows();
std::vector<IWorkbenchWindow::Pointer> result;
for (std::vector<Window::Pointer>::iterator iter = windows.begin();
iter != windows.end(); ++iter)
{
result.push_back(iter->Cast<WorkbenchWindow>());
}
return result;
}
IWorkbenchWindow::Pointer Workbench::OpenWorkbenchWindow(
const std::string& perspID, IAdaptable* input)
{
// Run op in busy cursor.
//final Object[] result = new Object[1];
//BusyIndicator.showWhile(null, new Runnable() {
// public void run() {
// try {
return this->BusyOpenWorkbenchWindow(perspID, input);
// } catch (WorkbenchException e) {
// result[0] = e;
// }
// }
//});
}
IWorkbenchWindow::Pointer Workbench::OpenWorkbenchWindow(IAdaptable* input)
{
return this->OpenWorkbenchWindow(this->GetPerspectiveRegistry()
->GetDefaultPerspective(), input);
}
IWorkbenchPage::Pointer Workbench::ShowPerspective(
const std::string& perspectiveId, IWorkbenchWindow::Pointer window)
{
// If the specified window has the requested perspective open, then the
// window
// is given focus and the perspective is shown. The page's input is
// ignored.
WorkbenchWindow::Pointer win = window.Cast<WorkbenchWindow> ();
if (win)
{
IWorkbenchPage::Pointer page = win->GetActivePage();
if (page)
{
std::vector<IPerspectiveDescriptor::Pointer> perspectives(page
->GetOpenPerspectives());
for (std::size_t i = 0; i < perspectives.size(); i++)
{
IPerspectiveDescriptor::Pointer persp = perspectives[i];
if (perspectiveId == persp->GetId())
{
win->MakeVisible();
page->SetPerspective(persp);
return page;
}
}
}
}
// If another window that has the workspace root as input and the
// requested
// perpective open and active, then the window is given focus.
IAdaptable* input = GetDefaultPageInput();
std::vector<IWorkbenchWindow::Pointer> windows(GetWorkbenchWindows());
for (std::size_t i = 0; i < windows.size(); i++)
{
win = windows[i].Cast<WorkbenchWindow>();
if (window != win)
{
WorkbenchPage::Pointer page = win->GetActivePage().Cast<WorkbenchPage>();
if (page)
{
bool inputSame = false;
if (input == 0)
{
inputSame = (page->GetInput() == 0);
}
else
{
inputSame = input == page->GetInput();
}
if (inputSame)
{
Perspective::Pointer persp = page->GetActivePerspective();
if (persp)
{
IPerspectiveDescriptor::Pointer desc = persp->GetDesc();
if (desc)
{
if (perspectiveId == desc->GetId())
{
Shell::Pointer shell = win->GetShell();
shell->Open();
if (shell->GetMinimized())
{
shell->SetMinimized(false);
}
return page;
}
}
}
}
}
}
}
// Otherwise the requested perspective is opened and shown in the
// specified
// window or in a new window depending on the current user preference
// for opening
// perspectives, and that window is given focus.
win = window.Cast<WorkbenchWindow>();
if (win)
{
IPreferencesService::Pointer store = WorkbenchPlugin::GetDefault()
->GetPreferencesService();
int mode = store->GetSystemPreferences()->GetInt(PreferenceConstants::OPEN_PERSP_MODE, PreferenceConstants::OPM_ACTIVE_PAGE);
IWorkbenchPage::Pointer page = win->GetActivePage();
IPerspectiveDescriptor::Pointer persp;
if (page)
{
persp = page->GetPerspective();
}
// Only open a new window if user preference is set and the window
// has an active perspective.
if (PreferenceConstants::OPM_NEW_WINDOW == mode && persp)
{
IWorkbenchWindow::Pointer newWindow = OpenWorkbenchWindow(perspectiveId,
input);
return newWindow->GetActivePage();
}
IPerspectiveDescriptor::Pointer desc = GetPerspectiveRegistry()
->FindPerspectiveWithId(perspectiveId);
if (desc == 0)
{
throw WorkbenchException(
"Unable to create perspective \"" + perspectiveId + "\". There is no corresponding perspective extension.");
}
win->GetShell()->Open();
if (page == 0)
{
page = win->OpenPage(perspectiveId, input);
}
else
{
page->SetPerspective(desc);
}
return page;
}
// Just throw an exception....
throw WorkbenchException("Problems opening perspective \"" +
perspectiveId + "\"");
}
IWorkbenchPage::Pointer Workbench::ShowPerspective(
const std::string& /*perspectiveId*/,
IWorkbenchWindow::Pointer /*window*/,
IAdaptable* /*input*/)
{
return IWorkbenchPage::Pointer(0);
// // If the specified window has the requested perspective open and the
// // same requested
// // input, then the window is given focus and the perspective is shown.
// bool inputSameAsWindow = false;
// WorkbenchWindow::Pointer win = window.Cast<WorkbenchWindow>();
// if (win.IsNotNull()) {
// WorkbenchPage::Pointer page = win->GetActiveWorkbenchPage();
// if (page.IsNotNull()) {
// bool inputSame = false;
// if (input == 0) {
// inputSame = (page->GetInput() == 0);
// } else {
// inputSame = input.equals(page.getInput());
// }
// if (inputSame) {
// inputSameAsWindow = true;
// IPerspectiveDescriptor perspectives[] = page
// .getOpenPerspectives();
// for (int i = 0; i < perspectives.length; i++) {
// IPerspectiveDescriptor persp = perspectives[i];
// if (perspectiveId.equals(persp.getId())) {
// win.makeVisible();
// page.setPerspective(persp);
// return page;
// }
// }
// }
// }
// }
//
// // If another window has the requested input and the requested
// // perpective open and active, then that window is given focus.
// IWorkbenchWindow[] windows = getWorkbenchWindows();
// for (int i = 0; i < windows.length; i++) {
// win = (WorkbenchWindow) windows[i];
// if (window != win) {
// WorkbenchPage page = win.getActiveWorkbenchPage();
// if (page != null) {
// boolean inputSame = false;
// if (input == null) {
// inputSame = (page.getInput() == null);
// } else {
// inputSame = input.equals(page.getInput());
// }
// if (inputSame) {
// Perspective persp = page.getActivePerspective();
// if (persp != null) {
// IPerspectiveDescriptor desc = persp.getDesc();
// if (desc != null) {
// if (perspectiveId.equals(desc.getId())) {
// win.getShell().open();
// return page;
// }
// }
// }
// }
// }
// }
// }
//
// // If the specified window has the same requested input but not the
// // requested
// // perspective, then the window is given focus and the perspective is
// // opened and shown
// // on condition that the user preference is not to open perspectives in
// // a new window.
// win = (WorkbenchWindow) window;
// if (inputSameAsWindow && win != null) {
// IPreferenceStore store = WorkbenchPlugin.getDefault()
// .getPreferenceStore();
// int mode = store.getInt(IPreferenceConstants.OPEN_PERSP_MODE);
//
// if (IPreferenceConstants.OPM_NEW_WINDOW != mode) {
// IWorkbenchPage page = win.getActiveWorkbenchPage();
// IPerspectiveDescriptor desc = getPerspectiveRegistry()
// .findPerspectiveWithId(perspectiveId);
// if (desc == null) {
// throw new WorkbenchException(
// NLS
// .bind(
// WorkbenchMessages.WorkbenchPage_ErrorCreatingPerspective,
// perspectiveId));
// }
// win.getShell().open();
// if (page == null) {
// page = win.openPage(perspectiveId, input);
// } else {
// page.setPerspective(desc);
// }
// return page;
// }
// }
//
// // If the specified window has no active perspective, then open the
// // requested perspective and show the specified window.
// if (win != null) {
// IWorkbenchPage page = win.getActiveWorkbenchPage();
// IPerspectiveDescriptor persp = null;
// if (page != null) {
// persp = page.getPerspective();
// }
// if (persp == null) {
// IPerspectiveDescriptor desc = getPerspectiveRegistry()
// .findPerspectiveWithId(perspectiveId);
// if (desc == null) {
// throw new WorkbenchException(
// NLS
// .bind(
// WorkbenchMessages.WorkbenchPage_ErrorCreatingPerspective,
// perspectiveId));
// }
// win.getShell().open();
// if (page == null) {
// page = win.openPage(perspectiveId, input);
// } else {
// page.setPerspective(desc);
// }
// return page;
// }
// }
//
// // Otherwise the requested perspective is opened and shown in a new
// // window, and the
// // window is given focus.
// IWorkbenchWindow newWindow = openWorkbenchWindow(perspectiveId, input);
// return newWindow.getActivePage();
}
bool Workbench::SaveAllEditors(bool /*confirm*/)
{
return true;
}
IIntroManager* Workbench::GetIntroManager()
{
return GetWorkbenchIntroManager();
}
WorkbenchIntroManager* Workbench::GetWorkbenchIntroManager()
{
if (introManager == 0)
{
introManager = new WorkbenchIntroManager(this);
}
return introManager;
}
IntroDescriptor::Pointer Workbench::GetIntroDescriptor() const
{
return introDescriptor;
}
void Workbench::SetIntroDescriptor(IntroDescriptor::Pointer descriptor)
{
if (GetIntroManager()->GetIntro())
{
GetIntroManager()->CloseIntro(GetIntroManager()->GetIntro());
}
introDescriptor = descriptor;
}
bool Workbench::IsRunning()
{
return Tweaklets::Get(WorkbenchTweaklet::KEY)->IsRunning();
}
bool Workbench::IsStarting()
{
return isStarting;
}
bool Workbench::IsClosing()
{
return isClosing;
}
WorkbenchWindow::Pointer Workbench::GetActivatedWindow()
{
return activatedWindow;
}
/*
* Sets the workbench window which was last known being the active one, or
* <code> null </code> .
*/
void Workbench::SetActivatedWindow(WorkbenchWindow::Pointer window)
{
activatedWindow = window;
}
WorkbenchWindow::Pointer Workbench::NewWorkbenchWindow()
{
WorkbenchWindow::Pointer wbw =
Tweaklets::Get(WorkbenchTweaklet::KEY)->CreateWorkbenchWindow(this->GetNewWindowNumber());
//wbw->Init();
return wbw;
}
int Workbench::GetNewWindowNumber()
{
// Get window list.
std::vector<Window::Pointer> windows = windowManager.GetWindows();
int count = static_cast<int>(windows.size());
// Create an array of booleans (size = window count).
// Cross off every number found in the window list.
bool *checkArray = new bool[count];
for (int nX = 0; nX < count; ++nX)
{
if (windows[nX].Cast<WorkbenchWindow> ().IsNotNull())
{
WorkbenchWindow::Pointer ww = windows[nX].Cast<WorkbenchWindow> ();
int index = ww->GetNumber() - 1;
if (index >= 0 && index < count)
{
checkArray[index] = true;
}
}
}
// Return first index which is not used.
// If no empty index was found then every slot is full.
// Return next index.
for (int index = 0; index < count; index++)
{
if (!checkArray[index])
{
delete[] checkArray;
return index + 1;
}
}
delete[] checkArray;
return static_cast<int>(count + 1);
}
IWorkbenchWindow::Pointer Workbench::BusyOpenWorkbenchWindow(
const std::string& perspID, IAdaptable* input)
{
// Create a workbench window (becomes active window)
//final WorkbenchWindow newWindowArray[] = new WorkbenchWindow[1];
//StartupThreading.runWithWorkbenchExceptions(new StartupRunnable() {
// public void runWithException() {
// newWindowArray[0] = newWorkbenchWindow();
WorkbenchWindow::Pointer newWindow = this->NewWorkbenchWindow();
// }
//});
//final WorkbenchWindow newWindow = newWindowArray[0];
//StartupThreading.runWithoutExceptions(new StartupRunnable() {
// public void runWithException() {
newWindow->Create(); // must be created before adding to window
// manager
// }
//});
windowManager.Add(newWindow);
//final WorkbenchException [] exceptions = new WorkbenchException[1];
// Create the initial page.
if (perspID != "")
{
//StartupThreading.runWithWorkbenchExceptions(new StartupRunnable() {
try
{
newWindow->BusyOpenPage(perspID, input);
}
catch (WorkbenchException& e)
{
windowManager.Remove(newWindow);
throw e;
}
}
// Open window after opening page, to avoid flicker.
//StartupThreading.runWithWorkbenchExceptions(new StartupRunnable() {
// public void runWithException() {
newWindow->Open();
// }
//});
return newWindow;
}
bool Workbench::SaveState(IMemento::Pointer memento)
{
// MultiStatus result = new MultiStatus(PlatformUI.PLUGIN_ID, IStatus.OK,
// WorkbenchMessages.Workbench_problemsSaving, null);
bool result = true;
// Save the version number.
memento->PutString(WorkbenchConstants::TAG_VERSION, VERSION_STRING[0]);
// Save how many plug-ins were loaded while restoring the workbench
if (progressCount != -1)
{
memento->PutInteger(WorkbenchConstants::TAG_PROGRESS_COUNT,
progressCount);
}
// Save the advisor state.
IMemento::Pointer advisorState = memento
->CreateChild(WorkbenchConstants::TAG_WORKBENCH_ADVISOR);
//result.add(getAdvisor().saveState(advisorState));
result &= GetAdvisor()->SaveState(advisorState);
// Save the workbench windows.
std::vector<IWorkbenchWindow::Pointer> windows(GetWorkbenchWindows());
for (std::size_t nX = 0; nX < windows.size(); nX++)
{
WorkbenchWindow::Pointer window = windows[nX].Cast<WorkbenchWindow>();
IMemento::Pointer childMem = memento->CreateChild(WorkbenchConstants::TAG_WINDOW);
//result.merge(window.saveState(childMem));
result &= window->SaveState(childMem);
}
// result.add(getEditorHistory().saveState(
// memento.createChild(IWorkbenchConstants.TAG_MRU_LIST)));
return result;
}
XMLMemento::Pointer Workbench::RecordWorkbenchState()
{
XMLMemento::Pointer memento = XMLMemento
::CreateWriteRoot(WorkbenchConstants::TAG_WORKBENCH);
//final IStatus status = saveState(memento);
bool status = SaveState(memento);
//if (status.getSeverity() != IStatus.OK) {
if (!status)
{
// // don't use newWindow as parent because it has not yet been opened
// // (bug 76724)
// StartupThreading.runWithoutExceptions(new StartupRunnable() {
//
// public void runWithException() throws Throwable {
// ErrorDialog.openError(null,
// WorkbenchMessages.Workbench_problemsSaving,
// WorkbenchMessages.Workbench_problemsSavingMsg, status);
// }});
}
return memento;
}
void Workbench::AddWorkbenchListener(IWorkbenchListener::Pointer listener)
{
workbenchEvents.AddListener(listener);
}
void Workbench::RemoveWorkbenchListener(IWorkbenchListener::Pointer listener)
{
workbenchEvents.RemoveListener(listener);
}
IWorkbenchListener::Events& Workbench::GetWorkbenchEvents()
{
return workbenchEvents;
}
void Workbench::AddWindowListener(IWindowListener::Pointer l)
{
windowEvents.AddListener(l);
}
void Workbench::RemoveWindowListener(IWindowListener::Pointer l)
{
windowEvents.RemoveListener(l);
}
IWindowListener::Events& Workbench::GetWindowEvents()
{
return windowEvents;
}
bool Workbench::FirePreShutdown(bool forced)
{
//SafeRunnable.run(new SafeRunnable() {
// public void run() {
typedef IWorkbenchListener::Events::PreShutdownEvent::ListenerList ListenerList;
const ListenerList& listeners = workbenchEvents.preShutdown.GetListeners();
for ( ListenerList::const_iterator iter = listeners.begin();
iter != listeners.end(); ++iter )
{
// notify each listener
if (! (*iter)->Execute(dynamic_cast<IWorkbench*>(this), forced))
return false;
}
// }
return true;
}
/**
* Fire workbench postShutdown event.
*
* @since 3.2
*/
void Workbench::FirePostShutdown()
{
// SafeRunnable.run(new SafeRunnable() {
// public void run() {
workbenchEvents.postShutdown(this);
// }
}
void Workbench::FireWindowOpened(IWorkbenchWindow::Pointer window)
{
// SafeRunner.run(new SafeRunnable() {
// public void run() {
windowEvents.windowOpened(window);
// }
}
void Workbench::FireWindowClosed(IWorkbenchWindow::Pointer window)
{
if (activatedWindow == window)
{
// Do not hang onto it so it can be GC'ed
activatedWindow = 0;
}
// SafeRunner.run(new SafeRunnable() {
// public void run() {
windowEvents.windowClosed(window);
// }
}
void Workbench::FireWindowActivated(IWorkbenchWindow::Pointer window)
{
// SafeRunner.run(new SafeRunnable() {
// public void run() {
windowEvents.windowActivated(window);
// }
}
void Workbench::FireWindowDeactivated(IWorkbenchWindow::Pointer window)
{
// SafeRunner.run(new SafeRunnable() {
// public void run() {
windowEvents.windowDeactivated(window);
// }
}
IWorkbenchWindow::Pointer Workbench::RestoreWorkbenchWindow(IMemento::Pointer memento)
{
WorkbenchWindow::Pointer newWindow = this->NewWorkbenchWindow();
//newWindow.create();
windowManager.Add(newWindow);
// whether the window was opened
bool opened = false;
try
{
newWindow->RestoreState(memento, IPerspectiveDescriptor::Pointer(0));
newWindow->FireWindowRestored();
newWindow->Open();
opened = true;
}
catch (...)
{
if (!opened)
{
newWindow->Close();
}
}
return newWindow;
}
void Workbench::Shutdown()
{
// shutdown application-specific portions first
advisor->PostShutdown();
// notify regular workbench clients of shutdown, and clear the list when
// done
this->FirePostShutdown();
//workbenchListeners.clear();
//cancelEarlyStartup();
// for dynamic UI
// Platform.getExtensionRegistry().removeRegistryChangeListener(
// extensionEventHandler);
// Platform.getExtensionRegistry().removeRegistryChangeListener(
// startupRegistryListener);
// ((GrabFocus) Tweaklets.get(GrabFocus.KEY)).dispose();
// Bring down all of the services.
// serviceLocator.dispose();
// workbenchActivitySupport.dispose();
// WorkbenchHelpSystem.disposeIfNecessary();
// shutdown the rest of the workbench
// WorkbenchColors.shutdown();
// activityHelper.shutdown();
// uninitializeImages();
// if (WorkbenchPlugin.getDefault() != null) {
// WorkbenchPlugin.getDefault().reset();
// }
// WorkbenchThemeManager.getInstance().dispose();
// PropertyPageContributorManager.getManager().dispose();
// ObjectActionContributorManager.getManager().dispose();
// if (tracker != null) {
// tracker.close();
// }
Tweaklets::Clear();
}
}
diff --git a/BlueBerry/Bundles/org.blueberry.ui/src/internal/berryWorkbenchPage.cpp b/BlueBerry/Bundles/org.blueberry.ui/src/internal/berryWorkbenchPage.cpp
index 86d65407a0..aad8d7ac4b 100644
--- a/BlueBerry/Bundles/org.blueberry.ui/src/internal/berryWorkbenchPage.cpp
+++ b/BlueBerry/Bundles/org.blueberry.ui/src/internal/berryWorkbenchPage.cpp
@@ -1,4111 +1,4112 @@
/*=========================================================================
Program: BlueBerry Platform
Language: C++
Date: $Date$
Version: $Revision$
Copyright (c) German Cancer Research Center, Division of Medical and
Biological Informatics. All rights reserved.
See MITKCopyright.txt or http://www.mitk.org/copyright.html for details.
This software is distributed WITHOUT ANY WARRANTY; without even
the implied warranty of MERCHANTABILITY or FITNESS FOR A PARTICULAR
PURPOSE. See the above copyright notices for more information.
=========================================================================*/
#include "berryLog.h"
+#include "../tweaklets/berryGuiWidgetsTweaklet.h"
+#include "../tweaklets/berryWorkbenchPageTweaklet.h"
+
#include "berryWorkbenchPage.h"
#include "berryPartSite.h"
#include "berryWorkbenchRegistryConstants.h"
#include "berryPerspective.h"
#include "berryLayoutPartSash.h"
#include "berryWorkbenchPlugin.h"
#include "berryEditorAreaHelper.h"
#include "berrySaveablesList.h"
#include "berryPerspectiveHelper.h"
#include "berryLayoutTreeNode.h"
#include "berryWorkbench.h"
#include "berryWorkbenchConstants.h"
#include "berryPartService.h"
#include "berryStickyViewManager.h"
#include "intro/berryIntroConstants.h"
#include "intro/berryViewIntroAdapterPart.h"
-#include "../tweaklets/berryGuiWidgetsTweaklet.h"
-#include "../tweaklets/berryWorkbenchPageTweaklet.h"
#include "../dialogs/berryMessageDialog.h"
#include "berryWorkbenchWindow.h"
#include "../berryUIException.h"
#include "../berryPlatformUI.h"
#include "berryPartPane.h"
#include "../berryImageDescriptor.h"
#include <berryIExtensionPointService.h>
#include <berryPlatform.h>
namespace berry
{
WorkbenchPage::ActivationOrderPred::ActivationOrderPred(
WorkbenchPage::ActivationList* al) :
activationList(al)
{
}
bool WorkbenchPage::ActivationOrderPred::operator()(
const IViewReference::Pointer o1, const IViewReference::Pointer o2) const
{
WorkbenchPage::ActivationList::PartListIter pos1 = activationList->IndexOf(
o1.Cast<IWorkbenchPartReference> ());
WorkbenchPage::ActivationList::PartListIter pos2 = activationList->IndexOf(
o2.Cast<IWorkbenchPartReference> ());
return pos1 < pos2;
}
void WorkbenchPage::PerspectiveList::UpdateActionSets(
Perspective::Pointer /*oldPersp*/, Perspective::Pointer /*newPersp*/)
{
//TODO WorkbenchPage action sets
// // Update action sets
//
// IContextService service = (IContextService) window
// .getService(IContextService.class);
// try {
// service.activateContext(ContextAuthority.DEFER_EVENTS);
// if (newPersp != 0) {
// IActionSetDescriptor[] newAlwaysOn = newPersp
// .getAlwaysOnActionSets();
// for (int i = 0; i < newAlwaysOn.length; i++) {
// IActionSetDescriptor descriptor = newAlwaysOn[i];
//
// actionSets.showAction(descriptor);
// }
//
// IActionSetDescriptor[] newAlwaysOff = newPersp
// .getAlwaysOffActionSets();
// for (int i = 0; i < newAlwaysOff.length; i++) {
// IActionSetDescriptor descriptor = newAlwaysOff[i];
//
// actionSets.maskAction(descriptor);
// }
// }
//
// if (oldPersp != 0) {
// IActionSetDescriptor[] newAlwaysOn = oldPersp
// .getAlwaysOnActionSets();
// for (int i = 0; i < newAlwaysOn.length; i++) {
// IActionSetDescriptor descriptor = newAlwaysOn[i];
//
// actionSets.hideAction(descriptor);
// }
//
// IActionSetDescriptor[] newAlwaysOff = oldPersp
// .getAlwaysOffActionSets();
// for (int i = 0; i < newAlwaysOff.length; i++) {
// IActionSetDescriptor descriptor = newAlwaysOff[i];
//
// actionSets.unmaskAction(descriptor);
// }
// }
// } finally {
// service.activateContext(ContextAuthority.SEND_EVENTS);
// }
}
WorkbenchPage::PerspectiveList::PerspectiveList()
{
}
void WorkbenchPage::PerspectiveList::Reorder(
IPerspectiveDescriptor::Pointer perspective, int newLoc)
{
PerspectiveListType::iterator oldLocation = openedList.end();
Perspective::Pointer movedPerspective;
for (PerspectiveListType::iterator iterator = openedList.begin(); iterator
!= openedList.end(); ++iterator)
{
Perspective::Pointer openPerspective = *iterator;
if (openPerspective->GetDesc() == perspective)
{
oldLocation = std::find(openedList.begin(), openedList.end(),
openPerspective);
movedPerspective = openPerspective;
}
}
PerspectiveListType::iterator newLocation = openedList.begin();
for (int i = 0; i < newLoc; ++i, ++newLocation)
;
if (oldLocation == newLocation)
{
return;
}
openedList.erase(oldLocation);
openedList.insert(newLocation, movedPerspective);
}
WorkbenchPage::PerspectiveList::PerspectiveListType WorkbenchPage::PerspectiveList::GetSortedPerspectives()
{
return usedList;
}
bool WorkbenchPage::PerspectiveList::Add(Perspective::Pointer perspective)
{
openedList.push_back(perspective);
usedList.push_front(perspective);
//It will be moved to top only when activated.
return true;
}
WorkbenchPage::PerspectiveList::PerspectiveListType::iterator WorkbenchPage::PerspectiveList::Begin()
{
return openedList.begin();
}
WorkbenchPage::PerspectiveList::PerspectiveListType::iterator WorkbenchPage::PerspectiveList::End()
{
return openedList.end();
}
WorkbenchPage::PerspectiveList::PerspectiveListType WorkbenchPage::PerspectiveList::GetOpenedPerspectives()
{
return openedList;
}
bool WorkbenchPage::PerspectiveList::Remove(Perspective::Pointer perspective)
{
if (active == perspective)
{
this->UpdateActionSets(active, Perspective::Pointer(0));
active = 0;
}
usedList.remove(perspective);
PerspectiveListType::size_type origSize = openedList.size();
openedList.remove(perspective);
return openedList.size() != origSize;
}
void WorkbenchPage::PerspectiveList::Swap(Perspective::Pointer oldPerspective,
Perspective::Pointer newPerspective)
{
PerspectiveListType::iterator oldIter = std::find(openedList.begin(),
openedList.end(), oldPerspective);
PerspectiveListType::iterator newIter = std::find(openedList.begin(),
openedList.end(), newPerspective);
if (oldIter == openedList.end() || newIter == openedList.end())
{
return;
}
std::iter_swap(oldIter, newIter);
}
bool WorkbenchPage::PerspectiveList::IsEmpty()
{
return openedList.empty();
}
Perspective::Pointer WorkbenchPage::PerspectiveList::GetActive()
{
return active;
}
Perspective::Pointer WorkbenchPage::PerspectiveList::GetNextActive()
{
if (active == 0)
{
if (usedList.empty())
{
return Perspective::Pointer(0);
}
else
{
return usedList.back();
}
}
else
{
if (usedList.size() < 2)
{
return Perspective::Pointer(0);
}
else
{
return *(++usedList.rbegin());
}
}
}
WorkbenchPage::PerspectiveList::PerspectiveListType::size_type WorkbenchPage::PerspectiveList::Size()
{
return openedList.size();
}
void WorkbenchPage::PerspectiveList::SetActive(Perspective::Pointer perspective)
{
if (perspective == active)
{
return;
}
this->UpdateActionSets(active, perspective);
active = perspective;
if (perspective != 0)
{
usedList.remove(perspective);
usedList.push_back(perspective);
}
}
WorkbenchPage::ActivationList::ActivationList(WorkbenchPage* page) :
page(page)
{
}
void WorkbenchPage::ActivationList::SetActive(SmartPointer<IWorkbenchPart> part)
{
if (parts.empty())
{
return;
}
IWorkbenchPartReference::Pointer ref(page->GetReference(part));
if (ref)
{
if (ref == parts.back())
{
return;
}
parts.erase(std::find(parts.begin(), parts.end(), ref));
parts.push_back(ref);
}
}
void WorkbenchPage::ActivationList::BringToTop(SmartPointer<
IWorkbenchPartReference> ref)
{
IStackableContainer::Pointer targetContainer(page->GetContainer(ref));
PartListIter newIndex = this->LastIndexOfContainer(targetContainer);
if (newIndex != parts.end() && ref == *newIndex)
{
return;
}
if (newIndex == parts.end())
{
parts.push_back(ref);
}
else
{
PartListType::size_type index = newIndex - parts.begin();
parts.erase(std::find(parts.begin(), parts.end(), ref));
PartListIter insertIndex = parts.begin() + index;
parts.insert(insertIndex, ref);
}
}
WorkbenchPage::ActivationList::PartListIter WorkbenchPage::ActivationList::LastIndexOfContainer(
SmartPointer<IStackableContainer> container)
{
PartListReverseIter i = parts.rbegin();
while (i != parts.rend())
{
IWorkbenchPartReference::Pointer ref(*i);
IStackableContainer::Pointer cnt(page->GetContainer(ref));
if (cnt == container)
{
return --i.base();
}
++i;
}
return parts.end();
}
void WorkbenchPage::ActivationList::SetActive(SmartPointer<
IWorkbenchPartReference> ref)
{
this->SetActive(ref->GetPart(true));
}
void WorkbenchPage::ActivationList::Add(
SmartPointer<IWorkbenchPartReference> ref)
{
if (std::find(parts.begin(), parts.end(), ref) != parts.end())
{
return;
}
ref->GetPart(false);
parts.push_front(ref);
}
SmartPointer<IWorkbenchPart> WorkbenchPage::ActivationList::GetActive()
{
if (parts.empty())
{
return IWorkbenchPart::Pointer(0);
}
return this->GetActive(parts.end());
}
SmartPointer<IWorkbenchPart> WorkbenchPage::ActivationList::GetPreviouslyActive()
{
if (parts.size() < 2)
{
return IWorkbenchPart::Pointer(0);
}
return this->GetActive(--parts.end());
}
SmartPointer<IWorkbenchPartReference> WorkbenchPage::ActivationList::GetActiveReference(
bool editorsOnly)
{
return this->GetActiveReference(parts.end(), editorsOnly);
}
WorkbenchPage::ActivationList::PartListIter WorkbenchPage::ActivationList::IndexOf(
SmartPointer<IWorkbenchPart> part)
{
IWorkbenchPartReference::Pointer ref(page->GetReference(part));
if (ref == 0)
{
return parts.end();
}
return std::find(parts.begin(), parts.end(), ref);
}
WorkbenchPage::ActivationList::PartListIter WorkbenchPage::ActivationList::IndexOf(
SmartPointer<IWorkbenchPartReference> ref)
{
return std::find(parts.begin(), parts.end(), ref);
}
bool WorkbenchPage::ActivationList::Remove(
SmartPointer<IWorkbenchPartReference> ref)
{
bool contains = std::find(parts.begin(), parts.end(), ref) != parts.end();
parts.erase(std::find(parts.begin(), parts.end(), ref));
return contains;
}
SmartPointer<IEditorPart> WorkbenchPage::ActivationList::GetTopEditor()
{
IEditorReference::Pointer editor =
this->GetActiveReference(parts.end(), true).Cast<IEditorReference> ();
if (editor == 0)
{
return IEditorPart::Pointer(0);
}
return editor->GetEditor(true);
}
SmartPointer<IWorkbenchPart> WorkbenchPage::ActivationList::GetActive(
PartListIter start)
{
IWorkbenchPartReference::Pointer ref(this->GetActiveReference(start, false));
if (!ref)
{
return IWorkbenchPart::Pointer(0);
}
return ref->GetPart(true);
}
SmartPointer<IWorkbenchPartReference> WorkbenchPage::ActivationList::GetActiveReference(
PartListIter start, bool editorsOnly)
{
// First look for parts that aren't obscured by the current zoom state
IWorkbenchPartReference::Pointer nonObscured = this->GetActiveReference(
start, editorsOnly, true);
if (nonObscured)
{
return nonObscured;
}
// Now try all the rest of the parts
return this->GetActiveReference(start, editorsOnly, false);
}
SmartPointer<IWorkbenchPartReference> WorkbenchPage::ActivationList::GetActiveReference(
PartListIter start, bool editorsOnly, bool /*skipPartsObscuredByZoom*/)
{
std::vector<IViewReference::Pointer> views = page->GetViewReferences();
PartListReverseIter i(start);
while (i != parts.rend())
{
WorkbenchPartReference::Pointer ref(i->Cast<WorkbenchPartReference> ());
if (editorsOnly && (ref.Cast<IEditorReference> () == 0))
{
++i;
continue;
}
// Skip parts whose containers have disabled auto-focus
PartPane::Pointer pane(ref->GetPane());
if (pane)
{
if (!pane->AllowsAutoFocus())
{
++i;
continue;
}
// if (skipPartsObscuredByZoom) {
// if (pane.isObscuredByZoom()) {
// continue;
// }
// }
}
// Skip fastviews (unless overridden)
if (IViewReference::Pointer viewRef = ref.Cast<IViewReference>())
{
//if (ref == getActiveFastView() || !((IViewReference) ref).isFastView()) {
for (unsigned int j = 0; j < views.size(); j++)
{
if (views[j] == viewRef)
{
return viewRef.Cast<IWorkbenchPartReference> ();
}
}
//}
}
else
{
return ref.Cast<IWorkbenchPartReference> ();
}
++i;
}
return IWorkbenchPartReference::Pointer(0);
}
std::vector<SmartPointer<IEditorReference> > WorkbenchPage::ActivationList::GetEditors()
{
std::vector<IEditorReference::Pointer> editors;
for (PartListIter i = parts.begin(); i != parts.end(); ++i)
{
if (IEditorReference::Pointer part = i->Cast<IEditorReference>())
{
editors.push_back(part);
}
}
return editors;
}
std::vector<SmartPointer<IWorkbenchPartReference> > WorkbenchPage::ActivationList::GetParts()
{
std::vector<IViewReference::Pointer> views(page->GetViewReferences());
std::vector<IWorkbenchPartReference::Pointer> resultList;
for (PartListIter iterator = parts.begin(); iterator != parts.end(); ++iterator)
{
if (IViewReference::Pointer ref = iterator->Cast<IViewReference>())
{
//Filter views from other perspectives
for (unsigned int i = 0; i < views.size(); i++)
{
if (ref == views[i])
{
resultList.push_back(ref);
break;
}
}
}
else
{
resultList.push_back(*iterator);
}
}
return resultList;
}
void WorkbenchPage::ActionSwitcher::UpdateActivePart(
IWorkbenchPart::Pointer newPart)
{
IWorkbenchPart::Pointer _activePart = this->activePart.Lock();
IEditorPart::Pointer _topEditor = this->topEditor.Lock();
if (_activePart == newPart)
{
return;
}
bool isNewPartAnEditor = newPart.Cast<IEditorPart> ().IsNotNull();
if (isNewPartAnEditor)
{
std::string oldId;
if (_topEditor)
{
oldId = _topEditor->GetSite()->GetId();
}
std::string newId = newPart->GetSite()->GetId();
// if the active part is an editor and the new editor
// is the same kind of editor, then we don't have to do
// anything
if (activePart == topEditor && newId == oldId)
{
activePart = newPart;
topEditor = newPart.Cast<IEditorPart> ();
return;
}
// remove the contributions of the old editor
// if it is a different kind of editor
if (oldId != newId)
{
this->DeactivateContributions(_topEditor, true);
}
// if a view was the active part, disable its contributions
if (_activePart && _activePart != _topEditor)
{
this->DeactivateContributions(_activePart, true);
}
// show (and enable) the contributions of the new editor
// if it is a different kind of editor or if the
// old active part was a view
if (newId != oldId || _activePart != _topEditor)
{
this->ActivateContributions(newPart, true);
}
}
else if (newPart.IsNull())
{
if (_activePart)
{
// remove all contributions
this->DeactivateContributions(_activePart, true);
}
}
else
{
// new part is a view
// if old active part is a view, remove all contributions,
// but if old part is an editor only disable
if (_activePart)
{
this->DeactivateContributions(_activePart,
_activePart.Cast<IViewPart> ().IsNotNull());
}
this->ActivateContributions(newPart, true);
}
//TODO WorkbenchPage action sets
// ArrayList newActionSets = 0;
// if (isNewPartAnEditor || (activePart == topEditor && newPart == 0))
// {
// newActionSets = calculateActionSets(newPart, 0);
// }
// else
// {
// newActionSets = calculateActionSets(newPart, topEditor);
// }
//
// if (!updateActionSets(newActionSets))
// {
// updateActionBars();
// }
if (isNewPartAnEditor)
{
topEditor = newPart.Cast<IEditorPart> ();
}
else if (activePart == topEditor && newPart.IsNull())
{
// since we removed all the contributions, we clear the top
// editor
topEditor.Reset();
}
activePart = newPart;
}
void WorkbenchPage::ActionSwitcher::UpdateTopEditor(
IEditorPart::Pointer newEditor)
{
if (topEditor.Lock() == newEditor)
{
return;
}
if (activePart == topEditor)
{
this->UpdateActivePart(newEditor);
return;
}
std::string oldId;
if (!topEditor.Expired())
{
oldId = topEditor.Lock()->GetSite()->GetId();
}
std::string newId;
if (newEditor.IsNotNull())
{
newId = newEditor->GetSite()->GetId();
}
if (oldId == newId)
{
// we don't have to change anything
topEditor = newEditor;
return;
}
// Remove the contributions of the old editor
if (!topEditor.Expired())
{
this->DeactivateContributions(topEditor.Lock(), true);
}
// Show (disabled) the contributions of the new editor
if (newEditor.IsNotNull())
{
this->ActivateContributions(newEditor, false);
}
// ArrayList newActionSets = calculateActionSets(activePart, newEditor);
// if (!updateActionSets(newActionSets))
// {
// updateActionBars();
// }
topEditor = newEditor;
}
void WorkbenchPage::ActionSwitcher::ActivateContributions(
IWorkbenchPart::Pointer /*part*/, bool /*enable*/)
{
//PartSite::Pointer site = part->GetSite().Cast<PartSite> ();
//site->ActivateActionBars(enable);
}
void WorkbenchPage::ActionSwitcher::DeactivateContributions(
IWorkbenchPart::Pointer /*part*/, bool /*remove*/)
{
//PartSite::Pointer site = part->GetSite().Cast<PartSite> ();
//site->DeactivateActionBars(remove);
}
const IExtensionPoint* WorkbenchPage::GetPerspectiveExtensionPoint()
{
return Platform::GetExtensionPointService()->GetExtensionPoint(
PlatformUI::PLUGIN_ID + "."
+ WorkbenchRegistryConstants::PL_PERSPECTIVE_EXTENSIONS);
}
WorkbenchPage::WorkbenchPage(WorkbenchWindow* w, const std::string& layoutID,
IAdaptable* input)
{
if (layoutID == "")
{
throw WorkbenchException("Perspective ID is undefined");
}
this->Register();
this->Init(w, layoutID, input, true);
this->UnRegister(false);
}
WorkbenchPage::WorkbenchPage(WorkbenchWindow* w, IAdaptable* input)
{
this->Register();
this->Init(w, "", input, false);
this->UnRegister(false);
}
void WorkbenchPage::Activate(IWorkbenchPart::Pointer part)
{
// Sanity check.
if (!this->CertifyPart(part))
{
return;
}
if (window->IsClosing())
{
return;
}
// if (composite!=0 && composite.isVisible() && !((GrabFocus)Tweaklets.get(GrabFocus.KEY)).grabFocusAllowed(part))
// {
// return;
// }
// Activate part.
//if (window.getActivePage() == this) {
IWorkbenchPartReference::Pointer ref = this->GetReference(part);
this->InternalBringToTop(ref);
this->SetActivePart(part);
}
void WorkbenchPage::ActivatePart(const IWorkbenchPart::Pointer part)
{
// Platform.run(new SafeRunnable(WorkbenchMessages.WorkbenchPage_ErrorActivatingView)
// {
// public void WorkbenchPage::run()
// {
if (part.IsNotNull())
{
//part.setFocus();
PartPane::Pointer pane = this->GetPane(part);
pane->SetFocus();
PartSite::Pointer site = part->GetSite().Cast<PartSite> ();
pane->ShowFocus(true);
//this->UpdateTabList(part);
//SubActionBars bars = (SubActionBars) site.getActionBars();
//bars.partChanged(part);
}
// }
// }
// );
}
void WorkbenchPage::AddPartListener(IPartListener::Pointer l)
{
partList->GetPartService()->AddPartListener(l);
}
void WorkbenchPage::AddSelectionListener(ISelectionListener::Pointer listener)
{
selectionService->AddSelectionListener(listener);
}
void WorkbenchPage::AddSelectionListener(const std::string& partId,
ISelectionListener::Pointer listener)
{
selectionService->AddSelectionListener(partId, listener);
}
void WorkbenchPage::AddPostSelectionListener(
ISelectionListener::Pointer listener)
{
selectionService->AddPostSelectionListener(listener);
}
void WorkbenchPage::AddPostSelectionListener(const std::string& partId,
ISelectionListener::Pointer listener)
{
selectionService->AddPostSelectionListener(partId, listener);
}
IStackableContainer::Pointer WorkbenchPage::GetContainer(
IWorkbenchPart::Pointer part)
{
PartPane::Pointer pane = this->GetPane(part);
if (pane == 0)
{
return IStackableContainer::Pointer(0);
}
return pane->GetContainer();
}
IStackableContainer::Pointer WorkbenchPage::GetContainer(
IWorkbenchPartReference::Pointer part)
{
PartPane::Pointer pane = this->GetPane(part);
if (pane == 0)
{
return IStackableContainer::Pointer(0);
}
return pane->GetContainer();
}
PartPane::Pointer WorkbenchPage::GetPane(IWorkbenchPart::Pointer part)
{
if (part.IsNull())
{
return PartPane::Pointer(0);
}
return this->GetPane(this->GetReference(part));
}
PartPane::Pointer WorkbenchPage::GetPane(IWorkbenchPartReference::Pointer part)
{
if (part.IsNull())
{
return PartPane::Pointer(0);
}
return part.Cast<WorkbenchPartReference> ()->GetPane();
}
bool WorkbenchPage::InternalBringToTop(IWorkbenchPartReference::Pointer part)
{
bool broughtToTop = false;
// Move part.
if (part.Cast<IEditorReference> ().IsNotNull())
{
IStackableContainer::Pointer container = this->GetContainer(part);
if (container.Cast<PartStack> () != 0)
{
PartStack::Pointer stack = container.Cast<PartStack> ();
PartPane::Pointer newPart = this->GetPane(part);
if (stack->GetSelection() != newPart)
{
stack->SetSelection(newPart);
}
broughtToTop = true;
}
}
else if (part.Cast<IViewReference> ().IsNotNull())
{
Perspective::Pointer persp = this->GetActivePerspective();
if (persp != 0)
{
broughtToTop = persp->BringToTop(part.Cast<IViewReference> ());
}
}
// Ensure that this part is considered the most recently activated part
// in this stack
activationList->BringToTop(part);
return broughtToTop;
}
void WorkbenchPage::BringToTop(IWorkbenchPart::Pointer part)
{
// Sanity check.
Perspective::Pointer persp = this->GetActivePerspective();
if (persp == 0 || !this->CertifyPart(part))
{
return;
}
// if (!((GrabFocus)Tweaklets.get(GrabFocus.KEY)).grabFocusAllowed(part))
// {
// return;
// }
// std::string label; // debugging only
// if (UIStats.isDebugging(UIStats.BRING_PART_TO_TOP))
// {
// label = part != 0 ? part.getTitle() : "none"; //$NON-NLS-1$
// }
IWorkbenchPartReference::Pointer ref = this->GetReference(part);
IStackableContainer::Pointer activeEditorContainer = this->GetContainer(
this->GetActiveEditor().Cast<IWorkbenchPart> ());
IStackableContainer::Pointer activePartContainer = this->GetContainer(
this->GetActivePart());
IStackableContainer::Pointer newPartContainer = this->GetContainer(part);
if (newPartContainer == activePartContainer)
{
this->MakeActive(ref);
}
else if (newPartContainer == activeEditorContainer)
{
if (ref.Cast<IEditorReference> () != 0)
{
if (part != 0)
{
IWorkbenchPartSite::Pointer site = part->GetSite();
if (site.Cast<PartSite> () != 0)
{
ref = site.Cast<PartSite> ()->GetPane()->GetPartReference();
}
}
this->MakeActiveEditor(ref.Cast<IEditorReference> ());
}
else
{
this->MakeActiveEditor(IEditorReference::Pointer(0));
}
}
else
{
this->InternalBringToTop(ref);
if (ref != 0)
{
partList->FirePartBroughtToTop(ref);
}
}
}
void WorkbenchPage::BusyResetPerspective()
{
ViewIntroAdapterPart::Pointer
introViewAdapter =
dynamic_cast<WorkbenchIntroManager*> (GetWorkbenchWindow() ->GetWorkbench()->GetIntroManager())->GetIntroAdapterPart().Cast<
ViewIntroAdapterPart> ();
// PartPane introPane = 0;
// boolean introFullScreen = false;
// if (introViewAdapter != 0)
// {
// introPane = ((PartSite) introViewAdapter.getSite()).getPane();
// introViewAdapter.setHandleZoomEvents(false);
// introFullScreen = introPane.isZoomed();
// }
// //try to prevent intro flicker.
// if (introFullScreen)
// {
// window.getShell().setRedraw(false);
// }
// try
// {
// // Always unzoom
// if (isZoomed())
// {
// zoomOut();
// }
// Get the current perspective.
// This describes the working layout of the page and differs from
// the original template.
Perspective::Pointer oldPersp = this->GetActivePerspective();
// Map the current perspective to the original template.
// If the original template cannot be found then it has been deleted.
// In that case just return. (PR#1GDSABU).
IPerspectiveRegistry* reg =
WorkbenchPlugin::GetDefault() ->GetPerspectiveRegistry();
PerspectiveDescriptor::Pointer desc = reg->FindPerspectiveWithId(
oldPersp->GetDesc()->GetId()).Cast<PerspectiveDescriptor> ();
if (desc == 0)
{
desc
= reg->FindPerspectiveWithId(oldPersp ->GetDesc().Cast<
PerspectiveDescriptor> ()->GetOriginalId()).Cast<
PerspectiveDescriptor> ();
}
if (desc == 0)
{
return;
}
// Notify listeners that we are doing a reset.
window->FirePerspectiveChanged(IWorkbenchPage::Pointer(this), desc,
CHANGE_RESET);
// Create new persp from original template.
// Suppress the perspectiveOpened and perspectiveClosed events otherwise it looks like two
// instances of the same perspective are open temporarily (see bug 127470).
Perspective::Pointer newPersp = this->CreatePerspective(desc, false);
if (newPersp == 0)
{
// We're not going through with the reset, so it is complete.
window->FirePerspectiveChanged(IWorkbenchPage::Pointer(this), desc,
CHANGE_RESET_COMPLETE);
return;
}
// Update the perspective list and shortcut
perspList.Swap(oldPersp, newPersp);
// Install new persp.
this->SetPerspective(newPersp);
// Destroy old persp.
this->DisposePerspective(oldPersp, false);
// Update the Coolbar layout.
this->ResetToolBarLayout();
// restore the maximized intro
if (introViewAdapter)
{
try
{
// ensure that the intro is visible in the new perspective
ShowView(IntroConstants::INTRO_VIEW_ID);
// if (introFullScreen)
// {
// toggleZoom(introPane.getPartReference());
// }
} catch (PartInitException& e)
{
//TODO IStatus
WorkbenchPlugin::Log("Could not restore intro", e);
// WorkbenchPlugin.getStatus(e));
}
// finally
// {
// // we want the intro back to a normal state before we fire the event
// introViewAdapter.setHandleZoomEvents(true);
// }
}
// Notify listeners that we have completed our reset.
window->FirePerspectiveChanged(IWorkbenchPage::Pointer(this), desc,
CHANGE_RESET_COMPLETE);
// }
// finally
// {
// // reset the handling of zoom events (possibly for the second time) in case there was
// // an exception thrown
// if (introViewAdapter != 0)
// {
// introViewAdapter.setHandleZoomEvents(true);
// }
//
// if (introFullScreen)
// {
// window.getShell().setRedraw(true);
// }
// }
}
void WorkbenchPage::BusySetPerspective(IPerspectiveDescriptor::Pointer desc)
{
// Create new layout.
std::string label = desc->GetId(); // debugging only
Perspective::Pointer newPersp;
//try
//{
//UIStats.start(UIStats.SWITCH_PERSPECTIVE, label);
PerspectiveDescriptor::Pointer realDesc = desc.Cast<PerspectiveDescriptor> ();
newPersp = this->FindPerspective(realDesc);
if (newPersp == 0)
{
newPersp = this->CreatePerspective(realDesc, true);
if (newPersp == 0)
{
return;
}
}
// Change layout.
this->SetPerspective(newPersp);
// }
// catch (std::exception& e)
// {
// UIStats.end(UIStats.SWITCH_PERSPECTIVE, desc.getId(), label);
// throw e;
// }
}
IViewPart::Pointer WorkbenchPage::BusyShowView(const std::string& viewID,
const std::string& secondaryID, int mode)
{
Perspective::Pointer persp = this->GetActivePerspective();
if (persp == 0)
{
return IViewPart::Pointer(0);
}
// If this view is already visible just return.
IViewReference::Pointer ref = persp->FindView(viewID, secondaryID);
IViewPart::Pointer view;
if (ref != 0)
{
view = ref->GetView(true);
}
if (view != 0)
{
this->BusyShowView(view, mode);
return view;
}
// Show the view.
view = persp->ShowView(viewID, secondaryID);
if (view != 0)
{
this->BusyShowView(view, mode);
IWorkbenchPartReference::Pointer partReference = this->GetReference(view);
PartPane::Pointer partPane = this->GetPane(partReference);
partPane->SetInLayout(true);
IWorkbenchPage::Pointer thisPage(this);
window->FirePerspectiveChanged(thisPage, GetPerspective(), partReference,
CHANGE_VIEW_SHOW);
window->FirePerspectiveChanged(thisPage, GetPerspective(), CHANGE_VIEW_SHOW);
}
return view;
}
void WorkbenchPage::BusyShowView(IViewPart::Pointer part, int mode)
{
// if (!((GrabFocus) Tweaklets.get(GrabFocus.KEY)).grabFocusAllowed(part))
// {
// return;
// }
if (mode == VIEW_ACTIVATE)
{
this->Activate(part);
}
else if (mode == VIEW_VISIBLE)
{
IWorkbenchPartReference::Pointer ref = this->GetActivePartReference();
// if there is no active part or it's not a view, bring to top
if (ref == 0 || ref.Cast<IViewReference> () == 0)
{
this->BringToTop(part);
}
else
{
// otherwise check to see if the we're in the same stack as the active view
IViewReference::Pointer activeView = ref.Cast<IViewReference> ();
std::vector<IViewReference::Pointer> viewStack =
this->GetViewReferenceStack(part);
for (unsigned int i = 0; i < viewStack.size(); i++)
{
if (viewStack[i] == activeView)
{
return;
}
}
this->BringToTop(part);
}
}
}
bool WorkbenchPage::CertifyPart(IWorkbenchPart::Pointer part)
{
//Workaround for bug 22325
if (part != 0 && part->GetSite().Cast<PartSite> () == 0)
{
return false;
}
if (part.Cast<IEditorPart> () != 0)
{
IEditorReference::Pointer ref = this->GetReference(part).Cast<
IEditorReference> ();
return ref != 0 && this->GetEditorManager()->ContainsEditor(ref);
}
if (part.Cast<IViewPart> () != 0)
{
Perspective::Pointer persp = this->GetActivePerspective();
return persp != 0 && persp->ContainsView(part.Cast<IViewPart> ());
}
return false;
}
bool WorkbenchPage::Close()
{
bool ret;
//BusyIndicator.showWhile(0, new Runnable()
// {
// public void WorkbenchPage::run()
// {
ret = window->ClosePage(IWorkbenchPage::Pointer(this), true);
// }
// });
return ret;
}
bool WorkbenchPage::CloseAllSavedEditors()
{
// get the Saved editors
std::list<IEditorReference::Pointer> editors = this->GetEditorReferences();
std::list<IEditorReference::Pointer> savedEditors;
for (std::list<IEditorReference::Pointer>::iterator iter = editors.begin(); iter
!= editors.end(); ++iter)
{
IEditorReference::Pointer editor = *iter;
if (!editor->IsDirty())
{
savedEditors.push_back(editor);
}
}
//there are no unsaved editors
if (savedEditors.empty())
{
return true;
}
return this->CloseEditors(savedEditors, false);
}
bool WorkbenchPage::CloseAllEditors(bool save)
{
return this->CloseEditors(this->GetEditorReferences(), save);
}
void WorkbenchPage::UpdateActivePart()
{
if (this->IsDeferred())
{
return;
}
IWorkbenchPartReference::Pointer oldActivePart =
partList->GetActivePartReference();
IWorkbenchPartReference::Pointer oldActiveEditor =
partList->GetActiveEditorReference();
IWorkbenchPartReference::Pointer newActivePart;
IEditorReference::Pointer newActiveEditor;
if (!window->IsClosing())
{
// If an editor is active, try to keep an editor active
if (oldActiveEditor && oldActivePart == oldActiveEditor)
{
newActiveEditor = activationList->GetActiveReference(true).Cast<
IEditorReference> ();
newActivePart = newActiveEditor;
if (newActivePart == 0)
{
// Only activate a non-editor if there's no editors left
newActivePart = activationList->GetActiveReference(false);
}
}
else
{
// If a non-editor is active, activate whatever was activated most recently
newActivePart = activationList->GetActiveReference(false);
if (newActivePart.Cast<IEditorReference> () != 0)
{
// If that happens to be an editor, make it the active editor as well
newActiveEditor = newActivePart.Cast<IEditorReference> ();
}
else
{
// Otherwise, select whatever editor was most recently active
newActiveEditor = activationList->GetActiveReference(true).Cast<
IEditorReference> ();
}
}
}
if (oldActiveEditor != newActiveEditor)
{
this->MakeActiveEditor(newActiveEditor);
}
if (newActivePart != oldActivePart)
{
this->MakeActive(newActivePart);
}
}
void WorkbenchPage::MakeActive(IWorkbenchPartReference::Pointer ref)
{
if (ref == 0)
{
this->SetActivePart(IWorkbenchPart::Pointer(0));
}
else
{
IWorkbenchPart::Pointer newActive = ref->GetPart(true);
if (newActive == 0)
{
this->SetActivePart(IWorkbenchPart::Pointer(0));
}
else
{
this->Activate(newActive);
}
}
}
void WorkbenchPage::MakeActiveEditor(IEditorReference::Pointer ref)
{
if (ref == this->GetActiveEditorReference())
{
return;
}
IEditorPart::Pointer part = (ref == 0) ? IEditorPart::Pointer(0)
: ref->GetEditor(true);
if (part)
{
editorMgr->SetVisibleEditor(ref, false);
//navigationHistory.MarkEditor(part);
}
actionSwitcher.UpdateTopEditor(part);
if (ref)
{
activationList->BringToTop(this->GetReference(part));
}
partList->SetActiveEditor(ref);
}
bool WorkbenchPage::CloseEditors(
const std::list<IEditorReference::Pointer>& refArray, bool save)
{
if (refArray.empty())
{
return true;
}
IWorkbenchPage::Pointer thisPage(this);
// Check if we're being asked to close any parts that are already closed or cannot
// be closed at this time
std::vector<IEditorReference::Pointer> editorRefs;
for (std::list<IEditorReference::Pointer>::const_iterator iter =
refArray.begin(); iter != refArray.end(); ++iter)
{
IEditorReference::Pointer reference = *iter;
// If we're in the middle of creating this part, this is a programming error. Abort the entire
// close operation. This usually occurs if someone tries to open a dialog in a method that
// isn't allowed to do so, and a *syncExec tries to close the part. If this shows up in a log
// file with a dialog's event loop on the stack, then the code that opened the dialog is usually
// at fault.
if (partBeingActivated == reference)
{
Poco::RuntimeException re(
"WARNING: Blocked recursive attempt to close part " //$NON-NLS-1$
+ partBeingActivated->GetId()
+ " while still in the middle of activating it");
WorkbenchPlugin::Log(re);
return false;
}
// if (reference.Cast<WorkbenchPartReference> () != 0)
// {
// WorkbenchPartReference::Pointer ref = reference.Cast<WorkbenchPartReference>();
//
// // If we're being asked to close a part that is disposed (ie: already closed),
// // skip it and proceed with closing the remaining parts.
// if (ref.isDisposed())
// {
// continue;
// }
// }
editorRefs.push_back(reference);
}
// notify the model manager before the close
std::list<IWorkbenchPart::Pointer> partsToClose;
for (unsigned int i = 0; i < editorRefs.size(); i++)
{
IWorkbenchPart::Pointer refPart = editorRefs[i]->GetPart(false);
if (refPart != 0)
{
partsToClose.push_back(refPart);
}
}
SaveablesList::Pointer modelManager;
SaveablesList::PostCloseInfo::Pointer postCloseInfo;
if (partsToClose.size() > 0)
{
modelManager = this->GetWorkbenchWindow()->GetService(
ISaveablesLifecycleListener::GetManifestName()).Cast<SaveablesList> ();
// this may prompt for saving and return 0 if the user canceled:
postCloseInfo = modelManager->PreCloseParts(partsToClose, save,
this->GetWorkbenchWindow());
if (postCloseInfo == 0)
{
return false;
}
}
// Fire pre-removal changes
for (unsigned int i = 0; i < editorRefs.size(); i++)
{
IEditorReference::Pointer ref = editorRefs[i];
// Notify interested listeners before the close
window->FirePerspectiveChanged(thisPage, this->GetPerspective(), ref,
CHANGE_EDITOR_CLOSE);
}
this->DeferUpdates(true);
try
{
if (modelManager != 0)
{
modelManager->PostClose(postCloseInfo);
}
// Close all editors.
for (unsigned int i = 0; i < editorRefs.size(); i++)
{
IEditorReference::Pointer ref = editorRefs[i];
// Remove editor from the presentation
editorPresentation->CloseEditor(ref);
this->PartRemoved(ref.Cast<WorkbenchPartReference> ());
}
} catch (...)
{
}
this->DeferUpdates(false);
// Notify interested listeners after the close
window->FirePerspectiveChanged(thisPage, this->GetPerspective(),
CHANGE_EDITOR_CLOSE);
// Return true on success.
return true;
}
void WorkbenchPage::DeferUpdates(bool shouldDefer)
{
if (shouldDefer)
{
if (deferCount == 0)
{
this->StartDeferring();
}
deferCount++;
}
else
{
deferCount--;
if (deferCount == 0)
{
this->HandleDeferredEvents();
}
}
}
void WorkbenchPage::StartDeferring()
{
//editorPresentation.getLayoutPart().deferUpdates(true);
}
void WorkbenchPage::HandleDeferredEvents()
{
editorPresentation->GetLayoutPart()->DeferUpdates(false);
this->UpdateActivePart();
std::vector<WorkbenchPartReference::Pointer> disposals = pendingDisposals;
pendingDisposals.clear();
for (unsigned int i = 0; i < disposals.size(); i++)
{
this->DisposePart(disposals[i]);
}
}
bool WorkbenchPage::IsDeferred()
{
return deferCount > 0;
}
bool WorkbenchPage::CloseEditor(IEditorReference::Pointer editorRef, bool save)
{
std::list<IEditorReference::Pointer> list;
list.push_back(editorRef);
return this->CloseEditors(list, save);
}
bool WorkbenchPage::CloseEditor(IEditorPart::Pointer editor, bool save)
{
IWorkbenchPartReference::Pointer ref = this->GetReference(editor);
if (ref.Cast<IEditorReference> ().IsNotNull())
{
std::list<IEditorReference::Pointer> list;
list.push_back(ref.Cast<IEditorReference> ());
return this->CloseEditors(list, save);
}
return false;
}
void WorkbenchPage::ClosePerspective(IPerspectiveDescriptor::Pointer desc,
bool saveParts, bool closePage)
{
Perspective::Pointer persp = this->FindPerspective(desc);
if (persp != 0)
{
this->ClosePerspective(persp, saveParts, closePage);
}
}
void WorkbenchPage::ClosePerspective(Perspective::Pointer persp,
bool saveParts, bool closePage)
{
// // Always unzoom
// if (isZoomed())
// {
// zoomOut();
// }
std::vector<IWorkbenchPart::Pointer> partsToSave;
std::list<IWorkbenchPart::Pointer> viewsToClose;
// collect views that will go away and views that are dirty
std::vector<IViewReference::Pointer> viewReferences =
persp->GetViewReferences();
for (unsigned int i = 0; i < viewReferences.size(); i++)
{
IViewReference::Pointer reference = viewReferences[i];
if (this->GetViewFactory()->GetReferenceCount(reference) == 1)
{
IViewPart::Pointer viewPart = reference->GetView(false);
if (viewPart != 0)
{
viewsToClose.push_back(viewPart);
if (saveParts && reference->IsDirty())
{
partsToSave.push_back(viewPart);
}
}
}
}
if (saveParts && perspList.Size() == 1)
{
// collect editors that are dirty
std::list<IEditorReference::Pointer> editorReferences =
this->GetEditorReferences();
for (std::list<IEditorReference::Pointer>::iterator refIter =
editorReferences.begin(); refIter != editorReferences.end(); ++refIter)
{
IEditorReference::Pointer reference = *refIter;
if (reference->IsDirty())
{
IEditorPart::Pointer editorPart = reference->GetEditor(false);
if (editorPart != 0)
{
partsToSave.push_back(editorPart);
}
}
}
}
if (saveParts && !partsToSave.empty())
{
if (!EditorManager::SaveAll(partsToSave, true, true, false,
IWorkbenchWindow::Pointer(window)))
{
// user canceled
return;
}
}
// Close all editors on last perspective close
if (perspList.Size() == 1 && this->GetEditorManager()->GetEditorCount() > 0)
{
// Close all editors
if (!this->CloseAllEditors(false))
{
return;
}
}
// closeAllEditors already notified the saveables list about the editors.
SaveablesList::Pointer
saveablesList =
this->GetWorkbenchWindow()->GetWorkbench()->GetService(
ISaveablesLifecycleListener::GetManifestName()).Cast<
SaveablesList> ();
// we took care of the saving already, so pass in false (postCloseInfo will be non-0)
SaveablesList::PostCloseInfo::Pointer postCloseInfo =
saveablesList->PreCloseParts(viewsToClose, false,
this->GetWorkbenchWindow());
saveablesList->PostClose(postCloseInfo);
// Dispose of the perspective
bool isActive = (perspList.GetActive() == persp);
if (isActive)
{
this->SetPerspective(perspList.GetNextActive());
}
this->DisposePerspective(persp, true);
if (closePage && perspList.Size() == 0)
{
this->Close();
}
}
void WorkbenchPage::CloseAllPerspectives(bool saveEditors, bool closePage)
{
if (perspList.IsEmpty())
{
return;
}
// // Always unzoom
// if (isZoomed())
// {
// zoomOut();
// }
if (saveEditors)
{
if (!this->SaveAllEditors(true))
{
return;
}
}
// Close all editors
if (!this->CloseAllEditors(false))
{
return;
}
// Deactivate the active perspective and part
this->SetPerspective(Perspective::Pointer(0));
// Close each perspective in turn
PerspectiveList oldList = perspList;
perspList = PerspectiveList();
for (PerspectiveList::iterator itr = oldList.Begin(); itr != oldList.End(); ++itr)
{
this->ClosePerspective(*itr, false, false);
}
if (closePage)
{
this->Close();
}
}
void WorkbenchPage::CreateClientComposite()
{
void* parent = window->GetPageComposite();
// StartupThreading.runWithoutExceptions(new StartupRunnable()
// {
//
// public void WorkbenchPage::runWithException()
// {
composite
= Tweaklets::Get(WorkbenchPageTweaklet::KEY)->CreateClientComposite(
parent);
Tweaklets::Get(GuiWidgetsTweaklet::KEY)->SetVisible(composite, false); // Make visible on activate.
// force the client composite to be layed out
// parent.layout();
// }
// });
}
Perspective::Pointer WorkbenchPage::CreatePerspective(
PerspectiveDescriptor::Pointer desc, bool notify)
{
std::string label = desc->GetId(); // debugging only
try
{
//UIStats.start(UIStats.CREATE_PERSPECTIVE, label);
WorkbenchPage::Pointer thisPage(this);
Perspective::Pointer persp(new Perspective(desc, thisPage));
perspList.Add(persp);
if (notify)
{
window->FirePerspectiveOpened(thisPage, desc);
}
//if the perspective is fresh and uncustomzied then it is not dirty
//no reset will be prompted for
if (!desc->HasCustomDefinition())
{
dirtyPerspectives.erase(desc->GetId());
}
return persp;
} catch (WorkbenchException& /*e*/)
{
if (!window->GetWorkbenchImpl()->IsStarting())
{
MessageDialog::OpenError(window->GetShell(), "Error",
"Problems opening perspective \"" + desc->GetId() + "\"");
}
return Perspective::Pointer(0);
}
// finally
// {
// UIStats.end(UIStats.CREATE_PERSPECTIVE, desc.getId(), label);
// }
}
void WorkbenchPage::PartAdded(WorkbenchPartReference::Pointer ref)
{
activationList->Add(ref);
partList->AddPart(ref);
this->UpdateActivePart();
}
void WorkbenchPage::PartRemoved(WorkbenchPartReference::Pointer ref)
{
activationList->Remove(ref);
this->DisposePart(ref);
}
void WorkbenchPage::DisposePart(WorkbenchPartReference::Pointer ref)
{
if (this->IsDeferred())
{
pendingDisposals.push_back(ref);
}
else
{
partList->RemovePart(ref);
ref->Dispose();
}
}
void WorkbenchPage::DeactivatePart(IWorkbenchPart::Pointer part)
{
if (part.IsNotNull())
{
PartSite::Pointer site = part->GetSite().Cast<PartSite> ();
site->GetPane()->ShowFocus(false);
}
}
void WorkbenchPage::DetachView(IViewReference::Pointer ref)
{
Perspective::Pointer persp = this->GetActivePerspective();
if (persp == 0)
{
return;
}
PerspectiveHelper* presentation = persp->GetPresentation();
presentation->DetachPart(ref);
}
void WorkbenchPage::AttachView(IViewReference::Pointer ref)
{
PerspectiveHelper* presentation = this->GetPerspectivePresentation();
presentation->AttachPart(ref);
}
WorkbenchPage::~WorkbenchPage()
{
// increment reference count to prevent recursive deletes
this->Register();
{
{
this->MakeActiveEditor(IEditorReference::Pointer(0));
this->MakeActive(IWorkbenchPartReference::Pointer(0));
// Close and dispose the editors.
this->CloseAllEditors(false);
// Need to make sure model data is cleaned up when the page is
// disposed. Collect all the views on the page and notify the
// saveable list of a pre/post close. This will free model data.
std::vector<IWorkbenchPartReference::Pointer> partsToClose =
this->GetOpenParts();
std::list<IWorkbenchPart::Pointer> dirtyParts;
for (unsigned int i = 0; i < partsToClose.size(); i++)
{
IWorkbenchPart::Pointer part = partsToClose[i]->GetPart(false);
if (part != 0 && part.Cast<IViewPart> () != 0)
{
dirtyParts.push_back(part);
}
}
SaveablesList::Pointer saveablesList =
this->GetWorkbenchWindow()->GetWorkbench()->GetService(
ISaveablesLifecycleListener::GetManifestName()).Cast<
SaveablesList> ();
SaveablesList::PostCloseInfo::Pointer postCloseInfo =
saveablesList->PreCloseParts(dirtyParts, false,
this->GetWorkbenchWindow());
saveablesList->PostClose(postCloseInfo);
IWorkbenchPage::Pointer thisPage(this);
// Get rid of perspectives. This will close the views
for (PerspectiveList::iterator itr = perspList.Begin(); itr
!= perspList.End(); ++itr)
{
Perspective::Pointer perspective = *itr;
window->FirePerspectiveClosed(thisPage, perspective->GetDesc());
//perspective->Dispose();
}
perspList = PerspectiveList();
// Capture views.
std::vector<IViewReference::Pointer> refs = viewFactory->GetViews();
// if (refs.size() > 0)
// {
// // Dispose views.
// for (unsigned int i = 0; i < refs.size(); i++)
// {
// WorkbenchPartReference::Pointer ref = refs[i].Cast<WorkbenchPartReference>();
// //partList.RemovePart(ref);
// //this->FirePartClosed(refs[i]);
// // Platform.run(new SafeRunnable() {
// // public void run() {
// // // WorkbenchPlugin.log(new Status(IStatus.WARNING, WorkbenchPlugin.PI_WORKBENCH,
// // // Status.OK, "WorkbenchPage leaked a refcount for view " + ref.getId(), 0)); //$NON-NLS-1$//$NON-NLS-2$
//
// ref.dispose();
// // }
//
// // public void handleException(Throwable e) {
// // }
// // });
// }
// }
// Get rid of editor presentation.
//editorPresentation->Dispose();
// Get rid of composite.
//composite.dispose();
//navigationHistory.dispose();
//stickyViewMan.clear();
// if (tracker != 0)
// {
// tracker.close();
// }
// // if we're destroying a window in a non-shutdown situation then we should
// // clean up the working set we made.
// if (!window->GetWorkbench()->IsClosing())
// {
// if (aggregateWorkingSet != 0)
// {
// PlatformUI.getWorkbench().getWorkingSetManager().removeWorkingSet(
// aggregateWorkingSet);
// }
// }
}
partBeingActivated = 0;
pendingDisposals.clear();
stickyViewMan = 0;
delete viewFactory;
delete editorPresentation;
delete editorMgr;
delete activationList;
deferredActivePersp = 0;
dirtyPerspectives.clear();
delete selectionService;
partList = 0;
}
// decrement reference count again, without explicit deletion
this->UnRegister(false);
}
void WorkbenchPage::DisposePerspective(Perspective::Pointer persp, bool notify)
{
// Get rid of perspective.
perspList.Remove(persp);
if (notify)
{
IWorkbenchPage::Pointer thisPage(this);
window->FirePerspectiveClosed(thisPage, persp->GetDesc());
}
//persp->Dispose();
stickyViewMan->Remove(persp->GetDesc()->GetId());
}
Perspective::Pointer WorkbenchPage::FindPerspective(
IPerspectiveDescriptor::Pointer desc)
{
for (PerspectiveList::iterator itr = perspList.Begin(); itr
!= perspList.End(); ++itr)
{
Perspective::Pointer mgr = *itr;
if (desc->GetId() == mgr->GetDesc()->GetId())
{
return mgr;
}
}
return Perspective::Pointer(0);
}
IViewPart::Pointer WorkbenchPage::FindView(const std::string& id)
{
IViewReference::Pointer ref = this->FindViewReference(id);
if (ref == 0)
{
return IViewPart::Pointer(0);
}
return ref->GetView(true);
}
IViewReference::Pointer WorkbenchPage::FindViewReference(
const std::string& viewId)
{
return this->FindViewReference(viewId, "");
}
IViewReference::Pointer WorkbenchPage::FindViewReference(
const std::string& viewId, const std::string& secondaryId)
{
Perspective::Pointer persp = this->GetActivePerspective();
if (persp == 0)
{
return IViewReference::Pointer(0);
}
return persp->FindView(viewId, secondaryId);
}
IEditorPart::Pointer WorkbenchPage::GetActiveEditor()
{
return partList->GetActiveEditor();
}
IEditorReference::Pointer WorkbenchPage::GetActiveEditorReference()
{
return partList->GetActiveEditorReference();
}
IWorkbenchPart::Pointer WorkbenchPage::GetActivePart()
{
return partList->GetActivePart();
}
IWorkbenchPartReference::Pointer WorkbenchPage::GetActivePartReference()
{
return partList->GetActivePartReference();
}
Perspective::Pointer WorkbenchPage::GetActivePerspective()
{
return perspList.GetActive();
}
void* WorkbenchPage::GetClientComposite()
{
return composite;
}
EditorManager* WorkbenchPage::GetEditorManager()
{
return editorMgr;
}
PerspectiveHelper* WorkbenchPage::GetPerspectivePresentation()
{
if (this->GetActivePerspective() != 0)
{
return this->GetActivePerspective()->GetPresentation();
}
return 0;
}
/**
* Answer the editor presentation.
*/
EditorAreaHelper* WorkbenchPage::GetEditorPresentation()
{
return editorPresentation;
}
std::vector<IEditorPart::Pointer> WorkbenchPage::GetEditors()
{
std::list<IEditorReference::Pointer> refs = this->GetEditorReferences();
std::vector<IEditorPart::Pointer> result;
//Display d = getWorkbenchWindow().getShell().getDisplay();
//Must be backward compatible.
// d.syncExec(new Runnable()
// {
// public void WorkbenchPage::run()
// {
for (std::list<IEditorReference::Pointer>::iterator iter = refs.begin(); iter
!= refs.end(); ++iter)
{
IEditorPart::Pointer part = (*iter)->GetEditor(true);
if (part != 0)
{
result.push_back(part);
}
}
// }
// });
return result;
}
std::vector<IEditorPart::Pointer> WorkbenchPage::GetDirtyEditors()
{
return this->GetEditorManager()->GetDirtyEditors();
}
std::vector<ISaveablePart::Pointer> WorkbenchPage::GetDirtyParts()
{
std::vector<ISaveablePart::Pointer> result;
std::vector<IWorkbenchPartReference::Pointer> allParts = this->GetAllParts();
for (unsigned int i = 0; i < allParts.size(); i++)
{
IWorkbenchPartReference::Pointer reference = allParts[i];
IWorkbenchPart::Pointer part = reference->GetPart(false);
if (part != 0 && part.Cast<ISaveablePart> () != 0)
{
ISaveablePart::Pointer saveable = part.Cast<ISaveablePart> ();
if (saveable->IsDirty())
{
result.push_back(saveable);
}
}
}
return result;
}
IEditorPart::Pointer WorkbenchPage::FindEditor(IEditorInput::Pointer input)
{
return this->GetEditorManager()->FindEditor(input);
}
std::vector<IEditorReference::Pointer> WorkbenchPage::FindEditors(
IEditorInput::Pointer input, const std::string& editorId, int matchFlags)
{
return this->GetEditorManager()->FindEditors(input, editorId, matchFlags);
}
std::list<IEditorReference::Pointer> WorkbenchPage::GetEditorReferences()
{
return editorPresentation->GetEditors();
}
IAdaptable* WorkbenchPage::GetInput()
{
return input;
}
std::string WorkbenchPage::GetLabel()
{
std::string label = "<Unknown label>";
// IWorkbenchAdapter adapter = (IWorkbenchAdapter) Util.getAdapter(input,
// IWorkbenchAdapter.class);
// if (adapter != 0)
// {
// label = adapter.getLabel(input);
// }
Perspective::Pointer persp = this->GetActivePerspective();
if (persp != 0)
{
label = label + " - " + persp->GetDesc()->GetLabel();
}
else if (deferredActivePersp != 0)
{
label = label + " - " + deferredActivePersp->GetLabel();
}
return label;
}
IPerspectiveDescriptor::Pointer WorkbenchPage::GetPerspective()
{
if (deferredActivePersp != 0)
{
return deferredActivePersp;
}
Perspective::Pointer persp = this->GetActivePerspective();
if (persp != 0)
{
return persp->GetDesc();
}
else
{
return IPerspectiveDescriptor::Pointer(0);
}
}
ISelection::ConstPointer WorkbenchPage::GetSelection() const
{
return selectionService->GetSelection();
}
ISelection::ConstPointer WorkbenchPage::GetSelection(const std::string& partId)
{
return selectionService->GetSelection(partId);
}
//ISelectionService::SelectionEvents& WorkbenchPage::GetSelectionEvents(const std::string& partId)
//{
// return selectionService->GetSelectionEvents(partId);
//}
ViewFactory* WorkbenchPage::GetViewFactory()
{
if (viewFactory == 0)
{
viewFactory = new ViewFactory(this,
WorkbenchPlugin::GetDefault()->GetViewRegistry());
}
return viewFactory;
}
std::vector<IViewReference::Pointer> WorkbenchPage::GetViewReferences()
{
Perspective::Pointer persp = this->GetActivePerspective();
if (persp != 0)
{
return persp->GetViewReferences();
}
else
{
return std::vector<IViewReference::Pointer>();
}
}
std::vector<IViewPart::Pointer> WorkbenchPage::GetViews()
{
return this->GetViews(Perspective::Pointer(0), true);
}
std::vector<IViewPart::Pointer> WorkbenchPage::GetViews(
Perspective::Pointer persp, bool restore)
{
if (persp == 0)
{
persp = this->GetActivePerspective();
}
std::vector<IViewPart::Pointer> parts;
if (persp != 0)
{
std::vector<IViewReference::Pointer> refs = persp->GetViewReferences();
for (unsigned int i = 0; i < refs.size(); i++)
{
IViewPart::Pointer part = refs[i]->GetPart(restore).Cast<IViewPart> ();
if (part != 0)
{
parts.push_back(part);
}
}
}
return parts;
}
IWorkbenchWindow::Pointer WorkbenchPage::GetWorkbenchWindow()
{
return IWorkbenchWindow::Pointer(window);
}
void WorkbenchPage::HideView(IViewReference::Pointer ref)
{
// Sanity check.
if (ref == 0)
{
return;
}
Perspective::Pointer persp = this->GetActivePerspective();
if (persp == 0)
{
return;
}
bool promptedForSave = false;
IViewPart::Pointer view = ref->GetView(false);
if (view != 0)
{
if (!this->CertifyPart(view))
{
return;
}
// Confirm.
if (view.Cast<ISaveablePart> () != 0)
{
ISaveablePart::Pointer saveable = view.Cast<ISaveablePart> ();
if (saveable->IsSaveOnCloseNeeded())
{
IWorkbenchWindow::Pointer window =
view->GetSite()->GetWorkbenchWindow();
std::vector<IWorkbenchPart::Pointer> partsToSave;
partsToSave.push_back(view);
bool success = EditorManager::SaveAll(partsToSave, true, true, false,
window);
if (!success)
{
// the user cancelled.
return;
}
promptedForSave = true;
}
}
}
int refCount = this->GetViewFactory()->GetReferenceCount(ref);
SaveablesList::Pointer saveablesList;
SaveablesList::PostCloseInfo::Pointer postCloseInfo;
if (refCount == 1)
{
IWorkbenchPart::Pointer actualPart = ref->GetPart(false);
if (actualPart != 0)
{
saveablesList
= actualPart->GetSite()->GetService(
ISaveablesLifecycleListener::GetManifestName()).Cast<
SaveablesList> ();
std::list<IWorkbenchPart::Pointer> partsToClose;
partsToClose.push_back(actualPart);
postCloseInfo = saveablesList->PreCloseParts(partsToClose,
!promptedForSave, this->GetWorkbenchWindow());
if (postCloseInfo == 0)
{
// cancel
return;
}
}
}
IWorkbenchPage::Pointer thisPage(this);
// Notify interested listeners before the hide
window->FirePerspectiveChanged(thisPage, persp->GetDesc(), ref,
CHANGE_VIEW_HIDE);
PartPane::Pointer pane = this->GetPane(ref.Cast<IWorkbenchPartReference> ());
pane->SetInLayout(false);
this->UpdateActivePart();
if (saveablesList != 0)
{
saveablesList->PostClose(postCloseInfo);
}
// Hide the part.
persp->HideView(ref);
// Notify interested listeners after the hide
window->FirePerspectiveChanged(thisPage, this->GetPerspective(),
CHANGE_VIEW_HIDE);
}
void WorkbenchPage::RefreshActiveView()
{
this->UpdateActivePart();
}
void WorkbenchPage::HideView(IViewPart::Pointer view)
{
this->HideView(this->GetReference(view).Cast<IViewReference> ());
}
void WorkbenchPage::Init(WorkbenchWindow* w, const std::string& layoutID,
IAdaptable* input, bool openExtras)
{
// Save args.
this->window = w;
this->input = input;
this->composite = 0;
this->viewFactory = 0;
this->activationList = new ActivationList(this);
this->selectionService = new PageSelectionService(this);
this->partList = new WorkbenchPagePartList(this->selectionService);
this->stickyViewMan = new StickyViewManager(this);
//actionSets = new ActionSetManager(w);
deferCount = 0;
// Create presentation.
this->CreateClientComposite();
editorPresentation = new EditorAreaHelper(this);
editorMgr = new EditorManager(WorkbenchWindow::Pointer(window),
WorkbenchPage::Pointer(this), editorPresentation);
//TODO WorkbenchPage perspective reorder listener?
// // add this page as a client to be notified when the UI has re-ordered perspectives
// // so that the order can be properly maintained in the receiver.
// // E.g. a UI might support drag-and-drop and will need to make this known to ensure
// // #saveState and #restoreState do not lose this re-ordering
// w.addPerspectiveReorderListener(new IReorderListener()
// {
// public void WorkbenchPage::reorder(Object perspective, int newLoc)
// {
// perspList.reorder((IPerspectiveDescriptor)perspective, newLoc);
// }
// });
if (openExtras)
{
this->OpenPerspectiveExtras();
}
// Get perspective descriptor.
if (layoutID != "")
{
PerspectiveDescriptor::Pointer
desc =
WorkbenchPlugin::GetDefault()->GetPerspectiveRegistry()->FindPerspectiveWithId(
layoutID).Cast<PerspectiveDescriptor> ();
if (desc == 0)
{
throw WorkbenchException("Unable to create Perspective " + layoutID
+ ". There is no corresponding perspective extension.");
}
Perspective::Pointer persp = this->FindPerspective(desc);
if (persp == 0)
{
persp = this->CreatePerspective(desc, true);
}
perspList.SetActive(persp);
window->FirePerspectiveActivated(IWorkbenchPage::Pointer(this), desc);
}
// getExtensionTracker() .registerHandler(perspectiveChangeHandler,
// ExtensionTracker .createExtensionPointFilter(
// getPerspectiveExtensionPoint()));
}
void WorkbenchPage::OpenPerspectiveExtras()
{
//TODO WorkbenchPage perspectice extras
std::string extras = ""; //PrefUtil.getAPIPreferenceStore().getString(
// IWorkbenchPreferenceConstants.PERSPECTIVE_BAR_EXTRAS);
Poco::StringTokenizer tok(extras, ", ", Poco::StringTokenizer::TOK_TRIM
| Poco::StringTokenizer::TOK_IGNORE_EMPTY); //$NON-NLS-1$
std::vector<IPerspectiveDescriptor::Pointer> descs;
for (Poco::StringTokenizer::Iterator itr = tok.begin(); itr != tok.end(); ++itr)
{
std::string id = *itr;
IPerspectiveDescriptor::Pointer
desc =
WorkbenchPlugin::GetDefault()->GetPerspectiveRegistry()->FindPerspectiveWithId(
id);
if (desc != 0)
{
descs.push_back(desc);
}
}
// HACK: The perspective switcher currently adds the button for a new perspective to the beginning of the list.
// So, we process the extra perspectives in reverse order here to have their buttons appear in the order declared.
for (int i = (int) descs.size(); --i >= 0;)
{
PerspectiveDescriptor::Pointer desc =
descs[i].Cast<PerspectiveDescriptor> ();
if (this->FindPerspective(desc) == 0)
{
this->CreatePerspective(desc, true);
}
}
}
bool WorkbenchPage::IsPartVisible(IWorkbenchPart::Pointer part)
{
PartPane::Pointer pane = this->GetPane(part);
return pane != 0 && pane->GetVisible();
}
bool WorkbenchPage::IsEditorAreaVisible()
{
Perspective::Pointer persp = this->GetActivePerspective();
if (persp == 0)
{
return false;
}
return persp->IsEditorAreaVisible();
}
bool WorkbenchPage::IsFastView(IViewReference::Pointer /*ref*/)
{
Perspective::Pointer persp = this->GetActivePerspective();
if (persp != 0)
{
//return persp->IsFastView(ref);
return false;
}
else
{
return false;
}
}
bool WorkbenchPage::IsCloseable(IViewReference::Pointer ref)
{
Perspective::Pointer persp = this->GetActivePerspective();
if (persp != 0)
{
return persp->IsCloseable(ref);
}
return false;
}
bool WorkbenchPage::IsMoveable(IViewReference::Pointer ref)
{
Perspective::Pointer persp = this->GetActivePerspective();
if (persp != 0)
{
return persp->IsMoveable(ref);
}
return false;
}
bool WorkbenchPage::IsFixedLayout()
{
Perspective::Pointer persp = this->GetActivePerspective();
if (persp != 0)
{
return persp->IsFixedLayout();
}
else
{
return false;
}
}
bool WorkbenchPage::IsSaveNeeded()
{
return this->GetEditorManager()->IsSaveAllNeeded();
}
void WorkbenchPage::OnActivate()
{
Tweaklets::Get(GuiWidgetsTweaklet::KEY)->SetVisible(composite, true);
Perspective::Pointer persp = this->GetActivePerspective();
if (persp != 0)
{
persp->OnActivate();
this->UpdateVisibility(Perspective::Pointer(0), persp);
}
}
void WorkbenchPage::OnDeactivate()
{
this->MakeActiveEditor(IEditorReference::Pointer(0));
this->MakeActive(IWorkbenchPartReference::Pointer(0));
if (this->GetActivePerspective() != 0)
{
this->GetActivePerspective()->OnDeactivate();
}
Tweaklets::Get(GuiWidgetsTweaklet::KEY)->SetVisible(composite, false);
}
void WorkbenchPage::ReuseEditor(IReusableEditor::Pointer editor,
IEditorInput::Pointer input)
{
// Rather than calling editor.setInput on the editor directly, we do it through the part reference.
// This case lets us detect badly behaved editors that are not firing a PROP_INPUT event in response
// to the input change... but if all editors obeyed their API contract, the "else" branch would be
// sufficient.
IWorkbenchPartReference::Pointer ref = this->GetReference(editor);
if (ref.Cast<EditorReference> () != 0)
{
EditorReference::Pointer editorRef = ref.Cast<EditorReference> ();
editorRef->SetInput(input);
}
else
{
editor->SetInput(input);
}
//navigationHistory.markEditor(editor);
}
IEditorPart::Pointer WorkbenchPage::OpenEditor(IEditorInput::Pointer input,
const std::string& editorID)
{
return this->OpenEditor(input, editorID, true, MATCH_INPUT);
}
IEditorPart::Pointer WorkbenchPage::OpenEditor(IEditorInput::Pointer input,
const std::string& editorID, bool activate)
{
return this->OpenEditor(input, editorID, activate, MATCH_INPUT);
}
IEditorPart::Pointer WorkbenchPage::OpenEditor(
const IEditorInput::Pointer input, const std::string& editorID,
bool activate, int matchFlags)
{
return this->OpenEditor(input, editorID, activate, matchFlags,
IMemento::Pointer(0));
}
IEditorPart::Pointer WorkbenchPage::OpenEditor(
const IEditorInput::Pointer input, const std::string& editorID,
bool activate, int matchFlags, IMemento::Pointer editorState)
{
if (input == 0 || editorID == "")
{
throw Poco::InvalidArgumentException();
}
// BusyIndicator.showWhile(window.getWorkbench().getDisplay(),
// new Runnable()
// {
// public void WorkbenchPage::run()
// {
return this->BusyOpenEditor(input, editorID, activate, matchFlags,
editorState);
}
IEditorPart::Pointer WorkbenchPage::OpenEditorFromDescriptor(
IEditorInput::Pointer input, IEditorDescriptor::Pointer editorDescriptor,
bool activate, IMemento::Pointer editorState)
{
if (input == 0 || !(editorDescriptor.Cast<EditorDescriptor> () != 0))
{
throw Poco::InvalidArgumentException();
}
// BusyIndicator.showWhile(window.getWorkbench().getDisplay(),
// new Runnable()
// {
// public void WorkbenchPage::run()
// {
return this->BusyOpenEditorFromDescriptor(input, editorDescriptor.Cast<
EditorDescriptor> (), activate, editorState);
// }
// });
}
IEditorPart::Pointer WorkbenchPage::BusyOpenEditor(IEditorInput::Pointer input,
const std::string& editorID, bool activate, int matchFlags,
IMemento::Pointer editorState)
{
Workbench* workbench =
this->GetWorkbenchWindow().Cast<WorkbenchWindow> ()->GetWorkbenchImpl();
workbench->LargeUpdateStart();
IEditorPart::Pointer result;
try
{
result = this->BusyOpenEditorBatched(input, editorID, activate, matchFlags,
editorState);
} catch (std::exception& e)
{
workbench->LargeUpdateEnd();
throw e;
}
workbench->LargeUpdateEnd();
return result;
}
IEditorPart::Pointer WorkbenchPage::BusyOpenEditorFromDescriptor(
IEditorInput::Pointer input, EditorDescriptor::Pointer editorDescriptor,
bool activate, IMemento::Pointer editorState)
{
Workbench* workbench =
this->GetWorkbenchWindow().Cast<WorkbenchWindow> ()->GetWorkbenchImpl();
workbench->LargeUpdateStart();
IEditorPart::Pointer result;
try
{
result = this->BusyOpenEditorFromDescriptorBatched(input, editorDescriptor,
activate, editorState);
} catch (std::exception& e)
{
workbench->LargeUpdateEnd();
throw e;
}
workbench->LargeUpdateEnd();
return result;
}
IEditorPart::Pointer WorkbenchPage::BusyOpenEditorBatched(
IEditorInput::Pointer input, const std::string& editorID, bool activate,
int matchFlags, IMemento::Pointer editorState)
{
// If an editor already exists for the input, use it.
IEditorPart::Pointer editor;
// Reuse an existing open editor, unless we are in "new editor tab management" mode
editor = this->GetEditorManager()->FindEditor(editorID, input, matchFlags);
if (editor != 0)
{
if (IEditorRegistry::SYSTEM_EXTERNAL_EDITOR_ID == editorID)
{
if (editor->IsDirty())
{
std::vector<std::string> dlgLabels;
dlgLabels.push_back("Yes");
dlgLabels.push_back("No");
dlgLabels.push_back("Cancel");
IDialog::Pointer
dialog =
MessageDialog::CreateMessageDialog(
this->GetWorkbenchWindow()->GetShell(),
"Save",
(void*) 0, // accept the default window icon
"\"" + input->GetName()
+ "\" is opened and has unsaved changes. Do you want to save it?",
IDialog::QUESTION, dlgLabels, 0);
int saveFile = dialog->Open();
if (saveFile == 0)
{
// try
// {
IEditorPart::Pointer editorToSave = editor;
// getWorkbenchWindow().run(false, false,
// new IRunnableWithProgress()
// {
// public void WorkbenchPage::run(IProgressMonitor monitor)
// throws InvocationTargetException,
// InterruptedException
// {
//TODO progress monitor
editorToSave->DoSave();//monitor);
// }
// });
// }
// catch (InvocationTargetException& e)
// {
// throw(RuntimeException) e->GetTargetException();
// }
// catch (InterruptedException& e)
// {
// return 0;
// }
}
else if (saveFile == 2)
{
return IEditorPart::Pointer(0);
}
}
}
else
{
// // do the IShowEditorInput notification before showing the editor
// // to reduce flicker
// if (editor.Cast<IShowEditorInput> () != 0)
// {
// ((IShowEditorInput) editor).showEditorInput(input);
// }
this->ShowEditor(activate, editor);
return editor;
}
}
// Otherwise, create a new one. This may cause the new editor to
// become the visible (i.e top) editor.
IEditorReference::Pointer ref = this->GetEditorManager()->OpenEditor(
editorID, input, true, editorState);
if (ref != 0)
{
editor = ref->GetEditor(true);
}
if (editor != 0)
{
this->SetEditorAreaVisible(true);
if (activate)
{
this->Activate(editor);
}
else
{
this->BringToTop(editor);
}
IWorkbenchPage::Pointer thisPage(this);
window->FirePerspectiveChanged(thisPage, this->GetPerspective(), ref,
CHANGE_EDITOR_OPEN);
window->FirePerspectiveChanged(thisPage, this->GetPerspective(),
CHANGE_EDITOR_OPEN);
}
return editor;
}
/*
* Added to fix Bug 178235 [EditorMgmt] DBCS 3.3 - Cannot open file with external program.
* See openEditorFromDescriptor().
*/
IEditorPart::Pointer WorkbenchPage::BusyOpenEditorFromDescriptorBatched(
IEditorInput::Pointer input, EditorDescriptor::Pointer editorDescriptor,
bool activate, IMemento::Pointer editorState)
{
IEditorPart::Pointer editor;
// Create a new one. This may cause the new editor to
// become the visible (i.e top) editor.
IEditorReference::Pointer ref;
ref = this->GetEditorManager()->OpenEditorFromDescriptor(editorDescriptor,
input, editorState);
if (ref != 0)
{
editor = ref->GetEditor(true);
}
if (editor != 0)
{
this->SetEditorAreaVisible(true);
if (activate)
{
this->Activate(editor);
}
else
{
this->BringToTop(editor);
}
IWorkbenchPage::Pointer thisPage(this);
window->FirePerspectiveChanged(thisPage, this->GetPerspective(), ref,
CHANGE_EDITOR_OPEN);
window->FirePerspectiveChanged(thisPage, this->GetPerspective(),
CHANGE_EDITOR_OPEN);
}
return editor;
}
void WorkbenchPage::OpenEmptyTab()
{
IEditorPart::Pointer editor;
EditorReference::Pointer ref;
ref = this->GetEditorManager()->OpenEmptyTab().Cast<EditorReference> ();
if (ref != 0)
{
editor
= ref->GetEmptyEditor(
dynamic_cast<EditorRegistry*> (WorkbenchPlugin::GetDefault()->GetEditorRegistry())->FindEditor(
EditorRegistry::EMPTY_EDITOR_ID).Cast<EditorDescriptor> ());
}
if (editor != 0)
{
this->SetEditorAreaVisible(true);
this->Activate(editor);
IWorkbenchPage::Pointer thisPage(this);
window->FirePerspectiveChanged(thisPage, this->GetPerspective(), ref,
CHANGE_EDITOR_OPEN);
window->FirePerspectiveChanged(thisPage, this->GetPerspective(),
CHANGE_EDITOR_OPEN);
}
}
void WorkbenchPage::ShowEditor(bool activate, IEditorPart::Pointer editor)
{
this->SetEditorAreaVisible(true);
if (activate)
{
//zoomOutIfNecessary(editor);
this->Activate(editor);
}
else
{
this->BringToTop(editor);
}
}
bool WorkbenchPage::IsEditorPinned(IEditorPart::Pointer editor)
{
WorkbenchPartReference::Pointer ref = this->GetReference(editor).Cast<
WorkbenchPartReference> ();
return ref != 0 && ref->IsPinned();
}
/**
* Removes an IPartListener from the part service.
*/
void WorkbenchPage::RemovePartListener(IPartListener::Pointer l)
{
partList->GetPartService()->RemovePartListener(l);
}
/**
* Implements IWorkbenchPage
*
* @see org.blueberry.ui.IWorkbenchPage#removePropertyChangeListener(IPropertyChangeListener)
* @since 2.0
* @deprecated individual views should store a working set if needed and
* register a property change listener directly with the
* working set manager to receive notification when the view
* working set is removed.
*/
// void WorkbenchPage::RemovePropertyChangeListener(IPropertyChangeListener listener) {
// propertyChangeListeners.remove(listener);
// }
void WorkbenchPage::RemoveSelectionListener(
ISelectionListener::Pointer listener)
{
selectionService->RemoveSelectionListener(listener);
}
void WorkbenchPage::RemoveSelectionListener(const std::string& partId,
ISelectionListener::Pointer listener)
{
selectionService->RemoveSelectionListener(partId, listener);
}
void WorkbenchPage::RemovePostSelectionListener(
ISelectionListener::Pointer listener)
{
selectionService->RemovePostSelectionListener(listener);
}
void WorkbenchPage::RemovePostSelectionListener(const std::string& partId,
ISelectionListener::Pointer listener)
{
selectionService->RemovePostSelectionListener(partId, listener);
}
void WorkbenchPage::RequestActivation(IWorkbenchPart::Pointer part)
{
// Sanity check.
if (!this->CertifyPart(part))
{
return;
}
// Real work.
this->SetActivePart(part);
}
/**
* Resets the layout for the perspective. The active part in the old layout
* is activated in the new layout for consistent user context.
*/
void WorkbenchPage::ResetPerspective()
{
// Run op in busy cursor.
// Use set redraw to eliminate the "flash" that can occur in the
// coolbar as the perspective is reset.
// ICoolBarManager2 mgr = (ICoolBarManager2) window.getCoolBarManager2();
// try
// {
// mgr.getControl2().setRedraw(false);
// BusyIndicator.showWhile(0, new Runnable()
// {
// public void WorkbenchPage::run()
// {
this->BusyResetPerspective();
// }
// });
// }finally
// {
// mgr.getControl2().setRedraw(true);
// }
}
bool WorkbenchPage::RestoreState(IMemento::Pointer memento,
const IPerspectiveDescriptor::Pointer activeDescriptor)
{
// StartupThreading.runWithoutExceptions(new StartupRunnable()
// {
//
// public void WorkbenchPage::runWithException() throws Throwable
// {
this->DeferUpdates(true);
// }});
try
{
// Restore working set
std::string pageName;
memento->GetString(WorkbenchConstants::TAG_LABEL, pageName);
// String label = 0; // debugging only
// if (UIStats.isDebugging(UIStats.RESTORE_WORKBENCH))
// {
// label = pageName == 0 ? "" : "::" + pageName; //$NON-NLS-1$ //$NON-NLS-2$
// }
try
{
//UIStats.start(UIStats.RESTORE_WORKBENCH, "WorkbenchPage" + label); //$NON-NLS-1$
// MultiStatus result =
// new MultiStatus(PlatformUI.PLUGIN_ID, IStatus.OK, NLS.bind(
// WorkbenchMessages.WorkbenchPage_unableToRestorePerspective,
// pageName), 0);
bool result = true;
// String workingSetName = memento .getString(
// IWorkbenchConstants.TAG_WORKING_SET);
// if (workingSetName != 0)
// {
// AbstractWorkingSetManager
// workingSetManager =
// (AbstractWorkingSetManager) getWorkbenchWindow() .getWorkbench().getWorkingSetManager();
// setWorkingSet(workingSetManager.getWorkingSet(workingSetName));
// }
//
// IMemento workingSetMem = memento .getChild(
// IWorkbenchConstants.TAG_WORKING_SETS);
// if (workingSetMem != 0)
// {
// std::vector<IMemento::Pointer> workingSetChildren =
// workingSetMem .getChildren(IWorkbenchConstants.TAG_WORKING_SET);
// List workingSetList = new ArrayList(workingSetChildren.length);
// for (int i = 0; i < workingSetChildren.length; i++)
// {
// IWorkingSet
// set =
// getWorkbenchWindow().getWorkbench() .getWorkingSetManager().getWorkingSet(
// workingSetChildren[i].getID());
// if (set != 0)
// {
// workingSetList.add(set);
// }
// }
//
// workingSets = (IWorkingSet[]) workingSetList .toArray(
// new IWorkingSet[workingSetList.size()]);
// }
//
// aggregateWorkingSetId = memento.getString(ATT_AGGREGATE_WORKING_SET_ID);
//
// IWorkingSet setWithId =
// window.getWorkbench().getWorkingSetManager().getWorkingSet(
// aggregateWorkingSetId);
//
// // check to see if the set has already been made and assign it if it has
// if (setWithId.Cast<AggregateWorkingSet> () != 0)
// {
// aggregateWorkingSet = (AggregateWorkingSet) setWithId;
// }
// Restore editor manager.
IMemento::Pointer childMem = memento->GetChild(
WorkbenchConstants::TAG_EDITORS);
//result.merge(getEditorManager().restoreState(childMem));
result &= this->GetEditorManager()->RestoreState(childMem);
childMem = memento->GetChild(WorkbenchConstants::TAG_VIEWS);
if (childMem)
{
//result.merge(getViewFactory().restoreState(childMem));
result &= this->GetViewFactory()->RestoreState(childMem);
}
// Get persp block.
childMem = memento->GetChild(WorkbenchConstants::TAG_PERSPECTIVES);
std::string activePartID;
childMem->GetString(WorkbenchConstants::TAG_ACTIVE_PART, activePartID);
std::string activePartSecondaryID;
if (!activePartID.empty())
{
activePartSecondaryID = ViewFactory::ExtractSecondaryId(activePartID);
if (!activePartSecondaryID.empty())
{
activePartID = ViewFactory::ExtractPrimaryId(activePartID);
}
}
std::string activePerspectiveID;
childMem->GetString(WorkbenchConstants::TAG_ACTIVE_PERSPECTIVE,
activePerspectiveID);
// Restore perspectives.
std::vector<IMemento::Pointer> perspMems(childMem->GetChildren(
WorkbenchConstants::TAG_PERSPECTIVE));
Perspective::Pointer activePerspective;
for (std::size_t i = 0; i < perspMems.size(); i++)
{
IMemento::Pointer current = perspMems[i];
// StartupThreading
// .runWithoutExceptions(new StartupRunnable()
// {
//
// public void WorkbenchPage::runWithException() throws Throwable
// {
Perspective::Pointer persp(new Perspective(
PerspectiveDescriptor::Pointer(0), WorkbenchPage::Pointer(this)));
//result.merge(persp.restoreState(current));
result &= persp->RestoreState(current);
IPerspectiveDescriptor::Pointer desc = persp->GetDesc();
if (desc == activeDescriptor)
{
activePerspective = persp;
}
else if ((activePerspective == 0) && desc->GetId()
== activePerspectiveID)
{
activePerspective = persp;
}
perspList.Add(persp);
window->FirePerspectiveOpened(WorkbenchPage::Pointer(this), desc);
// }
// });
}
bool restoreActivePerspective = false;
if (!activeDescriptor)
{
restoreActivePerspective = true;
}
else if (activePerspective && activePerspective->GetDesc()
== activeDescriptor)
{
restoreActivePerspective = true;
}
else
{
restoreActivePerspective = false;
activePerspective = this->CreatePerspective(activeDescriptor.Cast<
PerspectiveDescriptor> (), true);
if (activePerspective == 0)
{
// result .merge(
// new Status(IStatus.ERR, PlatformUI.PLUGIN_ID, 0, NLS.bind(
// WorkbenchMessages.Workbench_showPerspectiveError,
// activeDescriptor.getId()), 0));
result &= false;
}
}
perspList.SetActive(activePerspective);
// Make sure we have a valid perspective to work with,
// otherwise return.
activePerspective = perspList.GetActive();
if (activePerspective == 0)
{
activePerspective = perspList.GetNextActive();
perspList.SetActive(activePerspective);
}
if (activePerspective && restoreActivePerspective)
{
//result.merge(activePerspective.restoreState());
result &= activePerspective->RestoreState();
}
if (activePerspective)
{
Perspective::Pointer myPerspective = activePerspective;
std::string myActivePartId = activePartID;
std::string mySecondaryId = activePartSecondaryID;
// StartupThreading.runWithoutExceptions(new StartupRunnable()
// {
//
// public void WorkbenchPage::runWithException() throws Throwable
// {
window->FirePerspectiveActivated(WorkbenchPage::Pointer(this),
myPerspective->GetDesc());
// Restore active part.
if (!myActivePartId.empty())
{
IWorkbenchPartReference::Pointer ref = myPerspective->FindView(
myActivePartId, mySecondaryId);
if (ref)
{
activationList->SetActive(ref);
}
}
// }});
}
// childMem = memento->GetChild(WorkbenchConstants::TAG_NAVIGATION_HISTORY);
// if (childMem)
// {
// navigationHistory.restoreState(childMem);
// }
// else if (GetActiveEditor())
// {
// navigationHistory.markEditor(getActiveEditor());
// }
//
// restore sticky view state
stickyViewMan->Restore(memento);
// std::string blame = activeDescriptor == 0 ? pageName
// : activeDescriptor.getId();
// UIStats.end(UIStats.RESTORE_WORKBENCH, blame, "WorkbenchPage" + label); //$NON-NLS-1$
// StartupThreading.runWithoutExceptions(new StartupRunnable()
// {
// public void WorkbenchPage::runWithException() throws Throwable
// {
DeferUpdates(false);
// }
// });
return result;
} catch (...)
{
// std::string blame = activeDescriptor == 0 ? pageName
// : activeDescriptor.getId();
// UIStats.end(UIStats.RESTORE_WORKBENCH, blame, "WorkbenchPage" + label); //$NON-NLS-1$
throw ;
}
}
catch (...)
{
// StartupThreading.runWithoutExceptions(new StartupRunnable()
// {
// public void WorkbenchPage::runWithException() throws Throwable
// {
DeferUpdates(false);
// }
// });
throw;
}
}
bool WorkbenchPage::SaveAllEditors(bool confirm)
{
return this->SaveAllEditors(confirm, false);
}
bool WorkbenchPage::SaveAllEditors(bool confirm, bool addNonPartSources)
{
return this->GetEditorManager()->SaveAll(confirm, false, addNonPartSources);
}
bool WorkbenchPage::SavePart(ISaveablePart::Pointer saveable,
IWorkbenchPart::Pointer part, bool confirm)
{
// Do not certify part do allow editors inside a multipageeditor to
// call this.
return this->GetEditorManager()->SavePart(saveable, part, confirm);
}
bool WorkbenchPage::SaveEditor(IEditorPart::Pointer editor, bool confirm)
{
return this->SavePart(editor, editor, confirm);
}
/**
* Saves the current perspective.
*/
void WorkbenchPage::SavePerspective()
{
Perspective::Pointer persp = this->GetActivePerspective();
if (persp == 0)
{
return;
}
// // Always unzoom.
// if (isZoomed())
// {
// zoomOut();
// }
persp->SaveDesc();
}
/**
* Saves the perspective.
*/
void WorkbenchPage::SavePerspectiveAs(IPerspectiveDescriptor::Pointer newDesc)
{
Perspective::Pointer persp = this->GetActivePerspective();
if (persp == 0)
{
return;
}
IPerspectiveDescriptor::Pointer oldDesc = persp->GetDesc();
// // Always unzoom.
// if (isZoomed())
// {
// zoomOut();
// }
persp->SaveDescAs(newDesc);
window->FirePerspectiveSavedAs(IWorkbenchPage::Pointer(this), oldDesc, newDesc);
}
/**
* Save the state of the page.
*/
bool WorkbenchPage::SaveState(IMemento::Pointer memento)
{
// // We must unzoom to get correct layout.
// if (isZoomed())
// {
// zoomOut();
// }
// MultiStatus
// result =
// new MultiStatus(PlatformUI.PLUGIN_ID, IStatus.OK, NLS.bind(
// WorkbenchMessages.WorkbenchPage_unableToSavePerspective,
// getLabel()), 0);
bool result = true;
// Save editor manager.
IMemento::Pointer childMem = memento->CreateChild(WorkbenchConstants::TAG_EDITORS);
//result.merge(editorMgr.saveState(childMem));
result &= editorMgr->SaveState(childMem);
childMem = memento->CreateChild(WorkbenchConstants::TAG_VIEWS);
//result.merge(getViewFactory().saveState(childMem));
result &= this->GetViewFactory()->SaveState(childMem);
// Create persp block.
childMem = memento->CreateChild(WorkbenchConstants::TAG_PERSPECTIVES);
if (this->GetPerspective())
{
childMem->PutString(WorkbenchConstants::TAG_ACTIVE_PERSPECTIVE,
this->GetPerspective()->GetId());
}
if (this->GetActivePart() != 0)
{
if (this->GetActivePart().Cast<IViewPart> ())
{
IViewReference::Pointer ref = this->GetReference(this->GetActivePart()).Cast<IViewReference>();
if (ref)
{
childMem->PutString(WorkbenchConstants::TAG_ACTIVE_PART,
ViewFactory::GetKey(ref));
}
}
else
{
childMem->PutString(WorkbenchConstants::TAG_ACTIVE_PART,
this->GetActivePart()->GetSite()->GetId());
}
}
// Save each perspective in opened order
for (PerspectiveList::PerspectiveListType::iterator itr = perspList.Begin();
itr != perspList.End(); ++itr)
{
IMemento::Pointer gChildMem = childMem->CreateChild(
WorkbenchConstants::TAG_PERSPECTIVE);
//result.merge(persp.saveState(gChildMem));
result &= (*itr)->SaveState(gChildMem);
}
// // Save working set if set
// if (workingSet != 0)
// {
// memento.putString(IWorkbenchConstants.TAG_WORKING_SET,
// workingSet .getName());
// }
//
// IMemento workingSetMem = memento .createChild(
// IWorkbenchConstants.TAG_WORKING_SETS);
// for (int i = 0; i < workingSets.length; i++)
// {
// workingSetMem.createChild(IWorkbenchConstants.TAG_WORKING_SET,
// workingSets[i].getName());
// }
//
// if (aggregateWorkingSetId != 0)
// {
// memento.putString(ATT_AGGREGATE_WORKING_SET_ID, aggregateWorkingSetId);
// }
//
// navigationHistory.saveState(memento .createChild(
// IWorkbenchConstants.TAG_NAVIGATION_HISTORY));
//
// save the sticky activation state
stickyViewMan->Save(memento);
return result;
}
std::string WorkbenchPage::GetId(IWorkbenchPart::Pointer part)
{
return this->GetId(this->GetReference(part));
}
std::string WorkbenchPage::GetId(IWorkbenchPartReference::Pointer ref)
{
if (ref == 0)
{
return "0"; //$NON-NLS-1$
}
return ref->GetId();
}
void WorkbenchPage::SetActivePart(IWorkbenchPart::Pointer newPart)
{
// Optimize it.
if (this->GetActivePart() == newPart)
{
return;
}
if (partBeingActivated != 0)
{
if (partBeingActivated->GetPart(false) != newPart)
{
WorkbenchPlugin::Log(Poco::RuntimeException(
"WARNING: Prevented recursive attempt to activate part "
+ this->GetId(newPart)
+ " while still in the middle of activating part " + this->GetId(
partBeingActivated)));
}
return;
}
//No need to change the history if the active editor is becoming the
// active part
// String label = 0; // debugging only
// if (UIStats.isDebugging(UIStats.ACTIVATE_PART))
// {
// label = newPart != 0 ? newPart.getTitle() : "none"; //$NON-NLS-1$
// }
try
{
IWorkbenchPartReference::Pointer partref = this->GetReference(newPart);
IWorkbenchPartReference::Pointer realPartRef;
if (newPart != 0)
{
IWorkbenchPartSite::Pointer site = newPart->GetSite();
if (site.Cast<PartSite> () != 0)
{
realPartRef = site.Cast<PartSite> ()->GetPane()->GetPartReference();
}
}
partBeingActivated = realPartRef;
//UIStats.start(UIStats.ACTIVATE_PART, label);
// Notify perspective. It may deactivate fast view.
Perspective::Pointer persp = this->GetActivePerspective();
if (persp != 0)
{
persp->PartActivated(newPart);
}
// Deactivate old part
IWorkbenchPart::Pointer oldPart = this->GetActivePart();
if (oldPart != 0)
{
this->DeactivatePart(oldPart);
}
// Set active part.
if (newPart != 0)
{
activationList->SetActive(newPart);
if (newPart.Cast<IEditorPart> () != 0)
{
this->MakeActiveEditor(realPartRef.Cast<IEditorReference> ());
}
}
this->ActivatePart(newPart);
actionSwitcher.UpdateActivePart(newPart);
partList->SetActivePart(partref);
}
catch (std::exception& e)
{
partBeingActivated = 0;
// Object blame = newPart == 0 ? (Object) this : newPart;
// UIStats.end(UIStats.ACTIVATE_PART, blame, label);
throw e;
}
partBeingActivated = 0;
}
void WorkbenchPage::SetEditorAreaVisible(bool showEditorArea)
{
Perspective::Pointer persp = this->GetActivePerspective();
if (persp == 0)
{
return;
}
if (showEditorArea == persp->IsEditorAreaVisible())
{
return;
}
// // If parts change always update zoom.
// if (isZoomed())
// {
// zoomOut();
// }
// Update editor area visibility.
IWorkbenchPage::Pointer thisPage(this);
if (showEditorArea)
{
persp->ShowEditorArea();
window->FirePerspectiveChanged(thisPage, this->GetPerspective(),
CHANGE_EDITOR_AREA_SHOW);
}
else
{
persp->HideEditorArea();
this->UpdateActivePart();
window->FirePerspectiveChanged(thisPage, this->GetPerspective(),
CHANGE_EDITOR_AREA_HIDE);
}
}
/**
* Sets the layout of the page. Assumes the new perspective is not 0.
* Keeps the active part if possible. Updates the window menubar and
* toolbar if necessary.
*/
void WorkbenchPage::SetPerspective(Perspective::Pointer newPersp)
{
// Don't do anything if already active layout
Perspective::Pointer oldPersp = this->GetActivePerspective();
if (oldPersp == newPersp)
{
return;
}
window->LargeUpdateStart();
std::exception exc;
bool exceptionOccured = false;
try
{
IWorkbenchPage::Pointer thisPage(this);
if (oldPersp != 0)
{
// fire the pre-deactivate
window->FirePerspectivePreDeactivate(thisPage, oldPersp->GetDesc());
}
if (newPersp != 0)
{
bool status = newPersp->RestoreState();
if (!status)
{
std::string title = "Restoring problems";
std::string msg = "Unable to read workbench state.";
MessageDialog::OpenError(this->GetWorkbenchWindow()->GetShell(), title,
msg);
}
}
// Deactivate the old layout
if (oldPersp != 0)
{
oldPersp->OnDeactivate();
// Notify listeners of deactivation
window->FirePerspectiveDeactivated(thisPage, oldPersp->GetDesc());
}
// Activate the new layout
perspList.SetActive(newPersp);
if (newPersp != 0)
{
newPersp->OnActivate();
// Notify listeners of activation
window->FirePerspectiveActivated(thisPage, newPersp->GetDesc());
}
this->UpdateVisibility(oldPersp, newPersp);
// Update the window
//TODO action sets
//window->UpdateActionSets();
// Update sticky views
stickyViewMan->Update(oldPersp, newPersp);
}
catch (std::exception& e)
{
exc = e;
exceptionOccured = true;
}
window->LargeUpdateEnd();
if (newPersp == 0)
{
return;
}
IPerspectiveDescriptor::Pointer desc = newPersp->GetDesc();
if (desc == 0)
{
return;
}
if (dirtyPerspectives.erase(desc->GetId()))
{
this->SuggestReset();
}
if (exceptionOccured)
throw exc;
}
void WorkbenchPage::UpdateVisibility(Perspective::Pointer oldPersp,
Perspective::Pointer newPersp)
{
// Flag all parts in the old perspective
std::vector<IViewReference::Pointer> oldRefs;
if (oldPersp != 0)
{
oldRefs = oldPersp->GetViewReferences();
for (unsigned int i = 0; i < oldRefs.size(); i++)
{
PartPane::Pointer pane =
oldRefs[i].Cast<WorkbenchPartReference> ()->GetPane();
pane->SetInLayout(false);
}
}
PerspectiveHelper* pres = 0;
// Make parts in the new perspective visible
if (newPersp != 0)
{
pres = newPersp->GetPresentation();
std::vector<IViewReference::Pointer> newRefs =
newPersp->GetViewReferences();
for (unsigned int i = 0; i < newRefs.size(); i++)
{
WorkbenchPartReference::Pointer ref = newRefs[i].Cast<
WorkbenchPartReference> ();
PartPane::Pointer pane = ref->GetPane();
if (pres->IsPartVisible(ref))
{
activationList->BringToTop(ref);
}
pane->SetInLayout(true);
}
}
this->UpdateActivePart();
// Hide any parts in the old perspective that are no longer visible
for (unsigned int i = 0; i < oldRefs.size(); i++)
{
WorkbenchPartReference::Pointer ref = oldRefs[i].Cast<
WorkbenchPartReference> ();
PartPane::Pointer pane = ref->GetPane();
if (pres == 0 || !pres->IsPartVisible(ref))
{
pane->SetVisible(false);
}
}
}
/**
* Sets the perspective.
*
* @param desc
* identifies the new perspective.
*/
void WorkbenchPage::SetPerspective(IPerspectiveDescriptor::Pointer desc)
{
if (this->GetPerspective() == desc)
{
return;
}
// // Going from multiple to single rows can make the coolbar
// // and its adjacent views appear jumpy as perspectives are
// // switched. Turn off redraw to help with this.
// ICoolBarManager2 mgr = (ICoolBarManager2) window.getCoolBarManager2();
std::exception exc;
bool exceptionOccured = false;
try
{
//mgr.getControl2().setRedraw(false);
//getClientComposite().setRedraw(false);
// Run op in busy cursor.
// BusyIndicator.showWhile(0, new Runnable()
// {
// public void WorkbenchPage::run()
// {
this->BusySetPerspective(desc);
// }
// });
}
catch (std::exception& e)
{
exc = e;
exceptionOccured = true;
}
// getClientComposite().setRedraw(true);
// mgr.getControl2().setRedraw(true);
IWorkbenchPart::Pointer part = this->GetActivePart();
if (part != 0)
{
part->SetFocus();
}
if (exceptionOccured)
throw exc;
}
PartService* WorkbenchPage::GetPartService()
{
return dynamic_cast<PartService*> (partList->GetPartService());
}
void WorkbenchPage::ResetToolBarLayout()
{
// ICoolBarManager2 mgr = (ICoolBarManager2) window.getCoolBarManager2();
// mgr.resetItemOrder();
}
IViewPart::Pointer WorkbenchPage::ShowView(const std::string& viewID)
{
return this->ShowView(viewID, "", VIEW_ACTIVATE);
}
IViewPart::Pointer WorkbenchPage::ShowView(const std::string& viewID,
const std::string& secondaryID, int mode)
{
if (secondaryID != "")
{
if (secondaryID.size() == 0 || secondaryID.find_first_of(
ViewFactory::ID_SEP) != std::string::npos)
{
throw Poco::InvalidArgumentException(
"Illegal secondary id (cannot be empty or contain a colon)");
}
}
if (!this->CertifyMode(mode))
{
throw Poco::InvalidArgumentException("Illegal view mode");
}
// Run op in busy cursor.
// BusyIndicator.showWhile(0, new Runnable()
// {
// public void WorkbenchPage::run()
// {
// try
// {
return this->BusyShowView(viewID, secondaryID, mode);
// } catch (PartInitException& e)
// {
// result = e;
// }
// }
// });
}
bool WorkbenchPage::CertifyMode(int mode)
{
if (mode == VIEW_ACTIVATE || mode == VIEW_VISIBLE || mode == VIEW_CREATE)
return true;
return false;
}
std::vector<IEditorReference::Pointer> WorkbenchPage::GetSortedEditors()
{
return activationList->GetEditors();
}
std::vector<IPerspectiveDescriptor::Pointer> WorkbenchPage::GetOpenPerspectives()
{
std::list<Perspective::Pointer> opened = perspList.GetOpenedPerspectives();
std::vector<IPerspectiveDescriptor::Pointer> result;
for (std::list<Perspective::Pointer>::iterator iter = opened.begin(); iter
!= opened.end(); ++iter)
{
result.push_back((*iter)->GetDesc());
}
return result;
}
std::list<Perspective::Pointer> WorkbenchPage::GetOpenInternalPerspectives()
{
return perspList.GetOpenedPerspectives();
}
Perspective::Pointer WorkbenchPage::GetFirstPerspectiveWithView(
IViewPart::Pointer part)
{
std::list<Perspective::Pointer> perspectives =
perspList.GetSortedPerspectives();
for (std::list<Perspective::Pointer>::reverse_iterator iter =
perspectives.rbegin(); iter != perspectives.rend(); ++iter)
{
if ((*iter)->ContainsView(part))
{
return *iter;
}
}
// we should never get here
return Perspective::Pointer(0);
}
std::vector<IPerspectiveDescriptor::Pointer> WorkbenchPage::GetSortedPerspectives()
{
std::list<Perspective::Pointer> sortedArray =
perspList.GetSortedPerspectives();
std::vector<IPerspectiveDescriptor::Pointer> result;
for (std::list<Perspective::Pointer>::iterator iter = sortedArray.begin();
iter != sortedArray.end(); ++iter)
{
result.push_back((*iter)->GetDesc());
}
return result;
}
std::vector<IWorkbenchPartReference::Pointer> WorkbenchPage::GetSortedParts()
{
//return partList->GetParts(this->GetViewReferences());
return activationList->GetParts();
}
IWorkbenchPartReference::Pointer WorkbenchPage::GetReference(
IWorkbenchPart::Pointer part)
{
if (part == 0)
{
return IWorkbenchPartReference::Pointer(0);
}
IWorkbenchPartSite::Pointer site = part->GetSite();
if (site.Cast<PartSite> () == 0)
{
return IWorkbenchPartReference::Pointer(0);
}
PartSite::Pointer partSite = site.Cast<PartSite> ();
PartPane::Pointer pane = partSite->GetPane();
return partSite->GetPartReference();
}
// for dynamic UI
void WorkbenchPage::AddPerspective(Perspective::Pointer persp)
{
perspList.Add(persp);
IWorkbenchPage::Pointer thisPage(this);
window->FirePerspectiveOpened(thisPage, persp->GetDesc());
}
std::vector<IViewReference::Pointer> WorkbenchPage::GetViewReferenceStack(
IViewPart::Pointer part)
{
// Sanity check.
Perspective::Pointer persp = this->GetActivePerspective();
if (persp == 0 || !this->CertifyPart(part))
{
return std::vector<IViewReference::Pointer>();
}
IStackableContainer::Pointer container =
part->GetSite().Cast<PartSite> ()->GetPane()->GetContainer();
if (container.Cast<PartStack> () != 0)
{
PartStack::Pointer folder = container.Cast<PartStack> ();
std::vector<IViewReference::Pointer> list;
IStackableContainer::ChildrenType children = folder->GetChildren();
for (IStackableContainer::ChildrenType::iterator childIter =
children.begin(); childIter != children.end(); ++childIter)
{
StackablePart::Pointer stackablePart = *childIter;
if (stackablePart.Cast<PartPane> () != 0)
{
IViewReference::Pointer view =
stackablePart.Cast<PartPane> ()->GetPartReference().Cast<
IViewReference> ();
if (view != 0)
{
list.push_back(view);
}
}
}
// sort the list by activation order (most recently activated first)
std::sort(list.begin(), list.end(), ActivationOrderPred(activationList));
return list;
}
std::vector<IViewReference::Pointer> result;
result.push_back(this->GetReference(part).Cast<IViewReference> ());
return result;
}
std::vector<IViewPart::Pointer> WorkbenchPage::GetViewStack(
IViewPart::Pointer part)
{
std::vector<IViewReference::Pointer> refStack = this->GetViewReferenceStack(
part);
std::vector<IViewPart::Pointer> result;
for (unsigned int i = 0; i < refStack.size(); i++)
{
IViewPart::Pointer next = refStack[i]->GetView(false);
if (next != 0)
{
result.push_back(next);
}
}
return result;
}
void WorkbenchPage::ResizeView(IViewPart::Pointer part, int width, int height)
{
SashInfo sashInfo;
PartPane::Pointer pane = part->GetSite().Cast<PartSite> ()->GetPane();
IStackableContainer::Pointer container = pane->GetContainer();
LayoutTree::Pointer tree =
this->GetPerspectivePresentation()->GetLayout()->GetLayoutTree()->Find(
container.Cast<PartStack> ());
// retrieve our layout sashes from the layout tree
this->FindSashParts(tree, pane->FindSashes(), sashInfo);
// first set the width
int deltaWidth = width - pane->GetBounds().width;
if (sashInfo.right != 0)
{
Rectangle rightBounds = sashInfo.rightNode->GetBounds();
// set the new ratio
sashInfo.right->SetRatio(static_cast<float>((deltaWidth + sashInfo.right->GetBounds().x)
- rightBounds.x) / rightBounds.width);
// complete the resize
sashInfo.rightNode->SetBounds(rightBounds);
}
else if (sashInfo.left != 0)
{
Rectangle leftBounds = sashInfo.leftNode->GetBounds();
// set the ratio
sashInfo.left->SetRatio(static_cast<float>((sashInfo.left->GetBounds().x - deltaWidth)
- leftBounds.x) / leftBounds.width);
// complete the resize
sashInfo.leftNode->SetBounds(sashInfo.leftNode->GetBounds());
}
// next set the height
int deltaHeight = height - pane->GetBounds().height;
if (sashInfo.bottom != 0)
{
Rectangle bottomBounds = sashInfo.bottomNode->GetBounds();
// set the new ratio
sashInfo.bottom->SetRatio(static_cast<float>((deltaHeight + sashInfo.bottom->GetBounds().y)
- bottomBounds.y) / bottomBounds.height);
// complete the resize
sashInfo.bottomNode->SetBounds(bottomBounds);
}
else if (sashInfo.top != 0)
{
Rectangle topBounds = sashInfo.topNode->GetBounds();
// set the ratio
sashInfo.top->SetRatio(static_cast<float>((sashInfo.top->GetBounds().y - deltaHeight)
- topBounds.y) / topBounds.height);
// complete the resize
sashInfo.topNode->SetBounds(topBounds);
}
}
void WorkbenchPage::FindSashParts(LayoutTree::Pointer tree,
const PartPane::Sashes& sashes, SashInfo& info)
{
LayoutTree::Pointer parent(tree->GetParent());
if (parent == 0)
{
return;
}
if (parent->part.Cast<LayoutPartSash> () != 0)
{
// get the layout part sash from this tree node
LayoutPartSash::Pointer sash = parent->part.Cast<LayoutPartSash> ();
// make sure it has a sash control
void* control = sash->GetControl();
if (control != 0)
{
// check for a vertical sash
if (sash->IsVertical())
{
if (sashes.left == control)
{
info.left = sash;
info.leftNode = parent->FindSash(sash);
}
else if (sashes.right == control)
{
info.right = sash;
info.rightNode = parent->FindSash(sash);
}
}
// check for a horizontal sash
else
{
if (sashes.top == control)
{
info.top = sash;
info.topNode = parent->FindSash(sash);
}
else if (sashes.bottom == control)
{
info.bottom = sash;
info.bottomNode = parent->FindSash(sash);
}
}
}
}
// recursive call to continue up the tree
this->FindSashParts(parent, sashes, info);
}
std::vector<IWorkbenchPartReference::Pointer> WorkbenchPage::GetAllParts()
{
std::vector<IViewReference::Pointer> views = viewFactory->GetViews();
std::list<IEditorReference::Pointer> editors = this->GetEditorReferences();
std::vector<IWorkbenchPartReference::Pointer> result;
for (unsigned int i = 0; i < views.size(); i++)
{
result.push_back(views[i]);
}
for (std::list<IEditorReference::Pointer>::iterator iter = editors.begin(); iter
!= editors.end(); ++iter)
{
result.push_back(*iter);
}
return result;
}
std::vector<IWorkbenchPartReference::Pointer> WorkbenchPage::GetOpenParts()
{
std::vector<IWorkbenchPartReference::Pointer> refs = this->GetAllParts();
std::vector<IWorkbenchPartReference::Pointer> result;
for (unsigned int i = 0; i < refs.size(); i++)
{
IWorkbenchPartReference::Pointer reference = refs[i];
IWorkbenchPart::Pointer part = reference->GetPart(false);
if (part != 0)
{
result.push_back(reference);
}
}
return result;
}
void WorkbenchPage::TestInvariants()
{
Perspective::Pointer persp = this->GetActivePerspective();
if (persp != 0)
{
persp->TestInvariants();
// When we have widgets, ensure that there is no situation where the editor area is visible
// and the perspective doesn't want an editor area.
if (this->GetClientComposite()
&& editorPresentation->GetLayoutPart()->IsVisible())
{
poco_assert(persp->IsEditorAreaVisible());
}
}
}
/* (non-Javadoc)
* @see org.blueberry.ui.IWorkbenchPage#getExtensionTracker()
*/
// IExtensionTracker WorkbenchPage::GetExtensionTracker()
// {
// if (tracker == 0)
// {
// tracker = new UIExtensionTracker(getWorkbenchWindow().getWorkbench().getDisplay());
// }
// return tracker;
// }
/*
* (non-Javadoc)
*
* @see org.blueberry.ui.IWorkbenchPage#getPerspectiveShortcuts()
*/
std::vector<std::string> WorkbenchPage::GetPerspectiveShortcuts()
{
Perspective::Pointer persp = this->GetActivePerspective();
if (persp == 0)
{
return std::vector<std::string>();
}
return persp->GetPerspectiveShortcuts();
}
std::vector<std::string> WorkbenchPage::GetShowViewShortcuts()
{
Perspective::Pointer persp = this->GetActivePerspective();
if (persp == 0)
{
return std::vector<std::string>();
}
return persp->GetShowViewShortcuts();
}
void WorkbenchPage::SuggestReset()
{
IWorkbench* workbench = this->GetWorkbenchWindow()->GetWorkbench();
// workbench.getDisplay().asyncExec(new Runnable()
// {
// public void WorkbenchPage::run()
// {
Shell::Pointer parentShell;
IWorkbenchWindow::Pointer window = workbench->GetActiveWorkbenchWindow();
if (window == 0)
{
if (workbench->GetWorkbenchWindowCount() == 0)
{
return;
}
window = workbench->GetWorkbenchWindows()[0];
}
parentShell = window->GetShell();
if (MessageDialog::OpenQuestion(parentShell,
"Reset Perspective?",
"Changes to installed plug-ins have affected this perspective. Would you like to reset this perspective to accept these changes?"))
{
IWorkbenchPage::Pointer page = window->GetActivePage();
if (page == 0)
{
return;
}
page->ResetPerspective();
}
// }
// });
}
bool WorkbenchPage::IsPartVisible(
IWorkbenchPartReference::Pointer reference)
{
IWorkbenchPart::Pointer part = reference->GetPart(false);
// Can't be visible if it isn't created yet
if (part == 0)
{
return false;
}
return this->IsPartVisible(part);
}
}
diff --git a/BlueBerry/Bundles/org.blueberry.ui/src/internal/berryWorkbenchPlugin.cpp b/BlueBerry/Bundles/org.blueberry.ui/src/internal/berryWorkbenchPlugin.cpp
index 6463bc7f33..5152a9ee1e 100644
--- a/BlueBerry/Bundles/org.blueberry.ui/src/internal/berryWorkbenchPlugin.cpp
+++ b/BlueBerry/Bundles/org.blueberry.ui/src/internal/berryWorkbenchPlugin.cpp
@@ -1,329 +1,330 @@
/*=========================================================================
Program: BlueBerry Platform
Language: C++
Date: $Date$
Version: $Revision$
Copyright (c) German Cancer Research Center, Division of Medical and
Biological Informatics. All rights reserved.
See MITKCopyright.txt or http://www.mitk.org/copyright.html for details.
This software is distributed WITHOUT ANY WARRANTY; without even
the implied warranty of MERCHANTABILITY or FITNESS FOR A PARTICULAR
PURPOSE. See the above copyright notices for more information.
=========================================================================*/
#include "berryLog.h"
#include "berryWorkbenchPlugin.h"
#include "berryWorkbenchRegistryConstants.h"
#include "berryWorkbench.h"
#include "berryPlatform.h"
#include "intro/berryEditorIntroAdapterPart.h"
#include "../berryImageDescriptor.h"
#include <Poco/String.h>
+#include <QDebug>
namespace berry
{
bool WorkbenchPlugin::DEBUG = false;
char WorkbenchPlugin::PREFERENCE_PAGE_CATEGORY_SEPARATOR = '/';
WorkbenchPlugin* WorkbenchPlugin::inst = 0;
WorkbenchPlugin::WorkbenchPlugin()
: AbstractUICTKPlugin()
{
inst = this;
presentationFactory = 0;
editorRegistry = 0;
viewRegistry = 0;
perspRegistry = 0;
introRegistry = 0;
}
WorkbenchPlugin::~WorkbenchPlugin()
{
delete editorRegistry;
delete viewRegistry;
delete perspRegistry;
delete introRegistry;
}
bool WorkbenchPlugin::HasExecutableExtension(
IConfigurationElement::Pointer element, const std::string& extensionName)
{
std::string attr;
if (element->GetAttribute(extensionName, attr))
return true;
std::string elementText(element->GetValue());
if (elementText != "")
return true;
IConfigurationElement::vector children(element->GetChildren(extensionName));
if (children.size() == 1)
{
if (children[0]->GetAttribute(WorkbenchRegistryConstants::ATT_CLASS, attr))
return true;
}
return false;
}
bool WorkbenchPlugin::IsBundleLoadedForExecutableExtension(
IConfigurationElement::Pointer element, const std::string& extensionName)
{
IBundle::Pointer bundle(WorkbenchPlugin::GetBundleForExecutableExtension(element, extensionName));
if (bundle.IsNull())
return true;
return bundle->GetState() == IBundle::BUNDLE_ACTIVE;
}
IBundle::Pointer WorkbenchPlugin::GetBundleForExecutableExtension(
IConfigurationElement::Pointer element, const std::string& extensionName)
{
// this code is derived heavily from
// ConfigurationElement.createExecutableExtension.
std::string prop;
std::string executable;
std::string contributorName;
std::string::size_type i;
if (extensionName != "")
element->GetAttribute(extensionName, prop);
else
{
// property not specified, try as element value
prop = element->GetValue();
if (prop != "")
{
Poco::trimInPlace(prop);
}
}
if (prop == "")
{
// property not defined, try as a child element
IConfigurationElement::vector exec(element->GetChildren(extensionName));
if (exec.size() != 0)
exec[0]->GetAttribute("plugin", contributorName); //$NON-NLS-1$
}
else
{
// simple property or element value, parse it into its components
i = prop.find_first_of(':');
if (i != std::string::npos)
executable = Poco::trim(prop.substr(0, i));
else
executable = prop;
i = executable.find_first_of('/');
if (i != std::string::npos)
contributorName = Poco::trim(executable.substr(0, i));
}
if (contributorName == "")
contributorName = element->GetContributor();
return Platform::GetBundle(contributorName);
}
WorkbenchPlugin* WorkbenchPlugin::GetDefault()
{
return inst;
}
std::size_t WorkbenchPlugin::GetBundleCount()
{
// TODO BundleContext GetBundles
//return bundleContext->GetBundles().size();
return 0;
}
// ImageRegistry createImageRegistry() {
// return WorkbenchImages.getImageRegistry();
// }
IPerspectiveRegistry* WorkbenchPlugin::GetPerspectiveRegistry() {
if (perspRegistry == 0) {
perspRegistry = new PerspectiveRegistry();
// the load methods can touch on WorkbenchImages if an image is
// missing so we need to wrap the call in
// a startup block for the case where a custom descriptor exists on
// startup that does not have an image
// associated with it. See bug 196352.
//StartupThreading.runWithoutExceptions(new StartupRunnable() {
// public void runWithException() throws Throwable {
perspRegistry->Load();
// }
//});
}
return perspRegistry;
}
// PreferenceManager getPreferenceManager() {
// if (preferenceManager == null) {
// preferenceManager = new WorkbenchPreferenceManager(
// PREFERENCE_PAGE_CATEGORY_SEPARATOR);
//
// //Get the pages from the registry
// PreferencePageRegistryReader registryReader = new PreferencePageRegistryReader(
// getWorkbench());
// registryReader
// .loadFromRegistry(Platform.getExtensionRegistry());
// preferenceManager.addPages(registryReader.getTopLevelNodes());
//
// }
// return preferenceManager;
// }
// ISharedImages getSharedImages() {
// if (sharedImages == null) {
// sharedImages = new SharedImages();
// }
// return sharedImages;
// }
IIntroRegistry* WorkbenchPlugin::GetIntroRegistry()
{
if (introRegistry == 0)
{
introRegistry = new IntroRegistry();
}
return introRegistry;
}
IViewRegistry* WorkbenchPlugin::GetViewRegistry()
{
if (!viewRegistry)
viewRegistry = new ViewRegistry();
return viewRegistry;
}
IEditorRegistry* WorkbenchPlugin::GetEditorRegistry()
{
if (!editorRegistry)
editorRegistry = new EditorRegistry();
return editorRegistry;
}
IPresentationFactory* WorkbenchPlugin::GetPresentationFactory() {
if (presentationFactory != 0) return presentationFactory;
std::string targetID = Workbench::GetInstance()->GetPresentationId();
presentationFactory = this->CreateExtension<IPresentationFactory>(
WorkbenchRegistryConstants::PL_PRESENTATION_FACTORIES,
"factory", targetID);
if (presentationFactory == 0)
WorkbenchPlugin::Log("Error creating presentation factory: " +
targetID + " -- class is not an IPresentationFactory");
return presentationFactory;
}
void WorkbenchPlugin::Log(const std::string& message)
{
BERRY_INFO << "LOG: " << message << std::endl;
//inst->GetLog().log(message);
}
void WorkbenchPlugin::Log(const Poco::RuntimeException& exc)
{
BERRY_INFO << "LOG: " << exc.message() << std::endl;
//inst->GetLog().log(exc);
}
void WorkbenchPlugin::Log(const std::string& message, const Poco::RuntimeException& t)
{
PlatformException exc(message, t);
WorkbenchPlugin::Log(exc);
}
void WorkbenchPlugin::Log(const std::string& clazz,
const std::string& methodName, const Poco::RuntimeException& t)
{
std::string msg = "Exception in " + clazz + "." + methodName + ": "
+ t.what();
WorkbenchPlugin::Log(msg, t);
}
void WorkbenchPlugin::start(ctkPluginContext* context)
{
//context.addBundleListener(getBundleListener());
AbstractUICTKPlugin::start(context);
bundleContext = context;
BERRY_REGISTER_EXTENSION_CLASS(EditorIntroAdapterPart, context)
// The UI plugin needs to be initialized so that it can install the callback in PrefUtil,
// which needs to be done as early as possible, before the workbench
// accesses any API preferences.
// Bundle uiBundle = Platform.getBundle(PlatformUI.PLUGIN_ID);
// try
// {
// // Attempt to load the activator of the ui bundle. This will force lazy start
// // of the ui bundle. Using the bundle activator class here because it is a
// // class that needs to be loaded anyway so it should not cause extra classes
// // to be loaded.
// if(uiBundle != null)
// uiBundle.loadClass(UI_BUNDLE_ACTIVATOR);
// }
// catch (ClassNotFoundException e)
// {
// WorkbenchPlugin.log("Unable to load UI activator", e); //$NON-NLS-1$
// }
/*
* DO NOT RUN ANY OTHER CODE AFTER THIS LINE. If you do, then you are
* likely to cause a deadlock in class loader code. Please see Bug 86450
* for more information.
*/
}
//const std::vector<IBundle::Pointer> WorkbenchPlugin::GetBundles()
//{
// return bundleContext.IsNull() ? std::vector<IBundle::Pointer>() : bundleContext->GetBundles();
//}
ctkPluginContext* WorkbenchPlugin::GetPluginContext()
{
return bundleContext;
}
void WorkbenchPlugin::stop(ctkPluginContext* context)
{
AbstractUICTKPlugin::stop(context);
delete perspRegistry;
}
bool WorkbenchPlugin::GetDataPath(Poco::Path& path)
{
QFileInfo fileInfo = bundleContext->getDataFile("");
- path.assign(fileInfo.absolutePath().toStdString());
+ path.assign(fileInfo.absolutePath().toStdString() + '/');
return fileInfo.isWritable();
}
}
Q_EXPORT_PLUGIN2(org_blueberry_ui, berry::WorkbenchPlugin)
diff --git a/BlueBerry/Bundles/org.blueberry.ui/src/intro/berryIntroPart.h b/BlueBerry/Bundles/org.blueberry.ui/src/intro/berryIntroPart.h
index 71bdee6829..998ef9bed9 100644
--- a/BlueBerry/Bundles/org.blueberry.ui/src/intro/berryIntroPart.h
+++ b/BlueBerry/Bundles/org.blueberry.ui/src/intro/berryIntroPart.h
@@ -1,223 +1,226 @@
/*=========================================================================
Program: BlueBerry Platform
Language: C++
Date: $Date$
Version: $Revision$
Copyright (c) German Cancer Research Center, Division of Medical and
Biological Informatics. All rights reserved.
See MITKCopyright.txt or http://www.mitk.org/copyright.html for details.
This software is distributed WITHOUT ANY WARRANTY; without even
the implied warranty of MERCHANTABILITY or FITNESS FOR A PARTICULAR
PURPOSE. See the above copyright notices for more information.
=========================================================================*/
#ifndef BERRYINTROPART_H_
#define BERRYINTROPART_H_
#include "berryIIntroPart.h"
#include "berryIIntroSite.h"
#include <berryIConfigurationElement.h>
#include <berryImageDescriptor.h>
#include <berryIExecutableExtension.h>
#include <berryIPropertyChangeListener.h>
namespace berry
{
/**
* Abstract base implementation of an intro part.
* <p>
* Subclasses must implement the following methods:
* <ul>
* <li><code>CreatePartControl</code>- to create the intro part's controls
* </li>
* <li><code>SetFocus</code>- to accept focus</li>
* <li><code>StandbyStateChanged</code>- to change the standby mode</li>
* </ul>
* </p>
* <p>
* Subclasses may extend or reimplement the following methods as required:
* <ul>
* <li><code>SetInitializationData</code>- extend to provide additional
* initialization when the intro extension is instantiated</li>
* <li><code>Init(IIntroSite::Pointer, IMemento::Pointer)</code>- extend to provide additional
* initialization when intro is assigned its site</li>
* <li><code>GetAdapter</code>- reimplement to make their intro adaptable
* </li>
* </ul>
* </p>
*/
-class BERRY_UI IntroPart: public IIntroPart, public IExecutableExtension
+class BERRY_UI IntroPart: public QObject, public IIntroPart, public IExecutableExtension
{
+ Q_OBJECT
+ Q_INTERFACES(berry::IIntroPart berry::IExecutableExtension)
+
private:
IConfigurationElement::Pointer configElement;
ImageDescriptor::Pointer imageDescriptor;
IIntroSite::Pointer partSite;
void* titleImage;
std::string titleLabel;
IPropertyChangeListener::Events propChangeEvents;
/**
* Return the default title string.
*
* @return the default title string
*/
std::string GetDefaultTitle() const;
protected:
/**
* Fires a property changed event.
*
* @param propertyId
* the id of the property that changed
*/
void FirePropertyChange(int propertyId);
/**
* Returns the configuration element for this part. The configuration
* element comes from the plug-in registry entry for the extension defining
* this part.
*
* @return the configuration element for this part
*/
IConfigurationElement::Pointer GetConfigurationElement();
/**
* Returns the default title image.
*
* @return the default image
*/
void* GetDefaultImage() const;
/**
* Sets the part site.
* <p>
* Subclasses must invoke this method from {@link org.eclipse.ui.intro.IIntroPart#init(IIntroSite, IMemento)}.
* </p>
*
* @param site the intro part site
*/
void SetSite(IIntroSite::Pointer site);
/**
* Sets or clears the title image of this part.
*
* @param titleImage
* the title image, or <code>null</code> to clear
*/
void SetTitleImage(void* titleImage);
/**
* Set the title string for this part.
*
* @param titleLabel the title string. Must not be <code>null</code>.
* @since 3.2
*/
void SetTitle(const std::string& titleLabel);
public:
/* (non-Javadoc)
* @see org.eclipse.ui.intro.IIntroPart#addPropertyListener(org.eclipse.ui.IPropertyListener)
*/
void AddPropertyListener(IPropertyChangeListener::Pointer l);
/**
* The <code>IntroPart</code> implementation of this
* <code>IIntroPart</code> method disposes the title image loaded by
* <code>setInitializationData</code>. Subclasses may extend.
*/
~IntroPart();
/**
* This implementation of the method declared by <code>IAdaptable</code>
* passes the request along to the platform's adapter manager; roughly
* <code>Platform.getAdapterManager().getAdapter(this, adapter)</code>.
* Subclasses may override this method (however, if they do so, they should
* invoke the method on their superclass to ensure that the Platform's
* adapter manager is consulted).
*/
// Object getAdapter(Class adapter) {
// return Platform.getAdapterManager().getAdapter(this, adapter);
// }
/*
* (non-Javadoc)
*
* @see org.eclipse.ui.intro.IIntroPart#getIntroSite()
*/
IIntroSite::Pointer GetIntroSite() const;
/* (non-Javadoc)
* @see org.eclipse.ui.intro.IIntroPart#getTitleImage()
*/
void* GetTitleImage() const;
/* (non-Javadoc)
* @see org.eclipse.ui.intro.IIntroPart#getTitle()
*/
std::string GetPartName() const;
/**
* The base implementation of this {@link org.eclipse.ui.intro.IIntroPart}method ignores the
* memento and initializes the part in a fresh state. Subclasses may extend
* to perform any state restoration, but must call the super method.
*
* @param site
* the intro site
* @param memento
* the intro part state or <code>null</code> if there is no
* previous saved state
* @exception PartInitException
* if this part was not initialized successfully
*/
void Init(IIntroSite::Pointer site, IMemento::Pointer memento)
throw (PartInitException);
/* (non-Javadoc)
* @see org.eclipse.ui.intro.IIntroPart#removePropertyListener(org.eclipse.ui.IPropertyListener)
*/
void RemovePropertyListener(IPropertyChangeListener::Pointer l);
/**
* The base implementation of this {@link org.eclipse.ui.intro.IIntroPart} method does nothing.
* Subclasses may override.
*
* @param memento
* a memento to receive the object state
*/
void SaveState(IMemento::Pointer memento);
/**
* The <code>IntroPart</code> implementation of this
* <code>IExecutableExtension</code> records the configuration element in
* and internal state variable (accessible via <code>getConfigElement</code>).
* It also loads the title image, if one is specified in the configuration
* element. Subclasses may extend.
*
* Should not be called by clients. It is called by the core plugin when
* creating this executable extension.
*/
void SetInitializationData(IConfigurationElement::Pointer cfig,
const std::string& propertyName, Object::Pointer data);
};
}
#endif /* BERRYINTROPART_H_ */
diff --git a/BlueBerry/Bundles/org.blueberry.ui/src/tweaklets/berryDnDTweaklet.h b/BlueBerry/Bundles/org.blueberry.ui/src/tweaklets/berryDnDTweaklet.h
index d8e119a7e3..e7c4b85502 100755
--- a/BlueBerry/Bundles/org.blueberry.ui/src/tweaklets/berryDnDTweaklet.h
+++ b/BlueBerry/Bundles/org.blueberry.ui/src/tweaklets/berryDnDTweaklet.h
@@ -1,70 +1,68 @@
/*=========================================================================
Program: BlueBerry Platform
Language: C++
Date: $Date$
Version: $Revision$
Copyright (c) German Cancer Research Center, Division of Medical and
Biological Informatics. All rights reserved.
See MITKCopyright.txt or http://www.mitk.org/copyright.html for details.
This software is distributed WITHOUT ANY WARRANTY; without even
the implied warranty of MERCHANTABILITY or FITNESS FOR A PARTICULAR
PURPOSE. See the above copyright notices for more information.
=========================================================================*/
#ifndef BERRYDNDTWEAKLET_H_
#define BERRYDNDTWEAKLET_H_
#include <berryMacros.h>
#include <org_blueberry_ui_Export.h>
#include "../internal/berryTweaklets.h"
namespace berry
{
struct ITracker;
/**
* Provides the set of cursors used for drag-and-drop.
*/
-struct BERRY_UI DnDTweaklet : public Object
+struct BERRY_UI DnDTweaklet
{
- berryInterfaceMacro(DnDTweaklet, berry);
-
static Tweaklets::TweakKey<DnDTweaklet> KEY;
enum CursorType
{ CURSOR_INVALID,
CURSOR_LEFT,
CURSOR_RIGHT,
CURSOR_TOP,
CURSOR_BOTTOM,
CURSOR_CENTER,
CURSOR_OFFSCREEN,
CURSOR_FASTVIEW};
static CursorType PositionToCursorType(int positionConstant);
/**
* Converts a DnDTweaklet::CursorType (CURSOR_LEFT, CURSOR_RIGHT, CURSOR_TOP, CURSOR_BOTTOM, CURSOR_CENTER) into a BlueBerry constant
* (Constants::LEFT, Constants::RIGHT, Constants::TOP, Constants::BOTTOM, Constants::CENTER)
*
* @param dragCursorId
* @return a BlueBerry Constants::* constant
*/
static int CursorTypeToPosition(CursorType dragCursorId);
virtual ITracker* CreateTracker() = 0;
};
}
Q_DECLARE_INTERFACE(berry::DnDTweaklet, "org.blueberry.DnDTweaklet")
#endif /* BERRYDNDTWEAKLET_H_ */
diff --git a/BlueBerry/Bundles/org.blueberry.ui/src/tweaklets/berryGuiWidgetsTweaklet.h b/BlueBerry/Bundles/org.blueberry.ui/src/tweaklets/berryGuiWidgetsTweaklet.h
index 39482b49dc..1fd16f42e6 100755
--- a/BlueBerry/Bundles/org.blueberry.ui/src/tweaklets/berryGuiWidgetsTweaklet.h
+++ b/BlueBerry/Bundles/org.blueberry.ui/src/tweaklets/berryGuiWidgetsTweaklet.h
@@ -1,215 +1,214 @@
/*=========================================================================
Program: BlueBerry Platform
Language: C++
Date: $Date$
Version: $Revision$
Copyright (c) German Cancer Research Center, Division of Medical and
Biological Informatics. All rights reserved.
See MITKCopyright.txt or http://www.mitk.org/copyright.html for details.
This software is distributed WITHOUT ANY WARRANTY; without even
the implied warranty of MERCHANTABILITY or FITNESS FOR A PARTICULAR
PURPOSE. See the above copyright notices for more information.
=========================================================================*/
#ifndef BERRYGUIWIDGETSTWEAKLET_H_
#define BERRYGUIWIDGETSTWEAKLET_H_
#include <berryMacros.h>
#include "../internal/berryTweaklets.h"
#include "../guitk/berryGuiTkISelectionListener.h"
#include "../guitk/berryGuiTkIControlListener.h"
#include "../berryRectangle.h"
#include "../berryShell.h"
//#include "../commands/berryIMenu.h"
//#include "../commands/berryIMenuItem.h"
namespace berry {
-struct BERRY_UI GuiWidgetsTweaklet : public Object
+struct BERRY_UI GuiWidgetsTweaklet
{
- berryInterfaceMacro(GuiWidgetsTweaklet, berry);
static Tweaklets::TweakKey<GuiWidgetsTweaklet> KEY;
virtual void AddSelectionListener(void* widget, GuiTk::ISelectionListener::Pointer listener) = 0;
virtual void RemoveSelectionListener(void* widget, GuiTk::ISelectionListener::Pointer listener) = 0;
/**
* Adds the listener to the collection of listeners who will
* be notified when the widget is moved or resized, by sending
* it one of the messages defined in the <code>IControlListener</code>
* interface.
*
* @param listener the listener which should be notified
*
* @see IControlListener
* @see #RemoveControlListener
*/
virtual void AddControlListener(void* widget, GuiTk::IControlListener::Pointer listener) = 0;
/**
* Removes the listener from the collection of listeners who will
* be notified when the widget is moved or resized.
*
* @param listener the listener which should no longer be notified
*
* @see IControlListener
* @see #AddControlListener
*/
virtual void RemoveControlListener(void* widget, GuiTk::IControlListener::Pointer listener) = 0;
virtual bool GetEnabled(void* widget) = 0;
virtual void SetEnabled(void* widget, bool enabled) = 0;
virtual void SetBounds(void* widget, const Rectangle& bounds) = 0;
virtual Rectangle GetBounds(void* widget) = 0;
virtual void SetVisible(void* widget, bool visible) = 0;
virtual bool GetVisible(void* widget) = 0;
virtual bool IsVisible(void* widget) = 0;
virtual Rectangle GetClientArea(void* widget) = 0;
virtual void* GetParent(void* widget) = 0;
virtual bool SetParent(void* widget, void* parent) = 0;
virtual void SetData(void* widget, const std::string& id, Object::Pointer data) = 0;
virtual Object::Pointer GetData(void* widget, const std::string& id) = 0;
virtual Point GetCursorLocation() = 0;
virtual void* GetCursorControl() = 0;
virtual void* FindControl(const std::vector<Shell::Pointer>& shells, const Point& location) = 0;
/**
* Determines if one control is a child of another. Returns true iff the second
* argument is a child of the first (or the same object).
*
* @param potentialParent
* @param childToTest
* @return
*/
virtual bool IsChild(void* potentialParent, void* childToTest) = 0;
/**
* Returns the control which currently has keyboard focus,
* or null if keyboard events are not currently going to
* any of the controls built by the currently running
* application.
*
* @return the control under the cursor
*/
virtual void* GetFocusControl() = 0;
virtual bool IsReparentable(void* widget) = 0;
virtual void MoveAbove(void* widgetToMove, void* widget) = 0;
virtual void MoveBelow(void* widgetToMove, void* widget) = 0;
virtual void Dispose(void* widget) = 0;
virtual Shell::Pointer CreateShell(Shell::Pointer parent, int style) = 0;
virtual void DisposeShell(Shell::Pointer shell) = 0;
virtual void* CreateComposite(void* parent) = 0;
virtual std::vector<Shell::Pointer> GetShells() = 0;
virtual Shell::Pointer GetShell(void* widget) = 0;
virtual Shell::Pointer GetActiveShell() = 0;
// command framework interface classes
//virtual IMenu::Pointer CreateMenu(void*, IMenu::Style = IMenu::POP_UP) = 0;
//virtual IMenu::Pointer CreateMenu(IMenu::Pointer parent) = 0;
//virtual IMenuItem::Pointer CreateMenuItem(IMenu::Pointer, IMenuItem::Style, int index = -1) = 0;
/**
* @brief returns the coordinates of the center point of the primary screen
* (where the application starts) of the current desktop.
*
* @param i the number of the screen (if there are multiple). If i = -1
* a rectangle representing the size of the virtual desktop is returned.
* @return the screen Geometry.
* @see GetScreenNumber()
* @see GetPrimaryScreenNumber()
*/
virtual Rectangle GetScreenSize(int i = -1) = 0;
virtual Rectangle GetAvailableScreenSize(int i = -1) = 0;
virtual int GetClosestScreenNumber(const Rectangle&) = 0;
/**
* @brief Gets the number of available screens in a multi-screen environment.
*
* @return the number of available screens in a multi-screen environment.
*/
virtual unsigned int GetScreenNumber() = 0;
/**
* @brief Gets the number of the primary screen.
*
* @return the number of the primary screen.
*/
virtual int GetPrimaryScreenNumber() = 0;
/**
* Converts the given rectangle from display coordinates to the local coordinate system
* of the given object
*
* @param coordinateSystem local coordinate system (widget) being converted to
* @param toConvert rectangle to convert
* @return a rectangle in control coordinates
* @since 3.0
*/
virtual Rectangle ToControl(void* coordinateSystem,
const Rectangle& toConvert) = 0;
/**
* Converts the given point from display coordinates to the local coordinate system
* of the given object
*
* @param coordinateSystem local coordinate system (widget) being converted to
* @param toConvert point to convert
* @return a point in control coordinates
* @since 3.0
*/
virtual Point ToControl(void* coordinateSystem,
const Point& toConvert) = 0;
/**
* Converts the given rectangle from the local coordinate system of the given object
* into display coordinates.
*
* @param coordinateSystem local coordinate system (widget) being converted from
* @param toConvert rectangle to convert
* @return a rectangle in display coordinates
* @since 3.0
*/
virtual Rectangle ToDisplay(void* coordinateSystem,
const Rectangle& toConvert) = 0;
/**
* Converts the given point from the local coordinate system of the given object
* into display coordinates.
*
* @param coordinateSystem local coordinate system (widget) being converted from
* @param toConvert point to convert
* @return a point in display coordinates
* @since 3.0
*/
virtual Point ToDisplay(void* coordinateSystem,
const Point& toConvert) = 0;
};
}
Q_DECLARE_INTERFACE(berry::GuiWidgetsTweaklet, "org.blueberry.GuiWidgetsTweaklet")
#endif /* BERRYGUIWIDGETSTWEAKLET_H_ */
diff --git a/BlueBerry/Bundles/org.blueberry.ui/src/tweaklets/berryImageTweaklet.h b/BlueBerry/Bundles/org.blueberry.ui/src/tweaklets/berryImageTweaklet.h
index 3aea7758db..0f87d631ce 100755
--- a/BlueBerry/Bundles/org.blueberry.ui/src/tweaklets/berryImageTweaklet.h
+++ b/BlueBerry/Bundles/org.blueberry.ui/src/tweaklets/berryImageTweaklet.h
@@ -1,52 +1,49 @@
/*=========================================================================
Program: BlueBerry Platform
Language: C++
Date: $Date$
Version: $Revision$
Copyright (c) German Cancer Research Center, Division of Medical and
Biological Informatics. All rights reserved.
See MITKCopyright.txt or http://www.mitk.org/copyright.html for details.
This software is distributed WITHOUT ANY WARRANTY; without even
the implied warranty of MERCHANTABILITY or FITNESS FOR A PARTICULAR
PURPOSE. See the above copyright notices for more information.
=========================================================================*/
#ifndef BERRYIMAGETWEAKLET_H_
#define BERRYIMAGETWEAKLET_H_
#include <org_blueberry_ui_Export.h>
#include "../internal/berryTweaklets.h"
#include "../berryImageDescriptor.h"
#include <iostream>
namespace berry
{
/**
* Provides the set of cursors used for drag-and-drop.
*/
-struct BERRY_UI ImageTweaklet : public Object
+struct BERRY_UI ImageTweaklet
{
-
- berryInterfaceMacro(ImageTweaklet, berry);
-
static Tweaklets::TweakKey<ImageTweaklet> KEY;
virtual SmartPointer<ImageDescriptor> CreateFromFile(const std::string& filename, const std::string& pluginid) = 0;
virtual SmartPointer<ImageDescriptor> CreateFromImage(void* img) = 0;
virtual SmartPointer<ImageDescriptor> GetMissingImageDescriptor() = 0;
virtual void DestroyImage(const void* img) = 0;
};
}
-Q_DECLARE_INTERFACE(berry::ImageTweaklet, "orb.blueberry.ImageTweaklet")
+Q_DECLARE_INTERFACE(berry::ImageTweaklet, "org.blueberry.ImageTweaklet")
#endif /* BERRYIMAGETWEAKLET_H_ */
diff --git a/BlueBerry/Bundles/org.blueberry.ui/src/tweaklets/berryMessageDialogTweaklet.h b/BlueBerry/Bundles/org.blueberry.ui/src/tweaklets/berryMessageDialogTweaklet.h
index b221e72a2f..4f153f068e 100755
--- a/BlueBerry/Bundles/org.blueberry.ui/src/tweaklets/berryMessageDialogTweaklet.h
+++ b/BlueBerry/Bundles/org.blueberry.ui/src/tweaklets/berryMessageDialogTweaklet.h
@@ -1,160 +1,158 @@
/*=========================================================================
Program: BlueBerry Platform
Language: C++
Date: $Date$
Version: $Revision$
Copyright (c) German Cancer Research Center, Division of Medical and
Biological Informatics. All rights reserved.
See MITKCopyright.txt or http://www.mitk.org/copyright.html for details.
This software is distributed WITHOUT ANY WARRANTY; without even
the implied warranty of MERCHANTABILITY or FITNESS FOR A PARTICULAR
PURPOSE. See the above copyright notices for more information.
=========================================================================*/
#ifndef BERRYMESSAGEDIALOGTWEAKLET_H_
#define BERRYMESSAGEDIALOGTWEAKLET_H_
#include <org_blueberry_ui_Export.h>
#include "../berryShell.h"
#include "../dialogs/berryIDialog.h"
#include "../internal/berryTweaklets.h"
#include <berryMacros.h>
#include <vector>
#include <string>
namespace berry {
/**
* A dialog for showing messages to the user.
*/
-struct BERRY_UI MessageDialogTweaklet : public Object
+struct BERRY_UI MessageDialogTweaklet
{
- berryInterfaceMacro(MessageDialogTweaklet, berry);
-
static Tweaklets::TweakKey<MessageDialogTweaklet> KEY;
/**
* Convenience method to open a simple confirm (OK/Cancel) dialog.
*
* @param parent
* the parent shell of the dialog, or <code>null</code> if none
* @param title
* the dialog's title, or <code>null</code> if none
* @param message
* the message
* @return <code>true</code> if the user presses the OK button,
* <code>false</code> otherwise
*/
virtual bool OpenConfirm(Shell::Pointer parent, const std::string& title, const std::string& message) = 0;
/**
* Convenience method to open a standard error dialog.
*
* @param parent
* the parent shell of the dialog, or <code>null</code> if none
* @param title
* the dialog's title, or <code>null</code> if none
* @param message
* the message
*/
virtual void OpenError(Shell::Pointer parent, const std::string& title, const std::string& message) = 0;
/**
* Convenience method to open a standard information dialog.
*
* @param parent
* the parent shell of the dialog, or <code>null</code> if none
* @param title
* the dialog's title, or <code>null</code> if none
* @param message
* the message
*/
virtual void OpenInformation(Shell::Pointer parent, const std::string& title,
const std::string& message) = 0;
/**
* Convenience method to open a simple Yes/No question dialog.
*
* @param parent
* the parent shell of the dialog, or <code>null</code> if none
* @param title
* the dialog's title, or <code>null</code> if none
* @param message
* the message
* @return <code>true</code> if the user presses the OK button,
* <code>false</code> otherwise
*/
virtual bool OpenQuestion(Shell::Pointer parent, const std::string& title,
const std::string& message) = 0;
/**
* Convenience method to open a standard warning dialog.
*
* @param parent
* the parent shell of the dialog, or <code>null</code> if none
* @param title
* the dialog's title, or <code>null</code> if none
* @param message
* the message
*/
virtual void OpenWarning(Shell::Pointer parent, const std::string& title, const std::string& message) = 0;
/**
* Create a message dialog. Note that the dialog will have no visual
* representation (no widgets) until it is told to open.
* <p>
* The labels of the buttons to appear in the button bar are supplied in
* this constructor as an array. The <code>open</code> method will return
* the index of the label in this array corresponding to the button that was
* pressed to close the dialog. If the dialog was dismissed without pressing
* a button (ESC, etc.) then -1 is returned. Note that the <code>open</code>
* method blocks.
* </p>
*
* @param parentShell
* the parent shell
* @param dialogTitle
* the dialog title, or <code>null</code> if none
* @param dialogTitleImage
* the dialog title image, or <code>null</code> if none
* @param dialogMessage
* the dialog message
* @param dialogImageType
* one of the following values:
* <ul>
* <li><code>IDialog::NONE</code> for a dialog with no
* image</li>
* <li><code>IDialog::ERR</code> for a dialog with an
* error image</li>
* <li><code>IDialog::INFORMATION</code> for a dialog
* with an information image</li>
* <li><code>IDialog::QUESTION </code> for a dialog with a
* question image</li>
* <li><code>IDialog::WARNING</code> for a dialog with a
* warning image</li>
* </ul>
* @param dialogButtonLabels
* an array of labels for the buttons in the button bar
* @param defaultIndex
* the index in the button label array of the default button
*/
virtual IDialog::Pointer MessageDialog(Shell::Pointer parentShell, const std::string& dialogTitle,
void* dialogTitleImage, const std::string& dialogMessage, int dialogImageType,
const std::vector<std::string>& dialogButtonLabels, int defaultIndex) = 0;
};
}
Q_DECLARE_INTERFACE(berry::MessageDialogTweaklet, "org.blueberry.MessageDialogTweaklet")
#endif /* BERRYMESSAGEDIALOGTWEAKLET_H_ */
diff --git a/BlueBerry/Bundles/org.blueberry.ui/src/tweaklets/berryWorkbenchPageTweaklet.h b/BlueBerry/Bundles/org.blueberry.ui/src/tweaklets/berryWorkbenchPageTweaklet.h
index 6e87a48e1d..9cf9f808ef 100755
--- a/BlueBerry/Bundles/org.blueberry.ui/src/tweaklets/berryWorkbenchPageTweaklet.h
+++ b/BlueBerry/Bundles/org.blueberry.ui/src/tweaklets/berryWorkbenchPageTweaklet.h
@@ -1,46 +1,45 @@
/*=========================================================================
Program: BlueBerry Platform
Language: C++
Date: $Date$
Version: $Revision$
Copyright (c) German Cancer Research Center, Division of Medical and
Biological Informatics. All rights reserved.
See MITKCopyright.txt or http://www.mitk.org/copyright.html for details.
This software is distributed WITHOUT ANY WARRANTY; without even
the implied warranty of MERCHANTABILITY or FITNESS FOR A PARTICULAR
PURPOSE. See the above copyright notices for more information.
=========================================================================*/
#ifndef BERRYWORKBENCHPAGETWEAKLET_H_
#define BERRYWORKBENCHPAGETWEAKLET_H_
#include "../internal/berryTweaklets.h"
#include "../berryIWorkbenchPage.h"
namespace berry
{
-struct BERRY_UI WorkbenchPageTweaklet : public Object
+struct BERRY_UI WorkbenchPageTweaklet
{
- berryInterfaceMacro(WorkbenchPageTweaklet, berry);
static Tweaklets::TweakKey<WorkbenchPageTweaklet> KEY;
virtual void* CreateClientComposite(void* pageControl) = 0;
virtual void* CreatePaneControl(void* parent) = 0;
virtual Object::Pointer CreateStatusPart(void* parent, const std::string& title, const std::string& msg) = 0;
virtual IEditorPart::Pointer CreateErrorEditorPart(const std::string& partName, const std::string& msg) = 0;
};
}
Q_DECLARE_INTERFACE(berry::WorkbenchPageTweaklet, "org.blueberry.WorkbenchPageTweaklet")
#endif /* BERRYWORKBENCHPAGETWEAKLET_H_ */
diff --git a/BlueBerry/Bundles/org.blueberry.ui/src/tweaklets/berryWorkbenchTweaklet.h b/BlueBerry/Bundles/org.blueberry.ui/src/tweaklets/berryWorkbenchTweaklet.h
index 5c7ca2b975..26bdfb63ae 100755
--- a/BlueBerry/Bundles/org.blueberry.ui/src/tweaklets/berryWorkbenchTweaklet.h
+++ b/BlueBerry/Bundles/org.blueberry.ui/src/tweaklets/berryWorkbenchTweaklet.h
@@ -1,55 +1,54 @@
/*=========================================================================
Program: BlueBerry Platform
Language: C++
Date: $Date$
Version: $Revision$
Copyright (c) German Cancer Research Center, Division of Medical and
Biological Informatics. All rights reserved.
See MITKCopyright.txt or http://www.mitk.org/copyright.html for details.
This software is distributed WITHOUT ANY WARRANTY; without even
the implied warranty of MERCHANTABILITY or FITNESS FOR A PARTICULAR
PURPOSE. See the above copyright notices for more information.
=========================================================================*/
#ifndef BERRYWORKBENCHTWEAKLET_H_
#define BERRYWORKBENCHTWEAKLET_H_
#include "../internal/berryTweaklets.h"
#include "../berryShell.h"
#include "../berryDisplay.h"
#include "../dialogs/berryIDialog.h"
namespace berry
{
class WorkbenchWindow;
-struct BERRY_UI WorkbenchTweaklet : public Object
+struct BERRY_UI WorkbenchTweaklet
{
- berryInterfaceMacro(WorkbenchTweaklet, berry);
static Tweaklets::TweakKey<WorkbenchTweaklet> KEY;
static const std::string DIALOG_ID_SHOW_VIEW; // = "org.blueberry.ui.dialogs.showview";
virtual Display* CreateDisplay() = 0;
virtual bool IsRunning() = 0;
virtual SmartPointer<WorkbenchWindow> CreateWorkbenchWindow(int number) = 0;
virtual IDialog::Pointer CreateStandardDialog(const std::string& id) = 0;
};
}
Q_DECLARE_INTERFACE(berry::WorkbenchTweaklet, "org.blueberry.WorkbenchTweaklet")
#endif /* BERRYWORKBENCHTWEAKLET_H_ */
diff --git a/BlueBerry/CMake/FunctionCreateProvisioningFile.cmake b/BlueBerry/CMake/FunctionCreateProvisioningFile.cmake
index 814781ce42..3e186325dc 100644
--- a/BlueBerry/CMake/FunctionCreateProvisioningFile.cmake
+++ b/BlueBerry/CMake/FunctionCreateProvisioningFile.cmake
@@ -1,47 +1,47 @@
function(FunctionCreateProvisioningFile)
macro_parse_arguments(_PROV "FILE;INCLUDE;PLUGIN_DIR;PLUGINS" "" ${ARGN})
set(out_var )
set(out_var_install )
if(WIN32)
set(file_url "file:///")
else()
set(file_url "file://")
endif()
foreach(incl ${_PROV_INCLUDE})
- string(REPLACE "${CMAKE_RUNTIME_OUTPUT_DIRECTORY}" "@EXECUTABLE_DIR" incl_install ${incl})
+ get_filename_component(incl_filename "${incl}" NAME)
set(out_var "${out_var}READ ${file_url}${incl}\n")
- set(out_var_install "${out_var_install}READ ${file_url}${incl_install}\n")
+ set(out_var_install "${out_var_install}READ ${file_url}@EXECUTABLE_DIR/${incl_filename}\n")
endforeach()
if(_PROV_INCLUDE)
set(out_var "${out_var}\n")
set(out_var_install "${out_var_install}\n")
endif()
string(REPLACE "${CMAKE_RUNTIME_OUTPUT_DIRECTORY}" "@EXECUTABLE_DIR" _PROV_PLUGIN_DIR_install ${_PROV_PLUGIN_DIR})
foreach(plugin ${_PROV_PLUGINS})
ctkFunctionExtractOptionNameAndValue(${plugin} plugin_name_with_dirs plugin_value)
string(REPLACE "/" ";" _tokens ${plugin_name_with_dirs})
list(GET _tokens -1 plugin_name)
string(REPLACE "." "_" plugin_target ${plugin_name})
set(plugin_url "${file_url}${_PROV_PLUGIN_DIR}/lib${plugin_target}${CMAKE_SHARED_LIBRARY_SUFFIX}")
set(plugin_url_install "${file_url}${_PROV_PLUGIN_DIR_install}/lib${plugin_target}${CMAKE_SHARED_LIBRARY_SUFFIX}")
if(${${plugin_name_with_dirs}_option_name})
set(out_var "${out_var}START ${plugin_url}\n")
set(out_var_install "${out_var_install}START ${plugin_url_install}\n")
#else()
# set(out_var "${out_var}STOP ${plugin_url}\n")
# set(out_var_install "${out_var_install}STOP ${plugin_url_install}\n")
endif()
endforeach()
file(WRITE ${_PROV_FILE} "${out_var}")
file(WRITE ${_PROV_FILE}.install "${out_var_install}")
endfunction()
diff --git a/BlueBerry/CMake/MacroCreateCTKPlugin.cmake b/BlueBerry/CMake/MacroCreateCTKPlugin.cmake
index 8cf7d8d7c7..cbb771c889 100644
--- a/BlueBerry/CMake/MacroCreateCTKPlugin.cmake
+++ b/BlueBerry/CMake/MacroCreateCTKPlugin.cmake
@@ -1,126 +1,126 @@
# MACRO_CREATE_CTK_PLUGIN()
#
# Creates a CTK plugin.
# This macro should be called from the plugins CMakeLists.txt file.
# The target name is available after the macro call as ${PROJECT_NAME}
# to add additional libraries in your CMakeLists.txt. Include paths and link
# libraries are set depending on the value of the Required-Plugins header
# in your manifest_headers.cmake file.
#
MACRO(MACRO_CREATE_CTK_PLUGIN)
MACRO_PARSE_ARGUMENTS(_PLUGIN "EXPORT_DIRECTIVE;EXPORTED_INCLUDE_SUFFIXES" "TEST_PLUGIN" ${ARGN})
MESSAGE(STATUS "Creating CTK plugin ${PROJECT_NAME}")
SET(PLUGIN_TARGET ${PROJECT_NAME})
INCLUDE(files.cmake)
SET(_PLUGIN_CPP_FILES ${CPP_FILES})
SET(_PLUGIN_MOC_H_FILES ${MOC_H_FILES})
SET(_PLUGIN_UI_FILES ${UI_FILES})
SET(_PLUGIN_CACHED_RESOURCE_FILES ${CACHED_RESOURCE_FILES})
SET(_PLUGIN_TRANSLATION_FILES ${TRANSLATION_FILES})
SET(_PLUGIN_QRC_FILES ${QRC_FILES})
SET(_PLUGIN_H_FILES ${H_FILES})
SET(_PLUGIN_TXX_FILES ${TXX_FILES})
SET(_PLUGIN_DOX_FILES ${DOX_FILES})
SET(_PLUGIN_CMAKE_FILES ${CMAKE_FILES} files.cmake)
SET(_PLUGIN_FILE_DEPENDENCIES ${FILE_DEPENDENCIES})
IF(CTK_PLUGINS_OUTPUT_DIR)
SET(_output_dir "${CTK_PLUGINS_OUTPUT_DIR}")
ELSE()
SET(_output_dir plugins)
ENDIF()
IF(_PLUGIN_TEST_PLUGIN)
SET(is_test_plugin "TEST_PLUGIN")
ELSE()
SET(is_test_plugin)
ENDIF()
#------------------------------------------------------------#
#------------------ Qt Help support -------------------------#
SET(PLUGIN_GENERATED_QCH_FILES )
IF (BLUEBERRY_USE_QT_HELP AND
EXISTS "${CMAKE_CURRENT_SOURCE_DIR}/documentation/UserManual")
SET(PLUGIN_DOXYGEN_INPUT_DIR "${CMAKE_CURRENT_SOURCE_DIR}/documentation/UserManual")
SET(PLUGIN_DOXYGEN_OUTPUT_DIR "${CMAKE_CURRENT_BINARY_DIR}/documentation/UserManual")
_FUNCTION_CREATE_CTK_QT_COMPRESSED_HELP(PLUGIN_GENERATED_QCH_FILES )
LIST(APPEND _PLUGIN_CACHED_RESOURCE_FILES ${PLUGIN_GENERATED_QCH_FILES})
ENDIF()
# Compute the plugin dependencies
ctkFunctionGetTargetLibraries(_PLUGIN_target_libraries)
ctkMacroBuildPlugin(
NAME ${PLUGIN_TARGET}
EXPORT_DIRECTIVE ${_PLUGIN_EXPORT_DIRECTIVE}
SRCS ${_PLUGIN_CPP_FILES}
MOC_SRCS ${_PLUGIN_MOC_H_FILES}
UI_FORMS ${_PLUGIN_UI_FILES}
EXPORTED_INCLUDE_SUFFIXES ${_PLUGIN_EXPORTED_INCLUDE_SUFFIXES}
RESOURCES ${_PLUGIN_QRC_FILES}
TARGET_LIBRARIES ${_PLUGIN_target_libraries}
CACHED_RESOURCEFILES ${_PLUGIN_CACHED_RESOURCE_FILES}
TRANSLATIONS ${_PLUGIN_TRANSLATION_FILES}
OUTPUT_DIR ${_output_dir}
${is_test_plugin}
)
IF(mbilog_FOUND)
TARGET_LINK_LIBRARIES(${PLUGIN_TARGET} mbilog)
ENDIF()
INCLUDE_DIRECTORIES(${Poco_INCLUDE_DIRS})
TARGET_LINK_LIBRARIES(${PLUGIN_TARGET}
optimized PocoFoundation debug PocoFoundationd
optimized PocoUtil debug PocoUtild
optimized PocoXML debug PocoXMLd
)
SET(_PLUGIN_META_FILES "${CMAKE_CURRENT_SOURCE_DIR}/manifest_headers.cmake")
IF(EXISTS "${CMAKE_CURRENT_SOURCE_DIR}/plugin.xml")
LIST(APPEND _PLUGIN_META_FILES "${CMAKE_CURRENT_SOURCE_DIR}/plugin.xml")
ENDIF()
MACRO_ORGANIZE_SOURCES(
SOURCE ${_PLUGIN_CPP_FILES}
HEADER ${_PLUGIN_H_FILES}
TXX ${_PLUGIN_TXX_FILES}
DOC ${_PLUGIN_DOX_FILES}
UI ${_PLUGIN_UI_FILES}
QRC ${_PLUGIN_QRC_FILES} ${_PLUGIN_CACHED_RESOURCE_FILES}
META ${_PLUGIN_META_FILES}
MOC ${MY_MOC_CPP}
GEN_UI ${MY_UI_CPP}
GEN_QRC ${MY_QRC_SRCS}
)
#------------------------------------------------------------#
#------------------ Installer support -----------------------#
IF(NOT _PLUGIN_TEST_PLUGIN)
SET(install_directories "")
IF(NOT MACOSX_BUNDLE_NAMES)
- SET(install_directories bin)
+ SET(install_directories bin/plugins)
ELSE(NOT MACOSX_BUNDLE_NAMES)
FOREACH(bundle_name ${MACOSX_BUNDLE_NAMES})
- LIST(APPEND install_directories ${bundle_name}.app/Contents/MacOS)
+ LIST(APPEND install_directories ${bundle_name}.app/Contents/MacOS/plugins)
ENDFOREACH(bundle_name)
ENDIF(NOT MACOSX_BUNDLE_NAMES)
FOREACH(install_subdir ${install_directories})
MACRO_INSTALL_CTK_PLUGIN(TARGETS ${PLUGIN_TARGET}
- DESTINATION bin/plugins)
+ DESTINATION ${install_subdir})
ENDFOREACH()
ENDIF()
ENDMACRO()
diff --git a/BlueBerry/CMake/MacroInstallCTKPlugin.cmake b/BlueBerry/CMake/MacroInstallCTKPlugin.cmake
index 3429551a38..e3db8358cd 100644
--- a/BlueBerry/CMake/MacroInstallCTKPlugin.cmake
+++ b/BlueBerry/CMake/MacroInstallCTKPlugin.cmake
@@ -1,31 +1,43 @@
MACRO(MACRO_INSTALL_CTK_PLUGIN)
MACRO_PARSE_ARGUMENTS(_INSTALL "TARGETS;DESTINATION" "" ${ARGN})
IF(NOT _INSTALL_DESTINATION)
SET(_INSTALL_DESTINATION "bin/")
ELSE()
SET(_INSTALL_DESTINATION "${_INSTALL_DESTINATION}/")
ENDIF()
FOREACH(_install_target ${_INSTALL_TARGETS})
GET_TARGET_PROPERTY(_is_imported ${_install_target} IMPORTED)
IF(_is_imported)
GET_TARGET_PROPERTY(_import_loc_debug ${_install_target} IMPORTED_LOCATION_DEBUG)
GET_TARGET_PROPERTY(_import_loc_release ${_install_target} IMPORTED_LOCATION_RELEASE)
+ GET_FILENAME_COMPONENT(_target_filename_debug "${_import_loc_debug}" NAME)
+ GET_FILENAME_COMPONENT(_target_filename_release "${_import_loc_release}" NAME)
INSTALL(FILES ${_import_loc_debug}
DESTINATION ${_INSTALL_DESTINATION}
CONFIGURATIONS Debug)
INSTALL(FILES ${_import_loc_release}
DESTINATION ${_INSTALL_DESTINATION}
CONFIGURATIONS Release)
+ IF(UNIX AND NOT APPLE)
+ IF(_target_filename_debug)
+ INSTALL(CODE "FILE(RPATH_REMOVE
+ FILE \"\${CMAKE_INSTALL_PREFIX}/${_INSTALL_DESTINATION}/${_target_filename_debug}\")")
+ ENDIF()
+ IF(_target_filename_release)
+ INSTALL(CODE "FILE(RPATH_REMOVE
+ FILE \"\${CMAKE_INSTALL_PREFIX}/${_INSTALL_DESTINATION}/${_target_filename_release}\")")
+ ENDIF()
+ ENDIF()
ELSE()
INSTALL(TARGETS ${_install_target}
RUNTIME DESTINATION ${_INSTALL_DESTINATION}
LIBRARY DESTINATION ${_INSTALL_DESTINATION}
#ARCHIVE DESTINATION ${_INSTALL_DESTINATION}
)
ENDIF()
ENDFOREACH()
ENDMACRO()
diff --git a/BlueBerry/CMakeLists.txt b/BlueBerry/CMakeLists.txt
index 17ad694c0f..bf68825aa3 100644
--- a/BlueBerry/CMakeLists.txt
+++ b/BlueBerry/CMakeLists.txt
@@ -1,305 +1,295 @@
PROJECT(BlueBerry)
CMAKE_MINIMUM_REQUIRED(VERSION 2.8.2)
SET(CMAKE_MODULE_PATH ${CMAKE_MODULE_PATH} "${CMAKE_CURRENT_SOURCE_DIR}/CMake/")
INCLUDE(MacroParseArguments)
INCLUDE(MacroConvertSchema)
INCLUDE(MacroOrganizeSources)
INCLUDE(berryPluginHelpers)
INCLUDE(MacroCollectPlugins)
INCLUDE(MacroParseManifest)
INCLUDE(MacroCreatePlugin)
INCLUDE(MacroCreateCTKPlugin)
INCLUDE(MacroCreateQtHelp)
INCLUDE(MacroInstallPlugin)
INCLUDE(MacroInstallCTKPlugin)
INCLUDE(FunctionCreateProvisioningFile)
-OPTION(BLUEBERRY_INSTALL_RPATH_RELATIVE "Use relative rpath entries when installing" OFF)
-MARK_AS_ADVANCED(BLUEBERRY_INSTALL_RPATH_RELATIVE)
-
-IF(BLUEBERRY_INSTALL_RPATH_RELATIVE)
- SET(CMAKE_INSTALL_RPATH ".")
-ELSE()
- SET(CMAKE_INSTALL_RPATH "${CMAKE_INSTALL_PREFIX}/bin")
-ENDIF()
-
-
IF(MSVC)
SET(CMAKE_CXX_FLAGS "${CMAKE_CXX_FLAGS} /wd4250 /wd4275 /wd4251 /wd4503")
ENDIF()
IF (NOT CMAKE_RUNTIME_OUTPUT_DIRECTORY)
SET (CMAKE_RUNTIME_OUTPUT_DIRECTORY ${PROJECT_BINARY_DIR}/bin)
ENDIF ()
FIND_PACKAGE(mbilog REQUIRED)
INCLUDE_DIRECTORIES(${mbilog_INCLUDE_DIRS})
OPTION(BLUEBERRY_USE_QT "Use the Qt GUI toolkit" OFF)
IF(NOT DESIRED_QT_VERSION)
SET(DESIRED_QT_VERSION 4 CACHE STRING "Desired Qt version" FORCE)
MARK_AS_ADVANCED(DESIRED_QT_VERSION)
ENDIF()
IF(BLUEBERRY_USE_QT AND NOT DESIRED_QT_VERSION EQUAL 4)
MESSAGE("Attention: Qt4 GUI libraries are required to build the BlueBerry Qt plug-ins.")
ENDIF()
IF(BLUEBERRY_USE_QT AND DESIRED_QT_VERSION EQUAL 4)
SET(BUILD_QT_PLUGINS 1)
FIND_PACKAGE(Qt4 4.6.2 REQUIRED)
IF(QT_QMAKE_CHANGED)
SET(QT_HELPGENERATOR_EXECUTABLE NOTFOUND)
SET(QT_COLLECTIONGENERATOR_EXECUTABLE NOTFOUND)
SET(QT_ASSISTANT_EXECUTABLE NOTFOUND)
ENDIF()
FIND_PROGRAM(QT_HELPGENERATOR_EXECUTABLE
NAMES qhelpgenerator qhelpgenerator-qt4 qhelpgenerator4
PATHS ${QT_BINARY_DIR}
NO_DEFAULT_PATH
)
FIND_PROGRAM(QT_COLLECTIONGENERATOR_EXECUTABLE
NAMES qcollectiongenerator qcollectiongenerator-qt4 qcollectiongenerator4
PATHS ${QT_BINARY_DIR}
NO_DEFAULT_PATH
)
FIND_PROGRAM(QT_ASSISTANT_EXECUTABLE
NAMES assistant-qt4 assistant4 assistant
PATHS ${QT_BINARY_DIR}
NO_DEFAULT_PATH
)
OPTION(BLUEBERRY_USE_QT_HELP "Enable support for integrating bundle documentation into Qt Help" ON)
MARK_AS_ADVANCED(BLUEBERRY_USE_QT_HELP
QT_HELPGENERATOR_EXECUTABLE
QT_COLLECTIONGENERATOR_EXECUTABLE
QT_ASSISTANT_EXECUTABLE)
SET(_doxygen_too_old 1)
IF(BLUEBERRY_USE_QT_HELP)
FIND_PACKAGE(Doxygen)
IF(DOXYGEN_FOUND)
EXECUTE_PROCESS(COMMAND ${DOXYGEN_EXECUTABLE} --version
OUTPUT_VARIABLE _doxygen_version)
IF(${_doxygen_version} VERSION_GREATER 1.6.0 OR
${_doxygen_version} VERSION_EQUAL 1.6.0)
SET(_doxygen_too_old 0)
ENDIF()
ENDIF()
ELSE(BLUEBERRY_USE_QT_HELP)
CONFIGURE_FILE(../Documentation/pregenerated/MITKBlankPage.qch
${MITK_BINARY_DIR}/bin/ExtBundles/org.mitk.gui.qt.extapplication/resources/MITKBlankPage.qch
COPYONLY)
CONFIGURE_FILE(../Documentation/pregenerated/MitkExtQtHelpCollection.qhc
${MITK_BINARY_DIR}/bin/ExtBundles/org.mitk.gui.qt.extapplication/resources/MitkExtQtHelpCollection.qhc
COPYONLY)
ENDIF(BLUEBERRY_USE_QT_HELP)
IF (BLUEBERRY_USE_QT_HELP AND _doxygen_too_old)
MESSAGE("Doxygen was not found or is too old. Version 1.6.0 or later is needed if BLUEBERRY_USE_QT_HELP is ON")
SET(BLUEBERRY_USE_QT_HELP OFF CACHE BOOL "Enable support for integrating bundle documentation into Qt Help" FORCE)
ENDIF()
IF(BLUEBERRY_USE_QT_HELP AND NOT QT_HELPGENERATOR_EXECUTABLE)
MESSAGE("You have enabled Qt Help support, but QT_HELPGENERATOR_EXECUTABLE is empty")
SET(BLUEBERRY_USE_QT_HELP OFF CACHE BOOL "Enable support for integrating bundle documentation into Qt Help" FORCE)
ENDIF()
INCLUDE(${QT_USE_FILE})
ELSE()
FIND_PACKAGE(Qt4 4.6.2 COMPONENTS QtCore REQUIRED)
INCLUDE(${QT_USE_FILE})
ENDIF()
# ========= CTK specific CMake stuff ============
CMAKE_POLICY(SET CMP0012 NEW)
FIND_PACKAGE(CTK REQUIRED)
SET(CTK_PLUGIN_LIBRARIES "${CTK_PLUGIN_LIBRARIES}" CACHE INTERNAL "CTK plugins" FORCE)
# Extract all library names starting with org_blueberry_
MACRO(GetMyTargetLibraries all_target_libraries varname)
SET(re_ctkplugin "^org_blueberry_[a-zA-Z0-9_]+$")
SET(_tmp_list)
LIST(APPEND _tmp_list ${all_target_libraries})
ctkMacroListFilter(_tmp_list re_ctkplugin OUTPUT_VARIABLE ${varname})
ENDMACRO()
# ================================================
OPTION(BLUEBERRY_BUILD_ALL_PLUGINS "Build all BlueBerry plugins (overriding selection)" OFF)
MARK_AS_ADVANCED(BLUEBERRY_BUILD_ALL_PLUGINS)
IF(BLUEBERRY_BUILD_ALL_PLUGINS)
SET(BLUEBERRY_BUILD_ALL_PLUGINS_OPTION "FORCE_BUILD_ALL")
ENDIF()
OPTION(BLUEBERRY_STATIC "Build all plugins as static libraries" OFF)
MARK_AS_ADVANCED(BLUEBERRY_STATIC)
OPTION(BLUEBERRY_DEBUG_SMARTPOINTER "Enable code for debugging smart pointers" OFF)
MARK_AS_ADVANCED(BLUEBERRY_DEBUG_SMARTPOINTER)
FIND_PACKAGE(Poco REQUIRED)
FIND_PACKAGE(Ant)
FIND_PACKAGE(Eclipse)
SET(BLUEBERRY_SOURCE_DIR ${BlueBerry_SOURCE_DIR})
SET(BLUEBERRY_BINARY_DIR ${BlueBerry_BINARY_DIR})
SET(BLUEBERRY_PLUGINS_SOURCE_DIR ${CMAKE_CURRENT_SOURCE_DIR}/Bundles)
SET(BLUEBERRY_PLUGINS_BINARY_DIR ${CMAKE_CURRENT_BINARY_DIR}/Bundles)
SET(OSGI_APP solstice)
SET(OSGI_UI_APP solstice_ui)
# Force should be removed after everybody has configured their old binary tree
SET(BLUEBERRY_PLUGINS_OUTPUT_DIR ${CMAKE_RUNTIME_OUTPUT_DIRECTORY}/BlueBerry CACHE PATH "Directory where to build the BlueBerry Bundles" FORCE)
MARK_AS_ADVANCED(BLUEBERRY_PLUGINS_OUTPUT_DIR)
# Clear the cache variables
SET(BLUEBERRY_PLUGIN_SOURCE_DIRS "" CACHE INTERNAL "List of base plugin source directories" FORCE)
SET(BLUEBERRY_PLUGIN_BINARY_DIRS "" CACHE INTERNAL "List of base plugin binary directories" FORCE)
IF (Eclipse_DIR)
SET(BLUEBERRY_DOC_TOOLS_DIR "${Eclipse_DIR}" CACHE PATH "Directory containing additional tools needed for generating the documentation")
ELSE ()
SET(BLUEBERRY_DOC_TOOLS_DIR "" CACHE PATH "Directory containing additional tools needed for generating the documentation")
ENDIF ()
SET(BLUEBERRY_DEBUG_POSTFIX d)
# Testing options
OPTION(BLUEBERRY_BUILD_TESTING "Build the BlueBerry tests." ${BUILD_TESTING})
IF(WIN32)
SET(_gui_testing_default "ON")
ELSE()
SET(_gui_testing_default "OFF")
ENDIF()
OPTION(BLUEBERRY_ENABLE_GUI_TESTING "Enable the BlueBerry GUI tests" ${_gui_testing_default})
MARK_AS_ADVANCED(BLUEBERRY_ENABLE_GUI_TESTING)
IF(BLUEBERRY_BUILD_TESTING)
ENABLE_TESTING()
ENDIF()
# Add CTK plugins
SET(_ctk_plugins
Bundles/org.blueberry.osgi:ON
Bundles/org.blueberry.compat:ON
Bundles/org.blueberry.core.runtime:ON
Bundles/org.blueberry.core.expressions:ON
Bundles/org.blueberry.solstice.common:ON
Bundles/org.blueberry.core.commands:ON
Bundles/org.blueberry.core.jobs:OFF
Bundles/org.blueberry.ui:ON
Bundles/org.blueberry.ui.qt:ON
Bundles/org.blueberry.ui.qt.log:OFF
Bundles/org.blueberry.ui.qt.objectinspector:OFF
)
SET(_ctk_test_plugins )
SET(_ctk_plugins_include_dirs
${Poco_INCLUDE_DIRS}
)
SET(_ctk_plugins_link_dirs
${Poco_LIBRARY_DIR}
)
INCLUDE_DIRECTORIES(${_ctk_plugins_include_dirs})
LINK_DIRECTORIES(${_ctk_plugins_link_dirs})
IF(BLUEBERRY_BUILD_TESTING)
INCLUDE(berryTestingHelpers)
SET(BLUEBERRY_TEST_APP "${CMAKE_RUNTIME_OUTPUT_DIRECTORY}/${OSGI_APP}")
GET_TARGET_PROPERTY(_is_macosx_bundle ${OSGI_APP} MACOSX_BUNDLE)
IF(APPLE AND _is_macosx_bundle)
SET(BLUEBERRY_TEST_APP "${CMAKE_RUNTIME_OUTPUT_DIRECTORY}/${OSGI_APP}.app/Contents/MacOS/${OSGI_APP}")
ENDIF()
LIST(APPEND _ctk_plugins
Bundles/org.blueberry.test:ON
Bundles/org.blueberry.uitest:ON
)
SET(_ctk_test_plugins
# Testing/org.blueberry.core.runtime.tests:ON
# Testing/org.blueberry.osgi.tests:ON
)
IF(BLUEBERRY_ENABLE_GUI_TESTING)
# LIST(APPEND _ctk_test_plugins Testing/org.blueberry.ui.tests:ON)
SET(BLUEBERRY_UI_TEST_APP "${CMAKE_RUNTIME_OUTPUT_DIRECTORY}/${OSGI_UI_APP}")
GET_TARGET_PROPERTY(_is_macosx_bundle ${OSGI_UI_APP} MACOSX_BUNDLE)
IF(APPLE AND _is_macosx_bundle)
SET(BLUEBERRY_UI_TEST_APP "${CMAKE_RUNTIME_OUTPUT_DIRECTORY}/${OSGI_UI_APP}.app/Contents/MacOS/${OSGI_UI_APP}")
ENDIF()
ENDIF()
ENDIF()
SET(BLUEBERRY_TESTING_PROVISIONING_FILE "${BlueBerry_BINARY_DIR}/BlueBerryTesting.provisioning")
ADD_CUSTOM_TARGET(BlueBerry)
ctkMacroSetupExternalPlugins(${_ctk_plugins} ${_ctk_test_plugins}
BUILD_OPTION_PREFIX BLUEBERRY_BUILD_
BUILD_ALL ${BLUEBERRY_BUILD_ALL_PLUGINS}
COMPACT_OPTIONS)
SET(BLUEBERRY_PROVISIONING_FILE "${CMAKE_RUNTIME_OUTPUT_DIRECTORY}/BlueBerry.provisioning")
FunctionCreateProvisioningFile(
FILE ${BLUEBERRY_PROVISIONING_FILE}
PLUGIN_DIR "${CMAKE_RUNTIME_OUTPUT_DIRECTORY}/plugins"
PLUGINS ${_ctk_plugins}
)
FunctionCreateProvisioningFile(
FILE ${BLUEBERRY_TESTING_PROVISIONING_FILE}
INCLUDE ${BLUEBERRY_PROVISIONING_FILE}
PLUGIN_DIR "${CMAKE_RUNTIME_OUTPUT_DIRECTORY}/test_plugins"
PLUGINS ${_ctk_test_plugins}
)
ctkMacroGetAllProjectTargetLibraries("${CTK_PLUGIN_LIBRARIES}" _enabled_plugin_targets)
add_dependencies(BlueBerry ${_enabled_plugin_targets})
set_property(TARGET ${_enabled_plugin_targets} PROPERTY LABELS BlueBerry)
SET(BB_PLUGIN_USE_FILE "${BlueBerry_BINARY_DIR}/BlueBerryPluginUseFile.cmake")
ctkFunctionGeneratePluginUseFile(${BB_PLUGIN_USE_FILE})
# CTK Plugin Exports
SET(BB_PLUGIN_EXPORTS_FILE "${CMAKE_CURRENT_BINARY_DIR}/BlueBerryPluginExports.cmake")
GetMyTargetLibraries("${CTK_PLUGIN_LIBRARIES}" my_plugin_targets)
SET(additional_export_targets mbilog PocoFoundation PocoUtil PocoXML)
IF(BLUEBERRY_BUILD_TESTING)
LIST(APPEND additional_export_targets CppUnit)
ENDIF()
export(TARGETS ${my_plugin_targets} ${additional_export_targets}
FILE ${BB_PLUGIN_EXPORTS_FILE})
ADD_SUBDIRECTORY(Documentation)
CONFIGURE_FILE(BlueBerryConfig.cmake.in ${CMAKE_CURRENT_BINARY_DIR}/BlueBerryConfig.cmake @ONLY)
diff --git a/BlueBerry/Documentation/doxygen.conf.in b/BlueBerry/Documentation/doxygen.conf.in
index 91ac492c4b..23064a4e1f 100644
--- a/BlueBerry/Documentation/doxygen.conf.in
+++ b/BlueBerry/Documentation/doxygen.conf.in
@@ -1,1650 +1,1699 @@
-# Doxyfile 1.7.1
+# Doxyfile 1.7.3
# This file describes the settings to be used by the documentation system
-# doxygen (www.doxygen.org) for a project
+# doxygen (www.doxygen.org) for a project.
#
-# All text after a hash (#) is considered a comment and will be ignored
+# All text after a hash (#) is considered a comment and will be ignored.
# The format is:
# TAG = value [value, ...]
# For lists items can also be appended using:
# TAG += value [value, ...]
-# Values that contain spaces should be placed between quotes (" ")
+# Values that contain spaces should be placed between quotes (" ").
#---------------------------------------------------------------------------
# Project related configuration options
#---------------------------------------------------------------------------
# This tag specifies the encoding used for all characters in the config file
# that follow. The default is UTF-8 which is also the encoding used for all
# text before the first occurrence of this tag. Doxygen uses libiconv (or the
# iconv built into libc) for the transcoding. See
# http://www.gnu.org/software/libiconv for the list of possible encodings.
DOXYFILE_ENCODING = UTF-8
# The PROJECT_NAME tag is a single word (or a sequence of words surrounded
# by quotes) that should identify the project.
PROJECT_NAME = BlueBerry
# The PROJECT_NUMBER tag can be used to enter a project or revision number.
# This could be handy for archiving the generated documentation or
# if some version control system is used.
PROJECT_NUMBER = @BLUEBERRY_VERSION_STRING@
+# Using the PROJECT_BRIEF tag one can provide an optional one line description for a project that appears at the top of each page and should give viewer a quick idea about the purpose of the project. Keep the description short.
+
+PROJECT_BRIEF = "A modular, cross-platform, C++ application framework"
+
+# With the PROJECT_LOGO tag one can specify an logo or icon that is
+# included in the documentation. The maximum height of the logo should not
+# exceed 55 pixels and the maximum width should not exceed 200 pixels.
+# Doxygen will copy the logo to the output directory.
+
+PROJECT_LOGO =
+
# The OUTPUT_DIRECTORY tag is used to specify the (relative or absolute)
# base path where the generated documentation will be put.
# If a relative path is entered, it will be relative to the location
# where doxygen was started. If left blank the current directory will be used.
OUTPUT_DIRECTORY = "@BLUEBERRY_DOXYGEN_OUTPUT_DIR@"
# If the CREATE_SUBDIRS tag is set to YES, then doxygen will create
# 4096 sub-directories (in 2 levels) under the output directory of each output
# format and will distribute the generated files over these directories.
# Enabling this option can be useful when feeding doxygen a huge amount of
# source files, where putting all generated files in the same directory would
# otherwise cause performance problems for the file system.
CREATE_SUBDIRS = NO
# The OUTPUT_LANGUAGE tag is used to specify the language in which all
# documentation generated by doxygen is written. Doxygen will use this
# information to generate all constant output in the proper language.
# The default language is English, other supported languages are:
# Afrikaans, Arabic, Brazilian, Catalan, Chinese, Chinese-Traditional,
# Croatian, Czech, Danish, Dutch, Esperanto, Farsi, Finnish, French, German,
# Greek, Hungarian, Italian, Japanese, Japanese-en (Japanese with English
# messages), Korean, Korean-en, Lithuanian, Norwegian, Macedonian, Persian,
-# Polish, Portuguese, Romanian, Russian, Serbian, Serbian-Cyrilic, Slovak,
+# Polish, Portuguese, Romanian, Russian, Serbian, Serbian-Cyrillic, Slovak,
# Slovene, Spanish, Swedish, Ukrainian, and Vietnamese.
OUTPUT_LANGUAGE = English
# If the BRIEF_MEMBER_DESC tag is set to YES (the default) Doxygen will
# include brief member descriptions after the members that are listed in
# the file and class documentation (similar to JavaDoc).
# Set to NO to disable this.
BRIEF_MEMBER_DESC = YES
# If the REPEAT_BRIEF tag is set to YES (the default) Doxygen will prepend
# the brief description of a member or function before the detailed description.
# Note: if both HIDE_UNDOC_MEMBERS and BRIEF_MEMBER_DESC are set to NO, the
# brief descriptions will be completely suppressed.
REPEAT_BRIEF = YES
# This tag implements a quasi-intelligent brief description abbreviator
# that is used to form the text in various listings. Each string
# in this list, if found as the leading text of the brief description, will be
# stripped from the text and the result after processing the whole list, is
# used as the annotated text. Otherwise, the brief description is used as-is.
# If left blank, the following values are used ("$name" is automatically
# replaced with the name of the entity): "The $name class" "The $name widget"
# "The $name file" "is" "provides" "specifies" "contains"
# "represents" "a" "an" "the"
ABBREVIATE_BRIEF =
# If the ALWAYS_DETAILED_SEC and REPEAT_BRIEF tags are both set to YES then
# Doxygen will generate a detailed section even if there is only a brief
# description.
ALWAYS_DETAILED_SEC = NO
# If the INLINE_INHERITED_MEMB tag is set to YES, doxygen will show all
# inherited members of a class in the documentation of that class as if those
# members were ordinary class members. Constructors, destructors and assignment
# operators of the base classes will not be shown.
INLINE_INHERITED_MEMB = NO
# If the FULL_PATH_NAMES tag is set to YES then Doxygen will prepend the full
# path before files name in the file list and in the header files. If set
# to NO the shortest path that makes the file name unique will be used.
FULL_PATH_NAMES = NO
# If the FULL_PATH_NAMES tag is set to YES then the STRIP_FROM_PATH tag
# can be used to strip a user-defined part of the path. Stripping is
# only done if one of the specified strings matches the left-hand part of
# the path. The tag can be used to show relative paths in the file list.
# If left blank the directory from which doxygen is run is used as the
# path to strip.
STRIP_FROM_PATH =
# The STRIP_FROM_INC_PATH tag can be used to strip a user-defined part of
# the path mentioned in the documentation of a class, which tells
# the reader which header file to include in order to use a class.
# If left blank only the name of the header file containing the class
# definition is used. Otherwise one should specify the include paths that
# are normally passed to the compiler using the -I flag.
STRIP_FROM_INC_PATH =
# If the SHORT_NAMES tag is set to YES, doxygen will generate much shorter
-# (but less readable) file names. This can be useful is your file systems
+# (but less readable) file names. This can be useful if your file system
# doesn't support long names like on DOS, Mac, or CD-ROM.
SHORT_NAMES = NO
# If the JAVADOC_AUTOBRIEF tag is set to YES then Doxygen
# will interpret the first line (until the first dot) of a JavaDoc-style
# comment as the brief description. If set to NO, the JavaDoc
# comments will behave just like regular Qt-style comments
# (thus requiring an explicit @brief command for a brief description.)
JAVADOC_AUTOBRIEF = NO
# If the QT_AUTOBRIEF tag is set to YES then Doxygen will
# interpret the first line (until the first dot) of a Qt-style
# comment as the brief description. If set to NO, the comments
# will behave just like regular Qt-style comments (thus requiring
# an explicit \brief command for a brief description.)
QT_AUTOBRIEF = NO
# The MULTILINE_CPP_IS_BRIEF tag can be set to YES to make Doxygen
# treat a multi-line C++ special comment block (i.e. a block of //! or ///
# comments) as a brief description. This used to be the default behaviour.
# The new default is to treat a multi-line C++ comment block as a detailed
# description. Set this tag to YES if you prefer the old behaviour instead.
MULTILINE_CPP_IS_BRIEF = NO
# If the INHERIT_DOCS tag is set to YES (the default) then an undocumented
# member inherits the documentation from any documented member that it
# re-implements.
INHERIT_DOCS = YES
# If the SEPARATE_MEMBER_PAGES tag is set to YES, then doxygen will produce
# a new page for each member. If set to NO, the documentation of a member will
# be part of the file/class/namespace that contains it.
SEPARATE_MEMBER_PAGES = NO
# The TAB_SIZE tag can be used to set the number of spaces in a tab.
# Doxygen uses this value to replace tabs by spaces in code fragments.
TAB_SIZE = 8
# This tag can be used to specify a number of aliases that acts
# as commands in the documentation. An alias has the form "name=value".
# For example adding "sideeffect=\par Side Effects:\n" will allow you to
# put the command \sideeffect (or @sideeffect) in the documentation, which
# will result in a user-defined paragraph with heading "Side Effects:".
# You can put \n's in the value part of an alias to insert newlines.
ALIASES = "FIXME=\par Fix Me's:\n"
# Set the OPTIMIZE_OUTPUT_FOR_C tag to YES if your project consists of C
# sources only. Doxygen will then generate output that is more tailored for C.
# For instance, some of the names that are used will be different. The list
# of all members will be omitted, etc.
OPTIMIZE_OUTPUT_FOR_C = NO
# Set the OPTIMIZE_OUTPUT_JAVA tag to YES if your project consists of Java
# sources only. Doxygen will then generate output that is more tailored for
# Java. For instance, namespaces will be presented as packages, qualified
# scopes will look different, etc.
OPTIMIZE_OUTPUT_JAVA = NO
# Set the OPTIMIZE_FOR_FORTRAN tag to YES if your project consists of Fortran
# sources only. Doxygen will then generate output that is more tailored for
# Fortran.
OPTIMIZE_FOR_FORTRAN = NO
# Set the OPTIMIZE_OUTPUT_VHDL tag to YES if your project consists of VHDL
# sources. Doxygen will then generate output that is tailored for
# VHDL.
OPTIMIZE_OUTPUT_VHDL = NO
# Doxygen selects the parser to use depending on the extension of the files it
# parses. With this tag you can assign which parser to use for a given extension.
# Doxygen has a built-in mapping, but you can override or extend it using this
# tag. The format is ext=language, where ext is a file extension, and language
# is one of the parsers supported by doxygen: IDL, Java, Javascript, CSharp, C,
# C++, D, PHP, Objective-C, Python, Fortran, VHDL, C, C++. For instance to make
# doxygen treat .inc files as Fortran files (default is PHP), and .f files as C
# (default is Fortran), use: inc=Fortran f=C. Note that for custom extensions
# you also need to set FILE_PATTERNS otherwise the files are not read by doxygen.
EXTENSION_MAPPING =
# If you use STL classes (i.e. std::string, std::vector, etc.) but do not want
# to include (a tag file for) the STL sources as input, then you should
# set this tag to YES in order to let doxygen match functions declarations and
# definitions whose arguments contain STL classes (e.g. func(std::string); v.s.
-# func(std::string) {}). This also make the inheritance and collaboration
+# func(std::string) {}). This also makes the inheritance and collaboration
# diagrams that involve STL classes more complete and accurate.
-BUILTIN_STL_SUPPORT = NO
+BUILTIN_STL_SUPPORT = YES
# If you use Microsoft's C++/CLI language, you should set this option to YES to
# enable parsing support.
CPP_CLI_SUPPORT = NO
# Set the SIP_SUPPORT tag to YES if your project consists of sip sources only.
# Doxygen will parse them like normal C++ but will assume all classes use public
# instead of private inheritance when no explicit protection keyword is present.
SIP_SUPPORT = NO
# For Microsoft's IDL there are propget and propput attributes to indicate getter
# and setter methods for a property. Setting this option to YES (the default)
-# will make doxygen to replace the get and set methods by a property in the
+# will make doxygen replace the get and set methods by a property in the
# documentation. This will only work if the methods are indeed getting or
# setting a simple type. If this is not the case, or you want to show the
# methods anyway, you should set this option to NO.
IDL_PROPERTY_SUPPORT = YES
# If member grouping is used in the documentation and the DISTRIBUTE_GROUP_DOC
# tag is set to YES, then doxygen will reuse the documentation of the first
# member in the group (if any) for the other members of the group. By default
# all members of a group must be documented explicitly.
DISTRIBUTE_GROUP_DOC = NO
# Set the SUBGROUPING tag to YES (the default) to allow class member groups of
# the same type (for instance a group of public functions) to be put as a
# subgroup of that type (e.g. under the Public Functions section). Set it to
# NO to prevent subgrouping. Alternatively, this can be done per class using
# the \nosubgrouping command.
SUBGROUPING = YES
# When TYPEDEF_HIDES_STRUCT is enabled, a typedef of a struct, union, or enum
# is documented as struct, union, or enum with the name of the typedef. So
# typedef struct TypeS {} TypeT, will appear in the documentation as a struct
# with name TypeT. When disabled the typedef will appear as a member of a file,
# namespace, or class. And the struct will be named TypeS. This can typically
# be useful for C code in case the coding convention dictates that all compound
# types are typedef'ed and only the typedef is referenced, never the tag name.
TYPEDEF_HIDES_STRUCT = NO
# The SYMBOL_CACHE_SIZE determines the size of the internal cache use to
# determine which symbols to keep in memory and which to flush to disk.
# When the cache is full, less often used symbols will be written to disk.
# For small to medium size projects (<1000 input files) the default value is
# probably good enough. For larger projects a too small cache size can cause
# doxygen to be busy swapping symbols to and from disk most of the time
-# causing a significant performance penality.
+# causing a significant performance penalty.
# If the system has enough physical memory increasing the cache will improve the
# performance by keeping more symbols in memory. Note that the value works on
-# a logarithmic scale so increasing the size by one will rougly double the
+# a logarithmic scale so increasing the size by one will roughly double the
# memory usage. The cache size is given by this formula:
# 2^(16+SYMBOL_CACHE_SIZE). The valid range is 0..9, the default is 0,
# corresponding to a cache size of 2^16 = 65536 symbols
SYMBOL_CACHE_SIZE = 0
#---------------------------------------------------------------------------
# Build related configuration options
#---------------------------------------------------------------------------
# If the EXTRACT_ALL tag is set to YES doxygen will assume all entities in
# documentation are documented, even if no documentation was available.
# Private class members and static file members will be hidden unless
# the EXTRACT_PRIVATE and EXTRACT_STATIC tags are set to YES
EXTRACT_ALL = YES
# If the EXTRACT_PRIVATE tag is set to YES all private members of a class
# will be included in the documentation.
EXTRACT_PRIVATE = NO
# If the EXTRACT_STATIC tag is set to YES all static members of a file
# will be included in the documentation.
EXTRACT_STATIC = YES
# If the EXTRACT_LOCAL_CLASSES tag is set to YES classes (and structs)
# defined locally in source files will be included in the documentation.
# If set to NO only classes defined in header files are included.
-EXTRACT_LOCAL_CLASSES = YES
+EXTRACT_LOCAL_CLASSES = NO
# This flag is only useful for Objective-C code. When set to YES local
# methods, which are defined in the implementation section but not in
# the interface are included in the documentation.
# If set to NO (the default) only methods in the interface are included.
EXTRACT_LOCAL_METHODS = NO
# If this flag is set to YES, the members of anonymous namespaces will be
# extracted and appear in the documentation as a namespace called
# 'anonymous_namespace{file}', where file will be replaced with the base
# name of the file that contains the anonymous namespace. By default
-# anonymous namespace are hidden.
+# anonymous namespaces are hidden.
EXTRACT_ANON_NSPACES = NO
# If the HIDE_UNDOC_MEMBERS tag is set to YES, Doxygen will hide all
# undocumented members of documented classes, files or namespaces.
# If set to NO (the default) these members will be included in the
# various overviews, but no documentation section is generated.
# This option has no effect if EXTRACT_ALL is enabled.
HIDE_UNDOC_MEMBERS = NO
# If the HIDE_UNDOC_CLASSES tag is set to YES, Doxygen will hide all
# undocumented classes that are normally visible in the class hierarchy.
# If set to NO (the default) these classes will be included in the various
# overviews. This option has no effect if EXTRACT_ALL is enabled.
HIDE_UNDOC_CLASSES = NO
# If the HIDE_FRIEND_COMPOUNDS tag is set to YES, Doxygen will hide all
# friend (class|struct|union) declarations.
# If set to NO (the default) these declarations will be included in the
# documentation.
HIDE_FRIEND_COMPOUNDS = NO
# If the HIDE_IN_BODY_DOCS tag is set to YES, Doxygen will hide any
# documentation blocks found inside the body of a function.
# If set to NO (the default) these blocks will be appended to the
# function's detailed documentation block.
HIDE_IN_BODY_DOCS = NO
# The INTERNAL_DOCS tag determines if documentation
# that is typed after a \internal command is included. If the tag is set
# to NO (the default) then the documentation will be excluded.
# Set it to YES to include the internal documentation.
INTERNAL_DOCS = NO
# If the CASE_SENSE_NAMES tag is set to NO then Doxygen will only generate
# file names in lower-case letters. If set to YES upper-case letters are also
# allowed. This is useful if you have classes or files whose names only differ
# in case and if your file system supports case sensitive file names. Windows
# and Mac users are advised to set this option to NO.
CASE_SENSE_NAMES = YES
# If the HIDE_SCOPE_NAMES tag is set to NO (the default) then Doxygen
# will show members with their full class and namespace scopes in the
# documentation. If set to YES the scope will be hidden.
HIDE_SCOPE_NAMES = NO
# If the SHOW_INCLUDE_FILES tag is set to YES (the default) then Doxygen
# will put a list of the files that are included by a file in the documentation
# of that file.
SHOW_INCLUDE_FILES = YES
# If the FORCE_LOCAL_INCLUDES tag is set to YES then Doxygen
# will list include files with double quotes in the documentation
# rather than with sharp brackets.
FORCE_LOCAL_INCLUDES = NO
# If the INLINE_INFO tag is set to YES (the default) then a tag [inline]
# is inserted in the documentation for inline members.
INLINE_INFO = YES
# If the SORT_MEMBER_DOCS tag is set to YES (the default) then doxygen
# will sort the (detailed) documentation of file and class members
# alphabetically by member name. If set to NO the members will appear in
# declaration order.
SORT_MEMBER_DOCS = YES
# If the SORT_BRIEF_DOCS tag is set to YES then doxygen will sort the
# brief documentation of file, namespace and class members alphabetically
# by member name. If set to NO (the default) the members will appear in
# declaration order.
SORT_BRIEF_DOCS = NO
# If the SORT_MEMBERS_CTORS_1ST tag is set to YES then doxygen
# will sort the (brief and detailed) documentation of class members so that
# constructors and destructors are listed first. If set to NO (the default)
# the constructors will appear in the respective orders defined by
# SORT_MEMBER_DOCS and SORT_BRIEF_DOCS.
# This tag will be ignored for brief docs if SORT_BRIEF_DOCS is set to NO
# and ignored for detailed docs if SORT_MEMBER_DOCS is set to NO.
SORT_MEMBERS_CTORS_1ST = NO
# If the SORT_GROUP_NAMES tag is set to YES then doxygen will sort the
# hierarchy of group names into alphabetical order. If set to NO (the default)
# the group names will appear in their defined order.
SORT_GROUP_NAMES = NO
# If the SORT_BY_SCOPE_NAME tag is set to YES, the class list will be
# sorted by fully-qualified names, including namespaces. If set to
# NO (the default), the class list will be sorted only by class name,
# not including the namespace part.
# Note: This option is not very useful if HIDE_SCOPE_NAMES is set to YES.
# Note: This option applies only to the class list, not to the
# alphabetical list.
-SORT_BY_SCOPE_NAME = NO
+SORT_BY_SCOPE_NAME = YES
+
+# If the STRICT_PROTO_MATCHING option is enabled and doxygen fails to do proper type resolution of all parameters of a function it will reject a
+# match between the prototype and the implementation of a member function even if there is only one candidate or it is obvious which candidate to choose by doing a simple string match. By disabling STRICT_PROTO_MATCHING doxygen
+# will still accept a match between prototype and implementation in such cases.
+
+STRICT_PROTO_MATCHING = NO
# The GENERATE_TODOLIST tag can be used to enable (YES) or
# disable (NO) the todo list. This list is created by putting \todo
# commands in the documentation.
GENERATE_TODOLIST = YES
# The GENERATE_TESTLIST tag can be used to enable (YES) or
# disable (NO) the test list. This list is created by putting \test
# commands in the documentation.
GENERATE_TESTLIST = YES
# The GENERATE_BUGLIST tag can be used to enable (YES) or
# disable (NO) the bug list. This list is created by putting \bug
# commands in the documentation.
GENERATE_BUGLIST = YES
# The GENERATE_DEPRECATEDLIST tag can be used to enable (YES) or
# disable (NO) the deprecated list. This list is created by putting
# \deprecated commands in the documentation.
GENERATE_DEPRECATEDLIST= YES
# The ENABLED_SECTIONS tag can be used to enable conditional
# documentation sections, marked by \if sectionname ... \endif.
ENABLED_SECTIONS =
# The MAX_INITIALIZER_LINES tag determines the maximum number of lines
-# the initial value of a variable or define consists of for it to appear in
+# the initial value of a variable or macro consists of for it to appear in
# the documentation. If the initializer consists of more lines than specified
# here it will be hidden. Use a value of 0 to hide initializers completely.
-# The appearance of the initializer of individual variables and defines in the
+# The appearance of the initializer of individual variables and macros in the
# documentation can be controlled using \showinitializer or \hideinitializer
# command in the documentation regardless of this setting.
-MAX_INITIALIZER_LINES = 30
+MAX_INITIALIZER_LINES = 0
# Set the SHOW_USED_FILES tag to NO to disable the list of files generated
# at the bottom of the documentation of classes and structs. If set to YES the
# list will mention the files that were used to generate the documentation.
SHOW_USED_FILES = YES
# If the sources in your project are distributed over multiple directories
# then setting the SHOW_DIRECTORIES tag to YES will show the directory hierarchy
# in the documentation. The default is NO.
SHOW_DIRECTORIES = NO
# Set the SHOW_FILES tag to NO to disable the generation of the Files page.
# This will remove the Files entry from the Quick Index and from the
# Folder Tree View (if specified). The default is YES.
SHOW_FILES = YES
# Set the SHOW_NAMESPACES tag to NO to disable the generation of the
# Namespaces page.
# This will remove the Namespaces entry from the Quick Index
# and from the Folder Tree View (if specified). The default is YES.
SHOW_NAMESPACES = YES
# The FILE_VERSION_FILTER tag can be used to specify a program or script that
# doxygen should invoke to get the current version for each file (typically from
# the version control system). Doxygen will invoke the program by executing (via
# popen()) the command <command> <input-file>, where <command> is the value of
# the FILE_VERSION_FILTER tag, and <input-file> is the name of an input file
# provided by doxygen. Whatever the program writes to standard output
# is used as the file version. See the manual for examples.
FILE_VERSION_FILTER =
# The LAYOUT_FILE tag can be used to specify a layout file which will be parsed
# by doxygen. The layout file controls the global structure of the generated
# output files in an output format independent way. The create the layout file
# that represents doxygen's defaults, run doxygen with the -l option.
# You can optionally specify a file name after the option, if omitted
# DoxygenLayout.xml will be used as the name of the layout file.
LAYOUT_FILE =
#---------------------------------------------------------------------------
# configuration options related to warning and progress messages
#---------------------------------------------------------------------------
# The QUIET tag can be used to turn on/off the messages that are generated
# by doxygen. Possible values are YES and NO. If left blank NO is used.
QUIET = NO
# The WARNINGS tag can be used to turn on/off the warning messages that are
# generated by doxygen. Possible values are YES and NO. If left blank
# NO is used.
WARNINGS = YES
# If WARN_IF_UNDOCUMENTED is set to YES, then doxygen will generate warnings
# for undocumented members. If EXTRACT_ALL is set to YES then this flag will
# automatically be disabled.
WARN_IF_UNDOCUMENTED = YES
# If WARN_IF_DOC_ERROR is set to YES, doxygen will generate warnings for
# potential errors in the documentation, such as not documenting some
# parameters in a documented function, or documenting parameters that
# don't exist or using markup commands wrongly.
WARN_IF_DOC_ERROR = YES
-# This WARN_NO_PARAMDOC option can be abled to get warnings for
+# The WARN_NO_PARAMDOC option can be enabled to get warnings for
# functions that are documented, but have no documentation for their parameters
# or return value. If set to NO (the default) doxygen will only warn about
# wrong or incomplete parameter documentation, but not about the absence of
# documentation.
WARN_NO_PARAMDOC = NO
# The WARN_FORMAT tag determines the format of the warning messages that
# doxygen can produce. The string should contain the $file, $line, and $text
# tags, which will be replaced by the file and line number from which the
# warning originated and the warning text. Optionally the format may contain
# $version, which will be replaced by the version of the file (if it could
# be obtained via FILE_VERSION_FILTER)
WARN_FORMAT = "$file:$line: $text"
# The WARN_LOGFILE tag can be used to specify a file to which warning
# and error messages should be written. If left blank the output is written
# to stderr.
WARN_LOGFILE =
#---------------------------------------------------------------------------
# configuration options related to the input files
#---------------------------------------------------------------------------
# The INPUT tag can be used to specify the files and/or directories that contain
# documented source files. You may enter file names like "myfile.cpp" or
# directories like "/usr/src/myproject". Separate the files or directories
# with spaces.
INPUT = ./ \
@BLUEBERRY_SOURCE_DIR@/Documentation/ \
@_doxygen_bundles@ \
@_doxygen_qt4bundles@ \
@_doxygen_binary_bundles@ \
@_doxygen_binary_qt4bundles@
# This tag can be used to specify the character encoding of the source files
# that doxygen parses. Internally doxygen uses the UTF-8 encoding, which is
# also the default input encoding. Doxygen uses libiconv (or the iconv built
# into libc) for the transcoding. See http://www.gnu.org/software/libiconv for
# the list of possible encodings.
INPUT_ENCODING = UTF-8
# If the value of the INPUT tag contains directories, you can use the
# FILE_PATTERNS tag to specify one or more wildcard pattern (like *.cpp
# and *.h) to filter out the source-files in the directories. If left
# blank the following patterns are tested:
-# *.c *.cc *.cxx *.cpp *.c++ *.java *.ii *.ixx *.ipp *.i++ *.inl *.h *.hh *.hxx
-# *.hpp *.h++ *.idl *.odl *.cs *.php *.php3 *.inc *.m *.mm *.py *.f90
+# *.c *.cc *.cxx *.cpp *.c++ *.d *.java *.ii *.ixx *.ipp *.i++ *.inl *.h *.hh
+# *.hxx *.hpp *.h++ *.idl *.odl *.cs *.php *.php3 *.inc *.m *.mm *.dox *.py
+# *.f90 *.f *.for *.vhd *.vhdl
FILE_PATTERNS = *.h \
*.cpp \
*.dox \
*.txx \
*.cxx
# The RECURSIVE tag can be used to turn specify whether or not subdirectories
# should be searched for input files as well. Possible values are YES and NO.
# If left blank NO is used.
RECURSIVE = YES
# The EXCLUDE tag can be used to specify files and/or directories that should
# excluded from the INPUT source files. This way you can easily exclude a
# subdirectory from a directory tree whose root is specified with the INPUT tag.
EXCLUDE =
# The EXCLUDE_SYMLINKS tag can be used select whether or not files or
-# directories that are symbolic links (a Unix filesystem feature) are excluded
+# directories that are symbolic links (a Unix file system feature) are excluded
# from the input.
EXCLUDE_SYMLINKS = NO
# If the value of the INPUT tag contains directories, you can use the
# EXCLUDE_PATTERNS tag to specify one or more wildcard patterns to exclude
# certain files from those directories. Note that the wildcards are matched
# against the file with absolute path, so to exclude all test directories
# for example use the pattern */test/*
EXCLUDE_PATTERNS = moc_* \
Register*
# The EXCLUDE_SYMBOLS tag can be used to specify one or more symbol names
# (namespaces, classes, functions, etc.) that should be excluded from the
# output. The symbol name can be a fully qualified name, a word, or if the
# wildcard * is used, a substring. Examples: ANamespace, AClass,
# AClass::ANamespace, ANamespace::*Test
EXCLUDE_SYMBOLS =
# The EXAMPLE_PATH tag can be used to specify one or more files or
# directories that contain example code fragments that are included (see
# the \include command).
EXAMPLE_PATH =
# If the value of the EXAMPLE_PATH tag contains directories, you can use the
# EXAMPLE_PATTERNS tag to specify one or more wildcard pattern (like *.cpp
# and *.h) to filter out the source-files in the directories. If left
# blank all files are included.
EXAMPLE_PATTERNS =
# If the EXAMPLE_RECURSIVE tag is set to YES then subdirectories will be
# searched for input files to be used with the \include or \dontinclude
# commands irrespective of the value of the RECURSIVE tag.
# Possible values are YES and NO. If left blank NO is used.
EXAMPLE_RECURSIVE = NO
# The IMAGE_PATH tag can be used to specify one or more files or
# directories that contain image that are included in the documentation (see
# the \image command).
IMAGE_PATH = "@BLUEBERRY_SOURCE_DIR@"
# The INPUT_FILTER tag can be used to specify a program that doxygen should
# invoke to filter for each input file. Doxygen will invoke the filter program
# by executing (via popen()) the command <filter> <input-file>, where <filter>
# is the value of the INPUT_FILTER tag, and <input-file> is the name of an
# input file. Doxygen will then use the output that the filter program writes
# to standard output.
# If FILTER_PATTERNS is specified, this tag will be
# ignored.
INPUT_FILTER =
# The FILTER_PATTERNS tag can be used to specify filters on a per file pattern
# basis.
# Doxygen will compare the file name with each pattern and apply the
# filter if there is a match.
# The filters are a list of the form:
# pattern=filter (like *.cpp=my_cpp_filter). See INPUT_FILTER for further
-# info on how filters are used. If FILTER_PATTERNS is empty, INPUT_FILTER
-# is applied to all files.
+# info on how filters are used. If FILTER_PATTERNS is empty or if
+# non of the patterns match the file name, INPUT_FILTER is applied.
FILTER_PATTERNS =
# If the FILTER_SOURCE_FILES tag is set to YES, the input filter (if set using
# INPUT_FILTER) will be used to filter the input files when producing source
# files to browse (i.e. when SOURCE_BROWSER is set to YES).
FILTER_SOURCE_FILES = NO
+# The FILTER_SOURCE_PATTERNS tag can be used to specify source filters per file
+# pattern. A pattern will override the setting for FILTER_PATTERN (if any)
+# and it is also possible to disable source filtering for a specific pattern
+# using *.ext= (so without naming a filter). This option only has effect when
+# FILTER_SOURCE_FILES is enabled.
+
+FILTER_SOURCE_PATTERNS =
+
#---------------------------------------------------------------------------
# configuration options related to source browsing
#---------------------------------------------------------------------------
# If the SOURCE_BROWSER tag is set to YES then a list of source files will
# be generated. Documented entities will be cross-referenced with these sources.
# Note: To get rid of all source code in the generated output, make sure also
# VERBATIM_HEADERS is set to NO.
SOURCE_BROWSER = YES
# Setting the INLINE_SOURCES tag to YES will include the body
# of functions and classes directly in the documentation.
INLINE_SOURCES = YES
# Setting the STRIP_CODE_COMMENTS tag to YES (the default) will instruct
# doxygen to hide any special comment blocks from generated source code
# fragments. Normal C and C++ comments will always remain visible.
STRIP_CODE_COMMENTS = YES
# If the REFERENCED_BY_RELATION tag is set to YES
# then for each documented function all documented
# functions referencing it will be listed.
REFERENCED_BY_RELATION = YES
# If the REFERENCES_RELATION tag is set to YES
# then for each documented function all documented entities
# called/used by that function will be listed.
REFERENCES_RELATION = YES
# If the REFERENCES_LINK_SOURCE tag is set to YES (the default)
# and SOURCE_BROWSER tag is set to YES, then the hyperlinks from
# functions in REFERENCES_RELATION and REFERENCED_BY_RELATION lists will
# link to the source code.
# Otherwise they will link to the documentation.
REFERENCES_LINK_SOURCE = YES
# If the USE_HTAGS tag is set to YES then the references to source code
# will point to the HTML generated by the htags(1) tool instead of doxygen
# built-in source browser. The htags tool is part of GNU's global source
# tagging system (see http://www.gnu.org/software/global/global.html). You
# will need version 4.8.6 or higher.
USE_HTAGS = NO
# If the VERBATIM_HEADERS tag is set to YES (the default) then Doxygen
# will generate a verbatim copy of the header file for each class for
# which an include is specified. Set to NO to disable this.
VERBATIM_HEADERS = YES
#---------------------------------------------------------------------------
# configuration options related to the alphabetical class index
#---------------------------------------------------------------------------
# If the ALPHABETICAL_INDEX tag is set to YES, an alphabetical index
# of all compounds will be generated. Enable this if the project
# contains a lot of classes, structs, unions or interfaces.
ALPHABETICAL_INDEX = YES
# If the alphabetical index is enabled (see ALPHABETICAL_INDEX) then
# the COLS_IN_ALPHA_INDEX tag can be used to specify the number of columns
# in which this list will be split (can be a number in the range [1..20])
COLS_IN_ALPHA_INDEX = 3
# In case all classes in a project start with a common prefix, all
# classes will be put under the same header in the alphabetical index.
# The IGNORE_PREFIX tag can be used to specify one or more prefixes that
# should be ignored while generating the index headers.
IGNORE_PREFIX =
#---------------------------------------------------------------------------
# configuration options related to the HTML output
#---------------------------------------------------------------------------
# If the GENERATE_HTML tag is set to YES (the default) Doxygen will
# generate HTML output.
GENERATE_HTML = YES
# The HTML_OUTPUT tag is used to specify where the HTML docs will be put.
# If a relative path is entered the value of OUTPUT_DIRECTORY will be
# put in front of it. If left blank `html' will be used as the default path.
HTML_OUTPUT = html
# The HTML_FILE_EXTENSION tag can be used to specify the file extension for
# each generated HTML page (for example: .htm,.php,.asp). If it is left blank
# doxygen will generate files with .html extension.
HTML_FILE_EXTENSION = .html
# The HTML_HEADER tag can be used to specify a personal HTML header for
# each generated HTML page. If it is left blank doxygen will generate a
# standard header.
HTML_HEADER =
# The HTML_FOOTER tag can be used to specify a personal HTML footer for
# each generated HTML page. If it is left blank doxygen will generate a
# standard footer.
HTML_FOOTER =
# The HTML_STYLESHEET tag can be used to specify a user-defined cascading
# style sheet that is used by each HTML page. It can be used to
# fine-tune the look of the HTML output. If the tag is left blank doxygen
# will generate a default style sheet. Note that doxygen will try to copy
# the style sheet file to the HTML output directory, so don't put your own
# stylesheet in the HTML output directory as well, or it will be erased!
HTML_STYLESHEET =
# The HTML_COLORSTYLE_HUE tag controls the color of the HTML output.
# Doxygen will adjust the colors in the stylesheet and background images
# according to this color. Hue is specified as an angle on a colorwheel,
# see http://en.wikipedia.org/wiki/Hue for more information.
# For instance the value 0 represents red, 60 is yellow, 120 is green,
# 180 is cyan, 240 is blue, 300 purple, and 360 is red again.
# The allowed range is 0 to 359.
HTML_COLORSTYLE_HUE = 220
# The HTML_COLORSTYLE_SAT tag controls the purity (or saturation) of
# the colors in the HTML output. For a value of 0 the output will use
# grayscales only. A value of 255 will produce the most vivid colors.
HTML_COLORSTYLE_SAT = 100
# The HTML_COLORSTYLE_GAMMA tag controls the gamma correction applied to
# the luminance component of the colors in the HTML output. Values below
# 100 gradually make the output lighter, whereas values above 100 make
# the output darker. The value divided by 100 is the actual gamma applied,
# so 80 represents a gamma of 0.8, The value 220 represents a gamma of 2.2,
# and 100 does not change the gamma.
HTML_COLORSTYLE_GAMMA = 80
# If the HTML_TIMESTAMP tag is set to YES then the footer of each generated HTML
# page will contain the date and time when the page was generated. Setting
# this to NO can help when comparing the output of multiple runs.
HTML_TIMESTAMP = YES
# If the HTML_ALIGN_MEMBERS tag is set to YES, the members of classes,
# files or namespaces will be aligned in HTML using tables. If set to
# NO a bullet list will be used.
HTML_ALIGN_MEMBERS = YES
# If the HTML_DYNAMIC_SECTIONS tag is set to YES then the generated HTML
# documentation will contain sections that can be hidden and shown after the
# page has loaded. For this to work a browser that supports
# JavaScript and DHTML is required (for instance Mozilla 1.0+, Firefox
# Netscape 6.0+, Internet explorer 5.0+, Konqueror, or Safari).
HTML_DYNAMIC_SECTIONS = NO
# If the GENERATE_DOCSET tag is set to YES, additional index files
# will be generated that can be used as input for Apple's Xcode 3
# integrated development environment, introduced with OSX 10.5 (Leopard).
# To create a documentation set, doxygen will generate a Makefile in the
# HTML output directory. Running make will produce the docset in that
# directory and running "make install" will install the docset in
# ~/Library/Developer/Shared/Documentation/DocSets so that Xcode will find
# it at startup.
# See http://developer.apple.com/tools/creatingdocsetswithdoxygen.html
# for more information.
GENERATE_DOCSET = NO
# When GENERATE_DOCSET tag is set to YES, this tag determines the name of the
# feed. A documentation feed provides an umbrella under which multiple
# documentation sets from a single provider (such as a company or product suite)
# can be grouped.
DOCSET_FEEDNAME = "Doxygen generated docs"
# When GENERATE_DOCSET tag is set to YES, this tag specifies a string that
# should uniquely identify the documentation set bundle. This should be a
# reverse domain-name style string, e.g. com.mycompany.MyDocSet. Doxygen
# will append .docset to the name.
DOCSET_BUNDLE_ID = org.doxygen.Project
# When GENERATE_PUBLISHER_ID tag specifies a string that should uniquely identify
# the documentation publisher. This should be a reverse domain-name style
# string, e.g. com.mycompany.MyDocSet.documentation.
DOCSET_PUBLISHER_ID = org.doxygen.Publisher
# The GENERATE_PUBLISHER_NAME tag identifies the documentation publisher.
DOCSET_PUBLISHER_NAME = Publisher
# If the GENERATE_HTMLHELP tag is set to YES, additional index files
# will be generated that can be used as input for tools like the
# Microsoft HTML help workshop to generate a compiled HTML help file (.chm)
# of the generated HTML documentation.
GENERATE_HTMLHELP = NO
# If the GENERATE_HTMLHELP tag is set to YES, the CHM_FILE tag can
# be used to specify the file name of the resulting .chm file. You
# can add a path in front of the file if the result should not be
# written to the html output directory.
CHM_FILE =
# If the GENERATE_HTMLHELP tag is set to YES, the HHC_LOCATION tag can
# be used to specify the location (absolute path including file name) of
# the HTML help compiler (hhc.exe). If non-empty doxygen will try to run
# the HTML help compiler on the generated index.hhp.
HHC_LOCATION =
# If the GENERATE_HTMLHELP tag is set to YES, the GENERATE_CHI flag
# controls if a separate .chi index file is generated (YES) or that
# it should be included in the master .chm file (NO).
GENERATE_CHI = NO
# If the GENERATE_HTMLHELP tag is set to YES, the CHM_INDEX_ENCODING
# is used to encode HtmlHelp index (hhk), content (hhc) and project file
# content.
CHM_INDEX_ENCODING =
# If the GENERATE_HTMLHELP tag is set to YES, the BINARY_TOC flag
# controls whether a binary table of contents is generated (YES) or a
# normal table of contents (NO) in the .chm file.
BINARY_TOC = NO
# The TOC_EXPAND flag can be set to YES to add extra items for group members
# to the contents of the HTML help documentation and to the tree view.
TOC_EXPAND = NO
# If the GENERATE_QHP tag is set to YES and both QHP_NAMESPACE and
# QHP_VIRTUAL_FOLDER are set, an additional index file will be generated
# that can be used as input for Qt's qhelpgenerator to generate a
# Qt Compressed Help (.qch) of the generated HTML documentation.
GENERATE_QHP = NO
# If the QHG_LOCATION tag is specified, the QCH_FILE tag can
# be used to specify the file name of the resulting .qch file.
# The path specified is relative to the HTML output folder.
QCH_FILE =
# The QHP_NAMESPACE tag specifies the namespace to use when generating
# Qt Help Project output. For more information please see
# http://doc.trolltech.com/qthelpproject.html#namespace
QHP_NAMESPACE = org.doxygen.Project
# The QHP_VIRTUAL_FOLDER tag specifies the namespace to use when generating
# Qt Help Project output. For more information please see
# http://doc.trolltech.com/qthelpproject.html#virtual-folders
QHP_VIRTUAL_FOLDER = doc
# If QHP_CUST_FILTER_NAME is set, it specifies the name of a custom filter to
# add. For more information please see
# http://doc.trolltech.com/qthelpproject.html#custom-filters
QHP_CUST_FILTER_NAME =
# The QHP_CUST_FILT_ATTRS tag specifies the list of the attributes of the
# custom filter to add. For more information please see
# <a href="http://doc.trolltech.com/qthelpproject.html#custom-filters">
# Qt Help Project / Custom Filters</a>.
QHP_CUST_FILTER_ATTRS =
# The QHP_SECT_FILTER_ATTRS tag specifies the list of the attributes this
# project's
# filter section matches.
# <a href="http://doc.trolltech.com/qthelpproject.html#filter-attributes">
# Qt Help Project / Filter Attributes</a>.
QHP_SECT_FILTER_ATTRS =
# If the GENERATE_QHP tag is set to YES, the QHG_LOCATION tag can
# be used to specify the location of Qt's qhelpgenerator.
# If non-empty doxygen will try to run qhelpgenerator on the generated
# .qhp file.
QHG_LOCATION =
# If the GENERATE_ECLIPSEHELP tag is set to YES, additional index files
# will be generated, which together with the HTML files, form an Eclipse help
# plugin. To install this plugin and make it available under the help contents
# menu in Eclipse, the contents of the directory containing the HTML and XML
# files needs to be copied into the plugins directory of eclipse. The name of
# the directory within the plugins directory should be the same as
# the ECLIPSE_DOC_ID value. After copying Eclipse needs to be restarted before
# the help appears.
GENERATE_ECLIPSEHELP = NO
# A unique identifier for the eclipse help plugin. When installing the plugin
# the directory name containing the HTML and XML files should also have
# this name.
ECLIPSE_DOC_ID = org.doxygen.Project
# The DISABLE_INDEX tag can be used to turn on/off the condensed index at
# top of each HTML page. The value NO (the default) enables the index and
# the value YES disables it.
DISABLE_INDEX = NO
-# This tag can be used to set the number of enum values (range [1..20])
+# This tag can be used to set the number of enum values (range [0,1..20])
# that doxygen will group on one line in the generated HTML documentation.
+# Note that a value of 0 will completely suppress the enum values from appearing in the overview section.
ENUM_VALUES_PER_LINE = 4
# The GENERATE_TREEVIEW tag is used to specify whether a tree-like index
# structure should be generated to display hierarchical information.
# If the tag value is set to YES, a side panel will be generated
# containing a tree-like index structure (just like the one that
# is generated for HTML Help). For this to work a browser that supports
# JavaScript, DHTML, CSS and frames is required (i.e. any modern browser).
# Windows users are probably better off using the HTML help feature.
GENERATE_TREEVIEW = NO
# By enabling USE_INLINE_TREES, doxygen will generate the Groups, Directories,
# and Class Hierarchy pages using a tree view instead of an ordered list.
USE_INLINE_TREES = NO
# If the treeview is enabled (see GENERATE_TREEVIEW) then this tag can be
# used to set the initial width (in pixels) of the frame in which the tree
# is shown.
TREEVIEW_WIDTH = 250
# When the EXT_LINKS_IN_WINDOW option is set to YES doxygen will open
# links to external symbols imported via tag files in a separate window.
EXT_LINKS_IN_WINDOW = NO
# Use this tag to change the font size of Latex formulas included
# as images in the HTML documentation. The default is 10. Note that
# when you change the font size after a successful doxygen run you need
# to manually remove any form_*.png images from the HTML output directory
# to force them to be regenerated.
FORMULA_FONTSIZE = 10
# Use the FORMULA_TRANPARENT tag to determine whether or not the images
# generated for formulas are transparent PNGs. Transparent PNGs are
# not supported properly for IE 6.0, but are supported on all modern browsers.
# Note that when changing this option you need to delete any form_*.png files
# in the HTML output before the changes have effect.
FORMULA_TRANSPARENT = YES
+# Enable the USE_MATHJAX option to render LaTeX formulas using MathJax
+# (see http://www.mathjax.org) which uses client side Javascript for the
+# rendering instead of using prerendered bitmaps. Use this if you do not
+# have LaTeX installed or if you want to formulas look prettier in the HTML
+# output. When enabled you also need to install MathJax separately and
+# configure the path to it using the MATHJAX_RELPATH option.
+
+USE_MATHJAX = NO
+
+# When MathJax is enabled you need to specify the location relative to the
+# HTML output directory using the MATHJAX_RELPATH option. The destination
+# directory should contain the MathJax.js script. For instance, if the mathjax
+# directory is located at the same level as the HTML output directory, then
+# MATHJAX_RELPATH should be ../mathjax. The default value points to the mathjax.org site, so you can quickly see the result without installing
+# MathJax, but it is strongly recommended to install a local copy of MathJax
+# before deployment.
+
+MATHJAX_RELPATH = http://www.mathjax.org/mathjax
+
# When the SEARCHENGINE tag is enabled doxygen will generate a search box
# for the HTML output. The underlying search engine uses javascript
# and DHTML and should work on any modern browser. Note that when using
# HTML help (GENERATE_HTMLHELP), Qt help (GENERATE_QHP), or docsets
# (GENERATE_DOCSET) there is already a search function so this one should
# typically be disabled. For large projects the javascript based search engine
# can be slow, then enabling SERVER_BASED_SEARCH may provide a better solution.
SEARCHENGINE = YES
# When the SERVER_BASED_SEARCH tag is enabled the search engine will be
# implemented using a PHP enabled web server instead of at the web client
# using Javascript. Doxygen will generate the search PHP script and index
# file to put on the web server. The advantage of the server
# based approach is that it scales better to large projects and allows
-# full text search. The disadvances is that it is more difficult to setup
+# full text search. The disadvantages are that it is more difficult to setup
# and does not have live searching capabilities.
SERVER_BASED_SEARCH = NO
#---------------------------------------------------------------------------
# configuration options related to the LaTeX output
#---------------------------------------------------------------------------
# If the GENERATE_LATEX tag is set to YES (the default) Doxygen will
# generate Latex output.
GENERATE_LATEX = NO
# The LATEX_OUTPUT tag is used to specify where the LaTeX docs will be put.
# If a relative path is entered the value of OUTPUT_DIRECTORY will be
# put in front of it. If left blank `latex' will be used as the default path.
LATEX_OUTPUT = latex
# The LATEX_CMD_NAME tag can be used to specify the LaTeX command name to be
# invoked. If left blank `latex' will be used as the default command name.
# Note that when enabling USE_PDFLATEX this option is only used for
# generating bitmaps for formulas in the HTML output, but not in the
# Makefile that is written to the output directory.
LATEX_CMD_NAME = latex
# The MAKEINDEX_CMD_NAME tag can be used to specify the command name to
# generate index for LaTeX. If left blank `makeindex' will be used as the
# default command name.
MAKEINDEX_CMD_NAME = makeindex
# If the COMPACT_LATEX tag is set to YES Doxygen generates more compact
# LaTeX documents. This may be useful for small projects and may help to
# save some trees in general.
COMPACT_LATEX = NO
# The PAPER_TYPE tag can be used to set the paper type that is used
-# by the printer. Possible values are: a4, a4wide, letter, legal and
+# by the printer. Possible values are: a4, letter, legal and
# executive. If left blank a4wide will be used.
PAPER_TYPE = a4wide
# The EXTRA_PACKAGES tag can be to specify one or more names of LaTeX
# packages that should be included in the LaTeX output.
EXTRA_PACKAGES =
# The LATEX_HEADER tag can be used to specify a personal LaTeX header for
# the generated latex document. The header should contain everything until
# the first chapter. If it is left blank doxygen will generate a
# standard header. Notice: only use this tag if you know what you are doing!
LATEX_HEADER =
# If the PDF_HYPERLINKS tag is set to YES, the LaTeX that is generated
# is prepared for conversion to pdf (using ps2pdf). The pdf file will
# contain links (just like the HTML output) instead of page references
# This makes the output suitable for online browsing using a pdf viewer.
PDF_HYPERLINKS = NO
# If the USE_PDFLATEX tag is set to YES, pdflatex will be used instead of
# plain latex in the generated Makefile. Set this option to YES to get a
# higher quality PDF documentation.
USE_PDFLATEX = NO
# If the LATEX_BATCHMODE tag is set to YES, doxygen will add the \\batchmode.
# command to the generated LaTeX files. This will instruct LaTeX to keep
# running if errors occur, instead of asking the user for help.
# This option is also used when generating formulas in HTML.
LATEX_BATCHMODE = NO
# If LATEX_HIDE_INDICES is set to YES then doxygen will not
# include the index chapters (such as File Index, Compound Index, etc.)
# in the output.
LATEX_HIDE_INDICES = NO
# If LATEX_SOURCE_CODE is set to YES then doxygen will include
# source code with syntax highlighting in the LaTeX output.
# Note that which sources are shown also depends on other settings
# such as SOURCE_BROWSER.
LATEX_SOURCE_CODE = NO
#---------------------------------------------------------------------------
# configuration options related to the RTF output
#---------------------------------------------------------------------------
# If the GENERATE_RTF tag is set to YES Doxygen will generate RTF output
# The RTF output is optimized for Word 97 and may not look very pretty with
# other RTF readers or editors.
GENERATE_RTF = NO
# The RTF_OUTPUT tag is used to specify where the RTF docs will be put.
# If a relative path is entered the value of OUTPUT_DIRECTORY will be
# put in front of it. If left blank `rtf' will be used as the default path.
RTF_OUTPUT = rtf
# If the COMPACT_RTF tag is set to YES Doxygen generates more compact
# RTF documents. This may be useful for small projects and may help to
# save some trees in general.
COMPACT_RTF = NO
# If the RTF_HYPERLINKS tag is set to YES, the RTF that is generated
# will contain hyperlink fields. The RTF file will
# contain links (just like the HTML output) instead of page references.
# This makes the output suitable for online browsing using WORD or other
# programs which support those fields.
# Note: wordpad (write) and others do not support links.
RTF_HYPERLINKS = NO
# Load stylesheet definitions from file. Syntax is similar to doxygen's
# config file, i.e. a series of assignments. You only have to provide
# replacements, missing definitions are set to their default value.
RTF_STYLESHEET_FILE =
# Set optional variables used in the generation of an rtf document.
# Syntax is similar to doxygen's config file.
RTF_EXTENSIONS_FILE =
#---------------------------------------------------------------------------
# configuration options related to the man page output
#---------------------------------------------------------------------------
# If the GENERATE_MAN tag is set to YES (the default) Doxygen will
# generate man pages
GENERATE_MAN = NO
# The MAN_OUTPUT tag is used to specify where the man pages will be put.
# If a relative path is entered the value of OUTPUT_DIRECTORY will be
# put in front of it. If left blank `man' will be used as the default path.
MAN_OUTPUT = man
# The MAN_EXTENSION tag determines the extension that is added to
# the generated man pages (default is the subroutine's section .3)
MAN_EXTENSION = .3
# If the MAN_LINKS tag is set to YES and Doxygen generates man output,
# then it will generate one additional man file for each entity
# documented in the real man page(s). These additional files
# only source the real man page, but without them the man command
# would be unable to find the correct page. The default is NO.
MAN_LINKS = NO
#---------------------------------------------------------------------------
# configuration options related to the XML output
#---------------------------------------------------------------------------
# If the GENERATE_XML tag is set to YES Doxygen will
# generate an XML file that captures the structure of
# the code including all documentation.
GENERATE_XML = NO
# The XML_OUTPUT tag is used to specify where the XML pages will be put.
# If a relative path is entered the value of OUTPUT_DIRECTORY will be
# put in front of it. If left blank `xml' will be used as the default path.
XML_OUTPUT = xml
# The XML_SCHEMA tag can be used to specify an XML schema,
# which can be used by a validating XML parser to check the
# syntax of the XML files.
XML_SCHEMA =
# The XML_DTD tag can be used to specify an XML DTD,
# which can be used by a validating XML parser to check the
# syntax of the XML files.
XML_DTD =
# If the XML_PROGRAMLISTING tag is set to YES Doxygen will
# dump the program listings (including syntax highlighting
# and cross-referencing information) to the XML output. Note that
# enabling this will significantly increase the size of the XML output.
XML_PROGRAMLISTING = YES
#---------------------------------------------------------------------------
# configuration options for the AutoGen Definitions output
#---------------------------------------------------------------------------
# If the GENERATE_AUTOGEN_DEF tag is set to YES Doxygen will
# generate an AutoGen Definitions (see autogen.sf.net) file
# that captures the structure of the code including all
# documentation. Note that this feature is still experimental
# and incomplete at the moment.
GENERATE_AUTOGEN_DEF = NO
#---------------------------------------------------------------------------
# configuration options related to the Perl module output
#---------------------------------------------------------------------------
# If the GENERATE_PERLMOD tag is set to YES Doxygen will
# generate a Perl module file that captures the structure of
# the code including all documentation. Note that this
# feature is still experimental and incomplete at the
# moment.
GENERATE_PERLMOD = NO
# If the PERLMOD_LATEX tag is set to YES Doxygen will generate
# the necessary Makefile rules, Perl scripts and LaTeX code to be able
# to generate PDF and DVI output from the Perl module output.
PERLMOD_LATEX = NO
# If the PERLMOD_PRETTY tag is set to YES the Perl module output will be
# nicely formatted so it can be parsed by a human reader.
# This is useful
# if you want to understand what is going on.
# On the other hand, if this
# tag is set to NO the size of the Perl module output will be much smaller
# and Perl will parse it just the same.
PERLMOD_PRETTY = YES
# The names of the make variables in the generated doxyrules.make file
# are prefixed with the string contained in PERLMOD_MAKEVAR_PREFIX.
# This is useful so different doxyrules.make files included by the same
# Makefile don't overwrite each other's variables.
PERLMOD_MAKEVAR_PREFIX =
#---------------------------------------------------------------------------
# Configuration options related to the preprocessor
#---------------------------------------------------------------------------
# If the ENABLE_PREPROCESSING tag is set to YES (the default) Doxygen will
# evaluate all C-preprocessor directives found in the sources and include
# files.
ENABLE_PREPROCESSING = YES
# If the MACRO_EXPANSION tag is set to YES Doxygen will expand all macro
# names in the source code. If set to NO (the default) only conditional
# compilation will be performed. Macro expansion can be done in a controlled
# way by setting EXPAND_ONLY_PREDEF to YES.
MACRO_EXPANSION = YES
# If the EXPAND_ONLY_PREDEF and MACRO_EXPANSION tags are both set to YES
# then the macro expansion is limited to the macros specified with the
# PREDEFINED and EXPAND_AS_DEFINED tags.
EXPAND_ONLY_PREDEF = NO
# If the SEARCH_INCLUDES tag is set to YES (the default) the includes files
# in the INCLUDE_PATH (see below) will be search if a #include is found.
SEARCH_INCLUDES = YES
# The INCLUDE_PATH tag can be used to specify one or more directories that
# contain include files that are not input files but should be processed by
# the preprocessor.
INCLUDE_PATH =
# You can use the INCLUDE_FILE_PATTERNS tag to specify one or more wildcard
# patterns (like *.h and *.hpp) to filter out the header-files in the
# directories. If left blank, the patterns specified with FILE_PATTERNS will
# be used.
INCLUDE_FILE_PATTERNS =
# The PREDEFINED tag can be used to specify one or more macro names that
# are defined before the preprocessor is started (similar to the -D option of
# gcc). The argument of the tag is a list of macros of the form: name
# or name=definition (no spaces). If the definition and the = are
# omitted =1 is assumed. To prevent a macro definition from being
# undefined via #undef or recursively expanded use the := operator
# instead of the = operator.
PREDEFINED = FREEVERSION \
ERROR_CHECKING \
HAS_TIFF \
HAS_JPEG \
HAS_NETLIB \
HAS_PNG \
HAS_ZLIB \
HAS_GLUT \
HAS_QT \
size_t=vcl_size_t \
DOXYGEN_SKIP
# If the MACRO_EXPANSION and EXPAND_ONLY_PREDEF tags are set to YES then
# this tag can be used to specify a list of macro names that should be expanded.
# The macro definition that is found in the sources will be used.
-# Use the PREDEFINED tag if you want to use a different macro definition.
+# Use the PREDEFINED tag if you want to use a different macro definition that overrules the definition found in the source code.
EXPAND_AS_DEFINED =
# If the SKIP_FUNCTION_MACROS tag is set to YES (the default) then
-# doxygen's preprocessor will remove all function-like macros that are alone
-# on a line, have an all uppercase name, and do not end with a semicolon. Such
-# function macros are typically used for boiler-plate code, and will confuse
-# the parser if not removed.
+# doxygen's preprocessor will remove all references to function-like macros
+# that are alone on a line, have an all uppercase name, and do not end with a
+# semicolon, because these will confuse the parser if not removed.
SKIP_FUNCTION_MACROS = YES
#---------------------------------------------------------------------------
# Configuration::additions related to external references
#---------------------------------------------------------------------------
# The TAGFILES option can be used to specify one or more tagfiles.
# Optionally an initial location of the external documentation
# can be added for each tagfile. The format of a tag file without
# this location is as follows:
#
# TAGFILES = file1 file2 ...
# Adding location for the tag files is done as follows:
#
# TAGFILES = file1=loc1 "file2 = loc2" ...
# where "loc1" and "loc2" can be relative or absolute paths or
# URLs. If a location is present for each tag, the installdox tool
# does not have to be run to correct the links.
# Note that each tag file must have a unique name
# (where the name does NOT include the path)
# If a tag file is not located in the directory in which doxygen
# is run, you must also specify the path to the tagfile here.
TAGFILES =
# When a file name is specified after GENERATE_TAGFILE, doxygen will create
# a tag file that is based on the input files it reads.
GENERATE_TAGFILE = "@BLUEBERRY_DOXYGEN_TAGFILE_NAME@"
# If the ALLEXTERNALS tag is set to YES all external classes will be listed
# in the class index. If set to NO only the inherited external classes
# will be listed.
ALLEXTERNALS = NO
# If the EXTERNAL_GROUPS tag is set to YES all external groups will be listed
# in the modules index. If set to NO, only the current project's groups will
# be listed.
EXTERNAL_GROUPS = YES
# The PERL_PATH should be the absolute path and name of the perl script
# interpreter (i.e. the result of `which perl').
PERL_PATH = /usr/bin/perl
#---------------------------------------------------------------------------
# Configuration options related to the dot tool
#---------------------------------------------------------------------------
# If the CLASS_DIAGRAMS tag is set to YES (the default) Doxygen will
# generate a inheritance diagram (in HTML, RTF and LaTeX) for classes with base
# or super classes. Setting the tag to NO turns the diagrams off. Note that
-# this option is superseded by the HAVE_DOT option below. This is only a
-# fallback. It is recommended to install and use dot, since it yields more
-# powerful graphs.
+# this option also works with HAVE_DOT disabled, but it is recommended to
+# install and use dot, since it yields more powerful graphs.
CLASS_DIAGRAMS = YES
# You can define message sequence charts within doxygen comments using the \msc
# command. Doxygen will then run the mscgen tool (see
# http://www.mcternan.me.uk/mscgen/) to produce the chart and insert it in the
# documentation. The MSCGEN_PATH tag allows you to specify the directory where
# the mscgen tool resides. If left empty the tool is assumed to be found in the
# default search path.
MSCGEN_PATH =
# If set to YES, the inheritance and collaboration graphs will hide
# inheritance and usage relations if the target is undocumented
# or is not a class.
HIDE_UNDOC_RELATIONS = YES
# If you set the HAVE_DOT tag to YES then doxygen will assume the dot tool is
# available from the path. This tool is part of Graphviz, a graph visualization
# toolkit from AT&T and Lucent Bell Labs. The other options in this section
# have no effect if this option is set to NO (the default)
HAVE_DOT = @HAVE_DOT@
# The DOT_NUM_THREADS specifies the number of dot invocations doxygen is
# allowed to run in parallel. When set to 0 (the default) doxygen will
# base this on the number of processors available in the system. You can set it
# explicitly to a value larger than 0 to get control over the balance
# between CPU load and processing speed.
DOT_NUM_THREADS = 0
-# By default doxygen will write a font called FreeSans.ttf to the output
-# directory and reference it in all dot files that doxygen generates. This
-# font does not include all possible unicode characters however, so when you need
-# these (or just want a differently looking font) you can specify the font name
-# using DOT_FONTNAME. You need need to make sure dot is able to find the font,
+# By default doxygen will write a font called Helvetica to the output
+# directory and reference it in all dot files that doxygen generates.
+# When you want a differently looking font you can specify the font name
+# using DOT_FONTNAME. You need to make sure dot is able to find the font,
# which can be done by putting it in a standard location or by setting the
# DOTFONTPATH environment variable or by setting DOT_FONTPATH to the directory
# containing the font.
DOT_FONTNAME = FreeSans.ttf
# The DOT_FONTSIZE tag can be used to set the size of the font of dot graphs.
# The default size is 10pt.
DOT_FONTSIZE = 10
# By default doxygen will tell dot to use the output directory to look for the
# FreeSans.ttf font (which doxygen will put there itself). If you specify a
# different font using DOT_FONTNAME you can set the path where dot
# can find it using this tag.
DOT_FONTPATH =
# If the CLASS_GRAPH and HAVE_DOT tags are set to YES then doxygen
# will generate a graph for each documented class showing the direct and
# indirect inheritance relations. Setting this tag to YES will force the
# the CLASS_DIAGRAMS tag to NO.
CLASS_GRAPH = YES
# If the COLLABORATION_GRAPH and HAVE_DOT tags are set to YES then doxygen
# will generate a graph for each documented class showing the direct and
# indirect implementation dependencies (inheritance, containment, and
# class references variables) of the class with other documented classes.
COLLABORATION_GRAPH = YES
# If the GROUP_GRAPHS and HAVE_DOT tags are set to YES then doxygen
# will generate a graph for groups, showing the direct groups dependencies
GROUP_GRAPHS = YES
# If the UML_LOOK tag is set to YES doxygen will generate inheritance and
# collaboration diagrams in a style similar to the OMG's Unified Modeling
# Language.
UML_LOOK = NO
# If set to YES, the inheritance and collaboration graphs will show the
# relations between templates and their instances.
TEMPLATE_RELATIONS = YES
# If the ENABLE_PREPROCESSING, SEARCH_INCLUDES, INCLUDE_GRAPH, and HAVE_DOT
# tags are set to YES then doxygen will generate a graph for each documented
# file showing the direct and indirect include dependencies of the file with
# other documented files.
INCLUDE_GRAPH = YES
# If the ENABLE_PREPROCESSING, SEARCH_INCLUDES, INCLUDED_BY_GRAPH, and
# HAVE_DOT tags are set to YES then doxygen will generate a graph for each
# documented header file showing the documented files that directly or
# indirectly include this file.
INCLUDED_BY_GRAPH = YES
# If the CALL_GRAPH and HAVE_DOT options are set to YES then
# doxygen will generate a call dependency graph for every global function
# or class method. Note that enabling this option will significantly increase
# the time of a run. So in most cases it will be better to enable call graphs
# for selected functions only using the \callgraph command.
CALL_GRAPH = NO
# If the CALLER_GRAPH and HAVE_DOT tags are set to YES then
# doxygen will generate a caller dependency graph for every global function
# or class method. Note that enabling this option will significantly increase
# the time of a run. So in most cases it will be better to enable caller
# graphs for selected functions only using the \callergraph command.
CALLER_GRAPH = NO
# If the GRAPHICAL_HIERARCHY and HAVE_DOT tags are set to YES then doxygen
-# will graphical hierarchy of all classes instead of a textual one.
+# will generate a graphical hierarchy of all classes instead of a textual one.
GRAPHICAL_HIERARCHY = YES
# If the DIRECTORY_GRAPH, SHOW_DIRECTORIES and HAVE_DOT tags are set to YES
# then doxygen will show the dependencies a directory has on other directories
# in a graphical way. The dependency relations are determined by the #include
# relations between the files in the directories.
DIRECTORY_GRAPH = YES
# The DOT_IMAGE_FORMAT tag can be used to set the image format of the images
-# generated by dot. Possible values are png, jpg, or gif
+# generated by dot. Possible values are png, svg, gif or svg.
# If left blank png will be used.
DOT_IMAGE_FORMAT = png
# The tag DOT_PATH can be used to specify the path where the dot tool can be
# found. If left blank, it is assumed the dot tool can be found in the path.
DOT_PATH = "@DOXYGEN_DOT_PATH@"
# The DOTFILE_DIRS tag can be used to specify one or more directories that
# contain dot files that are included in the documentation (see the
# \dotfile command).
DOTFILE_DIRS =
+# The MSCFILE_DIRS tag can be used to specify one or more directories that
+# contain msc files that are included in the documentation (see the
+# \mscfile command).
+
+MSCFILE_DIRS =
+
# The DOT_GRAPH_MAX_NODES tag can be used to set the maximum number of
# nodes that will be shown in the graph. If the number of nodes in a graph
# becomes larger than this value, doxygen will truncate the graph, which is
# visualized by representing a node as a red box. Note that doxygen if the
# number of direct children of the root node in a graph is already larger than
# DOT_GRAPH_MAX_NODES then the graph will not be shown at all. Also note
# that the size of a graph can be further restricted by MAX_DOT_GRAPH_DEPTH.
DOT_GRAPH_MAX_NODES = 50
# The MAX_DOT_GRAPH_DEPTH tag can be used to set the maximum depth of the
# graphs generated by dot. A depth value of 3 means that only nodes reachable
# from the root by following a path via at most 3 edges will be shown. Nodes
# that lay further from the root node will be omitted. Note that setting this
# option to 1 or 2 may greatly reduce the computation time needed for large
# code bases. Also note that the size of a graph can be further restricted by
# DOT_GRAPH_MAX_NODES. Using a depth of 0 means no depth restriction.
MAX_DOT_GRAPH_DEPTH = 0
# Set the DOT_TRANSPARENT tag to YES to generate images with a transparent
# background. This is disabled by default, because dot on Windows does not
# seem to support this out of the box. Warning: Depending on the platform used,
# enabling this option may lead to badly anti-aliased labels on the edges of
# a graph (i.e. they become hard to read).
DOT_TRANSPARENT = NO
# Set the DOT_MULTI_TARGETS tag to YES allow dot to generate multiple output
# files in one run (i.e. multiple -o and -T options on the command line). This
# makes dot run faster, but since only newer versions of dot (>1.8.10)
# support this, this feature is disabled by default.
DOT_MULTI_TARGETS = YES
# If the GENERATE_LEGEND tag is set to YES (the default) Doxygen will
# generate a legend page explaining the meaning of the various boxes and
# arrows in the dot generated graphs.
GENERATE_LEGEND = YES
# If the DOT_CLEANUP tag is set to YES (the default) Doxygen will
# remove the intermediate dot files that are used to generate
# the various graphs.
DOT_CLEANUP = YES
diff --git a/CMake/FindGit.cmake b/CMake/FindGit.cmake
index bcde2e43aa..97b4815eaf 100644
--- a/CMake/FindGit.cmake
+++ b/CMake/FindGit.cmake
@@ -1,58 +1,80 @@
#
# FindGit
#
-SET(GIT_FOUND FALSE)
-
-FIND_PROGRAM(GIT_EXECUTABLE git
+SET(git_candidates git eg)
+
+IF(WIN32)
+ LIST(APPEND git_candidates eg.cmd)
+ IF(NOT MSYS)
+ # We don't append git.cmd, since it does not correctly return
+ # exit codes, see http://code.google.com/p/msysgit/issues/detail?id=428
+ LIST(APPEND git_candidates git.cmd)
+ ENDIF()
+ENDIF()
+
+FIND_PROGRAM(GIT_EXECUTABLE ${git_candidates}
PATHS
"C:/Program Files/Git/bin"
"C:/Program Files (x86)/Git/bin"
DOC "git command line client")
MARK_AS_ADVANCED(GIT_EXECUTABLE)
IF(GIT_EXECUTABLE)
- SET(GIT_FOUND TRUE)
+
+ MACRO(GIT_IS_REPO dir result_var)
+ EXECUTE_PROCESS(COMMAND ${GIT_EXECUTABLE} status
+ WORKING_DIRECTORY ${dir}
+ RESULT_VARIABLE GIT_error
+ OUTPUT_QUIET
+ ERROR_QUIET)
+ if(GIT_error EQUAL 0)
+ SET(${result_var} 1)
+ ELSE()
+ SET(${result_var} 0)
+ ENDIF()
+ ENDMACRO()
+
MACRO(GIT_WC_INFO dir prefix)
EXECUTE_PROCESS(COMMAND ${GIT_EXECUTABLE} rev-list -n 1 HEAD
WORKING_DIRECTORY ${dir}
ERROR_VARIABLE GIT_error
OUTPUT_VARIABLE ${prefix}_WC_REVISION_HASH
OUTPUT_STRIP_TRAILING_WHITESPACE)
- if(NOT ${GIT_error} EQUAL 0)
+ IF(NOT ${GIT_error} EQUAL 0)
MESSAGE(SEND_ERROR "Command \"${GIT_EXECUTBALE} rev-list -n 1 HEAD\" in directory ${dir} failed with output:\n${GIT_error}")
- ELSE(NOT ${GIT_error} EQUAL 0)
+ ELSE()
EXECUTE_PROCESS(COMMAND ${GIT_EXECUTABLE} name-rev ${${prefix}_WC_REVISION_HASH}
WORKING_DIRECTORY ${dir}
OUTPUT_VARIABLE ${prefix}_WC_REVISION_NAME
OUTPUT_STRIP_TRAILING_WHITESPACE)
- ENDIF(NOT ${GIT_error} EQUAL 0)
+ ENDIF()
+ SET(${prefix}_WC_GITSVN 0)
# In case, git-svn is used, attempt to extract svn info
EXECUTE_PROCESS(COMMAND ${GIT_EXECUTABLE} svn info
WORKING_DIRECTORY ${dir}
ERROR_VARIABLE git_svn_info_error
OUTPUT_VARIABLE ${prefix}_WC_INFO
RESULT_VARIABLE git_svn_info_result
OUTPUT_STRIP_TRAILING_WHITESPACE)
- IF(NOT ${git_svn_info_result} EQUAL 0)
- #MESSAGE(SEND_ERROR "Command \"${GIT_SVN_EXECUTABLE} info ${dir}\" failed with output:\n${git_svn_info_error}")
- ELSE(NOT ${git_svn_info_result} EQUAL 0)
-
+ IF(${git_svn_info_result} EQUAL 0)
+ SET(${prefix}_WC_GITSVN 1)
STRING(REGEX REPLACE "^(.*\n)?URL: ([^\n]+).*"
"\\2" ${prefix}_WC_URL "${${prefix}_WC_INFO}")
STRING(REGEX REPLACE "^(.*\n)?Revision: ([^\n]+).*"
"\\2" ${prefix}_WC_REVISION "${${prefix}_WC_INFO}")
STRING(REGEX REPLACE "^(.*\n)?Last Changed Author: ([^\n]+).*"
"\\2" ${prefix}_WC_LAST_CHANGED_AUTHOR "${${prefix}_WC_INFO}")
STRING(REGEX REPLACE "^(.*\n)?Last Changed Rev: ([^\n]+).*"
"\\2" ${prefix}_WC_LAST_CHANGED_REV "${${prefix}_WC_INFO}")
STRING(REGEX REPLACE "^(.*\n)?Last Changed Date: ([^\n]+).*"
"\\2" ${prefix}_WC_LAST_CHANGED_DATE "${${prefix}_WC_INFO}")
-
- ENDIF(NOT ${git_svn_info_result} EQUAL 0)
+ ENDIF()
- ENDMACRO(GIT_WC_INFO)
-ENDIF(GIT_EXECUTABLE)
+ ENDMACRO()
+ENDIF()
+INCLUDE(FindPackageHandleStandardArgs)
+FIND_PACKAGE_HANDLE_STANDARD_ARGS(Git DEFAULT_MSG GIT_EXECUTABLE)
diff --git a/CMake/MITKDashboardDriverScript.cmake b/CMake/MITKDashboardDriverScript.cmake
index 97c71bda4d..644c5930dc 100644
--- a/CMake/MITKDashboardDriverScript.cmake
+++ b/CMake/MITKDashboardDriverScript.cmake
@@ -1,430 +1,448 @@
#
# Included from a dashboard script, this cmake file will drive the configure and build
# steps of MITK
#
#-----------------------------------------------------------------------------
# The following variable are expected to be define in the top-level script:
set(expected_variables
CTEST_NOTES_FILES
CTEST_SITE
CTEST_DASHBOARD_ROOT
CTEST_CMAKE_COMMAND
CTEST_CMAKE_GENERATOR
WITH_MEMCHECK
WITH_COVERAGE
WITH_DOCUMENTATION
CTEST_BUILD_CONFIGURATION
CTEST_TEST_TIMEOUT
CTEST_BUILD_FLAGS
TEST_TO_EXCLUDE_REGEX
CTEST_SOURCE_DIRECTORY
CTEST_BINARY_DIRECTORY
CTEST_BUILD_NAME
SCRIPT_MODE
CTEST_COVERAGE_COMMAND
CTEST_MEMORYCHECK_COMMAND
CTEST_GIT_COMMAND
QT_QMAKE_EXECUTABLE
PROJECT_BUILD_DIR
SUPERBUILD_TARGETS
)
foreach(var ${expected_variables})
if(NOT DEFINED ${var})
message(FATAL_ERROR "Variable ${var} should be defined in top-level script !")
endif()
endforeach()
if (NOT DEFINED GIT_BRANCH OR GIT_BRANCH STREQUAL "")
set(GIT_BRANCH "")
else()
set(GIT_BRANCH "-b ${GIT_BRANCH}")
endif()
# Should binary directory be cleaned?
set(empty_binary_directory FALSE)
# Attempt to build and test also if 'ctest_update' returned an error
set(initial_force_build FALSE)
# Set model options
set(model "")
if (SCRIPT_MODE STREQUAL "experimental")
set(empty_binary_directory FALSE)
set(initial_force_build TRUE)
set(model Experimental)
elseif (SCRIPT_MODE STREQUAL "continuous")
set(empty_binary_directory FALSE)
set(initial_force_build FALSE)
set(model Continuous)
elseif (SCRIPT_MODE STREQUAL "nightly")
set(empty_binary_directory TRUE)
set(initial_force_build TRUE)
set(model Nightly)
else()
message(FATAL_ERROR "Unknown script mode: '${SCRIPT_MODE}'. Script mode should be either 'experimental', 'continuous' or 'nightly'")
endif()
#message("script_mode:${SCRIPT_MODE}")
#message("model:${model}")
#message("empty_binary_directory:${empty_binary_directory}")
#message("force_build:${initial_force_build}")
if(empty_binary_directory)
message("Directory ${CTEST_BINARY_DIRECTORY} cleaned !")
ctest_empty_binary_directory(${CTEST_BINARY_DIRECTORY})
endif()
if(NOT DEFINED CTEST_CHECKOUT_DIR)
set(CTEST_CHECKOUT_DIR ${CTEST_SOURCE_DIRECTORY})
endif()
if(NOT EXISTS "${CTEST_CHECKOUT_DIR}")
set(CTEST_CHECKOUT_COMMAND "\"${CTEST_GIT_COMMAND}\" clone ${GIT_BRANCH} ${GIT_REPOSITORY} \"${CTEST_CHECKOUT_DIR}\"")
endif()
set(CTEST_UPDATE_TYPE "git")
set(CTEST_UPDATE_COMMAND "${CTEST_GIT_COMMAND}")
#----------------------------------------------------------------------
# Utility macros
#----------------------------------------------------------------------
function(func_build_target target build_dir)
set(CTEST_BUILD_TARGET ${target})
ctest_build(BUILD "${build_dir}" APPEND
RETURN_VALUE res
NUMBER_ERRORS num_errors
NUMBER_WARNINGS num_warnings)
ctest_submit(PARTS Build)
if(num_errors)
math(EXPR build_errors "${build_errors} + ${num_errors}")
set(build_errors ${build_errors} PARENT_SCOPE)
endif()
if(num_warnings)
math(EXPR build_warnings "${build_warnings} + ${num_warnings}")
set(build_warnings ${build_warnings} PARENT_SCOPE)
endif()
endfunction()
function(func_test label build_dir)
+ if (NOT TESTING_PARALLEL_LEVEL)
+ set(TESTING_PARALLEL_LEVEL 8)
+ endif()
+
ctest_test(BUILD "${build_dir}"
INCLUDE_LABEL ${label}
- PARALLEL_LEVEL 8
+ PARALLEL_LEVEL ${TESTING_PARALLEL_LEVEL}
EXCLUDE ${TEST_TO_EXCLUDE_REGEX}
RETURN_VALUE res
)
ctest_submit(PARTS Test)
if(res)
math(EXPR test_errors "${test_errors} + 1")
set(test_errors ${test_errors} PARENT_SCOPE)
endif()
if(ARG3)
set(WITH_COVERAGE ${ARG3})
endif()
if(ARG4)
set(WITH_MEMCHECK ${ARG4})
endif()
if(WITH_COVERAGE AND CTEST_COVERAGE_COMMAND)
message("----------- [ Coverage ${label} ] -----------")
ctest_coverage(BUILD "${build_dir}" LABELS ${label})
ctest_submit(PARTS Coverage)
endif ()
- #if(WITH_MEMCHECK AND CTEST_MEMORYCHECK_COMMAND)
- # ctest_memcheck(BUILD "${build_dir}" INCLUDE_LABEL ${label})
- # ctest_submit(PARTS MemCheck)
- #endif ()
+ if(WITH_MEMCHECK AND CTEST_MEMORYCHECK_COMMAND)
+ if(NOT CTEST_MEMORYCHECK_SUPPRESSIONS_FILE)
+ if(EXISTS "${CTEST_SOURCE_DIRECTORY}/CMake/valgrind.supp")
+ set(CTEST_MEMORYCHECK_SUPPRESSIONS_FILE "${CTEST_SOURCE_DIRECTORY}/CMake/valgrind.supp")
+ endif()
+ endif()
+ if(NOT CTEST_MEMORYCHECK_COMMAND_OPTIONS)
+ set(CTEST_MEMORYCHECK_COMMAND_OPTIONS "-q --tool=memcheck --leak-check=yes --show-reachable=no --show-possibly-lost=no --workaround-gcc296-bugs=yes --num-callers=50")
+ endif()
+ ctest_memcheck(BUILD "${build_dir}" INCLUDE_LABEL ${label})
+ ctest_submit(PARTS MemCheck)
+ endif ()
+
endfunction()
#---------------------------------------------------------------------
# run_ctest macro
#---------------------------------------------------------------------
MACRO(run_ctest)
set(build_warnings 0)
set(build_errors 0)
set(test_errors 0)
ctest_start(${model})
ctest_update(SOURCE "${CTEST_CHECKOUT_DIR}" RETURN_VALUE res)
if(res LESS 0)
# update error
math(EXPR build_errors "${build_errors} + 1")
endif()
set(force_build ${initial_force_build})
# Check if a forced run was requested
set(cdash_remove_rerun_url )
if(NOT MITK_NO_CDASH_WEBADMIN)
set(cdash_rerun_url "http://mbits/rerun/${CTEST_BUILD_NAME}")
set(cdash_remove_rerun_url "http://mbits/rerun/rerun.php?name=${CTEST_BUILD_NAME}&remove=1")
file(DOWNLOAD
"${cdash_rerun_url}"
"${CTEST_BINARY_DIRECTORY}/tmp.txt"
STATUS status
)
list(GET status 0 error_code)
file(READ "${CTEST_BINARY_DIRECTORY}/tmp.txt" rerun_content LIMIT 1)
if(NOT error_code AND NOT rerun_content)
set(force_build 1)
endif()
endif()
if(COMMAND MITK_OVERRIDE_FORCE_BUILD)
MITK_OVERRIDE_FORCE_BUILD(force_build)
endif()
# force a build if this is the first run and the build dir is empty
if(NOT EXISTS "${CTEST_BINARY_DIRECTORY}/CMakeCache.txt")
message("First time build - Initialize CMakeCache.txt")
set(res 1)
+ # Write initial cache.
+ if (NOT DEFINED BUILD_TESTING)
+ set(BUILD_TESTING ON)
+ endif()
+
# Write initial cache.
file(WRITE "${CTEST_BINARY_DIRECTORY}/CMakeCache.txt" "
CTEST_USE_LAUNCHERS:BOOL=${CTEST_USE_LAUNCHERS}
CTEST_PROJECT_ADDITIONAL_TARGETS:INTERNAL=${CTEST_PROJECT_ADDITIONAL_TARGETS}
-BUILD_TESTING:BOOL=TRUE
-MITK_CTEST_SCRIPT_MODE:BOOL=TRUE
+BUILD_TESTING:BOOL=${BUILD_TESTING}
+MITK_CTEST_SCRIPT_MODE:STRING=${SCRIPT_MODE}
CMAKE_BUILD_TYPE:STRING=${CTEST_BUILD_CONFIGURATION}
QT_QMAKE_EXECUTABLE:FILEPATH=${QT_QMAKE_EXECUTABLE}
WITH_COVERAGE:BOOL=${WITH_COVERAGE}
${INITIAL_CMAKECACHE_OPTIONS}
")
endif()
if(res GREATER 0 OR force_build)
# Clear the forced rerun request
if(NOT MITK_NO_CDASH_WEBADMIN AND cdash_remove_rerun_url)
file(DOWNLOAD "${cdash_remove_rerun_url}" "${CTEST_BINARY_DIRECTORY}/tmp.txt")
file(REMOVE "${CTEST_BINARY_DIRECTORY}/tmp.txt")
endif()
if(CTEST_PROJECT_NAME_SUPERBUILD)
set(ctest_project_name_orig ${CTEST_PROJECT_NAME})
set(CTEST_PROJECT_NAME ${CTEST_PROJECT_NAME_SUPERBUILD})
endif()
message("----------- [ Configure SuperBuild ] -----------")
set_property(GLOBAL PROPERTY SubProject SuperBuild)
set_property(GLOBAL PROPERTY Label SuperBuild)
ctest_configure(BUILD "${CTEST_BINARY_DIRECTORY}" RETURN_VALUE res)
if(res)
math(EXPR build_errors "${build_errors} + 1")
endif()
# Project.xml is generated during the superbuild configure step
ctest_submit(FILES "${CTEST_BINARY_DIRECTORY}/Project.xml")
ctest_read_custom_files("${CTEST_BINARY_DIRECTORY}")
ctest_submit(PARTS Configure)
# submit the update results *after* the submitting the Configure info,
# otherwise CDash is somehow confused and cannot add the update info
# to the superbuild project
ctest_submit(PARTS Update)
# To get CTEST_PROJECT_SUBPROJECTS and CTEST_PROJECT_EXTERNALS definition
include("${CTEST_BINARY_DIRECTORY}/CTestConfigSubProject.cmake")
# Build top level (either all or the supplied targets at
# superbuild level
if(SUPERBUILD_TARGETS)
foreach(superbuild_target ${SUPERBUILD_TARGETS})
message("----------- [ Build ${superbuild_target} - SuperBuild ] -----------")
func_build_target(${superbuild_target} "${CTEST_BINARY_DIRECTORY}")
# runs only tests that have a LABELS property matching "SuperBuild"
func_test("SuperBuild" "${CTEST_BINARY_DIRECTORY}")
endforeach()
# HACK Unfortunately ctest_coverage ignores the build argument, back-up the original dirs
file(READ "${CTEST_BINARY_DIRECTORY}/CMakeFiles/TargetDirectories.txt" old_coverage_dirs)
# explicitly build requested external projects as subprojects
foreach(external_project_with_build_dir ${CTEST_PROJECT_EXTERNALS})
string(REPLACE "^^" ";" external_project_with_build_dir_list "${external_project_with_build_dir}")
list(GET external_project_with_build_dir_list 0 external_project)
list(GET external_project_with_build_dir_list 1 external_project_build_dir)
set_property(GLOBAL PROPERTY SubProject ${external_project})
set_property(GLOBAL PROPERTY Label ${external_project})
message("----------- [ Build ${external_project} ] -----------")
# Build target
func_build_target(${external_project} "${CTEST_BINARY_DIRECTORY}")
# HACK Unfortunately ctest_coverage ignores the build argument, try to force it...
file(READ "${CTEST_BINARY_DIRECTORY}/${external_project_build_dir}/CMakeFiles/TargetDirectories.txt" mitk_build_coverage_dirs)
file(APPEND "${CTEST_BINARY_DIRECTORY}/CMakeFiles/TargetDirectories.txt" "${mitk_build_coverage_dirs}")
message("----------- [ Test ${external_project} ] -----------")
# runs only tests that have a LABELS property matching "${external_project}"
func_test(${external_project} "${CTEST_BINARY_DIRECTORY}/${external_project_build_dir}")
# restore old coverage dirs
file(WRITE "${CTEST_BINARY_DIRECTORY}/CMakeFiles/TargetDirectories.txt" "${old_coverage_dirs}")
endforeach()
# switch back to SuperBuild label
set_property(GLOBAL PROPERTY SubProject SuperBuild)
set_property(GLOBAL PROPERTY Label SuperBuild)
message("----------- [ Finish SuperBuild ] -----------")
else()
message("----------- [ Build SuperBuild ] -----------")
endif()
# build everything at superbuild level which has not yet been built
func_build_target("" "${CTEST_BINARY_DIRECTORY}")
# runs only tests that have a LABELS property matching "SuperBuild"
#func_test("SuperBuild" "${CTEST_BINARY_DIRECTORY}")
set(build_dir "${CTEST_BINARY_DIRECTORY}/${PROJECT_BUILD_DIR}")
if(CTEST_PROJECT_NAME_SUPERBUILD)
set(CTEST_PROJECT_NAME ${ctest_project_name_orig})
endif()
message("----------- [ Configure ${build_dir} ] -----------")
# Configure target
ctest_configure(BUILD "${build_dir}"
OPTIONS "-DCTEST_USE_LAUNCHERS=${CTEST_USE_LAUNCHERS}"
RETURN_VALUE res
)
ctest_read_custom_files("${CTEST_BINARY_DIRECTORY}")
ctest_submit(PARTS Configure)
if(res)
math(EXPR build_errors "${build_errors} + 1")
endif()
foreach(subproject ${CTEST_PROJECT_SUBPROJECTS})
set_property(GLOBAL PROPERTY SubProject ${subproject})
set_property(GLOBAL PROPERTY Label ${subproject})
message("----------- [ Build ${subproject} ] -----------")
# Build target
func_build_target(${subproject} "${build_dir}")
endforeach()
# Build the rest of the project
set_property(GLOBAL PROPERTY SubProject SuperBuild)
set_property(GLOBAL PROPERTY Label SuperBuild)
message("----------- [ Build All ] -----------")
func_build_target("" "${build_dir}")
# HACK Unfortunately ctest_coverage ignores the build argument, try to force it...
file(READ ${build_dir}/CMakeFiles/TargetDirectories.txt mitk_build_coverage_dirs)
file(APPEND "${CTEST_BINARY_DIRECTORY}/CMakeFiles/TargetDirectories.txt" "${mitk_build_coverage_dirs}")
foreach(subproject ${CTEST_PROJECT_SUBPROJECTS})
set_property(GLOBAL PROPERTY SubProject ${subproject})
set_property(GLOBAL PROPERTY Label ${subproject})
message("----------- [ Test ${subproject} ] -----------")
# runs only tests that have a LABELS property matching "${subproject}"
func_test(${subproject} "${build_dir}")
endforeach()
# Build any additional target which is not build by "all"
# i.e. the "package" target
if(CTEST_PROJECT_ADDITIONAL_TARGETS)
foreach(additional_target ${CTEST_PROJECT_ADDITIONAL_TARGETS})
set_property(GLOBAL PROPERTY SubProject ${additional_target})
set_property(GLOBAL PROPERTY Label ${additional_target})
message("----------- [ Build ${additional_target} ] -----------")
func_build_target(${additional_target} "${build_dir}")
message("----------- [ Test ${additional_target} ] -----------")
# runs only tests that have a LABELS property matching "${subproject}"
func_test(${additional_target} "${build_dir}")
endforeach()
endif()
if (WITH_DOCUMENTATION)
message("----------- [ Build Documentation ] -----------")
set(CTEST_USE_LAUNCHERS 0)
# Build Documentation target
set_property(GLOBAL PROPERTY SubProject Documentation)
set_property(GLOBAL PROPERTY Label Documentation)
func_build_target("doc" "${build_dir}")
set(CTEST_USE_LAUNCHERS 1)
endif()
set_property(GLOBAL PROPERTY SubProject SuperBuild)
set_property(GLOBAL PROPERTY Label SuperBuild)
# Global coverage ...
if (WITH_COVERAGE AND CTEST_COVERAGE_COMMAND)
message("----------- [ Global coverage ] -----------")
ctest_coverage(BUILD "${build_dir}" APPEND)
ctest_submit(PARTS Coverage)
endif ()
# Global dynamic analysis ...
if (WITH_MEMCHECK AND CTEST_MEMORYCHECK_COMMAND)
message("----------- [ Global memcheck ] -----------")
ctest_memcheck(BUILD "${build_dir}")
ctest_submit(PARTS MemCheck)
endif ()
# Note should be at the end
ctest_submit(PARTS Notes)
# Send status to the "CDash Web Admin"
if(NOT MITK_NO_CDASH_WEBADMIN)
set(cdash_admin_url "http://mbits/cdashadmin-web/index.php?pw=4da12ca9c06d46d3171d7f73974c900f")
string(REGEX REPLACE ".*\\?project=(.*)&?" "\\1" _ctest_project "${CTEST_DROP_LOCATION}")
file(DOWNLOAD
"${cdash_admin_url}&action=submit&name=${CTEST_BUILD_NAME}&hasTestErrors=${test_errors}&hasBuildErrors=${build_errors}&hasBuildWarnings=${build_warnings}&ctestDropSite=${CTEST_DROP_SITE}&ctestProject=${_ctest_project}"
"${CTEST_BINARY_DIRECTORY}/cdashadmin.txt"
STATUS status
)
list(GET status 0 error_code)
list(GET status 1 error_msg)
if(error_code)
message(FATAL_ERROR "error: Failed to communicate with cdashadmin-web - ${error_msg}")
endif()
endif()
endif()
# Clear the CTEST_CHECKOUT_COMMAND variable to prevent continuous clients
# to try to checkout again
set(CTEST_CHECKOUT_COMMAND "")
endmacro()
if(SCRIPT_MODE STREQUAL "continuous")
while(1)
run_ctest()
# Loop no faster than once every 5 minutes
message("Wait for 5 minutes ...")
ctest_sleep(300)
endwhile()
else()
run_ctest()
endif()
diff --git a/CMake/MITKDashboardScript.TEMPLATE.cmake b/CMake/MITKDashboardScript.TEMPLATE.cmake
index d7c01f466a..a79fa71ce6 100644
--- a/CMake/MITKDashboardScript.TEMPLATE.cmake
+++ b/CMake/MITKDashboardScript.TEMPLATE.cmake
@@ -1,119 +1,119 @@
#
# OS: Ubuntu 9.04 2.6.28-18-generic
# Hardware: x86_64 GNU/Linux
# GPU: NA
#
# Note: The specific version and processor type of this machine should be reported in the
# header above. Indeed, this file will be send to the dashboard as a NOTE file.
cmake_minimum_required(VERSION 2.8.2)
#
# Dashboard properties
#
set(MY_COMPILER "gcc-4.4.5")
# For Windows, e.g.
#set(MY_COMPILER "VC9.0")
set(CTEST_CMAKE_COMMAND "/usr/bin/cmake")
set(CTEST_CMAKE_GENERATOR "Unix Makefiles")
set(CTEST_DASHBOARD_ROOT "/opt/dartclients")
# For Windows, e.g.
#set(CTEST_CMAKE_COMMAND "cmake")
#set(CTEST_CMAKE_GENERATOR "Visual Studio 9 2008 Win64")
#set(CTEST_DASHBOARD_ROOT "C:/dartclients")
# The directory containing the Qt binaries
set(QT_BINARY_DIR "/usr/bin/")
# For Windows, e.g.
#set(QT_BINARY_DIR "V:/windows/x64/QT-4.7.0_VC9.0_Bin/bin")
#
# Dashboard options
#
set(WITH_KWSTYLE FALSE)
set(WITH_MEMCHECK FALSE)
set(WITH_COVERAGE FALSE)
set(WITH_DOCUMENTATION FALSE)
#set(DOCUMENTATION_ARCHIVES_OUTPUT_DIRECTORY ) # for example: $ENV{HOME}/Projects/Doxygen
set(CTEST_BUILD_CONFIGURATION "Release")
set(CTEST_TEST_TIMEOUT 500)
if(UNIX OR MINGW)
set(CTEST_BUILD_FLAGS "-j4") # Use multiple CPU cores to build
else()
set(CTEST_BUILD_FLAGS "")
endif()
# experimental:
# - run_ctest() macro will be called *ONE* time
# - binary directory will *NOT* be cleaned
# continuous:
# - run_ctest() macro will be called EVERY 5 minutes ...
# - binary directory will *NOT* be cleaned
# - configure/build will be executed *ONLY* if the repository has been updated
# nightly:
# - run_ctest() macro will be called *ONE* time
# - binary directory *WILL BE* cleaned
set(SCRIPT_MODE "experimental") # "experimental", "continuous", "nightly"
#
# Project specific properties
#
set(CTEST_SOURCE_DIRECTORY "${CTEST_DASHBOARD_ROOT}/MITK")
set(CTEST_BINARY_DIRECTORY "${CTEST_DASHBOARD_ROOT}/MITK-Superbuild-${CTEST_BUILD_CONFIGURATION}-${SCRIPT_MODE}")
set(ADDITIONAL_CMAKECACHE_OPTION "
-MITK_USE_Boost:BOOL=ON
-MITK_USE_OpenCV:BOOL=ON
+# add entries like this
+# MITK_USE_OpenCV:BOOL=OFF
")
# List of test that should be explicitly disabled on this machine
set(TEST_TO_EXCLUDE_REGEX "")
# set any extra environment variables here
set(ENV{DISPLAY} ":0")
find_program(CTEST_COVERAGE_COMMAND NAMES gcov)
find_program(CTEST_MEMORYCHECK_COMMAND NAMES valgrind)
find_program(CTEST_GIT_COMMAND NAMES git)
#
# Git repository - Overwrite the default value provided by the driver script
#
# The git repository containing MITK code
#set(GIT_REPOSITORY "/home/username/MITK")
# The branch of the MITK git repository to check out
#set(GIT_BRANCH "bug-xxx-label")
##########################################
# WARNING: DO NOT EDIT BEYOND THIS POINT #
##########################################
#
# Convenient macro allowing to download a file
#
macro(downloadFile url dest)
file(DOWNLOAD "${url}" "${dest}" STATUS status)
list(GET status 0 error_code)
list(GET status 1 error_msg)
if(error_code)
message(FATAL_ERROR "error: Failed to download ${url} - ${error_msg}")
endif()
endmacro()
#
# Download and include setup script
#
if(NOT DEFINED GIT_BRANCH OR GIT_BRANCH STREQUAL "")
set(hb "HEAD")
else()
set(hb "refs/heads/${GIT_BRANCH}")
endif()
set(url "http://mbits/gitweb/?p=MITK.git;a=blob_plain;f=CMake/MITKDashboardSetup.cmake;hb=${hb}")
set(dest ${CTEST_SCRIPT_DIRECTORY}/${CTEST_SCRIPT_NAME}.setup)
downloadFile("${url}" "${dest}")
include(${dest})
diff --git a/CMake/MITKDashboardSetup.cmake b/CMake/MITKDashboardSetup.cmake
index 763ba253c7..889b2082be 100644
--- a/CMake/MITKDashboardSetup.cmake
+++ b/CMake/MITKDashboardSetup.cmake
@@ -1,105 +1,115 @@
# This file is intended to be included at the end of a custom MITKDashboardScript.TEMPLATE.cmake file
list(APPEND CTEST_NOTES_FILES "${CTEST_SCRIPT_DIRECTORY}/${CTEST_SCRIPT_NAME}")
#
# Automatically determined properties
#
set(MY_OPERATING_SYSTEM "${CMAKE_HOST_SYSTEM}") # Windows 7, Linux-2.6.32, Darwin...
site_name(CTEST_SITE)
if(QT_BINARY_DIR)
set(QT_QMAKE_EXECUTABLE "${QT_BINARY_DIR}/qmake")
else()
set(QT_QMAKE_EXECUTABLE "qmake")
endif()
execute_process(COMMAND ${QT_QMAKE_EXECUTABLE} --version
OUTPUT_VARIABLE MY_QT_VERSION
RESULT_VARIABLE qmake_error)
if(qmake_error)
message(FATAL_ERROR "Error when executing ${QT_QMAKE_EXECUTABLE} --version\n${qmake_error}")
endif()
string(REGEX REPLACE ".*Qt version ([0-9.]+) .*" "\\1" MY_QT_VERSION ${MY_QT_VERSION})
#
# Project specific properties
#
if(NOT CTEST_BUILD_NAME)
set(CTEST_BUILD_NAME "${MY_OPERATING_SYSTEM}-${MY_COMPILER}-Qt-${MY_QT_VERSION}-${CTEST_BUILD_CONFIGURATION}")
endif()
set(PROJECT_BUILD_DIR "MITK-build")
set(CTEST_PATH "$ENV{PATH}")
if(WIN32)
set(VTK_BINARY_DIR "${CTEST_BINARY_DIRECTORY}/VTK-build/bin/${CTEST_BUILD_CONFIGURATION}")
set(ITK_BINARY_DIR "${CTEST_BINARY_DIRECTORY}/ITK-build/bin/${CTEST_BUILD_CONFIGURATION}")
set(GDCM_BINARY_DIR "${CTEST_BINARY_DIRECTORY}/GDCM-build/bin/${CTEST_BUILD_CONFIGURATION}")
set(OPENCV_BINARY_DIR "${CTEST_BINARY_DIRECTORY}/OpenCV-build/bin/${CTEST_BUILD_CONFIGURATION}")
set(BLUEBERRY_OSGI_DIR "${CTEST_BINARY_DIRECTORY}/MITK-build/bin/BlueBerry/org.blueberry.osgi/bin/${CTEST_BUILD_CONFIGURATION}")
set(CTEST_PATH "${CTEST_PATH};${QT_BINARY_DIR};${VTK_BINARY_DIR};${ITK_BINARY_DIR};${GDCM_BINARY_DIR};${OPENCV_BINARY_DIR};${BLUEBERRY_OSGI_DIR}")
endif()
set(ENV{PATH} "${CTEST_PATH}")
set(SUPERBUILD_TARGETS "")
# If the dashscript doesn't define a GIT_REPOSITORY variable, let's define it here.
if (NOT DEFINED GIT_REPOSITORY OR GIT_REPOSITORY STREQUAL "")
set(GIT_REPOSITORY "http://git.mitk.org/MITK.git")
endif()
#
# Display build info
#
message("Site name: ${CTEST_SITE}")
message("Build name: ${CTEST_BUILD_NAME}")
message("Script Mode: ${SCRIPT_MODE}")
message("Coverage: ${WITH_COVERAGE}, MemCheck: ${WITH_MEMCHECK}")
#
# Set initial cache options
#
set(CTEST_USE_LAUNCHERS 1)
# Remove this if block after all dartclients work
if(DEFINED ADDITIONNAL_CMAKECACHE_OPTION)
message(WARNING "Rename ADDITIONNAL to ADDITIONAL in your dartlclient script: ${CTEST_SCRIPT_DIRECTORY}/${CTEST_SCRIPT_NAME}")
set(ADDITIONAL_CMAKECACHE_OPTION ${ADDITIONNAL_CMAKECACHE_OPTION})
endif()
+if(NOT DEFINED MITK_USE_Boost)
+ set(MITK_USE_Boost 1)
+endif()
+
+if(NOT DEFINED MITK_USE_OpenCV)
+ set(MITK_USE_OpenCV 1)
+endif()
+
set(INITIAL_CMAKECACHE_OPTIONS "
BLUEBERRY_BUILD_TESTING:BOOL=TRUE
BLUEBERRY_BUILD_ALL_PLUGINS:BOOL=TRUE
MITK_BUILD_ALL_PLUGINS:BOOL=TRUE
SUPERBUILD_EXCLUDE_MITKBUILD_TARGET:BOOL=TRUE
+MITK_USE_Boost:BOOL=${MITK_USE_Boost}
+MITK_USE_OpenCV:BOOL=${MITK_USE_OpenCV}
${ADDITIONAL_CMAKECACHE_OPTION}
")
# Write a cache file for populating the MITK initial cache (not the superbuild cache).
# This can be used to provide variables which are not passed through the
# superbuild process to the MITK configure step)
if(MITK_INITIAL_CACHE)
set(mitk_cache_file "${CTEST_SCRIPT_DIRECTORY}/mitk_initial_cache.txt")
file(WRITE "${mitk_cache_file}" "${MITK_INITIAL_CACHE}")
set(INITIAL_CMAKECACHE_OPTIONS "${INITIAL_CMAKECACHE_OPTIONS}
MITK_INITIAL_CACHE_FILE::INTERNAL=${mitk_cache_file}
")
endif()
#
# Download and include dashboard driver script
#
if(NOT DEFINED GIT_BRANCH OR GIT_BRANCH STREQUAL "")
set(hb "HEAD")
else()
set(hb "refs/heads/${GIT_BRANCH}")
endif()
set(url "http://mbits/gitweb/?p=MITK.git;a=blob_plain;f=CMake/MITKDashboardDriverScript.cmake;hb=${hb}")
set(dest ${CTEST_SCRIPT_DIRECTORY}/${CTEST_SCRIPT_NAME}.driver)
downloadFile("${url}" "${dest}")
include(${dest})
diff --git a/CMake/PackageDepends/MITK_DCMTK_Config.cmake b/CMake/PackageDepends/MITK_DCMTK_Config.cmake
index 4a1bd503a5..bdaebe6426 100644
--- a/CMake/PackageDepends/MITK_DCMTK_Config.cmake
+++ b/CMake/PackageDepends/MITK_DCMTK_Config.cmake
@@ -1,48 +1,48 @@
IF(MITK_USE_DCMTK)
IF(NOT DCMTK_DIR)
SET(DCMTK_DIR "$ENV{DCMTK_DIR}" CACHE PATH "Location of DCMTK")
SET(DCMTK_DIR "$ENV{DCMTK_DIR}")
IF(NOT DCMTK_DIR)
MESSAGE(FATAL_ERROR "DCMTK_DIR not set. Cannot proceed.")
ENDIF(NOT DCMTK_DIR)
ENDIF(NOT DCMTK_DIR)
FIND_PACKAGE(DCMTK)
IF(NOT DCMTK_FOUND)
MESSAGE(SEND_ERROR "DCMTK development files not found.\n Please check variables (e.g. DCMTK_DIR) for include directories and libraries.\nYou may set environment variable DCMTK_DIR before pressing 'configure'")
ENDIF(NOT DCMTK_FOUND)
IF( NOT WIN32 )
SET(MISSING_LIBS_REQUIRED_BY_DCMTK wrap tiff)
ENDIF( NOT WIN32 )
SET(QT_USE_QTSQL 1)
IF(EXISTS ${DCMTK_config_INCLUDE_DIR}/osconfig.h)
FILE(READ ${DCMTK_config_INCLUDE_DIR}/osconfig.h _osconfig_h)
IF(NOT _osconfig_h MATCHES "PACKAGE_VERSION_NUMBER \"354\"")
- MESSAGE(STATUS "Found DCMTK newer that 3.5.4 ...")
+ # MESSAGE(STATUS "Found DCMTK newer that 3.5.4 ...")
SET(MITK_USE_DCMTK_NEWER_THAN_3_5_4 TRUE)
# assume the new oflog library is located next to the others
# this can be removed if FindDCMTK is adapted for 3.5.5
GET_FILENAME_COMPONENT(_DCMTK_lib_dir ${DCMTK_ofstd_LIBRARY} PATH)
FIND_LIBRARY(DCMTK_oflog_LIBRARY oflog ${_DCMTK_lib_dir} )
LIST(APPEND DCMTK_LIBRARIES ${DCMTK_oflog_LIBRARY})
ENDIF(NOT _osconfig_h MATCHES "PACKAGE_VERSION_NUMBER \"354\"")
ENDIF(EXISTS ${DCMTK_config_INCLUDE_DIR}/osconfig.h)
#
# Usually all code should be adapted to DCMTK 3.6
# If necessary you could configure the MITK_USE_DCMTK_NEWER_THAN_3_5_4 variable
# to configure a header file for ifdefs:
# CONFIGURE_FILE( mitkDCMTKConfig.h.in mitkDCMTKConfig.h )
LIST(APPEND ALL_INCLUDE_DIRECTORIES ${DCMTK_INCLUDE_DIR} ${DCMTK_DIR}/include)
LIST(APPEND ALL_LIBRARIES ${DCMTK_LIBRARIES} ${MISSING_LIBS_REQUIRED_BY_DCMTK})
#link_directories()
ENDIF(MITK_USE_DCMTK)
diff --git a/CMake/RunInstalledApp.sh b/CMake/RunInstalledApp.sh
index 41b1d1c2c8..f436f10640 100644
--- a/CMake/RunInstalledApp.sh
+++ b/CMake/RunInstalledApp.sh
@@ -1,6 +1,6 @@
#!/bin/sh
binpath=$(dirname $(readlink -f $0))
appname=$(basename $0 .sh)
-export LD_LIBRARY_PATH=$binpath/bin:$LD_LIBRARY_PATH
+export LD_LIBRARY_PATH=$binpath/bin:$binpath/bin/plugins:$LD_LIBRARY_PATH
cd $binpath/bin
-./$appname
+./$appname $*
diff --git a/CMake/mitkFunctionGetVersion.cmake b/CMake/mitkFunctionGetVersion.cmake
index b92ab2a042..659c04e01d 100644
--- a/CMake/mitkFunctionGetVersion.cmake
+++ b/CMake/mitkFunctionGetVersion.cmake
@@ -1,28 +1,78 @@
+#! \brief Extract version information from a local working copy
#!
-#! Extracts the current git revision hash and branch/tag name
-#! and provides these in ${prefix}_WC_REVISION_HASH and
-#! ${prefix}_WC_REVISION_NAME
+#! If the source_dir variable points to a git repository, this function
+#! extracts the current revision hash and branch/tag name.
#!
-#! \param source_dir The directory containing a git repository
+#! If the source_dir variable points to a subversion repository, this
+#! function extracts the current svn revision.
+#
+#! The information is provided in
+#! \ul
+#! \li ${prefix}_REVISION_ID The git hash or svn revision value
+#! \li ${prefix}_REVISION_NAME The git branch/tag name or empty
+#! \li ${prefix}_WC_TYPE The working copy type, one of "local", "git", or "svn"
+#! \lu
+#!
+#! \param source_dir The directory containing a working copy
#! \param prefix A prefix to prepend to the variables containing
-#! the revision hash and name.
+#! the extracted information.
#!
function(mitkFunctionGetVersion source_dir prefix)
+
+ if(NOT prefix)
+ message(FATAL_ERROR "prefix argument not specified")
+ endif()
+
+ # initialize variables
+ set(_wc_type "local")
+ set(_wc_id "")
+ set(_wc_name "")
+
+
find_package(Git)
if(GIT_FOUND)
- GIT_WC_INFO(${source_dir} ${prefix})
+
+ GIT_IS_REPO(${source_dir} _is_git_repo)
+ if(_is_git_repo)
+ set(_wc_type "git")
+ GIT_WC_INFO(${source_dir} ${prefix})
+
+ set(_wc_id ${${prefix}_WC_REVISION_HASH})
- if(NOT ${prefix}_WC_REVISION_HASH)
- set(${prefix}_WC_REVISION_HASH "n/a")
+ string(REPLACE " " ";" hash_name ${${prefix}_WC_REVISION_NAME})
+ list(GET hash_name 1 name)
+ if(name)
+ set(_wc_name ${name})
+ endif()
endif()
-
- string(REPLACE " " ";" hash_name ${${prefix}_WC_REVISION_NAME})
- list(GET hash_name 1 name)
- if (NOT name)
- set(name "n/a")
+ endif()
+
+ # test for svn working copy
+ if(_wc_type STREQUAL "local")
+
+ find_package(Subversion)
+ if(Subversion_FOUND)
+ execute_process(COMMAND ${Subversion_SVN_EXECUTABLE} info
+ WORKING_DIRECTORY ${source_dir}
+ RESULT_VARIABLE _subversion_result
+ OUTPUT_QUIET
+ ERROR_QUIET)
+
+ if(NOT _subversion_result)
+ set(_wc_type svn)
+ Subversion_WC_INFO(${source_dir} ${prefix})
+ set(_wc_id ${${prefix}_WC_REVISION})
+ endif()
endif()
-
- set(${prefix}_WC_REVISION_HASH ${${prefix}_WC_REVISION_HASH} PARENT_SCOPE)
- set(${prefix}_WC_REVISION_NAME ${name} PARENT_SCOPE)
+
endif()
+
+ set(${prefix}_WC_TYPE ${_wc_type} PARENT_SCOPE)
+ set(${prefix}_REVISION_ID ${_wc_id} PARENT_SCOPE)
+ set(${prefix}_REVISION_NAME ${_wc_name} PARENT_SCOPE)
+
+ # For backwards compatibility
+ set(${prefix}_WC_REVISION_HASH ${_wc_id} PARENT_SCOPE)
+ set(${prefix}_WC_REVISION_NAME ${_wc_name} PARENT_SCOPE)
+
endfunction()
diff --git a/CMake/mitkMacroCreateModule.cmake b/CMake/mitkMacroCreateModule.cmake
index d88fa16266..ad8cd0f1c5 100644
--- a/CMake/mitkMacroCreateModule.cmake
+++ b/CMake/mitkMacroCreateModule.cmake
@@ -1,197 +1,208 @@
##################################################################
#
# MITK_CREATE_MODULE
#
#! Creates a module for the automatic module dependency system within MITK.
#! Configurations are generated in the moduleConf directory.
#!
#! USAGE:
#!
#! \code
#! MITK_CREATE_MODULE( <moduleName>
#! [INCLUDE_DIRS <include directories>]
#! [INTERNAL_INCLUDE_DIRS <internally used include directories>]
#! [DEPENDS <modules we need>]
#! [PROVIDES <library name which is built>]
#! [PACKAGE_DEPENDS <packages we need, like ITK, VTK, QT>]
#! [EXPORT_DEFINE <declspec macro name for dll exports>]
#! [QT_MODULE]
#! \endcode
#!
#! \param MODULE_NAME_IN The name for the new module
#
##################################################################
MACRO(MITK_CREATE_MODULE MODULE_NAME_IN)
MACRO_PARSE_ARGUMENTS(MODULE
"SUBPROJECTS;INCLUDE_DIRS;INTERNAL_INCLUDE_DIRS;DEPENDS;DEPENDS_INTERNAL;PROVIDES;PACKAGE_DEPENDS;EXPORT_DEFINE;ADDITIONAL_LIBS;GENERATED_CPP"
"QT_MODULE;FORCE_STATIC;HEADERS_ONLY"
${ARGN})
SET(MODULE_NAME ${MODULE_NAME_IN})
IF(NOT MODULE_SUBPROJECTS)
IF(MITK_DEFAULT_SUBPROJECTS)
SET(MODULE_SUBPROJECTS ${MITK_DEFAULT_SUBPROJECTS})
ENDIF()
ENDIF()
# check if the subprojects exist as targets
IF(MODULE_SUBPROJECTS)
FOREACH(subproject ${MODULE_SUBPROJECTS})
IF(NOT TARGET ${subproject})
MESSAGE(SEND_ERROR "The subproject ${subproject} does not have a corresponding target")
ENDIF()
ENDFOREACH()
ENDIF()
+
+
# assume worst case
SET(MODULE_IS_ENABLED 0)
- # first of all we check for the dependencies
- MITK_CHECK_MODULE(_MISSING_DEP ${MODULE_DEPENDS})
- IF(_MISSING_DEP)
- MESSAGE("Module ${MODULE_NAME} won't be built, missing dependency: ${_MISSING_DEP}")
- SET(MODULE_IS_ENABLED 0)
- ELSE(_MISSING_DEP)
- SET(MODULE_IS_ENABLED 1)
- # now check for every package if it is enabled. This overlaps a bit with
- # MITK_CHECK_MODULE ...
- FOREACH(_package ${MODULE_PACKAGE_DEPENDS})
- IF((DEFINED MITK_USE_${_package}) AND NOT (MITK_USE_${_package}))
- MESSAGE("Module ${MODULE_NAME} won't be built. Turn on MITK_USE_${_package} if you want to use it.")
- SET(MODULE_IS_ENABLED 0)
- ENDIF()
- ENDFOREACH()
- IF(MODULE_IS_ENABLED)
- IF(NOT MODULE_QT_MODULE OR MITK_USE_QT)
- SET(MODULE_IS_ENABLED 1)
- _MITK_CREATE_MODULE_CONF()
- IF(NOT MODULE_EXPORT_DEFINE)
- SET(MODULE_EXPORT_DEFINE ${MODULE_NAME}_EXPORT)
- ENDIF(NOT MODULE_EXPORT_DEFINE)
- CONFIGURE_FILE(${MITK_SOURCE_DIR}/CMake/moduleExports.h.in ${MITK_MODULES_CONF_DIR}/${MODULE_NAME}Exports.h @ONLY)
-
- IF(MITK_GENERATE_MODULE_DOT)
- MESSAGE("MODULEDOTNAME ${MODULE_NAME}")
- FOREACH(dep ${MODULE_DEPENDS})
- MESSAGE("MODULEDOT \"${MODULE_NAME}\" -> \"${dep}\" ; ")
- ENDFOREACH(dep)
- ENDIF(MITK_GENERATE_MODULE_DOT)
-
- SET(DEPENDS "${MODULE_DEPENDS}")
- SET(DEPENDS_BEFORE "not initialized")
- SET(PACKAGE_DEPENDS "${MODULE_PACKAGE_DEPENDS}")
- MITK_USE_MODULE("${MODULE_DEPENDS}")
-
- # ok, now create the module itself
- INCLUDE_DIRECTORIES(. ${ALL_INCLUDE_DIRECTORIES})
- INCLUDE(files.cmake)
-
- IF(NOT MODULE_QT_MODULE)
- ORGANIZE_SOURCES(SOURCE ${CPP_FILES}
- HEADER ${H_FILES}
- TXX ${TXX_FILES}
- DOC ${DOX_FILES}
- )
+ # first we check if we have an explicit module build list
+ IF(MITK_MODULES_TO_BUILD)
+ LIST(FIND MITK_MODULES_TO_BUILD ${MODULE_NAME} _MOD_INDEX)
+ IF(_MOD_INDEX EQUAL -1)
+ SET(MODULE_IS_EXCLUDED 1)
+ ENDIF()
+ ENDIF()
+ IF(NOT MODULE_IS_EXCLUDED)
+ # first of all we check for the dependencies
+ MITK_CHECK_MODULE(_MISSING_DEP ${MODULE_DEPENDS})
+ IF(_MISSING_DEP)
+ MESSAGE("Module ${MODULE_NAME} won't be built, missing dependency: ${_MISSING_DEP}")
+ SET(MODULE_IS_ENABLED 0)
+ ELSE(_MISSING_DEP)
+ SET(MODULE_IS_ENABLED 1)
+ # now check for every package if it is enabled. This overlaps a bit with
+ # MITK_CHECK_MODULE ...
+ FOREACH(_package ${MODULE_PACKAGE_DEPENDS})
+ IF((DEFINED MITK_USE_${_package}) AND NOT (MITK_USE_${_package}))
+ MESSAGE("Module ${MODULE_NAME} won't be built. Turn on MITK_USE_${_package} if you want to use it.")
+ SET(MODULE_IS_ENABLED 0)
+ ENDIF()
+ ENDFOREACH()
+ IF(MODULE_IS_ENABLED)
+ IF(NOT MODULE_QT_MODULE OR MITK_USE_QT)
+ SET(MODULE_IS_ENABLED 1)
+ _MITK_CREATE_MODULE_CONF()
+ IF(NOT MODULE_EXPORT_DEFINE)
+ SET(MODULE_EXPORT_DEFINE ${MODULE_NAME}_EXPORT)
+ ENDIF(NOT MODULE_EXPORT_DEFINE)
+ CONFIGURE_FILE(${MITK_SOURCE_DIR}/CMake/moduleExports.h.in ${MITK_MODULES_CONF_DIR}/${MODULE_NAME}Exports.h @ONLY)
+
+ IF(MITK_GENERATE_MODULE_DOT)
+ MESSAGE("MODULEDOTNAME ${MODULE_NAME}")
+ FOREACH(dep ${MODULE_DEPENDS})
+ MESSAGE("MODULEDOT \"${MODULE_NAME}\" -> \"${dep}\" ; ")
+ ENDFOREACH(dep)
+ ENDIF(MITK_GENERATE_MODULE_DOT)
+
+ SET(DEPENDS "${MODULE_DEPENDS}")
+ SET(DEPENDS_BEFORE "not initialized")
+ SET(PACKAGE_DEPENDS "${MODULE_PACKAGE_DEPENDS}")
+ MITK_USE_MODULE("${MODULE_DEPENDS}")
+
+ # ok, now create the module itself
+ INCLUDE_DIRECTORIES(. ${ALL_INCLUDE_DIRECTORIES})
+ INCLUDE(files.cmake)
+
+ IF(NOT MODULE_QT_MODULE)
+ ORGANIZE_SOURCES(SOURCE ${CPP_FILES}
+ HEADER ${H_FILES}
+ TXX ${TXX_FILES}
+ DOC ${DOX_FILES}
+ )
- IF(MODULE_FORCE_STATIC)
- SET(_STATIC ${MITK_WIN32_FORCE_STATIC})
- ENDIF(MODULE_FORCE_STATIC)
-
- SET(coverage_sources ${CPP_FILES} ${H_FILES} ${GLOBBED__H_FILES} ${CORRESPONDING__H_FILES} ${TXX_FILES} ${TOOL_CPPS})
- IF(MODULE_SUBPROJECTS)
- SET_PROPERTY(SOURCE ${coverage_sources} APPEND PROPERTY LABELS ${MODULE_SUBPROJECTS} MITK)
- ENDIF()
+ IF(MODULE_FORCE_STATIC)
+ SET(_STATIC ${MITK_WIN32_FORCE_STATIC})
+ ENDIF(MODULE_FORCE_STATIC)
+
+ SET(coverage_sources ${CPP_FILES} ${H_FILES} ${GLOBBED__H_FILES} ${CORRESPONDING__H_FILES} ${TXX_FILES} ${TOOL_CPPS})
+ IF(MODULE_SUBPROJECTS)
+ SET_PROPERTY(SOURCE ${coverage_sources} APPEND PROPERTY LABELS ${MODULE_SUBPROJECTS} MITK)
+ ENDIF()
- IF(NOT MODULE_HEADERS_ONLY)
- IF(ALL_LIBRARY_DIRS)
- # LINK_DIRECTORIES applies only to targets which are added after the call to LINK_DIRECTORIES
- LINK_DIRECTORIES(${ALL_LIBRARY_DIRS})
- ENDIF(ALL_LIBRARY_DIRS)
- ADD_LIBRARY(${MODULE_PROVIDES} ${_STATIC} ${coverage_sources} ${CPP_FILES_GENERATED} ${DOX_FILES} ${UI_FILES})
- IF(MODULE_SUBPROJECTS)
- SET_PROPERTY(TARGET ${MODULE_PROVIDES} PROPERTY LABELS ${MODULE_SUBPROJECTS} MITK)
- FOREACH(subproject ${MODULE_SUBPROJECTS})
- ADD_DEPENDENCIES(${subproject} ${MODULE_PROVIDES})
- ENDFOREACH()
- ENDIF()
- IF(ALL_LIBRARIES)
- TARGET_LINK_LIBRARIES(${MODULE_PROVIDES} ${ALL_LIBRARIES})
- ENDIF(ALL_LIBRARIES)
+ IF(NOT MODULE_HEADERS_ONLY)
+ IF(ALL_LIBRARY_DIRS)
+ # LINK_DIRECTORIES applies only to targets which are added after the call to LINK_DIRECTORIES
+ LINK_DIRECTORIES(${ALL_LIBRARY_DIRS})
+ ENDIF(ALL_LIBRARY_DIRS)
+ ADD_LIBRARY(${MODULE_PROVIDES} ${_STATIC} ${coverage_sources} ${CPP_FILES_GENERATED} ${DOX_FILES} ${UI_FILES})
+ IF(MODULE_SUBPROJECTS)
+ SET_PROPERTY(TARGET ${MODULE_PROVIDES} PROPERTY LABELS ${MODULE_SUBPROJECTS} MITK)
+ FOREACH(subproject ${MODULE_SUBPROJECTS})
+ ADD_DEPENDENCIES(${subproject} ${MODULE_PROVIDES})
+ ENDFOREACH()
+ ENDIF()
+ IF(ALL_LIBRARIES)
+ TARGET_LINK_LIBRARIES(${MODULE_PROVIDES} ${ALL_LIBRARIES})
+ ENDIF(ALL_LIBRARIES)
- IF(MINGW)
- TARGET_LINK_LIBRARIES(${MODULE_PROVIDES} ssp) # add stack smash protection lib
- ENDIF()
- ENDIF()
-
- ELSE(NOT MODULE_QT_MODULE)
+ IF(MINGW)
+ TARGET_LINK_LIBRARIES(${MODULE_PROVIDES} ssp) # add stack smash protection lib
+ ENDIF()
+ ENDIF()
+
+ ELSE(NOT MODULE_QT_MODULE)
- INCLUDE(files.cmake)
-
- IF(UI_FILES)
- QT4_WRAP_UI(Q${KITNAME}_GENERATED_UI_CPP ${UI_FILES})
- ENDIF(UI_FILES)
-
- IF(MOC_H_FILES)
- QT4_WRAP_CPP(Q${KITNAME}_GENERATED_MOC_CPP ${MOC_H_FILES})
- ENDIF(MOC_H_FILES)
-
- IF(QRC_FILES)
- QT4_ADD_RESOURCES(Q${KITNAME}_GENERATED_QRC_CPP ${QRC_FILES})
- ENDIF(QRC_FILES)
-
- SET(Q${KITNAME}_GENERATED_CPP ${Q${KITNAME}_GENERATED_CPP} ${Q${KITNAME}_GENERATED_UI_CPP} ${Q${KITNAME}_GENERATED_MOC_CPP} ${Q${KITNAME}_GENERATED_QRC_CPP})
-
- ORGANIZE_SOURCES(SOURCE ${CPP_FILES}
- HEADER ${H_FILES}
- TXX ${TXX_FILES}
- DOC ${DOX_FILES}
- UI ${UI_FILES}
- QRC ${QRC_FILES}
- MOC ${Q${KITNAME}_GENERATED_MOC_CPP}
- GEN_QRC ${Q${KITNAME}_GENERATED_QRC_CPP}
- GEN_UI ${Q${KITNAME}_GENERATED_UI_CPP})
+ INCLUDE(files.cmake)
+
+ IF(UI_FILES)
+ QT4_WRAP_UI(Q${KITNAME}_GENERATED_UI_CPP ${UI_FILES})
+ ENDIF(UI_FILES)
+
+ IF(MOC_H_FILES)
+ QT4_WRAP_CPP(Q${KITNAME}_GENERATED_MOC_CPP ${MOC_H_FILES})
+ ENDIF(MOC_H_FILES)
+
+ IF(QRC_FILES)
+ QT4_ADD_RESOURCES(Q${KITNAME}_GENERATED_QRC_CPP ${QRC_FILES})
+ ENDIF(QRC_FILES)
+
+ SET(Q${KITNAME}_GENERATED_CPP ${Q${KITNAME}_GENERATED_CPP} ${Q${KITNAME}_GENERATED_UI_CPP} ${Q${KITNAME}_GENERATED_MOC_CPP} ${Q${KITNAME}_GENERATED_QRC_CPP})
+
+ ORGANIZE_SOURCES(SOURCE ${CPP_FILES}
+ HEADER ${H_FILES}
+ TXX ${TXX_FILES}
+ DOC ${DOX_FILES}
+ UI ${UI_FILES}
+ QRC ${QRC_FILES}
+ MOC ${Q${KITNAME}_GENERATED_MOC_CPP}
+ GEN_QRC ${Q${KITNAME}_GENERATED_QRC_CPP}
+ GEN_UI ${Q${KITNAME}_GENERATED_UI_CPP})
- # MITK_GENERATE_TOOLS_LIBRARY(Qmitk${LIBPOSTFIX} "NO")
+ # MITK_GENERATE_TOOLS_LIBRARY(Qmitk${LIBPOSTFIX} "NO")
- SET(coverage_sources ${CPP_FILES} ${CORRESPONDING__H_FILES} ${GLOBBED__H_FILES} ${TXX_FILES} ${TOOL_GUI_CPPS})
- SET_PROPERTY(SOURCE ${coverage_sources} APPEND PROPERTY LABELS ${MODULE_SUBPROJECTS})
-
- IF(NOT MODULE_HEADERS_ONLY)
- IF(ALL_LIBRARY_DIRS)
- # LINK_DIRECTORIES applies only to targets which are added after the call to LINK_DIRECTORIES
- LINK_DIRECTORIES(${ALL_LIBRARY_DIRS})
- ENDIF(ALL_LIBRARY_DIRS)
- ADD_LIBRARY(${MODULE_PROVIDES} ${coverage_sources} ${CPP_FILES_GENERATED} ${Q${KITNAME}_GENERATED_CPP} ${DOX_FILES} ${UI_FILES} ${QRC_FILES})
- TARGET_LINK_LIBRARIES(${MODULE_PROVIDES} ${QT_LIBRARIES} ${ALL_LIBRARIES} QVTK)
- IF(MINGW)
- TARGET_LINK_LIBRARIES(${MODULE_PROVIDES} ssp) # add stack smash protection lib
- ENDIF()
- IF(MODULE_SUBPROJECTS)
- SET_PROPERTY(TARGET ${MODULE_PROVIDES} PROPERTY LABELS ${MODULE_SUBPROJECTS} MITK)
- FOREACH(subproject ${MODULE_SUBPROJECTS})
- ADD_DEPENDENCIES(${subproject} ${MODULE_PROVIDES})
- ENDFOREACH()
- ENDIF()
- ENDIF()
-
- ENDIF(NOT MODULE_QT_MODULE)
+ SET(coverage_sources ${CPP_FILES} ${CORRESPONDING__H_FILES} ${GLOBBED__H_FILES} ${TXX_FILES} ${TOOL_GUI_CPPS})
+ SET_PROPERTY(SOURCE ${coverage_sources} APPEND PROPERTY LABELS ${MODULE_SUBPROJECTS})
+
+ IF(NOT MODULE_HEADERS_ONLY)
+ IF(ALL_LIBRARY_DIRS)
+ # LINK_DIRECTORIES applies only to targets which are added after the call to LINK_DIRECTORIES
+ LINK_DIRECTORIES(${ALL_LIBRARY_DIRS})
+ ENDIF(ALL_LIBRARY_DIRS)
+ ADD_LIBRARY(${MODULE_PROVIDES} ${coverage_sources} ${CPP_FILES_GENERATED} ${Q${KITNAME}_GENERATED_CPP} ${DOX_FILES} ${UI_FILES} ${QRC_FILES})
+ TARGET_LINK_LIBRARIES(${MODULE_PROVIDES} ${QT_LIBRARIES} ${ALL_LIBRARIES} QVTK)
+ IF(MINGW)
+ TARGET_LINK_LIBRARIES(${MODULE_PROVIDES} ssp) # add stack smash protection lib
+ ENDIF()
+ IF(MODULE_SUBPROJECTS)
+ SET_PROPERTY(TARGET ${MODULE_PROVIDES} PROPERTY LABELS ${MODULE_SUBPROJECTS} MITK)
+ FOREACH(subproject ${MODULE_SUBPROJECTS})
+ ADD_DEPENDENCIES(${subproject} ${MODULE_PROVIDES})
+ ENDFOREACH()
+ ENDIF()
+ ENDIF()
+
+ ENDIF(NOT MODULE_QT_MODULE)
- #IF(NOT MODULE_HEADERS_ONLY AND TARGET EP_MITK)
- # ADD_DEPENDENCIES(${MODULE_PROVIDES} EP_MITK)
- #ENDIF()
+ #IF(NOT MODULE_HEADERS_ONLY AND TARGET EP_MITK)
+ # ADD_DEPENDENCIES(${MODULE_PROVIDES} EP_MITK)
+ #ENDIF()
- # install only if shared lib (for now)
- IF(NOT _STATIC OR MINGW)
- IF(NOT MODULE_HEADERS_ONLY)
- # # deprecated: MITK_INSTALL_TARGETS(${MODULE_PROVIDES})
- ENDIF()
- ENDIF(NOT _STATIC OR MINGW)
-
- ENDIF(NOT MODULE_QT_MODULE OR MITK_USE_QT)
- ENDIF(MODULE_IS_ENABLED)
- ENDIF(_MISSING_DEP)
-
+ # install only if shared lib (for now)
+ IF(NOT _STATIC OR MINGW)
+ IF(NOT MODULE_HEADERS_ONLY)
+ # # deprecated: MITK_INSTALL_TARGETS(${MODULE_PROVIDES})
+ ENDIF()
+ ENDIF(NOT _STATIC OR MINGW)
+
+ ENDIF(NOT MODULE_QT_MODULE OR MITK_USE_QT)
+ ENDIF(MODULE_IS_ENABLED)
+ ENDIF(_MISSING_DEP)
+ ENDIF(NOT MODULE_IS_EXCLUDED)
+
IF(NOT MODULE_IS_ENABLED)
_MITK_CREATE_MODULE_CONF()
ENDIF(NOT MODULE_IS_ENABLED)
ENDMACRO(MITK_CREATE_MODULE)
diff --git a/CMake/mitkMacroInstall.cmake b/CMake/mitkMacroInstall.cmake
index 83a275f61a..99f4d61069 100644
--- a/CMake/mitkMacroInstall.cmake
+++ b/CMake/mitkMacroInstall.cmake
@@ -1,135 +1,125 @@
#
# MITK specific install macro
#
# On Mac everything is installed for each bundle listed in MACOSX_BUNDLE_NAMES
# by replacing the DESTINATION parameter. Everything else is passed to the CMake INSTALL command
#
# Usage: MITK_INSTALL( )
#
MACRO(MITK_INSTALL)
SET(ARGS ${ARGN})
SET(install_directories "")
LIST(FIND ARGS DESTINATION _destination_index)
# SET(_install_DESTINATION "")
IF(_destination_index GREATER -1)
MESSAGE(SEND_ERROR "MITK_INSTALL macro must not be called with a DESTINATION parameter.")
### This code was a try to replace a given DESTINATION
#MATH(EXPR _destination_index ${_destination_index} + 1)
#LIST(GET ARGS ${_destination_index} _install_DESTINATION)
#STRING(REGEX REPLACE ^bin "" _install_DESTINATION ${_install_DESTINATION})
ELSE()
IF(NOT MACOSX_BUNDLE_NAMES)
INSTALL(${ARGS} DESTINATION bin)
ELSE()
FOREACH(bundle_name ${MACOSX_BUNDLE_NAMES})
INSTALL(${ARGS} DESTINATION ${bundle_name}.app/Contents/MacOS/${_install_DESTINATION})
ENDFOREACH()
ENDIF()
ENDIF()
ENDMACRO()
# Fix _target_location
# This is used in several install macros
MACRO(_fixup_target)
INSTALL(CODE "
MACRO(gp_item_default_embedded_path_override item default_embedded_path_var)
GET_FILENAME_COMPONENT(_item_name \"\${item}\" NAME)
GET_FILENAME_COMPONENT(_item_path \"\${item}\" PATH)
- IF(_item_name MATCHES \"liborg\")
+
+ # We have to fix all path references to build trees for plugins
+
+ IF(NOT _item_path MATCHES \"\${CMAKE_INSTALL_PREFIX}/${_bundle_dest_dir}\")
+ # item with relative path or embedded path pointing to some build dir
+ SET(full_path \"full_path-NOTFOUND\")
+ FILE (GLOB_RECURSE full_path \${CMAKE_INSTALL_PREFIX}/${_bundle_dest_dir}/\${_item_name} )
+ GET_FILENAME_COMPONENT(_item_path \"\${full_path}\" PATH)
+ ENDIF()
+
+ IF(_item_path STREQUAL \"\${CMAKE_INSTALL_PREFIX}/${_bundle_dest_dir}/plugins\"
+ OR _item_name MATCHES \"liborg\" # this is for legacy BlueBerry bundle support
+ )
+ # Only fix plugins
+ MESSAGE(\"override: \${item}\")
+ MESSAGE(\"found file: \${_item_path}/\${_item_name}\")
IF(APPLE)
- SET(full_path \"full_path-NOTFOUND\")
- MESSAGE(\"override: \${item}\")
- FILE (GLOB_RECURSE full_path \${CMAKE_INSTALL_PREFIX}/${_bundle_dest_dir}/\${_item_name} )
- MESSAGE(\"find file: \${full_path}\")
-
- GET_FILENAME_COMPONENT(_item_path \"\${full_path}\" PATH)
-
STRING(REPLACE
- \${CMAKE_INSTALL_PREFIX}
- @executable_path/../../../ \${default_embedded_path_var} \"\${_item_path}\" )
- MESSAGE(\"override result: \${\${default_embedded_path_var}}\")
+ \${CMAKE_INSTALL_PREFIX}/${_bundle_dest_dir}
+ @executable_path \${default_embedded_path_var} \"\${_item_path}\" )
ELSE()
SET(\${default_embedded_path_var} \"\${_item_path}\")
ENDIF()
+ MESSAGE(\"override result: \${\${default_embedded_path_var}}\")
ENDIF()
-
- #IF(_item_name MATCHES \"^liborg\")
- # IF(APPLE)
- # MESSAGE(\"override: \${item}\")
- # STRING(REPLACE
- # ${CMAKE_INSTALL_PREFIX}
- # @loader_path/../ \${default_embedded_path_var} \"\${_item_path}\" )
- # ELSE(APPLE)
- # SET(\${default_embedded_path_var} \"\${_item_path}\")
- # ENDIF(APPLE)
- #ENDIF()
ENDMACRO(gp_item_default_embedded_path_override)
MACRO(gp_resolved_file_type_override file type)
IF(NOT APPLE)
GET_FILENAME_COMPONENT(_file_path \"\${file}\" PATH)
GET_FILENAME_COMPONENT(_file_name \"\${file}\" NAME)
IF(_file_path MATCHES \"^\${CMAKE_INSTALL_PREFIX}\")
SET(\${type} \"local\")
- # On linux, rpaths are removed from the plugins
- # if installing more than on application. This override
- # should prevent this.
- IF(_file_name MATCHES \"^liborg\")
- SET(\${type} \"system\")
- ENDIF()
ENDIF()
IF(_file_name MATCHES gdiplus)
SET(\${type} \"system\")
ENDIF(_file_name MATCHES gdiplus)
ENDIF()
ENDMACRO(gp_resolved_file_type_override)
- SET(_rpath_relative ${MITK_INSTALL_RPATH_RELATIVE})
- IF(_rpath_relative AND NOT APPLE)
+ IF(NOT APPLE)
IF(UNIX OR MINGW)
MACRO(gp_resolve_item_override context item exepath dirs resolved_item_var resolved_var)
IF(\${item} MATCHES \"blueberry_osgi\")
GET_FILENAME_COMPONENT(_item_name \${item} NAME)
SET(\${resolved_item_var} \"\${exepath}/plugins/\${_item_name}\")
SET(\${resolved_var} 1)
ENDIF()
ENDMACRO()
ENDIF()
ENDIF()
IF(\"${_install_GLOB_PLUGINS}\" STREQUAL \"TRUE\")
file(GLOB_RECURSE GLOBBED_BLUEBERRY_PLUGINS
# glob for all blueberry bundles of this application
\"\${CMAKE_INSTALL_PREFIX}/${_bundle_dest_dir}/liborg*${CMAKE_SHARED_LIBRARY_SUFFIX}\")
ENDIF()
file(GLOB_RECURSE GLOBBED_QT_PLUGINS
# glob for Qt plugins
\"\${CMAKE_INSTALL_PREFIX}/${${_target_location}_qt_plugins_install_dir}/plugins/*${CMAKE_SHARED_LIBRARY_SUFFIX}\")
# use custom version of BundleUtilities
message(\"globbed plugins: \${GLOBBED_QT_PLUGINS} \${GLOBBED_BLUEBERRY_PLUGINS}\")
SET(PLUGIN_DIRS)
SET(PLUGINS ${_install_PLUGINS} \${GLOBBED_QT_PLUGINS} \${GLOBBED_BLUEBERRY_PLUGINS})
if(PLUGINS)
list(REMOVE_DUPLICATES PLUGINS)
endif(PLUGINS)
foreach(_plugin \${GLOBBED_BLUEBERRY_PLUGINS})
get_filename_component(_pluginpath \${_plugin} PATH)
list(APPEND PLUGIN_DIRS \${_pluginpath})
endforeach(_plugin)
set(DIRS ${DIRS})
list(APPEND DIRS \${PLUGIN_DIRS})
list(REMOVE_DUPLICATES DIRS)
# use custom version of BundleUtilities
SET(CMAKE_MODULE_PATH ${MITK_SOURCE_DIR}/CMake ${CMAKE_MODULE_PATH} )
include(BundleUtilities)
fixup_bundle(\"\${CMAKE_INSTALL_PREFIX}/${_target_location}\" \"\${PLUGINS}\" \"\${DIRS}\")
")
ENDMACRO()
diff --git a/CMake/mitkMacroInstallTargets.cmake b/CMake/mitkMacroInstallTargets.cmake
index 6575dd6e3d..532c9a6046 100644
--- a/CMake/mitkMacroInstallTargets.cmake
+++ b/CMake/mitkMacroInstallTargets.cmake
@@ -1,138 +1,138 @@
#
# MITK specific cross plattform install macro
#
# Usage: MITK_INSTALL_TARGETS(target1 [target2] ....)
#
MACRO(MITK_INSTALL_TARGETS)
MACRO_PARSE_ARGUMENTS(_install "TARGETS;EXECUTABLES;PLUGINS;LIBRARY_DIRS" "GLOB_PLUGINS" ${ARGN})
LIST(APPEND _install_TARGETS ${_install_DEFAULT_ARGS})
# TODO: how to supply the correct intermediate directory??
# CMAKE_CFG_INTDIR is not expanded to actual values inside the INSTALL(CODE "...") macro ...
SET(intermediate_dir )
IF(WIN32 AND NOT MINGW)
SET(intermediate_dir Release)
ENDIF()
SET(DIRS
- ${VTK_RUNTIME_LIBRARY_DIRS}/${intermediate_dir}
- ${ITK_LIBRARY_DIRS}/${intermediate_dir}
+ ${MITK_VTK_LIBRARY_DIRS}/${intermediate_dir}
+ ${MITK_ITK_LIBRARY_DIRS}/${intermediate_dir}
${QT_LIBRARY_DIR}
${QT_LIBRARY_DIR}/../bin
${MITK_BINARY_DIR}/bin/${intermediate_dir}
${CMAKE_RUNTIME_OUTPUT_DIRECTORY}/${intermediate_dir}
)
FOREACH(_lib_dir ${_install_LIBRARY_DIRS})
LIST(APPEND DIRS ${_lib_dir}/${intermediate_dir})
ENDFOREACH()
IF(GDCM_DIR)
LIST(APPEND DIRS ${GDCM_DIR}/bin/${intermediate_dir})
ENDIF()
IF(OpenCV_DIR)
LIST(APPEND DIRS ${OpenCV_DIR}/bin/${intermediate_dir})
ENDIF()
IF(MITK_USE_BLUEBERRY)
LIST(APPEND DIRS ${CTK_RUNTIME_LIBRARY_DIRS}/${intermediate_dir})
ENDIF()
LIST(REMOVE_DUPLICATES DIRS)
if(QT_LIBRARY_DIR MATCHES "^(/lib/|/lib32/|/lib64/|/usr/lib/|/usr/lib32/|/usr/lib64/|/usr/X11R6/)")
set(_qt_is_system_qt 1)
endif()
FOREACH(_target ${_install_EXECUTABLES})
GET_TARGET_PROPERTY(_is_bundle ${_target} MACOSX_BUNDLE)
SET(_qt_plugins_install_dirs "")
SET(_qt_conf_install_dirs "")
SET(_target_locations "")
IF(APPLE)
IF(_is_bundle)
SET(_target_locations ${_target}.app)
SET(${_target_locations}_qt_plugins_install_dir ${_target}.app/Contents/MacOS)
SET(_bundle_dest_dir ${_target}.app/Contents/MacOS)
SET(_qt_plugins_for_current_bundle ${_target}.app/Contents/MacOS)
SET(_qt_conf_install_dirs ${_target}.app/Contents/Resources)
INSTALL(TARGETS ${_target} BUNDLE DESTINATION . )
ELSE()
IF(NOT MACOSX_BUNDLE_NAMES)
SET(_qt_conf_install_dirs bin)
SET(_target_locations bin/${_target})
SET(${_target_locations}_qt_plugins_install_dir bin)
INSTALL(TARGETS ${_target} RUNTIME DESTINATION bin)
ELSE()
FOREACH(bundle_name ${MACOSX_BUNDLE_NAMES})
LIST(APPEND _qt_conf_install_dirs ${bundle_name}.app/Contents/Resources)
SET(_current_target_location ${bundle_name}.app/Contents/MacOS/${_target})
LIST(APPEND _target_locations ${_current_target_location})
SET(${_current_target_location}_qt_plugins_install_dir ${bundle_name}.app/Contents/MacOS)
MESSAGE( " SET(${_current_target_location}_qt_plugins_install_dir ${bundle_name}.app/Contents/MacOS) ")
INSTALL(TARGETS ${_target} RUNTIME DESTINATION ${bundle_name}.app/Contents/MacOS/)
ENDFOREACH()
ENDIF()
ENDIF()
ELSE()
SET(_target_locations bin/${_target}${CMAKE_EXECUTABLE_SUFFIX})
SET(${_target_locations}_qt_plugins_install_dir bin)
SET(_qt_conf_install_dirs bin)
INSTALL(TARGETS ${_target} RUNTIME DESTINATION bin)
ENDIF()
FOREACH(_target_location ${_target_locations})
IF(NOT _qt_is_system_qt)
IF(QT_PLUGINS_DIR)
IF(WIN32)
INSTALL(DIRECTORY "${QT_PLUGINS_DIR}"
DESTINATION ${${_target_location}_qt_plugins_install_dir}
CONFIGURATIONS Release
FILES_MATCHING REGEX "[^4d]4?${CMAKE_SHARED_LIBRARY_SUFFIX}"
)
INSTALL(DIRECTORY "${QT_PLUGINS_DIR}"
DESTINATION ${${_target_location}_qt_plugins_install_dir}
CONFIGURATIONS Debug
FILES_MATCHING REGEX "d4?${CMAKE_SHARED_LIBRARY_SUFFIX}"
)
ELSE(WIN32)
# install everything, see bug 7143
INSTALL(DIRECTORY "${QT_PLUGINS_DIR}"
DESTINATION ${${_target_location}_qt_plugins_install_dir}
FILES_MATCHING REGEX "${CMAKE_SHARED_LIBRARY_SUFFIX}"
)
ENDIF(WIN32)
ENDIF()
ENDIF()
_fixup_target()
ENDFOREACH()
IF(NOT _qt_is_system_qt)
#--------------------------------------------------------------------------------
# install a qt.conf file
# this inserts some cmake code into the install script to write the file
SET(_qt_conf_plugin_install_prefix .)
IF(APPLE)
SET(_qt_conf_plugin_install_prefix ./MacOS)
ENDIF()
FOREACH(_qt_conf_install_dir ${_qt_conf_install_dirs})
INSTALL(CODE "file(WRITE \"\${CMAKE_INSTALL_PREFIX}/${_qt_conf_install_dir}/qt.conf\" \"
[Paths]
Prefix=${_qt_conf_plugin_install_prefix}
\")")
ENDFOREACH()
ENDIF()
ENDFOREACH()
ENDMACRO()
diff --git a/CMake/mitkMacroMultiplexPicType.cmake b/CMake/mitkMacroMultiplexPicType.cmake
index ba19ae9de6..9d192fbc78 100644
--- a/CMake/mitkMacroMultiplexPicType.cmake
+++ b/CMake/mitkMacroMultiplexPicType.cmake
@@ -1,20 +1,20 @@
#
# MITK_MULTIPLEX_PICTYPE: generate separated source files for different
# data types to reduce memory consumption of compiler during template
# instantiation
#
# Param "file" should be named like mitkMyAlgo-TYPE.cpp
# in the file, every occurence of @TYPE@ is replaced by the
# datatype. For each datatype, a new file mitkMyAlgo-datatype.cpp
# is generated and added to CPP_FILES_GENERATED.
#
MACRO(MITK_MULTIPLEX_PICTYPE file)
- SET(TYPES "double;float;int;unsigned int;short;unsigned short;char;unsigned char")
+ STRING(REPLACE "," ";" TYPES "${MITK_ACCESSBYITK_PIXEL_TYPES}")
FOREACH(TYPE ${TYPES})
# create filename for destination
STRING(REPLACE " " "_" quoted_type "${TYPE}")
STRING(REPLACE TYPE ${quoted_type} quoted_file ${file})
CONFIGURE_FILE(${CMAKE_CURRENT_SOURCE_DIR}/${file} ${CMAKE_CURRENT_BINARY_DIR}/${quoted_file} @ONLY)
SET(CPP_FILES_GENERATED ${CPP_FILES_GENERATED} ${CMAKE_CURRENT_BINARY_DIR}/${quoted_file})
ENDFOREACH(TYPE)
ENDMACRO(MITK_MULTIPLEX_PICTYPE)
diff --git a/CMake/mitkSetupBlueBerry.cmake b/CMake/mitkSetupBlueBerry.cmake
index 8b1a0efe63..14332f43e1 100644
--- a/CMake/mitkSetupBlueBerry.cmake
+++ b/CMake/mitkSetupBlueBerry.cmake
@@ -1,33 +1,31 @@
-set(BLUEBERRY_INSTALL_RPATH_RELATIVE ${MITK_INSTALL_RPATH_RELATIVE}
- CACHE BOOL "Use relative rpath entries when installing" FORCE)
set(BLUEBERRY_USE_QT ${MITK_USE_QT} CACHE BOOL "Use the Qt GUI toolkit" FORCE)
mark_as_advanced(BLUEBERRY_USE_QT)
# Clear the cache variables containing plugin base directories
set(MITK_MODULES_PLUGIN_SOURCE_DIRS "" CACHE INTERNAL "List of base plugin source directories" FORCE)
set(MITK_MODULES_PLUGIN_OUTPUT_DIRS "" CACHE INTERNAL "List of base plugin output directories" FORCE)
set(mbilog_DIR "${mbilog_BINARY_DIR}")
if(MITK_BUILD_ALL_PLUGINS)
set(BLUEBERRY_BUILD_ALL_PLUGINS ON)
endif()
add_subdirectory(BlueBerry)
set(BlueBerry_DIR ${CMAKE_CURRENT_BINARY_DIR}/BlueBerry
CACHE PATH "The directory containing a CMake configuration file for BlueBerry" FORCE)
include(${BlueBerry_DIR}/BlueBerryConfig.cmake)
include(mitkMacroCreatePlugin)
include(mitkMacroCreateCTKPlugin)
SET(CTK_PLUGIN_LIBRARIES ${CTK_PLUGIN_LIBRARIES} CACHE INTERNAL "CTK plugins" FORCE)
# Extract all library names starting with org_mitk_
MACRO(GetMyTargetLibraries all_target_libraries varname)
SET(re_ctkplugin "^org_mitk_[a-zA-Z0-9_]+$")
SET(_tmp_list)
LIST(APPEND _tmp_list ${all_target_libraries})
ctkMacroListFilter(_tmp_list re_ctkplugin OUTPUT_VARIABLE ${varname})
ENDMACRO()
diff --git a/CMake/mitkSetupCPack.cmake b/CMake/mitkSetupCPack.cmake
index bab79daed4..968fb0274d 100644
--- a/CMake/mitkSetupCPack.cmake
+++ b/CMake/mitkSetupCPack.cmake
@@ -1,50 +1,58 @@
#
# First, set the generator variable
#
IF(NOT CPACK_GENERATOR)
IF(WIN32)
FIND_PROGRAM(NSIS_MAKENSIS NAMES makensis
PATHS [HKEY_LOCAL_MACHINE\\SOFTWARE\\NSIS]
DOC "Where is makensis.exe located"
)
IF(NOT NSIS_MAKENSIS)
SET(CPACK_GENERATOR ZIP)
ELSE()
SET(CPACK_GENERATOR "NSIS;ZIP")
ENDIF(NOT NSIS_MAKENSIS)
ELSE()
IF(APPLE)
SET(CPACK_GENERATOR DragNDrop)
ELSE()
SET(CPACK_GENERATOR TGZ)
ENDIF()
ENDIF()
ENDIF(NOT CPACK_GENERATOR)
# include required mfc libraries
INCLUDE(InstallRequiredSystemLibraries)
SET(CPACK_PACKAGE_NAME "MITK")
SET(CPACK_PACKAGE_DESCRIPTION_SUMMARY "MITK is a medical image processing tool")
SET(CPACK_PACKAGE_VENDOR "German Cancer Research Center (DKFZ)")
SET(CPACK_CREATE_DESKTOP_LINKS "ExtApp")
SET(CPACK_PACKAGE_DESCRIPTION_FILE "${MITK_SOURCE_DIR}/MITKCopyright.txt")
SET(CPACK_RESOURCE_FILE_LICENSE "${MITK_SOURCE_DIR}/MITKCopyright.txt")
SET(CPACK_PACKAGE_VERSION_MAJOR "${MITK_VERSION_MAJOR}")
SET(CPACK_PACKAGE_VERSION_MINOR "${MITK_VERSION_MINOR}")
# tell cpack to strip all debug symbols from all files
SET(CPACK_STRIP_FILES ON)
# append revision number if available
-IF(MITK_WC_REVISION_HASH)
- STRING(SUBSTRING ${MITK_WC_REVISION_HASH} 0 6 git_hash)
- SET(CPACK_PACKAGE_VERSION_PATCH "${MITK_VERSION_PATCH}_r${git_hash}")
+IF(MITK_REVISION_ID)
+ IF(MITK_WC_TYPE STREQUAL "git")
+ SET(git_hash ${MITK_REVISION_ID})
+ STRING(LENGTH "${git_hash}" hash_length)
+ IF(hash_length GREATER 6)
+ STRING(SUBSTRING ${git_hash} 0 6 git_hash)
+ ENDIF()
+ SET(CPACK_PACKAGE_VERSION_PATCH "${MITK_VERSION_PATCH}_r${git_hash}")
+ ELSE()
+ SET(CPACK_PACKAGE_VERSION_PATCH "${MITK_VERSION_PATCH}_r${MITK_REVISION_ID}")
+ ENDIF()
ELSE()
SET(CPACK_PACKAGE_VERSION_PATCH "${MITK_VERSION_PATCH}")
ENDIF()
diff --git a/CMake/mitkSetupVariables.cmake b/CMake/mitkSetupVariables.cmake
index adc3f0bf39..4f8132f6ef 100644
--- a/CMake/mitkSetupVariables.cmake
+++ b/CMake/mitkSetupVariables.cmake
@@ -1,104 +1,146 @@
if(MITK_BUILD_ALL_PLUGINS)
set(MITK_BUILD_ALL_PLUGINS_OPTION "FORCE_BUILD_ALL")
endif()
set(LIBPOSTFIX "")
# MITK_VERSION
set(MITK_VERSION_MAJOR "0")
set(MITK_VERSION_MINOR "15")
set(MITK_VERSION_PATCH "1")
set(MITK_VERSION_STRING "${MITK_VERSION_MAJOR}.${MITK_VERSION_MINOR}.${MITK_VERSION_PATCH}")
if(NOT UNIX AND NOT MINGW)
set(MITK_WIN32_FORCE_STATIC "STATIC" CACHE INTERNAL "Use this variable to always build static libraries on non-unix platforms")
endif()
# build the MITK_INCLUDE_DIRS variable
set(MITK_INCLUDE_DIRS ${PROJECT_BINARY_DIR})
set(CORE_DIRECTORIES DataManagement Algorithms IO Rendering Interactions Controllers)
foreach(d ${CORE_DIRECTORIES})
list(APPEND MITK_INCLUDE_DIRS ${CMAKE_CURRENT_SOURCE_DIR}/Core/Code/${d})
endforeach()
#list(APPEND MITK_INCLUDE_DIRS
#${ITK_INCLUDE_DIRS}
#${VTK_INCLUDE_DIRS}
# )
foreach(d Utilities Utilities/ipPic Utilities/IIL4MITK Utilities/pic2vtk Utilities/tinyxml Utilities/mbilog)
list(APPEND MITK_INCLUDE_DIRS ${CMAKE_CURRENT_SOURCE_DIR}/${dir})
endforeach()
if(WIN32)
list(APPEND MITK_INCLUDE_DIRS ${CMAKE_CURRENT_SOURCE_DIR}/Utilities/ipPic/win32)
endif()
# additional include dirs variables
set(ANN_INCLUDE_DIR ${CMAKE_CURRENT_SOURCE_DIR}/Utilities/ann/include)
set(IPSEGMENTATION_INCLUDE_DIR ${CMAKE_CURRENT_SOURCE_DIR}/Utilities/ipSegmentation)
# variables containing librariy names
set(MITK_CORE_LIBRARIES mitkCore)
set(VTK_FOR_MITK_LIBRARIES
vtkGraphics
vtkCommon
vtkFiltering
vtkftgl
vtkGraphics
vtkHybrid
vtkImaging
vtkIO
vtkParallel
vtkRendering
vtkVolumeRendering
vtkWidgets
${VTK_JPEG_LIBRARIES}
${VTK_PNG_LIBRARIES}
${VTK_ZLIB_LIBRARIES}
${VTK_EXPAT_LIBRARIES}
${VTK_FREETYPE_LIBRARIES}
)
# TODO: maybe solve this with lib depends mechanism of CMake
set(UTIL_FOR_MITK_LIBRARIES mitkIpPic mitkIpFunc mbilog)
set(LIBRARIES_FOR_MITK_CORE
${UTIL_FOR_MITK_LIBRARIES}
${VTK_FOR_MITK_LIBRARIES}
${ITK_LIBRARIES}
)
set(MITK_LIBRARIES
${MITK_CORE_LIBRARIES}
${LIBRARIES_FOR_MITK_CORE}
pic2vtk
IIL4MITK
ipSegmentation
ann
)
+
+# variables used in CMake macros which are called from external projects
+set(MITK_VTK_LIBRARY_DIRS ${VTK_LIBRARY_DIRS})
+set(MITK_ITK_LIBRARY_DIRS ${ITK_LIBRARY_DIRS})
# variables containing link directories
set(MITK_LIBRARY_DIRS ${CMAKE_LIBRARY_OUTPUT_DIRECTORY})
set(MITK_LINK_DIRECTORIES ${CMAKE_LIBRARY_OUTPUT_DIRECTORY} ${ITK_LIBRARY_DIRS} ${VTK_LIBRARY_DIRS})
# Qt support
if(MITK_USE_QT)
find_package(Qt4 REQUIRED)
set(QMITK_INCLUDE_DIRS
${MITK_INCLUDE_DIRS}
${CMAKE_CURRENT_SOURCE_DIR}/CoreUI/Qmitk
${PROJECT_BINARY_DIR}/CoreUI/Qmitk
)
foreach(d QmitkApplicationBase QmitkModels QmitkPropertyObservers)
list(APPEND QMITK_INCLUDE_DIRS ${CMAKE_CURRENT_SOURCE_DIR}/CoreUI/Qmitk/${d})
endforeach()
list(APPEND QMITK_INCLUDE_DIRS ${QWT_INCLUDE_DIR})
set(QMITK_LIBRARIES Qmitk ${MITK_LIBRARIES} ${QT_LIBRARIES})
set(QMITK_LINK_DIRECTORIES ${MITK_LINK_DIRECTORIES} ${QT_LIBRARY_DIR})
endif()
if(MITK_BUILD_ALL_PLUGINS)
set(MITK_BUILD_ALL_PLUGINS_OPTION "FORCE_BUILD_ALL")
endif()
+# create a list of types for template instantiations of itk image access functions
+function(_create_type_seq TYPES seq_var seqdim_var)
+ set(_seq )
+ set(_seq_dim )
+ string(REPLACE "," ";" _pixeltypes "${TYPES}")
+ foreach(_pixeltype ${_pixeltypes})
+ set(_seq "${_seq}(${_pixeltype})")
+ set(_seq_dim "${_seq_dim}((${_pixeltype},dim))")
+ endforeach()
+ set(${seq_var} "${_seq}" PARENT_SCOPE)
+ set(${seqdim_var} "${_seq_dim}" PARENT_SCOPE)
+endfunction()
+
+set(MITK_ACCESSBYITK_PIXEL_TYPES )
+set(MITK_ACCESSBYITK_PIXEL_TYPES_SEQ )
+set(MITK_ACCESSBYITK_TYPES_DIMN_SEQ )
+foreach(_type INTEGRAL FLOATING COMPOSITE)
+ set(_typelist "${MITK_ACCESSBYITK_${_type}_PIXEL_TYPES}")
+ if(_typelist)
+ if(MITK_ACCESSBYITK_PIXEL_TYPES)
+ set(MITK_ACCESSBYITK_PIXEL_TYPES "${MITK_ACCESSBYITK_PIXEL_TYPES},${_typelist}")
+ else()
+ set(MITK_ACCESSBYITK_PIXEL_TYPES "${_typelist}")
+ endif()
+ endif()
+
+ _create_type_seq("${_typelist}"
+ MITK_ACCESSBYITK_${_type}_PIXEL_TYPES_SEQ
+ MITK_ACCESSBYITK_${_type}_TYPES_DIMN_SEQ)
+ set(MITK_ACCESSBYITK_PIXEL_TYPES_SEQ "${MITK_ACCESSBYITK_PIXEL_TYPES_SEQ}${MITK_ACCESSBYITK_${_type}_PIXEL_TYPES_SEQ}")
+ set(MITK_ACCESSBYITK_TYPES_DIMN_SEQ "${MITK_ACCESSBYITK_TYPES_DIMN_SEQ}${MITK_ACCESSBYITK_${_type}_TYPES_DIMN_SEQ}")
+endforeach()
+
+set(MITK_ACCESSBYITK_DIMENSIONS_SEQ )
+string(REPLACE "," ";" _dimensions "${MITK_ACCESSBYITK_DIMENSIONS}")
+foreach(_dimension ${_dimensions})
+ set(MITK_ACCESSBYITK_DIMENSIONS_SEQ "${MITK_ACCESSBYITK_DIMENSIONS_SEQ}(${_dimension})")
+endforeach()
diff --git a/CMake/mitkSuperBuildPlugins.cmake b/CMake/mitkSuperBuildPlugins.cmake
deleted file mode 100644
index 3fa563b06c..0000000000
--- a/CMake/mitkSuperBuildPlugins.cmake
+++ /dev/null
@@ -1,12 +0,0 @@
-set(MITK_SUPERBUILD_PLUGINS
- org.mitk.gui.qt.basicimageprocessing
- org.mitk.gui.qt.imagecropper
- org.mitk.gui.qt.imagestatistics
- org.mitk.gui.qt.isosurface
- org.mitk.gui.qt.materialeditor
- org.mitk.gui.qt.measurement
- org.mitk.gui.qt.regiongrowing
- org.mitk.gui.qt.segmentation
- org.mitk.gui.qt.simplemeasurement
- org.mitk.gui.qt.volumevisualization
-)
diff --git a/CMake/mitkTestProjectTemplate.cmake b/CMake/mitkTestProjectTemplate.cmake
new file mode 100644
index 0000000000..2d6962d19d
--- /dev/null
+++ b/CMake/mitkTestProjectTemplate.cmake
@@ -0,0 +1,44 @@
+if(BUILD_TESTING)
+
+ include(ExternalProject)
+
+ set(proj MITK-ProjectTemplate)
+ set(MITK-ProjectTemplate_BINARY_DIR "${MITK_BINARY_DIR}/${proj}-build")
+
+ ExternalProject_Add(${proj}
+ GIT_REPOSITORY git://github.com/MITK/MITK-ProjectTemplate.git
+ GIT_TAG origin/master
+ SOURCE_DIR "${MITK_BINARY_DIR}/${proj}"
+ BINARY_DIR "${MITK-ProjectTemplate_BINARY_DIR}"
+ BUILD_COMMAND ""
+ INSTALL_COMMAND ""
+ CMAKE_GENERATOR "${CMAKE_GENERATOR}"
+ CMAKE_ARGS
+ -DQT_QMAKE_EXECUTABLE:FILEPATH=${QT_QMAKE_EXECUTABLE}
+ -DMITK_DIR:PATH=${MITK_BINARY_DIR}
+ -DCMAKE_BUILD_TYPE=${CMAKE_BUILD_TYPE}
+ -DAwesomeProject_BUILD_ALL_PLUGINS:BOOL=ON
+ )
+
+ add_test(NAME mitkProjectTemplateBuildTest
+ COMMAND ${CMAKE_COMMAND} --build ${MITK-ProjectTemplate_BINARY_DIR} --config $<CONFIGURATION>)
+ set_tests_properties(mitkProjectTemplateBuildTest PROPERTIES
+ LABELS "MITK;BlueBerry")
+
+ set(package_test_configurations)
+ if(WIN32)
+ # Only test packaging if build type is "Release" on Windows
+ set(package_test_configurations CONFIGURATIONS Release)
+ endif()
+
+ if(NOT MITK_FAST_TESTING)
+ add_test(NAME mitkProjectTemplatePackageTest ${package_test_configurations}
+ COMMAND ${CMAKE_COMMAND} --build ${MITK-ProjectTemplate_BINARY_DIR}/AwesomeProject-build --config $<CONFIGURATION> --target package)
+
+ set_tests_properties(mitkProjectTemplatePackageTest PROPERTIES
+ DEPENDS mitkProjectTemplateBuildTest
+ TIMEOUT 1200
+ LABELS "MITK;BlueBerry")
+ endif()
+
+endif()
diff --git a/CMakeExternals/CTK.cmake b/CMakeExternals/CTK.cmake
index 922d0aaf43..9a6fe63604 100644
--- a/CMakeExternals/CTK.cmake
+++ b/CMakeExternals/CTK.cmake
@@ -1,37 +1,38 @@
#-----------------------------------------------------------------------------
# CTK
#-----------------------------------------------------------------------------
IF(MITK_USE_CTK)
# Sanity checks
IF(DEFINED CTK_DIR AND NOT EXISTS ${CTK_DIR})
MESSAGE(FATAL_ERROR "CTK_DIR variable is defined but corresponds to non-existing directory")
ENDIF()
SET(proj CTK)
SET(proj_DEPENDENCIES )
SET(CTK_DEPENDS ${proj})
IF(NOT DEFINED CTK_DIR)
ExternalProject_Add(${proj}
GIT_REPOSITORY git://github.com/commontk/CTK.git
+ GIT_TAG 1608ad8ac1e0e548e3cb
BINARY_DIR ${proj}-build
INSTALL_COMMAND ""
CMAKE_GENERATOR ${gen}
CMAKE_ARGS
${ep_common_args}
-DDESIRED_QT_VERSION:STRING=4
-DQT_QMAKE_EXECUTABLE:FILEPATH=${QT_QMAKE_EXECUTABLE}
-DCTK_LIB_DICOM/Widgets:BOOL=ON
DEPENDS ${proj_DEPENDENCIES}
)
SET(CTK_DIR ${CMAKE_CURRENT_BINARY_DIR}/${proj}-build)
ELSE()
mitkMacroEmptyExternalProject(${proj} "${proj_DEPENDENCIES}")
ENDIF()
ENDIF()
diff --git a/CMakeLists.txt b/CMakeLists.txt
index 4848b9f747..9ad808bc9d 100644
--- a/CMakeLists.txt
+++ b/CMakeLists.txt
@@ -1,606 +1,649 @@
cmake_minimum_required(VERSION 2.8.2)
#-----------------------------------------------------------------------------
# Superbuild Option - Enabled by default
#-----------------------------------------------------------------------------
option(MITK_USE_SUPERBUILD "Build MITK and the projects it depends on via SuperBuild.cmake." ON)
if(MITK_USE_SUPERBUILD)
project(MITK-superbuild)
set(MITK_SOURCE_DIR ${PROJECT_SOURCE_DIR})
set(MITK_BINARY_DIR ${PROJECT_BINARY_DIR})
else()
project(MITK)
endif()
#-----------------------------------------------------------------------------
# See http://cmake.org/cmake/help/cmake-2-8-docs.html#section_Policies for details
#-----------------------------------------------------------------------------
set(project_policies
CMP0001 # NEW: CMAKE_BACKWARDS_COMPATIBILITY should no longer be used.
CMP0002 # NEW: Logical target names must be globally unique.
CMP0003 # NEW: Libraries linked via full path no longer produce linker search paths.
CMP0004 # NEW: Libraries linked may NOT have leading or trailing whitespace.
CMP0005 # NEW: Preprocessor definition values are now escaped automatically.
CMP0006 # NEW: Installing MACOSX_BUNDLE targets requires a BUNDLE DESTINATION.
CMP0007 # NEW: List command no longer ignores empty elements.
CMP0008 # NEW: Libraries linked by full-path must have a valid library file name.
CMP0009 # NEW: FILE GLOB_RECURSE calls should not follow symlinks by default.
CMP0010 # NEW: Bad variable reference syntax is an error.
CMP0011 # NEW: Included scripts do automatic cmake_policy PUSH and POP.
CMP0012 # NEW: if() recognizes numbers and boolean constants.
CMP0013 # NEW: Duplicate binary directories are not allowed.
CMP0014 # NEW: Input directories must have CMakeLists.txt
)
foreach(policy ${project_policies})
if(POLICY ${policy})
cmake_policy(SET ${policy} NEW)
endif()
endforeach()
#-----------------------------------------------------------------------------
# Update CMake module path
#------------------------------------------------------------------------------
set(CMAKE_MODULE_PATH
${MITK_SOURCE_DIR}/CMake
${CMAKE_MODULE_PATH}
)
#-----------------------------------------------------------------------------
# CMake Function(s) and Macro(s)
#-----------------------------------------------------------------------------
include(mitkMacroEmptyExternalProject)
include(mitkFunctionGenerateProjectXml)
#-----------------------------------------------------------------------------
# Output directories.
#-----------------------------------------------------------------------------
foreach(type LIBRARY RUNTIME ARCHIVE)
# Make sure the directory exists
if(DEFINED MITK_CMAKE_${type}_OUTPUT_DIRECTORY
AND NOT EXISTS ${MITK_CMAKE_${type}_OUTPUT_DIRECTORY})
message("Creating directory MITK_CMAKE_${type}_OUTPUT_DIRECTORY: ${MITK_CMAKE_${type}_OUTPUT_DIRECTORY}")
file(MAKE_DIRECTORY "${MITK_CMAKE_${type}_OUTPUT_DIRECTORY}")
endif()
if(MITK_USE_SUPERBUILD)
set(output_dir ${MITK_BINARY_DIR}/bin)
if(NOT DEFINED MITK_CMAKE_${type}_OUTPUT_DIRECTORY)
set(MITK_CMAKE_${type}_OUTPUT_DIRECTORY ${MITK_BINARY_DIR}/MITK-build/bin)
endif()
else()
if(NOT DEFINED MITK_CMAKE_${type}_OUTPUT_DIRECTORY)
SET(output_dir ${MITK_BINARY_DIR}/bin)
else()
SET(output_dir ${MITK_CMAKE_${type}_OUTPUT_DIRECTORY})
endif()
endif()
set(CMAKE_${type}_OUTPUT_DIRECTORY ${output_dir} CACHE INTERNAL "Single output directory for building all libraries.")
mark_as_advanced(CMAKE_${type}_OUTPUT_DIRECTORY)
endforeach()
#-----------------------------------------------------------------------------
# Additional MITK Options (also shown during superbuild)
#-----------------------------------------------------------------------------
option(BUILD_SHARED_LIBS "Build MITK with shared libraries" ON)
option(WITH_COVERAGE "Enable/Disable coverage" OFF)
option(BUILD_TESTING "Test the project" ON)
# some targets in Utilities also depend on Qt. Use this option
# to decide if they should be build
option(MITK_USE_QT "Use Trolltech's Qt library" ON)
if(MITK_USE_QT)
# find the package at the very beginning, so that QT4_FOUND is available
find_package(Qt4 4.6.0 REQUIRED)
endif()
-option(MITK_INSTALL_RPATH_RELATIVE "Use relative rpath entries for installation packages" OFF)
option(MITK_BUILD_ALL_PLUGINS "Build all MITK plugins" OFF)
option(MITK_BUILD_TUTORIAL "Build the MITK tutorial" ON)
option(MITK_USE_Boost "Use the Boost C++ library" OFF)
option(MITK_USE_BLUEBERRY "Build the BlueBerry platform" ON)
option(MITK_USE_CTK "Use CTK in MITK" ${MITK_USE_BLUEBERRY})
option(MITK_USE_DCMTK "EXEPERIMENTAL, superbuild only: Use DCMTK in MITK" OFF)
option(MITK_USE_OpenCV "Use Intel's OpenCV library" OFF)
-mark_as_advanced(MITK_INSTALL_RPATH_RELATIVE
- MITK_BUILD_ALL_PLUGINS
+mark_as_advanced(MITK_BUILD_ALL_PLUGINS
MITK_USE_CTK
MITK_USE_DCMTK
)
-
+
+set(MITK_ACCESSBYITK_INTEGRAL_PIXEL_TYPES
+ "int, unsigned int, short, unsigned short, char, unsigned char"
+ CACHE STRING "List of integral pixel types used in AccessByItk and InstantiateAccessFunction macros")
+
+set(MITK_ACCESSBYITK_FLOATING_PIXEL_TYPES
+ "double, float"
+ CACHE STRING "List of floating pixel types used in AccessByItk and InstantiateAccessFunction macros")
+
+set(MITK_ACCESSBYITK_COMPOSITE_PIXEL_TYPES
+ ""
+ CACHE STRING "List of composite pixel types used in AccessByItk and InstantiateAccessFunction macros")
+
+set(MITK_ACCESSBYITK_DIMENSIONS
+ "2,3"
+ CACHE STRING "List of dimensions used in AccessByItk and InstantiateAccessFunction macros")
+
+mark_as_advanced(MITK_ACCESSBYITK_INTEGRAL_PIXEL_TYPES
+ MITK_ACCESSBYITK_FLOATING_PIXEL_TYPES
+ MITK_ACCESSBYITK_COMPOSITE_PIXEL_TYPES
+ MITK_ACCESSBYITK_DIMENSIONS
+ )
+
# consistency checks
if(MITK_USE_BLUEBERRY AND NOT MITK_USE_CTK)
MESSAGE(FATAL_ERROR "BlueBerry depends on CTK. Please set MITK_USE_CTK to ON.")
endif()
+if(NOT MITK_ACCESSBYITK_INTEGRAL_PIXEL_TYPES)
+ set(MITK_ACCESSBYITK_INTEGRAL_PIXEL_TYPES
+ "int, unsigned int, short, unsigned short, char, unsigned char"
+ CACHE STRING "List of integral pixel types used in AccessByItk and InstantiateAccessFunction macros" FORCE)
+endif()
+
+if(NOT MITK_ACCESSBYITK_FLOATING_PIXEL_TYPES)
+ set(MITK_ACCESSBYITK_FLOATING_PIXEL_TYPES
+ "double, float"
+ CACHE STRING "List of floating pixel types used in AccessByItk and InstantiateAccessFunction macros" FORCE)
+endif()
+
+if(NOT MITK_ACCESSBYITK_DIMENSIONS)
+ set(MITK_ACCESSBYITK_DIMENSIONS
+ "2,3"
+ CACHE STRING "List of dimensions used in AccessByItk and InstantiateAccessFunction macros")
+endif()
+
#-----------------------------------------------------------------------------
# Additional CXX/C Flags
#-----------------------------------------------------------------------------
set(ADDITIONAL_C_FLAGS "" CACHE STRING "Additional C Flags")
mark_as_advanced(ADDITIONAL_C_FLAGS)
set(ADDITIONAL_CXX_FLAGS "" CACHE STRING "Additional CXX Flags")
mark_as_advanced(ADDITIONAL_CXX_FLAGS)
#-----------------------------------------------------------------------------
# Project.xml
#-----------------------------------------------------------------------------
# A list of topologically ordered targets
set(CTEST_PROJECT_SUBPROJECTS)
if(MITK_USE_BLUEBERRY)
list(APPEND CTEST_PROJECT_SUBPROJECTS BlueBerry)
endif()
list(APPEND CTEST_PROJECT_SUBPROJECTS
MITK-Core
MITK-CoreUI
MITK-IGT
MITK-ToF
MITK-DTI
MITK-Registration
MITK-Modules # all modules not contained in a specific subproject
MITK-Plugins # all plugins not contained in a specific subproject
)
# Configure CTestConfigSubProject.cmake that could be used by CTest scripts
configure_file(${MITK_SOURCE_DIR}/CTestConfigSubProject.cmake.in
${MITK_BINARY_DIR}/CTestConfigSubProject.cmake)
if(CTEST_PROJECT_ADDITIONAL_TARGETS)
# those targets will be executed at the end of the ctest driver script
# and they also get their own subproject label
set(subproject_list "${CTEST_PROJECT_SUBPROJECTS};${CTEST_PROJECT_ADDITIONAL_TARGETS}")
else()
set(subproject_list "${CTEST_PROJECT_SUBPROJECTS}")
endif()
# Generate Project.xml file expected by the CTest driver script
mitkFunctionGenerateProjectXml(${MITK_BINARY_DIR} ${PROJECT_NAME} "${subproject_list}" ${MITK_USE_SUPERBUILD})
#-----------------------------------------------------------------------------
# Superbuild script
#-----------------------------------------------------------------------------
if(MITK_USE_SUPERBUILD)
include("${CMAKE_CURRENT_SOURCE_DIR}/SuperBuild.cmake")
return()
endif()
#*****************************************************************************
#**************************** END OF SUPERBUILD ****************************
#*****************************************************************************
#-----------------------------------------------------------------------------
# CMake Function(s) and Macro(s)
#-----------------------------------------------------------------------------
include(mitkFunctionCheckCompilerFlags)
include(mitkFunctionGetGccVersion)
include(MacroParseArguments)
include(mitkFunctionSuppressWarnings) # includes several functions
include(mitkFunctionOrganizeSources)
include(mitkFunctionGetVersion)
include(mitkFunctionCreateWindowsBatchScript)
include(mitkFunctionInstallProvisioningFiles)
include(mitkMacroCreateModuleConf)
include(mitkMacroCreateModule)
include(mitkMacroCheckModule)
include(mitkMacroCreateModuleTests)
include(mitkFunctionAddCustomModuleTest)
include(mitkMacroUseModule)
include(mitkMacroMultiplexPicType)
include(mitkMacroInstall)
include(mitkMacroInstallHelperApp)
include(mitkMacroInstallTargets)
include(mitkMacroGenerateToolsLibrary)
include(mitkMacroGetLinuxDistribution)
#-----------------------------------------------------------------------------
# Prerequesites
#-----------------------------------------------------------------------------
find_package(ITK REQUIRED)
find_package(VTK REQUIRED)
#-----------------------------------------------------------------------------
# Set MITK specific options and variables (NOT available during superbuild)
#-----------------------------------------------------------------------------
# ASK THE USER TO SHOW THE CONSOLE WINDOW FOR CoreApp and ExtApp
option(MITK_SHOW_CONSOLE_WINDOW "Use this to enable or disable the console window when starting MITK GUI Applications" ON)
mark_as_advanced(MITK_SHOW_CONSOLE_WINDOW)
# TODO: check if necessary
option(USE_ITKZLIB "Use the ITK zlib for pic compression." ON)
mark_as_advanced(USE_ITKZLIB)
+if(NOT MITK_FAST_TESTING)
+ if(DEFINED MITK_CTEST_SCRIPT_MODE AND MITK_CTEST_SCRIPT_MODE STREQUAL "continuous")
+ set(MITK_FAST_TESTING 1)
+ endif()
+endif()
+
#-----------------------------------------------------------------------------
# Get MITK version info
#-----------------------------------------------------------------------------
mitkFunctionGetVersion(${MITK_SOURCE_DIR} MITK)
#-----------------------------------------------------------------------------
# Installation preparation
#
# These should be set before any MITK install macros are used
#-----------------------------------------------------------------------------
-if(MITK_INSTALL_RPATH_RELATIVE)
- set(CMAKE_INSTALL_RPATH ".")
-else()
- set(CMAKE_INSTALL_RPATH "${CMAKE_INSTALL_PREFIX}/bin")
-endif()
-
# on Mac OSX all BlueBerry plugins get copied into every
# application bundle (.app directory) specified here
if(APPLE)
if(MITK_BUILD_org.mitk.gui.qt.extapplication)
set(MACOSX_BUNDLE_NAMES ${MACOSX_BUNDLE_NAMES} ExtApp)
endif()
if(MITK_BUILD_org.mitk.gui.qt.application)
set(MACOSX_BUNDLE_NAMES ${MACOSX_BUNDLE_NAMES} CoreApp)
endif()
endif(APPLE)
#-----------------------------------------------------------------------------
# Set symbol visibility Flags
#-----------------------------------------------------------------------------
# MinGW does not export all symbols automatically, so no need to set flags
if(CMAKE_COMPILER_IS_GNUCXX AND NOT MINGW)
set(VISIBILITY_CXX_FLAGS ) #"-fvisibility=hidden -fvisibility-inlines-hidden")
endif()
#-----------------------------------------------------------------------------
# Set coverage Flags
#-----------------------------------------------------------------------------
if(WITH_COVERAGE)
if("${CMAKE_CXX_COMPILER_ID}" STREQUAL "GNU")
set(coverage_flags "-g -fprofile-arcs -ftest-coverage -O0 -DNDEBUG")
set(COVERAGE_CXX_FLAGS ${coverage_flags})
set(COVERAGE_C_FLAGS ${coverage_flags})
endif()
endif()
#-----------------------------------------------------------------------------
# MITK C/CXX Flags
#-----------------------------------------------------------------------------
set(MITK_C_FLAGS "${COVERAGE_C_FLAGS} ${ADDITIONAL_C_FLAGS}")
set(MITK_CXX_FLAGS "${VISIBILITY_CXX_FLAGS} ${COVERAGE_CXX_FLAGS} ${ADDITIONAL_CXX_FLAGS}")
if(CMAKE_COMPILER_IS_GNUCXX)
set(cflags "-Wall -Wextra -Wpointer-arith -Winvalid-pch -Wcast-align -Wwrite-strings -D_FORTIFY_SOURCE=2")
mitkFunctionCheckCompilerFlags("-fdiagnostics-show-option" cflags)
mitkFunctionCheckCompilerFlags("-Wl,--no-undefined" cflags)
mitkFunctionGetGccVersion(${CMAKE_CXX_COMPILER} GCC_VERSION)
# With older version of gcc supporting the flag -fstack-protector-all, an extra dependency to libssp.so
# is introduced. If gcc is smaller than 4.4.0 and the build type is Release let's not include the flag.
# Doing so should allow to build package made for distribution using older linux distro.
if(${GCC_VERSION} VERSION_GREATER "4.4.0" OR (CMAKE_BUILD_TYPE STREQUAL "Debug" AND ${GCC_VERSION} VERSION_LESS "4.4.0"))
mitkFunctionCheckCompilerFlags("-fstack-protector-all" cflags)
endif()
if(MINGW)
# suppress warnings about auto imported symbols
set(MITK_CXX_FLAGS "-Wl,--enable-auto-import ${MITK_CXX_FLAGS}")
# we need to define a Windows version
set(MITK_CXX_FLAGS "-D_WIN32_WINNT=0x0500 ${MITK_CXX_FLAGS}")
endif()
set(MITK_C_FLAGS "${cflags} ${MITK_C_FLAGS}")
#set(MITK_CXX_FLAGS "${cflags} -Woverloaded-virtual -Wold-style-cast -Wstrict-null-sentinel -Wsign-promo ${MITK_CXX_FLAGS}")
set(MITK_CXX_FLAGS "${cflags} -Woverloaded-virtual -Wstrict-null-sentinel ${MITK_CXX_FLAGS}")
endif()
#-----------------------------------------------------------------------------
# MITK Modules
#-----------------------------------------------------------------------------
set(MITK_MODULES_CONF_DIR ${MITK_BINARY_DIR}/modulesConf CACHE INTERNAL "Modules Conf")
set(MITK_MODULES_PACKAGE_DEPENDS_DIR ${MITK_SOURCE_DIR}/CMake/PackageDepends)
set(MODULES_PACKAGE_DEPENDS_DIRS ${MITK_MODULES_PACKAGE_DEPENDS_DIR})
#-----------------------------------------------------------------------------
# Testing
#-----------------------------------------------------------------------------
if(BUILD_TESTING)
enable_testing()
include(CTest)
mark_as_advanced(TCL_TCLSH DART_ROOT)
option(MITK_ENABLE_GUI_TESTING OFF "Enable the MITK GUI tests")
# Setup file for setting custom ctest vars
configure_file(
CMake/CTestCustom.cmake.in
${MITK_BINARY_DIR}/CTestCustom.cmake
@ONLY
)
# Configuration for the CMake-generated test driver
set(CMAKE_TESTDRIVER_EXTRA_INCLUDES "#include <stdexcept>")
set(CMAKE_TESTDRIVER_BEFORE_TESTMAIN "
try
{")
set(CMAKE_TESTDRIVER_AFTER_TESTMAIN " }
catch( std::exception & excp )
{
fprintf(stderr,\"%s\\n\",excp.what());
return EXIT_FAILURE;
}
catch( ... )
{
printf(\"Exception caught in the test driver\\n\");
return EXIT_FAILURE;
}
")
set(MITK_TEST_OUTPUT_DIR "${MITK_BINARY_DIR}/test_output")
if(NOT EXISTS ${MITK_TEST_OUTPUT_DIR})
file(MAKE_DIRECTORY ${MITK_TEST_OUTPUT_DIR})
endif()
+
+ # Test the external project template
+ if(MITK_USE_BLUEBERRY)
+ include(mitkTestProjectTemplate)
+ endif()
endif()
configure_file(mitkTestingConfig.h.in ${MITK_BINARY_DIR}/mitkTestingConfig.h)
#-----------------------------------------------------------------------------
# MITK_SUPERBUILD_BINARY_DIR
#-----------------------------------------------------------------------------
# If MITK_SUPERBUILD_BINARY_DIR isn't defined, it means MITK is *NOT* build using Superbuild.
# In that specific case, MITK_SUPERBUILD_BINARY_DIR should default to MITK_BINARY_DIR
if(NOT DEFINED MITK_SUPERBUILD_BINARY_DIR)
set(MITK_SUPERBUILD_BINARY_DIR ${MITK_BINARY_DIR})
endif()
#-----------------------------------------------------------------------------
# Compile Utilities and set-up MITK variables
#-----------------------------------------------------------------------------
add_subdirectory(Utilities)
include(mitkSetupVariables)
if(MITK_USE_BLUEBERRY)
include(mitkSetupBlueBerry)
endif()
#-----------------------------------------------------------------------------
# Set C/CXX Flags for MITK code
#-----------------------------------------------------------------------------
set(CMAKE_CXX_FLAGS "${CMAKE_CXX_FLAGS} ${MITK_CXX_FLAGS}")
set(CMAKE_C_FLAGS "${CMAKE_C_FLAGS} ${MITK_C_FLAGS}")
if(MITK_USE_QT)
add_definitions(-DQWT_DLL)
endif()
#-----------------------------------------------------------------------------
# Add custom targets representing CDash subprojects
#-----------------------------------------------------------------------------
foreach(subproject ${CTEST_PROJECT_SUBPROJECTS})
if(NOT TARGET ${subproject})
add_custom_target(${subproject})
endif()
endforeach()
#-----------------------------------------------------------------------------
# Add subdirectories
#-----------------------------------------------------------------------------
link_directories(${MITK_LINK_DIRECTORIES})
add_subdirectory(Core)
if(MITK_USE_QT AND QT4_FOUND)
add_subdirectory(CoreUI/Qmitk)
endif()
add_subdirectory(Modules)
if(MITK_USE_BLUEBERRY)
set(MITK_DEFAULT_SUBPROJECTS MITK-Plugins)
include("${CMAKE_CURRENT_SOURCE_DIR}/CoreUI/Bundles/PluginList.cmake")
set(mitk_core_plugins_fullpath )
foreach(core_plugin ${MITK_CORE_PLUGINS})
list(APPEND mitk_core_plugins_fullpath CoreUI/Bundles/${core_plugin})
endforeach()
if(BUILD_TESTING)
include(berryTestingHelpers)
include("${CMAKE_CURRENT_SOURCE_DIR}/CoreUI/BundleTesting/PluginList.cmake")
set(mitk_core_test_plugins_fullpath )
foreach(core_test_plugin ${MITK_CORE_TEST_PLUGINS})
# list(APPEND mitk_core_test_plugins_fullpath CoreUI/BundleTesting/${core_test_plugin})
endforeach()
set(BLUEBERRY_UI_TEST_APP "${CMAKE_RUNTIME_OUTPUT_DIRECTORY}/CoreApp")
get_target_property(_is_macosx_bundle CoreApp MACOSX_BUNDLE)
if(APPLE AND _is_macosx_bundle)
set(BLUEBERRY_UI_TEST_APP "${CMAKE_RUNTIME_OUTPUT_DIRECTORY}/CoreApp.app/Contents/MacOS/CoreApp")
endif()
set(BLUEBERRY_TEST_APP_ID "org.mitk.qt.application")
endif()
include("${CMAKE_CURRENT_SOURCE_DIR}/Modules/Bundles/PluginList.cmake")
set(mitk_ext_plugins_fullpath )
foreach(ext_plugin ${MITK_EXT_PLUGINS})
list(APPEND mitk_ext_plugins_fullpath Modules/Bundles/${ext_plugin})
endforeach()
ctkMacroSetupExternalPlugins(${mitk_core_plugins_fullpath} ${mitk_core_test_plugins_fullpath} ${mitk_ext_plugins_fullpath}
BUILD_OPTION_PREFIX MITK_BUILD_
BUILD_ALL ${MITK_BUILD_ALL_PLUGINS}
COMPACT_OPTIONS)
ctkFunctionExtractPluginTargets("${mitk_core_plugins_fullpath}" ON MITK_CORE_ENABLED_PLUGINS)
ctkFunctionExtractPluginTargets("${mitk_ext_plugins_fullpath}" ON MITK_EXT_ENABLED_PLUGINS)
list(APPEND MITK_EXT_ENABLED_PLUGINS ${MITK_CORE_ENABLED_PLUGINS})
set(MITK_COREAPP_PROVISIONING_FILE "${CMAKE_RUNTIME_OUTPUT_DIRECTORY}/CoreApp.provisioning")
FunctionCreateProvisioningFile(
FILE ${MITK_COREAPP_PROVISIONING_FILE}
INCLUDE "${BLUEBERRY_PLUGIN_PROVISIONING_FILE}"
PLUGIN_DIR "${CMAKE_RUNTIME_OUTPUT_DIRECTORY}/plugins"
PLUGINS ${mitk_core_plugins_fullpath}
)
set(MITK_EXTAPP_PROVISIONING_FILE "${CMAKE_RUNTIME_OUTPUT_DIRECTORY}/ExtApp.provisioning")
FunctionCreateProvisioningFile(
FILE ${MITK_EXTAPP_PROVISIONING_FILE}
INCLUDE "${BLUEBERRY_PLUGIN_PROVISIONING_FILE}"
PLUGIN_DIR "${CMAKE_RUNTIME_OUTPUT_DIRECTORY}/plugins"
PLUGINS ${mitk_core_plugins_fullpath} ${mitk_ext_plugins_fullpath}
)
set(MITK_PLUGIN_USE_FILE "${MITK_BINARY_DIR}/MitkPluginUseFile.cmake")
ctkFunctionGeneratePluginUseFile(${MITK_PLUGIN_USE_FILE})
# Used in the export command further below
GetMyTargetLibraries("${CTK_PLUGIN_LIBRARIES}" MITK_PLUGIN_TARGETS)
# add legacy BlueBerry bundles
add_subdirectory(Modules/Bundles)
endif()
# Construct a list of paths containing runtime directories
# for MITK applications on Windows
set(MITK_RUNTIME_PATH
"${VTK_LIBRARY_DIRS}/@VS_BUILD_TYPE@;${ITK_LIBRARY_DIRS}/@VS_BUILD_TYPE@;${CMAKE_RUNTIME_OUTPUT_DIRECTORY}/@VS_BUILD_TYPE@"
)
if(QT4_FOUND)
set(MITK_RUNTIME_PATH "${MITK_RUNTIME_PATH};${QT_LIBRARY_DIR}/../bin")
endif()
if(MITK_USE_BLUEBERRY)
set(MITK_RUNTIME_PATH "${MITK_RUNTIME_PATH};${CTK_RUNTIME_LIBRARY_DIRS}/@VS_BUILD_TYPE@;${CMAKE_RUNTIME_OUTPUT_DIRECTORY}/plugins/@VS_BUILD_TYPE@")
endif()
if(GDCM_DIR)
set(MITK_RUNTIME_PATH "${MITK_RUNTIME_PATH};${GDCM_DIR}/bin/@VS_BUILD_TYPE@")
endif()
if(OpenCV_DIR)
set(MITK_RUNTIME_PATH "${MITK_RUNTIME_PATH};${OpenCV_DIR}/bin/@VS_BUILD_TYPE@")
endif()
# DCMTK is statically build
#if(DCMTK_DIR)
# set(MITK_RUNTIME_PATH "${MITK_RUNTIME_PATH};${DCMTK_DIR}/bin/@VS_BUILD_TYPE@")
#endif()
# Add applications directory
add_subdirectory(Applications)
#-----------------------------------------------------------------------------
# Python Wrapping
#-----------------------------------------------------------------------------
set(MITK_WRAPPING_SOURCE_DIR ${CMAKE_CURRENT_SOURCE_DIR}/Wrapping)
set(MITK_WRAPPING_BINARY_DIR ${CMAKE_CURRENT_BINARY_DIR}/Wrapping)
option(MITK_USE_PYTHON "Build cswig Python wrapper support (requires CableSwig)." OFF)
if(MITK_USE_PYTHON)
add_subdirectory(Wrapping)
endif()
#-----------------------------------------------------------------------------
# Documentation
#-----------------------------------------------------------------------------
add_subdirectory(Documentation)
#-----------------------------------------------------------------------------
# Installation
#-----------------------------------------------------------------------------
# set MITK cpack variables
include(mitkSetupCPack)
if(MITK_BUILD_org.mitk.gui.qt.application)
list(APPEND CPACK_CREATE_DESKTOP_LINKS "CoreApp")
endif()
if(MITK_BUILD_org.mitk.gui.qt.extapplication)
list(APPEND CPACK_CREATE_DESKTOP_LINKS "ExtApp")
endif()
configure_file(${MITK_SOURCE_DIR}/MITKCPackOptions.cmake.in
${MITK_BINARY_DIR}/MITKCPackOptions.cmake @ONLY)
set(CPACK_PROJECT_CONFIG_FILE "${MITK_BINARY_DIR}/MITKCPackOptions.cmake")
# include CPack model once all variables are set
include(CPack)
# Additional installation rules
include(mitkInstallRules)
#-----------------------------------------------------------------------------
# Last configuration steps
#-----------------------------------------------------------------------------
set(MITK_EXPORTS_FILE "${MITK_BINARY_DIR}/MitkExports.cmake")
file(REMOVE ${MITK_EXPORTS_FILE})
if(MITK_USE_BLUEBERRY)
set(enabled_plugins
${BLUEBERRY_PLUGIN_TARGETS}
${MITK_PLUGIN_TARGETS}
${MITK_MODULES_ENABLED_PLUGINS}
)
# This is for installation support of external projects depending on
# MITK plugins. The export file should not be used for linking to MITK
# libraries without using LINK_DIRECTORIES, since the exports are incomplete
# yet(depending libraries are not exported).
foreach(plugin ${enabled_plugins})
string(REPLACE "." "_" plugin_target ${plugin})
export(TARGETS ${plugin_target}
APPEND
FILE ${MITK_EXPORTS_FILE})
endforeach()
endif()
configure_file(${MITK_SOURCE_DIR}/CMake/ToolExtensionITKFactory.cpp.in
${MITK_BINARY_DIR}/ToolExtensionITKFactory.cpp.in COPYONLY)
configure_file(${MITK_SOURCE_DIR}/CMake/ToolExtensionITKFactoryLoader.cpp.in
${MITK_BINARY_DIR}/ToolExtensionITKFactoryLoader.cpp.in COPYONLY)
configure_file(${MITK_SOURCE_DIR}/CMake/ToolGUIExtensionITKFactory.cpp.in
${MITK_BINARY_DIR}/ToolGUIExtensionITKFactory.cpp.in COPYONLY)
configure_file(mitkVersion.h.in ${MITK_BINARY_DIR}/mitkVersion.h)
configure_file(mitkConfig.h.in ${MITK_BINARY_DIR}/mitkConfig.h)
set(VECMATH_INCLUDE_DIR ${CMAKE_CURRENT_SOURCE_DIR}/Utilities/vecmath)
set(IPFUNC_INCLUDE_DIR ${CMAKE_CURRENT_SOURCE_DIR}/Utilities/ipFunc)
set(UTILITIES_DIR ${CMAKE_CURRENT_SOURCE_DIR}/Utilities)
configure_file(mitkConfig.h.in ${MITK_BINARY_DIR}/mitkConfig.h)
configure_file(MITKConfig.cmake.in ${MITK_BINARY_DIR}/MITKConfig.cmake @ONLY)
# If we are under Windows, create two batch files which correctly
# set up the environment for the application and for Visual Studio
if(WIN32)
include(mitkFunctionCreateWindowsBatchScript)
set(VS_SOLUTION_FILE "${PROJECT_BINARY_DIR}/${PROJECT_NAME}.sln")
foreach(VS_BUILD_TYPE debug release)
mitkFunctionCreateWindowsBatchScript("${MITK_SOURCE_DIR}/CMake/StartVS.bat.in"
${PROJECT_BINARY_DIR}/StartVS_${VS_BUILD_TYPE}.bat
${VS_BUILD_TYPE})
endforeach()
endif(WIN32)
diff --git a/Core/Code/Algorithms/mitkClippedSurfaceBoundsCalculator.cpp b/Core/Code/Algorithms/mitkClippedSurfaceBoundsCalculator.cpp
new file mode 100644
index 0000000000..63b8c33045
--- /dev/null
+++ b/Core/Code/Algorithms/mitkClippedSurfaceBoundsCalculator.cpp
@@ -0,0 +1,191 @@
+#include "mitkClippedSurfaceBoundsCalculator.h"
+#include "vtkPolyData.h"
+#include "vtkPlaneSource.h"
+#include "vtkPPolyDataNormals.h"
+#include "mitkGeometry2D.h"
+#include "mitkSliceNavigationController.h"
+#include "mitkLine.h"
+#include "vtkSmartPointer.h"
+
+#define ROUND_P(x) ((int)((x)+0.5))
+
+mitk::ClippedSurfaceBoundsCalculator::ClippedSurfaceBoundsCalculator(const mitk::PlaneGeometry* geometry, mitk::Image::Pointer image)
+{
+ this->SetInput(geometry, image);
+}
+
+mitk::ClippedSurfaceBoundsCalculator::~ClippedSurfaceBoundsCalculator()
+{
+}
+
+void mitk::ClippedSurfaceBoundsCalculator::SetInput(const mitk::PlaneGeometry* geometry, mitk::Image::Pointer image)
+{
+ if(geometry != NULL && image.IsNotNull())
+ {
+ this->m_PlaneGeometry = geometry;
+ this->m_Image = image;
+ }
+}
+
+mitk::ClippedSurfaceBoundsCalculator::OutputType mitk::ClippedSurfaceBoundsCalculator::GetMinMaxSpatialDirectionX()
+{
+ return this->m_MinMaxOutput[0];
+}
+
+mitk::ClippedSurfaceBoundsCalculator::OutputType mitk::ClippedSurfaceBoundsCalculator::GetMinMaxSpatialDirectionY()
+{
+ return this->m_MinMaxOutput[1];
+}
+
+mitk::ClippedSurfaceBoundsCalculator::OutputType mitk::ClippedSurfaceBoundsCalculator::GetMinMaxSpatialDirectionZ()
+{
+ return this->m_MinMaxOutput[2];
+}
+
+void mitk::ClippedSurfaceBoundsCalculator::Update()
+{
+ typedef std::vector< std::pair<mitk::Point3D, mitk::Point3D> > EdgesVector;
+
+ this->m_MinMaxOutput.clear();
+ for(int i = 0; i < 3; i++)
+ {
+ this->m_MinMaxOutput.push_back(OutputType( std::numeric_limits<int>::max() , std::numeric_limits<int>::min() ));
+ }
+
+ Point3D origin;
+ Vector3D xDirection, yDirection, zDirection;
+ const Vector3D spacing = m_Image->GetGeometry()->GetSpacing();
+
+ origin = m_Image->GetGeometry()->GetOrigin(); //Left, bottom, front
+
+ //Get axis vector for the spatial directions
+ xDirection = m_Image->GetGeometry()->GetAxisVector(1);
+ yDirection = m_Image->GetGeometry()->GetAxisVector(0);
+ zDirection = m_Image->GetGeometry()->GetAxisVector(2);
+
+ /* For the calculation of the intersection points we need as corner points the center-based image coordinates.
+ * With the method GetCornerPoint() of the class Geometry3D we only get the corner-based coordinates.
+ * Therefore we need to calculate the center-based corner points here. For that we add/substract the corner-
+ * based coordinates with the spacing of the geometry3D.
+ */
+ for( int i = 0; i < 3; i++ )
+ {
+ if(xDirection[i] < 0)
+ {
+ xDirection[i] += spacing[i];
+ }
+ else if( xDirection[i] > 0 )
+ {
+ xDirection[i] -= spacing[i];
+ }
+
+ if(yDirection[i] < 0)
+ {
+ yDirection[i] += spacing[i];
+ }
+ else if( yDirection[i] > 0 )
+ {
+ yDirection[i] -= spacing[i];
+ }
+
+ if(zDirection[i] < 0)
+ {
+ zDirection[i] += spacing[i];
+ }
+ else if( zDirection[i] > 0 )
+ {
+ zDirection[i] -= spacing[i];
+ }
+ }
+
+ Point3D LeftTopFront, LeftBottomBack, LeftTopBack;
+ Point3D RightBottomFront, RightTopFront, RightBottomBack, RightTopBack;
+
+ LeftTopFront = origin + yDirection;
+ LeftBottomBack = origin + zDirection;
+ LeftTopBack = origin + yDirection + zDirection;
+ RightBottomFront = origin + xDirection;
+ RightTopFront = origin + xDirection + yDirection;
+ RightBottomBack = origin + xDirection + zDirection;
+ RightTopBack = origin + xDirection + yDirection + zDirection;
+
+ EdgesVector edgesOf3DBox;
+
+ // connections/edges from origin
+ edgesOf3DBox.push_back(std::make_pair(origin, // x = left=xfront, y=bottom=yfront, z=front=zfront
+ LeftTopFront)); // left, top, front
+
+ edgesOf3DBox.push_back(std::make_pair(origin, // left, bottom, front
+ LeftBottomBack)); // left, bottom, back
+
+ edgesOf3DBox.push_back(std::make_pair(origin, // left, bottom, front
+ RightBottomFront)); // right, bottom, front
+
+ edgesOf3DBox.push_back(std::make_pair(LeftTopFront, // left, top, front
+ RightTopFront)); // right, top, front
+
+ edgesOf3DBox.push_back(std::make_pair(LeftTopFront, // left, top, front
+ LeftTopBack)); // left, top, back
+
+ edgesOf3DBox.push_back(std::make_pair(RightTopFront, // right, top, front
+ RightTopBack)); // right, top, back
+
+ edgesOf3DBox.push_back(std::make_pair(RightTopFront, // right, top, front
+ RightBottomFront)); // right, bottom, front
+
+ edgesOf3DBox.push_back(std::make_pair(RightBottomFront, // right, bottom, front
+ RightBottomBack)); // right, bottom, back
+
+ edgesOf3DBox.push_back(std::make_pair(RightBottomBack, // right, bottom, back
+ LeftBottomBack)); // left, bottom, back
+
+ edgesOf3DBox.push_back(std::make_pair(RightBottomBack, // right, bottom, back
+ RightTopBack)); // right, top, back
+
+ edgesOf3DBox.push_back(std::make_pair(RightTopBack, // right, top, back
+ LeftTopBack)); // left, top, back
+
+ edgesOf3DBox.push_back(std::make_pair(LeftTopBack, // left, top, back
+ LeftBottomBack)); // left, bottom, back
+
+
+
+ for (EdgesVector::iterator iterator = edgesOf3DBox.begin(); iterator != edgesOf3DBox.end();iterator++)
+ {
+ Point3D startPoint = (*iterator).first; // start point of the line
+ Point3D endPoint = (*iterator).second; // end point of the line
+ Vector3D lineDirection = endPoint - startPoint;
+
+ mitk::Line3D line(startPoint, lineDirection);
+
+ Point3D intersectionWorldPoint;
+ intersectionWorldPoint.Fill(std::numeric_limits<int>::min());
+
+ m_PlaneGeometry->IntersectionPoint(line, intersectionWorldPoint); // Get intersection point of line and plane geometry
+
+ double t = -1.0;
+ bool isIntersectionPointOnLine;
+ isIntersectionPointOnLine = m_PlaneGeometry->IntersectionPointParam(line, t);
+
+ mitk::Point3D intersectionIndexPoint;
+ m_Image->GetGeometry()->WorldToIndex(intersectionWorldPoint, intersectionIndexPoint); //Get index point
+
+ if(0.0 <= t && t <= 1.0 && isIntersectionPointOnLine)
+ {
+ for(int dim = 0; dim < 3; dim++)
+ {
+ // minimum
+ if( this->m_MinMaxOutput[dim].first > ROUND_P(intersectionIndexPoint[dim]) ) //If new point value is lower than old
+ {
+ this->m_MinMaxOutput[dim].first = ROUND_P(intersectionIndexPoint[dim]); //set new value
+ }
+
+ // maximum
+ if( this->m_MinMaxOutput[dim].second < ROUND_P(intersectionIndexPoint[dim]) ) //If new point value is higher than old
+ {
+ this->m_MinMaxOutput[dim].second = ROUND_P(intersectionIndexPoint[dim]); //set new value
+ }
+ }
+ }
+ }
+}
diff --git a/Core/Code/Algorithms/mitkClippedSurfaceBoundsCalculator.h b/Core/Code/Algorithms/mitkClippedSurfaceBoundsCalculator.h
new file mode 100644
index 0000000000..83098c127b
--- /dev/null
+++ b/Core/Code/Algorithms/mitkClippedSurfaceBoundsCalculator.h
@@ -0,0 +1,49 @@
+#ifndef ClippedSurfaceBoundsCalculator_h_included
+#define ClippedSurfaceBoundsCalculator_h_included
+
+#include "mitkGeometry2DData.h"
+#include "mitkImage.h"
+#include "mitkGeometry2DDataToSurfaceFilter.h"
+#include "mitkSlicedGeometry3D.h"
+#include "mitkSliceNavigationController.h"
+#include "mitkCommon.h"
+#include "vtkPoints.h"
+#include "mitkVector.h"
+
+
+/**
+ * \brief Class to find
+ *
+*/
+
+namespace mitk
+{
+
+class MITK_CORE_EXPORT ClippedSurfaceBoundsCalculator
+{
+
+ public:
+ ClippedSurfaceBoundsCalculator(const mitk::PlaneGeometry* geometry = NULL, mitk::Image::Pointer image = NULL);
+ virtual ~ClippedSurfaceBoundsCalculator();
+
+
+ void SetInput(const mitk::PlaneGeometry* geometry, mitk::Image::Pointer image);
+ void Update();
+
+ typedef std::pair<int, int> OutputType;
+
+ OutputType GetMinMaxSpatialDirectionX();
+ OutputType GetMinMaxSpatialDirectionY();
+ OutputType GetMinMaxSpatialDirectionZ();
+
+ protected:
+ const mitk::PlaneGeometry* m_PlaneGeometry;
+ mitk::Image::Pointer m_Image;
+ std::vector< OutputType > m_MinMaxOutput;
+
+};
+
+} //namespace mitk
+#endif
+
+
diff --git a/Core/Code/Algorithms/mitkHistogramGenerator.cpp b/Core/Code/Algorithms/mitkHistogramGenerator.cpp
index e2642c028f..5fb63242ae 100644
--- a/Core/Code/Algorithms/mitkHistogramGenerator.cpp
+++ b/Core/Code/Algorithms/mitkHistogramGenerator.cpp
@@ -1,127 +1,127 @@
/*=========================================================================
Program: Medical Imaging & Interaction Toolkit
Language: C++
Date: $Date$
Version: $Revision$
Copyright (c) German Cancer Research Center, Division of Medical and
Biological Informatics. All rights reserved.
See MITKCopyright.txt or http://www.mitk.org/copyright.html for details.
This software is distributed WITHOUT ANY WARRANTY; without even
the implied warranty of MERCHANTABILITY or FITNESS FOR A PARTICULAR
PURPOSE. See the above copyright notices for more information.
=========================================================================*/
#if(_MSC_VER==1200)
#include <itkFixedCenterOfRotationAffineTransform.h>
#endif
#include "mitkHistogramGenerator.h"
#include "mitkImageTimeSelector.h"
#include "mitkImageAccessByItk.h"
//
// The new ITK Statistics framework has
// a class with the same functionality as
// MITKScalarImageToHistogramGenerator.h, but
// no longer has the classis the MITK class depends on.
#if !defined(ITK_USE_REVIEW_STATISTICS)
#include "itkMITKScalarImageToHistogramGenerator.h"
#else
#include "itkScalarImageToHistogramGenerator.h"
#endif
mitk::HistogramGenerator::HistogramGenerator() : m_Image(NULL), m_Size(256), m_Histogram(NULL)
{
}
mitk::HistogramGenerator::~HistogramGenerator()
{
}
template < typename TPixel, unsigned int VImageDimension >
void InternalCompute(itk::Image< TPixel, VImageDimension >* itkImage, const mitk::HistogramGenerator* mitkHistoGenerator, mitk::HistogramGenerator::HistogramType::ConstPointer& histogram)
{
#if !defined(ITK_USE_REVIEW_STATISTICS)
typedef itk::Statistics::MITKScalarImageToHistogramGenerator<
itk::Image< TPixel, VImageDimension >,
double > HistogramGeneratorType;
#else
typedef itk::Statistics::ScalarImageToHistogramGenerator< itk::Image< TPixel, VImageDimension > >
HistogramGeneratorType;
#endif
typename HistogramGeneratorType::Pointer histogramGenerator = HistogramGeneratorType::New();
histogramGenerator->SetInput( itkImage );
histogramGenerator->SetNumberOfBins( mitkHistoGenerator->GetSize() );
// histogramGenerator->SetMarginalScale( 10.0 );
histogramGenerator->Compute();
histogram = histogramGenerator->GetOutput();
}
void mitk::HistogramGenerator::ComputeHistogram()
{
if((m_Histogram.IsNull()) || (m_Histogram->GetMTime() < m_Image->GetMTime()))
{
const_cast<mitk::Image*>(m_Image.GetPointer())->SetRequestedRegionToLargestPossibleRegion(); //@todo without this, Image::GetScalarMin does not work for dim==3 (including sliceselector!)
const_cast<mitk::Image*>(m_Image.GetPointer())->Update();
mitk::ImageTimeSelector::Pointer timeSelector=mitk::ImageTimeSelector::New();
timeSelector->SetInput(m_Image);
timeSelector->SetTimeNr( 0 );
timeSelector->UpdateLargestPossibleRegion();
- AccessByItk_2( timeSelector->GetOutput() , InternalCompute, this, m_Histogram);
+ AccessByItk_n( timeSelector->GetOutput() , InternalCompute, (this, m_Histogram));
}
// debug code
/*
MITK_INFO << "Histogram modfied 1" << m_Histogram->GetMTime() << std::endl;
m_Histogram->Modified();
MITK_INFO << "Histogram modfied 2" << m_Histogram->GetMTime() << std::endl;
MITK_INFO << "Image modfied" << m_Image->GetMTime() << std::endl;
const unsigned int histogramSize = m_Histogram->Size();
MITK_INFO << "Histogram size " << histogramSize << std::endl;
HistogramType::ConstIterator itr = GetHistogram()->Begin();
HistogramType::ConstIterator end = GetHistogram()->End();
int bin = 0;
while( itr != end )
{
MITK_INFO << "bin = " << GetHistogram()->GetBinMin(0,bin) << "--" << GetHistogram()->GetBinMax(0,bin) << " frequency = ";
MITK_INFO << itr.GetFrequency() << std::endl;
++itr;
++bin;
}
*/
}
float mitk::HistogramGenerator::GetMaximumFrequency() const {
return CalculateMaximumFrequency(this->m_Histogram);
};
float mitk::HistogramGenerator::CalculateMaximumFrequency(const HistogramType* histogram)
{
HistogramType::ConstIterator itr = histogram->Begin();
HistogramType::ConstIterator end = histogram->End();
float maxFreq = 0;
while( itr != end )
{
maxFreq = vnl_math_max(maxFreq,
// get rid of ambiguity with type signature
// for vnl_math_max
static_cast<float>(itr.GetFrequency()));
++itr;
}
return maxFreq;
};
diff --git a/Core/Code/Algorithms/mitkImageAccessByItk.h b/Core/Code/Algorithms/mitkImageAccessByItk.h
index 5605e98751..1fdf7aebd9 100644
--- a/Core/Code/Algorithms/mitkImageAccessByItk.h
+++ b/Core/Code/Algorithms/mitkImageAccessByItk.h
@@ -1,708 +1,620 @@
/*=========================================================================
Program: Medical Imaging & Interaction Toolkit
Language: C++
Date: $Date$
Version: $Revision$
Copyright (c) German Cancer Research Center, Division of Medical and
Biological Informatics. All rights reserved.
See MITKCopyright.txt or http://www.mitk.org/copyright.html for details.
This software is distributed WITHOUT ANY WARRANTY; without even
the implied warranty of MERCHANTABILITY or FITNESS FOR A PARTICULAR
PURPOSE. See the above copyright notices for more information.
=========================================================================*/
#ifndef MITKIMAGEACCESSBYITK_H_HEADER_INCLUDED
#define MITKIMAGEACCESSBYITK_H_HEADER_INCLUDED
#include <itkCastImageFilter.h>
#include <mitkImageToItk.h>
+#include <mitkPPArgCount.h>
+#include <mitkPPSeqForEach.h>
+#include <mitkPPSeqForEachProduct.h>
+#include <mitkPPSeqToTuple.h>
+#include <mitkPPCat.h>
+#include <mitkPPExpand.h>
+#include <mitkPPTupleRem.h>
+#include <mitkPPStringize.h>
+
+#include <sstream>
+
+namespace mitk {
+
+/**
+ * \brief Exception class thrown in #AccessByItk macros.
+ *
+ * This exception can be thrown by the invocation of the #AccessByItk macros,
+ * if the MITK image is of non-expected dimension or pixel type.
+ *
+ * \ingroup Adaptor
+ */
+class AccessByItkException : public virtual std::runtime_error
+{
+public:
+
+ AccessByItkException(const std::string& msg) : std::runtime_error(msg) {}
+ ~AccessByItkException() throw() {}
+};
+
+}
+
#ifndef DOXYGEN_SKIP
-#define _accessByItkWarning \
+
+#define _accessByItkPixelTypeException(pixelType, pixelTypeSeq) \
{ \
- itkGenericOutputMacro(<< "Pixel type " << pixelType.GetItkTypeAsString() \
- << " not supported by AccessByItk") \
+ std::string msg("Pixel type "); \
+ msg.append(pixelType.GetItkTypeAsString()); \
+ msg.append(" is not in " MITK_PP_STRINGIZE(pixelTypeSeq)); \
+ throw mitk::AccessByItkException(msg); \
}
-#define _accessByItkWarningParam(pixelType, accessor) \
+#define _accessByItkDimensionException(dim, validDims) \
{ \
- itkGenericOutputMacro(<< "Pixel type " << pixelType.GetItkTypeAsString() \
- << " not supported by " << accessor) \
+ std::stringstream msg; \
+ msg << "Dimension " << (dim) << " is not in " << validDims ; \
+ throw mitk::AccessByItkException(msg.str()); \
}
-#define _accessByItk(mitkImage, itkImageTypeFunction, pixeltype, dimension) \
- if ( pixelType == typeid(pixeltype) ) \
+#define _checkSpecificDimensionIter(r, mitkImage, dim) \
+ if (mitkImage->GetDimension() == dim); else
+
+#define _checkSpecificDimension(mitkImage, dimSeq) \
+ MITK_PP_SEQ_FOR_EACH(_checkSpecificDimensionIter, mitkImage, dimSeq) \
+ _accessByItkDimensionException(mitkImage->GetDimension(), MITK_PP_STRINGIZE(dimSeq))
+
+#define _msvc_expand_bug(macro, arg) MITK_PP_EXPAND(macro arg)
+
+//-------------------------------- 0-Arg Versions --------------------------------------
+
+#define _accessByItk(itkImageTypeFunction, pixeltype, dimension) \
+ if ( pixelType == typeid(pixeltype) && constImage->GetDimension() == dimension) \
{ \
typedef itk::Image<pixeltype, dimension> ImageType; \
typedef mitk::ImageToItk<ImageType> ImageToItkType; \
itk::SmartPointer<ImageToItkType> imagetoitk = ImageToItkType::New(); \
- imagetoitk->SetInput(mitkImage); \
+ imagetoitk->SetInput(constImage); \
imagetoitk->Update(); \
itkImageTypeFunction(imagetoitk->GetOutput()); \
- } \
-
-#define _accessAllTypesByItk(mitkImage, itkImageTypeFunction, dimension) \
- _accessByItk(mitkImage, itkImageTypeFunction, double, dimension) else \
- _accessByItk(mitkImage, itkImageTypeFunction, float, dimension) else \
- _accessByItk(mitkImage, itkImageTypeFunction, int, dimension) else \
- _accessByItk(mitkImage, itkImageTypeFunction, unsigned int, dimension) else \
- _accessByItk(mitkImage, itkImageTypeFunction, short, dimension) else \
- _accessByItk(mitkImage, itkImageTypeFunction, unsigned short, dimension) else \
- _accessByItk(mitkImage, itkImageTypeFunction, char, dimension) else \
- _accessByItk(mitkImage, itkImageTypeFunction, unsigned char, dimension) else \
- _accessByItkWarning
+ } else
+
+#define _accessByItkArgs(itkImageTypeFunction, type) \
+ (itkImageTypeFunction, MITK_PP_TUPLE_REM(2)type)
+
+// product will be of the form (itkImageTypeFunction)(short)(2) for pixel type short and dimension 2
+#ifdef _MSC_VER
+#define _accessByItkProductIter(r, product) \
+ _msvc_expand_bug(_accessByItk, _msvc_expand_bug(_accessByItkArgs, (MITK_PP_SEQ_HEAD(product), MITK_PP_SEQ_TO_TUPLE(MITK_PP_SEQ_TAIL(product)))))
+#else
+#define _accessByItkProductIter(r, product) \
+ MITK_PP_EXPAND(_accessByItk _accessByItkArgs(MITK_PP_SEQ_HEAD(product), MITK_PP_SEQ_TO_TUPLE(MITK_PP_SEQ_TAIL(product))))
+#endif
+
+#define _accessFixedTypeByItk(itkImageTypeFunction, pixelTypeSeq, dimSeq) \
+ MITK_PP_SEQ_FOR_EACH_PRODUCT(_accessByItkProductIter, ((itkImageTypeFunction))(pixelTypeSeq)(dimSeq))
+
+//-------------------------------- n-Arg Versions --------------------------------------
+
+#define _accessByItk_n(itkImageTypeFunction, pixeltype, dimension, args) \
+ if ( pixelType == typeid(pixeltype) && constImage->GetDimension() == dimension) \
+ { \
+ typedef itk::Image<pixeltype, dimension> ImageType; \
+ typedef mitk::ImageToItk<ImageType> ImageToItkType; \
+ itk::SmartPointer<ImageToItkType> imagetoitk = ImageToItkType::New(); \
+ imagetoitk->SetInput(constImage); \
+ imagetoitk->Update(); \
+ itkImageTypeFunction(imagetoitk->GetOutput(), MITK_PP_TUPLE_REM(MITK_PP_SEQ_HEAD(args))MITK_PP_SEQ_TAIL(args)); \
+ } else
+
+#define _accessByItkArgs_n(itkImageTypeFunction, type, args) \
+ (itkImageTypeFunction, MITK_PP_TUPLE_REM(2) type, args)
+
+// product will be of the form ((itkImageTypeFunction)(3)(a,b,c))(short)(2)
+// for the variable argument list a,b,c and for pixel type short and dimension 2
+#ifdef _MSC_VER
+#define _accessByItkProductIter_n(r, product) \
+ _msvc_expand_bug(_accessByItk_n, _msvc_expand_bug(_accessByItkArgs_n, (MITK_PP_SEQ_HEAD(MITK_PP_SEQ_HEAD(product)), MITK_PP_SEQ_TO_TUPLE(MITK_PP_SEQ_TAIL(product)), MITK_PP_SEQ_TAIL(MITK_PP_SEQ_HEAD(product)))))
+#else
+#define _accessByItkProductIter_n(r, product) \
+ MITK_PP_EXPAND(_accessByItk_n _accessByItkArgs_n(MITK_PP_SEQ_HEAD(MITK_PP_SEQ_HEAD(product)), MITK_PP_SEQ_TO_TUPLE(MITK_PP_SEQ_TAIL(product)), MITK_PP_SEQ_TAIL(MITK_PP_SEQ_HEAD(product))))
+#endif
+
+#define _accessFixedTypeByItk_n(itkImageTypeFunction, pixelTypeSeq, dimSeq, va_tuple) \
+ MITK_PP_SEQ_FOR_EACH_PRODUCT(_accessByItkProductIter_n, (((itkImageTypeFunction)(MITK_PP_ARG_COUNT va_tuple) va_tuple))(pixelTypeSeq)(dimSeq))
+
+
#endif //DOXYGEN_SKIP
/**
- * @brief Access an mitk-image by an itk-image
+ * \brief Access a MITK image by an ITK image
*
- * Define a templated function or method (@a itkImageTypeFunction)
- * within which the mitk-image (@a mitkImage) is accessed:
+ * Define a templated function or method (\a itkImageTypeFunction)
+ * within which the mitk-image (\a mitkImage) is accessed:
* \code
* template < typename TPixel, unsigned int VImageDimension >
- * void ExampleFunction( itk::Image<TPixel, VImageDimension>* itkImage, TPixel* dummy = NULL );
- * \endcode
- * Instantiate the function using
- * \code
- * InstantiateAccessFunction(ExampleFunction);
+ * void ExampleFunction( itk::Image<TPixel, VImageDimension>* itkImage );
* \endcode
- * Within the itk::Image passed to the function/method has the same
+ *
+ * The itk::Image passed to the function/method has the same
* data-pointer as the mitk-image. So you have full read- and write-
* access to the data vector of the mitk-image using the itk-image.
* Call by:
* \code
- * inputMitkImage being of type mitk::Image*
- * AccessByItk(inputMitkImage, ExampleFunction);
+ * mitk::Image* inputMitkImage = ...
+ * try
+ * {
+ * AccessByItk(inputMitkImage, ExampleFunction);
+ * }
+ * catch (const mitk::AccessByItkException& e)
+ * {
+ * // mitk::Image is of wrong pixel type or dimension,
+ * // insert error handling here
+ * }
* \endcode
- * @note If your inputMitkImage is an mitk::Image::Pointer, use
+ *
+ * \param mitkImage The MITK input image.
+ * \param itkImageTypeFunction The templated access-function to be called.
+ *
+ * \throws mitk::AccessByItkException If mitkImage is of unsupported pixel type or dimension.
+ *
+ * \note If your inputMitkImage is an mitk::Image::Pointer, use
* inputMitkImage.GetPointer()
- * @note If you need to pass an additional parameter to your
- * access-function (@a itkImageTypeFunction), use AccessByItk.
- * @note If you know the dimension of your input mitk-image,
+ * \note If you need to pass additional parameters to your
+ * access-function (\a itkImageTypeFunction), use #AccessByItk_n.
+ * \note If you know the dimension of your input mitk-image,
* it is better to use AccessFixedDimensionByItk (less code
* is generated).
* \sa AccessFixedDimensionByItk
* \sa AccessFixedTypeByItk
* \sa AccessFixedPixelTypeByItk
- * \sa AccessByItk_1
- * \sa AccessByItk_2
- * @ingroup Adaptor
+ * \sa AccessByItk_n
+ *
+ * \ingroup Adaptor
*/
#define AccessByItk(mitkImage, itkImageTypeFunction) \
-{ \
- const mitk::PixelType& pixelType = mitkImage->GetPixelType(); \
- const mitk::Image* constImage = mitkImage; \
- const_cast<mitk::Image*>(constImage)->Update(); \
- assert((mitkImage)->GetDimension()>=2 && (mitkImage)->GetDimension()<=3); \
- if((mitkImage)->GetDimension()==2) \
- { \
- _accessAllTypesByItk(mitkImage, itkImageTypeFunction, 2); \
- } \
- else \
- { \
- _accessAllTypesByItk(mitkImage, itkImageTypeFunction, 3) \
- } \
-}
+ AccessFixedTypeByItk(mitkImage, itkImageTypeFunction, MITK_ACCESSBYITK_PIXEL_TYPES_SEQ, MITK_ACCESSBYITK_DIMENSIONS_SEQ)
+
+/**
+ * \brief Access a mitk-image with known pixeltype (but unknown dimension) by an itk-image.
+ *
+ * For usage, see #AccessByItk.
+ *
+ * \param pixelTypeSeq A sequence of pixel types, like (short)(char)(int)
+ * \param mitkImage The MITK input image.
+ * \param itkImageTypeFunction The templated access-function to be called.
+ *
+ * \throws mitk::AccessByItkException If mitkImage is of unsupported pixel type or dimension.
+ *
+ * If the image has a different pixel type, a mitk::AccessByItkException exception is
+ * thrown. If you do not know the pixel type for sure, use #AccessByItk.
+ *
+ * \sa AccessByItk
+ * \sa AccessFixedDimensionByItk
+ * \sa AccessFixedTypeByItk
+ * \sa AccessFixedPixelTypeByItk_n
+ *
+ * \ingroup Adaptor
+ */
+#define AccessFixedPixelTypeByItk(mitkImage, itkImageTypeFunction, pixelTypeSeq) \
+ AccessFixedTypeByItk(mitkImage, itkImageTypeFunction, pixelTypeSeq, MITK_ACCESSBYITK_DIMENSIONS_SEQ)
+
+/**
+ * \brief Access a mitk-image with an integral pixel type by an itk-image
+ *
+ * See #AccessByItk for details.
+ *
+ * \param mitkImage The MITK input image.
+ * \param itkImageTypeFunction The templated access-function to be called.
+ *
+ * \throws mitk::AccessByItkException If mitkImage is of unsupported pixel type or dimension.
+ *
+ * \sa AccessFixedPixelTypeByItk
+ * \sa AccessByItk
+ * \sa AccessIntegralPixelTypeByItk_n
+ */
+#define AccessIntegralPixelTypeByItk(mitkImage, itkImageTypeFunction) \
+ AccessFixedTypeByItk(mitkImage, itkImageTypeFunction, MITK_ACCESSBYITK_INTEGRAL_PIXEL_TYPES_SEQ, MITK_ACCESSBYITK_DIMENSIONS_SEQ)
+
+/**
+ * \brief Access a mitk-image with a floating point pixel type by an ITK image
+ *
+ * See #AccessByItk for details.
+ *
+ * \param mitkImage The MITK input image.
+ * \param itkImageTypeFunction The templated access-function to be called.
+ *
+ * \throws mitk::AccessByItkException If mitkImage is of unsupported pixel type or dimension.
+ *
+ * \sa AccessFixedPixelTypeByItk
+ * \sa AccessByItk
+ * \sa AccessFloatingPixelTypeByItk_n
+ */
+#define AccessFloatingPixelTypeByItk(mitkImage, itkImageTypeFunction) \
+ AccessFixedTypeByItk(mitkImage, itkImageTypeFunction, MITK_ACCESSBYITK_FLOATING_PIXEL_TYPES_SEQ, MITK_ACCESSBYITK_DIMENSIONS_SEQ)
-//##Documentation
-//## @brief Access an mitk-image with known dimension by an itk-image
-//##
-//## For usage, see AccessByItk.
-//## @param dimension dimension of the mitk-image.
-//##
-//## If the image has a different dimension, an exception is thrown
-//## (by assert).
-//## If you do not know the dimension for sure, use AccessByItk.
-//## \sa AccessByItk
-//## \sa AccessFixedDimensionByItk
-//## \sa AccessFixedTypeByItk
-//## \sa AccessFixedPixelTypeByItk
-//## @ingroup Adaptor
+/**
+ * \brief Access a mitk-image with known dimension by an itk-image
+ *
+ * For usage, see #AccessByItk.
+ *
+ * \param dimension Dimension of the mitk-image. If the image has a different dimension,
+ * a mitk::AccessByItkException exception is thrown.
+ * \param mitkImage The MITK input image.
+ * \param itkImageTypeFunction The templated access-function to be called.
+ *
+ * \throws mitk::AccessByItkException If mitkImage is of unsupported pixel type or dimension.
+ *
+ * \note If you do not know the dimension for sure, use #AccessByItk.
+ *
+ * \sa AccessByItk
+ * \sa AccessFixedDimensionByItk_n
+ * \sa AccessFixedTypeByItk
+ * \sa AccessFixedPixelTypeByItk
+ *
+ * \ingroup Adaptor
+ */
#define AccessFixedDimensionByItk(mitkImage, itkImageTypeFunction, dimension) \
+ AccessFixedTypeByItk(mitkImage, itkImageTypeFunction, MITK_ACCESSBYITK_PIXEL_TYPES_SEQ, (dimension))
+
+/**
+ * \brief Access a mitk-image with known type (pixel type and dimension) by an itk-image.
+ *
+ * The provided mitk-image must be in the set of types created by taking the
+ * cartesian product of the pixel type sequence and the dimension sequence.
+ * For example, a call to
+ * \code
+ * AccessFixedTypeByItk(myMitkImage, MyAccessFunction, (short)(int), (2)(3))
+ * \endcode
+ * asserts that the type of myMitkImage (pixeltype,dim) is in the set {(short,2),(short,3),(int,2),(int,3)}.
+ * For more information, see #AccessByItk.
+ *
+ * \param pixelTypeSeq A sequence of pixel types, like (short)(char)(int).
+ * \param dimension A sequence of dimensions, like (2)(3).
+ * \param mitkImage The MITK input image.
+ * \param itkImageTypeFunction The templated access-function to be called.
+ *
+ * \throws mitk::AccessByItkException If mitkImage is of unsupported pixel type or dimension.
+ *
+ * If the image has a different dimension or pixel type,
+ * a mitk::AccessByItkException exception is thrown.
+ *
+ * \note If you do not know the dimension for sure, use #AccessByItk.
+ *
+ * \sa AccessByItk
+ * \sa AccessFixedDimensionByItk
+ * \sa AccessFixedTypeByItk_n
+ * \sa AccessFixedPixelTypeByItk
+ *
+ * \ingroup Adaptor
+ */
+#define AccessFixedTypeByItk(mitkImage, itkImageTypeFunction, pixelTypeSeq, dimSeq) \
{ \
const mitk::PixelType& pixelType = mitkImage->GetPixelType(); \
const mitk::Image* constImage = mitkImage; \
const_cast<mitk::Image*>(constImage)->Update(); \
- assert((mitkImage)->GetDimension()==dimension); \
- _accessAllTypesByItk(mitkImage, itkImageTypeFunction, dimension) \
-}
-
-//##Documentation
-//## @brief Access an mitk-image with known type (pixel type and dimension)
-//## by an itk-image
-//##
-//## For usage, see AccessByItk.
-//## @param dimension dimension of the mitk-image. If the image
-//## has a different dimension, an exception is thrown (by assert).
-//## If you do not know the dimension for sure, use AccessByItk.
-//## \sa AccessByItk
-//## \sa AccessFixedDimensionByItk
-//## \sa AccessFixedTypeByItk
-//## \sa AccessFixedPixelTypeByItk
-//## @ingroup Adaptor
-#define AccessFixedTypeByItk(mitkImage, itkImageTypeFunction, pixeltype, dimension) \
-{ \
- const mitk::PixelType& pixelType = mitkImage->GetPixelType(); \
- const mitk::Image* constImage = mitkImage; \
- const_cast<mitk::Image*>(constImage)->Update(); \
- assert((mitkImage)->GetDimension()==dimension); \
- _accessByItk(mitkImage, itkImageTypeFunction, pixeltype, dimension) else \
- _accessByItkWarning \
+ _checkSpecificDimension(mitkImage, dimSeq); \
+ _accessFixedTypeByItk(itkImageTypeFunction, pixelTypeSeq, dimSeq) \
+ _accessByItkPixelTypeException(mitkImage->GetPixelType(), pixelTypeSeq) \
}
-//##Documentation
-//## @brief Access an mitk-image with known pixeltype (but unknown dimension)
-//## by an itk-image and pass two additional parameters to the access-function
-//##
-//## For usage, see AccessByItk.
-//## @param pixeltype pixel type of the mitk-image.
-//##
-//## If the image has a different pixel type, an exception is
-//## thrown (by assert).
-//## If you do not know the pixel type for sure, use AccessByItk.
-//## \sa AccessByItk
-//## \sa AccessFixedDimensionByItk
-//## \sa AccessFixedTypeByItk
-//## \sa AccessFixedPixelTypeByItk
-//## @ingroup Adaptor
-#define AccessFixedPixelTypeByItk(mitkImage, itkImageTypeFunction, pixeltype) \
-{ \
- const mitk::PixelType& pixelType = mitkImage->GetPixelType(); \
- const mitk::Image* constImage = mitkImage; \
- const_cast<mitk::Image*>(constImage)->Update(); \
- assert((mitkImage)->GetDimension()>=2 && (mitkImage)->GetDimension()<=3); \
- if((mitkImage)->GetDimension()==2) \
- { \
- _accessByItk(mitkImage, itkImageTypeFunction, pixeltype, 2) else \
- _accessByItkWarning \
- } \
- else \
- { \
- _accessByItk(mitkImage, itkImageTypeFunction, pixeltype, 3) else \
- _accessByItkWarning \
- } \
-}
-
-//----------------------- version with 1 additional paramater ------------------
-#ifndef DOXYGEN_SKIP
-#define _accessByItk_1(mitkImage, itkImageTypeFunction, pixeltype, dimension, param1) \
- if ( pixelType == typeid(pixeltype) ) \
- { \
- typedef itk::Image<pixeltype, dimension> ImageType; \
- typedef mitk::ImageToItk<ImageType> ImageToItkType; \
- itk::SmartPointer<ImageToItkType> imagetoitk = ImageToItkType::New(); \
- imagetoitk->SetInput(mitkImage); \
- imagetoitk->Update(); \
- itkImageTypeFunction(imagetoitk->GetOutput(), param1); \
- }
+//------------------------------ n-Arg Access Macros -----------------------------------
-#define _accessAllTypesByItk_1(mitkImage, itkImageTypeFunction, dimension, param1) \
- _accessByItk_1(mitkImage, itkImageTypeFunction, double, dimension, param1) else \
- _accessByItk_1(mitkImage, itkImageTypeFunction, float, dimension, param1) else \
- _accessByItk_1(mitkImage, itkImageTypeFunction, int, dimension, param1) else \
- _accessByItk_1(mitkImage, itkImageTypeFunction, unsigned int, dimension, param1) else \
- _accessByItk_1(mitkImage, itkImageTypeFunction, short, dimension, param1) else \
- _accessByItk_1(mitkImage, itkImageTypeFunction, unsigned short, dimension, param1) else \
- _accessByItk_1(mitkImage, itkImageTypeFunction, char, dimension, param1) else \
- _accessByItk_1(mitkImage, itkImageTypeFunction, unsigned char, dimension, param1) else \
- _accessByItkWarning \
-
-#endif //DOXYGEN_SKIP
-
-//##Documentation
-//## @brief Access an mitk-image by an itk-image and pass one
-//## additional parameter to the access-function
-//##
-//## For usage, see AccessByItk. The only difference to AccessByItk
-//## is that an additional parameter (@a param1) is passed.
-//## @note If you know the dimension of your input mitk-image,
-//## it is better to use AccessFixedDimensionByItk_1 (less code
-//## is generated).
-//## \sa AccessByItk
-//## \sa AccessFixedDimensionByItk_1
-//## \sa AccessFixedTypeByItk_1
-//## \sa AccessFixedPixelTypeByItk_1
-//## @ingroup Adaptor
-#define AccessByItk_1(mitkImage, itkImageTypeFunction, param1) \
-{ \
- const mitk::PixelType& pixelType = mitkImage->GetPixelType(); \
- const mitk::Image* constImage = mitkImage; \
- const_cast<mitk::Image*>(constImage)->Update(); \
- assert(mitkImage->GetDimension()>=2 && mitkImage->GetDimension()<=3); \
- if(mitkImage->GetDimension()==2) \
- { \
- _accessAllTypesByItk_1(mitkImage, itkImageTypeFunction, 2, param1); \
- } \
- else \
- { \
- _accessAllTypesByItk_1(mitkImage, itkImageTypeFunction, 3, param1) \
- } \
-}
-
-//##Documentation
-//## @brief Access an mitk-image with known dimension by an itk-image
-//## and pass one additional parameter to the access-function
-//##
-//## For usage, see AccessByItk_1 and AccessByItk.
-//## @param dimension dimension of the mitk-image.
-//##
-//## If the image has a different dimension, an exception is thrown
-//## (by assert).
-//## If you do not know the dimension for sure, use AccessByItk_1.
-//## \sa AccessByItk_2
-//## \sa AccessByItk
-//## \sa AccessFixedDimensionByItk_1
-//## \sa AccessFixedTypeByItk_1
-//## \sa AccessFixedPixelTypeByItk_1
-//## @ingroup Adaptor
-#define AccessFixedDimensionByItk_1(mitkImage, itkImageTypeFunction, dimension, param1) \
-{ \
- const mitk::PixelType& pixelType = mitkImage->GetPixelType(); \
- const mitk::Image* constImage = mitkImage; \
- const_cast<mitk::Image*>(constImage)->Update(); \
- assert(mitkImage->GetDimension()==dimension); \
- _accessAllTypesByItk_1(mitkImage, itkImageTypeFunction, dimension, param1) \
-}
-
-//##Documentation
-//## @brief Access an mitk-image with known type (pixel type and dimension)
-//## by an itk-image and pass one additional parameters to the access-function
-//##
-//## For usage, see AccessByItk_1 and AccessByItk.
-//## @param pixeltype pixel type of the mitk-image.
-//## @param dimension dimension of the mitk-image.
-//##
-//## If the image has a different pixel type or dimension, an exception is
-//## thrown (by assert).
-//## If you do not know the pixel type and dimension for sure, use AccessByItk_1.
-//## \sa AccessByItk_1
-//## \sa AccessByItk
-//## \sa AccessFixedDimensionByItk_1
-//## \sa AccessFixedTypeByItk_1
-//## \sa AccessFixedPixelTypeByItk_1
-//## @ingroup Adaptor
-#define AccessFixedTypeByItk_1(mitkImage, itkImageTypeFunction, pixeltype, dimension, param1) \
-{ \
- const mitk::PixelType& pixelType = mitkImage->GetPixelType(); \
- const mitk::Image* constImage = mitkImage; \
- const_cast<mitk::Image*>(constImage)->Update(); \
- assert(mitkImage->GetDimension()==dimension); \
- _accessByItk_1(mitkImage, itkImageTypeFunction, pixeltype, dimension, param1) else \
- _accessByItkWarning \
-}
+/**
+ * \brief Access a MITK image by an ITK image with one or more parameters.
+ *
+ * Define a templated function or method (\a itkImageTypeFunction) with one ore more
+ * additional parameters, within which the mitk-image (\a mitkImage) is accessed:
+ * \code
+ * template < typename TPixel, unsigned int VImageDimension >
+ * void ExampleFunction( itk::Image<TPixel, VImageDimension>* itkImage, SomeType param);
+ * \endcode
+ *
+ * The itk::Image passed to the function/method has the same
+ * data-pointer as the mitk-image. So you have full read- and write-
+ * access to the data vector of the mitk-image using the itk-image.
+ * Call by:
+ * \code
+ * SomeType param = ...
+ * mitk::Image* inputMitkImage = ...
+ * try
+ * {
+ * AccessByItk_n(inputMitkImage, ExampleFunction, (param));
+ * }
+ * catch (const mitk::AccessByItkException& e)
+ * {
+ * // mitk::Image is of wrong pixel type or dimension,
+ * // insert error handling here
+ * }
+ * \endcode
+ *
+ * \param va_tuple A variable length tuple containing the arguments to be passed
+ * to the access function itkImageTypeFunction, e.g. ("first", 2, THIRD).
+ * \param mitkImage The MITK input image.
+ * \param itkImageTypeFunction The templated access-function to be called.
+ *
+ * \throws mitk::AccessByItkException If mitkImage is of unsupported pixel type or dimension.
+ *
+ * \note If your inputMitkImage is an mitk::Image::Pointer, use
+ * inputMitkImage.GetPointer()
+ * \note If you know the dimension of your input mitk-image,
+ * it is better to use AccessFixedDimensionByItk_n (less code
+ * is generated).
+ * \sa AccessFixedDimensionByItk_n
+ * \sa AccessFixedTypeByItk_n
+ * \sa AccessFixedPixelTypeByItk_n
+ * \sa AccessByItk
+ *
+ * \ingroup Adaptor
+ */
+#define AccessByItk_n(mitkImage, itkImageTypeFunction, va_tuple) \
+ AccessFixedTypeByItk_n(mitkImage, itkImageTypeFunction, MITK_ACCESSBYITK_PIXEL_TYPES_SEQ, MITK_ACCESSBYITK_DIMENSIONS_SEQ, va_tuple)
-//##Documentation
-//## @brief Access an mitk-image with known pixeltype (but unknown dimension)
-//## by an itk-image and pass one additional parameters to the access-function
-//##
-//## For usage, see AccessByItk_1 and AccessByItk.
-//## @param pixeltype pixel type of the mitk-image.
-//##
-//## If the image has a different pixel type, an exception is
-//## thrown (by assert).
-//## If you do not know the pixel type for sure, use AccessByItk_2.
-//## \sa AccessByItk_1
-//## \sa AccessByItk
-//## \sa AccessFixedDimensionByItk
-//## \sa AccessFixedTypeByItk_1
-//## \sa AccessFixedPixelTypeByItk_1
-//## @ingroup Adaptor
-#define AccessFixedPixelTypeByItk_1(mitkImage, itkImageTypeFunction, pixeltype, param1) \
-{ \
- const mitk::PixelType& pixelType = mitkImage->GetPixelType(); \
- const mitk::Image* constImage = mitkImage; \
- const_cast<mitk::Image*>(constImage)->Update(); \
- assert(mitkImage->GetDimension()>=2 && mitkImage->GetDimension()<=3); \
- if(mitkImage->GetDimension()==2) \
- { \
- _accessByItk_1(mitkImage, itkImageTypeFunction, pixeltype, 2, param1) else \
- _accessByItkWarning \
- } \
- else \
- { \
- _accessByItk_1(mitkImage, itkImageTypeFunction, pixeltype, 3, param1) else \
- _accessByItkWarning \
- } \
-}
+/**
+ * \brief Access a mitk-image with known pixeltype (but unknown dimension) by an itk-image
+ * with one or more parameters.
+ *
+ * For usage, see #AccessByItk_n.
+ *
+ * \param va_tuple A variable length tuple containing the arguments to be passed
+ * to the access function itkImageTypeFunction, e.g. ("first", 2, THIRD).
+ * \param pixelTypeSeq A sequence of pixel types, like (short)(char)(int).
+ * \param mitkImage The MITK input image.
+ * \param itkImageTypeFunction The templated access-function to be called.
+ *
+ * \throws mitk::AccessByItkException If mitkImage is of unsupported pixel type or dimension.
+ *
+ * If the image has a different pixel type, a mitk::AccessByItkException exception is
+ * thrown. If you do not know the pixel type for sure, use #AccessByItk_n.
+ *
+ * \sa AccessByItk_n
+ * \sa AccessFixedDimensionByItk_n
+ * \sa AccessFixedTypeByItk_n
+ * \sa AccessFixedPixelTypeByItk
+ *
+ * \ingroup Adaptor
+ */
+#define AccessFixedPixelTypeByItk_n(mitkImage, itkImageTypeFunction, pixelTypeSeq, va_tuple) \
+ AccessFixedTypeByItk_n(mitkImage, itkImageTypeFunction, pixelTypeSeq, MITK_ACCESSBYITK_DIMENSIONS_SEQ, va_tuple)
-//----------------------- version with 2 additional paramaters -----------------
-#ifndef DOXYGEN_SKIP
-#define _accessByItk_2(mitkImage, itkImageTypeFunction, pixeltype, dimension, param1, param2) \
- if ( pixelType == typeid(pixeltype) ) \
- { \
- typedef itk::Image<pixeltype, dimension> ImageType; \
- typedef mitk::ImageToItk<ImageType> ImageToItkType; \
- itk::SmartPointer<ImageToItkType> imagetoitk = ImageToItkType::New(); \
- imagetoitk->SetInput(mitkImage); \
- imagetoitk->Update(); \
- itkImageTypeFunction(imagetoitk->GetOutput(), param1, param2); \
- }
+/**
+ * \brief Access an mitk::Image with an integral pixel type by an ITK image with
+ * one or more parameters.
+ *
+ * See #AccessByItk_n for details.
+ *
+ * \param va_tuple A variable length tuple containing the arguments to be passed
+ * to the access function itkImageTypeFunction, e.g. ("first", 2, THIRD).
+ * \param mitkImage The MITK input image.
+ * \param itkImageTypeFunction The templated access-function to be called.
+ *
+ * \throws mitk::AccessByItkException If mitkImage is of unsupported pixel type or dimension.
+ *
+ * \sa AccessFixedPixelTypeByItk_n
+ * \sa AccessByItk_n
+ * \sa AccessIntegralPixelTypeByItk
+ */
+#define AccessIntegralPixelTypeByItk_n(mitkImage, itkImageTypeFunction, va_tuple) \
+ AccessFixedTypeByItk_n(mitkImage, itkImageTypeFunction, MITK_ACCESSBYITK_INTEGRAL_PIXEL_TYPES_SEQ, MITK_ACCESSBYITK_DIMENSIONS_SEQ, va_tuple)
-#define _accessAllTypesByItk_2(mitkImage, itkImageTypeFunction, dimension, param1, param2) \
- _accessByItk_2(mitkImage, itkImageTypeFunction, double, dimension, param1, param2) else \
- _accessByItk_2(mitkImage, itkImageTypeFunction, float, dimension, param1, param2) else \
- _accessByItk_2(mitkImage, itkImageTypeFunction, int, dimension, param1, param2) else \
- _accessByItk_2(mitkImage, itkImageTypeFunction, unsigned int, dimension, param1, param2) else \
- _accessByItk_2(mitkImage, itkImageTypeFunction, short, dimension, param1, param2) else \
- _accessByItk_2(mitkImage, itkImageTypeFunction, unsigned short, dimension, param1, param2) else \
- _accessByItk_2(mitkImage, itkImageTypeFunction, char, dimension, param1, param2) else \
- _accessByItk_2(mitkImage, itkImageTypeFunction, unsigned char, dimension, param1, param2) else \
- _accessByItkWarning \
+/**
+ * \brief Access an mitk::Image with a floating point pixel type by an ITK image
+ * with one or more parameters.
+ *
+ * See #AccessByItk_n for details.
+ *
+ * \param va_tuple A variable length tuple containing the arguments to be passed
+ * to the access function itkImageTypeFunction, e.g. ("first", 2, THIRD).
+ * \param mitkImage The MITK input image.
+ * \param itkImageTypeFunction The templated access-function to be called.
+ *
+ * \throws mitk::AccessByItkException If mitkImage is of unsupported pixel type or dimension.
+ *
+ * \sa AccessFixedPixelTypeByItk_n
+ * \sa AccessByItk_n
+ * \sa AccessFloatingPixelTypeByItk
+ */
+#define AccessFloatingPixelTypeByItk_n(mitkImage, itkImageTypeFunction, va_tuple) \
+ AccessFixedTypeByItk_n(mitkImage, itkImageTypeFunction, MITK_ACCESSBYITK_FLOATING_PIXEL_TYPES_SEQ, MITK_ACCESSBYITK_DIMENSIONS_SEQ, va_tuple)
-#endif //DOXYGEN_SKIP
+/**
+ * \brief Access a mitk-image with known dimension by an itk-image with
+ * one or more parameters.
+ *
+ * For usage, see #AccessByItk_n.
+ *
+ * \param dimension Dimension of the mitk-image. If the image has a different dimension,
+ * a mitk::AccessByItkException exception is thrown.
+ * \param va_tuple A variable length tuple containing the arguments to be passed
+ * to the access function itkImageTypeFunction, e.g. ("first", 2, THIRD).
+ * \param mitkImage The MITK input image.
+ * \param itkImageTypeFunction The templated access-function to be called.
+ *
+ * \throws mitk::AccessByItkException If mitkImage is of unsupported pixel type or dimension.
+ *
+ * \note If you do not know the dimension for sure, use #AccessByItk_n.
+ *
+ * \sa AccessByItk_n
+ * \sa AccessFixedDimensionByItk
+ * \sa AccessFixedTypeByItk_n
+ * \sa AccessFixedPixelTypeByItk_n
+ *
+ * \ingroup Adaptor
+ */
+#define AccessFixedDimensionByItk_n(mitkImage, itkImageTypeFunction, dimension, va_tuple) \
+ AccessFixedTypeByItk_n(mitkImage, itkImageTypeFunction, MITK_ACCESSBYITK_PIXEL_TYPES_SEQ, (dimension), va_tuple)
-//##Documentation
-//## @brief Access an mitk-image by an itk-image and pass two
-//## additional parameters to the access-function
-//##
-//## For usage, see AccessByItk. The only difference to AccessByItk
-//## is that two additional parameters (@a param1, @a param2) are passed.
-//## @note If you know the dimension of your input mitk-image,
-//## it is better to use AccessFixedDimensionByItk_2 (less code
-//## is generated).
-//## \sa AccessByItk
-//## \sa AccessFixedDimensionByItk_2
-//## \sa AccessFixedTypeByItk_2
-//## \sa AccessFixedPixelTypeByItk_2
-//## @ingroup Adaptor
-#define AccessByItk_2(mitkImage, itkImageTypeFunction, param1, param2) \
-{ \
- const mitk::PixelType& pixelType = mitkImage->GetPixelType(); \
- const mitk::Image* constImage = mitkImage; \
- const_cast<mitk::Image*>(constImage)->Update(); \
- assert(mitkImage->GetDimension()>=2 && mitkImage->GetDimension()<=3); \
- if(mitkImage->GetDimension()==2) \
- { \
- _accessAllTypesByItk_2(mitkImage, itkImageTypeFunction, 2, param1, param2); \
- } \
- else \
- { \
- _accessAllTypesByItk_2(mitkImage, itkImageTypeFunction, 3, param1, param2) \
- } \
+/**
+ * \brief Access a mitk-image with known type (pixel type and dimension) by an itk-image
+ * with one or more parameters.
+ *
+ * For usage, see AccessFixedTypeByItk.
+ *
+ * \param pixelTypeSeq A sequence of pixel types, like (short)(char)(int).
+ * \param dimension A sequence of dimensions, like (2)(3).
+ * \param va_tuple A variable length tuple containing the arguments to be passed
+ * to the access function itkImageTypeFunction, e.g. ("first", 2, THIRD).
+ * \param mitkImage The MITK input image.
+ * \param itkImageTypeFunction The templated access-function to be called.
+ *
+ * \throws mitk::AccessByItkException If mitkImage is of unsupported pixel type or dimension.
+ *
+ * If the image has a different dimension or pixel type,
+ * a mitk::AccessByItkException exception is thrown.
+ *
+ * \note If you do not know the dimension for sure, use #AccessByItk_n.
+ *
+ * \sa AccessByItk_n
+ * \sa AccessFixedDimensionByItk_n
+ * \sa AccessFixedTypeByItk
+ * \sa AccessFixedPixelTypeByItk_n
+ *
+ * \ingroup Adaptor
+ */
+#define AccessFixedTypeByItk_n(mitkImage, itkImageTypeFunction, pixelTypeSeq, dimSeq, va_tuple) \
+{ \
+ const mitk::PixelType& pixelType = mitkImage->GetPixelType(); \
+ const mitk::Image* constImage = mitkImage; \
+ const_cast<mitk::Image*>(constImage)->Update(); \
+ _checkSpecificDimension(mitkImage, dimSeq); \
+ _accessFixedTypeByItk_n(itkImageTypeFunction, pixelTypeSeq, dimSeq, va_tuple) \
+ _accessByItkPixelTypeException(mitkImage->GetPixelType(), pixelTypeSeq) \
}
-//##Documentation
-//## @brief Access an mitk-image with known dimension by an itk-image
-//## and pass two additional parameters to the access-function
-//##
-//## For usage, see AccessByItk_2 and AccessByItk.
-//## @param dimension dimension of the mitk-image.
-//##
-//## If the image has a different dimension, an exception is thrown
-//## (by assert).
-//## If you do not know the dimension for sure, use AccessByItk_2.
-//## \sa AccessByItk_2
-//## \sa AccessByItk
-//## \sa AccessFixedDimensionByItk_2
-//## \sa AccessFixedTypeByItk_2
-//## \sa AccessFixedPixelTypeByItk_2
-//## @ingroup Adaptor
-#define AccessFixedDimensionByItk_2(mitkImage, itkImageTypeFunction, dimension, param1, param2) \
-{ \
- const mitk::PixelType& pixelType = mitkImage->GetPixelType(); \
- const mitk::Image* constImage = mitkImage; \
- const_cast<mitk::Image*>(constImage)->Update(); \
- assert(mitkImage->GetDimension()==dimension); \
- _accessAllTypesByItk_2(mitkImage, itkImageTypeFunction, dimension, param1, param2) \
-}
+//------------------------- For back-wards compatibility -------------------------------
-//##Documentation
-//## @brief Access an mitk-image with known type (pixel type and dimension)
-//## by an itk-image and pass two additional parameters to the access-function
-//##
-//## For usage, see AccessByItk_2 and AccessByItk.
-//## @param pixeltype pixel type of the mitk-image.
-//## @param dimension dimension of the mitk-image.
-//##
-//## If the image has a different pixel type or dimension, an exception is
-//## thrown (by assert).
-//## If you do not know the pixel type and dimension for sure, use AccessByItk_2.
-//## \sa AccessByItk_2
-//## \sa AccessByItk
-//## \sa AccessFixedDimensionByItk
-//## \sa AccessFixedTypeByItk_2
-//## \sa AccessFixedPixelTypeByItk_2
-//## @ingroup Adaptor
-#define AccessFixedTypeByItk_2(mitkImage, itkImageTypeFunction, pixeltype, dimension, param1, param2) \
-{ \
- const mitk::PixelType& pixelType = mitkImage->GetPixelType(); \
- const mitk::Image* constImage = mitkImage; \
- const_cast<mitk::Image*>(constImage)->Update(); \
- assert(mitkImage->GetDimension()==dimension); \
- _accessByItk_2(mitkImage, itkImageTypeFunction, pixeltype, dimension, param1, param2) else \
- _accessByItkWarning \
-}
+#define AccessByItk_1(mitkImage, itkImageTypeFunction, arg1) AccessByItk_n(mitkImage, itkImageTypeFunction, (arg1))
+#define AccessFixedPixelTypeByItk_1(mitkImage, itkImageTypeFunction, pixelTypeSeq, arg1) AccessFixedPixelTypeByItk_n(mitkImage, itkImageTypeFunction, pixelTypeSeq, (arg1))
+#define AccessFixedDimensionByItk_1(mitkImage, itkImageTypeFunction, dimension, arg1) AccessFixedDimensionByItk_n(mitkImage, itkImageTypeFunction, dimension, (arg1))
+#define AccessFixedTypeByItk_1(mitkImage, itkImageTypeFunction, pixelTypeSeq, dimSeq, arg1) AccessFixedTypeByItk_n(mitkImage, itkImageTypeFunction, pixelTypeSeq, dimSeq, (arg1))
-//##Documentation
-//## @brief Access an mitk-image with known pixel type (but unknown dimension)
-//## by an itk-image and pass two additional parameters to the access-function
-//##
-//## For usage, see AccessByItk_2 and AccessByItk.
-//## @param pixeltype pixel type of the mitk-image.
-//##
-//## If the image has a different pixel type, an exception is
-//## thrown (by assert).
-//## If you do not know the pixel type for sure, use AccessByItk_2.
-//## \sa AccessByItk_2
-//## \sa AccessByItk
-//## \sa AccessFixedDimensionByItk
-//## \sa AccessFixedTypeByItk_2
-//## \sa AccessFixedPixelTypeByItk_2
-//## @ingroup Adaptor
-#define AccessFixedPixelTypeByItk_2(mitkImage, itkImageTypeFunction, pixeltype, param1, param2) \
-{ \
- const mitk::PixelType& pixelType = mitkImage->GetPixelType(); \
- const mitk::Image* constImage = mitkImage; \
- const_cast<mitk::Image*>(constImage)->Update(); \
- assert(mitkImage->GetDimension()>=2 && mitkImage->GetDimension()<=3); \
- if(mitkImage->GetDimension()==2) \
- { \
- _accessByItk_2(mitkImage, itkImageTypeFunction, pixeltype, 2, param1, param2) else \
- _accessByItkWarning \
- } \
- else \
- { \
- _accessByItk_2(mitkImage, itkImageTypeFunction, pixeltype, 3, param1, param2) else \
- _accessByItkWarning \
- } \
-}
+#define AccessByItk_2(mitkImage, itkImageTypeFunction, arg1, arg2) AccessByItk_n(mitkImage, itkImageTypeFunction, (arg1,arg2))
+#define AccessFixedPixelTypeByItk_2(mitkImage, itkImageTypeFunction, pixelTypeSeq, arg1, arg2) AccessFixedPixelTypeByItk_n(mitkImage, itkImageTypeFunction, pixelTypeSeq, (arg1,arg2))
+#define AccessFixedDimensionByItk_2(mitkImage, itkImageTypeFunction, dimension, arg1, arg2) AccessFixedDimensionByItk_n(mitkImage, itkImageTypeFunction, dimension, (arg1,arg2))
+#define AccessFixedTypeByItk_2(mitkImage, itkImageTypeFunction, pixelTypeSeq, dimSeq, arg1, arg2) AccessFixedTypeByItk_n(mitkImage, itkImageTypeFunction, pixelTypeSeq, dimSeq, (arg1,arg2))
-#define _accessTwoImagesByItk2(mitkImage1, mitkImage2, itkImageTypeFunction, pixeltype, pixeltype2, dimension) \
- if ( pixelType2 == typeid(pixeltype2) ) \
- { \
- typedef itk::Image<pixeltype, dimension> ImageType1; \
- typedef itk::Image<pixeltype2, dimension> ImageType2; \
- typedef mitk::ImageToItk<ImageType1> ImageToItkType1; \
- typedef mitk::ImageToItk<ImageType2> ImageToItkType2; \
- itk::SmartPointer<ImageToItkType1> imagetoitk1 = ImageToItkType1::New(); \
- imagetoitk1->SetInput(mitkImage1); \
- imagetoitk1->Update(); \
- itk::SmartPointer<ImageToItkType2> imagetoitk2 = ImageToItkType2::New(); \
- imagetoitk2->SetInput(mitkImage2); \
- imagetoitk2->Update(); \
- itkImageTypeFunction(imagetoitk1->GetOutput(), imagetoitk2->GetOutput()); \
- }
-
-#define _accessTwoImagesByItk(mitkImage1, mitkImage2, itkImageTypeFunction, pixeltype, dimension) \
- if ( pixelType1 == typeid(pixeltype) ) \
- { \
- _accessTwoImagesByItk2(mitkImage1, mitkImage2, itkImageTypeFunction, pixeltype, double, dimension) else \
- _accessTwoImagesByItk2(mitkImage1, mitkImage2, itkImageTypeFunction, pixeltype, float, dimension) else \
- _accessTwoImagesByItk2(mitkImage1, mitkImage2, itkImageTypeFunction, pixeltype, int, dimension) else \
- _accessTwoImagesByItk2(mitkImage1, mitkImage2, itkImageTypeFunction, pixeltype, unsigned int, dimension) else \
- _accessTwoImagesByItk2(mitkImage1, mitkImage2, itkImageTypeFunction, pixeltype, short, dimension) else \
- _accessTwoImagesByItk2(mitkImage1, mitkImage2, itkImageTypeFunction, pixeltype, unsigned short, dimension) else \
- _accessTwoImagesByItk2(mitkImage1, mitkImage2, itkImageTypeFunction, pixeltype, char, dimension) else \
- _accessTwoImagesByItk2(mitkImage1, mitkImage2, itkImageTypeFunction, pixeltype, unsigned char, dimension) else \
- _accessByItkWarningParam(pixelType2, "_accessTwoImagesByItk") \
- }
+#define AccessByItk_3(mitkImage, itkImageTypeFunction, arg1, arg2, arg3) AccessByItk_n(mitkImage, itkImageTypeFunction, (arg1,arg2,arg3))
+#define AccessFixedPixelTypeByItk_3(mitkImage, itkImageTypeFunction, pixelTypeSeq, arg1, arg2, arg3) AccessFixedPixelTypeByItk_n(mitkImage, itkImageTypeFunction, pixelTypeSeq, (arg1,arg2,arg3))
+#define AccessFixedDimensionByItk_3(mitkImage, itkImageTypeFunction, dimension, arg1, arg2, arg3) AccessFixedDimensionByItk_n(mitkImage, itkImageTypeFunction, dimension, (arg1,arg2,arg3))
+#define AccessFixedTypeByItk_3(mitkImage, itkImageTypeFunction, pixelTypeSeq, dimSeq, arg1, arg2, arg3) AccessFixedTypeByItk_n(mitkImage, itkImageTypeFunction, pixelTypeSeq, dimSeq, (arg1,arg2,arg3))
-#define _accessTwoImagesAllTypesByItk(mitkImage1, mitkImage2, itkImageTypeFunction, dimension) \
- _accessTwoImagesByItk(mitkImage1, mitkImage2, itkImageTypeFunction, double, dimension) else \
- _accessTwoImagesByItk(mitkImage1, mitkImage2, itkImageTypeFunction, float, dimension) else \
- _accessTwoImagesByItk(mitkImage1, mitkImage2, itkImageTypeFunction, int, dimension) else \
- _accessTwoImagesByItk(mitkImage1, mitkImage2, itkImageTypeFunction, unsigned int, dimension) else \
- _accessTwoImagesByItk(mitkImage1, mitkImage2, itkImageTypeFunction, short, dimension) else \
- _accessTwoImagesByItk(mitkImage1, mitkImage2, itkImageTypeFunction, unsigned short, dimension) else \
- _accessTwoImagesByItk(mitkImage1, mitkImage2, itkImageTypeFunction, char, dimension) else \
- _accessTwoImagesByItk(mitkImage1, mitkImage2, itkImageTypeFunction, unsigned char, dimension) else \
- _accessByItkWarningParam(pixelType1, "_accessTwoImagesByItk")
+//----------------------------- Access two MITK Images ---------------------------------
-//----------------------- version with 3 additional parameters -----------------
#ifndef DOXYGEN_SKIP
-#define _accessByItk_3(mitkImage, itkImageTypeFunction, pixeltype, dimension, param1, param2, param3) \
- if ( pixelType == typeid(pixeltype) ) \
- { \
- typedef itk::Image<pixeltype, dimension> ImageType; \
- typedef mitk::ImageToItk<ImageType> ImageToItkType; \
- itk::SmartPointer<ImageToItkType> imagetoitk = ImageToItkType::New(); \
- imagetoitk->SetInput(mitkImage); \
- imagetoitk->Update(); \
- itkImageTypeFunction(imagetoitk->GetOutput(), param1, param2, param3); \
- }
-
-#define _accessAllTypesByItk_3(mitkImage, itkImageTypeFunction, dimension, param1, param2, param3) \
- _accessByItk_3(mitkImage, itkImageTypeFunction, double, dimension, param1, param2, param3) else \
- _accessByItk_3(mitkImage, itkImageTypeFunction, float, dimension, param1, param2, param3) else \
- _accessByItk_3(mitkImage, itkImageTypeFunction, int, dimension, param1, param2, param3) else \
- _accessByItk_3(mitkImage, itkImageTypeFunction, unsigned int, dimension, param1, param2, param3) else \
- _accessByItk_3(mitkImage, itkImageTypeFunction, short, dimension, param1, param2, param3) else \
- _accessByItk_3(mitkImage, itkImageTypeFunction, unsigned short, dimension, param1, param2, param3) else \
- _accessByItk_3(mitkImage, itkImageTypeFunction, char, dimension, param1, param2, param3) else \
- _accessByItk_3(mitkImage, itkImageTypeFunction, unsigned char, dimension, param1, param2, param3) else \
- _accessByItkWarning \
-
-#endif //DOXYGEN_SKIP
-
-//##Documentation
-//## @brief Access an mitk-image by an itk-image and pass three
-//## additional parameters to the access-function
-//##
-//## For usage, see AccessByItk. The only difference to AccessByItk
-//## is that two additional parameters (@a param1, @a param2) are passed.
-//## @note If you know the dimension of your input mitk-image,
-//## it is better to use AccessFixedDimensionByItk_3 (less code
-//## is generated).
-//## \sa AccessByItk
-//## \sa AccessFixedDimensionByItk_3
-//## \sa AccessFixedPixelTypeByItk_3
-//## @ingroup Adaptor
-#define AccessByItk_3(mitkImage, itkImageTypeFunction, param1, param2, param3) \
-{ \
- const mitk::PixelType& pixelType = mitkImage->GetPixelType(); \
- const mitk::Image* constImage = mitkImage; \
- const_cast<mitk::Image*>(constImage)->Update(); \
- assert(mitkImage->GetDimension()>=2 && mitkImage->GetDimension()<=3); \
- if(mitkImage->GetDimension()==2) \
- { \
- _accessAllTypesByItk_3(mitkImage, itkImageTypeFunction, 2, param1, param2, param3); \
- } \
- else \
- { \
- _accessAllTypesByItk_3(mitkImage, itkImageTypeFunction, 3, param1, param2, param3) \
- } \
-}
-
-//##Documentation
-//## @brief Access an mitk-image with known dimension by an itk-image
-//## and pass three additional parameters to the access-function
-//##
-//## For usage, see AccessByItk_3 and AccessByItk.
-//## @param dimension dimension of the mitk-image.
-//##
-//## If the image has a different dimension, an exception is thrown
-//## (by assert).
-//## If you do not know the dimension for sure, use AccessByItk_3.
-//## \sa AccessByItk_3
-//## \sa AccessByItk
-//## \sa AccessFixedDimensionByItk_3
-//## \sa AccessFixedTypeByItk_3
-//## \sa AccessFixedPixelTypeByItk_3
-//## @ingroup Adaptor
-#define AccessFixedDimensionByItk_3(mitkImage, itkImageTypeFunction, dimension, param1, param2, param3) \
-{ \
- const mitk::PixelType& pixelType = mitkImage->GetPixelType(); \
- const mitk::Image* constImage = mitkImage; \
- const_cast<mitk::Image*>(constImage)->Update(); \
- assert(mitkImage->GetDimension()==dimension); \
- _accessAllTypesByItk_3(mitkImage, itkImageTypeFunction, dimension, param1, param2, param3) \
-}
-
-//##Documentation
-//## @brief Access an mitk-image with known type (pixel type and dimension)
-//## by an itk-image and pass three additional parameters to the access-function
-//##
-//## For usage, see AccessByItk_3 and AccessByItk.
-//## @param pixeltype pixel type of the mitk-image.
-//## @param dimension dimension of the mitk-image.
-//##
-//## If the image has a different pixel type or dimension, an exception is
-//## thrown (by assert).
-//## If you do not know the pixel type and dimension for sure, use AccessByItk_3.
-//## \sa AccessByItk_3
-//## \sa AccessByItk
-//## \sa AccessFixedDimensionByItk
-//## \sa AccessFixedPixelTypeByItk_3
-//## @ingroup Adaptor
-#define AccessFixedTypeByItk_3(mitkImage, itkImageTypeFunction, pixeltype, dimension, param1, param2, param3) \
-{ \
- const mitk::PixelType& pixelType = mitkImage->GetPixelType(); \
- const mitk::Image* constImage = mitkImage; \
- const_cast<mitk::Image*>(constImage)->Update(); \
- assert(mitkImage->GetDimension()==dimension); \
- _accessByItk_3(mitkImage, itkImageTypeFunction, pixeltype, dimension, param1, param2, param3) else \
- _accessByItkWarning \
-}
-
-//##Documentation
-//## @brief Access an mitk-image with known pixel type (but unknown dimension)
-//## by an itk-image and pass three additional parameters to the access-function
-//##
-//## For usage, see AccessByItk_3 and AccessByItk.
-//## @param pixeltype pixel type of the mitk-image.
-//##
-//## If the image has a different pixel type, an exception is
-//## thrown (by assert).
-//## If you do not know the pixel type for sure, use AccessByItk_3.
-//## \sa AccessByItk_3
-//## \sa AccessByItk
-//## \sa AccessFixedDimensionByItk
-//## \sa AccessFixedTypeByItk_3
-//## \sa AccessFixedPixelTypeByItk_3
-//## @ingroup Adaptor
-#define AccessFixedPixelTypeByItk_3(mitkImage, itkImageTypeFunction, pixeltype, param1, param2, param3) \
-{ \
- const mitk::PixelType& pixelType = mitkImage->GetPixelType(); \
- const mitk::Image* constImage = mitkImage; \
- const_cast<mitk::Image*>(constImage)->Update(); \
- assert(mitkImage->GetDimension()>=2 && mitkImage->GetDimension()<=3); \
- if(mitkImage->GetDimension()==2) \
- { \
- _accessByItk_3(mitkImage, itkImageTypeFunction, pixeltype, 2, param1, param2, param3) else \
- _accessByItkWarning \
- } \
- else \
- { \
- _accessByItk_3(mitkImage, itkImageTypeFunction, pixeltype, 3, param1, param2, param3) else \
- _accessByItkWarning \
- } \
-}
-
-
-//##Documentation
-//## @brief Access two mitk-images with known dimension by itk-images
-//##
-//## For usage, see AccessByItk.
-//## @param dimension dimension of the mitk-image.
-//##
-//## If one of the images has a different dimension, an exception is thrown
-//## (by assert).
-//## If you do not know the dimension for sure, use AccessByItk.
-//## \sa AccessByItk
-//## \sa AccessFixedDimensionByItk
-//## \sa AccessFixedTypeByItk
-//## \sa AccessFixedPixelTypeByItk
-//## @ingroup Adaptor
-#define AccessTwoImagesFixedDimensionByItk(mitkImage1, mitkImage2, itkImageTypeFunction, dimension) \
-{ \
- const mitk::PixelType& pixelType1 = mitkImage1->GetPixelType(); \
- const mitk::PixelType& pixelType2 = mitkImage2->GetPixelType(); \
- const mitk::Image* constImage1 = mitkImage1; \
- const mitk::Image* constImage2 = mitkImage2; \
- const_cast<mitk::Image*>(constImage1)->Update(); \
- const_cast<mitk::Image*>(constImage2)->Update(); \
- assert((mitkImage1)->GetDimension()==dimension); \
- assert((mitkImage2)->GetDimension()==dimension); \
- _accessTwoImagesAllTypesByItk(mitkImage1, mitkImage2, itkImageTypeFunction, dimension) \
-}
-
-#ifdef mitkCore_EXPORTS
-#define MITK_CORE_EXPORT_EXTERN
+#define _accessTwoImagesByItk(itkImageTypeFunction, pixeltype1, dim1, pixeltype2, dim2) \
+ if (pixelType1 == typeid(pixeltype1) && pixelType2 == typeid(pixeltype2) && \
+ constImage1->GetDimension() == dim1 && constImage2->GetDimension() == dim2) \
+ { \
+ typedef itk::Image<pixeltype1,dim1> ImageType1; \
+ typedef itk::Image<pixeltype2,dim2> ImageType2; \
+ typedef mitk::ImageToItk<ImageType1> ImageToItkType1; \
+ typedef mitk::ImageToItk<ImageType2> ImageToItkType2; \
+ itk::SmartPointer<ImageToItkType1> imagetoitk1 = ImageToItkType1::New(); \
+ imagetoitk1->SetInput(constImage1); \
+ imagetoitk1->Update(); \
+ itk::SmartPointer<ImageToItkType2> imagetoitk2 = ImageToItkType2::New(); \
+ imagetoitk2->SetInput(constImage2); \
+ imagetoitk2->Update(); \
+ itkImageTypeFunction(imagetoitk1->GetOutput(), imagetoitk2->GetOutput()); \
+ } else
+
+#define _accessTwoImagesByItkArgs2(itkImageTypeFunction, type1, type2) \
+ (itkImageTypeFunction, MITK_PP_TUPLE_REM(2) type1, MITK_PP_TUPLE_REM(2) type2)
+
+#define _accessTwoImagesByItkArgs(product) \
+ MITK_PP_EXPAND(_accessTwoImagesByItkArgs2 MITK_PP_EXPAND((MITK_PP_SEQ_HEAD(product), MITK_PP_TUPLE_REM(2) MITK_PP_SEQ_TO_TUPLE(MITK_PP_SEQ_TAIL(product)))))
+
+// product is of the form (itkImageTypeFunction)((short,2))((char,2))
+#ifdef _MSC_VER
+#define _accessTwoImagesByItkIter(r, product) \
+ MITK_PP_EXPAND(_accessTwoImagesByItk _msvc_expand_bug(_accessTwoImagesByItkArgs2, (MITK_PP_SEQ_HEAD(product), _msvc_expand_bug(MITK_PP_TUPLE_REM(2), MITK_PP_EXPAND(MITK_PP_SEQ_TO_TUPLE (MITK_PP_SEQ_TAIL(product)))))))
#else
-#define MITK_CORE_EXPORT_EXTERN extern
+#define _accessTwoImagesByItkIter(r, product) \
+ MITK_PP_EXPAND(_accessTwoImagesByItk _accessTwoImagesByItkArgs(product))
#endif
-//----------------------- cast functions. Will be moved to mitkImageCast.h -----------------
-namespace mitk
-{
-#ifndef DOXYGEN_SKIP
- template < typename TPixel, unsigned int VImageDimension, class ItkOutputImageType >
- void _CastToItkImage2Access( itk::Image<TPixel, VImageDimension>* itkInputImage, itk::SmartPointer<ItkOutputImageType>& itkOutputImage);
-#endif //DOXYGEN_SKIP
- //##Documentation
- //## @brief Cast an mitk::Image to an itk::Image with a specific type. You don't have to initialize the itk::Image<..>::Pointer.
- //## @ingroup Adaptor
- template <typename ItkOutputImageType> extern void MITK_CORE_EXPORT CastToItkImage(const mitk::Image * mitkImage, itk::SmartPointer<ItkOutputImageType>& itkOutputImage);
-}
+#define _accessTwoImagesByItkForEach(itkImageTypeFunction, tseq1, tseq2) \
+ MITK_PP_SEQ_FOR_EACH_PRODUCT(_accessTwoImagesByItkIter, ((itkImageTypeFunction))(tseq1)(tseq2))
-//----------------------- include to be removed -----------------------
-#include <mitkInstantiateAccessFunctions.h>
+#endif // DOXYGEN_SKIP
+
+/**
+ * \brief Access two mitk-images with known dimension by itk-images
+ *
+ * Define a templated function or method (\a itkImageTypeFunction)
+ * within which the mitk-images (\a mitkImage1 and \a mitkImage2) are accessed:
+ * \code
+ * template <typename TPixel1, unsigned int VImageDimension1, typename TPixel2, unsigned int VImageDimension2>
+ * void ExampleFunctionTwoImages(itk::Image<TPixel1, VImageDimension1>* itkImage1, itk::Image<TPixel2, VImageDimension2>* itkImage2);
+ * \endcode
+ *
+ * The itk::Image passed to the function/method has the same
+ * data-pointer as the mitk-image. So you have full read- and write-
+ * access to the data vector of the mitk-image using the itk-image.
+ * Call by:
+ * \code
+ * mitk::Image* inputMitkImage1 = ...
+ * mitk::Image* inputMitkImage2 = ...
+ * try
+ * {
+ * AccessTwoImagesFixedDimensionByItk(inputMitkImage1, inputMitkImage2, ExampleFunctionTwoImages, 3);
+ * }
+ * catch (const mitk::AccessByItkException& e)
+ * {
+ * // mitk::Image arguments are of wrong pixel type or dimension,
+ * // insert error handling here
+ * }
+ * \endcode
+ *
+ * \note If your inputMitkImage1 or inputMitkImage2 is a mitk::Image::Pointer, use
+ * inputMitkImage1.GetPointer().
+ *
+ * \param mitkImage1 The first MITK input image.
+ * \param mitkImage1 The second MITK input image.
+ * \param itkImageTypeFunction The name of the template access-function to be called.
+ * \param dimension Dimension of the two mitk-images.
+ *
+ * \throws mitk::AccessByItkException If mitkImage1 and mitkImage2 have different dimensions or
+ * one of the images is of unsupported pixel type or dimension.
+ *
+ * \sa #AccessByItk
+ *
+ * \ingroup Adaptor
+ */
+#define AccessTwoImagesFixedDimensionByItk(mitkImage1, mitkImage2, itkImageTypeFunction, dimension) \
+{ \
+ const mitk::PixelType& pixelType1 = mitkImage1->GetPixelType(); \
+ const mitk::PixelType& pixelType2 = mitkImage2->GetPixelType(); \
+ const mitk::Image* constImage1 = mitkImage1; \
+ const mitk::Image* constImage2 = mitkImage2; \
+ const_cast<mitk::Image*>(constImage1)->Update(); \
+ const_cast<mitk::Image*>(constImage2)->Update(); \
+ _checkSpecificDimension(mitkImage1, (dimension)); \
+ _checkSpecificDimension(mitkImage2, (dimension)); \
+ _accessTwoImagesByItkForEach(itkImageTypeFunction, MITK_ACCESSBYITK_TYPES_DIMN_SEQ(dimension), MITK_ACCESSBYITK_TYPES_DIMN_SEQ(dimension)) \
+ { \
+ std::string msg("Pixel type "); \
+ msg.append(pixelType1.GetItkTypeAsString()); \
+ msg.append(" or pixel type "); \
+ msg.append(pixelType2.GetItkTypeAsString()); \
+ msg.append(" is not in " MITK_PP_STRINGIZE(MITK_ACCESSBYITK_TYPES_DIMN_SEQ(dimension))); \
+ throw mitk::AccessByItkException(msg); \
+ } \
+}
#endif // of MITKIMAGEACCESSBYITK_H_HEADER_INCLUDED
diff --git a/Core/Code/Algorithms/mitkImageCast.h b/Core/Code/Algorithms/mitkImageCast.h
index 931b9a6194..72a47220c1 100644
--- a/Core/Code/Algorithms/mitkImageCast.h
+++ b/Core/Code/Algorithms/mitkImageCast.h
@@ -1,27 +1,41 @@
/*=========================================================================
Program: Medical Imaging & Interaction Toolkit
Language: C++
Date: $Date$
Version: $Revision$
Copyright (c) German Cancer Research Center, Division of Medical and
Biological Informatics. All rights reserved.
See MITKCopyright.txt or http://www.mitk.org/copyright.html for details.
This software is distributed WITHOUT ANY WARRANTY; without even
the implied warranty of MERCHANTABILITY or FITNESS FOR A PARTICULAR
PURPOSE. See the above copyright notices for more information.
=========================================================================*/
#ifndef MITKIMAGECAST_H_HEADER_INCLUDED
#define MITKIMAGECAST_H_HEADER_INCLUDED
-#include "itkDiffusionTensor3D.h"
-#include "itkVector.h"
+#include <mitkCommon.h>
+#include <mitkImage.h>
-#include <mitkImageAccessByItk.h>
+#include <itkImage.h>
+
+namespace mitk
+{
+
+#ifndef DOXYGEN_SKIP
+ template < typename TPixel, unsigned int VImageDimension, class ItkOutputImageType >
+ void _CastToItkImage2Access( itk::Image<TPixel, VImageDimension>* itkInputImage, itk::SmartPointer<ItkOutputImageType>& itkOutputImage);
+#endif //DOXYGEN_SKIP
+
+ //##Documentation
+ //## @brief Cast an mitk::Image to an itk::Image with a specific type. You don't have to initialize the itk::Image<..>::Pointer.
+ //## @ingroup Adaptor
+ template <typename ItkOutputImageType> extern void MITK_CORE_EXPORT CastToItkImage(const mitk::Image * mitkImage, itk::SmartPointer<ItkOutputImageType>& itkOutputImage);
+}
#endif // of MITKIMAGECAST_H_HEADER_INCLUDED
diff --git a/Core/Code/Algorithms/mitkImageCastPart1.cpp b/Core/Code/Algorithms/mitkImageCastPart1.cpp
index cee51bff5c..6fe18466b8 100644
--- a/Core/Code/Algorithms/mitkImageCastPart1.cpp
+++ b/Core/Code/Algorithms/mitkImageCastPart1.cpp
@@ -1,79 +1,54 @@
/*=========================================================================
Program: Medical Imaging & Interaction Toolkit
Language: C++
Date: $Date$
Version: $Revision$
Copyright (c) German Cancer Research Center, Division of Medical and
Biological Informatics. All rights reserved.
See MITKCopyright.txt or http://www.mitk.org/copyright.html for details.
This software is distributed WITHOUT ANY WARRANTY; without even
the implied warranty of MERCHANTABILITY or FITNESS FOR A PARTICULAR
PURPOSE. See the above copyright notices for more information.
=========================================================================*/
-
+#include <mitkConfig.h>
#include <mitkImageCast.h>
+#include <mitkInstantiateAccessFunctions.h>
+
#include <itkImage.h>
#include <itkCastImageFilter.h>
namespace mitk
{
#ifndef DOXYGEN_SKIP
template < typename TPixel, unsigned int VImageDimension, class ItkOutputImageType >
void _CastToItkImage2Access( itk::Image<TPixel, VImageDimension>* itkInputImage, itk::SmartPointer<ItkOutputImageType>& itkOutputImage)
{
typedef itk::Image<TPixel, VImageDimension> ItkInputImageType;
if(typeid(ItkInputImageType) == typeid(ItkOutputImageType))
{
itkOutputImage = reinterpret_cast<ItkOutputImageType*>(itkInputImage);
return;
}
typedef itk::CastImageFilter< ItkInputImageType, ItkOutputImageType > CastImageFilterType;
typename CastImageFilterType::Pointer castImageFilter = CastImageFilterType::New();
castImageFilter->SetInput( itkInputImage );
castImageFilter->Update();
itkOutputImage = castImageFilter->GetOutput();
}
#endif //DOXYGEN_SKIP
-typedef itk::Image<double, 2> itkImageD2;
-typedef itk::Image<float, 2> itkImageF2;
-typedef itk::Image<int, 2> itkImageSI2;
-typedef itk::Image<unsigned int, 2> itkImageUI2;
-typedef itk::Image<short, 2> itkImageSS2;
-typedef itk::Image<unsigned short, 2> itkImageUS2;
-typedef itk::Image<char, 2> itkImageSC2;
-typedef itk::Image<unsigned char, 2> itkImageUC2;
-InstantiateAccessFunctionForFixedDimension_1(_CastToItkImage2Access, 2, itk::SmartPointer<itkImageD2>& );
-InstantiateAccessFunctionForFixedDimension_1(_CastToItkImage2Access, 2, itk::SmartPointer<itkImageF2>& );
-InstantiateAccessFunctionForFixedDimension_1(_CastToItkImage2Access, 2, itk::SmartPointer<itkImageSI2>&);
-InstantiateAccessFunctionForFixedDimension_1(_CastToItkImage2Access, 2, itk::SmartPointer<itkImageUI2>&);
-InstantiateAccessFunctionForFixedDimension_1(_CastToItkImage2Access, 2, itk::SmartPointer<itkImageSS2>&);
-InstantiateAccessFunctionForFixedDimension_1(_CastToItkImage2Access, 2, itk::SmartPointer<itkImageUS2>&);
-InstantiateAccessFunctionForFixedDimension_1(_CastToItkImage2Access, 2, itk::SmartPointer<itkImageSC2>&);
-InstantiateAccessFunctionForFixedDimension_1(_CastToItkImage2Access, 2, itk::SmartPointer<itkImageUC2>&);
+#define InstantiateAccessFunction__CastToItkImage2Access(type1, type2) \
+ template MITK_CORE_EXPORT void _CastToItkImage2Access(itk::Image<MITK_PP_TUPLE_REM(2)type1>*, itk::SmartPointer<itk::Image<MITK_PP_TUPLE_REM(2)type2> >&);
-typedef itk::Image<double, 3> itkImageD3;
-typedef itk::Image<float, 3> itkImageF3;
-typedef itk::Image<int, 3> itkImageSI3;
-typedef itk::Image<unsigned int, 3> itkImageUI3;
-typedef itk::Image<short, 3> itkImageSS3;
-typedef itk::Image<unsigned short, 3> itkImageUS3;
-typedef itk::Image<char, 3> itkImageSC3;
-typedef itk::Image<unsigned char, 3> itkImageUC3;
+#define InstantiateCastToItkImage2Access(r, data, dim) \
+ MITK_PP_SEQ_FOR_EACH_PRODUCT(InstantiateAccessFunctionProductImpl, ((_CastToItkImage2Access))(MITK_ACCESSBYITK_TYPES_DIMN_SEQ(dim))(MITK_ACCESSBYITK_TYPES_DIMN_SEQ(dim)))
-InstantiateAccessFunctionForFixedDimension_1(_CastToItkImage2Access, 3, itk::SmartPointer<itkImageD3>&);
-InstantiateAccessFunctionForFixedDimension_1(_CastToItkImage2Access, 3, itk::SmartPointer<itkImageF3>&);
-InstantiateAccessFunctionForFixedDimension_1(_CastToItkImage2Access, 3, itk::SmartPointer<itkImageSI3>&);
-InstantiateAccessFunctionForFixedDimension_1(_CastToItkImage2Access, 3, itk::SmartPointer<itkImageUI3>&);
-InstantiateAccessFunctionForFixedDimension_1(_CastToItkImage2Access, 3, itk::SmartPointer<itkImageSS3>&);
-InstantiateAccessFunctionForFixedDimension_1(_CastToItkImage2Access, 3, itk::SmartPointer<itkImageUS3>&);
-InstantiateAccessFunctionForFixedDimension_1(_CastToItkImage2Access, 3, itk::SmartPointer<itkImageSC3>&);
-InstantiateAccessFunctionForFixedDimension_1(_CastToItkImage2Access, 3, itk::SmartPointer<itkImageUC3>&);
+MITK_PP_SEQ_FOR_EACH(InstantiateCastToItkImage2Access, _, MITK_ACCESSBYITK_DIMENSIONS_SEQ)
}
diff --git a/Core/Code/Algorithms/mitkImageCastPart2.cpp b/Core/Code/Algorithms/mitkImageCastPart2.cpp
index e36888f4aa..0eafbbe30d 100644
--- a/Core/Code/Algorithms/mitkImageCastPart2.cpp
+++ b/Core/Code/Algorithms/mitkImageCastPart2.cpp
@@ -1,73 +1,41 @@
/*=========================================================================
Program: Medical Imaging & Interaction Toolkit
Language: C++
Date: $Date$
Version: $Revision$
Copyright (c) German Cancer Research Center, Division of Medical and
Biological Informatics. All rights reserved.
See MITKCopyright.txt or http://www.mitk.org/copyright.html for details.
This software is distributed WITHOUT ANY WARRANTY; without even
the implied warranty of MERCHANTABILITY or FITNESS FOR A PARTICULAR
PURPOSE. See the above copyright notices for more information.
=========================================================================*/
#include <mitkImageCast.h>
+#include <mitkImageAccessByItk.h>
+#include <mitkInstantiateAccessFunctions.h>
+
#include <itkImage.h>
#include <itkCastImageFilter.h>
namespace mitk
{
#ifndef DOXYGEN_SKIP
template <typename ItkOutputImageType> void CastToItkImage(const mitk::Image * mitkImage, itk::SmartPointer<ItkOutputImageType>& itkOutputImage)
{
AccessFixedDimensionByItk_1(mitkImage, _CastToItkImage2Access, ::itk::GetImageDimension<ItkOutputImageType>::ImageDimension, itkOutputImage);
}
#endif //DOXYGEN_SKIP
-typedef itk::Image<double, 2> itkImageD2;
-typedef itk::Image<float, 2> itkImageF2;
-typedef itk::Image<int, 2> itkImageSI2;
-typedef itk::Image<unsigned int, 2> itkImageUI2;
-typedef itk::Image<short, 2> itkImageSS2;
-typedef itk::Image<unsigned short, 2> itkImageUS2;
-typedef itk::Image<char, 2> itkImageSC2;
-typedef itk::Image<unsigned char, 2> itkImageUC2;
-
-template void MITK_CORE_EXPORT CastToItkImage(const mitk::Image *, itk::SmartPointer<itkImageD2>&);
-template void MITK_CORE_EXPORT CastToItkImage(const mitk::Image *, itk::SmartPointer<itkImageF2>&);
-template void MITK_CORE_EXPORT CastToItkImage(const mitk::Image *, itk::SmartPointer<itkImageSI2>&);
-template void MITK_CORE_EXPORT CastToItkImage(const mitk::Image *, itk::SmartPointer<itkImageUI2>&);
-template void MITK_CORE_EXPORT CastToItkImage(const mitk::Image *, itk::SmartPointer<itkImageSS2>&);
-template void MITK_CORE_EXPORT CastToItkImage(const mitk::Image *, itk::SmartPointer<itkImageUS2>&);
-template void MITK_CORE_EXPORT CastToItkImage(const mitk::Image *, itk::SmartPointer<itkImageSC2>&);
-template void MITK_CORE_EXPORT CastToItkImage(const mitk::Image *, itk::SmartPointer<itkImageUC2>&);
-
-typedef itk::Image<double, 3> itkImageD3;
-typedef itk::Image<float, 3> itkImageF3;
-typedef itk::Image<int, 3> itkImageSI3;
-typedef itk::Image<unsigned int, 3> itkImageUI3;
-typedef itk::Image<short, 3> itkImageSS3;
-typedef itk::Image<unsigned short, 3> itkImageUS3;
-typedef itk::Image<char, 3> itkImageSC3;
-typedef itk::Image<unsigned char, 3> itkImageUC3;
-
-template void MITK_CORE_EXPORT CastToItkImage(const mitk::Image *, itk::SmartPointer<itkImageD3>&);
-template void MITK_CORE_EXPORT CastToItkImage(const mitk::Image *, itk::SmartPointer<itkImageF3>&);
-template void MITK_CORE_EXPORT CastToItkImage(const mitk::Image *, itk::SmartPointer<itkImageSI3>&);
-template void MITK_CORE_EXPORT CastToItkImage(const mitk::Image *, itk::SmartPointer<itkImageUI3>&);
-template void MITK_CORE_EXPORT CastToItkImage(const mitk::Image *, itk::SmartPointer<itkImageSS3>&);
-template void MITK_CORE_EXPORT CastToItkImage(const mitk::Image *, itk::SmartPointer<itkImageUS3>&);
-template void MITK_CORE_EXPORT CastToItkImage(const mitk::Image *, itk::SmartPointer<itkImageSC3>&);
-template void MITK_CORE_EXPORT CastToItkImage(const mitk::Image *, itk::SmartPointer<itkImageUC3>&);
+#define InstantiateAccessFunction_CastToItkImage(pixelType, dim) \
+template MITK_CORE_EXPORT void CastToItkImage(const mitk::Image *, itk::SmartPointer<itk::Image<pixelType,dim> >&);
-#ifndef DOXYGEN_SKIP
-
-#endif //DOXYGEN_SKIP
+InstantiateAccessFunction(CastToItkImage)
}
diff --git a/Core/Code/Algorithms/mitkImageCastPart3.cpp b/Core/Code/Algorithms/mitkImageCastPart3.cpp
index 0e5988a8de..c3e79bf19c 100644
--- a/Core/Code/Algorithms/mitkImageCastPart3.cpp
+++ b/Core/Code/Algorithms/mitkImageCastPart3.cpp
@@ -1,119 +1,122 @@
/*=========================================================================
Program: Medical Imaging & Interaction Toolkit
Language: C++
Date: $Date: 2008-12-05 10:31:44 +0100 (Fr, 05 Dez 2008) $
Version: $Revision: 15893 $
Copyright (c) German Cancer Research Center, Division of Medical and
Biological Informatics. All rights reserved.
See MITKCopyright.txt or http://www.mitk.org/copyright.html for details.
This software is distributed WITHOUT ANY WARRANTY; without even
the implied warranty of MERCHANTABILITY or FITNESS FOR A PARTICULAR
PURPOSE. See the above copyright notices for more information.
=========================================================================*/
#include <mitkImageCast.h>
#include <itkImage.h>
#include <itkCastImageFilter.h>
+#include <itkVector.h>
+#include <itkDiffusionTensor3D.h>
+
namespace mitk
{
#ifndef DOXYGEN_SKIP
template < typename TPixel, unsigned int VImageDimension, class ItkOutputImageType >
void _CastToItkImage2Access( itk::Image<TPixel, VImageDimension>* itkInputImage, itk::SmartPointer<ItkOutputImageType>& itkOutputImage)
{
typedef itk::Image<TPixel, VImageDimension> ItkInputImageType;
if(typeid(ItkInputImageType) == typeid(ItkOutputImageType))
{
itkOutputImage = reinterpret_cast<ItkOutputImageType*>(itkInputImage);
return;
}
typedef itk::CastImageFilter< ItkInputImageType, ItkOutputImageType > CastImageFilterType;
typename CastImageFilterType::Pointer castImageFilter = CastImageFilterType::New();
castImageFilter->SetInput( itkInputImage );
castImageFilter->Update();
itkOutputImage = castImageFilter->GetOutput();
}
#endif //DOXYGEN_SKIP
typedef itk::Image<itk::RGBPixel<unsigned char>, 2> itkImageRGBUC2;
typedef itk::Image<itk::DiffusionTensor3D<float>, 2> itkImageDTIF2;
typedef itk::Image<itk::DiffusionTensor3D<double>, 2> itkImageDTID2;
template void MITK_CORE_EXPORT _CastToItkImage2Access(itkImageRGBUC2*, itk::SmartPointer<itkImageRGBUC2>&);
template void MITK_CORE_EXPORT _CastToItkImage2Access(itkImageDTIF2*, itk::SmartPointer<itkImageDTIF2>&);
template void MITK_CORE_EXPORT _CastToItkImage2Access(itkImageDTID2*, itk::SmartPointer<itkImageDTID2>&);
typedef itk::Image<itk::RGBPixel<unsigned char>, 3> itkImageRGBUC3;
typedef itk::Image<itk::DiffusionTensor3D<float>, 3> itkImageDTIF3;
typedef itk::Image<itk::DiffusionTensor3D<double>, 3> itkImageDTID3;
template void MITK_CORE_EXPORT _CastToItkImage2Access(itkImageRGBUC3*, itk::SmartPointer<itkImageRGBUC3>&);
template void MITK_CORE_EXPORT _CastToItkImage2Access(itkImageDTIF3*, itk::SmartPointer<itkImageDTIF3>&);
template void MITK_CORE_EXPORT _CastToItkImage2Access(itkImageDTID3*, itk::SmartPointer<itkImageDTID3>&);
#define CAST_HUNDRED_VECS(HUN) \
CAST_TEN_VECS(HUN) \
CAST_TEN_VECS(HUN+10) \
CAST_TEN_VECS(HUN+20) \
CAST_TEN_VECS(HUN+30) \
CAST_TEN_VECS(HUN+40) \
CAST_TEN_VECS(HUN+50) \
CAST_TEN_VECS(HUN+60) \
CAST_TEN_VECS(HUN+70) \
CAST_TEN_VECS(HUN+80) \
CAST_TEN_VECS(HUN+90) \
#define CAST_TEN_VECS(TEN) \
CAST_N_VEC(TEN+ 1) \
CAST_N_VEC(TEN+ 2) \
CAST_N_VEC(TEN+ 3) \
CAST_N_VEC(TEN+ 4) \
CAST_N_VEC(TEN+ 5) \
CAST_N_VEC(TEN+ 6) \
CAST_N_VEC(TEN+ 7) \
CAST_N_VEC(TEN+ 8) \
CAST_N_VEC(TEN+ 9) \
CAST_N_VEC(TEN+10) \
#define CAST_N_VEC(N_DIRS) \
_CAST_N_VEC(N_DIRS,double) \
_CAST_N_VEC(N_DIRS,float) \
_CAST_N_VEC(N_DIRS,short) \
#define _CAST_N_VEC(N_DIRS,PIXTYPE) \
template void MITK_CORE_EXPORT _CastToItkImage2Access(itk::Image<itk::Vector<PIXTYPE,N_DIRS>, 2> *, itk::SmartPointer<itk::Image<itk::Vector<PIXTYPE,N_DIRS>, 2> >&); \
template void MITK_CORE_EXPORT _CastToItkImage2Access(itk::Image<itk::Vector<PIXTYPE,N_DIRS>, 3> *, itk::SmartPointer<itk::Image<itk::Vector<PIXTYPE,N_DIRS>, 3> >&); \
// the following lines allow for fixed-size vector images up to a certain size limit
// (commented out for shorter compile times)
//CAST_HUNDRED_VECS(0)
//CAST_HUNDRED_VECS(100)
//CAST_HUNDRED_VECS(200)
//CAST_HUNDRED_VECS(300)
// allow for fixed-size vectors of specific length
// (inspired by itkPointshell.cpp, precompiled q-ball configs)
//CAST_TEN_VECS(0)
//CAST_N_VEC(11)
//CAST_N_VEC(12)
CAST_N_VEC(2)
CAST_N_VEC(3)
CAST_N_VEC(6)
CAST_N_VEC(42)
CAST_N_VEC(92)
CAST_N_VEC(162)
CAST_N_VEC(252)
CAST_N_VEC(362)
CAST_N_VEC(492)
CAST_N_VEC(642)
CAST_N_VEC(812)
CAST_N_VEC(1002)
}
diff --git a/Core/Code/Algorithms/mitkImageCastPart4.cpp b/Core/Code/Algorithms/mitkImageCastPart4.cpp
index 1c2a6b24c7..f8f7d22894 100644
--- a/Core/Code/Algorithms/mitkImageCastPart4.cpp
+++ b/Core/Code/Algorithms/mitkImageCastPart4.cpp
@@ -1,151 +1,155 @@
/*=========================================================================
Program: Medical Imaging & Interaction Toolkit
Language: C++
Date: $Date: 2008-12-05 10:31:44 +0100 (Fr, 05 Dez 2008) $
Version: $Revision: 15893 $
Copyright (c) German Cancer Research Center, Division of Medical and
Biological Informatics. All rights reserved.
See MITKCopyright.txt or http://www.mitk.org/copyright.html for details.
This software is distributed WITHOUT ANY WARRANTY; without even
the implied warranty of MERCHANTABILITY or FITNESS FOR A PARTICULAR
PURPOSE. See the above copyright notices for more information.
=========================================================================*/
#include <mitkImageCast.h>
+#include <mitkImageAccessByItk.h>
+
#include <itkImage.h>
#include <itkCastImageFilter.h>
+#include <itkDiffusionTensor3D.h>
+
namespace mitk
{
#ifndef DOXYGEN_SKIP
template <typename ItkOutputImageType> void CastToItkImage(const mitk::Image * mitkImage, itk::SmartPointer<ItkOutputImageType>& itkOutputImage)
{
AccessFixedDimensionByItk_1(mitkImage, _CastToItkImage2Access, ::itk::GetImageDimension<ItkOutputImageType>::ImageDimension, itkOutputImage);
}
#endif //DOXYGEN_SKIP
typedef itk::Image<itk::RGBPixel<unsigned char>, 2> itkImageRGBUC2;
typedef itk::Image<itk::DiffusionTensor3D<float>, 2> itkImageDTIF2;
typedef itk::Image<itk::DiffusionTensor3D<double>, 2> itkImageDTID2;
template <> void MITK_CORE_EXPORT CastToItkImage<itkImageRGBUC2>(const mitk::Image * mitkImage, itk::SmartPointer<itkImageRGBUC2>& itkOutputImage)
{
typedef itkImageRGBUC2 ItkOutputImageType;
- AccessFixedTypeByItk_1(mitkImage, _CastToItkImage2Access, itk::RGBPixel<unsigned char>, ::itk::GetImageDimension<ItkOutputImageType>::ImageDimension, itkOutputImage);
+ AccessFixedTypeByItk_1(mitkImage, _CastToItkImage2Access, (itk::RGBPixel<unsigned char>), (::itk::GetImageDimension<ItkOutputImageType>::ImageDimension), itkOutputImage);
}
template <> void MITK_CORE_EXPORT CastToItkImage<itkImageDTIF2>(const mitk::Image * mitkImage, itk::SmartPointer<itkImageDTIF2>& itkOutputImage)
{
typedef itkImageDTIF2 ItkOutputImageType;
- AccessFixedTypeByItk_1(mitkImage, _CastToItkImage2Access, itk::DiffusionTensor3D<float>, ::itk::GetImageDimension<ItkOutputImageType>::ImageDimension, itkOutputImage);
+ AccessFixedTypeByItk_1(mitkImage, _CastToItkImage2Access, (itk::DiffusionTensor3D<float>), (::itk::GetImageDimension<ItkOutputImageType>::ImageDimension), itkOutputImage);
}
template <> void MITK_CORE_EXPORT CastToItkImage<itkImageDTID2>(const mitk::Image * mitkImage, itk::SmartPointer<itkImageDTID2>& itkOutputImage)
{
typedef itkImageDTID2 ItkOutputImageType;
- AccessFixedTypeByItk_1(mitkImage, _CastToItkImage2Access, itk::DiffusionTensor3D<double>, ::itk::GetImageDimension<ItkOutputImageType>::ImageDimension, itkOutputImage);
+ AccessFixedTypeByItk_1(mitkImage, _CastToItkImage2Access, (itk::DiffusionTensor3D<double>), (::itk::GetImageDimension<ItkOutputImageType>::ImageDimension), itkOutputImage);
}
typedef itk::Image<itk::RGBPixel<unsigned char>, 3> itkImageRGBUC3;
typedef itk::Image<itk::DiffusionTensor3D<float>, 3> itkImageDTIF3;
typedef itk::Image<itk::DiffusionTensor3D<double>, 3> itkImageDTID3;
template <> void MITK_CORE_EXPORT CastToItkImage<itkImageRGBUC3>(const mitk::Image * mitkImage, itk::SmartPointer<itkImageRGBUC3>& itkOutputImage)
{
typedef itkImageRGBUC3 ItkOutputImageType;
- AccessFixedTypeByItk_1(mitkImage, _CastToItkImage2Access, itk::RGBPixel<unsigned char>, ::itk::GetImageDimension<ItkOutputImageType>::ImageDimension, itkOutputImage);
+ AccessFixedTypeByItk_1(mitkImage, _CastToItkImage2Access, (itk::RGBPixel<unsigned char>), (::itk::GetImageDimension<ItkOutputImageType>::ImageDimension), itkOutputImage);
}
template <> void MITK_CORE_EXPORT CastToItkImage<itkImageDTIF3>(const mitk::Image * mitkImage, itk::SmartPointer<itkImageDTIF3>& itkOutputImage)
{
typedef itkImageDTIF3 ItkOutputImageType;
- AccessFixedTypeByItk_1(mitkImage, _CastToItkImage2Access, itk::DiffusionTensor3D<float>, ::itk::GetImageDimension<ItkOutputImageType>::ImageDimension, itkOutputImage);
+ AccessFixedTypeByItk_1(mitkImage, _CastToItkImage2Access, (itk::DiffusionTensor3D<float>), (::itk::GetImageDimension<ItkOutputImageType>::ImageDimension), itkOutputImage);
}
template <> void MITK_CORE_EXPORT CastToItkImage<itkImageDTID3>(const mitk::Image * mitkImage, itk::SmartPointer<itkImageDTID3>& itkOutputImage)
{
typedef itkImageDTID3 ItkOutputImageType;
- AccessFixedTypeByItk_1(mitkImage, _CastToItkImage2Access, itk::DiffusionTensor3D<double>, ::itk::GetImageDimension<ItkOutputImageType>::ImageDimension, itkOutputImage);
+ AccessFixedTypeByItk_1(mitkImage, _CastToItkImage2Access, (itk::DiffusionTensor3D<double>), (::itk::GetImageDimension<ItkOutputImageType>::ImageDimension), itkOutputImage);
}
#define TYPE_VECS(HUN) \
TYPE_TEN_VECS(HUN) \
TYPE_TEN_VECS(HUN + 10) \
TYPE_TEN_VECS(HUN + 20) \
TYPE_TEN_VECS(HUN + 30) \
TYPE_TEN_VECS(HUN + 40) \
TYPE_TEN_VECS(HUN + 50) \
TYPE_TEN_VECS(HUN + 60) \
TYPE_TEN_VECS(HUN + 70) \
TYPE_TEN_VECS(HUN + 80) \
TYPE_TEN_VECS(HUN + 90) \
#define TYPE_TEN_VECS(HUN) \
TYPE_N_VEC(HUN + 1) \
TYPE_N_VEC(HUN + 2) \
TYPE_N_VEC(HUN + 3) \
TYPE_N_VEC(HUN + 4) \
TYPE_N_VEC(HUN + 5) \
TYPE_N_VEC(HUN + 6) \
TYPE_N_VEC(HUN + 7) \
TYPE_N_VEC(HUN + 8) \
TYPE_N_VEC(HUN + 9) \
TYPE_N_VEC(HUN + 10) \
#define TYPE_N_VEC(N_DIRS) \
_TYPE_N_VEC(N_DIRS,double) \
_TYPE_N_VEC(N_DIRS,float) \
_TYPE_N_VEC(N_DIRS,short) \
#define _TYPE_N_VEC(N_DIRS,PIXTYPE) \
template <> void MITK_CORE_EXPORT CastToItkImage<itk::Image<itk::Vector<PIXTYPE,N_DIRS>, 2> >(const mitk::Image * mitkImage, itk::SmartPointer<itk::Image<itk::Vector<PIXTYPE,N_DIRS>, 2> >& itkOutputImage) \
{ \
typedef itk::Vector<PIXTYPE,N_DIRS> VECTORTYPE; \
typedef itk::Image<VECTORTYPE, 2> ItkOutputImageType2; \
- AccessFixedTypeByItk_1(mitkImage, _CastToItkImage2Access, VECTORTYPE, ::itk::GetImageDimension<ItkOutputImageType2>::ImageDimension, itkOutputImage); \
+ AccessFixedTypeByItk_1(mitkImage, _CastToItkImage2Access, (VECTORTYPE), (::itk::GetImageDimension<ItkOutputImageType2>::ImageDimension), itkOutputImage); \
} \
template <> void MITK_CORE_EXPORT CastToItkImage<itk::Image<itk::Vector<PIXTYPE,N_DIRS>, 3> >(const mitk::Image * mitkImage, itk::SmartPointer<itk::Image<itk::Vector<PIXTYPE,N_DIRS>, 3> >& itkOutputImage) \
{ \
typedef itk::Vector<PIXTYPE,N_DIRS> VECTORTYPE; \
typedef itk::Image<VECTORTYPE, 3> ItkOutputImageType3; \
- AccessFixedTypeByItk_1(mitkImage, _CastToItkImage2Access, VECTORTYPE, ::itk::GetImageDimension<ItkOutputImageType3>::ImageDimension, itkOutputImage); \
+ AccessFixedTypeByItk_1(mitkImage, _CastToItkImage2Access, (VECTORTYPE), (::itk::GetImageDimension<ItkOutputImageType3>::ImageDimension), itkOutputImage); \
} \
// the following lines allow for fixed-size vector images up to a certain size limit
// (commented out for shorter compile times)
//TYPE_VECS(000)
//TYPE_VECS(100)
//TYPE_VECS(200)
//TYPE_VECS(300)
//TYPE_VECS(400)
//TYPE_VECS(500)
//TYPE_VECS(600)
//TYPE_VECS(700)
// allow for fixed-size vectors of specific length
// (inspired by itkPointshell.cpp, precompiled q-ball configs)
//TYPE_TEN_VECS(0)
//TYPE_N_VEC(11)
//TYPE_N_VEC(12)
TYPE_N_VEC(2)
TYPE_N_VEC(3)
TYPE_N_VEC(6)
TYPE_N_VEC(42)
TYPE_N_VEC(92)
TYPE_N_VEC(162)
TYPE_N_VEC(252)
TYPE_N_VEC(362)
TYPE_N_VEC(492)
TYPE_N_VEC(642)
TYPE_N_VEC(812)
TYPE_N_VEC(1002)
#ifndef DOXYGEN_SKIP
#endif //DOXYGEN_SKIP
}
diff --git a/Core/Code/Algorithms/mitkImageCaster.cpp b/Core/Code/Algorithms/mitkImageCaster.cpp
index 80d8ca657a..934c01e6e9 100644
--- a/Core/Code/Algorithms/mitkImageCaster.cpp
+++ b/Core/Code/Algorithms/mitkImageCaster.cpp
@@ -1,149 +1,59 @@
/*=========================================================================
Program: Medical Imaging & Interaction Toolkit
Language: C++
Date: $Date: 2010-06-18 20:12:43 +0200 (Fr, 18 Jun 2010) $
Version: $Revision: 23881 $
Copyright (c) German Cancer Research Center, Division of Medical and
Biological Informatics. All rights reserved.
See MITKCopyright.txt or http://www.mitk.org/copyright.html for details.
This software is distributed WITHOUT ANY WARRANTY; without even
the implied warranty of MERCHANTABILITY or FITNESS FOR A PARTICULAR
PURPOSE. See the above copyright notices for more information.
=========================================================================*/
#include "mitkImageCaster.h"
#include "mitkImageAccessByItk.h"
+
vtkRenderer* mitk::RendererAccess::m_3DRenderer = 0;
void mitk::RendererAccess::Set3DRenderer(vtkRenderer* renwin4)
{
m_3DRenderer = renwin4;
}
vtkRenderer* mitk::RendererAccess::Get3DRenderer()
{
return m_3DRenderer;
}
-// shorts 2d
-void mitk::ImageCaster::CastToItkImage(const mitk::Image * mitkImage, itk::SmartPointer<itk::Image<signed short, 2> > & itkOutputImage){
- mitk::CastToItkImage<itk::Image<signed short, 2> >(mitkImage, itkOutputImage);
-}
-
-void mitk::ImageCaster::CastToMitkImage(const itk::Image<signed short, 2>* itkimage, itk::SmartPointer<mitk::Image>& mitkoutputimage){
- mitk::CastToMitkImage<itk::Image<signed short, 2> >(itkimage, mitkoutputimage);
-}
-
-void mitk::ImageCaster::CastToItkImage(const mitk::Image * mitkImage, itk::SmartPointer<itk::Image<unsigned short, 2> > & itkOutputImage){
- mitk::CastToItkImage<itk::Image<unsigned short, 2> >(mitkImage, itkOutputImage);
-}
-
-void mitk::ImageCaster::CastToMitkImage(const itk::Image<unsigned short, 2>* itkimage, itk::SmartPointer<mitk::Image>& mitkoutputimage){
- mitk::CastToMitkImage<itk::Image<unsigned short, 2> >(itkimage, mitkoutputimage);
-}
-// shorts 3d
-void mitk::ImageCaster::CastToItkImage(const mitk::Image * mitkImage, itk::SmartPointer<itk::Image<signed short, 3> > & itkOutputImage){
- mitk::CastToItkImage<itk::Image<signed short, 3> >(mitkImage, itkOutputImage);
-}
-
-void mitk::ImageCaster::CastToMitkImage(const itk::Image<signed short, 3>* itkimage, itk::SmartPointer<mitk::Image>& mitkoutputimage){
- mitk::CastToMitkImage<itk::Image<signed short, 3> >(itkimage, mitkoutputimage);
-}
-
-void mitk::ImageCaster::CastToItkImage(const mitk::Image * mitkImage, itk::SmartPointer<itk::Image<unsigned short, 3> > & itkOutputImage){
- mitk::CastToItkImage<itk::Image<unsigned short, 3> >(mitkImage, itkOutputImage);
-}
-
-void mitk::ImageCaster::CastToMitkImage(const itk::Image<unsigned short, 3>* itkimage, itk::SmartPointer<mitk::Image>& mitkoutputimage){
- mitk::CastToMitkImage<itk::Image<unsigned short, 3> >(itkimage, mitkoutputimage);
-}
-
-// char 2d
-void mitk::ImageCaster::CastToItkImage(const mitk::Image * mitkImage, itk::SmartPointer<itk::Image<char, 2> > & itkOutputImage){
- mitk::CastToItkImage<itk::Image<char, 2> >(mitkImage, itkOutputImage);
-}
-
-void mitk::ImageCaster::CastToMitkImage(const itk::Image<char, 2>* itkimage, itk::SmartPointer<mitk::Image>& mitkoutputimage){
- mitk::CastToMitkImage<itk::Image<char, 2> >(itkimage, mitkoutputimage);
-}
-
-void mitk::ImageCaster::CastToItkImage(const mitk::Image * mitkImage, itk::SmartPointer<itk::Image<unsigned char, 2> > & itkOutputImage){
- mitk::CastToItkImage<itk::Image<unsigned char, 2> >(mitkImage, itkOutputImage);
-}
-
-void mitk::ImageCaster::CastToMitkImage(const itk::Image<unsigned char, 2>* itkimage, itk::SmartPointer<mitk::Image>& mitkoutputimage){
- mitk::CastToMitkImage<itk::Image<unsigned char, 2> >(itkimage, mitkoutputimage);
-}
-
-// char 3d
-void mitk::ImageCaster::CastToItkImage(const mitk::Image * mitkImage, itk::SmartPointer<itk::Image<char, 3> > & itkOutputImage){
- mitk::CastToItkImage<itk::Image<char, 3> >(mitkImage, itkOutputImage);
-}
-
-void mitk::ImageCaster::CastToMitkImage(const itk::Image<char, 3>* itkimage, itk::SmartPointer<mitk::Image>& mitkoutputimage){
- mitk::CastToMitkImage<itk::Image<char, 3> >(itkimage, mitkoutputimage);
-}
-
-void mitk::ImageCaster::CastToItkImage(const mitk::Image * mitkImage, itk::SmartPointer<itk::Image<unsigned char, 3> > & itkOutputImage){
- mitk::CastToItkImage<itk::Image<unsigned char, 3> >(mitkImage, itkOutputImage);
-}
-
-void mitk::ImageCaster::CastToMitkImage(const itk::Image<unsigned char, 3>* itkimage, itk::SmartPointer<mitk::Image>& mitkoutputimage){
- mitk::CastToMitkImage<itk::Image<unsigned char, 3> >(itkimage, mitkoutputimage);
-}
-
-// int
-void mitk::ImageCaster::CastToItkImage(const mitk::Image * mitkImage, itk::SmartPointer<itk::Image<signed int, 3> > & itkOutputImage){
- mitk::CastToItkImage<itk::Image<signed int, 3> >(mitkImage, itkOutputImage);
-}
-
-void mitk::ImageCaster::CastToMitkImage(const itk::Image<signed int, 3>* itkimage, itk::SmartPointer<mitk::Image>& mitkoutputimage){
- mitk::CastToMitkImage<itk::Image<signed int, 3> >(itkimage, mitkoutputimage);
-}
-
-void mitk::ImageCaster::CastToItkImage(const mitk::Image * mitkImage, itk::SmartPointer<itk::Image<unsigned int, 3> > & itkOutputImage){
- mitk::CastToItkImage<itk::Image<unsigned int, 3> >(mitkImage, itkOutputImage);
-}
-
-void mitk::ImageCaster::CastToMitkImage(const itk::Image<unsigned int, 3>* itkimage, itk::SmartPointer<mitk::Image>& mitkoutputimage){
- mitk::CastToMitkImage<itk::Image<unsigned int, 3> >(itkimage, mitkoutputimage);
-}
-
-// float
-void mitk::ImageCaster::CastToItkImage(const mitk::Image * mitkImage, itk::SmartPointer<itk::Image<float, 3> > & itkOutputImage){
- mitk::CastToItkImage<itk::Image<float, 3> >(mitkImage, itkOutputImage);
-}
-
-void mitk::ImageCaster::CastToMitkImage(const itk::Image<float, 3>* itkimage, itk::SmartPointer<mitk::Image>& mitkoutputimage){
- mitk::CastToMitkImage<itk::Image<float, 3> >(itkimage, mitkoutputimage);
-}
-
-// int
-void mitk::ImageCaster::CastToItkImage(const mitk::Image * mitkImage, itk::SmartPointer<itk::Image<double, 3> > & itkOutputImage){
- mitk::CastToItkImage<itk::Image<double, 3> >(mitkImage, itkOutputImage);
-}
-
-void mitk::ImageCaster::CastToMitkImage(const itk::Image<double, 3>* itkimage, itk::SmartPointer<mitk::Image>& mitkoutputimage){
- mitk::CastToMitkImage<itk::Image<double, 3> >(itkimage, mitkoutputimage);
-}
-
void mitk::ImageCaster::CastBaseData(mitk::BaseData* const mitkBaseData, itk::SmartPointer<mitk::Image>& mitkoutputimage){
try
{
mitkoutputimage = dynamic_cast<mitk::Image*>(mitkBaseData);
}
catch(...)
{
return;
}
}
void mitk::Caster::Cast(mitk::BaseData* mitkBaseData, mitk::Surface* surface){
surface = dynamic_cast<mitk::Surface*>(mitkBaseData);
}
+
+#define DefineMitkImageCasterMethods(r, data, type) \
+ void mitk::ImageCaster::CastToItkImage(const mitk::Image* mitkImage, itk::SmartPointer<itk::Image<MITK_PP_TUPLE_REM(2)type> >& itkOutputImage) { \
+ mitk::CastToItkImage<itk::Image<MITK_PP_TUPLE_REM(2)type> >(mitkImage, itkOutputImage); \
+ } \
+ void mitk::ImageCaster::CastToMitkImage(const itk::Image<MITK_PP_TUPLE_REM(2)type>* itkImage, itk::SmartPointer<mitk::Image>& mitkOutputImage) { \
+ mitk::CastToMitkImage<itk::Image<MITK_PP_TUPLE_REM(2)type> >(itkImage, mitkOutputImage); \
+ }
+
+MITK_PP_SEQ_FOR_EACH(DefineMitkImageCasterMethods, _, MITK_ACCESSBYITK_TYPES_DIMN_SEQ(2))
+MITK_PP_SEQ_FOR_EACH(DefineMitkImageCasterMethods, _, MITK_ACCESSBYITK_TYPES_DIMN_SEQ(3))
diff --git a/Core/Code/Algorithms/mitkImageCaster.h b/Core/Code/Algorithms/mitkImageCaster.h
index 237f6586d1..dd0c5ed8c8 100644
--- a/Core/Code/Algorithms/mitkImageCaster.h
+++ b/Core/Code/Algorithms/mitkImageCaster.h
@@ -1,88 +1,67 @@
/*=========================================================================
Program: Medical Imaging & Interaction Toolkit
Language: C++
Date: $Date: 2009-05-12 19:56:03 +0200 (Di, 12 Mai 2009) $
Version: $Revision: 17179 $
Copyright (c) German Cancer Research Center, Division of Medical and
Biological Informatics. All rights reserved.
See MITKCopyright.txt or http://www.mitk.org/copyright.html for details.
This software is distributed WITHOUT ANY WARRANTY; without even
the implied warranty of MERCHANTABILITY or FITNESS FOR A PARTICULAR
PURPOSE. See the above copyright notices for more information.
=========================================================================*/
+#ifndef MITKIMAGECASTER_H
+#define MITKIMAGECASTER_H
+
#include <mitkImageCast.h>
#include <itkImage.h>
#include <itkCastImageFilter.h>
#include <vtkRenderWindow.h>
#include <mitkSurface.h>
+#include <mitkPPSeqForEach.h>
+
+#define DeclareMitkImageCasterMethods(r, data, type) \
+ static void CastToItkImage(const mitk::Image*, itk::SmartPointer<itk::Image<MITK_PP_TUPLE_REM(2)type> >&); \
+ static void CastToMitkImage(const itk::Image<MITK_PP_TUPLE_REM(2)type>*, itk::SmartPointer<mitk::Image>&);
+
namespace mitk
{
///
/// \brief This class is just a proxy for global functions which are needed by the
/// python wrapping process since global functions cannnot be wrapped. Static method
/// can be wrapped though.
///
class MITK_CORE_EXPORT ImageCaster
{
public:
- // short
- static void CastToItkImage(const mitk::Image*, itk::SmartPointer<itk::Image<short, 2> >&);
- static void CastToMitkImage(const itk::Image<short, 2>*, itk::SmartPointer<mitk::Image>&);
- static void CastToItkImage(const mitk::Image*, itk::SmartPointer<itk::Image<short, 3> >&);
- static void CastToMitkImage(const itk::Image<short, 3>*, itk::SmartPointer<mitk::Image>&);
-
- // unsigned short
- static void CastToItkImage(const mitk::Image*, itk::SmartPointer<itk::Image<unsigned short, 2> >&);
- static void CastToMitkImage(const itk::Image<unsigned short, 2>*, itk::SmartPointer<mitk::Image>&);
- static void CastToItkImage(const mitk::Image*, itk::SmartPointer<itk::Image<unsigned short, 3> >&);
- static void CastToMitkImage(const itk::Image<unsigned short, 3>*, itk::SmartPointer<mitk::Image>&);
-
- // char
- static void CastToItkImage(const mitk::Image*, itk::SmartPointer<itk::Image<char, 2> >&);
- static void CastToMitkImage(const itk::Image<char, 2>*, itk::SmartPointer<mitk::Image>&);
- static void CastToItkImage(const mitk::Image*, itk::SmartPointer<itk::Image<char, 3> >&);
- static void CastToMitkImage(const itk::Image<char, 3>*, itk::SmartPointer<mitk::Image>&);
- // unsigned char
- static void CastToItkImage(const mitk::Image*, itk::SmartPointer<itk::Image<unsigned char, 2> >&);
- static void CastToMitkImage(const itk::Image<unsigned char, 2>*, itk::SmartPointer<mitk::Image>&);
- static void CastToItkImage(const mitk::Image*, itk::SmartPointer<itk::Image<unsigned char, 3> >&);
- static void CastToMitkImage(const itk::Image<unsigned char, 3>*, itk::SmartPointer<mitk::Image>&);
+ MITK_PP_SEQ_FOR_EACH(DeclareMitkImageCasterMethods, _, MITK_ACCESSBYITK_TYPES_DIMN_SEQ(2))
+ MITK_PP_SEQ_FOR_EACH(DeclareMitkImageCasterMethods, _, MITK_ACCESSBYITK_TYPES_DIMN_SEQ(3))
- static void CastToItkImage(const mitk::Image*, itk::SmartPointer<itk::Image<int, 3> >&);
- static void CastToMitkImage(const itk::Image<int, 3>*, itk::SmartPointer<mitk::Image>&);
-
- static void CastToItkImage(const mitk::Image*, itk::SmartPointer<itk::Image<unsigned int, 3> >&);
- static void CastToMitkImage(const itk::Image<unsigned int, 3>*, itk::SmartPointer<mitk::Image>&);
-
- static void CastToItkImage(const mitk::Image*, itk::SmartPointer<itk::Image<float, 3> >&);
- static void CastToMitkImage(const itk::Image<float, 3>*, itk::SmartPointer<mitk::Image>&);
-
- static void CastToItkImage(const mitk::Image*, itk::SmartPointer<itk::Image<double, 3> >&);
- static void CastToMitkImage(const itk::Image<double, 3>*, itk::SmartPointer<mitk::Image>&);
-
- static void CastBaseData(mitk::BaseData* const, itk::SmartPointer<mitk::Image>&);
+ static void CastBaseData(mitk::BaseData* const, itk::SmartPointer<mitk::Image>&);
};
class MITK_CORE_EXPORT Caster
{
public:
static void Cast(BaseData* dat, Surface* surface);
};
class MITK_CORE_EXPORT RendererAccess
{
public:
static void Set3DRenderer(vtkRenderer* renderer);
static vtkRenderer* Get3DRenderer();
protected:
static vtkRenderer* m_3DRenderer;
};
}
+
+#endif // MITKIMAGECASTER_H
diff --git a/Core/Code/Algorithms/mitkImageToItk.h b/Core/Code/Algorithms/mitkImageToItk.h
index 0d15616f82..66a8e876c8 100644
--- a/Core/Code/Algorithms/mitkImageToItk.h
+++ b/Core/Code/Algorithms/mitkImageToItk.h
@@ -1,119 +1,119 @@
/*=========================================================================
Program: Medical Imaging & Interaction Toolkit
Language: C++
Date: $Date$
Version: $Revision$
Copyright (c) German Cancer Research Center, Division of Medical and
Biological Informatics. All rights reserved.
See MITKCopyright.txt or http://www.mitk.org/copyright.html for details.
This software is distributed WITHOUT ANY WARRANTY; without even
the implied warranty of MERCHANTABILITY or FITNESS FOR A PARTICULAR
PURPOSE. See the above copyright notices for more information.
=========================================================================*/
#ifndef IMAGETOITK_H_HEADER_INCLUDED_C1C2FCD2
#define IMAGETOITK_H_HEADER_INCLUDED_C1C2FCD2
#if(_MSC_VER==1200)
#include <itkFixedCenterOfRotationAffineTransform.h>
#endif
#include <itkImage.h>
#include <itkImageSource.h>
#include "mitkImage.h"
#include "mitkImageDataItem.h"
namespace mitk
{
/**
* Create itk::ImageSource for mitk::Image
* \ingroup Adaptor
*
* \warning 2D MITK images will get a 2D identity matrix in ITK
* \todo Get clear about how to handle directed ITK 2D images in ITK
*/
template <class TOutputImage>
-class ITK_EXPORT ImageToItk : public itk::ImageSource< TOutputImage >
+class ImageToItk : public itk::ImageSource< TOutputImage >
{
protected:
mitk::Image::Pointer m_MitkImage;
mitk::ImageDataItem::Pointer m_ImageDataItem;
public:
typedef ImageToItk Self;
typedef itk::ImageSource<TOutputImage> Superclass;
typedef itk::SmartPointer<Self> Pointer;
typedef itk::SmartPointer<const Self> ConstPointer;
/** Method for creation through the object factory. */
itkNewMacro(Self);
/** Superclass typedefs. */
typedef typename Superclass::OutputImageRegionType OutputImageRegionType;
/** Some convenient typedefs. */
typedef mitk::Image InputImageType;
typedef InputImageType::Pointer InputImagePointer;
typedef InputImageType::ConstPointer InputImageConstPointer;
typedef SlicedData::RegionType InputImageRegionType;
typedef typename TOutputImage::SizeType SizeType;
typedef typename TOutputImage::IndexType IndexType;
typedef typename TOutputImage::RegionType RegionType;
typedef typename TOutputImage::PixelType PixelType;
const mitk::Image * GetInput(void);
const mitk::Image * GetInput(unsigned int idx);
virtual void SetInput(const mitk::Image *input);
virtual void SetInput(unsigned int index, const mitk::Image * image);
virtual void UpdateOutputInformation();
itkGetMacro( Channel, int );
itkSetMacro( Channel, int );
itkSetMacro( CopyMemFlag, bool );
itkGetMacro( CopyMemFlag, bool );
itkBooleanMacro( CopyMemFlag );
protected:
ImageToItk(): m_CopyMemFlag(false), m_Channel(0)
{
}
virtual ~ImageToItk()
{
}
void PrintSelf(std::ostream& os, itk::Indent indent) const;
virtual void GenerateData();
virtual void GenerateOutputInformation();
private:
bool m_CopyMemFlag;
int m_Channel;
//ImageToItk(const Self&); //purposely not implemented
void operator=(const Self&); //purposely not implemented
};
} // end namespace mitk
#ifndef ITK_MANUAL_INSTANTIATION
#include "mitkImageToItk.txx"
#endif
#endif // IMAGETOITK_H_HEADER_INCLUDED_C1C2FCD2
diff --git a/Core/Code/Algorithms/mitkImageToItk.txx b/Core/Code/Algorithms/mitkImageToItk.txx
index 5c5b9f0503..d35d7314a6 100644
--- a/Core/Code/Algorithms/mitkImageToItk.txx
+++ b/Core/Code/Algorithms/mitkImageToItk.txx
@@ -1,232 +1,231 @@
/*=========================================================================
Program: Medical Imaging & Interaction Toolkit
Module: $RCSfile$
Language: C++
Date: $Date$
Version: $Revision$
Copyright (c) German Cancer Research Center, Division of Medical and
Biological Informatics. All rights reserved.
See MITKCopyright.txt or http://www.mitk.org/ for details.
This software is distributed WITHOUT ANY WARRANTY; without even
the implied warranty of MERCHANTABILITY or FITNESS FOR A PARTICULAR
PURPOSE. See the above copyright notices for more information.
=========================================================================*/
#ifndef IMAGETOITK_TXX_INCLUDED_C1C2FCD2
#define IMAGETOITK_TXX_INCLUDED_C1C2FCD2
#include "mitkImageToItk.h"
#include "mitkBaseProcess.h"
#include "itkImportMitkImageContainer.h"
-#include <itkSmartPointerForwardReference.txx>
template <class TOutputImage>
void mitk::ImageToItk<TOutputImage>::SetInput(const mitk::Image *input)
{
if(input == NULL)
itkExceptionMacro( << "image is null" );
if(input->GetDimension()!=TOutputImage::GetImageDimension())
itkExceptionMacro( << "image has dimension " << input->GetDimension() << " instead of " << TOutputImage::GetImageDimension() );
if(!(input->GetPixelType() == typeid(PixelType)))
itkExceptionMacro( << "image has wrong pixel type " );
// Process object is not const-correct so the const_cast is required here
itk::ProcessObject::SetNthInput(0,
const_cast< mitk::Image * >( input ) );
}
template<class TOutputImage>
void mitk::ImageToItk<TOutputImage>::SetInput( unsigned int index, const mitk::Image * input )
{
if( index+1 > this->GetNumberOfInputs() )
{
this->SetNumberOfRequiredInputs( index + 1 );
}
if(input == NULL)
itkExceptionMacro( << "image is null" );
if(input->GetDimension()!=TOutputImage::GetImageDimension())
itkExceptionMacro( << "image has dimension " << input->GetDimension() << " instead of " << TOutputImage::GetImageDimension() );
if(!(input->GetPixelType() == typeid(PixelType)))
itkExceptionMacro( << "image has wrong pixel type " );
// Process object is not const-correct so the const_cast is required here
itk::ProcessObject::SetNthInput(index,
const_cast< mitk::Image *>( input ) );
}
template<class TOutputImage>
const mitk::Image *mitk::ImageToItk<TOutputImage>::GetInput(void)
{
if (this->GetNumberOfInputs() < 1)
{
return 0;
}
return static_cast< const mitk::Image * >
(itk::ProcessObject::GetInput(0) );
}
template<class TOutputImage>
const mitk::Image *mitk::ImageToItk<TOutputImage>::GetInput(unsigned int idx)
{
return static_cast< mitk::Image * >
(itk::ProcessObject::GetInput(idx));
}
template<class TOutputImage>
void mitk::ImageToItk<TOutputImage>
::GenerateData()
{
// Allocate output
mitk::Image::ConstPointer input = this->GetInput();
typename Superclass::OutputImageType::Pointer output = this->GetOutput();
unsigned long noBytes = input->GetDimension(0);
for (unsigned int i=1; i<TOutputImage::GetImageDimension(); ++i)
{
noBytes = noBytes * input->GetDimension(i);
}
// hier wird momentan wohl nur der erste Channel verwendet??!!
m_ImageDataItem = const_cast<mitk::Image*>(input.GetPointer())->GetChannelData( m_Channel );
if(m_ImageDataItem.GetPointer() == NULL)
{
itkWarningMacro(<< "no image data to import in ITK image");
RegionType bufferedRegion;
output->SetBufferedRegion(bufferedRegion);
return;
}
if (m_CopyMemFlag)
{
itkDebugMacro("copyMem ...");
output->Allocate();
memcpy( (PixelType *) output->GetBufferPointer(), m_ImageDataItem->GetData(), sizeof(PixelType)*noBytes);
}
else
{
itkDebugMacro("do not copyMem ...");
typedef itk::ImportMitkImageContainer< unsigned long, PixelType > ImportContainerType;
typename ImportContainerType::Pointer import;
import = ImportContainerType::New();
import->Initialize();
itkDebugMacro( << "size of container = " << import->Size() );
import->SetImageDataItem(m_ImageDataItem);
output->SetPixelContainer(import);
itkDebugMacro( << "size of container = " << import->Size() );
}
}
template<class TOutputImage>
void mitk::ImageToItk<TOutputImage>
::UpdateOutputInformation()
{
mitk::Image::ConstPointer input = this->GetInput();
if(input.IsNotNull() && (input->GetSource()!=NULL) && input->GetSource()->Updating())
{
typename Superclass::OutputImageType::Pointer output = this->GetOutput();
unsigned long t1 = input->GetUpdateMTime()+1;
if (t1 > this->m_OutputInformationMTime.GetMTime())
{
output->SetPipelineMTime(t1);
this->GenerateOutputInformation();
this->m_OutputInformationMTime.Modified();
}
return;
}
Superclass::UpdateOutputInformation();
}
template<class TOutputImage>
void mitk::ImageToItk<TOutputImage>
::GenerateOutputInformation()
{
mitk::Image::ConstPointer input = this->GetInput();
typename Superclass::OutputImageType::Pointer output = this->GetOutput();
// allocate size, origin, spacing, direction in types of output image
SizeType size;
const unsigned int itkDimMin3 = (TOutputImage::ImageDimension > 3 ? TOutputImage::ImageDimension : 3);
const unsigned int itkDimMax3 = (TOutputImage::ImageDimension < 3 ? TOutputImage::ImageDimension : 3);
typename Superclass::OutputImageType::PointType::ValueType origin[ itkDimMin3 ];
typename Superclass::OutputImageType::SpacingType::ComponentType spacing[ itkDimMin3 ];
typename Superclass::OutputImageType::DirectionType direction;
// copy as much information as possible into size and spacing
unsigned int i;
for ( i=0; i < itkDimMax3; ++i)
{
size[i] = input->GetDimension(i);
spacing[i] = input->GetGeometry()->GetSpacing()[i];
}
for ( ; i < TOutputImage::ImageDimension; ++i)
{
origin[i] = 0.0;
size[i] = input->GetDimension(i);
spacing[i] = 1.0;
}
// build region from size
IndexType start;
start.Fill( 0 );
RegionType region;
region.SetIndex( start );
region.SetSize( size );
// copy as much information as possible into origin
const mitk::Point3D& mitkorigin = input->GetGeometry()->GetOrigin();
itk2vtk(mitkorigin, origin);
// copy as much information as possible into direction
direction.SetIdentity();
unsigned int j;
const AffineTransform3D::MatrixType& matrix = input->GetGeometry()->GetIndexToWorldTransform()->GetMatrix();
/// \warning 2D MITK images will get a 2D identity matrix in ITK
/// \todo Get clear about how to handle directed ITK 2D images in ITK
// the following loop devides by spacing now to normalize columns.
// counterpart of InitializeByItk in mitkImage.h line 372 of revision 15092.
if ( itkDimMax3 >= 3)
{
for ( i=0; i < itkDimMax3; ++i)
for( j=0; j < itkDimMax3; ++j )
direction[i][j] = matrix[i][j]/spacing[j];
}
// set information into output image
output->SetRegions( region );
output->SetOrigin( origin );
output->SetSpacing( spacing );
output->SetDirection( direction );
}
template<class TOutputImage>
void
mitk::ImageToItk<TOutputImage>
::PrintSelf(std::ostream& os, itk::Indent indent) const
{
Superclass::PrintSelf(os,indent);
}
#endif //IMAGETOITK_TXX_INCLUDED_C1C2FCD2
diff --git a/Core/Code/Algorithms/mitkInstantiateAccessFunctions.h b/Core/Code/Algorithms/mitkInstantiateAccessFunctions.h
index 2229a5cbea..93b92827b1 100644
--- a/Core/Code/Algorithms/mitkInstantiateAccessFunctions.h
+++ b/Core/Code/Algorithms/mitkInstantiateAccessFunctions.h
@@ -1,211 +1,158 @@
/*=========================================================================
Program: Medical Imaging & Interaction Toolkit
Language: C++
Date: $Date$
Version: $Revision$
Copyright (c) German Cancer Research Center, Division of Medical and
Biological Informatics. All rights reserved.
See MITKCopyright.txt or http://www.mitk.org/copyright.html for details.
This software is distributed WITHOUT ANY WARRANTY; without even
the implied warranty of MERCHANTABILITY or FITNESS FOR A PARTICULAR
PURPOSE. See the above copyright notices for more information.
=========================================================================*/
#ifndef MITKINSTANTIATEACCESSFUNCTIONS_H_HEADER_INCLUDED
#define MITKINSTANTIATEACCESSFUNCTIONS_H_HEADER_INCLUDED
#include <itkCastImageFilter.h>
#include <mitkImageToItk.h>
+#include <mitkConfig.h>
+
+#include <mitkPPSeqForEach.h>
+#include <mitkPPSeqForEachProduct.h>
+#include <mitkPPSeqToTuple.h>
+#include <mitkPPCat.h>
+#include <mitkPPExpand.h>
+#include <mitkPPTupleRem.h>
+
+#ifndef DOXYGEN_SKIP
+
+#define InstantiateAccessFunctionImpl(r, itkImgFunc, type) \
+ MITK_PP_CAT(InstantiateAccessFunction_, itkImgFunc) type
+
+// product is of the form (itkImgFunc)(short)(2)
+#ifdef _MSC_VER
+#define InstantiateAccessFunctionProductImpl(r, product) \
+ MITK_PP_CAT(InstantiateAccessFunction_, MITK_PP_SEQ_HEAD(product)) \
+ MITK_PP_EXPAND(MITK_PP_SEQ_TO_TUPLE(MITK_PP_SEQ_TAIL(product)))
+#else
+#define InstantiateAccessFunctionProductImpl(r, product) \
+ MITK_PP_EXPAND(MITK_PP_CAT(InstantiateAccessFunction_, MITK_PP_SEQ_HEAD(product)) \
+ MITK_PP_SEQ_TO_TUPLE(MITK_PP_SEQ_TAIL(product)))
+#endif
+
+#endif // DOXYGEN_SKIP
-// File created using Visual Studio by replacing regular expression
-// itkImgFunc\(itk\:\:Image\<(.*),(.*)\>
-// with
-// itkImgFunc<\1, \2>(itk::Image<\1,\2>
-// from mitkAltInstantiateAccessFunction.h
//--------------------------------- instantiation functions ------------------------------
-//##Documentation
-//## @brief Instantiate access function without additional parammeters
-//## for all datatypes and dimensions
-//##
-//## Use this macro once after the definition of your access function.
-//## Some compilers have memory problems without the explicit instantiation.
-//## You may need to move the access function to a separate file. The CMake macro
-//## MITK_MULTIPLEX_PICTYPE can help you with that. See \c mitk/CMake/mitkMacroMultiplexPicType.cmake
-//## for documentation.
-//##
-//## \note If you experience compiler errors, try to
-//## include mitkAltInstantiateAccessFunctions.h and
-//## add "Alt" (for alternate) before the call
-//## (e.g. AltInstantiateAccessFunction(...)).
-//## \sa InstantiateAccessFunction_1
-//## \sa InstantiateAccessFunction_2
-//## @ingroup Adaptor
-#define InstantiateAccessFunction(itkImgFunc) \
- InstantiateAccessFunctionForFixedDimension(itkImgFunc, 2) \
- InstantiateAccessFunctionForFixedDimension(itkImgFunc, 3)
-
-//##Documentation
-//## @brief Instantiate access function with one additional parammeter
-//## for all datatypes and dimensions
-//##
-//## Use this macro once after the definition of your access function.
-//## Some compilers have memory problems without the explicit instantiation.
-//## You may need to move the access function to a separate file.
-//## \note If you experience compiler errors, try to
-//## include mitkAltInstantiateAccessFunctions.h and
-//## add "Alt" (for alternate) before the call
-//## (e.g. AltInstantiateAccessFunction(...)).
-//## \sa InstantiateAccessFunction
-//## \sa InstantiateAccessFunction_2
-//## @ingroup Adaptor
-#define InstantiateAccessFunction_1(itkImgFunc, param1Type) \
- InstantiateAccessFunctionForFixedDimension_1(itkImgFunc, 2, param1Type) \
- InstantiateAccessFunctionForFixedDimension_1(itkImgFunc, 3, param1Type)
-
-//##Documentation
-//## @brief Instantiate access function with two additional parammeters
-//## for all datatypes and dimensions
-//##
-//## Use this macro once after the definition of your access function.
-//## Some compilers have memory problems without the explicit instantiation.
-//## You may need to move the access function to a separate file.
-//## \sa InstantiateAccessFunction
-//## \sa InstantiateAccessFunction_1
-//## @ingroup Adaptor
-#define InstantiateAccessFunction_2(itkImgFunc, param1Type, param2Type) \
- InstantiateAccessFunctionForFixedDimension_2(itkImgFunc, 2, param1Type, param2Type) \
- InstantiateAccessFunctionForFixedDimension_2(itkImgFunc, 3, param1Type, param2Type)
-
-//##Documentation
-//## @brief Instantiate access function without additional parammeters
-//## for all datatypes, but fixed dimension
-//##
-//## Use this macro once after the definition of your access function.
-//## Some compilers have memory problems without the explicit instantiation.
-//## You may need to move the access function to a separate file.
-//## \note If you experience compiler errors, try to
-//## include mitkAltInstantiateAccessFunctions.h and
-//## add "Alt" (for alternate) before the call
-//## (e.g. AltInstantiateAccessFunction(...)).
-//## \sa InstantiateAccessFunctionForFixedDimension_1
-//## \sa InstantiateAccessFunctionForFixedDimension_2
-//## @ingroup Adaptor
-#define InstantiateAccessFunctionForFixedDimension(itkImgFunc, dimension) \
-template void itkImgFunc<double, dimension>(itk::Image<double, dimension>*); \
-template void itkImgFunc<float, dimension>(itk::Image<float, dimension>*); \
-template void itkImgFunc<int, dimension>(itk::Image<int, dimension>*); \
-template void itkImgFunc<unsigned int, dimension>(itk::Image<unsigned int, dimension>*); \
-template void itkImgFunc<short, dimension>(itk::Image<short, dimension>*); \
-template void itkImgFunc<unsigned short, dimension>(itk::Image<unsigned short, dimension>*); \
-template void itkImgFunc<char, dimension>(itk::Image<char, dimension>*); \
-template void itkImgFunc<unsigned char, dimension>(itk::Image<unsigned char, dimension>*);
-
-//##Documentation
-//## @brief Instantiate access function with one additional parammeter
-//## for all datatypes, but fixed dimension
-//##
-//## Use this macro once after the definition of your access function.
-//## Some compilers have memory problems without the explicit instantiation.
-//## You may need to move the access function to a separate file.
-//## \note If you experience compiler errors, try to
-//## include mitkAltInstantiateAccessFunctions.h and
-//## add "Alt" (for alternate) before the call
-//## (e.g. AltInstantiateAccessFunction(...)).
-//## \sa InstantiateAccessFunctionForFixedDimension
-//## \sa InstantiateAccessFunctionForFixedDimension_2
-//## @ingroup Adaptor
-#define InstantiateAccessFunctionForFixedDimension_1(itkImgFunc, dimension, param1Type) \
-template void itkImgFunc<double, dimension>(itk::Image<double, dimension>*, param1Type); \
-template void itkImgFunc<float, dimension>(itk::Image<float, dimension>*, param1Type); \
-template void itkImgFunc<int, dimension>(itk::Image<int, dimension>*, param1Type); \
-template void itkImgFunc<unsigned int, dimension>(itk::Image<unsigned int, dimension>*, param1Type); \
-template void itkImgFunc<short, dimension>(itk::Image<short, dimension>*, param1Type); \
-template void itkImgFunc<unsigned short, dimension>(itk::Image<unsigned short, dimension>*, param1Type); \
-template void itkImgFunc<char, dimension>(itk::Image<char, dimension>*, param1Type); \
-template void itkImgFunc<unsigned char, dimension>(itk::Image<unsigned char, dimension>*, param1Type);
-
-//##Documentation
-//## @brief Instantiate access function with two additional parammeters
-//## for all datatypes, but fixed dimension
-//##
-//## Use this macro once after the definition of your access function.
-//## Some compilers have memory problems without the explicit instantiation.
-//## You may need to move the access function to a separate file.
-//## \note If you experience compiler errors, try to
-//## include mitkAltInstantiateAccessFunctions.h and
-//## add "Alt" (for alternate) before the call
-//## (e.g. AltInstantiateAccessFunction(...)).
-//## \sa InstantiateAccessFunctionForFixedDimension
-//## \sa InstantiateAccessFunctionForFixedDimension_1
-//## @ingroup Adaptor
-#define InstantiateAccessFunctionForFixedDimension_2(itkImgFunc, dimension, param1Type, param2Type) \
-template void itkImgFunc<double, dimension>(itk::Image<double, dimension>*, param1Type, param2Type); \
-template void itkImgFunc<float, dimension>(itk::Image<float, dimension>*, param1Type, param2Type); \
-template void itkImgFunc<int, dimension>(itk::Image<int, dimension>*, param1Type, param2Type); \
-template void itkImgFunc<unsigned int, dimension>(itk::Image<unsigned int, dimension>*, param1Type, param2Type); \
-template void itkImgFunc<short, dimension>(itk::Image<short, dimension>*, param1Type, param2Type); \
-template void itkImgFunc<unsigned short, dimension>(itk::Image<unsigned short, dimension>*, param1Type, param2Type); \
-template void itkImgFunc<char, dimension>(itk::Image<char, dimension>*, param1Type, param2Type); \
-template void itkImgFunc<unsigned char, dimension>(itk::Image<unsigned char, dimension>*, param1Type, param2Type);
-
-//##Documentation
-//## @brief Instantiate access function without additional parammeters
-//## for a fixed datatype, but all dimensions
-//##
-//## Use this macro once after the definition of your access function.
-//## Some compilers have memory problems without the explicit instantiation.
-//## You may need to move the access function to a separate file.
-//## \note If you experience compiler errors, try to
-//## include mitkAltInstantiateAccessFunctions.h and
-//## add "Alt" (for alternate) before the call
-//## (e.g. AltInstantiateAccessFunction(...)).
-//## \sa InstantiateAccessFunctionForFixedPixelType_1
-//## \sa InstantiateAccessFunctionForFixedPixelType_2
-//## @ingroup Adaptor
-#define InstantiateAccessFunctionForFixedPixelType(itkImgFunc, pixelType) \
-template void itkImgFunc<pixelType, 2>(itk::Image<pixelType, 2>*); \
-template void itkImgFunc<pixelType, 3>(itk::Image<pixelType, 3>*);
-
-//##Documentation
-//## @brief Instantiate access function with one additional parammeter
-//## for a fixed datatype, but all dimensions
-//##
-//## Use this macro once after the definition of your access function.
-//## Some compilers have memory problems without the explicit instantiation.
-//## You may need to move the access function to a separate file.
-//## \note If you experience compiler errors, try to
-//## include mitkAltInstantiateAccessFunctions.h and
-//## add "Alt" (for alternate) before the call
-//## (e.g. AltInstantiateAccessFunction(...)).
-//## \sa InstantiateAccessFunctionForFixedPixelType
-//## \sa InstantiateAccessFunctionForFixedPixelType_2
-//## @ingroup Adaptor
-#define InstantiateAccessFunctionForFixedPixelType_1(itkImgFunc, pixelType, param1Type) \
-template void itkImgFunc<pixelType, 2>(itk::Image<pixelType, 2>*, param1Type); \
-template void itkImgFunc<pixelType, 3>(itk::Image<pixelType, 3>*, param1Type);
-
-//##Documentation
-//## @brief Instantiate access function with two additional parammeters
-//## for a fixed datatype, but all dimensions
-//##
-//## Use this macro once after the definition of your access function.
-//## Some compilers have memory problems without the explicit instantiation.
-//## You may need to move the access function to a separate file.
-//## \note If you experience compiler errors, try to
-//## include mitkAltInstantiateAccessFunctions.h and
-//## add "Alt" (for alternate) before the call
-//## (e.g. AltInstantiateAccessFunction(...)).
-//## \sa InstantiateAccessFunctionForFixedPixelType
-//## \sa InstantiateAccessFunctionForFixedPixelType_1
-//## @ingroup Adaptor
-#define InstantiateAccessFunctionForFixedPixelType_2(itkImgFunc, pixelType, param1Type, param2Type)\
-template void itkImgFunc<pixelType, 2>(itk::Image<pixelType, 2>*, param1Type, param2Type); \
-template void itkImgFunc<pixelType, 3>(itk::Image<pixelType, 3>*, param1Type, param2Type);
+
+/**
+ * \brief Instantiate access function for the given pixel types and dimensions.
+ *
+ * Iteratively calls a macro named InstantiateAccessFunction_itkImgFunc
+ * which you must define and which usually explicitly instantiates your access function.
+ *
+ * A call to InstantiateAccessFunctionForFixedPixelType(T, (a)(b), (d)(e)) results in calls
+ *
+ * InstantiateAccessFunction_T(a, d) <br>
+ * InstantiateAccessFunction_T(a, e) <br>
+ * InstantiateAccessFunction_T(b, d) <br>
+ * InstantiateAccessFunction_T(b, e)
+ *
+ * That is, InstantiateAccessFunction_T is called for the cartesian product of the sequences pixelTypeSeq
+ * and dimSeq.
+ *
+ * Example:
+ * \code
+ * template<typename TPixel, typename VDimension>
+ * void MyImageAccessFunction(itk::Image<TPixel, VImageDimension>* itkImage)
+ * { ... }
+ *
+ * #define InstantiateAccessFunction_MyImageAccessFunction(pixelType, dim) \
+ * template void MyImageAccessFunction(itk::Image<pixelType,dim>*);
+ *
+ * InstantiateAccessFunctionForFixedPixelType(MyImageAccessFunction, (int), (3))
+ * \endcode
+ *
+ * Use this macro once after the definition of your access function.
+ * Some compilers have memory problems without the explicit instantiation.
+ * You may need to move the access function to a separate file. The CMake macro
+ * MITK_MULTIPLEX_PICTYPE can help you with that. See \c mitk/CMake/mitkMacroMultiplexPicType.cmake
+ * for documentation.
+ *
+ * \param itkImgFunc The custom part of the name of the macro to be called.
+ * \param pixelTypeSeq a sequence of types, like (int)(short)(char).
+ * \param dimSeq a sequence of dimensions, like (2)(3).
+ *
+ * \ingroup Adaptor
+ */
+#define InstantiateAccessFunctionForFixedType(itkImgFunc, pixelTypeSeq, dimSeq) \
+ MITK_PP_SEQ_FOR_EACH_PRODUCT(InstantiateAccessFunctionProductImpl, ((itkImgFunc))(pixelTypeSeq)(dimSeq))
+
+/**
+ * \brief Instantiate access function for all datatypes and dimensions.
+ *
+ * \sa InstantiateAccessFunctionForFixedType
+ *
+ * \ingroup Adaptor
+ */
+#define InstantiateAccessFunction(itkImgFunc) \
+ InstantiateAccessFunctionForFixedType(itkImgFunc, MITK_ACCESSBYITK_PIXEL_TYPES_SEQ, MITK_ACCESSBYITK_DIMENSIONS_SEQ)
+
+/**
+ * \brief Instantiate access function for all datatypes and a specific dimension.
+ *
+ * \sa InstantiateAccessFunctionForFixedType
+ *
+ * \param itkImgFunc The custom part of the name of the macro to be called.
+ * \param dimSeq a sequence of dimensions, like (2)(3).
+ *
+ * \ingroup Adaptor
+ */
+#define InstantiateAccessFunctionForFixedDimension(itkImgFunc, dim) \
+ InstantiateAccessFunctionForFixedType(itkImgFunc, MITK_ACCESSBYITK_PIXEL_TYPES_SEQ, (dim))
+
+/**
+ * \brief Instantiate access function for all given pixel types and all dimensions.
+ *
+ * \sa InstantiateAccessFunctionForFixedType
+ *
+ * \param itkImgFunc The custom part of the name of the macro to be called.
+ * \param pixelTypeSeq a sequence of types, like (int)(short)(char).
+ *
+ * \ingroup Adaptor
+ */
+#define InstantiateAccessFunctionForFixedPixelType(itkImgFunc, pixelTypeSeq) \
+ InstantiateAccessFunctionForFixedType(itkImgFunc, pixelTypeSeq, MITK_ACCESSBYITK_DIMENSIONS_SEQ)
+
+/**
+ * \brief Instantiate access function for integral datatypes and all dimensions.
+ *
+ * \sa InstantiateAccessFunctionForFixedType
+ *
+ * \param itkImgFunc The custom part of the name of the macro to be called.
+ *
+ * \ingroup Adaptor
+ */
+#define InstantiateAccessFunctionForIntegralPixelTypes(itkImgFunc) \
+ InstantiateAccessFunctionForFixedType(itkImgFunc, MITK_ACCESSBYITK_INTEGRAL_PIXEL_TYPES_SEQ, MITK_ACCESSBYITK_DIMENSIONS_SEQ)
+
+/**
+ * \brief Instantiate access function for floating point datatypes and all dimensions.
+ *
+ * \sa InstantiateAccessFunctionForFixedType
+ *
+ * \param itkImgFunc The custom part of the name of the macro to be called.
+ *
+ * \ingroup Adaptor
+ */
+#define InstantiateAccessFunctionForFloatingPixelTypes(itkImgFunc) \
+ InstantiateAccessFunctionForFixedType(itkImgFunc, MITK_ACCESSBYITK_FLOATING_PIXEL_TYPES_SEQ, MITK_ACCESSBYITK_DIMENSIONS_SEQ)
+
#endif // of MITKINSTANTIATEACCESSFUNCTIONS_H_HEADER_INCLUDED
diff --git a/Core/Code/DataManagement/mitkLandmarkBasedCurvedGeometry.cpp b/Core/Code/Algorithms/mitkPPArgCount.h
similarity index 57%
copy from Core/Code/DataManagement/mitkLandmarkBasedCurvedGeometry.cpp
copy to Core/Code/Algorithms/mitkPPArgCount.h
index 3a785dc677..059338d7cc 100644
--- a/Core/Code/DataManagement/mitkLandmarkBasedCurvedGeometry.cpp
+++ b/Core/Code/Algorithms/mitkPPArgCount.h
@@ -1,36 +1,38 @@
/*=========================================================================
Program: Medical Imaging & Interaction Toolkit
Language: C++
Date: $Date$
Version: $Revision$
Copyright (c) German Cancer Research Center, Division of Medical and
Biological Informatics. All rights reserved.
See MITKCopyright.txt or http://www.mitk.org/copyright.html for details.
This software is distributed WITHOUT ANY WARRANTY; without even
the implied warranty of MERCHANTABILITY or FITNESS FOR A PARTICULAR
PURPOSE. See the above copyright notices for more information.
=========================================================================*/
-#include "mitkLandmarkBasedCurvedGeometry.h"
-#include <vtkAbstractTransform.h>
+#ifndef MITKPPARGCOUNT_H
+#define MITKPPARGCOUNT_H
-mitk::LandmarkBasedCurvedGeometry::LandmarkBasedCurvedGeometry()
- : m_TargetLandmarks(NULL)
-{
-}
+#define MITK_PP_ARG_COUNT(...) \
+ MITK_PP_ARG_COUNT_((__VA_ARGS__, MITK_PP_RSEQ_N()))
-mitk::LandmarkBasedCurvedGeometry::~LandmarkBasedCurvedGeometry()
-{
+#define MITK_PP_ARG_COUNT_(tuple) \
+ MITK_PP_ARG_N tuple
-}
+#define MITK_PP_ARG_N( \
+ _1, _2, _3, _4, _5, _6, _7, _8, _9,_10, \
+ _11,_12,_13,_14,_15,_16,_17,_18,_19,_20, \
+ _21,_22,_23,_24,_25,N,...) N
-void mitk::LandmarkBasedCurvedGeometry::InitializeGeometry(Self * newGeometry) const
-{
- Superclass::InitializeGeometry(newGeometry);
- newGeometry->SetTargetLandmarks(m_TargetLandmarks);
-}
+#define MITK_PP_RSEQ_N() \
+ 25,24,23,22,21,20, \
+ 19,18,17,16,15,14,13,12,11,10, \
+ 9,8,7,6,5,4,3,2,1,0
+
+#endif // MITKPPARGCOUNT_H
diff --git a/Core/Code/Algorithms/mitkPPArithmeticDec.h b/Core/Code/Algorithms/mitkPPArithmeticDec.h
new file mode 100644
index 0000000000..7a8cb469c9
--- /dev/null
+++ b/Core/Code/Algorithms/mitkPPArithmeticDec.h
@@ -0,0 +1,288 @@
+# /* Copyright (C) 2001
+# * Housemarque Oy
+# * http://www.housemarque.com
+# *
+# * Distributed under the Boost Software License, Version 1.0. (See
+# * accompanying file LICENSE_1_0.txt or copy at
+# * http://www.boost.org/LICENSE_1_0.txt)
+# */
+#
+# /* Revised by Paul Mensonides (2002) */
+#
+# /* See http://www.boost.org for most recent version. */
+#
+# ifndef MITK_PREPROCESSOR_ARITHMETIC_DEC_HPP
+# define MITK_PREPROCESSOR_ARITHMETIC_DEC_HPP
+#
+# include "mitkPPConfig.h"
+#
+# /* MITK_PP_DEC */
+#
+# if ~MITK_PP_CONFIG_FLAGS() & MITK_PP_CONFIG_MWCC()
+# define MITK_PP_DEC(x) MITK_PP_DEC_I(x)
+# else
+# define MITK_PP_DEC(x) MITK_PP_DEC_OO((x))
+# define MITK_PP_DEC_OO(par) MITK_PP_DEC_I ## par
+# endif
+#
+# define MITK_PP_DEC_I(x) MITK_PP_DEC_ ## x
+#
+# define MITK_PP_DEC_0 0
+# define MITK_PP_DEC_1 0
+# define MITK_PP_DEC_2 1
+# define MITK_PP_DEC_3 2
+# define MITK_PP_DEC_4 3
+# define MITK_PP_DEC_5 4
+# define MITK_PP_DEC_6 5
+# define MITK_PP_DEC_7 6
+# define MITK_PP_DEC_8 7
+# define MITK_PP_DEC_9 8
+# define MITK_PP_DEC_10 9
+# define MITK_PP_DEC_11 10
+# define MITK_PP_DEC_12 11
+# define MITK_PP_DEC_13 12
+# define MITK_PP_DEC_14 13
+# define MITK_PP_DEC_15 14
+# define MITK_PP_DEC_16 15
+# define MITK_PP_DEC_17 16
+# define MITK_PP_DEC_18 17
+# define MITK_PP_DEC_19 18
+# define MITK_PP_DEC_20 19
+# define MITK_PP_DEC_21 20
+# define MITK_PP_DEC_22 21
+# define MITK_PP_DEC_23 22
+# define MITK_PP_DEC_24 23
+# define MITK_PP_DEC_25 24
+# define MITK_PP_DEC_26 25
+# define MITK_PP_DEC_27 26
+# define MITK_PP_DEC_28 27
+# define MITK_PP_DEC_29 28
+# define MITK_PP_DEC_30 29
+# define MITK_PP_DEC_31 30
+# define MITK_PP_DEC_32 31
+# define MITK_PP_DEC_33 32
+# define MITK_PP_DEC_34 33
+# define MITK_PP_DEC_35 34
+# define MITK_PP_DEC_36 35
+# define MITK_PP_DEC_37 36
+# define MITK_PP_DEC_38 37
+# define MITK_PP_DEC_39 38
+# define MITK_PP_DEC_40 39
+# define MITK_PP_DEC_41 40
+# define MITK_PP_DEC_42 41
+# define MITK_PP_DEC_43 42
+# define MITK_PP_DEC_44 43
+# define MITK_PP_DEC_45 44
+# define MITK_PP_DEC_46 45
+# define MITK_PP_DEC_47 46
+# define MITK_PP_DEC_48 47
+# define MITK_PP_DEC_49 48
+# define MITK_PP_DEC_50 49
+# define MITK_PP_DEC_51 50
+# define MITK_PP_DEC_52 51
+# define MITK_PP_DEC_53 52
+# define MITK_PP_DEC_54 53
+# define MITK_PP_DEC_55 54
+# define MITK_PP_DEC_56 55
+# define MITK_PP_DEC_57 56
+# define MITK_PP_DEC_58 57
+# define MITK_PP_DEC_59 58
+# define MITK_PP_DEC_60 59
+# define MITK_PP_DEC_61 60
+# define MITK_PP_DEC_62 61
+# define MITK_PP_DEC_63 62
+# define MITK_PP_DEC_64 63
+# define MITK_PP_DEC_65 64
+# define MITK_PP_DEC_66 65
+# define MITK_PP_DEC_67 66
+# define MITK_PP_DEC_68 67
+# define MITK_PP_DEC_69 68
+# define MITK_PP_DEC_70 69
+# define MITK_PP_DEC_71 70
+# define MITK_PP_DEC_72 71
+# define MITK_PP_DEC_73 72
+# define MITK_PP_DEC_74 73
+# define MITK_PP_DEC_75 74
+# define MITK_PP_DEC_76 75
+# define MITK_PP_DEC_77 76
+# define MITK_PP_DEC_78 77
+# define MITK_PP_DEC_79 78
+# define MITK_PP_DEC_80 79
+# define MITK_PP_DEC_81 80
+# define MITK_PP_DEC_82 81
+# define MITK_PP_DEC_83 82
+# define MITK_PP_DEC_84 83
+# define MITK_PP_DEC_85 84
+# define MITK_PP_DEC_86 85
+# define MITK_PP_DEC_87 86
+# define MITK_PP_DEC_88 87
+# define MITK_PP_DEC_89 88
+# define MITK_PP_DEC_90 89
+# define MITK_PP_DEC_91 90
+# define MITK_PP_DEC_92 91
+# define MITK_PP_DEC_93 92
+# define MITK_PP_DEC_94 93
+# define MITK_PP_DEC_95 94
+# define MITK_PP_DEC_96 95
+# define MITK_PP_DEC_97 96
+# define MITK_PP_DEC_98 97
+# define MITK_PP_DEC_99 98
+# define MITK_PP_DEC_100 99
+# define MITK_PP_DEC_101 100
+# define MITK_PP_DEC_102 101
+# define MITK_PP_DEC_103 102
+# define MITK_PP_DEC_104 103
+# define MITK_PP_DEC_105 104
+# define MITK_PP_DEC_106 105
+# define MITK_PP_DEC_107 106
+# define MITK_PP_DEC_108 107
+# define MITK_PP_DEC_109 108
+# define MITK_PP_DEC_110 109
+# define MITK_PP_DEC_111 110
+# define MITK_PP_DEC_112 111
+# define MITK_PP_DEC_113 112
+# define MITK_PP_DEC_114 113
+# define MITK_PP_DEC_115 114
+# define MITK_PP_DEC_116 115
+# define MITK_PP_DEC_117 116
+# define MITK_PP_DEC_118 117
+# define MITK_PP_DEC_119 118
+# define MITK_PP_DEC_120 119
+# define MITK_PP_DEC_121 120
+# define MITK_PP_DEC_122 121
+# define MITK_PP_DEC_123 122
+# define MITK_PP_DEC_124 123
+# define MITK_PP_DEC_125 124
+# define MITK_PP_DEC_126 125
+# define MITK_PP_DEC_127 126
+# define MITK_PP_DEC_128 127
+# define MITK_PP_DEC_129 128
+# define MITK_PP_DEC_130 129
+# define MITK_PP_DEC_131 130
+# define MITK_PP_DEC_132 131
+# define MITK_PP_DEC_133 132
+# define MITK_PP_DEC_134 133
+# define MITK_PP_DEC_135 134
+# define MITK_PP_DEC_136 135
+# define MITK_PP_DEC_137 136
+# define MITK_PP_DEC_138 137
+# define MITK_PP_DEC_139 138
+# define MITK_PP_DEC_140 139
+# define MITK_PP_DEC_141 140
+# define MITK_PP_DEC_142 141
+# define MITK_PP_DEC_143 142
+# define MITK_PP_DEC_144 143
+# define MITK_PP_DEC_145 144
+# define MITK_PP_DEC_146 145
+# define MITK_PP_DEC_147 146
+# define MITK_PP_DEC_148 147
+# define MITK_PP_DEC_149 148
+# define MITK_PP_DEC_150 149
+# define MITK_PP_DEC_151 150
+# define MITK_PP_DEC_152 151
+# define MITK_PP_DEC_153 152
+# define MITK_PP_DEC_154 153
+# define MITK_PP_DEC_155 154
+# define MITK_PP_DEC_156 155
+# define MITK_PP_DEC_157 156
+# define MITK_PP_DEC_158 157
+# define MITK_PP_DEC_159 158
+# define MITK_PP_DEC_160 159
+# define MITK_PP_DEC_161 160
+# define MITK_PP_DEC_162 161
+# define MITK_PP_DEC_163 162
+# define MITK_PP_DEC_164 163
+# define MITK_PP_DEC_165 164
+# define MITK_PP_DEC_166 165
+# define MITK_PP_DEC_167 166
+# define MITK_PP_DEC_168 167
+# define MITK_PP_DEC_169 168
+# define MITK_PP_DEC_170 169
+# define MITK_PP_DEC_171 170
+# define MITK_PP_DEC_172 171
+# define MITK_PP_DEC_173 172
+# define MITK_PP_DEC_174 173
+# define MITK_PP_DEC_175 174
+# define MITK_PP_DEC_176 175
+# define MITK_PP_DEC_177 176
+# define MITK_PP_DEC_178 177
+# define MITK_PP_DEC_179 178
+# define MITK_PP_DEC_180 179
+# define MITK_PP_DEC_181 180
+# define MITK_PP_DEC_182 181
+# define MITK_PP_DEC_183 182
+# define MITK_PP_DEC_184 183
+# define MITK_PP_DEC_185 184
+# define MITK_PP_DEC_186 185
+# define MITK_PP_DEC_187 186
+# define MITK_PP_DEC_188 187
+# define MITK_PP_DEC_189 188
+# define MITK_PP_DEC_190 189
+# define MITK_PP_DEC_191 190
+# define MITK_PP_DEC_192 191
+# define MITK_PP_DEC_193 192
+# define MITK_PP_DEC_194 193
+# define MITK_PP_DEC_195 194
+# define MITK_PP_DEC_196 195
+# define MITK_PP_DEC_197 196
+# define MITK_PP_DEC_198 197
+# define MITK_PP_DEC_199 198
+# define MITK_PP_DEC_200 199
+# define MITK_PP_DEC_201 200
+# define MITK_PP_DEC_202 201
+# define MITK_PP_DEC_203 202
+# define MITK_PP_DEC_204 203
+# define MITK_PP_DEC_205 204
+# define MITK_PP_DEC_206 205
+# define MITK_PP_DEC_207 206
+# define MITK_PP_DEC_208 207
+# define MITK_PP_DEC_209 208
+# define MITK_PP_DEC_210 209
+# define MITK_PP_DEC_211 210
+# define MITK_PP_DEC_212 211
+# define MITK_PP_DEC_213 212
+# define MITK_PP_DEC_214 213
+# define MITK_PP_DEC_215 214
+# define MITK_PP_DEC_216 215
+# define MITK_PP_DEC_217 216
+# define MITK_PP_DEC_218 217
+# define MITK_PP_DEC_219 218
+# define MITK_PP_DEC_220 219
+# define MITK_PP_DEC_221 220
+# define MITK_PP_DEC_222 221
+# define MITK_PP_DEC_223 222
+# define MITK_PP_DEC_224 223
+# define MITK_PP_DEC_225 224
+# define MITK_PP_DEC_226 225
+# define MITK_PP_DEC_227 226
+# define MITK_PP_DEC_228 227
+# define MITK_PP_DEC_229 228
+# define MITK_PP_DEC_230 229
+# define MITK_PP_DEC_231 230
+# define MITK_PP_DEC_232 231
+# define MITK_PP_DEC_233 232
+# define MITK_PP_DEC_234 233
+# define MITK_PP_DEC_235 234
+# define MITK_PP_DEC_236 235
+# define MITK_PP_DEC_237 236
+# define MITK_PP_DEC_238 237
+# define MITK_PP_DEC_239 238
+# define MITK_PP_DEC_240 239
+# define MITK_PP_DEC_241 240
+# define MITK_PP_DEC_242 241
+# define MITK_PP_DEC_243 242
+# define MITK_PP_DEC_244 243
+# define MITK_PP_DEC_245 244
+# define MITK_PP_DEC_246 245
+# define MITK_PP_DEC_247 246
+# define MITK_PP_DEC_248 247
+# define MITK_PP_DEC_249 248
+# define MITK_PP_DEC_250 249
+# define MITK_PP_DEC_251 250
+# define MITK_PP_DEC_252 251
+# define MITK_PP_DEC_253 252
+# define MITK_PP_DEC_254 253
+# define MITK_PP_DEC_255 254
+# define MITK_PP_DEC_256 255
+#
+# endif
diff --git a/Core/Code/Algorithms/mitkPPCat.h b/Core/Code/Algorithms/mitkPPCat.h
new file mode 100644
index 0000000000..36973a7b54
--- /dev/null
+++ b/Core/Code/Algorithms/mitkPPCat.h
@@ -0,0 +1,35 @@
+# /* Copyright (C) 2001
+# * Housemarque Oy
+# * http://www.housemarque.com
+# *
+# * Distributed under the Boost Software License, Version 1.0. (See
+# * accompanying file LICENSE_1_0.txt or copy at
+# * http://www.boost.org/LICENSE_1_0.txt)
+# */
+#
+# /* Revised by Paul Mensonides (2002) */
+#
+# /* See http://www.boost.org for most recent version. */
+#
+# ifndef MITK_PREPROCESSOR_CAT_HPP
+# define MITK_PREPROCESSOR_CAT_HPP
+#
+# include "mitkPPConfig.h"
+#
+# /* MITK_PP_CAT */
+#
+# if ~MITK_PP_CONFIG_FLAGS() & MITK_PP_CONFIG_MWCC()
+# define MITK_PP_CAT(a, b) MITK_PP_CAT_I(a, b)
+# else
+# define MITK_PP_CAT(a, b) MITK_PP_CAT_OO((a, b))
+# define MITK_PP_CAT_OO(par) MITK_PP_CAT_I ## par
+# endif
+#
+# if ~MITK_PP_CONFIG_FLAGS() & MITK_PP_CONFIG_MSVC()
+# define MITK_PP_CAT_I(a, b) a ## b
+# else
+# define MITK_PP_CAT_I(a, b) MITK_PP_CAT_II(a ## b)
+# define MITK_PP_CAT_II(res) res
+# endif
+#
+# endif
diff --git a/Core/Code/Algorithms/mitkPPConfig.h b/Core/Code/Algorithms/mitkPPConfig.h
new file mode 100644
index 0000000000..39168738a8
--- /dev/null
+++ b/Core/Code/Algorithms/mitkPPConfig.h
@@ -0,0 +1,70 @@
+# /* **************************************************************************
+# * *
+# * (C) Copyright Paul Mensonides 2002.
+# * Distributed under the Boost Software License, Version 1.0. (See
+# * accompanying file LICENSE_1_0.txt or copy at
+# * http://www.boost.org/LICENSE_1_0.txt)
+# * *
+# ************************************************************************** */
+#
+# /* See http://www.boost.org for most recent version. */
+#
+# ifndef MITK_PREPROCESSOR_CONFIG_CONFIG_HPP
+# define MITK_PREPROCESSOR_CONFIG_CONFIG_HPP
+#
+# /* MITK_PP_CONFIG_FLAGS */
+#
+# define MITK_PP_CONFIG_STRICT() 0x0001
+# define MITK_PP_CONFIG_IDEAL() 0x0002
+#
+# define MITK_PP_CONFIG_MSVC() 0x0004
+# define MITK_PP_CONFIG_MWCC() 0x0008
+# define MITK_PP_CONFIG_BCC() 0x0010
+# define MITK_PP_CONFIG_EDG() 0x0020
+# define MITK_PP_CONFIG_DMC() 0x0040
+#
+# ifndef MITK_PP_CONFIG_FLAGS
+# if defined(__GCCXML__)
+# define MITK_PP_CONFIG_FLAGS() (MITK_PP_CONFIG_STRICT())
+# elif defined(__WAVE__)
+# define MITK_PP_CONFIG_FLAGS() (MITK_PP_CONFIG_STRICT())
+# elif defined(__MWERKS__) && __MWERKS__ >= 0x3200
+# define MITK_PP_CONFIG_FLAGS() (MITK_PP_CONFIG_STRICT())
+# elif defined(__EDG__) || defined(__EDG_VERSION__)
+# if defined(_MSC_VER) && __EDG_VERSION__ >= 308
+# define MITK_PP_CONFIG_FLAGS() (MITK_PP_CONFIG_MSVC())
+# else
+# define MITK_PP_CONFIG_FLAGS() (MITK_PP_CONFIG_EDG() | MITK_PP_CONFIG_STRICT())
+# endif
+# elif defined(__MWERKS__)
+# define MITK_PP_CONFIG_FLAGS() (MITK_PP_CONFIG_MWCC())
+# elif defined(__DMC__)
+# define MITK_PP_CONFIG_FLAGS() (MITK_PP_CONFIG_DMC())
+# elif defined(__BORLANDC__) && __BORLANDC__ >= 0x581
+# define MITK_PP_CONFIG_FLAGS() (MITK_PP_CONFIG_STRICT())
+# elif defined(__BORLANDC__) || defined(__IBMC__) || defined(__IBMCPP__) || defined(__SUNPRO_CC)
+# define MITK_PP_CONFIG_FLAGS() (MITK_PP_CONFIG_BCC())
+# elif defined(_MSC_VER)
+# define MITK_PP_CONFIG_FLAGS() (MITK_PP_CONFIG_MSVC())
+# else
+# define MITK_PP_CONFIG_FLAGS() (MITK_PP_CONFIG_STRICT())
+# endif
+# endif
+#
+# /* MITK_PP_CONFIG_EXTENDED_LINE_INFO */
+#
+# ifndef MITK_PP_CONFIG_EXTENDED_LINE_INFO
+# define MITK_PP_CONFIG_EXTENDED_LINE_INFO 0
+# endif
+#
+# /* MITK_PP_CONFIG_ERRORS */
+#
+# ifndef MITK_PP_CONFIG_ERRORS
+# ifdef NDEBUG
+# define MITK_PP_CONFIG_ERRORS 0
+# else
+# define MITK_PP_CONFIG_ERRORS 1
+# endif
+# endif
+#
+# endif
diff --git a/Core/Code/Algorithms/mitkPPControlExprIIf.h b/Core/Code/Algorithms/mitkPPControlExprIIf.h
new file mode 100644
index 0000000000..d7262de6a8
--- /dev/null
+++ b/Core/Code/Algorithms/mitkPPControlExprIIf.h
@@ -0,0 +1,31 @@
+# /* **************************************************************************
+# * *
+# * (C) Copyright Paul Mensonides 2002.
+# * Distributed under the Boost Software License, Version 1.0. (See
+# * accompanying file LICENSE_1_0.txt or copy at
+# * http://www.boost.org/LICENSE_1_0.txt)
+# * *
+# ************************************************************************** */
+#
+# /* See http://www.boost.org for most recent version. */
+#
+# ifndef MITK_PREPROCESSOR_CONTROL_EXPR_IIF_HPP
+# define MITK_PREPROCESSOR_CONTROL_EXPR_IIF_HPP
+#
+# include "mitkPPConfig.h"
+#
+# /* MITK_PP_EXPR_IIF */
+#
+# if ~MITK_PP_CONFIG_FLAGS() & MITK_PP_CONFIG_MWCC()
+# define MITK_PP_EXPR_IIF(bit, expr) MITK_PP_EXPR_IIF_I(bit, expr)
+# else
+# define MITK_PP_EXPR_IIF(bit, expr) MITK_PP_EXPR_IIF_OO((bit, expr))
+# define MITK_PP_EXPR_IIF_OO(par) MITK_PP_EXPR_IIF_I ## par
+# endif
+#
+# define MITK_PP_EXPR_IIF_I(bit, expr) MITK_PP_EXPR_IIF_ ## bit(expr)
+#
+# define MITK_PP_EXPR_IIF_0(expr)
+# define MITK_PP_EXPR_IIF_1(expr) expr
+#
+# endif
diff --git a/Core/Code/Algorithms/mitkPPControlIIf.h b/Core/Code/Algorithms/mitkPPControlIIf.h
new file mode 100644
index 0000000000..565b7fd9f6
--- /dev/null
+++ b/Core/Code/Algorithms/mitkPPControlIIf.h
@@ -0,0 +1,34 @@
+# /* **************************************************************************
+# * *
+# * (C) Copyright Paul Mensonides 2002.
+# * Distributed under the Boost Software License, Version 1.0. (See
+# * accompanying file LICENSE_1_0.txt or copy at
+# * http://www.boost.org/LICENSE_1_0.txt)
+# * *
+# ************************************************************************** */
+#
+# /* See http://www.boost.org for most recent version. */
+#
+# ifndef MITK_PREPROCESSOR_CONTROL_IIF_HPP
+# define MITK_PREPROCESSOR_CONTROL_IIF_HPP
+#
+# include "mitkPPConfig.h"
+#
+# if ~MITK_PP_CONFIG_FLAGS() & MITK_PP_CONFIG_MWCC()
+# define MITK_PP_IIF(bit, t, f) MITK_PP_IIF_I(bit, t, f)
+# else
+# define MITK_PP_IIF(bit, t, f) MITK_PP_IIF_OO((bit, t, f))
+# define MITK_PP_IIF_OO(par) MITK_PP_IIF_I ## par
+# endif
+#
+# if ~MITK_PP_CONFIG_FLAGS() & MITK_PP_CONFIG_MSVC()
+# define MITK_PP_IIF_I(bit, t, f) MITK_PP_IIF_ ## bit(t, f)
+# else
+# define MITK_PP_IIF_I(bit, t, f) MITK_PP_IIF_II(MITK_PP_IIF_ ## bit(t, f))
+# define MITK_PP_IIF_II(id) id
+# endif
+#
+# define MITK_PP_IIF_0(t, f) f
+# define MITK_PP_IIF_1(t, f) t
+#
+# endif
diff --git a/Core/Code/Algorithms/mitkPPControlIf.h b/Core/Code/Algorithms/mitkPPControlIf.h
new file mode 100644
index 0000000000..9c64d12743
--- /dev/null
+++ b/Core/Code/Algorithms/mitkPPControlIf.h
@@ -0,0 +1,30 @@
+# /* Copyright (C) 2001
+# * Housemarque Oy
+# * http://www.housemarque.com
+# *
+# * Distributed under the Boost Software License, Version 1.0. (See
+# * accompanying file LICENSE_1_0.txt or copy at
+# * http://www.boost.org/LICENSE_1_0.txt)
+# */
+#
+# /* Revised by Paul Mensonides (2002) */
+#
+# /* See http://www.boost.org for most recent version. */
+#
+# ifndef MITK_PREPROCESSOR_CONTROL_IF_HPP
+# define MITK_PREPROCESSOR_CONTROL_IF_HPP
+#
+# include "mitkPPConfig.h"
+# include "mitkPPControlIIf.h"
+# include "mitkPPLogicalBool.h"
+#
+# /* MITK_PP_IF */
+#
+# if ~MITK_PP_CONFIG_FLAGS() & MITK_PP_CONFIG_EDG()
+# define MITK_PP_IF(cond, t, f) MITK_PP_IIF(MITK_PP_BOOL(cond), t, f)
+# else
+# define MITK_PP_IF(cond, t, f) MITK_PP_IF_I(cond, t, f)
+# define MITK_PP_IF_I(cond, t, f) MITK_PP_IIF(MITK_PP_BOOL(cond), t, f)
+# endif
+#
+# endif
diff --git a/Core/Code/Algorithms/mitkPPDebugError.h b/Core/Code/Algorithms/mitkPPDebugError.h
new file mode 100644
index 0000000000..800c390658
--- /dev/null
+++ b/Core/Code/Algorithms/mitkPPDebugError.h
@@ -0,0 +1,33 @@
+# /* **************************************************************************
+# * *
+# * (C) Copyright Paul Mensonides 2002.
+# * Distributed under the Boost Software License, Version 1.0. (See
+# * accompanying file LICENSE_1_0.txt or copy at
+# * http://www.boost.org/LICENSE_1_0.txt)
+# * *
+# ************************************************************************** */
+#
+# /* See http://www.boost.org for most recent version. */
+#
+# ifndef MITK_PREPROCESSOR_DEBUG_ERROR_HPP
+# define MITK_PREPROCESSOR_DEBUG_ERROR_HPP
+#
+# include "mitkPPCat.h"
+# include "mitkPPConfig.h"
+#
+# /* MITK_PP_ERROR */
+#
+# if MITK_PP_CONFIG_ERRORS
+# define MITK_PP_ERROR(code) MITK_PP_CAT(MITK_PP_ERROR_, code)
+# endif
+#
+# define MITK_PP_ERROR_0x0000 MITK_PP_ERROR(0x0000, MITK_PP_INDEX_OUT_OF_BOUNDS)
+# define MITK_PP_ERROR_0x0001 MITK_PP_ERROR(0x0001, MITK_PP_WHILE_OVERFLOW)
+# define MITK_PP_ERROR_0x0002 MITK_PP_ERROR(0x0002, MITK_PP_FOR_OVERFLOW)
+# define MITK_PP_ERROR_0x0003 MITK_PP_ERROR(0x0003, MITK_PP_REPEAT_OVERFLOW)
+# define MITK_PP_ERROR_0x0004 MITK_PP_ERROR(0x0004, MITK_PP_LIST_FOLD_OVERFLOW)
+# define MITK_PP_ERROR_0x0005 MITK_PP_ERROR(0x0005, MITK_PP_SEQ_FOLD_OVERFLOW)
+# define MITK_PP_ERROR_0x0006 MITK_PP_ERROR(0x0006, MITK_PP_ARITHMETIC_OVERFLOW)
+# define MITK_PP_ERROR_0x0007 MITK_PP_ERROR(0x0007, MITK_PP_DIVISION_BY_ZERO)
+#
+# endif
diff --git a/Core/Code/Algorithms/mitkPPDetailAutoRec.h b/Core/Code/Algorithms/mitkPPDetailAutoRec.h
new file mode 100644
index 0000000000..42289fbe44
--- /dev/null
+++ b/Core/Code/Algorithms/mitkPPDetailAutoRec.h
@@ -0,0 +1,293 @@
+# /* **************************************************************************
+# * *
+# * (C) Copyright Paul Mensonides 2002.
+# * Distributed under the Boost Software License, Version 1.0. (See
+# * accompanying file LICENSE_1_0.txt or copy at
+# * http://www.boost.org/LICENSE_1_0.txt)
+# * *
+# ************************************************************************** */
+#
+# /* See http://www.boost.org for most recent version. */
+#
+# include "mitkPPConfig.h"
+#
+# if MITK_PP_CONFIG_FLAGS() & MITK_PP_CONFIG_DMC()
+# include "mitkPPDetailDMCAutoRec.h"
+# else
+#
+# ifndef MITK_PREPROCESSOR_DETAIL_AUTO_REC_HPP
+# define MITK_PREPROCESSOR_DETAIL_AUTO_REC_HPP
+#
+# include "mitkPPControlIIf.h"
+#
+# /* MITK_PP_AUTO_REC */
+#
+# define MITK_PP_AUTO_REC(pred, n) MITK_PP_NODE_ENTRY_ ## n(pred)
+#
+# define MITK_PP_NODE_ENTRY_256(p) MITK_PP_NODE_128(p)(p)(p)(p)(p)(p)(p)(p)
+# define MITK_PP_NODE_ENTRY_128(p) MITK_PP_NODE_64(p)(p)(p)(p)(p)(p)(p)
+# define MITK_PP_NODE_ENTRY_64(p) MITK_PP_NODE_32(p)(p)(p)(p)(p)(p)
+# define MITK_PP_NODE_ENTRY_32(p) MITK_PP_NODE_16(p)(p)(p)(p)(p)
+# define MITK_PP_NODE_ENTRY_16(p) MITK_PP_NODE_8(p)(p)(p)(p)
+# define MITK_PP_NODE_ENTRY_8(p) MITK_PP_NODE_4(p)(p)(p)
+# define MITK_PP_NODE_ENTRY_4(p) MITK_PP_NODE_2(p)(p)
+# define MITK_PP_NODE_ENTRY_2(p) MITK_PP_NODE_1(p)
+#
+# define MITK_PP_NODE_128(p) MITK_PP_IIF(p(128), MITK_PP_NODE_64, MITK_PP_NODE_192)
+# define MITK_PP_NODE_64(p) MITK_PP_IIF(p(64), MITK_PP_NODE_32, MITK_PP_NODE_96)
+# define MITK_PP_NODE_32(p) MITK_PP_IIF(p(32), MITK_PP_NODE_16, MITK_PP_NODE_48)
+# define MITK_PP_NODE_16(p) MITK_PP_IIF(p(16), MITK_PP_NODE_8, MITK_PP_NODE_24)
+# define MITK_PP_NODE_8(p) MITK_PP_IIF(p(8), MITK_PP_NODE_4, MITK_PP_NODE_12)
+# define MITK_PP_NODE_4(p) MITK_PP_IIF(p(4), MITK_PP_NODE_2, MITK_PP_NODE_6)
+# define MITK_PP_NODE_2(p) MITK_PP_IIF(p(2), MITK_PP_NODE_1, MITK_PP_NODE_3)
+# define MITK_PP_NODE_1(p) MITK_PP_IIF(p(1), 1, 2)
+# define MITK_PP_NODE_3(p) MITK_PP_IIF(p(3), 3, 4)
+# define MITK_PP_NODE_6(p) MITK_PP_IIF(p(6), MITK_PP_NODE_5, MITK_PP_NODE_7)
+# define MITK_PP_NODE_5(p) MITK_PP_IIF(p(5), 5, 6)
+# define MITK_PP_NODE_7(p) MITK_PP_IIF(p(7), 7, 8)
+# define MITK_PP_NODE_12(p) MITK_PP_IIF(p(12), MITK_PP_NODE_10, MITK_PP_NODE_14)
+# define MITK_PP_NODE_10(p) MITK_PP_IIF(p(10), MITK_PP_NODE_9, MITK_PP_NODE_11)
+# define MITK_PP_NODE_9(p) MITK_PP_IIF(p(9), 9, 10)
+# define MITK_PP_NODE_11(p) MITK_PP_IIF(p(11), 11, 12)
+# define MITK_PP_NODE_14(p) MITK_PP_IIF(p(14), MITK_PP_NODE_13, MITK_PP_NODE_15)
+# define MITK_PP_NODE_13(p) MITK_PP_IIF(p(13), 13, 14)
+# define MITK_PP_NODE_15(p) MITK_PP_IIF(p(15), 15, 16)
+# define MITK_PP_NODE_24(p) MITK_PP_IIF(p(24), MITK_PP_NODE_20, MITK_PP_NODE_28)
+# define MITK_PP_NODE_20(p) MITK_PP_IIF(p(20), MITK_PP_NODE_18, MITK_PP_NODE_22)
+# define MITK_PP_NODE_18(p) MITK_PP_IIF(p(18), MITK_PP_NODE_17, MITK_PP_NODE_19)
+# define MITK_PP_NODE_17(p) MITK_PP_IIF(p(17), 17, 18)
+# define MITK_PP_NODE_19(p) MITK_PP_IIF(p(19), 19, 20)
+# define MITK_PP_NODE_22(p) MITK_PP_IIF(p(22), MITK_PP_NODE_21, MITK_PP_NODE_23)
+# define MITK_PP_NODE_21(p) MITK_PP_IIF(p(21), 21, 22)
+# define MITK_PP_NODE_23(p) MITK_PP_IIF(p(23), 23, 24)
+# define MITK_PP_NODE_28(p) MITK_PP_IIF(p(28), MITK_PP_NODE_26, MITK_PP_NODE_30)
+# define MITK_PP_NODE_26(p) MITK_PP_IIF(p(26), MITK_PP_NODE_25, MITK_PP_NODE_27)
+# define MITK_PP_NODE_25(p) MITK_PP_IIF(p(25), 25, 26)
+# define MITK_PP_NODE_27(p) MITK_PP_IIF(p(27), 27, 28)
+# define MITK_PP_NODE_30(p) MITK_PP_IIF(p(30), MITK_PP_NODE_29, MITK_PP_NODE_31)
+# define MITK_PP_NODE_29(p) MITK_PP_IIF(p(29), 29, 30)
+# define MITK_PP_NODE_31(p) MITK_PP_IIF(p(31), 31, 32)
+# define MITK_PP_NODE_48(p) MITK_PP_IIF(p(48), MITK_PP_NODE_40, MITK_PP_NODE_56)
+# define MITK_PP_NODE_40(p) MITK_PP_IIF(p(40), MITK_PP_NODE_36, MITK_PP_NODE_44)
+# define MITK_PP_NODE_36(p) MITK_PP_IIF(p(36), MITK_PP_NODE_34, MITK_PP_NODE_38)
+# define MITK_PP_NODE_34(p) MITK_PP_IIF(p(34), MITK_PP_NODE_33, MITK_PP_NODE_35)
+# define MITK_PP_NODE_33(p) MITK_PP_IIF(p(33), 33, 34)
+# define MITK_PP_NODE_35(p) MITK_PP_IIF(p(35), 35, 36)
+# define MITK_PP_NODE_38(p) MITK_PP_IIF(p(38), MITK_PP_NODE_37, MITK_PP_NODE_39)
+# define MITK_PP_NODE_37(p) MITK_PP_IIF(p(37), 37, 38)
+# define MITK_PP_NODE_39(p) MITK_PP_IIF(p(39), 39, 40)
+# define MITK_PP_NODE_44(p) MITK_PP_IIF(p(44), MITK_PP_NODE_42, MITK_PP_NODE_46)
+# define MITK_PP_NODE_42(p) MITK_PP_IIF(p(42), MITK_PP_NODE_41, MITK_PP_NODE_43)
+# define MITK_PP_NODE_41(p) MITK_PP_IIF(p(41), 41, 42)
+# define MITK_PP_NODE_43(p) MITK_PP_IIF(p(43), 43, 44)
+# define MITK_PP_NODE_46(p) MITK_PP_IIF(p(46), MITK_PP_NODE_45, MITK_PP_NODE_47)
+# define MITK_PP_NODE_45(p) MITK_PP_IIF(p(45), 45, 46)
+# define MITK_PP_NODE_47(p) MITK_PP_IIF(p(47), 47, 48)
+# define MITK_PP_NODE_56(p) MITK_PP_IIF(p(56), MITK_PP_NODE_52, MITK_PP_NODE_60)
+# define MITK_PP_NODE_52(p) MITK_PP_IIF(p(52), MITK_PP_NODE_50, MITK_PP_NODE_54)
+# define MITK_PP_NODE_50(p) MITK_PP_IIF(p(50), MITK_PP_NODE_49, MITK_PP_NODE_51)
+# define MITK_PP_NODE_49(p) MITK_PP_IIF(p(49), 49, 50)
+# define MITK_PP_NODE_51(p) MITK_PP_IIF(p(51), 51, 52)
+# define MITK_PP_NODE_54(p) MITK_PP_IIF(p(54), MITK_PP_NODE_53, MITK_PP_NODE_55)
+# define MITK_PP_NODE_53(p) MITK_PP_IIF(p(53), 53, 54)
+# define MITK_PP_NODE_55(p) MITK_PP_IIF(p(55), 55, 56)
+# define MITK_PP_NODE_60(p) MITK_PP_IIF(p(60), MITK_PP_NODE_58, MITK_PP_NODE_62)
+# define MITK_PP_NODE_58(p) MITK_PP_IIF(p(58), MITK_PP_NODE_57, MITK_PP_NODE_59)
+# define MITK_PP_NODE_57(p) MITK_PP_IIF(p(57), 57, 58)
+# define MITK_PP_NODE_59(p) MITK_PP_IIF(p(59), 59, 60)
+# define MITK_PP_NODE_62(p) MITK_PP_IIF(p(62), MITK_PP_NODE_61, MITK_PP_NODE_63)
+# define MITK_PP_NODE_61(p) MITK_PP_IIF(p(61), 61, 62)
+# define MITK_PP_NODE_63(p) MITK_PP_IIF(p(63), 63, 64)
+# define MITK_PP_NODE_96(p) MITK_PP_IIF(p(96), MITK_PP_NODE_80, MITK_PP_NODE_112)
+# define MITK_PP_NODE_80(p) MITK_PP_IIF(p(80), MITK_PP_NODE_72, MITK_PP_NODE_88)
+# define MITK_PP_NODE_72(p) MITK_PP_IIF(p(72), MITK_PP_NODE_68, MITK_PP_NODE_76)
+# define MITK_PP_NODE_68(p) MITK_PP_IIF(p(68), MITK_PP_NODE_66, MITK_PP_NODE_70)
+# define MITK_PP_NODE_66(p) MITK_PP_IIF(p(66), MITK_PP_NODE_65, MITK_PP_NODE_67)
+# define MITK_PP_NODE_65(p) MITK_PP_IIF(p(65), 65, 66)
+# define MITK_PP_NODE_67(p) MITK_PP_IIF(p(67), 67, 68)
+# define MITK_PP_NODE_70(p) MITK_PP_IIF(p(70), MITK_PP_NODE_69, MITK_PP_NODE_71)
+# define MITK_PP_NODE_69(p) MITK_PP_IIF(p(69), 69, 70)
+# define MITK_PP_NODE_71(p) MITK_PP_IIF(p(71), 71, 72)
+# define MITK_PP_NODE_76(p) MITK_PP_IIF(p(76), MITK_PP_NODE_74, MITK_PP_NODE_78)
+# define MITK_PP_NODE_74(p) MITK_PP_IIF(p(74), MITK_PP_NODE_73, MITK_PP_NODE_75)
+# define MITK_PP_NODE_73(p) MITK_PP_IIF(p(73), 73, 74)
+# define MITK_PP_NODE_75(p) MITK_PP_IIF(p(75), 75, 76)
+# define MITK_PP_NODE_78(p) MITK_PP_IIF(p(78), MITK_PP_NODE_77, MITK_PP_NODE_79)
+# define MITK_PP_NODE_77(p) MITK_PP_IIF(p(77), 77, 78)
+# define MITK_PP_NODE_79(p) MITK_PP_IIF(p(79), 79, 80)
+# define MITK_PP_NODE_88(p) MITK_PP_IIF(p(88), MITK_PP_NODE_84, MITK_PP_NODE_92)
+# define MITK_PP_NODE_84(p) MITK_PP_IIF(p(84), MITK_PP_NODE_82, MITK_PP_NODE_86)
+# define MITK_PP_NODE_82(p) MITK_PP_IIF(p(82), MITK_PP_NODE_81, MITK_PP_NODE_83)
+# define MITK_PP_NODE_81(p) MITK_PP_IIF(p(81), 81, 82)
+# define MITK_PP_NODE_83(p) MITK_PP_IIF(p(83), 83, 84)
+# define MITK_PP_NODE_86(p) MITK_PP_IIF(p(86), MITK_PP_NODE_85, MITK_PP_NODE_87)
+# define MITK_PP_NODE_85(p) MITK_PP_IIF(p(85), 85, 86)
+# define MITK_PP_NODE_87(p) MITK_PP_IIF(p(87), 87, 88)
+# define MITK_PP_NODE_92(p) MITK_PP_IIF(p(92), MITK_PP_NODE_90, MITK_PP_NODE_94)
+# define MITK_PP_NODE_90(p) MITK_PP_IIF(p(90), MITK_PP_NODE_89, MITK_PP_NODE_91)
+# define MITK_PP_NODE_89(p) MITK_PP_IIF(p(89), 89, 90)
+# define MITK_PP_NODE_91(p) MITK_PP_IIF(p(91), 91, 92)
+# define MITK_PP_NODE_94(p) MITK_PP_IIF(p(94), MITK_PP_NODE_93, MITK_PP_NODE_95)
+# define MITK_PP_NODE_93(p) MITK_PP_IIF(p(93), 93, 94)
+# define MITK_PP_NODE_95(p) MITK_PP_IIF(p(95), 95, 96)
+# define MITK_PP_NODE_112(p) MITK_PP_IIF(p(112), MITK_PP_NODE_104, MITK_PP_NODE_120)
+# define MITK_PP_NODE_104(p) MITK_PP_IIF(p(104), MITK_PP_NODE_100, MITK_PP_NODE_108)
+# define MITK_PP_NODE_100(p) MITK_PP_IIF(p(100), MITK_PP_NODE_98, MITK_PP_NODE_102)
+# define MITK_PP_NODE_98(p) MITK_PP_IIF(p(98), MITK_PP_NODE_97, MITK_PP_NODE_99)
+# define MITK_PP_NODE_97(p) MITK_PP_IIF(p(97), 97, 98)
+# define MITK_PP_NODE_99(p) MITK_PP_IIF(p(99), 99, 100)
+# define MITK_PP_NODE_102(p) MITK_PP_IIF(p(102), MITK_PP_NODE_101, MITK_PP_NODE_103)
+# define MITK_PP_NODE_101(p) MITK_PP_IIF(p(101), 101, 102)
+# define MITK_PP_NODE_103(p) MITK_PP_IIF(p(103), 103, 104)
+# define MITK_PP_NODE_108(p) MITK_PP_IIF(p(108), MITK_PP_NODE_106, MITK_PP_NODE_110)
+# define MITK_PP_NODE_106(p) MITK_PP_IIF(p(106), MITK_PP_NODE_105, MITK_PP_NODE_107)
+# define MITK_PP_NODE_105(p) MITK_PP_IIF(p(105), 105, 106)
+# define MITK_PP_NODE_107(p) MITK_PP_IIF(p(107), 107, 108)
+# define MITK_PP_NODE_110(p) MITK_PP_IIF(p(110), MITK_PP_NODE_109, MITK_PP_NODE_111)
+# define MITK_PP_NODE_109(p) MITK_PP_IIF(p(109), 109, 110)
+# define MITK_PP_NODE_111(p) MITK_PP_IIF(p(111), 111, 112)
+# define MITK_PP_NODE_120(p) MITK_PP_IIF(p(120), MITK_PP_NODE_116, MITK_PP_NODE_124)
+# define MITK_PP_NODE_116(p) MITK_PP_IIF(p(116), MITK_PP_NODE_114, MITK_PP_NODE_118)
+# define MITK_PP_NODE_114(p) MITK_PP_IIF(p(114), MITK_PP_NODE_113, MITK_PP_NODE_115)
+# define MITK_PP_NODE_113(p) MITK_PP_IIF(p(113), 113, 114)
+# define MITK_PP_NODE_115(p) MITK_PP_IIF(p(115), 115, 116)
+# define MITK_PP_NODE_118(p) MITK_PP_IIF(p(118), MITK_PP_NODE_117, MITK_PP_NODE_119)
+# define MITK_PP_NODE_117(p) MITK_PP_IIF(p(117), 117, 118)
+# define MITK_PP_NODE_119(p) MITK_PP_IIF(p(119), 119, 120)
+# define MITK_PP_NODE_124(p) MITK_PP_IIF(p(124), MITK_PP_NODE_122, MITK_PP_NODE_126)
+# define MITK_PP_NODE_122(p) MITK_PP_IIF(p(122), MITK_PP_NODE_121, MITK_PP_NODE_123)
+# define MITK_PP_NODE_121(p) MITK_PP_IIF(p(121), 121, 122)
+# define MITK_PP_NODE_123(p) MITK_PP_IIF(p(123), 123, 124)
+# define MITK_PP_NODE_126(p) MITK_PP_IIF(p(126), MITK_PP_NODE_125, MITK_PP_NODE_127)
+# define MITK_PP_NODE_125(p) MITK_PP_IIF(p(125), 125, 126)
+# define MITK_PP_NODE_127(p) MITK_PP_IIF(p(127), 127, 128)
+# define MITK_PP_NODE_192(p) MITK_PP_IIF(p(192), MITK_PP_NODE_160, MITK_PP_NODE_224)
+# define MITK_PP_NODE_160(p) MITK_PP_IIF(p(160), MITK_PP_NODE_144, MITK_PP_NODE_176)
+# define MITK_PP_NODE_144(p) MITK_PP_IIF(p(144), MITK_PP_NODE_136, MITK_PP_NODE_152)
+# define MITK_PP_NODE_136(p) MITK_PP_IIF(p(136), MITK_PP_NODE_132, MITK_PP_NODE_140)
+# define MITK_PP_NODE_132(p) MITK_PP_IIF(p(132), MITK_PP_NODE_130, MITK_PP_NODE_134)
+# define MITK_PP_NODE_130(p) MITK_PP_IIF(p(130), MITK_PP_NODE_129, MITK_PP_NODE_131)
+# define MITK_PP_NODE_129(p) MITK_PP_IIF(p(129), 129, 130)
+# define MITK_PP_NODE_131(p) MITK_PP_IIF(p(131), 131, 132)
+# define MITK_PP_NODE_134(p) MITK_PP_IIF(p(134), MITK_PP_NODE_133, MITK_PP_NODE_135)
+# define MITK_PP_NODE_133(p) MITK_PP_IIF(p(133), 133, 134)
+# define MITK_PP_NODE_135(p) MITK_PP_IIF(p(135), 135, 136)
+# define MITK_PP_NODE_140(p) MITK_PP_IIF(p(140), MITK_PP_NODE_138, MITK_PP_NODE_142)
+# define MITK_PP_NODE_138(p) MITK_PP_IIF(p(138), MITK_PP_NODE_137, MITK_PP_NODE_139)
+# define MITK_PP_NODE_137(p) MITK_PP_IIF(p(137), 137, 138)
+# define MITK_PP_NODE_139(p) MITK_PP_IIF(p(139), 139, 140)
+# define MITK_PP_NODE_142(p) MITK_PP_IIF(p(142), MITK_PP_NODE_141, MITK_PP_NODE_143)
+# define MITK_PP_NODE_141(p) MITK_PP_IIF(p(141), 141, 142)
+# define MITK_PP_NODE_143(p) MITK_PP_IIF(p(143), 143, 144)
+# define MITK_PP_NODE_152(p) MITK_PP_IIF(p(152), MITK_PP_NODE_148, MITK_PP_NODE_156)
+# define MITK_PP_NODE_148(p) MITK_PP_IIF(p(148), MITK_PP_NODE_146, MITK_PP_NODE_150)
+# define MITK_PP_NODE_146(p) MITK_PP_IIF(p(146), MITK_PP_NODE_145, MITK_PP_NODE_147)
+# define MITK_PP_NODE_145(p) MITK_PP_IIF(p(145), 145, 146)
+# define MITK_PP_NODE_147(p) MITK_PP_IIF(p(147), 147, 148)
+# define MITK_PP_NODE_150(p) MITK_PP_IIF(p(150), MITK_PP_NODE_149, MITK_PP_NODE_151)
+# define MITK_PP_NODE_149(p) MITK_PP_IIF(p(149), 149, 150)
+# define MITK_PP_NODE_151(p) MITK_PP_IIF(p(151), 151, 152)
+# define MITK_PP_NODE_156(p) MITK_PP_IIF(p(156), MITK_PP_NODE_154, MITK_PP_NODE_158)
+# define MITK_PP_NODE_154(p) MITK_PP_IIF(p(154), MITK_PP_NODE_153, MITK_PP_NODE_155)
+# define MITK_PP_NODE_153(p) MITK_PP_IIF(p(153), 153, 154)
+# define MITK_PP_NODE_155(p) MITK_PP_IIF(p(155), 155, 156)
+# define MITK_PP_NODE_158(p) MITK_PP_IIF(p(158), MITK_PP_NODE_157, MITK_PP_NODE_159)
+# define MITK_PP_NODE_157(p) MITK_PP_IIF(p(157), 157, 158)
+# define MITK_PP_NODE_159(p) MITK_PP_IIF(p(159), 159, 160)
+# define MITK_PP_NODE_176(p) MITK_PP_IIF(p(176), MITK_PP_NODE_168, MITK_PP_NODE_184)
+# define MITK_PP_NODE_168(p) MITK_PP_IIF(p(168), MITK_PP_NODE_164, MITK_PP_NODE_172)
+# define MITK_PP_NODE_164(p) MITK_PP_IIF(p(164), MITK_PP_NODE_162, MITK_PP_NODE_166)
+# define MITK_PP_NODE_162(p) MITK_PP_IIF(p(162), MITK_PP_NODE_161, MITK_PP_NODE_163)
+# define MITK_PP_NODE_161(p) MITK_PP_IIF(p(161), 161, 162)
+# define MITK_PP_NODE_163(p) MITK_PP_IIF(p(163), 163, 164)
+# define MITK_PP_NODE_166(p) MITK_PP_IIF(p(166), MITK_PP_NODE_165, MITK_PP_NODE_167)
+# define MITK_PP_NODE_165(p) MITK_PP_IIF(p(165), 165, 166)
+# define MITK_PP_NODE_167(p) MITK_PP_IIF(p(167), 167, 168)
+# define MITK_PP_NODE_172(p) MITK_PP_IIF(p(172), MITK_PP_NODE_170, MITK_PP_NODE_174)
+# define MITK_PP_NODE_170(p) MITK_PP_IIF(p(170), MITK_PP_NODE_169, MITK_PP_NODE_171)
+# define MITK_PP_NODE_169(p) MITK_PP_IIF(p(169), 169, 170)
+# define MITK_PP_NODE_171(p) MITK_PP_IIF(p(171), 171, 172)
+# define MITK_PP_NODE_174(p) MITK_PP_IIF(p(174), MITK_PP_NODE_173, MITK_PP_NODE_175)
+# define MITK_PP_NODE_173(p) MITK_PP_IIF(p(173), 173, 174)
+# define MITK_PP_NODE_175(p) MITK_PP_IIF(p(175), 175, 176)
+# define MITK_PP_NODE_184(p) MITK_PP_IIF(p(184), MITK_PP_NODE_180, MITK_PP_NODE_188)
+# define MITK_PP_NODE_180(p) MITK_PP_IIF(p(180), MITK_PP_NODE_178, MITK_PP_NODE_182)
+# define MITK_PP_NODE_178(p) MITK_PP_IIF(p(178), MITK_PP_NODE_177, MITK_PP_NODE_179)
+# define MITK_PP_NODE_177(p) MITK_PP_IIF(p(177), 177, 178)
+# define MITK_PP_NODE_179(p) MITK_PP_IIF(p(179), 179, 180)
+# define MITK_PP_NODE_182(p) MITK_PP_IIF(p(182), MITK_PP_NODE_181, MITK_PP_NODE_183)
+# define MITK_PP_NODE_181(p) MITK_PP_IIF(p(181), 181, 182)
+# define MITK_PP_NODE_183(p) MITK_PP_IIF(p(183), 183, 184)
+# define MITK_PP_NODE_188(p) MITK_PP_IIF(p(188), MITK_PP_NODE_186, MITK_PP_NODE_190)
+# define MITK_PP_NODE_186(p) MITK_PP_IIF(p(186), MITK_PP_NODE_185, MITK_PP_NODE_187)
+# define MITK_PP_NODE_185(p) MITK_PP_IIF(p(185), 185, 186)
+# define MITK_PP_NODE_187(p) MITK_PP_IIF(p(187), 187, 188)
+# define MITK_PP_NODE_190(p) MITK_PP_IIF(p(190), MITK_PP_NODE_189, MITK_PP_NODE_191)
+# define MITK_PP_NODE_189(p) MITK_PP_IIF(p(189), 189, 190)
+# define MITK_PP_NODE_191(p) MITK_PP_IIF(p(191), 191, 192)
+# define MITK_PP_NODE_224(p) MITK_PP_IIF(p(224), MITK_PP_NODE_208, MITK_PP_NODE_240)
+# define MITK_PP_NODE_208(p) MITK_PP_IIF(p(208), MITK_PP_NODE_200, MITK_PP_NODE_216)
+# define MITK_PP_NODE_200(p) MITK_PP_IIF(p(200), MITK_PP_NODE_196, MITK_PP_NODE_204)
+# define MITK_PP_NODE_196(p) MITK_PP_IIF(p(196), MITK_PP_NODE_194, MITK_PP_NODE_198)
+# define MITK_PP_NODE_194(p) MITK_PP_IIF(p(194), MITK_PP_NODE_193, MITK_PP_NODE_195)
+# define MITK_PP_NODE_193(p) MITK_PP_IIF(p(193), 193, 194)
+# define MITK_PP_NODE_195(p) MITK_PP_IIF(p(195), 195, 196)
+# define MITK_PP_NODE_198(p) MITK_PP_IIF(p(198), MITK_PP_NODE_197, MITK_PP_NODE_199)
+# define MITK_PP_NODE_197(p) MITK_PP_IIF(p(197), 197, 198)
+# define MITK_PP_NODE_199(p) MITK_PP_IIF(p(199), 199, 200)
+# define MITK_PP_NODE_204(p) MITK_PP_IIF(p(204), MITK_PP_NODE_202, MITK_PP_NODE_206)
+# define MITK_PP_NODE_202(p) MITK_PP_IIF(p(202), MITK_PP_NODE_201, MITK_PP_NODE_203)
+# define MITK_PP_NODE_201(p) MITK_PP_IIF(p(201), 201, 202)
+# define MITK_PP_NODE_203(p) MITK_PP_IIF(p(203), 203, 204)
+# define MITK_PP_NODE_206(p) MITK_PP_IIF(p(206), MITK_PP_NODE_205, MITK_PP_NODE_207)
+# define MITK_PP_NODE_205(p) MITK_PP_IIF(p(205), 205, 206)
+# define MITK_PP_NODE_207(p) MITK_PP_IIF(p(207), 207, 208)
+# define MITK_PP_NODE_216(p) MITK_PP_IIF(p(216), MITK_PP_NODE_212, MITK_PP_NODE_220)
+# define MITK_PP_NODE_212(p) MITK_PP_IIF(p(212), MITK_PP_NODE_210, MITK_PP_NODE_214)
+# define MITK_PP_NODE_210(p) MITK_PP_IIF(p(210), MITK_PP_NODE_209, MITK_PP_NODE_211)
+# define MITK_PP_NODE_209(p) MITK_PP_IIF(p(209), 209, 210)
+# define MITK_PP_NODE_211(p) MITK_PP_IIF(p(211), 211, 212)
+# define MITK_PP_NODE_214(p) MITK_PP_IIF(p(214), MITK_PP_NODE_213, MITK_PP_NODE_215)
+# define MITK_PP_NODE_213(p) MITK_PP_IIF(p(213), 213, 214)
+# define MITK_PP_NODE_215(p) MITK_PP_IIF(p(215), 215, 216)
+# define MITK_PP_NODE_220(p) MITK_PP_IIF(p(220), MITK_PP_NODE_218, MITK_PP_NODE_222)
+# define MITK_PP_NODE_218(p) MITK_PP_IIF(p(218), MITK_PP_NODE_217, MITK_PP_NODE_219)
+# define MITK_PP_NODE_217(p) MITK_PP_IIF(p(217), 217, 218)
+# define MITK_PP_NODE_219(p) MITK_PP_IIF(p(219), 219, 220)
+# define MITK_PP_NODE_222(p) MITK_PP_IIF(p(222), MITK_PP_NODE_221, MITK_PP_NODE_223)
+# define MITK_PP_NODE_221(p) MITK_PP_IIF(p(221), 221, 222)
+# define MITK_PP_NODE_223(p) MITK_PP_IIF(p(223), 223, 224)
+# define MITK_PP_NODE_240(p) MITK_PP_IIF(p(240), MITK_PP_NODE_232, MITK_PP_NODE_248)
+# define MITK_PP_NODE_232(p) MITK_PP_IIF(p(232), MITK_PP_NODE_228, MITK_PP_NODE_236)
+# define MITK_PP_NODE_228(p) MITK_PP_IIF(p(228), MITK_PP_NODE_226, MITK_PP_NODE_230)
+# define MITK_PP_NODE_226(p) MITK_PP_IIF(p(226), MITK_PP_NODE_225, MITK_PP_NODE_227)
+# define MITK_PP_NODE_225(p) MITK_PP_IIF(p(225), 225, 226)
+# define MITK_PP_NODE_227(p) MITK_PP_IIF(p(227), 227, 228)
+# define MITK_PP_NODE_230(p) MITK_PP_IIF(p(230), MITK_PP_NODE_229, MITK_PP_NODE_231)
+# define MITK_PP_NODE_229(p) MITK_PP_IIF(p(229), 229, 230)
+# define MITK_PP_NODE_231(p) MITK_PP_IIF(p(231), 231, 232)
+# define MITK_PP_NODE_236(p) MITK_PP_IIF(p(236), MITK_PP_NODE_234, MITK_PP_NODE_238)
+# define MITK_PP_NODE_234(p) MITK_PP_IIF(p(234), MITK_PP_NODE_233, MITK_PP_NODE_235)
+# define MITK_PP_NODE_233(p) MITK_PP_IIF(p(233), 233, 234)
+# define MITK_PP_NODE_235(p) MITK_PP_IIF(p(235), 235, 236)
+# define MITK_PP_NODE_238(p) MITK_PP_IIF(p(238), MITK_PP_NODE_237, MITK_PP_NODE_239)
+# define MITK_PP_NODE_237(p) MITK_PP_IIF(p(237), 237, 238)
+# define MITK_PP_NODE_239(p) MITK_PP_IIF(p(239), 239, 240)
+# define MITK_PP_NODE_248(p) MITK_PP_IIF(p(248), MITK_PP_NODE_244, MITK_PP_NODE_252)
+# define MITK_PP_NODE_244(p) MITK_PP_IIF(p(244), MITK_PP_NODE_242, MITK_PP_NODE_246)
+# define MITK_PP_NODE_242(p) MITK_PP_IIF(p(242), MITK_PP_NODE_241, MITK_PP_NODE_243)
+# define MITK_PP_NODE_241(p) MITK_PP_IIF(p(241), 241, 242)
+# define MITK_PP_NODE_243(p) MITK_PP_IIF(p(243), 243, 244)
+# define MITK_PP_NODE_246(p) MITK_PP_IIF(p(246), MITK_PP_NODE_245, MITK_PP_NODE_247)
+# define MITK_PP_NODE_245(p) MITK_PP_IIF(p(245), 245, 246)
+# define MITK_PP_NODE_247(p) MITK_PP_IIF(p(247), 247, 248)
+# define MITK_PP_NODE_252(p) MITK_PP_IIF(p(252), MITK_PP_NODE_250, MITK_PP_NODE_254)
+# define MITK_PP_NODE_250(p) MITK_PP_IIF(p(250), MITK_PP_NODE_249, MITK_PP_NODE_251)
+# define MITK_PP_NODE_249(p) MITK_PP_IIF(p(249), 249, 250)
+# define MITK_PP_NODE_251(p) MITK_PP_IIF(p(251), 251, 252)
+# define MITK_PP_NODE_254(p) MITK_PP_IIF(p(254), MITK_PP_NODE_253, MITK_PP_NODE_255)
+# define MITK_PP_NODE_253(p) MITK_PP_IIF(p(253), 253, 254)
+# define MITK_PP_NODE_255(p) MITK_PP_IIF(p(255), 255, 256)
+#
+# endif
+# endif
diff --git a/Core/Code/Algorithms/mitkPPDetailDMCAutoRec.h b/Core/Code/Algorithms/mitkPPDetailDMCAutoRec.h
new file mode 100644
index 0000000000..c1ca946f47
--- /dev/null
+++ b/Core/Code/Algorithms/mitkPPDetailDMCAutoRec.h
@@ -0,0 +1,286 @@
+# /* **************************************************************************
+# * *
+# * (C) Copyright Paul Mensonides 2002.
+# * Distributed under the Boost Software License, Version 1.0. (See
+# * accompanying file LICENSE_1_0.txt or copy at
+# * http://www.boost.org/LICENSE_1_0.txt)
+# * *
+# ************************************************************************** */
+#
+# /* See http://www.boost.org for most recent version. */
+#
+# ifndef MITK_PREPROCESSOR_DETAIL_AUTO_REC_HPP
+# define MITK_PREPROCESSOR_DETAIL_AUTO_REC_HPP
+#
+# include "mitkPPControlIIf.h"
+#
+# /* MITK_PP_AUTO_REC */
+#
+# define MITK_PP_AUTO_REC(pred, n) MITK_PP_NODE_ENTRY_ ## n(pred)
+#
+# define MITK_PP_NODE_ENTRY_256(p) MITK_PP_NODE_128(p)(p)(p)(p)(p)(p)(p)(p)
+# define MITK_PP_NODE_ENTRY_128(p) MITK_PP_NODE_64(p)(p)(p)(p)(p)(p)(p)
+# define MITK_PP_NODE_ENTRY_64(p) MITK_PP_NODE_32(p)(p)(p)(p)(p)(p)
+# define MITK_PP_NODE_ENTRY_32(p) MITK_PP_NODE_16(p)(p)(p)(p)(p)
+# define MITK_PP_NODE_ENTRY_16(p) MITK_PP_NODE_8(p)(p)(p)(p)
+# define MITK_PP_NODE_ENTRY_8(p) MITK_PP_NODE_4(p)(p)(p)
+# define MITK_PP_NODE_ENTRY_4(p) MITK_PP_NODE_2(p)(p)
+# define MITK_PP_NODE_ENTRY_2(p) MITK_PP_NODE_1(p)
+#
+# define MITK_PP_NODE_128(p) MITK_PP_IIF(p##(128), MITK_PP_NODE_64, MITK_PP_NODE_192)
+# define MITK_PP_NODE_64(p) MITK_PP_IIF(p##(64), MITK_PP_NODE_32, MITK_PP_NODE_96)
+# define MITK_PP_NODE_32(p) MITK_PP_IIF(p##(32), MITK_PP_NODE_16, MITK_PP_NODE_48)
+# define MITK_PP_NODE_16(p) MITK_PP_IIF(p##(16), MITK_PP_NODE_8, MITK_PP_NODE_24)
+# define MITK_PP_NODE_8(p) MITK_PP_IIF(p##(8), MITK_PP_NODE_4, MITK_PP_NODE_12)
+# define MITK_PP_NODE_4(p) MITK_PP_IIF(p##(4), MITK_PP_NODE_2, MITK_PP_NODE_6)
+# define MITK_PP_NODE_2(p) MITK_PP_IIF(p##(2), MITK_PP_NODE_1, MITK_PP_NODE_3)
+# define MITK_PP_NODE_1(p) MITK_PP_IIF(p##(1), 1, 2)
+# define MITK_PP_NODE_3(p) MITK_PP_IIF(p##(3), 3, 4)
+# define MITK_PP_NODE_6(p) MITK_PP_IIF(p##(6), MITK_PP_NODE_5, MITK_PP_NODE_7)
+# define MITK_PP_NODE_5(p) MITK_PP_IIF(p##(5), 5, 6)
+# define MITK_PP_NODE_7(p) MITK_PP_IIF(p##(7), 7, 8)
+# define MITK_PP_NODE_12(p) MITK_PP_IIF(p##(12), MITK_PP_NODE_10, MITK_PP_NODE_14)
+# define MITK_PP_NODE_10(p) MITK_PP_IIF(p##(10), MITK_PP_NODE_9, MITK_PP_NODE_11)
+# define MITK_PP_NODE_9(p) MITK_PP_IIF(p##(9), 9, 10)
+# define MITK_PP_NODE_11(p) MITK_PP_IIF(p##(11), 11, 12)
+# define MITK_PP_NODE_14(p) MITK_PP_IIF(p##(14), MITK_PP_NODE_13, MITK_PP_NODE_15)
+# define MITK_PP_NODE_13(p) MITK_PP_IIF(p##(13), 13, 14)
+# define MITK_PP_NODE_15(p) MITK_PP_IIF(p##(15), 15, 16)
+# define MITK_PP_NODE_24(p) MITK_PP_IIF(p##(24), MITK_PP_NODE_20, MITK_PP_NODE_28)
+# define MITK_PP_NODE_20(p) MITK_PP_IIF(p##(20), MITK_PP_NODE_18, MITK_PP_NODE_22)
+# define MITK_PP_NODE_18(p) MITK_PP_IIF(p##(18), MITK_PP_NODE_17, MITK_PP_NODE_19)
+# define MITK_PP_NODE_17(p) MITK_PP_IIF(p##(17), 17, 18)
+# define MITK_PP_NODE_19(p) MITK_PP_IIF(p##(19), 19, 20)
+# define MITK_PP_NODE_22(p) MITK_PP_IIF(p##(22), MITK_PP_NODE_21, MITK_PP_NODE_23)
+# define MITK_PP_NODE_21(p) MITK_PP_IIF(p##(21), 21, 22)
+# define MITK_PP_NODE_23(p) MITK_PP_IIF(p##(23), 23, 24)
+# define MITK_PP_NODE_28(p) MITK_PP_IIF(p##(28), MITK_PP_NODE_26, MITK_PP_NODE_30)
+# define MITK_PP_NODE_26(p) MITK_PP_IIF(p##(26), MITK_PP_NODE_25, MITK_PP_NODE_27)
+# define MITK_PP_NODE_25(p) MITK_PP_IIF(p##(25), 25, 26)
+# define MITK_PP_NODE_27(p) MITK_PP_IIF(p##(27), 27, 28)
+# define MITK_PP_NODE_30(p) MITK_PP_IIF(p##(30), MITK_PP_NODE_29, MITK_PP_NODE_31)
+# define MITK_PP_NODE_29(p) MITK_PP_IIF(p##(29), 29, 30)
+# define MITK_PP_NODE_31(p) MITK_PP_IIF(p##(31), 31, 32)
+# define MITK_PP_NODE_48(p) MITK_PP_IIF(p##(48), MITK_PP_NODE_40, MITK_PP_NODE_56)
+# define MITK_PP_NODE_40(p) MITK_PP_IIF(p##(40), MITK_PP_NODE_36, MITK_PP_NODE_44)
+# define MITK_PP_NODE_36(p) MITK_PP_IIF(p##(36), MITK_PP_NODE_34, MITK_PP_NODE_38)
+# define MITK_PP_NODE_34(p) MITK_PP_IIF(p##(34), MITK_PP_NODE_33, MITK_PP_NODE_35)
+# define MITK_PP_NODE_33(p) MITK_PP_IIF(p##(33), 33, 34)
+# define MITK_PP_NODE_35(p) MITK_PP_IIF(p##(35), 35, 36)
+# define MITK_PP_NODE_38(p) MITK_PP_IIF(p##(38), MITK_PP_NODE_37, MITK_PP_NODE_39)
+# define MITK_PP_NODE_37(p) MITK_PP_IIF(p##(37), 37, 38)
+# define MITK_PP_NODE_39(p) MITK_PP_IIF(p##(39), 39, 40)
+# define MITK_PP_NODE_44(p) MITK_PP_IIF(p##(44), MITK_PP_NODE_42, MITK_PP_NODE_46)
+# define MITK_PP_NODE_42(p) MITK_PP_IIF(p##(42), MITK_PP_NODE_41, MITK_PP_NODE_43)
+# define MITK_PP_NODE_41(p) MITK_PP_IIF(p##(41), 41, 42)
+# define MITK_PP_NODE_43(p) MITK_PP_IIF(p##(43), 43, 44)
+# define MITK_PP_NODE_46(p) MITK_PP_IIF(p##(46), MITK_PP_NODE_45, MITK_PP_NODE_47)
+# define MITK_PP_NODE_45(p) MITK_PP_IIF(p##(45), 45, 46)
+# define MITK_PP_NODE_47(p) MITK_PP_IIF(p##(47), 47, 48)
+# define MITK_PP_NODE_56(p) MITK_PP_IIF(p##(56), MITK_PP_NODE_52, MITK_PP_NODE_60)
+# define MITK_PP_NODE_52(p) MITK_PP_IIF(p##(52), MITK_PP_NODE_50, MITK_PP_NODE_54)
+# define MITK_PP_NODE_50(p) MITK_PP_IIF(p##(50), MITK_PP_NODE_49, MITK_PP_NODE_51)
+# define MITK_PP_NODE_49(p) MITK_PP_IIF(p##(49), 49, 50)
+# define MITK_PP_NODE_51(p) MITK_PP_IIF(p##(51), 51, 52)
+# define MITK_PP_NODE_54(p) MITK_PP_IIF(p##(54), MITK_PP_NODE_53, MITK_PP_NODE_55)
+# define MITK_PP_NODE_53(p) MITK_PP_IIF(p##(53), 53, 54)
+# define MITK_PP_NODE_55(p) MITK_PP_IIF(p##(55), 55, 56)
+# define MITK_PP_NODE_60(p) MITK_PP_IIF(p##(60), MITK_PP_NODE_58, MITK_PP_NODE_62)
+# define MITK_PP_NODE_58(p) MITK_PP_IIF(p##(58), MITK_PP_NODE_57, MITK_PP_NODE_59)
+# define MITK_PP_NODE_57(p) MITK_PP_IIF(p##(57), 57, 58)
+# define MITK_PP_NODE_59(p) MITK_PP_IIF(p##(59), 59, 60)
+# define MITK_PP_NODE_62(p) MITK_PP_IIF(p##(62), MITK_PP_NODE_61, MITK_PP_NODE_63)
+# define MITK_PP_NODE_61(p) MITK_PP_IIF(p##(61), 61, 62)
+# define MITK_PP_NODE_63(p) MITK_PP_IIF(p##(63), 63, 64)
+# define MITK_PP_NODE_96(p) MITK_PP_IIF(p##(96), MITK_PP_NODE_80, MITK_PP_NODE_112)
+# define MITK_PP_NODE_80(p) MITK_PP_IIF(p##(80), MITK_PP_NODE_72, MITK_PP_NODE_88)
+# define MITK_PP_NODE_72(p) MITK_PP_IIF(p##(72), MITK_PP_NODE_68, MITK_PP_NODE_76)
+# define MITK_PP_NODE_68(p) MITK_PP_IIF(p##(68), MITK_PP_NODE_66, MITK_PP_NODE_70)
+# define MITK_PP_NODE_66(p) MITK_PP_IIF(p##(66), MITK_PP_NODE_65, MITK_PP_NODE_67)
+# define MITK_PP_NODE_65(p) MITK_PP_IIF(p##(65), 65, 66)
+# define MITK_PP_NODE_67(p) MITK_PP_IIF(p##(67), 67, 68)
+# define MITK_PP_NODE_70(p) MITK_PP_IIF(p##(70), MITK_PP_NODE_69, MITK_PP_NODE_71)
+# define MITK_PP_NODE_69(p) MITK_PP_IIF(p##(69), 69, 70)
+# define MITK_PP_NODE_71(p) MITK_PP_IIF(p##(71), 71, 72)
+# define MITK_PP_NODE_76(p) MITK_PP_IIF(p##(76), MITK_PP_NODE_74, MITK_PP_NODE_78)
+# define MITK_PP_NODE_74(p) MITK_PP_IIF(p##(74), MITK_PP_NODE_73, MITK_PP_NODE_75)
+# define MITK_PP_NODE_73(p) MITK_PP_IIF(p##(73), 73, 74)
+# define MITK_PP_NODE_75(p) MITK_PP_IIF(p##(75), 75, 76)
+# define MITK_PP_NODE_78(p) MITK_PP_IIF(p##(78), MITK_PP_NODE_77, MITK_PP_NODE_79)
+# define MITK_PP_NODE_77(p) MITK_PP_IIF(p##(77), 77, 78)
+# define MITK_PP_NODE_79(p) MITK_PP_IIF(p##(79), 79, 80)
+# define MITK_PP_NODE_88(p) MITK_PP_IIF(p##(88), MITK_PP_NODE_84, MITK_PP_NODE_92)
+# define MITK_PP_NODE_84(p) MITK_PP_IIF(p##(84), MITK_PP_NODE_82, MITK_PP_NODE_86)
+# define MITK_PP_NODE_82(p) MITK_PP_IIF(p##(82), MITK_PP_NODE_81, MITK_PP_NODE_83)
+# define MITK_PP_NODE_81(p) MITK_PP_IIF(p##(81), 81, 82)
+# define MITK_PP_NODE_83(p) MITK_PP_IIF(p##(83), 83, 84)
+# define MITK_PP_NODE_86(p) MITK_PP_IIF(p##(86), MITK_PP_NODE_85, MITK_PP_NODE_87)
+# define MITK_PP_NODE_85(p) MITK_PP_IIF(p##(85), 85, 86)
+# define MITK_PP_NODE_87(p) MITK_PP_IIF(p##(87), 87, 88)
+# define MITK_PP_NODE_92(p) MITK_PP_IIF(p##(92), MITK_PP_NODE_90, MITK_PP_NODE_94)
+# define MITK_PP_NODE_90(p) MITK_PP_IIF(p##(90), MITK_PP_NODE_89, MITK_PP_NODE_91)
+# define MITK_PP_NODE_89(p) MITK_PP_IIF(p##(89), 89, 90)
+# define MITK_PP_NODE_91(p) MITK_PP_IIF(p##(91), 91, 92)
+# define MITK_PP_NODE_94(p) MITK_PP_IIF(p##(94), MITK_PP_NODE_93, MITK_PP_NODE_95)
+# define MITK_PP_NODE_93(p) MITK_PP_IIF(p##(93), 93, 94)
+# define MITK_PP_NODE_95(p) MITK_PP_IIF(p##(95), 95, 96)
+# define MITK_PP_NODE_112(p) MITK_PP_IIF(p##(112), MITK_PP_NODE_104, MITK_PP_NODE_120)
+# define MITK_PP_NODE_104(p) MITK_PP_IIF(p##(104), MITK_PP_NODE_100, MITK_PP_NODE_108)
+# define MITK_PP_NODE_100(p) MITK_PP_IIF(p##(100), MITK_PP_NODE_98, MITK_PP_NODE_102)
+# define MITK_PP_NODE_98(p) MITK_PP_IIF(p##(98), MITK_PP_NODE_97, MITK_PP_NODE_99)
+# define MITK_PP_NODE_97(p) MITK_PP_IIF(p##(97), 97, 98)
+# define MITK_PP_NODE_99(p) MITK_PP_IIF(p##(99), 99, 100)
+# define MITK_PP_NODE_102(p) MITK_PP_IIF(p##(102), MITK_PP_NODE_101, MITK_PP_NODE_103)
+# define MITK_PP_NODE_101(p) MITK_PP_IIF(p##(101), 101, 102)
+# define MITK_PP_NODE_103(p) MITK_PP_IIF(p##(103), 103, 104)
+# define MITK_PP_NODE_108(p) MITK_PP_IIF(p##(108), MITK_PP_NODE_106, MITK_PP_NODE_110)
+# define MITK_PP_NODE_106(p) MITK_PP_IIF(p##(106), MITK_PP_NODE_105, MITK_PP_NODE_107)
+# define MITK_PP_NODE_105(p) MITK_PP_IIF(p##(105), 105, 106)
+# define MITK_PP_NODE_107(p) MITK_PP_IIF(p##(107), 107, 108)
+# define MITK_PP_NODE_110(p) MITK_PP_IIF(p##(110), MITK_PP_NODE_109, MITK_PP_NODE_111)
+# define MITK_PP_NODE_109(p) MITK_PP_IIF(p##(109), 109, 110)
+# define MITK_PP_NODE_111(p) MITK_PP_IIF(p##(111), 111, 112)
+# define MITK_PP_NODE_120(p) MITK_PP_IIF(p##(120), MITK_PP_NODE_116, MITK_PP_NODE_124)
+# define MITK_PP_NODE_116(p) MITK_PP_IIF(p##(116), MITK_PP_NODE_114, MITK_PP_NODE_118)
+# define MITK_PP_NODE_114(p) MITK_PP_IIF(p##(114), MITK_PP_NODE_113, MITK_PP_NODE_115)
+# define MITK_PP_NODE_113(p) MITK_PP_IIF(p##(113), 113, 114)
+# define MITK_PP_NODE_115(p) MITK_PP_IIF(p##(115), 115, 116)
+# define MITK_PP_NODE_118(p) MITK_PP_IIF(p##(118), MITK_PP_NODE_117, MITK_PP_NODE_119)
+# define MITK_PP_NODE_117(p) MITK_PP_IIF(p##(117), 117, 118)
+# define MITK_PP_NODE_119(p) MITK_PP_IIF(p##(119), 119, 120)
+# define MITK_PP_NODE_124(p) MITK_PP_IIF(p##(124), MITK_PP_NODE_122, MITK_PP_NODE_126)
+# define MITK_PP_NODE_122(p) MITK_PP_IIF(p##(122), MITK_PP_NODE_121, MITK_PP_NODE_123)
+# define MITK_PP_NODE_121(p) MITK_PP_IIF(p##(121), 121, 122)
+# define MITK_PP_NODE_123(p) MITK_PP_IIF(p##(123), 123, 124)
+# define MITK_PP_NODE_126(p) MITK_PP_IIF(p##(126), MITK_PP_NODE_125, MITK_PP_NODE_127)
+# define MITK_PP_NODE_125(p) MITK_PP_IIF(p##(125), 125, 126)
+# define MITK_PP_NODE_127(p) MITK_PP_IIF(p##(127), 127, 128)
+# define MITK_PP_NODE_192(p) MITK_PP_IIF(p##(192), MITK_PP_NODE_160, MITK_PP_NODE_224)
+# define MITK_PP_NODE_160(p) MITK_PP_IIF(p##(160), MITK_PP_NODE_144, MITK_PP_NODE_176)
+# define MITK_PP_NODE_144(p) MITK_PP_IIF(p##(144), MITK_PP_NODE_136, MITK_PP_NODE_152)
+# define MITK_PP_NODE_136(p) MITK_PP_IIF(p##(136), MITK_PP_NODE_132, MITK_PP_NODE_140)
+# define MITK_PP_NODE_132(p) MITK_PP_IIF(p##(132), MITK_PP_NODE_130, MITK_PP_NODE_134)
+# define MITK_PP_NODE_130(p) MITK_PP_IIF(p##(130), MITK_PP_NODE_129, MITK_PP_NODE_131)
+# define MITK_PP_NODE_129(p) MITK_PP_IIF(p##(129), 129, 130)
+# define MITK_PP_NODE_131(p) MITK_PP_IIF(p##(131), 131, 132)
+# define MITK_PP_NODE_134(p) MITK_PP_IIF(p##(134), MITK_PP_NODE_133, MITK_PP_NODE_135)
+# define MITK_PP_NODE_133(p) MITK_PP_IIF(p##(133), 133, 134)
+# define MITK_PP_NODE_135(p) MITK_PP_IIF(p##(135), 135, 136)
+# define MITK_PP_NODE_140(p) MITK_PP_IIF(p##(140), MITK_PP_NODE_138, MITK_PP_NODE_142)
+# define MITK_PP_NODE_138(p) MITK_PP_IIF(p##(138), MITK_PP_NODE_137, MITK_PP_NODE_139)
+# define MITK_PP_NODE_137(p) MITK_PP_IIF(p##(137), 137, 138)
+# define MITK_PP_NODE_139(p) MITK_PP_IIF(p##(139), 139, 140)
+# define MITK_PP_NODE_142(p) MITK_PP_IIF(p##(142), MITK_PP_NODE_141, MITK_PP_NODE_143)
+# define MITK_PP_NODE_141(p) MITK_PP_IIF(p##(141), 141, 142)
+# define MITK_PP_NODE_143(p) MITK_PP_IIF(p##(143), 143, 144)
+# define MITK_PP_NODE_152(p) MITK_PP_IIF(p##(152), MITK_PP_NODE_148, MITK_PP_NODE_156)
+# define MITK_PP_NODE_148(p) MITK_PP_IIF(p##(148), MITK_PP_NODE_146, MITK_PP_NODE_150)
+# define MITK_PP_NODE_146(p) MITK_PP_IIF(p##(146), MITK_PP_NODE_145, MITK_PP_NODE_147)
+# define MITK_PP_NODE_145(p) MITK_PP_IIF(p##(145), 145, 146)
+# define MITK_PP_NODE_147(p) MITK_PP_IIF(p##(147), 147, 148)
+# define MITK_PP_NODE_150(p) MITK_PP_IIF(p##(150), MITK_PP_NODE_149, MITK_PP_NODE_151)
+# define MITK_PP_NODE_149(p) MITK_PP_IIF(p##(149), 149, 150)
+# define MITK_PP_NODE_151(p) MITK_PP_IIF(p##(151), 151, 152)
+# define MITK_PP_NODE_156(p) MITK_PP_IIF(p##(156), MITK_PP_NODE_154, MITK_PP_NODE_158)
+# define MITK_PP_NODE_154(p) MITK_PP_IIF(p##(154), MITK_PP_NODE_153, MITK_PP_NODE_155)
+# define MITK_PP_NODE_153(p) MITK_PP_IIF(p##(153), 153, 154)
+# define MITK_PP_NODE_155(p) MITK_PP_IIF(p##(155), 155, 156)
+# define MITK_PP_NODE_158(p) MITK_PP_IIF(p##(158), MITK_PP_NODE_157, MITK_PP_NODE_159)
+# define MITK_PP_NODE_157(p) MITK_PP_IIF(p##(157), 157, 158)
+# define MITK_PP_NODE_159(p) MITK_PP_IIF(p##(159), 159, 160)
+# define MITK_PP_NODE_176(p) MITK_PP_IIF(p##(176), MITK_PP_NODE_168, MITK_PP_NODE_184)
+# define MITK_PP_NODE_168(p) MITK_PP_IIF(p##(168), MITK_PP_NODE_164, MITK_PP_NODE_172)
+# define MITK_PP_NODE_164(p) MITK_PP_IIF(p##(164), MITK_PP_NODE_162, MITK_PP_NODE_166)
+# define MITK_PP_NODE_162(p) MITK_PP_IIF(p##(162), MITK_PP_NODE_161, MITK_PP_NODE_163)
+# define MITK_PP_NODE_161(p) MITK_PP_IIF(p##(161), 161, 162)
+# define MITK_PP_NODE_163(p) MITK_PP_IIF(p##(163), 163, 164)
+# define MITK_PP_NODE_166(p) MITK_PP_IIF(p##(166), MITK_PP_NODE_165, MITK_PP_NODE_167)
+# define MITK_PP_NODE_165(p) MITK_PP_IIF(p##(165), 165, 166)
+# define MITK_PP_NODE_167(p) MITK_PP_IIF(p##(167), 167, 168)
+# define MITK_PP_NODE_172(p) MITK_PP_IIF(p##(172), MITK_PP_NODE_170, MITK_PP_NODE_174)
+# define MITK_PP_NODE_170(p) MITK_PP_IIF(p##(170), MITK_PP_NODE_169, MITK_PP_NODE_171)
+# define MITK_PP_NODE_169(p) MITK_PP_IIF(p##(169), 169, 170)
+# define MITK_PP_NODE_171(p) MITK_PP_IIF(p##(171), 171, 172)
+# define MITK_PP_NODE_174(p) MITK_PP_IIF(p##(174), MITK_PP_NODE_173, MITK_PP_NODE_175)
+# define MITK_PP_NODE_173(p) MITK_PP_IIF(p##(173), 173, 174)
+# define MITK_PP_NODE_175(p) MITK_PP_IIF(p##(175), 175, 176)
+# define MITK_PP_NODE_184(p) MITK_PP_IIF(p##(184), MITK_PP_NODE_180, MITK_PP_NODE_188)
+# define MITK_PP_NODE_180(p) MITK_PP_IIF(p##(180), MITK_PP_NODE_178, MITK_PP_NODE_182)
+# define MITK_PP_NODE_178(p) MITK_PP_IIF(p##(178), MITK_PP_NODE_177, MITK_PP_NODE_179)
+# define MITK_PP_NODE_177(p) MITK_PP_IIF(p##(177), 177, 178)
+# define MITK_PP_NODE_179(p) MITK_PP_IIF(p##(179), 179, 180)
+# define MITK_PP_NODE_182(p) MITK_PP_IIF(p##(182), MITK_PP_NODE_181, MITK_PP_NODE_183)
+# define MITK_PP_NODE_181(p) MITK_PP_IIF(p##(181), 181, 182)
+# define MITK_PP_NODE_183(p) MITK_PP_IIF(p##(183), 183, 184)
+# define MITK_PP_NODE_188(p) MITK_PP_IIF(p##(188), MITK_PP_NODE_186, MITK_PP_NODE_190)
+# define MITK_PP_NODE_186(p) MITK_PP_IIF(p##(186), MITK_PP_NODE_185, MITK_PP_NODE_187)
+# define MITK_PP_NODE_185(p) MITK_PP_IIF(p##(185), 185, 186)
+# define MITK_PP_NODE_187(p) MITK_PP_IIF(p##(187), 187, 188)
+# define MITK_PP_NODE_190(p) MITK_PP_IIF(p##(190), MITK_PP_NODE_189, MITK_PP_NODE_191)
+# define MITK_PP_NODE_189(p) MITK_PP_IIF(p##(189), 189, 190)
+# define MITK_PP_NODE_191(p) MITK_PP_IIF(p##(191), 191, 192)
+# define MITK_PP_NODE_224(p) MITK_PP_IIF(p##(224), MITK_PP_NODE_208, MITK_PP_NODE_240)
+# define MITK_PP_NODE_208(p) MITK_PP_IIF(p##(208), MITK_PP_NODE_200, MITK_PP_NODE_216)
+# define MITK_PP_NODE_200(p) MITK_PP_IIF(p##(200), MITK_PP_NODE_196, MITK_PP_NODE_204)
+# define MITK_PP_NODE_196(p) MITK_PP_IIF(p##(196), MITK_PP_NODE_194, MITK_PP_NODE_198)
+# define MITK_PP_NODE_194(p) MITK_PP_IIF(p##(194), MITK_PP_NODE_193, MITK_PP_NODE_195)
+# define MITK_PP_NODE_193(p) MITK_PP_IIF(p##(193), 193, 194)
+# define MITK_PP_NODE_195(p) MITK_PP_IIF(p##(195), 195, 196)
+# define MITK_PP_NODE_198(p) MITK_PP_IIF(p##(198), MITK_PP_NODE_197, MITK_PP_NODE_199)
+# define MITK_PP_NODE_197(p) MITK_PP_IIF(p##(197), 197, 198)
+# define MITK_PP_NODE_199(p) MITK_PP_IIF(p##(199), 199, 200)
+# define MITK_PP_NODE_204(p) MITK_PP_IIF(p##(204), MITK_PP_NODE_202, MITK_PP_NODE_206)
+# define MITK_PP_NODE_202(p) MITK_PP_IIF(p##(202), MITK_PP_NODE_201, MITK_PP_NODE_203)
+# define MITK_PP_NODE_201(p) MITK_PP_IIF(p##(201), 201, 202)
+# define MITK_PP_NODE_203(p) MITK_PP_IIF(p##(203), 203, 204)
+# define MITK_PP_NODE_206(p) MITK_PP_IIF(p##(206), MITK_PP_NODE_205, MITK_PP_NODE_207)
+# define MITK_PP_NODE_205(p) MITK_PP_IIF(p##(205), 205, 206)
+# define MITK_PP_NODE_207(p) MITK_PP_IIF(p##(207), 207, 208)
+# define MITK_PP_NODE_216(p) MITK_PP_IIF(p##(216), MITK_PP_NODE_212, MITK_PP_NODE_220)
+# define MITK_PP_NODE_212(p) MITK_PP_IIF(p##(212), MITK_PP_NODE_210, MITK_PP_NODE_214)
+# define MITK_PP_NODE_210(p) MITK_PP_IIF(p##(210), MITK_PP_NODE_209, MITK_PP_NODE_211)
+# define MITK_PP_NODE_209(p) MITK_PP_IIF(p##(209), 209, 210)
+# define MITK_PP_NODE_211(p) MITK_PP_IIF(p##(211), 211, 212)
+# define MITK_PP_NODE_214(p) MITK_PP_IIF(p##(214), MITK_PP_NODE_213, MITK_PP_NODE_215)
+# define MITK_PP_NODE_213(p) MITK_PP_IIF(p##(213), 213, 214)
+# define MITK_PP_NODE_215(p) MITK_PP_IIF(p##(215), 215, 216)
+# define MITK_PP_NODE_220(p) MITK_PP_IIF(p##(220), MITK_PP_NODE_218, MITK_PP_NODE_222)
+# define MITK_PP_NODE_218(p) MITK_PP_IIF(p##(218), MITK_PP_NODE_217, MITK_PP_NODE_219)
+# define MITK_PP_NODE_217(p) MITK_PP_IIF(p##(217), 217, 218)
+# define MITK_PP_NODE_219(p) MITK_PP_IIF(p##(219), 219, 220)
+# define MITK_PP_NODE_222(p) MITK_PP_IIF(p##(222), MITK_PP_NODE_221, MITK_PP_NODE_223)
+# define MITK_PP_NODE_221(p) MITK_PP_IIF(p##(221), 221, 222)
+# define MITK_PP_NODE_223(p) MITK_PP_IIF(p##(223), 223, 224)
+# define MITK_PP_NODE_240(p) MITK_PP_IIF(p##(240), MITK_PP_NODE_232, MITK_PP_NODE_248)
+# define MITK_PP_NODE_232(p) MITK_PP_IIF(p##(232), MITK_PP_NODE_228, MITK_PP_NODE_236)
+# define MITK_PP_NODE_228(p) MITK_PP_IIF(p##(228), MITK_PP_NODE_226, MITK_PP_NODE_230)
+# define MITK_PP_NODE_226(p) MITK_PP_IIF(p##(226), MITK_PP_NODE_225, MITK_PP_NODE_227)
+# define MITK_PP_NODE_225(p) MITK_PP_IIF(p##(225), 225, 226)
+# define MITK_PP_NODE_227(p) MITK_PP_IIF(p##(227), 227, 228)
+# define MITK_PP_NODE_230(p) MITK_PP_IIF(p##(230), MITK_PP_NODE_229, MITK_PP_NODE_231)
+# define MITK_PP_NODE_229(p) MITK_PP_IIF(p##(229), 229, 230)
+# define MITK_PP_NODE_231(p) MITK_PP_IIF(p##(231), 231, 232)
+# define MITK_PP_NODE_236(p) MITK_PP_IIF(p##(236), MITK_PP_NODE_234, MITK_PP_NODE_238)
+# define MITK_PP_NODE_234(p) MITK_PP_IIF(p##(234), MITK_PP_NODE_233, MITK_PP_NODE_235)
+# define MITK_PP_NODE_233(p) MITK_PP_IIF(p##(233), 233, 234)
+# define MITK_PP_NODE_235(p) MITK_PP_IIF(p##(235), 235, 236)
+# define MITK_PP_NODE_238(p) MITK_PP_IIF(p##(238), MITK_PP_NODE_237, MITK_PP_NODE_239)
+# define MITK_PP_NODE_237(p) MITK_PP_IIF(p##(237), 237, 238)
+# define MITK_PP_NODE_239(p) MITK_PP_IIF(p##(239), 239, 240)
+# define MITK_PP_NODE_248(p) MITK_PP_IIF(p##(248), MITK_PP_NODE_244, MITK_PP_NODE_252)
+# define MITK_PP_NODE_244(p) MITK_PP_IIF(p##(244), MITK_PP_NODE_242, MITK_PP_NODE_246)
+# define MITK_PP_NODE_242(p) MITK_PP_IIF(p##(242), MITK_PP_NODE_241, MITK_PP_NODE_243)
+# define MITK_PP_NODE_241(p) MITK_PP_IIF(p##(241), 241, 242)
+# define MITK_PP_NODE_243(p) MITK_PP_IIF(p##(243), 243, 244)
+# define MITK_PP_NODE_246(p) MITK_PP_IIF(p##(246), MITK_PP_NODE_245, MITK_PP_NODE_247)
+# define MITK_PP_NODE_245(p) MITK_PP_IIF(p##(245), 245, 246)
+# define MITK_PP_NODE_247(p) MITK_PP_IIF(p##(247), 247, 248)
+# define MITK_PP_NODE_252(p) MITK_PP_IIF(p##(252), MITK_PP_NODE_250, MITK_PP_NODE_254)
+# define MITK_PP_NODE_250(p) MITK_PP_IIF(p##(250), MITK_PP_NODE_249, MITK_PP_NODE_251)
+# define MITK_PP_NODE_249(p) MITK_PP_IIF(p##(249), 249, 250)
+# define MITK_PP_NODE_251(p) MITK_PP_IIF(p##(251), 251, 252)
+# define MITK_PP_NODE_254(p) MITK_PP_IIF(p##(254), MITK_PP_NODE_253, MITK_PP_NODE_255)
+# define MITK_PP_NODE_253(p) MITK_PP_IIF(p##(253), 253, 254)
+# define MITK_PP_NODE_255(p) MITK_PP_IIF(p##(255), 255, 256)
+#
+# endif
diff --git a/Core/Code/Algorithms/mitkPPExpand.h b/Core/Code/Algorithms/mitkPPExpand.h
new file mode 100644
index 0000000000..3d05a298b8
--- /dev/null
+++ b/Core/Code/Algorithms/mitkPPExpand.h
@@ -0,0 +1,17 @@
+# /* **************************************************************************
+# * *
+# * (C) Copyright Paul Mensonides 2002.
+# * Distributed under the Boost Software License, Version 1.0. (See
+# * accompanying file LICENSE_1_0.txt or copy at
+# * http://www.boost.org/LICENSE_1_0.txt)
+# * *
+# ************************************************************************** */
+#
+# /* See http://www.boost.org for most recent version. */
+#
+# ifndef MITK_PREPROCESSOR_EXPAND_HPP
+# define MITK_PREPROCESSOR_EXPAND_HPP
+#
+# include "mitkPPFacilitiesExpand.h"
+#
+# endif
diff --git a/Core/Code/Algorithms/mitkPPFacilitiesEmpty.h b/Core/Code/Algorithms/mitkPPFacilitiesEmpty.h
new file mode 100644
index 0000000000..3cb10588ce
--- /dev/null
+++ b/Core/Code/Algorithms/mitkPPFacilitiesEmpty.h
@@ -0,0 +1,21 @@
+# /* Copyright (C) 2001
+# * Housemarque Oy
+# * http://www.housemarque.com
+# *
+# * Distributed under the Boost Software License, Version 1.0. (See
+# * accompanying file LICENSE_1_0.txt or copy at
+# * http://www.boost.org/LICENSE_1_0.txt)
+# */
+#
+# /* Revised by Paul Mensonides (2002) */
+#
+# /* See http://www.boost.org for most recent version. */
+#
+# ifndef MITK_PREPROCESSOR_FACILITIES_EMPTY_HPP
+# define MITK_PREPROCESSOR_FACILITIES_EMPTY_HPP
+#
+# /* MITK_PP_EMPTY */
+#
+# define MITK_PP_EMPTY()
+#
+# endif
diff --git a/Core/Code/Algorithms/mitkPPFacilitiesExpand.h b/Core/Code/Algorithms/mitkPPFacilitiesExpand.h
new file mode 100644
index 0000000000..f6f128160f
--- /dev/null
+++ b/Core/Code/Algorithms/mitkPPFacilitiesExpand.h
@@ -0,0 +1,28 @@
+# /* Copyright (C) 2001
+# * Housemarque Oy
+# * http://www.housemarque.com
+# *
+# * Distributed under the Boost Software License, Version 1.0. (See
+# * accompanying file LICENSE_1_0.txt or copy at
+# * http://www.boost.org/LICENSE_1_0.txt)
+# */
+#
+# /* Revised by Paul Mensonides (2002) */
+#
+# /* See http://www.boost.org for most recent version. */
+#
+# ifndef MITK_PREPROCESSOR_FACILITIES_EXPAND_HPP
+# define MITK_PREPROCESSOR_FACILITIES_EXPAND_HPP
+#
+# include "mitkPPConfig.h"
+#
+# if ~MITK_PP_CONFIG_FLAGS() & MITK_PP_CONFIG_MWCC() && ~MITK_PP_CONFIG_FLAGS() & MITK_PP_CONFIG_DMC()
+# define MITK_PP_EXPAND(x) MITK_PP_EXPAND_I(x)
+# else
+# define MITK_PP_EXPAND(x) MITK_PP_EXPAND_OO((x))
+# define MITK_PP_EXPAND_OO(par) MITK_PP_EXPAND_I ## par
+# endif
+#
+# define MITK_PP_EXPAND_I(x) x
+#
+# endif
diff --git a/Core/Code/Algorithms/mitkPPLogicalBool.h b/Core/Code/Algorithms/mitkPPLogicalBool.h
new file mode 100644
index 0000000000..c69e4ae4f9
--- /dev/null
+++ b/Core/Code/Algorithms/mitkPPLogicalBool.h
@@ -0,0 +1,288 @@
+# /* Copyright (C) 2001
+# * Housemarque Oy
+# * http://www.housemarque.com
+# *
+# * Distributed under the Boost Software License, Version 1.0. (See
+# * accompanying file LICENSE_1_0.txt or copy at
+# * http://www.boost.org/LICENSE_1_0.txt)
+# */
+#
+# /* Revised by Paul Mensonides (2002) */
+#
+# /* See http://www.boost.org for most recent version. */
+#
+# ifndef MITK_PREPROCESSOR_LOGICAL_BOOL_HPP
+# define MITK_PREPROCESSOR_LOGICAL_BOOL_HPP
+#
+# include "mitkPPConfig.h"
+#
+# /* MITK_PP_BOOL */
+#
+# if ~MITK_PP_CONFIG_FLAGS() & MITK_PP_CONFIG_MWCC()
+# define MITK_PP_BOOL(x) MITK_PP_BOOL_I(x)
+# else
+# define MITK_PP_BOOL(x) MITK_PP_BOOL_OO((x))
+# define MITK_PP_BOOL_OO(par) MITK_PP_BOOL_I ## par
+# endif
+#
+# define MITK_PP_BOOL_I(x) MITK_PP_BOOL_ ## x
+#
+# define MITK_PP_BOOL_0 0
+# define MITK_PP_BOOL_1 1
+# define MITK_PP_BOOL_2 1
+# define MITK_PP_BOOL_3 1
+# define MITK_PP_BOOL_4 1
+# define MITK_PP_BOOL_5 1
+# define MITK_PP_BOOL_6 1
+# define MITK_PP_BOOL_7 1
+# define MITK_PP_BOOL_8 1
+# define MITK_PP_BOOL_9 1
+# define MITK_PP_BOOL_10 1
+# define MITK_PP_BOOL_11 1
+# define MITK_PP_BOOL_12 1
+# define MITK_PP_BOOL_13 1
+# define MITK_PP_BOOL_14 1
+# define MITK_PP_BOOL_15 1
+# define MITK_PP_BOOL_16 1
+# define MITK_PP_BOOL_17 1
+# define MITK_PP_BOOL_18 1
+# define MITK_PP_BOOL_19 1
+# define MITK_PP_BOOL_20 1
+# define MITK_PP_BOOL_21 1
+# define MITK_PP_BOOL_22 1
+# define MITK_PP_BOOL_23 1
+# define MITK_PP_BOOL_24 1
+# define MITK_PP_BOOL_25 1
+# define MITK_PP_BOOL_26 1
+# define MITK_PP_BOOL_27 1
+# define MITK_PP_BOOL_28 1
+# define MITK_PP_BOOL_29 1
+# define MITK_PP_BOOL_30 1
+# define MITK_PP_BOOL_31 1
+# define MITK_PP_BOOL_32 1
+# define MITK_PP_BOOL_33 1
+# define MITK_PP_BOOL_34 1
+# define MITK_PP_BOOL_35 1
+# define MITK_PP_BOOL_36 1
+# define MITK_PP_BOOL_37 1
+# define MITK_PP_BOOL_38 1
+# define MITK_PP_BOOL_39 1
+# define MITK_PP_BOOL_40 1
+# define MITK_PP_BOOL_41 1
+# define MITK_PP_BOOL_42 1
+# define MITK_PP_BOOL_43 1
+# define MITK_PP_BOOL_44 1
+# define MITK_PP_BOOL_45 1
+# define MITK_PP_BOOL_46 1
+# define MITK_PP_BOOL_47 1
+# define MITK_PP_BOOL_48 1
+# define MITK_PP_BOOL_49 1
+# define MITK_PP_BOOL_50 1
+# define MITK_PP_BOOL_51 1
+# define MITK_PP_BOOL_52 1
+# define MITK_PP_BOOL_53 1
+# define MITK_PP_BOOL_54 1
+# define MITK_PP_BOOL_55 1
+# define MITK_PP_BOOL_56 1
+# define MITK_PP_BOOL_57 1
+# define MITK_PP_BOOL_58 1
+# define MITK_PP_BOOL_59 1
+# define MITK_PP_BOOL_60 1
+# define MITK_PP_BOOL_61 1
+# define MITK_PP_BOOL_62 1
+# define MITK_PP_BOOL_63 1
+# define MITK_PP_BOOL_64 1
+# define MITK_PP_BOOL_65 1
+# define MITK_PP_BOOL_66 1
+# define MITK_PP_BOOL_67 1
+# define MITK_PP_BOOL_68 1
+# define MITK_PP_BOOL_69 1
+# define MITK_PP_BOOL_70 1
+# define MITK_PP_BOOL_71 1
+# define MITK_PP_BOOL_72 1
+# define MITK_PP_BOOL_73 1
+# define MITK_PP_BOOL_74 1
+# define MITK_PP_BOOL_75 1
+# define MITK_PP_BOOL_76 1
+# define MITK_PP_BOOL_77 1
+# define MITK_PP_BOOL_78 1
+# define MITK_PP_BOOL_79 1
+# define MITK_PP_BOOL_80 1
+# define MITK_PP_BOOL_81 1
+# define MITK_PP_BOOL_82 1
+# define MITK_PP_BOOL_83 1
+# define MITK_PP_BOOL_84 1
+# define MITK_PP_BOOL_85 1
+# define MITK_PP_BOOL_86 1
+# define MITK_PP_BOOL_87 1
+# define MITK_PP_BOOL_88 1
+# define MITK_PP_BOOL_89 1
+# define MITK_PP_BOOL_90 1
+# define MITK_PP_BOOL_91 1
+# define MITK_PP_BOOL_92 1
+# define MITK_PP_BOOL_93 1
+# define MITK_PP_BOOL_94 1
+# define MITK_PP_BOOL_95 1
+# define MITK_PP_BOOL_96 1
+# define MITK_PP_BOOL_97 1
+# define MITK_PP_BOOL_98 1
+# define MITK_PP_BOOL_99 1
+# define MITK_PP_BOOL_100 1
+# define MITK_PP_BOOL_101 1
+# define MITK_PP_BOOL_102 1
+# define MITK_PP_BOOL_103 1
+# define MITK_PP_BOOL_104 1
+# define MITK_PP_BOOL_105 1
+# define MITK_PP_BOOL_106 1
+# define MITK_PP_BOOL_107 1
+# define MITK_PP_BOOL_108 1
+# define MITK_PP_BOOL_109 1
+# define MITK_PP_BOOL_110 1
+# define MITK_PP_BOOL_111 1
+# define MITK_PP_BOOL_112 1
+# define MITK_PP_BOOL_113 1
+# define MITK_PP_BOOL_114 1
+# define MITK_PP_BOOL_115 1
+# define MITK_PP_BOOL_116 1
+# define MITK_PP_BOOL_117 1
+# define MITK_PP_BOOL_118 1
+# define MITK_PP_BOOL_119 1
+# define MITK_PP_BOOL_120 1
+# define MITK_PP_BOOL_121 1
+# define MITK_PP_BOOL_122 1
+# define MITK_PP_BOOL_123 1
+# define MITK_PP_BOOL_124 1
+# define MITK_PP_BOOL_125 1
+# define MITK_PP_BOOL_126 1
+# define MITK_PP_BOOL_127 1
+# define MITK_PP_BOOL_128 1
+# define MITK_PP_BOOL_129 1
+# define MITK_PP_BOOL_130 1
+# define MITK_PP_BOOL_131 1
+# define MITK_PP_BOOL_132 1
+# define MITK_PP_BOOL_133 1
+# define MITK_PP_BOOL_134 1
+# define MITK_PP_BOOL_135 1
+# define MITK_PP_BOOL_136 1
+# define MITK_PP_BOOL_137 1
+# define MITK_PP_BOOL_138 1
+# define MITK_PP_BOOL_139 1
+# define MITK_PP_BOOL_140 1
+# define MITK_PP_BOOL_141 1
+# define MITK_PP_BOOL_142 1
+# define MITK_PP_BOOL_143 1
+# define MITK_PP_BOOL_144 1
+# define MITK_PP_BOOL_145 1
+# define MITK_PP_BOOL_146 1
+# define MITK_PP_BOOL_147 1
+# define MITK_PP_BOOL_148 1
+# define MITK_PP_BOOL_149 1
+# define MITK_PP_BOOL_150 1
+# define MITK_PP_BOOL_151 1
+# define MITK_PP_BOOL_152 1
+# define MITK_PP_BOOL_153 1
+# define MITK_PP_BOOL_154 1
+# define MITK_PP_BOOL_155 1
+# define MITK_PP_BOOL_156 1
+# define MITK_PP_BOOL_157 1
+# define MITK_PP_BOOL_158 1
+# define MITK_PP_BOOL_159 1
+# define MITK_PP_BOOL_160 1
+# define MITK_PP_BOOL_161 1
+# define MITK_PP_BOOL_162 1
+# define MITK_PP_BOOL_163 1
+# define MITK_PP_BOOL_164 1
+# define MITK_PP_BOOL_165 1
+# define MITK_PP_BOOL_166 1
+# define MITK_PP_BOOL_167 1
+# define MITK_PP_BOOL_168 1
+# define MITK_PP_BOOL_169 1
+# define MITK_PP_BOOL_170 1
+# define MITK_PP_BOOL_171 1
+# define MITK_PP_BOOL_172 1
+# define MITK_PP_BOOL_173 1
+# define MITK_PP_BOOL_174 1
+# define MITK_PP_BOOL_175 1
+# define MITK_PP_BOOL_176 1
+# define MITK_PP_BOOL_177 1
+# define MITK_PP_BOOL_178 1
+# define MITK_PP_BOOL_179 1
+# define MITK_PP_BOOL_180 1
+# define MITK_PP_BOOL_181 1
+# define MITK_PP_BOOL_182 1
+# define MITK_PP_BOOL_183 1
+# define MITK_PP_BOOL_184 1
+# define MITK_PP_BOOL_185 1
+# define MITK_PP_BOOL_186 1
+# define MITK_PP_BOOL_187 1
+# define MITK_PP_BOOL_188 1
+# define MITK_PP_BOOL_189 1
+# define MITK_PP_BOOL_190 1
+# define MITK_PP_BOOL_191 1
+# define MITK_PP_BOOL_192 1
+# define MITK_PP_BOOL_193 1
+# define MITK_PP_BOOL_194 1
+# define MITK_PP_BOOL_195 1
+# define MITK_PP_BOOL_196 1
+# define MITK_PP_BOOL_197 1
+# define MITK_PP_BOOL_198 1
+# define MITK_PP_BOOL_199 1
+# define MITK_PP_BOOL_200 1
+# define MITK_PP_BOOL_201 1
+# define MITK_PP_BOOL_202 1
+# define MITK_PP_BOOL_203 1
+# define MITK_PP_BOOL_204 1
+# define MITK_PP_BOOL_205 1
+# define MITK_PP_BOOL_206 1
+# define MITK_PP_BOOL_207 1
+# define MITK_PP_BOOL_208 1
+# define MITK_PP_BOOL_209 1
+# define MITK_PP_BOOL_210 1
+# define MITK_PP_BOOL_211 1
+# define MITK_PP_BOOL_212 1
+# define MITK_PP_BOOL_213 1
+# define MITK_PP_BOOL_214 1
+# define MITK_PP_BOOL_215 1
+# define MITK_PP_BOOL_216 1
+# define MITK_PP_BOOL_217 1
+# define MITK_PP_BOOL_218 1
+# define MITK_PP_BOOL_219 1
+# define MITK_PP_BOOL_220 1
+# define MITK_PP_BOOL_221 1
+# define MITK_PP_BOOL_222 1
+# define MITK_PP_BOOL_223 1
+# define MITK_PP_BOOL_224 1
+# define MITK_PP_BOOL_225 1
+# define MITK_PP_BOOL_226 1
+# define MITK_PP_BOOL_227 1
+# define MITK_PP_BOOL_228 1
+# define MITK_PP_BOOL_229 1
+# define MITK_PP_BOOL_230 1
+# define MITK_PP_BOOL_231 1
+# define MITK_PP_BOOL_232 1
+# define MITK_PP_BOOL_233 1
+# define MITK_PP_BOOL_234 1
+# define MITK_PP_BOOL_235 1
+# define MITK_PP_BOOL_236 1
+# define MITK_PP_BOOL_237 1
+# define MITK_PP_BOOL_238 1
+# define MITK_PP_BOOL_239 1
+# define MITK_PP_BOOL_240 1
+# define MITK_PP_BOOL_241 1
+# define MITK_PP_BOOL_242 1
+# define MITK_PP_BOOL_243 1
+# define MITK_PP_BOOL_244 1
+# define MITK_PP_BOOL_245 1
+# define MITK_PP_BOOL_246 1
+# define MITK_PP_BOOL_247 1
+# define MITK_PP_BOOL_248 1
+# define MITK_PP_BOOL_249 1
+# define MITK_PP_BOOL_250 1
+# define MITK_PP_BOOL_251 1
+# define MITK_PP_BOOL_252 1
+# define MITK_PP_BOOL_253 1
+# define MITK_PP_BOOL_254 1
+# define MITK_PP_BOOL_255 1
+# define MITK_PP_BOOL_256 1
+#
+# endif
diff --git a/Core/Code/Algorithms/mitkPPRepetitionDetailDMCFor.h b/Core/Code/Algorithms/mitkPPRepetitionDetailDMCFor.h
new file mode 100644
index 0000000000..1d80d7fd02
--- /dev/null
+++ b/Core/Code/Algorithms/mitkPPRepetitionDetailDMCFor.h
@@ -0,0 +1,536 @@
+# /* Copyright (C) 2001
+# * Housemarque Oy
+# * http://www.housemarque.com
+# *
+# * Distributed under the Boost Software License, Version 1.0. (See
+# * accompanying file LICENSE_1_0.txt or copy at
+# * http://www.boost.org/LICENSE_1_0.txt)
+# */
+#
+# /* Revised by Paul Mensonides (2002) */
+#
+# /* See http://www.boost.org for most recent version. */
+#
+# ifndef MITK_PREPROCESSOR_REPETITION_DETAIL_FOR_HPP
+# define MITK_PREPROCESSOR_REPETITION_DETAIL_FOR_HPP
+#
+# include "mitkPPControlExprIIf.h"
+# include "mitkPPControlIIf.h"
+# include "mitkPPLogicalBool.h"
+# include "mitkPPTupleEat.h"
+#
+# define MITK_PP_FOR_1(s, p, o, m) MITK_PP_FOR_1_C(MITK_PP_BOOL(p##(2, s)), s, p, o, m)
+# define MITK_PP_FOR_2(s, p, o, m) MITK_PP_FOR_2_C(MITK_PP_BOOL(p##(3, s)), s, p, o, m)
+# define MITK_PP_FOR_3(s, p, o, m) MITK_PP_FOR_3_C(MITK_PP_BOOL(p##(4, s)), s, p, o, m)
+# define MITK_PP_FOR_4(s, p, o, m) MITK_PP_FOR_4_C(MITK_PP_BOOL(p##(5, s)), s, p, o, m)
+# define MITK_PP_FOR_5(s, p, o, m) MITK_PP_FOR_5_C(MITK_PP_BOOL(p##(6, s)), s, p, o, m)
+# define MITK_PP_FOR_6(s, p, o, m) MITK_PP_FOR_6_C(MITK_PP_BOOL(p##(7, s)), s, p, o, m)
+# define MITK_PP_FOR_7(s, p, o, m) MITK_PP_FOR_7_C(MITK_PP_BOOL(p##(8, s)), s, p, o, m)
+# define MITK_PP_FOR_8(s, p, o, m) MITK_PP_FOR_8_C(MITK_PP_BOOL(p##(9, s)), s, p, o, m)
+# define MITK_PP_FOR_9(s, p, o, m) MITK_PP_FOR_9_C(MITK_PP_BOOL(p##(10, s)), s, p, o, m)
+# define MITK_PP_FOR_10(s, p, o, m) MITK_PP_FOR_10_C(MITK_PP_BOOL(p##(11, s)), s, p, o, m)
+# define MITK_PP_FOR_11(s, p, o, m) MITK_PP_FOR_11_C(MITK_PP_BOOL(p##(12, s)), s, p, o, m)
+# define MITK_PP_FOR_12(s, p, o, m) MITK_PP_FOR_12_C(MITK_PP_BOOL(p##(13, s)), s, p, o, m)
+# define MITK_PP_FOR_13(s, p, o, m) MITK_PP_FOR_13_C(MITK_PP_BOOL(p##(14, s)), s, p, o, m)
+# define MITK_PP_FOR_14(s, p, o, m) MITK_PP_FOR_14_C(MITK_PP_BOOL(p##(15, s)), s, p, o, m)
+# define MITK_PP_FOR_15(s, p, o, m) MITK_PP_FOR_15_C(MITK_PP_BOOL(p##(16, s)), s, p, o, m)
+# define MITK_PP_FOR_16(s, p, o, m) MITK_PP_FOR_16_C(MITK_PP_BOOL(p##(17, s)), s, p, o, m)
+# define MITK_PP_FOR_17(s, p, o, m) MITK_PP_FOR_17_C(MITK_PP_BOOL(p##(18, s)), s, p, o, m)
+# define MITK_PP_FOR_18(s, p, o, m) MITK_PP_FOR_18_C(MITK_PP_BOOL(p##(19, s)), s, p, o, m)
+# define MITK_PP_FOR_19(s, p, o, m) MITK_PP_FOR_19_C(MITK_PP_BOOL(p##(20, s)), s, p, o, m)
+# define MITK_PP_FOR_20(s, p, o, m) MITK_PP_FOR_20_C(MITK_PP_BOOL(p##(21, s)), s, p, o, m)
+# define MITK_PP_FOR_21(s, p, o, m) MITK_PP_FOR_21_C(MITK_PP_BOOL(p##(22, s)), s, p, o, m)
+# define MITK_PP_FOR_22(s, p, o, m) MITK_PP_FOR_22_C(MITK_PP_BOOL(p##(23, s)), s, p, o, m)
+# define MITK_PP_FOR_23(s, p, o, m) MITK_PP_FOR_23_C(MITK_PP_BOOL(p##(24, s)), s, p, o, m)
+# define MITK_PP_FOR_24(s, p, o, m) MITK_PP_FOR_24_C(MITK_PP_BOOL(p##(25, s)), s, p, o, m)
+# define MITK_PP_FOR_25(s, p, o, m) MITK_PP_FOR_25_C(MITK_PP_BOOL(p##(26, s)), s, p, o, m)
+# define MITK_PP_FOR_26(s, p, o, m) MITK_PP_FOR_26_C(MITK_PP_BOOL(p##(27, s)), s, p, o, m)
+# define MITK_PP_FOR_27(s, p, o, m) MITK_PP_FOR_27_C(MITK_PP_BOOL(p##(28, s)), s, p, o, m)
+# define MITK_PP_FOR_28(s, p, o, m) MITK_PP_FOR_28_C(MITK_PP_BOOL(p##(29, s)), s, p, o, m)
+# define MITK_PP_FOR_29(s, p, o, m) MITK_PP_FOR_29_C(MITK_PP_BOOL(p##(30, s)), s, p, o, m)
+# define MITK_PP_FOR_30(s, p, o, m) MITK_PP_FOR_30_C(MITK_PP_BOOL(p##(31, s)), s, p, o, m)
+# define MITK_PP_FOR_31(s, p, o, m) MITK_PP_FOR_31_C(MITK_PP_BOOL(p##(32, s)), s, p, o, m)
+# define MITK_PP_FOR_32(s, p, o, m) MITK_PP_FOR_32_C(MITK_PP_BOOL(p##(33, s)), s, p, o, m)
+# define MITK_PP_FOR_33(s, p, o, m) MITK_PP_FOR_33_C(MITK_PP_BOOL(p##(34, s)), s, p, o, m)
+# define MITK_PP_FOR_34(s, p, o, m) MITK_PP_FOR_34_C(MITK_PP_BOOL(p##(35, s)), s, p, o, m)
+# define MITK_PP_FOR_35(s, p, o, m) MITK_PP_FOR_35_C(MITK_PP_BOOL(p##(36, s)), s, p, o, m)
+# define MITK_PP_FOR_36(s, p, o, m) MITK_PP_FOR_36_C(MITK_PP_BOOL(p##(37, s)), s, p, o, m)
+# define MITK_PP_FOR_37(s, p, o, m) MITK_PP_FOR_37_C(MITK_PP_BOOL(p##(38, s)), s, p, o, m)
+# define MITK_PP_FOR_38(s, p, o, m) MITK_PP_FOR_38_C(MITK_PP_BOOL(p##(39, s)), s, p, o, m)
+# define MITK_PP_FOR_39(s, p, o, m) MITK_PP_FOR_39_C(MITK_PP_BOOL(p##(40, s)), s, p, o, m)
+# define MITK_PP_FOR_40(s, p, o, m) MITK_PP_FOR_40_C(MITK_PP_BOOL(p##(41, s)), s, p, o, m)
+# define MITK_PP_FOR_41(s, p, o, m) MITK_PP_FOR_41_C(MITK_PP_BOOL(p##(42, s)), s, p, o, m)
+# define MITK_PP_FOR_42(s, p, o, m) MITK_PP_FOR_42_C(MITK_PP_BOOL(p##(43, s)), s, p, o, m)
+# define MITK_PP_FOR_43(s, p, o, m) MITK_PP_FOR_43_C(MITK_PP_BOOL(p##(44, s)), s, p, o, m)
+# define MITK_PP_FOR_44(s, p, o, m) MITK_PP_FOR_44_C(MITK_PP_BOOL(p##(45, s)), s, p, o, m)
+# define MITK_PP_FOR_45(s, p, o, m) MITK_PP_FOR_45_C(MITK_PP_BOOL(p##(46, s)), s, p, o, m)
+# define MITK_PP_FOR_46(s, p, o, m) MITK_PP_FOR_46_C(MITK_PP_BOOL(p##(47, s)), s, p, o, m)
+# define MITK_PP_FOR_47(s, p, o, m) MITK_PP_FOR_47_C(MITK_PP_BOOL(p##(48, s)), s, p, o, m)
+# define MITK_PP_FOR_48(s, p, o, m) MITK_PP_FOR_48_C(MITK_PP_BOOL(p##(49, s)), s, p, o, m)
+# define MITK_PP_FOR_49(s, p, o, m) MITK_PP_FOR_49_C(MITK_PP_BOOL(p##(50, s)), s, p, o, m)
+# define MITK_PP_FOR_50(s, p, o, m) MITK_PP_FOR_50_C(MITK_PP_BOOL(p##(51, s)), s, p, o, m)
+# define MITK_PP_FOR_51(s, p, o, m) MITK_PP_FOR_51_C(MITK_PP_BOOL(p##(52, s)), s, p, o, m)
+# define MITK_PP_FOR_52(s, p, o, m) MITK_PP_FOR_52_C(MITK_PP_BOOL(p##(53, s)), s, p, o, m)
+# define MITK_PP_FOR_53(s, p, o, m) MITK_PP_FOR_53_C(MITK_PP_BOOL(p##(54, s)), s, p, o, m)
+# define MITK_PP_FOR_54(s, p, o, m) MITK_PP_FOR_54_C(MITK_PP_BOOL(p##(55, s)), s, p, o, m)
+# define MITK_PP_FOR_55(s, p, o, m) MITK_PP_FOR_55_C(MITK_PP_BOOL(p##(56, s)), s, p, o, m)
+# define MITK_PP_FOR_56(s, p, o, m) MITK_PP_FOR_56_C(MITK_PP_BOOL(p##(57, s)), s, p, o, m)
+# define MITK_PP_FOR_57(s, p, o, m) MITK_PP_FOR_57_C(MITK_PP_BOOL(p##(58, s)), s, p, o, m)
+# define MITK_PP_FOR_58(s, p, o, m) MITK_PP_FOR_58_C(MITK_PP_BOOL(p##(59, s)), s, p, o, m)
+# define MITK_PP_FOR_59(s, p, o, m) MITK_PP_FOR_59_C(MITK_PP_BOOL(p##(60, s)), s, p, o, m)
+# define MITK_PP_FOR_60(s, p, o, m) MITK_PP_FOR_60_C(MITK_PP_BOOL(p##(61, s)), s, p, o, m)
+# define MITK_PP_FOR_61(s, p, o, m) MITK_PP_FOR_61_C(MITK_PP_BOOL(p##(62, s)), s, p, o, m)
+# define MITK_PP_FOR_62(s, p, o, m) MITK_PP_FOR_62_C(MITK_PP_BOOL(p##(63, s)), s, p, o, m)
+# define MITK_PP_FOR_63(s, p, o, m) MITK_PP_FOR_63_C(MITK_PP_BOOL(p##(64, s)), s, p, o, m)
+# define MITK_PP_FOR_64(s, p, o, m) MITK_PP_FOR_64_C(MITK_PP_BOOL(p##(65, s)), s, p, o, m)
+# define MITK_PP_FOR_65(s, p, o, m) MITK_PP_FOR_65_C(MITK_PP_BOOL(p##(66, s)), s, p, o, m)
+# define MITK_PP_FOR_66(s, p, o, m) MITK_PP_FOR_66_C(MITK_PP_BOOL(p##(67, s)), s, p, o, m)
+# define MITK_PP_FOR_67(s, p, o, m) MITK_PP_FOR_67_C(MITK_PP_BOOL(p##(68, s)), s, p, o, m)
+# define MITK_PP_FOR_68(s, p, o, m) MITK_PP_FOR_68_C(MITK_PP_BOOL(p##(69, s)), s, p, o, m)
+# define MITK_PP_FOR_69(s, p, o, m) MITK_PP_FOR_69_C(MITK_PP_BOOL(p##(70, s)), s, p, o, m)
+# define MITK_PP_FOR_70(s, p, o, m) MITK_PP_FOR_70_C(MITK_PP_BOOL(p##(71, s)), s, p, o, m)
+# define MITK_PP_FOR_71(s, p, o, m) MITK_PP_FOR_71_C(MITK_PP_BOOL(p##(72, s)), s, p, o, m)
+# define MITK_PP_FOR_72(s, p, o, m) MITK_PP_FOR_72_C(MITK_PP_BOOL(p##(73, s)), s, p, o, m)
+# define MITK_PP_FOR_73(s, p, o, m) MITK_PP_FOR_73_C(MITK_PP_BOOL(p##(74, s)), s, p, o, m)
+# define MITK_PP_FOR_74(s, p, o, m) MITK_PP_FOR_74_C(MITK_PP_BOOL(p##(75, s)), s, p, o, m)
+# define MITK_PP_FOR_75(s, p, o, m) MITK_PP_FOR_75_C(MITK_PP_BOOL(p##(76, s)), s, p, o, m)
+# define MITK_PP_FOR_76(s, p, o, m) MITK_PP_FOR_76_C(MITK_PP_BOOL(p##(77, s)), s, p, o, m)
+# define MITK_PP_FOR_77(s, p, o, m) MITK_PP_FOR_77_C(MITK_PP_BOOL(p##(78, s)), s, p, o, m)
+# define MITK_PP_FOR_78(s, p, o, m) MITK_PP_FOR_78_C(MITK_PP_BOOL(p##(79, s)), s, p, o, m)
+# define MITK_PP_FOR_79(s, p, o, m) MITK_PP_FOR_79_C(MITK_PP_BOOL(p##(80, s)), s, p, o, m)
+# define MITK_PP_FOR_80(s, p, o, m) MITK_PP_FOR_80_C(MITK_PP_BOOL(p##(81, s)), s, p, o, m)
+# define MITK_PP_FOR_81(s, p, o, m) MITK_PP_FOR_81_C(MITK_PP_BOOL(p##(82, s)), s, p, o, m)
+# define MITK_PP_FOR_82(s, p, o, m) MITK_PP_FOR_82_C(MITK_PP_BOOL(p##(83, s)), s, p, o, m)
+# define MITK_PP_FOR_83(s, p, o, m) MITK_PP_FOR_83_C(MITK_PP_BOOL(p##(84, s)), s, p, o, m)
+# define MITK_PP_FOR_84(s, p, o, m) MITK_PP_FOR_84_C(MITK_PP_BOOL(p##(85, s)), s, p, o, m)
+# define MITK_PP_FOR_85(s, p, o, m) MITK_PP_FOR_85_C(MITK_PP_BOOL(p##(86, s)), s, p, o, m)
+# define MITK_PP_FOR_86(s, p, o, m) MITK_PP_FOR_86_C(MITK_PP_BOOL(p##(87, s)), s, p, o, m)
+# define MITK_PP_FOR_87(s, p, o, m) MITK_PP_FOR_87_C(MITK_PP_BOOL(p##(88, s)), s, p, o, m)
+# define MITK_PP_FOR_88(s, p, o, m) MITK_PP_FOR_88_C(MITK_PP_BOOL(p##(89, s)), s, p, o, m)
+# define MITK_PP_FOR_89(s, p, o, m) MITK_PP_FOR_89_C(MITK_PP_BOOL(p##(90, s)), s, p, o, m)
+# define MITK_PP_FOR_90(s, p, o, m) MITK_PP_FOR_90_C(MITK_PP_BOOL(p##(91, s)), s, p, o, m)
+# define MITK_PP_FOR_91(s, p, o, m) MITK_PP_FOR_91_C(MITK_PP_BOOL(p##(92, s)), s, p, o, m)
+# define MITK_PP_FOR_92(s, p, o, m) MITK_PP_FOR_92_C(MITK_PP_BOOL(p##(93, s)), s, p, o, m)
+# define MITK_PP_FOR_93(s, p, o, m) MITK_PP_FOR_93_C(MITK_PP_BOOL(p##(94, s)), s, p, o, m)
+# define MITK_PP_FOR_94(s, p, o, m) MITK_PP_FOR_94_C(MITK_PP_BOOL(p##(95, s)), s, p, o, m)
+# define MITK_PP_FOR_95(s, p, o, m) MITK_PP_FOR_95_C(MITK_PP_BOOL(p##(96, s)), s, p, o, m)
+# define MITK_PP_FOR_96(s, p, o, m) MITK_PP_FOR_96_C(MITK_PP_BOOL(p##(97, s)), s, p, o, m)
+# define MITK_PP_FOR_97(s, p, o, m) MITK_PP_FOR_97_C(MITK_PP_BOOL(p##(98, s)), s, p, o, m)
+# define MITK_PP_FOR_98(s, p, o, m) MITK_PP_FOR_98_C(MITK_PP_BOOL(p##(99, s)), s, p, o, m)
+# define MITK_PP_FOR_99(s, p, o, m) MITK_PP_FOR_99_C(MITK_PP_BOOL(p##(100, s)), s, p, o, m)
+# define MITK_PP_FOR_100(s, p, o, m) MITK_PP_FOR_100_C(MITK_PP_BOOL(p##(101, s)), s, p, o, m)
+# define MITK_PP_FOR_101(s, p, o, m) MITK_PP_FOR_101_C(MITK_PP_BOOL(p##(102, s)), s, p, o, m)
+# define MITK_PP_FOR_102(s, p, o, m) MITK_PP_FOR_102_C(MITK_PP_BOOL(p##(103, s)), s, p, o, m)
+# define MITK_PP_FOR_103(s, p, o, m) MITK_PP_FOR_103_C(MITK_PP_BOOL(p##(104, s)), s, p, o, m)
+# define MITK_PP_FOR_104(s, p, o, m) MITK_PP_FOR_104_C(MITK_PP_BOOL(p##(105, s)), s, p, o, m)
+# define MITK_PP_FOR_105(s, p, o, m) MITK_PP_FOR_105_C(MITK_PP_BOOL(p##(106, s)), s, p, o, m)
+# define MITK_PP_FOR_106(s, p, o, m) MITK_PP_FOR_106_C(MITK_PP_BOOL(p##(107, s)), s, p, o, m)
+# define MITK_PP_FOR_107(s, p, o, m) MITK_PP_FOR_107_C(MITK_PP_BOOL(p##(108, s)), s, p, o, m)
+# define MITK_PP_FOR_108(s, p, o, m) MITK_PP_FOR_108_C(MITK_PP_BOOL(p##(109, s)), s, p, o, m)
+# define MITK_PP_FOR_109(s, p, o, m) MITK_PP_FOR_109_C(MITK_PP_BOOL(p##(110, s)), s, p, o, m)
+# define MITK_PP_FOR_110(s, p, o, m) MITK_PP_FOR_110_C(MITK_PP_BOOL(p##(111, s)), s, p, o, m)
+# define MITK_PP_FOR_111(s, p, o, m) MITK_PP_FOR_111_C(MITK_PP_BOOL(p##(112, s)), s, p, o, m)
+# define MITK_PP_FOR_112(s, p, o, m) MITK_PP_FOR_112_C(MITK_PP_BOOL(p##(113, s)), s, p, o, m)
+# define MITK_PP_FOR_113(s, p, o, m) MITK_PP_FOR_113_C(MITK_PP_BOOL(p##(114, s)), s, p, o, m)
+# define MITK_PP_FOR_114(s, p, o, m) MITK_PP_FOR_114_C(MITK_PP_BOOL(p##(115, s)), s, p, o, m)
+# define MITK_PP_FOR_115(s, p, o, m) MITK_PP_FOR_115_C(MITK_PP_BOOL(p##(116, s)), s, p, o, m)
+# define MITK_PP_FOR_116(s, p, o, m) MITK_PP_FOR_116_C(MITK_PP_BOOL(p##(117, s)), s, p, o, m)
+# define MITK_PP_FOR_117(s, p, o, m) MITK_PP_FOR_117_C(MITK_PP_BOOL(p##(118, s)), s, p, o, m)
+# define MITK_PP_FOR_118(s, p, o, m) MITK_PP_FOR_118_C(MITK_PP_BOOL(p##(119, s)), s, p, o, m)
+# define MITK_PP_FOR_119(s, p, o, m) MITK_PP_FOR_119_C(MITK_PP_BOOL(p##(120, s)), s, p, o, m)
+# define MITK_PP_FOR_120(s, p, o, m) MITK_PP_FOR_120_C(MITK_PP_BOOL(p##(121, s)), s, p, o, m)
+# define MITK_PP_FOR_121(s, p, o, m) MITK_PP_FOR_121_C(MITK_PP_BOOL(p##(122, s)), s, p, o, m)
+# define MITK_PP_FOR_122(s, p, o, m) MITK_PP_FOR_122_C(MITK_PP_BOOL(p##(123, s)), s, p, o, m)
+# define MITK_PP_FOR_123(s, p, o, m) MITK_PP_FOR_123_C(MITK_PP_BOOL(p##(124, s)), s, p, o, m)
+# define MITK_PP_FOR_124(s, p, o, m) MITK_PP_FOR_124_C(MITK_PP_BOOL(p##(125, s)), s, p, o, m)
+# define MITK_PP_FOR_125(s, p, o, m) MITK_PP_FOR_125_C(MITK_PP_BOOL(p##(126, s)), s, p, o, m)
+# define MITK_PP_FOR_126(s, p, o, m) MITK_PP_FOR_126_C(MITK_PP_BOOL(p##(127, s)), s, p, o, m)
+# define MITK_PP_FOR_127(s, p, o, m) MITK_PP_FOR_127_C(MITK_PP_BOOL(p##(128, s)), s, p, o, m)
+# define MITK_PP_FOR_128(s, p, o, m) MITK_PP_FOR_128_C(MITK_PP_BOOL(p##(129, s)), s, p, o, m)
+# define MITK_PP_FOR_129(s, p, o, m) MITK_PP_FOR_129_C(MITK_PP_BOOL(p##(130, s)), s, p, o, m)
+# define MITK_PP_FOR_130(s, p, o, m) MITK_PP_FOR_130_C(MITK_PP_BOOL(p##(131, s)), s, p, o, m)
+# define MITK_PP_FOR_131(s, p, o, m) MITK_PP_FOR_131_C(MITK_PP_BOOL(p##(132, s)), s, p, o, m)
+# define MITK_PP_FOR_132(s, p, o, m) MITK_PP_FOR_132_C(MITK_PP_BOOL(p##(133, s)), s, p, o, m)
+# define MITK_PP_FOR_133(s, p, o, m) MITK_PP_FOR_133_C(MITK_PP_BOOL(p##(134, s)), s, p, o, m)
+# define MITK_PP_FOR_134(s, p, o, m) MITK_PP_FOR_134_C(MITK_PP_BOOL(p##(135, s)), s, p, o, m)
+# define MITK_PP_FOR_135(s, p, o, m) MITK_PP_FOR_135_C(MITK_PP_BOOL(p##(136, s)), s, p, o, m)
+# define MITK_PP_FOR_136(s, p, o, m) MITK_PP_FOR_136_C(MITK_PP_BOOL(p##(137, s)), s, p, o, m)
+# define MITK_PP_FOR_137(s, p, o, m) MITK_PP_FOR_137_C(MITK_PP_BOOL(p##(138, s)), s, p, o, m)
+# define MITK_PP_FOR_138(s, p, o, m) MITK_PP_FOR_138_C(MITK_PP_BOOL(p##(139, s)), s, p, o, m)
+# define MITK_PP_FOR_139(s, p, o, m) MITK_PP_FOR_139_C(MITK_PP_BOOL(p##(140, s)), s, p, o, m)
+# define MITK_PP_FOR_140(s, p, o, m) MITK_PP_FOR_140_C(MITK_PP_BOOL(p##(141, s)), s, p, o, m)
+# define MITK_PP_FOR_141(s, p, o, m) MITK_PP_FOR_141_C(MITK_PP_BOOL(p##(142, s)), s, p, o, m)
+# define MITK_PP_FOR_142(s, p, o, m) MITK_PP_FOR_142_C(MITK_PP_BOOL(p##(143, s)), s, p, o, m)
+# define MITK_PP_FOR_143(s, p, o, m) MITK_PP_FOR_143_C(MITK_PP_BOOL(p##(144, s)), s, p, o, m)
+# define MITK_PP_FOR_144(s, p, o, m) MITK_PP_FOR_144_C(MITK_PP_BOOL(p##(145, s)), s, p, o, m)
+# define MITK_PP_FOR_145(s, p, o, m) MITK_PP_FOR_145_C(MITK_PP_BOOL(p##(146, s)), s, p, o, m)
+# define MITK_PP_FOR_146(s, p, o, m) MITK_PP_FOR_146_C(MITK_PP_BOOL(p##(147, s)), s, p, o, m)
+# define MITK_PP_FOR_147(s, p, o, m) MITK_PP_FOR_147_C(MITK_PP_BOOL(p##(148, s)), s, p, o, m)
+# define MITK_PP_FOR_148(s, p, o, m) MITK_PP_FOR_148_C(MITK_PP_BOOL(p##(149, s)), s, p, o, m)
+# define MITK_PP_FOR_149(s, p, o, m) MITK_PP_FOR_149_C(MITK_PP_BOOL(p##(150, s)), s, p, o, m)
+# define MITK_PP_FOR_150(s, p, o, m) MITK_PP_FOR_150_C(MITK_PP_BOOL(p##(151, s)), s, p, o, m)
+# define MITK_PP_FOR_151(s, p, o, m) MITK_PP_FOR_151_C(MITK_PP_BOOL(p##(152, s)), s, p, o, m)
+# define MITK_PP_FOR_152(s, p, o, m) MITK_PP_FOR_152_C(MITK_PP_BOOL(p##(153, s)), s, p, o, m)
+# define MITK_PP_FOR_153(s, p, o, m) MITK_PP_FOR_153_C(MITK_PP_BOOL(p##(154, s)), s, p, o, m)
+# define MITK_PP_FOR_154(s, p, o, m) MITK_PP_FOR_154_C(MITK_PP_BOOL(p##(155, s)), s, p, o, m)
+# define MITK_PP_FOR_155(s, p, o, m) MITK_PP_FOR_155_C(MITK_PP_BOOL(p##(156, s)), s, p, o, m)
+# define MITK_PP_FOR_156(s, p, o, m) MITK_PP_FOR_156_C(MITK_PP_BOOL(p##(157, s)), s, p, o, m)
+# define MITK_PP_FOR_157(s, p, o, m) MITK_PP_FOR_157_C(MITK_PP_BOOL(p##(158, s)), s, p, o, m)
+# define MITK_PP_FOR_158(s, p, o, m) MITK_PP_FOR_158_C(MITK_PP_BOOL(p##(159, s)), s, p, o, m)
+# define MITK_PP_FOR_159(s, p, o, m) MITK_PP_FOR_159_C(MITK_PP_BOOL(p##(160, s)), s, p, o, m)
+# define MITK_PP_FOR_160(s, p, o, m) MITK_PP_FOR_160_C(MITK_PP_BOOL(p##(161, s)), s, p, o, m)
+# define MITK_PP_FOR_161(s, p, o, m) MITK_PP_FOR_161_C(MITK_PP_BOOL(p##(162, s)), s, p, o, m)
+# define MITK_PP_FOR_162(s, p, o, m) MITK_PP_FOR_162_C(MITK_PP_BOOL(p##(163, s)), s, p, o, m)
+# define MITK_PP_FOR_163(s, p, o, m) MITK_PP_FOR_163_C(MITK_PP_BOOL(p##(164, s)), s, p, o, m)
+# define MITK_PP_FOR_164(s, p, o, m) MITK_PP_FOR_164_C(MITK_PP_BOOL(p##(165, s)), s, p, o, m)
+# define MITK_PP_FOR_165(s, p, o, m) MITK_PP_FOR_165_C(MITK_PP_BOOL(p##(166, s)), s, p, o, m)
+# define MITK_PP_FOR_166(s, p, o, m) MITK_PP_FOR_166_C(MITK_PP_BOOL(p##(167, s)), s, p, o, m)
+# define MITK_PP_FOR_167(s, p, o, m) MITK_PP_FOR_167_C(MITK_PP_BOOL(p##(168, s)), s, p, o, m)
+# define MITK_PP_FOR_168(s, p, o, m) MITK_PP_FOR_168_C(MITK_PP_BOOL(p##(169, s)), s, p, o, m)
+# define MITK_PP_FOR_169(s, p, o, m) MITK_PP_FOR_169_C(MITK_PP_BOOL(p##(170, s)), s, p, o, m)
+# define MITK_PP_FOR_170(s, p, o, m) MITK_PP_FOR_170_C(MITK_PP_BOOL(p##(171, s)), s, p, o, m)
+# define MITK_PP_FOR_171(s, p, o, m) MITK_PP_FOR_171_C(MITK_PP_BOOL(p##(172, s)), s, p, o, m)
+# define MITK_PP_FOR_172(s, p, o, m) MITK_PP_FOR_172_C(MITK_PP_BOOL(p##(173, s)), s, p, o, m)
+# define MITK_PP_FOR_173(s, p, o, m) MITK_PP_FOR_173_C(MITK_PP_BOOL(p##(174, s)), s, p, o, m)
+# define MITK_PP_FOR_174(s, p, o, m) MITK_PP_FOR_174_C(MITK_PP_BOOL(p##(175, s)), s, p, o, m)
+# define MITK_PP_FOR_175(s, p, o, m) MITK_PP_FOR_175_C(MITK_PP_BOOL(p##(176, s)), s, p, o, m)
+# define MITK_PP_FOR_176(s, p, o, m) MITK_PP_FOR_176_C(MITK_PP_BOOL(p##(177, s)), s, p, o, m)
+# define MITK_PP_FOR_177(s, p, o, m) MITK_PP_FOR_177_C(MITK_PP_BOOL(p##(178, s)), s, p, o, m)
+# define MITK_PP_FOR_178(s, p, o, m) MITK_PP_FOR_178_C(MITK_PP_BOOL(p##(179, s)), s, p, o, m)
+# define MITK_PP_FOR_179(s, p, o, m) MITK_PP_FOR_179_C(MITK_PP_BOOL(p##(180, s)), s, p, o, m)
+# define MITK_PP_FOR_180(s, p, o, m) MITK_PP_FOR_180_C(MITK_PP_BOOL(p##(181, s)), s, p, o, m)
+# define MITK_PP_FOR_181(s, p, o, m) MITK_PP_FOR_181_C(MITK_PP_BOOL(p##(182, s)), s, p, o, m)
+# define MITK_PP_FOR_182(s, p, o, m) MITK_PP_FOR_182_C(MITK_PP_BOOL(p##(183, s)), s, p, o, m)
+# define MITK_PP_FOR_183(s, p, o, m) MITK_PP_FOR_183_C(MITK_PP_BOOL(p##(184, s)), s, p, o, m)
+# define MITK_PP_FOR_184(s, p, o, m) MITK_PP_FOR_184_C(MITK_PP_BOOL(p##(185, s)), s, p, o, m)
+# define MITK_PP_FOR_185(s, p, o, m) MITK_PP_FOR_185_C(MITK_PP_BOOL(p##(186, s)), s, p, o, m)
+# define MITK_PP_FOR_186(s, p, o, m) MITK_PP_FOR_186_C(MITK_PP_BOOL(p##(187, s)), s, p, o, m)
+# define MITK_PP_FOR_187(s, p, o, m) MITK_PP_FOR_187_C(MITK_PP_BOOL(p##(188, s)), s, p, o, m)
+# define MITK_PP_FOR_188(s, p, o, m) MITK_PP_FOR_188_C(MITK_PP_BOOL(p##(189, s)), s, p, o, m)
+# define MITK_PP_FOR_189(s, p, o, m) MITK_PP_FOR_189_C(MITK_PP_BOOL(p##(190, s)), s, p, o, m)
+# define MITK_PP_FOR_190(s, p, o, m) MITK_PP_FOR_190_C(MITK_PP_BOOL(p##(191, s)), s, p, o, m)
+# define MITK_PP_FOR_191(s, p, o, m) MITK_PP_FOR_191_C(MITK_PP_BOOL(p##(192, s)), s, p, o, m)
+# define MITK_PP_FOR_192(s, p, o, m) MITK_PP_FOR_192_C(MITK_PP_BOOL(p##(193, s)), s, p, o, m)
+# define MITK_PP_FOR_193(s, p, o, m) MITK_PP_FOR_193_C(MITK_PP_BOOL(p##(194, s)), s, p, o, m)
+# define MITK_PP_FOR_194(s, p, o, m) MITK_PP_FOR_194_C(MITK_PP_BOOL(p##(195, s)), s, p, o, m)
+# define MITK_PP_FOR_195(s, p, o, m) MITK_PP_FOR_195_C(MITK_PP_BOOL(p##(196, s)), s, p, o, m)
+# define MITK_PP_FOR_196(s, p, o, m) MITK_PP_FOR_196_C(MITK_PP_BOOL(p##(197, s)), s, p, o, m)
+# define MITK_PP_FOR_197(s, p, o, m) MITK_PP_FOR_197_C(MITK_PP_BOOL(p##(198, s)), s, p, o, m)
+# define MITK_PP_FOR_198(s, p, o, m) MITK_PP_FOR_198_C(MITK_PP_BOOL(p##(199, s)), s, p, o, m)
+# define MITK_PP_FOR_199(s, p, o, m) MITK_PP_FOR_199_C(MITK_PP_BOOL(p##(200, s)), s, p, o, m)
+# define MITK_PP_FOR_200(s, p, o, m) MITK_PP_FOR_200_C(MITK_PP_BOOL(p##(201, s)), s, p, o, m)
+# define MITK_PP_FOR_201(s, p, o, m) MITK_PP_FOR_201_C(MITK_PP_BOOL(p##(202, s)), s, p, o, m)
+# define MITK_PP_FOR_202(s, p, o, m) MITK_PP_FOR_202_C(MITK_PP_BOOL(p##(203, s)), s, p, o, m)
+# define MITK_PP_FOR_203(s, p, o, m) MITK_PP_FOR_203_C(MITK_PP_BOOL(p##(204, s)), s, p, o, m)
+# define MITK_PP_FOR_204(s, p, o, m) MITK_PP_FOR_204_C(MITK_PP_BOOL(p##(205, s)), s, p, o, m)
+# define MITK_PP_FOR_205(s, p, o, m) MITK_PP_FOR_205_C(MITK_PP_BOOL(p##(206, s)), s, p, o, m)
+# define MITK_PP_FOR_206(s, p, o, m) MITK_PP_FOR_206_C(MITK_PP_BOOL(p##(207, s)), s, p, o, m)
+# define MITK_PP_FOR_207(s, p, o, m) MITK_PP_FOR_207_C(MITK_PP_BOOL(p##(208, s)), s, p, o, m)
+# define MITK_PP_FOR_208(s, p, o, m) MITK_PP_FOR_208_C(MITK_PP_BOOL(p##(209, s)), s, p, o, m)
+# define MITK_PP_FOR_209(s, p, o, m) MITK_PP_FOR_209_C(MITK_PP_BOOL(p##(210, s)), s, p, o, m)
+# define MITK_PP_FOR_210(s, p, o, m) MITK_PP_FOR_210_C(MITK_PP_BOOL(p##(211, s)), s, p, o, m)
+# define MITK_PP_FOR_211(s, p, o, m) MITK_PP_FOR_211_C(MITK_PP_BOOL(p##(212, s)), s, p, o, m)
+# define MITK_PP_FOR_212(s, p, o, m) MITK_PP_FOR_212_C(MITK_PP_BOOL(p##(213, s)), s, p, o, m)
+# define MITK_PP_FOR_213(s, p, o, m) MITK_PP_FOR_213_C(MITK_PP_BOOL(p##(214, s)), s, p, o, m)
+# define MITK_PP_FOR_214(s, p, o, m) MITK_PP_FOR_214_C(MITK_PP_BOOL(p##(215, s)), s, p, o, m)
+# define MITK_PP_FOR_215(s, p, o, m) MITK_PP_FOR_215_C(MITK_PP_BOOL(p##(216, s)), s, p, o, m)
+# define MITK_PP_FOR_216(s, p, o, m) MITK_PP_FOR_216_C(MITK_PP_BOOL(p##(217, s)), s, p, o, m)
+# define MITK_PP_FOR_217(s, p, o, m) MITK_PP_FOR_217_C(MITK_PP_BOOL(p##(218, s)), s, p, o, m)
+# define MITK_PP_FOR_218(s, p, o, m) MITK_PP_FOR_218_C(MITK_PP_BOOL(p##(219, s)), s, p, o, m)
+# define MITK_PP_FOR_219(s, p, o, m) MITK_PP_FOR_219_C(MITK_PP_BOOL(p##(220, s)), s, p, o, m)
+# define MITK_PP_FOR_220(s, p, o, m) MITK_PP_FOR_220_C(MITK_PP_BOOL(p##(221, s)), s, p, o, m)
+# define MITK_PP_FOR_221(s, p, o, m) MITK_PP_FOR_221_C(MITK_PP_BOOL(p##(222, s)), s, p, o, m)
+# define MITK_PP_FOR_222(s, p, o, m) MITK_PP_FOR_222_C(MITK_PP_BOOL(p##(223, s)), s, p, o, m)
+# define MITK_PP_FOR_223(s, p, o, m) MITK_PP_FOR_223_C(MITK_PP_BOOL(p##(224, s)), s, p, o, m)
+# define MITK_PP_FOR_224(s, p, o, m) MITK_PP_FOR_224_C(MITK_PP_BOOL(p##(225, s)), s, p, o, m)
+# define MITK_PP_FOR_225(s, p, o, m) MITK_PP_FOR_225_C(MITK_PP_BOOL(p##(226, s)), s, p, o, m)
+# define MITK_PP_FOR_226(s, p, o, m) MITK_PP_FOR_226_C(MITK_PP_BOOL(p##(227, s)), s, p, o, m)
+# define MITK_PP_FOR_227(s, p, o, m) MITK_PP_FOR_227_C(MITK_PP_BOOL(p##(228, s)), s, p, o, m)
+# define MITK_PP_FOR_228(s, p, o, m) MITK_PP_FOR_228_C(MITK_PP_BOOL(p##(229, s)), s, p, o, m)
+# define MITK_PP_FOR_229(s, p, o, m) MITK_PP_FOR_229_C(MITK_PP_BOOL(p##(230, s)), s, p, o, m)
+# define MITK_PP_FOR_230(s, p, o, m) MITK_PP_FOR_230_C(MITK_PP_BOOL(p##(231, s)), s, p, o, m)
+# define MITK_PP_FOR_231(s, p, o, m) MITK_PP_FOR_231_C(MITK_PP_BOOL(p##(232, s)), s, p, o, m)
+# define MITK_PP_FOR_232(s, p, o, m) MITK_PP_FOR_232_C(MITK_PP_BOOL(p##(233, s)), s, p, o, m)
+# define MITK_PP_FOR_233(s, p, o, m) MITK_PP_FOR_233_C(MITK_PP_BOOL(p##(234, s)), s, p, o, m)
+# define MITK_PP_FOR_234(s, p, o, m) MITK_PP_FOR_234_C(MITK_PP_BOOL(p##(235, s)), s, p, o, m)
+# define MITK_PP_FOR_235(s, p, o, m) MITK_PP_FOR_235_C(MITK_PP_BOOL(p##(236, s)), s, p, o, m)
+# define MITK_PP_FOR_236(s, p, o, m) MITK_PP_FOR_236_C(MITK_PP_BOOL(p##(237, s)), s, p, o, m)
+# define MITK_PP_FOR_237(s, p, o, m) MITK_PP_FOR_237_C(MITK_PP_BOOL(p##(238, s)), s, p, o, m)
+# define MITK_PP_FOR_238(s, p, o, m) MITK_PP_FOR_238_C(MITK_PP_BOOL(p##(239, s)), s, p, o, m)
+# define MITK_PP_FOR_239(s, p, o, m) MITK_PP_FOR_239_C(MITK_PP_BOOL(p##(240, s)), s, p, o, m)
+# define MITK_PP_FOR_240(s, p, o, m) MITK_PP_FOR_240_C(MITK_PP_BOOL(p##(241, s)), s, p, o, m)
+# define MITK_PP_FOR_241(s, p, o, m) MITK_PP_FOR_241_C(MITK_PP_BOOL(p##(242, s)), s, p, o, m)
+# define MITK_PP_FOR_242(s, p, o, m) MITK_PP_FOR_242_C(MITK_PP_BOOL(p##(243, s)), s, p, o, m)
+# define MITK_PP_FOR_243(s, p, o, m) MITK_PP_FOR_243_C(MITK_PP_BOOL(p##(244, s)), s, p, o, m)
+# define MITK_PP_FOR_244(s, p, o, m) MITK_PP_FOR_244_C(MITK_PP_BOOL(p##(245, s)), s, p, o, m)
+# define MITK_PP_FOR_245(s, p, o, m) MITK_PP_FOR_245_C(MITK_PP_BOOL(p##(246, s)), s, p, o, m)
+# define MITK_PP_FOR_246(s, p, o, m) MITK_PP_FOR_246_C(MITK_PP_BOOL(p##(247, s)), s, p, o, m)
+# define MITK_PP_FOR_247(s, p, o, m) MITK_PP_FOR_247_C(MITK_PP_BOOL(p##(248, s)), s, p, o, m)
+# define MITK_PP_FOR_248(s, p, o, m) MITK_PP_FOR_248_C(MITK_PP_BOOL(p##(249, s)), s, p, o, m)
+# define MITK_PP_FOR_249(s, p, o, m) MITK_PP_FOR_249_C(MITK_PP_BOOL(p##(250, s)), s, p, o, m)
+# define MITK_PP_FOR_250(s, p, o, m) MITK_PP_FOR_250_C(MITK_PP_BOOL(p##(251, s)), s, p, o, m)
+# define MITK_PP_FOR_251(s, p, o, m) MITK_PP_FOR_251_C(MITK_PP_BOOL(p##(252, s)), s, p, o, m)
+# define MITK_PP_FOR_252(s, p, o, m) MITK_PP_FOR_252_C(MITK_PP_BOOL(p##(253, s)), s, p, o, m)
+# define MITK_PP_FOR_253(s, p, o, m) MITK_PP_FOR_253_C(MITK_PP_BOOL(p##(254, s)), s, p, o, m)
+# define MITK_PP_FOR_254(s, p, o, m) MITK_PP_FOR_254_C(MITK_PP_BOOL(p##(255, s)), s, p, o, m)
+# define MITK_PP_FOR_255(s, p, o, m) MITK_PP_FOR_255_C(MITK_PP_BOOL(p##(256, s)), s, p, o, m)
+# define MITK_PP_FOR_256(s, p, o, m) MITK_PP_FOR_256_C(MITK_PP_BOOL(p##(257, s)), s, p, o, m)
+#
+# define MITK_PP_FOR_1_C(c, s, p, o, m) MITK_PP_IIF(c, m, MITK_PP_TUPLE_EAT_2)(2, s) MITK_PP_IIF(c, MITK_PP_FOR_2, MITK_PP_TUPLE_EAT_4)(MITK_PP_EXPR_IIF(c, o)(2, s), p, o, m)
+# define MITK_PP_FOR_2_C(c, s, p, o, m) MITK_PP_IIF(c, m, MITK_PP_TUPLE_EAT_2)(3, s) MITK_PP_IIF(c, MITK_PP_FOR_3, MITK_PP_TUPLE_EAT_4)(MITK_PP_EXPR_IIF(c, o)(3, s), p, o, m)
+# define MITK_PP_FOR_3_C(c, s, p, o, m) MITK_PP_IIF(c, m, MITK_PP_TUPLE_EAT_2)(4, s) MITK_PP_IIF(c, MITK_PP_FOR_4, MITK_PP_TUPLE_EAT_4)(MITK_PP_EXPR_IIF(c, o)(4, s), p, o, m)
+# define MITK_PP_FOR_4_C(c, s, p, o, m) MITK_PP_IIF(c, m, MITK_PP_TUPLE_EAT_2)(5, s) MITK_PP_IIF(c, MITK_PP_FOR_5, MITK_PP_TUPLE_EAT_4)(MITK_PP_EXPR_IIF(c, o)(5, s), p, o, m)
+# define MITK_PP_FOR_5_C(c, s, p, o, m) MITK_PP_IIF(c, m, MITK_PP_TUPLE_EAT_2)(6, s) MITK_PP_IIF(c, MITK_PP_FOR_6, MITK_PP_TUPLE_EAT_4)(MITK_PP_EXPR_IIF(c, o)(6, s), p, o, m)
+# define MITK_PP_FOR_6_C(c, s, p, o, m) MITK_PP_IIF(c, m, MITK_PP_TUPLE_EAT_2)(7, s) MITK_PP_IIF(c, MITK_PP_FOR_7, MITK_PP_TUPLE_EAT_4)(MITK_PP_EXPR_IIF(c, o)(7, s), p, o, m)
+# define MITK_PP_FOR_7_C(c, s, p, o, m) MITK_PP_IIF(c, m, MITK_PP_TUPLE_EAT_2)(8, s) MITK_PP_IIF(c, MITK_PP_FOR_8, MITK_PP_TUPLE_EAT_4)(MITK_PP_EXPR_IIF(c, o)(8, s), p, o, m)
+# define MITK_PP_FOR_8_C(c, s, p, o, m) MITK_PP_IIF(c, m, MITK_PP_TUPLE_EAT_2)(9, s) MITK_PP_IIF(c, MITK_PP_FOR_9, MITK_PP_TUPLE_EAT_4)(MITK_PP_EXPR_IIF(c, o)(9, s), p, o, m)
+# define MITK_PP_FOR_9_C(c, s, p, o, m) MITK_PP_IIF(c, m, MITK_PP_TUPLE_EAT_2)(10, s) MITK_PP_IIF(c, MITK_PP_FOR_10, MITK_PP_TUPLE_EAT_4)(MITK_PP_EXPR_IIF(c, o)(10, s), p, o, m)
+# define MITK_PP_FOR_10_C(c, s, p, o, m) MITK_PP_IIF(c, m, MITK_PP_TUPLE_EAT_2)(11, s) MITK_PP_IIF(c, MITK_PP_FOR_11, MITK_PP_TUPLE_EAT_4)(MITK_PP_EXPR_IIF(c, o)(11, s), p, o, m)
+# define MITK_PP_FOR_11_C(c, s, p, o, m) MITK_PP_IIF(c, m, MITK_PP_TUPLE_EAT_2)(12, s) MITK_PP_IIF(c, MITK_PP_FOR_12, MITK_PP_TUPLE_EAT_4)(MITK_PP_EXPR_IIF(c, o)(12, s), p, o, m)
+# define MITK_PP_FOR_12_C(c, s, p, o, m) MITK_PP_IIF(c, m, MITK_PP_TUPLE_EAT_2)(13, s) MITK_PP_IIF(c, MITK_PP_FOR_13, MITK_PP_TUPLE_EAT_4)(MITK_PP_EXPR_IIF(c, o)(13, s), p, o, m)
+# define MITK_PP_FOR_13_C(c, s, p, o, m) MITK_PP_IIF(c, m, MITK_PP_TUPLE_EAT_2)(14, s) MITK_PP_IIF(c, MITK_PP_FOR_14, MITK_PP_TUPLE_EAT_4)(MITK_PP_EXPR_IIF(c, o)(14, s), p, o, m)
+# define MITK_PP_FOR_14_C(c, s, p, o, m) MITK_PP_IIF(c, m, MITK_PP_TUPLE_EAT_2)(15, s) MITK_PP_IIF(c, MITK_PP_FOR_15, MITK_PP_TUPLE_EAT_4)(MITK_PP_EXPR_IIF(c, o)(15, s), p, o, m)
+# define MITK_PP_FOR_15_C(c, s, p, o, m) MITK_PP_IIF(c, m, MITK_PP_TUPLE_EAT_2)(16, s) MITK_PP_IIF(c, MITK_PP_FOR_16, MITK_PP_TUPLE_EAT_4)(MITK_PP_EXPR_IIF(c, o)(16, s), p, o, m)
+# define MITK_PP_FOR_16_C(c, s, p, o, m) MITK_PP_IIF(c, m, MITK_PP_TUPLE_EAT_2)(17, s) MITK_PP_IIF(c, MITK_PP_FOR_17, MITK_PP_TUPLE_EAT_4)(MITK_PP_EXPR_IIF(c, o)(17, s), p, o, m)
+# define MITK_PP_FOR_17_C(c, s, p, o, m) MITK_PP_IIF(c, m, MITK_PP_TUPLE_EAT_2)(18, s) MITK_PP_IIF(c, MITK_PP_FOR_18, MITK_PP_TUPLE_EAT_4)(MITK_PP_EXPR_IIF(c, o)(18, s), p, o, m)
+# define MITK_PP_FOR_18_C(c, s, p, o, m) MITK_PP_IIF(c, m, MITK_PP_TUPLE_EAT_2)(19, s) MITK_PP_IIF(c, MITK_PP_FOR_19, MITK_PP_TUPLE_EAT_4)(MITK_PP_EXPR_IIF(c, o)(19, s), p, o, m)
+# define MITK_PP_FOR_19_C(c, s, p, o, m) MITK_PP_IIF(c, m, MITK_PP_TUPLE_EAT_2)(20, s) MITK_PP_IIF(c, MITK_PP_FOR_20, MITK_PP_TUPLE_EAT_4)(MITK_PP_EXPR_IIF(c, o)(20, s), p, o, m)
+# define MITK_PP_FOR_20_C(c, s, p, o, m) MITK_PP_IIF(c, m, MITK_PP_TUPLE_EAT_2)(21, s) MITK_PP_IIF(c, MITK_PP_FOR_21, MITK_PP_TUPLE_EAT_4)(MITK_PP_EXPR_IIF(c, o)(21, s), p, o, m)
+# define MITK_PP_FOR_21_C(c, s, p, o, m) MITK_PP_IIF(c, m, MITK_PP_TUPLE_EAT_2)(22, s) MITK_PP_IIF(c, MITK_PP_FOR_22, MITK_PP_TUPLE_EAT_4)(MITK_PP_EXPR_IIF(c, o)(22, s), p, o, m)
+# define MITK_PP_FOR_22_C(c, s, p, o, m) MITK_PP_IIF(c, m, MITK_PP_TUPLE_EAT_2)(23, s) MITK_PP_IIF(c, MITK_PP_FOR_23, MITK_PP_TUPLE_EAT_4)(MITK_PP_EXPR_IIF(c, o)(23, s), p, o, m)
+# define MITK_PP_FOR_23_C(c, s, p, o, m) MITK_PP_IIF(c, m, MITK_PP_TUPLE_EAT_2)(24, s) MITK_PP_IIF(c, MITK_PP_FOR_24, MITK_PP_TUPLE_EAT_4)(MITK_PP_EXPR_IIF(c, o)(24, s), p, o, m)
+# define MITK_PP_FOR_24_C(c, s, p, o, m) MITK_PP_IIF(c, m, MITK_PP_TUPLE_EAT_2)(25, s) MITK_PP_IIF(c, MITK_PP_FOR_25, MITK_PP_TUPLE_EAT_4)(MITK_PP_EXPR_IIF(c, o)(25, s), p, o, m)
+# define MITK_PP_FOR_25_C(c, s, p, o, m) MITK_PP_IIF(c, m, MITK_PP_TUPLE_EAT_2)(26, s) MITK_PP_IIF(c, MITK_PP_FOR_26, MITK_PP_TUPLE_EAT_4)(MITK_PP_EXPR_IIF(c, o)(26, s), p, o, m)
+# define MITK_PP_FOR_26_C(c, s, p, o, m) MITK_PP_IIF(c, m, MITK_PP_TUPLE_EAT_2)(27, s) MITK_PP_IIF(c, MITK_PP_FOR_27, MITK_PP_TUPLE_EAT_4)(MITK_PP_EXPR_IIF(c, o)(27, s), p, o, m)
+# define MITK_PP_FOR_27_C(c, s, p, o, m) MITK_PP_IIF(c, m, MITK_PP_TUPLE_EAT_2)(28, s) MITK_PP_IIF(c, MITK_PP_FOR_28, MITK_PP_TUPLE_EAT_4)(MITK_PP_EXPR_IIF(c, o)(28, s), p, o, m)
+# define MITK_PP_FOR_28_C(c, s, p, o, m) MITK_PP_IIF(c, m, MITK_PP_TUPLE_EAT_2)(29, s) MITK_PP_IIF(c, MITK_PP_FOR_29, MITK_PP_TUPLE_EAT_4)(MITK_PP_EXPR_IIF(c, o)(29, s), p, o, m)
+# define MITK_PP_FOR_29_C(c, s, p, o, m) MITK_PP_IIF(c, m, MITK_PP_TUPLE_EAT_2)(30, s) MITK_PP_IIF(c, MITK_PP_FOR_30, MITK_PP_TUPLE_EAT_4)(MITK_PP_EXPR_IIF(c, o)(30, s), p, o, m)
+# define MITK_PP_FOR_30_C(c, s, p, o, m) MITK_PP_IIF(c, m, MITK_PP_TUPLE_EAT_2)(31, s) MITK_PP_IIF(c, MITK_PP_FOR_31, MITK_PP_TUPLE_EAT_4)(MITK_PP_EXPR_IIF(c, o)(31, s), p, o, m)
+# define MITK_PP_FOR_31_C(c, s, p, o, m) MITK_PP_IIF(c, m, MITK_PP_TUPLE_EAT_2)(32, s) MITK_PP_IIF(c, MITK_PP_FOR_32, MITK_PP_TUPLE_EAT_4)(MITK_PP_EXPR_IIF(c, o)(32, s), p, o, m)
+# define MITK_PP_FOR_32_C(c, s, p, o, m) MITK_PP_IIF(c, m, MITK_PP_TUPLE_EAT_2)(33, s) MITK_PP_IIF(c, MITK_PP_FOR_33, MITK_PP_TUPLE_EAT_4)(MITK_PP_EXPR_IIF(c, o)(33, s), p, o, m)
+# define MITK_PP_FOR_33_C(c, s, p, o, m) MITK_PP_IIF(c, m, MITK_PP_TUPLE_EAT_2)(34, s) MITK_PP_IIF(c, MITK_PP_FOR_34, MITK_PP_TUPLE_EAT_4)(MITK_PP_EXPR_IIF(c, o)(34, s), p, o, m)
+# define MITK_PP_FOR_34_C(c, s, p, o, m) MITK_PP_IIF(c, m, MITK_PP_TUPLE_EAT_2)(35, s) MITK_PP_IIF(c, MITK_PP_FOR_35, MITK_PP_TUPLE_EAT_4)(MITK_PP_EXPR_IIF(c, o)(35, s), p, o, m)
+# define MITK_PP_FOR_35_C(c, s, p, o, m) MITK_PP_IIF(c, m, MITK_PP_TUPLE_EAT_2)(36, s) MITK_PP_IIF(c, MITK_PP_FOR_36, MITK_PP_TUPLE_EAT_4)(MITK_PP_EXPR_IIF(c, o)(36, s), p, o, m)
+# define MITK_PP_FOR_36_C(c, s, p, o, m) MITK_PP_IIF(c, m, MITK_PP_TUPLE_EAT_2)(37, s) MITK_PP_IIF(c, MITK_PP_FOR_37, MITK_PP_TUPLE_EAT_4)(MITK_PP_EXPR_IIF(c, o)(37, s), p, o, m)
+# define MITK_PP_FOR_37_C(c, s, p, o, m) MITK_PP_IIF(c, m, MITK_PP_TUPLE_EAT_2)(38, s) MITK_PP_IIF(c, MITK_PP_FOR_38, MITK_PP_TUPLE_EAT_4)(MITK_PP_EXPR_IIF(c, o)(38, s), p, o, m)
+# define MITK_PP_FOR_38_C(c, s, p, o, m) MITK_PP_IIF(c, m, MITK_PP_TUPLE_EAT_2)(39, s) MITK_PP_IIF(c, MITK_PP_FOR_39, MITK_PP_TUPLE_EAT_4)(MITK_PP_EXPR_IIF(c, o)(39, s), p, o, m)
+# define MITK_PP_FOR_39_C(c, s, p, o, m) MITK_PP_IIF(c, m, MITK_PP_TUPLE_EAT_2)(40, s) MITK_PP_IIF(c, MITK_PP_FOR_40, MITK_PP_TUPLE_EAT_4)(MITK_PP_EXPR_IIF(c, o)(40, s), p, o, m)
+# define MITK_PP_FOR_40_C(c, s, p, o, m) MITK_PP_IIF(c, m, MITK_PP_TUPLE_EAT_2)(41, s) MITK_PP_IIF(c, MITK_PP_FOR_41, MITK_PP_TUPLE_EAT_4)(MITK_PP_EXPR_IIF(c, o)(41, s), p, o, m)
+# define MITK_PP_FOR_41_C(c, s, p, o, m) MITK_PP_IIF(c, m, MITK_PP_TUPLE_EAT_2)(42, s) MITK_PP_IIF(c, MITK_PP_FOR_42, MITK_PP_TUPLE_EAT_4)(MITK_PP_EXPR_IIF(c, o)(42, s), p, o, m)
+# define MITK_PP_FOR_42_C(c, s, p, o, m) MITK_PP_IIF(c, m, MITK_PP_TUPLE_EAT_2)(43, s) MITK_PP_IIF(c, MITK_PP_FOR_43, MITK_PP_TUPLE_EAT_4)(MITK_PP_EXPR_IIF(c, o)(43, s), p, o, m)
+# define MITK_PP_FOR_43_C(c, s, p, o, m) MITK_PP_IIF(c, m, MITK_PP_TUPLE_EAT_2)(44, s) MITK_PP_IIF(c, MITK_PP_FOR_44, MITK_PP_TUPLE_EAT_4)(MITK_PP_EXPR_IIF(c, o)(44, s), p, o, m)
+# define MITK_PP_FOR_44_C(c, s, p, o, m) MITK_PP_IIF(c, m, MITK_PP_TUPLE_EAT_2)(45, s) MITK_PP_IIF(c, MITK_PP_FOR_45, MITK_PP_TUPLE_EAT_4)(MITK_PP_EXPR_IIF(c, o)(45, s), p, o, m)
+# define MITK_PP_FOR_45_C(c, s, p, o, m) MITK_PP_IIF(c, m, MITK_PP_TUPLE_EAT_2)(46, s) MITK_PP_IIF(c, MITK_PP_FOR_46, MITK_PP_TUPLE_EAT_4)(MITK_PP_EXPR_IIF(c, o)(46, s), p, o, m)
+# define MITK_PP_FOR_46_C(c, s, p, o, m) MITK_PP_IIF(c, m, MITK_PP_TUPLE_EAT_2)(47, s) MITK_PP_IIF(c, MITK_PP_FOR_47, MITK_PP_TUPLE_EAT_4)(MITK_PP_EXPR_IIF(c, o)(47, s), p, o, m)
+# define MITK_PP_FOR_47_C(c, s, p, o, m) MITK_PP_IIF(c, m, MITK_PP_TUPLE_EAT_2)(48, s) MITK_PP_IIF(c, MITK_PP_FOR_48, MITK_PP_TUPLE_EAT_4)(MITK_PP_EXPR_IIF(c, o)(48, s), p, o, m)
+# define MITK_PP_FOR_48_C(c, s, p, o, m) MITK_PP_IIF(c, m, MITK_PP_TUPLE_EAT_2)(49, s) MITK_PP_IIF(c, MITK_PP_FOR_49, MITK_PP_TUPLE_EAT_4)(MITK_PP_EXPR_IIF(c, o)(49, s), p, o, m)
+# define MITK_PP_FOR_49_C(c, s, p, o, m) MITK_PP_IIF(c, m, MITK_PP_TUPLE_EAT_2)(50, s) MITK_PP_IIF(c, MITK_PP_FOR_50, MITK_PP_TUPLE_EAT_4)(MITK_PP_EXPR_IIF(c, o)(50, s), p, o, m)
+# define MITK_PP_FOR_50_C(c, s, p, o, m) MITK_PP_IIF(c, m, MITK_PP_TUPLE_EAT_2)(51, s) MITK_PP_IIF(c, MITK_PP_FOR_51, MITK_PP_TUPLE_EAT_4)(MITK_PP_EXPR_IIF(c, o)(51, s), p, o, m)
+# define MITK_PP_FOR_51_C(c, s, p, o, m) MITK_PP_IIF(c, m, MITK_PP_TUPLE_EAT_2)(52, s) MITK_PP_IIF(c, MITK_PP_FOR_52, MITK_PP_TUPLE_EAT_4)(MITK_PP_EXPR_IIF(c, o)(52, s), p, o, m)
+# define MITK_PP_FOR_52_C(c, s, p, o, m) MITK_PP_IIF(c, m, MITK_PP_TUPLE_EAT_2)(53, s) MITK_PP_IIF(c, MITK_PP_FOR_53, MITK_PP_TUPLE_EAT_4)(MITK_PP_EXPR_IIF(c, o)(53, s), p, o, m)
+# define MITK_PP_FOR_53_C(c, s, p, o, m) MITK_PP_IIF(c, m, MITK_PP_TUPLE_EAT_2)(54, s) MITK_PP_IIF(c, MITK_PP_FOR_54, MITK_PP_TUPLE_EAT_4)(MITK_PP_EXPR_IIF(c, o)(54, s), p, o, m)
+# define MITK_PP_FOR_54_C(c, s, p, o, m) MITK_PP_IIF(c, m, MITK_PP_TUPLE_EAT_2)(55, s) MITK_PP_IIF(c, MITK_PP_FOR_55, MITK_PP_TUPLE_EAT_4)(MITK_PP_EXPR_IIF(c, o)(55, s), p, o, m)
+# define MITK_PP_FOR_55_C(c, s, p, o, m) MITK_PP_IIF(c, m, MITK_PP_TUPLE_EAT_2)(56, s) MITK_PP_IIF(c, MITK_PP_FOR_56, MITK_PP_TUPLE_EAT_4)(MITK_PP_EXPR_IIF(c, o)(56, s), p, o, m)
+# define MITK_PP_FOR_56_C(c, s, p, o, m) MITK_PP_IIF(c, m, MITK_PP_TUPLE_EAT_2)(57, s) MITK_PP_IIF(c, MITK_PP_FOR_57, MITK_PP_TUPLE_EAT_4)(MITK_PP_EXPR_IIF(c, o)(57, s), p, o, m)
+# define MITK_PP_FOR_57_C(c, s, p, o, m) MITK_PP_IIF(c, m, MITK_PP_TUPLE_EAT_2)(58, s) MITK_PP_IIF(c, MITK_PP_FOR_58, MITK_PP_TUPLE_EAT_4)(MITK_PP_EXPR_IIF(c, o)(58, s), p, o, m)
+# define MITK_PP_FOR_58_C(c, s, p, o, m) MITK_PP_IIF(c, m, MITK_PP_TUPLE_EAT_2)(59, s) MITK_PP_IIF(c, MITK_PP_FOR_59, MITK_PP_TUPLE_EAT_4)(MITK_PP_EXPR_IIF(c, o)(59, s), p, o, m)
+# define MITK_PP_FOR_59_C(c, s, p, o, m) MITK_PP_IIF(c, m, MITK_PP_TUPLE_EAT_2)(60, s) MITK_PP_IIF(c, MITK_PP_FOR_60, MITK_PP_TUPLE_EAT_4)(MITK_PP_EXPR_IIF(c, o)(60, s), p, o, m)
+# define MITK_PP_FOR_60_C(c, s, p, o, m) MITK_PP_IIF(c, m, MITK_PP_TUPLE_EAT_2)(61, s) MITK_PP_IIF(c, MITK_PP_FOR_61, MITK_PP_TUPLE_EAT_4)(MITK_PP_EXPR_IIF(c, o)(61, s), p, o, m)
+# define MITK_PP_FOR_61_C(c, s, p, o, m) MITK_PP_IIF(c, m, MITK_PP_TUPLE_EAT_2)(62, s) MITK_PP_IIF(c, MITK_PP_FOR_62, MITK_PP_TUPLE_EAT_4)(MITK_PP_EXPR_IIF(c, o)(62, s), p, o, m)
+# define MITK_PP_FOR_62_C(c, s, p, o, m) MITK_PP_IIF(c, m, MITK_PP_TUPLE_EAT_2)(63, s) MITK_PP_IIF(c, MITK_PP_FOR_63, MITK_PP_TUPLE_EAT_4)(MITK_PP_EXPR_IIF(c, o)(63, s), p, o, m)
+# define MITK_PP_FOR_63_C(c, s, p, o, m) MITK_PP_IIF(c, m, MITK_PP_TUPLE_EAT_2)(64, s) MITK_PP_IIF(c, MITK_PP_FOR_64, MITK_PP_TUPLE_EAT_4)(MITK_PP_EXPR_IIF(c, o)(64, s), p, o, m)
+# define MITK_PP_FOR_64_C(c, s, p, o, m) MITK_PP_IIF(c, m, MITK_PP_TUPLE_EAT_2)(65, s) MITK_PP_IIF(c, MITK_PP_FOR_65, MITK_PP_TUPLE_EAT_4)(MITK_PP_EXPR_IIF(c, o)(65, s), p, o, m)
+# define MITK_PP_FOR_65_C(c, s, p, o, m) MITK_PP_IIF(c, m, MITK_PP_TUPLE_EAT_2)(66, s) MITK_PP_IIF(c, MITK_PP_FOR_66, MITK_PP_TUPLE_EAT_4)(MITK_PP_EXPR_IIF(c, o)(66, s), p, o, m)
+# define MITK_PP_FOR_66_C(c, s, p, o, m) MITK_PP_IIF(c, m, MITK_PP_TUPLE_EAT_2)(67, s) MITK_PP_IIF(c, MITK_PP_FOR_67, MITK_PP_TUPLE_EAT_4)(MITK_PP_EXPR_IIF(c, o)(67, s), p, o, m)
+# define MITK_PP_FOR_67_C(c, s, p, o, m) MITK_PP_IIF(c, m, MITK_PP_TUPLE_EAT_2)(68, s) MITK_PP_IIF(c, MITK_PP_FOR_68, MITK_PP_TUPLE_EAT_4)(MITK_PP_EXPR_IIF(c, o)(68, s), p, o, m)
+# define MITK_PP_FOR_68_C(c, s, p, o, m) MITK_PP_IIF(c, m, MITK_PP_TUPLE_EAT_2)(69, s) MITK_PP_IIF(c, MITK_PP_FOR_69, MITK_PP_TUPLE_EAT_4)(MITK_PP_EXPR_IIF(c, o)(69, s), p, o, m)
+# define MITK_PP_FOR_69_C(c, s, p, o, m) MITK_PP_IIF(c, m, MITK_PP_TUPLE_EAT_2)(70, s) MITK_PP_IIF(c, MITK_PP_FOR_70, MITK_PP_TUPLE_EAT_4)(MITK_PP_EXPR_IIF(c, o)(70, s), p, o, m)
+# define MITK_PP_FOR_70_C(c, s, p, o, m) MITK_PP_IIF(c, m, MITK_PP_TUPLE_EAT_2)(71, s) MITK_PP_IIF(c, MITK_PP_FOR_71, MITK_PP_TUPLE_EAT_4)(MITK_PP_EXPR_IIF(c, o)(71, s), p, o, m)
+# define MITK_PP_FOR_71_C(c, s, p, o, m) MITK_PP_IIF(c, m, MITK_PP_TUPLE_EAT_2)(72, s) MITK_PP_IIF(c, MITK_PP_FOR_72, MITK_PP_TUPLE_EAT_4)(MITK_PP_EXPR_IIF(c, o)(72, s), p, o, m)
+# define MITK_PP_FOR_72_C(c, s, p, o, m) MITK_PP_IIF(c, m, MITK_PP_TUPLE_EAT_2)(73, s) MITK_PP_IIF(c, MITK_PP_FOR_73, MITK_PP_TUPLE_EAT_4)(MITK_PP_EXPR_IIF(c, o)(73, s), p, o, m)
+# define MITK_PP_FOR_73_C(c, s, p, o, m) MITK_PP_IIF(c, m, MITK_PP_TUPLE_EAT_2)(74, s) MITK_PP_IIF(c, MITK_PP_FOR_74, MITK_PP_TUPLE_EAT_4)(MITK_PP_EXPR_IIF(c, o)(74, s), p, o, m)
+# define MITK_PP_FOR_74_C(c, s, p, o, m) MITK_PP_IIF(c, m, MITK_PP_TUPLE_EAT_2)(75, s) MITK_PP_IIF(c, MITK_PP_FOR_75, MITK_PP_TUPLE_EAT_4)(MITK_PP_EXPR_IIF(c, o)(75, s), p, o, m)
+# define MITK_PP_FOR_75_C(c, s, p, o, m) MITK_PP_IIF(c, m, MITK_PP_TUPLE_EAT_2)(76, s) MITK_PP_IIF(c, MITK_PP_FOR_76, MITK_PP_TUPLE_EAT_4)(MITK_PP_EXPR_IIF(c, o)(76, s), p, o, m)
+# define MITK_PP_FOR_76_C(c, s, p, o, m) MITK_PP_IIF(c, m, MITK_PP_TUPLE_EAT_2)(77, s) MITK_PP_IIF(c, MITK_PP_FOR_77, MITK_PP_TUPLE_EAT_4)(MITK_PP_EXPR_IIF(c, o)(77, s), p, o, m)
+# define MITK_PP_FOR_77_C(c, s, p, o, m) MITK_PP_IIF(c, m, MITK_PP_TUPLE_EAT_2)(78, s) MITK_PP_IIF(c, MITK_PP_FOR_78, MITK_PP_TUPLE_EAT_4)(MITK_PP_EXPR_IIF(c, o)(78, s), p, o, m)
+# define MITK_PP_FOR_78_C(c, s, p, o, m) MITK_PP_IIF(c, m, MITK_PP_TUPLE_EAT_2)(79, s) MITK_PP_IIF(c, MITK_PP_FOR_79, MITK_PP_TUPLE_EAT_4)(MITK_PP_EXPR_IIF(c, o)(79, s), p, o, m)
+# define MITK_PP_FOR_79_C(c, s, p, o, m) MITK_PP_IIF(c, m, MITK_PP_TUPLE_EAT_2)(80, s) MITK_PP_IIF(c, MITK_PP_FOR_80, MITK_PP_TUPLE_EAT_4)(MITK_PP_EXPR_IIF(c, o)(80, s), p, o, m)
+# define MITK_PP_FOR_80_C(c, s, p, o, m) MITK_PP_IIF(c, m, MITK_PP_TUPLE_EAT_2)(81, s) MITK_PP_IIF(c, MITK_PP_FOR_81, MITK_PP_TUPLE_EAT_4)(MITK_PP_EXPR_IIF(c, o)(81, s), p, o, m)
+# define MITK_PP_FOR_81_C(c, s, p, o, m) MITK_PP_IIF(c, m, MITK_PP_TUPLE_EAT_2)(82, s) MITK_PP_IIF(c, MITK_PP_FOR_82, MITK_PP_TUPLE_EAT_4)(MITK_PP_EXPR_IIF(c, o)(82, s), p, o, m)
+# define MITK_PP_FOR_82_C(c, s, p, o, m) MITK_PP_IIF(c, m, MITK_PP_TUPLE_EAT_2)(83, s) MITK_PP_IIF(c, MITK_PP_FOR_83, MITK_PP_TUPLE_EAT_4)(MITK_PP_EXPR_IIF(c, o)(83, s), p, o, m)
+# define MITK_PP_FOR_83_C(c, s, p, o, m) MITK_PP_IIF(c, m, MITK_PP_TUPLE_EAT_2)(84, s) MITK_PP_IIF(c, MITK_PP_FOR_84, MITK_PP_TUPLE_EAT_4)(MITK_PP_EXPR_IIF(c, o)(84, s), p, o, m)
+# define MITK_PP_FOR_84_C(c, s, p, o, m) MITK_PP_IIF(c, m, MITK_PP_TUPLE_EAT_2)(85, s) MITK_PP_IIF(c, MITK_PP_FOR_85, MITK_PP_TUPLE_EAT_4)(MITK_PP_EXPR_IIF(c, o)(85, s), p, o, m)
+# define MITK_PP_FOR_85_C(c, s, p, o, m) MITK_PP_IIF(c, m, MITK_PP_TUPLE_EAT_2)(86, s) MITK_PP_IIF(c, MITK_PP_FOR_86, MITK_PP_TUPLE_EAT_4)(MITK_PP_EXPR_IIF(c, o)(86, s), p, o, m)
+# define MITK_PP_FOR_86_C(c, s, p, o, m) MITK_PP_IIF(c, m, MITK_PP_TUPLE_EAT_2)(87, s) MITK_PP_IIF(c, MITK_PP_FOR_87, MITK_PP_TUPLE_EAT_4)(MITK_PP_EXPR_IIF(c, o)(87, s), p, o, m)
+# define MITK_PP_FOR_87_C(c, s, p, o, m) MITK_PP_IIF(c, m, MITK_PP_TUPLE_EAT_2)(88, s) MITK_PP_IIF(c, MITK_PP_FOR_88, MITK_PP_TUPLE_EAT_4)(MITK_PP_EXPR_IIF(c, o)(88, s), p, o, m)
+# define MITK_PP_FOR_88_C(c, s, p, o, m) MITK_PP_IIF(c, m, MITK_PP_TUPLE_EAT_2)(89, s) MITK_PP_IIF(c, MITK_PP_FOR_89, MITK_PP_TUPLE_EAT_4)(MITK_PP_EXPR_IIF(c, o)(89, s), p, o, m)
+# define MITK_PP_FOR_89_C(c, s, p, o, m) MITK_PP_IIF(c, m, MITK_PP_TUPLE_EAT_2)(90, s) MITK_PP_IIF(c, MITK_PP_FOR_90, MITK_PP_TUPLE_EAT_4)(MITK_PP_EXPR_IIF(c, o)(90, s), p, o, m)
+# define MITK_PP_FOR_90_C(c, s, p, o, m) MITK_PP_IIF(c, m, MITK_PP_TUPLE_EAT_2)(91, s) MITK_PP_IIF(c, MITK_PP_FOR_91, MITK_PP_TUPLE_EAT_4)(MITK_PP_EXPR_IIF(c, o)(91, s), p, o, m)
+# define MITK_PP_FOR_91_C(c, s, p, o, m) MITK_PP_IIF(c, m, MITK_PP_TUPLE_EAT_2)(92, s) MITK_PP_IIF(c, MITK_PP_FOR_92, MITK_PP_TUPLE_EAT_4)(MITK_PP_EXPR_IIF(c, o)(92, s), p, o, m)
+# define MITK_PP_FOR_92_C(c, s, p, o, m) MITK_PP_IIF(c, m, MITK_PP_TUPLE_EAT_2)(93, s) MITK_PP_IIF(c, MITK_PP_FOR_93, MITK_PP_TUPLE_EAT_4)(MITK_PP_EXPR_IIF(c, o)(93, s), p, o, m)
+# define MITK_PP_FOR_93_C(c, s, p, o, m) MITK_PP_IIF(c, m, MITK_PP_TUPLE_EAT_2)(94, s) MITK_PP_IIF(c, MITK_PP_FOR_94, MITK_PP_TUPLE_EAT_4)(MITK_PP_EXPR_IIF(c, o)(94, s), p, o, m)
+# define MITK_PP_FOR_94_C(c, s, p, o, m) MITK_PP_IIF(c, m, MITK_PP_TUPLE_EAT_2)(95, s) MITK_PP_IIF(c, MITK_PP_FOR_95, MITK_PP_TUPLE_EAT_4)(MITK_PP_EXPR_IIF(c, o)(95, s), p, o, m)
+# define MITK_PP_FOR_95_C(c, s, p, o, m) MITK_PP_IIF(c, m, MITK_PP_TUPLE_EAT_2)(96, s) MITK_PP_IIF(c, MITK_PP_FOR_96, MITK_PP_TUPLE_EAT_4)(MITK_PP_EXPR_IIF(c, o)(96, s), p, o, m)
+# define MITK_PP_FOR_96_C(c, s, p, o, m) MITK_PP_IIF(c, m, MITK_PP_TUPLE_EAT_2)(97, s) MITK_PP_IIF(c, MITK_PP_FOR_97, MITK_PP_TUPLE_EAT_4)(MITK_PP_EXPR_IIF(c, o)(97, s), p, o, m)
+# define MITK_PP_FOR_97_C(c, s, p, o, m) MITK_PP_IIF(c, m, MITK_PP_TUPLE_EAT_2)(98, s) MITK_PP_IIF(c, MITK_PP_FOR_98, MITK_PP_TUPLE_EAT_4)(MITK_PP_EXPR_IIF(c, o)(98, s), p, o, m)
+# define MITK_PP_FOR_98_C(c, s, p, o, m) MITK_PP_IIF(c, m, MITK_PP_TUPLE_EAT_2)(99, s) MITK_PP_IIF(c, MITK_PP_FOR_99, MITK_PP_TUPLE_EAT_4)(MITK_PP_EXPR_IIF(c, o)(99, s), p, o, m)
+# define MITK_PP_FOR_99_C(c, s, p, o, m) MITK_PP_IIF(c, m, MITK_PP_TUPLE_EAT_2)(100, s) MITK_PP_IIF(c, MITK_PP_FOR_100, MITK_PP_TUPLE_EAT_4)(MITK_PP_EXPR_IIF(c, o)(100, s), p, o, m)
+# define MITK_PP_FOR_100_C(c, s, p, o, m) MITK_PP_IIF(c, m, MITK_PP_TUPLE_EAT_2)(101, s) MITK_PP_IIF(c, MITK_PP_FOR_101, MITK_PP_TUPLE_EAT_4)(MITK_PP_EXPR_IIF(c, o)(101, s), p, o, m)
+# define MITK_PP_FOR_101_C(c, s, p, o, m) MITK_PP_IIF(c, m, MITK_PP_TUPLE_EAT_2)(102, s) MITK_PP_IIF(c, MITK_PP_FOR_102, MITK_PP_TUPLE_EAT_4)(MITK_PP_EXPR_IIF(c, o)(102, s), p, o, m)
+# define MITK_PP_FOR_102_C(c, s, p, o, m) MITK_PP_IIF(c, m, MITK_PP_TUPLE_EAT_2)(103, s) MITK_PP_IIF(c, MITK_PP_FOR_103, MITK_PP_TUPLE_EAT_4)(MITK_PP_EXPR_IIF(c, o)(103, s), p, o, m)
+# define MITK_PP_FOR_103_C(c, s, p, o, m) MITK_PP_IIF(c, m, MITK_PP_TUPLE_EAT_2)(104, s) MITK_PP_IIF(c, MITK_PP_FOR_104, MITK_PP_TUPLE_EAT_4)(MITK_PP_EXPR_IIF(c, o)(104, s), p, o, m)
+# define MITK_PP_FOR_104_C(c, s, p, o, m) MITK_PP_IIF(c, m, MITK_PP_TUPLE_EAT_2)(105, s) MITK_PP_IIF(c, MITK_PP_FOR_105, MITK_PP_TUPLE_EAT_4)(MITK_PP_EXPR_IIF(c, o)(105, s), p, o, m)
+# define MITK_PP_FOR_105_C(c, s, p, o, m) MITK_PP_IIF(c, m, MITK_PP_TUPLE_EAT_2)(106, s) MITK_PP_IIF(c, MITK_PP_FOR_106, MITK_PP_TUPLE_EAT_4)(MITK_PP_EXPR_IIF(c, o)(106, s), p, o, m)
+# define MITK_PP_FOR_106_C(c, s, p, o, m) MITK_PP_IIF(c, m, MITK_PP_TUPLE_EAT_2)(107, s) MITK_PP_IIF(c, MITK_PP_FOR_107, MITK_PP_TUPLE_EAT_4)(MITK_PP_EXPR_IIF(c, o)(107, s), p, o, m)
+# define MITK_PP_FOR_107_C(c, s, p, o, m) MITK_PP_IIF(c, m, MITK_PP_TUPLE_EAT_2)(108, s) MITK_PP_IIF(c, MITK_PP_FOR_108, MITK_PP_TUPLE_EAT_4)(MITK_PP_EXPR_IIF(c, o)(108, s), p, o, m)
+# define MITK_PP_FOR_108_C(c, s, p, o, m) MITK_PP_IIF(c, m, MITK_PP_TUPLE_EAT_2)(109, s) MITK_PP_IIF(c, MITK_PP_FOR_109, MITK_PP_TUPLE_EAT_4)(MITK_PP_EXPR_IIF(c, o)(109, s), p, o, m)
+# define MITK_PP_FOR_109_C(c, s, p, o, m) MITK_PP_IIF(c, m, MITK_PP_TUPLE_EAT_2)(110, s) MITK_PP_IIF(c, MITK_PP_FOR_110, MITK_PP_TUPLE_EAT_4)(MITK_PP_EXPR_IIF(c, o)(110, s), p, o, m)
+# define MITK_PP_FOR_110_C(c, s, p, o, m) MITK_PP_IIF(c, m, MITK_PP_TUPLE_EAT_2)(111, s) MITK_PP_IIF(c, MITK_PP_FOR_111, MITK_PP_TUPLE_EAT_4)(MITK_PP_EXPR_IIF(c, o)(111, s), p, o, m)
+# define MITK_PP_FOR_111_C(c, s, p, o, m) MITK_PP_IIF(c, m, MITK_PP_TUPLE_EAT_2)(112, s) MITK_PP_IIF(c, MITK_PP_FOR_112, MITK_PP_TUPLE_EAT_4)(MITK_PP_EXPR_IIF(c, o)(112, s), p, o, m)
+# define MITK_PP_FOR_112_C(c, s, p, o, m) MITK_PP_IIF(c, m, MITK_PP_TUPLE_EAT_2)(113, s) MITK_PP_IIF(c, MITK_PP_FOR_113, MITK_PP_TUPLE_EAT_4)(MITK_PP_EXPR_IIF(c, o)(113, s), p, o, m)
+# define MITK_PP_FOR_113_C(c, s, p, o, m) MITK_PP_IIF(c, m, MITK_PP_TUPLE_EAT_2)(114, s) MITK_PP_IIF(c, MITK_PP_FOR_114, MITK_PP_TUPLE_EAT_4)(MITK_PP_EXPR_IIF(c, o)(114, s), p, o, m)
+# define MITK_PP_FOR_114_C(c, s, p, o, m) MITK_PP_IIF(c, m, MITK_PP_TUPLE_EAT_2)(115, s) MITK_PP_IIF(c, MITK_PP_FOR_115, MITK_PP_TUPLE_EAT_4)(MITK_PP_EXPR_IIF(c, o)(115, s), p, o, m)
+# define MITK_PP_FOR_115_C(c, s, p, o, m) MITK_PP_IIF(c, m, MITK_PP_TUPLE_EAT_2)(116, s) MITK_PP_IIF(c, MITK_PP_FOR_116, MITK_PP_TUPLE_EAT_4)(MITK_PP_EXPR_IIF(c, o)(116, s), p, o, m)
+# define MITK_PP_FOR_116_C(c, s, p, o, m) MITK_PP_IIF(c, m, MITK_PP_TUPLE_EAT_2)(117, s) MITK_PP_IIF(c, MITK_PP_FOR_117, MITK_PP_TUPLE_EAT_4)(MITK_PP_EXPR_IIF(c, o)(117, s), p, o, m)
+# define MITK_PP_FOR_117_C(c, s, p, o, m) MITK_PP_IIF(c, m, MITK_PP_TUPLE_EAT_2)(118, s) MITK_PP_IIF(c, MITK_PP_FOR_118, MITK_PP_TUPLE_EAT_4)(MITK_PP_EXPR_IIF(c, o)(118, s), p, o, m)
+# define MITK_PP_FOR_118_C(c, s, p, o, m) MITK_PP_IIF(c, m, MITK_PP_TUPLE_EAT_2)(119, s) MITK_PP_IIF(c, MITK_PP_FOR_119, MITK_PP_TUPLE_EAT_4)(MITK_PP_EXPR_IIF(c, o)(119, s), p, o, m)
+# define MITK_PP_FOR_119_C(c, s, p, o, m) MITK_PP_IIF(c, m, MITK_PP_TUPLE_EAT_2)(120, s) MITK_PP_IIF(c, MITK_PP_FOR_120, MITK_PP_TUPLE_EAT_4)(MITK_PP_EXPR_IIF(c, o)(120, s), p, o, m)
+# define MITK_PP_FOR_120_C(c, s, p, o, m) MITK_PP_IIF(c, m, MITK_PP_TUPLE_EAT_2)(121, s) MITK_PP_IIF(c, MITK_PP_FOR_121, MITK_PP_TUPLE_EAT_4)(MITK_PP_EXPR_IIF(c, o)(121, s), p, o, m)
+# define MITK_PP_FOR_121_C(c, s, p, o, m) MITK_PP_IIF(c, m, MITK_PP_TUPLE_EAT_2)(122, s) MITK_PP_IIF(c, MITK_PP_FOR_122, MITK_PP_TUPLE_EAT_4)(MITK_PP_EXPR_IIF(c, o)(122, s), p, o, m)
+# define MITK_PP_FOR_122_C(c, s, p, o, m) MITK_PP_IIF(c, m, MITK_PP_TUPLE_EAT_2)(123, s) MITK_PP_IIF(c, MITK_PP_FOR_123, MITK_PP_TUPLE_EAT_4)(MITK_PP_EXPR_IIF(c, o)(123, s), p, o, m)
+# define MITK_PP_FOR_123_C(c, s, p, o, m) MITK_PP_IIF(c, m, MITK_PP_TUPLE_EAT_2)(124, s) MITK_PP_IIF(c, MITK_PP_FOR_124, MITK_PP_TUPLE_EAT_4)(MITK_PP_EXPR_IIF(c, o)(124, s), p, o, m)
+# define MITK_PP_FOR_124_C(c, s, p, o, m) MITK_PP_IIF(c, m, MITK_PP_TUPLE_EAT_2)(125, s) MITK_PP_IIF(c, MITK_PP_FOR_125, MITK_PP_TUPLE_EAT_4)(MITK_PP_EXPR_IIF(c, o)(125, s), p, o, m)
+# define MITK_PP_FOR_125_C(c, s, p, o, m) MITK_PP_IIF(c, m, MITK_PP_TUPLE_EAT_2)(126, s) MITK_PP_IIF(c, MITK_PP_FOR_126, MITK_PP_TUPLE_EAT_4)(MITK_PP_EXPR_IIF(c, o)(126, s), p, o, m)
+# define MITK_PP_FOR_126_C(c, s, p, o, m) MITK_PP_IIF(c, m, MITK_PP_TUPLE_EAT_2)(127, s) MITK_PP_IIF(c, MITK_PP_FOR_127, MITK_PP_TUPLE_EAT_4)(MITK_PP_EXPR_IIF(c, o)(127, s), p, o, m)
+# define MITK_PP_FOR_127_C(c, s, p, o, m) MITK_PP_IIF(c, m, MITK_PP_TUPLE_EAT_2)(128, s) MITK_PP_IIF(c, MITK_PP_FOR_128, MITK_PP_TUPLE_EAT_4)(MITK_PP_EXPR_IIF(c, o)(128, s), p, o, m)
+# define MITK_PP_FOR_128_C(c, s, p, o, m) MITK_PP_IIF(c, m, MITK_PP_TUPLE_EAT_2)(129, s) MITK_PP_IIF(c, MITK_PP_FOR_129, MITK_PP_TUPLE_EAT_4)(MITK_PP_EXPR_IIF(c, o)(129, s), p, o, m)
+# define MITK_PP_FOR_129_C(c, s, p, o, m) MITK_PP_IIF(c, m, MITK_PP_TUPLE_EAT_2)(130, s) MITK_PP_IIF(c, MITK_PP_FOR_130, MITK_PP_TUPLE_EAT_4)(MITK_PP_EXPR_IIF(c, o)(130, s), p, o, m)
+# define MITK_PP_FOR_130_C(c, s, p, o, m) MITK_PP_IIF(c, m, MITK_PP_TUPLE_EAT_2)(131, s) MITK_PP_IIF(c, MITK_PP_FOR_131, MITK_PP_TUPLE_EAT_4)(MITK_PP_EXPR_IIF(c, o)(131, s), p, o, m)
+# define MITK_PP_FOR_131_C(c, s, p, o, m) MITK_PP_IIF(c, m, MITK_PP_TUPLE_EAT_2)(132, s) MITK_PP_IIF(c, MITK_PP_FOR_132, MITK_PP_TUPLE_EAT_4)(MITK_PP_EXPR_IIF(c, o)(132, s), p, o, m)
+# define MITK_PP_FOR_132_C(c, s, p, o, m) MITK_PP_IIF(c, m, MITK_PP_TUPLE_EAT_2)(133, s) MITK_PP_IIF(c, MITK_PP_FOR_133, MITK_PP_TUPLE_EAT_4)(MITK_PP_EXPR_IIF(c, o)(133, s), p, o, m)
+# define MITK_PP_FOR_133_C(c, s, p, o, m) MITK_PP_IIF(c, m, MITK_PP_TUPLE_EAT_2)(134, s) MITK_PP_IIF(c, MITK_PP_FOR_134, MITK_PP_TUPLE_EAT_4)(MITK_PP_EXPR_IIF(c, o)(134, s), p, o, m)
+# define MITK_PP_FOR_134_C(c, s, p, o, m) MITK_PP_IIF(c, m, MITK_PP_TUPLE_EAT_2)(135, s) MITK_PP_IIF(c, MITK_PP_FOR_135, MITK_PP_TUPLE_EAT_4)(MITK_PP_EXPR_IIF(c, o)(135, s), p, o, m)
+# define MITK_PP_FOR_135_C(c, s, p, o, m) MITK_PP_IIF(c, m, MITK_PP_TUPLE_EAT_2)(136, s) MITK_PP_IIF(c, MITK_PP_FOR_136, MITK_PP_TUPLE_EAT_4)(MITK_PP_EXPR_IIF(c, o)(136, s), p, o, m)
+# define MITK_PP_FOR_136_C(c, s, p, o, m) MITK_PP_IIF(c, m, MITK_PP_TUPLE_EAT_2)(137, s) MITK_PP_IIF(c, MITK_PP_FOR_137, MITK_PP_TUPLE_EAT_4)(MITK_PP_EXPR_IIF(c, o)(137, s), p, o, m)
+# define MITK_PP_FOR_137_C(c, s, p, o, m) MITK_PP_IIF(c, m, MITK_PP_TUPLE_EAT_2)(138, s) MITK_PP_IIF(c, MITK_PP_FOR_138, MITK_PP_TUPLE_EAT_4)(MITK_PP_EXPR_IIF(c, o)(138, s), p, o, m)
+# define MITK_PP_FOR_138_C(c, s, p, o, m) MITK_PP_IIF(c, m, MITK_PP_TUPLE_EAT_2)(139, s) MITK_PP_IIF(c, MITK_PP_FOR_139, MITK_PP_TUPLE_EAT_4)(MITK_PP_EXPR_IIF(c, o)(139, s), p, o, m)
+# define MITK_PP_FOR_139_C(c, s, p, o, m) MITK_PP_IIF(c, m, MITK_PP_TUPLE_EAT_2)(140, s) MITK_PP_IIF(c, MITK_PP_FOR_140, MITK_PP_TUPLE_EAT_4)(MITK_PP_EXPR_IIF(c, o)(140, s), p, o, m)
+# define MITK_PP_FOR_140_C(c, s, p, o, m) MITK_PP_IIF(c, m, MITK_PP_TUPLE_EAT_2)(141, s) MITK_PP_IIF(c, MITK_PP_FOR_141, MITK_PP_TUPLE_EAT_4)(MITK_PP_EXPR_IIF(c, o)(141, s), p, o, m)
+# define MITK_PP_FOR_141_C(c, s, p, o, m) MITK_PP_IIF(c, m, MITK_PP_TUPLE_EAT_2)(142, s) MITK_PP_IIF(c, MITK_PP_FOR_142, MITK_PP_TUPLE_EAT_4)(MITK_PP_EXPR_IIF(c, o)(142, s), p, o, m)
+# define MITK_PP_FOR_142_C(c, s, p, o, m) MITK_PP_IIF(c, m, MITK_PP_TUPLE_EAT_2)(143, s) MITK_PP_IIF(c, MITK_PP_FOR_143, MITK_PP_TUPLE_EAT_4)(MITK_PP_EXPR_IIF(c, o)(143, s), p, o, m)
+# define MITK_PP_FOR_143_C(c, s, p, o, m) MITK_PP_IIF(c, m, MITK_PP_TUPLE_EAT_2)(144, s) MITK_PP_IIF(c, MITK_PP_FOR_144, MITK_PP_TUPLE_EAT_4)(MITK_PP_EXPR_IIF(c, o)(144, s), p, o, m)
+# define MITK_PP_FOR_144_C(c, s, p, o, m) MITK_PP_IIF(c, m, MITK_PP_TUPLE_EAT_2)(145, s) MITK_PP_IIF(c, MITK_PP_FOR_145, MITK_PP_TUPLE_EAT_4)(MITK_PP_EXPR_IIF(c, o)(145, s), p, o, m)
+# define MITK_PP_FOR_145_C(c, s, p, o, m) MITK_PP_IIF(c, m, MITK_PP_TUPLE_EAT_2)(146, s) MITK_PP_IIF(c, MITK_PP_FOR_146, MITK_PP_TUPLE_EAT_4)(MITK_PP_EXPR_IIF(c, o)(146, s), p, o, m)
+# define MITK_PP_FOR_146_C(c, s, p, o, m) MITK_PP_IIF(c, m, MITK_PP_TUPLE_EAT_2)(147, s) MITK_PP_IIF(c, MITK_PP_FOR_147, MITK_PP_TUPLE_EAT_4)(MITK_PP_EXPR_IIF(c, o)(147, s), p, o, m)
+# define MITK_PP_FOR_147_C(c, s, p, o, m) MITK_PP_IIF(c, m, MITK_PP_TUPLE_EAT_2)(148, s) MITK_PP_IIF(c, MITK_PP_FOR_148, MITK_PP_TUPLE_EAT_4)(MITK_PP_EXPR_IIF(c, o)(148, s), p, o, m)
+# define MITK_PP_FOR_148_C(c, s, p, o, m) MITK_PP_IIF(c, m, MITK_PP_TUPLE_EAT_2)(149, s) MITK_PP_IIF(c, MITK_PP_FOR_149, MITK_PP_TUPLE_EAT_4)(MITK_PP_EXPR_IIF(c, o)(149, s), p, o, m)
+# define MITK_PP_FOR_149_C(c, s, p, o, m) MITK_PP_IIF(c, m, MITK_PP_TUPLE_EAT_2)(150, s) MITK_PP_IIF(c, MITK_PP_FOR_150, MITK_PP_TUPLE_EAT_4)(MITK_PP_EXPR_IIF(c, o)(150, s), p, o, m)
+# define MITK_PP_FOR_150_C(c, s, p, o, m) MITK_PP_IIF(c, m, MITK_PP_TUPLE_EAT_2)(151, s) MITK_PP_IIF(c, MITK_PP_FOR_151, MITK_PP_TUPLE_EAT_4)(MITK_PP_EXPR_IIF(c, o)(151, s), p, o, m)
+# define MITK_PP_FOR_151_C(c, s, p, o, m) MITK_PP_IIF(c, m, MITK_PP_TUPLE_EAT_2)(152, s) MITK_PP_IIF(c, MITK_PP_FOR_152, MITK_PP_TUPLE_EAT_4)(MITK_PP_EXPR_IIF(c, o)(152, s), p, o, m)
+# define MITK_PP_FOR_152_C(c, s, p, o, m) MITK_PP_IIF(c, m, MITK_PP_TUPLE_EAT_2)(153, s) MITK_PP_IIF(c, MITK_PP_FOR_153, MITK_PP_TUPLE_EAT_4)(MITK_PP_EXPR_IIF(c, o)(153, s), p, o, m)
+# define MITK_PP_FOR_153_C(c, s, p, o, m) MITK_PP_IIF(c, m, MITK_PP_TUPLE_EAT_2)(154, s) MITK_PP_IIF(c, MITK_PP_FOR_154, MITK_PP_TUPLE_EAT_4)(MITK_PP_EXPR_IIF(c, o)(154, s), p, o, m)
+# define MITK_PP_FOR_154_C(c, s, p, o, m) MITK_PP_IIF(c, m, MITK_PP_TUPLE_EAT_2)(155, s) MITK_PP_IIF(c, MITK_PP_FOR_155, MITK_PP_TUPLE_EAT_4)(MITK_PP_EXPR_IIF(c, o)(155, s), p, o, m)
+# define MITK_PP_FOR_155_C(c, s, p, o, m) MITK_PP_IIF(c, m, MITK_PP_TUPLE_EAT_2)(156, s) MITK_PP_IIF(c, MITK_PP_FOR_156, MITK_PP_TUPLE_EAT_4)(MITK_PP_EXPR_IIF(c, o)(156, s), p, o, m)
+# define MITK_PP_FOR_156_C(c, s, p, o, m) MITK_PP_IIF(c, m, MITK_PP_TUPLE_EAT_2)(157, s) MITK_PP_IIF(c, MITK_PP_FOR_157, MITK_PP_TUPLE_EAT_4)(MITK_PP_EXPR_IIF(c, o)(157, s), p, o, m)
+# define MITK_PP_FOR_157_C(c, s, p, o, m) MITK_PP_IIF(c, m, MITK_PP_TUPLE_EAT_2)(158, s) MITK_PP_IIF(c, MITK_PP_FOR_158, MITK_PP_TUPLE_EAT_4)(MITK_PP_EXPR_IIF(c, o)(158, s), p, o, m)
+# define MITK_PP_FOR_158_C(c, s, p, o, m) MITK_PP_IIF(c, m, MITK_PP_TUPLE_EAT_2)(159, s) MITK_PP_IIF(c, MITK_PP_FOR_159, MITK_PP_TUPLE_EAT_4)(MITK_PP_EXPR_IIF(c, o)(159, s), p, o, m)
+# define MITK_PP_FOR_159_C(c, s, p, o, m) MITK_PP_IIF(c, m, MITK_PP_TUPLE_EAT_2)(160, s) MITK_PP_IIF(c, MITK_PP_FOR_160, MITK_PP_TUPLE_EAT_4)(MITK_PP_EXPR_IIF(c, o)(160, s), p, o, m)
+# define MITK_PP_FOR_160_C(c, s, p, o, m) MITK_PP_IIF(c, m, MITK_PP_TUPLE_EAT_2)(161, s) MITK_PP_IIF(c, MITK_PP_FOR_161, MITK_PP_TUPLE_EAT_4)(MITK_PP_EXPR_IIF(c, o)(161, s), p, o, m)
+# define MITK_PP_FOR_161_C(c, s, p, o, m) MITK_PP_IIF(c, m, MITK_PP_TUPLE_EAT_2)(162, s) MITK_PP_IIF(c, MITK_PP_FOR_162, MITK_PP_TUPLE_EAT_4)(MITK_PP_EXPR_IIF(c, o)(162, s), p, o, m)
+# define MITK_PP_FOR_162_C(c, s, p, o, m) MITK_PP_IIF(c, m, MITK_PP_TUPLE_EAT_2)(163, s) MITK_PP_IIF(c, MITK_PP_FOR_163, MITK_PP_TUPLE_EAT_4)(MITK_PP_EXPR_IIF(c, o)(163, s), p, o, m)
+# define MITK_PP_FOR_163_C(c, s, p, o, m) MITK_PP_IIF(c, m, MITK_PP_TUPLE_EAT_2)(164, s) MITK_PP_IIF(c, MITK_PP_FOR_164, MITK_PP_TUPLE_EAT_4)(MITK_PP_EXPR_IIF(c, o)(164, s), p, o, m)
+# define MITK_PP_FOR_164_C(c, s, p, o, m) MITK_PP_IIF(c, m, MITK_PP_TUPLE_EAT_2)(165, s) MITK_PP_IIF(c, MITK_PP_FOR_165, MITK_PP_TUPLE_EAT_4)(MITK_PP_EXPR_IIF(c, o)(165, s), p, o, m)
+# define MITK_PP_FOR_165_C(c, s, p, o, m) MITK_PP_IIF(c, m, MITK_PP_TUPLE_EAT_2)(166, s) MITK_PP_IIF(c, MITK_PP_FOR_166, MITK_PP_TUPLE_EAT_4)(MITK_PP_EXPR_IIF(c, o)(166, s), p, o, m)
+# define MITK_PP_FOR_166_C(c, s, p, o, m) MITK_PP_IIF(c, m, MITK_PP_TUPLE_EAT_2)(167, s) MITK_PP_IIF(c, MITK_PP_FOR_167, MITK_PP_TUPLE_EAT_4)(MITK_PP_EXPR_IIF(c, o)(167, s), p, o, m)
+# define MITK_PP_FOR_167_C(c, s, p, o, m) MITK_PP_IIF(c, m, MITK_PP_TUPLE_EAT_2)(168, s) MITK_PP_IIF(c, MITK_PP_FOR_168, MITK_PP_TUPLE_EAT_4)(MITK_PP_EXPR_IIF(c, o)(168, s), p, o, m)
+# define MITK_PP_FOR_168_C(c, s, p, o, m) MITK_PP_IIF(c, m, MITK_PP_TUPLE_EAT_2)(169, s) MITK_PP_IIF(c, MITK_PP_FOR_169, MITK_PP_TUPLE_EAT_4)(MITK_PP_EXPR_IIF(c, o)(169, s), p, o, m)
+# define MITK_PP_FOR_169_C(c, s, p, o, m) MITK_PP_IIF(c, m, MITK_PP_TUPLE_EAT_2)(170, s) MITK_PP_IIF(c, MITK_PP_FOR_170, MITK_PP_TUPLE_EAT_4)(MITK_PP_EXPR_IIF(c, o)(170, s), p, o, m)
+# define MITK_PP_FOR_170_C(c, s, p, o, m) MITK_PP_IIF(c, m, MITK_PP_TUPLE_EAT_2)(171, s) MITK_PP_IIF(c, MITK_PP_FOR_171, MITK_PP_TUPLE_EAT_4)(MITK_PP_EXPR_IIF(c, o)(171, s), p, o, m)
+# define MITK_PP_FOR_171_C(c, s, p, o, m) MITK_PP_IIF(c, m, MITK_PP_TUPLE_EAT_2)(172, s) MITK_PP_IIF(c, MITK_PP_FOR_172, MITK_PP_TUPLE_EAT_4)(MITK_PP_EXPR_IIF(c, o)(172, s), p, o, m)
+# define MITK_PP_FOR_172_C(c, s, p, o, m) MITK_PP_IIF(c, m, MITK_PP_TUPLE_EAT_2)(173, s) MITK_PP_IIF(c, MITK_PP_FOR_173, MITK_PP_TUPLE_EAT_4)(MITK_PP_EXPR_IIF(c, o)(173, s), p, o, m)
+# define MITK_PP_FOR_173_C(c, s, p, o, m) MITK_PP_IIF(c, m, MITK_PP_TUPLE_EAT_2)(174, s) MITK_PP_IIF(c, MITK_PP_FOR_174, MITK_PP_TUPLE_EAT_4)(MITK_PP_EXPR_IIF(c, o)(174, s), p, o, m)
+# define MITK_PP_FOR_174_C(c, s, p, o, m) MITK_PP_IIF(c, m, MITK_PP_TUPLE_EAT_2)(175, s) MITK_PP_IIF(c, MITK_PP_FOR_175, MITK_PP_TUPLE_EAT_4)(MITK_PP_EXPR_IIF(c, o)(175, s), p, o, m)
+# define MITK_PP_FOR_175_C(c, s, p, o, m) MITK_PP_IIF(c, m, MITK_PP_TUPLE_EAT_2)(176, s) MITK_PP_IIF(c, MITK_PP_FOR_176, MITK_PP_TUPLE_EAT_4)(MITK_PP_EXPR_IIF(c, o)(176, s), p, o, m)
+# define MITK_PP_FOR_176_C(c, s, p, o, m) MITK_PP_IIF(c, m, MITK_PP_TUPLE_EAT_2)(177, s) MITK_PP_IIF(c, MITK_PP_FOR_177, MITK_PP_TUPLE_EAT_4)(MITK_PP_EXPR_IIF(c, o)(177, s), p, o, m)
+# define MITK_PP_FOR_177_C(c, s, p, o, m) MITK_PP_IIF(c, m, MITK_PP_TUPLE_EAT_2)(178, s) MITK_PP_IIF(c, MITK_PP_FOR_178, MITK_PP_TUPLE_EAT_4)(MITK_PP_EXPR_IIF(c, o)(178, s), p, o, m)
+# define MITK_PP_FOR_178_C(c, s, p, o, m) MITK_PP_IIF(c, m, MITK_PP_TUPLE_EAT_2)(179, s) MITK_PP_IIF(c, MITK_PP_FOR_179, MITK_PP_TUPLE_EAT_4)(MITK_PP_EXPR_IIF(c, o)(179, s), p, o, m)
+# define MITK_PP_FOR_179_C(c, s, p, o, m) MITK_PP_IIF(c, m, MITK_PP_TUPLE_EAT_2)(180, s) MITK_PP_IIF(c, MITK_PP_FOR_180, MITK_PP_TUPLE_EAT_4)(MITK_PP_EXPR_IIF(c, o)(180, s), p, o, m)
+# define MITK_PP_FOR_180_C(c, s, p, o, m) MITK_PP_IIF(c, m, MITK_PP_TUPLE_EAT_2)(181, s) MITK_PP_IIF(c, MITK_PP_FOR_181, MITK_PP_TUPLE_EAT_4)(MITK_PP_EXPR_IIF(c, o)(181, s), p, o, m)
+# define MITK_PP_FOR_181_C(c, s, p, o, m) MITK_PP_IIF(c, m, MITK_PP_TUPLE_EAT_2)(182, s) MITK_PP_IIF(c, MITK_PP_FOR_182, MITK_PP_TUPLE_EAT_4)(MITK_PP_EXPR_IIF(c, o)(182, s), p, o, m)
+# define MITK_PP_FOR_182_C(c, s, p, o, m) MITK_PP_IIF(c, m, MITK_PP_TUPLE_EAT_2)(183, s) MITK_PP_IIF(c, MITK_PP_FOR_183, MITK_PP_TUPLE_EAT_4)(MITK_PP_EXPR_IIF(c, o)(183, s), p, o, m)
+# define MITK_PP_FOR_183_C(c, s, p, o, m) MITK_PP_IIF(c, m, MITK_PP_TUPLE_EAT_2)(184, s) MITK_PP_IIF(c, MITK_PP_FOR_184, MITK_PP_TUPLE_EAT_4)(MITK_PP_EXPR_IIF(c, o)(184, s), p, o, m)
+# define MITK_PP_FOR_184_C(c, s, p, o, m) MITK_PP_IIF(c, m, MITK_PP_TUPLE_EAT_2)(185, s) MITK_PP_IIF(c, MITK_PP_FOR_185, MITK_PP_TUPLE_EAT_4)(MITK_PP_EXPR_IIF(c, o)(185, s), p, o, m)
+# define MITK_PP_FOR_185_C(c, s, p, o, m) MITK_PP_IIF(c, m, MITK_PP_TUPLE_EAT_2)(186, s) MITK_PP_IIF(c, MITK_PP_FOR_186, MITK_PP_TUPLE_EAT_4)(MITK_PP_EXPR_IIF(c, o)(186, s), p, o, m)
+# define MITK_PP_FOR_186_C(c, s, p, o, m) MITK_PP_IIF(c, m, MITK_PP_TUPLE_EAT_2)(187, s) MITK_PP_IIF(c, MITK_PP_FOR_187, MITK_PP_TUPLE_EAT_4)(MITK_PP_EXPR_IIF(c, o)(187, s), p, o, m)
+# define MITK_PP_FOR_187_C(c, s, p, o, m) MITK_PP_IIF(c, m, MITK_PP_TUPLE_EAT_2)(188, s) MITK_PP_IIF(c, MITK_PP_FOR_188, MITK_PP_TUPLE_EAT_4)(MITK_PP_EXPR_IIF(c, o)(188, s), p, o, m)
+# define MITK_PP_FOR_188_C(c, s, p, o, m) MITK_PP_IIF(c, m, MITK_PP_TUPLE_EAT_2)(189, s) MITK_PP_IIF(c, MITK_PP_FOR_189, MITK_PP_TUPLE_EAT_4)(MITK_PP_EXPR_IIF(c, o)(189, s), p, o, m)
+# define MITK_PP_FOR_189_C(c, s, p, o, m) MITK_PP_IIF(c, m, MITK_PP_TUPLE_EAT_2)(190, s) MITK_PP_IIF(c, MITK_PP_FOR_190, MITK_PP_TUPLE_EAT_4)(MITK_PP_EXPR_IIF(c, o)(190, s), p, o, m)
+# define MITK_PP_FOR_190_C(c, s, p, o, m) MITK_PP_IIF(c, m, MITK_PP_TUPLE_EAT_2)(191, s) MITK_PP_IIF(c, MITK_PP_FOR_191, MITK_PP_TUPLE_EAT_4)(MITK_PP_EXPR_IIF(c, o)(191, s), p, o, m)
+# define MITK_PP_FOR_191_C(c, s, p, o, m) MITK_PP_IIF(c, m, MITK_PP_TUPLE_EAT_2)(192, s) MITK_PP_IIF(c, MITK_PP_FOR_192, MITK_PP_TUPLE_EAT_4)(MITK_PP_EXPR_IIF(c, o)(192, s), p, o, m)
+# define MITK_PP_FOR_192_C(c, s, p, o, m) MITK_PP_IIF(c, m, MITK_PP_TUPLE_EAT_2)(193, s) MITK_PP_IIF(c, MITK_PP_FOR_193, MITK_PP_TUPLE_EAT_4)(MITK_PP_EXPR_IIF(c, o)(193, s), p, o, m)
+# define MITK_PP_FOR_193_C(c, s, p, o, m) MITK_PP_IIF(c, m, MITK_PP_TUPLE_EAT_2)(194, s) MITK_PP_IIF(c, MITK_PP_FOR_194, MITK_PP_TUPLE_EAT_4)(MITK_PP_EXPR_IIF(c, o)(194, s), p, o, m)
+# define MITK_PP_FOR_194_C(c, s, p, o, m) MITK_PP_IIF(c, m, MITK_PP_TUPLE_EAT_2)(195, s) MITK_PP_IIF(c, MITK_PP_FOR_195, MITK_PP_TUPLE_EAT_4)(MITK_PP_EXPR_IIF(c, o)(195, s), p, o, m)
+# define MITK_PP_FOR_195_C(c, s, p, o, m) MITK_PP_IIF(c, m, MITK_PP_TUPLE_EAT_2)(196, s) MITK_PP_IIF(c, MITK_PP_FOR_196, MITK_PP_TUPLE_EAT_4)(MITK_PP_EXPR_IIF(c, o)(196, s), p, o, m)
+# define MITK_PP_FOR_196_C(c, s, p, o, m) MITK_PP_IIF(c, m, MITK_PP_TUPLE_EAT_2)(197, s) MITK_PP_IIF(c, MITK_PP_FOR_197, MITK_PP_TUPLE_EAT_4)(MITK_PP_EXPR_IIF(c, o)(197, s), p, o, m)
+# define MITK_PP_FOR_197_C(c, s, p, o, m) MITK_PP_IIF(c, m, MITK_PP_TUPLE_EAT_2)(198, s) MITK_PP_IIF(c, MITK_PP_FOR_198, MITK_PP_TUPLE_EAT_4)(MITK_PP_EXPR_IIF(c, o)(198, s), p, o, m)
+# define MITK_PP_FOR_198_C(c, s, p, o, m) MITK_PP_IIF(c, m, MITK_PP_TUPLE_EAT_2)(199, s) MITK_PP_IIF(c, MITK_PP_FOR_199, MITK_PP_TUPLE_EAT_4)(MITK_PP_EXPR_IIF(c, o)(199, s), p, o, m)
+# define MITK_PP_FOR_199_C(c, s, p, o, m) MITK_PP_IIF(c, m, MITK_PP_TUPLE_EAT_2)(200, s) MITK_PP_IIF(c, MITK_PP_FOR_200, MITK_PP_TUPLE_EAT_4)(MITK_PP_EXPR_IIF(c, o)(200, s), p, o, m)
+# define MITK_PP_FOR_200_C(c, s, p, o, m) MITK_PP_IIF(c, m, MITK_PP_TUPLE_EAT_2)(201, s) MITK_PP_IIF(c, MITK_PP_FOR_201, MITK_PP_TUPLE_EAT_4)(MITK_PP_EXPR_IIF(c, o)(201, s), p, o, m)
+# define MITK_PP_FOR_201_C(c, s, p, o, m) MITK_PP_IIF(c, m, MITK_PP_TUPLE_EAT_2)(202, s) MITK_PP_IIF(c, MITK_PP_FOR_202, MITK_PP_TUPLE_EAT_4)(MITK_PP_EXPR_IIF(c, o)(202, s), p, o, m)
+# define MITK_PP_FOR_202_C(c, s, p, o, m) MITK_PP_IIF(c, m, MITK_PP_TUPLE_EAT_2)(203, s) MITK_PP_IIF(c, MITK_PP_FOR_203, MITK_PP_TUPLE_EAT_4)(MITK_PP_EXPR_IIF(c, o)(203, s), p, o, m)
+# define MITK_PP_FOR_203_C(c, s, p, o, m) MITK_PP_IIF(c, m, MITK_PP_TUPLE_EAT_2)(204, s) MITK_PP_IIF(c, MITK_PP_FOR_204, MITK_PP_TUPLE_EAT_4)(MITK_PP_EXPR_IIF(c, o)(204, s), p, o, m)
+# define MITK_PP_FOR_204_C(c, s, p, o, m) MITK_PP_IIF(c, m, MITK_PP_TUPLE_EAT_2)(205, s) MITK_PP_IIF(c, MITK_PP_FOR_205, MITK_PP_TUPLE_EAT_4)(MITK_PP_EXPR_IIF(c, o)(205, s), p, o, m)
+# define MITK_PP_FOR_205_C(c, s, p, o, m) MITK_PP_IIF(c, m, MITK_PP_TUPLE_EAT_2)(206, s) MITK_PP_IIF(c, MITK_PP_FOR_206, MITK_PP_TUPLE_EAT_4)(MITK_PP_EXPR_IIF(c, o)(206, s), p, o, m)
+# define MITK_PP_FOR_206_C(c, s, p, o, m) MITK_PP_IIF(c, m, MITK_PP_TUPLE_EAT_2)(207, s) MITK_PP_IIF(c, MITK_PP_FOR_207, MITK_PP_TUPLE_EAT_4)(MITK_PP_EXPR_IIF(c, o)(207, s), p, o, m)
+# define MITK_PP_FOR_207_C(c, s, p, o, m) MITK_PP_IIF(c, m, MITK_PP_TUPLE_EAT_2)(208, s) MITK_PP_IIF(c, MITK_PP_FOR_208, MITK_PP_TUPLE_EAT_4)(MITK_PP_EXPR_IIF(c, o)(208, s), p, o, m)
+# define MITK_PP_FOR_208_C(c, s, p, o, m) MITK_PP_IIF(c, m, MITK_PP_TUPLE_EAT_2)(209, s) MITK_PP_IIF(c, MITK_PP_FOR_209, MITK_PP_TUPLE_EAT_4)(MITK_PP_EXPR_IIF(c, o)(209, s), p, o, m)
+# define MITK_PP_FOR_209_C(c, s, p, o, m) MITK_PP_IIF(c, m, MITK_PP_TUPLE_EAT_2)(210, s) MITK_PP_IIF(c, MITK_PP_FOR_210, MITK_PP_TUPLE_EAT_4)(MITK_PP_EXPR_IIF(c, o)(210, s), p, o, m)
+# define MITK_PP_FOR_210_C(c, s, p, o, m) MITK_PP_IIF(c, m, MITK_PP_TUPLE_EAT_2)(211, s) MITK_PP_IIF(c, MITK_PP_FOR_211, MITK_PP_TUPLE_EAT_4)(MITK_PP_EXPR_IIF(c, o)(211, s), p, o, m)
+# define MITK_PP_FOR_211_C(c, s, p, o, m) MITK_PP_IIF(c, m, MITK_PP_TUPLE_EAT_2)(212, s) MITK_PP_IIF(c, MITK_PP_FOR_212, MITK_PP_TUPLE_EAT_4)(MITK_PP_EXPR_IIF(c, o)(212, s), p, o, m)
+# define MITK_PP_FOR_212_C(c, s, p, o, m) MITK_PP_IIF(c, m, MITK_PP_TUPLE_EAT_2)(213, s) MITK_PP_IIF(c, MITK_PP_FOR_213, MITK_PP_TUPLE_EAT_4)(MITK_PP_EXPR_IIF(c, o)(213, s), p, o, m)
+# define MITK_PP_FOR_213_C(c, s, p, o, m) MITK_PP_IIF(c, m, MITK_PP_TUPLE_EAT_2)(214, s) MITK_PP_IIF(c, MITK_PP_FOR_214, MITK_PP_TUPLE_EAT_4)(MITK_PP_EXPR_IIF(c, o)(214, s), p, o, m)
+# define MITK_PP_FOR_214_C(c, s, p, o, m) MITK_PP_IIF(c, m, MITK_PP_TUPLE_EAT_2)(215, s) MITK_PP_IIF(c, MITK_PP_FOR_215, MITK_PP_TUPLE_EAT_4)(MITK_PP_EXPR_IIF(c, o)(215, s), p, o, m)
+# define MITK_PP_FOR_215_C(c, s, p, o, m) MITK_PP_IIF(c, m, MITK_PP_TUPLE_EAT_2)(216, s) MITK_PP_IIF(c, MITK_PP_FOR_216, MITK_PP_TUPLE_EAT_4)(MITK_PP_EXPR_IIF(c, o)(216, s), p, o, m)
+# define MITK_PP_FOR_216_C(c, s, p, o, m) MITK_PP_IIF(c, m, MITK_PP_TUPLE_EAT_2)(217, s) MITK_PP_IIF(c, MITK_PP_FOR_217, MITK_PP_TUPLE_EAT_4)(MITK_PP_EXPR_IIF(c, o)(217, s), p, o, m)
+# define MITK_PP_FOR_217_C(c, s, p, o, m) MITK_PP_IIF(c, m, MITK_PP_TUPLE_EAT_2)(218, s) MITK_PP_IIF(c, MITK_PP_FOR_218, MITK_PP_TUPLE_EAT_4)(MITK_PP_EXPR_IIF(c, o)(218, s), p, o, m)
+# define MITK_PP_FOR_218_C(c, s, p, o, m) MITK_PP_IIF(c, m, MITK_PP_TUPLE_EAT_2)(219, s) MITK_PP_IIF(c, MITK_PP_FOR_219, MITK_PP_TUPLE_EAT_4)(MITK_PP_EXPR_IIF(c, o)(219, s), p, o, m)
+# define MITK_PP_FOR_219_C(c, s, p, o, m) MITK_PP_IIF(c, m, MITK_PP_TUPLE_EAT_2)(220, s) MITK_PP_IIF(c, MITK_PP_FOR_220, MITK_PP_TUPLE_EAT_4)(MITK_PP_EXPR_IIF(c, o)(220, s), p, o, m)
+# define MITK_PP_FOR_220_C(c, s, p, o, m) MITK_PP_IIF(c, m, MITK_PP_TUPLE_EAT_2)(221, s) MITK_PP_IIF(c, MITK_PP_FOR_221, MITK_PP_TUPLE_EAT_4)(MITK_PP_EXPR_IIF(c, o)(221, s), p, o, m)
+# define MITK_PP_FOR_221_C(c, s, p, o, m) MITK_PP_IIF(c, m, MITK_PP_TUPLE_EAT_2)(222, s) MITK_PP_IIF(c, MITK_PP_FOR_222, MITK_PP_TUPLE_EAT_4)(MITK_PP_EXPR_IIF(c, o)(222, s), p, o, m)
+# define MITK_PP_FOR_222_C(c, s, p, o, m) MITK_PP_IIF(c, m, MITK_PP_TUPLE_EAT_2)(223, s) MITK_PP_IIF(c, MITK_PP_FOR_223, MITK_PP_TUPLE_EAT_4)(MITK_PP_EXPR_IIF(c, o)(223, s), p, o, m)
+# define MITK_PP_FOR_223_C(c, s, p, o, m) MITK_PP_IIF(c, m, MITK_PP_TUPLE_EAT_2)(224, s) MITK_PP_IIF(c, MITK_PP_FOR_224, MITK_PP_TUPLE_EAT_4)(MITK_PP_EXPR_IIF(c, o)(224, s), p, o, m)
+# define MITK_PP_FOR_224_C(c, s, p, o, m) MITK_PP_IIF(c, m, MITK_PP_TUPLE_EAT_2)(225, s) MITK_PP_IIF(c, MITK_PP_FOR_225, MITK_PP_TUPLE_EAT_4)(MITK_PP_EXPR_IIF(c, o)(225, s), p, o, m)
+# define MITK_PP_FOR_225_C(c, s, p, o, m) MITK_PP_IIF(c, m, MITK_PP_TUPLE_EAT_2)(226, s) MITK_PP_IIF(c, MITK_PP_FOR_226, MITK_PP_TUPLE_EAT_4)(MITK_PP_EXPR_IIF(c, o)(226, s), p, o, m)
+# define MITK_PP_FOR_226_C(c, s, p, o, m) MITK_PP_IIF(c, m, MITK_PP_TUPLE_EAT_2)(227, s) MITK_PP_IIF(c, MITK_PP_FOR_227, MITK_PP_TUPLE_EAT_4)(MITK_PP_EXPR_IIF(c, o)(227, s), p, o, m)
+# define MITK_PP_FOR_227_C(c, s, p, o, m) MITK_PP_IIF(c, m, MITK_PP_TUPLE_EAT_2)(228, s) MITK_PP_IIF(c, MITK_PP_FOR_228, MITK_PP_TUPLE_EAT_4)(MITK_PP_EXPR_IIF(c, o)(228, s), p, o, m)
+# define MITK_PP_FOR_228_C(c, s, p, o, m) MITK_PP_IIF(c, m, MITK_PP_TUPLE_EAT_2)(229, s) MITK_PP_IIF(c, MITK_PP_FOR_229, MITK_PP_TUPLE_EAT_4)(MITK_PP_EXPR_IIF(c, o)(229, s), p, o, m)
+# define MITK_PP_FOR_229_C(c, s, p, o, m) MITK_PP_IIF(c, m, MITK_PP_TUPLE_EAT_2)(230, s) MITK_PP_IIF(c, MITK_PP_FOR_230, MITK_PP_TUPLE_EAT_4)(MITK_PP_EXPR_IIF(c, o)(230, s), p, o, m)
+# define MITK_PP_FOR_230_C(c, s, p, o, m) MITK_PP_IIF(c, m, MITK_PP_TUPLE_EAT_2)(231, s) MITK_PP_IIF(c, MITK_PP_FOR_231, MITK_PP_TUPLE_EAT_4)(MITK_PP_EXPR_IIF(c, o)(231, s), p, o, m)
+# define MITK_PP_FOR_231_C(c, s, p, o, m) MITK_PP_IIF(c, m, MITK_PP_TUPLE_EAT_2)(232, s) MITK_PP_IIF(c, MITK_PP_FOR_232, MITK_PP_TUPLE_EAT_4)(MITK_PP_EXPR_IIF(c, o)(232, s), p, o, m)
+# define MITK_PP_FOR_232_C(c, s, p, o, m) MITK_PP_IIF(c, m, MITK_PP_TUPLE_EAT_2)(233, s) MITK_PP_IIF(c, MITK_PP_FOR_233, MITK_PP_TUPLE_EAT_4)(MITK_PP_EXPR_IIF(c, o)(233, s), p, o, m)
+# define MITK_PP_FOR_233_C(c, s, p, o, m) MITK_PP_IIF(c, m, MITK_PP_TUPLE_EAT_2)(234, s) MITK_PP_IIF(c, MITK_PP_FOR_234, MITK_PP_TUPLE_EAT_4)(MITK_PP_EXPR_IIF(c, o)(234, s), p, o, m)
+# define MITK_PP_FOR_234_C(c, s, p, o, m) MITK_PP_IIF(c, m, MITK_PP_TUPLE_EAT_2)(235, s) MITK_PP_IIF(c, MITK_PP_FOR_235, MITK_PP_TUPLE_EAT_4)(MITK_PP_EXPR_IIF(c, o)(235, s), p, o, m)
+# define MITK_PP_FOR_235_C(c, s, p, o, m) MITK_PP_IIF(c, m, MITK_PP_TUPLE_EAT_2)(236, s) MITK_PP_IIF(c, MITK_PP_FOR_236, MITK_PP_TUPLE_EAT_4)(MITK_PP_EXPR_IIF(c, o)(236, s), p, o, m)
+# define MITK_PP_FOR_236_C(c, s, p, o, m) MITK_PP_IIF(c, m, MITK_PP_TUPLE_EAT_2)(237, s) MITK_PP_IIF(c, MITK_PP_FOR_237, MITK_PP_TUPLE_EAT_4)(MITK_PP_EXPR_IIF(c, o)(237, s), p, o, m)
+# define MITK_PP_FOR_237_C(c, s, p, o, m) MITK_PP_IIF(c, m, MITK_PP_TUPLE_EAT_2)(238, s) MITK_PP_IIF(c, MITK_PP_FOR_238, MITK_PP_TUPLE_EAT_4)(MITK_PP_EXPR_IIF(c, o)(238, s), p, o, m)
+# define MITK_PP_FOR_238_C(c, s, p, o, m) MITK_PP_IIF(c, m, MITK_PP_TUPLE_EAT_2)(239, s) MITK_PP_IIF(c, MITK_PP_FOR_239, MITK_PP_TUPLE_EAT_4)(MITK_PP_EXPR_IIF(c, o)(239, s), p, o, m)
+# define MITK_PP_FOR_239_C(c, s, p, o, m) MITK_PP_IIF(c, m, MITK_PP_TUPLE_EAT_2)(240, s) MITK_PP_IIF(c, MITK_PP_FOR_240, MITK_PP_TUPLE_EAT_4)(MITK_PP_EXPR_IIF(c, o)(240, s), p, o, m)
+# define MITK_PP_FOR_240_C(c, s, p, o, m) MITK_PP_IIF(c, m, MITK_PP_TUPLE_EAT_2)(241, s) MITK_PP_IIF(c, MITK_PP_FOR_241, MITK_PP_TUPLE_EAT_4)(MITK_PP_EXPR_IIF(c, o)(241, s), p, o, m)
+# define MITK_PP_FOR_241_C(c, s, p, o, m) MITK_PP_IIF(c, m, MITK_PP_TUPLE_EAT_2)(242, s) MITK_PP_IIF(c, MITK_PP_FOR_242, MITK_PP_TUPLE_EAT_4)(MITK_PP_EXPR_IIF(c, o)(242, s), p, o, m)
+# define MITK_PP_FOR_242_C(c, s, p, o, m) MITK_PP_IIF(c, m, MITK_PP_TUPLE_EAT_2)(243, s) MITK_PP_IIF(c, MITK_PP_FOR_243, MITK_PP_TUPLE_EAT_4)(MITK_PP_EXPR_IIF(c, o)(243, s), p, o, m)
+# define MITK_PP_FOR_243_C(c, s, p, o, m) MITK_PP_IIF(c, m, MITK_PP_TUPLE_EAT_2)(244, s) MITK_PP_IIF(c, MITK_PP_FOR_244, MITK_PP_TUPLE_EAT_4)(MITK_PP_EXPR_IIF(c, o)(244, s), p, o, m)
+# define MITK_PP_FOR_244_C(c, s, p, o, m) MITK_PP_IIF(c, m, MITK_PP_TUPLE_EAT_2)(245, s) MITK_PP_IIF(c, MITK_PP_FOR_245, MITK_PP_TUPLE_EAT_4)(MITK_PP_EXPR_IIF(c, o)(245, s), p, o, m)
+# define MITK_PP_FOR_245_C(c, s, p, o, m) MITK_PP_IIF(c, m, MITK_PP_TUPLE_EAT_2)(246, s) MITK_PP_IIF(c, MITK_PP_FOR_246, MITK_PP_TUPLE_EAT_4)(MITK_PP_EXPR_IIF(c, o)(246, s), p, o, m)
+# define MITK_PP_FOR_246_C(c, s, p, o, m) MITK_PP_IIF(c, m, MITK_PP_TUPLE_EAT_2)(247, s) MITK_PP_IIF(c, MITK_PP_FOR_247, MITK_PP_TUPLE_EAT_4)(MITK_PP_EXPR_IIF(c, o)(247, s), p, o, m)
+# define MITK_PP_FOR_247_C(c, s, p, o, m) MITK_PP_IIF(c, m, MITK_PP_TUPLE_EAT_2)(248, s) MITK_PP_IIF(c, MITK_PP_FOR_248, MITK_PP_TUPLE_EAT_4)(MITK_PP_EXPR_IIF(c, o)(248, s), p, o, m)
+# define MITK_PP_FOR_248_C(c, s, p, o, m) MITK_PP_IIF(c, m, MITK_PP_TUPLE_EAT_2)(249, s) MITK_PP_IIF(c, MITK_PP_FOR_249, MITK_PP_TUPLE_EAT_4)(MITK_PP_EXPR_IIF(c, o)(249, s), p, o, m)
+# define MITK_PP_FOR_249_C(c, s, p, o, m) MITK_PP_IIF(c, m, MITK_PP_TUPLE_EAT_2)(250, s) MITK_PP_IIF(c, MITK_PP_FOR_250, MITK_PP_TUPLE_EAT_4)(MITK_PP_EXPR_IIF(c, o)(250, s), p, o, m)
+# define MITK_PP_FOR_250_C(c, s, p, o, m) MITK_PP_IIF(c, m, MITK_PP_TUPLE_EAT_2)(251, s) MITK_PP_IIF(c, MITK_PP_FOR_251, MITK_PP_TUPLE_EAT_4)(MITK_PP_EXPR_IIF(c, o)(251, s), p, o, m)
+# define MITK_PP_FOR_251_C(c, s, p, o, m) MITK_PP_IIF(c, m, MITK_PP_TUPLE_EAT_2)(252, s) MITK_PP_IIF(c, MITK_PP_FOR_252, MITK_PP_TUPLE_EAT_4)(MITK_PP_EXPR_IIF(c, o)(252, s), p, o, m)
+# define MITK_PP_FOR_252_C(c, s, p, o, m) MITK_PP_IIF(c, m, MITK_PP_TUPLE_EAT_2)(253, s) MITK_PP_IIF(c, MITK_PP_FOR_253, MITK_PP_TUPLE_EAT_4)(MITK_PP_EXPR_IIF(c, o)(253, s), p, o, m)
+# define MITK_PP_FOR_253_C(c, s, p, o, m) MITK_PP_IIF(c, m, MITK_PP_TUPLE_EAT_2)(254, s) MITK_PP_IIF(c, MITK_PP_FOR_254, MITK_PP_TUPLE_EAT_4)(MITK_PP_EXPR_IIF(c, o)(254, s), p, o, m)
+# define MITK_PP_FOR_254_C(c, s, p, o, m) MITK_PP_IIF(c, m, MITK_PP_TUPLE_EAT_2)(255, s) MITK_PP_IIF(c, MITK_PP_FOR_255, MITK_PP_TUPLE_EAT_4)(MITK_PP_EXPR_IIF(c, o)(255, s), p, o, m)
+# define MITK_PP_FOR_255_C(c, s, p, o, m) MITK_PP_IIF(c, m, MITK_PP_TUPLE_EAT_2)(256, s) MITK_PP_IIF(c, MITK_PP_FOR_256, MITK_PP_TUPLE_EAT_4)(MITK_PP_EXPR_IIF(c, o)(256, s), p, o, m)
+# define MITK_PP_FOR_256_C(c, s, p, o, m) MITK_PP_IIF(c, m, MITK_PP_TUPLE_EAT_2)(257, s) MITK_PP_IIF(c, MITK_PP_FOR_257, MITK_PP_TUPLE_EAT_4)(MITK_PP_EXPR_IIF(c, o)(257, s), p, o, m)
+#
+# endif
diff --git a/Core/Code/Algorithms/mitkPPRepetitionDetailEDGFor.h b/Core/Code/Algorithms/mitkPPRepetitionDetailEDGFor.h
new file mode 100644
index 0000000000..44a214b635
--- /dev/null
+++ b/Core/Code/Algorithms/mitkPPRepetitionDetailEDGFor.h
@@ -0,0 +1,534 @@
+# /* Copyright (C) 2001
+# * Housemarque Oy
+# * http://www.housemarque.com
+# *
+# * Distributed under the Boost Software License, Version 1.0. (See
+# * accompanying file LICENSE_1_0.txt or copy at
+# * http://www.boost.org/LICENSE_1_0.txt)
+# */
+#
+# /* Revised by Paul Mensonides (2002) */
+#
+# /* See http://www.boost.org for most recent version. */
+#
+# ifndef MITK_PREPROCESSOR_REPETITION_DETAIL_EDG_FOR_HPP
+# define MITK_PREPROCESSOR_REPETITION_DETAIL_EDG_FOR_HPP
+#
+# include "mitkPPControlIf.h"
+# include "mitkPPTupleEat.h"
+#
+# define MITK_PP_FOR_1(s, p, o, m) MITK_PP_FOR_1_I(s, p, o, m)
+# define MITK_PP_FOR_2(s, p, o, m) MITK_PP_FOR_2_I(s, p, o, m)
+# define MITK_PP_FOR_3(s, p, o, m) MITK_PP_FOR_3_I(s, p, o, m)
+# define MITK_PP_FOR_4(s, p, o, m) MITK_PP_FOR_4_I(s, p, o, m)
+# define MITK_PP_FOR_5(s, p, o, m) MITK_PP_FOR_5_I(s, p, o, m)
+# define MITK_PP_FOR_6(s, p, o, m) MITK_PP_FOR_6_I(s, p, o, m)
+# define MITK_PP_FOR_7(s, p, o, m) MITK_PP_FOR_7_I(s, p, o, m)
+# define MITK_PP_FOR_8(s, p, o, m) MITK_PP_FOR_8_I(s, p, o, m)
+# define MITK_PP_FOR_9(s, p, o, m) MITK_PP_FOR_9_I(s, p, o, m)
+# define MITK_PP_FOR_10(s, p, o, m) MITK_PP_FOR_10_I(s, p, o, m)
+# define MITK_PP_FOR_11(s, p, o, m) MITK_PP_FOR_11_I(s, p, o, m)
+# define MITK_PP_FOR_12(s, p, o, m) MITK_PP_FOR_12_I(s, p, o, m)
+# define MITK_PP_FOR_13(s, p, o, m) MITK_PP_FOR_13_I(s, p, o, m)
+# define MITK_PP_FOR_14(s, p, o, m) MITK_PP_FOR_14_I(s, p, o, m)
+# define MITK_PP_FOR_15(s, p, o, m) MITK_PP_FOR_15_I(s, p, o, m)
+# define MITK_PP_FOR_16(s, p, o, m) MITK_PP_FOR_16_I(s, p, o, m)
+# define MITK_PP_FOR_17(s, p, o, m) MITK_PP_FOR_17_I(s, p, o, m)
+# define MITK_PP_FOR_18(s, p, o, m) MITK_PP_FOR_18_I(s, p, o, m)
+# define MITK_PP_FOR_19(s, p, o, m) MITK_PP_FOR_19_I(s, p, o, m)
+# define MITK_PP_FOR_20(s, p, o, m) MITK_PP_FOR_20_I(s, p, o, m)
+# define MITK_PP_FOR_21(s, p, o, m) MITK_PP_FOR_21_I(s, p, o, m)
+# define MITK_PP_FOR_22(s, p, o, m) MITK_PP_FOR_22_I(s, p, o, m)
+# define MITK_PP_FOR_23(s, p, o, m) MITK_PP_FOR_23_I(s, p, o, m)
+# define MITK_PP_FOR_24(s, p, o, m) MITK_PP_FOR_24_I(s, p, o, m)
+# define MITK_PP_FOR_25(s, p, o, m) MITK_PP_FOR_25_I(s, p, o, m)
+# define MITK_PP_FOR_26(s, p, o, m) MITK_PP_FOR_26_I(s, p, o, m)
+# define MITK_PP_FOR_27(s, p, o, m) MITK_PP_FOR_27_I(s, p, o, m)
+# define MITK_PP_FOR_28(s, p, o, m) MITK_PP_FOR_28_I(s, p, o, m)
+# define MITK_PP_FOR_29(s, p, o, m) MITK_PP_FOR_29_I(s, p, o, m)
+# define MITK_PP_FOR_30(s, p, o, m) MITK_PP_FOR_30_I(s, p, o, m)
+# define MITK_PP_FOR_31(s, p, o, m) MITK_PP_FOR_31_I(s, p, o, m)
+# define MITK_PP_FOR_32(s, p, o, m) MITK_PP_FOR_32_I(s, p, o, m)
+# define MITK_PP_FOR_33(s, p, o, m) MITK_PP_FOR_33_I(s, p, o, m)
+# define MITK_PP_FOR_34(s, p, o, m) MITK_PP_FOR_34_I(s, p, o, m)
+# define MITK_PP_FOR_35(s, p, o, m) MITK_PP_FOR_35_I(s, p, o, m)
+# define MITK_PP_FOR_36(s, p, o, m) MITK_PP_FOR_36_I(s, p, o, m)
+# define MITK_PP_FOR_37(s, p, o, m) MITK_PP_FOR_37_I(s, p, o, m)
+# define MITK_PP_FOR_38(s, p, o, m) MITK_PP_FOR_38_I(s, p, o, m)
+# define MITK_PP_FOR_39(s, p, o, m) MITK_PP_FOR_39_I(s, p, o, m)
+# define MITK_PP_FOR_40(s, p, o, m) MITK_PP_FOR_40_I(s, p, o, m)
+# define MITK_PP_FOR_41(s, p, o, m) MITK_PP_FOR_41_I(s, p, o, m)
+# define MITK_PP_FOR_42(s, p, o, m) MITK_PP_FOR_42_I(s, p, o, m)
+# define MITK_PP_FOR_43(s, p, o, m) MITK_PP_FOR_43_I(s, p, o, m)
+# define MITK_PP_FOR_44(s, p, o, m) MITK_PP_FOR_44_I(s, p, o, m)
+# define MITK_PP_FOR_45(s, p, o, m) MITK_PP_FOR_45_I(s, p, o, m)
+# define MITK_PP_FOR_46(s, p, o, m) MITK_PP_FOR_46_I(s, p, o, m)
+# define MITK_PP_FOR_47(s, p, o, m) MITK_PP_FOR_47_I(s, p, o, m)
+# define MITK_PP_FOR_48(s, p, o, m) MITK_PP_FOR_48_I(s, p, o, m)
+# define MITK_PP_FOR_49(s, p, o, m) MITK_PP_FOR_49_I(s, p, o, m)
+# define MITK_PP_FOR_50(s, p, o, m) MITK_PP_FOR_50_I(s, p, o, m)
+# define MITK_PP_FOR_51(s, p, o, m) MITK_PP_FOR_51_I(s, p, o, m)
+# define MITK_PP_FOR_52(s, p, o, m) MITK_PP_FOR_52_I(s, p, o, m)
+# define MITK_PP_FOR_53(s, p, o, m) MITK_PP_FOR_53_I(s, p, o, m)
+# define MITK_PP_FOR_54(s, p, o, m) MITK_PP_FOR_54_I(s, p, o, m)
+# define MITK_PP_FOR_55(s, p, o, m) MITK_PP_FOR_55_I(s, p, o, m)
+# define MITK_PP_FOR_56(s, p, o, m) MITK_PP_FOR_56_I(s, p, o, m)
+# define MITK_PP_FOR_57(s, p, o, m) MITK_PP_FOR_57_I(s, p, o, m)
+# define MITK_PP_FOR_58(s, p, o, m) MITK_PP_FOR_58_I(s, p, o, m)
+# define MITK_PP_FOR_59(s, p, o, m) MITK_PP_FOR_59_I(s, p, o, m)
+# define MITK_PP_FOR_60(s, p, o, m) MITK_PP_FOR_60_I(s, p, o, m)
+# define MITK_PP_FOR_61(s, p, o, m) MITK_PP_FOR_61_I(s, p, o, m)
+# define MITK_PP_FOR_62(s, p, o, m) MITK_PP_FOR_62_I(s, p, o, m)
+# define MITK_PP_FOR_63(s, p, o, m) MITK_PP_FOR_63_I(s, p, o, m)
+# define MITK_PP_FOR_64(s, p, o, m) MITK_PP_FOR_64_I(s, p, o, m)
+# define MITK_PP_FOR_65(s, p, o, m) MITK_PP_FOR_65_I(s, p, o, m)
+# define MITK_PP_FOR_66(s, p, o, m) MITK_PP_FOR_66_I(s, p, o, m)
+# define MITK_PP_FOR_67(s, p, o, m) MITK_PP_FOR_67_I(s, p, o, m)
+# define MITK_PP_FOR_68(s, p, o, m) MITK_PP_FOR_68_I(s, p, o, m)
+# define MITK_PP_FOR_69(s, p, o, m) MITK_PP_FOR_69_I(s, p, o, m)
+# define MITK_PP_FOR_70(s, p, o, m) MITK_PP_FOR_70_I(s, p, o, m)
+# define MITK_PP_FOR_71(s, p, o, m) MITK_PP_FOR_71_I(s, p, o, m)
+# define MITK_PP_FOR_72(s, p, o, m) MITK_PP_FOR_72_I(s, p, o, m)
+# define MITK_PP_FOR_73(s, p, o, m) MITK_PP_FOR_73_I(s, p, o, m)
+# define MITK_PP_FOR_74(s, p, o, m) MITK_PP_FOR_74_I(s, p, o, m)
+# define MITK_PP_FOR_75(s, p, o, m) MITK_PP_FOR_75_I(s, p, o, m)
+# define MITK_PP_FOR_76(s, p, o, m) MITK_PP_FOR_76_I(s, p, o, m)
+# define MITK_PP_FOR_77(s, p, o, m) MITK_PP_FOR_77_I(s, p, o, m)
+# define MITK_PP_FOR_78(s, p, o, m) MITK_PP_FOR_78_I(s, p, o, m)
+# define MITK_PP_FOR_79(s, p, o, m) MITK_PP_FOR_79_I(s, p, o, m)
+# define MITK_PP_FOR_80(s, p, o, m) MITK_PP_FOR_80_I(s, p, o, m)
+# define MITK_PP_FOR_81(s, p, o, m) MITK_PP_FOR_81_I(s, p, o, m)
+# define MITK_PP_FOR_82(s, p, o, m) MITK_PP_FOR_82_I(s, p, o, m)
+# define MITK_PP_FOR_83(s, p, o, m) MITK_PP_FOR_83_I(s, p, o, m)
+# define MITK_PP_FOR_84(s, p, o, m) MITK_PP_FOR_84_I(s, p, o, m)
+# define MITK_PP_FOR_85(s, p, o, m) MITK_PP_FOR_85_I(s, p, o, m)
+# define MITK_PP_FOR_86(s, p, o, m) MITK_PP_FOR_86_I(s, p, o, m)
+# define MITK_PP_FOR_87(s, p, o, m) MITK_PP_FOR_87_I(s, p, o, m)
+# define MITK_PP_FOR_88(s, p, o, m) MITK_PP_FOR_88_I(s, p, o, m)
+# define MITK_PP_FOR_89(s, p, o, m) MITK_PP_FOR_89_I(s, p, o, m)
+# define MITK_PP_FOR_90(s, p, o, m) MITK_PP_FOR_90_I(s, p, o, m)
+# define MITK_PP_FOR_91(s, p, o, m) MITK_PP_FOR_91_I(s, p, o, m)
+# define MITK_PP_FOR_92(s, p, o, m) MITK_PP_FOR_92_I(s, p, o, m)
+# define MITK_PP_FOR_93(s, p, o, m) MITK_PP_FOR_93_I(s, p, o, m)
+# define MITK_PP_FOR_94(s, p, o, m) MITK_PP_FOR_94_I(s, p, o, m)
+# define MITK_PP_FOR_95(s, p, o, m) MITK_PP_FOR_95_I(s, p, o, m)
+# define MITK_PP_FOR_96(s, p, o, m) MITK_PP_FOR_96_I(s, p, o, m)
+# define MITK_PP_FOR_97(s, p, o, m) MITK_PP_FOR_97_I(s, p, o, m)
+# define MITK_PP_FOR_98(s, p, o, m) MITK_PP_FOR_98_I(s, p, o, m)
+# define MITK_PP_FOR_99(s, p, o, m) MITK_PP_FOR_99_I(s, p, o, m)
+# define MITK_PP_FOR_100(s, p, o, m) MITK_PP_FOR_100_I(s, p, o, m)
+# define MITK_PP_FOR_101(s, p, o, m) MITK_PP_FOR_101_I(s, p, o, m)
+# define MITK_PP_FOR_102(s, p, o, m) MITK_PP_FOR_102_I(s, p, o, m)
+# define MITK_PP_FOR_103(s, p, o, m) MITK_PP_FOR_103_I(s, p, o, m)
+# define MITK_PP_FOR_104(s, p, o, m) MITK_PP_FOR_104_I(s, p, o, m)
+# define MITK_PP_FOR_105(s, p, o, m) MITK_PP_FOR_105_I(s, p, o, m)
+# define MITK_PP_FOR_106(s, p, o, m) MITK_PP_FOR_106_I(s, p, o, m)
+# define MITK_PP_FOR_107(s, p, o, m) MITK_PP_FOR_107_I(s, p, o, m)
+# define MITK_PP_FOR_108(s, p, o, m) MITK_PP_FOR_108_I(s, p, o, m)
+# define MITK_PP_FOR_109(s, p, o, m) MITK_PP_FOR_109_I(s, p, o, m)
+# define MITK_PP_FOR_110(s, p, o, m) MITK_PP_FOR_110_I(s, p, o, m)
+# define MITK_PP_FOR_111(s, p, o, m) MITK_PP_FOR_111_I(s, p, o, m)
+# define MITK_PP_FOR_112(s, p, o, m) MITK_PP_FOR_112_I(s, p, o, m)
+# define MITK_PP_FOR_113(s, p, o, m) MITK_PP_FOR_113_I(s, p, o, m)
+# define MITK_PP_FOR_114(s, p, o, m) MITK_PP_FOR_114_I(s, p, o, m)
+# define MITK_PP_FOR_115(s, p, o, m) MITK_PP_FOR_115_I(s, p, o, m)
+# define MITK_PP_FOR_116(s, p, o, m) MITK_PP_FOR_116_I(s, p, o, m)
+# define MITK_PP_FOR_117(s, p, o, m) MITK_PP_FOR_117_I(s, p, o, m)
+# define MITK_PP_FOR_118(s, p, o, m) MITK_PP_FOR_118_I(s, p, o, m)
+# define MITK_PP_FOR_119(s, p, o, m) MITK_PP_FOR_119_I(s, p, o, m)
+# define MITK_PP_FOR_120(s, p, o, m) MITK_PP_FOR_120_I(s, p, o, m)
+# define MITK_PP_FOR_121(s, p, o, m) MITK_PP_FOR_121_I(s, p, o, m)
+# define MITK_PP_FOR_122(s, p, o, m) MITK_PP_FOR_122_I(s, p, o, m)
+# define MITK_PP_FOR_123(s, p, o, m) MITK_PP_FOR_123_I(s, p, o, m)
+# define MITK_PP_FOR_124(s, p, o, m) MITK_PP_FOR_124_I(s, p, o, m)
+# define MITK_PP_FOR_125(s, p, o, m) MITK_PP_FOR_125_I(s, p, o, m)
+# define MITK_PP_FOR_126(s, p, o, m) MITK_PP_FOR_126_I(s, p, o, m)
+# define MITK_PP_FOR_127(s, p, o, m) MITK_PP_FOR_127_I(s, p, o, m)
+# define MITK_PP_FOR_128(s, p, o, m) MITK_PP_FOR_128_I(s, p, o, m)
+# define MITK_PP_FOR_129(s, p, o, m) MITK_PP_FOR_129_I(s, p, o, m)
+# define MITK_PP_FOR_130(s, p, o, m) MITK_PP_FOR_130_I(s, p, o, m)
+# define MITK_PP_FOR_131(s, p, o, m) MITK_PP_FOR_131_I(s, p, o, m)
+# define MITK_PP_FOR_132(s, p, o, m) MITK_PP_FOR_132_I(s, p, o, m)
+# define MITK_PP_FOR_133(s, p, o, m) MITK_PP_FOR_133_I(s, p, o, m)
+# define MITK_PP_FOR_134(s, p, o, m) MITK_PP_FOR_134_I(s, p, o, m)
+# define MITK_PP_FOR_135(s, p, o, m) MITK_PP_FOR_135_I(s, p, o, m)
+# define MITK_PP_FOR_136(s, p, o, m) MITK_PP_FOR_136_I(s, p, o, m)
+# define MITK_PP_FOR_137(s, p, o, m) MITK_PP_FOR_137_I(s, p, o, m)
+# define MITK_PP_FOR_138(s, p, o, m) MITK_PP_FOR_138_I(s, p, o, m)
+# define MITK_PP_FOR_139(s, p, o, m) MITK_PP_FOR_139_I(s, p, o, m)
+# define MITK_PP_FOR_140(s, p, o, m) MITK_PP_FOR_140_I(s, p, o, m)
+# define MITK_PP_FOR_141(s, p, o, m) MITK_PP_FOR_141_I(s, p, o, m)
+# define MITK_PP_FOR_142(s, p, o, m) MITK_PP_FOR_142_I(s, p, o, m)
+# define MITK_PP_FOR_143(s, p, o, m) MITK_PP_FOR_143_I(s, p, o, m)
+# define MITK_PP_FOR_144(s, p, o, m) MITK_PP_FOR_144_I(s, p, o, m)
+# define MITK_PP_FOR_145(s, p, o, m) MITK_PP_FOR_145_I(s, p, o, m)
+# define MITK_PP_FOR_146(s, p, o, m) MITK_PP_FOR_146_I(s, p, o, m)
+# define MITK_PP_FOR_147(s, p, o, m) MITK_PP_FOR_147_I(s, p, o, m)
+# define MITK_PP_FOR_148(s, p, o, m) MITK_PP_FOR_148_I(s, p, o, m)
+# define MITK_PP_FOR_149(s, p, o, m) MITK_PP_FOR_149_I(s, p, o, m)
+# define MITK_PP_FOR_150(s, p, o, m) MITK_PP_FOR_150_I(s, p, o, m)
+# define MITK_PP_FOR_151(s, p, o, m) MITK_PP_FOR_151_I(s, p, o, m)
+# define MITK_PP_FOR_152(s, p, o, m) MITK_PP_FOR_152_I(s, p, o, m)
+# define MITK_PP_FOR_153(s, p, o, m) MITK_PP_FOR_153_I(s, p, o, m)
+# define MITK_PP_FOR_154(s, p, o, m) MITK_PP_FOR_154_I(s, p, o, m)
+# define MITK_PP_FOR_155(s, p, o, m) MITK_PP_FOR_155_I(s, p, o, m)
+# define MITK_PP_FOR_156(s, p, o, m) MITK_PP_FOR_156_I(s, p, o, m)
+# define MITK_PP_FOR_157(s, p, o, m) MITK_PP_FOR_157_I(s, p, o, m)
+# define MITK_PP_FOR_158(s, p, o, m) MITK_PP_FOR_158_I(s, p, o, m)
+# define MITK_PP_FOR_159(s, p, o, m) MITK_PP_FOR_159_I(s, p, o, m)
+# define MITK_PP_FOR_160(s, p, o, m) MITK_PP_FOR_160_I(s, p, o, m)
+# define MITK_PP_FOR_161(s, p, o, m) MITK_PP_FOR_161_I(s, p, o, m)
+# define MITK_PP_FOR_162(s, p, o, m) MITK_PP_FOR_162_I(s, p, o, m)
+# define MITK_PP_FOR_163(s, p, o, m) MITK_PP_FOR_163_I(s, p, o, m)
+# define MITK_PP_FOR_164(s, p, o, m) MITK_PP_FOR_164_I(s, p, o, m)
+# define MITK_PP_FOR_165(s, p, o, m) MITK_PP_FOR_165_I(s, p, o, m)
+# define MITK_PP_FOR_166(s, p, o, m) MITK_PP_FOR_166_I(s, p, o, m)
+# define MITK_PP_FOR_167(s, p, o, m) MITK_PP_FOR_167_I(s, p, o, m)
+# define MITK_PP_FOR_168(s, p, o, m) MITK_PP_FOR_168_I(s, p, o, m)
+# define MITK_PP_FOR_169(s, p, o, m) MITK_PP_FOR_169_I(s, p, o, m)
+# define MITK_PP_FOR_170(s, p, o, m) MITK_PP_FOR_170_I(s, p, o, m)
+# define MITK_PP_FOR_171(s, p, o, m) MITK_PP_FOR_171_I(s, p, o, m)
+# define MITK_PP_FOR_172(s, p, o, m) MITK_PP_FOR_172_I(s, p, o, m)
+# define MITK_PP_FOR_173(s, p, o, m) MITK_PP_FOR_173_I(s, p, o, m)
+# define MITK_PP_FOR_174(s, p, o, m) MITK_PP_FOR_174_I(s, p, o, m)
+# define MITK_PP_FOR_175(s, p, o, m) MITK_PP_FOR_175_I(s, p, o, m)
+# define MITK_PP_FOR_176(s, p, o, m) MITK_PP_FOR_176_I(s, p, o, m)
+# define MITK_PP_FOR_177(s, p, o, m) MITK_PP_FOR_177_I(s, p, o, m)
+# define MITK_PP_FOR_178(s, p, o, m) MITK_PP_FOR_178_I(s, p, o, m)
+# define MITK_PP_FOR_179(s, p, o, m) MITK_PP_FOR_179_I(s, p, o, m)
+# define MITK_PP_FOR_180(s, p, o, m) MITK_PP_FOR_180_I(s, p, o, m)
+# define MITK_PP_FOR_181(s, p, o, m) MITK_PP_FOR_181_I(s, p, o, m)
+# define MITK_PP_FOR_182(s, p, o, m) MITK_PP_FOR_182_I(s, p, o, m)
+# define MITK_PP_FOR_183(s, p, o, m) MITK_PP_FOR_183_I(s, p, o, m)
+# define MITK_PP_FOR_184(s, p, o, m) MITK_PP_FOR_184_I(s, p, o, m)
+# define MITK_PP_FOR_185(s, p, o, m) MITK_PP_FOR_185_I(s, p, o, m)
+# define MITK_PP_FOR_186(s, p, o, m) MITK_PP_FOR_186_I(s, p, o, m)
+# define MITK_PP_FOR_187(s, p, o, m) MITK_PP_FOR_187_I(s, p, o, m)
+# define MITK_PP_FOR_188(s, p, o, m) MITK_PP_FOR_188_I(s, p, o, m)
+# define MITK_PP_FOR_189(s, p, o, m) MITK_PP_FOR_189_I(s, p, o, m)
+# define MITK_PP_FOR_190(s, p, o, m) MITK_PP_FOR_190_I(s, p, o, m)
+# define MITK_PP_FOR_191(s, p, o, m) MITK_PP_FOR_191_I(s, p, o, m)
+# define MITK_PP_FOR_192(s, p, o, m) MITK_PP_FOR_192_I(s, p, o, m)
+# define MITK_PP_FOR_193(s, p, o, m) MITK_PP_FOR_193_I(s, p, o, m)
+# define MITK_PP_FOR_194(s, p, o, m) MITK_PP_FOR_194_I(s, p, o, m)
+# define MITK_PP_FOR_195(s, p, o, m) MITK_PP_FOR_195_I(s, p, o, m)
+# define MITK_PP_FOR_196(s, p, o, m) MITK_PP_FOR_196_I(s, p, o, m)
+# define MITK_PP_FOR_197(s, p, o, m) MITK_PP_FOR_197_I(s, p, o, m)
+# define MITK_PP_FOR_198(s, p, o, m) MITK_PP_FOR_198_I(s, p, o, m)
+# define MITK_PP_FOR_199(s, p, o, m) MITK_PP_FOR_199_I(s, p, o, m)
+# define MITK_PP_FOR_200(s, p, o, m) MITK_PP_FOR_200_I(s, p, o, m)
+# define MITK_PP_FOR_201(s, p, o, m) MITK_PP_FOR_201_I(s, p, o, m)
+# define MITK_PP_FOR_202(s, p, o, m) MITK_PP_FOR_202_I(s, p, o, m)
+# define MITK_PP_FOR_203(s, p, o, m) MITK_PP_FOR_203_I(s, p, o, m)
+# define MITK_PP_FOR_204(s, p, o, m) MITK_PP_FOR_204_I(s, p, o, m)
+# define MITK_PP_FOR_205(s, p, o, m) MITK_PP_FOR_205_I(s, p, o, m)
+# define MITK_PP_FOR_206(s, p, o, m) MITK_PP_FOR_206_I(s, p, o, m)
+# define MITK_PP_FOR_207(s, p, o, m) MITK_PP_FOR_207_I(s, p, o, m)
+# define MITK_PP_FOR_208(s, p, o, m) MITK_PP_FOR_208_I(s, p, o, m)
+# define MITK_PP_FOR_209(s, p, o, m) MITK_PP_FOR_209_I(s, p, o, m)
+# define MITK_PP_FOR_210(s, p, o, m) MITK_PP_FOR_210_I(s, p, o, m)
+# define MITK_PP_FOR_211(s, p, o, m) MITK_PP_FOR_211_I(s, p, o, m)
+# define MITK_PP_FOR_212(s, p, o, m) MITK_PP_FOR_212_I(s, p, o, m)
+# define MITK_PP_FOR_213(s, p, o, m) MITK_PP_FOR_213_I(s, p, o, m)
+# define MITK_PP_FOR_214(s, p, o, m) MITK_PP_FOR_214_I(s, p, o, m)
+# define MITK_PP_FOR_215(s, p, o, m) MITK_PP_FOR_215_I(s, p, o, m)
+# define MITK_PP_FOR_216(s, p, o, m) MITK_PP_FOR_216_I(s, p, o, m)
+# define MITK_PP_FOR_217(s, p, o, m) MITK_PP_FOR_217_I(s, p, o, m)
+# define MITK_PP_FOR_218(s, p, o, m) MITK_PP_FOR_218_I(s, p, o, m)
+# define MITK_PP_FOR_219(s, p, o, m) MITK_PP_FOR_219_I(s, p, o, m)
+# define MITK_PP_FOR_220(s, p, o, m) MITK_PP_FOR_220_I(s, p, o, m)
+# define MITK_PP_FOR_221(s, p, o, m) MITK_PP_FOR_221_I(s, p, o, m)
+# define MITK_PP_FOR_222(s, p, o, m) MITK_PP_FOR_222_I(s, p, o, m)
+# define MITK_PP_FOR_223(s, p, o, m) MITK_PP_FOR_223_I(s, p, o, m)
+# define MITK_PP_FOR_224(s, p, o, m) MITK_PP_FOR_224_I(s, p, o, m)
+# define MITK_PP_FOR_225(s, p, o, m) MITK_PP_FOR_225_I(s, p, o, m)
+# define MITK_PP_FOR_226(s, p, o, m) MITK_PP_FOR_226_I(s, p, o, m)
+# define MITK_PP_FOR_227(s, p, o, m) MITK_PP_FOR_227_I(s, p, o, m)
+# define MITK_PP_FOR_228(s, p, o, m) MITK_PP_FOR_228_I(s, p, o, m)
+# define MITK_PP_FOR_229(s, p, o, m) MITK_PP_FOR_229_I(s, p, o, m)
+# define MITK_PP_FOR_230(s, p, o, m) MITK_PP_FOR_230_I(s, p, o, m)
+# define MITK_PP_FOR_231(s, p, o, m) MITK_PP_FOR_231_I(s, p, o, m)
+# define MITK_PP_FOR_232(s, p, o, m) MITK_PP_FOR_232_I(s, p, o, m)
+# define MITK_PP_FOR_233(s, p, o, m) MITK_PP_FOR_233_I(s, p, o, m)
+# define MITK_PP_FOR_234(s, p, o, m) MITK_PP_FOR_234_I(s, p, o, m)
+# define MITK_PP_FOR_235(s, p, o, m) MITK_PP_FOR_235_I(s, p, o, m)
+# define MITK_PP_FOR_236(s, p, o, m) MITK_PP_FOR_236_I(s, p, o, m)
+# define MITK_PP_FOR_237(s, p, o, m) MITK_PP_FOR_237_I(s, p, o, m)
+# define MITK_PP_FOR_238(s, p, o, m) MITK_PP_FOR_238_I(s, p, o, m)
+# define MITK_PP_FOR_239(s, p, o, m) MITK_PP_FOR_239_I(s, p, o, m)
+# define MITK_PP_FOR_240(s, p, o, m) MITK_PP_FOR_240_I(s, p, o, m)
+# define MITK_PP_FOR_241(s, p, o, m) MITK_PP_FOR_241_I(s, p, o, m)
+# define MITK_PP_FOR_242(s, p, o, m) MITK_PP_FOR_242_I(s, p, o, m)
+# define MITK_PP_FOR_243(s, p, o, m) MITK_PP_FOR_243_I(s, p, o, m)
+# define MITK_PP_FOR_244(s, p, o, m) MITK_PP_FOR_244_I(s, p, o, m)
+# define MITK_PP_FOR_245(s, p, o, m) MITK_PP_FOR_245_I(s, p, o, m)
+# define MITK_PP_FOR_246(s, p, o, m) MITK_PP_FOR_246_I(s, p, o, m)
+# define MITK_PP_FOR_247(s, p, o, m) MITK_PP_FOR_247_I(s, p, o, m)
+# define MITK_PP_FOR_248(s, p, o, m) MITK_PP_FOR_248_I(s, p, o, m)
+# define MITK_PP_FOR_249(s, p, o, m) MITK_PP_FOR_249_I(s, p, o, m)
+# define MITK_PP_FOR_250(s, p, o, m) MITK_PP_FOR_250_I(s, p, o, m)
+# define MITK_PP_FOR_251(s, p, o, m) MITK_PP_FOR_251_I(s, p, o, m)
+# define MITK_PP_FOR_252(s, p, o, m) MITK_PP_FOR_252_I(s, p, o, m)
+# define MITK_PP_FOR_253(s, p, o, m) MITK_PP_FOR_253_I(s, p, o, m)
+# define MITK_PP_FOR_254(s, p, o, m) MITK_PP_FOR_254_I(s, p, o, m)
+# define MITK_PP_FOR_255(s, p, o, m) MITK_PP_FOR_255_I(s, p, o, m)
+# define MITK_PP_FOR_256(s, p, o, m) MITK_PP_FOR_256_I(s, p, o, m)
+#
+# define MITK_PP_FOR_1_I(s, p, o, m) MITK_PP_IF(p(2, s), m, MITK_PP_TUPLE_EAT_2)(2, s) MITK_PP_IF(p(2, s), MITK_PP_FOR_2, MITK_PP_TUPLE_EAT_4)(o(2, s), p, o, m)
+# define MITK_PP_FOR_2_I(s, p, o, m) MITK_PP_IF(p(3, s), m, MITK_PP_TUPLE_EAT_2)(3, s) MITK_PP_IF(p(3, s), MITK_PP_FOR_3, MITK_PP_TUPLE_EAT_4)(o(3, s), p, o, m)
+# define MITK_PP_FOR_3_I(s, p, o, m) MITK_PP_IF(p(4, s), m, MITK_PP_TUPLE_EAT_2)(4, s) MITK_PP_IF(p(4, s), MITK_PP_FOR_4, MITK_PP_TUPLE_EAT_4)(o(4, s), p, o, m)
+# define MITK_PP_FOR_4_I(s, p, o, m) MITK_PP_IF(p(5, s), m, MITK_PP_TUPLE_EAT_2)(5, s) MITK_PP_IF(p(5, s), MITK_PP_FOR_5, MITK_PP_TUPLE_EAT_4)(o(5, s), p, o, m)
+# define MITK_PP_FOR_5_I(s, p, o, m) MITK_PP_IF(p(6, s), m, MITK_PP_TUPLE_EAT_2)(6, s) MITK_PP_IF(p(6, s), MITK_PP_FOR_6, MITK_PP_TUPLE_EAT_4)(o(6, s), p, o, m)
+# define MITK_PP_FOR_6_I(s, p, o, m) MITK_PP_IF(p(7, s), m, MITK_PP_TUPLE_EAT_2)(7, s) MITK_PP_IF(p(7, s), MITK_PP_FOR_7, MITK_PP_TUPLE_EAT_4)(o(7, s), p, o, m)
+# define MITK_PP_FOR_7_I(s, p, o, m) MITK_PP_IF(p(8, s), m, MITK_PP_TUPLE_EAT_2)(8, s) MITK_PP_IF(p(8, s), MITK_PP_FOR_8, MITK_PP_TUPLE_EAT_4)(o(8, s), p, o, m)
+# define MITK_PP_FOR_8_I(s, p, o, m) MITK_PP_IF(p(9, s), m, MITK_PP_TUPLE_EAT_2)(9, s) MITK_PP_IF(p(9, s), MITK_PP_FOR_9, MITK_PP_TUPLE_EAT_4)(o(9, s), p, o, m)
+# define MITK_PP_FOR_9_I(s, p, o, m) MITK_PP_IF(p(10, s), m, MITK_PP_TUPLE_EAT_2)(10, s) MITK_PP_IF(p(10, s), MITK_PP_FOR_10, MITK_PP_TUPLE_EAT_4)(o(10, s), p, o, m)
+# define MITK_PP_FOR_10_I(s, p, o, m) MITK_PP_IF(p(11, s), m, MITK_PP_TUPLE_EAT_2)(11, s) MITK_PP_IF(p(11, s), MITK_PP_FOR_11, MITK_PP_TUPLE_EAT_4)(o(11, s), p, o, m)
+# define MITK_PP_FOR_11_I(s, p, o, m) MITK_PP_IF(p(12, s), m, MITK_PP_TUPLE_EAT_2)(12, s) MITK_PP_IF(p(12, s), MITK_PP_FOR_12, MITK_PP_TUPLE_EAT_4)(o(12, s), p, o, m)
+# define MITK_PP_FOR_12_I(s, p, o, m) MITK_PP_IF(p(13, s), m, MITK_PP_TUPLE_EAT_2)(13, s) MITK_PP_IF(p(13, s), MITK_PP_FOR_13, MITK_PP_TUPLE_EAT_4)(o(13, s), p, o, m)
+# define MITK_PP_FOR_13_I(s, p, o, m) MITK_PP_IF(p(14, s), m, MITK_PP_TUPLE_EAT_2)(14, s) MITK_PP_IF(p(14, s), MITK_PP_FOR_14, MITK_PP_TUPLE_EAT_4)(o(14, s), p, o, m)
+# define MITK_PP_FOR_14_I(s, p, o, m) MITK_PP_IF(p(15, s), m, MITK_PP_TUPLE_EAT_2)(15, s) MITK_PP_IF(p(15, s), MITK_PP_FOR_15, MITK_PP_TUPLE_EAT_4)(o(15, s), p, o, m)
+# define MITK_PP_FOR_15_I(s, p, o, m) MITK_PP_IF(p(16, s), m, MITK_PP_TUPLE_EAT_2)(16, s) MITK_PP_IF(p(16, s), MITK_PP_FOR_16, MITK_PP_TUPLE_EAT_4)(o(16, s), p, o, m)
+# define MITK_PP_FOR_16_I(s, p, o, m) MITK_PP_IF(p(17, s), m, MITK_PP_TUPLE_EAT_2)(17, s) MITK_PP_IF(p(17, s), MITK_PP_FOR_17, MITK_PP_TUPLE_EAT_4)(o(17, s), p, o, m)
+# define MITK_PP_FOR_17_I(s, p, o, m) MITK_PP_IF(p(18, s), m, MITK_PP_TUPLE_EAT_2)(18, s) MITK_PP_IF(p(18, s), MITK_PP_FOR_18, MITK_PP_TUPLE_EAT_4)(o(18, s), p, o, m)
+# define MITK_PP_FOR_18_I(s, p, o, m) MITK_PP_IF(p(19, s), m, MITK_PP_TUPLE_EAT_2)(19, s) MITK_PP_IF(p(19, s), MITK_PP_FOR_19, MITK_PP_TUPLE_EAT_4)(o(19, s), p, o, m)
+# define MITK_PP_FOR_19_I(s, p, o, m) MITK_PP_IF(p(20, s), m, MITK_PP_TUPLE_EAT_2)(20, s) MITK_PP_IF(p(20, s), MITK_PP_FOR_20, MITK_PP_TUPLE_EAT_4)(o(20, s), p, o, m)
+# define MITK_PP_FOR_20_I(s, p, o, m) MITK_PP_IF(p(21, s), m, MITK_PP_TUPLE_EAT_2)(21, s) MITK_PP_IF(p(21, s), MITK_PP_FOR_21, MITK_PP_TUPLE_EAT_4)(o(21, s), p, o, m)
+# define MITK_PP_FOR_21_I(s, p, o, m) MITK_PP_IF(p(22, s), m, MITK_PP_TUPLE_EAT_2)(22, s) MITK_PP_IF(p(22, s), MITK_PP_FOR_22, MITK_PP_TUPLE_EAT_4)(o(22, s), p, o, m)
+# define MITK_PP_FOR_22_I(s, p, o, m) MITK_PP_IF(p(23, s), m, MITK_PP_TUPLE_EAT_2)(23, s) MITK_PP_IF(p(23, s), MITK_PP_FOR_23, MITK_PP_TUPLE_EAT_4)(o(23, s), p, o, m)
+# define MITK_PP_FOR_23_I(s, p, o, m) MITK_PP_IF(p(24, s), m, MITK_PP_TUPLE_EAT_2)(24, s) MITK_PP_IF(p(24, s), MITK_PP_FOR_24, MITK_PP_TUPLE_EAT_4)(o(24, s), p, o, m)
+# define MITK_PP_FOR_24_I(s, p, o, m) MITK_PP_IF(p(25, s), m, MITK_PP_TUPLE_EAT_2)(25, s) MITK_PP_IF(p(25, s), MITK_PP_FOR_25, MITK_PP_TUPLE_EAT_4)(o(25, s), p, o, m)
+# define MITK_PP_FOR_25_I(s, p, o, m) MITK_PP_IF(p(26, s), m, MITK_PP_TUPLE_EAT_2)(26, s) MITK_PP_IF(p(26, s), MITK_PP_FOR_26, MITK_PP_TUPLE_EAT_4)(o(26, s), p, o, m)
+# define MITK_PP_FOR_26_I(s, p, o, m) MITK_PP_IF(p(27, s), m, MITK_PP_TUPLE_EAT_2)(27, s) MITK_PP_IF(p(27, s), MITK_PP_FOR_27, MITK_PP_TUPLE_EAT_4)(o(27, s), p, o, m)
+# define MITK_PP_FOR_27_I(s, p, o, m) MITK_PP_IF(p(28, s), m, MITK_PP_TUPLE_EAT_2)(28, s) MITK_PP_IF(p(28, s), MITK_PP_FOR_28, MITK_PP_TUPLE_EAT_4)(o(28, s), p, o, m)
+# define MITK_PP_FOR_28_I(s, p, o, m) MITK_PP_IF(p(29, s), m, MITK_PP_TUPLE_EAT_2)(29, s) MITK_PP_IF(p(29, s), MITK_PP_FOR_29, MITK_PP_TUPLE_EAT_4)(o(29, s), p, o, m)
+# define MITK_PP_FOR_29_I(s, p, o, m) MITK_PP_IF(p(30, s), m, MITK_PP_TUPLE_EAT_2)(30, s) MITK_PP_IF(p(30, s), MITK_PP_FOR_30, MITK_PP_TUPLE_EAT_4)(o(30, s), p, o, m)
+# define MITK_PP_FOR_30_I(s, p, o, m) MITK_PP_IF(p(31, s), m, MITK_PP_TUPLE_EAT_2)(31, s) MITK_PP_IF(p(31, s), MITK_PP_FOR_31, MITK_PP_TUPLE_EAT_4)(o(31, s), p, o, m)
+# define MITK_PP_FOR_31_I(s, p, o, m) MITK_PP_IF(p(32, s), m, MITK_PP_TUPLE_EAT_2)(32, s) MITK_PP_IF(p(32, s), MITK_PP_FOR_32, MITK_PP_TUPLE_EAT_4)(o(32, s), p, o, m)
+# define MITK_PP_FOR_32_I(s, p, o, m) MITK_PP_IF(p(33, s), m, MITK_PP_TUPLE_EAT_2)(33, s) MITK_PP_IF(p(33, s), MITK_PP_FOR_33, MITK_PP_TUPLE_EAT_4)(o(33, s), p, o, m)
+# define MITK_PP_FOR_33_I(s, p, o, m) MITK_PP_IF(p(34, s), m, MITK_PP_TUPLE_EAT_2)(34, s) MITK_PP_IF(p(34, s), MITK_PP_FOR_34, MITK_PP_TUPLE_EAT_4)(o(34, s), p, o, m)
+# define MITK_PP_FOR_34_I(s, p, o, m) MITK_PP_IF(p(35, s), m, MITK_PP_TUPLE_EAT_2)(35, s) MITK_PP_IF(p(35, s), MITK_PP_FOR_35, MITK_PP_TUPLE_EAT_4)(o(35, s), p, o, m)
+# define MITK_PP_FOR_35_I(s, p, o, m) MITK_PP_IF(p(36, s), m, MITK_PP_TUPLE_EAT_2)(36, s) MITK_PP_IF(p(36, s), MITK_PP_FOR_36, MITK_PP_TUPLE_EAT_4)(o(36, s), p, o, m)
+# define MITK_PP_FOR_36_I(s, p, o, m) MITK_PP_IF(p(37, s), m, MITK_PP_TUPLE_EAT_2)(37, s) MITK_PP_IF(p(37, s), MITK_PP_FOR_37, MITK_PP_TUPLE_EAT_4)(o(37, s), p, o, m)
+# define MITK_PP_FOR_37_I(s, p, o, m) MITK_PP_IF(p(38, s), m, MITK_PP_TUPLE_EAT_2)(38, s) MITK_PP_IF(p(38, s), MITK_PP_FOR_38, MITK_PP_TUPLE_EAT_4)(o(38, s), p, o, m)
+# define MITK_PP_FOR_38_I(s, p, o, m) MITK_PP_IF(p(39, s), m, MITK_PP_TUPLE_EAT_2)(39, s) MITK_PP_IF(p(39, s), MITK_PP_FOR_39, MITK_PP_TUPLE_EAT_4)(o(39, s), p, o, m)
+# define MITK_PP_FOR_39_I(s, p, o, m) MITK_PP_IF(p(40, s), m, MITK_PP_TUPLE_EAT_2)(40, s) MITK_PP_IF(p(40, s), MITK_PP_FOR_40, MITK_PP_TUPLE_EAT_4)(o(40, s), p, o, m)
+# define MITK_PP_FOR_40_I(s, p, o, m) MITK_PP_IF(p(41, s), m, MITK_PP_TUPLE_EAT_2)(41, s) MITK_PP_IF(p(41, s), MITK_PP_FOR_41, MITK_PP_TUPLE_EAT_4)(o(41, s), p, o, m)
+# define MITK_PP_FOR_41_I(s, p, o, m) MITK_PP_IF(p(42, s), m, MITK_PP_TUPLE_EAT_2)(42, s) MITK_PP_IF(p(42, s), MITK_PP_FOR_42, MITK_PP_TUPLE_EAT_4)(o(42, s), p, o, m)
+# define MITK_PP_FOR_42_I(s, p, o, m) MITK_PP_IF(p(43, s), m, MITK_PP_TUPLE_EAT_2)(43, s) MITK_PP_IF(p(43, s), MITK_PP_FOR_43, MITK_PP_TUPLE_EAT_4)(o(43, s), p, o, m)
+# define MITK_PP_FOR_43_I(s, p, o, m) MITK_PP_IF(p(44, s), m, MITK_PP_TUPLE_EAT_2)(44, s) MITK_PP_IF(p(44, s), MITK_PP_FOR_44, MITK_PP_TUPLE_EAT_4)(o(44, s), p, o, m)
+# define MITK_PP_FOR_44_I(s, p, o, m) MITK_PP_IF(p(45, s), m, MITK_PP_TUPLE_EAT_2)(45, s) MITK_PP_IF(p(45, s), MITK_PP_FOR_45, MITK_PP_TUPLE_EAT_4)(o(45, s), p, o, m)
+# define MITK_PP_FOR_45_I(s, p, o, m) MITK_PP_IF(p(46, s), m, MITK_PP_TUPLE_EAT_2)(46, s) MITK_PP_IF(p(46, s), MITK_PP_FOR_46, MITK_PP_TUPLE_EAT_4)(o(46, s), p, o, m)
+# define MITK_PP_FOR_46_I(s, p, o, m) MITK_PP_IF(p(47, s), m, MITK_PP_TUPLE_EAT_2)(47, s) MITK_PP_IF(p(47, s), MITK_PP_FOR_47, MITK_PP_TUPLE_EAT_4)(o(47, s), p, o, m)
+# define MITK_PP_FOR_47_I(s, p, o, m) MITK_PP_IF(p(48, s), m, MITK_PP_TUPLE_EAT_2)(48, s) MITK_PP_IF(p(48, s), MITK_PP_FOR_48, MITK_PP_TUPLE_EAT_4)(o(48, s), p, o, m)
+# define MITK_PP_FOR_48_I(s, p, o, m) MITK_PP_IF(p(49, s), m, MITK_PP_TUPLE_EAT_2)(49, s) MITK_PP_IF(p(49, s), MITK_PP_FOR_49, MITK_PP_TUPLE_EAT_4)(o(49, s), p, o, m)
+# define MITK_PP_FOR_49_I(s, p, o, m) MITK_PP_IF(p(50, s), m, MITK_PP_TUPLE_EAT_2)(50, s) MITK_PP_IF(p(50, s), MITK_PP_FOR_50, MITK_PP_TUPLE_EAT_4)(o(50, s), p, o, m)
+# define MITK_PP_FOR_50_I(s, p, o, m) MITK_PP_IF(p(51, s), m, MITK_PP_TUPLE_EAT_2)(51, s) MITK_PP_IF(p(51, s), MITK_PP_FOR_51, MITK_PP_TUPLE_EAT_4)(o(51, s), p, o, m)
+# define MITK_PP_FOR_51_I(s, p, o, m) MITK_PP_IF(p(52, s), m, MITK_PP_TUPLE_EAT_2)(52, s) MITK_PP_IF(p(52, s), MITK_PP_FOR_52, MITK_PP_TUPLE_EAT_4)(o(52, s), p, o, m)
+# define MITK_PP_FOR_52_I(s, p, o, m) MITK_PP_IF(p(53, s), m, MITK_PP_TUPLE_EAT_2)(53, s) MITK_PP_IF(p(53, s), MITK_PP_FOR_53, MITK_PP_TUPLE_EAT_4)(o(53, s), p, o, m)
+# define MITK_PP_FOR_53_I(s, p, o, m) MITK_PP_IF(p(54, s), m, MITK_PP_TUPLE_EAT_2)(54, s) MITK_PP_IF(p(54, s), MITK_PP_FOR_54, MITK_PP_TUPLE_EAT_4)(o(54, s), p, o, m)
+# define MITK_PP_FOR_54_I(s, p, o, m) MITK_PP_IF(p(55, s), m, MITK_PP_TUPLE_EAT_2)(55, s) MITK_PP_IF(p(55, s), MITK_PP_FOR_55, MITK_PP_TUPLE_EAT_4)(o(55, s), p, o, m)
+# define MITK_PP_FOR_55_I(s, p, o, m) MITK_PP_IF(p(56, s), m, MITK_PP_TUPLE_EAT_2)(56, s) MITK_PP_IF(p(56, s), MITK_PP_FOR_56, MITK_PP_TUPLE_EAT_4)(o(56, s), p, o, m)
+# define MITK_PP_FOR_56_I(s, p, o, m) MITK_PP_IF(p(57, s), m, MITK_PP_TUPLE_EAT_2)(57, s) MITK_PP_IF(p(57, s), MITK_PP_FOR_57, MITK_PP_TUPLE_EAT_4)(o(57, s), p, o, m)
+# define MITK_PP_FOR_57_I(s, p, o, m) MITK_PP_IF(p(58, s), m, MITK_PP_TUPLE_EAT_2)(58, s) MITK_PP_IF(p(58, s), MITK_PP_FOR_58, MITK_PP_TUPLE_EAT_4)(o(58, s), p, o, m)
+# define MITK_PP_FOR_58_I(s, p, o, m) MITK_PP_IF(p(59, s), m, MITK_PP_TUPLE_EAT_2)(59, s) MITK_PP_IF(p(59, s), MITK_PP_FOR_59, MITK_PP_TUPLE_EAT_4)(o(59, s), p, o, m)
+# define MITK_PP_FOR_59_I(s, p, o, m) MITK_PP_IF(p(60, s), m, MITK_PP_TUPLE_EAT_2)(60, s) MITK_PP_IF(p(60, s), MITK_PP_FOR_60, MITK_PP_TUPLE_EAT_4)(o(60, s), p, o, m)
+# define MITK_PP_FOR_60_I(s, p, o, m) MITK_PP_IF(p(61, s), m, MITK_PP_TUPLE_EAT_2)(61, s) MITK_PP_IF(p(61, s), MITK_PP_FOR_61, MITK_PP_TUPLE_EAT_4)(o(61, s), p, o, m)
+# define MITK_PP_FOR_61_I(s, p, o, m) MITK_PP_IF(p(62, s), m, MITK_PP_TUPLE_EAT_2)(62, s) MITK_PP_IF(p(62, s), MITK_PP_FOR_62, MITK_PP_TUPLE_EAT_4)(o(62, s), p, o, m)
+# define MITK_PP_FOR_62_I(s, p, o, m) MITK_PP_IF(p(63, s), m, MITK_PP_TUPLE_EAT_2)(63, s) MITK_PP_IF(p(63, s), MITK_PP_FOR_63, MITK_PP_TUPLE_EAT_4)(o(63, s), p, o, m)
+# define MITK_PP_FOR_63_I(s, p, o, m) MITK_PP_IF(p(64, s), m, MITK_PP_TUPLE_EAT_2)(64, s) MITK_PP_IF(p(64, s), MITK_PP_FOR_64, MITK_PP_TUPLE_EAT_4)(o(64, s), p, o, m)
+# define MITK_PP_FOR_64_I(s, p, o, m) MITK_PP_IF(p(65, s), m, MITK_PP_TUPLE_EAT_2)(65, s) MITK_PP_IF(p(65, s), MITK_PP_FOR_65, MITK_PP_TUPLE_EAT_4)(o(65, s), p, o, m)
+# define MITK_PP_FOR_65_I(s, p, o, m) MITK_PP_IF(p(66, s), m, MITK_PP_TUPLE_EAT_2)(66, s) MITK_PP_IF(p(66, s), MITK_PP_FOR_66, MITK_PP_TUPLE_EAT_4)(o(66, s), p, o, m)
+# define MITK_PP_FOR_66_I(s, p, o, m) MITK_PP_IF(p(67, s), m, MITK_PP_TUPLE_EAT_2)(67, s) MITK_PP_IF(p(67, s), MITK_PP_FOR_67, MITK_PP_TUPLE_EAT_4)(o(67, s), p, o, m)
+# define MITK_PP_FOR_67_I(s, p, o, m) MITK_PP_IF(p(68, s), m, MITK_PP_TUPLE_EAT_2)(68, s) MITK_PP_IF(p(68, s), MITK_PP_FOR_68, MITK_PP_TUPLE_EAT_4)(o(68, s), p, o, m)
+# define MITK_PP_FOR_68_I(s, p, o, m) MITK_PP_IF(p(69, s), m, MITK_PP_TUPLE_EAT_2)(69, s) MITK_PP_IF(p(69, s), MITK_PP_FOR_69, MITK_PP_TUPLE_EAT_4)(o(69, s), p, o, m)
+# define MITK_PP_FOR_69_I(s, p, o, m) MITK_PP_IF(p(70, s), m, MITK_PP_TUPLE_EAT_2)(70, s) MITK_PP_IF(p(70, s), MITK_PP_FOR_70, MITK_PP_TUPLE_EAT_4)(o(70, s), p, o, m)
+# define MITK_PP_FOR_70_I(s, p, o, m) MITK_PP_IF(p(71, s), m, MITK_PP_TUPLE_EAT_2)(71, s) MITK_PP_IF(p(71, s), MITK_PP_FOR_71, MITK_PP_TUPLE_EAT_4)(o(71, s), p, o, m)
+# define MITK_PP_FOR_71_I(s, p, o, m) MITK_PP_IF(p(72, s), m, MITK_PP_TUPLE_EAT_2)(72, s) MITK_PP_IF(p(72, s), MITK_PP_FOR_72, MITK_PP_TUPLE_EAT_4)(o(72, s), p, o, m)
+# define MITK_PP_FOR_72_I(s, p, o, m) MITK_PP_IF(p(73, s), m, MITK_PP_TUPLE_EAT_2)(73, s) MITK_PP_IF(p(73, s), MITK_PP_FOR_73, MITK_PP_TUPLE_EAT_4)(o(73, s), p, o, m)
+# define MITK_PP_FOR_73_I(s, p, o, m) MITK_PP_IF(p(74, s), m, MITK_PP_TUPLE_EAT_2)(74, s) MITK_PP_IF(p(74, s), MITK_PP_FOR_74, MITK_PP_TUPLE_EAT_4)(o(74, s), p, o, m)
+# define MITK_PP_FOR_74_I(s, p, o, m) MITK_PP_IF(p(75, s), m, MITK_PP_TUPLE_EAT_2)(75, s) MITK_PP_IF(p(75, s), MITK_PP_FOR_75, MITK_PP_TUPLE_EAT_4)(o(75, s), p, o, m)
+# define MITK_PP_FOR_75_I(s, p, o, m) MITK_PP_IF(p(76, s), m, MITK_PP_TUPLE_EAT_2)(76, s) MITK_PP_IF(p(76, s), MITK_PP_FOR_76, MITK_PP_TUPLE_EAT_4)(o(76, s), p, o, m)
+# define MITK_PP_FOR_76_I(s, p, o, m) MITK_PP_IF(p(77, s), m, MITK_PP_TUPLE_EAT_2)(77, s) MITK_PP_IF(p(77, s), MITK_PP_FOR_77, MITK_PP_TUPLE_EAT_4)(o(77, s), p, o, m)
+# define MITK_PP_FOR_77_I(s, p, o, m) MITK_PP_IF(p(78, s), m, MITK_PP_TUPLE_EAT_2)(78, s) MITK_PP_IF(p(78, s), MITK_PP_FOR_78, MITK_PP_TUPLE_EAT_4)(o(78, s), p, o, m)
+# define MITK_PP_FOR_78_I(s, p, o, m) MITK_PP_IF(p(79, s), m, MITK_PP_TUPLE_EAT_2)(79, s) MITK_PP_IF(p(79, s), MITK_PP_FOR_79, MITK_PP_TUPLE_EAT_4)(o(79, s), p, o, m)
+# define MITK_PP_FOR_79_I(s, p, o, m) MITK_PP_IF(p(80, s), m, MITK_PP_TUPLE_EAT_2)(80, s) MITK_PP_IF(p(80, s), MITK_PP_FOR_80, MITK_PP_TUPLE_EAT_4)(o(80, s), p, o, m)
+# define MITK_PP_FOR_80_I(s, p, o, m) MITK_PP_IF(p(81, s), m, MITK_PP_TUPLE_EAT_2)(81, s) MITK_PP_IF(p(81, s), MITK_PP_FOR_81, MITK_PP_TUPLE_EAT_4)(o(81, s), p, o, m)
+# define MITK_PP_FOR_81_I(s, p, o, m) MITK_PP_IF(p(82, s), m, MITK_PP_TUPLE_EAT_2)(82, s) MITK_PP_IF(p(82, s), MITK_PP_FOR_82, MITK_PP_TUPLE_EAT_4)(o(82, s), p, o, m)
+# define MITK_PP_FOR_82_I(s, p, o, m) MITK_PP_IF(p(83, s), m, MITK_PP_TUPLE_EAT_2)(83, s) MITK_PP_IF(p(83, s), MITK_PP_FOR_83, MITK_PP_TUPLE_EAT_4)(o(83, s), p, o, m)
+# define MITK_PP_FOR_83_I(s, p, o, m) MITK_PP_IF(p(84, s), m, MITK_PP_TUPLE_EAT_2)(84, s) MITK_PP_IF(p(84, s), MITK_PP_FOR_84, MITK_PP_TUPLE_EAT_4)(o(84, s), p, o, m)
+# define MITK_PP_FOR_84_I(s, p, o, m) MITK_PP_IF(p(85, s), m, MITK_PP_TUPLE_EAT_2)(85, s) MITK_PP_IF(p(85, s), MITK_PP_FOR_85, MITK_PP_TUPLE_EAT_4)(o(85, s), p, o, m)
+# define MITK_PP_FOR_85_I(s, p, o, m) MITK_PP_IF(p(86, s), m, MITK_PP_TUPLE_EAT_2)(86, s) MITK_PP_IF(p(86, s), MITK_PP_FOR_86, MITK_PP_TUPLE_EAT_4)(o(86, s), p, o, m)
+# define MITK_PP_FOR_86_I(s, p, o, m) MITK_PP_IF(p(87, s), m, MITK_PP_TUPLE_EAT_2)(87, s) MITK_PP_IF(p(87, s), MITK_PP_FOR_87, MITK_PP_TUPLE_EAT_4)(o(87, s), p, o, m)
+# define MITK_PP_FOR_87_I(s, p, o, m) MITK_PP_IF(p(88, s), m, MITK_PP_TUPLE_EAT_2)(88, s) MITK_PP_IF(p(88, s), MITK_PP_FOR_88, MITK_PP_TUPLE_EAT_4)(o(88, s), p, o, m)
+# define MITK_PP_FOR_88_I(s, p, o, m) MITK_PP_IF(p(89, s), m, MITK_PP_TUPLE_EAT_2)(89, s) MITK_PP_IF(p(89, s), MITK_PP_FOR_89, MITK_PP_TUPLE_EAT_4)(o(89, s), p, o, m)
+# define MITK_PP_FOR_89_I(s, p, o, m) MITK_PP_IF(p(90, s), m, MITK_PP_TUPLE_EAT_2)(90, s) MITK_PP_IF(p(90, s), MITK_PP_FOR_90, MITK_PP_TUPLE_EAT_4)(o(90, s), p, o, m)
+# define MITK_PP_FOR_90_I(s, p, o, m) MITK_PP_IF(p(91, s), m, MITK_PP_TUPLE_EAT_2)(91, s) MITK_PP_IF(p(91, s), MITK_PP_FOR_91, MITK_PP_TUPLE_EAT_4)(o(91, s), p, o, m)
+# define MITK_PP_FOR_91_I(s, p, o, m) MITK_PP_IF(p(92, s), m, MITK_PP_TUPLE_EAT_2)(92, s) MITK_PP_IF(p(92, s), MITK_PP_FOR_92, MITK_PP_TUPLE_EAT_4)(o(92, s), p, o, m)
+# define MITK_PP_FOR_92_I(s, p, o, m) MITK_PP_IF(p(93, s), m, MITK_PP_TUPLE_EAT_2)(93, s) MITK_PP_IF(p(93, s), MITK_PP_FOR_93, MITK_PP_TUPLE_EAT_4)(o(93, s), p, o, m)
+# define MITK_PP_FOR_93_I(s, p, o, m) MITK_PP_IF(p(94, s), m, MITK_PP_TUPLE_EAT_2)(94, s) MITK_PP_IF(p(94, s), MITK_PP_FOR_94, MITK_PP_TUPLE_EAT_4)(o(94, s), p, o, m)
+# define MITK_PP_FOR_94_I(s, p, o, m) MITK_PP_IF(p(95, s), m, MITK_PP_TUPLE_EAT_2)(95, s) MITK_PP_IF(p(95, s), MITK_PP_FOR_95, MITK_PP_TUPLE_EAT_4)(o(95, s), p, o, m)
+# define MITK_PP_FOR_95_I(s, p, o, m) MITK_PP_IF(p(96, s), m, MITK_PP_TUPLE_EAT_2)(96, s) MITK_PP_IF(p(96, s), MITK_PP_FOR_96, MITK_PP_TUPLE_EAT_4)(o(96, s), p, o, m)
+# define MITK_PP_FOR_96_I(s, p, o, m) MITK_PP_IF(p(97, s), m, MITK_PP_TUPLE_EAT_2)(97, s) MITK_PP_IF(p(97, s), MITK_PP_FOR_97, MITK_PP_TUPLE_EAT_4)(o(97, s), p, o, m)
+# define MITK_PP_FOR_97_I(s, p, o, m) MITK_PP_IF(p(98, s), m, MITK_PP_TUPLE_EAT_2)(98, s) MITK_PP_IF(p(98, s), MITK_PP_FOR_98, MITK_PP_TUPLE_EAT_4)(o(98, s), p, o, m)
+# define MITK_PP_FOR_98_I(s, p, o, m) MITK_PP_IF(p(99, s), m, MITK_PP_TUPLE_EAT_2)(99, s) MITK_PP_IF(p(99, s), MITK_PP_FOR_99, MITK_PP_TUPLE_EAT_4)(o(99, s), p, o, m)
+# define MITK_PP_FOR_99_I(s, p, o, m) MITK_PP_IF(p(100, s), m, MITK_PP_TUPLE_EAT_2)(100, s) MITK_PP_IF(p(100, s), MITK_PP_FOR_100, MITK_PP_TUPLE_EAT_4)(o(100, s), p, o, m)
+# define MITK_PP_FOR_100_I(s, p, o, m) MITK_PP_IF(p(101, s), m, MITK_PP_TUPLE_EAT_2)(101, s) MITK_PP_IF(p(101, s), MITK_PP_FOR_101, MITK_PP_TUPLE_EAT_4)(o(101, s), p, o, m)
+# define MITK_PP_FOR_101_I(s, p, o, m) MITK_PP_IF(p(102, s), m, MITK_PP_TUPLE_EAT_2)(102, s) MITK_PP_IF(p(102, s), MITK_PP_FOR_102, MITK_PP_TUPLE_EAT_4)(o(102, s), p, o, m)
+# define MITK_PP_FOR_102_I(s, p, o, m) MITK_PP_IF(p(103, s), m, MITK_PP_TUPLE_EAT_2)(103, s) MITK_PP_IF(p(103, s), MITK_PP_FOR_103, MITK_PP_TUPLE_EAT_4)(o(103, s), p, o, m)
+# define MITK_PP_FOR_103_I(s, p, o, m) MITK_PP_IF(p(104, s), m, MITK_PP_TUPLE_EAT_2)(104, s) MITK_PP_IF(p(104, s), MITK_PP_FOR_104, MITK_PP_TUPLE_EAT_4)(o(104, s), p, o, m)
+# define MITK_PP_FOR_104_I(s, p, o, m) MITK_PP_IF(p(105, s), m, MITK_PP_TUPLE_EAT_2)(105, s) MITK_PP_IF(p(105, s), MITK_PP_FOR_105, MITK_PP_TUPLE_EAT_4)(o(105, s), p, o, m)
+# define MITK_PP_FOR_105_I(s, p, o, m) MITK_PP_IF(p(106, s), m, MITK_PP_TUPLE_EAT_2)(106, s) MITK_PP_IF(p(106, s), MITK_PP_FOR_106, MITK_PP_TUPLE_EAT_4)(o(106, s), p, o, m)
+# define MITK_PP_FOR_106_I(s, p, o, m) MITK_PP_IF(p(107, s), m, MITK_PP_TUPLE_EAT_2)(107, s) MITK_PP_IF(p(107, s), MITK_PP_FOR_107, MITK_PP_TUPLE_EAT_4)(o(107, s), p, o, m)
+# define MITK_PP_FOR_107_I(s, p, o, m) MITK_PP_IF(p(108, s), m, MITK_PP_TUPLE_EAT_2)(108, s) MITK_PP_IF(p(108, s), MITK_PP_FOR_108, MITK_PP_TUPLE_EAT_4)(o(108, s), p, o, m)
+# define MITK_PP_FOR_108_I(s, p, o, m) MITK_PP_IF(p(109, s), m, MITK_PP_TUPLE_EAT_2)(109, s) MITK_PP_IF(p(109, s), MITK_PP_FOR_109, MITK_PP_TUPLE_EAT_4)(o(109, s), p, o, m)
+# define MITK_PP_FOR_109_I(s, p, o, m) MITK_PP_IF(p(110, s), m, MITK_PP_TUPLE_EAT_2)(110, s) MITK_PP_IF(p(110, s), MITK_PP_FOR_110, MITK_PP_TUPLE_EAT_4)(o(110, s), p, o, m)
+# define MITK_PP_FOR_110_I(s, p, o, m) MITK_PP_IF(p(111, s), m, MITK_PP_TUPLE_EAT_2)(111, s) MITK_PP_IF(p(111, s), MITK_PP_FOR_111, MITK_PP_TUPLE_EAT_4)(o(111, s), p, o, m)
+# define MITK_PP_FOR_111_I(s, p, o, m) MITK_PP_IF(p(112, s), m, MITK_PP_TUPLE_EAT_2)(112, s) MITK_PP_IF(p(112, s), MITK_PP_FOR_112, MITK_PP_TUPLE_EAT_4)(o(112, s), p, o, m)
+# define MITK_PP_FOR_112_I(s, p, o, m) MITK_PP_IF(p(113, s), m, MITK_PP_TUPLE_EAT_2)(113, s) MITK_PP_IF(p(113, s), MITK_PP_FOR_113, MITK_PP_TUPLE_EAT_4)(o(113, s), p, o, m)
+# define MITK_PP_FOR_113_I(s, p, o, m) MITK_PP_IF(p(114, s), m, MITK_PP_TUPLE_EAT_2)(114, s) MITK_PP_IF(p(114, s), MITK_PP_FOR_114, MITK_PP_TUPLE_EAT_4)(o(114, s), p, o, m)
+# define MITK_PP_FOR_114_I(s, p, o, m) MITK_PP_IF(p(115, s), m, MITK_PP_TUPLE_EAT_2)(115, s) MITK_PP_IF(p(115, s), MITK_PP_FOR_115, MITK_PP_TUPLE_EAT_4)(o(115, s), p, o, m)
+# define MITK_PP_FOR_115_I(s, p, o, m) MITK_PP_IF(p(116, s), m, MITK_PP_TUPLE_EAT_2)(116, s) MITK_PP_IF(p(116, s), MITK_PP_FOR_116, MITK_PP_TUPLE_EAT_4)(o(116, s), p, o, m)
+# define MITK_PP_FOR_116_I(s, p, o, m) MITK_PP_IF(p(117, s), m, MITK_PP_TUPLE_EAT_2)(117, s) MITK_PP_IF(p(117, s), MITK_PP_FOR_117, MITK_PP_TUPLE_EAT_4)(o(117, s), p, o, m)
+# define MITK_PP_FOR_117_I(s, p, o, m) MITK_PP_IF(p(118, s), m, MITK_PP_TUPLE_EAT_2)(118, s) MITK_PP_IF(p(118, s), MITK_PP_FOR_118, MITK_PP_TUPLE_EAT_4)(o(118, s), p, o, m)
+# define MITK_PP_FOR_118_I(s, p, o, m) MITK_PP_IF(p(119, s), m, MITK_PP_TUPLE_EAT_2)(119, s) MITK_PP_IF(p(119, s), MITK_PP_FOR_119, MITK_PP_TUPLE_EAT_4)(o(119, s), p, o, m)
+# define MITK_PP_FOR_119_I(s, p, o, m) MITK_PP_IF(p(120, s), m, MITK_PP_TUPLE_EAT_2)(120, s) MITK_PP_IF(p(120, s), MITK_PP_FOR_120, MITK_PP_TUPLE_EAT_4)(o(120, s), p, o, m)
+# define MITK_PP_FOR_120_I(s, p, o, m) MITK_PP_IF(p(121, s), m, MITK_PP_TUPLE_EAT_2)(121, s) MITK_PP_IF(p(121, s), MITK_PP_FOR_121, MITK_PP_TUPLE_EAT_4)(o(121, s), p, o, m)
+# define MITK_PP_FOR_121_I(s, p, o, m) MITK_PP_IF(p(122, s), m, MITK_PP_TUPLE_EAT_2)(122, s) MITK_PP_IF(p(122, s), MITK_PP_FOR_122, MITK_PP_TUPLE_EAT_4)(o(122, s), p, o, m)
+# define MITK_PP_FOR_122_I(s, p, o, m) MITK_PP_IF(p(123, s), m, MITK_PP_TUPLE_EAT_2)(123, s) MITK_PP_IF(p(123, s), MITK_PP_FOR_123, MITK_PP_TUPLE_EAT_4)(o(123, s), p, o, m)
+# define MITK_PP_FOR_123_I(s, p, o, m) MITK_PP_IF(p(124, s), m, MITK_PP_TUPLE_EAT_2)(124, s) MITK_PP_IF(p(124, s), MITK_PP_FOR_124, MITK_PP_TUPLE_EAT_4)(o(124, s), p, o, m)
+# define MITK_PP_FOR_124_I(s, p, o, m) MITK_PP_IF(p(125, s), m, MITK_PP_TUPLE_EAT_2)(125, s) MITK_PP_IF(p(125, s), MITK_PP_FOR_125, MITK_PP_TUPLE_EAT_4)(o(125, s), p, o, m)
+# define MITK_PP_FOR_125_I(s, p, o, m) MITK_PP_IF(p(126, s), m, MITK_PP_TUPLE_EAT_2)(126, s) MITK_PP_IF(p(126, s), MITK_PP_FOR_126, MITK_PP_TUPLE_EAT_4)(o(126, s), p, o, m)
+# define MITK_PP_FOR_126_I(s, p, o, m) MITK_PP_IF(p(127, s), m, MITK_PP_TUPLE_EAT_2)(127, s) MITK_PP_IF(p(127, s), MITK_PP_FOR_127, MITK_PP_TUPLE_EAT_4)(o(127, s), p, o, m)
+# define MITK_PP_FOR_127_I(s, p, o, m) MITK_PP_IF(p(128, s), m, MITK_PP_TUPLE_EAT_2)(128, s) MITK_PP_IF(p(128, s), MITK_PP_FOR_128, MITK_PP_TUPLE_EAT_4)(o(128, s), p, o, m)
+# define MITK_PP_FOR_128_I(s, p, o, m) MITK_PP_IF(p(129, s), m, MITK_PP_TUPLE_EAT_2)(129, s) MITK_PP_IF(p(129, s), MITK_PP_FOR_129, MITK_PP_TUPLE_EAT_4)(o(129, s), p, o, m)
+# define MITK_PP_FOR_129_I(s, p, o, m) MITK_PP_IF(p(130, s), m, MITK_PP_TUPLE_EAT_2)(130, s) MITK_PP_IF(p(130, s), MITK_PP_FOR_130, MITK_PP_TUPLE_EAT_4)(o(130, s), p, o, m)
+# define MITK_PP_FOR_130_I(s, p, o, m) MITK_PP_IF(p(131, s), m, MITK_PP_TUPLE_EAT_2)(131, s) MITK_PP_IF(p(131, s), MITK_PP_FOR_131, MITK_PP_TUPLE_EAT_4)(o(131, s), p, o, m)
+# define MITK_PP_FOR_131_I(s, p, o, m) MITK_PP_IF(p(132, s), m, MITK_PP_TUPLE_EAT_2)(132, s) MITK_PP_IF(p(132, s), MITK_PP_FOR_132, MITK_PP_TUPLE_EAT_4)(o(132, s), p, o, m)
+# define MITK_PP_FOR_132_I(s, p, o, m) MITK_PP_IF(p(133, s), m, MITK_PP_TUPLE_EAT_2)(133, s) MITK_PP_IF(p(133, s), MITK_PP_FOR_133, MITK_PP_TUPLE_EAT_4)(o(133, s), p, o, m)
+# define MITK_PP_FOR_133_I(s, p, o, m) MITK_PP_IF(p(134, s), m, MITK_PP_TUPLE_EAT_2)(134, s) MITK_PP_IF(p(134, s), MITK_PP_FOR_134, MITK_PP_TUPLE_EAT_4)(o(134, s), p, o, m)
+# define MITK_PP_FOR_134_I(s, p, o, m) MITK_PP_IF(p(135, s), m, MITK_PP_TUPLE_EAT_2)(135, s) MITK_PP_IF(p(135, s), MITK_PP_FOR_135, MITK_PP_TUPLE_EAT_4)(o(135, s), p, o, m)
+# define MITK_PP_FOR_135_I(s, p, o, m) MITK_PP_IF(p(136, s), m, MITK_PP_TUPLE_EAT_2)(136, s) MITK_PP_IF(p(136, s), MITK_PP_FOR_136, MITK_PP_TUPLE_EAT_4)(o(136, s), p, o, m)
+# define MITK_PP_FOR_136_I(s, p, o, m) MITK_PP_IF(p(137, s), m, MITK_PP_TUPLE_EAT_2)(137, s) MITK_PP_IF(p(137, s), MITK_PP_FOR_137, MITK_PP_TUPLE_EAT_4)(o(137, s), p, o, m)
+# define MITK_PP_FOR_137_I(s, p, o, m) MITK_PP_IF(p(138, s), m, MITK_PP_TUPLE_EAT_2)(138, s) MITK_PP_IF(p(138, s), MITK_PP_FOR_138, MITK_PP_TUPLE_EAT_4)(o(138, s), p, o, m)
+# define MITK_PP_FOR_138_I(s, p, o, m) MITK_PP_IF(p(139, s), m, MITK_PP_TUPLE_EAT_2)(139, s) MITK_PP_IF(p(139, s), MITK_PP_FOR_139, MITK_PP_TUPLE_EAT_4)(o(139, s), p, o, m)
+# define MITK_PP_FOR_139_I(s, p, o, m) MITK_PP_IF(p(140, s), m, MITK_PP_TUPLE_EAT_2)(140, s) MITK_PP_IF(p(140, s), MITK_PP_FOR_140, MITK_PP_TUPLE_EAT_4)(o(140, s), p, o, m)
+# define MITK_PP_FOR_140_I(s, p, o, m) MITK_PP_IF(p(141, s), m, MITK_PP_TUPLE_EAT_2)(141, s) MITK_PP_IF(p(141, s), MITK_PP_FOR_141, MITK_PP_TUPLE_EAT_4)(o(141, s), p, o, m)
+# define MITK_PP_FOR_141_I(s, p, o, m) MITK_PP_IF(p(142, s), m, MITK_PP_TUPLE_EAT_2)(142, s) MITK_PP_IF(p(142, s), MITK_PP_FOR_142, MITK_PP_TUPLE_EAT_4)(o(142, s), p, o, m)
+# define MITK_PP_FOR_142_I(s, p, o, m) MITK_PP_IF(p(143, s), m, MITK_PP_TUPLE_EAT_2)(143, s) MITK_PP_IF(p(143, s), MITK_PP_FOR_143, MITK_PP_TUPLE_EAT_4)(o(143, s), p, o, m)
+# define MITK_PP_FOR_143_I(s, p, o, m) MITK_PP_IF(p(144, s), m, MITK_PP_TUPLE_EAT_2)(144, s) MITK_PP_IF(p(144, s), MITK_PP_FOR_144, MITK_PP_TUPLE_EAT_4)(o(144, s), p, o, m)
+# define MITK_PP_FOR_144_I(s, p, o, m) MITK_PP_IF(p(145, s), m, MITK_PP_TUPLE_EAT_2)(145, s) MITK_PP_IF(p(145, s), MITK_PP_FOR_145, MITK_PP_TUPLE_EAT_4)(o(145, s), p, o, m)
+# define MITK_PP_FOR_145_I(s, p, o, m) MITK_PP_IF(p(146, s), m, MITK_PP_TUPLE_EAT_2)(146, s) MITK_PP_IF(p(146, s), MITK_PP_FOR_146, MITK_PP_TUPLE_EAT_4)(o(146, s), p, o, m)
+# define MITK_PP_FOR_146_I(s, p, o, m) MITK_PP_IF(p(147, s), m, MITK_PP_TUPLE_EAT_2)(147, s) MITK_PP_IF(p(147, s), MITK_PP_FOR_147, MITK_PP_TUPLE_EAT_4)(o(147, s), p, o, m)
+# define MITK_PP_FOR_147_I(s, p, o, m) MITK_PP_IF(p(148, s), m, MITK_PP_TUPLE_EAT_2)(148, s) MITK_PP_IF(p(148, s), MITK_PP_FOR_148, MITK_PP_TUPLE_EAT_4)(o(148, s), p, o, m)
+# define MITK_PP_FOR_148_I(s, p, o, m) MITK_PP_IF(p(149, s), m, MITK_PP_TUPLE_EAT_2)(149, s) MITK_PP_IF(p(149, s), MITK_PP_FOR_149, MITK_PP_TUPLE_EAT_4)(o(149, s), p, o, m)
+# define MITK_PP_FOR_149_I(s, p, o, m) MITK_PP_IF(p(150, s), m, MITK_PP_TUPLE_EAT_2)(150, s) MITK_PP_IF(p(150, s), MITK_PP_FOR_150, MITK_PP_TUPLE_EAT_4)(o(150, s), p, o, m)
+# define MITK_PP_FOR_150_I(s, p, o, m) MITK_PP_IF(p(151, s), m, MITK_PP_TUPLE_EAT_2)(151, s) MITK_PP_IF(p(151, s), MITK_PP_FOR_151, MITK_PP_TUPLE_EAT_4)(o(151, s), p, o, m)
+# define MITK_PP_FOR_151_I(s, p, o, m) MITK_PP_IF(p(152, s), m, MITK_PP_TUPLE_EAT_2)(152, s) MITK_PP_IF(p(152, s), MITK_PP_FOR_152, MITK_PP_TUPLE_EAT_4)(o(152, s), p, o, m)
+# define MITK_PP_FOR_152_I(s, p, o, m) MITK_PP_IF(p(153, s), m, MITK_PP_TUPLE_EAT_2)(153, s) MITK_PP_IF(p(153, s), MITK_PP_FOR_153, MITK_PP_TUPLE_EAT_4)(o(153, s), p, o, m)
+# define MITK_PP_FOR_153_I(s, p, o, m) MITK_PP_IF(p(154, s), m, MITK_PP_TUPLE_EAT_2)(154, s) MITK_PP_IF(p(154, s), MITK_PP_FOR_154, MITK_PP_TUPLE_EAT_4)(o(154, s), p, o, m)
+# define MITK_PP_FOR_154_I(s, p, o, m) MITK_PP_IF(p(155, s), m, MITK_PP_TUPLE_EAT_2)(155, s) MITK_PP_IF(p(155, s), MITK_PP_FOR_155, MITK_PP_TUPLE_EAT_4)(o(155, s), p, o, m)
+# define MITK_PP_FOR_155_I(s, p, o, m) MITK_PP_IF(p(156, s), m, MITK_PP_TUPLE_EAT_2)(156, s) MITK_PP_IF(p(156, s), MITK_PP_FOR_156, MITK_PP_TUPLE_EAT_4)(o(156, s), p, o, m)
+# define MITK_PP_FOR_156_I(s, p, o, m) MITK_PP_IF(p(157, s), m, MITK_PP_TUPLE_EAT_2)(157, s) MITK_PP_IF(p(157, s), MITK_PP_FOR_157, MITK_PP_TUPLE_EAT_4)(o(157, s), p, o, m)
+# define MITK_PP_FOR_157_I(s, p, o, m) MITK_PP_IF(p(158, s), m, MITK_PP_TUPLE_EAT_2)(158, s) MITK_PP_IF(p(158, s), MITK_PP_FOR_158, MITK_PP_TUPLE_EAT_4)(o(158, s), p, o, m)
+# define MITK_PP_FOR_158_I(s, p, o, m) MITK_PP_IF(p(159, s), m, MITK_PP_TUPLE_EAT_2)(159, s) MITK_PP_IF(p(159, s), MITK_PP_FOR_159, MITK_PP_TUPLE_EAT_4)(o(159, s), p, o, m)
+# define MITK_PP_FOR_159_I(s, p, o, m) MITK_PP_IF(p(160, s), m, MITK_PP_TUPLE_EAT_2)(160, s) MITK_PP_IF(p(160, s), MITK_PP_FOR_160, MITK_PP_TUPLE_EAT_4)(o(160, s), p, o, m)
+# define MITK_PP_FOR_160_I(s, p, o, m) MITK_PP_IF(p(161, s), m, MITK_PP_TUPLE_EAT_2)(161, s) MITK_PP_IF(p(161, s), MITK_PP_FOR_161, MITK_PP_TUPLE_EAT_4)(o(161, s), p, o, m)
+# define MITK_PP_FOR_161_I(s, p, o, m) MITK_PP_IF(p(162, s), m, MITK_PP_TUPLE_EAT_2)(162, s) MITK_PP_IF(p(162, s), MITK_PP_FOR_162, MITK_PP_TUPLE_EAT_4)(o(162, s), p, o, m)
+# define MITK_PP_FOR_162_I(s, p, o, m) MITK_PP_IF(p(163, s), m, MITK_PP_TUPLE_EAT_2)(163, s) MITK_PP_IF(p(163, s), MITK_PP_FOR_163, MITK_PP_TUPLE_EAT_4)(o(163, s), p, o, m)
+# define MITK_PP_FOR_163_I(s, p, o, m) MITK_PP_IF(p(164, s), m, MITK_PP_TUPLE_EAT_2)(164, s) MITK_PP_IF(p(164, s), MITK_PP_FOR_164, MITK_PP_TUPLE_EAT_4)(o(164, s), p, o, m)
+# define MITK_PP_FOR_164_I(s, p, o, m) MITK_PP_IF(p(165, s), m, MITK_PP_TUPLE_EAT_2)(165, s) MITK_PP_IF(p(165, s), MITK_PP_FOR_165, MITK_PP_TUPLE_EAT_4)(o(165, s), p, o, m)
+# define MITK_PP_FOR_165_I(s, p, o, m) MITK_PP_IF(p(166, s), m, MITK_PP_TUPLE_EAT_2)(166, s) MITK_PP_IF(p(166, s), MITK_PP_FOR_166, MITK_PP_TUPLE_EAT_4)(o(166, s), p, o, m)
+# define MITK_PP_FOR_166_I(s, p, o, m) MITK_PP_IF(p(167, s), m, MITK_PP_TUPLE_EAT_2)(167, s) MITK_PP_IF(p(167, s), MITK_PP_FOR_167, MITK_PP_TUPLE_EAT_4)(o(167, s), p, o, m)
+# define MITK_PP_FOR_167_I(s, p, o, m) MITK_PP_IF(p(168, s), m, MITK_PP_TUPLE_EAT_2)(168, s) MITK_PP_IF(p(168, s), MITK_PP_FOR_168, MITK_PP_TUPLE_EAT_4)(o(168, s), p, o, m)
+# define MITK_PP_FOR_168_I(s, p, o, m) MITK_PP_IF(p(169, s), m, MITK_PP_TUPLE_EAT_2)(169, s) MITK_PP_IF(p(169, s), MITK_PP_FOR_169, MITK_PP_TUPLE_EAT_4)(o(169, s), p, o, m)
+# define MITK_PP_FOR_169_I(s, p, o, m) MITK_PP_IF(p(170, s), m, MITK_PP_TUPLE_EAT_2)(170, s) MITK_PP_IF(p(170, s), MITK_PP_FOR_170, MITK_PP_TUPLE_EAT_4)(o(170, s), p, o, m)
+# define MITK_PP_FOR_170_I(s, p, o, m) MITK_PP_IF(p(171, s), m, MITK_PP_TUPLE_EAT_2)(171, s) MITK_PP_IF(p(171, s), MITK_PP_FOR_171, MITK_PP_TUPLE_EAT_4)(o(171, s), p, o, m)
+# define MITK_PP_FOR_171_I(s, p, o, m) MITK_PP_IF(p(172, s), m, MITK_PP_TUPLE_EAT_2)(172, s) MITK_PP_IF(p(172, s), MITK_PP_FOR_172, MITK_PP_TUPLE_EAT_4)(o(172, s), p, o, m)
+# define MITK_PP_FOR_172_I(s, p, o, m) MITK_PP_IF(p(173, s), m, MITK_PP_TUPLE_EAT_2)(173, s) MITK_PP_IF(p(173, s), MITK_PP_FOR_173, MITK_PP_TUPLE_EAT_4)(o(173, s), p, o, m)
+# define MITK_PP_FOR_173_I(s, p, o, m) MITK_PP_IF(p(174, s), m, MITK_PP_TUPLE_EAT_2)(174, s) MITK_PP_IF(p(174, s), MITK_PP_FOR_174, MITK_PP_TUPLE_EAT_4)(o(174, s), p, o, m)
+# define MITK_PP_FOR_174_I(s, p, o, m) MITK_PP_IF(p(175, s), m, MITK_PP_TUPLE_EAT_2)(175, s) MITK_PP_IF(p(175, s), MITK_PP_FOR_175, MITK_PP_TUPLE_EAT_4)(o(175, s), p, o, m)
+# define MITK_PP_FOR_175_I(s, p, o, m) MITK_PP_IF(p(176, s), m, MITK_PP_TUPLE_EAT_2)(176, s) MITK_PP_IF(p(176, s), MITK_PP_FOR_176, MITK_PP_TUPLE_EAT_4)(o(176, s), p, o, m)
+# define MITK_PP_FOR_176_I(s, p, o, m) MITK_PP_IF(p(177, s), m, MITK_PP_TUPLE_EAT_2)(177, s) MITK_PP_IF(p(177, s), MITK_PP_FOR_177, MITK_PP_TUPLE_EAT_4)(o(177, s), p, o, m)
+# define MITK_PP_FOR_177_I(s, p, o, m) MITK_PP_IF(p(178, s), m, MITK_PP_TUPLE_EAT_2)(178, s) MITK_PP_IF(p(178, s), MITK_PP_FOR_178, MITK_PP_TUPLE_EAT_4)(o(178, s), p, o, m)
+# define MITK_PP_FOR_178_I(s, p, o, m) MITK_PP_IF(p(179, s), m, MITK_PP_TUPLE_EAT_2)(179, s) MITK_PP_IF(p(179, s), MITK_PP_FOR_179, MITK_PP_TUPLE_EAT_4)(o(179, s), p, o, m)
+# define MITK_PP_FOR_179_I(s, p, o, m) MITK_PP_IF(p(180, s), m, MITK_PP_TUPLE_EAT_2)(180, s) MITK_PP_IF(p(180, s), MITK_PP_FOR_180, MITK_PP_TUPLE_EAT_4)(o(180, s), p, o, m)
+# define MITK_PP_FOR_180_I(s, p, o, m) MITK_PP_IF(p(181, s), m, MITK_PP_TUPLE_EAT_2)(181, s) MITK_PP_IF(p(181, s), MITK_PP_FOR_181, MITK_PP_TUPLE_EAT_4)(o(181, s), p, o, m)
+# define MITK_PP_FOR_181_I(s, p, o, m) MITK_PP_IF(p(182, s), m, MITK_PP_TUPLE_EAT_2)(182, s) MITK_PP_IF(p(182, s), MITK_PP_FOR_182, MITK_PP_TUPLE_EAT_4)(o(182, s), p, o, m)
+# define MITK_PP_FOR_182_I(s, p, o, m) MITK_PP_IF(p(183, s), m, MITK_PP_TUPLE_EAT_2)(183, s) MITK_PP_IF(p(183, s), MITK_PP_FOR_183, MITK_PP_TUPLE_EAT_4)(o(183, s), p, o, m)
+# define MITK_PP_FOR_183_I(s, p, o, m) MITK_PP_IF(p(184, s), m, MITK_PP_TUPLE_EAT_2)(184, s) MITK_PP_IF(p(184, s), MITK_PP_FOR_184, MITK_PP_TUPLE_EAT_4)(o(184, s), p, o, m)
+# define MITK_PP_FOR_184_I(s, p, o, m) MITK_PP_IF(p(185, s), m, MITK_PP_TUPLE_EAT_2)(185, s) MITK_PP_IF(p(185, s), MITK_PP_FOR_185, MITK_PP_TUPLE_EAT_4)(o(185, s), p, o, m)
+# define MITK_PP_FOR_185_I(s, p, o, m) MITK_PP_IF(p(186, s), m, MITK_PP_TUPLE_EAT_2)(186, s) MITK_PP_IF(p(186, s), MITK_PP_FOR_186, MITK_PP_TUPLE_EAT_4)(o(186, s), p, o, m)
+# define MITK_PP_FOR_186_I(s, p, o, m) MITK_PP_IF(p(187, s), m, MITK_PP_TUPLE_EAT_2)(187, s) MITK_PP_IF(p(187, s), MITK_PP_FOR_187, MITK_PP_TUPLE_EAT_4)(o(187, s), p, o, m)
+# define MITK_PP_FOR_187_I(s, p, o, m) MITK_PP_IF(p(188, s), m, MITK_PP_TUPLE_EAT_2)(188, s) MITK_PP_IF(p(188, s), MITK_PP_FOR_188, MITK_PP_TUPLE_EAT_4)(o(188, s), p, o, m)
+# define MITK_PP_FOR_188_I(s, p, o, m) MITK_PP_IF(p(189, s), m, MITK_PP_TUPLE_EAT_2)(189, s) MITK_PP_IF(p(189, s), MITK_PP_FOR_189, MITK_PP_TUPLE_EAT_4)(o(189, s), p, o, m)
+# define MITK_PP_FOR_189_I(s, p, o, m) MITK_PP_IF(p(190, s), m, MITK_PP_TUPLE_EAT_2)(190, s) MITK_PP_IF(p(190, s), MITK_PP_FOR_190, MITK_PP_TUPLE_EAT_4)(o(190, s), p, o, m)
+# define MITK_PP_FOR_190_I(s, p, o, m) MITK_PP_IF(p(191, s), m, MITK_PP_TUPLE_EAT_2)(191, s) MITK_PP_IF(p(191, s), MITK_PP_FOR_191, MITK_PP_TUPLE_EAT_4)(o(191, s), p, o, m)
+# define MITK_PP_FOR_191_I(s, p, o, m) MITK_PP_IF(p(192, s), m, MITK_PP_TUPLE_EAT_2)(192, s) MITK_PP_IF(p(192, s), MITK_PP_FOR_192, MITK_PP_TUPLE_EAT_4)(o(192, s), p, o, m)
+# define MITK_PP_FOR_192_I(s, p, o, m) MITK_PP_IF(p(193, s), m, MITK_PP_TUPLE_EAT_2)(193, s) MITK_PP_IF(p(193, s), MITK_PP_FOR_193, MITK_PP_TUPLE_EAT_4)(o(193, s), p, o, m)
+# define MITK_PP_FOR_193_I(s, p, o, m) MITK_PP_IF(p(194, s), m, MITK_PP_TUPLE_EAT_2)(194, s) MITK_PP_IF(p(194, s), MITK_PP_FOR_194, MITK_PP_TUPLE_EAT_4)(o(194, s), p, o, m)
+# define MITK_PP_FOR_194_I(s, p, o, m) MITK_PP_IF(p(195, s), m, MITK_PP_TUPLE_EAT_2)(195, s) MITK_PP_IF(p(195, s), MITK_PP_FOR_195, MITK_PP_TUPLE_EAT_4)(o(195, s), p, o, m)
+# define MITK_PP_FOR_195_I(s, p, o, m) MITK_PP_IF(p(196, s), m, MITK_PP_TUPLE_EAT_2)(196, s) MITK_PP_IF(p(196, s), MITK_PP_FOR_196, MITK_PP_TUPLE_EAT_4)(o(196, s), p, o, m)
+# define MITK_PP_FOR_196_I(s, p, o, m) MITK_PP_IF(p(197, s), m, MITK_PP_TUPLE_EAT_2)(197, s) MITK_PP_IF(p(197, s), MITK_PP_FOR_197, MITK_PP_TUPLE_EAT_4)(o(197, s), p, o, m)
+# define MITK_PP_FOR_197_I(s, p, o, m) MITK_PP_IF(p(198, s), m, MITK_PP_TUPLE_EAT_2)(198, s) MITK_PP_IF(p(198, s), MITK_PP_FOR_198, MITK_PP_TUPLE_EAT_4)(o(198, s), p, o, m)
+# define MITK_PP_FOR_198_I(s, p, o, m) MITK_PP_IF(p(199, s), m, MITK_PP_TUPLE_EAT_2)(199, s) MITK_PP_IF(p(199, s), MITK_PP_FOR_199, MITK_PP_TUPLE_EAT_4)(o(199, s), p, o, m)
+# define MITK_PP_FOR_199_I(s, p, o, m) MITK_PP_IF(p(200, s), m, MITK_PP_TUPLE_EAT_2)(200, s) MITK_PP_IF(p(200, s), MITK_PP_FOR_200, MITK_PP_TUPLE_EAT_4)(o(200, s), p, o, m)
+# define MITK_PP_FOR_200_I(s, p, o, m) MITK_PP_IF(p(201, s), m, MITK_PP_TUPLE_EAT_2)(201, s) MITK_PP_IF(p(201, s), MITK_PP_FOR_201, MITK_PP_TUPLE_EAT_4)(o(201, s), p, o, m)
+# define MITK_PP_FOR_201_I(s, p, o, m) MITK_PP_IF(p(202, s), m, MITK_PP_TUPLE_EAT_2)(202, s) MITK_PP_IF(p(202, s), MITK_PP_FOR_202, MITK_PP_TUPLE_EAT_4)(o(202, s), p, o, m)
+# define MITK_PP_FOR_202_I(s, p, o, m) MITK_PP_IF(p(203, s), m, MITK_PP_TUPLE_EAT_2)(203, s) MITK_PP_IF(p(203, s), MITK_PP_FOR_203, MITK_PP_TUPLE_EAT_4)(o(203, s), p, o, m)
+# define MITK_PP_FOR_203_I(s, p, o, m) MITK_PP_IF(p(204, s), m, MITK_PP_TUPLE_EAT_2)(204, s) MITK_PP_IF(p(204, s), MITK_PP_FOR_204, MITK_PP_TUPLE_EAT_4)(o(204, s), p, o, m)
+# define MITK_PP_FOR_204_I(s, p, o, m) MITK_PP_IF(p(205, s), m, MITK_PP_TUPLE_EAT_2)(205, s) MITK_PP_IF(p(205, s), MITK_PP_FOR_205, MITK_PP_TUPLE_EAT_4)(o(205, s), p, o, m)
+# define MITK_PP_FOR_205_I(s, p, o, m) MITK_PP_IF(p(206, s), m, MITK_PP_TUPLE_EAT_2)(206, s) MITK_PP_IF(p(206, s), MITK_PP_FOR_206, MITK_PP_TUPLE_EAT_4)(o(206, s), p, o, m)
+# define MITK_PP_FOR_206_I(s, p, o, m) MITK_PP_IF(p(207, s), m, MITK_PP_TUPLE_EAT_2)(207, s) MITK_PP_IF(p(207, s), MITK_PP_FOR_207, MITK_PP_TUPLE_EAT_4)(o(207, s), p, o, m)
+# define MITK_PP_FOR_207_I(s, p, o, m) MITK_PP_IF(p(208, s), m, MITK_PP_TUPLE_EAT_2)(208, s) MITK_PP_IF(p(208, s), MITK_PP_FOR_208, MITK_PP_TUPLE_EAT_4)(o(208, s), p, o, m)
+# define MITK_PP_FOR_208_I(s, p, o, m) MITK_PP_IF(p(209, s), m, MITK_PP_TUPLE_EAT_2)(209, s) MITK_PP_IF(p(209, s), MITK_PP_FOR_209, MITK_PP_TUPLE_EAT_4)(o(209, s), p, o, m)
+# define MITK_PP_FOR_209_I(s, p, o, m) MITK_PP_IF(p(210, s), m, MITK_PP_TUPLE_EAT_2)(210, s) MITK_PP_IF(p(210, s), MITK_PP_FOR_210, MITK_PP_TUPLE_EAT_4)(o(210, s), p, o, m)
+# define MITK_PP_FOR_210_I(s, p, o, m) MITK_PP_IF(p(211, s), m, MITK_PP_TUPLE_EAT_2)(211, s) MITK_PP_IF(p(211, s), MITK_PP_FOR_211, MITK_PP_TUPLE_EAT_4)(o(211, s), p, o, m)
+# define MITK_PP_FOR_211_I(s, p, o, m) MITK_PP_IF(p(212, s), m, MITK_PP_TUPLE_EAT_2)(212, s) MITK_PP_IF(p(212, s), MITK_PP_FOR_212, MITK_PP_TUPLE_EAT_4)(o(212, s), p, o, m)
+# define MITK_PP_FOR_212_I(s, p, o, m) MITK_PP_IF(p(213, s), m, MITK_PP_TUPLE_EAT_2)(213, s) MITK_PP_IF(p(213, s), MITK_PP_FOR_213, MITK_PP_TUPLE_EAT_4)(o(213, s), p, o, m)
+# define MITK_PP_FOR_213_I(s, p, o, m) MITK_PP_IF(p(214, s), m, MITK_PP_TUPLE_EAT_2)(214, s) MITK_PP_IF(p(214, s), MITK_PP_FOR_214, MITK_PP_TUPLE_EAT_4)(o(214, s), p, o, m)
+# define MITK_PP_FOR_214_I(s, p, o, m) MITK_PP_IF(p(215, s), m, MITK_PP_TUPLE_EAT_2)(215, s) MITK_PP_IF(p(215, s), MITK_PP_FOR_215, MITK_PP_TUPLE_EAT_4)(o(215, s), p, o, m)
+# define MITK_PP_FOR_215_I(s, p, o, m) MITK_PP_IF(p(216, s), m, MITK_PP_TUPLE_EAT_2)(216, s) MITK_PP_IF(p(216, s), MITK_PP_FOR_216, MITK_PP_TUPLE_EAT_4)(o(216, s), p, o, m)
+# define MITK_PP_FOR_216_I(s, p, o, m) MITK_PP_IF(p(217, s), m, MITK_PP_TUPLE_EAT_2)(217, s) MITK_PP_IF(p(217, s), MITK_PP_FOR_217, MITK_PP_TUPLE_EAT_4)(o(217, s), p, o, m)
+# define MITK_PP_FOR_217_I(s, p, o, m) MITK_PP_IF(p(218, s), m, MITK_PP_TUPLE_EAT_2)(218, s) MITK_PP_IF(p(218, s), MITK_PP_FOR_218, MITK_PP_TUPLE_EAT_4)(o(218, s), p, o, m)
+# define MITK_PP_FOR_218_I(s, p, o, m) MITK_PP_IF(p(219, s), m, MITK_PP_TUPLE_EAT_2)(219, s) MITK_PP_IF(p(219, s), MITK_PP_FOR_219, MITK_PP_TUPLE_EAT_4)(o(219, s), p, o, m)
+# define MITK_PP_FOR_219_I(s, p, o, m) MITK_PP_IF(p(220, s), m, MITK_PP_TUPLE_EAT_2)(220, s) MITK_PP_IF(p(220, s), MITK_PP_FOR_220, MITK_PP_TUPLE_EAT_4)(o(220, s), p, o, m)
+# define MITK_PP_FOR_220_I(s, p, o, m) MITK_PP_IF(p(221, s), m, MITK_PP_TUPLE_EAT_2)(221, s) MITK_PP_IF(p(221, s), MITK_PP_FOR_221, MITK_PP_TUPLE_EAT_4)(o(221, s), p, o, m)
+# define MITK_PP_FOR_221_I(s, p, o, m) MITK_PP_IF(p(222, s), m, MITK_PP_TUPLE_EAT_2)(222, s) MITK_PP_IF(p(222, s), MITK_PP_FOR_222, MITK_PP_TUPLE_EAT_4)(o(222, s), p, o, m)
+# define MITK_PP_FOR_222_I(s, p, o, m) MITK_PP_IF(p(223, s), m, MITK_PP_TUPLE_EAT_2)(223, s) MITK_PP_IF(p(223, s), MITK_PP_FOR_223, MITK_PP_TUPLE_EAT_4)(o(223, s), p, o, m)
+# define MITK_PP_FOR_223_I(s, p, o, m) MITK_PP_IF(p(224, s), m, MITK_PP_TUPLE_EAT_2)(224, s) MITK_PP_IF(p(224, s), MITK_PP_FOR_224, MITK_PP_TUPLE_EAT_4)(o(224, s), p, o, m)
+# define MITK_PP_FOR_224_I(s, p, o, m) MITK_PP_IF(p(225, s), m, MITK_PP_TUPLE_EAT_2)(225, s) MITK_PP_IF(p(225, s), MITK_PP_FOR_225, MITK_PP_TUPLE_EAT_4)(o(225, s), p, o, m)
+# define MITK_PP_FOR_225_I(s, p, o, m) MITK_PP_IF(p(226, s), m, MITK_PP_TUPLE_EAT_2)(226, s) MITK_PP_IF(p(226, s), MITK_PP_FOR_226, MITK_PP_TUPLE_EAT_4)(o(226, s), p, o, m)
+# define MITK_PP_FOR_226_I(s, p, o, m) MITK_PP_IF(p(227, s), m, MITK_PP_TUPLE_EAT_2)(227, s) MITK_PP_IF(p(227, s), MITK_PP_FOR_227, MITK_PP_TUPLE_EAT_4)(o(227, s), p, o, m)
+# define MITK_PP_FOR_227_I(s, p, o, m) MITK_PP_IF(p(228, s), m, MITK_PP_TUPLE_EAT_2)(228, s) MITK_PP_IF(p(228, s), MITK_PP_FOR_228, MITK_PP_TUPLE_EAT_4)(o(228, s), p, o, m)
+# define MITK_PP_FOR_228_I(s, p, o, m) MITK_PP_IF(p(229, s), m, MITK_PP_TUPLE_EAT_2)(229, s) MITK_PP_IF(p(229, s), MITK_PP_FOR_229, MITK_PP_TUPLE_EAT_4)(o(229, s), p, o, m)
+# define MITK_PP_FOR_229_I(s, p, o, m) MITK_PP_IF(p(230, s), m, MITK_PP_TUPLE_EAT_2)(230, s) MITK_PP_IF(p(230, s), MITK_PP_FOR_230, MITK_PP_TUPLE_EAT_4)(o(230, s), p, o, m)
+# define MITK_PP_FOR_230_I(s, p, o, m) MITK_PP_IF(p(231, s), m, MITK_PP_TUPLE_EAT_2)(231, s) MITK_PP_IF(p(231, s), MITK_PP_FOR_231, MITK_PP_TUPLE_EAT_4)(o(231, s), p, o, m)
+# define MITK_PP_FOR_231_I(s, p, o, m) MITK_PP_IF(p(232, s), m, MITK_PP_TUPLE_EAT_2)(232, s) MITK_PP_IF(p(232, s), MITK_PP_FOR_232, MITK_PP_TUPLE_EAT_4)(o(232, s), p, o, m)
+# define MITK_PP_FOR_232_I(s, p, o, m) MITK_PP_IF(p(233, s), m, MITK_PP_TUPLE_EAT_2)(233, s) MITK_PP_IF(p(233, s), MITK_PP_FOR_233, MITK_PP_TUPLE_EAT_4)(o(233, s), p, o, m)
+# define MITK_PP_FOR_233_I(s, p, o, m) MITK_PP_IF(p(234, s), m, MITK_PP_TUPLE_EAT_2)(234, s) MITK_PP_IF(p(234, s), MITK_PP_FOR_234, MITK_PP_TUPLE_EAT_4)(o(234, s), p, o, m)
+# define MITK_PP_FOR_234_I(s, p, o, m) MITK_PP_IF(p(235, s), m, MITK_PP_TUPLE_EAT_2)(235, s) MITK_PP_IF(p(235, s), MITK_PP_FOR_235, MITK_PP_TUPLE_EAT_4)(o(235, s), p, o, m)
+# define MITK_PP_FOR_235_I(s, p, o, m) MITK_PP_IF(p(236, s), m, MITK_PP_TUPLE_EAT_2)(236, s) MITK_PP_IF(p(236, s), MITK_PP_FOR_236, MITK_PP_TUPLE_EAT_4)(o(236, s), p, o, m)
+# define MITK_PP_FOR_236_I(s, p, o, m) MITK_PP_IF(p(237, s), m, MITK_PP_TUPLE_EAT_2)(237, s) MITK_PP_IF(p(237, s), MITK_PP_FOR_237, MITK_PP_TUPLE_EAT_4)(o(237, s), p, o, m)
+# define MITK_PP_FOR_237_I(s, p, o, m) MITK_PP_IF(p(238, s), m, MITK_PP_TUPLE_EAT_2)(238, s) MITK_PP_IF(p(238, s), MITK_PP_FOR_238, MITK_PP_TUPLE_EAT_4)(o(238, s), p, o, m)
+# define MITK_PP_FOR_238_I(s, p, o, m) MITK_PP_IF(p(239, s), m, MITK_PP_TUPLE_EAT_2)(239, s) MITK_PP_IF(p(239, s), MITK_PP_FOR_239, MITK_PP_TUPLE_EAT_4)(o(239, s), p, o, m)
+# define MITK_PP_FOR_239_I(s, p, o, m) MITK_PP_IF(p(240, s), m, MITK_PP_TUPLE_EAT_2)(240, s) MITK_PP_IF(p(240, s), MITK_PP_FOR_240, MITK_PP_TUPLE_EAT_4)(o(240, s), p, o, m)
+# define MITK_PP_FOR_240_I(s, p, o, m) MITK_PP_IF(p(241, s), m, MITK_PP_TUPLE_EAT_2)(241, s) MITK_PP_IF(p(241, s), MITK_PP_FOR_241, MITK_PP_TUPLE_EAT_4)(o(241, s), p, o, m)
+# define MITK_PP_FOR_241_I(s, p, o, m) MITK_PP_IF(p(242, s), m, MITK_PP_TUPLE_EAT_2)(242, s) MITK_PP_IF(p(242, s), MITK_PP_FOR_242, MITK_PP_TUPLE_EAT_4)(o(242, s), p, o, m)
+# define MITK_PP_FOR_242_I(s, p, o, m) MITK_PP_IF(p(243, s), m, MITK_PP_TUPLE_EAT_2)(243, s) MITK_PP_IF(p(243, s), MITK_PP_FOR_243, MITK_PP_TUPLE_EAT_4)(o(243, s), p, o, m)
+# define MITK_PP_FOR_243_I(s, p, o, m) MITK_PP_IF(p(244, s), m, MITK_PP_TUPLE_EAT_2)(244, s) MITK_PP_IF(p(244, s), MITK_PP_FOR_244, MITK_PP_TUPLE_EAT_4)(o(244, s), p, o, m)
+# define MITK_PP_FOR_244_I(s, p, o, m) MITK_PP_IF(p(245, s), m, MITK_PP_TUPLE_EAT_2)(245, s) MITK_PP_IF(p(245, s), MITK_PP_FOR_245, MITK_PP_TUPLE_EAT_4)(o(245, s), p, o, m)
+# define MITK_PP_FOR_245_I(s, p, o, m) MITK_PP_IF(p(246, s), m, MITK_PP_TUPLE_EAT_2)(246, s) MITK_PP_IF(p(246, s), MITK_PP_FOR_246, MITK_PP_TUPLE_EAT_4)(o(246, s), p, o, m)
+# define MITK_PP_FOR_246_I(s, p, o, m) MITK_PP_IF(p(247, s), m, MITK_PP_TUPLE_EAT_2)(247, s) MITK_PP_IF(p(247, s), MITK_PP_FOR_247, MITK_PP_TUPLE_EAT_4)(o(247, s), p, o, m)
+# define MITK_PP_FOR_247_I(s, p, o, m) MITK_PP_IF(p(248, s), m, MITK_PP_TUPLE_EAT_2)(248, s) MITK_PP_IF(p(248, s), MITK_PP_FOR_248, MITK_PP_TUPLE_EAT_4)(o(248, s), p, o, m)
+# define MITK_PP_FOR_248_I(s, p, o, m) MITK_PP_IF(p(249, s), m, MITK_PP_TUPLE_EAT_2)(249, s) MITK_PP_IF(p(249, s), MITK_PP_FOR_249, MITK_PP_TUPLE_EAT_4)(o(249, s), p, o, m)
+# define MITK_PP_FOR_249_I(s, p, o, m) MITK_PP_IF(p(250, s), m, MITK_PP_TUPLE_EAT_2)(250, s) MITK_PP_IF(p(250, s), MITK_PP_FOR_250, MITK_PP_TUPLE_EAT_4)(o(250, s), p, o, m)
+# define MITK_PP_FOR_250_I(s, p, o, m) MITK_PP_IF(p(251, s), m, MITK_PP_TUPLE_EAT_2)(251, s) MITK_PP_IF(p(251, s), MITK_PP_FOR_251, MITK_PP_TUPLE_EAT_4)(o(251, s), p, o, m)
+# define MITK_PP_FOR_251_I(s, p, o, m) MITK_PP_IF(p(252, s), m, MITK_PP_TUPLE_EAT_2)(252, s) MITK_PP_IF(p(252, s), MITK_PP_FOR_252, MITK_PP_TUPLE_EAT_4)(o(252, s), p, o, m)
+# define MITK_PP_FOR_252_I(s, p, o, m) MITK_PP_IF(p(253, s), m, MITK_PP_TUPLE_EAT_2)(253, s) MITK_PP_IF(p(253, s), MITK_PP_FOR_253, MITK_PP_TUPLE_EAT_4)(o(253, s), p, o, m)
+# define MITK_PP_FOR_253_I(s, p, o, m) MITK_PP_IF(p(254, s), m, MITK_PP_TUPLE_EAT_2)(254, s) MITK_PP_IF(p(254, s), MITK_PP_FOR_254, MITK_PP_TUPLE_EAT_4)(o(254, s), p, o, m)
+# define MITK_PP_FOR_254_I(s, p, o, m) MITK_PP_IF(p(255, s), m, MITK_PP_TUPLE_EAT_2)(255, s) MITK_PP_IF(p(255, s), MITK_PP_FOR_255, MITK_PP_TUPLE_EAT_4)(o(255, s), p, o, m)
+# define MITK_PP_FOR_255_I(s, p, o, m) MITK_PP_IF(p(256, s), m, MITK_PP_TUPLE_EAT_2)(256, s) MITK_PP_IF(p(256, s), MITK_PP_FOR_256, MITK_PP_TUPLE_EAT_4)(o(256, s), p, o, m)
+# define MITK_PP_FOR_256_I(s, p, o, m) MITK_PP_IF(p(257, s), m, MITK_PP_TUPLE_EAT_2)(257, s) MITK_PP_IF(p(257, s), MITK_PP_FOR_257, MITK_PP_TUPLE_EAT_4)(o(257, s), p, o, m)
+#
+# endif
diff --git a/Core/Code/Algorithms/mitkPPRepetitionDetailFor.h b/Core/Code/Algorithms/mitkPPRepetitionDetailFor.h
new file mode 100644
index 0000000000..e642ff7ffb
--- /dev/null
+++ b/Core/Code/Algorithms/mitkPPRepetitionDetailFor.h
@@ -0,0 +1,536 @@
+# /* Copyright (C) 2001
+# * Housemarque Oy
+# * http://www.housemarque.com
+# *
+# * Distributed under the Boost Software License, Version 1.0. (See
+# * accompanying file LICENSE_1_0.txt or copy at
+# * http://www.boost.org/LICENSE_1_0.txt)
+# */
+#
+# /* Revised by Paul Mensonides (2002) */
+#
+# /* See http://www.boost.org for most recent version. */
+#
+# ifndef MITK_PREPROCESSOR_REPETITION_DETAIL_FOR_HPP
+# define MITK_PREPROCESSOR_REPETITION_DETAIL_FOR_HPP
+#
+# include "mitkPPControlExprIIf.h"
+# include "mitkPPControlIIf.h"
+# include "mitkPPLogicalBool.h"
+# include "mitkPPTupleEat.h"
+#
+# define MITK_PP_FOR_1(s, p, o, m) MITK_PP_FOR_1_C(MITK_PP_BOOL(p(2, s)), s, p, o, m)
+# define MITK_PP_FOR_2(s, p, o, m) MITK_PP_FOR_2_C(MITK_PP_BOOL(p(3, s)), s, p, o, m)
+# define MITK_PP_FOR_3(s, p, o, m) MITK_PP_FOR_3_C(MITK_PP_BOOL(p(4, s)), s, p, o, m)
+# define MITK_PP_FOR_4(s, p, o, m) MITK_PP_FOR_4_C(MITK_PP_BOOL(p(5, s)), s, p, o, m)
+# define MITK_PP_FOR_5(s, p, o, m) MITK_PP_FOR_5_C(MITK_PP_BOOL(p(6, s)), s, p, o, m)
+# define MITK_PP_FOR_6(s, p, o, m) MITK_PP_FOR_6_C(MITK_PP_BOOL(p(7, s)), s, p, o, m)
+# define MITK_PP_FOR_7(s, p, o, m) MITK_PP_FOR_7_C(MITK_PP_BOOL(p(8, s)), s, p, o, m)
+# define MITK_PP_FOR_8(s, p, o, m) MITK_PP_FOR_8_C(MITK_PP_BOOL(p(9, s)), s, p, o, m)
+# define MITK_PP_FOR_9(s, p, o, m) MITK_PP_FOR_9_C(MITK_PP_BOOL(p(10, s)), s, p, o, m)
+# define MITK_PP_FOR_10(s, p, o, m) MITK_PP_FOR_10_C(MITK_PP_BOOL(p(11, s)), s, p, o, m)
+# define MITK_PP_FOR_11(s, p, o, m) MITK_PP_FOR_11_C(MITK_PP_BOOL(p(12, s)), s, p, o, m)
+# define MITK_PP_FOR_12(s, p, o, m) MITK_PP_FOR_12_C(MITK_PP_BOOL(p(13, s)), s, p, o, m)
+# define MITK_PP_FOR_13(s, p, o, m) MITK_PP_FOR_13_C(MITK_PP_BOOL(p(14, s)), s, p, o, m)
+# define MITK_PP_FOR_14(s, p, o, m) MITK_PP_FOR_14_C(MITK_PP_BOOL(p(15, s)), s, p, o, m)
+# define MITK_PP_FOR_15(s, p, o, m) MITK_PP_FOR_15_C(MITK_PP_BOOL(p(16, s)), s, p, o, m)
+# define MITK_PP_FOR_16(s, p, o, m) MITK_PP_FOR_16_C(MITK_PP_BOOL(p(17, s)), s, p, o, m)
+# define MITK_PP_FOR_17(s, p, o, m) MITK_PP_FOR_17_C(MITK_PP_BOOL(p(18, s)), s, p, o, m)
+# define MITK_PP_FOR_18(s, p, o, m) MITK_PP_FOR_18_C(MITK_PP_BOOL(p(19, s)), s, p, o, m)
+# define MITK_PP_FOR_19(s, p, o, m) MITK_PP_FOR_19_C(MITK_PP_BOOL(p(20, s)), s, p, o, m)
+# define MITK_PP_FOR_20(s, p, o, m) MITK_PP_FOR_20_C(MITK_PP_BOOL(p(21, s)), s, p, o, m)
+# define MITK_PP_FOR_21(s, p, o, m) MITK_PP_FOR_21_C(MITK_PP_BOOL(p(22, s)), s, p, o, m)
+# define MITK_PP_FOR_22(s, p, o, m) MITK_PP_FOR_22_C(MITK_PP_BOOL(p(23, s)), s, p, o, m)
+# define MITK_PP_FOR_23(s, p, o, m) MITK_PP_FOR_23_C(MITK_PP_BOOL(p(24, s)), s, p, o, m)
+# define MITK_PP_FOR_24(s, p, o, m) MITK_PP_FOR_24_C(MITK_PP_BOOL(p(25, s)), s, p, o, m)
+# define MITK_PP_FOR_25(s, p, o, m) MITK_PP_FOR_25_C(MITK_PP_BOOL(p(26, s)), s, p, o, m)
+# define MITK_PP_FOR_26(s, p, o, m) MITK_PP_FOR_26_C(MITK_PP_BOOL(p(27, s)), s, p, o, m)
+# define MITK_PP_FOR_27(s, p, o, m) MITK_PP_FOR_27_C(MITK_PP_BOOL(p(28, s)), s, p, o, m)
+# define MITK_PP_FOR_28(s, p, o, m) MITK_PP_FOR_28_C(MITK_PP_BOOL(p(29, s)), s, p, o, m)
+# define MITK_PP_FOR_29(s, p, o, m) MITK_PP_FOR_29_C(MITK_PP_BOOL(p(30, s)), s, p, o, m)
+# define MITK_PP_FOR_30(s, p, o, m) MITK_PP_FOR_30_C(MITK_PP_BOOL(p(31, s)), s, p, o, m)
+# define MITK_PP_FOR_31(s, p, o, m) MITK_PP_FOR_31_C(MITK_PP_BOOL(p(32, s)), s, p, o, m)
+# define MITK_PP_FOR_32(s, p, o, m) MITK_PP_FOR_32_C(MITK_PP_BOOL(p(33, s)), s, p, o, m)
+# define MITK_PP_FOR_33(s, p, o, m) MITK_PP_FOR_33_C(MITK_PP_BOOL(p(34, s)), s, p, o, m)
+# define MITK_PP_FOR_34(s, p, o, m) MITK_PP_FOR_34_C(MITK_PP_BOOL(p(35, s)), s, p, o, m)
+# define MITK_PP_FOR_35(s, p, o, m) MITK_PP_FOR_35_C(MITK_PP_BOOL(p(36, s)), s, p, o, m)
+# define MITK_PP_FOR_36(s, p, o, m) MITK_PP_FOR_36_C(MITK_PP_BOOL(p(37, s)), s, p, o, m)
+# define MITK_PP_FOR_37(s, p, o, m) MITK_PP_FOR_37_C(MITK_PP_BOOL(p(38, s)), s, p, o, m)
+# define MITK_PP_FOR_38(s, p, o, m) MITK_PP_FOR_38_C(MITK_PP_BOOL(p(39, s)), s, p, o, m)
+# define MITK_PP_FOR_39(s, p, o, m) MITK_PP_FOR_39_C(MITK_PP_BOOL(p(40, s)), s, p, o, m)
+# define MITK_PP_FOR_40(s, p, o, m) MITK_PP_FOR_40_C(MITK_PP_BOOL(p(41, s)), s, p, o, m)
+# define MITK_PP_FOR_41(s, p, o, m) MITK_PP_FOR_41_C(MITK_PP_BOOL(p(42, s)), s, p, o, m)
+# define MITK_PP_FOR_42(s, p, o, m) MITK_PP_FOR_42_C(MITK_PP_BOOL(p(43, s)), s, p, o, m)
+# define MITK_PP_FOR_43(s, p, o, m) MITK_PP_FOR_43_C(MITK_PP_BOOL(p(44, s)), s, p, o, m)
+# define MITK_PP_FOR_44(s, p, o, m) MITK_PP_FOR_44_C(MITK_PP_BOOL(p(45, s)), s, p, o, m)
+# define MITK_PP_FOR_45(s, p, o, m) MITK_PP_FOR_45_C(MITK_PP_BOOL(p(46, s)), s, p, o, m)
+# define MITK_PP_FOR_46(s, p, o, m) MITK_PP_FOR_46_C(MITK_PP_BOOL(p(47, s)), s, p, o, m)
+# define MITK_PP_FOR_47(s, p, o, m) MITK_PP_FOR_47_C(MITK_PP_BOOL(p(48, s)), s, p, o, m)
+# define MITK_PP_FOR_48(s, p, o, m) MITK_PP_FOR_48_C(MITK_PP_BOOL(p(49, s)), s, p, o, m)
+# define MITK_PP_FOR_49(s, p, o, m) MITK_PP_FOR_49_C(MITK_PP_BOOL(p(50, s)), s, p, o, m)
+# define MITK_PP_FOR_50(s, p, o, m) MITK_PP_FOR_50_C(MITK_PP_BOOL(p(51, s)), s, p, o, m)
+# define MITK_PP_FOR_51(s, p, o, m) MITK_PP_FOR_51_C(MITK_PP_BOOL(p(52, s)), s, p, o, m)
+# define MITK_PP_FOR_52(s, p, o, m) MITK_PP_FOR_52_C(MITK_PP_BOOL(p(53, s)), s, p, o, m)
+# define MITK_PP_FOR_53(s, p, o, m) MITK_PP_FOR_53_C(MITK_PP_BOOL(p(54, s)), s, p, o, m)
+# define MITK_PP_FOR_54(s, p, o, m) MITK_PP_FOR_54_C(MITK_PP_BOOL(p(55, s)), s, p, o, m)
+# define MITK_PP_FOR_55(s, p, o, m) MITK_PP_FOR_55_C(MITK_PP_BOOL(p(56, s)), s, p, o, m)
+# define MITK_PP_FOR_56(s, p, o, m) MITK_PP_FOR_56_C(MITK_PP_BOOL(p(57, s)), s, p, o, m)
+# define MITK_PP_FOR_57(s, p, o, m) MITK_PP_FOR_57_C(MITK_PP_BOOL(p(58, s)), s, p, o, m)
+# define MITK_PP_FOR_58(s, p, o, m) MITK_PP_FOR_58_C(MITK_PP_BOOL(p(59, s)), s, p, o, m)
+# define MITK_PP_FOR_59(s, p, o, m) MITK_PP_FOR_59_C(MITK_PP_BOOL(p(60, s)), s, p, o, m)
+# define MITK_PP_FOR_60(s, p, o, m) MITK_PP_FOR_60_C(MITK_PP_BOOL(p(61, s)), s, p, o, m)
+# define MITK_PP_FOR_61(s, p, o, m) MITK_PP_FOR_61_C(MITK_PP_BOOL(p(62, s)), s, p, o, m)
+# define MITK_PP_FOR_62(s, p, o, m) MITK_PP_FOR_62_C(MITK_PP_BOOL(p(63, s)), s, p, o, m)
+# define MITK_PP_FOR_63(s, p, o, m) MITK_PP_FOR_63_C(MITK_PP_BOOL(p(64, s)), s, p, o, m)
+# define MITK_PP_FOR_64(s, p, o, m) MITK_PP_FOR_64_C(MITK_PP_BOOL(p(65, s)), s, p, o, m)
+# define MITK_PP_FOR_65(s, p, o, m) MITK_PP_FOR_65_C(MITK_PP_BOOL(p(66, s)), s, p, o, m)
+# define MITK_PP_FOR_66(s, p, o, m) MITK_PP_FOR_66_C(MITK_PP_BOOL(p(67, s)), s, p, o, m)
+# define MITK_PP_FOR_67(s, p, o, m) MITK_PP_FOR_67_C(MITK_PP_BOOL(p(68, s)), s, p, o, m)
+# define MITK_PP_FOR_68(s, p, o, m) MITK_PP_FOR_68_C(MITK_PP_BOOL(p(69, s)), s, p, o, m)
+# define MITK_PP_FOR_69(s, p, o, m) MITK_PP_FOR_69_C(MITK_PP_BOOL(p(70, s)), s, p, o, m)
+# define MITK_PP_FOR_70(s, p, o, m) MITK_PP_FOR_70_C(MITK_PP_BOOL(p(71, s)), s, p, o, m)
+# define MITK_PP_FOR_71(s, p, o, m) MITK_PP_FOR_71_C(MITK_PP_BOOL(p(72, s)), s, p, o, m)
+# define MITK_PP_FOR_72(s, p, o, m) MITK_PP_FOR_72_C(MITK_PP_BOOL(p(73, s)), s, p, o, m)
+# define MITK_PP_FOR_73(s, p, o, m) MITK_PP_FOR_73_C(MITK_PP_BOOL(p(74, s)), s, p, o, m)
+# define MITK_PP_FOR_74(s, p, o, m) MITK_PP_FOR_74_C(MITK_PP_BOOL(p(75, s)), s, p, o, m)
+# define MITK_PP_FOR_75(s, p, o, m) MITK_PP_FOR_75_C(MITK_PP_BOOL(p(76, s)), s, p, o, m)
+# define MITK_PP_FOR_76(s, p, o, m) MITK_PP_FOR_76_C(MITK_PP_BOOL(p(77, s)), s, p, o, m)
+# define MITK_PP_FOR_77(s, p, o, m) MITK_PP_FOR_77_C(MITK_PP_BOOL(p(78, s)), s, p, o, m)
+# define MITK_PP_FOR_78(s, p, o, m) MITK_PP_FOR_78_C(MITK_PP_BOOL(p(79, s)), s, p, o, m)
+# define MITK_PP_FOR_79(s, p, o, m) MITK_PP_FOR_79_C(MITK_PP_BOOL(p(80, s)), s, p, o, m)
+# define MITK_PP_FOR_80(s, p, o, m) MITK_PP_FOR_80_C(MITK_PP_BOOL(p(81, s)), s, p, o, m)
+# define MITK_PP_FOR_81(s, p, o, m) MITK_PP_FOR_81_C(MITK_PP_BOOL(p(82, s)), s, p, o, m)
+# define MITK_PP_FOR_82(s, p, o, m) MITK_PP_FOR_82_C(MITK_PP_BOOL(p(83, s)), s, p, o, m)
+# define MITK_PP_FOR_83(s, p, o, m) MITK_PP_FOR_83_C(MITK_PP_BOOL(p(84, s)), s, p, o, m)
+# define MITK_PP_FOR_84(s, p, o, m) MITK_PP_FOR_84_C(MITK_PP_BOOL(p(85, s)), s, p, o, m)
+# define MITK_PP_FOR_85(s, p, o, m) MITK_PP_FOR_85_C(MITK_PP_BOOL(p(86, s)), s, p, o, m)
+# define MITK_PP_FOR_86(s, p, o, m) MITK_PP_FOR_86_C(MITK_PP_BOOL(p(87, s)), s, p, o, m)
+# define MITK_PP_FOR_87(s, p, o, m) MITK_PP_FOR_87_C(MITK_PP_BOOL(p(88, s)), s, p, o, m)
+# define MITK_PP_FOR_88(s, p, o, m) MITK_PP_FOR_88_C(MITK_PP_BOOL(p(89, s)), s, p, o, m)
+# define MITK_PP_FOR_89(s, p, o, m) MITK_PP_FOR_89_C(MITK_PP_BOOL(p(90, s)), s, p, o, m)
+# define MITK_PP_FOR_90(s, p, o, m) MITK_PP_FOR_90_C(MITK_PP_BOOL(p(91, s)), s, p, o, m)
+# define MITK_PP_FOR_91(s, p, o, m) MITK_PP_FOR_91_C(MITK_PP_BOOL(p(92, s)), s, p, o, m)
+# define MITK_PP_FOR_92(s, p, o, m) MITK_PP_FOR_92_C(MITK_PP_BOOL(p(93, s)), s, p, o, m)
+# define MITK_PP_FOR_93(s, p, o, m) MITK_PP_FOR_93_C(MITK_PP_BOOL(p(94, s)), s, p, o, m)
+# define MITK_PP_FOR_94(s, p, o, m) MITK_PP_FOR_94_C(MITK_PP_BOOL(p(95, s)), s, p, o, m)
+# define MITK_PP_FOR_95(s, p, o, m) MITK_PP_FOR_95_C(MITK_PP_BOOL(p(96, s)), s, p, o, m)
+# define MITK_PP_FOR_96(s, p, o, m) MITK_PP_FOR_96_C(MITK_PP_BOOL(p(97, s)), s, p, o, m)
+# define MITK_PP_FOR_97(s, p, o, m) MITK_PP_FOR_97_C(MITK_PP_BOOL(p(98, s)), s, p, o, m)
+# define MITK_PP_FOR_98(s, p, o, m) MITK_PP_FOR_98_C(MITK_PP_BOOL(p(99, s)), s, p, o, m)
+# define MITK_PP_FOR_99(s, p, o, m) MITK_PP_FOR_99_C(MITK_PP_BOOL(p(100, s)), s, p, o, m)
+# define MITK_PP_FOR_100(s, p, o, m) MITK_PP_FOR_100_C(MITK_PP_BOOL(p(101, s)), s, p, o, m)
+# define MITK_PP_FOR_101(s, p, o, m) MITK_PP_FOR_101_C(MITK_PP_BOOL(p(102, s)), s, p, o, m)
+# define MITK_PP_FOR_102(s, p, o, m) MITK_PP_FOR_102_C(MITK_PP_BOOL(p(103, s)), s, p, o, m)
+# define MITK_PP_FOR_103(s, p, o, m) MITK_PP_FOR_103_C(MITK_PP_BOOL(p(104, s)), s, p, o, m)
+# define MITK_PP_FOR_104(s, p, o, m) MITK_PP_FOR_104_C(MITK_PP_BOOL(p(105, s)), s, p, o, m)
+# define MITK_PP_FOR_105(s, p, o, m) MITK_PP_FOR_105_C(MITK_PP_BOOL(p(106, s)), s, p, o, m)
+# define MITK_PP_FOR_106(s, p, o, m) MITK_PP_FOR_106_C(MITK_PP_BOOL(p(107, s)), s, p, o, m)
+# define MITK_PP_FOR_107(s, p, o, m) MITK_PP_FOR_107_C(MITK_PP_BOOL(p(108, s)), s, p, o, m)
+# define MITK_PP_FOR_108(s, p, o, m) MITK_PP_FOR_108_C(MITK_PP_BOOL(p(109, s)), s, p, o, m)
+# define MITK_PP_FOR_109(s, p, o, m) MITK_PP_FOR_109_C(MITK_PP_BOOL(p(110, s)), s, p, o, m)
+# define MITK_PP_FOR_110(s, p, o, m) MITK_PP_FOR_110_C(MITK_PP_BOOL(p(111, s)), s, p, o, m)
+# define MITK_PP_FOR_111(s, p, o, m) MITK_PP_FOR_111_C(MITK_PP_BOOL(p(112, s)), s, p, o, m)
+# define MITK_PP_FOR_112(s, p, o, m) MITK_PP_FOR_112_C(MITK_PP_BOOL(p(113, s)), s, p, o, m)
+# define MITK_PP_FOR_113(s, p, o, m) MITK_PP_FOR_113_C(MITK_PP_BOOL(p(114, s)), s, p, o, m)
+# define MITK_PP_FOR_114(s, p, o, m) MITK_PP_FOR_114_C(MITK_PP_BOOL(p(115, s)), s, p, o, m)
+# define MITK_PP_FOR_115(s, p, o, m) MITK_PP_FOR_115_C(MITK_PP_BOOL(p(116, s)), s, p, o, m)
+# define MITK_PP_FOR_116(s, p, o, m) MITK_PP_FOR_116_C(MITK_PP_BOOL(p(117, s)), s, p, o, m)
+# define MITK_PP_FOR_117(s, p, o, m) MITK_PP_FOR_117_C(MITK_PP_BOOL(p(118, s)), s, p, o, m)
+# define MITK_PP_FOR_118(s, p, o, m) MITK_PP_FOR_118_C(MITK_PP_BOOL(p(119, s)), s, p, o, m)
+# define MITK_PP_FOR_119(s, p, o, m) MITK_PP_FOR_119_C(MITK_PP_BOOL(p(120, s)), s, p, o, m)
+# define MITK_PP_FOR_120(s, p, o, m) MITK_PP_FOR_120_C(MITK_PP_BOOL(p(121, s)), s, p, o, m)
+# define MITK_PP_FOR_121(s, p, o, m) MITK_PP_FOR_121_C(MITK_PP_BOOL(p(122, s)), s, p, o, m)
+# define MITK_PP_FOR_122(s, p, o, m) MITK_PP_FOR_122_C(MITK_PP_BOOL(p(123, s)), s, p, o, m)
+# define MITK_PP_FOR_123(s, p, o, m) MITK_PP_FOR_123_C(MITK_PP_BOOL(p(124, s)), s, p, o, m)
+# define MITK_PP_FOR_124(s, p, o, m) MITK_PP_FOR_124_C(MITK_PP_BOOL(p(125, s)), s, p, o, m)
+# define MITK_PP_FOR_125(s, p, o, m) MITK_PP_FOR_125_C(MITK_PP_BOOL(p(126, s)), s, p, o, m)
+# define MITK_PP_FOR_126(s, p, o, m) MITK_PP_FOR_126_C(MITK_PP_BOOL(p(127, s)), s, p, o, m)
+# define MITK_PP_FOR_127(s, p, o, m) MITK_PP_FOR_127_C(MITK_PP_BOOL(p(128, s)), s, p, o, m)
+# define MITK_PP_FOR_128(s, p, o, m) MITK_PP_FOR_128_C(MITK_PP_BOOL(p(129, s)), s, p, o, m)
+# define MITK_PP_FOR_129(s, p, o, m) MITK_PP_FOR_129_C(MITK_PP_BOOL(p(130, s)), s, p, o, m)
+# define MITK_PP_FOR_130(s, p, o, m) MITK_PP_FOR_130_C(MITK_PP_BOOL(p(131, s)), s, p, o, m)
+# define MITK_PP_FOR_131(s, p, o, m) MITK_PP_FOR_131_C(MITK_PP_BOOL(p(132, s)), s, p, o, m)
+# define MITK_PP_FOR_132(s, p, o, m) MITK_PP_FOR_132_C(MITK_PP_BOOL(p(133, s)), s, p, o, m)
+# define MITK_PP_FOR_133(s, p, o, m) MITK_PP_FOR_133_C(MITK_PP_BOOL(p(134, s)), s, p, o, m)
+# define MITK_PP_FOR_134(s, p, o, m) MITK_PP_FOR_134_C(MITK_PP_BOOL(p(135, s)), s, p, o, m)
+# define MITK_PP_FOR_135(s, p, o, m) MITK_PP_FOR_135_C(MITK_PP_BOOL(p(136, s)), s, p, o, m)
+# define MITK_PP_FOR_136(s, p, o, m) MITK_PP_FOR_136_C(MITK_PP_BOOL(p(137, s)), s, p, o, m)
+# define MITK_PP_FOR_137(s, p, o, m) MITK_PP_FOR_137_C(MITK_PP_BOOL(p(138, s)), s, p, o, m)
+# define MITK_PP_FOR_138(s, p, o, m) MITK_PP_FOR_138_C(MITK_PP_BOOL(p(139, s)), s, p, o, m)
+# define MITK_PP_FOR_139(s, p, o, m) MITK_PP_FOR_139_C(MITK_PP_BOOL(p(140, s)), s, p, o, m)
+# define MITK_PP_FOR_140(s, p, o, m) MITK_PP_FOR_140_C(MITK_PP_BOOL(p(141, s)), s, p, o, m)
+# define MITK_PP_FOR_141(s, p, o, m) MITK_PP_FOR_141_C(MITK_PP_BOOL(p(142, s)), s, p, o, m)
+# define MITK_PP_FOR_142(s, p, o, m) MITK_PP_FOR_142_C(MITK_PP_BOOL(p(143, s)), s, p, o, m)
+# define MITK_PP_FOR_143(s, p, o, m) MITK_PP_FOR_143_C(MITK_PP_BOOL(p(144, s)), s, p, o, m)
+# define MITK_PP_FOR_144(s, p, o, m) MITK_PP_FOR_144_C(MITK_PP_BOOL(p(145, s)), s, p, o, m)
+# define MITK_PP_FOR_145(s, p, o, m) MITK_PP_FOR_145_C(MITK_PP_BOOL(p(146, s)), s, p, o, m)
+# define MITK_PP_FOR_146(s, p, o, m) MITK_PP_FOR_146_C(MITK_PP_BOOL(p(147, s)), s, p, o, m)
+# define MITK_PP_FOR_147(s, p, o, m) MITK_PP_FOR_147_C(MITK_PP_BOOL(p(148, s)), s, p, o, m)
+# define MITK_PP_FOR_148(s, p, o, m) MITK_PP_FOR_148_C(MITK_PP_BOOL(p(149, s)), s, p, o, m)
+# define MITK_PP_FOR_149(s, p, o, m) MITK_PP_FOR_149_C(MITK_PP_BOOL(p(150, s)), s, p, o, m)
+# define MITK_PP_FOR_150(s, p, o, m) MITK_PP_FOR_150_C(MITK_PP_BOOL(p(151, s)), s, p, o, m)
+# define MITK_PP_FOR_151(s, p, o, m) MITK_PP_FOR_151_C(MITK_PP_BOOL(p(152, s)), s, p, o, m)
+# define MITK_PP_FOR_152(s, p, o, m) MITK_PP_FOR_152_C(MITK_PP_BOOL(p(153, s)), s, p, o, m)
+# define MITK_PP_FOR_153(s, p, o, m) MITK_PP_FOR_153_C(MITK_PP_BOOL(p(154, s)), s, p, o, m)
+# define MITK_PP_FOR_154(s, p, o, m) MITK_PP_FOR_154_C(MITK_PP_BOOL(p(155, s)), s, p, o, m)
+# define MITK_PP_FOR_155(s, p, o, m) MITK_PP_FOR_155_C(MITK_PP_BOOL(p(156, s)), s, p, o, m)
+# define MITK_PP_FOR_156(s, p, o, m) MITK_PP_FOR_156_C(MITK_PP_BOOL(p(157, s)), s, p, o, m)
+# define MITK_PP_FOR_157(s, p, o, m) MITK_PP_FOR_157_C(MITK_PP_BOOL(p(158, s)), s, p, o, m)
+# define MITK_PP_FOR_158(s, p, o, m) MITK_PP_FOR_158_C(MITK_PP_BOOL(p(159, s)), s, p, o, m)
+# define MITK_PP_FOR_159(s, p, o, m) MITK_PP_FOR_159_C(MITK_PP_BOOL(p(160, s)), s, p, o, m)
+# define MITK_PP_FOR_160(s, p, o, m) MITK_PP_FOR_160_C(MITK_PP_BOOL(p(161, s)), s, p, o, m)
+# define MITK_PP_FOR_161(s, p, o, m) MITK_PP_FOR_161_C(MITK_PP_BOOL(p(162, s)), s, p, o, m)
+# define MITK_PP_FOR_162(s, p, o, m) MITK_PP_FOR_162_C(MITK_PP_BOOL(p(163, s)), s, p, o, m)
+# define MITK_PP_FOR_163(s, p, o, m) MITK_PP_FOR_163_C(MITK_PP_BOOL(p(164, s)), s, p, o, m)
+# define MITK_PP_FOR_164(s, p, o, m) MITK_PP_FOR_164_C(MITK_PP_BOOL(p(165, s)), s, p, o, m)
+# define MITK_PP_FOR_165(s, p, o, m) MITK_PP_FOR_165_C(MITK_PP_BOOL(p(166, s)), s, p, o, m)
+# define MITK_PP_FOR_166(s, p, o, m) MITK_PP_FOR_166_C(MITK_PP_BOOL(p(167, s)), s, p, o, m)
+# define MITK_PP_FOR_167(s, p, o, m) MITK_PP_FOR_167_C(MITK_PP_BOOL(p(168, s)), s, p, o, m)
+# define MITK_PP_FOR_168(s, p, o, m) MITK_PP_FOR_168_C(MITK_PP_BOOL(p(169, s)), s, p, o, m)
+# define MITK_PP_FOR_169(s, p, o, m) MITK_PP_FOR_169_C(MITK_PP_BOOL(p(170, s)), s, p, o, m)
+# define MITK_PP_FOR_170(s, p, o, m) MITK_PP_FOR_170_C(MITK_PP_BOOL(p(171, s)), s, p, o, m)
+# define MITK_PP_FOR_171(s, p, o, m) MITK_PP_FOR_171_C(MITK_PP_BOOL(p(172, s)), s, p, o, m)
+# define MITK_PP_FOR_172(s, p, o, m) MITK_PP_FOR_172_C(MITK_PP_BOOL(p(173, s)), s, p, o, m)
+# define MITK_PP_FOR_173(s, p, o, m) MITK_PP_FOR_173_C(MITK_PP_BOOL(p(174, s)), s, p, o, m)
+# define MITK_PP_FOR_174(s, p, o, m) MITK_PP_FOR_174_C(MITK_PP_BOOL(p(175, s)), s, p, o, m)
+# define MITK_PP_FOR_175(s, p, o, m) MITK_PP_FOR_175_C(MITK_PP_BOOL(p(176, s)), s, p, o, m)
+# define MITK_PP_FOR_176(s, p, o, m) MITK_PP_FOR_176_C(MITK_PP_BOOL(p(177, s)), s, p, o, m)
+# define MITK_PP_FOR_177(s, p, o, m) MITK_PP_FOR_177_C(MITK_PP_BOOL(p(178, s)), s, p, o, m)
+# define MITK_PP_FOR_178(s, p, o, m) MITK_PP_FOR_178_C(MITK_PP_BOOL(p(179, s)), s, p, o, m)
+# define MITK_PP_FOR_179(s, p, o, m) MITK_PP_FOR_179_C(MITK_PP_BOOL(p(180, s)), s, p, o, m)
+# define MITK_PP_FOR_180(s, p, o, m) MITK_PP_FOR_180_C(MITK_PP_BOOL(p(181, s)), s, p, o, m)
+# define MITK_PP_FOR_181(s, p, o, m) MITK_PP_FOR_181_C(MITK_PP_BOOL(p(182, s)), s, p, o, m)
+# define MITK_PP_FOR_182(s, p, o, m) MITK_PP_FOR_182_C(MITK_PP_BOOL(p(183, s)), s, p, o, m)
+# define MITK_PP_FOR_183(s, p, o, m) MITK_PP_FOR_183_C(MITK_PP_BOOL(p(184, s)), s, p, o, m)
+# define MITK_PP_FOR_184(s, p, o, m) MITK_PP_FOR_184_C(MITK_PP_BOOL(p(185, s)), s, p, o, m)
+# define MITK_PP_FOR_185(s, p, o, m) MITK_PP_FOR_185_C(MITK_PP_BOOL(p(186, s)), s, p, o, m)
+# define MITK_PP_FOR_186(s, p, o, m) MITK_PP_FOR_186_C(MITK_PP_BOOL(p(187, s)), s, p, o, m)
+# define MITK_PP_FOR_187(s, p, o, m) MITK_PP_FOR_187_C(MITK_PP_BOOL(p(188, s)), s, p, o, m)
+# define MITK_PP_FOR_188(s, p, o, m) MITK_PP_FOR_188_C(MITK_PP_BOOL(p(189, s)), s, p, o, m)
+# define MITK_PP_FOR_189(s, p, o, m) MITK_PP_FOR_189_C(MITK_PP_BOOL(p(190, s)), s, p, o, m)
+# define MITK_PP_FOR_190(s, p, o, m) MITK_PP_FOR_190_C(MITK_PP_BOOL(p(191, s)), s, p, o, m)
+# define MITK_PP_FOR_191(s, p, o, m) MITK_PP_FOR_191_C(MITK_PP_BOOL(p(192, s)), s, p, o, m)
+# define MITK_PP_FOR_192(s, p, o, m) MITK_PP_FOR_192_C(MITK_PP_BOOL(p(193, s)), s, p, o, m)
+# define MITK_PP_FOR_193(s, p, o, m) MITK_PP_FOR_193_C(MITK_PP_BOOL(p(194, s)), s, p, o, m)
+# define MITK_PP_FOR_194(s, p, o, m) MITK_PP_FOR_194_C(MITK_PP_BOOL(p(195, s)), s, p, o, m)
+# define MITK_PP_FOR_195(s, p, o, m) MITK_PP_FOR_195_C(MITK_PP_BOOL(p(196, s)), s, p, o, m)
+# define MITK_PP_FOR_196(s, p, o, m) MITK_PP_FOR_196_C(MITK_PP_BOOL(p(197, s)), s, p, o, m)
+# define MITK_PP_FOR_197(s, p, o, m) MITK_PP_FOR_197_C(MITK_PP_BOOL(p(198, s)), s, p, o, m)
+# define MITK_PP_FOR_198(s, p, o, m) MITK_PP_FOR_198_C(MITK_PP_BOOL(p(199, s)), s, p, o, m)
+# define MITK_PP_FOR_199(s, p, o, m) MITK_PP_FOR_199_C(MITK_PP_BOOL(p(200, s)), s, p, o, m)
+# define MITK_PP_FOR_200(s, p, o, m) MITK_PP_FOR_200_C(MITK_PP_BOOL(p(201, s)), s, p, o, m)
+# define MITK_PP_FOR_201(s, p, o, m) MITK_PP_FOR_201_C(MITK_PP_BOOL(p(202, s)), s, p, o, m)
+# define MITK_PP_FOR_202(s, p, o, m) MITK_PP_FOR_202_C(MITK_PP_BOOL(p(203, s)), s, p, o, m)
+# define MITK_PP_FOR_203(s, p, o, m) MITK_PP_FOR_203_C(MITK_PP_BOOL(p(204, s)), s, p, o, m)
+# define MITK_PP_FOR_204(s, p, o, m) MITK_PP_FOR_204_C(MITK_PP_BOOL(p(205, s)), s, p, o, m)
+# define MITK_PP_FOR_205(s, p, o, m) MITK_PP_FOR_205_C(MITK_PP_BOOL(p(206, s)), s, p, o, m)
+# define MITK_PP_FOR_206(s, p, o, m) MITK_PP_FOR_206_C(MITK_PP_BOOL(p(207, s)), s, p, o, m)
+# define MITK_PP_FOR_207(s, p, o, m) MITK_PP_FOR_207_C(MITK_PP_BOOL(p(208, s)), s, p, o, m)
+# define MITK_PP_FOR_208(s, p, o, m) MITK_PP_FOR_208_C(MITK_PP_BOOL(p(209, s)), s, p, o, m)
+# define MITK_PP_FOR_209(s, p, o, m) MITK_PP_FOR_209_C(MITK_PP_BOOL(p(210, s)), s, p, o, m)
+# define MITK_PP_FOR_210(s, p, o, m) MITK_PP_FOR_210_C(MITK_PP_BOOL(p(211, s)), s, p, o, m)
+# define MITK_PP_FOR_211(s, p, o, m) MITK_PP_FOR_211_C(MITK_PP_BOOL(p(212, s)), s, p, o, m)
+# define MITK_PP_FOR_212(s, p, o, m) MITK_PP_FOR_212_C(MITK_PP_BOOL(p(213, s)), s, p, o, m)
+# define MITK_PP_FOR_213(s, p, o, m) MITK_PP_FOR_213_C(MITK_PP_BOOL(p(214, s)), s, p, o, m)
+# define MITK_PP_FOR_214(s, p, o, m) MITK_PP_FOR_214_C(MITK_PP_BOOL(p(215, s)), s, p, o, m)
+# define MITK_PP_FOR_215(s, p, o, m) MITK_PP_FOR_215_C(MITK_PP_BOOL(p(216, s)), s, p, o, m)
+# define MITK_PP_FOR_216(s, p, o, m) MITK_PP_FOR_216_C(MITK_PP_BOOL(p(217, s)), s, p, o, m)
+# define MITK_PP_FOR_217(s, p, o, m) MITK_PP_FOR_217_C(MITK_PP_BOOL(p(218, s)), s, p, o, m)
+# define MITK_PP_FOR_218(s, p, o, m) MITK_PP_FOR_218_C(MITK_PP_BOOL(p(219, s)), s, p, o, m)
+# define MITK_PP_FOR_219(s, p, o, m) MITK_PP_FOR_219_C(MITK_PP_BOOL(p(220, s)), s, p, o, m)
+# define MITK_PP_FOR_220(s, p, o, m) MITK_PP_FOR_220_C(MITK_PP_BOOL(p(221, s)), s, p, o, m)
+# define MITK_PP_FOR_221(s, p, o, m) MITK_PP_FOR_221_C(MITK_PP_BOOL(p(222, s)), s, p, o, m)
+# define MITK_PP_FOR_222(s, p, o, m) MITK_PP_FOR_222_C(MITK_PP_BOOL(p(223, s)), s, p, o, m)
+# define MITK_PP_FOR_223(s, p, o, m) MITK_PP_FOR_223_C(MITK_PP_BOOL(p(224, s)), s, p, o, m)
+# define MITK_PP_FOR_224(s, p, o, m) MITK_PP_FOR_224_C(MITK_PP_BOOL(p(225, s)), s, p, o, m)
+# define MITK_PP_FOR_225(s, p, o, m) MITK_PP_FOR_225_C(MITK_PP_BOOL(p(226, s)), s, p, o, m)
+# define MITK_PP_FOR_226(s, p, o, m) MITK_PP_FOR_226_C(MITK_PP_BOOL(p(227, s)), s, p, o, m)
+# define MITK_PP_FOR_227(s, p, o, m) MITK_PP_FOR_227_C(MITK_PP_BOOL(p(228, s)), s, p, o, m)
+# define MITK_PP_FOR_228(s, p, o, m) MITK_PP_FOR_228_C(MITK_PP_BOOL(p(229, s)), s, p, o, m)
+# define MITK_PP_FOR_229(s, p, o, m) MITK_PP_FOR_229_C(MITK_PP_BOOL(p(230, s)), s, p, o, m)
+# define MITK_PP_FOR_230(s, p, o, m) MITK_PP_FOR_230_C(MITK_PP_BOOL(p(231, s)), s, p, o, m)
+# define MITK_PP_FOR_231(s, p, o, m) MITK_PP_FOR_231_C(MITK_PP_BOOL(p(232, s)), s, p, o, m)
+# define MITK_PP_FOR_232(s, p, o, m) MITK_PP_FOR_232_C(MITK_PP_BOOL(p(233, s)), s, p, o, m)
+# define MITK_PP_FOR_233(s, p, o, m) MITK_PP_FOR_233_C(MITK_PP_BOOL(p(234, s)), s, p, o, m)
+# define MITK_PP_FOR_234(s, p, o, m) MITK_PP_FOR_234_C(MITK_PP_BOOL(p(235, s)), s, p, o, m)
+# define MITK_PP_FOR_235(s, p, o, m) MITK_PP_FOR_235_C(MITK_PP_BOOL(p(236, s)), s, p, o, m)
+# define MITK_PP_FOR_236(s, p, o, m) MITK_PP_FOR_236_C(MITK_PP_BOOL(p(237, s)), s, p, o, m)
+# define MITK_PP_FOR_237(s, p, o, m) MITK_PP_FOR_237_C(MITK_PP_BOOL(p(238, s)), s, p, o, m)
+# define MITK_PP_FOR_238(s, p, o, m) MITK_PP_FOR_238_C(MITK_PP_BOOL(p(239, s)), s, p, o, m)
+# define MITK_PP_FOR_239(s, p, o, m) MITK_PP_FOR_239_C(MITK_PP_BOOL(p(240, s)), s, p, o, m)
+# define MITK_PP_FOR_240(s, p, o, m) MITK_PP_FOR_240_C(MITK_PP_BOOL(p(241, s)), s, p, o, m)
+# define MITK_PP_FOR_241(s, p, o, m) MITK_PP_FOR_241_C(MITK_PP_BOOL(p(242, s)), s, p, o, m)
+# define MITK_PP_FOR_242(s, p, o, m) MITK_PP_FOR_242_C(MITK_PP_BOOL(p(243, s)), s, p, o, m)
+# define MITK_PP_FOR_243(s, p, o, m) MITK_PP_FOR_243_C(MITK_PP_BOOL(p(244, s)), s, p, o, m)
+# define MITK_PP_FOR_244(s, p, o, m) MITK_PP_FOR_244_C(MITK_PP_BOOL(p(245, s)), s, p, o, m)
+# define MITK_PP_FOR_245(s, p, o, m) MITK_PP_FOR_245_C(MITK_PP_BOOL(p(246, s)), s, p, o, m)
+# define MITK_PP_FOR_246(s, p, o, m) MITK_PP_FOR_246_C(MITK_PP_BOOL(p(247, s)), s, p, o, m)
+# define MITK_PP_FOR_247(s, p, o, m) MITK_PP_FOR_247_C(MITK_PP_BOOL(p(248, s)), s, p, o, m)
+# define MITK_PP_FOR_248(s, p, o, m) MITK_PP_FOR_248_C(MITK_PP_BOOL(p(249, s)), s, p, o, m)
+# define MITK_PP_FOR_249(s, p, o, m) MITK_PP_FOR_249_C(MITK_PP_BOOL(p(250, s)), s, p, o, m)
+# define MITK_PP_FOR_250(s, p, o, m) MITK_PP_FOR_250_C(MITK_PP_BOOL(p(251, s)), s, p, o, m)
+# define MITK_PP_FOR_251(s, p, o, m) MITK_PP_FOR_251_C(MITK_PP_BOOL(p(252, s)), s, p, o, m)
+# define MITK_PP_FOR_252(s, p, o, m) MITK_PP_FOR_252_C(MITK_PP_BOOL(p(253, s)), s, p, o, m)
+# define MITK_PP_FOR_253(s, p, o, m) MITK_PP_FOR_253_C(MITK_PP_BOOL(p(254, s)), s, p, o, m)
+# define MITK_PP_FOR_254(s, p, o, m) MITK_PP_FOR_254_C(MITK_PP_BOOL(p(255, s)), s, p, o, m)
+# define MITK_PP_FOR_255(s, p, o, m) MITK_PP_FOR_255_C(MITK_PP_BOOL(p(256, s)), s, p, o, m)
+# define MITK_PP_FOR_256(s, p, o, m) MITK_PP_FOR_256_C(MITK_PP_BOOL(p(257, s)), s, p, o, m)
+#
+# define MITK_PP_FOR_1_C(c, s, p, o, m) MITK_PP_IIF(c, m, MITK_PP_TUPLE_EAT_2)(2, s) MITK_PP_IIF(c, MITK_PP_FOR_2, MITK_PP_TUPLE_EAT_4)(MITK_PP_EXPR_IIF(c, o)(2, s), p, o, m)
+# define MITK_PP_FOR_2_C(c, s, p, o, m) MITK_PP_IIF(c, m, MITK_PP_TUPLE_EAT_2)(3, s) MITK_PP_IIF(c, MITK_PP_FOR_3, MITK_PP_TUPLE_EAT_4)(MITK_PP_EXPR_IIF(c, o)(3, s), p, o, m)
+# define MITK_PP_FOR_3_C(c, s, p, o, m) MITK_PP_IIF(c, m, MITK_PP_TUPLE_EAT_2)(4, s) MITK_PP_IIF(c, MITK_PP_FOR_4, MITK_PP_TUPLE_EAT_4)(MITK_PP_EXPR_IIF(c, o)(4, s), p, o, m)
+# define MITK_PP_FOR_4_C(c, s, p, o, m) MITK_PP_IIF(c, m, MITK_PP_TUPLE_EAT_2)(5, s) MITK_PP_IIF(c, MITK_PP_FOR_5, MITK_PP_TUPLE_EAT_4)(MITK_PP_EXPR_IIF(c, o)(5, s), p, o, m)
+# define MITK_PP_FOR_5_C(c, s, p, o, m) MITK_PP_IIF(c, m, MITK_PP_TUPLE_EAT_2)(6, s) MITK_PP_IIF(c, MITK_PP_FOR_6, MITK_PP_TUPLE_EAT_4)(MITK_PP_EXPR_IIF(c, o)(6, s), p, o, m)
+# define MITK_PP_FOR_6_C(c, s, p, o, m) MITK_PP_IIF(c, m, MITK_PP_TUPLE_EAT_2)(7, s) MITK_PP_IIF(c, MITK_PP_FOR_7, MITK_PP_TUPLE_EAT_4)(MITK_PP_EXPR_IIF(c, o)(7, s), p, o, m)
+# define MITK_PP_FOR_7_C(c, s, p, o, m) MITK_PP_IIF(c, m, MITK_PP_TUPLE_EAT_2)(8, s) MITK_PP_IIF(c, MITK_PP_FOR_8, MITK_PP_TUPLE_EAT_4)(MITK_PP_EXPR_IIF(c, o)(8, s), p, o, m)
+# define MITK_PP_FOR_8_C(c, s, p, o, m) MITK_PP_IIF(c, m, MITK_PP_TUPLE_EAT_2)(9, s) MITK_PP_IIF(c, MITK_PP_FOR_9, MITK_PP_TUPLE_EAT_4)(MITK_PP_EXPR_IIF(c, o)(9, s), p, o, m)
+# define MITK_PP_FOR_9_C(c, s, p, o, m) MITK_PP_IIF(c, m, MITK_PP_TUPLE_EAT_2)(10, s) MITK_PP_IIF(c, MITK_PP_FOR_10, MITK_PP_TUPLE_EAT_4)(MITK_PP_EXPR_IIF(c, o)(10, s), p, o, m)
+# define MITK_PP_FOR_10_C(c, s, p, o, m) MITK_PP_IIF(c, m, MITK_PP_TUPLE_EAT_2)(11, s) MITK_PP_IIF(c, MITK_PP_FOR_11, MITK_PP_TUPLE_EAT_4)(MITK_PP_EXPR_IIF(c, o)(11, s), p, o, m)
+# define MITK_PP_FOR_11_C(c, s, p, o, m) MITK_PP_IIF(c, m, MITK_PP_TUPLE_EAT_2)(12, s) MITK_PP_IIF(c, MITK_PP_FOR_12, MITK_PP_TUPLE_EAT_4)(MITK_PP_EXPR_IIF(c, o)(12, s), p, o, m)
+# define MITK_PP_FOR_12_C(c, s, p, o, m) MITK_PP_IIF(c, m, MITK_PP_TUPLE_EAT_2)(13, s) MITK_PP_IIF(c, MITK_PP_FOR_13, MITK_PP_TUPLE_EAT_4)(MITK_PP_EXPR_IIF(c, o)(13, s), p, o, m)
+# define MITK_PP_FOR_13_C(c, s, p, o, m) MITK_PP_IIF(c, m, MITK_PP_TUPLE_EAT_2)(14, s) MITK_PP_IIF(c, MITK_PP_FOR_14, MITK_PP_TUPLE_EAT_4)(MITK_PP_EXPR_IIF(c, o)(14, s), p, o, m)
+# define MITK_PP_FOR_14_C(c, s, p, o, m) MITK_PP_IIF(c, m, MITK_PP_TUPLE_EAT_2)(15, s) MITK_PP_IIF(c, MITK_PP_FOR_15, MITK_PP_TUPLE_EAT_4)(MITK_PP_EXPR_IIF(c, o)(15, s), p, o, m)
+# define MITK_PP_FOR_15_C(c, s, p, o, m) MITK_PP_IIF(c, m, MITK_PP_TUPLE_EAT_2)(16, s) MITK_PP_IIF(c, MITK_PP_FOR_16, MITK_PP_TUPLE_EAT_4)(MITK_PP_EXPR_IIF(c, o)(16, s), p, o, m)
+# define MITK_PP_FOR_16_C(c, s, p, o, m) MITK_PP_IIF(c, m, MITK_PP_TUPLE_EAT_2)(17, s) MITK_PP_IIF(c, MITK_PP_FOR_17, MITK_PP_TUPLE_EAT_4)(MITK_PP_EXPR_IIF(c, o)(17, s), p, o, m)
+# define MITK_PP_FOR_17_C(c, s, p, o, m) MITK_PP_IIF(c, m, MITK_PP_TUPLE_EAT_2)(18, s) MITK_PP_IIF(c, MITK_PP_FOR_18, MITK_PP_TUPLE_EAT_4)(MITK_PP_EXPR_IIF(c, o)(18, s), p, o, m)
+# define MITK_PP_FOR_18_C(c, s, p, o, m) MITK_PP_IIF(c, m, MITK_PP_TUPLE_EAT_2)(19, s) MITK_PP_IIF(c, MITK_PP_FOR_19, MITK_PP_TUPLE_EAT_4)(MITK_PP_EXPR_IIF(c, o)(19, s), p, o, m)
+# define MITK_PP_FOR_19_C(c, s, p, o, m) MITK_PP_IIF(c, m, MITK_PP_TUPLE_EAT_2)(20, s) MITK_PP_IIF(c, MITK_PP_FOR_20, MITK_PP_TUPLE_EAT_4)(MITK_PP_EXPR_IIF(c, o)(20, s), p, o, m)
+# define MITK_PP_FOR_20_C(c, s, p, o, m) MITK_PP_IIF(c, m, MITK_PP_TUPLE_EAT_2)(21, s) MITK_PP_IIF(c, MITK_PP_FOR_21, MITK_PP_TUPLE_EAT_4)(MITK_PP_EXPR_IIF(c, o)(21, s), p, o, m)
+# define MITK_PP_FOR_21_C(c, s, p, o, m) MITK_PP_IIF(c, m, MITK_PP_TUPLE_EAT_2)(22, s) MITK_PP_IIF(c, MITK_PP_FOR_22, MITK_PP_TUPLE_EAT_4)(MITK_PP_EXPR_IIF(c, o)(22, s), p, o, m)
+# define MITK_PP_FOR_22_C(c, s, p, o, m) MITK_PP_IIF(c, m, MITK_PP_TUPLE_EAT_2)(23, s) MITK_PP_IIF(c, MITK_PP_FOR_23, MITK_PP_TUPLE_EAT_4)(MITK_PP_EXPR_IIF(c, o)(23, s), p, o, m)
+# define MITK_PP_FOR_23_C(c, s, p, o, m) MITK_PP_IIF(c, m, MITK_PP_TUPLE_EAT_2)(24, s) MITK_PP_IIF(c, MITK_PP_FOR_24, MITK_PP_TUPLE_EAT_4)(MITK_PP_EXPR_IIF(c, o)(24, s), p, o, m)
+# define MITK_PP_FOR_24_C(c, s, p, o, m) MITK_PP_IIF(c, m, MITK_PP_TUPLE_EAT_2)(25, s) MITK_PP_IIF(c, MITK_PP_FOR_25, MITK_PP_TUPLE_EAT_4)(MITK_PP_EXPR_IIF(c, o)(25, s), p, o, m)
+# define MITK_PP_FOR_25_C(c, s, p, o, m) MITK_PP_IIF(c, m, MITK_PP_TUPLE_EAT_2)(26, s) MITK_PP_IIF(c, MITK_PP_FOR_26, MITK_PP_TUPLE_EAT_4)(MITK_PP_EXPR_IIF(c, o)(26, s), p, o, m)
+# define MITK_PP_FOR_26_C(c, s, p, o, m) MITK_PP_IIF(c, m, MITK_PP_TUPLE_EAT_2)(27, s) MITK_PP_IIF(c, MITK_PP_FOR_27, MITK_PP_TUPLE_EAT_4)(MITK_PP_EXPR_IIF(c, o)(27, s), p, o, m)
+# define MITK_PP_FOR_27_C(c, s, p, o, m) MITK_PP_IIF(c, m, MITK_PP_TUPLE_EAT_2)(28, s) MITK_PP_IIF(c, MITK_PP_FOR_28, MITK_PP_TUPLE_EAT_4)(MITK_PP_EXPR_IIF(c, o)(28, s), p, o, m)
+# define MITK_PP_FOR_28_C(c, s, p, o, m) MITK_PP_IIF(c, m, MITK_PP_TUPLE_EAT_2)(29, s) MITK_PP_IIF(c, MITK_PP_FOR_29, MITK_PP_TUPLE_EAT_4)(MITK_PP_EXPR_IIF(c, o)(29, s), p, o, m)
+# define MITK_PP_FOR_29_C(c, s, p, o, m) MITK_PP_IIF(c, m, MITK_PP_TUPLE_EAT_2)(30, s) MITK_PP_IIF(c, MITK_PP_FOR_30, MITK_PP_TUPLE_EAT_4)(MITK_PP_EXPR_IIF(c, o)(30, s), p, o, m)
+# define MITK_PP_FOR_30_C(c, s, p, o, m) MITK_PP_IIF(c, m, MITK_PP_TUPLE_EAT_2)(31, s) MITK_PP_IIF(c, MITK_PP_FOR_31, MITK_PP_TUPLE_EAT_4)(MITK_PP_EXPR_IIF(c, o)(31, s), p, o, m)
+# define MITK_PP_FOR_31_C(c, s, p, o, m) MITK_PP_IIF(c, m, MITK_PP_TUPLE_EAT_2)(32, s) MITK_PP_IIF(c, MITK_PP_FOR_32, MITK_PP_TUPLE_EAT_4)(MITK_PP_EXPR_IIF(c, o)(32, s), p, o, m)
+# define MITK_PP_FOR_32_C(c, s, p, o, m) MITK_PP_IIF(c, m, MITK_PP_TUPLE_EAT_2)(33, s) MITK_PP_IIF(c, MITK_PP_FOR_33, MITK_PP_TUPLE_EAT_4)(MITK_PP_EXPR_IIF(c, o)(33, s), p, o, m)
+# define MITK_PP_FOR_33_C(c, s, p, o, m) MITK_PP_IIF(c, m, MITK_PP_TUPLE_EAT_2)(34, s) MITK_PP_IIF(c, MITK_PP_FOR_34, MITK_PP_TUPLE_EAT_4)(MITK_PP_EXPR_IIF(c, o)(34, s), p, o, m)
+# define MITK_PP_FOR_34_C(c, s, p, o, m) MITK_PP_IIF(c, m, MITK_PP_TUPLE_EAT_2)(35, s) MITK_PP_IIF(c, MITK_PP_FOR_35, MITK_PP_TUPLE_EAT_4)(MITK_PP_EXPR_IIF(c, o)(35, s), p, o, m)
+# define MITK_PP_FOR_35_C(c, s, p, o, m) MITK_PP_IIF(c, m, MITK_PP_TUPLE_EAT_2)(36, s) MITK_PP_IIF(c, MITK_PP_FOR_36, MITK_PP_TUPLE_EAT_4)(MITK_PP_EXPR_IIF(c, o)(36, s), p, o, m)
+# define MITK_PP_FOR_36_C(c, s, p, o, m) MITK_PP_IIF(c, m, MITK_PP_TUPLE_EAT_2)(37, s) MITK_PP_IIF(c, MITK_PP_FOR_37, MITK_PP_TUPLE_EAT_4)(MITK_PP_EXPR_IIF(c, o)(37, s), p, o, m)
+# define MITK_PP_FOR_37_C(c, s, p, o, m) MITK_PP_IIF(c, m, MITK_PP_TUPLE_EAT_2)(38, s) MITK_PP_IIF(c, MITK_PP_FOR_38, MITK_PP_TUPLE_EAT_4)(MITK_PP_EXPR_IIF(c, o)(38, s), p, o, m)
+# define MITK_PP_FOR_38_C(c, s, p, o, m) MITK_PP_IIF(c, m, MITK_PP_TUPLE_EAT_2)(39, s) MITK_PP_IIF(c, MITK_PP_FOR_39, MITK_PP_TUPLE_EAT_4)(MITK_PP_EXPR_IIF(c, o)(39, s), p, o, m)
+# define MITK_PP_FOR_39_C(c, s, p, o, m) MITK_PP_IIF(c, m, MITK_PP_TUPLE_EAT_2)(40, s) MITK_PP_IIF(c, MITK_PP_FOR_40, MITK_PP_TUPLE_EAT_4)(MITK_PP_EXPR_IIF(c, o)(40, s), p, o, m)
+# define MITK_PP_FOR_40_C(c, s, p, o, m) MITK_PP_IIF(c, m, MITK_PP_TUPLE_EAT_2)(41, s) MITK_PP_IIF(c, MITK_PP_FOR_41, MITK_PP_TUPLE_EAT_4)(MITK_PP_EXPR_IIF(c, o)(41, s), p, o, m)
+# define MITK_PP_FOR_41_C(c, s, p, o, m) MITK_PP_IIF(c, m, MITK_PP_TUPLE_EAT_2)(42, s) MITK_PP_IIF(c, MITK_PP_FOR_42, MITK_PP_TUPLE_EAT_4)(MITK_PP_EXPR_IIF(c, o)(42, s), p, o, m)
+# define MITK_PP_FOR_42_C(c, s, p, o, m) MITK_PP_IIF(c, m, MITK_PP_TUPLE_EAT_2)(43, s) MITK_PP_IIF(c, MITK_PP_FOR_43, MITK_PP_TUPLE_EAT_4)(MITK_PP_EXPR_IIF(c, o)(43, s), p, o, m)
+# define MITK_PP_FOR_43_C(c, s, p, o, m) MITK_PP_IIF(c, m, MITK_PP_TUPLE_EAT_2)(44, s) MITK_PP_IIF(c, MITK_PP_FOR_44, MITK_PP_TUPLE_EAT_4)(MITK_PP_EXPR_IIF(c, o)(44, s), p, o, m)
+# define MITK_PP_FOR_44_C(c, s, p, o, m) MITK_PP_IIF(c, m, MITK_PP_TUPLE_EAT_2)(45, s) MITK_PP_IIF(c, MITK_PP_FOR_45, MITK_PP_TUPLE_EAT_4)(MITK_PP_EXPR_IIF(c, o)(45, s), p, o, m)
+# define MITK_PP_FOR_45_C(c, s, p, o, m) MITK_PP_IIF(c, m, MITK_PP_TUPLE_EAT_2)(46, s) MITK_PP_IIF(c, MITK_PP_FOR_46, MITK_PP_TUPLE_EAT_4)(MITK_PP_EXPR_IIF(c, o)(46, s), p, o, m)
+# define MITK_PP_FOR_46_C(c, s, p, o, m) MITK_PP_IIF(c, m, MITK_PP_TUPLE_EAT_2)(47, s) MITK_PP_IIF(c, MITK_PP_FOR_47, MITK_PP_TUPLE_EAT_4)(MITK_PP_EXPR_IIF(c, o)(47, s), p, o, m)
+# define MITK_PP_FOR_47_C(c, s, p, o, m) MITK_PP_IIF(c, m, MITK_PP_TUPLE_EAT_2)(48, s) MITK_PP_IIF(c, MITK_PP_FOR_48, MITK_PP_TUPLE_EAT_4)(MITK_PP_EXPR_IIF(c, o)(48, s), p, o, m)
+# define MITK_PP_FOR_48_C(c, s, p, o, m) MITK_PP_IIF(c, m, MITK_PP_TUPLE_EAT_2)(49, s) MITK_PP_IIF(c, MITK_PP_FOR_49, MITK_PP_TUPLE_EAT_4)(MITK_PP_EXPR_IIF(c, o)(49, s), p, o, m)
+# define MITK_PP_FOR_49_C(c, s, p, o, m) MITK_PP_IIF(c, m, MITK_PP_TUPLE_EAT_2)(50, s) MITK_PP_IIF(c, MITK_PP_FOR_50, MITK_PP_TUPLE_EAT_4)(MITK_PP_EXPR_IIF(c, o)(50, s), p, o, m)
+# define MITK_PP_FOR_50_C(c, s, p, o, m) MITK_PP_IIF(c, m, MITK_PP_TUPLE_EAT_2)(51, s) MITK_PP_IIF(c, MITK_PP_FOR_51, MITK_PP_TUPLE_EAT_4)(MITK_PP_EXPR_IIF(c, o)(51, s), p, o, m)
+# define MITK_PP_FOR_51_C(c, s, p, o, m) MITK_PP_IIF(c, m, MITK_PP_TUPLE_EAT_2)(52, s) MITK_PP_IIF(c, MITK_PP_FOR_52, MITK_PP_TUPLE_EAT_4)(MITK_PP_EXPR_IIF(c, o)(52, s), p, o, m)
+# define MITK_PP_FOR_52_C(c, s, p, o, m) MITK_PP_IIF(c, m, MITK_PP_TUPLE_EAT_2)(53, s) MITK_PP_IIF(c, MITK_PP_FOR_53, MITK_PP_TUPLE_EAT_4)(MITK_PP_EXPR_IIF(c, o)(53, s), p, o, m)
+# define MITK_PP_FOR_53_C(c, s, p, o, m) MITK_PP_IIF(c, m, MITK_PP_TUPLE_EAT_2)(54, s) MITK_PP_IIF(c, MITK_PP_FOR_54, MITK_PP_TUPLE_EAT_4)(MITK_PP_EXPR_IIF(c, o)(54, s), p, o, m)
+# define MITK_PP_FOR_54_C(c, s, p, o, m) MITK_PP_IIF(c, m, MITK_PP_TUPLE_EAT_2)(55, s) MITK_PP_IIF(c, MITK_PP_FOR_55, MITK_PP_TUPLE_EAT_4)(MITK_PP_EXPR_IIF(c, o)(55, s), p, o, m)
+# define MITK_PP_FOR_55_C(c, s, p, o, m) MITK_PP_IIF(c, m, MITK_PP_TUPLE_EAT_2)(56, s) MITK_PP_IIF(c, MITK_PP_FOR_56, MITK_PP_TUPLE_EAT_4)(MITK_PP_EXPR_IIF(c, o)(56, s), p, o, m)
+# define MITK_PP_FOR_56_C(c, s, p, o, m) MITK_PP_IIF(c, m, MITK_PP_TUPLE_EAT_2)(57, s) MITK_PP_IIF(c, MITK_PP_FOR_57, MITK_PP_TUPLE_EAT_4)(MITK_PP_EXPR_IIF(c, o)(57, s), p, o, m)
+# define MITK_PP_FOR_57_C(c, s, p, o, m) MITK_PP_IIF(c, m, MITK_PP_TUPLE_EAT_2)(58, s) MITK_PP_IIF(c, MITK_PP_FOR_58, MITK_PP_TUPLE_EAT_4)(MITK_PP_EXPR_IIF(c, o)(58, s), p, o, m)
+# define MITK_PP_FOR_58_C(c, s, p, o, m) MITK_PP_IIF(c, m, MITK_PP_TUPLE_EAT_2)(59, s) MITK_PP_IIF(c, MITK_PP_FOR_59, MITK_PP_TUPLE_EAT_4)(MITK_PP_EXPR_IIF(c, o)(59, s), p, o, m)
+# define MITK_PP_FOR_59_C(c, s, p, o, m) MITK_PP_IIF(c, m, MITK_PP_TUPLE_EAT_2)(60, s) MITK_PP_IIF(c, MITK_PP_FOR_60, MITK_PP_TUPLE_EAT_4)(MITK_PP_EXPR_IIF(c, o)(60, s), p, o, m)
+# define MITK_PP_FOR_60_C(c, s, p, o, m) MITK_PP_IIF(c, m, MITK_PP_TUPLE_EAT_2)(61, s) MITK_PP_IIF(c, MITK_PP_FOR_61, MITK_PP_TUPLE_EAT_4)(MITK_PP_EXPR_IIF(c, o)(61, s), p, o, m)
+# define MITK_PP_FOR_61_C(c, s, p, o, m) MITK_PP_IIF(c, m, MITK_PP_TUPLE_EAT_2)(62, s) MITK_PP_IIF(c, MITK_PP_FOR_62, MITK_PP_TUPLE_EAT_4)(MITK_PP_EXPR_IIF(c, o)(62, s), p, o, m)
+# define MITK_PP_FOR_62_C(c, s, p, o, m) MITK_PP_IIF(c, m, MITK_PP_TUPLE_EAT_2)(63, s) MITK_PP_IIF(c, MITK_PP_FOR_63, MITK_PP_TUPLE_EAT_4)(MITK_PP_EXPR_IIF(c, o)(63, s), p, o, m)
+# define MITK_PP_FOR_63_C(c, s, p, o, m) MITK_PP_IIF(c, m, MITK_PP_TUPLE_EAT_2)(64, s) MITK_PP_IIF(c, MITK_PP_FOR_64, MITK_PP_TUPLE_EAT_4)(MITK_PP_EXPR_IIF(c, o)(64, s), p, o, m)
+# define MITK_PP_FOR_64_C(c, s, p, o, m) MITK_PP_IIF(c, m, MITK_PP_TUPLE_EAT_2)(65, s) MITK_PP_IIF(c, MITK_PP_FOR_65, MITK_PP_TUPLE_EAT_4)(MITK_PP_EXPR_IIF(c, o)(65, s), p, o, m)
+# define MITK_PP_FOR_65_C(c, s, p, o, m) MITK_PP_IIF(c, m, MITK_PP_TUPLE_EAT_2)(66, s) MITK_PP_IIF(c, MITK_PP_FOR_66, MITK_PP_TUPLE_EAT_4)(MITK_PP_EXPR_IIF(c, o)(66, s), p, o, m)
+# define MITK_PP_FOR_66_C(c, s, p, o, m) MITK_PP_IIF(c, m, MITK_PP_TUPLE_EAT_2)(67, s) MITK_PP_IIF(c, MITK_PP_FOR_67, MITK_PP_TUPLE_EAT_4)(MITK_PP_EXPR_IIF(c, o)(67, s), p, o, m)
+# define MITK_PP_FOR_67_C(c, s, p, o, m) MITK_PP_IIF(c, m, MITK_PP_TUPLE_EAT_2)(68, s) MITK_PP_IIF(c, MITK_PP_FOR_68, MITK_PP_TUPLE_EAT_4)(MITK_PP_EXPR_IIF(c, o)(68, s), p, o, m)
+# define MITK_PP_FOR_68_C(c, s, p, o, m) MITK_PP_IIF(c, m, MITK_PP_TUPLE_EAT_2)(69, s) MITK_PP_IIF(c, MITK_PP_FOR_69, MITK_PP_TUPLE_EAT_4)(MITK_PP_EXPR_IIF(c, o)(69, s), p, o, m)
+# define MITK_PP_FOR_69_C(c, s, p, o, m) MITK_PP_IIF(c, m, MITK_PP_TUPLE_EAT_2)(70, s) MITK_PP_IIF(c, MITK_PP_FOR_70, MITK_PP_TUPLE_EAT_4)(MITK_PP_EXPR_IIF(c, o)(70, s), p, o, m)
+# define MITK_PP_FOR_70_C(c, s, p, o, m) MITK_PP_IIF(c, m, MITK_PP_TUPLE_EAT_2)(71, s) MITK_PP_IIF(c, MITK_PP_FOR_71, MITK_PP_TUPLE_EAT_4)(MITK_PP_EXPR_IIF(c, o)(71, s), p, o, m)
+# define MITK_PP_FOR_71_C(c, s, p, o, m) MITK_PP_IIF(c, m, MITK_PP_TUPLE_EAT_2)(72, s) MITK_PP_IIF(c, MITK_PP_FOR_72, MITK_PP_TUPLE_EAT_4)(MITK_PP_EXPR_IIF(c, o)(72, s), p, o, m)
+# define MITK_PP_FOR_72_C(c, s, p, o, m) MITK_PP_IIF(c, m, MITK_PP_TUPLE_EAT_2)(73, s) MITK_PP_IIF(c, MITK_PP_FOR_73, MITK_PP_TUPLE_EAT_4)(MITK_PP_EXPR_IIF(c, o)(73, s), p, o, m)
+# define MITK_PP_FOR_73_C(c, s, p, o, m) MITK_PP_IIF(c, m, MITK_PP_TUPLE_EAT_2)(74, s) MITK_PP_IIF(c, MITK_PP_FOR_74, MITK_PP_TUPLE_EAT_4)(MITK_PP_EXPR_IIF(c, o)(74, s), p, o, m)
+# define MITK_PP_FOR_74_C(c, s, p, o, m) MITK_PP_IIF(c, m, MITK_PP_TUPLE_EAT_2)(75, s) MITK_PP_IIF(c, MITK_PP_FOR_75, MITK_PP_TUPLE_EAT_4)(MITK_PP_EXPR_IIF(c, o)(75, s), p, o, m)
+# define MITK_PP_FOR_75_C(c, s, p, o, m) MITK_PP_IIF(c, m, MITK_PP_TUPLE_EAT_2)(76, s) MITK_PP_IIF(c, MITK_PP_FOR_76, MITK_PP_TUPLE_EAT_4)(MITK_PP_EXPR_IIF(c, o)(76, s), p, o, m)
+# define MITK_PP_FOR_76_C(c, s, p, o, m) MITK_PP_IIF(c, m, MITK_PP_TUPLE_EAT_2)(77, s) MITK_PP_IIF(c, MITK_PP_FOR_77, MITK_PP_TUPLE_EAT_4)(MITK_PP_EXPR_IIF(c, o)(77, s), p, o, m)
+# define MITK_PP_FOR_77_C(c, s, p, o, m) MITK_PP_IIF(c, m, MITK_PP_TUPLE_EAT_2)(78, s) MITK_PP_IIF(c, MITK_PP_FOR_78, MITK_PP_TUPLE_EAT_4)(MITK_PP_EXPR_IIF(c, o)(78, s), p, o, m)
+# define MITK_PP_FOR_78_C(c, s, p, o, m) MITK_PP_IIF(c, m, MITK_PP_TUPLE_EAT_2)(79, s) MITK_PP_IIF(c, MITK_PP_FOR_79, MITK_PP_TUPLE_EAT_4)(MITK_PP_EXPR_IIF(c, o)(79, s), p, o, m)
+# define MITK_PP_FOR_79_C(c, s, p, o, m) MITK_PP_IIF(c, m, MITK_PP_TUPLE_EAT_2)(80, s) MITK_PP_IIF(c, MITK_PP_FOR_80, MITK_PP_TUPLE_EAT_4)(MITK_PP_EXPR_IIF(c, o)(80, s), p, o, m)
+# define MITK_PP_FOR_80_C(c, s, p, o, m) MITK_PP_IIF(c, m, MITK_PP_TUPLE_EAT_2)(81, s) MITK_PP_IIF(c, MITK_PP_FOR_81, MITK_PP_TUPLE_EAT_4)(MITK_PP_EXPR_IIF(c, o)(81, s), p, o, m)
+# define MITK_PP_FOR_81_C(c, s, p, o, m) MITK_PP_IIF(c, m, MITK_PP_TUPLE_EAT_2)(82, s) MITK_PP_IIF(c, MITK_PP_FOR_82, MITK_PP_TUPLE_EAT_4)(MITK_PP_EXPR_IIF(c, o)(82, s), p, o, m)
+# define MITK_PP_FOR_82_C(c, s, p, o, m) MITK_PP_IIF(c, m, MITK_PP_TUPLE_EAT_2)(83, s) MITK_PP_IIF(c, MITK_PP_FOR_83, MITK_PP_TUPLE_EAT_4)(MITK_PP_EXPR_IIF(c, o)(83, s), p, o, m)
+# define MITK_PP_FOR_83_C(c, s, p, o, m) MITK_PP_IIF(c, m, MITK_PP_TUPLE_EAT_2)(84, s) MITK_PP_IIF(c, MITK_PP_FOR_84, MITK_PP_TUPLE_EAT_4)(MITK_PP_EXPR_IIF(c, o)(84, s), p, o, m)
+# define MITK_PP_FOR_84_C(c, s, p, o, m) MITK_PP_IIF(c, m, MITK_PP_TUPLE_EAT_2)(85, s) MITK_PP_IIF(c, MITK_PP_FOR_85, MITK_PP_TUPLE_EAT_4)(MITK_PP_EXPR_IIF(c, o)(85, s), p, o, m)
+# define MITK_PP_FOR_85_C(c, s, p, o, m) MITK_PP_IIF(c, m, MITK_PP_TUPLE_EAT_2)(86, s) MITK_PP_IIF(c, MITK_PP_FOR_86, MITK_PP_TUPLE_EAT_4)(MITK_PP_EXPR_IIF(c, o)(86, s), p, o, m)
+# define MITK_PP_FOR_86_C(c, s, p, o, m) MITK_PP_IIF(c, m, MITK_PP_TUPLE_EAT_2)(87, s) MITK_PP_IIF(c, MITK_PP_FOR_87, MITK_PP_TUPLE_EAT_4)(MITK_PP_EXPR_IIF(c, o)(87, s), p, o, m)
+# define MITK_PP_FOR_87_C(c, s, p, o, m) MITK_PP_IIF(c, m, MITK_PP_TUPLE_EAT_2)(88, s) MITK_PP_IIF(c, MITK_PP_FOR_88, MITK_PP_TUPLE_EAT_4)(MITK_PP_EXPR_IIF(c, o)(88, s), p, o, m)
+# define MITK_PP_FOR_88_C(c, s, p, o, m) MITK_PP_IIF(c, m, MITK_PP_TUPLE_EAT_2)(89, s) MITK_PP_IIF(c, MITK_PP_FOR_89, MITK_PP_TUPLE_EAT_4)(MITK_PP_EXPR_IIF(c, o)(89, s), p, o, m)
+# define MITK_PP_FOR_89_C(c, s, p, o, m) MITK_PP_IIF(c, m, MITK_PP_TUPLE_EAT_2)(90, s) MITK_PP_IIF(c, MITK_PP_FOR_90, MITK_PP_TUPLE_EAT_4)(MITK_PP_EXPR_IIF(c, o)(90, s), p, o, m)
+# define MITK_PP_FOR_90_C(c, s, p, o, m) MITK_PP_IIF(c, m, MITK_PP_TUPLE_EAT_2)(91, s) MITK_PP_IIF(c, MITK_PP_FOR_91, MITK_PP_TUPLE_EAT_4)(MITK_PP_EXPR_IIF(c, o)(91, s), p, o, m)
+# define MITK_PP_FOR_91_C(c, s, p, o, m) MITK_PP_IIF(c, m, MITK_PP_TUPLE_EAT_2)(92, s) MITK_PP_IIF(c, MITK_PP_FOR_92, MITK_PP_TUPLE_EAT_4)(MITK_PP_EXPR_IIF(c, o)(92, s), p, o, m)
+# define MITK_PP_FOR_92_C(c, s, p, o, m) MITK_PP_IIF(c, m, MITK_PP_TUPLE_EAT_2)(93, s) MITK_PP_IIF(c, MITK_PP_FOR_93, MITK_PP_TUPLE_EAT_4)(MITK_PP_EXPR_IIF(c, o)(93, s), p, o, m)
+# define MITK_PP_FOR_93_C(c, s, p, o, m) MITK_PP_IIF(c, m, MITK_PP_TUPLE_EAT_2)(94, s) MITK_PP_IIF(c, MITK_PP_FOR_94, MITK_PP_TUPLE_EAT_4)(MITK_PP_EXPR_IIF(c, o)(94, s), p, o, m)
+# define MITK_PP_FOR_94_C(c, s, p, o, m) MITK_PP_IIF(c, m, MITK_PP_TUPLE_EAT_2)(95, s) MITK_PP_IIF(c, MITK_PP_FOR_95, MITK_PP_TUPLE_EAT_4)(MITK_PP_EXPR_IIF(c, o)(95, s), p, o, m)
+# define MITK_PP_FOR_95_C(c, s, p, o, m) MITK_PP_IIF(c, m, MITK_PP_TUPLE_EAT_2)(96, s) MITK_PP_IIF(c, MITK_PP_FOR_96, MITK_PP_TUPLE_EAT_4)(MITK_PP_EXPR_IIF(c, o)(96, s), p, o, m)
+# define MITK_PP_FOR_96_C(c, s, p, o, m) MITK_PP_IIF(c, m, MITK_PP_TUPLE_EAT_2)(97, s) MITK_PP_IIF(c, MITK_PP_FOR_97, MITK_PP_TUPLE_EAT_4)(MITK_PP_EXPR_IIF(c, o)(97, s), p, o, m)
+# define MITK_PP_FOR_97_C(c, s, p, o, m) MITK_PP_IIF(c, m, MITK_PP_TUPLE_EAT_2)(98, s) MITK_PP_IIF(c, MITK_PP_FOR_98, MITK_PP_TUPLE_EAT_4)(MITK_PP_EXPR_IIF(c, o)(98, s), p, o, m)
+# define MITK_PP_FOR_98_C(c, s, p, o, m) MITK_PP_IIF(c, m, MITK_PP_TUPLE_EAT_2)(99, s) MITK_PP_IIF(c, MITK_PP_FOR_99, MITK_PP_TUPLE_EAT_4)(MITK_PP_EXPR_IIF(c, o)(99, s), p, o, m)
+# define MITK_PP_FOR_99_C(c, s, p, o, m) MITK_PP_IIF(c, m, MITK_PP_TUPLE_EAT_2)(100, s) MITK_PP_IIF(c, MITK_PP_FOR_100, MITK_PP_TUPLE_EAT_4)(MITK_PP_EXPR_IIF(c, o)(100, s), p, o, m)
+# define MITK_PP_FOR_100_C(c, s, p, o, m) MITK_PP_IIF(c, m, MITK_PP_TUPLE_EAT_2)(101, s) MITK_PP_IIF(c, MITK_PP_FOR_101, MITK_PP_TUPLE_EAT_4)(MITK_PP_EXPR_IIF(c, o)(101, s), p, o, m)
+# define MITK_PP_FOR_101_C(c, s, p, o, m) MITK_PP_IIF(c, m, MITK_PP_TUPLE_EAT_2)(102, s) MITK_PP_IIF(c, MITK_PP_FOR_102, MITK_PP_TUPLE_EAT_4)(MITK_PP_EXPR_IIF(c, o)(102, s), p, o, m)
+# define MITK_PP_FOR_102_C(c, s, p, o, m) MITK_PP_IIF(c, m, MITK_PP_TUPLE_EAT_2)(103, s) MITK_PP_IIF(c, MITK_PP_FOR_103, MITK_PP_TUPLE_EAT_4)(MITK_PP_EXPR_IIF(c, o)(103, s), p, o, m)
+# define MITK_PP_FOR_103_C(c, s, p, o, m) MITK_PP_IIF(c, m, MITK_PP_TUPLE_EAT_2)(104, s) MITK_PP_IIF(c, MITK_PP_FOR_104, MITK_PP_TUPLE_EAT_4)(MITK_PP_EXPR_IIF(c, o)(104, s), p, o, m)
+# define MITK_PP_FOR_104_C(c, s, p, o, m) MITK_PP_IIF(c, m, MITK_PP_TUPLE_EAT_2)(105, s) MITK_PP_IIF(c, MITK_PP_FOR_105, MITK_PP_TUPLE_EAT_4)(MITK_PP_EXPR_IIF(c, o)(105, s), p, o, m)
+# define MITK_PP_FOR_105_C(c, s, p, o, m) MITK_PP_IIF(c, m, MITK_PP_TUPLE_EAT_2)(106, s) MITK_PP_IIF(c, MITK_PP_FOR_106, MITK_PP_TUPLE_EAT_4)(MITK_PP_EXPR_IIF(c, o)(106, s), p, o, m)
+# define MITK_PP_FOR_106_C(c, s, p, o, m) MITK_PP_IIF(c, m, MITK_PP_TUPLE_EAT_2)(107, s) MITK_PP_IIF(c, MITK_PP_FOR_107, MITK_PP_TUPLE_EAT_4)(MITK_PP_EXPR_IIF(c, o)(107, s), p, o, m)
+# define MITK_PP_FOR_107_C(c, s, p, o, m) MITK_PP_IIF(c, m, MITK_PP_TUPLE_EAT_2)(108, s) MITK_PP_IIF(c, MITK_PP_FOR_108, MITK_PP_TUPLE_EAT_4)(MITK_PP_EXPR_IIF(c, o)(108, s), p, o, m)
+# define MITK_PP_FOR_108_C(c, s, p, o, m) MITK_PP_IIF(c, m, MITK_PP_TUPLE_EAT_2)(109, s) MITK_PP_IIF(c, MITK_PP_FOR_109, MITK_PP_TUPLE_EAT_4)(MITK_PP_EXPR_IIF(c, o)(109, s), p, o, m)
+# define MITK_PP_FOR_109_C(c, s, p, o, m) MITK_PP_IIF(c, m, MITK_PP_TUPLE_EAT_2)(110, s) MITK_PP_IIF(c, MITK_PP_FOR_110, MITK_PP_TUPLE_EAT_4)(MITK_PP_EXPR_IIF(c, o)(110, s), p, o, m)
+# define MITK_PP_FOR_110_C(c, s, p, o, m) MITK_PP_IIF(c, m, MITK_PP_TUPLE_EAT_2)(111, s) MITK_PP_IIF(c, MITK_PP_FOR_111, MITK_PP_TUPLE_EAT_4)(MITK_PP_EXPR_IIF(c, o)(111, s), p, o, m)
+# define MITK_PP_FOR_111_C(c, s, p, o, m) MITK_PP_IIF(c, m, MITK_PP_TUPLE_EAT_2)(112, s) MITK_PP_IIF(c, MITK_PP_FOR_112, MITK_PP_TUPLE_EAT_4)(MITK_PP_EXPR_IIF(c, o)(112, s), p, o, m)
+# define MITK_PP_FOR_112_C(c, s, p, o, m) MITK_PP_IIF(c, m, MITK_PP_TUPLE_EAT_2)(113, s) MITK_PP_IIF(c, MITK_PP_FOR_113, MITK_PP_TUPLE_EAT_4)(MITK_PP_EXPR_IIF(c, o)(113, s), p, o, m)
+# define MITK_PP_FOR_113_C(c, s, p, o, m) MITK_PP_IIF(c, m, MITK_PP_TUPLE_EAT_2)(114, s) MITK_PP_IIF(c, MITK_PP_FOR_114, MITK_PP_TUPLE_EAT_4)(MITK_PP_EXPR_IIF(c, o)(114, s), p, o, m)
+# define MITK_PP_FOR_114_C(c, s, p, o, m) MITK_PP_IIF(c, m, MITK_PP_TUPLE_EAT_2)(115, s) MITK_PP_IIF(c, MITK_PP_FOR_115, MITK_PP_TUPLE_EAT_4)(MITK_PP_EXPR_IIF(c, o)(115, s), p, o, m)
+# define MITK_PP_FOR_115_C(c, s, p, o, m) MITK_PP_IIF(c, m, MITK_PP_TUPLE_EAT_2)(116, s) MITK_PP_IIF(c, MITK_PP_FOR_116, MITK_PP_TUPLE_EAT_4)(MITK_PP_EXPR_IIF(c, o)(116, s), p, o, m)
+# define MITK_PP_FOR_116_C(c, s, p, o, m) MITK_PP_IIF(c, m, MITK_PP_TUPLE_EAT_2)(117, s) MITK_PP_IIF(c, MITK_PP_FOR_117, MITK_PP_TUPLE_EAT_4)(MITK_PP_EXPR_IIF(c, o)(117, s), p, o, m)
+# define MITK_PP_FOR_117_C(c, s, p, o, m) MITK_PP_IIF(c, m, MITK_PP_TUPLE_EAT_2)(118, s) MITK_PP_IIF(c, MITK_PP_FOR_118, MITK_PP_TUPLE_EAT_4)(MITK_PP_EXPR_IIF(c, o)(118, s), p, o, m)
+# define MITK_PP_FOR_118_C(c, s, p, o, m) MITK_PP_IIF(c, m, MITK_PP_TUPLE_EAT_2)(119, s) MITK_PP_IIF(c, MITK_PP_FOR_119, MITK_PP_TUPLE_EAT_4)(MITK_PP_EXPR_IIF(c, o)(119, s), p, o, m)
+# define MITK_PP_FOR_119_C(c, s, p, o, m) MITK_PP_IIF(c, m, MITK_PP_TUPLE_EAT_2)(120, s) MITK_PP_IIF(c, MITK_PP_FOR_120, MITK_PP_TUPLE_EAT_4)(MITK_PP_EXPR_IIF(c, o)(120, s), p, o, m)
+# define MITK_PP_FOR_120_C(c, s, p, o, m) MITK_PP_IIF(c, m, MITK_PP_TUPLE_EAT_2)(121, s) MITK_PP_IIF(c, MITK_PP_FOR_121, MITK_PP_TUPLE_EAT_4)(MITK_PP_EXPR_IIF(c, o)(121, s), p, o, m)
+# define MITK_PP_FOR_121_C(c, s, p, o, m) MITK_PP_IIF(c, m, MITK_PP_TUPLE_EAT_2)(122, s) MITK_PP_IIF(c, MITK_PP_FOR_122, MITK_PP_TUPLE_EAT_4)(MITK_PP_EXPR_IIF(c, o)(122, s), p, o, m)
+# define MITK_PP_FOR_122_C(c, s, p, o, m) MITK_PP_IIF(c, m, MITK_PP_TUPLE_EAT_2)(123, s) MITK_PP_IIF(c, MITK_PP_FOR_123, MITK_PP_TUPLE_EAT_4)(MITK_PP_EXPR_IIF(c, o)(123, s), p, o, m)
+# define MITK_PP_FOR_123_C(c, s, p, o, m) MITK_PP_IIF(c, m, MITK_PP_TUPLE_EAT_2)(124, s) MITK_PP_IIF(c, MITK_PP_FOR_124, MITK_PP_TUPLE_EAT_4)(MITK_PP_EXPR_IIF(c, o)(124, s), p, o, m)
+# define MITK_PP_FOR_124_C(c, s, p, o, m) MITK_PP_IIF(c, m, MITK_PP_TUPLE_EAT_2)(125, s) MITK_PP_IIF(c, MITK_PP_FOR_125, MITK_PP_TUPLE_EAT_4)(MITK_PP_EXPR_IIF(c, o)(125, s), p, o, m)
+# define MITK_PP_FOR_125_C(c, s, p, o, m) MITK_PP_IIF(c, m, MITK_PP_TUPLE_EAT_2)(126, s) MITK_PP_IIF(c, MITK_PP_FOR_126, MITK_PP_TUPLE_EAT_4)(MITK_PP_EXPR_IIF(c, o)(126, s), p, o, m)
+# define MITK_PP_FOR_126_C(c, s, p, o, m) MITK_PP_IIF(c, m, MITK_PP_TUPLE_EAT_2)(127, s) MITK_PP_IIF(c, MITK_PP_FOR_127, MITK_PP_TUPLE_EAT_4)(MITK_PP_EXPR_IIF(c, o)(127, s), p, o, m)
+# define MITK_PP_FOR_127_C(c, s, p, o, m) MITK_PP_IIF(c, m, MITK_PP_TUPLE_EAT_2)(128, s) MITK_PP_IIF(c, MITK_PP_FOR_128, MITK_PP_TUPLE_EAT_4)(MITK_PP_EXPR_IIF(c, o)(128, s), p, o, m)
+# define MITK_PP_FOR_128_C(c, s, p, o, m) MITK_PP_IIF(c, m, MITK_PP_TUPLE_EAT_2)(129, s) MITK_PP_IIF(c, MITK_PP_FOR_129, MITK_PP_TUPLE_EAT_4)(MITK_PP_EXPR_IIF(c, o)(129, s), p, o, m)
+# define MITK_PP_FOR_129_C(c, s, p, o, m) MITK_PP_IIF(c, m, MITK_PP_TUPLE_EAT_2)(130, s) MITK_PP_IIF(c, MITK_PP_FOR_130, MITK_PP_TUPLE_EAT_4)(MITK_PP_EXPR_IIF(c, o)(130, s), p, o, m)
+# define MITK_PP_FOR_130_C(c, s, p, o, m) MITK_PP_IIF(c, m, MITK_PP_TUPLE_EAT_2)(131, s) MITK_PP_IIF(c, MITK_PP_FOR_131, MITK_PP_TUPLE_EAT_4)(MITK_PP_EXPR_IIF(c, o)(131, s), p, o, m)
+# define MITK_PP_FOR_131_C(c, s, p, o, m) MITK_PP_IIF(c, m, MITK_PP_TUPLE_EAT_2)(132, s) MITK_PP_IIF(c, MITK_PP_FOR_132, MITK_PP_TUPLE_EAT_4)(MITK_PP_EXPR_IIF(c, o)(132, s), p, o, m)
+# define MITK_PP_FOR_132_C(c, s, p, o, m) MITK_PP_IIF(c, m, MITK_PP_TUPLE_EAT_2)(133, s) MITK_PP_IIF(c, MITK_PP_FOR_133, MITK_PP_TUPLE_EAT_4)(MITK_PP_EXPR_IIF(c, o)(133, s), p, o, m)
+# define MITK_PP_FOR_133_C(c, s, p, o, m) MITK_PP_IIF(c, m, MITK_PP_TUPLE_EAT_2)(134, s) MITK_PP_IIF(c, MITK_PP_FOR_134, MITK_PP_TUPLE_EAT_4)(MITK_PP_EXPR_IIF(c, o)(134, s), p, o, m)
+# define MITK_PP_FOR_134_C(c, s, p, o, m) MITK_PP_IIF(c, m, MITK_PP_TUPLE_EAT_2)(135, s) MITK_PP_IIF(c, MITK_PP_FOR_135, MITK_PP_TUPLE_EAT_4)(MITK_PP_EXPR_IIF(c, o)(135, s), p, o, m)
+# define MITK_PP_FOR_135_C(c, s, p, o, m) MITK_PP_IIF(c, m, MITK_PP_TUPLE_EAT_2)(136, s) MITK_PP_IIF(c, MITK_PP_FOR_136, MITK_PP_TUPLE_EAT_4)(MITK_PP_EXPR_IIF(c, o)(136, s), p, o, m)
+# define MITK_PP_FOR_136_C(c, s, p, o, m) MITK_PP_IIF(c, m, MITK_PP_TUPLE_EAT_2)(137, s) MITK_PP_IIF(c, MITK_PP_FOR_137, MITK_PP_TUPLE_EAT_4)(MITK_PP_EXPR_IIF(c, o)(137, s), p, o, m)
+# define MITK_PP_FOR_137_C(c, s, p, o, m) MITK_PP_IIF(c, m, MITK_PP_TUPLE_EAT_2)(138, s) MITK_PP_IIF(c, MITK_PP_FOR_138, MITK_PP_TUPLE_EAT_4)(MITK_PP_EXPR_IIF(c, o)(138, s), p, o, m)
+# define MITK_PP_FOR_138_C(c, s, p, o, m) MITK_PP_IIF(c, m, MITK_PP_TUPLE_EAT_2)(139, s) MITK_PP_IIF(c, MITK_PP_FOR_139, MITK_PP_TUPLE_EAT_4)(MITK_PP_EXPR_IIF(c, o)(139, s), p, o, m)
+# define MITK_PP_FOR_139_C(c, s, p, o, m) MITK_PP_IIF(c, m, MITK_PP_TUPLE_EAT_2)(140, s) MITK_PP_IIF(c, MITK_PP_FOR_140, MITK_PP_TUPLE_EAT_4)(MITK_PP_EXPR_IIF(c, o)(140, s), p, o, m)
+# define MITK_PP_FOR_140_C(c, s, p, o, m) MITK_PP_IIF(c, m, MITK_PP_TUPLE_EAT_2)(141, s) MITK_PP_IIF(c, MITK_PP_FOR_141, MITK_PP_TUPLE_EAT_4)(MITK_PP_EXPR_IIF(c, o)(141, s), p, o, m)
+# define MITK_PP_FOR_141_C(c, s, p, o, m) MITK_PP_IIF(c, m, MITK_PP_TUPLE_EAT_2)(142, s) MITK_PP_IIF(c, MITK_PP_FOR_142, MITK_PP_TUPLE_EAT_4)(MITK_PP_EXPR_IIF(c, o)(142, s), p, o, m)
+# define MITK_PP_FOR_142_C(c, s, p, o, m) MITK_PP_IIF(c, m, MITK_PP_TUPLE_EAT_2)(143, s) MITK_PP_IIF(c, MITK_PP_FOR_143, MITK_PP_TUPLE_EAT_4)(MITK_PP_EXPR_IIF(c, o)(143, s), p, o, m)
+# define MITK_PP_FOR_143_C(c, s, p, o, m) MITK_PP_IIF(c, m, MITK_PP_TUPLE_EAT_2)(144, s) MITK_PP_IIF(c, MITK_PP_FOR_144, MITK_PP_TUPLE_EAT_4)(MITK_PP_EXPR_IIF(c, o)(144, s), p, o, m)
+# define MITK_PP_FOR_144_C(c, s, p, o, m) MITK_PP_IIF(c, m, MITK_PP_TUPLE_EAT_2)(145, s) MITK_PP_IIF(c, MITK_PP_FOR_145, MITK_PP_TUPLE_EAT_4)(MITK_PP_EXPR_IIF(c, o)(145, s), p, o, m)
+# define MITK_PP_FOR_145_C(c, s, p, o, m) MITK_PP_IIF(c, m, MITK_PP_TUPLE_EAT_2)(146, s) MITK_PP_IIF(c, MITK_PP_FOR_146, MITK_PP_TUPLE_EAT_4)(MITK_PP_EXPR_IIF(c, o)(146, s), p, o, m)
+# define MITK_PP_FOR_146_C(c, s, p, o, m) MITK_PP_IIF(c, m, MITK_PP_TUPLE_EAT_2)(147, s) MITK_PP_IIF(c, MITK_PP_FOR_147, MITK_PP_TUPLE_EAT_4)(MITK_PP_EXPR_IIF(c, o)(147, s), p, o, m)
+# define MITK_PP_FOR_147_C(c, s, p, o, m) MITK_PP_IIF(c, m, MITK_PP_TUPLE_EAT_2)(148, s) MITK_PP_IIF(c, MITK_PP_FOR_148, MITK_PP_TUPLE_EAT_4)(MITK_PP_EXPR_IIF(c, o)(148, s), p, o, m)
+# define MITK_PP_FOR_148_C(c, s, p, o, m) MITK_PP_IIF(c, m, MITK_PP_TUPLE_EAT_2)(149, s) MITK_PP_IIF(c, MITK_PP_FOR_149, MITK_PP_TUPLE_EAT_4)(MITK_PP_EXPR_IIF(c, o)(149, s), p, o, m)
+# define MITK_PP_FOR_149_C(c, s, p, o, m) MITK_PP_IIF(c, m, MITK_PP_TUPLE_EAT_2)(150, s) MITK_PP_IIF(c, MITK_PP_FOR_150, MITK_PP_TUPLE_EAT_4)(MITK_PP_EXPR_IIF(c, o)(150, s), p, o, m)
+# define MITK_PP_FOR_150_C(c, s, p, o, m) MITK_PP_IIF(c, m, MITK_PP_TUPLE_EAT_2)(151, s) MITK_PP_IIF(c, MITK_PP_FOR_151, MITK_PP_TUPLE_EAT_4)(MITK_PP_EXPR_IIF(c, o)(151, s), p, o, m)
+# define MITK_PP_FOR_151_C(c, s, p, o, m) MITK_PP_IIF(c, m, MITK_PP_TUPLE_EAT_2)(152, s) MITK_PP_IIF(c, MITK_PP_FOR_152, MITK_PP_TUPLE_EAT_4)(MITK_PP_EXPR_IIF(c, o)(152, s), p, o, m)
+# define MITK_PP_FOR_152_C(c, s, p, o, m) MITK_PP_IIF(c, m, MITK_PP_TUPLE_EAT_2)(153, s) MITK_PP_IIF(c, MITK_PP_FOR_153, MITK_PP_TUPLE_EAT_4)(MITK_PP_EXPR_IIF(c, o)(153, s), p, o, m)
+# define MITK_PP_FOR_153_C(c, s, p, o, m) MITK_PP_IIF(c, m, MITK_PP_TUPLE_EAT_2)(154, s) MITK_PP_IIF(c, MITK_PP_FOR_154, MITK_PP_TUPLE_EAT_4)(MITK_PP_EXPR_IIF(c, o)(154, s), p, o, m)
+# define MITK_PP_FOR_154_C(c, s, p, o, m) MITK_PP_IIF(c, m, MITK_PP_TUPLE_EAT_2)(155, s) MITK_PP_IIF(c, MITK_PP_FOR_155, MITK_PP_TUPLE_EAT_4)(MITK_PP_EXPR_IIF(c, o)(155, s), p, o, m)
+# define MITK_PP_FOR_155_C(c, s, p, o, m) MITK_PP_IIF(c, m, MITK_PP_TUPLE_EAT_2)(156, s) MITK_PP_IIF(c, MITK_PP_FOR_156, MITK_PP_TUPLE_EAT_4)(MITK_PP_EXPR_IIF(c, o)(156, s), p, o, m)
+# define MITK_PP_FOR_156_C(c, s, p, o, m) MITK_PP_IIF(c, m, MITK_PP_TUPLE_EAT_2)(157, s) MITK_PP_IIF(c, MITK_PP_FOR_157, MITK_PP_TUPLE_EAT_4)(MITK_PP_EXPR_IIF(c, o)(157, s), p, o, m)
+# define MITK_PP_FOR_157_C(c, s, p, o, m) MITK_PP_IIF(c, m, MITK_PP_TUPLE_EAT_2)(158, s) MITK_PP_IIF(c, MITK_PP_FOR_158, MITK_PP_TUPLE_EAT_4)(MITK_PP_EXPR_IIF(c, o)(158, s), p, o, m)
+# define MITK_PP_FOR_158_C(c, s, p, o, m) MITK_PP_IIF(c, m, MITK_PP_TUPLE_EAT_2)(159, s) MITK_PP_IIF(c, MITK_PP_FOR_159, MITK_PP_TUPLE_EAT_4)(MITK_PP_EXPR_IIF(c, o)(159, s), p, o, m)
+# define MITK_PP_FOR_159_C(c, s, p, o, m) MITK_PP_IIF(c, m, MITK_PP_TUPLE_EAT_2)(160, s) MITK_PP_IIF(c, MITK_PP_FOR_160, MITK_PP_TUPLE_EAT_4)(MITK_PP_EXPR_IIF(c, o)(160, s), p, o, m)
+# define MITK_PP_FOR_160_C(c, s, p, o, m) MITK_PP_IIF(c, m, MITK_PP_TUPLE_EAT_2)(161, s) MITK_PP_IIF(c, MITK_PP_FOR_161, MITK_PP_TUPLE_EAT_4)(MITK_PP_EXPR_IIF(c, o)(161, s), p, o, m)
+# define MITK_PP_FOR_161_C(c, s, p, o, m) MITK_PP_IIF(c, m, MITK_PP_TUPLE_EAT_2)(162, s) MITK_PP_IIF(c, MITK_PP_FOR_162, MITK_PP_TUPLE_EAT_4)(MITK_PP_EXPR_IIF(c, o)(162, s), p, o, m)
+# define MITK_PP_FOR_162_C(c, s, p, o, m) MITK_PP_IIF(c, m, MITK_PP_TUPLE_EAT_2)(163, s) MITK_PP_IIF(c, MITK_PP_FOR_163, MITK_PP_TUPLE_EAT_4)(MITK_PP_EXPR_IIF(c, o)(163, s), p, o, m)
+# define MITK_PP_FOR_163_C(c, s, p, o, m) MITK_PP_IIF(c, m, MITK_PP_TUPLE_EAT_2)(164, s) MITK_PP_IIF(c, MITK_PP_FOR_164, MITK_PP_TUPLE_EAT_4)(MITK_PP_EXPR_IIF(c, o)(164, s), p, o, m)
+# define MITK_PP_FOR_164_C(c, s, p, o, m) MITK_PP_IIF(c, m, MITK_PP_TUPLE_EAT_2)(165, s) MITK_PP_IIF(c, MITK_PP_FOR_165, MITK_PP_TUPLE_EAT_4)(MITK_PP_EXPR_IIF(c, o)(165, s), p, o, m)
+# define MITK_PP_FOR_165_C(c, s, p, o, m) MITK_PP_IIF(c, m, MITK_PP_TUPLE_EAT_2)(166, s) MITK_PP_IIF(c, MITK_PP_FOR_166, MITK_PP_TUPLE_EAT_4)(MITK_PP_EXPR_IIF(c, o)(166, s), p, o, m)
+# define MITK_PP_FOR_166_C(c, s, p, o, m) MITK_PP_IIF(c, m, MITK_PP_TUPLE_EAT_2)(167, s) MITK_PP_IIF(c, MITK_PP_FOR_167, MITK_PP_TUPLE_EAT_4)(MITK_PP_EXPR_IIF(c, o)(167, s), p, o, m)
+# define MITK_PP_FOR_167_C(c, s, p, o, m) MITK_PP_IIF(c, m, MITK_PP_TUPLE_EAT_2)(168, s) MITK_PP_IIF(c, MITK_PP_FOR_168, MITK_PP_TUPLE_EAT_4)(MITK_PP_EXPR_IIF(c, o)(168, s), p, o, m)
+# define MITK_PP_FOR_168_C(c, s, p, o, m) MITK_PP_IIF(c, m, MITK_PP_TUPLE_EAT_2)(169, s) MITK_PP_IIF(c, MITK_PP_FOR_169, MITK_PP_TUPLE_EAT_4)(MITK_PP_EXPR_IIF(c, o)(169, s), p, o, m)
+# define MITK_PP_FOR_169_C(c, s, p, o, m) MITK_PP_IIF(c, m, MITK_PP_TUPLE_EAT_2)(170, s) MITK_PP_IIF(c, MITK_PP_FOR_170, MITK_PP_TUPLE_EAT_4)(MITK_PP_EXPR_IIF(c, o)(170, s), p, o, m)
+# define MITK_PP_FOR_170_C(c, s, p, o, m) MITK_PP_IIF(c, m, MITK_PP_TUPLE_EAT_2)(171, s) MITK_PP_IIF(c, MITK_PP_FOR_171, MITK_PP_TUPLE_EAT_4)(MITK_PP_EXPR_IIF(c, o)(171, s), p, o, m)
+# define MITK_PP_FOR_171_C(c, s, p, o, m) MITK_PP_IIF(c, m, MITK_PP_TUPLE_EAT_2)(172, s) MITK_PP_IIF(c, MITK_PP_FOR_172, MITK_PP_TUPLE_EAT_4)(MITK_PP_EXPR_IIF(c, o)(172, s), p, o, m)
+# define MITK_PP_FOR_172_C(c, s, p, o, m) MITK_PP_IIF(c, m, MITK_PP_TUPLE_EAT_2)(173, s) MITK_PP_IIF(c, MITK_PP_FOR_173, MITK_PP_TUPLE_EAT_4)(MITK_PP_EXPR_IIF(c, o)(173, s), p, o, m)
+# define MITK_PP_FOR_173_C(c, s, p, o, m) MITK_PP_IIF(c, m, MITK_PP_TUPLE_EAT_2)(174, s) MITK_PP_IIF(c, MITK_PP_FOR_174, MITK_PP_TUPLE_EAT_4)(MITK_PP_EXPR_IIF(c, o)(174, s), p, o, m)
+# define MITK_PP_FOR_174_C(c, s, p, o, m) MITK_PP_IIF(c, m, MITK_PP_TUPLE_EAT_2)(175, s) MITK_PP_IIF(c, MITK_PP_FOR_175, MITK_PP_TUPLE_EAT_4)(MITK_PP_EXPR_IIF(c, o)(175, s), p, o, m)
+# define MITK_PP_FOR_175_C(c, s, p, o, m) MITK_PP_IIF(c, m, MITK_PP_TUPLE_EAT_2)(176, s) MITK_PP_IIF(c, MITK_PP_FOR_176, MITK_PP_TUPLE_EAT_4)(MITK_PP_EXPR_IIF(c, o)(176, s), p, o, m)
+# define MITK_PP_FOR_176_C(c, s, p, o, m) MITK_PP_IIF(c, m, MITK_PP_TUPLE_EAT_2)(177, s) MITK_PP_IIF(c, MITK_PP_FOR_177, MITK_PP_TUPLE_EAT_4)(MITK_PP_EXPR_IIF(c, o)(177, s), p, o, m)
+# define MITK_PP_FOR_177_C(c, s, p, o, m) MITK_PP_IIF(c, m, MITK_PP_TUPLE_EAT_2)(178, s) MITK_PP_IIF(c, MITK_PP_FOR_178, MITK_PP_TUPLE_EAT_4)(MITK_PP_EXPR_IIF(c, o)(178, s), p, o, m)
+# define MITK_PP_FOR_178_C(c, s, p, o, m) MITK_PP_IIF(c, m, MITK_PP_TUPLE_EAT_2)(179, s) MITK_PP_IIF(c, MITK_PP_FOR_179, MITK_PP_TUPLE_EAT_4)(MITK_PP_EXPR_IIF(c, o)(179, s), p, o, m)
+# define MITK_PP_FOR_179_C(c, s, p, o, m) MITK_PP_IIF(c, m, MITK_PP_TUPLE_EAT_2)(180, s) MITK_PP_IIF(c, MITK_PP_FOR_180, MITK_PP_TUPLE_EAT_4)(MITK_PP_EXPR_IIF(c, o)(180, s), p, o, m)
+# define MITK_PP_FOR_180_C(c, s, p, o, m) MITK_PP_IIF(c, m, MITK_PP_TUPLE_EAT_2)(181, s) MITK_PP_IIF(c, MITK_PP_FOR_181, MITK_PP_TUPLE_EAT_4)(MITK_PP_EXPR_IIF(c, o)(181, s), p, o, m)
+# define MITK_PP_FOR_181_C(c, s, p, o, m) MITK_PP_IIF(c, m, MITK_PP_TUPLE_EAT_2)(182, s) MITK_PP_IIF(c, MITK_PP_FOR_182, MITK_PP_TUPLE_EAT_4)(MITK_PP_EXPR_IIF(c, o)(182, s), p, o, m)
+# define MITK_PP_FOR_182_C(c, s, p, o, m) MITK_PP_IIF(c, m, MITK_PP_TUPLE_EAT_2)(183, s) MITK_PP_IIF(c, MITK_PP_FOR_183, MITK_PP_TUPLE_EAT_4)(MITK_PP_EXPR_IIF(c, o)(183, s), p, o, m)
+# define MITK_PP_FOR_183_C(c, s, p, o, m) MITK_PP_IIF(c, m, MITK_PP_TUPLE_EAT_2)(184, s) MITK_PP_IIF(c, MITK_PP_FOR_184, MITK_PP_TUPLE_EAT_4)(MITK_PP_EXPR_IIF(c, o)(184, s), p, o, m)
+# define MITK_PP_FOR_184_C(c, s, p, o, m) MITK_PP_IIF(c, m, MITK_PP_TUPLE_EAT_2)(185, s) MITK_PP_IIF(c, MITK_PP_FOR_185, MITK_PP_TUPLE_EAT_4)(MITK_PP_EXPR_IIF(c, o)(185, s), p, o, m)
+# define MITK_PP_FOR_185_C(c, s, p, o, m) MITK_PP_IIF(c, m, MITK_PP_TUPLE_EAT_2)(186, s) MITK_PP_IIF(c, MITK_PP_FOR_186, MITK_PP_TUPLE_EAT_4)(MITK_PP_EXPR_IIF(c, o)(186, s), p, o, m)
+# define MITK_PP_FOR_186_C(c, s, p, o, m) MITK_PP_IIF(c, m, MITK_PP_TUPLE_EAT_2)(187, s) MITK_PP_IIF(c, MITK_PP_FOR_187, MITK_PP_TUPLE_EAT_4)(MITK_PP_EXPR_IIF(c, o)(187, s), p, o, m)
+# define MITK_PP_FOR_187_C(c, s, p, o, m) MITK_PP_IIF(c, m, MITK_PP_TUPLE_EAT_2)(188, s) MITK_PP_IIF(c, MITK_PP_FOR_188, MITK_PP_TUPLE_EAT_4)(MITK_PP_EXPR_IIF(c, o)(188, s), p, o, m)
+# define MITK_PP_FOR_188_C(c, s, p, o, m) MITK_PP_IIF(c, m, MITK_PP_TUPLE_EAT_2)(189, s) MITK_PP_IIF(c, MITK_PP_FOR_189, MITK_PP_TUPLE_EAT_4)(MITK_PP_EXPR_IIF(c, o)(189, s), p, o, m)
+# define MITK_PP_FOR_189_C(c, s, p, o, m) MITK_PP_IIF(c, m, MITK_PP_TUPLE_EAT_2)(190, s) MITK_PP_IIF(c, MITK_PP_FOR_190, MITK_PP_TUPLE_EAT_4)(MITK_PP_EXPR_IIF(c, o)(190, s), p, o, m)
+# define MITK_PP_FOR_190_C(c, s, p, o, m) MITK_PP_IIF(c, m, MITK_PP_TUPLE_EAT_2)(191, s) MITK_PP_IIF(c, MITK_PP_FOR_191, MITK_PP_TUPLE_EAT_4)(MITK_PP_EXPR_IIF(c, o)(191, s), p, o, m)
+# define MITK_PP_FOR_191_C(c, s, p, o, m) MITK_PP_IIF(c, m, MITK_PP_TUPLE_EAT_2)(192, s) MITK_PP_IIF(c, MITK_PP_FOR_192, MITK_PP_TUPLE_EAT_4)(MITK_PP_EXPR_IIF(c, o)(192, s), p, o, m)
+# define MITK_PP_FOR_192_C(c, s, p, o, m) MITK_PP_IIF(c, m, MITK_PP_TUPLE_EAT_2)(193, s) MITK_PP_IIF(c, MITK_PP_FOR_193, MITK_PP_TUPLE_EAT_4)(MITK_PP_EXPR_IIF(c, o)(193, s), p, o, m)
+# define MITK_PP_FOR_193_C(c, s, p, o, m) MITK_PP_IIF(c, m, MITK_PP_TUPLE_EAT_2)(194, s) MITK_PP_IIF(c, MITK_PP_FOR_194, MITK_PP_TUPLE_EAT_4)(MITK_PP_EXPR_IIF(c, o)(194, s), p, o, m)
+# define MITK_PP_FOR_194_C(c, s, p, o, m) MITK_PP_IIF(c, m, MITK_PP_TUPLE_EAT_2)(195, s) MITK_PP_IIF(c, MITK_PP_FOR_195, MITK_PP_TUPLE_EAT_4)(MITK_PP_EXPR_IIF(c, o)(195, s), p, o, m)
+# define MITK_PP_FOR_195_C(c, s, p, o, m) MITK_PP_IIF(c, m, MITK_PP_TUPLE_EAT_2)(196, s) MITK_PP_IIF(c, MITK_PP_FOR_196, MITK_PP_TUPLE_EAT_4)(MITK_PP_EXPR_IIF(c, o)(196, s), p, o, m)
+# define MITK_PP_FOR_196_C(c, s, p, o, m) MITK_PP_IIF(c, m, MITK_PP_TUPLE_EAT_2)(197, s) MITK_PP_IIF(c, MITK_PP_FOR_197, MITK_PP_TUPLE_EAT_4)(MITK_PP_EXPR_IIF(c, o)(197, s), p, o, m)
+# define MITK_PP_FOR_197_C(c, s, p, o, m) MITK_PP_IIF(c, m, MITK_PP_TUPLE_EAT_2)(198, s) MITK_PP_IIF(c, MITK_PP_FOR_198, MITK_PP_TUPLE_EAT_4)(MITK_PP_EXPR_IIF(c, o)(198, s), p, o, m)
+# define MITK_PP_FOR_198_C(c, s, p, o, m) MITK_PP_IIF(c, m, MITK_PP_TUPLE_EAT_2)(199, s) MITK_PP_IIF(c, MITK_PP_FOR_199, MITK_PP_TUPLE_EAT_4)(MITK_PP_EXPR_IIF(c, o)(199, s), p, o, m)
+# define MITK_PP_FOR_199_C(c, s, p, o, m) MITK_PP_IIF(c, m, MITK_PP_TUPLE_EAT_2)(200, s) MITK_PP_IIF(c, MITK_PP_FOR_200, MITK_PP_TUPLE_EAT_4)(MITK_PP_EXPR_IIF(c, o)(200, s), p, o, m)
+# define MITK_PP_FOR_200_C(c, s, p, o, m) MITK_PP_IIF(c, m, MITK_PP_TUPLE_EAT_2)(201, s) MITK_PP_IIF(c, MITK_PP_FOR_201, MITK_PP_TUPLE_EAT_4)(MITK_PP_EXPR_IIF(c, o)(201, s), p, o, m)
+# define MITK_PP_FOR_201_C(c, s, p, o, m) MITK_PP_IIF(c, m, MITK_PP_TUPLE_EAT_2)(202, s) MITK_PP_IIF(c, MITK_PP_FOR_202, MITK_PP_TUPLE_EAT_4)(MITK_PP_EXPR_IIF(c, o)(202, s), p, o, m)
+# define MITK_PP_FOR_202_C(c, s, p, o, m) MITK_PP_IIF(c, m, MITK_PP_TUPLE_EAT_2)(203, s) MITK_PP_IIF(c, MITK_PP_FOR_203, MITK_PP_TUPLE_EAT_4)(MITK_PP_EXPR_IIF(c, o)(203, s), p, o, m)
+# define MITK_PP_FOR_203_C(c, s, p, o, m) MITK_PP_IIF(c, m, MITK_PP_TUPLE_EAT_2)(204, s) MITK_PP_IIF(c, MITK_PP_FOR_204, MITK_PP_TUPLE_EAT_4)(MITK_PP_EXPR_IIF(c, o)(204, s), p, o, m)
+# define MITK_PP_FOR_204_C(c, s, p, o, m) MITK_PP_IIF(c, m, MITK_PP_TUPLE_EAT_2)(205, s) MITK_PP_IIF(c, MITK_PP_FOR_205, MITK_PP_TUPLE_EAT_4)(MITK_PP_EXPR_IIF(c, o)(205, s), p, o, m)
+# define MITK_PP_FOR_205_C(c, s, p, o, m) MITK_PP_IIF(c, m, MITK_PP_TUPLE_EAT_2)(206, s) MITK_PP_IIF(c, MITK_PP_FOR_206, MITK_PP_TUPLE_EAT_4)(MITK_PP_EXPR_IIF(c, o)(206, s), p, o, m)
+# define MITK_PP_FOR_206_C(c, s, p, o, m) MITK_PP_IIF(c, m, MITK_PP_TUPLE_EAT_2)(207, s) MITK_PP_IIF(c, MITK_PP_FOR_207, MITK_PP_TUPLE_EAT_4)(MITK_PP_EXPR_IIF(c, o)(207, s), p, o, m)
+# define MITK_PP_FOR_207_C(c, s, p, o, m) MITK_PP_IIF(c, m, MITK_PP_TUPLE_EAT_2)(208, s) MITK_PP_IIF(c, MITK_PP_FOR_208, MITK_PP_TUPLE_EAT_4)(MITK_PP_EXPR_IIF(c, o)(208, s), p, o, m)
+# define MITK_PP_FOR_208_C(c, s, p, o, m) MITK_PP_IIF(c, m, MITK_PP_TUPLE_EAT_2)(209, s) MITK_PP_IIF(c, MITK_PP_FOR_209, MITK_PP_TUPLE_EAT_4)(MITK_PP_EXPR_IIF(c, o)(209, s), p, o, m)
+# define MITK_PP_FOR_209_C(c, s, p, o, m) MITK_PP_IIF(c, m, MITK_PP_TUPLE_EAT_2)(210, s) MITK_PP_IIF(c, MITK_PP_FOR_210, MITK_PP_TUPLE_EAT_4)(MITK_PP_EXPR_IIF(c, o)(210, s), p, o, m)
+# define MITK_PP_FOR_210_C(c, s, p, o, m) MITK_PP_IIF(c, m, MITK_PP_TUPLE_EAT_2)(211, s) MITK_PP_IIF(c, MITK_PP_FOR_211, MITK_PP_TUPLE_EAT_4)(MITK_PP_EXPR_IIF(c, o)(211, s), p, o, m)
+# define MITK_PP_FOR_211_C(c, s, p, o, m) MITK_PP_IIF(c, m, MITK_PP_TUPLE_EAT_2)(212, s) MITK_PP_IIF(c, MITK_PP_FOR_212, MITK_PP_TUPLE_EAT_4)(MITK_PP_EXPR_IIF(c, o)(212, s), p, o, m)
+# define MITK_PP_FOR_212_C(c, s, p, o, m) MITK_PP_IIF(c, m, MITK_PP_TUPLE_EAT_2)(213, s) MITK_PP_IIF(c, MITK_PP_FOR_213, MITK_PP_TUPLE_EAT_4)(MITK_PP_EXPR_IIF(c, o)(213, s), p, o, m)
+# define MITK_PP_FOR_213_C(c, s, p, o, m) MITK_PP_IIF(c, m, MITK_PP_TUPLE_EAT_2)(214, s) MITK_PP_IIF(c, MITK_PP_FOR_214, MITK_PP_TUPLE_EAT_4)(MITK_PP_EXPR_IIF(c, o)(214, s), p, o, m)
+# define MITK_PP_FOR_214_C(c, s, p, o, m) MITK_PP_IIF(c, m, MITK_PP_TUPLE_EAT_2)(215, s) MITK_PP_IIF(c, MITK_PP_FOR_215, MITK_PP_TUPLE_EAT_4)(MITK_PP_EXPR_IIF(c, o)(215, s), p, o, m)
+# define MITK_PP_FOR_215_C(c, s, p, o, m) MITK_PP_IIF(c, m, MITK_PP_TUPLE_EAT_2)(216, s) MITK_PP_IIF(c, MITK_PP_FOR_216, MITK_PP_TUPLE_EAT_4)(MITK_PP_EXPR_IIF(c, o)(216, s), p, o, m)
+# define MITK_PP_FOR_216_C(c, s, p, o, m) MITK_PP_IIF(c, m, MITK_PP_TUPLE_EAT_2)(217, s) MITK_PP_IIF(c, MITK_PP_FOR_217, MITK_PP_TUPLE_EAT_4)(MITK_PP_EXPR_IIF(c, o)(217, s), p, o, m)
+# define MITK_PP_FOR_217_C(c, s, p, o, m) MITK_PP_IIF(c, m, MITK_PP_TUPLE_EAT_2)(218, s) MITK_PP_IIF(c, MITK_PP_FOR_218, MITK_PP_TUPLE_EAT_4)(MITK_PP_EXPR_IIF(c, o)(218, s), p, o, m)
+# define MITK_PP_FOR_218_C(c, s, p, o, m) MITK_PP_IIF(c, m, MITK_PP_TUPLE_EAT_2)(219, s) MITK_PP_IIF(c, MITK_PP_FOR_219, MITK_PP_TUPLE_EAT_4)(MITK_PP_EXPR_IIF(c, o)(219, s), p, o, m)
+# define MITK_PP_FOR_219_C(c, s, p, o, m) MITK_PP_IIF(c, m, MITK_PP_TUPLE_EAT_2)(220, s) MITK_PP_IIF(c, MITK_PP_FOR_220, MITK_PP_TUPLE_EAT_4)(MITK_PP_EXPR_IIF(c, o)(220, s), p, o, m)
+# define MITK_PP_FOR_220_C(c, s, p, o, m) MITK_PP_IIF(c, m, MITK_PP_TUPLE_EAT_2)(221, s) MITK_PP_IIF(c, MITK_PP_FOR_221, MITK_PP_TUPLE_EAT_4)(MITK_PP_EXPR_IIF(c, o)(221, s), p, o, m)
+# define MITK_PP_FOR_221_C(c, s, p, o, m) MITK_PP_IIF(c, m, MITK_PP_TUPLE_EAT_2)(222, s) MITK_PP_IIF(c, MITK_PP_FOR_222, MITK_PP_TUPLE_EAT_4)(MITK_PP_EXPR_IIF(c, o)(222, s), p, o, m)
+# define MITK_PP_FOR_222_C(c, s, p, o, m) MITK_PP_IIF(c, m, MITK_PP_TUPLE_EAT_2)(223, s) MITK_PP_IIF(c, MITK_PP_FOR_223, MITK_PP_TUPLE_EAT_4)(MITK_PP_EXPR_IIF(c, o)(223, s), p, o, m)
+# define MITK_PP_FOR_223_C(c, s, p, o, m) MITK_PP_IIF(c, m, MITK_PP_TUPLE_EAT_2)(224, s) MITK_PP_IIF(c, MITK_PP_FOR_224, MITK_PP_TUPLE_EAT_4)(MITK_PP_EXPR_IIF(c, o)(224, s), p, o, m)
+# define MITK_PP_FOR_224_C(c, s, p, o, m) MITK_PP_IIF(c, m, MITK_PP_TUPLE_EAT_2)(225, s) MITK_PP_IIF(c, MITK_PP_FOR_225, MITK_PP_TUPLE_EAT_4)(MITK_PP_EXPR_IIF(c, o)(225, s), p, o, m)
+# define MITK_PP_FOR_225_C(c, s, p, o, m) MITK_PP_IIF(c, m, MITK_PP_TUPLE_EAT_2)(226, s) MITK_PP_IIF(c, MITK_PP_FOR_226, MITK_PP_TUPLE_EAT_4)(MITK_PP_EXPR_IIF(c, o)(226, s), p, o, m)
+# define MITK_PP_FOR_226_C(c, s, p, o, m) MITK_PP_IIF(c, m, MITK_PP_TUPLE_EAT_2)(227, s) MITK_PP_IIF(c, MITK_PP_FOR_227, MITK_PP_TUPLE_EAT_4)(MITK_PP_EXPR_IIF(c, o)(227, s), p, o, m)
+# define MITK_PP_FOR_227_C(c, s, p, o, m) MITK_PP_IIF(c, m, MITK_PP_TUPLE_EAT_2)(228, s) MITK_PP_IIF(c, MITK_PP_FOR_228, MITK_PP_TUPLE_EAT_4)(MITK_PP_EXPR_IIF(c, o)(228, s), p, o, m)
+# define MITK_PP_FOR_228_C(c, s, p, o, m) MITK_PP_IIF(c, m, MITK_PP_TUPLE_EAT_2)(229, s) MITK_PP_IIF(c, MITK_PP_FOR_229, MITK_PP_TUPLE_EAT_4)(MITK_PP_EXPR_IIF(c, o)(229, s), p, o, m)
+# define MITK_PP_FOR_229_C(c, s, p, o, m) MITK_PP_IIF(c, m, MITK_PP_TUPLE_EAT_2)(230, s) MITK_PP_IIF(c, MITK_PP_FOR_230, MITK_PP_TUPLE_EAT_4)(MITK_PP_EXPR_IIF(c, o)(230, s), p, o, m)
+# define MITK_PP_FOR_230_C(c, s, p, o, m) MITK_PP_IIF(c, m, MITK_PP_TUPLE_EAT_2)(231, s) MITK_PP_IIF(c, MITK_PP_FOR_231, MITK_PP_TUPLE_EAT_4)(MITK_PP_EXPR_IIF(c, o)(231, s), p, o, m)
+# define MITK_PP_FOR_231_C(c, s, p, o, m) MITK_PP_IIF(c, m, MITK_PP_TUPLE_EAT_2)(232, s) MITK_PP_IIF(c, MITK_PP_FOR_232, MITK_PP_TUPLE_EAT_4)(MITK_PP_EXPR_IIF(c, o)(232, s), p, o, m)
+# define MITK_PP_FOR_232_C(c, s, p, o, m) MITK_PP_IIF(c, m, MITK_PP_TUPLE_EAT_2)(233, s) MITK_PP_IIF(c, MITK_PP_FOR_233, MITK_PP_TUPLE_EAT_4)(MITK_PP_EXPR_IIF(c, o)(233, s), p, o, m)
+# define MITK_PP_FOR_233_C(c, s, p, o, m) MITK_PP_IIF(c, m, MITK_PP_TUPLE_EAT_2)(234, s) MITK_PP_IIF(c, MITK_PP_FOR_234, MITK_PP_TUPLE_EAT_4)(MITK_PP_EXPR_IIF(c, o)(234, s), p, o, m)
+# define MITK_PP_FOR_234_C(c, s, p, o, m) MITK_PP_IIF(c, m, MITK_PP_TUPLE_EAT_2)(235, s) MITK_PP_IIF(c, MITK_PP_FOR_235, MITK_PP_TUPLE_EAT_4)(MITK_PP_EXPR_IIF(c, o)(235, s), p, o, m)
+# define MITK_PP_FOR_235_C(c, s, p, o, m) MITK_PP_IIF(c, m, MITK_PP_TUPLE_EAT_2)(236, s) MITK_PP_IIF(c, MITK_PP_FOR_236, MITK_PP_TUPLE_EAT_4)(MITK_PP_EXPR_IIF(c, o)(236, s), p, o, m)
+# define MITK_PP_FOR_236_C(c, s, p, o, m) MITK_PP_IIF(c, m, MITK_PP_TUPLE_EAT_2)(237, s) MITK_PP_IIF(c, MITK_PP_FOR_237, MITK_PP_TUPLE_EAT_4)(MITK_PP_EXPR_IIF(c, o)(237, s), p, o, m)
+# define MITK_PP_FOR_237_C(c, s, p, o, m) MITK_PP_IIF(c, m, MITK_PP_TUPLE_EAT_2)(238, s) MITK_PP_IIF(c, MITK_PP_FOR_238, MITK_PP_TUPLE_EAT_4)(MITK_PP_EXPR_IIF(c, o)(238, s), p, o, m)
+# define MITK_PP_FOR_238_C(c, s, p, o, m) MITK_PP_IIF(c, m, MITK_PP_TUPLE_EAT_2)(239, s) MITK_PP_IIF(c, MITK_PP_FOR_239, MITK_PP_TUPLE_EAT_4)(MITK_PP_EXPR_IIF(c, o)(239, s), p, o, m)
+# define MITK_PP_FOR_239_C(c, s, p, o, m) MITK_PP_IIF(c, m, MITK_PP_TUPLE_EAT_2)(240, s) MITK_PP_IIF(c, MITK_PP_FOR_240, MITK_PP_TUPLE_EAT_4)(MITK_PP_EXPR_IIF(c, o)(240, s), p, o, m)
+# define MITK_PP_FOR_240_C(c, s, p, o, m) MITK_PP_IIF(c, m, MITK_PP_TUPLE_EAT_2)(241, s) MITK_PP_IIF(c, MITK_PP_FOR_241, MITK_PP_TUPLE_EAT_4)(MITK_PP_EXPR_IIF(c, o)(241, s), p, o, m)
+# define MITK_PP_FOR_241_C(c, s, p, o, m) MITK_PP_IIF(c, m, MITK_PP_TUPLE_EAT_2)(242, s) MITK_PP_IIF(c, MITK_PP_FOR_242, MITK_PP_TUPLE_EAT_4)(MITK_PP_EXPR_IIF(c, o)(242, s), p, o, m)
+# define MITK_PP_FOR_242_C(c, s, p, o, m) MITK_PP_IIF(c, m, MITK_PP_TUPLE_EAT_2)(243, s) MITK_PP_IIF(c, MITK_PP_FOR_243, MITK_PP_TUPLE_EAT_4)(MITK_PP_EXPR_IIF(c, o)(243, s), p, o, m)
+# define MITK_PP_FOR_243_C(c, s, p, o, m) MITK_PP_IIF(c, m, MITK_PP_TUPLE_EAT_2)(244, s) MITK_PP_IIF(c, MITK_PP_FOR_244, MITK_PP_TUPLE_EAT_4)(MITK_PP_EXPR_IIF(c, o)(244, s), p, o, m)
+# define MITK_PP_FOR_244_C(c, s, p, o, m) MITK_PP_IIF(c, m, MITK_PP_TUPLE_EAT_2)(245, s) MITK_PP_IIF(c, MITK_PP_FOR_245, MITK_PP_TUPLE_EAT_4)(MITK_PP_EXPR_IIF(c, o)(245, s), p, o, m)
+# define MITK_PP_FOR_245_C(c, s, p, o, m) MITK_PP_IIF(c, m, MITK_PP_TUPLE_EAT_2)(246, s) MITK_PP_IIF(c, MITK_PP_FOR_246, MITK_PP_TUPLE_EAT_4)(MITK_PP_EXPR_IIF(c, o)(246, s), p, o, m)
+# define MITK_PP_FOR_246_C(c, s, p, o, m) MITK_PP_IIF(c, m, MITK_PP_TUPLE_EAT_2)(247, s) MITK_PP_IIF(c, MITK_PP_FOR_247, MITK_PP_TUPLE_EAT_4)(MITK_PP_EXPR_IIF(c, o)(247, s), p, o, m)
+# define MITK_PP_FOR_247_C(c, s, p, o, m) MITK_PP_IIF(c, m, MITK_PP_TUPLE_EAT_2)(248, s) MITK_PP_IIF(c, MITK_PP_FOR_248, MITK_PP_TUPLE_EAT_4)(MITK_PP_EXPR_IIF(c, o)(248, s), p, o, m)
+# define MITK_PP_FOR_248_C(c, s, p, o, m) MITK_PP_IIF(c, m, MITK_PP_TUPLE_EAT_2)(249, s) MITK_PP_IIF(c, MITK_PP_FOR_249, MITK_PP_TUPLE_EAT_4)(MITK_PP_EXPR_IIF(c, o)(249, s), p, o, m)
+# define MITK_PP_FOR_249_C(c, s, p, o, m) MITK_PP_IIF(c, m, MITK_PP_TUPLE_EAT_2)(250, s) MITK_PP_IIF(c, MITK_PP_FOR_250, MITK_PP_TUPLE_EAT_4)(MITK_PP_EXPR_IIF(c, o)(250, s), p, o, m)
+# define MITK_PP_FOR_250_C(c, s, p, o, m) MITK_PP_IIF(c, m, MITK_PP_TUPLE_EAT_2)(251, s) MITK_PP_IIF(c, MITK_PP_FOR_251, MITK_PP_TUPLE_EAT_4)(MITK_PP_EXPR_IIF(c, o)(251, s), p, o, m)
+# define MITK_PP_FOR_251_C(c, s, p, o, m) MITK_PP_IIF(c, m, MITK_PP_TUPLE_EAT_2)(252, s) MITK_PP_IIF(c, MITK_PP_FOR_252, MITK_PP_TUPLE_EAT_4)(MITK_PP_EXPR_IIF(c, o)(252, s), p, o, m)
+# define MITK_PP_FOR_252_C(c, s, p, o, m) MITK_PP_IIF(c, m, MITK_PP_TUPLE_EAT_2)(253, s) MITK_PP_IIF(c, MITK_PP_FOR_253, MITK_PP_TUPLE_EAT_4)(MITK_PP_EXPR_IIF(c, o)(253, s), p, o, m)
+# define MITK_PP_FOR_253_C(c, s, p, o, m) MITK_PP_IIF(c, m, MITK_PP_TUPLE_EAT_2)(254, s) MITK_PP_IIF(c, MITK_PP_FOR_254, MITK_PP_TUPLE_EAT_4)(MITK_PP_EXPR_IIF(c, o)(254, s), p, o, m)
+# define MITK_PP_FOR_254_C(c, s, p, o, m) MITK_PP_IIF(c, m, MITK_PP_TUPLE_EAT_2)(255, s) MITK_PP_IIF(c, MITK_PP_FOR_255, MITK_PP_TUPLE_EAT_4)(MITK_PP_EXPR_IIF(c, o)(255, s), p, o, m)
+# define MITK_PP_FOR_255_C(c, s, p, o, m) MITK_PP_IIF(c, m, MITK_PP_TUPLE_EAT_2)(256, s) MITK_PP_IIF(c, MITK_PP_FOR_256, MITK_PP_TUPLE_EAT_4)(MITK_PP_EXPR_IIF(c, o)(256, s), p, o, m)
+# define MITK_PP_FOR_256_C(c, s, p, o, m) MITK_PP_IIF(c, m, MITK_PP_TUPLE_EAT_2)(257, s) MITK_PP_IIF(c, MITK_PP_FOR_257, MITK_PP_TUPLE_EAT_4)(MITK_PP_EXPR_IIF(c, o)(257, s), p, o, m)
+#
+# endif
diff --git a/Core/Code/Algorithms/mitkPPRepetitionDetailMSVCFor.h b/Core/Code/Algorithms/mitkPPRepetitionDetailMSVCFor.h
new file mode 100644
index 0000000000..3edbebb55f
--- /dev/null
+++ b/Core/Code/Algorithms/mitkPPRepetitionDetailMSVCFor.h
@@ -0,0 +1,277 @@
+# /* Copyright (C) 2001
+# * Housemarque Oy
+# * http://www.housemarque.com
+# *
+# * Distributed under the Boost Software License, Version 1.0. (See
+# * accompanying file LICENSE_1_0.txt or copy at
+# * http://www.boost.org/LICENSE_1_0.txt)
+# */
+#
+# /* Revised by Paul Mensonides (2002) */
+#
+# /* See http://www.boost.org for most recent version. */
+#
+# ifndef MITK_PREPROCESSOR_REPETITION_DETAIL_MSVC_FOR_HPP
+# define MITK_PREPROCESSOR_REPETITION_DETAIL_MSVC_FOR_HPP
+#
+# include "mitkPPControlIf.h"
+# include "mitkPPTupleEat.h"
+#
+# define MITK_PP_FOR_1(s, p, o, m) MITK_PP_IF(p(2, s), m, MITK_PP_TUPLE_EAT_2)(2, s) MITK_PP_IF(p(2, s), MITK_PP_FOR_2, MITK_PP_TUPLE_EAT_4)(o(2, s), p, o, m)
+# define MITK_PP_FOR_2(s, p, o, m) MITK_PP_IF(p(3, s), m, MITK_PP_TUPLE_EAT_2)(3, s) MITK_PP_IF(p(3, s), MITK_PP_FOR_3, MITK_PP_TUPLE_EAT_4)(o(3, s), p, o, m)
+# define MITK_PP_FOR_3(s, p, o, m) MITK_PP_IF(p(4, s), m, MITK_PP_TUPLE_EAT_2)(4, s) MITK_PP_IF(p(4, s), MITK_PP_FOR_4, MITK_PP_TUPLE_EAT_4)(o(4, s), p, o, m)
+# define MITK_PP_FOR_4(s, p, o, m) MITK_PP_IF(p(5, s), m, MITK_PP_TUPLE_EAT_2)(5, s) MITK_PP_IF(p(5, s), MITK_PP_FOR_5, MITK_PP_TUPLE_EAT_4)(o(5, s), p, o, m)
+# define MITK_PP_FOR_5(s, p, o, m) MITK_PP_IF(p(6, s), m, MITK_PP_TUPLE_EAT_2)(6, s) MITK_PP_IF(p(6, s), MITK_PP_FOR_6, MITK_PP_TUPLE_EAT_4)(o(6, s), p, o, m)
+# define MITK_PP_FOR_6(s, p, o, m) MITK_PP_IF(p(7, s), m, MITK_PP_TUPLE_EAT_2)(7, s) MITK_PP_IF(p(7, s), MITK_PP_FOR_7, MITK_PP_TUPLE_EAT_4)(o(7, s), p, o, m)
+# define MITK_PP_FOR_7(s, p, o, m) MITK_PP_IF(p(8, s), m, MITK_PP_TUPLE_EAT_2)(8, s) MITK_PP_IF(p(8, s), MITK_PP_FOR_8, MITK_PP_TUPLE_EAT_4)(o(8, s), p, o, m)
+# define MITK_PP_FOR_8(s, p, o, m) MITK_PP_IF(p(9, s), m, MITK_PP_TUPLE_EAT_2)(9, s) MITK_PP_IF(p(9, s), MITK_PP_FOR_9, MITK_PP_TUPLE_EAT_4)(o(9, s), p, o, m)
+# define MITK_PP_FOR_9(s, p, o, m) MITK_PP_IF(p(10, s), m, MITK_PP_TUPLE_EAT_2)(10, s) MITK_PP_IF(p(10, s), MITK_PP_FOR_10, MITK_PP_TUPLE_EAT_4)(o(10, s), p, o, m)
+# define MITK_PP_FOR_10(s, p, o, m) MITK_PP_IF(p(11, s), m, MITK_PP_TUPLE_EAT_2)(11, s) MITK_PP_IF(p(11, s), MITK_PP_FOR_11, MITK_PP_TUPLE_EAT_4)(o(11, s), p, o, m)
+# define MITK_PP_FOR_11(s, p, o, m) MITK_PP_IF(p(12, s), m, MITK_PP_TUPLE_EAT_2)(12, s) MITK_PP_IF(p(12, s), MITK_PP_FOR_12, MITK_PP_TUPLE_EAT_4)(o(12, s), p, o, m)
+# define MITK_PP_FOR_12(s, p, o, m) MITK_PP_IF(p(13, s), m, MITK_PP_TUPLE_EAT_2)(13, s) MITK_PP_IF(p(13, s), MITK_PP_FOR_13, MITK_PP_TUPLE_EAT_4)(o(13, s), p, o, m)
+# define MITK_PP_FOR_13(s, p, o, m) MITK_PP_IF(p(14, s), m, MITK_PP_TUPLE_EAT_2)(14, s) MITK_PP_IF(p(14, s), MITK_PP_FOR_14, MITK_PP_TUPLE_EAT_4)(o(14, s), p, o, m)
+# define MITK_PP_FOR_14(s, p, o, m) MITK_PP_IF(p(15, s), m, MITK_PP_TUPLE_EAT_2)(15, s) MITK_PP_IF(p(15, s), MITK_PP_FOR_15, MITK_PP_TUPLE_EAT_4)(o(15, s), p, o, m)
+# define MITK_PP_FOR_15(s, p, o, m) MITK_PP_IF(p(16, s), m, MITK_PP_TUPLE_EAT_2)(16, s) MITK_PP_IF(p(16, s), MITK_PP_FOR_16, MITK_PP_TUPLE_EAT_4)(o(16, s), p, o, m)
+# define MITK_PP_FOR_16(s, p, o, m) MITK_PP_IF(p(17, s), m, MITK_PP_TUPLE_EAT_2)(17, s) MITK_PP_IF(p(17, s), MITK_PP_FOR_17, MITK_PP_TUPLE_EAT_4)(o(17, s), p, o, m)
+# define MITK_PP_FOR_17(s, p, o, m) MITK_PP_IF(p(18, s), m, MITK_PP_TUPLE_EAT_2)(18, s) MITK_PP_IF(p(18, s), MITK_PP_FOR_18, MITK_PP_TUPLE_EAT_4)(o(18, s), p, o, m)
+# define MITK_PP_FOR_18(s, p, o, m) MITK_PP_IF(p(19, s), m, MITK_PP_TUPLE_EAT_2)(19, s) MITK_PP_IF(p(19, s), MITK_PP_FOR_19, MITK_PP_TUPLE_EAT_4)(o(19, s), p, o, m)
+# define MITK_PP_FOR_19(s, p, o, m) MITK_PP_IF(p(20, s), m, MITK_PP_TUPLE_EAT_2)(20, s) MITK_PP_IF(p(20, s), MITK_PP_FOR_20, MITK_PP_TUPLE_EAT_4)(o(20, s), p, o, m)
+# define MITK_PP_FOR_20(s, p, o, m) MITK_PP_IF(p(21, s), m, MITK_PP_TUPLE_EAT_2)(21, s) MITK_PP_IF(p(21, s), MITK_PP_FOR_21, MITK_PP_TUPLE_EAT_4)(o(21, s), p, o, m)
+# define MITK_PP_FOR_21(s, p, o, m) MITK_PP_IF(p(22, s), m, MITK_PP_TUPLE_EAT_2)(22, s) MITK_PP_IF(p(22, s), MITK_PP_FOR_22, MITK_PP_TUPLE_EAT_4)(o(22, s), p, o, m)
+# define MITK_PP_FOR_22(s, p, o, m) MITK_PP_IF(p(23, s), m, MITK_PP_TUPLE_EAT_2)(23, s) MITK_PP_IF(p(23, s), MITK_PP_FOR_23, MITK_PP_TUPLE_EAT_4)(o(23, s), p, o, m)
+# define MITK_PP_FOR_23(s, p, o, m) MITK_PP_IF(p(24, s), m, MITK_PP_TUPLE_EAT_2)(24, s) MITK_PP_IF(p(24, s), MITK_PP_FOR_24, MITK_PP_TUPLE_EAT_4)(o(24, s), p, o, m)
+# define MITK_PP_FOR_24(s, p, o, m) MITK_PP_IF(p(25, s), m, MITK_PP_TUPLE_EAT_2)(25, s) MITK_PP_IF(p(25, s), MITK_PP_FOR_25, MITK_PP_TUPLE_EAT_4)(o(25, s), p, o, m)
+# define MITK_PP_FOR_25(s, p, o, m) MITK_PP_IF(p(26, s), m, MITK_PP_TUPLE_EAT_2)(26, s) MITK_PP_IF(p(26, s), MITK_PP_FOR_26, MITK_PP_TUPLE_EAT_4)(o(26, s), p, o, m)
+# define MITK_PP_FOR_26(s, p, o, m) MITK_PP_IF(p(27, s), m, MITK_PP_TUPLE_EAT_2)(27, s) MITK_PP_IF(p(27, s), MITK_PP_FOR_27, MITK_PP_TUPLE_EAT_4)(o(27, s), p, o, m)
+# define MITK_PP_FOR_27(s, p, o, m) MITK_PP_IF(p(28, s), m, MITK_PP_TUPLE_EAT_2)(28, s) MITK_PP_IF(p(28, s), MITK_PP_FOR_28, MITK_PP_TUPLE_EAT_4)(o(28, s), p, o, m)
+# define MITK_PP_FOR_28(s, p, o, m) MITK_PP_IF(p(29, s), m, MITK_PP_TUPLE_EAT_2)(29, s) MITK_PP_IF(p(29, s), MITK_PP_FOR_29, MITK_PP_TUPLE_EAT_4)(o(29, s), p, o, m)
+# define MITK_PP_FOR_29(s, p, o, m) MITK_PP_IF(p(30, s), m, MITK_PP_TUPLE_EAT_2)(30, s) MITK_PP_IF(p(30, s), MITK_PP_FOR_30, MITK_PP_TUPLE_EAT_4)(o(30, s), p, o, m)
+# define MITK_PP_FOR_30(s, p, o, m) MITK_PP_IF(p(31, s), m, MITK_PP_TUPLE_EAT_2)(31, s) MITK_PP_IF(p(31, s), MITK_PP_FOR_31, MITK_PP_TUPLE_EAT_4)(o(31, s), p, o, m)
+# define MITK_PP_FOR_31(s, p, o, m) MITK_PP_IF(p(32, s), m, MITK_PP_TUPLE_EAT_2)(32, s) MITK_PP_IF(p(32, s), MITK_PP_FOR_32, MITK_PP_TUPLE_EAT_4)(o(32, s), p, o, m)
+# define MITK_PP_FOR_32(s, p, o, m) MITK_PP_IF(p(33, s), m, MITK_PP_TUPLE_EAT_2)(33, s) MITK_PP_IF(p(33, s), MITK_PP_FOR_33, MITK_PP_TUPLE_EAT_4)(o(33, s), p, o, m)
+# define MITK_PP_FOR_33(s, p, o, m) MITK_PP_IF(p(34, s), m, MITK_PP_TUPLE_EAT_2)(34, s) MITK_PP_IF(p(34, s), MITK_PP_FOR_34, MITK_PP_TUPLE_EAT_4)(o(34, s), p, o, m)
+# define MITK_PP_FOR_34(s, p, o, m) MITK_PP_IF(p(35, s), m, MITK_PP_TUPLE_EAT_2)(35, s) MITK_PP_IF(p(35, s), MITK_PP_FOR_35, MITK_PP_TUPLE_EAT_4)(o(35, s), p, o, m)
+# define MITK_PP_FOR_35(s, p, o, m) MITK_PP_IF(p(36, s), m, MITK_PP_TUPLE_EAT_2)(36, s) MITK_PP_IF(p(36, s), MITK_PP_FOR_36, MITK_PP_TUPLE_EAT_4)(o(36, s), p, o, m)
+# define MITK_PP_FOR_36(s, p, o, m) MITK_PP_IF(p(37, s), m, MITK_PP_TUPLE_EAT_2)(37, s) MITK_PP_IF(p(37, s), MITK_PP_FOR_37, MITK_PP_TUPLE_EAT_4)(o(37, s), p, o, m)
+# define MITK_PP_FOR_37(s, p, o, m) MITK_PP_IF(p(38, s), m, MITK_PP_TUPLE_EAT_2)(38, s) MITK_PP_IF(p(38, s), MITK_PP_FOR_38, MITK_PP_TUPLE_EAT_4)(o(38, s), p, o, m)
+# define MITK_PP_FOR_38(s, p, o, m) MITK_PP_IF(p(39, s), m, MITK_PP_TUPLE_EAT_2)(39, s) MITK_PP_IF(p(39, s), MITK_PP_FOR_39, MITK_PP_TUPLE_EAT_4)(o(39, s), p, o, m)
+# define MITK_PP_FOR_39(s, p, o, m) MITK_PP_IF(p(40, s), m, MITK_PP_TUPLE_EAT_2)(40, s) MITK_PP_IF(p(40, s), MITK_PP_FOR_40, MITK_PP_TUPLE_EAT_4)(o(40, s), p, o, m)
+# define MITK_PP_FOR_40(s, p, o, m) MITK_PP_IF(p(41, s), m, MITK_PP_TUPLE_EAT_2)(41, s) MITK_PP_IF(p(41, s), MITK_PP_FOR_41, MITK_PP_TUPLE_EAT_4)(o(41, s), p, o, m)
+# define MITK_PP_FOR_41(s, p, o, m) MITK_PP_IF(p(42, s), m, MITK_PP_TUPLE_EAT_2)(42, s) MITK_PP_IF(p(42, s), MITK_PP_FOR_42, MITK_PP_TUPLE_EAT_4)(o(42, s), p, o, m)
+# define MITK_PP_FOR_42(s, p, o, m) MITK_PP_IF(p(43, s), m, MITK_PP_TUPLE_EAT_2)(43, s) MITK_PP_IF(p(43, s), MITK_PP_FOR_43, MITK_PP_TUPLE_EAT_4)(o(43, s), p, o, m)
+# define MITK_PP_FOR_43(s, p, o, m) MITK_PP_IF(p(44, s), m, MITK_PP_TUPLE_EAT_2)(44, s) MITK_PP_IF(p(44, s), MITK_PP_FOR_44, MITK_PP_TUPLE_EAT_4)(o(44, s), p, o, m)
+# define MITK_PP_FOR_44(s, p, o, m) MITK_PP_IF(p(45, s), m, MITK_PP_TUPLE_EAT_2)(45, s) MITK_PP_IF(p(45, s), MITK_PP_FOR_45, MITK_PP_TUPLE_EAT_4)(o(45, s), p, o, m)
+# define MITK_PP_FOR_45(s, p, o, m) MITK_PP_IF(p(46, s), m, MITK_PP_TUPLE_EAT_2)(46, s) MITK_PP_IF(p(46, s), MITK_PP_FOR_46, MITK_PP_TUPLE_EAT_4)(o(46, s), p, o, m)
+# define MITK_PP_FOR_46(s, p, o, m) MITK_PP_IF(p(47, s), m, MITK_PP_TUPLE_EAT_2)(47, s) MITK_PP_IF(p(47, s), MITK_PP_FOR_47, MITK_PP_TUPLE_EAT_4)(o(47, s), p, o, m)
+# define MITK_PP_FOR_47(s, p, o, m) MITK_PP_IF(p(48, s), m, MITK_PP_TUPLE_EAT_2)(48, s) MITK_PP_IF(p(48, s), MITK_PP_FOR_48, MITK_PP_TUPLE_EAT_4)(o(48, s), p, o, m)
+# define MITK_PP_FOR_48(s, p, o, m) MITK_PP_IF(p(49, s), m, MITK_PP_TUPLE_EAT_2)(49, s) MITK_PP_IF(p(49, s), MITK_PP_FOR_49, MITK_PP_TUPLE_EAT_4)(o(49, s), p, o, m)
+# define MITK_PP_FOR_49(s, p, o, m) MITK_PP_IF(p(50, s), m, MITK_PP_TUPLE_EAT_2)(50, s) MITK_PP_IF(p(50, s), MITK_PP_FOR_50, MITK_PP_TUPLE_EAT_4)(o(50, s), p, o, m)
+# define MITK_PP_FOR_50(s, p, o, m) MITK_PP_IF(p(51, s), m, MITK_PP_TUPLE_EAT_2)(51, s) MITK_PP_IF(p(51, s), MITK_PP_FOR_51, MITK_PP_TUPLE_EAT_4)(o(51, s), p, o, m)
+# define MITK_PP_FOR_51(s, p, o, m) MITK_PP_IF(p(52, s), m, MITK_PP_TUPLE_EAT_2)(52, s) MITK_PP_IF(p(52, s), MITK_PP_FOR_52, MITK_PP_TUPLE_EAT_4)(o(52, s), p, o, m)
+# define MITK_PP_FOR_52(s, p, o, m) MITK_PP_IF(p(53, s), m, MITK_PP_TUPLE_EAT_2)(53, s) MITK_PP_IF(p(53, s), MITK_PP_FOR_53, MITK_PP_TUPLE_EAT_4)(o(53, s), p, o, m)
+# define MITK_PP_FOR_53(s, p, o, m) MITK_PP_IF(p(54, s), m, MITK_PP_TUPLE_EAT_2)(54, s) MITK_PP_IF(p(54, s), MITK_PP_FOR_54, MITK_PP_TUPLE_EAT_4)(o(54, s), p, o, m)
+# define MITK_PP_FOR_54(s, p, o, m) MITK_PP_IF(p(55, s), m, MITK_PP_TUPLE_EAT_2)(55, s) MITK_PP_IF(p(55, s), MITK_PP_FOR_55, MITK_PP_TUPLE_EAT_4)(o(55, s), p, o, m)
+# define MITK_PP_FOR_55(s, p, o, m) MITK_PP_IF(p(56, s), m, MITK_PP_TUPLE_EAT_2)(56, s) MITK_PP_IF(p(56, s), MITK_PP_FOR_56, MITK_PP_TUPLE_EAT_4)(o(56, s), p, o, m)
+# define MITK_PP_FOR_56(s, p, o, m) MITK_PP_IF(p(57, s), m, MITK_PP_TUPLE_EAT_2)(57, s) MITK_PP_IF(p(57, s), MITK_PP_FOR_57, MITK_PP_TUPLE_EAT_4)(o(57, s), p, o, m)
+# define MITK_PP_FOR_57(s, p, o, m) MITK_PP_IF(p(58, s), m, MITK_PP_TUPLE_EAT_2)(58, s) MITK_PP_IF(p(58, s), MITK_PP_FOR_58, MITK_PP_TUPLE_EAT_4)(o(58, s), p, o, m)
+# define MITK_PP_FOR_58(s, p, o, m) MITK_PP_IF(p(59, s), m, MITK_PP_TUPLE_EAT_2)(59, s) MITK_PP_IF(p(59, s), MITK_PP_FOR_59, MITK_PP_TUPLE_EAT_4)(o(59, s), p, o, m)
+# define MITK_PP_FOR_59(s, p, o, m) MITK_PP_IF(p(60, s), m, MITK_PP_TUPLE_EAT_2)(60, s) MITK_PP_IF(p(60, s), MITK_PP_FOR_60, MITK_PP_TUPLE_EAT_4)(o(60, s), p, o, m)
+# define MITK_PP_FOR_60(s, p, o, m) MITK_PP_IF(p(61, s), m, MITK_PP_TUPLE_EAT_2)(61, s) MITK_PP_IF(p(61, s), MITK_PP_FOR_61, MITK_PP_TUPLE_EAT_4)(o(61, s), p, o, m)
+# define MITK_PP_FOR_61(s, p, o, m) MITK_PP_IF(p(62, s), m, MITK_PP_TUPLE_EAT_2)(62, s) MITK_PP_IF(p(62, s), MITK_PP_FOR_62, MITK_PP_TUPLE_EAT_4)(o(62, s), p, o, m)
+# define MITK_PP_FOR_62(s, p, o, m) MITK_PP_IF(p(63, s), m, MITK_PP_TUPLE_EAT_2)(63, s) MITK_PP_IF(p(63, s), MITK_PP_FOR_63, MITK_PP_TUPLE_EAT_4)(o(63, s), p, o, m)
+# define MITK_PP_FOR_63(s, p, o, m) MITK_PP_IF(p(64, s), m, MITK_PP_TUPLE_EAT_2)(64, s) MITK_PP_IF(p(64, s), MITK_PP_FOR_64, MITK_PP_TUPLE_EAT_4)(o(64, s), p, o, m)
+# define MITK_PP_FOR_64(s, p, o, m) MITK_PP_IF(p(65, s), m, MITK_PP_TUPLE_EAT_2)(65, s) MITK_PP_IF(p(65, s), MITK_PP_FOR_65, MITK_PP_TUPLE_EAT_4)(o(65, s), p, o, m)
+# define MITK_PP_FOR_65(s, p, o, m) MITK_PP_IF(p(66, s), m, MITK_PP_TUPLE_EAT_2)(66, s) MITK_PP_IF(p(66, s), MITK_PP_FOR_66, MITK_PP_TUPLE_EAT_4)(o(66, s), p, o, m)
+# define MITK_PP_FOR_66(s, p, o, m) MITK_PP_IF(p(67, s), m, MITK_PP_TUPLE_EAT_2)(67, s) MITK_PP_IF(p(67, s), MITK_PP_FOR_67, MITK_PP_TUPLE_EAT_4)(o(67, s), p, o, m)
+# define MITK_PP_FOR_67(s, p, o, m) MITK_PP_IF(p(68, s), m, MITK_PP_TUPLE_EAT_2)(68, s) MITK_PP_IF(p(68, s), MITK_PP_FOR_68, MITK_PP_TUPLE_EAT_4)(o(68, s), p, o, m)
+# define MITK_PP_FOR_68(s, p, o, m) MITK_PP_IF(p(69, s), m, MITK_PP_TUPLE_EAT_2)(69, s) MITK_PP_IF(p(69, s), MITK_PP_FOR_69, MITK_PP_TUPLE_EAT_4)(o(69, s), p, o, m)
+# define MITK_PP_FOR_69(s, p, o, m) MITK_PP_IF(p(70, s), m, MITK_PP_TUPLE_EAT_2)(70, s) MITK_PP_IF(p(70, s), MITK_PP_FOR_70, MITK_PP_TUPLE_EAT_4)(o(70, s), p, o, m)
+# define MITK_PP_FOR_70(s, p, o, m) MITK_PP_IF(p(71, s), m, MITK_PP_TUPLE_EAT_2)(71, s) MITK_PP_IF(p(71, s), MITK_PP_FOR_71, MITK_PP_TUPLE_EAT_4)(o(71, s), p, o, m)
+# define MITK_PP_FOR_71(s, p, o, m) MITK_PP_IF(p(72, s), m, MITK_PP_TUPLE_EAT_2)(72, s) MITK_PP_IF(p(72, s), MITK_PP_FOR_72, MITK_PP_TUPLE_EAT_4)(o(72, s), p, o, m)
+# define MITK_PP_FOR_72(s, p, o, m) MITK_PP_IF(p(73, s), m, MITK_PP_TUPLE_EAT_2)(73, s) MITK_PP_IF(p(73, s), MITK_PP_FOR_73, MITK_PP_TUPLE_EAT_4)(o(73, s), p, o, m)
+# define MITK_PP_FOR_73(s, p, o, m) MITK_PP_IF(p(74, s), m, MITK_PP_TUPLE_EAT_2)(74, s) MITK_PP_IF(p(74, s), MITK_PP_FOR_74, MITK_PP_TUPLE_EAT_4)(o(74, s), p, o, m)
+# define MITK_PP_FOR_74(s, p, o, m) MITK_PP_IF(p(75, s), m, MITK_PP_TUPLE_EAT_2)(75, s) MITK_PP_IF(p(75, s), MITK_PP_FOR_75, MITK_PP_TUPLE_EAT_4)(o(75, s), p, o, m)
+# define MITK_PP_FOR_75(s, p, o, m) MITK_PP_IF(p(76, s), m, MITK_PP_TUPLE_EAT_2)(76, s) MITK_PP_IF(p(76, s), MITK_PP_FOR_76, MITK_PP_TUPLE_EAT_4)(o(76, s), p, o, m)
+# define MITK_PP_FOR_76(s, p, o, m) MITK_PP_IF(p(77, s), m, MITK_PP_TUPLE_EAT_2)(77, s) MITK_PP_IF(p(77, s), MITK_PP_FOR_77, MITK_PP_TUPLE_EAT_4)(o(77, s), p, o, m)
+# define MITK_PP_FOR_77(s, p, o, m) MITK_PP_IF(p(78, s), m, MITK_PP_TUPLE_EAT_2)(78, s) MITK_PP_IF(p(78, s), MITK_PP_FOR_78, MITK_PP_TUPLE_EAT_4)(o(78, s), p, o, m)
+# define MITK_PP_FOR_78(s, p, o, m) MITK_PP_IF(p(79, s), m, MITK_PP_TUPLE_EAT_2)(79, s) MITK_PP_IF(p(79, s), MITK_PP_FOR_79, MITK_PP_TUPLE_EAT_4)(o(79, s), p, o, m)
+# define MITK_PP_FOR_79(s, p, o, m) MITK_PP_IF(p(80, s), m, MITK_PP_TUPLE_EAT_2)(80, s) MITK_PP_IF(p(80, s), MITK_PP_FOR_80, MITK_PP_TUPLE_EAT_4)(o(80, s), p, o, m)
+# define MITK_PP_FOR_80(s, p, o, m) MITK_PP_IF(p(81, s), m, MITK_PP_TUPLE_EAT_2)(81, s) MITK_PP_IF(p(81, s), MITK_PP_FOR_81, MITK_PP_TUPLE_EAT_4)(o(81, s), p, o, m)
+# define MITK_PP_FOR_81(s, p, o, m) MITK_PP_IF(p(82, s), m, MITK_PP_TUPLE_EAT_2)(82, s) MITK_PP_IF(p(82, s), MITK_PP_FOR_82, MITK_PP_TUPLE_EAT_4)(o(82, s), p, o, m)
+# define MITK_PP_FOR_82(s, p, o, m) MITK_PP_IF(p(83, s), m, MITK_PP_TUPLE_EAT_2)(83, s) MITK_PP_IF(p(83, s), MITK_PP_FOR_83, MITK_PP_TUPLE_EAT_4)(o(83, s), p, o, m)
+# define MITK_PP_FOR_83(s, p, o, m) MITK_PP_IF(p(84, s), m, MITK_PP_TUPLE_EAT_2)(84, s) MITK_PP_IF(p(84, s), MITK_PP_FOR_84, MITK_PP_TUPLE_EAT_4)(o(84, s), p, o, m)
+# define MITK_PP_FOR_84(s, p, o, m) MITK_PP_IF(p(85, s), m, MITK_PP_TUPLE_EAT_2)(85, s) MITK_PP_IF(p(85, s), MITK_PP_FOR_85, MITK_PP_TUPLE_EAT_4)(o(85, s), p, o, m)
+# define MITK_PP_FOR_85(s, p, o, m) MITK_PP_IF(p(86, s), m, MITK_PP_TUPLE_EAT_2)(86, s) MITK_PP_IF(p(86, s), MITK_PP_FOR_86, MITK_PP_TUPLE_EAT_4)(o(86, s), p, o, m)
+# define MITK_PP_FOR_86(s, p, o, m) MITK_PP_IF(p(87, s), m, MITK_PP_TUPLE_EAT_2)(87, s) MITK_PP_IF(p(87, s), MITK_PP_FOR_87, MITK_PP_TUPLE_EAT_4)(o(87, s), p, o, m)
+# define MITK_PP_FOR_87(s, p, o, m) MITK_PP_IF(p(88, s), m, MITK_PP_TUPLE_EAT_2)(88, s) MITK_PP_IF(p(88, s), MITK_PP_FOR_88, MITK_PP_TUPLE_EAT_4)(o(88, s), p, o, m)
+# define MITK_PP_FOR_88(s, p, o, m) MITK_PP_IF(p(89, s), m, MITK_PP_TUPLE_EAT_2)(89, s) MITK_PP_IF(p(89, s), MITK_PP_FOR_89, MITK_PP_TUPLE_EAT_4)(o(89, s), p, o, m)
+# define MITK_PP_FOR_89(s, p, o, m) MITK_PP_IF(p(90, s), m, MITK_PP_TUPLE_EAT_2)(90, s) MITK_PP_IF(p(90, s), MITK_PP_FOR_90, MITK_PP_TUPLE_EAT_4)(o(90, s), p, o, m)
+# define MITK_PP_FOR_90(s, p, o, m) MITK_PP_IF(p(91, s), m, MITK_PP_TUPLE_EAT_2)(91, s) MITK_PP_IF(p(91, s), MITK_PP_FOR_91, MITK_PP_TUPLE_EAT_4)(o(91, s), p, o, m)
+# define MITK_PP_FOR_91(s, p, o, m) MITK_PP_IF(p(92, s), m, MITK_PP_TUPLE_EAT_2)(92, s) MITK_PP_IF(p(92, s), MITK_PP_FOR_92, MITK_PP_TUPLE_EAT_4)(o(92, s), p, o, m)
+# define MITK_PP_FOR_92(s, p, o, m) MITK_PP_IF(p(93, s), m, MITK_PP_TUPLE_EAT_2)(93, s) MITK_PP_IF(p(93, s), MITK_PP_FOR_93, MITK_PP_TUPLE_EAT_4)(o(93, s), p, o, m)
+# define MITK_PP_FOR_93(s, p, o, m) MITK_PP_IF(p(94, s), m, MITK_PP_TUPLE_EAT_2)(94, s) MITK_PP_IF(p(94, s), MITK_PP_FOR_94, MITK_PP_TUPLE_EAT_4)(o(94, s), p, o, m)
+# define MITK_PP_FOR_94(s, p, o, m) MITK_PP_IF(p(95, s), m, MITK_PP_TUPLE_EAT_2)(95, s) MITK_PP_IF(p(95, s), MITK_PP_FOR_95, MITK_PP_TUPLE_EAT_4)(o(95, s), p, o, m)
+# define MITK_PP_FOR_95(s, p, o, m) MITK_PP_IF(p(96, s), m, MITK_PP_TUPLE_EAT_2)(96, s) MITK_PP_IF(p(96, s), MITK_PP_FOR_96, MITK_PP_TUPLE_EAT_4)(o(96, s), p, o, m)
+# define MITK_PP_FOR_96(s, p, o, m) MITK_PP_IF(p(97, s), m, MITK_PP_TUPLE_EAT_2)(97, s) MITK_PP_IF(p(97, s), MITK_PP_FOR_97, MITK_PP_TUPLE_EAT_4)(o(97, s), p, o, m)
+# define MITK_PP_FOR_97(s, p, o, m) MITK_PP_IF(p(98, s), m, MITK_PP_TUPLE_EAT_2)(98, s) MITK_PP_IF(p(98, s), MITK_PP_FOR_98, MITK_PP_TUPLE_EAT_4)(o(98, s), p, o, m)
+# define MITK_PP_FOR_98(s, p, o, m) MITK_PP_IF(p(99, s), m, MITK_PP_TUPLE_EAT_2)(99, s) MITK_PP_IF(p(99, s), MITK_PP_FOR_99, MITK_PP_TUPLE_EAT_4)(o(99, s), p, o, m)
+# define MITK_PP_FOR_99(s, p, o, m) MITK_PP_IF(p(100, s), m, MITK_PP_TUPLE_EAT_2)(100, s) MITK_PP_IF(p(100, s), MITK_PP_FOR_100, MITK_PP_TUPLE_EAT_4)(o(100, s), p, o, m)
+# define MITK_PP_FOR_100(s, p, o, m) MITK_PP_IF(p(101, s), m, MITK_PP_TUPLE_EAT_2)(101, s) MITK_PP_IF(p(101, s), MITK_PP_FOR_101, MITK_PP_TUPLE_EAT_4)(o(101, s), p, o, m)
+# define MITK_PP_FOR_101(s, p, o, m) MITK_PP_IF(p(102, s), m, MITK_PP_TUPLE_EAT_2)(102, s) MITK_PP_IF(p(102, s), MITK_PP_FOR_102, MITK_PP_TUPLE_EAT_4)(o(102, s), p, o, m)
+# define MITK_PP_FOR_102(s, p, o, m) MITK_PP_IF(p(103, s), m, MITK_PP_TUPLE_EAT_2)(103, s) MITK_PP_IF(p(103, s), MITK_PP_FOR_103, MITK_PP_TUPLE_EAT_4)(o(103, s), p, o, m)
+# define MITK_PP_FOR_103(s, p, o, m) MITK_PP_IF(p(104, s), m, MITK_PP_TUPLE_EAT_2)(104, s) MITK_PP_IF(p(104, s), MITK_PP_FOR_104, MITK_PP_TUPLE_EAT_4)(o(104, s), p, o, m)
+# define MITK_PP_FOR_104(s, p, o, m) MITK_PP_IF(p(105, s), m, MITK_PP_TUPLE_EAT_2)(105, s) MITK_PP_IF(p(105, s), MITK_PP_FOR_105, MITK_PP_TUPLE_EAT_4)(o(105, s), p, o, m)
+# define MITK_PP_FOR_105(s, p, o, m) MITK_PP_IF(p(106, s), m, MITK_PP_TUPLE_EAT_2)(106, s) MITK_PP_IF(p(106, s), MITK_PP_FOR_106, MITK_PP_TUPLE_EAT_4)(o(106, s), p, o, m)
+# define MITK_PP_FOR_106(s, p, o, m) MITK_PP_IF(p(107, s), m, MITK_PP_TUPLE_EAT_2)(107, s) MITK_PP_IF(p(107, s), MITK_PP_FOR_107, MITK_PP_TUPLE_EAT_4)(o(107, s), p, o, m)
+# define MITK_PP_FOR_107(s, p, o, m) MITK_PP_IF(p(108, s), m, MITK_PP_TUPLE_EAT_2)(108, s) MITK_PP_IF(p(108, s), MITK_PP_FOR_108, MITK_PP_TUPLE_EAT_4)(o(108, s), p, o, m)
+# define MITK_PP_FOR_108(s, p, o, m) MITK_PP_IF(p(109, s), m, MITK_PP_TUPLE_EAT_2)(109, s) MITK_PP_IF(p(109, s), MITK_PP_FOR_109, MITK_PP_TUPLE_EAT_4)(o(109, s), p, o, m)
+# define MITK_PP_FOR_109(s, p, o, m) MITK_PP_IF(p(110, s), m, MITK_PP_TUPLE_EAT_2)(110, s) MITK_PP_IF(p(110, s), MITK_PP_FOR_110, MITK_PP_TUPLE_EAT_4)(o(110, s), p, o, m)
+# define MITK_PP_FOR_110(s, p, o, m) MITK_PP_IF(p(111, s), m, MITK_PP_TUPLE_EAT_2)(111, s) MITK_PP_IF(p(111, s), MITK_PP_FOR_111, MITK_PP_TUPLE_EAT_4)(o(111, s), p, o, m)
+# define MITK_PP_FOR_111(s, p, o, m) MITK_PP_IF(p(112, s), m, MITK_PP_TUPLE_EAT_2)(112, s) MITK_PP_IF(p(112, s), MITK_PP_FOR_112, MITK_PP_TUPLE_EAT_4)(o(112, s), p, o, m)
+# define MITK_PP_FOR_112(s, p, o, m) MITK_PP_IF(p(113, s), m, MITK_PP_TUPLE_EAT_2)(113, s) MITK_PP_IF(p(113, s), MITK_PP_FOR_113, MITK_PP_TUPLE_EAT_4)(o(113, s), p, o, m)
+# define MITK_PP_FOR_113(s, p, o, m) MITK_PP_IF(p(114, s), m, MITK_PP_TUPLE_EAT_2)(114, s) MITK_PP_IF(p(114, s), MITK_PP_FOR_114, MITK_PP_TUPLE_EAT_4)(o(114, s), p, o, m)
+# define MITK_PP_FOR_114(s, p, o, m) MITK_PP_IF(p(115, s), m, MITK_PP_TUPLE_EAT_2)(115, s) MITK_PP_IF(p(115, s), MITK_PP_FOR_115, MITK_PP_TUPLE_EAT_4)(o(115, s), p, o, m)
+# define MITK_PP_FOR_115(s, p, o, m) MITK_PP_IF(p(116, s), m, MITK_PP_TUPLE_EAT_2)(116, s) MITK_PP_IF(p(116, s), MITK_PP_FOR_116, MITK_PP_TUPLE_EAT_4)(o(116, s), p, o, m)
+# define MITK_PP_FOR_116(s, p, o, m) MITK_PP_IF(p(117, s), m, MITK_PP_TUPLE_EAT_2)(117, s) MITK_PP_IF(p(117, s), MITK_PP_FOR_117, MITK_PP_TUPLE_EAT_4)(o(117, s), p, o, m)
+# define MITK_PP_FOR_117(s, p, o, m) MITK_PP_IF(p(118, s), m, MITK_PP_TUPLE_EAT_2)(118, s) MITK_PP_IF(p(118, s), MITK_PP_FOR_118, MITK_PP_TUPLE_EAT_4)(o(118, s), p, o, m)
+# define MITK_PP_FOR_118(s, p, o, m) MITK_PP_IF(p(119, s), m, MITK_PP_TUPLE_EAT_2)(119, s) MITK_PP_IF(p(119, s), MITK_PP_FOR_119, MITK_PP_TUPLE_EAT_4)(o(119, s), p, o, m)
+# define MITK_PP_FOR_119(s, p, o, m) MITK_PP_IF(p(120, s), m, MITK_PP_TUPLE_EAT_2)(120, s) MITK_PP_IF(p(120, s), MITK_PP_FOR_120, MITK_PP_TUPLE_EAT_4)(o(120, s), p, o, m)
+# define MITK_PP_FOR_120(s, p, o, m) MITK_PP_IF(p(121, s), m, MITK_PP_TUPLE_EAT_2)(121, s) MITK_PP_IF(p(121, s), MITK_PP_FOR_121, MITK_PP_TUPLE_EAT_4)(o(121, s), p, o, m)
+# define MITK_PP_FOR_121(s, p, o, m) MITK_PP_IF(p(122, s), m, MITK_PP_TUPLE_EAT_2)(122, s) MITK_PP_IF(p(122, s), MITK_PP_FOR_122, MITK_PP_TUPLE_EAT_4)(o(122, s), p, o, m)
+# define MITK_PP_FOR_122(s, p, o, m) MITK_PP_IF(p(123, s), m, MITK_PP_TUPLE_EAT_2)(123, s) MITK_PP_IF(p(123, s), MITK_PP_FOR_123, MITK_PP_TUPLE_EAT_4)(o(123, s), p, o, m)
+# define MITK_PP_FOR_123(s, p, o, m) MITK_PP_IF(p(124, s), m, MITK_PP_TUPLE_EAT_2)(124, s) MITK_PP_IF(p(124, s), MITK_PP_FOR_124, MITK_PP_TUPLE_EAT_4)(o(124, s), p, o, m)
+# define MITK_PP_FOR_124(s, p, o, m) MITK_PP_IF(p(125, s), m, MITK_PP_TUPLE_EAT_2)(125, s) MITK_PP_IF(p(125, s), MITK_PP_FOR_125, MITK_PP_TUPLE_EAT_4)(o(125, s), p, o, m)
+# define MITK_PP_FOR_125(s, p, o, m) MITK_PP_IF(p(126, s), m, MITK_PP_TUPLE_EAT_2)(126, s) MITK_PP_IF(p(126, s), MITK_PP_FOR_126, MITK_PP_TUPLE_EAT_4)(o(126, s), p, o, m)
+# define MITK_PP_FOR_126(s, p, o, m) MITK_PP_IF(p(127, s), m, MITK_PP_TUPLE_EAT_2)(127, s) MITK_PP_IF(p(127, s), MITK_PP_FOR_127, MITK_PP_TUPLE_EAT_4)(o(127, s), p, o, m)
+# define MITK_PP_FOR_127(s, p, o, m) MITK_PP_IF(p(128, s), m, MITK_PP_TUPLE_EAT_2)(128, s) MITK_PP_IF(p(128, s), MITK_PP_FOR_128, MITK_PP_TUPLE_EAT_4)(o(128, s), p, o, m)
+# define MITK_PP_FOR_128(s, p, o, m) MITK_PP_IF(p(129, s), m, MITK_PP_TUPLE_EAT_2)(129, s) MITK_PP_IF(p(129, s), MITK_PP_FOR_129, MITK_PP_TUPLE_EAT_4)(o(129, s), p, o, m)
+# define MITK_PP_FOR_129(s, p, o, m) MITK_PP_IF(p(130, s), m, MITK_PP_TUPLE_EAT_2)(130, s) MITK_PP_IF(p(130, s), MITK_PP_FOR_130, MITK_PP_TUPLE_EAT_4)(o(130, s), p, o, m)
+# define MITK_PP_FOR_130(s, p, o, m) MITK_PP_IF(p(131, s), m, MITK_PP_TUPLE_EAT_2)(131, s) MITK_PP_IF(p(131, s), MITK_PP_FOR_131, MITK_PP_TUPLE_EAT_4)(o(131, s), p, o, m)
+# define MITK_PP_FOR_131(s, p, o, m) MITK_PP_IF(p(132, s), m, MITK_PP_TUPLE_EAT_2)(132, s) MITK_PP_IF(p(132, s), MITK_PP_FOR_132, MITK_PP_TUPLE_EAT_4)(o(132, s), p, o, m)
+# define MITK_PP_FOR_132(s, p, o, m) MITK_PP_IF(p(133, s), m, MITK_PP_TUPLE_EAT_2)(133, s) MITK_PP_IF(p(133, s), MITK_PP_FOR_133, MITK_PP_TUPLE_EAT_4)(o(133, s), p, o, m)
+# define MITK_PP_FOR_133(s, p, o, m) MITK_PP_IF(p(134, s), m, MITK_PP_TUPLE_EAT_2)(134, s) MITK_PP_IF(p(134, s), MITK_PP_FOR_134, MITK_PP_TUPLE_EAT_4)(o(134, s), p, o, m)
+# define MITK_PP_FOR_134(s, p, o, m) MITK_PP_IF(p(135, s), m, MITK_PP_TUPLE_EAT_2)(135, s) MITK_PP_IF(p(135, s), MITK_PP_FOR_135, MITK_PP_TUPLE_EAT_4)(o(135, s), p, o, m)
+# define MITK_PP_FOR_135(s, p, o, m) MITK_PP_IF(p(136, s), m, MITK_PP_TUPLE_EAT_2)(136, s) MITK_PP_IF(p(136, s), MITK_PP_FOR_136, MITK_PP_TUPLE_EAT_4)(o(136, s), p, o, m)
+# define MITK_PP_FOR_136(s, p, o, m) MITK_PP_IF(p(137, s), m, MITK_PP_TUPLE_EAT_2)(137, s) MITK_PP_IF(p(137, s), MITK_PP_FOR_137, MITK_PP_TUPLE_EAT_4)(o(137, s), p, o, m)
+# define MITK_PP_FOR_137(s, p, o, m) MITK_PP_IF(p(138, s), m, MITK_PP_TUPLE_EAT_2)(138, s) MITK_PP_IF(p(138, s), MITK_PP_FOR_138, MITK_PP_TUPLE_EAT_4)(o(138, s), p, o, m)
+# define MITK_PP_FOR_138(s, p, o, m) MITK_PP_IF(p(139, s), m, MITK_PP_TUPLE_EAT_2)(139, s) MITK_PP_IF(p(139, s), MITK_PP_FOR_139, MITK_PP_TUPLE_EAT_4)(o(139, s), p, o, m)
+# define MITK_PP_FOR_139(s, p, o, m) MITK_PP_IF(p(140, s), m, MITK_PP_TUPLE_EAT_2)(140, s) MITK_PP_IF(p(140, s), MITK_PP_FOR_140, MITK_PP_TUPLE_EAT_4)(o(140, s), p, o, m)
+# define MITK_PP_FOR_140(s, p, o, m) MITK_PP_IF(p(141, s), m, MITK_PP_TUPLE_EAT_2)(141, s) MITK_PP_IF(p(141, s), MITK_PP_FOR_141, MITK_PP_TUPLE_EAT_4)(o(141, s), p, o, m)
+# define MITK_PP_FOR_141(s, p, o, m) MITK_PP_IF(p(142, s), m, MITK_PP_TUPLE_EAT_2)(142, s) MITK_PP_IF(p(142, s), MITK_PP_FOR_142, MITK_PP_TUPLE_EAT_4)(o(142, s), p, o, m)
+# define MITK_PP_FOR_142(s, p, o, m) MITK_PP_IF(p(143, s), m, MITK_PP_TUPLE_EAT_2)(143, s) MITK_PP_IF(p(143, s), MITK_PP_FOR_143, MITK_PP_TUPLE_EAT_4)(o(143, s), p, o, m)
+# define MITK_PP_FOR_143(s, p, o, m) MITK_PP_IF(p(144, s), m, MITK_PP_TUPLE_EAT_2)(144, s) MITK_PP_IF(p(144, s), MITK_PP_FOR_144, MITK_PP_TUPLE_EAT_4)(o(144, s), p, o, m)
+# define MITK_PP_FOR_144(s, p, o, m) MITK_PP_IF(p(145, s), m, MITK_PP_TUPLE_EAT_2)(145, s) MITK_PP_IF(p(145, s), MITK_PP_FOR_145, MITK_PP_TUPLE_EAT_4)(o(145, s), p, o, m)
+# define MITK_PP_FOR_145(s, p, o, m) MITK_PP_IF(p(146, s), m, MITK_PP_TUPLE_EAT_2)(146, s) MITK_PP_IF(p(146, s), MITK_PP_FOR_146, MITK_PP_TUPLE_EAT_4)(o(146, s), p, o, m)
+# define MITK_PP_FOR_146(s, p, o, m) MITK_PP_IF(p(147, s), m, MITK_PP_TUPLE_EAT_2)(147, s) MITK_PP_IF(p(147, s), MITK_PP_FOR_147, MITK_PP_TUPLE_EAT_4)(o(147, s), p, o, m)
+# define MITK_PP_FOR_147(s, p, o, m) MITK_PP_IF(p(148, s), m, MITK_PP_TUPLE_EAT_2)(148, s) MITK_PP_IF(p(148, s), MITK_PP_FOR_148, MITK_PP_TUPLE_EAT_4)(o(148, s), p, o, m)
+# define MITK_PP_FOR_148(s, p, o, m) MITK_PP_IF(p(149, s), m, MITK_PP_TUPLE_EAT_2)(149, s) MITK_PP_IF(p(149, s), MITK_PP_FOR_149, MITK_PP_TUPLE_EAT_4)(o(149, s), p, o, m)
+# define MITK_PP_FOR_149(s, p, o, m) MITK_PP_IF(p(150, s), m, MITK_PP_TUPLE_EAT_2)(150, s) MITK_PP_IF(p(150, s), MITK_PP_FOR_150, MITK_PP_TUPLE_EAT_4)(o(150, s), p, o, m)
+# define MITK_PP_FOR_150(s, p, o, m) MITK_PP_IF(p(151, s), m, MITK_PP_TUPLE_EAT_2)(151, s) MITK_PP_IF(p(151, s), MITK_PP_FOR_151, MITK_PP_TUPLE_EAT_4)(o(151, s), p, o, m)
+# define MITK_PP_FOR_151(s, p, o, m) MITK_PP_IF(p(152, s), m, MITK_PP_TUPLE_EAT_2)(152, s) MITK_PP_IF(p(152, s), MITK_PP_FOR_152, MITK_PP_TUPLE_EAT_4)(o(152, s), p, o, m)
+# define MITK_PP_FOR_152(s, p, o, m) MITK_PP_IF(p(153, s), m, MITK_PP_TUPLE_EAT_2)(153, s) MITK_PP_IF(p(153, s), MITK_PP_FOR_153, MITK_PP_TUPLE_EAT_4)(o(153, s), p, o, m)
+# define MITK_PP_FOR_153(s, p, o, m) MITK_PP_IF(p(154, s), m, MITK_PP_TUPLE_EAT_2)(154, s) MITK_PP_IF(p(154, s), MITK_PP_FOR_154, MITK_PP_TUPLE_EAT_4)(o(154, s), p, o, m)
+# define MITK_PP_FOR_154(s, p, o, m) MITK_PP_IF(p(155, s), m, MITK_PP_TUPLE_EAT_2)(155, s) MITK_PP_IF(p(155, s), MITK_PP_FOR_155, MITK_PP_TUPLE_EAT_4)(o(155, s), p, o, m)
+# define MITK_PP_FOR_155(s, p, o, m) MITK_PP_IF(p(156, s), m, MITK_PP_TUPLE_EAT_2)(156, s) MITK_PP_IF(p(156, s), MITK_PP_FOR_156, MITK_PP_TUPLE_EAT_4)(o(156, s), p, o, m)
+# define MITK_PP_FOR_156(s, p, o, m) MITK_PP_IF(p(157, s), m, MITK_PP_TUPLE_EAT_2)(157, s) MITK_PP_IF(p(157, s), MITK_PP_FOR_157, MITK_PP_TUPLE_EAT_4)(o(157, s), p, o, m)
+# define MITK_PP_FOR_157(s, p, o, m) MITK_PP_IF(p(158, s), m, MITK_PP_TUPLE_EAT_2)(158, s) MITK_PP_IF(p(158, s), MITK_PP_FOR_158, MITK_PP_TUPLE_EAT_4)(o(158, s), p, o, m)
+# define MITK_PP_FOR_158(s, p, o, m) MITK_PP_IF(p(159, s), m, MITK_PP_TUPLE_EAT_2)(159, s) MITK_PP_IF(p(159, s), MITK_PP_FOR_159, MITK_PP_TUPLE_EAT_4)(o(159, s), p, o, m)
+# define MITK_PP_FOR_159(s, p, o, m) MITK_PP_IF(p(160, s), m, MITK_PP_TUPLE_EAT_2)(160, s) MITK_PP_IF(p(160, s), MITK_PP_FOR_160, MITK_PP_TUPLE_EAT_4)(o(160, s), p, o, m)
+# define MITK_PP_FOR_160(s, p, o, m) MITK_PP_IF(p(161, s), m, MITK_PP_TUPLE_EAT_2)(161, s) MITK_PP_IF(p(161, s), MITK_PP_FOR_161, MITK_PP_TUPLE_EAT_4)(o(161, s), p, o, m)
+# define MITK_PP_FOR_161(s, p, o, m) MITK_PP_IF(p(162, s), m, MITK_PP_TUPLE_EAT_2)(162, s) MITK_PP_IF(p(162, s), MITK_PP_FOR_162, MITK_PP_TUPLE_EAT_4)(o(162, s), p, o, m)
+# define MITK_PP_FOR_162(s, p, o, m) MITK_PP_IF(p(163, s), m, MITK_PP_TUPLE_EAT_2)(163, s) MITK_PP_IF(p(163, s), MITK_PP_FOR_163, MITK_PP_TUPLE_EAT_4)(o(163, s), p, o, m)
+# define MITK_PP_FOR_163(s, p, o, m) MITK_PP_IF(p(164, s), m, MITK_PP_TUPLE_EAT_2)(164, s) MITK_PP_IF(p(164, s), MITK_PP_FOR_164, MITK_PP_TUPLE_EAT_4)(o(164, s), p, o, m)
+# define MITK_PP_FOR_164(s, p, o, m) MITK_PP_IF(p(165, s), m, MITK_PP_TUPLE_EAT_2)(165, s) MITK_PP_IF(p(165, s), MITK_PP_FOR_165, MITK_PP_TUPLE_EAT_4)(o(165, s), p, o, m)
+# define MITK_PP_FOR_165(s, p, o, m) MITK_PP_IF(p(166, s), m, MITK_PP_TUPLE_EAT_2)(166, s) MITK_PP_IF(p(166, s), MITK_PP_FOR_166, MITK_PP_TUPLE_EAT_4)(o(166, s), p, o, m)
+# define MITK_PP_FOR_166(s, p, o, m) MITK_PP_IF(p(167, s), m, MITK_PP_TUPLE_EAT_2)(167, s) MITK_PP_IF(p(167, s), MITK_PP_FOR_167, MITK_PP_TUPLE_EAT_4)(o(167, s), p, o, m)
+# define MITK_PP_FOR_167(s, p, o, m) MITK_PP_IF(p(168, s), m, MITK_PP_TUPLE_EAT_2)(168, s) MITK_PP_IF(p(168, s), MITK_PP_FOR_168, MITK_PP_TUPLE_EAT_4)(o(168, s), p, o, m)
+# define MITK_PP_FOR_168(s, p, o, m) MITK_PP_IF(p(169, s), m, MITK_PP_TUPLE_EAT_2)(169, s) MITK_PP_IF(p(169, s), MITK_PP_FOR_169, MITK_PP_TUPLE_EAT_4)(o(169, s), p, o, m)
+# define MITK_PP_FOR_169(s, p, o, m) MITK_PP_IF(p(170, s), m, MITK_PP_TUPLE_EAT_2)(170, s) MITK_PP_IF(p(170, s), MITK_PP_FOR_170, MITK_PP_TUPLE_EAT_4)(o(170, s), p, o, m)
+# define MITK_PP_FOR_170(s, p, o, m) MITK_PP_IF(p(171, s), m, MITK_PP_TUPLE_EAT_2)(171, s) MITK_PP_IF(p(171, s), MITK_PP_FOR_171, MITK_PP_TUPLE_EAT_4)(o(171, s), p, o, m)
+# define MITK_PP_FOR_171(s, p, o, m) MITK_PP_IF(p(172, s), m, MITK_PP_TUPLE_EAT_2)(172, s) MITK_PP_IF(p(172, s), MITK_PP_FOR_172, MITK_PP_TUPLE_EAT_4)(o(172, s), p, o, m)
+# define MITK_PP_FOR_172(s, p, o, m) MITK_PP_IF(p(173, s), m, MITK_PP_TUPLE_EAT_2)(173, s) MITK_PP_IF(p(173, s), MITK_PP_FOR_173, MITK_PP_TUPLE_EAT_4)(o(173, s), p, o, m)
+# define MITK_PP_FOR_173(s, p, o, m) MITK_PP_IF(p(174, s), m, MITK_PP_TUPLE_EAT_2)(174, s) MITK_PP_IF(p(174, s), MITK_PP_FOR_174, MITK_PP_TUPLE_EAT_4)(o(174, s), p, o, m)
+# define MITK_PP_FOR_174(s, p, o, m) MITK_PP_IF(p(175, s), m, MITK_PP_TUPLE_EAT_2)(175, s) MITK_PP_IF(p(175, s), MITK_PP_FOR_175, MITK_PP_TUPLE_EAT_4)(o(175, s), p, o, m)
+# define MITK_PP_FOR_175(s, p, o, m) MITK_PP_IF(p(176, s), m, MITK_PP_TUPLE_EAT_2)(176, s) MITK_PP_IF(p(176, s), MITK_PP_FOR_176, MITK_PP_TUPLE_EAT_4)(o(176, s), p, o, m)
+# define MITK_PP_FOR_176(s, p, o, m) MITK_PP_IF(p(177, s), m, MITK_PP_TUPLE_EAT_2)(177, s) MITK_PP_IF(p(177, s), MITK_PP_FOR_177, MITK_PP_TUPLE_EAT_4)(o(177, s), p, o, m)
+# define MITK_PP_FOR_177(s, p, o, m) MITK_PP_IF(p(178, s), m, MITK_PP_TUPLE_EAT_2)(178, s) MITK_PP_IF(p(178, s), MITK_PP_FOR_178, MITK_PP_TUPLE_EAT_4)(o(178, s), p, o, m)
+# define MITK_PP_FOR_178(s, p, o, m) MITK_PP_IF(p(179, s), m, MITK_PP_TUPLE_EAT_2)(179, s) MITK_PP_IF(p(179, s), MITK_PP_FOR_179, MITK_PP_TUPLE_EAT_4)(o(179, s), p, o, m)
+# define MITK_PP_FOR_179(s, p, o, m) MITK_PP_IF(p(180, s), m, MITK_PP_TUPLE_EAT_2)(180, s) MITK_PP_IF(p(180, s), MITK_PP_FOR_180, MITK_PP_TUPLE_EAT_4)(o(180, s), p, o, m)
+# define MITK_PP_FOR_180(s, p, o, m) MITK_PP_IF(p(181, s), m, MITK_PP_TUPLE_EAT_2)(181, s) MITK_PP_IF(p(181, s), MITK_PP_FOR_181, MITK_PP_TUPLE_EAT_4)(o(181, s), p, o, m)
+# define MITK_PP_FOR_181(s, p, o, m) MITK_PP_IF(p(182, s), m, MITK_PP_TUPLE_EAT_2)(182, s) MITK_PP_IF(p(182, s), MITK_PP_FOR_182, MITK_PP_TUPLE_EAT_4)(o(182, s), p, o, m)
+# define MITK_PP_FOR_182(s, p, o, m) MITK_PP_IF(p(183, s), m, MITK_PP_TUPLE_EAT_2)(183, s) MITK_PP_IF(p(183, s), MITK_PP_FOR_183, MITK_PP_TUPLE_EAT_4)(o(183, s), p, o, m)
+# define MITK_PP_FOR_183(s, p, o, m) MITK_PP_IF(p(184, s), m, MITK_PP_TUPLE_EAT_2)(184, s) MITK_PP_IF(p(184, s), MITK_PP_FOR_184, MITK_PP_TUPLE_EAT_4)(o(184, s), p, o, m)
+# define MITK_PP_FOR_184(s, p, o, m) MITK_PP_IF(p(185, s), m, MITK_PP_TUPLE_EAT_2)(185, s) MITK_PP_IF(p(185, s), MITK_PP_FOR_185, MITK_PP_TUPLE_EAT_4)(o(185, s), p, o, m)
+# define MITK_PP_FOR_185(s, p, o, m) MITK_PP_IF(p(186, s), m, MITK_PP_TUPLE_EAT_2)(186, s) MITK_PP_IF(p(186, s), MITK_PP_FOR_186, MITK_PP_TUPLE_EAT_4)(o(186, s), p, o, m)
+# define MITK_PP_FOR_186(s, p, o, m) MITK_PP_IF(p(187, s), m, MITK_PP_TUPLE_EAT_2)(187, s) MITK_PP_IF(p(187, s), MITK_PP_FOR_187, MITK_PP_TUPLE_EAT_4)(o(187, s), p, o, m)
+# define MITK_PP_FOR_187(s, p, o, m) MITK_PP_IF(p(188, s), m, MITK_PP_TUPLE_EAT_2)(188, s) MITK_PP_IF(p(188, s), MITK_PP_FOR_188, MITK_PP_TUPLE_EAT_4)(o(188, s), p, o, m)
+# define MITK_PP_FOR_188(s, p, o, m) MITK_PP_IF(p(189, s), m, MITK_PP_TUPLE_EAT_2)(189, s) MITK_PP_IF(p(189, s), MITK_PP_FOR_189, MITK_PP_TUPLE_EAT_4)(o(189, s), p, o, m)
+# define MITK_PP_FOR_189(s, p, o, m) MITK_PP_IF(p(190, s), m, MITK_PP_TUPLE_EAT_2)(190, s) MITK_PP_IF(p(190, s), MITK_PP_FOR_190, MITK_PP_TUPLE_EAT_4)(o(190, s), p, o, m)
+# define MITK_PP_FOR_190(s, p, o, m) MITK_PP_IF(p(191, s), m, MITK_PP_TUPLE_EAT_2)(191, s) MITK_PP_IF(p(191, s), MITK_PP_FOR_191, MITK_PP_TUPLE_EAT_4)(o(191, s), p, o, m)
+# define MITK_PP_FOR_191(s, p, o, m) MITK_PP_IF(p(192, s), m, MITK_PP_TUPLE_EAT_2)(192, s) MITK_PP_IF(p(192, s), MITK_PP_FOR_192, MITK_PP_TUPLE_EAT_4)(o(192, s), p, o, m)
+# define MITK_PP_FOR_192(s, p, o, m) MITK_PP_IF(p(193, s), m, MITK_PP_TUPLE_EAT_2)(193, s) MITK_PP_IF(p(193, s), MITK_PP_FOR_193, MITK_PP_TUPLE_EAT_4)(o(193, s), p, o, m)
+# define MITK_PP_FOR_193(s, p, o, m) MITK_PP_IF(p(194, s), m, MITK_PP_TUPLE_EAT_2)(194, s) MITK_PP_IF(p(194, s), MITK_PP_FOR_194, MITK_PP_TUPLE_EAT_4)(o(194, s), p, o, m)
+# define MITK_PP_FOR_194(s, p, o, m) MITK_PP_IF(p(195, s), m, MITK_PP_TUPLE_EAT_2)(195, s) MITK_PP_IF(p(195, s), MITK_PP_FOR_195, MITK_PP_TUPLE_EAT_4)(o(195, s), p, o, m)
+# define MITK_PP_FOR_195(s, p, o, m) MITK_PP_IF(p(196, s), m, MITK_PP_TUPLE_EAT_2)(196, s) MITK_PP_IF(p(196, s), MITK_PP_FOR_196, MITK_PP_TUPLE_EAT_4)(o(196, s), p, o, m)
+# define MITK_PP_FOR_196(s, p, o, m) MITK_PP_IF(p(197, s), m, MITK_PP_TUPLE_EAT_2)(197, s) MITK_PP_IF(p(197, s), MITK_PP_FOR_197, MITK_PP_TUPLE_EAT_4)(o(197, s), p, o, m)
+# define MITK_PP_FOR_197(s, p, o, m) MITK_PP_IF(p(198, s), m, MITK_PP_TUPLE_EAT_2)(198, s) MITK_PP_IF(p(198, s), MITK_PP_FOR_198, MITK_PP_TUPLE_EAT_4)(o(198, s), p, o, m)
+# define MITK_PP_FOR_198(s, p, o, m) MITK_PP_IF(p(199, s), m, MITK_PP_TUPLE_EAT_2)(199, s) MITK_PP_IF(p(199, s), MITK_PP_FOR_199, MITK_PP_TUPLE_EAT_4)(o(199, s), p, o, m)
+# define MITK_PP_FOR_199(s, p, o, m) MITK_PP_IF(p(200, s), m, MITK_PP_TUPLE_EAT_2)(200, s) MITK_PP_IF(p(200, s), MITK_PP_FOR_200, MITK_PP_TUPLE_EAT_4)(o(200, s), p, o, m)
+# define MITK_PP_FOR_200(s, p, o, m) MITK_PP_IF(p(201, s), m, MITK_PP_TUPLE_EAT_2)(201, s) MITK_PP_IF(p(201, s), MITK_PP_FOR_201, MITK_PP_TUPLE_EAT_4)(o(201, s), p, o, m)
+# define MITK_PP_FOR_201(s, p, o, m) MITK_PP_IF(p(202, s), m, MITK_PP_TUPLE_EAT_2)(202, s) MITK_PP_IF(p(202, s), MITK_PP_FOR_202, MITK_PP_TUPLE_EAT_4)(o(202, s), p, o, m)
+# define MITK_PP_FOR_202(s, p, o, m) MITK_PP_IF(p(203, s), m, MITK_PP_TUPLE_EAT_2)(203, s) MITK_PP_IF(p(203, s), MITK_PP_FOR_203, MITK_PP_TUPLE_EAT_4)(o(203, s), p, o, m)
+# define MITK_PP_FOR_203(s, p, o, m) MITK_PP_IF(p(204, s), m, MITK_PP_TUPLE_EAT_2)(204, s) MITK_PP_IF(p(204, s), MITK_PP_FOR_204, MITK_PP_TUPLE_EAT_4)(o(204, s), p, o, m)
+# define MITK_PP_FOR_204(s, p, o, m) MITK_PP_IF(p(205, s), m, MITK_PP_TUPLE_EAT_2)(205, s) MITK_PP_IF(p(205, s), MITK_PP_FOR_205, MITK_PP_TUPLE_EAT_4)(o(205, s), p, o, m)
+# define MITK_PP_FOR_205(s, p, o, m) MITK_PP_IF(p(206, s), m, MITK_PP_TUPLE_EAT_2)(206, s) MITK_PP_IF(p(206, s), MITK_PP_FOR_206, MITK_PP_TUPLE_EAT_4)(o(206, s), p, o, m)
+# define MITK_PP_FOR_206(s, p, o, m) MITK_PP_IF(p(207, s), m, MITK_PP_TUPLE_EAT_2)(207, s) MITK_PP_IF(p(207, s), MITK_PP_FOR_207, MITK_PP_TUPLE_EAT_4)(o(207, s), p, o, m)
+# define MITK_PP_FOR_207(s, p, o, m) MITK_PP_IF(p(208, s), m, MITK_PP_TUPLE_EAT_2)(208, s) MITK_PP_IF(p(208, s), MITK_PP_FOR_208, MITK_PP_TUPLE_EAT_4)(o(208, s), p, o, m)
+# define MITK_PP_FOR_208(s, p, o, m) MITK_PP_IF(p(209, s), m, MITK_PP_TUPLE_EAT_2)(209, s) MITK_PP_IF(p(209, s), MITK_PP_FOR_209, MITK_PP_TUPLE_EAT_4)(o(209, s), p, o, m)
+# define MITK_PP_FOR_209(s, p, o, m) MITK_PP_IF(p(210, s), m, MITK_PP_TUPLE_EAT_2)(210, s) MITK_PP_IF(p(210, s), MITK_PP_FOR_210, MITK_PP_TUPLE_EAT_4)(o(210, s), p, o, m)
+# define MITK_PP_FOR_210(s, p, o, m) MITK_PP_IF(p(211, s), m, MITK_PP_TUPLE_EAT_2)(211, s) MITK_PP_IF(p(211, s), MITK_PP_FOR_211, MITK_PP_TUPLE_EAT_4)(o(211, s), p, o, m)
+# define MITK_PP_FOR_211(s, p, o, m) MITK_PP_IF(p(212, s), m, MITK_PP_TUPLE_EAT_2)(212, s) MITK_PP_IF(p(212, s), MITK_PP_FOR_212, MITK_PP_TUPLE_EAT_4)(o(212, s), p, o, m)
+# define MITK_PP_FOR_212(s, p, o, m) MITK_PP_IF(p(213, s), m, MITK_PP_TUPLE_EAT_2)(213, s) MITK_PP_IF(p(213, s), MITK_PP_FOR_213, MITK_PP_TUPLE_EAT_4)(o(213, s), p, o, m)
+# define MITK_PP_FOR_213(s, p, o, m) MITK_PP_IF(p(214, s), m, MITK_PP_TUPLE_EAT_2)(214, s) MITK_PP_IF(p(214, s), MITK_PP_FOR_214, MITK_PP_TUPLE_EAT_4)(o(214, s), p, o, m)
+# define MITK_PP_FOR_214(s, p, o, m) MITK_PP_IF(p(215, s), m, MITK_PP_TUPLE_EAT_2)(215, s) MITK_PP_IF(p(215, s), MITK_PP_FOR_215, MITK_PP_TUPLE_EAT_4)(o(215, s), p, o, m)
+# define MITK_PP_FOR_215(s, p, o, m) MITK_PP_IF(p(216, s), m, MITK_PP_TUPLE_EAT_2)(216, s) MITK_PP_IF(p(216, s), MITK_PP_FOR_216, MITK_PP_TUPLE_EAT_4)(o(216, s), p, o, m)
+# define MITK_PP_FOR_216(s, p, o, m) MITK_PP_IF(p(217, s), m, MITK_PP_TUPLE_EAT_2)(217, s) MITK_PP_IF(p(217, s), MITK_PP_FOR_217, MITK_PP_TUPLE_EAT_4)(o(217, s), p, o, m)
+# define MITK_PP_FOR_217(s, p, o, m) MITK_PP_IF(p(218, s), m, MITK_PP_TUPLE_EAT_2)(218, s) MITK_PP_IF(p(218, s), MITK_PP_FOR_218, MITK_PP_TUPLE_EAT_4)(o(218, s), p, o, m)
+# define MITK_PP_FOR_218(s, p, o, m) MITK_PP_IF(p(219, s), m, MITK_PP_TUPLE_EAT_2)(219, s) MITK_PP_IF(p(219, s), MITK_PP_FOR_219, MITK_PP_TUPLE_EAT_4)(o(219, s), p, o, m)
+# define MITK_PP_FOR_219(s, p, o, m) MITK_PP_IF(p(220, s), m, MITK_PP_TUPLE_EAT_2)(220, s) MITK_PP_IF(p(220, s), MITK_PP_FOR_220, MITK_PP_TUPLE_EAT_4)(o(220, s), p, o, m)
+# define MITK_PP_FOR_220(s, p, o, m) MITK_PP_IF(p(221, s), m, MITK_PP_TUPLE_EAT_2)(221, s) MITK_PP_IF(p(221, s), MITK_PP_FOR_221, MITK_PP_TUPLE_EAT_4)(o(221, s), p, o, m)
+# define MITK_PP_FOR_221(s, p, o, m) MITK_PP_IF(p(222, s), m, MITK_PP_TUPLE_EAT_2)(222, s) MITK_PP_IF(p(222, s), MITK_PP_FOR_222, MITK_PP_TUPLE_EAT_4)(o(222, s), p, o, m)
+# define MITK_PP_FOR_222(s, p, o, m) MITK_PP_IF(p(223, s), m, MITK_PP_TUPLE_EAT_2)(223, s) MITK_PP_IF(p(223, s), MITK_PP_FOR_223, MITK_PP_TUPLE_EAT_4)(o(223, s), p, o, m)
+# define MITK_PP_FOR_223(s, p, o, m) MITK_PP_IF(p(224, s), m, MITK_PP_TUPLE_EAT_2)(224, s) MITK_PP_IF(p(224, s), MITK_PP_FOR_224, MITK_PP_TUPLE_EAT_4)(o(224, s), p, o, m)
+# define MITK_PP_FOR_224(s, p, o, m) MITK_PP_IF(p(225, s), m, MITK_PP_TUPLE_EAT_2)(225, s) MITK_PP_IF(p(225, s), MITK_PP_FOR_225, MITK_PP_TUPLE_EAT_4)(o(225, s), p, o, m)
+# define MITK_PP_FOR_225(s, p, o, m) MITK_PP_IF(p(226, s), m, MITK_PP_TUPLE_EAT_2)(226, s) MITK_PP_IF(p(226, s), MITK_PP_FOR_226, MITK_PP_TUPLE_EAT_4)(o(226, s), p, o, m)
+# define MITK_PP_FOR_226(s, p, o, m) MITK_PP_IF(p(227, s), m, MITK_PP_TUPLE_EAT_2)(227, s) MITK_PP_IF(p(227, s), MITK_PP_FOR_227, MITK_PP_TUPLE_EAT_4)(o(227, s), p, o, m)
+# define MITK_PP_FOR_227(s, p, o, m) MITK_PP_IF(p(228, s), m, MITK_PP_TUPLE_EAT_2)(228, s) MITK_PP_IF(p(228, s), MITK_PP_FOR_228, MITK_PP_TUPLE_EAT_4)(o(228, s), p, o, m)
+# define MITK_PP_FOR_228(s, p, o, m) MITK_PP_IF(p(229, s), m, MITK_PP_TUPLE_EAT_2)(229, s) MITK_PP_IF(p(229, s), MITK_PP_FOR_229, MITK_PP_TUPLE_EAT_4)(o(229, s), p, o, m)
+# define MITK_PP_FOR_229(s, p, o, m) MITK_PP_IF(p(230, s), m, MITK_PP_TUPLE_EAT_2)(230, s) MITK_PP_IF(p(230, s), MITK_PP_FOR_230, MITK_PP_TUPLE_EAT_4)(o(230, s), p, o, m)
+# define MITK_PP_FOR_230(s, p, o, m) MITK_PP_IF(p(231, s), m, MITK_PP_TUPLE_EAT_2)(231, s) MITK_PP_IF(p(231, s), MITK_PP_FOR_231, MITK_PP_TUPLE_EAT_4)(o(231, s), p, o, m)
+# define MITK_PP_FOR_231(s, p, o, m) MITK_PP_IF(p(232, s), m, MITK_PP_TUPLE_EAT_2)(232, s) MITK_PP_IF(p(232, s), MITK_PP_FOR_232, MITK_PP_TUPLE_EAT_4)(o(232, s), p, o, m)
+# define MITK_PP_FOR_232(s, p, o, m) MITK_PP_IF(p(233, s), m, MITK_PP_TUPLE_EAT_2)(233, s) MITK_PP_IF(p(233, s), MITK_PP_FOR_233, MITK_PP_TUPLE_EAT_4)(o(233, s), p, o, m)
+# define MITK_PP_FOR_233(s, p, o, m) MITK_PP_IF(p(234, s), m, MITK_PP_TUPLE_EAT_2)(234, s) MITK_PP_IF(p(234, s), MITK_PP_FOR_234, MITK_PP_TUPLE_EAT_4)(o(234, s), p, o, m)
+# define MITK_PP_FOR_234(s, p, o, m) MITK_PP_IF(p(235, s), m, MITK_PP_TUPLE_EAT_2)(235, s) MITK_PP_IF(p(235, s), MITK_PP_FOR_235, MITK_PP_TUPLE_EAT_4)(o(235, s), p, o, m)
+# define MITK_PP_FOR_235(s, p, o, m) MITK_PP_IF(p(236, s), m, MITK_PP_TUPLE_EAT_2)(236, s) MITK_PP_IF(p(236, s), MITK_PP_FOR_236, MITK_PP_TUPLE_EAT_4)(o(236, s), p, o, m)
+# define MITK_PP_FOR_236(s, p, o, m) MITK_PP_IF(p(237, s), m, MITK_PP_TUPLE_EAT_2)(237, s) MITK_PP_IF(p(237, s), MITK_PP_FOR_237, MITK_PP_TUPLE_EAT_4)(o(237, s), p, o, m)
+# define MITK_PP_FOR_237(s, p, o, m) MITK_PP_IF(p(238, s), m, MITK_PP_TUPLE_EAT_2)(238, s) MITK_PP_IF(p(238, s), MITK_PP_FOR_238, MITK_PP_TUPLE_EAT_4)(o(238, s), p, o, m)
+# define MITK_PP_FOR_238(s, p, o, m) MITK_PP_IF(p(239, s), m, MITK_PP_TUPLE_EAT_2)(239, s) MITK_PP_IF(p(239, s), MITK_PP_FOR_239, MITK_PP_TUPLE_EAT_4)(o(239, s), p, o, m)
+# define MITK_PP_FOR_239(s, p, o, m) MITK_PP_IF(p(240, s), m, MITK_PP_TUPLE_EAT_2)(240, s) MITK_PP_IF(p(240, s), MITK_PP_FOR_240, MITK_PP_TUPLE_EAT_4)(o(240, s), p, o, m)
+# define MITK_PP_FOR_240(s, p, o, m) MITK_PP_IF(p(241, s), m, MITK_PP_TUPLE_EAT_2)(241, s) MITK_PP_IF(p(241, s), MITK_PP_FOR_241, MITK_PP_TUPLE_EAT_4)(o(241, s), p, o, m)
+# define MITK_PP_FOR_241(s, p, o, m) MITK_PP_IF(p(242, s), m, MITK_PP_TUPLE_EAT_2)(242, s) MITK_PP_IF(p(242, s), MITK_PP_FOR_242, MITK_PP_TUPLE_EAT_4)(o(242, s), p, o, m)
+# define MITK_PP_FOR_242(s, p, o, m) MITK_PP_IF(p(243, s), m, MITK_PP_TUPLE_EAT_2)(243, s) MITK_PP_IF(p(243, s), MITK_PP_FOR_243, MITK_PP_TUPLE_EAT_4)(o(243, s), p, o, m)
+# define MITK_PP_FOR_243(s, p, o, m) MITK_PP_IF(p(244, s), m, MITK_PP_TUPLE_EAT_2)(244, s) MITK_PP_IF(p(244, s), MITK_PP_FOR_244, MITK_PP_TUPLE_EAT_4)(o(244, s), p, o, m)
+# define MITK_PP_FOR_244(s, p, o, m) MITK_PP_IF(p(245, s), m, MITK_PP_TUPLE_EAT_2)(245, s) MITK_PP_IF(p(245, s), MITK_PP_FOR_245, MITK_PP_TUPLE_EAT_4)(o(245, s), p, o, m)
+# define MITK_PP_FOR_245(s, p, o, m) MITK_PP_IF(p(246, s), m, MITK_PP_TUPLE_EAT_2)(246, s) MITK_PP_IF(p(246, s), MITK_PP_FOR_246, MITK_PP_TUPLE_EAT_4)(o(246, s), p, o, m)
+# define MITK_PP_FOR_246(s, p, o, m) MITK_PP_IF(p(247, s), m, MITK_PP_TUPLE_EAT_2)(247, s) MITK_PP_IF(p(247, s), MITK_PP_FOR_247, MITK_PP_TUPLE_EAT_4)(o(247, s), p, o, m)
+# define MITK_PP_FOR_247(s, p, o, m) MITK_PP_IF(p(248, s), m, MITK_PP_TUPLE_EAT_2)(248, s) MITK_PP_IF(p(248, s), MITK_PP_FOR_248, MITK_PP_TUPLE_EAT_4)(o(248, s), p, o, m)
+# define MITK_PP_FOR_248(s, p, o, m) MITK_PP_IF(p(249, s), m, MITK_PP_TUPLE_EAT_2)(249, s) MITK_PP_IF(p(249, s), MITK_PP_FOR_249, MITK_PP_TUPLE_EAT_4)(o(249, s), p, o, m)
+# define MITK_PP_FOR_249(s, p, o, m) MITK_PP_IF(p(250, s), m, MITK_PP_TUPLE_EAT_2)(250, s) MITK_PP_IF(p(250, s), MITK_PP_FOR_250, MITK_PP_TUPLE_EAT_4)(o(250, s), p, o, m)
+# define MITK_PP_FOR_250(s, p, o, m) MITK_PP_IF(p(251, s), m, MITK_PP_TUPLE_EAT_2)(251, s) MITK_PP_IF(p(251, s), MITK_PP_FOR_251, MITK_PP_TUPLE_EAT_4)(o(251, s), p, o, m)
+# define MITK_PP_FOR_251(s, p, o, m) MITK_PP_IF(p(252, s), m, MITK_PP_TUPLE_EAT_2)(252, s) MITK_PP_IF(p(252, s), MITK_PP_FOR_252, MITK_PP_TUPLE_EAT_4)(o(252, s), p, o, m)
+# define MITK_PP_FOR_252(s, p, o, m) MITK_PP_IF(p(253, s), m, MITK_PP_TUPLE_EAT_2)(253, s) MITK_PP_IF(p(253, s), MITK_PP_FOR_253, MITK_PP_TUPLE_EAT_4)(o(253, s), p, o, m)
+# define MITK_PP_FOR_253(s, p, o, m) MITK_PP_IF(p(254, s), m, MITK_PP_TUPLE_EAT_2)(254, s) MITK_PP_IF(p(254, s), MITK_PP_FOR_254, MITK_PP_TUPLE_EAT_4)(o(254, s), p, o, m)
+# define MITK_PP_FOR_254(s, p, o, m) MITK_PP_IF(p(255, s), m, MITK_PP_TUPLE_EAT_2)(255, s) MITK_PP_IF(p(255, s), MITK_PP_FOR_255, MITK_PP_TUPLE_EAT_4)(o(255, s), p, o, m)
+# define MITK_PP_FOR_255(s, p, o, m) MITK_PP_IF(p(256, s), m, MITK_PP_TUPLE_EAT_2)(256, s) MITK_PP_IF(p(256, s), MITK_PP_FOR_256, MITK_PP_TUPLE_EAT_4)(o(256, s), p, o, m)
+# define MITK_PP_FOR_256(s, p, o, m) MITK_PP_IF(p(257, s), m, MITK_PP_TUPLE_EAT_2)(257, s) MITK_PP_IF(p(257, s), MITK_PP_FOR_257, MITK_PP_TUPLE_EAT_4)(o(257, s), p, o, m)
+#
+# endif
diff --git a/Core/Code/Algorithms/mitkPPRepetitionFor.h b/Core/Code/Algorithms/mitkPPRepetitionFor.h
new file mode 100644
index 0000000000..e2668b5943
--- /dev/null
+++ b/Core/Code/Algorithms/mitkPPRepetitionFor.h
@@ -0,0 +1,306 @@
+# /* Copyright (C) 2001
+# * Housemarque Oy
+# * http://www.housemarque.com
+# *
+# * Distributed under the Boost Software License, Version 1.0. (See
+# * accompanying file LICENSE_1_0.txt or copy at
+# * http://www.boost.org/LICENSE_1_0.txt)
+# */
+#
+# /* Revised by Paul Mensonides (2002) */
+#
+# /* See http://www.boost.org for most recent version. */
+#
+# ifndef MITK_PREPROCESSOR_REPETITION_FOR_HPP
+# define MITK_PREPROCESSOR_REPETITION_FOR_HPP
+#
+# include "mitkPPCat.h"
+# include "mitkPPDebugError.h"
+# include "mitkPPDetailAutoRec.h"
+#
+# /* MITK_PP_FOR */
+#
+# if 0
+# define MITK_PP_FOR(state, pred, op, macro)
+# endif
+#
+# define MITK_PP_FOR MITK_PP_CAT(MITK_PP_FOR_, MITK_PP_AUTO_REC(MITK_PP_FOR_P, 256))
+#
+# define MITK_PP_FOR_P(n) MITK_PP_CAT(MITK_PP_FOR_CHECK_, MITK_PP_FOR_ ## n(1, MITK_PP_FOR_SR_P, MITK_PP_FOR_SR_O, MITK_PP_FOR_SR_M))
+#
+# define MITK_PP_FOR_SR_P(r, s) s
+# define MITK_PP_FOR_SR_O(r, s) 0
+# define MITK_PP_FOR_SR_M(r, s) MITK_PP_NIL
+#
+# if MITK_PP_CONFIG_FLAGS() & MITK_PP_CONFIG_EDG()
+# include "mitkPPRepetitionDetailEDGFor.h"
+# elif MITK_PP_CONFIG_FLAGS() & MITK_PP_CONFIG_MSVC()
+# include "mitkPPRepetitionDetailMSVCFor.h"
+# elif MITK_PP_CONFIG_FLAGS() & MITK_PP_CONFIG_DMC()
+# include "mitkPPRepetitionDetailDMCFor.h"
+# else
+# include "mitkPPRepetitionDetailFor.h"
+# endif
+#
+# define MITK_PP_FOR_257(s, p, o, m) MITK_PP_ERROR(0x0002)
+#
+# define MITK_PP_FOR_CHECK_MITK_PP_NIL 1
+#
+# define MITK_PP_FOR_CHECK_MITK_PP_FOR_1(s, p, o, m) 0
+# define MITK_PP_FOR_CHECK_MITK_PP_FOR_2(s, p, o, m) 0
+# define MITK_PP_FOR_CHECK_MITK_PP_FOR_3(s, p, o, m) 0
+# define MITK_PP_FOR_CHECK_MITK_PP_FOR_4(s, p, o, m) 0
+# define MITK_PP_FOR_CHECK_MITK_PP_FOR_5(s, p, o, m) 0
+# define MITK_PP_FOR_CHECK_MITK_PP_FOR_6(s, p, o, m) 0
+# define MITK_PP_FOR_CHECK_MITK_PP_FOR_7(s, p, o, m) 0
+# define MITK_PP_FOR_CHECK_MITK_PP_FOR_8(s, p, o, m) 0
+# define MITK_PP_FOR_CHECK_MITK_PP_FOR_9(s, p, o, m) 0
+# define MITK_PP_FOR_CHECK_MITK_PP_FOR_10(s, p, o, m) 0
+# define MITK_PP_FOR_CHECK_MITK_PP_FOR_11(s, p, o, m) 0
+# define MITK_PP_FOR_CHECK_MITK_PP_FOR_12(s, p, o, m) 0
+# define MITK_PP_FOR_CHECK_MITK_PP_FOR_13(s, p, o, m) 0
+# define MITK_PP_FOR_CHECK_MITK_PP_FOR_14(s, p, o, m) 0
+# define MITK_PP_FOR_CHECK_MITK_PP_FOR_15(s, p, o, m) 0
+# define MITK_PP_FOR_CHECK_MITK_PP_FOR_16(s, p, o, m) 0
+# define MITK_PP_FOR_CHECK_MITK_PP_FOR_17(s, p, o, m) 0
+# define MITK_PP_FOR_CHECK_MITK_PP_FOR_18(s, p, o, m) 0
+# define MITK_PP_FOR_CHECK_MITK_PP_FOR_19(s, p, o, m) 0
+# define MITK_PP_FOR_CHECK_MITK_PP_FOR_20(s, p, o, m) 0
+# define MITK_PP_FOR_CHECK_MITK_PP_FOR_21(s, p, o, m) 0
+# define MITK_PP_FOR_CHECK_MITK_PP_FOR_22(s, p, o, m) 0
+# define MITK_PP_FOR_CHECK_MITK_PP_FOR_23(s, p, o, m) 0
+# define MITK_PP_FOR_CHECK_MITK_PP_FOR_24(s, p, o, m) 0
+# define MITK_PP_FOR_CHECK_MITK_PP_FOR_25(s, p, o, m) 0
+# define MITK_PP_FOR_CHECK_MITK_PP_FOR_26(s, p, o, m) 0
+# define MITK_PP_FOR_CHECK_MITK_PP_FOR_27(s, p, o, m) 0
+# define MITK_PP_FOR_CHECK_MITK_PP_FOR_28(s, p, o, m) 0
+# define MITK_PP_FOR_CHECK_MITK_PP_FOR_29(s, p, o, m) 0
+# define MITK_PP_FOR_CHECK_MITK_PP_FOR_30(s, p, o, m) 0
+# define MITK_PP_FOR_CHECK_MITK_PP_FOR_31(s, p, o, m) 0
+# define MITK_PP_FOR_CHECK_MITK_PP_FOR_32(s, p, o, m) 0
+# define MITK_PP_FOR_CHECK_MITK_PP_FOR_33(s, p, o, m) 0
+# define MITK_PP_FOR_CHECK_MITK_PP_FOR_34(s, p, o, m) 0
+# define MITK_PP_FOR_CHECK_MITK_PP_FOR_35(s, p, o, m) 0
+# define MITK_PP_FOR_CHECK_MITK_PP_FOR_36(s, p, o, m) 0
+# define MITK_PP_FOR_CHECK_MITK_PP_FOR_37(s, p, o, m) 0
+# define MITK_PP_FOR_CHECK_MITK_PP_FOR_38(s, p, o, m) 0
+# define MITK_PP_FOR_CHECK_MITK_PP_FOR_39(s, p, o, m) 0
+# define MITK_PP_FOR_CHECK_MITK_PP_FOR_40(s, p, o, m) 0
+# define MITK_PP_FOR_CHECK_MITK_PP_FOR_41(s, p, o, m) 0
+# define MITK_PP_FOR_CHECK_MITK_PP_FOR_42(s, p, o, m) 0
+# define MITK_PP_FOR_CHECK_MITK_PP_FOR_43(s, p, o, m) 0
+# define MITK_PP_FOR_CHECK_MITK_PP_FOR_44(s, p, o, m) 0
+# define MITK_PP_FOR_CHECK_MITK_PP_FOR_45(s, p, o, m) 0
+# define MITK_PP_FOR_CHECK_MITK_PP_FOR_46(s, p, o, m) 0
+# define MITK_PP_FOR_CHECK_MITK_PP_FOR_47(s, p, o, m) 0
+# define MITK_PP_FOR_CHECK_MITK_PP_FOR_48(s, p, o, m) 0
+# define MITK_PP_FOR_CHECK_MITK_PP_FOR_49(s, p, o, m) 0
+# define MITK_PP_FOR_CHECK_MITK_PP_FOR_50(s, p, o, m) 0
+# define MITK_PP_FOR_CHECK_MITK_PP_FOR_51(s, p, o, m) 0
+# define MITK_PP_FOR_CHECK_MITK_PP_FOR_52(s, p, o, m) 0
+# define MITK_PP_FOR_CHECK_MITK_PP_FOR_53(s, p, o, m) 0
+# define MITK_PP_FOR_CHECK_MITK_PP_FOR_54(s, p, o, m) 0
+# define MITK_PP_FOR_CHECK_MITK_PP_FOR_55(s, p, o, m) 0
+# define MITK_PP_FOR_CHECK_MITK_PP_FOR_56(s, p, o, m) 0
+# define MITK_PP_FOR_CHECK_MITK_PP_FOR_57(s, p, o, m) 0
+# define MITK_PP_FOR_CHECK_MITK_PP_FOR_58(s, p, o, m) 0
+# define MITK_PP_FOR_CHECK_MITK_PP_FOR_59(s, p, o, m) 0
+# define MITK_PP_FOR_CHECK_MITK_PP_FOR_60(s, p, o, m) 0
+# define MITK_PP_FOR_CHECK_MITK_PP_FOR_61(s, p, o, m) 0
+# define MITK_PP_FOR_CHECK_MITK_PP_FOR_62(s, p, o, m) 0
+# define MITK_PP_FOR_CHECK_MITK_PP_FOR_63(s, p, o, m) 0
+# define MITK_PP_FOR_CHECK_MITK_PP_FOR_64(s, p, o, m) 0
+# define MITK_PP_FOR_CHECK_MITK_PP_FOR_65(s, p, o, m) 0
+# define MITK_PP_FOR_CHECK_MITK_PP_FOR_66(s, p, o, m) 0
+# define MITK_PP_FOR_CHECK_MITK_PP_FOR_67(s, p, o, m) 0
+# define MITK_PP_FOR_CHECK_MITK_PP_FOR_68(s, p, o, m) 0
+# define MITK_PP_FOR_CHECK_MITK_PP_FOR_69(s, p, o, m) 0
+# define MITK_PP_FOR_CHECK_MITK_PP_FOR_70(s, p, o, m) 0
+# define MITK_PP_FOR_CHECK_MITK_PP_FOR_71(s, p, o, m) 0
+# define MITK_PP_FOR_CHECK_MITK_PP_FOR_72(s, p, o, m) 0
+# define MITK_PP_FOR_CHECK_MITK_PP_FOR_73(s, p, o, m) 0
+# define MITK_PP_FOR_CHECK_MITK_PP_FOR_74(s, p, o, m) 0
+# define MITK_PP_FOR_CHECK_MITK_PP_FOR_75(s, p, o, m) 0
+# define MITK_PP_FOR_CHECK_MITK_PP_FOR_76(s, p, o, m) 0
+# define MITK_PP_FOR_CHECK_MITK_PP_FOR_77(s, p, o, m) 0
+# define MITK_PP_FOR_CHECK_MITK_PP_FOR_78(s, p, o, m) 0
+# define MITK_PP_FOR_CHECK_MITK_PP_FOR_79(s, p, o, m) 0
+# define MITK_PP_FOR_CHECK_MITK_PP_FOR_80(s, p, o, m) 0
+# define MITK_PP_FOR_CHECK_MITK_PP_FOR_81(s, p, o, m) 0
+# define MITK_PP_FOR_CHECK_MITK_PP_FOR_82(s, p, o, m) 0
+# define MITK_PP_FOR_CHECK_MITK_PP_FOR_83(s, p, o, m) 0
+# define MITK_PP_FOR_CHECK_MITK_PP_FOR_84(s, p, o, m) 0
+# define MITK_PP_FOR_CHECK_MITK_PP_FOR_85(s, p, o, m) 0
+# define MITK_PP_FOR_CHECK_MITK_PP_FOR_86(s, p, o, m) 0
+# define MITK_PP_FOR_CHECK_MITK_PP_FOR_87(s, p, o, m) 0
+# define MITK_PP_FOR_CHECK_MITK_PP_FOR_88(s, p, o, m) 0
+# define MITK_PP_FOR_CHECK_MITK_PP_FOR_89(s, p, o, m) 0
+# define MITK_PP_FOR_CHECK_MITK_PP_FOR_90(s, p, o, m) 0
+# define MITK_PP_FOR_CHECK_MITK_PP_FOR_91(s, p, o, m) 0
+# define MITK_PP_FOR_CHECK_MITK_PP_FOR_92(s, p, o, m) 0
+# define MITK_PP_FOR_CHECK_MITK_PP_FOR_93(s, p, o, m) 0
+# define MITK_PP_FOR_CHECK_MITK_PP_FOR_94(s, p, o, m) 0
+# define MITK_PP_FOR_CHECK_MITK_PP_FOR_95(s, p, o, m) 0
+# define MITK_PP_FOR_CHECK_MITK_PP_FOR_96(s, p, o, m) 0
+# define MITK_PP_FOR_CHECK_MITK_PP_FOR_97(s, p, o, m) 0
+# define MITK_PP_FOR_CHECK_MITK_PP_FOR_98(s, p, o, m) 0
+# define MITK_PP_FOR_CHECK_MITK_PP_FOR_99(s, p, o, m) 0
+# define MITK_PP_FOR_CHECK_MITK_PP_FOR_100(s, p, o, m) 0
+# define MITK_PP_FOR_CHECK_MITK_PP_FOR_101(s, p, o, m) 0
+# define MITK_PP_FOR_CHECK_MITK_PP_FOR_102(s, p, o, m) 0
+# define MITK_PP_FOR_CHECK_MITK_PP_FOR_103(s, p, o, m) 0
+# define MITK_PP_FOR_CHECK_MITK_PP_FOR_104(s, p, o, m) 0
+# define MITK_PP_FOR_CHECK_MITK_PP_FOR_105(s, p, o, m) 0
+# define MITK_PP_FOR_CHECK_MITK_PP_FOR_106(s, p, o, m) 0
+# define MITK_PP_FOR_CHECK_MITK_PP_FOR_107(s, p, o, m) 0
+# define MITK_PP_FOR_CHECK_MITK_PP_FOR_108(s, p, o, m) 0
+# define MITK_PP_FOR_CHECK_MITK_PP_FOR_109(s, p, o, m) 0
+# define MITK_PP_FOR_CHECK_MITK_PP_FOR_110(s, p, o, m) 0
+# define MITK_PP_FOR_CHECK_MITK_PP_FOR_111(s, p, o, m) 0
+# define MITK_PP_FOR_CHECK_MITK_PP_FOR_112(s, p, o, m) 0
+# define MITK_PP_FOR_CHECK_MITK_PP_FOR_113(s, p, o, m) 0
+# define MITK_PP_FOR_CHECK_MITK_PP_FOR_114(s, p, o, m) 0
+# define MITK_PP_FOR_CHECK_MITK_PP_FOR_115(s, p, o, m) 0
+# define MITK_PP_FOR_CHECK_MITK_PP_FOR_116(s, p, o, m) 0
+# define MITK_PP_FOR_CHECK_MITK_PP_FOR_117(s, p, o, m) 0
+# define MITK_PP_FOR_CHECK_MITK_PP_FOR_118(s, p, o, m) 0
+# define MITK_PP_FOR_CHECK_MITK_PP_FOR_119(s, p, o, m) 0
+# define MITK_PP_FOR_CHECK_MITK_PP_FOR_120(s, p, o, m) 0
+# define MITK_PP_FOR_CHECK_MITK_PP_FOR_121(s, p, o, m) 0
+# define MITK_PP_FOR_CHECK_MITK_PP_FOR_122(s, p, o, m) 0
+# define MITK_PP_FOR_CHECK_MITK_PP_FOR_123(s, p, o, m) 0
+# define MITK_PP_FOR_CHECK_MITK_PP_FOR_124(s, p, o, m) 0
+# define MITK_PP_FOR_CHECK_MITK_PP_FOR_125(s, p, o, m) 0
+# define MITK_PP_FOR_CHECK_MITK_PP_FOR_126(s, p, o, m) 0
+# define MITK_PP_FOR_CHECK_MITK_PP_FOR_127(s, p, o, m) 0
+# define MITK_PP_FOR_CHECK_MITK_PP_FOR_128(s, p, o, m) 0
+# define MITK_PP_FOR_CHECK_MITK_PP_FOR_129(s, p, o, m) 0
+# define MITK_PP_FOR_CHECK_MITK_PP_FOR_130(s, p, o, m) 0
+# define MITK_PP_FOR_CHECK_MITK_PP_FOR_131(s, p, o, m) 0
+# define MITK_PP_FOR_CHECK_MITK_PP_FOR_132(s, p, o, m) 0
+# define MITK_PP_FOR_CHECK_MITK_PP_FOR_133(s, p, o, m) 0
+# define MITK_PP_FOR_CHECK_MITK_PP_FOR_134(s, p, o, m) 0
+# define MITK_PP_FOR_CHECK_MITK_PP_FOR_135(s, p, o, m) 0
+# define MITK_PP_FOR_CHECK_MITK_PP_FOR_136(s, p, o, m) 0
+# define MITK_PP_FOR_CHECK_MITK_PP_FOR_137(s, p, o, m) 0
+# define MITK_PP_FOR_CHECK_MITK_PP_FOR_138(s, p, o, m) 0
+# define MITK_PP_FOR_CHECK_MITK_PP_FOR_139(s, p, o, m) 0
+# define MITK_PP_FOR_CHECK_MITK_PP_FOR_140(s, p, o, m) 0
+# define MITK_PP_FOR_CHECK_MITK_PP_FOR_141(s, p, o, m) 0
+# define MITK_PP_FOR_CHECK_MITK_PP_FOR_142(s, p, o, m) 0
+# define MITK_PP_FOR_CHECK_MITK_PP_FOR_143(s, p, o, m) 0
+# define MITK_PP_FOR_CHECK_MITK_PP_FOR_144(s, p, o, m) 0
+# define MITK_PP_FOR_CHECK_MITK_PP_FOR_145(s, p, o, m) 0
+# define MITK_PP_FOR_CHECK_MITK_PP_FOR_146(s, p, o, m) 0
+# define MITK_PP_FOR_CHECK_MITK_PP_FOR_147(s, p, o, m) 0
+# define MITK_PP_FOR_CHECK_MITK_PP_FOR_148(s, p, o, m) 0
+# define MITK_PP_FOR_CHECK_MITK_PP_FOR_149(s, p, o, m) 0
+# define MITK_PP_FOR_CHECK_MITK_PP_FOR_150(s, p, o, m) 0
+# define MITK_PP_FOR_CHECK_MITK_PP_FOR_151(s, p, o, m) 0
+# define MITK_PP_FOR_CHECK_MITK_PP_FOR_152(s, p, o, m) 0
+# define MITK_PP_FOR_CHECK_MITK_PP_FOR_153(s, p, o, m) 0
+# define MITK_PP_FOR_CHECK_MITK_PP_FOR_154(s, p, o, m) 0
+# define MITK_PP_FOR_CHECK_MITK_PP_FOR_155(s, p, o, m) 0
+# define MITK_PP_FOR_CHECK_MITK_PP_FOR_156(s, p, o, m) 0
+# define MITK_PP_FOR_CHECK_MITK_PP_FOR_157(s, p, o, m) 0
+# define MITK_PP_FOR_CHECK_MITK_PP_FOR_158(s, p, o, m) 0
+# define MITK_PP_FOR_CHECK_MITK_PP_FOR_159(s, p, o, m) 0
+# define MITK_PP_FOR_CHECK_MITK_PP_FOR_160(s, p, o, m) 0
+# define MITK_PP_FOR_CHECK_MITK_PP_FOR_161(s, p, o, m) 0
+# define MITK_PP_FOR_CHECK_MITK_PP_FOR_162(s, p, o, m) 0
+# define MITK_PP_FOR_CHECK_MITK_PP_FOR_163(s, p, o, m) 0
+# define MITK_PP_FOR_CHECK_MITK_PP_FOR_164(s, p, o, m) 0
+# define MITK_PP_FOR_CHECK_MITK_PP_FOR_165(s, p, o, m) 0
+# define MITK_PP_FOR_CHECK_MITK_PP_FOR_166(s, p, o, m) 0
+# define MITK_PP_FOR_CHECK_MITK_PP_FOR_167(s, p, o, m) 0
+# define MITK_PP_FOR_CHECK_MITK_PP_FOR_168(s, p, o, m) 0
+# define MITK_PP_FOR_CHECK_MITK_PP_FOR_169(s, p, o, m) 0
+# define MITK_PP_FOR_CHECK_MITK_PP_FOR_170(s, p, o, m) 0
+# define MITK_PP_FOR_CHECK_MITK_PP_FOR_171(s, p, o, m) 0
+# define MITK_PP_FOR_CHECK_MITK_PP_FOR_172(s, p, o, m) 0
+# define MITK_PP_FOR_CHECK_MITK_PP_FOR_173(s, p, o, m) 0
+# define MITK_PP_FOR_CHECK_MITK_PP_FOR_174(s, p, o, m) 0
+# define MITK_PP_FOR_CHECK_MITK_PP_FOR_175(s, p, o, m) 0
+# define MITK_PP_FOR_CHECK_MITK_PP_FOR_176(s, p, o, m) 0
+# define MITK_PP_FOR_CHECK_MITK_PP_FOR_177(s, p, o, m) 0
+# define MITK_PP_FOR_CHECK_MITK_PP_FOR_178(s, p, o, m) 0
+# define MITK_PP_FOR_CHECK_MITK_PP_FOR_179(s, p, o, m) 0
+# define MITK_PP_FOR_CHECK_MITK_PP_FOR_180(s, p, o, m) 0
+# define MITK_PP_FOR_CHECK_MITK_PP_FOR_181(s, p, o, m) 0
+# define MITK_PP_FOR_CHECK_MITK_PP_FOR_182(s, p, o, m) 0
+# define MITK_PP_FOR_CHECK_MITK_PP_FOR_183(s, p, o, m) 0
+# define MITK_PP_FOR_CHECK_MITK_PP_FOR_184(s, p, o, m) 0
+# define MITK_PP_FOR_CHECK_MITK_PP_FOR_185(s, p, o, m) 0
+# define MITK_PP_FOR_CHECK_MITK_PP_FOR_186(s, p, o, m) 0
+# define MITK_PP_FOR_CHECK_MITK_PP_FOR_187(s, p, o, m) 0
+# define MITK_PP_FOR_CHECK_MITK_PP_FOR_188(s, p, o, m) 0
+# define MITK_PP_FOR_CHECK_MITK_PP_FOR_189(s, p, o, m) 0
+# define MITK_PP_FOR_CHECK_MITK_PP_FOR_190(s, p, o, m) 0
+# define MITK_PP_FOR_CHECK_MITK_PP_FOR_191(s, p, o, m) 0
+# define MITK_PP_FOR_CHECK_MITK_PP_FOR_192(s, p, o, m) 0
+# define MITK_PP_FOR_CHECK_MITK_PP_FOR_193(s, p, o, m) 0
+# define MITK_PP_FOR_CHECK_MITK_PP_FOR_194(s, p, o, m) 0
+# define MITK_PP_FOR_CHECK_MITK_PP_FOR_195(s, p, o, m) 0
+# define MITK_PP_FOR_CHECK_MITK_PP_FOR_196(s, p, o, m) 0
+# define MITK_PP_FOR_CHECK_MITK_PP_FOR_197(s, p, o, m) 0
+# define MITK_PP_FOR_CHECK_MITK_PP_FOR_198(s, p, o, m) 0
+# define MITK_PP_FOR_CHECK_MITK_PP_FOR_199(s, p, o, m) 0
+# define MITK_PP_FOR_CHECK_MITK_PP_FOR_200(s, p, o, m) 0
+# define MITK_PP_FOR_CHECK_MITK_PP_FOR_201(s, p, o, m) 0
+# define MITK_PP_FOR_CHECK_MITK_PP_FOR_202(s, p, o, m) 0
+# define MITK_PP_FOR_CHECK_MITK_PP_FOR_203(s, p, o, m) 0
+# define MITK_PP_FOR_CHECK_MITK_PP_FOR_204(s, p, o, m) 0
+# define MITK_PP_FOR_CHECK_MITK_PP_FOR_205(s, p, o, m) 0
+# define MITK_PP_FOR_CHECK_MITK_PP_FOR_206(s, p, o, m) 0
+# define MITK_PP_FOR_CHECK_MITK_PP_FOR_207(s, p, o, m) 0
+# define MITK_PP_FOR_CHECK_MITK_PP_FOR_208(s, p, o, m) 0
+# define MITK_PP_FOR_CHECK_MITK_PP_FOR_209(s, p, o, m) 0
+# define MITK_PP_FOR_CHECK_MITK_PP_FOR_210(s, p, o, m) 0
+# define MITK_PP_FOR_CHECK_MITK_PP_FOR_211(s, p, o, m) 0
+# define MITK_PP_FOR_CHECK_MITK_PP_FOR_212(s, p, o, m) 0
+# define MITK_PP_FOR_CHECK_MITK_PP_FOR_213(s, p, o, m) 0
+# define MITK_PP_FOR_CHECK_MITK_PP_FOR_214(s, p, o, m) 0
+# define MITK_PP_FOR_CHECK_MITK_PP_FOR_215(s, p, o, m) 0
+# define MITK_PP_FOR_CHECK_MITK_PP_FOR_216(s, p, o, m) 0
+# define MITK_PP_FOR_CHECK_MITK_PP_FOR_217(s, p, o, m) 0
+# define MITK_PP_FOR_CHECK_MITK_PP_FOR_218(s, p, o, m) 0
+# define MITK_PP_FOR_CHECK_MITK_PP_FOR_219(s, p, o, m) 0
+# define MITK_PP_FOR_CHECK_MITK_PP_FOR_220(s, p, o, m) 0
+# define MITK_PP_FOR_CHECK_MITK_PP_FOR_221(s, p, o, m) 0
+# define MITK_PP_FOR_CHECK_MITK_PP_FOR_222(s, p, o, m) 0
+# define MITK_PP_FOR_CHECK_MITK_PP_FOR_223(s, p, o, m) 0
+# define MITK_PP_FOR_CHECK_MITK_PP_FOR_224(s, p, o, m) 0
+# define MITK_PP_FOR_CHECK_MITK_PP_FOR_225(s, p, o, m) 0
+# define MITK_PP_FOR_CHECK_MITK_PP_FOR_226(s, p, o, m) 0
+# define MITK_PP_FOR_CHECK_MITK_PP_FOR_227(s, p, o, m) 0
+# define MITK_PP_FOR_CHECK_MITK_PP_FOR_228(s, p, o, m) 0
+# define MITK_PP_FOR_CHECK_MITK_PP_FOR_229(s, p, o, m) 0
+# define MITK_PP_FOR_CHECK_MITK_PP_FOR_230(s, p, o, m) 0
+# define MITK_PP_FOR_CHECK_MITK_PP_FOR_231(s, p, o, m) 0
+# define MITK_PP_FOR_CHECK_MITK_PP_FOR_232(s, p, o, m) 0
+# define MITK_PP_FOR_CHECK_MITK_PP_FOR_233(s, p, o, m) 0
+# define MITK_PP_FOR_CHECK_MITK_PP_FOR_234(s, p, o, m) 0
+# define MITK_PP_FOR_CHECK_MITK_PP_FOR_235(s, p, o, m) 0
+# define MITK_PP_FOR_CHECK_MITK_PP_FOR_236(s, p, o, m) 0
+# define MITK_PP_FOR_CHECK_MITK_PP_FOR_237(s, p, o, m) 0
+# define MITK_PP_FOR_CHECK_MITK_PP_FOR_238(s, p, o, m) 0
+# define MITK_PP_FOR_CHECK_MITK_PP_FOR_239(s, p, o, m) 0
+# define MITK_PP_FOR_CHECK_MITK_PP_FOR_240(s, p, o, m) 0
+# define MITK_PP_FOR_CHECK_MITK_PP_FOR_241(s, p, o, m) 0
+# define MITK_PP_FOR_CHECK_MITK_PP_FOR_242(s, p, o, m) 0
+# define MITK_PP_FOR_CHECK_MITK_PP_FOR_243(s, p, o, m) 0
+# define MITK_PP_FOR_CHECK_MITK_PP_FOR_244(s, p, o, m) 0
+# define MITK_PP_FOR_CHECK_MITK_PP_FOR_245(s, p, o, m) 0
+# define MITK_PP_FOR_CHECK_MITK_PP_FOR_246(s, p, o, m) 0
+# define MITK_PP_FOR_CHECK_MITK_PP_FOR_247(s, p, o, m) 0
+# define MITK_PP_FOR_CHECK_MITK_PP_FOR_248(s, p, o, m) 0
+# define MITK_PP_FOR_CHECK_MITK_PP_FOR_249(s, p, o, m) 0
+# define MITK_PP_FOR_CHECK_MITK_PP_FOR_250(s, p, o, m) 0
+# define MITK_PP_FOR_CHECK_MITK_PP_FOR_251(s, p, o, m) 0
+# define MITK_PP_FOR_CHECK_MITK_PP_FOR_252(s, p, o, m) 0
+# define MITK_PP_FOR_CHECK_MITK_PP_FOR_253(s, p, o, m) 0
+# define MITK_PP_FOR_CHECK_MITK_PP_FOR_254(s, p, o, m) 0
+# define MITK_PP_FOR_CHECK_MITK_PP_FOR_255(s, p, o, m) 0
+# define MITK_PP_FOR_CHECK_MITK_PP_FOR_256(s, p, o, m) 0
+#
+# endif
diff --git a/Core/Code/Algorithms/mitkPPSeq.h b/Core/Code/Algorithms/mitkPPSeq.h
new file mode 100644
index 0000000000..f6f390cd74
--- /dev/null
+++ b/Core/Code/Algorithms/mitkPPSeq.h
@@ -0,0 +1,44 @@
+# /* **************************************************************************
+# * *
+# * (C) Copyright Paul Mensonides 2002.
+# * Distributed under the Boost Software License, Version 1.0. (See
+# * accompanying file LICENSE_1_0.txt or copy at
+# * http://www.boost.org/LICENSE_1_0.txt)
+# * *
+# ************************************************************************** */
+#
+# /* See http://www.boost.org for most recent version. */
+#
+# ifndef MITK_PREPROCESSOR_SEQ_SEQ_HPP
+# define MITK_PREPROCESSOR_SEQ_SEQ_HPP
+#
+# include "mitkPPConfig.h"
+# include "mitkPPSeqElem.h"
+#
+# /* MITK_PP_SEQ_HEAD */
+#
+# define MITK_PP_SEQ_HEAD(seq) MITK_PP_SEQ_ELEM(0, seq)
+#
+# /* MITK_PP_SEQ_TAIL */
+#
+# if MITK_PP_CONFIG_FLAGS() & MITK_PP_CONFIG_MWCC()
+# define MITK_PP_SEQ_TAIL(seq) MITK_PP_SEQ_TAIL_1((seq))
+# define MITK_PP_SEQ_TAIL_1(par) MITK_PP_SEQ_TAIL_2 ## par
+# define MITK_PP_SEQ_TAIL_2(seq) MITK_PP_SEQ_TAIL_I ## seq
+# elif MITK_PP_CONFIG_FLAGS() & MITK_PP_CONFIG_MSVC()
+# define MITK_PP_SEQ_TAIL(seq) MITK_PP_SEQ_TAIL_ID(MITK_PP_SEQ_TAIL_I seq)
+# define MITK_PP_SEQ_TAIL_ID(id) id
+# elif MITK_PP_CONFIG_FLAGS() & MITK_PP_CONFIG_EDG()
+# define MITK_PP_SEQ_TAIL(seq) MITK_PP_SEQ_TAIL_D(seq)
+# define MITK_PP_SEQ_TAIL_D(seq) MITK_PP_SEQ_TAIL_I seq
+# else
+# define MITK_PP_SEQ_TAIL(seq) MITK_PP_SEQ_TAIL_I seq
+# endif
+#
+# define MITK_PP_SEQ_TAIL_I(x)
+#
+# /* MITK_PP_SEQ_NIL */
+#
+# define MITK_PP_SEQ_NIL(x) (x)
+#
+# endif
diff --git a/Core/Code/Algorithms/mitkPPSeqElem.h b/Core/Code/Algorithms/mitkPPSeqElem.h
new file mode 100644
index 0000000000..5877c80868
--- /dev/null
+++ b/Core/Code/Algorithms/mitkPPSeqElem.h
@@ -0,0 +1,304 @@
+# /* **************************************************************************
+# * *
+# * (C) Copyright Paul Mensonides 2002.
+# * Distributed under the Boost Software License, Version 1.0. (See
+# * accompanying file LICENSE_1_0.txt or copy at
+# * http://www.boost.org/LICENSE_1_0.txt)
+# * *
+# ************************************************************************** */
+#
+# /* See http://www.boost.org for most recent version. */
+#
+# ifndef MITK_PREPROCESSOR_SEQ_ELEM_HPP
+# define MITK_PREPROCESSOR_SEQ_ELEM_HPP
+#
+# include "mitkPPCat.h"
+# include "mitkPPConfig.h"
+# include "mitkPPFacilitiesEmpty.h"
+#
+# /* MITK_PP_SEQ_ELEM */
+#
+# if ~MITK_PP_CONFIG_FLAGS() & MITK_PP_CONFIG_MWCC()
+# define MITK_PP_SEQ_ELEM(i, seq) MITK_PP_SEQ_ELEM_I(i, seq)
+# else
+# define MITK_PP_SEQ_ELEM(i, seq) MITK_PP_SEQ_ELEM_I((i, seq))
+# endif
+#
+# if MITK_PP_CONFIG_FLAGS() & MITK_PP_CONFIG_MSVC()
+# define MITK_PP_SEQ_ELEM_I(i, seq) MITK_PP_SEQ_ELEM_II((MITK_PP_SEQ_ELEM_ ## i seq))
+# define MITK_PP_SEQ_ELEM_II(res) MITK_PP_SEQ_ELEM_IV(MITK_PP_SEQ_ELEM_III res)
+# define MITK_PP_SEQ_ELEM_III(x, _) x MITK_PP_EMPTY()
+# define MITK_PP_SEQ_ELEM_IV(x) x
+# elif MITK_PP_CONFIG_FLAGS() & MITK_PP_CONFIG_MWCC()
+# define MITK_PP_SEQ_ELEM_I(par) MITK_PP_SEQ_ELEM_II ## par
+# define MITK_PP_SEQ_ELEM_II(i, seq) MITK_PP_SEQ_ELEM_III(MITK_PP_SEQ_ELEM_ ## i ## seq)
+# define MITK_PP_SEQ_ELEM_III(im) MITK_PP_SEQ_ELEM_IV(im)
+# define MITK_PP_SEQ_ELEM_IV(x, _) x
+# else
+# if defined(__IBMC__) || defined(__IBMCPP__)
+# define MITK_PP_SEQ_ELEM_I(i, seq) MITK_PP_SEQ_ELEM_II(MITK_PP_CAT(MITK_PP_SEQ_ELEM_ ## i, seq))
+# else
+# define MITK_PP_SEQ_ELEM_I(i, seq) MITK_PP_SEQ_ELEM_II(MITK_PP_SEQ_ELEM_ ## i seq)
+# endif
+# define MITK_PP_SEQ_ELEM_II(im) MITK_PP_SEQ_ELEM_III(im)
+# define MITK_PP_SEQ_ELEM_III(x, _) x
+# endif
+#
+# define MITK_PP_SEQ_ELEM_0(x) x, MITK_PP_NIL
+# define MITK_PP_SEQ_ELEM_1(_) MITK_PP_SEQ_ELEM_0
+# define MITK_PP_SEQ_ELEM_2(_) MITK_PP_SEQ_ELEM_1
+# define MITK_PP_SEQ_ELEM_3(_) MITK_PP_SEQ_ELEM_2
+# define MITK_PP_SEQ_ELEM_4(_) MITK_PP_SEQ_ELEM_3
+# define MITK_PP_SEQ_ELEM_5(_) MITK_PP_SEQ_ELEM_4
+# define MITK_PP_SEQ_ELEM_6(_) MITK_PP_SEQ_ELEM_5
+# define MITK_PP_SEQ_ELEM_7(_) MITK_PP_SEQ_ELEM_6
+# define MITK_PP_SEQ_ELEM_8(_) MITK_PP_SEQ_ELEM_7
+# define MITK_PP_SEQ_ELEM_9(_) MITK_PP_SEQ_ELEM_8
+# define MITK_PP_SEQ_ELEM_10(_) MITK_PP_SEQ_ELEM_9
+# define MITK_PP_SEQ_ELEM_11(_) MITK_PP_SEQ_ELEM_10
+# define MITK_PP_SEQ_ELEM_12(_) MITK_PP_SEQ_ELEM_11
+# define MITK_PP_SEQ_ELEM_13(_) MITK_PP_SEQ_ELEM_12
+# define MITK_PP_SEQ_ELEM_14(_) MITK_PP_SEQ_ELEM_13
+# define MITK_PP_SEQ_ELEM_15(_) MITK_PP_SEQ_ELEM_14
+# define MITK_PP_SEQ_ELEM_16(_) MITK_PP_SEQ_ELEM_15
+# define MITK_PP_SEQ_ELEM_17(_) MITK_PP_SEQ_ELEM_16
+# define MITK_PP_SEQ_ELEM_18(_) MITK_PP_SEQ_ELEM_17
+# define MITK_PP_SEQ_ELEM_19(_) MITK_PP_SEQ_ELEM_18
+# define MITK_PP_SEQ_ELEM_20(_) MITK_PP_SEQ_ELEM_19
+# define MITK_PP_SEQ_ELEM_21(_) MITK_PP_SEQ_ELEM_20
+# define MITK_PP_SEQ_ELEM_22(_) MITK_PP_SEQ_ELEM_21
+# define MITK_PP_SEQ_ELEM_23(_) MITK_PP_SEQ_ELEM_22
+# define MITK_PP_SEQ_ELEM_24(_) MITK_PP_SEQ_ELEM_23
+# define MITK_PP_SEQ_ELEM_25(_) MITK_PP_SEQ_ELEM_24
+# define MITK_PP_SEQ_ELEM_26(_) MITK_PP_SEQ_ELEM_25
+# define MITK_PP_SEQ_ELEM_27(_) MITK_PP_SEQ_ELEM_26
+# define MITK_PP_SEQ_ELEM_28(_) MITK_PP_SEQ_ELEM_27
+# define MITK_PP_SEQ_ELEM_29(_) MITK_PP_SEQ_ELEM_28
+# define MITK_PP_SEQ_ELEM_30(_) MITK_PP_SEQ_ELEM_29
+# define MITK_PP_SEQ_ELEM_31(_) MITK_PP_SEQ_ELEM_30
+# define MITK_PP_SEQ_ELEM_32(_) MITK_PP_SEQ_ELEM_31
+# define MITK_PP_SEQ_ELEM_33(_) MITK_PP_SEQ_ELEM_32
+# define MITK_PP_SEQ_ELEM_34(_) MITK_PP_SEQ_ELEM_33
+# define MITK_PP_SEQ_ELEM_35(_) MITK_PP_SEQ_ELEM_34
+# define MITK_PP_SEQ_ELEM_36(_) MITK_PP_SEQ_ELEM_35
+# define MITK_PP_SEQ_ELEM_37(_) MITK_PP_SEQ_ELEM_36
+# define MITK_PP_SEQ_ELEM_38(_) MITK_PP_SEQ_ELEM_37
+# define MITK_PP_SEQ_ELEM_39(_) MITK_PP_SEQ_ELEM_38
+# define MITK_PP_SEQ_ELEM_40(_) MITK_PP_SEQ_ELEM_39
+# define MITK_PP_SEQ_ELEM_41(_) MITK_PP_SEQ_ELEM_40
+# define MITK_PP_SEQ_ELEM_42(_) MITK_PP_SEQ_ELEM_41
+# define MITK_PP_SEQ_ELEM_43(_) MITK_PP_SEQ_ELEM_42
+# define MITK_PP_SEQ_ELEM_44(_) MITK_PP_SEQ_ELEM_43
+# define MITK_PP_SEQ_ELEM_45(_) MITK_PP_SEQ_ELEM_44
+# define MITK_PP_SEQ_ELEM_46(_) MITK_PP_SEQ_ELEM_45
+# define MITK_PP_SEQ_ELEM_47(_) MITK_PP_SEQ_ELEM_46
+# define MITK_PP_SEQ_ELEM_48(_) MITK_PP_SEQ_ELEM_47
+# define MITK_PP_SEQ_ELEM_49(_) MITK_PP_SEQ_ELEM_48
+# define MITK_PP_SEQ_ELEM_50(_) MITK_PP_SEQ_ELEM_49
+# define MITK_PP_SEQ_ELEM_51(_) MITK_PP_SEQ_ELEM_50
+# define MITK_PP_SEQ_ELEM_52(_) MITK_PP_SEQ_ELEM_51
+# define MITK_PP_SEQ_ELEM_53(_) MITK_PP_SEQ_ELEM_52
+# define MITK_PP_SEQ_ELEM_54(_) MITK_PP_SEQ_ELEM_53
+# define MITK_PP_SEQ_ELEM_55(_) MITK_PP_SEQ_ELEM_54
+# define MITK_PP_SEQ_ELEM_56(_) MITK_PP_SEQ_ELEM_55
+# define MITK_PP_SEQ_ELEM_57(_) MITK_PP_SEQ_ELEM_56
+# define MITK_PP_SEQ_ELEM_58(_) MITK_PP_SEQ_ELEM_57
+# define MITK_PP_SEQ_ELEM_59(_) MITK_PP_SEQ_ELEM_58
+# define MITK_PP_SEQ_ELEM_60(_) MITK_PP_SEQ_ELEM_59
+# define MITK_PP_SEQ_ELEM_61(_) MITK_PP_SEQ_ELEM_60
+# define MITK_PP_SEQ_ELEM_62(_) MITK_PP_SEQ_ELEM_61
+# define MITK_PP_SEQ_ELEM_63(_) MITK_PP_SEQ_ELEM_62
+# define MITK_PP_SEQ_ELEM_64(_) MITK_PP_SEQ_ELEM_63
+# define MITK_PP_SEQ_ELEM_65(_) MITK_PP_SEQ_ELEM_64
+# define MITK_PP_SEQ_ELEM_66(_) MITK_PP_SEQ_ELEM_65
+# define MITK_PP_SEQ_ELEM_67(_) MITK_PP_SEQ_ELEM_66
+# define MITK_PP_SEQ_ELEM_68(_) MITK_PP_SEQ_ELEM_67
+# define MITK_PP_SEQ_ELEM_69(_) MITK_PP_SEQ_ELEM_68
+# define MITK_PP_SEQ_ELEM_70(_) MITK_PP_SEQ_ELEM_69
+# define MITK_PP_SEQ_ELEM_71(_) MITK_PP_SEQ_ELEM_70
+# define MITK_PP_SEQ_ELEM_72(_) MITK_PP_SEQ_ELEM_71
+# define MITK_PP_SEQ_ELEM_73(_) MITK_PP_SEQ_ELEM_72
+# define MITK_PP_SEQ_ELEM_74(_) MITK_PP_SEQ_ELEM_73
+# define MITK_PP_SEQ_ELEM_75(_) MITK_PP_SEQ_ELEM_74
+# define MITK_PP_SEQ_ELEM_76(_) MITK_PP_SEQ_ELEM_75
+# define MITK_PP_SEQ_ELEM_77(_) MITK_PP_SEQ_ELEM_76
+# define MITK_PP_SEQ_ELEM_78(_) MITK_PP_SEQ_ELEM_77
+# define MITK_PP_SEQ_ELEM_79(_) MITK_PP_SEQ_ELEM_78
+# define MITK_PP_SEQ_ELEM_80(_) MITK_PP_SEQ_ELEM_79
+# define MITK_PP_SEQ_ELEM_81(_) MITK_PP_SEQ_ELEM_80
+# define MITK_PP_SEQ_ELEM_82(_) MITK_PP_SEQ_ELEM_81
+# define MITK_PP_SEQ_ELEM_83(_) MITK_PP_SEQ_ELEM_82
+# define MITK_PP_SEQ_ELEM_84(_) MITK_PP_SEQ_ELEM_83
+# define MITK_PP_SEQ_ELEM_85(_) MITK_PP_SEQ_ELEM_84
+# define MITK_PP_SEQ_ELEM_86(_) MITK_PP_SEQ_ELEM_85
+# define MITK_PP_SEQ_ELEM_87(_) MITK_PP_SEQ_ELEM_86
+# define MITK_PP_SEQ_ELEM_88(_) MITK_PP_SEQ_ELEM_87
+# define MITK_PP_SEQ_ELEM_89(_) MITK_PP_SEQ_ELEM_88
+# define MITK_PP_SEQ_ELEM_90(_) MITK_PP_SEQ_ELEM_89
+# define MITK_PP_SEQ_ELEM_91(_) MITK_PP_SEQ_ELEM_90
+# define MITK_PP_SEQ_ELEM_92(_) MITK_PP_SEQ_ELEM_91
+# define MITK_PP_SEQ_ELEM_93(_) MITK_PP_SEQ_ELEM_92
+# define MITK_PP_SEQ_ELEM_94(_) MITK_PP_SEQ_ELEM_93
+# define MITK_PP_SEQ_ELEM_95(_) MITK_PP_SEQ_ELEM_94
+# define MITK_PP_SEQ_ELEM_96(_) MITK_PP_SEQ_ELEM_95
+# define MITK_PP_SEQ_ELEM_97(_) MITK_PP_SEQ_ELEM_96
+# define MITK_PP_SEQ_ELEM_98(_) MITK_PP_SEQ_ELEM_97
+# define MITK_PP_SEQ_ELEM_99(_) MITK_PP_SEQ_ELEM_98
+# define MITK_PP_SEQ_ELEM_100(_) MITK_PP_SEQ_ELEM_99
+# define MITK_PP_SEQ_ELEM_101(_) MITK_PP_SEQ_ELEM_100
+# define MITK_PP_SEQ_ELEM_102(_) MITK_PP_SEQ_ELEM_101
+# define MITK_PP_SEQ_ELEM_103(_) MITK_PP_SEQ_ELEM_102
+# define MITK_PP_SEQ_ELEM_104(_) MITK_PP_SEQ_ELEM_103
+# define MITK_PP_SEQ_ELEM_105(_) MITK_PP_SEQ_ELEM_104
+# define MITK_PP_SEQ_ELEM_106(_) MITK_PP_SEQ_ELEM_105
+# define MITK_PP_SEQ_ELEM_107(_) MITK_PP_SEQ_ELEM_106
+# define MITK_PP_SEQ_ELEM_108(_) MITK_PP_SEQ_ELEM_107
+# define MITK_PP_SEQ_ELEM_109(_) MITK_PP_SEQ_ELEM_108
+# define MITK_PP_SEQ_ELEM_110(_) MITK_PP_SEQ_ELEM_109
+# define MITK_PP_SEQ_ELEM_111(_) MITK_PP_SEQ_ELEM_110
+# define MITK_PP_SEQ_ELEM_112(_) MITK_PP_SEQ_ELEM_111
+# define MITK_PP_SEQ_ELEM_113(_) MITK_PP_SEQ_ELEM_112
+# define MITK_PP_SEQ_ELEM_114(_) MITK_PP_SEQ_ELEM_113
+# define MITK_PP_SEQ_ELEM_115(_) MITK_PP_SEQ_ELEM_114
+# define MITK_PP_SEQ_ELEM_116(_) MITK_PP_SEQ_ELEM_115
+# define MITK_PP_SEQ_ELEM_117(_) MITK_PP_SEQ_ELEM_116
+# define MITK_PP_SEQ_ELEM_118(_) MITK_PP_SEQ_ELEM_117
+# define MITK_PP_SEQ_ELEM_119(_) MITK_PP_SEQ_ELEM_118
+# define MITK_PP_SEQ_ELEM_120(_) MITK_PP_SEQ_ELEM_119
+# define MITK_PP_SEQ_ELEM_121(_) MITK_PP_SEQ_ELEM_120
+# define MITK_PP_SEQ_ELEM_122(_) MITK_PP_SEQ_ELEM_121
+# define MITK_PP_SEQ_ELEM_123(_) MITK_PP_SEQ_ELEM_122
+# define MITK_PP_SEQ_ELEM_124(_) MITK_PP_SEQ_ELEM_123
+# define MITK_PP_SEQ_ELEM_125(_) MITK_PP_SEQ_ELEM_124
+# define MITK_PP_SEQ_ELEM_126(_) MITK_PP_SEQ_ELEM_125
+# define MITK_PP_SEQ_ELEM_127(_) MITK_PP_SEQ_ELEM_126
+# define MITK_PP_SEQ_ELEM_128(_) MITK_PP_SEQ_ELEM_127
+# define MITK_PP_SEQ_ELEM_129(_) MITK_PP_SEQ_ELEM_128
+# define MITK_PP_SEQ_ELEM_130(_) MITK_PP_SEQ_ELEM_129
+# define MITK_PP_SEQ_ELEM_131(_) MITK_PP_SEQ_ELEM_130
+# define MITK_PP_SEQ_ELEM_132(_) MITK_PP_SEQ_ELEM_131
+# define MITK_PP_SEQ_ELEM_133(_) MITK_PP_SEQ_ELEM_132
+# define MITK_PP_SEQ_ELEM_134(_) MITK_PP_SEQ_ELEM_133
+# define MITK_PP_SEQ_ELEM_135(_) MITK_PP_SEQ_ELEM_134
+# define MITK_PP_SEQ_ELEM_136(_) MITK_PP_SEQ_ELEM_135
+# define MITK_PP_SEQ_ELEM_137(_) MITK_PP_SEQ_ELEM_136
+# define MITK_PP_SEQ_ELEM_138(_) MITK_PP_SEQ_ELEM_137
+# define MITK_PP_SEQ_ELEM_139(_) MITK_PP_SEQ_ELEM_138
+# define MITK_PP_SEQ_ELEM_140(_) MITK_PP_SEQ_ELEM_139
+# define MITK_PP_SEQ_ELEM_141(_) MITK_PP_SEQ_ELEM_140
+# define MITK_PP_SEQ_ELEM_142(_) MITK_PP_SEQ_ELEM_141
+# define MITK_PP_SEQ_ELEM_143(_) MITK_PP_SEQ_ELEM_142
+# define MITK_PP_SEQ_ELEM_144(_) MITK_PP_SEQ_ELEM_143
+# define MITK_PP_SEQ_ELEM_145(_) MITK_PP_SEQ_ELEM_144
+# define MITK_PP_SEQ_ELEM_146(_) MITK_PP_SEQ_ELEM_145
+# define MITK_PP_SEQ_ELEM_147(_) MITK_PP_SEQ_ELEM_146
+# define MITK_PP_SEQ_ELEM_148(_) MITK_PP_SEQ_ELEM_147
+# define MITK_PP_SEQ_ELEM_149(_) MITK_PP_SEQ_ELEM_148
+# define MITK_PP_SEQ_ELEM_150(_) MITK_PP_SEQ_ELEM_149
+# define MITK_PP_SEQ_ELEM_151(_) MITK_PP_SEQ_ELEM_150
+# define MITK_PP_SEQ_ELEM_152(_) MITK_PP_SEQ_ELEM_151
+# define MITK_PP_SEQ_ELEM_153(_) MITK_PP_SEQ_ELEM_152
+# define MITK_PP_SEQ_ELEM_154(_) MITK_PP_SEQ_ELEM_153
+# define MITK_PP_SEQ_ELEM_155(_) MITK_PP_SEQ_ELEM_154
+# define MITK_PP_SEQ_ELEM_156(_) MITK_PP_SEQ_ELEM_155
+# define MITK_PP_SEQ_ELEM_157(_) MITK_PP_SEQ_ELEM_156
+# define MITK_PP_SEQ_ELEM_158(_) MITK_PP_SEQ_ELEM_157
+# define MITK_PP_SEQ_ELEM_159(_) MITK_PP_SEQ_ELEM_158
+# define MITK_PP_SEQ_ELEM_160(_) MITK_PP_SEQ_ELEM_159
+# define MITK_PP_SEQ_ELEM_161(_) MITK_PP_SEQ_ELEM_160
+# define MITK_PP_SEQ_ELEM_162(_) MITK_PP_SEQ_ELEM_161
+# define MITK_PP_SEQ_ELEM_163(_) MITK_PP_SEQ_ELEM_162
+# define MITK_PP_SEQ_ELEM_164(_) MITK_PP_SEQ_ELEM_163
+# define MITK_PP_SEQ_ELEM_165(_) MITK_PP_SEQ_ELEM_164
+# define MITK_PP_SEQ_ELEM_166(_) MITK_PP_SEQ_ELEM_165
+# define MITK_PP_SEQ_ELEM_167(_) MITK_PP_SEQ_ELEM_166
+# define MITK_PP_SEQ_ELEM_168(_) MITK_PP_SEQ_ELEM_167
+# define MITK_PP_SEQ_ELEM_169(_) MITK_PP_SEQ_ELEM_168
+# define MITK_PP_SEQ_ELEM_170(_) MITK_PP_SEQ_ELEM_169
+# define MITK_PP_SEQ_ELEM_171(_) MITK_PP_SEQ_ELEM_170
+# define MITK_PP_SEQ_ELEM_172(_) MITK_PP_SEQ_ELEM_171
+# define MITK_PP_SEQ_ELEM_173(_) MITK_PP_SEQ_ELEM_172
+# define MITK_PP_SEQ_ELEM_174(_) MITK_PP_SEQ_ELEM_173
+# define MITK_PP_SEQ_ELEM_175(_) MITK_PP_SEQ_ELEM_174
+# define MITK_PP_SEQ_ELEM_176(_) MITK_PP_SEQ_ELEM_175
+# define MITK_PP_SEQ_ELEM_177(_) MITK_PP_SEQ_ELEM_176
+# define MITK_PP_SEQ_ELEM_178(_) MITK_PP_SEQ_ELEM_177
+# define MITK_PP_SEQ_ELEM_179(_) MITK_PP_SEQ_ELEM_178
+# define MITK_PP_SEQ_ELEM_180(_) MITK_PP_SEQ_ELEM_179
+# define MITK_PP_SEQ_ELEM_181(_) MITK_PP_SEQ_ELEM_180
+# define MITK_PP_SEQ_ELEM_182(_) MITK_PP_SEQ_ELEM_181
+# define MITK_PP_SEQ_ELEM_183(_) MITK_PP_SEQ_ELEM_182
+# define MITK_PP_SEQ_ELEM_184(_) MITK_PP_SEQ_ELEM_183
+# define MITK_PP_SEQ_ELEM_185(_) MITK_PP_SEQ_ELEM_184
+# define MITK_PP_SEQ_ELEM_186(_) MITK_PP_SEQ_ELEM_185
+# define MITK_PP_SEQ_ELEM_187(_) MITK_PP_SEQ_ELEM_186
+# define MITK_PP_SEQ_ELEM_188(_) MITK_PP_SEQ_ELEM_187
+# define MITK_PP_SEQ_ELEM_189(_) MITK_PP_SEQ_ELEM_188
+# define MITK_PP_SEQ_ELEM_190(_) MITK_PP_SEQ_ELEM_189
+# define MITK_PP_SEQ_ELEM_191(_) MITK_PP_SEQ_ELEM_190
+# define MITK_PP_SEQ_ELEM_192(_) MITK_PP_SEQ_ELEM_191
+# define MITK_PP_SEQ_ELEM_193(_) MITK_PP_SEQ_ELEM_192
+# define MITK_PP_SEQ_ELEM_194(_) MITK_PP_SEQ_ELEM_193
+# define MITK_PP_SEQ_ELEM_195(_) MITK_PP_SEQ_ELEM_194
+# define MITK_PP_SEQ_ELEM_196(_) MITK_PP_SEQ_ELEM_195
+# define MITK_PP_SEQ_ELEM_197(_) MITK_PP_SEQ_ELEM_196
+# define MITK_PP_SEQ_ELEM_198(_) MITK_PP_SEQ_ELEM_197
+# define MITK_PP_SEQ_ELEM_199(_) MITK_PP_SEQ_ELEM_198
+# define MITK_PP_SEQ_ELEM_200(_) MITK_PP_SEQ_ELEM_199
+# define MITK_PP_SEQ_ELEM_201(_) MITK_PP_SEQ_ELEM_200
+# define MITK_PP_SEQ_ELEM_202(_) MITK_PP_SEQ_ELEM_201
+# define MITK_PP_SEQ_ELEM_203(_) MITK_PP_SEQ_ELEM_202
+# define MITK_PP_SEQ_ELEM_204(_) MITK_PP_SEQ_ELEM_203
+# define MITK_PP_SEQ_ELEM_205(_) MITK_PP_SEQ_ELEM_204
+# define MITK_PP_SEQ_ELEM_206(_) MITK_PP_SEQ_ELEM_205
+# define MITK_PP_SEQ_ELEM_207(_) MITK_PP_SEQ_ELEM_206
+# define MITK_PP_SEQ_ELEM_208(_) MITK_PP_SEQ_ELEM_207
+# define MITK_PP_SEQ_ELEM_209(_) MITK_PP_SEQ_ELEM_208
+# define MITK_PP_SEQ_ELEM_210(_) MITK_PP_SEQ_ELEM_209
+# define MITK_PP_SEQ_ELEM_211(_) MITK_PP_SEQ_ELEM_210
+# define MITK_PP_SEQ_ELEM_212(_) MITK_PP_SEQ_ELEM_211
+# define MITK_PP_SEQ_ELEM_213(_) MITK_PP_SEQ_ELEM_212
+# define MITK_PP_SEQ_ELEM_214(_) MITK_PP_SEQ_ELEM_213
+# define MITK_PP_SEQ_ELEM_215(_) MITK_PP_SEQ_ELEM_214
+# define MITK_PP_SEQ_ELEM_216(_) MITK_PP_SEQ_ELEM_215
+# define MITK_PP_SEQ_ELEM_217(_) MITK_PP_SEQ_ELEM_216
+# define MITK_PP_SEQ_ELEM_218(_) MITK_PP_SEQ_ELEM_217
+# define MITK_PP_SEQ_ELEM_219(_) MITK_PP_SEQ_ELEM_218
+# define MITK_PP_SEQ_ELEM_220(_) MITK_PP_SEQ_ELEM_219
+# define MITK_PP_SEQ_ELEM_221(_) MITK_PP_SEQ_ELEM_220
+# define MITK_PP_SEQ_ELEM_222(_) MITK_PP_SEQ_ELEM_221
+# define MITK_PP_SEQ_ELEM_223(_) MITK_PP_SEQ_ELEM_222
+# define MITK_PP_SEQ_ELEM_224(_) MITK_PP_SEQ_ELEM_223
+# define MITK_PP_SEQ_ELEM_225(_) MITK_PP_SEQ_ELEM_224
+# define MITK_PP_SEQ_ELEM_226(_) MITK_PP_SEQ_ELEM_225
+# define MITK_PP_SEQ_ELEM_227(_) MITK_PP_SEQ_ELEM_226
+# define MITK_PP_SEQ_ELEM_228(_) MITK_PP_SEQ_ELEM_227
+# define MITK_PP_SEQ_ELEM_229(_) MITK_PP_SEQ_ELEM_228
+# define MITK_PP_SEQ_ELEM_230(_) MITK_PP_SEQ_ELEM_229
+# define MITK_PP_SEQ_ELEM_231(_) MITK_PP_SEQ_ELEM_230
+# define MITK_PP_SEQ_ELEM_232(_) MITK_PP_SEQ_ELEM_231
+# define MITK_PP_SEQ_ELEM_233(_) MITK_PP_SEQ_ELEM_232
+# define MITK_PP_SEQ_ELEM_234(_) MITK_PP_SEQ_ELEM_233
+# define MITK_PP_SEQ_ELEM_235(_) MITK_PP_SEQ_ELEM_234
+# define MITK_PP_SEQ_ELEM_236(_) MITK_PP_SEQ_ELEM_235
+# define MITK_PP_SEQ_ELEM_237(_) MITK_PP_SEQ_ELEM_236
+# define MITK_PP_SEQ_ELEM_238(_) MITK_PP_SEQ_ELEM_237
+# define MITK_PP_SEQ_ELEM_239(_) MITK_PP_SEQ_ELEM_238
+# define MITK_PP_SEQ_ELEM_240(_) MITK_PP_SEQ_ELEM_239
+# define MITK_PP_SEQ_ELEM_241(_) MITK_PP_SEQ_ELEM_240
+# define MITK_PP_SEQ_ELEM_242(_) MITK_PP_SEQ_ELEM_241
+# define MITK_PP_SEQ_ELEM_243(_) MITK_PP_SEQ_ELEM_242
+# define MITK_PP_SEQ_ELEM_244(_) MITK_PP_SEQ_ELEM_243
+# define MITK_PP_SEQ_ELEM_245(_) MITK_PP_SEQ_ELEM_244
+# define MITK_PP_SEQ_ELEM_246(_) MITK_PP_SEQ_ELEM_245
+# define MITK_PP_SEQ_ELEM_247(_) MITK_PP_SEQ_ELEM_246
+# define MITK_PP_SEQ_ELEM_248(_) MITK_PP_SEQ_ELEM_247
+# define MITK_PP_SEQ_ELEM_249(_) MITK_PP_SEQ_ELEM_248
+# define MITK_PP_SEQ_ELEM_250(_) MITK_PP_SEQ_ELEM_249
+# define MITK_PP_SEQ_ELEM_251(_) MITK_PP_SEQ_ELEM_250
+# define MITK_PP_SEQ_ELEM_252(_) MITK_PP_SEQ_ELEM_251
+# define MITK_PP_SEQ_ELEM_253(_) MITK_PP_SEQ_ELEM_252
+# define MITK_PP_SEQ_ELEM_254(_) MITK_PP_SEQ_ELEM_253
+# define MITK_PP_SEQ_ELEM_255(_) MITK_PP_SEQ_ELEM_254
+#
+# endif
diff --git a/Core/Code/Algorithms/mitkPPSeqEnum.h b/Core/Code/Algorithms/mitkPPSeqEnum.h
new file mode 100644
index 0000000000..f9cfc97796
--- /dev/null
+++ b/Core/Code/Algorithms/mitkPPSeqEnum.h
@@ -0,0 +1,288 @@
+# /* **************************************************************************
+# * *
+# * (C) Copyright Paul Mensonides 2002.
+# * Distributed under the Boost Software License, Version 1.0. (See
+# * accompanying file LICENSE_1_0.txt or copy at
+# * http://www.boost.org/LICENSE_1_0.txt)
+# * *
+# ************************************************************************** */
+#
+# /* See http://www.boost.org for most recent version. */
+#
+# ifndef MITK_PREPROCESSOR_SEQ_ENUM_HPP
+# define MITK_PREPROCESSOR_SEQ_ENUM_HPP
+#
+# include "mitkPPCat.h"
+# include "mitkPPConfig.h"
+# include "mitkPPSeqSize.h"
+#
+# /* MITK_PP_SEQ_ENUM */
+#
+# if MITK_PP_CONFIG_FLAGS() & MITK_PP_CONFIG_EDG()
+# define MITK_PP_SEQ_ENUM(seq) MITK_PP_SEQ_ENUM_I(seq)
+# define MITK_PP_SEQ_ENUM_I(seq) MITK_PP_CAT(MITK_PP_SEQ_ENUM_, MITK_PP_SEQ_SIZE(seq)) seq
+# elif MITK_PP_CONFIG_FLAGS() & MITK_PP_CONFIG_MWCC()
+# define MITK_PP_SEQ_ENUM(seq) MITK_PP_SEQ_ENUM_I(MITK_PP_SEQ_SIZE(seq), seq)
+# define MITK_PP_SEQ_ENUM_I(size, seq) MITK_PP_CAT(MITK_PP_SEQ_ENUM_, size) seq
+# else
+# define MITK_PP_SEQ_ENUM(seq) MITK_PP_CAT(MITK_PP_SEQ_ENUM_, MITK_PP_SEQ_SIZE(seq)) seq
+# endif
+#
+# define MITK_PP_SEQ_ENUM_1(x) x
+# define MITK_PP_SEQ_ENUM_2(x) x, MITK_PP_SEQ_ENUM_1
+# define MITK_PP_SEQ_ENUM_3(x) x, MITK_PP_SEQ_ENUM_2
+# define MITK_PP_SEQ_ENUM_4(x) x, MITK_PP_SEQ_ENUM_3
+# define MITK_PP_SEQ_ENUM_5(x) x, MITK_PP_SEQ_ENUM_4
+# define MITK_PP_SEQ_ENUM_6(x) x, MITK_PP_SEQ_ENUM_5
+# define MITK_PP_SEQ_ENUM_7(x) x, MITK_PP_SEQ_ENUM_6
+# define MITK_PP_SEQ_ENUM_8(x) x, MITK_PP_SEQ_ENUM_7
+# define MITK_PP_SEQ_ENUM_9(x) x, MITK_PP_SEQ_ENUM_8
+# define MITK_PP_SEQ_ENUM_10(x) x, MITK_PP_SEQ_ENUM_9
+# define MITK_PP_SEQ_ENUM_11(x) x, MITK_PP_SEQ_ENUM_10
+# define MITK_PP_SEQ_ENUM_12(x) x, MITK_PP_SEQ_ENUM_11
+# define MITK_PP_SEQ_ENUM_13(x) x, MITK_PP_SEQ_ENUM_12
+# define MITK_PP_SEQ_ENUM_14(x) x, MITK_PP_SEQ_ENUM_13
+# define MITK_PP_SEQ_ENUM_15(x) x, MITK_PP_SEQ_ENUM_14
+# define MITK_PP_SEQ_ENUM_16(x) x, MITK_PP_SEQ_ENUM_15
+# define MITK_PP_SEQ_ENUM_17(x) x, MITK_PP_SEQ_ENUM_16
+# define MITK_PP_SEQ_ENUM_18(x) x, MITK_PP_SEQ_ENUM_17
+# define MITK_PP_SEQ_ENUM_19(x) x, MITK_PP_SEQ_ENUM_18
+# define MITK_PP_SEQ_ENUM_20(x) x, MITK_PP_SEQ_ENUM_19
+# define MITK_PP_SEQ_ENUM_21(x) x, MITK_PP_SEQ_ENUM_20
+# define MITK_PP_SEQ_ENUM_22(x) x, MITK_PP_SEQ_ENUM_21
+# define MITK_PP_SEQ_ENUM_23(x) x, MITK_PP_SEQ_ENUM_22
+# define MITK_PP_SEQ_ENUM_24(x) x, MITK_PP_SEQ_ENUM_23
+# define MITK_PP_SEQ_ENUM_25(x) x, MITK_PP_SEQ_ENUM_24
+# define MITK_PP_SEQ_ENUM_26(x) x, MITK_PP_SEQ_ENUM_25
+# define MITK_PP_SEQ_ENUM_27(x) x, MITK_PP_SEQ_ENUM_26
+# define MITK_PP_SEQ_ENUM_28(x) x, MITK_PP_SEQ_ENUM_27
+# define MITK_PP_SEQ_ENUM_29(x) x, MITK_PP_SEQ_ENUM_28
+# define MITK_PP_SEQ_ENUM_30(x) x, MITK_PP_SEQ_ENUM_29
+# define MITK_PP_SEQ_ENUM_31(x) x, MITK_PP_SEQ_ENUM_30
+# define MITK_PP_SEQ_ENUM_32(x) x, MITK_PP_SEQ_ENUM_31
+# define MITK_PP_SEQ_ENUM_33(x) x, MITK_PP_SEQ_ENUM_32
+# define MITK_PP_SEQ_ENUM_34(x) x, MITK_PP_SEQ_ENUM_33
+# define MITK_PP_SEQ_ENUM_35(x) x, MITK_PP_SEQ_ENUM_34
+# define MITK_PP_SEQ_ENUM_36(x) x, MITK_PP_SEQ_ENUM_35
+# define MITK_PP_SEQ_ENUM_37(x) x, MITK_PP_SEQ_ENUM_36
+# define MITK_PP_SEQ_ENUM_38(x) x, MITK_PP_SEQ_ENUM_37
+# define MITK_PP_SEQ_ENUM_39(x) x, MITK_PP_SEQ_ENUM_38
+# define MITK_PP_SEQ_ENUM_40(x) x, MITK_PP_SEQ_ENUM_39
+# define MITK_PP_SEQ_ENUM_41(x) x, MITK_PP_SEQ_ENUM_40
+# define MITK_PP_SEQ_ENUM_42(x) x, MITK_PP_SEQ_ENUM_41
+# define MITK_PP_SEQ_ENUM_43(x) x, MITK_PP_SEQ_ENUM_42
+# define MITK_PP_SEQ_ENUM_44(x) x, MITK_PP_SEQ_ENUM_43
+# define MITK_PP_SEQ_ENUM_45(x) x, MITK_PP_SEQ_ENUM_44
+# define MITK_PP_SEQ_ENUM_46(x) x, MITK_PP_SEQ_ENUM_45
+# define MITK_PP_SEQ_ENUM_47(x) x, MITK_PP_SEQ_ENUM_46
+# define MITK_PP_SEQ_ENUM_48(x) x, MITK_PP_SEQ_ENUM_47
+# define MITK_PP_SEQ_ENUM_49(x) x, MITK_PP_SEQ_ENUM_48
+# define MITK_PP_SEQ_ENUM_50(x) x, MITK_PP_SEQ_ENUM_49
+# define MITK_PP_SEQ_ENUM_51(x) x, MITK_PP_SEQ_ENUM_50
+# define MITK_PP_SEQ_ENUM_52(x) x, MITK_PP_SEQ_ENUM_51
+# define MITK_PP_SEQ_ENUM_53(x) x, MITK_PP_SEQ_ENUM_52
+# define MITK_PP_SEQ_ENUM_54(x) x, MITK_PP_SEQ_ENUM_53
+# define MITK_PP_SEQ_ENUM_55(x) x, MITK_PP_SEQ_ENUM_54
+# define MITK_PP_SEQ_ENUM_56(x) x, MITK_PP_SEQ_ENUM_55
+# define MITK_PP_SEQ_ENUM_57(x) x, MITK_PP_SEQ_ENUM_56
+# define MITK_PP_SEQ_ENUM_58(x) x, MITK_PP_SEQ_ENUM_57
+# define MITK_PP_SEQ_ENUM_59(x) x, MITK_PP_SEQ_ENUM_58
+# define MITK_PP_SEQ_ENUM_60(x) x, MITK_PP_SEQ_ENUM_59
+# define MITK_PP_SEQ_ENUM_61(x) x, MITK_PP_SEQ_ENUM_60
+# define MITK_PP_SEQ_ENUM_62(x) x, MITK_PP_SEQ_ENUM_61
+# define MITK_PP_SEQ_ENUM_63(x) x, MITK_PP_SEQ_ENUM_62
+# define MITK_PP_SEQ_ENUM_64(x) x, MITK_PP_SEQ_ENUM_63
+# define MITK_PP_SEQ_ENUM_65(x) x, MITK_PP_SEQ_ENUM_64
+# define MITK_PP_SEQ_ENUM_66(x) x, MITK_PP_SEQ_ENUM_65
+# define MITK_PP_SEQ_ENUM_67(x) x, MITK_PP_SEQ_ENUM_66
+# define MITK_PP_SEQ_ENUM_68(x) x, MITK_PP_SEQ_ENUM_67
+# define MITK_PP_SEQ_ENUM_69(x) x, MITK_PP_SEQ_ENUM_68
+# define MITK_PP_SEQ_ENUM_70(x) x, MITK_PP_SEQ_ENUM_69
+# define MITK_PP_SEQ_ENUM_71(x) x, MITK_PP_SEQ_ENUM_70
+# define MITK_PP_SEQ_ENUM_72(x) x, MITK_PP_SEQ_ENUM_71
+# define MITK_PP_SEQ_ENUM_73(x) x, MITK_PP_SEQ_ENUM_72
+# define MITK_PP_SEQ_ENUM_74(x) x, MITK_PP_SEQ_ENUM_73
+# define MITK_PP_SEQ_ENUM_75(x) x, MITK_PP_SEQ_ENUM_74
+# define MITK_PP_SEQ_ENUM_76(x) x, MITK_PP_SEQ_ENUM_75
+# define MITK_PP_SEQ_ENUM_77(x) x, MITK_PP_SEQ_ENUM_76
+# define MITK_PP_SEQ_ENUM_78(x) x, MITK_PP_SEQ_ENUM_77
+# define MITK_PP_SEQ_ENUM_79(x) x, MITK_PP_SEQ_ENUM_78
+# define MITK_PP_SEQ_ENUM_80(x) x, MITK_PP_SEQ_ENUM_79
+# define MITK_PP_SEQ_ENUM_81(x) x, MITK_PP_SEQ_ENUM_80
+# define MITK_PP_SEQ_ENUM_82(x) x, MITK_PP_SEQ_ENUM_81
+# define MITK_PP_SEQ_ENUM_83(x) x, MITK_PP_SEQ_ENUM_82
+# define MITK_PP_SEQ_ENUM_84(x) x, MITK_PP_SEQ_ENUM_83
+# define MITK_PP_SEQ_ENUM_85(x) x, MITK_PP_SEQ_ENUM_84
+# define MITK_PP_SEQ_ENUM_86(x) x, MITK_PP_SEQ_ENUM_85
+# define MITK_PP_SEQ_ENUM_87(x) x, MITK_PP_SEQ_ENUM_86
+# define MITK_PP_SEQ_ENUM_88(x) x, MITK_PP_SEQ_ENUM_87
+# define MITK_PP_SEQ_ENUM_89(x) x, MITK_PP_SEQ_ENUM_88
+# define MITK_PP_SEQ_ENUM_90(x) x, MITK_PP_SEQ_ENUM_89
+# define MITK_PP_SEQ_ENUM_91(x) x, MITK_PP_SEQ_ENUM_90
+# define MITK_PP_SEQ_ENUM_92(x) x, MITK_PP_SEQ_ENUM_91
+# define MITK_PP_SEQ_ENUM_93(x) x, MITK_PP_SEQ_ENUM_92
+# define MITK_PP_SEQ_ENUM_94(x) x, MITK_PP_SEQ_ENUM_93
+# define MITK_PP_SEQ_ENUM_95(x) x, MITK_PP_SEQ_ENUM_94
+# define MITK_PP_SEQ_ENUM_96(x) x, MITK_PP_SEQ_ENUM_95
+# define MITK_PP_SEQ_ENUM_97(x) x, MITK_PP_SEQ_ENUM_96
+# define MITK_PP_SEQ_ENUM_98(x) x, MITK_PP_SEQ_ENUM_97
+# define MITK_PP_SEQ_ENUM_99(x) x, MITK_PP_SEQ_ENUM_98
+# define MITK_PP_SEQ_ENUM_100(x) x, MITK_PP_SEQ_ENUM_99
+# define MITK_PP_SEQ_ENUM_101(x) x, MITK_PP_SEQ_ENUM_100
+# define MITK_PP_SEQ_ENUM_102(x) x, MITK_PP_SEQ_ENUM_101
+# define MITK_PP_SEQ_ENUM_103(x) x, MITK_PP_SEQ_ENUM_102
+# define MITK_PP_SEQ_ENUM_104(x) x, MITK_PP_SEQ_ENUM_103
+# define MITK_PP_SEQ_ENUM_105(x) x, MITK_PP_SEQ_ENUM_104
+# define MITK_PP_SEQ_ENUM_106(x) x, MITK_PP_SEQ_ENUM_105
+# define MITK_PP_SEQ_ENUM_107(x) x, MITK_PP_SEQ_ENUM_106
+# define MITK_PP_SEQ_ENUM_108(x) x, MITK_PP_SEQ_ENUM_107
+# define MITK_PP_SEQ_ENUM_109(x) x, MITK_PP_SEQ_ENUM_108
+# define MITK_PP_SEQ_ENUM_110(x) x, MITK_PP_SEQ_ENUM_109
+# define MITK_PP_SEQ_ENUM_111(x) x, MITK_PP_SEQ_ENUM_110
+# define MITK_PP_SEQ_ENUM_112(x) x, MITK_PP_SEQ_ENUM_111
+# define MITK_PP_SEQ_ENUM_113(x) x, MITK_PP_SEQ_ENUM_112
+# define MITK_PP_SEQ_ENUM_114(x) x, MITK_PP_SEQ_ENUM_113
+# define MITK_PP_SEQ_ENUM_115(x) x, MITK_PP_SEQ_ENUM_114
+# define MITK_PP_SEQ_ENUM_116(x) x, MITK_PP_SEQ_ENUM_115
+# define MITK_PP_SEQ_ENUM_117(x) x, MITK_PP_SEQ_ENUM_116
+# define MITK_PP_SEQ_ENUM_118(x) x, MITK_PP_SEQ_ENUM_117
+# define MITK_PP_SEQ_ENUM_119(x) x, MITK_PP_SEQ_ENUM_118
+# define MITK_PP_SEQ_ENUM_120(x) x, MITK_PP_SEQ_ENUM_119
+# define MITK_PP_SEQ_ENUM_121(x) x, MITK_PP_SEQ_ENUM_120
+# define MITK_PP_SEQ_ENUM_122(x) x, MITK_PP_SEQ_ENUM_121
+# define MITK_PP_SEQ_ENUM_123(x) x, MITK_PP_SEQ_ENUM_122
+# define MITK_PP_SEQ_ENUM_124(x) x, MITK_PP_SEQ_ENUM_123
+# define MITK_PP_SEQ_ENUM_125(x) x, MITK_PP_SEQ_ENUM_124
+# define MITK_PP_SEQ_ENUM_126(x) x, MITK_PP_SEQ_ENUM_125
+# define MITK_PP_SEQ_ENUM_127(x) x, MITK_PP_SEQ_ENUM_126
+# define MITK_PP_SEQ_ENUM_128(x) x, MITK_PP_SEQ_ENUM_127
+# define MITK_PP_SEQ_ENUM_129(x) x, MITK_PP_SEQ_ENUM_128
+# define MITK_PP_SEQ_ENUM_130(x) x, MITK_PP_SEQ_ENUM_129
+# define MITK_PP_SEQ_ENUM_131(x) x, MITK_PP_SEQ_ENUM_130
+# define MITK_PP_SEQ_ENUM_132(x) x, MITK_PP_SEQ_ENUM_131
+# define MITK_PP_SEQ_ENUM_133(x) x, MITK_PP_SEQ_ENUM_132
+# define MITK_PP_SEQ_ENUM_134(x) x, MITK_PP_SEQ_ENUM_133
+# define MITK_PP_SEQ_ENUM_135(x) x, MITK_PP_SEQ_ENUM_134
+# define MITK_PP_SEQ_ENUM_136(x) x, MITK_PP_SEQ_ENUM_135
+# define MITK_PP_SEQ_ENUM_137(x) x, MITK_PP_SEQ_ENUM_136
+# define MITK_PP_SEQ_ENUM_138(x) x, MITK_PP_SEQ_ENUM_137
+# define MITK_PP_SEQ_ENUM_139(x) x, MITK_PP_SEQ_ENUM_138
+# define MITK_PP_SEQ_ENUM_140(x) x, MITK_PP_SEQ_ENUM_139
+# define MITK_PP_SEQ_ENUM_141(x) x, MITK_PP_SEQ_ENUM_140
+# define MITK_PP_SEQ_ENUM_142(x) x, MITK_PP_SEQ_ENUM_141
+# define MITK_PP_SEQ_ENUM_143(x) x, MITK_PP_SEQ_ENUM_142
+# define MITK_PP_SEQ_ENUM_144(x) x, MITK_PP_SEQ_ENUM_143
+# define MITK_PP_SEQ_ENUM_145(x) x, MITK_PP_SEQ_ENUM_144
+# define MITK_PP_SEQ_ENUM_146(x) x, MITK_PP_SEQ_ENUM_145
+# define MITK_PP_SEQ_ENUM_147(x) x, MITK_PP_SEQ_ENUM_146
+# define MITK_PP_SEQ_ENUM_148(x) x, MITK_PP_SEQ_ENUM_147
+# define MITK_PP_SEQ_ENUM_149(x) x, MITK_PP_SEQ_ENUM_148
+# define MITK_PP_SEQ_ENUM_150(x) x, MITK_PP_SEQ_ENUM_149
+# define MITK_PP_SEQ_ENUM_151(x) x, MITK_PP_SEQ_ENUM_150
+# define MITK_PP_SEQ_ENUM_152(x) x, MITK_PP_SEQ_ENUM_151
+# define MITK_PP_SEQ_ENUM_153(x) x, MITK_PP_SEQ_ENUM_152
+# define MITK_PP_SEQ_ENUM_154(x) x, MITK_PP_SEQ_ENUM_153
+# define MITK_PP_SEQ_ENUM_155(x) x, MITK_PP_SEQ_ENUM_154
+# define MITK_PP_SEQ_ENUM_156(x) x, MITK_PP_SEQ_ENUM_155
+# define MITK_PP_SEQ_ENUM_157(x) x, MITK_PP_SEQ_ENUM_156
+# define MITK_PP_SEQ_ENUM_158(x) x, MITK_PP_SEQ_ENUM_157
+# define MITK_PP_SEQ_ENUM_159(x) x, MITK_PP_SEQ_ENUM_158
+# define MITK_PP_SEQ_ENUM_160(x) x, MITK_PP_SEQ_ENUM_159
+# define MITK_PP_SEQ_ENUM_161(x) x, MITK_PP_SEQ_ENUM_160
+# define MITK_PP_SEQ_ENUM_162(x) x, MITK_PP_SEQ_ENUM_161
+# define MITK_PP_SEQ_ENUM_163(x) x, MITK_PP_SEQ_ENUM_162
+# define MITK_PP_SEQ_ENUM_164(x) x, MITK_PP_SEQ_ENUM_163
+# define MITK_PP_SEQ_ENUM_165(x) x, MITK_PP_SEQ_ENUM_164
+# define MITK_PP_SEQ_ENUM_166(x) x, MITK_PP_SEQ_ENUM_165
+# define MITK_PP_SEQ_ENUM_167(x) x, MITK_PP_SEQ_ENUM_166
+# define MITK_PP_SEQ_ENUM_168(x) x, MITK_PP_SEQ_ENUM_167
+# define MITK_PP_SEQ_ENUM_169(x) x, MITK_PP_SEQ_ENUM_168
+# define MITK_PP_SEQ_ENUM_170(x) x, MITK_PP_SEQ_ENUM_169
+# define MITK_PP_SEQ_ENUM_171(x) x, MITK_PP_SEQ_ENUM_170
+# define MITK_PP_SEQ_ENUM_172(x) x, MITK_PP_SEQ_ENUM_171
+# define MITK_PP_SEQ_ENUM_173(x) x, MITK_PP_SEQ_ENUM_172
+# define MITK_PP_SEQ_ENUM_174(x) x, MITK_PP_SEQ_ENUM_173
+# define MITK_PP_SEQ_ENUM_175(x) x, MITK_PP_SEQ_ENUM_174
+# define MITK_PP_SEQ_ENUM_176(x) x, MITK_PP_SEQ_ENUM_175
+# define MITK_PP_SEQ_ENUM_177(x) x, MITK_PP_SEQ_ENUM_176
+# define MITK_PP_SEQ_ENUM_178(x) x, MITK_PP_SEQ_ENUM_177
+# define MITK_PP_SEQ_ENUM_179(x) x, MITK_PP_SEQ_ENUM_178
+# define MITK_PP_SEQ_ENUM_180(x) x, MITK_PP_SEQ_ENUM_179
+# define MITK_PP_SEQ_ENUM_181(x) x, MITK_PP_SEQ_ENUM_180
+# define MITK_PP_SEQ_ENUM_182(x) x, MITK_PP_SEQ_ENUM_181
+# define MITK_PP_SEQ_ENUM_183(x) x, MITK_PP_SEQ_ENUM_182
+# define MITK_PP_SEQ_ENUM_184(x) x, MITK_PP_SEQ_ENUM_183
+# define MITK_PP_SEQ_ENUM_185(x) x, MITK_PP_SEQ_ENUM_184
+# define MITK_PP_SEQ_ENUM_186(x) x, MITK_PP_SEQ_ENUM_185
+# define MITK_PP_SEQ_ENUM_187(x) x, MITK_PP_SEQ_ENUM_186
+# define MITK_PP_SEQ_ENUM_188(x) x, MITK_PP_SEQ_ENUM_187
+# define MITK_PP_SEQ_ENUM_189(x) x, MITK_PP_SEQ_ENUM_188
+# define MITK_PP_SEQ_ENUM_190(x) x, MITK_PP_SEQ_ENUM_189
+# define MITK_PP_SEQ_ENUM_191(x) x, MITK_PP_SEQ_ENUM_190
+# define MITK_PP_SEQ_ENUM_192(x) x, MITK_PP_SEQ_ENUM_191
+# define MITK_PP_SEQ_ENUM_193(x) x, MITK_PP_SEQ_ENUM_192
+# define MITK_PP_SEQ_ENUM_194(x) x, MITK_PP_SEQ_ENUM_193
+# define MITK_PP_SEQ_ENUM_195(x) x, MITK_PP_SEQ_ENUM_194
+# define MITK_PP_SEQ_ENUM_196(x) x, MITK_PP_SEQ_ENUM_195
+# define MITK_PP_SEQ_ENUM_197(x) x, MITK_PP_SEQ_ENUM_196
+# define MITK_PP_SEQ_ENUM_198(x) x, MITK_PP_SEQ_ENUM_197
+# define MITK_PP_SEQ_ENUM_199(x) x, MITK_PP_SEQ_ENUM_198
+# define MITK_PP_SEQ_ENUM_200(x) x, MITK_PP_SEQ_ENUM_199
+# define MITK_PP_SEQ_ENUM_201(x) x, MITK_PP_SEQ_ENUM_200
+# define MITK_PP_SEQ_ENUM_202(x) x, MITK_PP_SEQ_ENUM_201
+# define MITK_PP_SEQ_ENUM_203(x) x, MITK_PP_SEQ_ENUM_202
+# define MITK_PP_SEQ_ENUM_204(x) x, MITK_PP_SEQ_ENUM_203
+# define MITK_PP_SEQ_ENUM_205(x) x, MITK_PP_SEQ_ENUM_204
+# define MITK_PP_SEQ_ENUM_206(x) x, MITK_PP_SEQ_ENUM_205
+# define MITK_PP_SEQ_ENUM_207(x) x, MITK_PP_SEQ_ENUM_206
+# define MITK_PP_SEQ_ENUM_208(x) x, MITK_PP_SEQ_ENUM_207
+# define MITK_PP_SEQ_ENUM_209(x) x, MITK_PP_SEQ_ENUM_208
+# define MITK_PP_SEQ_ENUM_210(x) x, MITK_PP_SEQ_ENUM_209
+# define MITK_PP_SEQ_ENUM_211(x) x, MITK_PP_SEQ_ENUM_210
+# define MITK_PP_SEQ_ENUM_212(x) x, MITK_PP_SEQ_ENUM_211
+# define MITK_PP_SEQ_ENUM_213(x) x, MITK_PP_SEQ_ENUM_212
+# define MITK_PP_SEQ_ENUM_214(x) x, MITK_PP_SEQ_ENUM_213
+# define MITK_PP_SEQ_ENUM_215(x) x, MITK_PP_SEQ_ENUM_214
+# define MITK_PP_SEQ_ENUM_216(x) x, MITK_PP_SEQ_ENUM_215
+# define MITK_PP_SEQ_ENUM_217(x) x, MITK_PP_SEQ_ENUM_216
+# define MITK_PP_SEQ_ENUM_218(x) x, MITK_PP_SEQ_ENUM_217
+# define MITK_PP_SEQ_ENUM_219(x) x, MITK_PP_SEQ_ENUM_218
+# define MITK_PP_SEQ_ENUM_220(x) x, MITK_PP_SEQ_ENUM_219
+# define MITK_PP_SEQ_ENUM_221(x) x, MITK_PP_SEQ_ENUM_220
+# define MITK_PP_SEQ_ENUM_222(x) x, MITK_PP_SEQ_ENUM_221
+# define MITK_PP_SEQ_ENUM_223(x) x, MITK_PP_SEQ_ENUM_222
+# define MITK_PP_SEQ_ENUM_224(x) x, MITK_PP_SEQ_ENUM_223
+# define MITK_PP_SEQ_ENUM_225(x) x, MITK_PP_SEQ_ENUM_224
+# define MITK_PP_SEQ_ENUM_226(x) x, MITK_PP_SEQ_ENUM_225
+# define MITK_PP_SEQ_ENUM_227(x) x, MITK_PP_SEQ_ENUM_226
+# define MITK_PP_SEQ_ENUM_228(x) x, MITK_PP_SEQ_ENUM_227
+# define MITK_PP_SEQ_ENUM_229(x) x, MITK_PP_SEQ_ENUM_228
+# define MITK_PP_SEQ_ENUM_230(x) x, MITK_PP_SEQ_ENUM_229
+# define MITK_PP_SEQ_ENUM_231(x) x, MITK_PP_SEQ_ENUM_230
+# define MITK_PP_SEQ_ENUM_232(x) x, MITK_PP_SEQ_ENUM_231
+# define MITK_PP_SEQ_ENUM_233(x) x, MITK_PP_SEQ_ENUM_232
+# define MITK_PP_SEQ_ENUM_234(x) x, MITK_PP_SEQ_ENUM_233
+# define MITK_PP_SEQ_ENUM_235(x) x, MITK_PP_SEQ_ENUM_234
+# define MITK_PP_SEQ_ENUM_236(x) x, MITK_PP_SEQ_ENUM_235
+# define MITK_PP_SEQ_ENUM_237(x) x, MITK_PP_SEQ_ENUM_236
+# define MITK_PP_SEQ_ENUM_238(x) x, MITK_PP_SEQ_ENUM_237
+# define MITK_PP_SEQ_ENUM_239(x) x, MITK_PP_SEQ_ENUM_238
+# define MITK_PP_SEQ_ENUM_240(x) x, MITK_PP_SEQ_ENUM_239
+# define MITK_PP_SEQ_ENUM_241(x) x, MITK_PP_SEQ_ENUM_240
+# define MITK_PP_SEQ_ENUM_242(x) x, MITK_PP_SEQ_ENUM_241
+# define MITK_PP_SEQ_ENUM_243(x) x, MITK_PP_SEQ_ENUM_242
+# define MITK_PP_SEQ_ENUM_244(x) x, MITK_PP_SEQ_ENUM_243
+# define MITK_PP_SEQ_ENUM_245(x) x, MITK_PP_SEQ_ENUM_244
+# define MITK_PP_SEQ_ENUM_246(x) x, MITK_PP_SEQ_ENUM_245
+# define MITK_PP_SEQ_ENUM_247(x) x, MITK_PP_SEQ_ENUM_246
+# define MITK_PP_SEQ_ENUM_248(x) x, MITK_PP_SEQ_ENUM_247
+# define MITK_PP_SEQ_ENUM_249(x) x, MITK_PP_SEQ_ENUM_248
+# define MITK_PP_SEQ_ENUM_250(x) x, MITK_PP_SEQ_ENUM_249
+# define MITK_PP_SEQ_ENUM_251(x) x, MITK_PP_SEQ_ENUM_250
+# define MITK_PP_SEQ_ENUM_252(x) x, MITK_PP_SEQ_ENUM_251
+# define MITK_PP_SEQ_ENUM_253(x) x, MITK_PP_SEQ_ENUM_252
+# define MITK_PP_SEQ_ENUM_254(x) x, MITK_PP_SEQ_ENUM_253
+# define MITK_PP_SEQ_ENUM_255(x) x, MITK_PP_SEQ_ENUM_254
+# define MITK_PP_SEQ_ENUM_256(x) x, MITK_PP_SEQ_ENUM_255
+#
+# endif
diff --git a/Core/Code/Algorithms/mitkPPSeqForEach.h b/Core/Code/Algorithms/mitkPPSeqForEach.h
new file mode 100644
index 0000000000..21b9b19aae
--- /dev/null
+++ b/Core/Code/Algorithms/mitkPPSeqForEach.h
@@ -0,0 +1,60 @@
+# /* **************************************************************************
+# * *
+# * (C) Copyright Paul Mensonides 2002.
+# * Distributed under the Boost Software License, Version 1.0. (See
+# * accompanying file LICENSE_1_0.txt or copy at
+# * http://www.boost.org/LICENSE_1_0.txt)
+# * *
+# ************************************************************************** */
+#
+# /* See http://www.boost.org for most recent version. */
+#
+# ifndef MITK_PREPROCESSOR_SEQ_FOR_EACH_HPP
+# define MITK_PREPROCESSOR_SEQ_FOR_EACH_HPP
+#
+# include "mitkPPArithmeticDec.h"
+# include "mitkPPConfig.h"
+# include "mitkPPRepetitionFor.h"
+# include "mitkPPSeq.h"
+# include "mitkPPSeqSize.h"
+# include "mitkPPTupleElem.h"
+# include "mitkPPTupleRem.h"
+#
+# /* MITK_PP_SEQ_FOR_EACH */
+#
+# if ~MITK_PP_CONFIG_FLAGS() & MITK_PP_CONFIG_EDG()
+# define MITK_PP_SEQ_FOR_EACH(macro, data, seq) MITK_PP_FOR((macro, data, seq (nil)), MITK_PP_SEQ_FOR_EACH_P, MITK_PP_SEQ_FOR_EACH_O, MITK_PP_SEQ_FOR_EACH_M)
+# else
+# define MITK_PP_SEQ_FOR_EACH(macro, data, seq) MITK_PP_SEQ_FOR_EACH_D(macro, data, seq)
+# define MITK_PP_SEQ_FOR_EACH_D(macro, data, seq) MITK_PP_FOR((macro, data, seq (nil)), MITK_PP_SEQ_FOR_EACH_P, MITK_PP_SEQ_FOR_EACH_O, MITK_PP_SEQ_FOR_EACH_M)
+# endif
+#
+# define MITK_PP_SEQ_FOR_EACH_P(r, x) MITK_PP_DEC(MITK_PP_SEQ_SIZE(MITK_PP_TUPLE_ELEM(3, 2, x)))
+#
+# if MITK_PP_CONFIG_FLAGS() & MITK_PP_CONFIG_STRICT()
+# define MITK_PP_SEQ_FOR_EACH_O(r, x) MITK_PP_SEQ_FOR_EACH_O_I x
+# else
+# define MITK_PP_SEQ_FOR_EACH_O(r, x) MITK_PP_SEQ_FOR_EACH_O_I(MITK_PP_TUPLE_ELEM(3, 0, x), MITK_PP_TUPLE_ELEM(3, 1, x), MITK_PP_TUPLE_ELEM(3, 2, x))
+# endif
+#
+# define MITK_PP_SEQ_FOR_EACH_O_I(macro, data, seq) (macro, data, MITK_PP_SEQ_TAIL(seq))
+#
+# if MITK_PP_CONFIG_FLAGS() & MITK_PP_CONFIG_STRICT()
+# define MITK_PP_SEQ_FOR_EACH_M(r, x) MITK_PP_SEQ_FOR_EACH_M_IM(r, MITK_PP_TUPLE_REM_3 x)
+# define MITK_PP_SEQ_FOR_EACH_M_IM(r, im) MITK_PP_SEQ_FOR_EACH_M_I(r, im)
+# else
+# define MITK_PP_SEQ_FOR_EACH_M(r, x) MITK_PP_SEQ_FOR_EACH_M_I(r, MITK_PP_TUPLE_ELEM(3, 0, x), MITK_PP_TUPLE_ELEM(3, 1, x), MITK_PP_TUPLE_ELEM(3, 2, x))
+# endif
+#
+# define MITK_PP_SEQ_FOR_EACH_M_I(r, macro, data, seq) macro(r, data, MITK_PP_SEQ_HEAD(seq))
+#
+# /* MITK_PP_SEQ_FOR_EACH_R */
+#
+# if ~MITK_PP_CONFIG_FLAGS() & MITK_PP_CONFIG_EDG()
+# define MITK_PP_SEQ_FOR_EACH_R(r, macro, data, seq) MITK_PP_FOR_ ## r((macro, data, seq (nil)), MITK_PP_SEQ_FOR_EACH_P, MITK_PP_SEQ_FOR_EACH_O, MITK_PP_SEQ_FOR_EACH_M)
+# else
+# define MITK_PP_SEQ_FOR_EACH_R(r, macro, data, seq) MITK_PP_SEQ_FOR_EACH_R_I(r, macro, data, seq)
+# define MITK_PP_SEQ_FOR_EACH_R_I(r, macro, data, seq) MITK_PP_FOR_ ## r((macro, data, seq (nil)), MITK_PP_SEQ_FOR_EACH_P, MITK_PP_SEQ_FOR_EACH_O, MITK_PP_SEQ_FOR_EACH_M)
+# endif
+#
+# endif
diff --git a/Core/Code/Algorithms/mitkPPSeqForEachProduct.h b/Core/Code/Algorithms/mitkPPSeqForEachProduct.h
new file mode 100644
index 0000000000..29eebaca94
--- /dev/null
+++ b/Core/Code/Algorithms/mitkPPSeqForEachProduct.h
@@ -0,0 +1,126 @@
+# /* **************************************************************************
+# * *
+# * (C) Copyright Paul Mensonides 2002.
+# * Distributed under the Boost Software License, Version 1.0. (See
+# * accompanying file LICENSE_1_0.txt or copy at
+# * http://www.boost.org/LICENSE_1_0.txt)
+# * *
+# ************************************************************************** */
+#
+# /* See http://www.boost.org for most recent version. */
+#
+# ifndef MITK_PREPROCESSOR_SEQ_FOR_EACH_PRODUCT_HPP
+# define MITK_PREPROCESSOR_SEQ_FOR_EACH_PRODUCT_HPP
+#
+# include "mitkPPArithmeticDec.h"
+# include "mitkPPConfig.h"
+# include "mitkPPControlIf.h"
+# include "mitkPPRepetitionFor.h"
+# include "mitkPPSeq.h"
+# include "mitkPPSeqSize.h"
+# include "mitkPPTupleElem.h"
+# include "mitkPPTupleRem.h"
+#
+# /* MITK_PP_SEQ_FOR_EACH_PRODUCT */
+#
+# define MITK_PP_SEQ_FOR_EACH_PRODUCT(macro, sets) MITK_PP_SEQ_FOR_EACH_PRODUCT_E(MITK_PP_FOR, macro, sets)
+#
+# /* MITK_PP_SEQ_FOR_EACH_PRODUCT_R */
+#
+# define MITK_PP_SEQ_FOR_EACH_PRODUCT_R(r, macro, sets) MITK_PP_SEQ_FOR_EACH_PRODUCT_E(MITK_PP_FOR_ ## r, macro, sets)
+#
+# if ~MITK_PP_CONFIG_FLAGS() & MITK_PP_CONFIG_EDG()
+# define MITK_PP_SEQ_FOR_EACH_PRODUCT_E(impl, macro, sets) impl((MITK_PP_SEQ_HEAD(sets)(nil), MITK_PP_SEQ_TAIL(sets)(nil), (nil), macro), MITK_PP_SEQ_FOR_EACH_PRODUCT_P, MITK_PP_SEQ_FOR_EACH_PRODUCT_O, MITK_PP_SEQ_FOR_EACH_PRODUCT_M_0)
+# else
+# define MITK_PP_SEQ_FOR_EACH_PRODUCT_E(impl, macro, sets) MITK_PP_SEQ_FOR_EACH_PRODUCT_E_I(impl, macro, sets)
+# define MITK_PP_SEQ_FOR_EACH_PRODUCT_E_I(impl, macro, sets) impl((MITK_PP_SEQ_HEAD(sets)(nil), MITK_PP_SEQ_TAIL(sets)(nil), (nil), macro), MITK_PP_SEQ_FOR_EACH_PRODUCT_P, MITK_PP_SEQ_FOR_EACH_PRODUCT_O, MITK_PP_SEQ_FOR_EACH_PRODUCT_M_0)
+# endif
+#
+# if MITK_PP_CONFIG_FLAGS() & MITK_PP_CONFIG_STRICT()
+# define MITK_PP_SEQ_FOR_EACH_PRODUCT_P(r, data) MITK_PP_SEQ_FOR_EACH_PRODUCT_P_I data
+# define MITK_PP_SEQ_FOR_EACH_PRODUCT_P_I(cset, rset, res, macro) MITK_PP_DEC(MITK_PP_SEQ_SIZE(cset))
+# else
+# define MITK_PP_SEQ_FOR_EACH_PRODUCT_P(r, data) MITK_PP_DEC(MITK_PP_SEQ_SIZE(MITK_PP_TUPLE_ELEM(4, 0, data)))
+# endif
+#
+# if ~MITK_PP_CONFIG_FLAGS() & MITK_PP_CONFIG_MWCC()
+# define MITK_PP_SEQ_FOR_EACH_PRODUCT_O(r, data) MITK_PP_SEQ_FOR_EACH_PRODUCT_O_I data
+# define MITK_PP_SEQ_FOR_EACH_PRODUCT_O_I(cset, rset, res, macro) (MITK_PP_SEQ_TAIL(cset), rset, res, macro)
+# else
+# define MITK_PP_SEQ_FOR_EACH_PRODUCT_O(r, data) (MITK_PP_SEQ_TAIL(MITK_PP_TUPLE_ELEM(4, 0, data)), MITK_PP_TUPLE_ELEM(4, 1, data), MITK_PP_TUPLE_ELEM(4, 2, data), MITK_PP_TUPLE_ELEM(4, 3, data))
+# endif
+#
+# define MITK_PP_SEQ_FOR_EACH_PRODUCT_C(data, i) MITK_PP_IF(MITK_PP_DEC(MITK_PP_SEQ_SIZE(MITK_PP_TUPLE_ELEM(4, 1, data))), MITK_PP_SEQ_FOR_EACH_PRODUCT_N_ ## i, MITK_PP_SEQ_FOR_EACH_PRODUCT_I)
+#
+# if ~MITK_PP_CONFIG_FLAGS() & MITK_PP_CONFIG_EDG()
+# define MITK_PP_SEQ_FOR_EACH_PRODUCT_I(r, data) MITK_PP_SEQ_FOR_EACH_PRODUCT_I_I(r, MITK_PP_TUPLE_ELEM(4, 0, data), MITK_PP_TUPLE_ELEM(4, 1, data), MITK_PP_TUPLE_ELEM(4, 2, data), MITK_PP_TUPLE_ELEM(4, 3, data))
+# else
+# define MITK_PP_SEQ_FOR_EACH_PRODUCT_I(r, data) MITK_PP_SEQ_FOR_EACH_PRODUCT_I_IM(r, MITK_PP_TUPLE_REM_4 data)
+# define MITK_PP_SEQ_FOR_EACH_PRODUCT_I_IM(r, im) MITK_PP_SEQ_FOR_EACH_PRODUCT_I_I(r, im)
+# endif
+#
+# define MITK_PP_SEQ_FOR_EACH_PRODUCT_I_I(r, cset, rset, res, macro) macro(r, MITK_PP_SEQ_TAIL(res (MITK_PP_SEQ_HEAD(cset))))
+#
+# if ~MITK_PP_CONFIG_FLAGS() & MITK_PP_CONFIG_MWCC()
+# define MITK_PP_SEQ_FOR_EACH_PRODUCT_H(data) MITK_PP_SEQ_FOR_EACH_PRODUCT_H_I data
+# else
+# define MITK_PP_SEQ_FOR_EACH_PRODUCT_H(data) MITK_PP_SEQ_FOR_EACH_PRODUCT_H_I(MITK_PP_TUPLE_ELEM(4, 0, data), MITK_PP_TUPLE_ELEM(4, 1, data), MITK_PP_TUPLE_ELEM(4, 2, data), MITK_PP_TUPLE_ELEM(4, 3, data))
+# endif
+#
+# define MITK_PP_SEQ_FOR_EACH_PRODUCT_H_I(cset, rset, res, macro) (MITK_PP_SEQ_HEAD(rset)(nil), MITK_PP_SEQ_TAIL(rset), res (MITK_PP_SEQ_HEAD(cset)), macro)
+#
+# define MITK_PP_SEQ_FOR_EACH_PRODUCT_M_0(r, data) MITK_PP_SEQ_FOR_EACH_PRODUCT_C(data, 0)(r, data)
+# define MITK_PP_SEQ_FOR_EACH_PRODUCT_M_1(r, data) MITK_PP_SEQ_FOR_EACH_PRODUCT_C(data, 1)(r, data)
+# define MITK_PP_SEQ_FOR_EACH_PRODUCT_M_2(r, data) MITK_PP_SEQ_FOR_EACH_PRODUCT_C(data, 2)(r, data)
+# define MITK_PP_SEQ_FOR_EACH_PRODUCT_M_3(r, data) MITK_PP_SEQ_FOR_EACH_PRODUCT_C(data, 3)(r, data)
+# define MITK_PP_SEQ_FOR_EACH_PRODUCT_M_4(r, data) MITK_PP_SEQ_FOR_EACH_PRODUCT_C(data, 4)(r, data)
+# define MITK_PP_SEQ_FOR_EACH_PRODUCT_M_5(r, data) MITK_PP_SEQ_FOR_EACH_PRODUCT_C(data, 5)(r, data)
+# define MITK_PP_SEQ_FOR_EACH_PRODUCT_M_6(r, data) MITK_PP_SEQ_FOR_EACH_PRODUCT_C(data, 6)(r, data)
+# define MITK_PP_SEQ_FOR_EACH_PRODUCT_M_7(r, data) MITK_PP_SEQ_FOR_EACH_PRODUCT_C(data, 7)(r, data)
+# define MITK_PP_SEQ_FOR_EACH_PRODUCT_M_8(r, data) MITK_PP_SEQ_FOR_EACH_PRODUCT_C(data, 8)(r, data)
+# define MITK_PP_SEQ_FOR_EACH_PRODUCT_M_9(r, data) MITK_PP_SEQ_FOR_EACH_PRODUCT_C(data, 9)(r, data)
+# define MITK_PP_SEQ_FOR_EACH_PRODUCT_M_10(r, data) MITK_PP_SEQ_FOR_EACH_PRODUCT_C(data, 10)(r, data)
+# define MITK_PP_SEQ_FOR_EACH_PRODUCT_M_11(r, data) MITK_PP_SEQ_FOR_EACH_PRODUCT_C(data, 11)(r, data)
+# define MITK_PP_SEQ_FOR_EACH_PRODUCT_M_12(r, data) MITK_PP_SEQ_FOR_EACH_PRODUCT_C(data, 12)(r, data)
+# define MITK_PP_SEQ_FOR_EACH_PRODUCT_M_13(r, data) MITK_PP_SEQ_FOR_EACH_PRODUCT_C(data, 13)(r, data)
+# define MITK_PP_SEQ_FOR_EACH_PRODUCT_M_14(r, data) MITK_PP_SEQ_FOR_EACH_PRODUCT_C(data, 14)(r, data)
+# define MITK_PP_SEQ_FOR_EACH_PRODUCT_M_15(r, data) MITK_PP_SEQ_FOR_EACH_PRODUCT_C(data, 15)(r, data)
+# define MITK_PP_SEQ_FOR_EACH_PRODUCT_M_16(r, data) MITK_PP_SEQ_FOR_EACH_PRODUCT_C(data, 16)(r, data)
+# define MITK_PP_SEQ_FOR_EACH_PRODUCT_M_17(r, data) MITK_PP_SEQ_FOR_EACH_PRODUCT_C(data, 17)(r, data)
+# define MITK_PP_SEQ_FOR_EACH_PRODUCT_M_18(r, data) MITK_PP_SEQ_FOR_EACH_PRODUCT_C(data, 18)(r, data)
+# define MITK_PP_SEQ_FOR_EACH_PRODUCT_M_19(r, data) MITK_PP_SEQ_FOR_EACH_PRODUCT_C(data, 19)(r, data)
+# define MITK_PP_SEQ_FOR_EACH_PRODUCT_M_20(r, data) MITK_PP_SEQ_FOR_EACH_PRODUCT_C(data, 20)(r, data)
+# define MITK_PP_SEQ_FOR_EACH_PRODUCT_M_21(r, data) MITK_PP_SEQ_FOR_EACH_PRODUCT_C(data, 21)(r, data)
+# define MITK_PP_SEQ_FOR_EACH_PRODUCT_M_22(r, data) MITK_PP_SEQ_FOR_EACH_PRODUCT_C(data, 22)(r, data)
+# define MITK_PP_SEQ_FOR_EACH_PRODUCT_M_23(r, data) MITK_PP_SEQ_FOR_EACH_PRODUCT_C(data, 23)(r, data)
+# define MITK_PP_SEQ_FOR_EACH_PRODUCT_M_24(r, data) MITK_PP_SEQ_FOR_EACH_PRODUCT_C(data, 24)(r, data)
+# define MITK_PP_SEQ_FOR_EACH_PRODUCT_M_25(r, data) MITK_PP_SEQ_FOR_EACH_PRODUCT_C(data, 25)(r, data)
+#
+# define MITK_PP_SEQ_FOR_EACH_PRODUCT_N_0(r, data) MITK_PP_FOR_ ## r(MITK_PP_SEQ_FOR_EACH_PRODUCT_H(data), MITK_PP_SEQ_FOR_EACH_PRODUCT_P, MITK_PP_SEQ_FOR_EACH_PRODUCT_O, MITK_PP_SEQ_FOR_EACH_PRODUCT_M_1)
+# define MITK_PP_SEQ_FOR_EACH_PRODUCT_N_1(r, data) MITK_PP_FOR_ ## r(MITK_PP_SEQ_FOR_EACH_PRODUCT_H(data), MITK_PP_SEQ_FOR_EACH_PRODUCT_P, MITK_PP_SEQ_FOR_EACH_PRODUCT_O, MITK_PP_SEQ_FOR_EACH_PRODUCT_M_2)
+# define MITK_PP_SEQ_FOR_EACH_PRODUCT_N_2(r, data) MITK_PP_FOR_ ## r(MITK_PP_SEQ_FOR_EACH_PRODUCT_H(data), MITK_PP_SEQ_FOR_EACH_PRODUCT_P, MITK_PP_SEQ_FOR_EACH_PRODUCT_O, MITK_PP_SEQ_FOR_EACH_PRODUCT_M_3)
+# define MITK_PP_SEQ_FOR_EACH_PRODUCT_N_3(r, data) MITK_PP_FOR_ ## r(MITK_PP_SEQ_FOR_EACH_PRODUCT_H(data), MITK_PP_SEQ_FOR_EACH_PRODUCT_P, MITK_PP_SEQ_FOR_EACH_PRODUCT_O, MITK_PP_SEQ_FOR_EACH_PRODUCT_M_4)
+# define MITK_PP_SEQ_FOR_EACH_PRODUCT_N_4(r, data) MITK_PP_FOR_ ## r(MITK_PP_SEQ_FOR_EACH_PRODUCT_H(data), MITK_PP_SEQ_FOR_EACH_PRODUCT_P, MITK_PP_SEQ_FOR_EACH_PRODUCT_O, MITK_PP_SEQ_FOR_EACH_PRODUCT_M_5)
+# define MITK_PP_SEQ_FOR_EACH_PRODUCT_N_5(r, data) MITK_PP_FOR_ ## r(MITK_PP_SEQ_FOR_EACH_PRODUCT_H(data), MITK_PP_SEQ_FOR_EACH_PRODUCT_P, MITK_PP_SEQ_FOR_EACH_PRODUCT_O, MITK_PP_SEQ_FOR_EACH_PRODUCT_M_6)
+# define MITK_PP_SEQ_FOR_EACH_PRODUCT_N_6(r, data) MITK_PP_FOR_ ## r(MITK_PP_SEQ_FOR_EACH_PRODUCT_H(data), MITK_PP_SEQ_FOR_EACH_PRODUCT_P, MITK_PP_SEQ_FOR_EACH_PRODUCT_O, MITK_PP_SEQ_FOR_EACH_PRODUCT_M_7)
+# define MITK_PP_SEQ_FOR_EACH_PRODUCT_N_7(r, data) MITK_PP_FOR_ ## r(MITK_PP_SEQ_FOR_EACH_PRODUCT_H(data), MITK_PP_SEQ_FOR_EACH_PRODUCT_P, MITK_PP_SEQ_FOR_EACH_PRODUCT_O, MITK_PP_SEQ_FOR_EACH_PRODUCT_M_8)
+# define MITK_PP_SEQ_FOR_EACH_PRODUCT_N_8(r, data) MITK_PP_FOR_ ## r(MITK_PP_SEQ_FOR_EACH_PRODUCT_H(data), MITK_PP_SEQ_FOR_EACH_PRODUCT_P, MITK_PP_SEQ_FOR_EACH_PRODUCT_O, MITK_PP_SEQ_FOR_EACH_PRODUCT_M_9)
+# define MITK_PP_SEQ_FOR_EACH_PRODUCT_N_9(r, data) MITK_PP_FOR_ ## r(MITK_PP_SEQ_FOR_EACH_PRODUCT_H(data), MITK_PP_SEQ_FOR_EACH_PRODUCT_P, MITK_PP_SEQ_FOR_EACH_PRODUCT_O, MITK_PP_SEQ_FOR_EACH_PRODUCT_M_10)
+# define MITK_PP_SEQ_FOR_EACH_PRODUCT_N_10(r, data) MITK_PP_FOR_ ## r(MITK_PP_SEQ_FOR_EACH_PRODUCT_H(data), MITK_PP_SEQ_FOR_EACH_PRODUCT_P, MITK_PP_SEQ_FOR_EACH_PRODUCT_O, MITK_PP_SEQ_FOR_EACH_PRODUCT_M_11)
+# define MITK_PP_SEQ_FOR_EACH_PRODUCT_N_11(r, data) MITK_PP_FOR_ ## r(MITK_PP_SEQ_FOR_EACH_PRODUCT_H(data), MITK_PP_SEQ_FOR_EACH_PRODUCT_P, MITK_PP_SEQ_FOR_EACH_PRODUCT_O, MITK_PP_SEQ_FOR_EACH_PRODUCT_M_12)
+# define MITK_PP_SEQ_FOR_EACH_PRODUCT_N_12(r, data) MITK_PP_FOR_ ## r(MITK_PP_SEQ_FOR_EACH_PRODUCT_H(data), MITK_PP_SEQ_FOR_EACH_PRODUCT_P, MITK_PP_SEQ_FOR_EACH_PRODUCT_O, MITK_PP_SEQ_FOR_EACH_PRODUCT_M_13)
+# define MITK_PP_SEQ_FOR_EACH_PRODUCT_N_13(r, data) MITK_PP_FOR_ ## r(MITK_PP_SEQ_FOR_EACH_PRODUCT_H(data), MITK_PP_SEQ_FOR_EACH_PRODUCT_P, MITK_PP_SEQ_FOR_EACH_PRODUCT_O, MITK_PP_SEQ_FOR_EACH_PRODUCT_M_14)
+# define MITK_PP_SEQ_FOR_EACH_PRODUCT_N_14(r, data) MITK_PP_FOR_ ## r(MITK_PP_SEQ_FOR_EACH_PRODUCT_H(data), MITK_PP_SEQ_FOR_EACH_PRODUCT_P, MITK_PP_SEQ_FOR_EACH_PRODUCT_O, MITK_PP_SEQ_FOR_EACH_PRODUCT_M_15)
+# define MITK_PP_SEQ_FOR_EACH_PRODUCT_N_15(r, data) MITK_PP_FOR_ ## r(MITK_PP_SEQ_FOR_EACH_PRODUCT_H(data), MITK_PP_SEQ_FOR_EACH_PRODUCT_P, MITK_PP_SEQ_FOR_EACH_PRODUCT_O, MITK_PP_SEQ_FOR_EACH_PRODUCT_M_16)
+# define MITK_PP_SEQ_FOR_EACH_PRODUCT_N_16(r, data) MITK_PP_FOR_ ## r(MITK_PP_SEQ_FOR_EACH_PRODUCT_H(data), MITK_PP_SEQ_FOR_EACH_PRODUCT_P, MITK_PP_SEQ_FOR_EACH_PRODUCT_O, MITK_PP_SEQ_FOR_EACH_PRODUCT_M_17)
+# define MITK_PP_SEQ_FOR_EACH_PRODUCT_N_17(r, data) MITK_PP_FOR_ ## r(MITK_PP_SEQ_FOR_EACH_PRODUCT_H(data), MITK_PP_SEQ_FOR_EACH_PRODUCT_P, MITK_PP_SEQ_FOR_EACH_PRODUCT_O, MITK_PP_SEQ_FOR_EACH_PRODUCT_M_18)
+# define MITK_PP_SEQ_FOR_EACH_PRODUCT_N_18(r, data) MITK_PP_FOR_ ## r(MITK_PP_SEQ_FOR_EACH_PRODUCT_H(data), MITK_PP_SEQ_FOR_EACH_PRODUCT_P, MITK_PP_SEQ_FOR_EACH_PRODUCT_O, MITK_PP_SEQ_FOR_EACH_PRODUCT_M_19)
+# define MITK_PP_SEQ_FOR_EACH_PRODUCT_N_19(r, data) MITK_PP_FOR_ ## r(MITK_PP_SEQ_FOR_EACH_PRODUCT_H(data), MITK_PP_SEQ_FOR_EACH_PRODUCT_P, MITK_PP_SEQ_FOR_EACH_PRODUCT_O, MITK_PP_SEQ_FOR_EACH_PRODUCT_M_20)
+# define MITK_PP_SEQ_FOR_EACH_PRODUCT_N_20(r, data) MITK_PP_FOR_ ## r(MITK_PP_SEQ_FOR_EACH_PRODUCT_H(data), MITK_PP_SEQ_FOR_EACH_PRODUCT_P, MITK_PP_SEQ_FOR_EACH_PRODUCT_O, MITK_PP_SEQ_FOR_EACH_PRODUCT_M_21)
+# define MITK_PP_SEQ_FOR_EACH_PRODUCT_N_21(r, data) MITK_PP_FOR_ ## r(MITK_PP_SEQ_FOR_EACH_PRODUCT_H(data), MITK_PP_SEQ_FOR_EACH_PRODUCT_P, MITK_PP_SEQ_FOR_EACH_PRODUCT_O, MITK_PP_SEQ_FOR_EACH_PRODUCT_M_22)
+# define MITK_PP_SEQ_FOR_EACH_PRODUCT_N_22(r, data) MITK_PP_FOR_ ## r(MITK_PP_SEQ_FOR_EACH_PRODUCT_H(data), MITK_PP_SEQ_FOR_EACH_PRODUCT_P, MITK_PP_SEQ_FOR_EACH_PRODUCT_O, MITK_PP_SEQ_FOR_EACH_PRODUCT_M_23)
+# define MITK_PP_SEQ_FOR_EACH_PRODUCT_N_23(r, data) MITK_PP_FOR_ ## r(MITK_PP_SEQ_FOR_EACH_PRODUCT_H(data), MITK_PP_SEQ_FOR_EACH_PRODUCT_P, MITK_PP_SEQ_FOR_EACH_PRODUCT_O, MITK_PP_SEQ_FOR_EACH_PRODUCT_M_24)
+# define MITK_PP_SEQ_FOR_EACH_PRODUCT_N_24(r, data) MITK_PP_FOR_ ## r(MITK_PP_SEQ_FOR_EACH_PRODUCT_H(data), MITK_PP_SEQ_FOR_EACH_PRODUCT_P, MITK_PP_SEQ_FOR_EACH_PRODUCT_O, MITK_PP_SEQ_FOR_EACH_PRODUCT_M_25)
+# define MITK_PP_SEQ_FOR_EACH_PRODUCT_N_25(r, data) MITK_PP_FOR_ ## r(MITK_PP_SEQ_FOR_EACH_PRODUCT_H(data), MITK_PP_SEQ_FOR_EACH_PRODUCT_P, MITK_PP_SEQ_FOR_EACH_PRODUCT_O, MITK_PP_SEQ_FOR_EACH_PRODUCT_M_26)
+#
+# endif
diff --git a/Core/Code/Algorithms/mitkPPSeqSize.h b/Core/Code/Algorithms/mitkPPSeqSize.h
new file mode 100644
index 0000000000..1941d5b57f
--- /dev/null
+++ b/Core/Code/Algorithms/mitkPPSeqSize.h
@@ -0,0 +1,548 @@
+# /* **************************************************************************
+# * *
+# * (C) Copyright Paul Mensonides 2002.
+# * Distributed under the Boost Software License, Version 1.0. (See
+# * accompanying file LICENSE_1_0.txt or copy at
+# * http://www.boost.org/LICENSE_1_0.txt)
+# * *
+# ************************************************************************** */
+#
+# /* See http://www.boost.org for most recent version. */
+#
+# ifndef MITK_PREPROCESSOR_SEQ_SIZE_HPP
+# define MITK_PREPROCESSOR_SEQ_SIZE_HPP
+#
+# include "mitkPPCat.h"
+# include "mitkPPConfig.h"
+# include "mitkPPTupleEat.h"
+#
+# if MITK_PP_CONFIG_FLAGS() & MITK_PP_CONFIG_MWCC()
+# define MITK_PP_SEQ_SIZE(seq) MITK_PP_SEQ_SIZE_I((seq))
+# define MITK_PP_SEQ_SIZE_I(par) MITK_PP_SEQ_SIZE_II ## par
+# define MITK_PP_SEQ_SIZE_II(seq) MITK_PP_CAT(MITK_PP_SEQ_SIZE_, MITK_PP_SEQ_SIZE_0 ## seq)
+# elif MITK_PP_CONFIG_FLAGS() & MITK_PP_CONFIG_EDG() || MITK_PP_CONFIG_FLAGS() & MITK_PP_CONFIG_MSVC()
+# define MITK_PP_SEQ_SIZE(seq) MITK_PP_SEQ_SIZE_I(seq)
+# define MITK_PP_SEQ_SIZE_I(seq) MITK_PP_CAT(MITK_PP_SEQ_SIZE_, MITK_PP_SEQ_SIZE_0 seq)
+# elif defined(__IBMC__) || defined(__IBMCPP__)
+# define MITK_PP_SEQ_SIZE(seq) MITK_PP_CAT(MITK_PP_SEQ_SIZE_, MITK_PP_CAT(MITK_PP_SEQ_SIZE_0, seq))
+# else
+# define MITK_PP_SEQ_SIZE(seq) MITK_PP_CAT(MITK_PP_SEQ_SIZE_, MITK_PP_SEQ_SIZE_0 seq)
+# endif
+#
+# define MITK_PP_SEQ_SIZE_0(_) MITK_PP_SEQ_SIZE_1
+# define MITK_PP_SEQ_SIZE_1(_) MITK_PP_SEQ_SIZE_2
+# define MITK_PP_SEQ_SIZE_2(_) MITK_PP_SEQ_SIZE_3
+# define MITK_PP_SEQ_SIZE_3(_) MITK_PP_SEQ_SIZE_4
+# define MITK_PP_SEQ_SIZE_4(_) MITK_PP_SEQ_SIZE_5
+# define MITK_PP_SEQ_SIZE_5(_) MITK_PP_SEQ_SIZE_6
+# define MITK_PP_SEQ_SIZE_6(_) MITK_PP_SEQ_SIZE_7
+# define MITK_PP_SEQ_SIZE_7(_) MITK_PP_SEQ_SIZE_8
+# define MITK_PP_SEQ_SIZE_8(_) MITK_PP_SEQ_SIZE_9
+# define MITK_PP_SEQ_SIZE_9(_) MITK_PP_SEQ_SIZE_10
+# define MITK_PP_SEQ_SIZE_10(_) MITK_PP_SEQ_SIZE_11
+# define MITK_PP_SEQ_SIZE_11(_) MITK_PP_SEQ_SIZE_12
+# define MITK_PP_SEQ_SIZE_12(_) MITK_PP_SEQ_SIZE_13
+# define MITK_PP_SEQ_SIZE_13(_) MITK_PP_SEQ_SIZE_14
+# define MITK_PP_SEQ_SIZE_14(_) MITK_PP_SEQ_SIZE_15
+# define MITK_PP_SEQ_SIZE_15(_) MITK_PP_SEQ_SIZE_16
+# define MITK_PP_SEQ_SIZE_16(_) MITK_PP_SEQ_SIZE_17
+# define MITK_PP_SEQ_SIZE_17(_) MITK_PP_SEQ_SIZE_18
+# define MITK_PP_SEQ_SIZE_18(_) MITK_PP_SEQ_SIZE_19
+# define MITK_PP_SEQ_SIZE_19(_) MITK_PP_SEQ_SIZE_20
+# define MITK_PP_SEQ_SIZE_20(_) MITK_PP_SEQ_SIZE_21
+# define MITK_PP_SEQ_SIZE_21(_) MITK_PP_SEQ_SIZE_22
+# define MITK_PP_SEQ_SIZE_22(_) MITK_PP_SEQ_SIZE_23
+# define MITK_PP_SEQ_SIZE_23(_) MITK_PP_SEQ_SIZE_24
+# define MITK_PP_SEQ_SIZE_24(_) MITK_PP_SEQ_SIZE_25
+# define MITK_PP_SEQ_SIZE_25(_) MITK_PP_SEQ_SIZE_26
+# define MITK_PP_SEQ_SIZE_26(_) MITK_PP_SEQ_SIZE_27
+# define MITK_PP_SEQ_SIZE_27(_) MITK_PP_SEQ_SIZE_28
+# define MITK_PP_SEQ_SIZE_28(_) MITK_PP_SEQ_SIZE_29
+# define MITK_PP_SEQ_SIZE_29(_) MITK_PP_SEQ_SIZE_30
+# define MITK_PP_SEQ_SIZE_30(_) MITK_PP_SEQ_SIZE_31
+# define MITK_PP_SEQ_SIZE_31(_) MITK_PP_SEQ_SIZE_32
+# define MITK_PP_SEQ_SIZE_32(_) MITK_PP_SEQ_SIZE_33
+# define MITK_PP_SEQ_SIZE_33(_) MITK_PP_SEQ_SIZE_34
+# define MITK_PP_SEQ_SIZE_34(_) MITK_PP_SEQ_SIZE_35
+# define MITK_PP_SEQ_SIZE_35(_) MITK_PP_SEQ_SIZE_36
+# define MITK_PP_SEQ_SIZE_36(_) MITK_PP_SEQ_SIZE_37
+# define MITK_PP_SEQ_SIZE_37(_) MITK_PP_SEQ_SIZE_38
+# define MITK_PP_SEQ_SIZE_38(_) MITK_PP_SEQ_SIZE_39
+# define MITK_PP_SEQ_SIZE_39(_) MITK_PP_SEQ_SIZE_40
+# define MITK_PP_SEQ_SIZE_40(_) MITK_PP_SEQ_SIZE_41
+# define MITK_PP_SEQ_SIZE_41(_) MITK_PP_SEQ_SIZE_42
+# define MITK_PP_SEQ_SIZE_42(_) MITK_PP_SEQ_SIZE_43
+# define MITK_PP_SEQ_SIZE_43(_) MITK_PP_SEQ_SIZE_44
+# define MITK_PP_SEQ_SIZE_44(_) MITK_PP_SEQ_SIZE_45
+# define MITK_PP_SEQ_SIZE_45(_) MITK_PP_SEQ_SIZE_46
+# define MITK_PP_SEQ_SIZE_46(_) MITK_PP_SEQ_SIZE_47
+# define MITK_PP_SEQ_SIZE_47(_) MITK_PP_SEQ_SIZE_48
+# define MITK_PP_SEQ_SIZE_48(_) MITK_PP_SEQ_SIZE_49
+# define MITK_PP_SEQ_SIZE_49(_) MITK_PP_SEQ_SIZE_50
+# define MITK_PP_SEQ_SIZE_50(_) MITK_PP_SEQ_SIZE_51
+# define MITK_PP_SEQ_SIZE_51(_) MITK_PP_SEQ_SIZE_52
+# define MITK_PP_SEQ_SIZE_52(_) MITK_PP_SEQ_SIZE_53
+# define MITK_PP_SEQ_SIZE_53(_) MITK_PP_SEQ_SIZE_54
+# define MITK_PP_SEQ_SIZE_54(_) MITK_PP_SEQ_SIZE_55
+# define MITK_PP_SEQ_SIZE_55(_) MITK_PP_SEQ_SIZE_56
+# define MITK_PP_SEQ_SIZE_56(_) MITK_PP_SEQ_SIZE_57
+# define MITK_PP_SEQ_SIZE_57(_) MITK_PP_SEQ_SIZE_58
+# define MITK_PP_SEQ_SIZE_58(_) MITK_PP_SEQ_SIZE_59
+# define MITK_PP_SEQ_SIZE_59(_) MITK_PP_SEQ_SIZE_60
+# define MITK_PP_SEQ_SIZE_60(_) MITK_PP_SEQ_SIZE_61
+# define MITK_PP_SEQ_SIZE_61(_) MITK_PP_SEQ_SIZE_62
+# define MITK_PP_SEQ_SIZE_62(_) MITK_PP_SEQ_SIZE_63
+# define MITK_PP_SEQ_SIZE_63(_) MITK_PP_SEQ_SIZE_64
+# define MITK_PP_SEQ_SIZE_64(_) MITK_PP_SEQ_SIZE_65
+# define MITK_PP_SEQ_SIZE_65(_) MITK_PP_SEQ_SIZE_66
+# define MITK_PP_SEQ_SIZE_66(_) MITK_PP_SEQ_SIZE_67
+# define MITK_PP_SEQ_SIZE_67(_) MITK_PP_SEQ_SIZE_68
+# define MITK_PP_SEQ_SIZE_68(_) MITK_PP_SEQ_SIZE_69
+# define MITK_PP_SEQ_SIZE_69(_) MITK_PP_SEQ_SIZE_70
+# define MITK_PP_SEQ_SIZE_70(_) MITK_PP_SEQ_SIZE_71
+# define MITK_PP_SEQ_SIZE_71(_) MITK_PP_SEQ_SIZE_72
+# define MITK_PP_SEQ_SIZE_72(_) MITK_PP_SEQ_SIZE_73
+# define MITK_PP_SEQ_SIZE_73(_) MITK_PP_SEQ_SIZE_74
+# define MITK_PP_SEQ_SIZE_74(_) MITK_PP_SEQ_SIZE_75
+# define MITK_PP_SEQ_SIZE_75(_) MITK_PP_SEQ_SIZE_76
+# define MITK_PP_SEQ_SIZE_76(_) MITK_PP_SEQ_SIZE_77
+# define MITK_PP_SEQ_SIZE_77(_) MITK_PP_SEQ_SIZE_78
+# define MITK_PP_SEQ_SIZE_78(_) MITK_PP_SEQ_SIZE_79
+# define MITK_PP_SEQ_SIZE_79(_) MITK_PP_SEQ_SIZE_80
+# define MITK_PP_SEQ_SIZE_80(_) MITK_PP_SEQ_SIZE_81
+# define MITK_PP_SEQ_SIZE_81(_) MITK_PP_SEQ_SIZE_82
+# define MITK_PP_SEQ_SIZE_82(_) MITK_PP_SEQ_SIZE_83
+# define MITK_PP_SEQ_SIZE_83(_) MITK_PP_SEQ_SIZE_84
+# define MITK_PP_SEQ_SIZE_84(_) MITK_PP_SEQ_SIZE_85
+# define MITK_PP_SEQ_SIZE_85(_) MITK_PP_SEQ_SIZE_86
+# define MITK_PP_SEQ_SIZE_86(_) MITK_PP_SEQ_SIZE_87
+# define MITK_PP_SEQ_SIZE_87(_) MITK_PP_SEQ_SIZE_88
+# define MITK_PP_SEQ_SIZE_88(_) MITK_PP_SEQ_SIZE_89
+# define MITK_PP_SEQ_SIZE_89(_) MITK_PP_SEQ_SIZE_90
+# define MITK_PP_SEQ_SIZE_90(_) MITK_PP_SEQ_SIZE_91
+# define MITK_PP_SEQ_SIZE_91(_) MITK_PP_SEQ_SIZE_92
+# define MITK_PP_SEQ_SIZE_92(_) MITK_PP_SEQ_SIZE_93
+# define MITK_PP_SEQ_SIZE_93(_) MITK_PP_SEQ_SIZE_94
+# define MITK_PP_SEQ_SIZE_94(_) MITK_PP_SEQ_SIZE_95
+# define MITK_PP_SEQ_SIZE_95(_) MITK_PP_SEQ_SIZE_96
+# define MITK_PP_SEQ_SIZE_96(_) MITK_PP_SEQ_SIZE_97
+# define MITK_PP_SEQ_SIZE_97(_) MITK_PP_SEQ_SIZE_98
+# define MITK_PP_SEQ_SIZE_98(_) MITK_PP_SEQ_SIZE_99
+# define MITK_PP_SEQ_SIZE_99(_) MITK_PP_SEQ_SIZE_100
+# define MITK_PP_SEQ_SIZE_100(_) MITK_PP_SEQ_SIZE_101
+# define MITK_PP_SEQ_SIZE_101(_) MITK_PP_SEQ_SIZE_102
+# define MITK_PP_SEQ_SIZE_102(_) MITK_PP_SEQ_SIZE_103
+# define MITK_PP_SEQ_SIZE_103(_) MITK_PP_SEQ_SIZE_104
+# define MITK_PP_SEQ_SIZE_104(_) MITK_PP_SEQ_SIZE_105
+# define MITK_PP_SEQ_SIZE_105(_) MITK_PP_SEQ_SIZE_106
+# define MITK_PP_SEQ_SIZE_106(_) MITK_PP_SEQ_SIZE_107
+# define MITK_PP_SEQ_SIZE_107(_) MITK_PP_SEQ_SIZE_108
+# define MITK_PP_SEQ_SIZE_108(_) MITK_PP_SEQ_SIZE_109
+# define MITK_PP_SEQ_SIZE_109(_) MITK_PP_SEQ_SIZE_110
+# define MITK_PP_SEQ_SIZE_110(_) MITK_PP_SEQ_SIZE_111
+# define MITK_PP_SEQ_SIZE_111(_) MITK_PP_SEQ_SIZE_112
+# define MITK_PP_SEQ_SIZE_112(_) MITK_PP_SEQ_SIZE_113
+# define MITK_PP_SEQ_SIZE_113(_) MITK_PP_SEQ_SIZE_114
+# define MITK_PP_SEQ_SIZE_114(_) MITK_PP_SEQ_SIZE_115
+# define MITK_PP_SEQ_SIZE_115(_) MITK_PP_SEQ_SIZE_116
+# define MITK_PP_SEQ_SIZE_116(_) MITK_PP_SEQ_SIZE_117
+# define MITK_PP_SEQ_SIZE_117(_) MITK_PP_SEQ_SIZE_118
+# define MITK_PP_SEQ_SIZE_118(_) MITK_PP_SEQ_SIZE_119
+# define MITK_PP_SEQ_SIZE_119(_) MITK_PP_SEQ_SIZE_120
+# define MITK_PP_SEQ_SIZE_120(_) MITK_PP_SEQ_SIZE_121
+# define MITK_PP_SEQ_SIZE_121(_) MITK_PP_SEQ_SIZE_122
+# define MITK_PP_SEQ_SIZE_122(_) MITK_PP_SEQ_SIZE_123
+# define MITK_PP_SEQ_SIZE_123(_) MITK_PP_SEQ_SIZE_124
+# define MITK_PP_SEQ_SIZE_124(_) MITK_PP_SEQ_SIZE_125
+# define MITK_PP_SEQ_SIZE_125(_) MITK_PP_SEQ_SIZE_126
+# define MITK_PP_SEQ_SIZE_126(_) MITK_PP_SEQ_SIZE_127
+# define MITK_PP_SEQ_SIZE_127(_) MITK_PP_SEQ_SIZE_128
+# define MITK_PP_SEQ_SIZE_128(_) MITK_PP_SEQ_SIZE_129
+# define MITK_PP_SEQ_SIZE_129(_) MITK_PP_SEQ_SIZE_130
+# define MITK_PP_SEQ_SIZE_130(_) MITK_PP_SEQ_SIZE_131
+# define MITK_PP_SEQ_SIZE_131(_) MITK_PP_SEQ_SIZE_132
+# define MITK_PP_SEQ_SIZE_132(_) MITK_PP_SEQ_SIZE_133
+# define MITK_PP_SEQ_SIZE_133(_) MITK_PP_SEQ_SIZE_134
+# define MITK_PP_SEQ_SIZE_134(_) MITK_PP_SEQ_SIZE_135
+# define MITK_PP_SEQ_SIZE_135(_) MITK_PP_SEQ_SIZE_136
+# define MITK_PP_SEQ_SIZE_136(_) MITK_PP_SEQ_SIZE_137
+# define MITK_PP_SEQ_SIZE_137(_) MITK_PP_SEQ_SIZE_138
+# define MITK_PP_SEQ_SIZE_138(_) MITK_PP_SEQ_SIZE_139
+# define MITK_PP_SEQ_SIZE_139(_) MITK_PP_SEQ_SIZE_140
+# define MITK_PP_SEQ_SIZE_140(_) MITK_PP_SEQ_SIZE_141
+# define MITK_PP_SEQ_SIZE_141(_) MITK_PP_SEQ_SIZE_142
+# define MITK_PP_SEQ_SIZE_142(_) MITK_PP_SEQ_SIZE_143
+# define MITK_PP_SEQ_SIZE_143(_) MITK_PP_SEQ_SIZE_144
+# define MITK_PP_SEQ_SIZE_144(_) MITK_PP_SEQ_SIZE_145
+# define MITK_PP_SEQ_SIZE_145(_) MITK_PP_SEQ_SIZE_146
+# define MITK_PP_SEQ_SIZE_146(_) MITK_PP_SEQ_SIZE_147
+# define MITK_PP_SEQ_SIZE_147(_) MITK_PP_SEQ_SIZE_148
+# define MITK_PP_SEQ_SIZE_148(_) MITK_PP_SEQ_SIZE_149
+# define MITK_PP_SEQ_SIZE_149(_) MITK_PP_SEQ_SIZE_150
+# define MITK_PP_SEQ_SIZE_150(_) MITK_PP_SEQ_SIZE_151
+# define MITK_PP_SEQ_SIZE_151(_) MITK_PP_SEQ_SIZE_152
+# define MITK_PP_SEQ_SIZE_152(_) MITK_PP_SEQ_SIZE_153
+# define MITK_PP_SEQ_SIZE_153(_) MITK_PP_SEQ_SIZE_154
+# define MITK_PP_SEQ_SIZE_154(_) MITK_PP_SEQ_SIZE_155
+# define MITK_PP_SEQ_SIZE_155(_) MITK_PP_SEQ_SIZE_156
+# define MITK_PP_SEQ_SIZE_156(_) MITK_PP_SEQ_SIZE_157
+# define MITK_PP_SEQ_SIZE_157(_) MITK_PP_SEQ_SIZE_158
+# define MITK_PP_SEQ_SIZE_158(_) MITK_PP_SEQ_SIZE_159
+# define MITK_PP_SEQ_SIZE_159(_) MITK_PP_SEQ_SIZE_160
+# define MITK_PP_SEQ_SIZE_160(_) MITK_PP_SEQ_SIZE_161
+# define MITK_PP_SEQ_SIZE_161(_) MITK_PP_SEQ_SIZE_162
+# define MITK_PP_SEQ_SIZE_162(_) MITK_PP_SEQ_SIZE_163
+# define MITK_PP_SEQ_SIZE_163(_) MITK_PP_SEQ_SIZE_164
+# define MITK_PP_SEQ_SIZE_164(_) MITK_PP_SEQ_SIZE_165
+# define MITK_PP_SEQ_SIZE_165(_) MITK_PP_SEQ_SIZE_166
+# define MITK_PP_SEQ_SIZE_166(_) MITK_PP_SEQ_SIZE_167
+# define MITK_PP_SEQ_SIZE_167(_) MITK_PP_SEQ_SIZE_168
+# define MITK_PP_SEQ_SIZE_168(_) MITK_PP_SEQ_SIZE_169
+# define MITK_PP_SEQ_SIZE_169(_) MITK_PP_SEQ_SIZE_170
+# define MITK_PP_SEQ_SIZE_170(_) MITK_PP_SEQ_SIZE_171
+# define MITK_PP_SEQ_SIZE_171(_) MITK_PP_SEQ_SIZE_172
+# define MITK_PP_SEQ_SIZE_172(_) MITK_PP_SEQ_SIZE_173
+# define MITK_PP_SEQ_SIZE_173(_) MITK_PP_SEQ_SIZE_174
+# define MITK_PP_SEQ_SIZE_174(_) MITK_PP_SEQ_SIZE_175
+# define MITK_PP_SEQ_SIZE_175(_) MITK_PP_SEQ_SIZE_176
+# define MITK_PP_SEQ_SIZE_176(_) MITK_PP_SEQ_SIZE_177
+# define MITK_PP_SEQ_SIZE_177(_) MITK_PP_SEQ_SIZE_178
+# define MITK_PP_SEQ_SIZE_178(_) MITK_PP_SEQ_SIZE_179
+# define MITK_PP_SEQ_SIZE_179(_) MITK_PP_SEQ_SIZE_180
+# define MITK_PP_SEQ_SIZE_180(_) MITK_PP_SEQ_SIZE_181
+# define MITK_PP_SEQ_SIZE_181(_) MITK_PP_SEQ_SIZE_182
+# define MITK_PP_SEQ_SIZE_182(_) MITK_PP_SEQ_SIZE_183
+# define MITK_PP_SEQ_SIZE_183(_) MITK_PP_SEQ_SIZE_184
+# define MITK_PP_SEQ_SIZE_184(_) MITK_PP_SEQ_SIZE_185
+# define MITK_PP_SEQ_SIZE_185(_) MITK_PP_SEQ_SIZE_186
+# define MITK_PP_SEQ_SIZE_186(_) MITK_PP_SEQ_SIZE_187
+# define MITK_PP_SEQ_SIZE_187(_) MITK_PP_SEQ_SIZE_188
+# define MITK_PP_SEQ_SIZE_188(_) MITK_PP_SEQ_SIZE_189
+# define MITK_PP_SEQ_SIZE_189(_) MITK_PP_SEQ_SIZE_190
+# define MITK_PP_SEQ_SIZE_190(_) MITK_PP_SEQ_SIZE_191
+# define MITK_PP_SEQ_SIZE_191(_) MITK_PP_SEQ_SIZE_192
+# define MITK_PP_SEQ_SIZE_192(_) MITK_PP_SEQ_SIZE_193
+# define MITK_PP_SEQ_SIZE_193(_) MITK_PP_SEQ_SIZE_194
+# define MITK_PP_SEQ_SIZE_194(_) MITK_PP_SEQ_SIZE_195
+# define MITK_PP_SEQ_SIZE_195(_) MITK_PP_SEQ_SIZE_196
+# define MITK_PP_SEQ_SIZE_196(_) MITK_PP_SEQ_SIZE_197
+# define MITK_PP_SEQ_SIZE_197(_) MITK_PP_SEQ_SIZE_198
+# define MITK_PP_SEQ_SIZE_198(_) MITK_PP_SEQ_SIZE_199
+# define MITK_PP_SEQ_SIZE_199(_) MITK_PP_SEQ_SIZE_200
+# define MITK_PP_SEQ_SIZE_200(_) MITK_PP_SEQ_SIZE_201
+# define MITK_PP_SEQ_SIZE_201(_) MITK_PP_SEQ_SIZE_202
+# define MITK_PP_SEQ_SIZE_202(_) MITK_PP_SEQ_SIZE_203
+# define MITK_PP_SEQ_SIZE_203(_) MITK_PP_SEQ_SIZE_204
+# define MITK_PP_SEQ_SIZE_204(_) MITK_PP_SEQ_SIZE_205
+# define MITK_PP_SEQ_SIZE_205(_) MITK_PP_SEQ_SIZE_206
+# define MITK_PP_SEQ_SIZE_206(_) MITK_PP_SEQ_SIZE_207
+# define MITK_PP_SEQ_SIZE_207(_) MITK_PP_SEQ_SIZE_208
+# define MITK_PP_SEQ_SIZE_208(_) MITK_PP_SEQ_SIZE_209
+# define MITK_PP_SEQ_SIZE_209(_) MITK_PP_SEQ_SIZE_210
+# define MITK_PP_SEQ_SIZE_210(_) MITK_PP_SEQ_SIZE_211
+# define MITK_PP_SEQ_SIZE_211(_) MITK_PP_SEQ_SIZE_212
+# define MITK_PP_SEQ_SIZE_212(_) MITK_PP_SEQ_SIZE_213
+# define MITK_PP_SEQ_SIZE_213(_) MITK_PP_SEQ_SIZE_214
+# define MITK_PP_SEQ_SIZE_214(_) MITK_PP_SEQ_SIZE_215
+# define MITK_PP_SEQ_SIZE_215(_) MITK_PP_SEQ_SIZE_216
+# define MITK_PP_SEQ_SIZE_216(_) MITK_PP_SEQ_SIZE_217
+# define MITK_PP_SEQ_SIZE_217(_) MITK_PP_SEQ_SIZE_218
+# define MITK_PP_SEQ_SIZE_218(_) MITK_PP_SEQ_SIZE_219
+# define MITK_PP_SEQ_SIZE_219(_) MITK_PP_SEQ_SIZE_220
+# define MITK_PP_SEQ_SIZE_220(_) MITK_PP_SEQ_SIZE_221
+# define MITK_PP_SEQ_SIZE_221(_) MITK_PP_SEQ_SIZE_222
+# define MITK_PP_SEQ_SIZE_222(_) MITK_PP_SEQ_SIZE_223
+# define MITK_PP_SEQ_SIZE_223(_) MITK_PP_SEQ_SIZE_224
+# define MITK_PP_SEQ_SIZE_224(_) MITK_PP_SEQ_SIZE_225
+# define MITK_PP_SEQ_SIZE_225(_) MITK_PP_SEQ_SIZE_226
+# define MITK_PP_SEQ_SIZE_226(_) MITK_PP_SEQ_SIZE_227
+# define MITK_PP_SEQ_SIZE_227(_) MITK_PP_SEQ_SIZE_228
+# define MITK_PP_SEQ_SIZE_228(_) MITK_PP_SEQ_SIZE_229
+# define MITK_PP_SEQ_SIZE_229(_) MITK_PP_SEQ_SIZE_230
+# define MITK_PP_SEQ_SIZE_230(_) MITK_PP_SEQ_SIZE_231
+# define MITK_PP_SEQ_SIZE_231(_) MITK_PP_SEQ_SIZE_232
+# define MITK_PP_SEQ_SIZE_232(_) MITK_PP_SEQ_SIZE_233
+# define MITK_PP_SEQ_SIZE_233(_) MITK_PP_SEQ_SIZE_234
+# define MITK_PP_SEQ_SIZE_234(_) MITK_PP_SEQ_SIZE_235
+# define MITK_PP_SEQ_SIZE_235(_) MITK_PP_SEQ_SIZE_236
+# define MITK_PP_SEQ_SIZE_236(_) MITK_PP_SEQ_SIZE_237
+# define MITK_PP_SEQ_SIZE_237(_) MITK_PP_SEQ_SIZE_238
+# define MITK_PP_SEQ_SIZE_238(_) MITK_PP_SEQ_SIZE_239
+# define MITK_PP_SEQ_SIZE_239(_) MITK_PP_SEQ_SIZE_240
+# define MITK_PP_SEQ_SIZE_240(_) MITK_PP_SEQ_SIZE_241
+# define MITK_PP_SEQ_SIZE_241(_) MITK_PP_SEQ_SIZE_242
+# define MITK_PP_SEQ_SIZE_242(_) MITK_PP_SEQ_SIZE_243
+# define MITK_PP_SEQ_SIZE_243(_) MITK_PP_SEQ_SIZE_244
+# define MITK_PP_SEQ_SIZE_244(_) MITK_PP_SEQ_SIZE_245
+# define MITK_PP_SEQ_SIZE_245(_) MITK_PP_SEQ_SIZE_246
+# define MITK_PP_SEQ_SIZE_246(_) MITK_PP_SEQ_SIZE_247
+# define MITK_PP_SEQ_SIZE_247(_) MITK_PP_SEQ_SIZE_248
+# define MITK_PP_SEQ_SIZE_248(_) MITK_PP_SEQ_SIZE_249
+# define MITK_PP_SEQ_SIZE_249(_) MITK_PP_SEQ_SIZE_250
+# define MITK_PP_SEQ_SIZE_250(_) MITK_PP_SEQ_SIZE_251
+# define MITK_PP_SEQ_SIZE_251(_) MITK_PP_SEQ_SIZE_252
+# define MITK_PP_SEQ_SIZE_252(_) MITK_PP_SEQ_SIZE_253
+# define MITK_PP_SEQ_SIZE_253(_) MITK_PP_SEQ_SIZE_254
+# define MITK_PP_SEQ_SIZE_254(_) MITK_PP_SEQ_SIZE_255
+# define MITK_PP_SEQ_SIZE_255(_) MITK_PP_SEQ_SIZE_256
+# define MITK_PP_SEQ_SIZE_256(_) MITK_PP_SEQ_SIZE_257
+#
+# define MITK_PP_SEQ_SIZE_MITK_PP_SEQ_SIZE_0 0
+# define MITK_PP_SEQ_SIZE_MITK_PP_SEQ_SIZE_1 1
+# define MITK_PP_SEQ_SIZE_MITK_PP_SEQ_SIZE_2 2
+# define MITK_PP_SEQ_SIZE_MITK_PP_SEQ_SIZE_3 3
+# define MITK_PP_SEQ_SIZE_MITK_PP_SEQ_SIZE_4 4
+# define MITK_PP_SEQ_SIZE_MITK_PP_SEQ_SIZE_5 5
+# define MITK_PP_SEQ_SIZE_MITK_PP_SEQ_SIZE_6 6
+# define MITK_PP_SEQ_SIZE_MITK_PP_SEQ_SIZE_7 7
+# define MITK_PP_SEQ_SIZE_MITK_PP_SEQ_SIZE_8 8
+# define MITK_PP_SEQ_SIZE_MITK_PP_SEQ_SIZE_9 9
+# define MITK_PP_SEQ_SIZE_MITK_PP_SEQ_SIZE_10 10
+# define MITK_PP_SEQ_SIZE_MITK_PP_SEQ_SIZE_11 11
+# define MITK_PP_SEQ_SIZE_MITK_PP_SEQ_SIZE_12 12
+# define MITK_PP_SEQ_SIZE_MITK_PP_SEQ_SIZE_13 13
+# define MITK_PP_SEQ_SIZE_MITK_PP_SEQ_SIZE_14 14
+# define MITK_PP_SEQ_SIZE_MITK_PP_SEQ_SIZE_15 15
+# define MITK_PP_SEQ_SIZE_MITK_PP_SEQ_SIZE_16 16
+# define MITK_PP_SEQ_SIZE_MITK_PP_SEQ_SIZE_17 17
+# define MITK_PP_SEQ_SIZE_MITK_PP_SEQ_SIZE_18 18
+# define MITK_PP_SEQ_SIZE_MITK_PP_SEQ_SIZE_19 19
+# define MITK_PP_SEQ_SIZE_MITK_PP_SEQ_SIZE_20 20
+# define MITK_PP_SEQ_SIZE_MITK_PP_SEQ_SIZE_21 21
+# define MITK_PP_SEQ_SIZE_MITK_PP_SEQ_SIZE_22 22
+# define MITK_PP_SEQ_SIZE_MITK_PP_SEQ_SIZE_23 23
+# define MITK_PP_SEQ_SIZE_MITK_PP_SEQ_SIZE_24 24
+# define MITK_PP_SEQ_SIZE_MITK_PP_SEQ_SIZE_25 25
+# define MITK_PP_SEQ_SIZE_MITK_PP_SEQ_SIZE_26 26
+# define MITK_PP_SEQ_SIZE_MITK_PP_SEQ_SIZE_27 27
+# define MITK_PP_SEQ_SIZE_MITK_PP_SEQ_SIZE_28 28
+# define MITK_PP_SEQ_SIZE_MITK_PP_SEQ_SIZE_29 29
+# define MITK_PP_SEQ_SIZE_MITK_PP_SEQ_SIZE_30 30
+# define MITK_PP_SEQ_SIZE_MITK_PP_SEQ_SIZE_31 31
+# define MITK_PP_SEQ_SIZE_MITK_PP_SEQ_SIZE_32 32
+# define MITK_PP_SEQ_SIZE_MITK_PP_SEQ_SIZE_33 33
+# define MITK_PP_SEQ_SIZE_MITK_PP_SEQ_SIZE_34 34
+# define MITK_PP_SEQ_SIZE_MITK_PP_SEQ_SIZE_35 35
+# define MITK_PP_SEQ_SIZE_MITK_PP_SEQ_SIZE_36 36
+# define MITK_PP_SEQ_SIZE_MITK_PP_SEQ_SIZE_37 37
+# define MITK_PP_SEQ_SIZE_MITK_PP_SEQ_SIZE_38 38
+# define MITK_PP_SEQ_SIZE_MITK_PP_SEQ_SIZE_39 39
+# define MITK_PP_SEQ_SIZE_MITK_PP_SEQ_SIZE_40 40
+# define MITK_PP_SEQ_SIZE_MITK_PP_SEQ_SIZE_41 41
+# define MITK_PP_SEQ_SIZE_MITK_PP_SEQ_SIZE_42 42
+# define MITK_PP_SEQ_SIZE_MITK_PP_SEQ_SIZE_43 43
+# define MITK_PP_SEQ_SIZE_MITK_PP_SEQ_SIZE_44 44
+# define MITK_PP_SEQ_SIZE_MITK_PP_SEQ_SIZE_45 45
+# define MITK_PP_SEQ_SIZE_MITK_PP_SEQ_SIZE_46 46
+# define MITK_PP_SEQ_SIZE_MITK_PP_SEQ_SIZE_47 47
+# define MITK_PP_SEQ_SIZE_MITK_PP_SEQ_SIZE_48 48
+# define MITK_PP_SEQ_SIZE_MITK_PP_SEQ_SIZE_49 49
+# define MITK_PP_SEQ_SIZE_MITK_PP_SEQ_SIZE_50 50
+# define MITK_PP_SEQ_SIZE_MITK_PP_SEQ_SIZE_51 51
+# define MITK_PP_SEQ_SIZE_MITK_PP_SEQ_SIZE_52 52
+# define MITK_PP_SEQ_SIZE_MITK_PP_SEQ_SIZE_53 53
+# define MITK_PP_SEQ_SIZE_MITK_PP_SEQ_SIZE_54 54
+# define MITK_PP_SEQ_SIZE_MITK_PP_SEQ_SIZE_55 55
+# define MITK_PP_SEQ_SIZE_MITK_PP_SEQ_SIZE_56 56
+# define MITK_PP_SEQ_SIZE_MITK_PP_SEQ_SIZE_57 57
+# define MITK_PP_SEQ_SIZE_MITK_PP_SEQ_SIZE_58 58
+# define MITK_PP_SEQ_SIZE_MITK_PP_SEQ_SIZE_59 59
+# define MITK_PP_SEQ_SIZE_MITK_PP_SEQ_SIZE_60 60
+# define MITK_PP_SEQ_SIZE_MITK_PP_SEQ_SIZE_61 61
+# define MITK_PP_SEQ_SIZE_MITK_PP_SEQ_SIZE_62 62
+# define MITK_PP_SEQ_SIZE_MITK_PP_SEQ_SIZE_63 63
+# define MITK_PP_SEQ_SIZE_MITK_PP_SEQ_SIZE_64 64
+# define MITK_PP_SEQ_SIZE_MITK_PP_SEQ_SIZE_65 65
+# define MITK_PP_SEQ_SIZE_MITK_PP_SEQ_SIZE_66 66
+# define MITK_PP_SEQ_SIZE_MITK_PP_SEQ_SIZE_67 67
+# define MITK_PP_SEQ_SIZE_MITK_PP_SEQ_SIZE_68 68
+# define MITK_PP_SEQ_SIZE_MITK_PP_SEQ_SIZE_69 69
+# define MITK_PP_SEQ_SIZE_MITK_PP_SEQ_SIZE_70 70
+# define MITK_PP_SEQ_SIZE_MITK_PP_SEQ_SIZE_71 71
+# define MITK_PP_SEQ_SIZE_MITK_PP_SEQ_SIZE_72 72
+# define MITK_PP_SEQ_SIZE_MITK_PP_SEQ_SIZE_73 73
+# define MITK_PP_SEQ_SIZE_MITK_PP_SEQ_SIZE_74 74
+# define MITK_PP_SEQ_SIZE_MITK_PP_SEQ_SIZE_75 75
+# define MITK_PP_SEQ_SIZE_MITK_PP_SEQ_SIZE_76 76
+# define MITK_PP_SEQ_SIZE_MITK_PP_SEQ_SIZE_77 77
+# define MITK_PP_SEQ_SIZE_MITK_PP_SEQ_SIZE_78 78
+# define MITK_PP_SEQ_SIZE_MITK_PP_SEQ_SIZE_79 79
+# define MITK_PP_SEQ_SIZE_MITK_PP_SEQ_SIZE_80 80
+# define MITK_PP_SEQ_SIZE_MITK_PP_SEQ_SIZE_81 81
+# define MITK_PP_SEQ_SIZE_MITK_PP_SEQ_SIZE_82 82
+# define MITK_PP_SEQ_SIZE_MITK_PP_SEQ_SIZE_83 83
+# define MITK_PP_SEQ_SIZE_MITK_PP_SEQ_SIZE_84 84
+# define MITK_PP_SEQ_SIZE_MITK_PP_SEQ_SIZE_85 85
+# define MITK_PP_SEQ_SIZE_MITK_PP_SEQ_SIZE_86 86
+# define MITK_PP_SEQ_SIZE_MITK_PP_SEQ_SIZE_87 87
+# define MITK_PP_SEQ_SIZE_MITK_PP_SEQ_SIZE_88 88
+# define MITK_PP_SEQ_SIZE_MITK_PP_SEQ_SIZE_89 89
+# define MITK_PP_SEQ_SIZE_MITK_PP_SEQ_SIZE_90 90
+# define MITK_PP_SEQ_SIZE_MITK_PP_SEQ_SIZE_91 91
+# define MITK_PP_SEQ_SIZE_MITK_PP_SEQ_SIZE_92 92
+# define MITK_PP_SEQ_SIZE_MITK_PP_SEQ_SIZE_93 93
+# define MITK_PP_SEQ_SIZE_MITK_PP_SEQ_SIZE_94 94
+# define MITK_PP_SEQ_SIZE_MITK_PP_SEQ_SIZE_95 95
+# define MITK_PP_SEQ_SIZE_MITK_PP_SEQ_SIZE_96 96
+# define MITK_PP_SEQ_SIZE_MITK_PP_SEQ_SIZE_97 97
+# define MITK_PP_SEQ_SIZE_MITK_PP_SEQ_SIZE_98 98
+# define MITK_PP_SEQ_SIZE_MITK_PP_SEQ_SIZE_99 99
+# define MITK_PP_SEQ_SIZE_MITK_PP_SEQ_SIZE_100 100
+# define MITK_PP_SEQ_SIZE_MITK_PP_SEQ_SIZE_101 101
+# define MITK_PP_SEQ_SIZE_MITK_PP_SEQ_SIZE_102 102
+# define MITK_PP_SEQ_SIZE_MITK_PP_SEQ_SIZE_103 103
+# define MITK_PP_SEQ_SIZE_MITK_PP_SEQ_SIZE_104 104
+# define MITK_PP_SEQ_SIZE_MITK_PP_SEQ_SIZE_105 105
+# define MITK_PP_SEQ_SIZE_MITK_PP_SEQ_SIZE_106 106
+# define MITK_PP_SEQ_SIZE_MITK_PP_SEQ_SIZE_107 107
+# define MITK_PP_SEQ_SIZE_MITK_PP_SEQ_SIZE_108 108
+# define MITK_PP_SEQ_SIZE_MITK_PP_SEQ_SIZE_109 109
+# define MITK_PP_SEQ_SIZE_MITK_PP_SEQ_SIZE_110 110
+# define MITK_PP_SEQ_SIZE_MITK_PP_SEQ_SIZE_111 111
+# define MITK_PP_SEQ_SIZE_MITK_PP_SEQ_SIZE_112 112
+# define MITK_PP_SEQ_SIZE_MITK_PP_SEQ_SIZE_113 113
+# define MITK_PP_SEQ_SIZE_MITK_PP_SEQ_SIZE_114 114
+# define MITK_PP_SEQ_SIZE_MITK_PP_SEQ_SIZE_115 115
+# define MITK_PP_SEQ_SIZE_MITK_PP_SEQ_SIZE_116 116
+# define MITK_PP_SEQ_SIZE_MITK_PP_SEQ_SIZE_117 117
+# define MITK_PP_SEQ_SIZE_MITK_PP_SEQ_SIZE_118 118
+# define MITK_PP_SEQ_SIZE_MITK_PP_SEQ_SIZE_119 119
+# define MITK_PP_SEQ_SIZE_MITK_PP_SEQ_SIZE_120 120
+# define MITK_PP_SEQ_SIZE_MITK_PP_SEQ_SIZE_121 121
+# define MITK_PP_SEQ_SIZE_MITK_PP_SEQ_SIZE_122 122
+# define MITK_PP_SEQ_SIZE_MITK_PP_SEQ_SIZE_123 123
+# define MITK_PP_SEQ_SIZE_MITK_PP_SEQ_SIZE_124 124
+# define MITK_PP_SEQ_SIZE_MITK_PP_SEQ_SIZE_125 125
+# define MITK_PP_SEQ_SIZE_MITK_PP_SEQ_SIZE_126 126
+# define MITK_PP_SEQ_SIZE_MITK_PP_SEQ_SIZE_127 127
+# define MITK_PP_SEQ_SIZE_MITK_PP_SEQ_SIZE_128 128
+# define MITK_PP_SEQ_SIZE_MITK_PP_SEQ_SIZE_129 129
+# define MITK_PP_SEQ_SIZE_MITK_PP_SEQ_SIZE_130 130
+# define MITK_PP_SEQ_SIZE_MITK_PP_SEQ_SIZE_131 131
+# define MITK_PP_SEQ_SIZE_MITK_PP_SEQ_SIZE_132 132
+# define MITK_PP_SEQ_SIZE_MITK_PP_SEQ_SIZE_133 133
+# define MITK_PP_SEQ_SIZE_MITK_PP_SEQ_SIZE_134 134
+# define MITK_PP_SEQ_SIZE_MITK_PP_SEQ_SIZE_135 135
+# define MITK_PP_SEQ_SIZE_MITK_PP_SEQ_SIZE_136 136
+# define MITK_PP_SEQ_SIZE_MITK_PP_SEQ_SIZE_137 137
+# define MITK_PP_SEQ_SIZE_MITK_PP_SEQ_SIZE_138 138
+# define MITK_PP_SEQ_SIZE_MITK_PP_SEQ_SIZE_139 139
+# define MITK_PP_SEQ_SIZE_MITK_PP_SEQ_SIZE_140 140
+# define MITK_PP_SEQ_SIZE_MITK_PP_SEQ_SIZE_141 141
+# define MITK_PP_SEQ_SIZE_MITK_PP_SEQ_SIZE_142 142
+# define MITK_PP_SEQ_SIZE_MITK_PP_SEQ_SIZE_143 143
+# define MITK_PP_SEQ_SIZE_MITK_PP_SEQ_SIZE_144 144
+# define MITK_PP_SEQ_SIZE_MITK_PP_SEQ_SIZE_145 145
+# define MITK_PP_SEQ_SIZE_MITK_PP_SEQ_SIZE_146 146
+# define MITK_PP_SEQ_SIZE_MITK_PP_SEQ_SIZE_147 147
+# define MITK_PP_SEQ_SIZE_MITK_PP_SEQ_SIZE_148 148
+# define MITK_PP_SEQ_SIZE_MITK_PP_SEQ_SIZE_149 149
+# define MITK_PP_SEQ_SIZE_MITK_PP_SEQ_SIZE_150 150
+# define MITK_PP_SEQ_SIZE_MITK_PP_SEQ_SIZE_151 151
+# define MITK_PP_SEQ_SIZE_MITK_PP_SEQ_SIZE_152 152
+# define MITK_PP_SEQ_SIZE_MITK_PP_SEQ_SIZE_153 153
+# define MITK_PP_SEQ_SIZE_MITK_PP_SEQ_SIZE_154 154
+# define MITK_PP_SEQ_SIZE_MITK_PP_SEQ_SIZE_155 155
+# define MITK_PP_SEQ_SIZE_MITK_PP_SEQ_SIZE_156 156
+# define MITK_PP_SEQ_SIZE_MITK_PP_SEQ_SIZE_157 157
+# define MITK_PP_SEQ_SIZE_MITK_PP_SEQ_SIZE_158 158
+# define MITK_PP_SEQ_SIZE_MITK_PP_SEQ_SIZE_159 159
+# define MITK_PP_SEQ_SIZE_MITK_PP_SEQ_SIZE_160 160
+# define MITK_PP_SEQ_SIZE_MITK_PP_SEQ_SIZE_161 161
+# define MITK_PP_SEQ_SIZE_MITK_PP_SEQ_SIZE_162 162
+# define MITK_PP_SEQ_SIZE_MITK_PP_SEQ_SIZE_163 163
+# define MITK_PP_SEQ_SIZE_MITK_PP_SEQ_SIZE_164 164
+# define MITK_PP_SEQ_SIZE_MITK_PP_SEQ_SIZE_165 165
+# define MITK_PP_SEQ_SIZE_MITK_PP_SEQ_SIZE_166 166
+# define MITK_PP_SEQ_SIZE_MITK_PP_SEQ_SIZE_167 167
+# define MITK_PP_SEQ_SIZE_MITK_PP_SEQ_SIZE_168 168
+# define MITK_PP_SEQ_SIZE_MITK_PP_SEQ_SIZE_169 169
+# define MITK_PP_SEQ_SIZE_MITK_PP_SEQ_SIZE_170 170
+# define MITK_PP_SEQ_SIZE_MITK_PP_SEQ_SIZE_171 171
+# define MITK_PP_SEQ_SIZE_MITK_PP_SEQ_SIZE_172 172
+# define MITK_PP_SEQ_SIZE_MITK_PP_SEQ_SIZE_173 173
+# define MITK_PP_SEQ_SIZE_MITK_PP_SEQ_SIZE_174 174
+# define MITK_PP_SEQ_SIZE_MITK_PP_SEQ_SIZE_175 175
+# define MITK_PP_SEQ_SIZE_MITK_PP_SEQ_SIZE_176 176
+# define MITK_PP_SEQ_SIZE_MITK_PP_SEQ_SIZE_177 177
+# define MITK_PP_SEQ_SIZE_MITK_PP_SEQ_SIZE_178 178
+# define MITK_PP_SEQ_SIZE_MITK_PP_SEQ_SIZE_179 179
+# define MITK_PP_SEQ_SIZE_MITK_PP_SEQ_SIZE_180 180
+# define MITK_PP_SEQ_SIZE_MITK_PP_SEQ_SIZE_181 181
+# define MITK_PP_SEQ_SIZE_MITK_PP_SEQ_SIZE_182 182
+# define MITK_PP_SEQ_SIZE_MITK_PP_SEQ_SIZE_183 183
+# define MITK_PP_SEQ_SIZE_MITK_PP_SEQ_SIZE_184 184
+# define MITK_PP_SEQ_SIZE_MITK_PP_SEQ_SIZE_185 185
+# define MITK_PP_SEQ_SIZE_MITK_PP_SEQ_SIZE_186 186
+# define MITK_PP_SEQ_SIZE_MITK_PP_SEQ_SIZE_187 187
+# define MITK_PP_SEQ_SIZE_MITK_PP_SEQ_SIZE_188 188
+# define MITK_PP_SEQ_SIZE_MITK_PP_SEQ_SIZE_189 189
+# define MITK_PP_SEQ_SIZE_MITK_PP_SEQ_SIZE_190 190
+# define MITK_PP_SEQ_SIZE_MITK_PP_SEQ_SIZE_191 191
+# define MITK_PP_SEQ_SIZE_MITK_PP_SEQ_SIZE_192 192
+# define MITK_PP_SEQ_SIZE_MITK_PP_SEQ_SIZE_193 193
+# define MITK_PP_SEQ_SIZE_MITK_PP_SEQ_SIZE_194 194
+# define MITK_PP_SEQ_SIZE_MITK_PP_SEQ_SIZE_195 195
+# define MITK_PP_SEQ_SIZE_MITK_PP_SEQ_SIZE_196 196
+# define MITK_PP_SEQ_SIZE_MITK_PP_SEQ_SIZE_197 197
+# define MITK_PP_SEQ_SIZE_MITK_PP_SEQ_SIZE_198 198
+# define MITK_PP_SEQ_SIZE_MITK_PP_SEQ_SIZE_199 199
+# define MITK_PP_SEQ_SIZE_MITK_PP_SEQ_SIZE_200 200
+# define MITK_PP_SEQ_SIZE_MITK_PP_SEQ_SIZE_201 201
+# define MITK_PP_SEQ_SIZE_MITK_PP_SEQ_SIZE_202 202
+# define MITK_PP_SEQ_SIZE_MITK_PP_SEQ_SIZE_203 203
+# define MITK_PP_SEQ_SIZE_MITK_PP_SEQ_SIZE_204 204
+# define MITK_PP_SEQ_SIZE_MITK_PP_SEQ_SIZE_205 205
+# define MITK_PP_SEQ_SIZE_MITK_PP_SEQ_SIZE_206 206
+# define MITK_PP_SEQ_SIZE_MITK_PP_SEQ_SIZE_207 207
+# define MITK_PP_SEQ_SIZE_MITK_PP_SEQ_SIZE_208 208
+# define MITK_PP_SEQ_SIZE_MITK_PP_SEQ_SIZE_209 209
+# define MITK_PP_SEQ_SIZE_MITK_PP_SEQ_SIZE_210 210
+# define MITK_PP_SEQ_SIZE_MITK_PP_SEQ_SIZE_211 211
+# define MITK_PP_SEQ_SIZE_MITK_PP_SEQ_SIZE_212 212
+# define MITK_PP_SEQ_SIZE_MITK_PP_SEQ_SIZE_213 213
+# define MITK_PP_SEQ_SIZE_MITK_PP_SEQ_SIZE_214 214
+# define MITK_PP_SEQ_SIZE_MITK_PP_SEQ_SIZE_215 215
+# define MITK_PP_SEQ_SIZE_MITK_PP_SEQ_SIZE_216 216
+# define MITK_PP_SEQ_SIZE_MITK_PP_SEQ_SIZE_217 217
+# define MITK_PP_SEQ_SIZE_MITK_PP_SEQ_SIZE_218 218
+# define MITK_PP_SEQ_SIZE_MITK_PP_SEQ_SIZE_219 219
+# define MITK_PP_SEQ_SIZE_MITK_PP_SEQ_SIZE_220 220
+# define MITK_PP_SEQ_SIZE_MITK_PP_SEQ_SIZE_221 221
+# define MITK_PP_SEQ_SIZE_MITK_PP_SEQ_SIZE_222 222
+# define MITK_PP_SEQ_SIZE_MITK_PP_SEQ_SIZE_223 223
+# define MITK_PP_SEQ_SIZE_MITK_PP_SEQ_SIZE_224 224
+# define MITK_PP_SEQ_SIZE_MITK_PP_SEQ_SIZE_225 225
+# define MITK_PP_SEQ_SIZE_MITK_PP_SEQ_SIZE_226 226
+# define MITK_PP_SEQ_SIZE_MITK_PP_SEQ_SIZE_227 227
+# define MITK_PP_SEQ_SIZE_MITK_PP_SEQ_SIZE_228 228
+# define MITK_PP_SEQ_SIZE_MITK_PP_SEQ_SIZE_229 229
+# define MITK_PP_SEQ_SIZE_MITK_PP_SEQ_SIZE_230 230
+# define MITK_PP_SEQ_SIZE_MITK_PP_SEQ_SIZE_231 231
+# define MITK_PP_SEQ_SIZE_MITK_PP_SEQ_SIZE_232 232
+# define MITK_PP_SEQ_SIZE_MITK_PP_SEQ_SIZE_233 233
+# define MITK_PP_SEQ_SIZE_MITK_PP_SEQ_SIZE_234 234
+# define MITK_PP_SEQ_SIZE_MITK_PP_SEQ_SIZE_235 235
+# define MITK_PP_SEQ_SIZE_MITK_PP_SEQ_SIZE_236 236
+# define MITK_PP_SEQ_SIZE_MITK_PP_SEQ_SIZE_237 237
+# define MITK_PP_SEQ_SIZE_MITK_PP_SEQ_SIZE_238 238
+# define MITK_PP_SEQ_SIZE_MITK_PP_SEQ_SIZE_239 239
+# define MITK_PP_SEQ_SIZE_MITK_PP_SEQ_SIZE_240 240
+# define MITK_PP_SEQ_SIZE_MITK_PP_SEQ_SIZE_241 241
+# define MITK_PP_SEQ_SIZE_MITK_PP_SEQ_SIZE_242 242
+# define MITK_PP_SEQ_SIZE_MITK_PP_SEQ_SIZE_243 243
+# define MITK_PP_SEQ_SIZE_MITK_PP_SEQ_SIZE_244 244
+# define MITK_PP_SEQ_SIZE_MITK_PP_SEQ_SIZE_245 245
+# define MITK_PP_SEQ_SIZE_MITK_PP_SEQ_SIZE_246 246
+# define MITK_PP_SEQ_SIZE_MITK_PP_SEQ_SIZE_247 247
+# define MITK_PP_SEQ_SIZE_MITK_PP_SEQ_SIZE_248 248
+# define MITK_PP_SEQ_SIZE_MITK_PP_SEQ_SIZE_249 249
+# define MITK_PP_SEQ_SIZE_MITK_PP_SEQ_SIZE_250 250
+# define MITK_PP_SEQ_SIZE_MITK_PP_SEQ_SIZE_251 251
+# define MITK_PP_SEQ_SIZE_MITK_PP_SEQ_SIZE_252 252
+# define MITK_PP_SEQ_SIZE_MITK_PP_SEQ_SIZE_253 253
+# define MITK_PP_SEQ_SIZE_MITK_PP_SEQ_SIZE_254 254
+# define MITK_PP_SEQ_SIZE_MITK_PP_SEQ_SIZE_255 255
+# define MITK_PP_SEQ_SIZE_MITK_PP_SEQ_SIZE_256 256
+#
+# endif
diff --git a/Core/Code/Algorithms/mitkPPSeqToTuple.h b/Core/Code/Algorithms/mitkPPSeqToTuple.h
new file mode 100644
index 0000000000..b1fdd59083
--- /dev/null
+++ b/Core/Code/Algorithms/mitkPPSeqToTuple.h
@@ -0,0 +1,27 @@
+# /* **************************************************************************
+# * *
+# * (C) Copyright Paul Mensonides 2002.
+# * Distributed under the Boost Software License, Version 1.0. (See
+# * accompanying file LICENSE_1_0.txt or copy at
+# * http://www.boost.org/LICENSE_1_0.txt)
+# * *
+# ************************************************************************** */
+#
+# /* See http://www.boost.org for most recent version. */
+#
+# ifndef MITK_PREPROCESSOR_SEQ_TO_TUPLE_HPP
+# define MITK_PREPROCESSOR_SEQ_TO_TUPLE_HPP
+#
+# include "mitkPPConfig.h"
+# include "mitkPPSeqEnum.h"
+#
+# /* MITK_PP_SEQ_TO_TUPLE */
+#
+# if ~MITK_PP_CONFIG_FLAGS() & MITK_PP_CONFIG_EDG()
+# define MITK_PP_SEQ_TO_TUPLE(seq) (MITK_PP_SEQ_ENUM(seq))
+# else
+# define MITK_PP_SEQ_TO_TUPLE(seq) MITK_PP_SEQ_TO_TUPLE_I(seq)
+# define MITK_PP_SEQ_TO_TUPLE_I(seq) (MITK_PP_SEQ_ENUM(seq))
+# endif
+#
+# endif
diff --git a/Core/Code/Algorithms/mitkPPStringize.h b/Core/Code/Algorithms/mitkPPStringize.h
new file mode 100644
index 0000000000..90c98c0341
--- /dev/null
+++ b/Core/Code/Algorithms/mitkPPStringize.h
@@ -0,0 +1,33 @@
+# /* Copyright (C) 2001
+# * Housemarque Oy
+# * http://www.housemarque.com
+# *
+# * Distributed under the Boost Software License, Version 1.0. (See
+# * accompanying file LICENSE_1_0.txt or copy at
+# * http://www.boost.org/LICENSE_1_0.txt)
+# */
+#
+# /* Revised by Paul Mensonides (2002) */
+#
+# /* See http://www.boost.org for most recent version. */
+#
+# ifndef MITK_PREPROCESSOR_STRINGIZE_HPP
+# define MITK_PREPROCESSOR_STRINGIZE_HPP
+#
+# include "mitkPPConfig.h"
+#
+# /* MITK_PP_STRINGIZE */
+#
+# if MITK_PP_CONFIG_FLAGS() & MITK_PP_CONFIG_MSVC()
+# define MITK_PP_STRINGIZE(text) MITK_PP_STRINGIZE_A((text))
+# define MITK_PP_STRINGIZE_A(arg) MITK_PP_STRINGIZE_I arg
+# elif MITK_PP_CONFIG_FLAGS() & MITK_PP_CONFIG_MWCC()
+# define MITK_PP_STRINGIZE(text) MITK_PP_STRINGIZE_OO((text))
+# define MITK_PP_STRINGIZE_OO(par) MITK_PP_STRINGIZE_I ## par
+# else
+# define MITK_PP_STRINGIZE(text) MITK_PP_STRINGIZE_I(text)
+# endif
+#
+# define MITK_PP_STRINGIZE_I(text) #text
+#
+# endif
diff --git a/Core/Code/Algorithms/mitkPPTupleEat.h b/Core/Code/Algorithms/mitkPPTupleEat.h
new file mode 100644
index 0000000000..b33f4fb520
--- /dev/null
+++ b/Core/Code/Algorithms/mitkPPTupleEat.h
@@ -0,0 +1,57 @@
+# /* Copyright (C) 2001
+# * Housemarque Oy
+# * http://www.housemarque.com
+# *
+# * Distributed under the Boost Software License, Version 1.0. (See
+# * accompanying file LICENSE_1_0.txt or copy at
+# * http://www.boost.org/LICENSE_1_0.txt)
+# */
+#
+# /* Revised by Paul Mensonides (2002) */
+#
+# /* See http://www.boost.org for most recent version. */
+#
+# ifndef MITK_PREPROCESSOR_TUPLE_EAT_HPP
+# define MITK_PREPROCESSOR_TUPLE_EAT_HPP
+#
+# include "mitkPPConfig.h"
+#
+# /* MITK_PP_TUPLE_EAT */
+#
+# if ~MITK_PP_CONFIG_FLAGS() & MITK_PP_CONFIG_MWCC()
+# define MITK_PP_TUPLE_EAT(size) MITK_PP_TUPLE_EAT_I(size)
+# else
+# define MITK_PP_TUPLE_EAT(size) MITK_PP_TUPLE_EAT_OO((size))
+# define MITK_PP_TUPLE_EAT_OO(par) MITK_PP_TUPLE_EAT_I ## par
+# endif
+#
+# define MITK_PP_TUPLE_EAT_I(size) MITK_PP_TUPLE_EAT_ ## size
+#
+# define MITK_PP_TUPLE_EAT_0()
+# define MITK_PP_TUPLE_EAT_1(a)
+# define MITK_PP_TUPLE_EAT_2(a, b)
+# define MITK_PP_TUPLE_EAT_3(a, b, c)
+# define MITK_PP_TUPLE_EAT_4(a, b, c, d)
+# define MITK_PP_TUPLE_EAT_5(a, b, c, d, e)
+# define MITK_PP_TUPLE_EAT_6(a, b, c, d, e, f)
+# define MITK_PP_TUPLE_EAT_7(a, b, c, d, e, f, g)
+# define MITK_PP_TUPLE_EAT_8(a, b, c, d, e, f, g, h)
+# define MITK_PP_TUPLE_EAT_9(a, b, c, d, e, f, g, h, i)
+# define MITK_PP_TUPLE_EAT_10(a, b, c, d, e, f, g, h, i, j)
+# define MITK_PP_TUPLE_EAT_11(a, b, c, d, e, f, g, h, i, j, k)
+# define MITK_PP_TUPLE_EAT_12(a, b, c, d, e, f, g, h, i, j, k, l)
+# define MITK_PP_TUPLE_EAT_13(a, b, c, d, e, f, g, h, i, j, k, l, m)
+# define MITK_PP_TUPLE_EAT_14(a, b, c, d, e, f, g, h, i, j, k, l, m, n)
+# define MITK_PP_TUPLE_EAT_15(a, b, c, d, e, f, g, h, i, j, k, l, m, n, o)
+# define MITK_PP_TUPLE_EAT_16(a, b, c, d, e, f, g, h, i, j, k, l, m, n, o, p)
+# define MITK_PP_TUPLE_EAT_17(a, b, c, d, e, f, g, h, i, j, k, l, m, n, o, p, q)
+# define MITK_PP_TUPLE_EAT_18(a, b, c, d, e, f, g, h, i, j, k, l, m, n, o, p, q, r)
+# define MITK_PP_TUPLE_EAT_19(a, b, c, d, e, f, g, h, i, j, k, l, m, n, o, p, q, r, s)
+# define MITK_PP_TUPLE_EAT_20(a, b, c, d, e, f, g, h, i, j, k, l, m, n, o, p, q, r, s, t)
+# define MITK_PP_TUPLE_EAT_21(a, b, c, d, e, f, g, h, i, j, k, l, m, n, o, p, q, r, s, t, u)
+# define MITK_PP_TUPLE_EAT_22(a, b, c, d, e, f, g, h, i, j, k, l, m, n, o, p, q, r, s, t, u, v)
+# define MITK_PP_TUPLE_EAT_23(a, b, c, d, e, f, g, h, i, j, k, l, m, n, o, p, q, r, s, t, u, v, w)
+# define MITK_PP_TUPLE_EAT_24(a, b, c, d, e, f, g, h, i, j, k, l, m, n, o, p, q, r, s, t, u, v, w, x)
+# define MITK_PP_TUPLE_EAT_25(a, b, c, d, e, f, g, h, i, j, k, l, m, n, o, p, q, r, s, t, u, v, w, x, y)
+#
+# endif
diff --git a/Core/Code/Algorithms/mitkPPTupleElem.h b/Core/Code/Algorithms/mitkPPTupleElem.h
new file mode 100644
index 0000000000..5fcc60aee7
--- /dev/null
+++ b/Core/Code/Algorithms/mitkPPTupleElem.h
@@ -0,0 +1,385 @@
+# /* Copyright (C) 2001
+# * Housemarque Oy
+# * http://www.housemarque.com
+# *
+# * Distributed under the Boost Software License, Version 1.0. (See
+# * accompanying file LICENSE_1_0.txt or copy at
+# * http://www.boost.org/LICENSE_1_0.txt)
+# */
+#
+# /* Revised by Paul Mensonides (2002) */
+#
+# /* See http://www.boost.org for most recent version. */
+#
+# ifndef MITK_PREPROCESSOR_TUPLE_ELEM_HPP
+# define MITK_PREPROCESSOR_TUPLE_ELEM_HPP
+#
+# include "mitkPPConfig.h"
+#
+# if ~MITK_PP_CONFIG_FLAGS() & MITK_PP_CONFIG_MWCC()
+# define MITK_PP_TUPLE_ELEM(size, index, tuple) MITK_PP_TUPLE_ELEM_I(size, index, tuple)
+# else
+# define MITK_PP_TUPLE_ELEM(size, index, tuple) MITK_PP_TUPLE_ELEM_OO((size, index, tuple))
+# define MITK_PP_TUPLE_ELEM_OO(par) MITK_PP_TUPLE_ELEM_I ## par
+# endif
+#
+# if MITK_PP_CONFIG_FLAGS() & MITK_PP_CONFIG_MWCC()
+# define MITK_PP_TUPLE_ELEM_I(s, i, t) MITK_PP_TUPLE_ELEM_ ## s ## _ ## i ## t
+# elif MITK_PP_CONFIG_FLAGS() & MITK_PP_CONFIG_MSVC()
+# define MITK_PP_TUPLE_ELEM_I(s, i, t) MITK_PP_TUPLE_ELEM_II(MITK_PP_TUPLE_ELEM_ ## s ## _ ## i t)
+# define MITK_PP_TUPLE_ELEM_II(res) res
+# else
+# define MITK_PP_TUPLE_ELEM_I(s, i, t) MITK_PP_TUPLE_ELEM_ ## s ## _ ## i t
+# endif
+#
+# define MITK_PP_TUPLE_ELEM_1_0(a) a
+#
+# define MITK_PP_TUPLE_ELEM_2_0(a, b) a
+# define MITK_PP_TUPLE_ELEM_2_1(a, b) b
+#
+# define MITK_PP_TUPLE_ELEM_3_0(a, b, c) a
+# define MITK_PP_TUPLE_ELEM_3_1(a, b, c) b
+# define MITK_PP_TUPLE_ELEM_3_2(a, b, c) c
+#
+# define MITK_PP_TUPLE_ELEM_4_0(a, b, c, d) a
+# define MITK_PP_TUPLE_ELEM_4_1(a, b, c, d) b
+# define MITK_PP_TUPLE_ELEM_4_2(a, b, c, d) c
+# define MITK_PP_TUPLE_ELEM_4_3(a, b, c, d) d
+#
+# define MITK_PP_TUPLE_ELEM_5_0(a, b, c, d, e) a
+# define MITK_PP_TUPLE_ELEM_5_1(a, b, c, d, e) b
+# define MITK_PP_TUPLE_ELEM_5_2(a, b, c, d, e) c
+# define MITK_PP_TUPLE_ELEM_5_3(a, b, c, d, e) d
+# define MITK_PP_TUPLE_ELEM_5_4(a, b, c, d, e) e
+#
+# define MITK_PP_TUPLE_ELEM_6_0(a, b, c, d, e, f) a
+# define MITK_PP_TUPLE_ELEM_6_1(a, b, c, d, e, f) b
+# define MITK_PP_TUPLE_ELEM_6_2(a, b, c, d, e, f) c
+# define MITK_PP_TUPLE_ELEM_6_3(a, b, c, d, e, f) d
+# define MITK_PP_TUPLE_ELEM_6_4(a, b, c, d, e, f) e
+# define MITK_PP_TUPLE_ELEM_6_5(a, b, c, d, e, f) f
+#
+# define MITK_PP_TUPLE_ELEM_7_0(a, b, c, d, e, f, g) a
+# define MITK_PP_TUPLE_ELEM_7_1(a, b, c, d, e, f, g) b
+# define MITK_PP_TUPLE_ELEM_7_2(a, b, c, d, e, f, g) c
+# define MITK_PP_TUPLE_ELEM_7_3(a, b, c, d, e, f, g) d
+# define MITK_PP_TUPLE_ELEM_7_4(a, b, c, d, e, f, g) e
+# define MITK_PP_TUPLE_ELEM_7_5(a, b, c, d, e, f, g) f
+# define MITK_PP_TUPLE_ELEM_7_6(a, b, c, d, e, f, g) g
+#
+# define MITK_PP_TUPLE_ELEM_8_0(a, b, c, d, e, f, g, h) a
+# define MITK_PP_TUPLE_ELEM_8_1(a, b, c, d, e, f, g, h) b
+# define MITK_PP_TUPLE_ELEM_8_2(a, b, c, d, e, f, g, h) c
+# define MITK_PP_TUPLE_ELEM_8_3(a, b, c, d, e, f, g, h) d
+# define MITK_PP_TUPLE_ELEM_8_4(a, b, c, d, e, f, g, h) e
+# define MITK_PP_TUPLE_ELEM_8_5(a, b, c, d, e, f, g, h) f
+# define MITK_PP_TUPLE_ELEM_8_6(a, b, c, d, e, f, g, h) g
+# define MITK_PP_TUPLE_ELEM_8_7(a, b, c, d, e, f, g, h) h
+#
+# define MITK_PP_TUPLE_ELEM_9_0(a, b, c, d, e, f, g, h, i) a
+# define MITK_PP_TUPLE_ELEM_9_1(a, b, c, d, e, f, g, h, i) b
+# define MITK_PP_TUPLE_ELEM_9_2(a, b, c, d, e, f, g, h, i) c
+# define MITK_PP_TUPLE_ELEM_9_3(a, b, c, d, e, f, g, h, i) d
+# define MITK_PP_TUPLE_ELEM_9_4(a, b, c, d, e, f, g, h, i) e
+# define MITK_PP_TUPLE_ELEM_9_5(a, b, c, d, e, f, g, h, i) f
+# define MITK_PP_TUPLE_ELEM_9_6(a, b, c, d, e, f, g, h, i) g
+# define MITK_PP_TUPLE_ELEM_9_7(a, b, c, d, e, f, g, h, i) h
+# define MITK_PP_TUPLE_ELEM_9_8(a, b, c, d, e, f, g, h, i) i
+#
+# define MITK_PP_TUPLE_ELEM_10_0(a, b, c, d, e, f, g, h, i, j) a
+# define MITK_PP_TUPLE_ELEM_10_1(a, b, c, d, e, f, g, h, i, j) b
+# define MITK_PP_TUPLE_ELEM_10_2(a, b, c, d, e, f, g, h, i, j) c
+# define MITK_PP_TUPLE_ELEM_10_3(a, b, c, d, e, f, g, h, i, j) d
+# define MITK_PP_TUPLE_ELEM_10_4(a, b, c, d, e, f, g, h, i, j) e
+# define MITK_PP_TUPLE_ELEM_10_5(a, b, c, d, e, f, g, h, i, j) f
+# define MITK_PP_TUPLE_ELEM_10_6(a, b, c, d, e, f, g, h, i, j) g
+# define MITK_PP_TUPLE_ELEM_10_7(a, b, c, d, e, f, g, h, i, j) h
+# define MITK_PP_TUPLE_ELEM_10_8(a, b, c, d, e, f, g, h, i, j) i
+# define MITK_PP_TUPLE_ELEM_10_9(a, b, c, d, e, f, g, h, i, j) j
+#
+# define MITK_PP_TUPLE_ELEM_11_0(a, b, c, d, e, f, g, h, i, j, k) a
+# define MITK_PP_TUPLE_ELEM_11_1(a, b, c, d, e, f, g, h, i, j, k) b
+# define MITK_PP_TUPLE_ELEM_11_2(a, b, c, d, e, f, g, h, i, j, k) c
+# define MITK_PP_TUPLE_ELEM_11_3(a, b, c, d, e, f, g, h, i, j, k) d
+# define MITK_PP_TUPLE_ELEM_11_4(a, b, c, d, e, f, g, h, i, j, k) e
+# define MITK_PP_TUPLE_ELEM_11_5(a, b, c, d, e, f, g, h, i, j, k) f
+# define MITK_PP_TUPLE_ELEM_11_6(a, b, c, d, e, f, g, h, i, j, k) g
+# define MITK_PP_TUPLE_ELEM_11_7(a, b, c, d, e, f, g, h, i, j, k) h
+# define MITK_PP_TUPLE_ELEM_11_8(a, b, c, d, e, f, g, h, i, j, k) i
+# define MITK_PP_TUPLE_ELEM_11_9(a, b, c, d, e, f, g, h, i, j, k) j
+# define MITK_PP_TUPLE_ELEM_11_10(a, b, c, d, e, f, g, h, i, j, k) k
+#
+# define MITK_PP_TUPLE_ELEM_12_0(a, b, c, d, e, f, g, h, i, j, k, l) a
+# define MITK_PP_TUPLE_ELEM_12_1(a, b, c, d, e, f, g, h, i, j, k, l) b
+# define MITK_PP_TUPLE_ELEM_12_2(a, b, c, d, e, f, g, h, i, j, k, l) c
+# define MITK_PP_TUPLE_ELEM_12_3(a, b, c, d, e, f, g, h, i, j, k, l) d
+# define MITK_PP_TUPLE_ELEM_12_4(a, b, c, d, e, f, g, h, i, j, k, l) e
+# define MITK_PP_TUPLE_ELEM_12_5(a, b, c, d, e, f, g, h, i, j, k, l) f
+# define MITK_PP_TUPLE_ELEM_12_6(a, b, c, d, e, f, g, h, i, j, k, l) g
+# define MITK_PP_TUPLE_ELEM_12_7(a, b, c, d, e, f, g, h, i, j, k, l) h
+# define MITK_PP_TUPLE_ELEM_12_8(a, b, c, d, e, f, g, h, i, j, k, l) i
+# define MITK_PP_TUPLE_ELEM_12_9(a, b, c, d, e, f, g, h, i, j, k, l) j
+# define MITK_PP_TUPLE_ELEM_12_10(a, b, c, d, e, f, g, h, i, j, k, l) k
+# define MITK_PP_TUPLE_ELEM_12_11(a, b, c, d, e, f, g, h, i, j, k, l) l
+#
+# define MITK_PP_TUPLE_ELEM_13_0(a, b, c, d, e, f, g, h, i, j, k, l, m) a
+# define MITK_PP_TUPLE_ELEM_13_1(a, b, c, d, e, f, g, h, i, j, k, l, m) b
+# define MITK_PP_TUPLE_ELEM_13_2(a, b, c, d, e, f, g, h, i, j, k, l, m) c
+# define MITK_PP_TUPLE_ELEM_13_3(a, b, c, d, e, f, g, h, i, j, k, l, m) d
+# define MITK_PP_TUPLE_ELEM_13_4(a, b, c, d, e, f, g, h, i, j, k, l, m) e
+# define MITK_PP_TUPLE_ELEM_13_5(a, b, c, d, e, f, g, h, i, j, k, l, m) f
+# define MITK_PP_TUPLE_ELEM_13_6(a, b, c, d, e, f, g, h, i, j, k, l, m) g
+# define MITK_PP_TUPLE_ELEM_13_7(a, b, c, d, e, f, g, h, i, j, k, l, m) h
+# define MITK_PP_TUPLE_ELEM_13_8(a, b, c, d, e, f, g, h, i, j, k, l, m) i
+# define MITK_PP_TUPLE_ELEM_13_9(a, b, c, d, e, f, g, h, i, j, k, l, m) j
+# define MITK_PP_TUPLE_ELEM_13_10(a, b, c, d, e, f, g, h, i, j, k, l, m) k
+# define MITK_PP_TUPLE_ELEM_13_11(a, b, c, d, e, f, g, h, i, j, k, l, m) l
+# define MITK_PP_TUPLE_ELEM_13_12(a, b, c, d, e, f, g, h, i, j, k, l, m) m
+#
+# define MITK_PP_TUPLE_ELEM_14_0(a, b, c, d, e, f, g, h, i, j, k, l, m, n) a
+# define MITK_PP_TUPLE_ELEM_14_1(a, b, c, d, e, f, g, h, i, j, k, l, m, n) b
+# define MITK_PP_TUPLE_ELEM_14_2(a, b, c, d, e, f, g, h, i, j, k, l, m, n) c
+# define MITK_PP_TUPLE_ELEM_14_3(a, b, c, d, e, f, g, h, i, j, k, l, m, n) d
+# define MITK_PP_TUPLE_ELEM_14_4(a, b, c, d, e, f, g, h, i, j, k, l, m, n) e
+# define MITK_PP_TUPLE_ELEM_14_5(a, b, c, d, e, f, g, h, i, j, k, l, m, n) f
+# define MITK_PP_TUPLE_ELEM_14_6(a, b, c, d, e, f, g, h, i, j, k, l, m, n) g
+# define MITK_PP_TUPLE_ELEM_14_7(a, b, c, d, e, f, g, h, i, j, k, l, m, n) h
+# define MITK_PP_TUPLE_ELEM_14_8(a, b, c, d, e, f, g, h, i, j, k, l, m, n) i
+# define MITK_PP_TUPLE_ELEM_14_9(a, b, c, d, e, f, g, h, i, j, k, l, m, n) j
+# define MITK_PP_TUPLE_ELEM_14_10(a, b, c, d, e, f, g, h, i, j, k, l, m, n) k
+# define MITK_PP_TUPLE_ELEM_14_11(a, b, c, d, e, f, g, h, i, j, k, l, m, n) l
+# define MITK_PP_TUPLE_ELEM_14_12(a, b, c, d, e, f, g, h, i, j, k, l, m, n) m
+# define MITK_PP_TUPLE_ELEM_14_13(a, b, c, d, e, f, g, h, i, j, k, l, m, n) n
+#
+# define MITK_PP_TUPLE_ELEM_15_0(a, b, c, d, e, f, g, h, i, j, k, l, m, n, o) a
+# define MITK_PP_TUPLE_ELEM_15_1(a, b, c, d, e, f, g, h, i, j, k, l, m, n, o) b
+# define MITK_PP_TUPLE_ELEM_15_2(a, b, c, d, e, f, g, h, i, j, k, l, m, n, o) c
+# define MITK_PP_TUPLE_ELEM_15_3(a, b, c, d, e, f, g, h, i, j, k, l, m, n, o) d
+# define MITK_PP_TUPLE_ELEM_15_4(a, b, c, d, e, f, g, h, i, j, k, l, m, n, o) e
+# define MITK_PP_TUPLE_ELEM_15_5(a, b, c, d, e, f, g, h, i, j, k, l, m, n, o) f
+# define MITK_PP_TUPLE_ELEM_15_6(a, b, c, d, e, f, g, h, i, j, k, l, m, n, o) g
+# define MITK_PP_TUPLE_ELEM_15_7(a, b, c, d, e, f, g, h, i, j, k, l, m, n, o) h
+# define MITK_PP_TUPLE_ELEM_15_8(a, b, c, d, e, f, g, h, i, j, k, l, m, n, o) i
+# define MITK_PP_TUPLE_ELEM_15_9(a, b, c, d, e, f, g, h, i, j, k, l, m, n, o) j
+# define MITK_PP_TUPLE_ELEM_15_10(a, b, c, d, e, f, g, h, i, j, k, l, m, n, o) k
+# define MITK_PP_TUPLE_ELEM_15_11(a, b, c, d, e, f, g, h, i, j, k, l, m, n, o) l
+# define MITK_PP_TUPLE_ELEM_15_12(a, b, c, d, e, f, g, h, i, j, k, l, m, n, o) m
+# define MITK_PP_TUPLE_ELEM_15_13(a, b, c, d, e, f, g, h, i, j, k, l, m, n, o) n
+# define MITK_PP_TUPLE_ELEM_15_14(a, b, c, d, e, f, g, h, i, j, k, l, m, n, o) o
+#
+# define MITK_PP_TUPLE_ELEM_16_0(a, b, c, d, e, f, g, h, i, j, k, l, m, n, o, p) a
+# define MITK_PP_TUPLE_ELEM_16_1(a, b, c, d, e, f, g, h, i, j, k, l, m, n, o, p) b
+# define MITK_PP_TUPLE_ELEM_16_2(a, b, c, d, e, f, g, h, i, j, k, l, m, n, o, p) c
+# define MITK_PP_TUPLE_ELEM_16_3(a, b, c, d, e, f, g, h, i, j, k, l, m, n, o, p) d
+# define MITK_PP_TUPLE_ELEM_16_4(a, b, c, d, e, f, g, h, i, j, k, l, m, n, o, p) e
+# define MITK_PP_TUPLE_ELEM_16_5(a, b, c, d, e, f, g, h, i, j, k, l, m, n, o, p) f
+# define MITK_PP_TUPLE_ELEM_16_6(a, b, c, d, e, f, g, h, i, j, k, l, m, n, o, p) g
+# define MITK_PP_TUPLE_ELEM_16_7(a, b, c, d, e, f, g, h, i, j, k, l, m, n, o, p) h
+# define MITK_PP_TUPLE_ELEM_16_8(a, b, c, d, e, f, g, h, i, j, k, l, m, n, o, p) i
+# define MITK_PP_TUPLE_ELEM_16_9(a, b, c, d, e, f, g, h, i, j, k, l, m, n, o, p) j
+# define MITK_PP_TUPLE_ELEM_16_10(a, b, c, d, e, f, g, h, i, j, k, l, m, n, o, p) k
+# define MITK_PP_TUPLE_ELEM_16_11(a, b, c, d, e, f, g, h, i, j, k, l, m, n, o, p) l
+# define MITK_PP_TUPLE_ELEM_16_12(a, b, c, d, e, f, g, h, i, j, k, l, m, n, o, p) m
+# define MITK_PP_TUPLE_ELEM_16_13(a, b, c, d, e, f, g, h, i, j, k, l, m, n, o, p) n
+# define MITK_PP_TUPLE_ELEM_16_14(a, b, c, d, e, f, g, h, i, j, k, l, m, n, o, p) o
+# define MITK_PP_TUPLE_ELEM_16_15(a, b, c, d, e, f, g, h, i, j, k, l, m, n, o, p) p
+#
+# define MITK_PP_TUPLE_ELEM_17_0(a, b, c, d, e, f, g, h, i, j, k, l, m, n, o, p, q) a
+# define MITK_PP_TUPLE_ELEM_17_1(a, b, c, d, e, f, g, h, i, j, k, l, m, n, o, p, q) b
+# define MITK_PP_TUPLE_ELEM_17_2(a, b, c, d, e, f, g, h, i, j, k, l, m, n, o, p, q) c
+# define MITK_PP_TUPLE_ELEM_17_3(a, b, c, d, e, f, g, h, i, j, k, l, m, n, o, p, q) d
+# define MITK_PP_TUPLE_ELEM_17_4(a, b, c, d, e, f, g, h, i, j, k, l, m, n, o, p, q) e
+# define MITK_PP_TUPLE_ELEM_17_5(a, b, c, d, e, f, g, h, i, j, k, l, m, n, o, p, q) f
+# define MITK_PP_TUPLE_ELEM_17_6(a, b, c, d, e, f, g, h, i, j, k, l, m, n, o, p, q) g
+# define MITK_PP_TUPLE_ELEM_17_7(a, b, c, d, e, f, g, h, i, j, k, l, m, n, o, p, q) h
+# define MITK_PP_TUPLE_ELEM_17_8(a, b, c, d, e, f, g, h, i, j, k, l, m, n, o, p, q) i
+# define MITK_PP_TUPLE_ELEM_17_9(a, b, c, d, e, f, g, h, i, j, k, l, m, n, o, p, q) j
+# define MITK_PP_TUPLE_ELEM_17_10(a, b, c, d, e, f, g, h, i, j, k, l, m, n, o, p, q) k
+# define MITK_PP_TUPLE_ELEM_17_11(a, b, c, d, e, f, g, h, i, j, k, l, m, n, o, p, q) l
+# define MITK_PP_TUPLE_ELEM_17_12(a, b, c, d, e, f, g, h, i, j, k, l, m, n, o, p, q) m
+# define MITK_PP_TUPLE_ELEM_17_13(a, b, c, d, e, f, g, h, i, j, k, l, m, n, o, p, q) n
+# define MITK_PP_TUPLE_ELEM_17_14(a, b, c, d, e, f, g, h, i, j, k, l, m, n, o, p, q) o
+# define MITK_PP_TUPLE_ELEM_17_15(a, b, c, d, e, f, g, h, i, j, k, l, m, n, o, p, q) p
+# define MITK_PP_TUPLE_ELEM_17_16(a, b, c, d, e, f, g, h, i, j, k, l, m, n, o, p, q) q
+#
+# define MITK_PP_TUPLE_ELEM_18_0(a, b, c, d, e, f, g, h, i, j, k, l, m, n, o, p, q, r) a
+# define MITK_PP_TUPLE_ELEM_18_1(a, b, c, d, e, f, g, h, i, j, k, l, m, n, o, p, q, r) b
+# define MITK_PP_TUPLE_ELEM_18_2(a, b, c, d, e, f, g, h, i, j, k, l, m, n, o, p, q, r) c
+# define MITK_PP_TUPLE_ELEM_18_3(a, b, c, d, e, f, g, h, i, j, k, l, m, n, o, p, q, r) d
+# define MITK_PP_TUPLE_ELEM_18_4(a, b, c, d, e, f, g, h, i, j, k, l, m, n, o, p, q, r) e
+# define MITK_PP_TUPLE_ELEM_18_5(a, b, c, d, e, f, g, h, i, j, k, l, m, n, o, p, q, r) f
+# define MITK_PP_TUPLE_ELEM_18_6(a, b, c, d, e, f, g, h, i, j, k, l, m, n, o, p, q, r) g
+# define MITK_PP_TUPLE_ELEM_18_7(a, b, c, d, e, f, g, h, i, j, k, l, m, n, o, p, q, r) h
+# define MITK_PP_TUPLE_ELEM_18_8(a, b, c, d, e, f, g, h, i, j, k, l, m, n, o, p, q, r) i
+# define MITK_PP_TUPLE_ELEM_18_9(a, b, c, d, e, f, g, h, i, j, k, l, m, n, o, p, q, r) j
+# define MITK_PP_TUPLE_ELEM_18_10(a, b, c, d, e, f, g, h, i, j, k, l, m, n, o, p, q, r) k
+# define MITK_PP_TUPLE_ELEM_18_11(a, b, c, d, e, f, g, h, i, j, k, l, m, n, o, p, q, r) l
+# define MITK_PP_TUPLE_ELEM_18_12(a, b, c, d, e, f, g, h, i, j, k, l, m, n, o, p, q, r) m
+# define MITK_PP_TUPLE_ELEM_18_13(a, b, c, d, e, f, g, h, i, j, k, l, m, n, o, p, q, r) n
+# define MITK_PP_TUPLE_ELEM_18_14(a, b, c, d, e, f, g, h, i, j, k, l, m, n, o, p, q, r) o
+# define MITK_PP_TUPLE_ELEM_18_15(a, b, c, d, e, f, g, h, i, j, k, l, m, n, o, p, q, r) p
+# define MITK_PP_TUPLE_ELEM_18_16(a, b, c, d, e, f, g, h, i, j, k, l, m, n, o, p, q, r) q
+# define MITK_PP_TUPLE_ELEM_18_17(a, b, c, d, e, f, g, h, i, j, k, l, m, n, o, p, q, r) r
+#
+# define MITK_PP_TUPLE_ELEM_19_0(a, b, c, d, e, f, g, h, i, j, k, l, m, n, o, p, q, r, s) a
+# define MITK_PP_TUPLE_ELEM_19_1(a, b, c, d, e, f, g, h, i, j, k, l, m, n, o, p, q, r, s) b
+# define MITK_PP_TUPLE_ELEM_19_2(a, b, c, d, e, f, g, h, i, j, k, l, m, n, o, p, q, r, s) c
+# define MITK_PP_TUPLE_ELEM_19_3(a, b, c, d, e, f, g, h, i, j, k, l, m, n, o, p, q, r, s) d
+# define MITK_PP_TUPLE_ELEM_19_4(a, b, c, d, e, f, g, h, i, j, k, l, m, n, o, p, q, r, s) e
+# define MITK_PP_TUPLE_ELEM_19_5(a, b, c, d, e, f, g, h, i, j, k, l, m, n, o, p, q, r, s) f
+# define MITK_PP_TUPLE_ELEM_19_6(a, b, c, d, e, f, g, h, i, j, k, l, m, n, o, p, q, r, s) g
+# define MITK_PP_TUPLE_ELEM_19_7(a, b, c, d, e, f, g, h, i, j, k, l, m, n, o, p, q, r, s) h
+# define MITK_PP_TUPLE_ELEM_19_8(a, b, c, d, e, f, g, h, i, j, k, l, m, n, o, p, q, r, s) i
+# define MITK_PP_TUPLE_ELEM_19_9(a, b, c, d, e, f, g, h, i, j, k, l, m, n, o, p, q, r, s) j
+# define MITK_PP_TUPLE_ELEM_19_10(a, b, c, d, e, f, g, h, i, j, k, l, m, n, o, p, q, r, s) k
+# define MITK_PP_TUPLE_ELEM_19_11(a, b, c, d, e, f, g, h, i, j, k, l, m, n, o, p, q, r, s) l
+# define MITK_PP_TUPLE_ELEM_19_12(a, b, c, d, e, f, g, h, i, j, k, l, m, n, o, p, q, r, s) m
+# define MITK_PP_TUPLE_ELEM_19_13(a, b, c, d, e, f, g, h, i, j, k, l, m, n, o, p, q, r, s) n
+# define MITK_PP_TUPLE_ELEM_19_14(a, b, c, d, e, f, g, h, i, j, k, l, m, n, o, p, q, r, s) o
+# define MITK_PP_TUPLE_ELEM_19_15(a, b, c, d, e, f, g, h, i, j, k, l, m, n, o, p, q, r, s) p
+# define MITK_PP_TUPLE_ELEM_19_16(a, b, c, d, e, f, g, h, i, j, k, l, m, n, o, p, q, r, s) q
+# define MITK_PP_TUPLE_ELEM_19_17(a, b, c, d, e, f, g, h, i, j, k, l, m, n, o, p, q, r, s) r
+# define MITK_PP_TUPLE_ELEM_19_18(a, b, c, d, e, f, g, h, i, j, k, l, m, n, o, p, q, r, s) s
+#
+# define MITK_PP_TUPLE_ELEM_20_0(a, b, c, d, e, f, g, h, i, j, k, l, m, n, o, p, q, r, s, t) a
+# define MITK_PP_TUPLE_ELEM_20_1(a, b, c, d, e, f, g, h, i, j, k, l, m, n, o, p, q, r, s, t) b
+# define MITK_PP_TUPLE_ELEM_20_2(a, b, c, d, e, f, g, h, i, j, k, l, m, n, o, p, q, r, s, t) c
+# define MITK_PP_TUPLE_ELEM_20_3(a, b, c, d, e, f, g, h, i, j, k, l, m, n, o, p, q, r, s, t) d
+# define MITK_PP_TUPLE_ELEM_20_4(a, b, c, d, e, f, g, h, i, j, k, l, m, n, o, p, q, r, s, t) e
+# define MITK_PP_TUPLE_ELEM_20_5(a, b, c, d, e, f, g, h, i, j, k, l, m, n, o, p, q, r, s, t) f
+# define MITK_PP_TUPLE_ELEM_20_6(a, b, c, d, e, f, g, h, i, j, k, l, m, n, o, p, q, r, s, t) g
+# define MITK_PP_TUPLE_ELEM_20_7(a, b, c, d, e, f, g, h, i, j, k, l, m, n, o, p, q, r, s, t) h
+# define MITK_PP_TUPLE_ELEM_20_8(a, b, c, d, e, f, g, h, i, j, k, l, m, n, o, p, q, r, s, t) i
+# define MITK_PP_TUPLE_ELEM_20_9(a, b, c, d, e, f, g, h, i, j, k, l, m, n, o, p, q, r, s, t) j
+# define MITK_PP_TUPLE_ELEM_20_10(a, b, c, d, e, f, g, h, i, j, k, l, m, n, o, p, q, r, s, t) k
+# define MITK_PP_TUPLE_ELEM_20_11(a, b, c, d, e, f, g, h, i, j, k, l, m, n, o, p, q, r, s, t) l
+# define MITK_PP_TUPLE_ELEM_20_12(a, b, c, d, e, f, g, h, i, j, k, l, m, n, o, p, q, r, s, t) m
+# define MITK_PP_TUPLE_ELEM_20_13(a, b, c, d, e, f, g, h, i, j, k, l, m, n, o, p, q, r, s, t) n
+# define MITK_PP_TUPLE_ELEM_20_14(a, b, c, d, e, f, g, h, i, j, k, l, m, n, o, p, q, r, s, t) o
+# define MITK_PP_TUPLE_ELEM_20_15(a, b, c, d, e, f, g, h, i, j, k, l, m, n, o, p, q, r, s, t) p
+# define MITK_PP_TUPLE_ELEM_20_16(a, b, c, d, e, f, g, h, i, j, k, l, m, n, o, p, q, r, s, t) q
+# define MITK_PP_TUPLE_ELEM_20_17(a, b, c, d, e, f, g, h, i, j, k, l, m, n, o, p, q, r, s, t) r
+# define MITK_PP_TUPLE_ELEM_20_18(a, b, c, d, e, f, g, h, i, j, k, l, m, n, o, p, q, r, s, t) s
+# define MITK_PP_TUPLE_ELEM_20_19(a, b, c, d, e, f, g, h, i, j, k, l, m, n, o, p, q, r, s, t) t
+#
+# define MITK_PP_TUPLE_ELEM_21_0(a, b, c, d, e, f, g, h, i, j, k, l, m, n, o, p, q, r, s, t, u) a
+# define MITK_PP_TUPLE_ELEM_21_1(a, b, c, d, e, f, g, h, i, j, k, l, m, n, o, p, q, r, s, t, u) b
+# define MITK_PP_TUPLE_ELEM_21_2(a, b, c, d, e, f, g, h, i, j, k, l, m, n, o, p, q, r, s, t, u) c
+# define MITK_PP_TUPLE_ELEM_21_3(a, b, c, d, e, f, g, h, i, j, k, l, m, n, o, p, q, r, s, t, u) d
+# define MITK_PP_TUPLE_ELEM_21_4(a, b, c, d, e, f, g, h, i, j, k, l, m, n, o, p, q, r, s, t, u) e
+# define MITK_PP_TUPLE_ELEM_21_5(a, b, c, d, e, f, g, h, i, j, k, l, m, n, o, p, q, r, s, t, u) f
+# define MITK_PP_TUPLE_ELEM_21_6(a, b, c, d, e, f, g, h, i, j, k, l, m, n, o, p, q, r, s, t, u) g
+# define MITK_PP_TUPLE_ELEM_21_7(a, b, c, d, e, f, g, h, i, j, k, l, m, n, o, p, q, r, s, t, u) h
+# define MITK_PP_TUPLE_ELEM_21_8(a, b, c, d, e, f, g, h, i, j, k, l, m, n, o, p, q, r, s, t, u) i
+# define MITK_PP_TUPLE_ELEM_21_9(a, b, c, d, e, f, g, h, i, j, k, l, m, n, o, p, q, r, s, t, u) j
+# define MITK_PP_TUPLE_ELEM_21_10(a, b, c, d, e, f, g, h, i, j, k, l, m, n, o, p, q, r, s, t, u) k
+# define MITK_PP_TUPLE_ELEM_21_11(a, b, c, d, e, f, g, h, i, j, k, l, m, n, o, p, q, r, s, t, u) l
+# define MITK_PP_TUPLE_ELEM_21_12(a, b, c, d, e, f, g, h, i, j, k, l, m, n, o, p, q, r, s, t, u) m
+# define MITK_PP_TUPLE_ELEM_21_13(a, b, c, d, e, f, g, h, i, j, k, l, m, n, o, p, q, r, s, t, u) n
+# define MITK_PP_TUPLE_ELEM_21_14(a, b, c, d, e, f, g, h, i, j, k, l, m, n, o, p, q, r, s, t, u) o
+# define MITK_PP_TUPLE_ELEM_21_15(a, b, c, d, e, f, g, h, i, j, k, l, m, n, o, p, q, r, s, t, u) p
+# define MITK_PP_TUPLE_ELEM_21_16(a, b, c, d, e, f, g, h, i, j, k, l, m, n, o, p, q, r, s, t, u) q
+# define MITK_PP_TUPLE_ELEM_21_17(a, b, c, d, e, f, g, h, i, j, k, l, m, n, o, p, q, r, s, t, u) r
+# define MITK_PP_TUPLE_ELEM_21_18(a, b, c, d, e, f, g, h, i, j, k, l, m, n, o, p, q, r, s, t, u) s
+# define MITK_PP_TUPLE_ELEM_21_19(a, b, c, d, e, f, g, h, i, j, k, l, m, n, o, p, q, r, s, t, u) t
+# define MITK_PP_TUPLE_ELEM_21_20(a, b, c, d, e, f, g, h, i, j, k, l, m, n, o, p, q, r, s, t, u) u
+#
+# define MITK_PP_TUPLE_ELEM_22_0(a, b, c, d, e, f, g, h, i, j, k, l, m, n, o, p, q, r, s, t, u, v) a
+# define MITK_PP_TUPLE_ELEM_22_1(a, b, c, d, e, f, g, h, i, j, k, l, m, n, o, p, q, r, s, t, u, v) b
+# define MITK_PP_TUPLE_ELEM_22_2(a, b, c, d, e, f, g, h, i, j, k, l, m, n, o, p, q, r, s, t, u, v) c
+# define MITK_PP_TUPLE_ELEM_22_3(a, b, c, d, e, f, g, h, i, j, k, l, m, n, o, p, q, r, s, t, u, v) d
+# define MITK_PP_TUPLE_ELEM_22_4(a, b, c, d, e, f, g, h, i, j, k, l, m, n, o, p, q, r, s, t, u, v) e
+# define MITK_PP_TUPLE_ELEM_22_5(a, b, c, d, e, f, g, h, i, j, k, l, m, n, o, p, q, r, s, t, u, v) f
+# define MITK_PP_TUPLE_ELEM_22_6(a, b, c, d, e, f, g, h, i, j, k, l, m, n, o, p, q, r, s, t, u, v) g
+# define MITK_PP_TUPLE_ELEM_22_7(a, b, c, d, e, f, g, h, i, j, k, l, m, n, o, p, q, r, s, t, u, v) h
+# define MITK_PP_TUPLE_ELEM_22_8(a, b, c, d, e, f, g, h, i, j, k, l, m, n, o, p, q, r, s, t, u, v) i
+# define MITK_PP_TUPLE_ELEM_22_9(a, b, c, d, e, f, g, h, i, j, k, l, m, n, o, p, q, r, s, t, u, v) j
+# define MITK_PP_TUPLE_ELEM_22_10(a, b, c, d, e, f, g, h, i, j, k, l, m, n, o, p, q, r, s, t, u, v) k
+# define MITK_PP_TUPLE_ELEM_22_11(a, b, c, d, e, f, g, h, i, j, k, l, m, n, o, p, q, r, s, t, u, v) l
+# define MITK_PP_TUPLE_ELEM_22_12(a, b, c, d, e, f, g, h, i, j, k, l, m, n, o, p, q, r, s, t, u, v) m
+# define MITK_PP_TUPLE_ELEM_22_13(a, b, c, d, e, f, g, h, i, j, k, l, m, n, o, p, q, r, s, t, u, v) n
+# define MITK_PP_TUPLE_ELEM_22_14(a, b, c, d, e, f, g, h, i, j, k, l, m, n, o, p, q, r, s, t, u, v) o
+# define MITK_PP_TUPLE_ELEM_22_15(a, b, c, d, e, f, g, h, i, j, k, l, m, n, o, p, q, r, s, t, u, v) p
+# define MITK_PP_TUPLE_ELEM_22_16(a, b, c, d, e, f, g, h, i, j, k, l, m, n, o, p, q, r, s, t, u, v) q
+# define MITK_PP_TUPLE_ELEM_22_17(a, b, c, d, e, f, g, h, i, j, k, l, m, n, o, p, q, r, s, t, u, v) r
+# define MITK_PP_TUPLE_ELEM_22_18(a, b, c, d, e, f, g, h, i, j, k, l, m, n, o, p, q, r, s, t, u, v) s
+# define MITK_PP_TUPLE_ELEM_22_19(a, b, c, d, e, f, g, h, i, j, k, l, m, n, o, p, q, r, s, t, u, v) t
+# define MITK_PP_TUPLE_ELEM_22_20(a, b, c, d, e, f, g, h, i, j, k, l, m, n, o, p, q, r, s, t, u, v) u
+# define MITK_PP_TUPLE_ELEM_22_21(a, b, c, d, e, f, g, h, i, j, k, l, m, n, o, p, q, r, s, t, u, v) v
+#
+# define MITK_PP_TUPLE_ELEM_23_0(a, b, c, d, e, f, g, h, i, j, k, l, m, n, o, p, q, r, s, t, u, v, w) a
+# define MITK_PP_TUPLE_ELEM_23_1(a, b, c, d, e, f, g, h, i, j, k, l, m, n, o, p, q, r, s, t, u, v, w) b
+# define MITK_PP_TUPLE_ELEM_23_2(a, b, c, d, e, f, g, h, i, j, k, l, m, n, o, p, q, r, s, t, u, v, w) c
+# define MITK_PP_TUPLE_ELEM_23_3(a, b, c, d, e, f, g, h, i, j, k, l, m, n, o, p, q, r, s, t, u, v, w) d
+# define MITK_PP_TUPLE_ELEM_23_4(a, b, c, d, e, f, g, h, i, j, k, l, m, n, o, p, q, r, s, t, u, v, w) e
+# define MITK_PP_TUPLE_ELEM_23_5(a, b, c, d, e, f, g, h, i, j, k, l, m, n, o, p, q, r, s, t, u, v, w) f
+# define MITK_PP_TUPLE_ELEM_23_6(a, b, c, d, e, f, g, h, i, j, k, l, m, n, o, p, q, r, s, t, u, v, w) g
+# define MITK_PP_TUPLE_ELEM_23_7(a, b, c, d, e, f, g, h, i, j, k, l, m, n, o, p, q, r, s, t, u, v, w) h
+# define MITK_PP_TUPLE_ELEM_23_8(a, b, c, d, e, f, g, h, i, j, k, l, m, n, o, p, q, r, s, t, u, v, w) i
+# define MITK_PP_TUPLE_ELEM_23_9(a, b, c, d, e, f, g, h, i, j, k, l, m, n, o, p, q, r, s, t, u, v, w) j
+# define MITK_PP_TUPLE_ELEM_23_10(a, b, c, d, e, f, g, h, i, j, k, l, m, n, o, p, q, r, s, t, u, v, w) k
+# define MITK_PP_TUPLE_ELEM_23_11(a, b, c, d, e, f, g, h, i, j, k, l, m, n, o, p, q, r, s, t, u, v, w) l
+# define MITK_PP_TUPLE_ELEM_23_12(a, b, c, d, e, f, g, h, i, j, k, l, m, n, o, p, q, r, s, t, u, v, w) m
+# define MITK_PP_TUPLE_ELEM_23_13(a, b, c, d, e, f, g, h, i, j, k, l, m, n, o, p, q, r, s, t, u, v, w) n
+# define MITK_PP_TUPLE_ELEM_23_14(a, b, c, d, e, f, g, h, i, j, k, l, m, n, o, p, q, r, s, t, u, v, w) o
+# define MITK_PP_TUPLE_ELEM_23_15(a, b, c, d, e, f, g, h, i, j, k, l, m, n, o, p, q, r, s, t, u, v, w) p
+# define MITK_PP_TUPLE_ELEM_23_16(a, b, c, d, e, f, g, h, i, j, k, l, m, n, o, p, q, r, s, t, u, v, w) q
+# define MITK_PP_TUPLE_ELEM_23_17(a, b, c, d, e, f, g, h, i, j, k, l, m, n, o, p, q, r, s, t, u, v, w) r
+# define MITK_PP_TUPLE_ELEM_23_18(a, b, c, d, e, f, g, h, i, j, k, l, m, n, o, p, q, r, s, t, u, v, w) s
+# define MITK_PP_TUPLE_ELEM_23_19(a, b, c, d, e, f, g, h, i, j, k, l, m, n, o, p, q, r, s, t, u, v, w) t
+# define MITK_PP_TUPLE_ELEM_23_20(a, b, c, d, e, f, g, h, i, j, k, l, m, n, o, p, q, r, s, t, u, v, w) u
+# define MITK_PP_TUPLE_ELEM_23_21(a, b, c, d, e, f, g, h, i, j, k, l, m, n, o, p, q, r, s, t, u, v, w) v
+# define MITK_PP_TUPLE_ELEM_23_22(a, b, c, d, e, f, g, h, i, j, k, l, m, n, o, p, q, r, s, t, u, v, w) w
+#
+# define MITK_PP_TUPLE_ELEM_24_0(a, b, c, d, e, f, g, h, i, j, k, l, m, n, o, p, q, r, s, t, u, v, w, x) a
+# define MITK_PP_TUPLE_ELEM_24_1(a, b, c, d, e, f, g, h, i, j, k, l, m, n, o, p, q, r, s, t, u, v, w, x) b
+# define MITK_PP_TUPLE_ELEM_24_2(a, b, c, d, e, f, g, h, i, j, k, l, m, n, o, p, q, r, s, t, u, v, w, x) c
+# define MITK_PP_TUPLE_ELEM_24_3(a, b, c, d, e, f, g, h, i, j, k, l, m, n, o, p, q, r, s, t, u, v, w, x) d
+# define MITK_PP_TUPLE_ELEM_24_4(a, b, c, d, e, f, g, h, i, j, k, l, m, n, o, p, q, r, s, t, u, v, w, x) e
+# define MITK_PP_TUPLE_ELEM_24_5(a, b, c, d, e, f, g, h, i, j, k, l, m, n, o, p, q, r, s, t, u, v, w, x) f
+# define MITK_PP_TUPLE_ELEM_24_6(a, b, c, d, e, f, g, h, i, j, k, l, m, n, o, p, q, r, s, t, u, v, w, x) g
+# define MITK_PP_TUPLE_ELEM_24_7(a, b, c, d, e, f, g, h, i, j, k, l, m, n, o, p, q, r, s, t, u, v, w, x) h
+# define MITK_PP_TUPLE_ELEM_24_8(a, b, c, d, e, f, g, h, i, j, k, l, m, n, o, p, q, r, s, t, u, v, w, x) i
+# define MITK_PP_TUPLE_ELEM_24_9(a, b, c, d, e, f, g, h, i, j, k, l, m, n, o, p, q, r, s, t, u, v, w, x) j
+# define MITK_PP_TUPLE_ELEM_24_10(a, b, c, d, e, f, g, h, i, j, k, l, m, n, o, p, q, r, s, t, u, v, w, x) k
+# define MITK_PP_TUPLE_ELEM_24_11(a, b, c, d, e, f, g, h, i, j, k, l, m, n, o, p, q, r, s, t, u, v, w, x) l
+# define MITK_PP_TUPLE_ELEM_24_12(a, b, c, d, e, f, g, h, i, j, k, l, m, n, o, p, q, r, s, t, u, v, w, x) m
+# define MITK_PP_TUPLE_ELEM_24_13(a, b, c, d, e, f, g, h, i, j, k, l, m, n, o, p, q, r, s, t, u, v, w, x) n
+# define MITK_PP_TUPLE_ELEM_24_14(a, b, c, d, e, f, g, h, i, j, k, l, m, n, o, p, q, r, s, t, u, v, w, x) o
+# define MITK_PP_TUPLE_ELEM_24_15(a, b, c, d, e, f, g, h, i, j, k, l, m, n, o, p, q, r, s, t, u, v, w, x) p
+# define MITK_PP_TUPLE_ELEM_24_16(a, b, c, d, e, f, g, h, i, j, k, l, m, n, o, p, q, r, s, t, u, v, w, x) q
+# define MITK_PP_TUPLE_ELEM_24_17(a, b, c, d, e, f, g, h, i, j, k, l, m, n, o, p, q, r, s, t, u, v, w, x) r
+# define MITK_PP_TUPLE_ELEM_24_18(a, b, c, d, e, f, g, h, i, j, k, l, m, n, o, p, q, r, s, t, u, v, w, x) s
+# define MITK_PP_TUPLE_ELEM_24_19(a, b, c, d, e, f, g, h, i, j, k, l, m, n, o, p, q, r, s, t, u, v, w, x) t
+# define MITK_PP_TUPLE_ELEM_24_20(a, b, c, d, e, f, g, h, i, j, k, l, m, n, o, p, q, r, s, t, u, v, w, x) u
+# define MITK_PP_TUPLE_ELEM_24_21(a, b, c, d, e, f, g, h, i, j, k, l, m, n, o, p, q, r, s, t, u, v, w, x) v
+# define MITK_PP_TUPLE_ELEM_24_22(a, b, c, d, e, f, g, h, i, j, k, l, m, n, o, p, q, r, s, t, u, v, w, x) w
+# define MITK_PP_TUPLE_ELEM_24_23(a, b, c, d, e, f, g, h, i, j, k, l, m, n, o, p, q, r, s, t, u, v, w, x) x
+#
+# define MITK_PP_TUPLE_ELEM_25_0(a, b, c, d, e, f, g, h, i, j, k, l, m, n, o, p, q, r, s, t, u, v, w, x, y) a
+# define MITK_PP_TUPLE_ELEM_25_1(a, b, c, d, e, f, g, h, i, j, k, l, m, n, o, p, q, r, s, t, u, v, w, x, y) b
+# define MITK_PP_TUPLE_ELEM_25_2(a, b, c, d, e, f, g, h, i, j, k, l, m, n, o, p, q, r, s, t, u, v, w, x, y) c
+# define MITK_PP_TUPLE_ELEM_25_3(a, b, c, d, e, f, g, h, i, j, k, l, m, n, o, p, q, r, s, t, u, v, w, x, y) d
+# define MITK_PP_TUPLE_ELEM_25_4(a, b, c, d, e, f, g, h, i, j, k, l, m, n, o, p, q, r, s, t, u, v, w, x, y) e
+# define MITK_PP_TUPLE_ELEM_25_5(a, b, c, d, e, f, g, h, i, j, k, l, m, n, o, p, q, r, s, t, u, v, w, x, y) f
+# define MITK_PP_TUPLE_ELEM_25_6(a, b, c, d, e, f, g, h, i, j, k, l, m, n, o, p, q, r, s, t, u, v, w, x, y) g
+# define MITK_PP_TUPLE_ELEM_25_7(a, b, c, d, e, f, g, h, i, j, k, l, m, n, o, p, q, r, s, t, u, v, w, x, y) h
+# define MITK_PP_TUPLE_ELEM_25_8(a, b, c, d, e, f, g, h, i, j, k, l, m, n, o, p, q, r, s, t, u, v, w, x, y) i
+# define MITK_PP_TUPLE_ELEM_25_9(a, b, c, d, e, f, g, h, i, j, k, l, m, n, o, p, q, r, s, t, u, v, w, x, y) j
+# define MITK_PP_TUPLE_ELEM_25_10(a, b, c, d, e, f, g, h, i, j, k, l, m, n, o, p, q, r, s, t, u, v, w, x, y) k
+# define MITK_PP_TUPLE_ELEM_25_11(a, b, c, d, e, f, g, h, i, j, k, l, m, n, o, p, q, r, s, t, u, v, w, x, y) l
+# define MITK_PP_TUPLE_ELEM_25_12(a, b, c, d, e, f, g, h, i, j, k, l, m, n, o, p, q, r, s, t, u, v, w, x, y) m
+# define MITK_PP_TUPLE_ELEM_25_13(a, b, c, d, e, f, g, h, i, j, k, l, m, n, o, p, q, r, s, t, u, v, w, x, y) n
+# define MITK_PP_TUPLE_ELEM_25_14(a, b, c, d, e, f, g, h, i, j, k, l, m, n, o, p, q, r, s, t, u, v, w, x, y) o
+# define MITK_PP_TUPLE_ELEM_25_15(a, b, c, d, e, f, g, h, i, j, k, l, m, n, o, p, q, r, s, t, u, v, w, x, y) p
+# define MITK_PP_TUPLE_ELEM_25_16(a, b, c, d, e, f, g, h, i, j, k, l, m, n, o, p, q, r, s, t, u, v, w, x, y) q
+# define MITK_PP_TUPLE_ELEM_25_17(a, b, c, d, e, f, g, h, i, j, k, l, m, n, o, p, q, r, s, t, u, v, w, x, y) r
+# define MITK_PP_TUPLE_ELEM_25_18(a, b, c, d, e, f, g, h, i, j, k, l, m, n, o, p, q, r, s, t, u, v, w, x, y) s
+# define MITK_PP_TUPLE_ELEM_25_19(a, b, c, d, e, f, g, h, i, j, k, l, m, n, o, p, q, r, s, t, u, v, w, x, y) t
+# define MITK_PP_TUPLE_ELEM_25_20(a, b, c, d, e, f, g, h, i, j, k, l, m, n, o, p, q, r, s, t, u, v, w, x, y) u
+# define MITK_PP_TUPLE_ELEM_25_21(a, b, c, d, e, f, g, h, i, j, k, l, m, n, o, p, q, r, s, t, u, v, w, x, y) v
+# define MITK_PP_TUPLE_ELEM_25_22(a, b, c, d, e, f, g, h, i, j, k, l, m, n, o, p, q, r, s, t, u, v, w, x, y) w
+# define MITK_PP_TUPLE_ELEM_25_23(a, b, c, d, e, f, g, h, i, j, k, l, m, n, o, p, q, r, s, t, u, v, w, x, y) x
+# define MITK_PP_TUPLE_ELEM_25_24(a, b, c, d, e, f, g, h, i, j, k, l, m, n, o, p, q, r, s, t, u, v, w, x, y) y
+#
+# endif
diff --git a/Core/Code/Algorithms/mitkPPTupleRem.h b/Core/Code/Algorithms/mitkPPTupleRem.h
new file mode 100644
index 0000000000..f9ededef69
--- /dev/null
+++ b/Core/Code/Algorithms/mitkPPTupleRem.h
@@ -0,0 +1,72 @@
+# /* **************************************************************************
+# * *
+# * (C) Copyright Paul Mensonides 2002.
+# * Distributed under the Boost Software License, Version 1.0. (See
+# * accompanying file LICENSE_1_0.txt or copy at
+# * http://www.boost.org/LICENSE_1_0.txt)
+# * *
+# ************************************************************************** */
+#
+# /* See http://www.boost.org for most recent version. */
+#
+# ifndef MITK_PREPROCESSOR_TUPLE_REM_HPP
+# define MITK_PREPROCESSOR_TUPLE_REM_HPP
+#
+# include "mitkPPConfig.h"
+#
+# /* MITK_PP_TUPLE_REM */
+#
+# if ~MITK_PP_CONFIG_FLAGS() & MITK_PP_CONFIG_MWCC()
+# define MITK_PP_TUPLE_REM(size) MITK_PP_TUPLE_REM_I(size)
+# else
+# define MITK_PP_TUPLE_REM(size) MITK_PP_TUPLE_REM_OO((size))
+# define MITK_PP_TUPLE_REM_OO(par) MITK_PP_TUPLE_REM_I ## par
+# endif
+#
+# define MITK_PP_TUPLE_REM_I(size) MITK_PP_TUPLE_REM_ ## size
+#
+# define MITK_PP_TUPLE_REM_0()
+# define MITK_PP_TUPLE_REM_1(a) a
+# define MITK_PP_TUPLE_REM_2(a, b) a, b
+# define MITK_PP_TUPLE_REM_3(a, b, c) a, b, c
+# define MITK_PP_TUPLE_REM_4(a, b, c, d) a, b, c, d
+# define MITK_PP_TUPLE_REM_5(a, b, c, d, e) a, b, c, d, e
+# define MITK_PP_TUPLE_REM_6(a, b, c, d, e, f) a, b, c, d, e, f
+# define MITK_PP_TUPLE_REM_7(a, b, c, d, e, f, g) a, b, c, d, e, f, g
+# define MITK_PP_TUPLE_REM_8(a, b, c, d, e, f, g, h) a, b, c, d, e, f, g, h
+# define MITK_PP_TUPLE_REM_9(a, b, c, d, e, f, g, h, i) a, b, c, d, e, f, g, h, i
+# define MITK_PP_TUPLE_REM_10(a, b, c, d, e, f, g, h, i, j) a, b, c, d, e, f, g, h, i, j
+# define MITK_PP_TUPLE_REM_11(a, b, c, d, e, f, g, h, i, j, k) a, b, c, d, e, f, g, h, i, j, k
+# define MITK_PP_TUPLE_REM_12(a, b, c, d, e, f, g, h, i, j, k, l) a, b, c, d, e, f, g, h, i, j, k, l
+# define MITK_PP_TUPLE_REM_13(a, b, c, d, e, f, g, h, i, j, k, l, m) a, b, c, d, e, f, g, h, i, j, k, l, m
+# define MITK_PP_TUPLE_REM_14(a, b, c, d, e, f, g, h, i, j, k, l, m, n) a, b, c, d, e, f, g, h, i, j, k, l, m, n
+# define MITK_PP_TUPLE_REM_15(a, b, c, d, e, f, g, h, i, j, k, l, m, n, o) a, b, c, d, e, f, g, h, i, j, k, l, m, n, o
+# define MITK_PP_TUPLE_REM_16(a, b, c, d, e, f, g, h, i, j, k, l, m, n, o, p) a, b, c, d, e, f, g, h, i, j, k, l, m, n, o, p
+# define MITK_PP_TUPLE_REM_17(a, b, c, d, e, f, g, h, i, j, k, l, m, n, o, p, q) a, b, c, d, e, f, g, h, i, j, k, l, m, n, o, p, q
+# define MITK_PP_TUPLE_REM_18(a, b, c, d, e, f, g, h, i, j, k, l, m, n, o, p, q, r) a, b, c, d, e, f, g, h, i, j, k, l, m, n, o, p, q, r
+# define MITK_PP_TUPLE_REM_19(a, b, c, d, e, f, g, h, i, j, k, l, m, n, o, p, q, r, s) a, b, c, d, e, f, g, h, i, j, k, l, m, n, o, p, q, r, s
+# define MITK_PP_TUPLE_REM_20(a, b, c, d, e, f, g, h, i, j, k, l, m, n, o, p, q, r, s, t) a, b, c, d, e, f, g, h, i, j, k, l, m, n, o, p, q, r, s, t
+# define MITK_PP_TUPLE_REM_21(a, b, c, d, e, f, g, h, i, j, k, l, m, n, o, p, q, r, s, t, u) a, b, c, d, e, f, g, h, i, j, k, l, m, n, o, p, q, r, s, t, u
+# define MITK_PP_TUPLE_REM_22(a, b, c, d, e, f, g, h, i, j, k, l, m, n, o, p, q, r, s, t, u, v) a, b, c, d, e, f, g, h, i, j, k, l, m, n, o, p, q, r, s, t, u, v
+# define MITK_PP_TUPLE_REM_23(a, b, c, d, e, f, g, h, i, j, k, l, m, n, o, p, q, r, s, t, u, v, w) a, b, c, d, e, f, g, h, i, j, k, l, m, n, o, p, q, r, s, t, u, v, w
+# define MITK_PP_TUPLE_REM_24(a, b, c, d, e, f, g, h, i, j, k, l, m, n, o, p, q, r, s, t, u, v, w, x) a, b, c, d, e, f, g, h, i, j, k, l, m, n, o, p, q, r, s, t, u, v, w, x
+# define MITK_PP_TUPLE_REM_25(a, b, c, d, e, f, g, h, i, j, k, l, m, n, o, p, q, r, s, t, u, v, w, x, y) a, b, c, d, e, f, g, h, i, j, k, l, m, n, o, p, q, r, s, t, u, v, w, x, y
+#
+# /* MITK_PP_TUPLE_REM_CTOR */
+#
+# if ~MITK_PP_CONFIG_FLAGS() & MITK_PP_CONFIG_EDG()
+# define MITK_PP_TUPLE_REM_CTOR(size, tuple) MITK_PP_TUPLE_REM_CTOR_I(MITK_PP_TUPLE_REM(size), tuple)
+# else
+# define MITK_PP_TUPLE_REM_CTOR(size, tuple) MITK_PP_TUPLE_REM_CTOR_D(size, tuple)
+# define MITK_PP_TUPLE_REM_CTOR_D(size, tuple) MITK_PP_TUPLE_REM_CTOR_I(MITK_PP_TUPLE_REM(size), tuple)
+# endif
+#
+# if ~MITK_PP_CONFIG_FLAGS() & MITK_PP_CONFIG_MWCC()
+# define MITK_PP_TUPLE_REM_CTOR_I(ext, tuple) ext tuple
+# else
+# define MITK_PP_TUPLE_REM_CTOR_I(ext, tuple) MITK_PP_TUPLE_REM_CTOR_OO((ext, tuple))
+# define MITK_PP_TUPLE_REM_CTOR_OO(par) MITK_PP_TUPLE_REM_CTOR_II ## par
+# define MITK_PP_TUPLE_REM_CTOR_II(ext, tuple) ext ## tuple
+# endif
+#
+# endif
diff --git a/Core/Code/Algorithms/mitkPixelTypeList.h b/Core/Code/Algorithms/mitkPixelTypeList.h
new file mode 100644
index 0000000000..2c33db0c32
--- /dev/null
+++ b/Core/Code/Algorithms/mitkPixelTypeList.h
@@ -0,0 +1,194 @@
+/*=========================================================================
+
+Program: Medical Imaging & Interaction Toolkit
+Language: C++
+Date: $Date$
+Version: $Revision$
+
+Copyright (c) German Cancer Research Center, Division of Medical and
+Biological Informatics. All rights reserved.
+See MITKCopyright.txt or http://www.mitk.org/copyright.html for details.
+
+This software is distributed WITHOUT ANY WARRANTY; without even
+the implied warranty of MERCHANTABILITY or FITNESS FOR A PARTICULAR
+PURPOSE. See the above copyright notices for more information.
+
+=========================================================================*/
+
+#include <stdexcept>
+
+namespace mitk {
+
+struct EmptyType {};
+
+template<
+ typename T0=EmptyType,
+ typename T1=EmptyType,
+ typename T2=EmptyType,
+ typename T3=EmptyType,
+ typename T4=EmptyType,
+ typename T5=EmptyType,
+ typename T6=EmptyType,
+ typename T7=EmptyType,
+ typename T8=EmptyType,
+ typename T9=EmptyType
+> struct PixelTypeList;
+
+template<
+ typename T0,
+ typename T1,
+ typename T2,
+ typename T3,
+ typename T4,
+ typename T5,
+ typename T6,
+ typename T7,
+ typename T8,
+ typename T9
+> struct PixelTypeList
+{
+ typedef T0 head;
+ typedef PixelTypeList<T1,T2,T3,T4,T5,T6,T7,T8,T9> tail;
+ enum
+ {
+ length = tail::length+1
+ };
+};
+
+template<>
+struct PixelTypeList<EmptyType, EmptyType, EmptyType, EmptyType, EmptyType,
+ EmptyType, EmptyType, EmptyType, EmptyType, EmptyType>
+{
+ enum
+ {
+ length = 0
+ };
+};
+
+template<typename TypeList>
+struct PixelTypeLength
+{
+ enum
+ {
+ value = TypeList::length
+ };
+};
+
+template<
+ typename TypeList,
+ int Index, //requested element index
+ int Step = 0, //current recusion step
+ bool Stop=(Index==Step), //stop recusion flag
+ bool OutOfRange = PixelTypeLength<TypeList>::value==0 //out of range flag
+> struct GetPixelType
+{
+ typedef typename GetPixelType<typename TypeList::tail, Index, Step+1>::type type;
+};
+
+//"out of range" specialization
+template<
+ typename TypeList,
+ int Index,
+ int Step,
+ bool Stop
+>
+struct GetPixelType<TypeList, Index, Step, Stop, true>
+{
+ //if OutOfRange is 'true' the 'type' is undefined
+ //so we'll get a compile-time error
+};
+
+//"element found" specialization
+template<
+ typename TypeList,
+ int Index,
+ int Step,
+ bool OutOfRange
+>
+struct GetPixelType<TypeList, Index, Step, true, OutOfRange>
+{
+ //the index is equal to the recursion step
+ //so the result type is the head of the Typlist and stop!
+ typedef typename TypeList::head type;
+};
+
+////////////////////////////////////////////////////////////
+// run-time type switch
+template<
+ typename TypeList,
+ int Index = 0,
+ bool Stop=(Index==PixelTypeLength<TypeList>::value)
+> struct PixelTypeSwitch;
+
+template<typename TypeList, int Index, bool Stop>
+struct PixelTypeSwitch
+{
+ template<typename F>
+ bool operator() (int i, F& f)
+ {
+ if( i == Index)
+ {
+ return f.operator()<typename GetPixelType<TypeList, Index>::type>();
+ }
+ else
+ {
+ PixelTypeSwitch<TypeList, Index+1> next;
+ return next(i, f);
+ }
+ }
+};
+
+template<typename TypeList, int Index>
+struct PixelTypeSwitch<TypeList, Index, true>
+{
+ template<typename F>
+ bool operator() (int, F&)
+ {
+ throw std::out_of_range("Index out of range");
+ }
+};
+
+template<typename X, int VDimension, typename T1 = EmptyType, typename T2 = EmptyType, typename T3 = EmptyType>
+struct AccessItkImageFunctor
+{
+ typedef void (*CallBack)(T1,T2,T3);
+
+ AccessItkImageFunctor(X* cl, CallBack callBack, const mitk::Image* mitkImage, T1 t1 = T1(), T2 t2 = T2(), T3 t3 = T3())
+ : cl(cl), callBack(callBack), mitkImage(mitkImage), pixelType(mitkImage->GetPixelType()),
+ t1(t1), t2(t2), t3(t3)
+ {
+
+ }
+
+ template<typename PixelType>
+ bool operator() ()
+ {
+ if (pixelType != typeid(PixelType)) return false;
+ if (mitkImage->GetDimension() != VDimension) return false;
+
+ const_cast<mitk::Image*>(mitkImage)->Update();
+
+ typedef itk::Image<PixelType, VDimension> ImageType;
+ typedef mitk::ImageToItk<ImageType> ImageToItkType;
+ itk::SmartPointer<ImageToItkType> imagetoitk = ImageToItkType::New();
+ imagetoitk->SetInput(mitkImage);
+ imagetoitk->Update();
+ cl->*callBack(imagetoitk->GetOutput(), t1, t2, t3);
+ return true;
+ }
+
+private:
+
+ X* cl;
+ CallBack callBack;
+
+ const mitk::Image* mitkImage;
+ const mitk::PixelType& pixelType;
+ T1 t1;
+ T2 t2;
+ T3 t3;
+};
+
+
+} // namespace mitk
+
diff --git a/Core/Code/Algorithms/mitkRGBToRGBACastImageFilter.cpp b/Core/Code/Algorithms/mitkRGBToRGBACastImageFilter.cpp
index 9f39a83f51..0da6869236 100644
--- a/Core/Code/Algorithms/mitkRGBToRGBACastImageFilter.cpp
+++ b/Core/Code/Algorithms/mitkRGBToRGBACastImageFilter.cpp
@@ -1,223 +1,223 @@
/*=========================================================================
Program: Medical Imaging & Interaction Toolkit
Language: C++
Date: $Date: 2009-04-23 13:50:34 +0200 (Do, 23 Apr 2009) $
Version: $Revision: 16947 $
Copyright (c) German Cancer Research Center, Division of Medical and
Biological Informatics. All rights reserved.
See MITKCopyright.txt or http://www.mitk.org/copyright.html for details.
This software is distributed WITHOUT ANY WARRANTY; without even
the implied warranty of MERCHANTABILITY or FITNESS FOR A PARTICULAR
PURPOSE. See the above copyright notices for more information.
=========================================================================*/
#include "mitkRGBToRGBACastImageFilter.h"
#include "mitkImageTimeSelector.h"
#include "mitkProperties.h"
#include "mitkImageAccessByItk.h"
#include "mitkImageToItk.h"
#include <itkImageRegionConstIterator.h>
#include <itkImageRegionIteratorWithIndex.h>
#include <itkImageIOBase.h>
#include <itkRGBAPixel.h>
mitk::RGBToRGBACastImageFilter::RGBToRGBACastImageFilter()
{
this->SetNumberOfInputs(1);
this->SetNumberOfRequiredInputs(1);
m_InputTimeSelector = mitk::ImageTimeSelector::New();
m_OutputTimeSelector = mitk::ImageTimeSelector::New();
}
mitk::RGBToRGBACastImageFilter::~RGBToRGBACastImageFilter()
{
}
bool mitk::RGBToRGBACastImageFilter::IsRGBImage( const mitk::Image *image )
{
const mitk::PixelType &inputPixelType = image->GetPixelType();
if ( (inputPixelType == typeid( UCRGBPixelType) )
|| (inputPixelType == typeid( USRGBPixelType) )
|| (inputPixelType == typeid( FloatRGBPixelType) )
|| (inputPixelType == typeid( DoubleRGBPixelType) ) )
{
return true;
}
return false;
}
void mitk::RGBToRGBACastImageFilter::GenerateInputRequestedRegion()
{
Superclass::GenerateInputRequestedRegion();
mitk::Image* output = this->GetOutput();
mitk::Image* input = const_cast< mitk::Image * > ( this->GetInput() );
if ( !output->IsInitialized() )
{
return;
}
input->SetRequestedRegionToLargestPossibleRegion();
//GenerateTimeInInputRegion(output, input);
}
void mitk::RGBToRGBACastImageFilter::GenerateOutputInformation()
{
mitk::Image::ConstPointer input = this->GetInput();
mitk::Image::Pointer output = this->GetOutput();
if ((output->IsInitialized()) && (this->GetMTime() <= m_TimeOfHeaderInitialization.GetMTime()))
return;
itkDebugMacro(<<"GenerateOutputInformation()");
// Initialize RGBA output with same pixel type as input image
const mitk::PixelType &inputPixelType = input->GetPixelType();
if ( inputPixelType == typeid( UCRGBPixelType ) )
{
mitk::PixelType outputPixelType( typeid( unsigned char ), 4, itk::ImageIOBase::RGBA );
output->Initialize( outputPixelType, *input->GetTimeSlicedGeometry() );
}
else if ( inputPixelType == typeid( USRGBPixelType ) )
{
mitk::PixelType outputPixelType( typeid( unsigned short ), 4, itk::ImageIOBase::RGBA );
output->Initialize( outputPixelType, *input->GetTimeSlicedGeometry() );
}
else if ( inputPixelType == typeid( FloatRGBPixelType ) )
{
mitk::PixelType outputPixelType( typeid( float ), 4, itk::ImageIOBase::RGBA );
output->Initialize( outputPixelType, *input->GetTimeSlicedGeometry() );
}
else if ( inputPixelType == typeid( DoubleRGBPixelType ) )
{
mitk::PixelType outputPixelType( typeid( double ), 4, itk::ImageIOBase::RGBA );
output->Initialize( outputPixelType, *input->GetTimeSlicedGeometry() );
}
output->SetPropertyList(input->GetPropertyList()->Clone());
m_TimeOfHeaderInitialization.Modified();
}
void mitk::RGBToRGBACastImageFilter::GenerateData()
{
mitk::Image::ConstPointer input = this->GetInput();
mitk::Image::Pointer output = this->GetOutput();
if( !output->IsInitialized() )
{
return;
}
m_InputTimeSelector->SetInput(input);
m_OutputTimeSelector->SetInput(this->GetOutput());
mitk::Image::RegionType outputRegion = output->GetRequestedRegion();
const mitk::TimeSlicedGeometry *outputTimeGeometry = output->GetTimeSlicedGeometry();
const mitk::TimeSlicedGeometry *inputTimeGeometry = input->GetTimeSlicedGeometry();
ScalarType timeInMS;
int timestep=0;
int tstart=outputRegion.GetIndex(3);
int tmax=tstart+outputRegion.GetSize(3);
int t;
for(t=tstart;t<tmax;++t)
{
timeInMS = outputTimeGeometry->TimeStepToMS( t );
timestep = inputTimeGeometry->MSToTimeStep( timeInMS );
m_InputTimeSelector->SetTimeNr(timestep);
m_InputTimeSelector->UpdateLargestPossibleRegion();
m_OutputTimeSelector->SetTimeNr(t);
m_OutputTimeSelector->UpdateLargestPossibleRegion();
mitk::Image *image = m_InputTimeSelector->GetOutput();
const mitk::PixelType &pixelType = image->GetPixelType();
// Check if the pixel type is supported
if ( pixelType == typeid( UCRGBPixelType ) )
{
- AccessFixedPixelTypeByItk_2( image, InternalCast, UCRGBPixelType, this, 255 );
+ AccessFixedPixelTypeByItk_2( image, InternalCast, (UCRGBPixelType), this, 255 );
}
else if ( pixelType == typeid( USRGBPixelType ) )
{
- AccessFixedPixelTypeByItk_2( image, InternalCast, USRGBPixelType, this, 65535 );
+ AccessFixedPixelTypeByItk_2( image, InternalCast, (USRGBPixelType), this, 65535 );
}
else if ( pixelType == typeid( FloatRGBPixelType ) )
{
- AccessFixedPixelTypeByItk_2( image, InternalCast, FloatRGBPixelType, this, 1.0 );
+ AccessFixedPixelTypeByItk_2( image, InternalCast, (FloatRGBPixelType), this, 1.0 );
}
else if ( pixelType == typeid( DoubleRGBPixelType ) )
{
- AccessFixedPixelTypeByItk_2( image, InternalCast, DoubleRGBPixelType, this, 1.0 );
+ AccessFixedPixelTypeByItk_2( image, InternalCast, (DoubleRGBPixelType), this, 1.0 );
}
else
{
// Otherwise, write warning and graft input to output
// ...TBD...
}
}
m_TimeOfHeaderInitialization.Modified();
}
template < typename TPixel, unsigned int VImageDimension >
void mitk::RGBToRGBACastImageFilter::InternalCast(
itk::Image< TPixel, VImageDimension > *inputItkImage,
mitk::RGBToRGBACastImageFilter *addComponentFilter,
typename TPixel::ComponentType defaultAlpha )
{
typedef TPixel InputPixelType;
typedef itk::RGBAPixel< typename TPixel::ComponentType > OutputPixelType;
typedef itk::Image< InputPixelType, VImageDimension > InputImageType;
typedef itk::Image< OutputPixelType, VImageDimension > OutputImageType;
typedef itk::ImageRegionConstIterator< InputImageType > InputImageIteratorType;
typedef itk::ImageRegionIteratorWithIndex< OutputImageType > OutputImageIteratorType;
typename mitk::ImageToItk< OutputImageType >::Pointer outputimagetoitk =
mitk::ImageToItk< OutputImageType >::New();
outputimagetoitk->SetInput(addComponentFilter->m_OutputTimeSelector->GetOutput());
outputimagetoitk->Update();
typename OutputImageType::Pointer outputItkImage = outputimagetoitk->GetOutput();
// create the iterators
typename InputImageType::RegionType inputRegionOfInterest =
inputItkImage->GetLargestPossibleRegion();
InputImageIteratorType inputIt( inputItkImage, inputRegionOfInterest );
OutputImageIteratorType outputIt( outputItkImage, inputRegionOfInterest );
for ( inputIt.GoToBegin(), outputIt.GoToBegin();
!inputIt.IsAtEnd();
++inputIt, ++outputIt )
{
typename InputPixelType::Iterator pixelInputIt = inputIt.Get().Begin();
typename OutputPixelType::Iterator pixelOutputIt = outputIt.Get().Begin();
*pixelOutputIt++ = *pixelInputIt++;
*pixelOutputIt++ = *pixelInputIt++;
*pixelOutputIt++ = *pixelInputIt++;
*pixelOutputIt = defaultAlpha;
}
}
diff --git a/Core/Code/Controllers/mitkSliceNavigationController.h b/Core/Code/Controllers/mitkSliceNavigationController.h
index 5cf5646a5d..6ff232b0cd 100644
--- a/Core/Code/Controllers/mitkSliceNavigationController.h
+++ b/Core/Code/Controllers/mitkSliceNavigationController.h
@@ -1,505 +1,505 @@
/*=========================================================================
Program: Medical Imaging & Interaction Toolkit
Language: C++
Date: $Date$
Version: $Revision$
Copyright (c) German Cancer Research Center, Division of Medical and
Biological Informatics. All rights reserved.
See MITKCopyright.txt or http://www.mitk.org/copyright.html for details.
This software is distributed WITHOUT ANY WARRANTY; without even
the implied warranty of MERCHANTABILITY or FITNESS FOR A PARTICULAR
PURPOSE. See the above copyright notices for more information.
=========================================================================*/
#ifndef SLICENAVIGATIONCONTROLLER_H_HEADER_INCLUDED_C1C55A2F
#define SLICENAVIGATIONCONTROLLER_H_HEADER_INCLUDED_C1C55A2F
#include "mitkCommon.h"
#include "mitkBaseController.h"
#include "mitkRenderingManager.h"
#include "mitkTimeSlicedGeometry.h"
#include <itkEventObject.h>
#include <itkCommand.h>
#include <mitkIpPicTypeMultiplex.h>
#include <sstream>
namespace mitk {
#define mitkTimeSlicedGeometryEventMacro( classname , super ) \
class MITK_CORE_EXPORT classname : public super { \
public: \
typedef classname Self; \
typedef super Superclass; \
classname(TimeSlicedGeometry* aTimeSlicedGeometry, unsigned int aPos) \
: Superclass(aTimeSlicedGeometry, aPos) {} \
virtual ~classname() {} \
virtual const char * GetEventName() const { return #classname; } \
virtual bool CheckEvent(const ::itk::EventObject* e) const \
{ return dynamic_cast<const Self*>(e); } \
virtual ::itk::EventObject* MakeObject() const \
{ return new Self(GetTimeSlicedGeometry(), GetPos()); } \
private: \
void operator=(const Self&); \
}
class PlaneGeometry;
class Geometry3D;
class BaseRenderer;
/**
* \brief Controls the selection of the slice the associated BaseRenderer
* will display
*
* A SliceNavigationController takes a Geometry3D as input world geometry
* (TODO what are the exact requirements?) and generates a TimeSlicedGeometry
* as output. The TimeSlicedGeometry holds a number of SlicedGeometry3Ds and
* these in turn hold a series of Geometry2Ds. One of these Geometry2Ds is
* selected as world geometry for the BaseRenderers associated to 2D views.
*
* The SliceNavigationController holds has Steppers (one for the slice, a
* second for the time step), which control the selection of a single
* Geometry2D from the TimeSlicedGeometry. SliceNavigationController generates
* ITK events to tell observers, like a BaseRenderer, when the selected slice
* or timestep changes.
*
* SliceNavigationControllers are registered as listeners to GlobalInteraction
* by the QmitkStdMultiWidget. In ExecuteAction, the controllers react to
* PositionEvents by setting the steppers to the slice which is nearest to the
* point of the PositionEvent.
*
* Example:
* \code
* // Initialization
* sliceCtrl = mitk::SliceNavigationController::New();
*
* // Tell the navigator the geometry to be sliced (with geometry a
* // Geometry3D::ConstPointer)
* sliceCtrl->SetInputWorldGeometry(geometry.GetPointer());
*
* // Tell the navigator in which direction it shall slice the data
* sliceCtrl->SetViewDirection(mitk::SliceNavigationController::Transversal);
*
* // Connect one or more BaseRenderer to this navigator, i.e.: events sent
* // by the navigator when stepping through the slices (e.g. by
* // sliceCtrl->GetSlice()->Next()) will be received by the BaseRenderer
* // (in this example only slice-changes, see also ConnectGeometryTimeEvent
* // and ConnectGeometryEvents.)
* sliceCtrl->ConnectGeometrySliceEvent(renderer.GetPointer());
*
* //create a world geometry and send the information to the connected renderer(s)
* sliceCtrl->Update();
* \endcode
*
*
* You can connect visible navigators to a SliceNavigationController, e.g., a
* QmitkSliderNavigator (for Qt):
*
* \code
* // Create the visible navigator (a slider with a spin-box)
* QmitkSliderNavigator* navigator =
* new QmitkSliderNavigator(parent, "slidernavigator");
*
* // Connect the navigator to the slice-stepper of the
* // SliceNavigationController. For initialization (position, mininal and
* // maximal values) the values of the SliceNavigationController are used.
* // Thus, accessing methods of a navigator is normally not necessary, since
* // everything can be set via the (Qt-independent) SliceNavigationController.
* // The QmitkStepperAdapter converts the Qt-signals to Qt-independent
* // itk-events.
* new QmitkStepperAdapter(navigator, sliceCtrl->GetSlice(), "navigatoradaptor");
* \endcode
*
* If you do not want that all renderwindows are updated when a new slice is
* selected, you can use a specific RenderingManager, which updates only those
* renderwindows that should be updated. This is sometimes useful when a 3D view
* does not need to be updated when the slices in some 2D views are changed.
* QmitkSliderNavigator (for Qt):
*
* \code
* // create a specific RenderingManager
* mitk::RenderingManager::Pointer myManager = mitk::RenderingManager::New();
*
* // tell the RenderingManager to update only renderwindow1 and renderwindow2
* myManager->AddRenderWindow(renderwindow1);
* myManager->AddRenderWindow(renderwindow2);
*
* // tell the SliceNavigationController of renderwindow1 and renderwindow2
* // to use the specific RenderingManager instead of the global one
* renderwindow1->GetSliceNavigationController()->SetRenderingManager(myManager);
* renderwindow2->GetSliceNavigationController()->SetRenderingManager(myManager);
* \endcode
*
* \todo implement for non-evenly-timed geometry!
* \ingroup NavigationControl
*/
class MITK_CORE_EXPORT SliceNavigationController : public BaseController
{
public:
mitkClassMacro(SliceNavigationController,BaseController);
itkNewMacro(Self);
mitkNewMacro1Param(Self, const char *);
/**
* \brief Possible view directions, \a Original will uses
* the Geometry2D instances in a SlicedGeometry3D provided
* as input world geometry (by SetInputWorldGeometry).
*/
enum ViewDirection{Transversal, Sagittal, Frontal, Original};
/**
* \brief Set the input world geometry out of which the
* geometries for slicing will be created.
*/
void SetInputWorldGeometry(const mitk::Geometry3D* geometry);
itkGetConstObjectMacro(InputWorldGeometry, mitk::Geometry3D);
/**
* \brief Access the created geometry
*/
itkGetConstObjectMacro(CreatedWorldGeometry, mitk::Geometry3D);
/**
* \brief Set the desired view directions
*
* \sa ViewDirection
* \sa Update(ViewDirection viewDirection, bool top = true,
* bool frontside = true, bool rotated = false)
*/
- itkSetMacro(ViewDirection, ViewDirection);
- itkGetMacro(ViewDirection, ViewDirection);
+ itkSetEnumMacro(ViewDirection, ViewDirection);
+ itkGetEnumMacro(ViewDirection, ViewDirection);
/**
* \brief Set the default view direction
*
* This is used to re-initialize the view direction of the SNC to the
* default value with SetViewDirectionToDefault()
*
* \sa ViewDirection
* \sa Update(ViewDirection viewDirection, bool top = true,
* bool frontside = true, bool rotated = false)
*/
- itkSetMacro(DefaultViewDirection, ViewDirection);
- itkGetMacro(DefaultViewDirection, ViewDirection);
+ itkSetEnumMacro(DefaultViewDirection, ViewDirection);
+ itkGetEnumMacro(DefaultViewDirection, ViewDirection);
virtual void SetViewDirectionToDefault();
/**
* \brief Do the actual creation and send it to the connected
* observers (renderers)
*
*/
virtual void Update();
/**
* \brief Extended version of Update, additionally allowing to
* specify the direction/orientation of the created geometry.
*
*/
virtual void Update(ViewDirection viewDirection, bool top = true,
bool frontside = true, bool rotated = false);
/**
* \brief Send the created geometry to the connected
* observers (renderers)
*
* Called by Update().
*/
virtual void SendCreatedWorldGeometry();
/**
* \brief Tell observers to re-read the currently selected 2D geometry
*
* Called by mitk::SlicesRotator during rotation.
*/
virtual void SendCreatedWorldGeometryUpdate();
/**
* \brief Send the currently selected slice to the connected
* observers (renderers)
*
* Called by Update().
*/
virtual void SendSlice();
/**
* \brief Send the currently selected time to the connected
* observers (renderers)
*
* Called by Update().
*/
virtual void SendTime();
/**
* \brief Set the RenderingManager to be used
*
* If \a NULL, the default RenderingManager will be used.
*/
itkSetObjectMacro(RenderingManager, RenderingManager);
mitk::RenderingManager* GetRenderingManager() const;
itkEventMacro( UpdateEvent, itk::AnyEvent );
class MITK_CORE_EXPORT TimeSlicedGeometryEvent : public itk::AnyEvent
{
public:
typedef TimeSlicedGeometryEvent Self;
typedef itk::AnyEvent Superclass;
TimeSlicedGeometryEvent(
TimeSlicedGeometry* aTimeSlicedGeometry, unsigned int aPos)
: m_TimeSlicedGeometry(aTimeSlicedGeometry), m_Pos(aPos)
{}
virtual ~TimeSlicedGeometryEvent()
{}
virtual const char * GetEventName() const
{ return "TimeSlicedGeometryEvent"; }
virtual bool CheckEvent(const ::itk::EventObject* e) const
{ return dynamic_cast<const Self*>(e); }
virtual ::itk::EventObject* MakeObject() const
{ return new Self(m_TimeSlicedGeometry, m_Pos); }
TimeSlicedGeometry* GetTimeSlicedGeometry() const
{ return m_TimeSlicedGeometry; }
unsigned int GetPos() const
{ return m_Pos; }
private:
TimeSlicedGeometry::Pointer m_TimeSlicedGeometry;
unsigned int m_Pos;
// TimeSlicedGeometryEvent(const Self&);
void operator=(const Self&); //just hide
};
mitkTimeSlicedGeometryEventMacro(
GeometrySendEvent,TimeSlicedGeometryEvent );
mitkTimeSlicedGeometryEventMacro(
GeometryUpdateEvent, TimeSlicedGeometryEvent );
mitkTimeSlicedGeometryEventMacro(
GeometryTimeEvent, TimeSlicedGeometryEvent );
mitkTimeSlicedGeometryEventMacro(
GeometrySliceEvent, TimeSlicedGeometryEvent );
template <typename T>
void ConnectGeometrySendEvent(T* receiver)
{
typedef typename itk::ReceptorMemberCommand<T>::Pointer
ReceptorMemberCommandPointer;
ReceptorMemberCommandPointer eventReceptorCommand =
itk::ReceptorMemberCommand<T>::New();
eventReceptorCommand->SetCallbackFunction(receiver, &T::SetGeometry);
AddObserver(GeometrySendEvent(NULL,0), eventReceptorCommand);
}
template <typename T>
void ConnectGeometryUpdateEvent(T* receiver)
{
typedef typename itk::ReceptorMemberCommand<T>::Pointer
ReceptorMemberCommandPointer;
ReceptorMemberCommandPointer eventReceptorCommand =
itk::ReceptorMemberCommand<T>::New();
eventReceptorCommand->SetCallbackFunction(receiver, &T::UpdateGeometry);
AddObserver(GeometryUpdateEvent(NULL,0), eventReceptorCommand);
}
template <typename T>
void ConnectGeometrySliceEvent(T* receiver, bool connectSendEvent=true)
{
typedef typename itk::ReceptorMemberCommand<T>::Pointer
ReceptorMemberCommandPointer;
ReceptorMemberCommandPointer eventReceptorCommand =
itk::ReceptorMemberCommand<T>::New();
eventReceptorCommand->SetCallbackFunction(receiver, &T::SetGeometrySlice);
AddObserver(GeometrySliceEvent(NULL,0), eventReceptorCommand);
if(connectSendEvent)
ConnectGeometrySendEvent(receiver);
}
template <typename T>
void ConnectGeometryTimeEvent(T* receiver, bool connectSendEvent=true)
{
typedef typename itk::ReceptorMemberCommand<T>::Pointer
ReceptorMemberCommandPointer;
ReceptorMemberCommandPointer eventReceptorCommand =
itk::ReceptorMemberCommand<T>::New();
eventReceptorCommand->SetCallbackFunction(receiver, &T::SetGeometryTime);
AddObserver(GeometryTimeEvent(NULL,0), eventReceptorCommand);
if(connectSendEvent)
ConnectGeometrySendEvent(receiver);
}
template <typename T>
void ConnectGeometryEvents(T* receiver)
{
//connect sendEvent only once
ConnectGeometrySliceEvent(receiver, false);
ConnectGeometryTimeEvent(receiver);
}
/**
* \brief To connect multiple SliceNavigationController, we can
* act as an observer ourselves: implemented interface
* \warning not implemented
*/
virtual void SetGeometry(const itk::EventObject & geometrySliceEvent);
/**
* \brief To connect multiple SliceNavigationController, we can
* act as an observer ourselves: implemented interface
*/
virtual void SetGeometrySlice(const itk::EventObject & geometrySliceEvent);
/**
* \brief To connect multiple SliceNavigationController, we can
* act as an observer ourselves: implemented interface
*/
virtual void SetGeometryTime(const itk::EventObject & geometryTimeEvent);
/** \brief Positions the SNC according to the specified point */
void SelectSliceByPoint( const mitk::Point3D &point );
/** \brief Returns the TimeSlicedGeometry created by the SNC. */
const mitk::TimeSlicedGeometry *GetCreatedWorldGeometry();
/** \brief Returns the Geometry3D of the currently selected time step. */
const mitk::Geometry3D *GetCurrentGeometry3D();
/** \brief Returns the currently selected Plane in the current
* Geometry3D (if existent).
*/
const mitk::PlaneGeometry *GetCurrentPlaneGeometry();
/** \brief Sets the BaseRenderer associated with this SNC (if any). While
* the BaseRenderer is not directly used by SNC, this is a convenience
* method to enable BaseRenderer access via the SNC. */
void SetRenderer( BaseRenderer *renderer );
/** \brief Gets the BaseRenderer associated with this SNC (if any). While
* the BaseRenderer is not directly used by SNC, this is a convenience
* method to enable BaseRenderer access via the SNC. Returns NULL if no
* BaseRenderer has been specified*/
BaseRenderer *GetRenderer() const;
/** \brief Re-orients the slice stack to include the plane specified by
* the given point an normal vector.
*/
void ReorientSlices(
const mitk::Point3D &point, const mitk::Vector3D &normal );
virtual bool ExecuteAction(
Action* action, mitk::StateEvent const* stateEvent);
void ExecuteOperation(Operation* operation);
/**
* \brief Feature option to lock planes during mouse interaction.
* This option flag disables the mouse event which causes the center
* cross to move near by.
*/
itkSetMacro(SliceLocked, bool);
itkGetMacro(SliceLocked, bool);
itkBooleanMacro(SliceLocked);
/**
* \brief Feature option to lock slice rotation.
*
* This option flag disables separately the rotation of a slice which is
* implemented in mitkSliceRotator.
*/
itkSetMacro(SliceRotationLocked, bool);
itkGetMacro(SliceRotationLocked, bool);
itkBooleanMacro(SliceRotationLocked);
/**
* \brief Adjusts the numerical range of the slice stepper according to
* the current geometry orientation of this SNC's SlicedGeometry.
*/
void AdjustSliceStepperRange();
protected:
SliceNavigationController(const char * type = NULL);
virtual ~SliceNavigationController();
template <class T>
static void buildstring( mitkIpPicDescriptor *pic, itk::Point<int, 3> p, std::string &s, T = 0)
{
std::string value;
std::stringstream stream;
stream.imbue(std::locale::classic());
stream<<s<<"; Pixelvalue: ";
if ( (p[0]>=0 && p[1] >=0 && p[2]>=0) && (unsigned int)p[0] < pic->n[0] && (unsigned int)p[1] < pic->n[1] && (unsigned int)p[2] < pic->n[2] )
{
if(pic->bpe!=24)
{
stream<<(((T*) pic->data)[ p[0] + p[1]*pic->n[0] + p[2]*pic->n[0]*pic->n[1] ]);
}
else
{
stream<<(((T*) pic->data)[p[0]*3 + 0 + p[1]*pic->n[0]*3 + p[2]*pic->n[0]*pic->n[1]*3 ]);
stream<<(((T*) pic->data)[p[0]*3 + 1 + p[1]*pic->n[0]*3 + p[2]*pic->n[0]*pic->n[1]*3 ]);
stream<<(((T*) pic->data)[p[0]*3 + 2 + p[1]*pic->n[0]*3 + p[2]*pic->n[0]*pic->n[1]*3 ]);
}
s = stream.str();
}
else
{
s+= "point out of data";
}
};
mitk::Geometry3D::ConstPointer m_InputWorldGeometry;
mitk::Geometry3D::Pointer m_ExtendedInputWorldGeometry;
mitk::TimeSlicedGeometry::Pointer m_CreatedWorldGeometry;
ViewDirection m_ViewDirection;
ViewDirection m_DefaultViewDirection;
mitk::RenderingManager::Pointer m_RenderingManager;
mitk::BaseRenderer *m_Renderer;
itkSetMacro(Top, bool);
itkGetMacro(Top, bool);
itkBooleanMacro(Top);
itkSetMacro(FrontSide, bool);
itkGetMacro(FrontSide, bool);
itkBooleanMacro(FrontSide);
itkSetMacro(Rotated, bool);
itkGetMacro(Rotated, bool);
itkBooleanMacro(Rotated);
bool m_Top;
bool m_FrontSide;
bool m_Rotated;
bool m_BlockUpdate;
bool m_SliceLocked;
bool m_SliceRotationLocked;
unsigned int m_OldPos;
};
} // namespace mitk
#endif /* SLICENAVIGATIONCONTROLLER_H_HEADER_INCLUDED_C1C55A2F */
diff --git a/Core/Code/DataManagement/mitkAbstractTransformGeometry.cpp b/Core/Code/DataManagement/mitkAbstractTransformGeometry.cpp
index 8d91e54c66..57b2bb883d 100644
--- a/Core/Code/DataManagement/mitkAbstractTransformGeometry.cpp
+++ b/Core/Code/DataManagement/mitkAbstractTransformGeometry.cpp
@@ -1,263 +1,263 @@
/*=========================================================================
Program: Medical Imaging & Interaction Toolkit
Language: C++
Date: $Date$
Version: $Revision$
Copyright (c) German Cancer Research Center, Division of Medical and
Biological Informatics. All rights reserved.
See MITKCopyright.txt or http://www.mitk.org/copyright.html for details.
This software is distributed WITHOUT ANY WARRANTY; without even
the implied warranty of MERCHANTABILITY or FITNESS FOR A PARTICULAR
PURPOSE. See the above copyright notices for more information.
=========================================================================*/
#include "mitkAbstractTransformGeometry.h"
#include <vtkAbstractTransform.h>
mitk::AbstractTransformGeometry::AbstractTransformGeometry() : m_Plane(NULL), m_FrameGeometry(NULL)
{
Initialize();
}
+mitk::AbstractTransformGeometry::AbstractTransformGeometry(const AbstractTransformGeometry& other) : Superclass(other)
+{
+ if(other.m_ParametricBoundingBox.IsNotNull())
+ {
+ this->SetParametricBounds(m_ParametricBoundingBox->GetBounds());
+ }
+
+ this->SetPlane(other.m_Plane);
+
+ this->SetFrameGeometry(other.m_FrameGeometry);
+}
+
+
mitk::AbstractTransformGeometry::~AbstractTransformGeometry()
{
}
void mitk::AbstractTransformGeometry::Initialize()
{
Superclass::Initialize();
m_ItkVtkAbstractTransform = itk::VtkAbstractTransform<ScalarType>::New();
}
vtkAbstractTransform* mitk::AbstractTransformGeometry::GetVtkAbstractTransform() const
{
return m_ItkVtkAbstractTransform->GetVtkAbstractTransform();
}
mitk::ScalarType mitk::AbstractTransformGeometry::GetParametricExtentInMM(int direction) const
{
if(m_Plane.IsNull())
{
itkExceptionMacro(<<"m_Plane is NULL.");
}
return m_Plane->GetExtentInMM(direction);
}
const mitk::Transform3D* mitk::AbstractTransformGeometry::GetParametricTransform() const
{
return m_ItkVtkAbstractTransform;
}
bool mitk::AbstractTransformGeometry::Project(const mitk::Point3D &pt3d_mm, mitk::Point3D &projectedPt3d_mm) const
{
assert(m_BoundingBox.IsNotNull());
mitk::Point2D pt2d_mm;
bool isInside;
isInside = Map(pt3d_mm, pt2d_mm);
Map(pt2d_mm, projectedPt3d_mm);
return isInside;
//Point3D pt3d_units;
//pt3d_units = m_ItkVtkAbstractTransform->BackTransform(pt3d_mm);
//pt3d_units[2] = 0;
//projectedPt3d_mm = m_ItkVtkAbstractTransform->TransformPoint(pt3d_units);
//return const_cast<BoundingBox*>(m_BoundingBox.GetPointer())->IsInside(pt3d_units);
}
bool mitk::AbstractTransformGeometry::Map(const mitk::Point3D &pt3d_mm, mitk::Point2D &pt2d_mm) const
{
assert((m_ItkVtkAbstractTransform.IsNotNull()) && (m_Plane.IsNotNull()));
Point3D pt3d_units;
pt3d_units = m_ItkVtkAbstractTransform->BackTransform(pt3d_mm);
return m_Plane->Map(pt3d_units, pt2d_mm);
}
void mitk::AbstractTransformGeometry::Map(const mitk::Point2D &pt2d_mm, mitk::Point3D &pt3d_mm) const
{
assert((m_ItkVtkAbstractTransform.IsNotNull()) && (m_Plane.IsNotNull()));
m_Plane->Map(pt2d_mm, pt3d_mm);
pt3d_mm = m_ItkVtkAbstractTransform->TransformPoint(pt3d_mm);
}
bool mitk::AbstractTransformGeometry::Project(const mitk::Point3D & atPt3d_mm, const mitk::Vector3D &vec3d_mm, mitk::Vector3D &projectedVec3d_mm) const
{
itkExceptionMacro("not implemented yet - replace GetIndexToWorldTransform by m_ItkVtkAbstractTransform->GetInverseVtkAbstractTransform()");
assert(m_BoundingBox.IsNotNull());
Vector3D vec3d_units;
vec3d_units = GetIndexToWorldTransform()->BackTransform(vec3d_mm);
vec3d_units[2] = 0;
projectedVec3d_mm = GetIndexToWorldTransform()->TransformVector(vec3d_units);
Point3D pt3d_units;
pt3d_units = GetIndexToWorldTransform()->BackTransformPoint(atPt3d_mm);
return const_cast<BoundingBox*>(m_BoundingBox.GetPointer())->IsInside(pt3d_units);
}
bool mitk::AbstractTransformGeometry::Map(const mitk::Point3D & atPt3d_mm, const mitk::Vector3D &vec3d_mm, mitk::Vector2D &vec2d_mm) const
{
assert((m_ItkVtkAbstractTransform.IsNotNull()) && (m_Plane.IsNotNull()));
float vtkpt[3], vtkvec[3];
itk2vtk(atPt3d_mm, vtkpt);
itk2vtk(vec3d_mm, vtkvec);
m_ItkVtkAbstractTransform->GetInverseVtkAbstractTransform()->TransformVectorAtPoint(vtkpt, vtkvec, vtkvec);
mitk::Vector3D vec3d_units;
vtk2itk(vtkvec, vec3d_units);
return m_Plane->Map(atPt3d_mm, vec3d_units, vec2d_mm);
}
void mitk::AbstractTransformGeometry::Map(const mitk::Point2D & atPt2d_mm, const mitk::Vector2D &vec2d_mm, mitk::Vector3D &vec3d_mm) const
{
m_Plane->Map(atPt2d_mm, vec2d_mm, vec3d_mm);
Point3D atPt3d_mm;
Map(atPt2d_mm, atPt3d_mm);
float vtkpt[3], vtkvec[3];
itk2vtk(atPt3d_mm, vtkpt);
itk2vtk(vec3d_mm, vtkvec);
m_ItkVtkAbstractTransform->GetVtkAbstractTransform()->TransformVectorAtPoint(vtkpt, vtkvec, vtkvec);
vtk2itk(vtkvec, vec3d_mm);
}
void mitk::AbstractTransformGeometry::IndexToWorld(const mitk::Point2D &pt_units, mitk::Point2D &pt_mm) const
{
m_Plane->IndexToWorld(pt_units, pt_mm);
}
void mitk::AbstractTransformGeometry::WorldToIndex(const mitk::Point2D &pt_mm, mitk::Point2D &pt_units) const
{
m_Plane->WorldToIndex(pt_mm, pt_units);
}
void mitk::AbstractTransformGeometry::IndexToWorld(const mitk::Point2D &atPt2d_units, const mitk::Vector2D &vec_units, mitk::Vector2D &vec_mm) const
{
MITK_WARN<<"Warning! Call of the deprecated function AbstractTransformGeometry::IndexToWorld(point, vec, vec). Use AbstractTransformGeometry::IndexToWorld(vec, vec) instead!";
this->IndexToWorld(vec_units, vec_mm);
}
void mitk::AbstractTransformGeometry::IndexToWorld(const mitk::Vector2D &vec_units, mitk::Vector2D &vec_mm) const
{
m_Plane->IndexToWorld(vec_units, vec_mm);
}
void mitk::AbstractTransformGeometry::WorldToIndex(const mitk::Point2D &atPt2d_mm, const mitk::Vector2D &vec_mm, mitk::Vector2D &vec_units) const
{
MITK_WARN<<"Warning! Call of the deprecated function AbstractTransformGeometry::WorldToIndex(point, vec, vec). Use AbstractTransformGeometry::WorldToIndex(vec, vec) instead!";
this->WorldToIndex(vec_mm, vec_units);
}
void mitk::AbstractTransformGeometry::WorldToIndex(const mitk::Vector2D &vec_mm, mitk::Vector2D &vec_units) const
{
m_Plane->WorldToIndex(vec_mm, vec_units);
}
bool mitk::AbstractTransformGeometry::IsAbove(const mitk::Point3D& pt3d_mm) const
{
assert((m_ItkVtkAbstractTransform.IsNotNull()) && (m_Plane.IsNotNull()));
Point3D pt3d_ParametricWorld;
pt3d_ParametricWorld = m_ItkVtkAbstractTransform->BackTransform(pt3d_mm);
Point3D pt3d_ParametricUnits;
((Geometry3D*)m_Plane)->WorldToIndex(pt3d_ParametricWorld, pt3d_ParametricUnits);
return (pt3d_ParametricUnits[2] > m_ParametricBoundingBox->GetBounds()[4]);
}
void mitk::AbstractTransformGeometry::SetVtkAbstractTransform(vtkAbstractTransform* aVtkAbstractTransform)
{
m_ItkVtkAbstractTransform->SetVtkAbstractTransform(aVtkAbstractTransform);
}
void mitk::AbstractTransformGeometry::SetPlane(const mitk::PlaneGeometry* aPlane)
{
if(aPlane!=NULL)
{
m_Plane = static_cast<mitk::PlaneGeometry*>(aPlane->Clone().GetPointer());
BoundingBox::BoundsArrayType b=m_Plane->GetBoundingBox()->GetBounds();
SetParametricBounds(b);
CalculateFrameGeometry();
}
else
{
if(m_Plane.IsNull())
return;
m_Plane=NULL;
}
Modified();
}
void mitk::AbstractTransformGeometry::CalculateFrameGeometry()
{
if((m_Plane.IsNull()) || (m_FrameGeometry.IsNotNull()))
return;
//@warning affine-transforms and bounding-box should be set by specific sub-classes!
SetBounds(m_Plane->GetBoundingBox()->GetBounds());
}
void mitk::AbstractTransformGeometry::SetFrameGeometry(const mitk::Geometry3D* frameGeometry)
{
if((frameGeometry != NULL) && (frameGeometry->IsValid()))
{
m_FrameGeometry = static_cast<mitk::Geometry3D*>(frameGeometry->Clone().GetPointer());
SetIndexToWorldTransform(m_FrameGeometry->GetIndexToWorldTransform());
SetBounds(m_FrameGeometry->GetBounds());
}
else
{
m_FrameGeometry = NULL;
}
}
unsigned long mitk::AbstractTransformGeometry::GetMTime() const
{
if(Superclass::GetMTime()<m_ItkVtkAbstractTransform->GetMTime())
return m_ItkVtkAbstractTransform->GetMTime();
return Superclass::GetMTime();
}
void mitk::AbstractTransformGeometry::SetOversampling(float oversampling)
{
if(m_Plane.IsNull())
{
itkExceptionMacro(<< "m_Plane is not set.");
}
mitk::BoundingBox::BoundsArrayType bounds = m_Plane->GetBounds();
bounds[1]*=oversampling; bounds[3]*=oversampling; bounds[5]*=oversampling;
SetParametricBounds(bounds);
}
mitk::AffineGeometryFrame3D::Pointer mitk::AbstractTransformGeometry::Clone() const
{
- Self::Pointer newGeometry = Self::New();
- newGeometry->Initialize();
- InitializeGeometry(newGeometry);
+ Self::Pointer newGeometry = new AbstractTransformGeometry(*this);
+ newGeometry->UnRegister();
return newGeometry.GetPointer();
}
-
-void mitk::AbstractTransformGeometry::InitializeGeometry(Self * newGeometry) const
-{
- Superclass::InitializeGeometry(newGeometry);
-
- if(m_ParametricBoundingBox.IsNotNull())
- newGeometry->SetParametricBounds(m_ParametricBoundingBox->GetBounds());
-
- newGeometry->SetPlane(m_Plane);
-
- newGeometry->SetFrameGeometry(m_FrameGeometry);
-}
diff --git a/Core/Code/DataManagement/mitkAbstractTransformGeometry.h b/Core/Code/DataManagement/mitkAbstractTransformGeometry.h
index 195b80aafe..3a409d5bfb 100644
--- a/Core/Code/DataManagement/mitkAbstractTransformGeometry.h
+++ b/Core/Code/DataManagement/mitkAbstractTransformGeometry.h
@@ -1,180 +1,180 @@
/*=========================================================================
Program: Medical Imaging & Interaction Toolkit
Language: C++
Date: $Date$
Version: $Revision$
Copyright (c) German Cancer Research Center, Division of Medical and
Biological Informatics. All rights reserved.
See MITKCopyright.txt or http://www.mitk.org/copyright.html for details.
This software is distributed WITHOUT ANY WARRANTY; without even
the implied warranty of MERCHANTABILITY or FITNESS FOR A PARTICULAR
PURPOSE. See the above copyright notices for more information.
=========================================================================*/
#ifndef MITKVTKABSTRACTTRANSFORMPLANEGEOMETRY_H_HEADER_INCLUDED_C1C68A2C
#define MITKVTKABSTRACTTRANSFORMPLANEGEOMETRY_H_HEADER_INCLUDED_C1C68A2C
#include "mitkCommon.h"
#include "mitkGeometry2D.h"
#include "mitkPlaneGeometry.h"
#include "itkVtkAbstractTransform.h"
class vtkAbstractTransform;
namespace mitk {
//##Documentation
//## @brief Describes a geometry defined by an vtkAbstractTransform and a plane
//##
//## vtkAbstractTransform is the most general transform in vtk (superclass for
//## all vtk geometric transformations). It defines an arbitrary 3D transformation,
//## i.e., a transformation of 3D space into 3D space. In contrast,
//## AbstractTransformGeometry (since it is a subclass of Geometry2D) describes a
//## 2D manifold in 3D space. The 2D manifold is defined as the manifold that results
//## from transforming a rectangle (given in m_Plane as a PlaneGeometry) by the
//## vtkAbstractTransform (given in m_VtkAbstractTransform).
//## The PlaneGeometry m_Plane is used to define the parameter space. 2D coordinates are
//## first mapped by the PlaneGeometry and the resulting 3D coordinates are put into
//## the vtkAbstractTransform.
//## @note This class is the superclass of concrete geometries. Since there is no
//## write access to the vtkAbstractTransform and m_Plane, this class is somehow
//## abstract. For full write access from extern, use ExternAbstractTransformGeometry.
//## @note The bounds of the PlaneGeometry are used as the parametric bounds.
//## @sa ExternAbstractTransformGeometry
//## @ingroup Geometry
class MITK_CORE_EXPORT AbstractTransformGeometry : public Geometry2D
{
public:
mitkClassMacro(AbstractTransformGeometry, Geometry2D);
itkNewMacro(Self);
//##Documentation
//## @brief Get the vtkAbstractTransform (stored in m_VtkAbstractTransform)
virtual vtkAbstractTransform* GetVtkAbstractTransform() const;
virtual unsigned long GetMTime() const;
//##Documentation
//## @brief Get the rectangular area that is used for transformation by
//## m_VtkAbstractTransform and therewith defines the 2D manifold described by
//## AbstractTransformGeometry
itkGetConstObjectMacro(Plane, PlaneGeometry);
virtual bool Project(const mitk::Point3D &pt3d_mm, mitk::Point3D &projectedPt3d_mm) const;
virtual bool Map(const mitk::Point3D &pt3d_mm, mitk::Point2D &pt2d_mm) const;
virtual void Map(const mitk::Point2D &pt2d_mm, mitk::Point3D &pt3d_mm) const;
virtual bool Project(const mitk::Point3D & atPt3d_mm, const mitk::Vector3D &vec3d_mm, mitk::Vector3D &projectedVec3d_mm) const;
virtual bool Map(const mitk::Point3D & atPt3d_mm, const mitk::Vector3D &vec3d_mm, mitk::Vector2D &vec2d_mm) const;
virtual void Map(const mitk::Point2D & atPt2d_mm, const mitk::Vector2D &vec2d_mm, mitk::Vector3D &vec3d_mm) const;
virtual void IndexToWorld(const mitk::Point2D &pt_units, mitk::Point2D &pt_mm) const;
virtual void WorldToIndex(const mitk::Point2D &pt_mm, mitk::Point2D &pt_units) const;
//##Documentation
//## @brief Convert (continuous or discrete) index coordinates of a \em vector
//## \a vec_units to world coordinates (in mm)
//## @deprecated First parameter (Point2D) is not used. If possible, please use void IndexToWorld(const mitk::Vector2D& vec_units, mitk::Vector2D& vec_mm) const.
//## For further information about coordinates types, please see the Geometry documentation
virtual void IndexToWorld(const mitk::Point2D &atPt2d_units, const mitk::Vector2D &vec_units, mitk::Vector2D &vec_mm) const;
//##Documentation
//## @brief Convert (continuous or discrete) index coordinates of a \em vector
//## \a vec_units to world coordinates (in mm)
//## For further information about coordinates types, please see the Geometry documentation
virtual void IndexToWorld(const mitk::Vector2D &vec_units, mitk::Vector2D &vec_mm) const;
//##Documentation
//## @brief Convert world coordinates (in mm) of a \em vector
//## \a vec_mm to (continuous!) index coordinates.
//## @deprecated First parameter (Point2D) is not used. If possible, please use void WorldToIndex(const mitk::Vector2D& vec_mm, mitk::Vector2D& vec_units) const.
//## For further information about coordinates types, please see the Geometry documentation
virtual void WorldToIndex(const mitk::Point2D &atPt2d_mm, const mitk::Vector2D &vec_mm, mitk::Vector2D &vec_units) const;
//##Documentation
//## @brief Convert world coordinates (in mm) of a \em vector
//## \a vec_mm to (continuous!) index coordinates.
//## For further information about coordinates types, please see the Geometry documentation
virtual void WorldToIndex(const mitk::Vector2D &vec_mm, mitk::Vector2D &vec_units) const;
virtual bool IsAbove(const Point3D& pt3d_mm) const;
virtual mitk::ScalarType GetParametricExtentInMM(int direction) const;
virtual const Transform3D* GetParametricTransform() const;
//##Documentation
//## @brief Change the parametric bounds to @a oversampling times
//## the bounds of m_Plane.
//##
//## The change is done once (immediately). Later changes of the bounds
//## of m_Plane will not influence the parametric bounds. (Consequently,
//## there is no method to get the oversampling.)
virtual void SetOversampling(float oversampling);
virtual void Initialize();
//##Documentation
//## @brief Calculates the standard part of a Geometry3D
//## (IndexToWorldTransform and bounding box) around the
//## curved geometry. Has to be implemented in subclasses.
//##
//## \sa SetFrameGeometry
virtual void CalculateFrameGeometry();
//##Documentation
//## @brief Set the frame geometry which is used as the standard
//## part of an Geometry3D (IndexToWorldTransform and bounding box)
//##
//## Maybe used as a hint within which the interpolation shall occur
//## by concrete sub-classes.
//## \sa CalculateFrameGeometry
virtual void SetFrameGeometry(const mitk::Geometry3D* frameGeometry);
virtual AffineGeometryFrame3D::Pointer Clone() const;
protected:
AbstractTransformGeometry();
+ AbstractTransformGeometry(const AbstractTransformGeometry& other);
+
virtual ~AbstractTransformGeometry();
-
- void InitializeGeometry(Self * newGeometry) const;
-
+
//##Documentation
//## @brief Set the vtkAbstractTransform (stored in m_VtkAbstractTransform)
//##
//## Protected in this class, made public in ExternAbstractTransformGeometry.
virtual void SetVtkAbstractTransform(vtkAbstractTransform* aVtkAbstractTransform);
//##Documentation
//## @brief Set the rectangular area that is used for transformation by
//## m_VtkAbstractTransform and therewith defines the 2D manifold described by
//## ExternAbstractTransformGeometry
//##
//## Protected in this class, made public in ExternAbstractTransformGeometry.
//## @note The bounds of the PlaneGeometry are used as the parametric bounds.
//## @note The PlaneGeometry is cloned, @em not linked/referenced.
virtual void SetPlane(const mitk::PlaneGeometry* aPlane);
//##Documentation
//## @brief The rectangular area that is used for transformation by
//## m_VtkAbstractTransform and therewith defines the 2D manifold described by
//## AbstractTransformGeometry.
mitk::PlaneGeometry::Pointer m_Plane;
itk::VtkAbstractTransform<ScalarType>::Pointer m_ItkVtkAbstractTransform;
mitk::Geometry3D::Pointer m_FrameGeometry;
};
} // namespace mitk
#endif /* MITKVTKABSTRACTTRANSFORMPLANEGEOMETRY_H_HEADER_INCLUDED_C1C68A2C */
diff --git a/Core/Code/DataManagement/mitkAnnotationProperty.h b/Core/Code/DataManagement/mitkAnnotationProperty.h
index 335f812849..d87976acd3 100644
--- a/Core/Code/DataManagement/mitkAnnotationProperty.h
+++ b/Core/Code/DataManagement/mitkAnnotationProperty.h
@@ -1,78 +1,79 @@
/*=========================================================================
Program: Medical Imaging & Interaction Toolkit
Language: C++
Date: $Date: 2008-04-14 19:45:53 +0200 (Mo, 14 Apr 2008) $
Version: $Revision: 14081 $
Copyright (c) German Cancer Research Center, Division of Medical and
Biological Informatics. All rights reserved.
See MITKCopyright.txt or http://www.mitk.org/copyright.html for details.
This software is distributed WITHOUT ANY WARRANTY; without even
the implied warranty of MERCHANTABILITY or FITNESS FOR A PARTICULAR
PURPOSE. See the above copyright notices for more information.
=========================================================================*/
#ifndef MITKANNOTATIONPROPERTY_H_HEADER_INCLUDED
#define MITKANNOTATIONPROPERTY_H_HEADER_INCLUDED
#include "mitkCommon.h"
#include "mitkBaseProperty.h"
#include "mitkVector.h"
#include <itkConfigure.h>
#include <string>
namespace mitk {
/**
* \brief Property for annotations
* \ingroup DataManagement
*/
class MITK_CORE_EXPORT AnnotationProperty : public BaseProperty
{
public:
mitkClassMacro(AnnotationProperty, BaseProperty);
typedef std::string ValueType;
itkNewMacro( AnnotationProperty );
mitkNewMacro2Param( AnnotationProperty,
const char *, const Point3D & );
mitkNewMacro2Param( AnnotationProperty,
const std::string &, const Point3D & );
mitkNewMacro4Param( AnnotationProperty,
const char *, ScalarType, ScalarType, ScalarType );
mitkNewMacro4Param( AnnotationProperty,
const std::string &, ScalarType, ScalarType, ScalarType );
itkGetStringMacro( Label );
itkSetStringMacro( Label );
const Point3D &GetPosition() const;
void SetPosition( const Point3D &position );
virtual bool operator==(const BaseProperty& property ) const;
virtual std::string GetValueAsString() const;
+ virtual BaseProperty& operator=(const BaseProperty& other) { return Superclass::operator=(other); } \
protected:
std::string m_Label;
Point3D m_Position;
AnnotationProperty();
AnnotationProperty( const char *label, const Point3D &position );
AnnotationProperty( const std::string &label, const Point3D &position );
AnnotationProperty( const char *label, ScalarType x, ScalarType y, ScalarType z );
AnnotationProperty( const std::string &label, ScalarType x, ScalarType y, ScalarType z );
};
} // namespace mitk
#endif /* MITKANNOTATIONPROPERTY_H_HEADER_INCLUDED */
diff --git a/Core/Code/DataManagement/mitkBaseData.cpp b/Core/Code/DataManagement/mitkBaseData.cpp
index 099bbea020..ea8a723463 100644
--- a/Core/Code/DataManagement/mitkBaseData.cpp
+++ b/Core/Code/DataManagement/mitkBaseData.cpp
@@ -1,367 +1,364 @@
/*=========================================================================
Program: Medical Imaging & Interaction Toolkit
Language: C++
Date: $Date$
Version: $Revision$
Copyright (c) German Cancer Research Center, Division of Medical and
Biological Informatics. All rights reserved.
See MITKCopyright.txt or http://www.mitk.org/copyright.html for details.
This software is distributed WITHOUT ANY WARRANTY; without even
the implied warranty of MERCHANTABILITY or FITNESS FOR A PARTICULAR
PURPOSE. See the above copyright notices for more information.
=========================================================================*/
#include "mitkBaseData.h"
#include <itkObjectFactoryBase.h>
#include <itkSmartPointerForwardReference.txx>
template class MITK_CORE_EXPORT itk::SmartPointerForwardReference<mitk::BaseProcess>;
#define MITK_WEAKPOINTER_PROBLEM_WORKAROUND_ENABLED
mitk::BaseData::BaseData() :
m_RequestedRegionInitialized(false), m_SmartSourcePointer(NULL),
m_SourceOutputIndexDuplicate(0), m_Initialized(true),
m_Unregistering(false), m_CalculatingExternalReferenceCount(false),
m_ExternalReferenceCount(-1)
{
m_TimeSlicedGeometry = TimeSlicedGeometry::New();
m_PropertyList = PropertyList::New();
}
mitk::BaseData::BaseData( const BaseData &other ):
m_RequestedRegionInitialized(other.m_RequestedRegionInitialized),
m_SmartSourcePointer(other.m_SmartSourcePointer),
m_SourceOutputIndexDuplicate(other.m_SourceOutputIndexDuplicate),
m_Initialized(other.m_Initialized), m_Unregistering(other.m_Unregistering),
m_CalculatingExternalReferenceCount(other.m_CalculatingExternalReferenceCount),
m_ExternalReferenceCount(other.m_ExternalReferenceCount)
{
m_TimeSlicedGeometry = dynamic_cast<mitk::TimeSlicedGeometry*>(other.m_TimeSlicedGeometry->Clone().GetPointer());
m_PropertyList = other.m_PropertyList->Clone();
}
mitk::BaseData::~BaseData()
{
m_SmartSourcePointer = NULL;
}
void mitk::BaseData::InitializeTimeSlicedGeometry(unsigned int timeSteps)
{
mitk::TimeSlicedGeometry::Pointer timeGeometry = this->GetTimeSlicedGeometry();
mitk::Geometry3D::Pointer g3d = mitk::Geometry3D::New();
g3d->Initialize();
if ( timeSteps > 1 )
{
mitk::ScalarType timeBounds[] = {0.0, 1.0};
g3d->SetTimeBounds( timeBounds );
}
// The geometry is propagated automatically to the other items,
// if EvenlyTimed is true...
timeGeometry->InitializeEvenlyTimed( g3d.GetPointer(), timeSteps );
}
void mitk::BaseData::UpdateOutputInformation()
{
if ( this->GetSource() )
{
this->GetSource()->UpdateOutputInformation();
}
if(m_TimeSlicedGeometry.IsNotNull())
m_TimeSlicedGeometry->UpdateInformation();
}
const mitk::TimeSlicedGeometry* mitk::BaseData::GetUpdatedTimeSlicedGeometry()
{
SetRequestedRegionToLargestPossibleRegion();
UpdateOutputInformation();
return GetTimeSlicedGeometry();
}
void mitk::BaseData::Expand( unsigned int timeSteps )
{
if( m_TimeSlicedGeometry.IsNotNull() )
m_TimeSlicedGeometry->ExpandToNumberOfTimeSteps( timeSteps );
}
const mitk::Geometry3D* mitk::BaseData::GetUpdatedGeometry(int t)
{
SetRequestedRegionToLargestPossibleRegion();
UpdateOutputInformation();
return GetGeometry(t);
}
void mitk::BaseData::SetGeometry(Geometry3D* aGeometry3D)
{
if(aGeometry3D!=NULL)
{
TimeSlicedGeometry::Pointer timeSlicedGeometry = dynamic_cast<TimeSlicedGeometry*>(aGeometry3D);
if ( timeSlicedGeometry.IsNotNull() )
m_TimeSlicedGeometry = timeSlicedGeometry;
else
{
timeSlicedGeometry = TimeSlicedGeometry::New();
m_TimeSlicedGeometry = timeSlicedGeometry;
timeSlicedGeometry->InitializeEvenlyTimed(aGeometry3D, 1);
}
Modified();
}
else if( m_TimeSlicedGeometry.IsNotNull() )
{
m_TimeSlicedGeometry = NULL;
Modified();
}
return;
}
-void mitk::BaseData::SetGeometry(Geometry3D* aGeometry3D, unsigned int time)
-{
- if ( m_TimeSlicedGeometry )
- m_TimeSlicedGeometry->SetGeometry3D(aGeometry3D, time);
-}
-
void mitk::BaseData::SetClonedGeometry(const Geometry3D* aGeometry3D)
{
SetGeometry(static_cast<mitk::Geometry3D*>(aGeometry3D->Clone().GetPointer()));
}
void mitk::BaseData::SetClonedGeometry(const Geometry3D* aGeometry3D, unsigned int time)
{
- SetGeometry(static_cast<mitk::Geometry3D*>(aGeometry3D->Clone().GetPointer()), time);
+ if (m_TimeSlicedGeometry)
+ {
+ m_TimeSlicedGeometry->SetGeometry3D(static_cast<mitk::Geometry3D*>(aGeometry3D->Clone().GetPointer()), time);
+ }
}
-bool mitk::BaseData::IsEmpty(unsigned int) const
+bool mitk::BaseData::IsEmptyTimeStep(unsigned int) const
{
return IsInitialized() == false;
}
bool mitk::BaseData::IsEmpty() const
{
if(IsInitialized() == false)
return true;
const TimeSlicedGeometry* timeGeometry = const_cast<BaseData*>(this)->GetUpdatedTimeSlicedGeometry();
if(timeGeometry == NULL)
return true;
unsigned int timeSteps = timeGeometry->GetTimeSteps();
for ( unsigned int t = 0 ; t < timeSteps ; ++t )
{
- if(IsEmpty(t) == false)
+ if(IsEmptyTimeStep(t) == false)
return false;
}
return true;
}
itk::SmartPointerForwardReference<mitk::BaseProcess> mitk::BaseData::GetSource() const
{
return static_cast<mitk::BaseProcess*>(Superclass::GetSource().GetPointer());
}
int mitk::BaseData::GetExternalReferenceCount() const
{
if(m_CalculatingExternalReferenceCount==false) //this is only needed because a smart-pointer to m_Outputs (private!!) must be created by calling GetOutputs.
{
m_CalculatingExternalReferenceCount = true;
m_ExternalReferenceCount = -1;
int realReferenceCount = GetReferenceCount();
if(GetSource()==NULL)
{
m_ExternalReferenceCount = realReferenceCount;
m_CalculatingExternalReferenceCount = false;
return m_ExternalReferenceCount;
}
mitk::BaseProcess::DataObjectPointerArray outputs = m_SmartSourcePointer->GetOutputs();
unsigned int idx;
for (idx = 0; idx < outputs.size(); ++idx)
{
//references of outputs that are not referenced from someone else (reference additional to the reference from this BaseProcess object) are interpreted as non-existent
if(outputs[idx]==this)
--realReferenceCount;
}
m_ExternalReferenceCount = realReferenceCount;
if(m_ExternalReferenceCount<0)
m_ExternalReferenceCount=0;
m_CalculatingExternalReferenceCount = false;
}
else
return -1;
return m_ExternalReferenceCount;
}
void mitk::BaseData::UnRegister() const
{
#ifdef MITK_WEAKPOINTER_PROBLEM_WORKAROUND_ENABLED
if(GetReferenceCount()>1)
{
Superclass::UnRegister();
if((m_Unregistering==false) && (m_SmartSourcePointer.IsNotNull()))
{
m_Unregistering=true;
// the order of the following boolean statement is important:
// this->GetSource() returns a SmartPointerForwardReference,
// which increases and afterwards decreases the reference count,
// which may result in an ExternalReferenceCount of 0, causing
// BaseProcess::UnRegister() to destroy us (also we already
// about to do that).
if((this->m_SmartSourcePointer->GetExternalReferenceCount()==0) || (this->GetSource()==NULL))
m_SmartSourcePointer=NULL; // now the reference count is zero and this object has been destroyed; thus nothing may be done after this line!!
else
m_Unregistering=false;
}
}
else
#endif
Superclass::UnRegister(); // now the reference count is zero and this object has been destroyed; thus nothing may be done after this line!!
}
void mitk::BaseData::ConnectSource(itk::ProcessObject *arg, unsigned int idx) const
{
#ifdef MITK_WEAKPOINTER_PROBLEM_WORKAROUND_ENABLED
itkDebugMacro( "connecting source " << arg
<< ", source output index " << idx);
if ( GetSource() != arg || m_SourceOutputIndexDuplicate != idx)
{
m_SmartSourcePointer = dynamic_cast<mitk::BaseProcess*>(arg);
m_SourceOutputIndexDuplicate = idx;
Modified();
}
#endif
}
mitk::PropertyList::Pointer mitk::BaseData::GetPropertyList() const
{
return m_PropertyList;
}
mitk::BaseProperty::Pointer mitk::BaseData::GetProperty(const char *propertyKey) const
{
return m_PropertyList->GetProperty(propertyKey);
}
void mitk::BaseData::SetProperty(const char *propertyKey,
BaseProperty* propertyValue)
{
m_PropertyList->SetProperty(propertyKey, propertyValue);
}
void mitk::BaseData::SetPropertyList(PropertyList *pList)
{
m_PropertyList = pList;
}
void mitk::BaseData::SetOrigin(const mitk::Point3D& origin)
{
mitk::TimeSlicedGeometry* timeSlicedGeometry = GetTimeSlicedGeometry();
assert(timeSlicedGeometry!=NULL);
mitk::Geometry3D* geometry;
unsigned int steps = timeSlicedGeometry->GetTimeSteps();
for(unsigned int timestep = 0; timestep < steps; ++timestep)
{
geometry = GetGeometry(timestep);
if(geometry != NULL)
{
geometry->SetOrigin(origin);
}
if(GetTimeSlicedGeometry()->GetEvenlyTimed())
{
GetTimeSlicedGeometry()->InitializeEvenlyTimed(geometry, steps);
break;
}
}
}
unsigned long mitk::BaseData::GetMTime() const
{
unsigned long time = Superclass::GetMTime();
if(m_TimeSlicedGeometry.IsNotNull())
{
if((time < m_TimeSlicedGeometry->GetMTime()))
{
Modified();
return Superclass::GetMTime();
}
//unsigned long geometryTime = m_TimeSlicedGeometry->GetMTime();
//if(time < geometryTime)
//{
// return geometryTime;
//}
}
return time;
}
void mitk::BaseData::CopyInformation( const itk::DataObject* data )
{
const Self* bd = dynamic_cast<const Self*>(data);
if (bd != NULL)
{
m_TimeSlicedGeometry = dynamic_cast<TimeSlicedGeometry*>(bd->GetTimeSlicedGeometry()->Clone().GetPointer());
m_PropertyList = bd->GetPropertyList()->Clone();
}
else
{
// pointer could not be cast back down; this can be the case if your filters input
// and output objects differ in type; then you have to write your own GenerateOutputInformation method
itkExceptionMacro(<< "mitk::BaseData::CopyInformation() cannot cast "
<< typeid(data).name() << " to "
<< typeid(Self*).name() );
}
}
bool mitk::BaseData::IsInitialized() const
{
return m_Initialized;
}
void mitk::BaseData::Clear()
{
this->ClearData();
this->InitializeEmpty();
}
void mitk::BaseData::ClearData()
{
if(m_Initialized)
{
ReleaseData();
m_Initialized = false;
}
}
void mitk::BaseData::ExecuteOperation(mitk::Operation* /*operation*/)
{
//empty by default. override if needed!
}
void mitk::BaseData::PrintSelf(std::ostream& os, itk::Indent indent) const
{
os << std::endl;
os << indent << " TimeSlicedGeometry: ";
if(GetTimeSlicedGeometry() == NULL)
os << "NULL" << std::endl;
else
GetTimeSlicedGeometry()->Print(os, indent);
}
diff --git a/Core/Code/DataManagement/mitkBaseData.h b/Core/Code/DataManagement/mitkBaseData.h
index 163583273a..937f7a4712 100644
--- a/Core/Code/DataManagement/mitkBaseData.h
+++ b/Core/Code/DataManagement/mitkBaseData.h
@@ -1,396 +1,388 @@
/*=========================================================================
Program: Medical Imaging & Interaction Toolkit
Language: C++
Date: $Date$
Version: $Revision$
Copyright (c) German Cancer Research Center, Division of Medical and
Biological Informatics. All rights reserved.
See MITKCopyright.txt or http://www.mitk.org/copyright.html for details.
This software is distributed WITHOUT ANY WARRANTY; without even
the implied warranty of MERCHANTABILITY or FITNESS FOR A PARTICULAR
PURPOSE. See the above copyright notices for more information.
=========================================================================*/
#ifndef BASEDATA_H_HEADER_INCLUDED_C1EBB6FA
#define BASEDATA_H_HEADER_INCLUDED_C1EBB6FA
#include <itkDataObject.h>
#include "mitkBaseProcess.h"
#include "mitkTimeSlicedGeometry.h"
#include "mitkCommon.h"
#include "mitkOperationActor.h"
#include "mitkPropertyList.h"
namespace mitk {
class BaseProcess;
//##Documentation
//## @brief Base of all data objects
//##
//## Base of all data objects, e.g., images, contours, surfaces etc. Inherits
//## from itk::DataObject and thus can be included in a pipeline.
//## Inherits also from OperationActor and can be used as a destination for Undo
//## @ingroup Data
class MITK_CORE_EXPORT BaseData : public itk::DataObject, public OperationActor
{
public:
mitkClassMacro(BaseData,itk::DataObject);
//##Documentation
//## @brief Return the TimeSlicedGeometry of the data as const pointer.
//##
//## \warning No update will be called. Use GetUpdatedGeometry() if you cannot
//## be sure that the geometry is up-to-date.
//##
//## Normally used in GenerateOutputInformation of subclasses of BaseProcess.
const mitk::TimeSlicedGeometry* GetTimeSlicedGeometry() const
{
return m_TimeSlicedGeometry.GetPointer();
}
//##Documentation
//## @brief Return the TimeSlicedGeometry of the data as pointer.
//##
//## \warning No update will be called. Use GetUpdatedGeometry() if you cannot
//## be sure that the geometry is up-to-date.
//##
//## Normally used in GenerateOutputInformation of subclasses of BaseProcess.
mitk::TimeSlicedGeometry* GetTimeSlicedGeometry()
{
return m_TimeSlicedGeometry.GetPointer();
}
//##Documentation
//## @brief Return the Geometry3D of the data.
//##
//## The method does not simply return the value of the m_TimeSlicedGeometry
//## member. Before doing this, it makes sure that the TimeSlicedGeometry
//## is up-to-date (by setting the update extent to largest possible and
//## calling UpdateOutputInformation).
const mitk::TimeSlicedGeometry* GetUpdatedTimeSlicedGeometry();
//##Documentation
//## @brief Expands the TimeSlicedGeometry to a number of TimeSteps.
//##
//## The method expands the TimeSlicedGeometry to the given number of TimeSteps,
//## filling newly created elements with empty geometries. Sub-classes should override
//## this method to handle the elongation of their data vectors, too.
//## Note that a shrinking is neither possible nor intended.
virtual void Expand( unsigned int timeSteps );
//##Documentation
//## @brief Return the Geometry3D of the data at time \a t.
//##
//## The method does not simply return
//## m_TimeSlicedGeometry->GetGeometry(t).
//## Before doing this, it makes sure that the Geometry3D is up-to-date
//## (by setting the update extent appropriately and calling
//## UpdateOutputInformation).
//##
//## @todo Appropriate setting of the update extent is missing.
const mitk::Geometry3D* GetUpdatedGeometry(int t=0);
//##Documentation
//## @brief Return the geometry, which is a TimeSlicedGeometry, of the data
//## as non-const pointer.
//##
//## \warning No update will be called. Use GetUpdatedGeometry() if you cannot
//## be sure that the geometry is up-to-date.
//##
//## Normally used in GenerateOutputInformation of subclasses of BaseProcess.
mitk::Geometry3D* GetGeometry(int t=0) const
{
if(m_TimeSlicedGeometry.IsNull())
return NULL;
return m_TimeSlicedGeometry->GetGeometry3D(t);
}
//##Documentation
//## @brief Helps to deal with the weak-pointer-problem.
virtual void UnRegister() const;
//##Documentation
//## @brief for internal use only. Helps to deal with the
//## weak-pointer-problem.
virtual int GetExternalReferenceCount() const;
//##Documentation
//## @brief Update the information for this BaseData (the geometry in particular)
//## so that it can be used as an output of a BaseProcess.
//##
//## This method is used in the pipeline mechanism to propagate information and
//## initialize the meta data associated with a BaseData. Any implementation
//## of this method in a derived class is assumed to call its source's
//## BaseProcess::UpdateOutputInformation() which determines modified
//## times, LargestPossibleRegions, and any extra meta data like spacing,
//## origin, etc. Default implementation simply call's it's source's
//## UpdateOutputInformation().
//## \note Implementations of this methods in derived classes must take care
//## that the geometry is updated by calling
//## GetTimeSlicedGeometry()->UpdateInformation()
//## \em after calling its source's BaseProcess::UpdateOutputInformation().
void UpdateOutputInformation();
//##Documentation
//## @brief Set the RequestedRegion to the LargestPossibleRegion.
//##
//## This forces a filter to produce all of the output in one execution
//## (i.e. not streaming) on the next call to Update().
void SetRequestedRegionToLargestPossibleRegion()=0;
//##Documentation
//## @brief Determine whether the RequestedRegion is outside of the BufferedRegion.
//##
//## This method returns true if the RequestedRegion
//## is outside the BufferedRegion (true if at least one pixel is
//## outside). This is used by the pipeline mechanism to determine
//## whether a filter needs to re-execute in order to satisfy the
//## current request. If the current RequestedRegion is already
//## inside the BufferedRegion from the previous execution (and the
//## current filter is up to date), then a given filter does not need
//## to re-execute
bool RequestedRegionIsOutsideOfTheBufferedRegion()=0;
//##Documentation
//## @brief Verify that the RequestedRegion is within the LargestPossibleRegion.
//##
//## If the RequestedRegion is not within the LargestPossibleRegion,
//## then the filter cannot possibly satisfy the request. This method
//## returns true if the request can be satisfied (even if it will be
//## necessary to process the entire LargestPossibleRegion) and
//## returns false otherwise. This method is used by
//## PropagateRequestedRegion(). PropagateRequestedRegion() throws a
//## InvalidRequestedRegionError exception if the requested region is
//## not within the LargestPossibleRegion.
virtual bool VerifyRequestedRegion() = 0;
//##Documentation
//## @brief Copy information from the specified data set.
//##
//## This method is part of the pipeline execution model. By default, a
//## BaseProcess will copy meta-data from the first input to all of its
//## outputs. See ProcessObject::GenerateOutputInformation(). Each
//## subclass of DataObject is responsible for being able to copy
//## whatever meta-data it needs from another DataObject.
//## The default implementation of this method copies the time sliced geometry
//## and the property list of an object. If a subclass overrides this
//## method, it should always call its superclass' version.
void CopyInformation(const itk::DataObject* data);
//##Documentation
//## @brief Check whether the data has been initialized, i.e.,
//## at least the Geometry and other header data has been set
//##
//## \warning Set to \a true by default for compatibility reasons.
//## Set m_Initialized=false in constructors of sub-classes that
//## support distinction between initialized and uninitialized state.
virtual bool IsInitialized() const;
//##Documentation
//## @brief Calls ClearData() and InitializeEmpty();
//## \warning Only use in subclasses that reimplemented these methods.
//## Just calling Clear from BaseData will reset an object to a not initialized,
//## invalid state.
virtual void Clear();
//##Documentation
//## @brief Check whether object contains data (at
//## a specified time), e.g., a set of points may be empty
//##
//## \warning Returns IsInitialized()==false by default for
//## compatibility reasons. Override in sub-classes that
//## support distinction between empty/non-empty state.
- virtual bool IsEmpty(unsigned int t) const;
+ virtual bool IsEmptyTimeStep(unsigned int t) const;
//##Documentation
//## @brief Check whether object contains data (at
//## least at one point in time), e.g., a set of points
//## may be empty
//##
//## \warning Returns IsInitialized()==false by default for
//## compatibility reasons. Override in sub-classes that
//## support distinction between empty/non-empty state.
virtual bool IsEmpty() const;
//##Documentation
//## @brief Set the requested region from this data object to match the requested
//## region of the data object passed in as a parameter.
//##
//## This method is implemented in the concrete subclasses of BaseData.
void SetRequestedRegion(itk::DataObject *data)=0;
//##Documentation
//##@brief overwrite if the Data can be called by an Interactor (StateMachine).
//##
//## Empty by default. Overwrite and implement all the necessary operations here
//## and get the necessary information from the parameter operation.
void ExecuteOperation(Operation* operation);
//##Documentation
//## @brief Set the Geometry3D of the data, which will be referenced (not copied!).
//## Assumes the data object has only 1 time step ( is a 3D object ).
//##
//## For convenience (and historic) reasons, it is also possible to set a complete
//## mitk::TimeSlicedGeometry*, which will be referenced (not copied!).
//##
//## @warning This method will normally be called internally by the sub-class of BaseData
//## during initialization.
//## \sa SetClonedGeometry
virtual void SetGeometry(Geometry3D* aGeometry3D);
- //##Documentation
- //## @brief Set the Geometry3D of a given time step, which will be referenced (not copied!).
- //##
- //## @warning This method will normally be called internally by the sub-class of BaseData
- //## during initialization.
- //## \sa SetClonedGeometry
- virtual void SetGeometry(Geometry3D* aGeometry3D, unsigned int time);
-
//##Documentation
//## @brief Set a clone of the provided geometry as Geometry3D of the data.
//## Assumes the data object has only 1 time step ( is a 3D object )
//##
//## \sa SetGeometry
virtual void SetClonedGeometry(const Geometry3D* aGeometry3D);
//##Documentation
//## @brief Set a clone of the provided geometry as Geometry3D of a given time step.
//##
//## \sa SetGeometry
virtual void SetClonedGeometry(const Geometry3D* aGeometry3D, unsigned int time);
//##Documentation
//## @brief Get the data's property list
//## @sa GetProperty
//## @sa m_PropertyList
mitk::PropertyList::Pointer GetPropertyList() const;
//##Documentation
//## @brief Set the data's property list
//## @sa SetProperty
//## @sa m_PropertyList
void SetPropertyList(PropertyList* propertyList);
//##Documentation
//## @brief Get the property (instance of BaseProperty) with key @a propertyKey from the PropertyList,
//## and set it to this, respectively;
//## @sa GetPropertyList
//## @sa m_PropertyList
//## @sa m_MapOfPropertyLists
mitk::BaseProperty::Pointer GetProperty(const char *propertyKey) const;
void SetProperty(const char *propertyKey, BaseProperty* property);
//##Documentation
//## @brief Convenience method for setting the origin of
//## the Geometry3D instances of all time steps
//##
//## \warning Geometries contained in the Geometry3D will
//## \em not be changed, e.g. in case the Geometry3D is a
//## SlicedGeometry3D the origin will \em not be propagated
//## to the contained slices. The sub-class SlicedData
//## does this for the case that the SlicedGeometry3D is
//## evenly spaced.
virtual void SetOrigin(const Point3D& origin);
/** \brief Get the process object that generated this data object.
*
* If there is no process object, then the data object has
* been disconnected from the pipeline, or the data object
* was created manually. (Note: we cannot use the GetObjectMacro()
* defined in itkMacro because the mutual dependency of
* DataObject and ProcessObject causes compile problems. Also,
* a forward reference smart pointer is returned, not a smart pointer,
* because of the circular dependency between the process and data object.)
*
* GetSource() returns a SmartPointerForwardReference and not a WeakPointer
* because it is assumed the code calling GetSource() wants to hold a
* long term reference to the source. */
itk::SmartPointerForwardReference<mitk::BaseProcess> GetSource() const;
//##Documentation
//## @brief Get the number of time steps from the Timeslicedgeometry
//## As the base data has not a data vector given by itself, the number
//## of time steps is defined over the time sliced geometry. In sub classes,
//## a better implementation could be over the length of the data vector.
unsigned int GetTimeSteps() const
{
return m_TimeSlicedGeometry->GetTimeSteps();
};
//##Documentation
//## @brief Get the modified time of the last change of the contents
//## this data object or its geometry.
virtual unsigned long GetMTime() const;
protected:
BaseData();
BaseData(const BaseData &other);
~BaseData();
//##Documentation
//## @brief Initialize the TimeSlicedGeometry for a number of time steps.
//## The TimeSlicedGeometry is initialized empty and evenly timed.
//## In many cases it will be necessary to overwrite this in sub-classes.
virtual void InitializeTimeSlicedGeometry( unsigned int timeSteps = 1 );
//##Documentation
//## @brief reset to non-initialized state, release memory
virtual void ClearData();
//##Documentation
//## @brief Pure virtual; Must be used in subclasses to get a data object to a
//## valid state. Should at least create one empty object and call
//## Superclass::InitializeTimeSlicedGeometry() to ensure an existing valid geometry
virtual void InitializeEmpty(){};
virtual void PrintSelf(std::ostream& os, itk::Indent indent) const;
bool m_RequestedRegionInitialized;
bool m_LastRequestedRegionWasOutsideOfTheBufferedRegion;
mutable itk::SmartPointer<mitk::BaseProcess> m_SmartSourcePointer;
mutable unsigned int m_SourceOutputIndexDuplicate;
//##Documentation
//## @brief for internal use only. Helps to deal with the
//## weak-pointer-problem.
virtual void ConnectSource(itk::ProcessObject *arg, unsigned int idx) const;
bool m_Initialized;
private:
//##Documentation
//## @brief Helps to deal with the weak-pointer-problem.
mutable bool m_Unregistering;
//##Documentation
//## @brief Helps to deal with the weak-pointer-problem.
mutable bool m_CalculatingExternalReferenceCount;
//##Documentation
//## @brief Helps to deal with the weak-pointer-problem.
mutable int m_ExternalReferenceCount;
//##Documentation
//## @brief PropertyList, f.e. to hold pic-tags, tracking-data,..
//##
PropertyList::Pointer m_PropertyList;
TimeSlicedGeometry::Pointer m_TimeSlicedGeometry;
//##Documentation
//## @brief Helps to deal with the weak-pointer-problem.
friend class mitk::BaseProcess;
};
} // namespace mitk
#endif /* BASEDATA_H_HEADER_INCLUDED_C1EBB6FA */
diff --git a/Core/Code/DataManagement/mitkClippingProperty.h b/Core/Code/DataManagement/mitkClippingProperty.h
index 0c0e3d7e68..1f656c6183 100644
--- a/Core/Code/DataManagement/mitkClippingProperty.h
+++ b/Core/Code/DataManagement/mitkClippingProperty.h
@@ -1,75 +1,77 @@
/*=========================================================================
Program: Medical Imaging & Interaction Toolkit
Language: C++
Date: $Date: 2008-04-14 19:45:53 +0200 (Mo, 14 Apr 2008) $
Version: $Revision: 14081 $
Copyright (c) German Cancer Research Center, Division of Medical and
Biological Informatics. All rights reserved.
See MITKCopyright.txt or http://www.mitk.org/copyright.html for details.
This software is distributed WITHOUT ANY WARRANTY; without even
the implied warranty of MERCHANTABILITY or FITNESS FOR A PARTICULAR
PURPOSE. See the above copyright notices for more information.
=========================================================================*/
#ifndef MITKCLIPPINGPROPERTY_H_HEADER_INCLUDED
#define MITKCLIPPINGPROPERTY_H_HEADER_INCLUDED
#include "mitkCommon.h"
#include "mitkBaseProperty.h"
#include "mitkVector.h"
#include <itkConfigure.h>
#include <string>
namespace mitk {
/**
* \brief Property for clipping datasets; currently only
* clipping planes are possible
* \ingroup DataManagement
*/
class MITK_CORE_EXPORT ClippingProperty : public BaseProperty
{
public:
mitkClassMacro(ClippingProperty, BaseProperty);
+
+ virtual BaseProperty& operator=(const BaseProperty& other) { return Superclass::operator=(other); }
typedef std::string ValueType;
itkNewMacro( ClippingProperty );
mitkNewMacro2Param( ClippingProperty,
const Point3D &, const Vector3D & );
bool GetClippingEnabled() const;
void SetClippingEnabled( bool enabled );
const Point3D &GetOrigin() const;
void SetOrigin( const Point3D &origin );
const Vector3D &GetNormal() const;
void SetNormal( const Vector3D &normal );
virtual bool operator==(const BaseProperty& property ) const;
virtual std::string GetValueAsString() const;
protected:
bool m_ClippingEnabled;
Point3D m_Origin;
Vector3D m_Normal;
ClippingProperty();
ClippingProperty( const Point3D &origin, const Vector3D &normal );
};
} // namespace mitk
#endif /* MITKCLIPPINGPROPERTY_H_HEADER_INCLUDED */
diff --git a/Core/Code/DataManagement/mitkDataNode.cpp b/Core/Code/DataManagement/mitkDataNode.cpp
index f126dba1f7..068be6c4fa 100644
--- a/Core/Code/DataManagement/mitkDataNode.cpp
+++ b/Core/Code/DataManagement/mitkDataNode.cpp
@@ -1,574 +1,574 @@
/*=========================================================================
Program: Medical Imaging & Interaction Toolkit
Language: C++
Date: $Date$
Version: $Revision$
Copyright (c) German Cancer Research Center, Division of Medical and
Biological Informatics. All rights reserved.
See MITKCopyright.txt or http://www.mitk.org/copyright.html for details.
This software is distributed WITHOUT ANY WARRANTY; without even
the implied warranty of MERCHANTABILITY or FITNESS FOR A PARTICULAR
PURPOSE. See the above copyright notices for more information.
=========================================================================*/
#include "mitkDataNode.h"
#include "mitkCoreObjectFactory.h"
#include <vtkTransform.h>
#include <itkSmartPointerForwardReference.txx>
#include "mitkProperties.h"
#include "mitkStringProperty.h"
#include "mitkGroupTagProperty.h"
#include "mitkSmartPointerProperty.h"
//#include "mitkMaterialProperty.h"
#include "mitkColorProperty.h"
#include "mitkLevelWindowProperty.h"
#include "mitkGeometry3D.h"
#include "mitkRenderingManager.h"
#include "mitkGlobalInteraction.h"
#include "mitkEventMapper.h"
#include "mitkGenericProperty.h"
#include "mitkCoreObjectFactory.h"
mitk::Mapper* mitk::DataNode::GetMapper(MapperSlotId id) const
{
if( (id >= m_Mappers.size()) || (m_Mappers[id].IsNull()) )
{
if(id >= m_Mappers.capacity())
{
// int i, size=id-m_Mappers.capacity()+10;
m_Mappers.resize(id+10);
}
m_Mappers[id] = CoreObjectFactory::GetInstance()->CreateMapper(const_cast<DataNode*>(this),id);
}
return m_Mappers[id];
}
mitk::BaseData* mitk::DataNode::GetData() const
{
return m_Data;
}
mitk::Interactor* mitk::DataNode::GetInteractor() const
{
return m_Interactor;
}
void mitk::DataNode::SetData(mitk::BaseData* baseData)
{
if(m_Data!=baseData)
{
m_Data=baseData;
m_Mappers.clear();
m_Mappers.resize(10);
mitk::CoreObjectFactory::GetInstance()->SetDefaultProperties(this);
m_DataReferenceChangedTime.Modified();
Modified();
//inform the interactor about the change
if (m_Interactor.IsNotNull())
m_Interactor->DataChanged();
}
}
void mitk::DataNode::SetInteractor(mitk::Interactor* interactor)
{
m_Interactor = interactor;
if(m_Interactor.IsNotNull())
m_Interactor->SetDataNode(this);
}
mitk::DataNode::DataNode() : m_Data(NULL), m_PropertyListModifiedObserverTag(0)
{
m_Mappers.resize(10);
m_PropertyList = PropertyList::New();
// subscribe for modified event
itk::MemberCommand<mitk::DataNode>::Pointer _PropertyListModifiedCommand =
itk::MemberCommand<mitk::DataNode>::New();
_PropertyListModifiedCommand->SetCallbackFunction(this, &mitk::DataNode::PropertyListModified);
m_PropertyListModifiedObserverTag = m_PropertyList->AddObserver(itk::ModifiedEvent(), _PropertyListModifiedCommand);
}
mitk::DataNode::~DataNode()
{
if(m_PropertyList.IsNotNull())
// remove modified event listener
m_PropertyList->RemoveObserver(m_PropertyListModifiedObserverTag);
Interactor* interactor = this->GetInteractor();
if ( interactor )
{
mitk::GlobalInteraction::GetInstance()->RemoveInteractor( interactor );
}
m_Mappers.clear();
m_Data = NULL;
}
mitk::DataNode& mitk::DataNode::operator=(const DataNode& right)
{
mitk::DataNode* node=mitk::DataNode::New();
node->SetData(right.GetData());
return *node;
}
mitk::DataNode& mitk::DataNode::operator=(mitk::BaseData* right)
{
mitk::DataNode* node=mitk::DataNode::New();
node->SetData(right);
return *node;
}
#if (_MSC_VER > 1200) || !defined(_MSC_VER)
MBI_STD::istream& mitk::operator>>( MBI_STD::istream& i, mitk::DataNode::Pointer& dtn )
#endif
#if ((defined(_MSC_VER)) && (_MSC_VER <= 1200))
MBI_STD::istream& operator>>( MBI_STD::istream& i, mitk::DataNode::Pointer& dtn )
#endif
{
dtn = mitk::DataNode::New();
//i >> av.get();
return i;
}
#if (_MSC_VER > 1200) || !defined(_MSC_VER)
MBI_STD::ostream& mitk::operator<<( MBI_STD::ostream& o, mitk::DataNode::Pointer& dtn)
#endif
#if ((defined(_MSC_VER)) && (_MSC_VER <= 1200))
MBI_STD::ostream& operator<<( MBI_STD::ostream& o, mitk::DataNode::Pointer& dtn)
#endif
{
if(dtn->GetData()!=NULL)
o<<dtn->GetData()->GetNameOfClass();
else
o<<"empty data";
return o;
}
void mitk::DataNode::SetMapper(MapperSlotId id, mitk::Mapper* mapper)
{
m_Mappers[id] = mapper;
if (mapper!=NULL)
mapper->SetDataNode(this);
}
void mitk::DataNode::UpdateOutputInformation()
{
if (this->GetSource())
{
this->GetSource()->UpdateOutputInformation();
}
}
void mitk::DataNode::SetRequestedRegionToLargestPossibleRegion()
{
}
bool mitk::DataNode::RequestedRegionIsOutsideOfTheBufferedRegion()
{
return false;
}
bool mitk::DataNode::VerifyRequestedRegion()
{
return true;
}
void mitk::DataNode::SetRequestedRegion(itk::DataObject * /*data*/)
{
}
void mitk::DataNode::CopyInformation(const itk::DataObject * /*data*/)
{
}
mitk::PropertyList* mitk::DataNode::GetPropertyList(const mitk::BaseRenderer* renderer) const
{
if(renderer==NULL)
return m_PropertyList;
mitk::PropertyList::Pointer & propertyList = m_MapOfPropertyLists[renderer];
if(propertyList.IsNull())
propertyList = mitk::PropertyList::New();
assert(m_MapOfPropertyLists[renderer].IsNotNull());
return propertyList;
}
void mitk::DataNode::ConcatenatePropertyList(PropertyList *pList, bool replace)
{
m_PropertyList->ConcatenatePropertyList(pList, replace);
}
mitk::BaseProperty* mitk::DataNode::GetProperty(const char *propertyKey, const mitk::BaseRenderer* renderer) const
{
if(propertyKey==NULL)
return NULL;
//renderer specified?
if (renderer)
{
std::map<const mitk::BaseRenderer*,mitk::PropertyList::Pointer>::const_iterator it;
//check for the renderer specific property
it=m_MapOfPropertyLists.find(renderer);
if(it!=m_MapOfPropertyLists.end()) //found
{
mitk::BaseProperty::Pointer property;
property=it->second->GetProperty(propertyKey);
if(property.IsNotNull())//found an enabled property in the render specific list
return property;
else //found a renderer specific list, but not the desired property
return m_PropertyList->GetProperty(propertyKey); //return renderer unspecific property
}
else //didn't find the property list of the given renderer
{
//return the renderer unspecific property if there is one
return m_PropertyList->GetProperty(propertyKey);
}
}
else //no specific renderer given; use the renderer independent one
{
mitk::BaseProperty::Pointer property;
property=m_PropertyList->GetProperty(propertyKey);
if(property.IsNotNull())
return property;
}
//only to satisfy compiler!
return NULL;
}
mitk::DataNode::GroupTagList mitk::DataNode::GetGroupTags() const
{
GroupTagList groups;
const PropertyList::PropertyMap* propertyMap = m_PropertyList->GetMap();
for ( PropertyList::PropertyMap::const_iterator groupIter = propertyMap->begin(); // m_PropertyList is created in the constructor, so we don't check it here
groupIter != propertyMap->end();
++groupIter )
{
- const BaseProperty* bp = groupIter->second.first;
- if ( dynamic_cast<const GroupTagProperty*>(bp) && groupIter->second.second )
+ const BaseProperty* bp = groupIter->second;
+ if ( dynamic_cast<const GroupTagProperty*>(bp) )
{
groups.insert( groupIter->first );
}
}
return groups;
}
bool mitk::DataNode::GetBoolProperty(const char* propertyKey, bool& boolValue, mitk::BaseRenderer* renderer) const
{
mitk::BoolProperty::Pointer boolprop = dynamic_cast<mitk::BoolProperty*>(GetProperty(propertyKey, renderer));
if(boolprop.IsNull())
return false;
boolValue = boolprop->GetValue();
return true;
}
bool mitk::DataNode::GetIntProperty(const char* propertyKey, int &intValue, mitk::BaseRenderer* renderer) const
{
mitk::IntProperty::Pointer intprop = dynamic_cast<mitk::IntProperty*>(GetProperty(propertyKey, renderer));
if(intprop.IsNull())
return false;
intValue = intprop->GetValue();
return true;
}
bool mitk::DataNode::GetFloatProperty(const char* propertyKey, float &floatValue, mitk::BaseRenderer* renderer) const
{
mitk::FloatProperty::Pointer floatprop = dynamic_cast<mitk::FloatProperty*>(GetProperty(propertyKey, renderer));
if(floatprop.IsNull())
return false;
floatValue = floatprop->GetValue();
return true;
}
bool mitk::DataNode::GetStringProperty(const char* propertyKey, std::string& string, mitk::BaseRenderer* renderer) const
{
mitk::StringProperty::Pointer stringProp = dynamic_cast<mitk::StringProperty*>(GetProperty(propertyKey, renderer));
if(stringProp.IsNull())
{
return false;
}
else
{
//memcpy((void*)string, stringProp->GetValue(), strlen(stringProp->GetValue()) + 1 ); // looks dangerous
string = stringProp->GetValue();
return true;
}
}
bool mitk::DataNode::GetColor(float rgb[3], mitk::BaseRenderer* renderer, const char* propertyKey) const
{
mitk::ColorProperty::Pointer colorprop = dynamic_cast<mitk::ColorProperty*>(GetProperty(propertyKey, renderer));
if(colorprop.IsNull())
return false;
memcpy(rgb, colorprop->GetColor().GetDataPointer(), 3*sizeof(float));
return true;
}
bool mitk::DataNode::GetOpacity(float &opacity, mitk::BaseRenderer* renderer, const char* propertyKey) const
{
mitk::FloatProperty::Pointer opacityprop = dynamic_cast<mitk::FloatProperty*>(GetProperty(propertyKey, renderer));
if(opacityprop.IsNull())
return false;
opacity=opacityprop->GetValue();
return true;
}
bool mitk::DataNode::GetLevelWindow(mitk::LevelWindow &levelWindow, mitk::BaseRenderer* renderer, const char* propertyKey) const
{
mitk::LevelWindowProperty::Pointer levWinProp = dynamic_cast<mitk::LevelWindowProperty*>(GetProperty(propertyKey, renderer));
if(levWinProp.IsNull())
return false;
levelWindow=levWinProp->GetLevelWindow();
return true;
}
void mitk::DataNode::SetColor(const mitk::Color &color, mitk::BaseRenderer* renderer, const char* propertyKey)
{
mitk::ColorProperty::Pointer prop;
prop = mitk::ColorProperty::New(color);
GetPropertyList(renderer)->SetProperty(propertyKey, prop);
}
void mitk::DataNode::SetColor(float red, float green, float blue, mitk::BaseRenderer* renderer, const char* propertyKey)
{
float color[3];
color[0]=red;
color[1]=green;
color[2]=blue;
SetColor(color, renderer, propertyKey);
}
void mitk::DataNode::SetColor(const float rgb[3], mitk::BaseRenderer* renderer, const char* propertyKey)
{
mitk::ColorProperty::Pointer prop;
prop = mitk::ColorProperty::New(rgb);
GetPropertyList(renderer)->SetProperty(propertyKey, prop);
}
void mitk::DataNode::SetVisibility(bool visible, mitk::BaseRenderer* renderer, const char* propertyKey)
{
mitk::BoolProperty::Pointer prop;
prop = mitk::BoolProperty::New(visible);
GetPropertyList(renderer)->SetProperty(propertyKey, prop);
}
void mitk::DataNode::SetOpacity(float opacity, mitk::BaseRenderer* renderer, const char* propertyKey)
{
mitk::FloatProperty::Pointer prop;
prop = mitk::FloatProperty::New(opacity);
GetPropertyList(renderer)->SetProperty(propertyKey, prop);
}
void mitk::DataNode::SetLevelWindow(mitk::LevelWindow levelWindow, mitk::BaseRenderer* renderer, const char* propertyKey)
{
mitk::LevelWindowProperty::Pointer prop;
prop = mitk::LevelWindowProperty::New(levelWindow);
GetPropertyList(renderer)->SetProperty(propertyKey, prop);
}
void mitk::DataNode::SetIntProperty(const char* propertyKey, int intValue, mitk::BaseRenderer* renderer)
{
GetPropertyList(renderer)->SetProperty(propertyKey, mitk::IntProperty::New(intValue));
}
void mitk::DataNode::SetBoolProperty( const char* propertyKey, bool boolValue, mitk::BaseRenderer* renderer/*=NULL*/ )
{
GetPropertyList(renderer)->SetProperty(propertyKey, mitk::BoolProperty::New(boolValue));
}
void mitk::DataNode::SetFloatProperty( const char* propertyKey, float floatValue, mitk::BaseRenderer* renderer/*=NULL*/ )
{
GetPropertyList(renderer)->SetProperty(propertyKey, mitk::FloatProperty::New(floatValue));
}
void mitk::DataNode::SetStringProperty( const char* propertyKey, const char* stringValue, mitk::BaseRenderer* renderer/*=NULL*/ )
{
GetPropertyList(renderer)->SetProperty(propertyKey, mitk::StringProperty::New(stringValue));
}
void mitk::DataNode::SetProperty(const char *propertyKey,
BaseProperty* propertyValue,
const mitk::BaseRenderer* renderer)
{
GetPropertyList(renderer)->SetProperty(propertyKey, propertyValue);
}
void mitk::DataNode::ReplaceProperty(const char *propertyKey,
BaseProperty* propertyValue,
const mitk::BaseRenderer* renderer)
{
GetPropertyList(renderer)->ReplaceProperty(propertyKey, propertyValue);
}
void mitk::DataNode::AddProperty(const char *propertyKey,
BaseProperty* propertyValue,
const mitk::BaseRenderer* renderer,
bool overwrite)
{
if((overwrite) || (GetProperty(propertyKey, renderer) == NULL))
{
SetProperty(propertyKey, propertyValue, renderer);
}
}
vtkLinearTransform* mitk::DataNode::GetVtkTransform(int t) const
{
assert(m_Data.IsNotNull());
mitk::Geometry3D* geometry = m_Data->GetGeometry(t);
if(geometry == NULL)
return NULL;
return geometry->GetVtkTransform();
}
unsigned long mitk::DataNode::GetMTime() const
{
unsigned long time = Superclass::GetMTime();
if(m_Data.IsNotNull())
{
if((time < m_Data->GetMTime()) ||
((m_Data->GetSource() != NULL) && (time < m_Data->GetSource()->GetMTime()))
)
{
Modified();
return Superclass::GetMTime();
}
}
return time;
}
void mitk::DataNode::SetSelected(bool selected, mitk::BaseRenderer* renderer)
{
mitk::BoolProperty::Pointer selectedProperty = dynamic_cast<mitk::BoolProperty*>(GetProperty("selected"));
if ( selectedProperty.IsNull() )
{
selectedProperty = mitk::BoolProperty::New();
selectedProperty->SetValue(false);
SetProperty("selected", selectedProperty, renderer);
}
if( selectedProperty->GetValue() != selected )
{
selectedProperty->SetValue(selected);
itk::ModifiedEvent event;
InvokeEvent( event );
}
}
/*
class SelectedEvent : public itk::ModifiedEvent
{
public:
typedef SelectedEvent Self;
typedef itk::ModifiedEvent Superclass;
SelectedEvent(DataNode* dataNode)
{ m_DataNode = dataNode; };
DataNode* GetDataNode()
{ return m_DataNode; };
virtual const char * GetEventName() const
{ return "SelectedEvent"; }
virtual bool CheckEvent(const ::itk::EventObject* e) const
{ return dynamic_cast<const Self*>(e); }
virtual ::itk::EventObject* MakeObject() const
{ return new Self(m_DataNode); }
private:
DataNode* m_DataNode;
SelectedEvent(const Self& event)
{ m_DataNode = event.m_DataNode; };
void operator=(const Self& event)
{ m_DataNode = event.m_DataNode; }
};
*/
bool mitk::DataNode::IsSelected(mitk::BaseRenderer* renderer)
{
bool selected;
if ( !GetBoolProperty("selected", selected, renderer) )
return false;
return selected;
}
void mitk::DataNode::SetInteractorEnabled( const bool& enabled )
{
if ( m_Interactor.IsNull() )
{
itkWarningMacro("Interactor is NULL. Couldn't enable or disable interaction.");
return;
}
if ( enabled )
mitk::GlobalInteraction::GetInstance()->AddInteractor( m_Interactor.GetPointer() );
else
mitk::GlobalInteraction::GetInstance()->RemoveInteractor( m_Interactor.GetPointer() );
}
void mitk::DataNode::EnableInteractor()
{
SetInteractorEnabled( true );
}
void mitk::DataNode::DisableInteractor()
{
SetInteractorEnabled( false );
}
bool mitk::DataNode::IsInteractorEnabled() const
{
return mitk::GlobalInteraction::GetInstance()->InteractorRegistered( m_Interactor.GetPointer() );
}
void mitk::DataNode::PropertyListModified( const itk::Object* /*caller*/, const itk::EventObject& )
{
Modified();
}
#ifndef _MSC_VER
template <typename T>
bool mitk::DataNode::GetPropertyValue(const char* propertyKey, T & value, mitk::BaseRenderer* renderer) const
{
GenericProperty<T>* gp= dynamic_cast<GenericProperty<T>*>(GetProperty(propertyKey, renderer) );
if ( gp != NULL )
{
value = gp->GetValue();
return true;
}
return false;
}
template bool mitk::DataNode::GetPropertyValue<double>(char const*, double&, mitk::BaseRenderer*) const;
template bool mitk::DataNode::GetPropertyValue<float>(char const*, float&, mitk::BaseRenderer*) const;
template bool mitk::DataNode::GetPropertyValue<int>(char const*, int&, mitk::BaseRenderer*) const;
template bool mitk::DataNode::GetPropertyValue<bool>(char const*, bool&, mitk::BaseRenderer*) const;
#endif
diff --git a/Core/Code/DataManagement/mitkDataStorage.cpp b/Core/Code/DataManagement/mitkDataStorage.cpp
index 4e1edd044b..9ee1adb74d 100644
--- a/Core/Code/DataManagement/mitkDataStorage.cpp
+++ b/Core/Code/DataManagement/mitkDataStorage.cpp
@@ -1,513 +1,513 @@
/*=========================================================================
Program: Medical Imaging & Interaction Toolkit
Language: C++
Date: $Date$
Version: $Revision$
Copyright (c) German Cancer Research Center, Division of Medical and
Biological Informatics. All rights reserved.
See MITKCopyright.txt or http://www.mitk.org/copyright.html for details.
This software is distributed WITHOUT ANY WARRANTY; without even
the implied warranty of MERCHANTABILITY or FITNESS FOR A PARTICULAR
PURPOSE. See the above copyright notices for more information.
=========================================================================*/
#include "mitkDataStorage.h"
#include "mitkDataNode.h"
#include "mitkProperties.h"
#include "mitkNodePredicateBase.h"
#include "mitkNodePredicateProperty.h"
#include "mitkGroupTagProperty.h"
#include "itkMutexLockHolder.h"
#include "itkCommand.h"
mitk::DataStorage::DataStorage() : itk::Object()
, m_BlockNodeModifiedEvents(false)
{
}
mitk::DataStorage::~DataStorage()
{
///// we can not call GetAll() in destructor, because it is implemented in a subclass
//SetOfObjects::ConstPointer all = this->GetAll();
//for (SetOfObjects::ConstIterator it = all->Begin(); it != all->End(); ++it)
// this->RemoveListeners(it->Value());
//m_NodeModifiedObserverTags.clear();
//m_NodeDeleteObserverTags.clear();
}
void mitk::DataStorage::Add(mitk::DataNode* node, mitk::DataNode* parent)
{
mitk::DataStorage::SetOfObjects::Pointer parents = mitk::DataStorage::SetOfObjects::New();
parents->InsertElement(0, parent);
this->Add(node, parents);
}
void mitk::DataStorage::Remove(const mitk::DataStorage::SetOfObjects* nodes)
{
if (nodes == NULL)
return;
for (mitk::DataStorage::SetOfObjects::ConstIterator it = nodes->Begin(); it != nodes->End(); it++)
this->Remove(it.Value());
}
mitk::DataStorage::SetOfObjects::ConstPointer mitk::DataStorage::GetSubset(const NodePredicateBase* condition) const
{
mitk::DataStorage::SetOfObjects::ConstPointer result = this->FilterSetOfObjects(this->GetAll(), condition);
return result;
}
mitk::DataNode* mitk::DataStorage::GetNamedNode(const char* name) const
{
if (name == NULL)
return NULL;
mitk::StringProperty::Pointer s(mitk::StringProperty::New(name));
mitk::NodePredicateProperty::Pointer p = mitk::NodePredicateProperty::New("name", s);
mitk::DataStorage::SetOfObjects::ConstPointer rs = this->GetSubset(p);
if (rs->Size() >= 1)
return rs->GetElement(0);
else
return NULL;
}
mitk::DataNode* mitk::DataStorage::GetNode(const NodePredicateBase* condition) const
{
if (condition == NULL)
return NULL;
mitk::DataStorage::SetOfObjects::ConstPointer rs = this->GetSubset(condition);
if (rs->Size() >= 1)
return rs->GetElement(0);
else
return NULL;
}
mitk::DataNode* mitk::DataStorage::GetNamedDerivedNode(const char* name, const mitk::DataNode* sourceNode, bool onlyDirectDerivations) const
{
if (name == NULL)
return NULL;
mitk::StringProperty::Pointer s(mitk::StringProperty::New(name));
mitk::NodePredicateProperty::Pointer p = mitk::NodePredicateProperty::New("name", s);
mitk::DataStorage::SetOfObjects::ConstPointer rs = this->GetDerivations(sourceNode, p, onlyDirectDerivations);
if (rs->Size() >= 1)
return rs->GetElement(0);
else
return NULL;
}
void mitk::DataStorage::PrintSelf(std::ostream& os, itk::Indent indent) const
{
//Superclass::PrintSelf(os, indent);
mitk::DataStorage::SetOfObjects::ConstPointer all = this->GetAll();
os << indent << "DataStorage " << this << " is managing " << all->Size() << " objects. List of objects:" << std::endl;
for (mitk::DataStorage::SetOfObjects::ConstIterator allIt = all->Begin(); allIt != all->End(); allIt++)
{
std::string name;
allIt.Value()->GetName(name);
std::string datatype;
if (allIt.Value()->GetData() != NULL)
datatype = allIt.Value()->GetData()->GetNameOfClass();
os << indent << " " << allIt.Value().GetPointer() << "<" << datatype << ">: " << name << std::endl;
mitk::DataStorage::SetOfObjects::ConstPointer parents = this->GetSources(allIt.Value());
if (parents->Size() > 0)
{
os << indent << " Direct sources: ";
for (mitk::DataStorage::SetOfObjects::ConstIterator parentIt = parents->Begin(); parentIt != parents->End(); parentIt++)
os << parentIt.Value().GetPointer() << ", ";
os << std::endl;
}
mitk::DataStorage::SetOfObjects::ConstPointer derivations = this->GetDerivations(allIt.Value());
if (derivations->Size() > 0)
{
os << indent << " Direct derivations: ";
for (mitk::DataStorage::SetOfObjects::ConstIterator derivationIt = derivations->Begin(); derivationIt != derivations->End(); derivationIt++)
os << derivationIt.Value().GetPointer() << ", ";
os << std::endl;
}
}
os << std::endl;
}
mitk::DataStorage::SetOfObjects::ConstPointer mitk::DataStorage::FilterSetOfObjects(const SetOfObjects* set, const NodePredicateBase* condition) const
{
if (set == NULL)
return NULL;
mitk::DataStorage::SetOfObjects::Pointer result = mitk::DataStorage::SetOfObjects::New();
for (mitk::DataStorage::SetOfObjects::ConstIterator it = set->Begin(); it != set->End(); it++)
if (condition == NULL || condition->CheckNode(it.Value()) == true) //alway copy the set, otherwise the iterator in mitk::DataStorage::Remove() will crash
result->InsertElement(result->Size(), it.Value());
return mitk::DataStorage::SetOfObjects::ConstPointer(result);
}
const mitk::DataNode::GroupTagList mitk::DataStorage::GetGroupTags() const
{
DataNode::GroupTagList result;
SetOfObjects::ConstPointer all = this->GetAll();
if (all.IsNull())
return result;
for (mitk::DataStorage::SetOfObjects::ConstIterator nodeIt = all->Begin(); nodeIt != all->End(); nodeIt++) // for each node
{
mitk::PropertyList* pl = nodeIt.Value()->GetPropertyList();
for (mitk::PropertyList::PropertyMap::const_iterator propIt = pl->GetMap()->begin(); propIt != pl->GetMap()->end(); propIt++)
- if (dynamic_cast<mitk::GroupTagProperty*>(propIt->second.first.GetPointer()) != NULL)
+ if (dynamic_cast<mitk::GroupTagProperty*>(propIt->second.GetPointer()) != NULL)
result.insert(propIt->first);
}
return result;
}
void mitk::DataStorage::EmitAddNodeEvent(const mitk::DataNode* node)
{
AddNodeEvent.Send(node);
}
void mitk::DataStorage::EmitRemoveNodeEvent(const mitk::DataNode* node)
{
RemoveNodeEvent.Send(node);
}
void mitk::DataStorage::OnNodeModifiedOrDeleted( const itk::Object *caller, const itk::EventObject &event )
{
if(m_BlockNodeModifiedEvents)
return;
const mitk::DataNode* _Node = dynamic_cast<const mitk::DataNode*>(caller);
if(_Node)
{
const itk::ModifiedEvent* modEvent = dynamic_cast<const itk::ModifiedEvent*>(&event);
if(modEvent)
ChangedNodeEvent.Send(_Node);
else
DeleteNodeEvent.Send(_Node);
}
}
void mitk::DataStorage::AddListeners( const mitk::DataNode* _Node )
{
itk::MutexLockHolder<itk::SimpleFastMutexLock> locked(m_MutexOne);
// node must not be 0 and must not be yet registered
mitk::DataNode* NonConstNode = const_cast<mitk::DataNode*>(_Node);
if(_Node && m_NodeModifiedObserverTags
.find(NonConstNode) == m_NodeModifiedObserverTags.end())
{
itk::MemberCommand<mitk::DataStorage>::Pointer nodeModifiedCommand =
itk::MemberCommand<mitk::DataStorage>::New();
nodeModifiedCommand->SetCallbackFunction(this
, &mitk::DataStorage::OnNodeModifiedOrDeleted);
m_NodeModifiedObserverTags[NonConstNode]
= NonConstNode->AddObserver(itk::ModifiedEvent(), nodeModifiedCommand);
// add itk delete listener on datastorage
itk::MemberCommand<mitk::DataStorage>::Pointer deleteCommand =
itk::MemberCommand<mitk::DataStorage>::New();
deleteCommand->SetCallbackFunction(this, &mitk::DataStorage::OnNodeModifiedOrDeleted);
// add observer
m_NodeDeleteObserverTags[NonConstNode]
= NonConstNode->AddObserver(itk::DeleteEvent(), deleteCommand);
}
}
void mitk::DataStorage::RemoveListeners( const mitk::DataNode* _Node )
{
itk::MutexLockHolder<itk::SimpleFastMutexLock> locked(m_MutexOne) ;
// node must not be 0 and must be registered
mitk::DataNode* NonConstNode = const_cast<mitk::DataNode*>(_Node);
if(_Node && m_NodeModifiedObserverTags
.find(NonConstNode) != m_NodeModifiedObserverTags.end())
{
// const cast is bad! but sometimes it is necessary. removing an observer does not really
// touch the internal state
NonConstNode->RemoveObserver(m_NodeModifiedObserverTags
.find(NonConstNode)->second);
NonConstNode->RemoveObserver(m_NodeDeleteObserverTags
.find(NonConstNode)->second);
m_NodeModifiedObserverTags.erase(NonConstNode);
m_NodeDeleteObserverTags.erase(NonConstNode);
}
}
mitk::TimeSlicedGeometry::Pointer mitk::DataStorage::ComputeBoundingGeometry3D( const SetOfObjects* input, const char* boolPropertyKey, mitk::BaseRenderer* renderer, const char* boolPropertyKey2)
{
if (input == NULL)
throw std::invalid_argument("DataStorage: input is invalid");
BoundingBox::PointsContainer::Pointer pointscontainer=BoundingBox::PointsContainer::New();
BoundingBox::PointIdentifier pointid=0;
Point3D point;
Vector3D minSpacing;
minSpacing.Fill(ScalarTypeNumericTraits::max());
ScalarType stmin, stmax;
stmin= ScalarTypeNumericTraits::NonpositiveMin();
stmax= ScalarTypeNumericTraits::max();
ScalarType minimalIntervallSize = stmax;
ScalarType minimalTime = stmax;
ScalarType maximalTime = 0;
// Needed for check of zero bounding boxes
mitk::ScalarType nullpoint[]={0,0,0,0,0,0};
BoundingBox::BoundsArrayType itkBoundsZero(nullpoint);
for (SetOfObjects::ConstIterator it = input->Begin(); it != input->End(); ++it)
{
DataNode::Pointer node = it->Value();
if((node.IsNotNull()) && (node->GetData() != NULL) &&
(node->GetData()->IsEmpty()==false) &&
node->IsOn(boolPropertyKey, renderer) &&
node->IsOn(boolPropertyKey2, renderer)
)
{
const TimeSlicedGeometry* geometry = node->GetData()->GetUpdatedTimeSlicedGeometry();
if (geometry != NULL )
{
// bounding box (only if non-zero)
BoundingBox::BoundsArrayType itkBounds = geometry->GetBoundingBox()->GetBounds();
if (itkBounds == itkBoundsZero)
{
continue;
}
unsigned char i;
for(i=0; i<8; ++i)
{
point = geometry->GetCornerPoint(i);
if(point[0]*point[0]+point[1]*point[1]+point[2]*point[2] < large)
pointscontainer->InsertElement( pointid++, point);
else
{
itkGenericOutputMacro( << "Unrealistically distant corner point encountered. Ignored. Node: " << node );
}
}
// spacing
try
{
AffineTransform3D::Pointer inverseTransform = AffineTransform3D::New();
geometry->GetIndexToWorldTransform()->GetInverse(inverseTransform);
vnl_vector< AffineTransform3D::MatrixType::ValueType > unitVector(3);
int axis;
for(axis = 0; axis < 3; ++axis)
{
unitVector.fill(0);
unitVector[axis] = 1.0;
ScalarType mmPerPixel = 1.0/(inverseTransform->GetMatrix()*unitVector).magnitude();
if(minSpacing[axis] > mmPerPixel)
{
minSpacing[axis] = mmPerPixel;
}
}
// time bounds
// iterate over all time steps
// Attention: Objects with zero bounding box are not respected in time bound calculation
TimeBounds minTB = geometry->GetTimeBounds();
for (unsigned int i=0; i<geometry->GetTimeSteps(); i++)
{
const TimeBounds & curTimeBounds = node->GetData()->GetGeometry(i)->GetTimeBounds();
// get the minimal time of all objects in the DataStorage
if ((curTimeBounds[0]<minimalTime)&&(curTimeBounds[0]>stmin))
{
minimalTime=curTimeBounds[0];
}
// get the maximal time of all objects in the DataStorage
if ((curTimeBounds[1]>maximalTime)&&(curTimeBounds[1]<stmax))
{
maximalTime = curTimeBounds[1];
}
// get the minimal TimeBound of all time steps of the current DataNode
if (curTimeBounds[1]-curTimeBounds[0]<minTB[1]-minTB[0])
{
minTB = curTimeBounds;
}
}
// get the minimal interval size of all time steps of all objects of the DataStorage
if (minTB[1]-minTB[0]<minimalIntervallSize)
{
minimalIntervallSize = minTB[1]-minTB[0];
}
}
catch(itk::ExceptionObject e)
{
MITK_ERROR << e << std::endl;
}
}
}
}
BoundingBox::Pointer result = BoundingBox::New();
result->SetPoints(pointscontainer);
result->ComputeBoundingBox();
// minimal time bounds of a single time step for all geometries
TimeBounds minTimeBounds;
minTimeBounds[0] = 0;
minTimeBounds[1] = 1;
// compute the number of time steps
unsigned int numberOfTimeSteps = 1;
if (maximalTime!=0) // make sure that there is at least one time sliced geometry in the data storage
{
minTimeBounds[0] = minimalTime;
minTimeBounds[1] = minimalTime + minimalIntervallSize;
numberOfTimeSteps = (maximalTime-minimalTime)/minimalIntervallSize;
}
TimeSlicedGeometry::Pointer timeSlicedGeometry = NULL;
if ( result->GetPoints()->Size()>0 )
{
// Initialize a geometry of a single time step
Geometry3D::Pointer geometry = Geometry3D::New();
geometry->Initialize();
// correct bounding-box (is now in mm, should be in index-coordinates)
// according to spacing
BoundingBox::BoundsArrayType bounds = result->GetBounds();
int i;
for(i = 0; i < 6; ++i)
{
bounds[i] /= minSpacing[i/2];
}
geometry->SetBounds(bounds);
geometry->SetSpacing(minSpacing);
geometry->SetTimeBounds(minTimeBounds);
// Initialize the time sliced geometry
timeSlicedGeometry = TimeSlicedGeometry::New();
timeSlicedGeometry->InitializeEvenlyTimed(geometry,numberOfTimeSteps);
}
return timeSlicedGeometry;
}
mitk::TimeSlicedGeometry::Pointer mitk::DataStorage::ComputeBoundingGeometry3D( const char* boolPropertyKey, mitk::BaseRenderer* renderer, const char* boolPropertyKey2)
{
return this->ComputeBoundingGeometry3D(this->GetAll(), boolPropertyKey, renderer, boolPropertyKey2);
}
mitk::TimeSlicedGeometry::Pointer mitk::DataStorage::ComputeVisibleBoundingGeometry3D( mitk::BaseRenderer* renderer, const char* boolPropertyKey )
{
return ComputeBoundingGeometry3D( "visible", renderer, boolPropertyKey );
}
mitk::BoundingBox::Pointer mitk::DataStorage::ComputeBoundingBox( const char* boolPropertyKey, mitk::BaseRenderer* renderer, const char* boolPropertyKey2)
{
BoundingBox::PointsContainer::Pointer pointscontainer=BoundingBox::PointsContainer::New();
BoundingBox::PointIdentifier pointid=0;
Point3D point;
// Needed for check of zero bounding boxes
mitk::ScalarType nullpoint[]={0,0,0,0,0,0};
BoundingBox::BoundsArrayType itkBoundsZero(nullpoint);
SetOfObjects::ConstPointer all = this->GetAll();
for (SetOfObjects::ConstIterator it = all->Begin(); it != all->End(); ++it)
{
DataNode::Pointer node = it->Value();
if((node.IsNotNull()) && (node->GetData() != NULL) &&
(node->GetData()->IsEmpty()==false) &&
node->IsOn(boolPropertyKey, renderer) &&
node->IsOn(boolPropertyKey2, renderer)
)
{
const Geometry3D* geometry = node->GetData()->GetUpdatedTimeSlicedGeometry();
if (geometry != NULL )
{
// bounding box (only if non-zero)
BoundingBox::BoundsArrayType itkBounds = geometry->GetBoundingBox()->GetBounds();
if (itkBounds == itkBoundsZero)
{
continue;
}
unsigned char i;
for(i=0; i<8; ++i)
{
point = geometry->GetCornerPoint(i);
if(point[0]*point[0]+point[1]*point[1]+point[2]*point[2] < large)
pointscontainer->InsertElement( pointid++, point);
else
{
itkGenericOutputMacro( << "Unrealistically distant corner point encountered. Ignored. Node: " << node );
}
}
}
}
}
BoundingBox::Pointer result = BoundingBox::New();
result->SetPoints(pointscontainer);
result->ComputeBoundingBox();
return result;
}
mitk::TimeBounds mitk::DataStorage::ComputeTimeBounds( const char* boolPropertyKey, mitk::BaseRenderer* renderer, const char* boolPropertyKey2)
{
TimeBounds timeBounds;
ScalarType stmin, stmax, cur;
stmin= ScalarTypeNumericTraits::NonpositiveMin();
stmax= ScalarTypeNumericTraits::max();
timeBounds[0]=stmax; timeBounds[1]=stmin;
SetOfObjects::ConstPointer all = this->GetAll();
for (SetOfObjects::ConstIterator it = all->Begin(); it != all->End(); ++it)
{
DataNode::Pointer node = it->Value();
if((node.IsNotNull()) && (node->GetData() != NULL) &&
(node->GetData()->IsEmpty()==false) &&
node->IsOn(boolPropertyKey, renderer) &&
node->IsOn(boolPropertyKey2, renderer)
)
{
const Geometry3D* geometry = node->GetData()->GetUpdatedTimeSlicedGeometry();
if (geometry != NULL )
{
const TimeBounds & curTimeBounds = geometry->GetTimeBounds();
cur=curTimeBounds[0];
//is it after -infinity, but before everything else that we found until now?
if((cur > stmin) && (cur < timeBounds[0]))
timeBounds[0] = cur;
cur=curTimeBounds[1];
//is it before infinity, but after everything else that we found until now?
if((cur < stmax) && (cur > timeBounds[1]))
timeBounds[1] = cur;
}
}
}
if(!(timeBounds[0] < stmax))
{
timeBounds[0] = stmin;
timeBounds[1] = stmax;
}
return timeBounds;
}
diff --git a/Core/Code/DataManagement/mitkEnumerationProperty.h b/Core/Code/DataManagement/mitkEnumerationProperty.h
index 602392e34a..550965a713 100644
--- a/Core/Code/DataManagement/mitkEnumerationProperty.h
+++ b/Core/Code/DataManagement/mitkEnumerationProperty.h
@@ -1,215 +1,215 @@
/*=========================================================================
Program: Medical Imaging & Interaction Toolkit
Language: C++
Date: $Date$
Version: $Revision$
Copyright (c) German Cancer Research Center, Division of Medical and
Biological Informatics. All rights reserved.
See MITKCopyright.txt or http://www.mitk.org/copyright.html for details.
This software is distributed WITHOUT ANY WARRANTY; without even
the implied warranty of MERCHANTABILITY or FITNESS FOR A PARTICULAR
PURPOSE. See the above copyright notices for more information.
=========================================================================*/
#ifndef _MITK_ENUMERATION_PROPERTY__H_
#define _MITK_ENUMERATION_PROPERTY__H_
#include "mitkBaseProperty.h"
#include <map>
#include <string>
namespace mitk
{
/**
* This class may be used to store properties similar to enumeration values.
* Each enumeration value is identified via a string representation and a
* id. Note, that both string representation and id MUST be unique. This is checked
* when inserting a new enumeration value. Please note that you have to add valid
* enumeration values before you may use the Get/SetValue methods.
*
* To use the class enumeration property you have 2 choices:
*
* 1. Directly use the class and add your possible enumeration values via
* AddEnum(name, id). NOte that the ids do not have to be in any order, they
* just have to be unique. The current value is set via SetValue(...) and
* retrieved via GetValueAsId() or GetValueAsString().
* 2. Create a subclass, which adds the possible enumeration values in its
* constructor and maybe adds some additional convenience functions to
* set/get the value. NOte that you should override AddEnum(...) as protected
* so that the user may not add additional invalid enumeration values.
* As example see mitk::VtkRepresentationProperty or mitk::VtkInterpolationProperty
*
* @ingroup DataManagement
*/
class MITK_CORE_EXPORT EnumerationProperty : public BaseProperty
{
public:
mitkClassMacro( EnumerationProperty, BaseProperty );
itkNewMacro(EnumerationProperty);
/**
* Represents the unique id which is asigned to each enumeration value
*/
typedef unsigned int IdType;
/**
* Type used to store a mapping from enumeration id to enumeration string/
* description
*/
typedef std::map<IdType, std::string> EnumIdsContainerType;
/**
* Type used to store a mapping from enumeration string/description to
* enumeration id
*/
typedef std::map<std::string, IdType> EnumStringsContainerType;
/**
* Type used for iterators over all defined enumeration values.
*/
typedef EnumIdsContainerType::const_iterator EnumConstIterator;
/**
* Adds an enumeration value into the enumeration. The name and id provided
* must be unique. This is checked while adding the new enumeration value.
* If it is not unique, false is returned. If addition was successful, true
* is returned.
* @param name the unique string representation of the enumeration value
* @param id the unique integer representation of the enumeration value
* @returns true, if the name/id combination was successfully added to the
* enumeration values or true otherwise
*/
virtual bool AddEnum( const std::string& name, const IdType& id );
/**
* Sets the current value of the enumeration
* @param name the string representation of the enumeration value to set
* @returns true if the value was successfully set (i.e. it was valid), or
* false, if the name provided is incalid.
*/
virtual bool SetValue( const std::string& name );
/**
* Sets the current value of the enumeration
* @param id the integer representation of the enumeration value to set
* @returns true if the value was successfully set (i.e. it was valid), or
* false, if the id provided is invalid.
*/
virtual bool SetValue( const IdType& id );
/**
* Returns the id of the current enumeration value. If it was not yet set,
* the return value is unspecified
*/
virtual IdType GetValueAsId() const;
/**
* Returns the string representation of the current enumeration value. If it
* was not yet set, the return value is unspecified
*/
virtual std::string GetValueAsString() const;
/**
* Clears all possible enumeration values and the current enumeration value.
*/
virtual void Clear();
/**
* Determines the number of enumeration values which have been added via
* AddEnum(...).
* @returns the number of enumeration values associated with this Enumeration
* Property
*/
virtual EnumIdsContainerType::size_type Size() const;
/**
* Provides access to the set of known enumeration values. The string representation
* may be accessed via iterator->second, the id may be access via iterator->first
* @returns an iterator over all enumeration values.
*/
virtual EnumConstIterator Begin() const;
/**
* Specifies the end of the range of the known enumeration values.
* @returns an iterator pointing past the last known element of the possible
* enumeration values.
*/
virtual EnumConstIterator End() const;
/**
* Returns the string representation for the given id.
* @param id the id for which the string representation should be determined
* if id is invalid, the return value is unspecified.
* @returns the string representation of the given enumeration value
*/
virtual std::string GetEnumString( const IdType& id ) const;
/**
* Returns the integer representation for the given string.
* @param name the enumeration name for which the integer representation should be determined
* if the name is invalid, the return value is unspecified.
* @returns the integer representation of the given enumeration value
*/
virtual IdType GetEnumId( const std::string& name ) const;
/**
* Determines if a given integer representation of an enumeration value
* is valid or not
* @param val the integer value to check
* @returns true if the given value is valid or false otherwise
*/
virtual bool IsValidEnumerationValue( const IdType& val ) const;
/**
* Determines if a given string representation of an enumeration value
* is valid or not
* @param val the string to check
* @returns true if the given value is valid or false otherwise
*/
virtual bool IsValidEnumerationValue( const std::string& val ) const;
virtual bool operator==( const BaseProperty& property ) const;
-
+ virtual BaseProperty& operator=(const BaseProperty& other) { return Superclass::operator=(other); }
const EnumIdsContainerType& GetEnumIds() const;
const EnumStringsContainerType& GetEnumStrings() const;
EnumIdsContainerType& GetEnumIds();
EnumStringsContainerType& GetEnumStrings();
protected:
/**
* Default constructor. The current value of the enumeration is undefined.
*/
EnumerationProperty();
private:
IdType m_CurrentValue;
EnumIdsContainerType m_EnumIds;
EnumStringsContainerType m_EnumStrings;
typedef std::map<std::string, EnumIdsContainerType> IdMapForClassNameContainerType;
typedef std::map<std::string, EnumStringsContainerType> StringMapForClassNameContainerType;
static IdMapForClassNameContainerType s_IdMapForClassName;
static StringMapForClassNameContainerType s_StringMapForClassName;
};
} // namespace
#endif
diff --git a/Core/Code/DataManagement/mitkGenericLookupTable.h b/Core/Code/DataManagement/mitkGenericLookupTable.h
index 6e1fe42a1e..5ef973dc1a 100644
--- a/Core/Code/DataManagement/mitkGenericLookupTable.h
+++ b/Core/Code/DataManagement/mitkGenericLookupTable.h
@@ -1,149 +1,150 @@
/*=========================================================================
Program: Medical Imaging & Interaction Toolkit
Language: C++
Date: $Date: 2008-06-24 19:37:48 +0200 (Di, 24 Jun 2008) $
Version: $Revision: 14641 $
Copyright (c) German Cancer Research Center, Division of Medical and
Biological Informatics. All rights reserved.
See MITKCopyright.txt or http://www.mitk.org/copyright.html for details.
This software is distributed WITHOUT ANY WARRANTY; without even
the implied warranty of MERCHANTABILITY or FITNESS FOR A PARTICULAR
PURPOSE. See the above copyright notices for more information.
=========================================================================*/
#ifndef MITKGENERICLOOKUPTABLE_H_HEADER_INCLUDED_C1061CEE
#define MITKGENERICLOOKUPTABLE_H_HEADER_INCLUDED_C1061CEE
#include <string>
#include <sstream>
#include <stdlib.h>
#include <map>
#include <itkDataObject.h>
#include "mitkVector.h"
#include "mitkCommon.h"
namespace mitk {
/**
* @brief Template class for generating lookup-tables
*
* This class template can be instantiated for all classes/internal types that fulfills
* these requirements:
* - an operator<< so that the properties value can be put into a std::stringstream
* - an operator== so that two properties can be checked for equality
*
* The main purpose of this class is to be used in conjunction with
* GenericLookupTableProperty. This enables passing of arbitrary lookup
* tables to mappers to configure the rendering process.
*/
template <typename T>
class GenericLookupTable
{
public:
typedef unsigned int IdentifierType;
typedef T ValueType;
typedef std::map< IdentifierType, ValueType > LookupTableType;
typedef GenericLookupTable Self;
GenericLookupTable() {}
virtual ~GenericLookupTable()
{
}
virtual const char *GetNameOfClass() const
{
return "GenericLookupTable";
}
void SetTableValue( IdentifierType id, ValueType value )
{
m_LookupTable[id] = value;
}
bool ValueExists(IdentifierType id) const
{
typename LookupTableType::const_iterator it = m_LookupTable.find(id);
return (it != m_LookupTable.end());
}
ValueType GetTableValue( IdentifierType id ) const
{
typename LookupTableType::const_iterator it = m_LookupTable.find(id);
if (it != m_LookupTable.end())
return it->second;
else
throw std::range_error("id does not exist in the lookup table");
}
const LookupTableType& GetLookupTable() const
{
return m_LookupTable;
}
bool operator==( const Self& lookupTable ) const
{
return (m_LookupTable == lookupTable.m_LookupTable);
}
bool operator!=( const Self& lookupTable ) const
{
return !(m_LookupTable == lookupTable.m_LookupTable);
}
virtual Self& operator=(const Self& other) // \TODO: this needs to be unit tested!
{
if ( this == &other )
{
return *this;
}
else
{
m_LookupTable.clear();
m_LookupTable = other.m_LookupTable;
return *this;
}
}
protected:
LookupTableType m_LookupTable;
};
} // namespace mitk
/**
* Generates a specialized subclass of mitk::GenericLookupTable.
* This way, GetNameOfClass() returns the value provided by LookupTableName.
* Please see mitkProperties.h for examples.
* @param LookupTableName the name of the instantiation of GenericLookupTable
* @param Type the value type of the GenericLookupTable
*/
#define mitkSpecializeGenericLookupTable(LookupTableName,Type) \
class MITK_CORE_EXPORT LookupTableName: public GenericLookupTable< Type > \
{ \
public: \
typedef LookupTableName Self; \
typedef GenericLookupTable< Type > Superclass; \
virtual const char *GetNameOfClass() const \
{return #LookupTableName;} \
LookupTableName() {} \
+ virtual Superclass& operator=(const Superclass& other) { return Superclass::operator=(other); } \
virtual ~LookupTableName() {} \
}; \
std::ostream& operator<<(std::ostream& stream, const LookupTableName& /*l*/);
/**
* Generates the ostream << operator for the lookuptable. This definition
* of a global function must be in a cpp file, therefore it is split from the
* class declaration macro mitkSpecializeGenericLookupTable.
*/
#define mitkSpecializeGenericLookupTableOperator(LookupTableName) \
std::ostream& mitk::operator<<(std::ostream& stream, const LookupTableName& /*l*/) \
{ \
return stream; \
};
#endif
diff --git a/Core/Code/DataManagement/mitkGenericProperty.h b/Core/Code/DataManagement/mitkGenericProperty.h
index b31b9956a2..fd3e0201fb 100644
--- a/Core/Code/DataManagement/mitkGenericProperty.h
+++ b/Core/Code/DataManagement/mitkGenericProperty.h
@@ -1,149 +1,150 @@
/*=========================================================================
Program: Medical Imaging & Interaction Toolkit
Language: C++
Date: $Date$
Version: $Revision$
Copyright (c) German Cancer Research Center, Division of Medical and
Biological Informatics. All rights reserved.
See MITKCopyright.txt or http://www.mitk.org/copyright.html for details.
This software is distributed WITHOUT ANY WARRANTY; without even
the implied warranty of MERCHANTABILITY or FITNESS FOR A PARTICULAR
PURPOSE. See the above copyright notices for more information.
=========================================================================*/
#ifndef MITKGENERICPROPERTY_H_HEADER_INCLUDED_C1061CEE
#define MITKGENERICPROPERTY_H_HEADER_INCLUDED_C1061CEE
#include <string>
#include <sstream>
#include <stdlib.h>
#include "mitkVector.h"
#include "mitkCommon.h"
#include "mitkBaseProperty.h"
namespace mitk {
/*!
@ brief Template class for generating properties for int, float, bool, etc.
This class template can be instantiated for all classes/internal types that fulfills
these requirements:
- an operator<< so that the properties value can be put into a std::stringstream
- an operator== so that two properties can be checked for equality
Note: you must use the macro mitkSpecializeGenericProperty to provide specializations
for concrete types (e.g. BoolProperty). Please see mitkProperties.h for examples. If you
don't use the mitkSpecializeGenericProperty Macro, GetNameOfClass() returns a wrong name.
*/
template <typename T>
class GenericProperty : public BaseProperty
{
public:
mitkClassMacro(GenericProperty, BaseProperty);
mitkNewMacro1Param(GenericProperty<T>, T);
typedef T ValueType;
virtual ~GenericProperty()
{
}
itkSetMacro(Value,T);
itkGetConstMacro(Value,T);
virtual bool operator==(const BaseProperty& other) const
{
try
{
const Self *otherProp = dynamic_cast<const Self*>(&other);
if(otherProp==NULL) return false;
if (this->m_Value == otherProp->m_Value) return true;
}
catch (std::bad_cast)
{
// nothing to do now - just return false
}
return false;
}
virtual std::string GetValueAsString() const
{
std::stringstream myStr;
myStr << GetValue() ;
return myStr.str();
}
virtual bool Assignable(const BaseProperty& other) const
{
try
{
dynamic_cast<const Self&>(other); // dear compiler, please don't optimize this away!
return true;
}
catch (std::bad_cast)
{
}
return false;
}
virtual BaseProperty& operator=(const BaseProperty& other)
{
try
{
const Self& otherProp( dynamic_cast<const Self&>(other) );
if (this->m_Value != otherProp.m_Value)
{
this->m_Value = otherProp.m_Value;
this->Modified();
}
}
catch (std::bad_cast)
{
// nothing to do then
}
return *this;
}
protected:
GenericProperty() {}
GenericProperty(T x)
: m_Value(x) {}
T m_Value;
};
} // namespace mitk
/**
* Generates a specialized subclass of mitk::GenericProperty.
* This way, GetNameOfClass() returns the value provided by PropertyName.
* Please see mitkProperties.h for examples.
* @param PropertyName the name of the instantiation of GenericProperty
* @param Type the value type of the GenericProperty
*/
#define mitkSpecializeGenericProperty(PropertyName,Type,DefaultValue) \
class MITK_CORE_EXPORT PropertyName: public GenericProperty< Type > \
{ \
public: \
mitkClassMacro(PropertyName, GenericProperty< Type >); \
itkNewMacro(PropertyName); \
mitkNewMacro1Param(PropertyName, Type); \
virtual ~PropertyName() {} \
+ virtual BaseProperty& operator=(const BaseProperty& other) { return Superclass::operator=(other); } \
protected: \
PropertyName() { m_Value = DefaultValue; } \
PropertyName(Type x) : GenericProperty<Type>(x) {} \
};
#endif /* MITKGENERICPROPERTY_H_HEADER_INCLUDED_C1061CEE */
diff --git a/Core/Code/DataManagement/mitkGeometry2D.cpp b/Core/Code/DataManagement/mitkGeometry2D.cpp
index 29fe5e370e..3dfdb48c34 100644
--- a/Core/Code/DataManagement/mitkGeometry2D.cpp
+++ b/Core/Code/DataManagement/mitkGeometry2D.cpp
@@ -1,275 +1,273 @@
/*=========================================================================
Program: Medical Imaging & Interaction Toolkit
Language: C++
Date: $Date$
Version: $Revision$
Copyright (c) German Cancer Research Center, Division of Medical and
Biological Informatics. All rights reserved.
See MITKCopyright.txt or http://www.mitk.org/copyright.html for details.
This software is distributed WITHOUT ANY WARRANTY; without even
the implied warranty of MERCHANTABILITY or FITNESS FOR A PARTICULAR
PURPOSE. See the above copyright notices for more information.
=========================================================================*/
#include "mitkGeometry2D.h"
#include <vtkTransform.h>
mitk::Geometry2D::Geometry2D()
: m_ScaleFactorMMPerUnitX( 1.0 ),
m_ScaleFactorMMPerUnitY( 1.0 ),
m_ReferenceGeometry( NULL )
{
}
+mitk::Geometry2D::Geometry2D(const Geometry2D& other)
+ : Geometry3D(other), m_ScaleFactorMMPerUnitX( other.m_ScaleFactorMMPerUnitX),
+ m_ScaleFactorMMPerUnitY( other.m_ScaleFactorMMPerUnitY),
+ m_ReferenceGeometry( other.m_ReferenceGeometry )
+{
+}
+
+
mitk::Geometry2D::~Geometry2D()
{
}
void
mitk::Geometry2D::SetIndexToWorldTransform(
mitk::AffineTransform3D* transform)
{
Superclass::SetIndexToWorldTransform(transform);
m_ScaleFactorMMPerUnitX=GetExtentInMM(0)/GetExtent(0);
m_ScaleFactorMMPerUnitY=GetExtentInMM(1)/GetExtent(1);
assert(m_ScaleFactorMMPerUnitX<ScalarTypeNumericTraits::infinity());
assert(m_ScaleFactorMMPerUnitY<ScalarTypeNumericTraits::infinity());
}
void
mitk::Geometry2D::SetExtentInMM(int direction, ScalarType extentInMM)
{
Superclass::SetExtentInMM(direction, extentInMM);
m_ScaleFactorMMPerUnitX=GetExtentInMM(0)/GetExtent(0);
m_ScaleFactorMMPerUnitY=GetExtentInMM(1)/GetExtent(1);
assert(m_ScaleFactorMMPerUnitX<ScalarTypeNumericTraits::infinity());
assert(m_ScaleFactorMMPerUnitY<ScalarTypeNumericTraits::infinity());
}
bool
mitk::Geometry2D::Map(
const mitk::Point3D &pt3d_mm, mitk::Point2D &pt2d_mm) const
{
assert(m_BoundingBox.IsNotNull());
Point3D pt3d_units;
BackTransform(pt3d_mm, pt3d_units);
pt2d_mm[0]=pt3d_units[0]*m_ScaleFactorMMPerUnitX;
pt2d_mm[1]=pt3d_units[1]*m_ScaleFactorMMPerUnitY;
pt3d_units[2]=0;
return const_cast<BoundingBox*>(m_BoundingBox.GetPointer())->IsInside(pt3d_units);
}
void
mitk::Geometry2D::Map(const mitk::Point2D &pt2d_mm, mitk::Point3D &pt3d_mm) const
{
Point3D pt3d_units;
pt3d_units[0]=pt2d_mm[0]/m_ScaleFactorMMPerUnitX;
pt3d_units[1]=pt2d_mm[1]/m_ScaleFactorMMPerUnitY;
pt3d_units[2]=0;
pt3d_mm = GetParametricTransform()->TransformPoint(pt3d_units);
}
void
mitk::Geometry2D::IndexToWorld(
const mitk::Point2D &/*pt_units*/, mitk::Point2D &/*pt_mm*/) const
{
itkExceptionMacro(<< "No general transform possible (only affine) ==> no general" \
" IndexToWorld(const mitk::Point2D &pt_mm, mitk::Point2D &pt_units)" \
" possible. Has to be implemented in sub-class.");
}
void
mitk::Geometry2D::WorldToIndex(
const mitk::Point2D &/*pt_mm*/, mitk::Point2D &/*pt_units*/) const
{
itkExceptionMacro(<< "No general back transform possible (only affine) ==> no general" \
" WorldToIndex(const mitk::Point2D &pt_mm, mitk::Point2D &pt_units)" \
" possible. Has to be implemented in sub-class.");
}
void
mitk::Geometry2D::IndexToWorld(const mitk::Point2D &/*atPt2d_units*/,
const mitk::Vector2D &/*vec_units*/, mitk::Vector2D &/*vec_mm*/) const
{
itkExceptionMacro(<< "No general transform possible (only affine) ==> no general" \
" IndexToWorld(const mitk::Vector2D &vec_mm, mitk::Vector2D &vec_units)" \
" possible. Has to be implemented in sub-class.");
}
void
mitk::Geometry2D::WorldToIndex(const mitk::Point2D &/*atPt2d_mm*/,
const mitk::Vector2D &/*vec_mm*/, mitk::Vector2D &/*vec_units*/) const
{
itkExceptionMacro(<< "No general back transform possible (only affine) ==> no general" \
" WorldToIndex(const mitk::Vector2D &vec_mm, mitk::Vector2D &vec_units)" \
" possible. Has to be implemented in sub-class.");
}
void
mitk::Geometry2D::SetSizeInUnits(mitk::ScalarType width, mitk::ScalarType height)
{
ScalarType bounds[6]={0, width, 0, height, 0, 1};
ScalarType extent, newextentInMM;
if(GetExtent(0)>0)
{
extent = GetExtent(0);
if(width>extent)
newextentInMM = GetExtentInMM(0)/width*extent;
else
newextentInMM = GetExtentInMM(0)*extent/width;
SetExtentInMM(0, newextentInMM);
}
if(GetExtent(1)>0)
{
extent = GetExtent(1);
if(width>extent)
newextentInMM = GetExtentInMM(1)/height*extent;
else
newextentInMM = GetExtentInMM(1)*extent/height;
SetExtentInMM(1, newextentInMM);
}
SetBounds(bounds);
}
bool
mitk::Geometry2D::Project(
const mitk::Point3D &pt3d_mm, mitk::Point3D &projectedPt3d_mm) const
{
assert(m_BoundingBox.IsNotNull());
Point3D pt3d_units;
BackTransform(pt3d_mm, pt3d_units);
pt3d_units[2] = 0;
projectedPt3d_mm = GetParametricTransform()->TransformPoint(pt3d_units);
return const_cast<BoundingBox*>(m_BoundingBox.GetPointer())->IsInside(pt3d_units);
}
bool
mitk::Geometry2D::Map(const mitk::Point3D & atPt3d_mm,
const mitk::Vector3D &vec3d_mm, mitk::Vector2D &vec2d_mm) const
{
Point2D pt2d_mm_start, pt2d_mm_end;
Point3D pt3d_mm_end;
bool inside=Map(atPt3d_mm, pt2d_mm_start);
pt3d_mm_end = atPt3d_mm+vec3d_mm;
inside&=Map(pt3d_mm_end, pt2d_mm_end);
vec2d_mm=pt2d_mm_end-pt2d_mm_start;
return inside;
}
void
mitk::Geometry2D::Map(const mitk::Point2D &/*atPt2d_mm*/,
const mitk::Vector2D &/*vec2d_mm*/, mitk::Vector3D &/*vec3d_mm*/) const
{
//@todo implement parallel to the other Map method!
assert(false);
}
bool
mitk::Geometry2D::Project(const mitk::Point3D & atPt3d_mm,
const mitk::Vector3D &vec3d_mm, mitk::Vector3D &projectedVec3d_mm) const
{
assert(m_BoundingBox.IsNotNull());
Vector3D vec3d_units;
BackTransform(atPt3d_mm, vec3d_mm, vec3d_units);
vec3d_units[2] = 0;
projectedVec3d_mm = GetParametricTransform()->TransformVector(vec3d_units);
Point3D pt3d_units;
BackTransform(atPt3d_mm, pt3d_units);
return const_cast<BoundingBox*>(m_BoundingBox.GetPointer())->IsInside(pt3d_units);
}
mitk::ScalarType
mitk::Geometry2D::SignedDistance(const mitk::Point3D& pt3d_mm) const
{
Point3D projectedPoint;
Project(pt3d_mm, projectedPoint);
Vector3D direction = pt3d_mm-projectedPoint;
ScalarType distance = direction.GetNorm();
if(IsAbove(pt3d_mm) == false)
distance*=-1.0;
return distance;
}
bool
mitk::Geometry2D::IsAbove(const mitk::Point3D& pt3d_mm) const
{
Point3D pt3d_units;
Geometry3D::WorldToIndex(pt3d_mm, pt3d_units);
return (pt3d_units[2] > m_BoundingBox->GetBounds()[4]);
}
-mitk::AffineGeometryFrame3D::Pointer
+mitk::AffineGeometryFrame3D::Pointer
mitk::Geometry2D::Clone() const
{
- Self::Pointer newGeometry = Self::New();
- newGeometry->Initialize();
- InitializeGeometry(newGeometry);
+ Self::Pointer newGeometry = new Geometry2D(*this);
+ newGeometry->UnRegister();
return newGeometry.GetPointer();
}
-
-void
-mitk::Geometry2D::InitializeGeometry(Self * newGeometry) const
-{
- Superclass::InitializeGeometry(newGeometry);
-
- newGeometry->SetReferenceGeometry( m_ReferenceGeometry );
-}
-
void
mitk::Geometry2D::PrintSelf(std::ostream& os, itk::Indent indent) const
{
Superclass::PrintSelf(os,indent);
os << indent << " ScaleFactorMMPerUnitX: "
<< m_ScaleFactorMMPerUnitX << std::endl;
os << indent << " ScaleFactorMMPerUnitY: "
<< m_ScaleFactorMMPerUnitY << std::endl;
}
void
mitk::Geometry2D::SetReferenceGeometry( mitk::Geometry3D *geometry )
{
m_ReferenceGeometry = geometry;
}
mitk::Geometry3D *
mitk::Geometry2D::GetReferenceGeometry() const
{
return m_ReferenceGeometry;
}
bool
mitk::Geometry2D::HasReferenceGeometry() const
{
return ( m_ReferenceGeometry != NULL );
}
diff --git a/Core/Code/DataManagement/mitkGeometry2D.h b/Core/Code/DataManagement/mitkGeometry2D.h
index 2074f58443..be4e082542 100644
--- a/Core/Code/DataManagement/mitkGeometry2D.h
+++ b/Core/Code/DataManagement/mitkGeometry2D.h
@@ -1,264 +1,264 @@
/*=========================================================================
Program: Medical Imaging & Interaction Toolkit
Language: C++
Date: $Date$
Version: $Revision$
Copyright (c) German Cancer Research Center, Division of Medical and
Biological Informatics. All rights reserved.
See MITKCopyright.txt or http://www.mitk.org/copyright.html for details.
This software is distributed WITHOUT ANY WARRANTY; without even
the implied warranty of MERCHANTABILITY or FITNESS FOR A PARTICULAR
PURPOSE. See the above copyright notices for more information.
=========================================================================*/
#ifndef GEOMETRY2D_H_HEADER_INCLUDED_C1F4D8E0
#define GEOMETRY2D_H_HEADER_INCLUDED_C1F4D8E0
#include "mitkCommon.h"
#include "mitkGeometry3D.h"
namespace mitk {
/**
* \brief Describes the geometry of a two-dimensional object
*
* Describes a two-dimensional manifold, i.e., to put it simply,
* an object that can be described using a 2D coordinate-system.
*
* Geometry2D can map points between 3D world coordinates
* (in mm) and the described 2D coordinate-system (in mm) by first projecting
* the 3D point onto the 2D manifold and then calculating the 2D-coordinates
* (in mm). These 2D-mm-coordinates can be further converted into
* 2D-unit-coordinates (e.g., pixels), giving a parameter representation of
* the object with parameter values inside a rectangle
* (e.g., [0,0]..[width, height]), which is the bounding box (bounding range
* in z-direction always [0]..[1]).
*
* A Geometry2D describes the 2D representation within a 3D object and is
* therefore itself a Geometry3D (derived from Geometry3D). For example,
* a single CT-image (slice) is 2D in the sense that you can access the
* pixels using 2D-coordinates, but is also 3D, as the pixels are really
* voxels, thus have an extension (thickness) in the 3rd dimension.
*
* Most often, instances of Geometry2D will be used to descibe a plane,
* which is represented by the sub-class PlaneGeometry, but curved
* surfaces are also possible.
*
* Optionally, a reference Geometry3D can be specified, which usually would
* be the geometry associated with the underlying dataset. This is currently
* used for calculating the intersection of inclined / rotated planes
* (represented as Geometry2D) with the bounding box of the associated
* Geometry3D.
*
* \warning The Geometry2Ds are not necessarily up-to-date and not even
* initialized. As described in the previous paragraph, one of the
* Generate-/Copy-/UpdateOutputInformation methods have to initialize it.
* mitk::BaseData::GetGeometry2D() makes sure, that the Geometry2D is
* up-to-date before returning it (by setting the update extent appropriately
* and calling UpdateOutputInformation).
*
* Rule: everything is in mm (or ms for temporal information) if not
* stated otherwise.
* \ingroup Geometry
*/
class MITK_CORE_EXPORT Geometry2D : public mitk::Geometry3D
{
public:
mitkClassMacro(Geometry2D, mitk::Geometry3D);
itkNewMacro(Self);
/**
* \brief Project a 3D point given in mm (\a pt3d_mm) onto the 2D
* geometry. The result is a 2D point in mm (\a pt2d_mm).
*
* The result is a 2D point in mm (\a pt2d_mm) relative to the upper-left
* corner of the geometry. To convert this point into units (e.g., pixels
* in case of an image), use WorldToIndex.
* \return true projection was possible
* \sa Project(const mitk::Point3D &pt3d_mm, mitk::Point3D
* &projectedPt3d_mm)
*/
virtual bool Map(const mitk::Point3D &pt3d_mm, mitk::Point2D &pt2d_mm) const;
/**
* \brief Converts a 2D point given in mm (\a pt2d_mm) relative to the
* upper-left corner of the geometry into the corresponding
* world-coordinate (a 3D point in mm, \a pt3d_mm).
*
* To convert a 2D point given in units (e.g., pixels in case of an
* image) into a 2D point given in mm (as required by this method), use
* IndexToWorld.
*/
virtual void Map(const mitk::Point2D &pt2d_mm, mitk::Point3D &pt3d_mm) const;
/**
* \brief Convert a 2D point given in units (e.g., pixels in case of an
* image) into a 2D point given in mm
*/
virtual void IndexToWorld(
const mitk::Point2D &pt_units, mitk::Point2D &pt_mm) const;
/**
* \brief Convert a 2D point given in mm into a 2D point given in mm
* (e.g., pixels in case of an image)
*/
virtual void WorldToIndex(
const mitk::Point2D &pt_mm, mitk::Point2D &pt_units) const;
/**
* \brief Convert a 2D vector given in units (e.g., pixels in case of an
* image) into a 2D vector given in mm
* \warning strange: in contrast to vtkTransform the class itk::Transform
* does not have the parameter, \em where the vector that is to be
* transformed is located. This method here should also need this
* information for general transforms.
*/
virtual void IndexToWorld(
const mitk::Point2D &atPt2d_units, const mitk::Vector2D &vec_units,
mitk::Vector2D &vec_mm) const;
/**
* \brief Convert a 2D vector given in mm into a 2D point vector in mm
* (e.g., pixels in case of an image)
* \warning strange: in contrast to vtkTransform the class itk::Transform
* does not have the parameter, \em where the vector that is to be
* transformed is located. This method here should also need this
* information for general transforms.
*/
virtual void WorldToIndex(
const mitk::Point2D &atPt2d_mm, const mitk::Vector2D &vec_mm,
mitk::Vector2D &vec_units) const;
/**
* \brief Set the width and height of this 2D-geometry in units by calling
* SetBounds. This does \a not change the extent in mm!
*
* For an image, this is the number of pixels in x-/y-direction.
* \note In contrast to calling SetBounds directly, this does \a not change
* the extent in mm!
*/
virtual void SetSizeInUnits(mitk::ScalarType width, mitk::ScalarType height);
/**
* \brief Project a 3D point given in mm (\a pt3d_mm) onto the 2D
* geometry. The result is a 3D point in mm (\a projectedPt3d_mm).
*
* \return true projection was possible
*/
virtual bool Project(const mitk::Point3D &pt3d_mm,
mitk::Point3D &projectedPt3d_mm) const;
/**
* \brief Project a 3D vector given in mm (\a vec3d_mm) onto the 2D
* geometry. The result is a 2D vector in mm (\a vec2d_mm).
*
* The result is a 2D vector in mm (\a vec2d_mm) relative to the
* upper-left
* corner of the geometry. To convert this point into units (e.g., pixels
* in case of an image), use WorldToIndex.
* \return true projection was possible
* \sa Project(const mitk::Vector3D &vec3d_mm, mitk::Vector3D
* &projectedVec3d_mm)
*/
virtual bool Map(const mitk::Point3D & atPt3d_mm,
const mitk::Vector3D &vec3d_mm, mitk::Vector2D &vec2d_mm) const;
/**
* \brief Converts a 2D vector given in mm (\a vec2d_mm) relative to the
* upper-left corner of the geometry into the corresponding
* world-coordinate (a 3D vector in mm, \a vec3d_mm).
*
* To convert a 2D vector given in units (e.g., pixels in case of an
* image) into a 2D vector given in mm (as required by this method), use
* IndexToWorld.
*/
virtual void Map(const mitk::Point2D & atPt2d_mm,
const mitk::Vector2D &vec2d_mm, mitk::Vector3D &vec3d_mm) const;
/**
* \brief Project a 3D vector given in mm (\a vec3d_mm) onto the 2D
* geometry. The result is a 3D vector in mm (\a projectedVec3d_mm).
*
* \return true projection was possible
*/
virtual bool Project(const mitk::Point3D & atPt3d_mm,
const mitk::Vector3D &vec3d_mm, mitk::Vector3D &projectedVec3d_mm) const;
/**
* \brief Distance of the point from the geometry
* (bounding-box \em not considered)
*
*/
inline ScalarType Distance(const Point3D& pt3d_mm) const
{
return fabs(SignedDistance(pt3d_mm));
}
/**
* \brief Signed distance of the point from the geometry
* (bounding-box \em not considered)
*
*/
virtual ScalarType SignedDistance(const Point3D& pt3d_mm) const;
/**
* \brief Test if the point is above the geometry
* (bounding-box \em not considered)
*
*/
virtual bool IsAbove(const Point3D& pt3d_mm) const;
virtual void SetIndexToWorldTransform(mitk::AffineTransform3D* transform);
virtual void SetExtentInMM(int direction, ScalarType extentInMM);
virtual AffineGeometryFrame3D::Pointer Clone() const;
/**
* \brief Set the geometrical frame of reference in which this Geometry2D
* is placed.
*
* This would usually be the Geometry3D of the underlying dataset, but
* setting it is optional.
*/
void SetReferenceGeometry( mitk::Geometry3D *geometry );
/**
* \brief Get the geometrical frame of reference for this Geometry2D.
*/
Geometry3D *GetReferenceGeometry() const;
bool HasReferenceGeometry() const;
protected:
Geometry2D();
+
+ Geometry2D(const Geometry2D& other);
virtual ~Geometry2D();
- virtual void InitializeGeometry(Self * newGeometry) const;
-
virtual void PrintSelf(std::ostream& os, itk::Indent indent) const;
/**
* \brief factor to convert x-coordinates from mm to units and vice versa
*
*/
mutable mitk::ScalarType m_ScaleFactorMMPerUnitX;
/**
* \brief factor to convert y-coordinates from mm to units and vice versa
*
*/
mutable mitk::ScalarType m_ScaleFactorMMPerUnitY;
mitk::Geometry3D *m_ReferenceGeometry;
};
} // namespace mitk
#endif /* GEOMETRY2D_H_HEADER_INCLUDED_C1F4D8E0 */
diff --git a/Core/Code/DataManagement/mitkGeometry3D.cpp b/Core/Code/DataManagement/mitkGeometry3D.cpp
index de755a370c..7fb073bd35 100644
--- a/Core/Code/DataManagement/mitkGeometry3D.cpp
+++ b/Core/Code/DataManagement/mitkGeometry3D.cpp
@@ -1,717 +1,732 @@
/*=========================================================================
Program: Medical Imaging & Interaction Toolkit
Language: C++
Date: $Date$
Version: $Revision$
Copyright (c) German Cancer Research Center, Division of Medical and
Biological Informatics. All rights reserved.
See MITKCopyright.txt or http://www.mitk.org/copyright.html for details.
This software is distributed WITHOUT ANY WARRANTY; without even
the implied warranty of MERCHANTABILITY or FITNESS FOR A PARTICULAR
PURPOSE. See the above copyright notices for more information.
=========================================================================*/
#include "mitkGeometry3D.h"
#include "mitkMatrixConvert.h"
#include "mitkRotationOperation.h"
#include "mitkPointOperation.h"
#include "mitkInteractionConst.h"
//#include "mitkStatusBar.h"
#include <vtkMatrixToLinearTransform.h>
#include <vtkMatrix4x4.h>
// Standard constructor for the New() macro. Sets the geometry to 3 dimensions
mitk::Geometry3D::Geometry3D()
: m_ParametricBoundingBox(NULL),
m_ImageGeometry(false), m_Valid(true), m_FrameOfReferenceID(0), m_IndexToWorldTransformLastModified(0)
{
FillVector3D(m_FloatSpacing, 1,1,1);
m_VtkMatrix = vtkMatrix4x4::New();
m_VtkIndexToWorldTransform = vtkMatrixToLinearTransform::New();
m_VtkIndexToWorldTransform->SetInput(m_VtkMatrix);
Initialize();
}
+mitk::Geometry3D::Geometry3D(const Geometry3D& other) : Superclass(), m_ParametricBoundingBox(other.m_ParametricBoundingBox),m_TimeBounds(other.m_TimeBounds),
+ m_ImageGeometry(other.m_ImageGeometry), m_Valid(other.m_Valid), m_FrameOfReferenceID(other.m_FrameOfReferenceID), m_IndexToWorldTransformLastModified(other.m_IndexToWorldTransformLastModified), m_RotationQuaternion( other.m_RotationQuaternion ) , m_Origin(other.m_Origin)
+{
+ // AffineGeometryFrame
+ SetBounds(other.GetBounds());
+ //SetIndexToObjectTransform(other.GetIndexToObjectTransform());
+ //SetObjectToNodeTransform(other.GetObjectToNodeTransform());
+ //SetIndexToWorldTransform(other.GetIndexToWorldTransform());
+ // this is not used in AffineGeometryFrame of ITK, thus there are not Get and Set methods
+ // m_IndexToNodeTransform = other.m_IndexToNodeTransform;
+ // m_InvertedTransform = TransformType::New();
+ // m_InvertedTransform = TransformType::New();
+ // m_InvertedTransform->DeepCopy(other.m_InvertedTransform);
+ m_VtkMatrix = vtkMatrix4x4::New();
+ m_VtkMatrix->DeepCopy(other.m_VtkMatrix);
+ if (other.m_ParametricBoundingBox.IsNotNull())
+ {
+ m_ParametricBoundingBox = other.m_ParametricBoundingBox->DeepCopy();
+ }
+ FillVector3D(m_FloatSpacing,other.m_FloatSpacing[0],other.m_FloatSpacing[1],other.m_FloatSpacing[2]);
+ m_VtkIndexToWorldTransform = vtkMatrixToLinearTransform::New();
+ m_VtkIndexToWorldTransform->DeepCopy(other.m_VtkIndexToWorldTransform);
+ m_VtkIndexToWorldTransform->SetInput(m_VtkMatrix);
+ other.InitializeGeometry(this);
+}
mitk::Geometry3D::~Geometry3D()
{
m_VtkMatrix->Delete();
m_VtkIndexToWorldTransform->Delete();
}
static void CopySpacingFromTransform(mitk::AffineTransform3D* transform, mitk::Vector3D& spacing, float floatSpacing[3])
{
mitk::AffineTransform3D::MatrixType::InternalMatrixType vnlmatrix;
vnlmatrix = transform->GetMatrix().GetVnlMatrix();
spacing[0]=vnlmatrix.get_column(0).magnitude();
spacing[1]=vnlmatrix.get_column(1).magnitude();
spacing[2]=vnlmatrix.get_column(2).magnitude();
floatSpacing[0]=spacing[0];
floatSpacing[1]=spacing[1];
floatSpacing[2]=spacing[2];
}
void mitk::Geometry3D::Initialize()
{
float b[6] = {0,1,0,1,0,1};
SetFloatBounds(b);
m_IndexToObjectTransform = TransformType::New();
m_ObjectToNodeTransform = TransformType::New();
if(m_IndexToWorldTransform.IsNull())
m_IndexToWorldTransform = TransformType::New();
else
m_IndexToWorldTransform->SetIdentity();
CopySpacingFromTransform(m_IndexToWorldTransform, m_Spacing, m_FloatSpacing);
vtk2itk(m_IndexToWorldTransform->GetOffset(), m_Origin);
m_VtkMatrix->Identity();
m_TimeBounds[0]=ScalarTypeNumericTraits::NonpositiveMin(); m_TimeBounds[1]=ScalarTypeNumericTraits::max();
m_FrameOfReferenceID = 0;
m_ImageGeometry = false;
}
void mitk::Geometry3D::TransferItkToVtkTransform()
{
// copy m_IndexToWorldTransform into m_VtkIndexToWorldTransform
TransferItkTransformToVtkMatrix(m_IndexToWorldTransform.GetPointer(), m_VtkMatrix);
m_VtkIndexToWorldTransform->Modified();
}
void mitk::Geometry3D::TransferVtkToItkTransform()
{
TransferVtkMatrixToItkTransform(m_VtkMatrix, m_IndexToWorldTransform.GetPointer());
CopySpacingFromTransform(m_IndexToWorldTransform, m_Spacing, m_FloatSpacing);
vtk2itk(m_IndexToWorldTransform->GetOffset(), m_Origin);
}
void mitk::Geometry3D::SetIndexToWorldTransformByVtkMatrix(vtkMatrix4x4* vtkmatrix)
{
m_VtkMatrix->DeepCopy(vtkmatrix);
TransferVtkToItkTransform();
}
void mitk::Geometry3D::SetTimeBounds(const TimeBounds& timebounds)
{
if(m_TimeBounds != timebounds)
{
m_TimeBounds = timebounds;
Modified();
}
}
void mitk::Geometry3D::SetFloatBounds(const float bounds[6])
{
mitk::BoundingBox::BoundsArrayType b;
const float *input = bounds;
int i=0;
for(mitk::BoundingBox::BoundsArrayType::Iterator it = b.Begin(); i < 6 ;++i) *it++ = (mitk::ScalarType)*input++;
SetBoundsArray(b, m_BoundingBox);
}
void mitk::Geometry3D::SetFloatBounds(const double bounds[6])
{
mitk::BoundingBox::BoundsArrayType b;
const double *input = bounds;
int i=0;
for(mitk::BoundingBox::BoundsArrayType::Iterator it = b.Begin(); i < 6 ;++i) *it++ = (mitk::ScalarType)*input++;
SetBoundsArray(b, m_BoundingBox);
}
void mitk::Geometry3D::SetParametricBounds(const BoundingBox::BoundsArrayType& bounds)
{
SetBoundsArray(bounds, m_ParametricBoundingBox);
}
void mitk::Geometry3D::WorldToIndex(const mitk::Point3D &pt_mm, mitk::Point3D &pt_units) const
{
BackTransform(pt_mm, pt_units);
}
void mitk::Geometry3D::IndexToWorld(const mitk::Point3D &pt_units, mitk::Point3D &pt_mm) const
{
pt_mm = m_IndexToWorldTransform->TransformPoint(pt_units);
}
void mitk::Geometry3D::WorldToIndex(const mitk::Point3D &atPt3d_mm, const mitk::Vector3D &vec_mm, mitk::Vector3D &vec_units) const
{
MITK_WARN<<"Warning! Call of the deprecated function Geometry3D::WorldToIndex(point, vec, vec). Use Geometry3D::WorldToIndex(vec, vec) instead!";
//BackTransform(atPt3d_mm, vec_mm, vec_units);
this->WorldToIndex(vec_mm, vec_units);
}
void mitk::Geometry3D::WorldToIndex( const mitk::Vector3D &vec_mm, mitk::Vector3D &vec_units) const
{
BackTransform( vec_mm, vec_units);
}
void mitk::Geometry3D::IndexToWorld(const mitk::Point3D &/*atPt3d_units*/, const mitk::Vector3D &vec_units, mitk::Vector3D &vec_mm) const
{
MITK_WARN<<"Warning! Call of the deprecated function Geometry3D::IndexToWorld(point, vec, vec). Use Geometry3D::IndexToWorld(vec, vec) instead!";
//vec_mm = m_IndexToWorldTransform->TransformVector(vec_units);
this->IndexToWorld(vec_units, vec_mm);
}
void mitk::Geometry3D::IndexToWorld(const mitk::Vector3D &vec_units, mitk::Vector3D &vec_mm) const
{
vec_mm = m_IndexToWorldTransform->TransformVector(vec_units);
}
void mitk::Geometry3D::SetIndexToWorldTransform(mitk::AffineTransform3D* transform)
{
if(m_IndexToWorldTransform.GetPointer() != transform)
{
Superclass::SetIndexToWorldTransform(transform);
CopySpacingFromTransform(m_IndexToWorldTransform, m_Spacing, m_FloatSpacing);
vtk2itk(m_IndexToWorldTransform->GetOffset(), m_Origin);
TransferItkToVtkTransform();
Modified();
}
}
mitk::AffineGeometryFrame3D::Pointer mitk::Geometry3D::Clone() const
{
- Self::Pointer newGeometry = Self::New();
- newGeometry->Initialize();
- InitializeGeometry(newGeometry);
+ Self::Pointer newGeometry = new Self(*this);
+ newGeometry->UnRegister();
return newGeometry.GetPointer();
}
-
+/*
void mitk::Geometry3D::InitializeGeometry(Geometry3D * newGeometry) const
{
Superclass::InitializeGeometry(newGeometry);
newGeometry->SetTimeBounds(m_TimeBounds);
//newGeometry->GetVtkTransform()->SetMatrix(m_VtkIndexToWorldTransform->GetMatrix()); IW
//newGeometry->TransferVtkToItkTransform(); //MH
newGeometry->SetFrameOfReferenceID(GetFrameOfReferenceID());
newGeometry->m_ImageGeometry = m_ImageGeometry;
}
-
+*/
void mitk::Geometry3D::SetExtentInMM(int direction, ScalarType extentInMM)
{
ScalarType len = GetExtentInMM(direction);
if(fabs(len - extentInMM)>=mitk::eps)
{
AffineTransform3D::MatrixType::InternalMatrixType vnlmatrix;
vnlmatrix = m_IndexToWorldTransform->GetMatrix().GetVnlMatrix();
if(len>extentInMM)
vnlmatrix.set_column(direction, vnlmatrix.get_column(direction)/len*extentInMM);
else
vnlmatrix.set_column(direction, vnlmatrix.get_column(direction)*extentInMM/len);
Matrix3D matrix;
matrix = vnlmatrix;
m_IndexToWorldTransform->SetMatrix(matrix);
Modified();
}
}
mitk::BoundingBox::Pointer mitk::Geometry3D::CalculateBoundingBoxRelativeToTransform(const mitk::AffineTransform3D* transform) const
{
mitk::BoundingBox::PointsContainer::Pointer pointscontainer=mitk::BoundingBox::PointsContainer::New();
mitk::BoundingBox::PointIdentifier pointid=0;
unsigned char i;
if(transform!=NULL)
{
mitk::AffineTransform3D::Pointer inverse = mitk::AffineTransform3D::New();
transform->GetInverse(inverse);
for(i=0; i<8; ++i)
pointscontainer->InsertElement( pointid++, inverse->TransformPoint( GetCornerPoint(i) ));
}
else
{
for(i=0; i<8; ++i)
pointscontainer->InsertElement( pointid++, GetCornerPoint(i) );
}
mitk::BoundingBox::Pointer result = mitk::BoundingBox::New();
result->SetPoints(pointscontainer);
result->ComputeBoundingBox();
return result;
}
#include <vtkTransform.h>
void mitk::Geometry3D::ExecuteOperation(Operation* operation)
{
vtkTransform *vtktransform = vtkTransform::New();
vtktransform->SetMatrix(m_VtkMatrix);
switch (operation->GetOperationType())
{
case OpNOTHING:
break;
case OpMOVE:
{
mitk::PointOperation *pointOp = dynamic_cast<mitk::PointOperation *>(operation);
if (pointOp == NULL)
{
//mitk::StatusBar::GetInstance()->DisplayText("received wrong type of operation!See mitkAffineInteractor.cpp", 10000);
return;
}
mitk::Point3D newPos = pointOp->GetPoint();
ScalarType data[3];
vtktransform->GetPosition(data);
vtktransform->PostMultiply();
vtktransform->Translate(newPos[0], newPos[1], newPos[2]);
vtktransform->PreMultiply();
break;
}
case OpSCALE:
{
mitk::PointOperation *pointOp = dynamic_cast<mitk::PointOperation *>(operation);
if (pointOp == NULL)
{
//mitk::StatusBar::GetInstance()->DisplayText("received wrong type of operation!See mitkAffineInteractor.cpp", 10000);
return;
}
mitk::Point3D newScale = pointOp->GetPoint();
ScalarType data[3];
/* calculate new scale: newscale = oldscale * (oldscale + scaletoadd)/oldscale */
data[0] = 1 + (newScale[0] / GetMatrixColumn(0).magnitude());
data[1] = 1 + (newScale[1] / GetMatrixColumn(1).magnitude());
data[2] = 1 + (newScale[2] / GetMatrixColumn(2).magnitude());
mitk::Point3D center = const_cast<mitk::BoundingBox*>(m_BoundingBox.GetPointer())->GetCenter();
ScalarType pos[3];
vtktransform->GetPosition(pos);
vtktransform->PostMultiply();
vtktransform->Translate(-pos[0], -pos[1], -pos[2]);
vtktransform->Translate(-center[0], -center[1], -center[2]);
vtktransform->PreMultiply();
vtktransform->Scale(data[0], data[1], data[2]);
vtktransform->PostMultiply();
vtktransform->Translate(+center[0], +center[1], +center[2]);
vtktransform->Translate(pos[0], pos[1], pos[2]);
vtktransform->PreMultiply();
break;
}
case OpROTATE:
{
mitk::RotationOperation *rotateOp = dynamic_cast<mitk::RotationOperation *>(operation);
if (rotateOp == NULL)
{
//mitk::StatusBar::GetInstance()->DisplayText("received wrong type of operation!See mitkAffineInteractor.cpp", 10000);
return;
}
Vector3D rotationVector = rotateOp->GetVectorOfRotation();
Point3D center = rotateOp->GetCenterOfRotation();
ScalarType angle = rotateOp->GetAngleOfRotation();
vtktransform->PostMultiply();
vtktransform->Translate(-center[0], -center[1], -center[2]);
vtktransform->RotateWXYZ(angle, rotationVector[0], rotationVector[1], rotationVector[2]);
vtktransform->Translate(center[0], center[1], center[2]);
vtktransform->PreMultiply();
break;
}
default:
vtktransform->Delete();
return;
}
m_VtkMatrix->DeepCopy(vtktransform->GetMatrix());
TransferVtkToItkTransform();
Modified();
vtktransform->Delete();
}
void mitk::Geometry3D::BackTransform(const mitk::Point3D &in, mitk::Point3D& out) const
{
ScalarType temp[3];
unsigned int i, j;
const TransformType::OffsetType& offset = m_IndexToWorldTransform->GetOffset();
// Remove offset
for (j = 0; j < 3; j++)
{
temp[j] = in[j] - offset[j];
}
// Get WorldToIndex transform
if (m_IndexToWorldTransformLastModified != m_IndexToWorldTransform->GetMTime())
{
m_InvertedTransform = TransformType::New();
if (!m_IndexToWorldTransform->GetInverse( m_InvertedTransform.GetPointer() ))
{
itkExceptionMacro( "Internal ITK matrix inversion error, cannot proceed." );
}
m_IndexToWorldTransformLastModified = m_IndexToWorldTransform->GetMTime();
}
// Check for valid matrix inversion
const TransformType::MatrixType& inverse = m_InvertedTransform->GetMatrix();
if(inverse.GetVnlMatrix().has_nans())
{
itkExceptionMacro( "Internal ITK matrix inversion error, cannot proceed. Matrix was: " << std::endl
<< m_IndexToWorldTransform->GetMatrix() << "Suggested inverted matrix is:" << std::endl
<< inverse );
}
// Transform point
for (i = 0; i < 3; i++)
{
out[i] = 0.0;
for (j = 0; j < 3; j++)
{
out[i] += inverse[i][j]*temp[j];
}
}
}
void mitk::Geometry3D::BackTransform(const mitk::Point3D &/*at*/, const mitk::Vector3D &in, mitk::Vector3D& out) const
{
MITK_INFO<<"Warning! Call of the deprecated function Geometry3D::BackTransform(point, vec, vec). Use Geometry3D::BackTransform(vec, vec) instead!";
//// Get WorldToIndex transform
//if (m_IndexToWorldTransformLastModified != m_IndexToWorldTransform->GetMTime())
//{
// m_InvertedTransform = TransformType::New();
// if (!m_IndexToWorldTransform->GetInverse( m_InvertedTransform.GetPointer() ))
// {
// itkExceptionMacro( "Internal ITK matrix inversion error, cannot proceed." );
// }
// m_IndexToWorldTransformLastModified = m_IndexToWorldTransform->GetMTime();
//}
//// Check for valid matrix inversion
//const TransformType::MatrixType& inverse = m_InvertedTransform->GetMatrix();
//if(inverse.GetVnlMatrix().has_nans())
//{
// itkExceptionMacro( "Internal ITK matrix inversion error, cannot proceed. Matrix was: " << std::endl
// << m_IndexToWorldTransform->GetMatrix() << "Suggested inverted matrix is:" << std::endl
// << inverse );
//}
//// Transform vector
//for (unsigned int i = 0; i < 3; i++)
//{
// out[i] = 0.0;
// for (unsigned int j = 0; j < 3; j++)
// {
// out[i] += inverse[i][j]*in[j];
// }
//}
this->BackTransform(in, out);
}
void mitk::Geometry3D::BackTransform(const mitk::Vector3D& in, mitk::Vector3D& out) const
{
// Get WorldToIndex transform
if (m_IndexToWorldTransformLastModified != m_IndexToWorldTransform->GetMTime())
{
m_InvertedTransform = TransformType::New();
if (!m_IndexToWorldTransform->GetInverse( m_InvertedTransform.GetPointer() ))
{
itkExceptionMacro( "Internal ITK matrix inversion error, cannot proceed." );
}
m_IndexToWorldTransformLastModified = m_IndexToWorldTransform->GetMTime();
}
// Check for valid matrix inversion
const TransformType::MatrixType& inverse = m_InvertedTransform->GetMatrix();
if(inverse.GetVnlMatrix().has_nans())
{
itkExceptionMacro( "Internal ITK matrix inversion error, cannot proceed. Matrix was: " << std::endl
<< m_IndexToWorldTransform->GetMatrix() << "Suggested inverted matrix is:" << std::endl
<< inverse );
}
// Transform vector
for (unsigned int i = 0; i < 3; i++)
{
out[i] = 0.0;
for (unsigned int j = 0; j < 3; j++)
{
out[i] += inverse[i][j]*in[j];
}
}
}
const float* mitk::Geometry3D::GetFloatSpacing() const
{
return m_FloatSpacing;
}
-void mitk::Geometry3D::SetSpacing(const float aSpacing[3])
-{
- mitk::Vector3D tmp;
- tmp[0]= aSpacing[0];
- tmp[1]= aSpacing[1];
- tmp[2]= aSpacing[2];
- SetSpacing(tmp);
-}
-
void mitk::Geometry3D::SetSpacing(const mitk::Vector3D& aSpacing)
{
if(mitk::Equal(m_Spacing, aSpacing) == false)
{
assert(aSpacing[0]>0 && aSpacing[1]>0 && aSpacing[2]>0);
m_Spacing = aSpacing;
AffineTransform3D::MatrixType::InternalMatrixType vnlmatrix;
vnlmatrix = m_IndexToWorldTransform->GetMatrix().GetVnlMatrix();
mitk::VnlVector col;
col = vnlmatrix.get_column(0); col.normalize(); col*=aSpacing[0]; vnlmatrix.set_column(0, col);
col = vnlmatrix.get_column(1); col.normalize(); col*=aSpacing[1]; vnlmatrix.set_column(1, col);
col = vnlmatrix.get_column(2); col.normalize(); col*=aSpacing[2]; vnlmatrix.set_column(2, col);
Matrix3D matrix;
matrix = vnlmatrix;
AffineTransform3D::Pointer transform = AffineTransform3D::New();
transform->SetMatrix(matrix);
transform->SetOffset(m_IndexToWorldTransform->GetOffset());
SetIndexToWorldTransform(transform.GetPointer());
itk2vtk(m_Spacing, m_FloatSpacing);
}
}
void mitk::Geometry3D::SetOrigin(const Point3D & origin)
{
if(origin!=GetOrigin())
{
m_Origin = origin;
m_IndexToWorldTransform->SetOffset(m_Origin.GetVectorFromOrigin());
Modified();
TransferItkToVtkTransform();
}
}
void mitk::Geometry3D::Translate(const Vector3D & vector)
{
if((vector[0] != 0) || (vector[1] != 0) || (vector[2] != 0))
{
m_IndexToWorldTransform->SetOffset(m_IndexToWorldTransform->GetOffset()+vector);
TransferItkToVtkTransform();
Modified();
}
}
void mitk::Geometry3D::SetIdentity()
{
m_IndexToWorldTransform->SetIdentity();
m_Origin.Fill(0);
Modified();
TransferItkToVtkTransform();
}
void mitk::Geometry3D::Compose( const mitk::AffineGeometryFrame3D::TransformType * other, bool pre )
{
m_IndexToWorldTransform->Compose(other, pre);
CopySpacingFromTransform(m_IndexToWorldTransform, m_Spacing, m_FloatSpacing);
vtk2itk(m_IndexToWorldTransform->GetOffset(), m_Origin);
Modified();
TransferItkToVtkTransform();
}
void mitk::Geometry3D::Compose( const vtkMatrix4x4 * vtkmatrix, bool pre )
{
mitk::AffineGeometryFrame3D::TransformType::Pointer itkTransform = mitk::AffineGeometryFrame3D::TransformType::New();
TransferVtkMatrixToItkTransform(vtkmatrix, itkTransform.GetPointer());
Compose(itkTransform, pre);
}
const char* mitk::Geometry3D::GetTransformAsString( TransformType* transformType )
{
static char buffer[255];
for ( int j=0; j<255; j++) buffer[j] = '\0';
ostrstream out( buffer, 255 );
out << '[';
for( int i=0; i<3; ++i )
{
out << '[';
for( int j=0; j<3; ++j )
out << transformType->GetMatrix().GetVnlMatrix().get(i, j) << ' ';
out << ']';
}
out << "][";
for( int i=0; i<3; ++i )
out << transformType->GetOffset()[i] << ' ';
out << "]\0";
return buffer;
}
void mitk::Geometry3D::PrintSelf(std::ostream& os, itk::Indent indent) const
{
os << indent << " IndexToWorldTransform: ";
if(m_IndexToWorldTransform.IsNull())
os << "NULL" << std::endl;
else
{
// from itk::MatrixOffsetTransformBase
unsigned int i, j;
os << std::endl;
os << indent << "Matrix: " << std::endl;
for (i = 0; i < 3; i++)
{
os << indent.GetNextIndent();
for (j = 0; j < 3; j++)
{
os << m_IndexToWorldTransform->GetMatrix()[i][j] << " ";
}
os << std::endl;
}
os << indent << "Offset: " << m_IndexToWorldTransform->GetOffset() << std::endl;
os << indent << "Center: " << m_IndexToWorldTransform->GetCenter() << std::endl;
os << indent << "Translation: " << m_IndexToWorldTransform->GetTranslation() << std::endl;
os << indent << "Inverse: " << std::endl;
for (i = 0; i < 3; i++)
{
os << indent.GetNextIndent();
for (j = 0; j < 3; j++)
{
os << m_IndexToWorldTransform->GetInverseMatrix()[i][j] << " ";
}
os << std::endl;
}
// from itk::ScalableAffineTransform
os << indent << "Scale : ";
for (i = 0; i < 3; i++)
{
os << m_IndexToWorldTransform->GetScale()[i] << " ";
}
os << std::endl;
}
os << indent << " BoundingBox: ";
if(m_BoundingBox.IsNull())
os << "NULL" << std::endl;
else
{
os << indent << "( ";
for (unsigned int i=0; i<3; i++)
{
os << m_BoundingBox->GetBounds()[2*i] << "," << m_BoundingBox->GetBounds()[2*i+1] << " ";
}
os << " )" << std::endl;
}
os << indent << " Origin: " << m_Origin << std::endl;
os << indent << " ImageGeometry: " << m_ImageGeometry << std::endl;
os << indent << " Spacing: " << m_Spacing << std::endl;
os << indent << " TimeBounds: " << m_TimeBounds << std::endl;
}
mitk::Point3D mitk::Geometry3D::GetCornerPoint(int id) const
{
assert(id >= 0);
assert(m_BoundingBox.IsNotNull());
BoundingBox::BoundsArrayType bounds = m_BoundingBox->GetBounds();
Point3D cornerpoint;
switch(id)
{
case 0: FillVector3D(cornerpoint, bounds[0],bounds[2],bounds[4]); break;
case 1: FillVector3D(cornerpoint, bounds[0],bounds[2],bounds[5]); break;
case 2: FillVector3D(cornerpoint, bounds[0],bounds[3],bounds[4]); break;
case 3: FillVector3D(cornerpoint, bounds[0],bounds[3],bounds[5]); break;
case 4: FillVector3D(cornerpoint, bounds[1],bounds[2],bounds[4]); break;
case 5: FillVector3D(cornerpoint, bounds[1],bounds[2],bounds[5]); break;
case 6: FillVector3D(cornerpoint, bounds[1],bounds[3],bounds[4]); break;
case 7: FillVector3D(cornerpoint, bounds[1],bounds[3],bounds[5]); break;
default:
{
itkExceptionMacro(<<"A cube only has 8 corners. These are labeled 0-7.");
return NULL;
}
}
if(m_ImageGeometry)
{
// Here i have to adjust the 0.5 offset manually, because the cornerpoint is the corner of the
// bounding box. The bounding box itself is no image, so it is corner-based
FillVector3D(cornerpoint, cornerpoint[0]-0.5, cornerpoint[1]-0.5, cornerpoint[2]-0.5);
}
return m_IndexToWorldTransform->TransformPoint(cornerpoint);
}
mitk::Point3D mitk::Geometry3D::GetCornerPoint(bool xFront, bool yFront, bool zFront) const
{
assert(m_BoundingBox.IsNotNull());
BoundingBox::BoundsArrayType bounds = m_BoundingBox->GetBounds();
Point3D cornerpoint;
cornerpoint[0] = (xFront ? bounds[0] : bounds[1]);
cornerpoint[1] = (yFront ? bounds[2] : bounds[3]);
cornerpoint[2] = (zFront ? bounds[4] : bounds[5]);
if(m_ImageGeometry)
{
// Here i have to adjust the 0.5 offset manually, because the cornerpoint is the corner of the
// bounding box. The bounding box itself is no image, so it is corner-based
FillVector3D(cornerpoint, cornerpoint[0]-0.5, cornerpoint[1]-0.5, cornerpoint[2]-0.5);
}
return m_IndexToWorldTransform->TransformPoint(cornerpoint);
}
void
mitk::Geometry3D::ResetSubTransforms()
{
}
void
mitk::Geometry3D::ChangeImageGeometryConsideringOriginOffset( const bool isAnImageGeometry )
{
// If Geometry is switched to ImageGeometry, you have to put an offset to the origin, because
// imageGeometries origins are pixel-center-based
// ... and remove the offset, if you switch an imageGeometry back to a normal geometry
// For more information please see the Geometry documentation page
if(m_ImageGeometry == isAnImageGeometry)
return;
const BoundingBox::BoundsArrayType& boundsarray =
this->GetBoundingBox()->GetBounds();
Point3D originIndex;
FillVector3D(originIndex, boundsarray[0], boundsarray[2], boundsarray[4]);
if(isAnImageGeometry == true)
FillVector3D( originIndex,
originIndex[0] + 0.5,
originIndex[1] + 0.5,
originIndex[2] + 0.5 );
else
FillVector3D( originIndex,
originIndex[0] - 0.5,
originIndex[1] - 0.5,
originIndex[2] - 0.5 );
Point3D originWorld;
originWorld = GetIndexToWorldTransform()
->TransformPoint( originIndex );
// instead could as well call IndexToWorld(originIndex,originWorld);
SetOrigin(originWorld);
this->SetImageGeometry(isAnImageGeometry);
-}
\ No newline at end of file
+}
diff --git a/Core/Code/DataManagement/mitkGeometry3D.h b/Core/Code/DataManagement/mitkGeometry3D.h
index 76aed22e3d..6782431d58 100644
--- a/Core/Code/DataManagement/mitkGeometry3D.h
+++ b/Core/Code/DataManagement/mitkGeometry3D.h
@@ -1,693 +1,680 @@
/*=========================================================================
Program: Medical Imaging & Interaction Toolkit
Language: C++
Date: $Date$
Version: $Revision$
Copyright (c) German Cancer Research Center, Division of Medical and
Biological Informatics. All rights reserved.
See MITKCopyright.txt or http://www.mitk.org/copyright.html for details.
This software is distributed WITHOUT ANY WARRANTY; without even
the implied warranty of MERCHANTABILITY or FITNESS FOR A PARTICULAR
PURPOSE. See the above copyright notices for more information.
=========================================================================*/
#ifndef GEOMETRY3D_H_HEADER_INCLUDED_C1EBD0AD
#define GEOMETRY3D_H_HEADER_INCLUDED_C1EBD0AD
#include "mitkCommon.h"
#include "mitkVector.h"
#include "mitkOperationActor.h"
#include <itkIndex.h>
#include <itkBoundingBox.h>
#include <itkQuaternionRigidTransform.h>
#include <itkAffineGeometryFrame.h>
class vtkLinearTransform;
class vtkMatrixToLinearTransform;
class vtkMatrix4x4;
namespace mitk {
//##Documentation
//## @brief Standard 3D-BoundingBox typedef
//##
//## Standard 3D-BoundingBox typedef to get rid of template arguments (3D, type).
typedef itk::BoundingBox<unsigned long, 3, ScalarType> BoundingBox;
//##Documentation
//## @brief Standard typedef for time-bounds
typedef itk::FixedArray<ScalarType,2> TimeBounds;
typedef itk::FixedArray<ScalarType, 3> FixedArrayType;
typedef itk::AffineGeometryFrame<ScalarType, 3> AffineGeometryFrame3D;
//##Documentation
//## @brief Describes the geometry of a data object
//##
//## At least, it can return the bounding box of the data object.
//##
//## The class holds
//## \li a bounding box which is axes-parallel in intrinsic coordinates
//## (often integer indices of pixels), to be accessed by
//## GetBoundingBox()
//## \li a transform to convert intrinsic coordinates into a
//## world-coordinate system with coordinates in millimeters
//## and milliseconds (all are floating point values), to
//## be accessed by GetIndexToWorldTransform()
//## \li a life span, i.e. a bounding box in time in ms (with
//## start and end time), to be accessed by GetTimeBounds().
//## The default is minus infinity to plus infinity.
//##
//## Geometry3D and its sub-classes allow converting between
//## intrinsic coordinates (called index or unit coordinates)
//## and world-coordinates (called world or mm coordinates),
//## e.g. WorldToIndex.
//## In case you need integer index coordinates, provide an
//## mitk::Index3D (or itk::Index) as target variable to
//## WorldToIndex, otherwise you will get a continuous index
//## (floating point values).
//##
//## An important sub-class is SlicedGeometry3D, which descibes
//## data objects consisting of slices, e.g., objects of type Image.
//## Conversions between world coordinates (in mm) and unit coordinates
//## (e.g., pixels in the case of an Image) can be performed.
//##
//## For more information on related classes, see \ref Geometry.
//##
//## Geometry3D instances referring to an Image need a slightly
//## different definition of corners, see SetImageGeometry. This
//## is usualy automatically called by Image.
//##
//## Geometry3D have to be initialized in the method GenerateOutputInformation()
//## of BaseProcess (or CopyInformation/ UpdateOutputInformation of BaseData,
//## if possible, e.g., by analyzing pic tags in Image) subclasses. See also
//## itk::ProcessObject::GenerateOutputInformation(),
//## itk::DataObject::CopyInformation() and
//## itk::DataObject::UpdateOutputInformation().
//##
//## Rule: everything is in mm (ms) if not stated otherwise.
//## @ingroup Geometry
class MITK_CORE_EXPORT Geometry3D : public AffineGeometryFrame3D, public OperationActor
{
public:
mitkClassMacro(Geometry3D, AffineGeometryFrame3D);
typedef itk::QuaternionRigidTransform< ScalarType > QuaternionTransformType;
typedef QuaternionTransformType::VnlQuaternionType VnlQuaternionType;
/** Method for creation through the object factory. */
itkNewMacro(Self);
// a bit of a misuse, but we want only doxygen to see the following:
#ifdef DOXYGEN_SKIP
//##Documentation
//## @brief Get the transformation used to convert from index
//## to world coordinates
itkGetObjectMacro(IndexToWorldTransform, AffineTransform3D);
#endif
//## @brief Set the transformation used to convert from index
//## to world coordinates
virtual void SetIndexToWorldTransform(mitk::AffineTransform3D* transform);
//##Documentation
//## @brief Convenience method for setting the ITK transform
//## (m_IndexToWorldTransform) via an vtkMatrix4x4
//## \sa SetIndexToWorldTransform
virtual void SetIndexToWorldTransformByVtkMatrix(vtkMatrix4x4* vtkmatrix);
#ifdef DOXYGEN_SKIP
//##Documentation
//## @brief Get bounding box (in index/unit coordinates)
itkGetConstObjectMacro(BoundingBox, BoundingBoxType);
//##Documentation
//## @brief Get bounding box (in index/unit coordinates) as a BoundsArrayType
const BoundsArrayType GetBounds() const
{
assert(m_BoundingBox.IsNotNull());
return m_BoundingBox->GetBounds();
}
//##Documentation
//## \brief Set the bounding box (in index/unit coordinates)
//##
//## Only possible via the BoundsArray to make clear that a
//## copy of the bounding-box is stored, not a reference to it.
virtual void SetBounds(const BoundsArrayType& bounds);
#endif
//##Documentation
//## @brief Set the bounding box (in index/unit coordinates) via a float array
virtual void SetFloatBounds(const float bounds[6]);
//##Documentation
//## @brief Set the bounding box (in index/unit coordinates) via a double array
virtual void SetFloatBounds(const double bounds[6]);
//##Documentation
//## @brief When switching from an Image Geometry to a normal Geometry (and the other way around), you have to change the origin as well (See Geometry Documentation)! This function will change the "isImageGeometry" bool flag and changes the origin respectively.
virtual void ChangeImageGeometryConsideringOriginOffset( const bool isAnImageGeometry );
//##Documentation
//## @brief Get the time bounds (in ms)
itkGetConstReferenceMacro(TimeBounds, TimeBounds);
//##Documentation
//## @brief Set the time bounds (in ms)
virtual void SetTimeBounds(const TimeBounds& timebounds);
//##Documentation
//## @brief Get the position of the corner number \a id (in world coordinates)
//##
//## See SetImageGeometry for how a corner is defined on images.
Point3D GetCornerPoint(int id) const;
//##Documentation
//## @brief Get the position of a corner (in world coordinates)
//##
//## See SetImageGeometry for how a corner is defined on images.
Point3D GetCornerPoint(bool xFront=true, bool yFront=true, bool zFront=true) const;
//##Documentation
//## @brief Get vector along bounding-box in the specified @a direction in mm
//##
//## The length of the vector is the size of the bounding-box in the
//## specified @a direction in mm
//## \sa GetMatrixColumn
Vector3D GetAxisVector(unsigned int direction) const
{
Vector3D frontToBack;
frontToBack.Set_vnl_vector(m_IndexToWorldTransform->GetMatrix().GetVnlMatrix().get_column(direction));
frontToBack *= GetExtent(direction);
return frontToBack;
}
//##Documentation
//## @brief Get the center of the bounding-box in mm
//##
Point3D GetCenter() const
{
assert(m_BoundingBox.IsNotNull());
return m_IndexToWorldTransform->TransformPoint(m_BoundingBox->GetCenter());
}
//##Documentation
//## @brief Get the squared length of the diagonal of the bounding-box in mm
//##
double GetDiagonalLength2() const
{
Vector3D diagonalvector = GetCornerPoint()-GetCornerPoint(false, false, false);
return diagonalvector.GetSquaredNorm();
}
//##Documentation
//## @brief Get the length of the diagonal of the bounding-box in mm
//##
double GetDiagonalLength() const
{
return sqrt(GetDiagonalLength2());
}
//##Documentation
//## @brief Get a VnlVector along bounding-box in the specified
//## @a direction, length is spacing
//##
//## \sa GetAxisVector
VnlVector GetMatrixColumn(unsigned int direction) const
{
return m_IndexToWorldTransform->GetMatrix().GetVnlMatrix().get_column(direction);
}
#ifdef DOXYGEN_SKIP
//##Documentation
//## @brief Get the extent of the bounding box (in index/unit coordinates)
//##
//## To access the extent in mm use GetExtentInMM
ScalarType GetExtent(unsigned int direction) const;
#endif
//##Documentation
//## @brief Get the extent of the bounding-box in the specified @a direction in mm
//##
//## Equals length of GetAxisVector(direction).
ScalarType GetExtentInMM(int direction) const
{
return m_IndexToWorldTransform->GetMatrix().GetVnlMatrix().get_column(direction).magnitude()*GetExtent(direction);
}
//##Documentation
//## @brief Set the extent of the bounding-box in the specified @a direction in mm
//##
//## @note This changes the matrix in the transform, @a not the bounds, which are given in units!
virtual void SetExtentInMM(int direction, ScalarType extentInMM);
//##Documentation
//## @brief Get the m_IndexToWorldTransform as a vtkLinearTransform
vtkLinearTransform* GetVtkTransform() const
{
return (vtkLinearTransform*)m_VtkIndexToWorldTransform;
}
//##Documentation
//## @brief Set the origin, i.e. the upper-left corner of the plane
//##
virtual void SetOrigin(const Point3D& origin);
//##Documentation
//## @brief Translate the origin by a vector
//##
virtual void Translate(const Vector3D& vector);
//##Documentation
//## @brief Set the transform to identity
//##
virtual void SetIdentity();
//##Documentation
//## @brief Compose new IndexToWorldTransform with a given transform.
//##
//## This method composes m_IndexToWorldTransform with another transform,
//## modifying self to be the composition of self and other.
//## If the argument pre is true, then other is precomposed with self;
//## that is, the resulting transformation consists of first applying
//## other to the source, followed by self. If pre is false or omitted,
//## then other is post-composed with self; that is the resulting
//## transformation consists of first applying self to the source,
//## followed by other.
virtual void Compose( const AffineGeometryFrame3D::TransformType * other, bool pre = 0 );
//##Documentation
//## @brief Compose new IndexToWorldTransform with a given vtkMatrix4x4.
//##
//## Converts the vtkMatrix4x4 into a itk-transform and calls the previous method.
virtual void Compose( const vtkMatrix4x4 * vtkmatrix, bool pre = 0 );
//##Documentation
//## @brief Get the origin, e.g. the upper-left corner of the plane
const Point3D& GetOrigin() const
{
return m_Origin;
}
//##Documentation
//## @brief Get the origin as VnlVector
//##
//## \sa GetOrigin
VnlVector GetOriginVnl() const
{
return const_cast<Self*>(this)->m_Origin.Get_vnl_vector();
}
//##Documentation
//## @brief Convert world coordinates (in mm) of a \em point to (continuous!) index coordinates
//## \warning If you need (discrete) integer index coordinates (e.g., for iterating easily over an image),
//## use WorldToIndex(const mitk::Point3D& pt_mm, itk::Index<VIndexDimension> &index).
//## For further information about coordinates types, please see the Geometry documentation
void WorldToIndex(const mitk::Point3D& pt_mm, mitk::Point3D& pt_units) const;
//##Documentation
//## @brief Convert (continuous or discrete) index coordinates of a \em point to world coordinates (in mm)
//## For further information about coordinates types, please see the Geometry documentation
void IndexToWorld(const mitk::Point3D& pt_units, mitk::Point3D& pt_mm) const;
//##Documentation
//## @brief Convert world coordinates (in mm) of a \em vector
//## \a vec_mm to (continuous!) index coordinates.
//## @deprecated First parameter (Point3D) is not used. If possible, please use void WorldToIndex(const mitk::Vector3D& vec_mm, mitk::Vector3D& vec_units) const.
//## For further information about coordinates types, please see the Geometry documentation
void WorldToIndex(const mitk::Point3D& atPt3d_mm, const mitk::Vector3D& vec_mm, mitk::Vector3D& vec_units) const;
//##Documentation
//## @brief Convert world coordinates (in mm) of a \em vector
//## \a vec_mm to (continuous!) index coordinates.
//## For further information about coordinates types, please see the Geometry documentation
void WorldToIndex(const mitk::Vector3D& vec_mm, mitk::Vector3D& vec_units) const;
//##Documentation
//## @brief Convert (continuous or discrete) index coordinates of a \em vector
//## \a vec_units to world coordinates (in mm)
//## @deprecated First parameter (Point3D) is not used. If possible, please use void IndexToWorld(const mitk::Vector3D& vec_units, mitk::Vector3D& vec_mm) const.
//## For further information about coordinates types, please see the Geometry documentation
void IndexToWorld(const mitk::Point3D& atPt3d_units, const mitk::Vector3D& vec_units, mitk::Vector3D& vec_mm) const;
//##Documentation
//## @brief Convert (continuous or discrete) index coordinates of a \em vector
//## \a vec_units to world coordinates (in mm)
//## For further information about coordinates types, please see the Geometry documentation
void IndexToWorld(const mitk::Vector3D& vec_units, mitk::Vector3D& vec_mm) const;
//##Documentation
//## @brief Convert world coordinates (in mm) of a \em point to (discrete!) index coordinates.
//## This method rounds to integer indices!
//## For further information about coordinates types, please see the Geometry documentation
template <unsigned int VIndexDimension>
void WorldToIndex(const mitk::Point3D& pt_mm, itk::Index<VIndexDimension> &index) const
{
typedef itk::Index<VIndexDimension> IndexType;
mitk::Point3D pt_units;
this->WorldToIndex(pt_mm, pt_units);
int i, dim=index.GetIndexDimension();
if(dim>3)
{
index.Fill(0);
dim=3;
}
for(i=0;i<dim;++i){
//index[i]=itk::Math::RoundHalfIntegerUp<typename IndexType::IndexValueType >( pt_units[i] );
index[i]=itk::Math::RoundHalfIntegerUp( pt_units[i] );
}
}
//##Documentation
//## @brief Deprecated for use with ITK version 3.10 or newer.
//## Convert world coordinates (in mm) of a \em point to
//## ITK physical coordinates (in mm, but without a possible rotation)
//##
//## This method is useful if you have want to access an mitk::Image
//## via an itk::Image. ITK v3.8 and older did not support rotated (tilted)
//## images, i.e., ITK images are always parallel to the coordinate axes.
//## When accessing a (possibly rotated) mitk::Image via an itk::Image
//## the rotational part of the transformation in the Geometry3D is
//## simply discarded; in other word: only the origin and spacing is
//## used by ITK, not the complete matrix available in MITK.
//## With WorldToItkPhysicalPoint you can convert an MITK world
//## coordinate (including the rotation) into a coordinate that
//## can be used with the ITK image as a ITK physical coordinate
//## (excluding the rotation).
template<class TCoordRep>
void WorldToItkPhysicalPoint(const mitk::Point3D& pt_mm,
itk::Point<TCoordRep, 3>& itkPhysicalPoint) const
{
#if ((ITK_VERSION_MAJOR > 3) || (ITK_VERSION_MAJOR == 3 && ITK_VERSION_MINOR > 8))
mitk::vtk2itk(pt_mm, itkPhysicalPoint);
#else
mitk::Point3D index;
WorldToIndex(pt_mm, index);
for (unsigned int i = 0 ; i < 3 ; i++)
{
itkPhysicalPoint[i] = static_cast<TCoordRep>( this->m_Spacing[i] * index[i] + this->m_Origin[i] );
}
#endif
}
//##Documentation
//## @brief Deprecated for use with ITK version 3.10 or newer.
//## Convert ITK physical coordinates of a \em point (in mm,
//## but without a rotation) into MITK world coordinates (in mm)
//##
//## For more information, see WorldToItkPhysicalPoint.
template<class TCoordRep>
void ItkPhysicalPointToWorld(const itk::Point<TCoordRep, 3>& itkPhysicalPoint,
mitk::Point3D& pt_mm) const
{
#if ((ITK_VERSION_MAJOR > 3) || (ITK_VERSION_MAJOR == 3 && ITK_VERSION_MINOR > 8))
mitk::vtk2itk(itkPhysicalPoint, pt_mm);
#else
mitk::Point3D index;
for (unsigned int i = 0 ; i < 3 ; i++)
{
index[i] = static_cast<ScalarType>( (itkPhysicalPoint[i]- this->m_Origin[i]) / this->m_Spacing[i] );
}
IndexToWorld(index, pt_mm);
#endif
}
//##Documentation
//## @brief Initialize the Geometry3D
virtual void Initialize();
//##Documentation
//## @brief Is this an ImageGeometry?
//##
//## For more information, see SetImageGeometry
itkGetConstMacro(ImageGeometry, bool);
//##Documentation
//## @brief Define that this Geometry3D is refering to an Image
//##
//## A geometry referring to an Image needs a slightly different
//## definition of the position of the corners (see GetCornerPoint).
//## The position of a voxel is defined by the position of its center.
//## If we would use the origin (position of the (center of) the first
//## voxel) as a corner and display this point, it would seem to be
//## \em not at the corner but a bit within the image. Even worse for
//## the opposite corner of the image: here the corner would appear
//## outside the image (by half of the voxel diameter). Thus, we have
//## to correct for this and to be able to do that, we need to know
//## that the Geometry3D is referring to an Image.
itkSetMacro(ImageGeometry, bool);
itkBooleanMacro(ImageGeometry);
//##Documentation
//## @brief Is this Geometry3D in a state that is valid?
virtual bool IsValid() const
{
return m_Valid;
}
//##Documentation
//## @brief Test whether the point \a p (world coordinates in mm) is
//## inside the bounding box
bool IsInside(const mitk::Point3D& p) const
{
mitk::Point3D index;
WorldToIndex(p, index);
return IsIndexInside(index);
}
//##Documentation
//## @brief Test whether the point \a p ((continous!)index coordinates in units) is
//## inside the bounding box
bool IsIndexInside(const mitk::Point3D& index) const
{
bool inside = false;
//if it is an image geometry, we need to convert the index to discrete values
//this is done by applying the rounding function also used in WorldToIndex (see line 323)
if (m_ImageGeometry)
{
mitk::Point3D discretIndex;
discretIndex[0]=itk::Math::RoundHalfIntegerUp( index[0] );
discretIndex[1]=itk::Math::RoundHalfIntegerUp( index[1] );
discretIndex[2]=itk::Math::RoundHalfIntegerUp( index[2] );
inside = m_BoundingBox->IsInside(discretIndex);
//we have to check if the index is at the upper border of each dimension,
// because the boundingbox is not centerbased
if (inside)
{
const BoundingBox::BoundsArrayType& bounds = m_BoundingBox->GetBounds();
if((discretIndex[0] == bounds[1]) ||
(discretIndex[1] == bounds[3]) ||
(discretIndex[2] == bounds[5]))
inside = false;
}
}
else
inside = m_BoundingBox->IsInside(index);
return inside;
}
//##Documentation
//## @brief Convenience method for working with ITK indices
template <unsigned int VIndexDimension>
bool IsIndexInside(const itk::Index<VIndexDimension> &index) const
{
int i, dim=index.GetIndexDimension();
Point3D pt_index;
pt_index.Fill(0);
for ( i = 0; i < dim; ++i )
{
pt_index[i] = index[i];
}
return IsIndexInside(pt_index);
}
//##Documentation
//## @brief Get the spacing (size of a pixel).
//##
itkGetConstReferenceMacro(Spacing, mitk::Vector3D);
//##Documentation
//## @brief Get the spacing as a float[3] array.
const float* GetFloatSpacing() const;
//##Documentation
//## @brief Set the spacing (m_Spacing)
virtual void SetSpacing(const mitk::Vector3D& aSpacing);
- //##Documentation
- //## @brief Set the spacing (m_Spacing) via a float array
- virtual void SetSpacing(const float aSpacing[3]);
//##Documentation
//## @brief Get the DICOM FrameOfReferenceID referring to the
//## used world coordinate system
itkGetConstMacro(FrameOfReferenceID, unsigned int);
//##Documentation
//## @brief Set the DICOM FrameOfReferenceID referring to the
//## used world coordinate system
itkSetMacro(FrameOfReferenceID, unsigned int);
//##Documentation
//## @brief Copy the ITK transform
//## (m_IndexToWorldTransform) to the VTK transform
//## \sa SetIndexToWorldTransform
void TransferItkToVtkTransform();
//##Documentation
//## @brief Copy the VTK transform
//## to the ITK transform (m_IndexToWorldTransform)
//## \sa SetIndexToWorldTransform
void TransferVtkToItkTransform();
//##Documentation
//## @brief Get the parametric bounding-box
//##
//## See AbstractTransformGeometry for an example usage of this.
itkGetConstObjectMacro(ParametricBoundingBox, BoundingBox);
//##Documentation
//## @brief Get the parametric bounds
//##
//## See AbstractTransformGeometry for an example usage of this.
const BoundingBox::BoundsArrayType& GetParametricBounds() const
{
assert(m_ParametricBoundingBox.IsNotNull());
return m_ParametricBoundingBox->GetBounds();
}
//##Documentation
//## @brief Get the parametric extent
//##
//## See AbstractTransformGeometry for an example usage of this.
mitk::ScalarType GetParametricExtent(int direction) const
{
assert(direction>=0 && direction<3);
assert(m_ParametricBoundingBox.IsNotNull());
BoundingBoxType::BoundsArrayType bounds = m_ParametricBoundingBox->GetBounds();
return bounds[direction*2+1]-bounds[direction*2];
}
//##Documentation
//## @brief Get the parametric extent in mm
//##
//## See AbstractTransformGeometry for an example usage of this.
virtual mitk::ScalarType GetParametricExtentInMM(int direction) const
{
return GetExtentInMM(direction);
}
//##Documentation
//## @brief Get the parametric transform
//##
//## See AbstractTransformGeometry for an example usage of this.
virtual const Transform3D* GetParametricTransform() const
{
return m_IndexToWorldTransform;
}
//##Documentation
//## @brief Calculates a bounding-box around the geometry relative
//## to a coordinate system defined by a transform
//##
mitk::BoundingBox::Pointer CalculateBoundingBoxRelativeToTransform(const mitk::AffineTransform3D* transform) const;
//##Documentation
//## @brief clones the geometry
//##
//## Overwrite in all sub-classes.
//## Normally looks like:
//## \code
- //## Self::Pointer newGeometry = Self::New();
- //## newGeometry->Initialize();
- //## InitializeGeometry(newGeometry);
+ //## Self::Pointer newGeometry = new Self(*this);
+ //## newGeometry->UnRegister();
//## return newGeometry.GetPointer();
//## \endcode
- //## \sa InitializeGeometry
virtual AffineGeometryFrame3D::Pointer Clone() const;
//##Documentation
//##@brief executes affine operations (translate, rotate, scale)
virtual void ExecuteOperation(Operation* operation);
protected:
Geometry3D();
+ Geometry3D(const Geometry3D& other);
+
static const char* GetTransformAsString( TransformType* transformType );
virtual ~Geometry3D();
- //##Documentation
- //## @brief used in clone to initialize the newly created geometry
- //##
- //## Has to be overwritten in sub-classes, if they add members.
- //## Do the following:
- //## \li call Superclass::InitializeGeometry(newGeometry)
- //## \li transfer all additional members of Self compared to Superclass
- virtual void InitializeGeometry(Self * newGeometry) const;
-
virtual void PrintSelf(std::ostream& os, itk::Indent indent) const;
virtual void BackTransform(const mitk::Point3D& in, mitk::Point3D& out) const;
//##Documentation
//## @brief Deprecated
virtual void BackTransform(const mitk::Point3D& at, const mitk::Vector3D& in, mitk::Vector3D& out) const;
//Without redundant parameter Point3D
virtual void BackTransform(const mitk::Vector3D& in, mitk::Vector3D& out) const;
//##Documentation
//## @brief Set the parametric bounds
//##
//## Protected in this class, made public in some sub-classes, e.g.,
//## ExternAbstractTransformGeometry.
virtual void SetParametricBounds(const BoundingBox::BoundsArrayType& bounds);
/** Resets sub-transforms that compose m_IndexToWorldTransform, by using
* the current value of m_IndexToWorldTransform and setting the rotation
* component to zero. */
virtual void ResetSubTransforms();
mutable mitk::BoundingBox::Pointer m_ParametricBoundingBox;
mutable mitk::TimeBounds m_TimeBounds;
vtkMatrix4x4* m_VtkMatrix;
bool m_ImageGeometry;
//##Documentation
//## @brief Spacing of the data. Only significant if the geometry describes
//## an Image (m_ImageGeometry==true).
mitk::Vector3D m_Spacing;
bool m_Valid;
unsigned int m_FrameOfReferenceID;
static const std::string INDEX_TO_OBJECT_TRANSFORM;
static const std::string OBJECT_TO_NODE_TRANSFORM;
static const std::string INDEX_TO_NODE_TRANSFORM;
static const std::string INDEX_TO_WORLD_TRANSFORM;
private:
mutable TransformType::Pointer m_InvertedTransform;
mutable unsigned long m_IndexToWorldTransformLastModified;
- QuaternionTransformType::Pointer m_IndexToWorldRotationTransform;
VnlQuaternionType m_RotationQuaternion;
float m_FloatSpacing[3];
vtkMatrixToLinearTransform* m_VtkIndexToWorldTransform;
//##Documentation
//## @brief Origin, i.e. upper-left corner of the plane
//##
Point3D m_Origin;
};
} // namespace mitk
#endif /* GEOMETRY3D_H_HEADER_INCLUDED_C1EBD0AD */
diff --git a/Core/Code/DataManagement/mitkGroupTagProperty.h b/Core/Code/DataManagement/mitkGroupTagProperty.h
index bb953913b7..eedccb2d77 100644
--- a/Core/Code/DataManagement/mitkGroupTagProperty.h
+++ b/Core/Code/DataManagement/mitkGroupTagProperty.h
@@ -1,53 +1,54 @@
/*=========================================================================
Program: Medical Imaging & Interaction Toolkit
Language: C++
Date: $Date$
Version: $Revision$
Copyright (c) German Cancer Research Center, Division of Medical and
Biological Informatics. All rights reserved.
See MITKCopyright.txt or http://www.mitk.org/copyright.html for details.
This software is distributed WITHOUT ANY WARRANTY; without even
the implied warranty of MERCHANTABILITY or FITNESS FOR A PARTICULAR
PURPOSE. See the above copyright notices for more information.
=========================================================================*/
#ifndef GROUPTAGPROPERTY_H_HEADER_INCLUDED_C1F4DF54
#define GROUPTAGPROPERTY_H_HEADER_INCLUDED_C1F4DF54
#include <mitkBaseProperty.h>
namespace mitk {
/*! @brief Property class that has no value.
@ingroup DataManagement
The GroupTag property is used to tag a datatree node to show, that it is member of a
group of datatree nodes. This can be used to build groups of datatreenodes without the
need to contain them in a specific hiearchic order in the datatree
*/
class MITK_CORE_EXPORT GroupTagProperty : public BaseProperty
{
public:
mitkClassMacro(GroupTagProperty, BaseProperty);
itkNewMacro(GroupTagProperty);
virtual ~GroupTagProperty();
virtual bool operator==(const BaseProperty& property) const;
virtual bool Assignable(const BaseProperty& other) const;
+ virtual BaseProperty& operator=(const BaseProperty& other) { return Superclass::operator=(other); }
protected:
GroupTagProperty();
};
} // namespace mitk
#endif /* GROUPTAGPROPERTY_H_HEADER_INCLUDED_C1F4DF54 */
diff --git a/Core/Code/DataManagement/mitkImage.cpp b/Core/Code/DataManagement/mitkImage.cpp
index e6ff2cb15b..a7415698a3 100644
--- a/Core/Code/DataManagement/mitkImage.cpp
+++ b/Core/Code/DataManagement/mitkImage.cpp
@@ -1,1459 +1,1463 @@
/*=========================================================================
Program: Medical Imaging & Interaction Toolkit
Language: C++
Date: $Date$
Version: $Revision$
Copyright (c) German Cancer Research Center, Division of Medical and
Biological Informatics. All rights reserved.
See MITKCopyright.txt or http://www.mitk.org/copyright.html for details.
This software is distributed WITHOUT ANY WARRANTY; without even
the implied warranty of MERCHANTABILITY or FITNESS FOR A PARTICULAR
PURPOSE. See the above copyright notices for more information.
=========================================================================*/
#include "mitkImage.h"
#include "mitkHistogramGenerator.h"
#include "mitkPicHelper.h"
#include "mitkImageTimeSelector.h"
#include "ipFunc/mitkIpFunc.h"
#include "mitkIpPicTypeMultiplex.h"
#include <vtkImageData.h>
#include <itkSmartPointerForwardReference.txx>
template class MITK_CORE_EXPORT itk::SmartPointerForwardReference<mitk::ImageDataItem>;
mitk::Image::Image() :
m_Dimension(0), m_Dimensions(NULL), m_OffsetTable(NULL),
m_CompleteData(NULL), m_PixelType(NULL),
m_TimeSelectorForExtremaObject(NULL)
{
m_CountOfMinValuedVoxels.resize(1, 0);
m_CountOfMaxValuedVoxels.resize(1, 0);
m_ScalarMin.resize(1, itk::NumericTraits<ScalarType>::max());
m_ScalarMax.resize(1, itk::NumericTraits<ScalarType>::NonpositiveMin());
m_Scalar2ndMin.resize(1, itk::NumericTraits<ScalarType>::max());
m_Scalar2ndMax.resize(1, itk::NumericTraits<ScalarType>::NonpositiveMin());
m_Initialized = false;
mitk::HistogramGenerator::Pointer generator = mitk::HistogramGenerator::New();
m_HistogramGeneratorObject = generator;
}
mitk::Image::Image(const Image &other) : SlicedData(other), m_Dimension(0),
m_Dimensions(NULL), m_OffsetTable(NULL), m_CompleteData(NULL), m_PixelType(NULL),
m_TimeSelectorForExtremaObject(NULL)
{
this->Initialize(&other);
if (this->GetDimension() > 3)
{
const unsigned int time_steps = this->GetDimension(3);
for (unsigned int i = 0u; i < time_steps; ++i)
{
ImageDataItemPointer volume = const_cast<Image&>(other).GetVolumeData(i);
this->SetVolume(volume->GetData(), i);
}
}
else
{
ImageDataItemPointer volume = const_cast<Image&>(other).GetVolumeData(0);
this->SetVolume(volume->GetData(), 0);
}
}
mitk::Image::~Image()
{
Clear();
m_ReferenceCountLock.Lock();
m_ReferenceCount = 3;
m_ReferenceCountLock.Unlock();
m_HistogramGeneratorObject = NULL;
m_TimeSelectorForExtremaObject = NULL;
m_ReferenceCountLock.Lock();
m_ReferenceCount = 0;
m_ReferenceCountLock.Unlock();
delete [] m_OffsetTable;
}
const mitk::PixelType& mitk::Image::GetPixelType(int /*n*/) const
{
return m_PixelType;
}
unsigned int mitk::Image::GetDimension() const
{
return m_Dimension;
}
unsigned int mitk::Image::GetDimension(int i) const
{
if((i>=0) && (i<(int)m_Dimension))
return m_Dimensions[i];
return 1;
}
void* mitk::Image::GetData()
{
if(m_Initialized==false)
{
if(GetSource()==NULL)
return NULL;
if(GetSource()->Updating()==false)
GetSource()->UpdateOutputInformation();
}
m_CompleteData=GetChannelData();
return m_CompleteData->GetData();
}
template <class T>
void AccessPixel(mitkIpPicDescriptor* pic, const mitk::Index3D& p, double& value, int timestep)
{
if ( (p[0]>=0 && p[1] >=0 && p[2]>=0 && timestep>=0) && (unsigned int)p[0] < pic->n[0] && (unsigned int)p[1] < pic->n[1] && (unsigned int)p[2] < pic->n[2] && (unsigned int)timestep < pic->n[3] )
{
if(pic->bpe!=24)
{
value = (double) (((T*) pic->data)[ p[0] + p[1]*pic->n[0] + p[2]*pic->n[0]*pic->n[1] + timestep*pic->n[0]*pic->n[1]*pic->n[2] ]);
}
else
{
double returnvalue = (((T*) pic->data)[p[0]*3 + 0 + p[1]*pic->n[0]*3 + p[2]*pic->n[0]*pic->n[1]*3 + timestep*pic->n[0]*pic->n[1]*pic->n[2]*3 ]);
returnvalue += (((T*) pic->data)[p[0]*3 + 1 + p[1]*pic->n[0]*3 + p[2]*pic->n[0]*pic->n[1]*3 + timestep*pic->n[0]*pic->n[1]*pic->n[2]*3]);
returnvalue += (((T*) pic->data)[p[0]*3 + 2 + p[1]*pic->n[0]*3 + p[2]*pic->n[0]*pic->n[1]*3 + timestep*pic->n[0]*pic->n[1]*pic->n[2]*3]);
value = returnvalue;
}
}
else
{
value = 0;
}
};
double mitk::Image::GetPixelValueByIndex(const mitk::Index3D &position, unsigned int timestep)
{
mitkIpPicDescriptor* pic = this->GetPic();
double value = 0;
if (this->GetTimeSteps() < timestep)
{
timestep = this->GetTimeSteps();
}
mitkIpPicTypeMultiplex3(AccessPixel, pic, position, value, timestep);
return value;
}
double mitk::Image::GetPixelValueByWorldCoordinate(const mitk::Point3D& position, unsigned int timestep)
{
mitkIpPicDescriptor* pic = this->GetPic();
double value = 0;
if (this->GetTimeSteps() < timestep)
{
timestep = this->GetTimeSteps();
}
Index3D itkIndex;
this->GetGeometry()->WorldToIndex(position,itkIndex);
mitkIpPicTypeMultiplex3(AccessPixel, pic, itkIndex, value, timestep);
return value;
}
vtkImageData* mitk::Image::GetVtkImageData(int t, int n)
{
if(m_Initialized==false)
{
if(GetSource()==NULL)
return NULL;
if(GetSource()->Updating()==false)
GetSource()->UpdateOutputInformation();
}
ImageDataItemPointer volume=GetVolumeData(t, n);
if(volume.GetPointer()==NULL || volume->GetVtkImageData() == NULL)
return NULL;
#if ((VTK_MAJOR_VERSION > 4) || ((VTK_MAJOR_VERSION==4) && (VTK_MINOR_VERSION>=4) ))
float *fspacing = const_cast<float *>(GetSlicedGeometry(t)->GetFloatSpacing());
double dspacing[3] = {fspacing[0],fspacing[1],fspacing[2]};
volume->GetVtkImageData()->SetSpacing( dspacing );
#else
volume->GetVtkImageData()->SetSpacing(const_cast<float*>(GetSlicedGeometry(t)->GetFloatSpacing()));
#endif
return volume->GetVtkImageData();
}
mitkIpPicDescriptor* mitk::Image::GetPic()
{
if(m_Initialized==false)
{
if(GetSource()==NULL)
return NULL;
if(GetSource()->Updating()==false)
GetSource()->UpdateOutputInformation();
}
m_CompleteData=GetChannelData();
if(m_CompleteData.GetPointer()==NULL)
return NULL;
return m_CompleteData->GetPicDescriptor();
}
mitk::Image::ImageDataItemPointer mitk::Image::GetSliceData(int s, int t, int n, void *data, ImportMemoryManagementType importMemoryManagement)
{
if(IsValidSlice(s,t,n)==false) return NULL;
// slice directly available?
int pos=GetSliceIndex(s,t,n);
if(m_Slices[pos].GetPointer()!=NULL)
return m_Slices[pos];
// is slice available as part of a volume that is available?
ImageDataItemPointer sl, ch, vol;
vol=m_Volumes[GetVolumeIndex(t,n)];
if((vol.GetPointer()!=NULL) && (vol->IsComplete()))
{
sl=new ImageDataItem(*vol, 2, data, importMemoryManagement == ManageMemory, ((size_t) s)*m_OffsetTable[2]*(m_PixelType.GetBpe()/8));
sl->SetComplete(true);
return m_Slices[pos]=sl;
}
// is slice available as part of a channel that is available?
ch=m_Channels[n];
if((ch.GetPointer()!=NULL) && (ch->IsComplete()))
{
sl=new ImageDataItem(*ch, 2, data, importMemoryManagement == ManageMemory, (((size_t) s)*m_OffsetTable[2]+((size_t) t)*m_OffsetTable[3])*(m_PixelType.GetBpe()/8));
sl->SetComplete(true);
return m_Slices[pos]=sl;
}
// slice is unavailable. Can we calculate it?
if((GetSource()!=NULL) && (GetSource()->Updating()==false))
{
// ... wir mussen rechnen!!! ....
m_RequestedRegion.SetIndex(0, 0);
m_RequestedRegion.SetIndex(1, 0);
m_RequestedRegion.SetIndex(2, s);
m_RequestedRegion.SetIndex(3, t);
m_RequestedRegion.SetIndex(4, n);
m_RequestedRegion.SetSize(0, m_Dimensions[0]);
m_RequestedRegion.SetSize(1, m_Dimensions[1]);
m_RequestedRegion.SetSize(2, 1);
m_RequestedRegion.SetSize(3, 1);
m_RequestedRegion.SetSize(4, 1);
m_RequestedRegionInitialized=true;
GetSource()->Update();
if(IsSliceSet(s,t,n))
//yes: now we can call ourselves without the risk of a endless loop (see "if" above)
return GetSliceData(s,t,n,data,importMemoryManagement);
else
return NULL;
}
else
{
ImageDataItemPointer item = AllocateSliceData(s,t,n,data,importMemoryManagement);
item->SetComplete(true);
return item;
}
}
mitk::Image::ImageDataItemPointer mitk::Image::GetVolumeData(int t, int n, void *data, ImportMemoryManagementType importMemoryManagement)
{
if(IsValidVolume(t,n)==false) return NULL;
ImageDataItemPointer ch, vol;
// volume directly available?
int pos=GetVolumeIndex(t,n);
vol=m_Volumes[pos];
if((vol.GetPointer()!=NULL) && (vol->IsComplete()))
return vol;
// is volume available as part of a channel that is available?
ch=m_Channels[n];
if((ch.GetPointer()!=NULL) && (ch->IsComplete()))
{
vol=new ImageDataItem(*ch, 3, data, importMemoryManagement == ManageMemory, (((size_t) t)*m_OffsetTable[3])*(m_PixelType.GetBpe()/8));
vol->SetComplete(true);
return m_Volumes[pos]=vol;
}
// let's see if all slices of the volume are set, so that we can (could) combine them to a volume
bool complete=true;
unsigned int s;
for(s=0;s<m_Dimensions[2];++s)
{
if(m_Slices[GetSliceIndex(s,t,n)].GetPointer()==NULL)
{
complete=false;
break;
}
}
if(complete)
{
// if there is only single slice we do not need to combine anything
if(m_Dimensions[2]<=1)
{
ImageDataItemPointer sl;
sl=GetSliceData(0,t,n,data,importMemoryManagement);
vol=new ImageDataItem(*sl, 3, data, importMemoryManagement == ManageMemory);
vol->SetComplete(true);
}
else
{
vol=m_Volumes[pos];
// ok, let's combine the slices!
if(vol.GetPointer()==NULL)
vol=new ImageDataItem(m_PixelType, 3, m_Dimensions, NULL, true);
vol->SetComplete(true);
size_t size=m_OffsetTable[2]*(m_PixelType.GetBpe()/8);
for(s=0;s<m_Dimensions[2];++s)
{
int posSl;
ImageDataItemPointer sl;
posSl=GetSliceIndex(s,t,n);
sl=m_Slices[posSl];
if(sl->GetParent()!=vol)
{
// copy data of slices in volume
size_t offset = ((size_t) s)*size;
std::memcpy(static_cast<char*>(vol->GetData())+offset, sl->GetData(), size);
mitkIpPicDescriptor * pic = sl->GetPicDescriptor();
// replace old slice with reference to volume
sl=new ImageDataItem(*vol, 2, data, importMemoryManagement == ManageMemory, ((size_t) s)*size);
sl->SetComplete(true);
mitkIpFuncCopyTags(sl->GetPicDescriptor(), pic);
m_Slices[posSl]=sl;
}
}
if(vol->GetPicDescriptor()->info->tags_head==NULL)
mitkIpFuncCopyTags(vol->GetPicDescriptor(), m_Slices[GetSliceIndex(0,t,n)]->GetPicDescriptor());
}
return m_Volumes[pos]=vol;
}
// volume is unavailable. Can we calculate it?
if((GetSource()!=NULL) && (GetSource()->Updating()==false))
{
// ... wir muessen rechnen!!! ....
m_RequestedRegion.SetIndex(0, 0);
m_RequestedRegion.SetIndex(1, 0);
m_RequestedRegion.SetIndex(2, 0);
m_RequestedRegion.SetIndex(3, t);
m_RequestedRegion.SetIndex(4, n);
m_RequestedRegion.SetSize(0, m_Dimensions[0]);
m_RequestedRegion.SetSize(1, m_Dimensions[1]);
m_RequestedRegion.SetSize(2, m_Dimensions[2]);
m_RequestedRegion.SetSize(3, 1);
m_RequestedRegion.SetSize(4, 1);
m_RequestedRegionInitialized=true;
GetSource()->Update();
if(IsVolumeSet(t,n))
//yes: now we can call ourselves without the risk of a endless loop (see "if" above)
return GetVolumeData(t,n,data,importMemoryManagement);
else
return NULL;
}
else
{
ImageDataItemPointer item = AllocateVolumeData(t,n,data,importMemoryManagement);
item->SetComplete(true);
return item;
}
}
mitk::Image::ImageDataItemPointer mitk::Image::GetChannelData(int n, void *data, ImportMemoryManagementType importMemoryManagement)
{
if(IsValidChannel(n)==false) return NULL;
ImageDataItemPointer ch, vol;
ch=m_Channels[n];
if((ch.GetPointer()!=NULL) && (ch->IsComplete()))
return ch;
// let's see if all volumes are set, so that we can (could) combine them to a channel
if(IsChannelSet(n))
{
// if there is only one time frame we do not need to combine anything
if(m_Dimensions[3]<=1)
{
vol=GetVolumeData(0,n,data,importMemoryManagement);
ch=new ImageDataItem(*vol, 3, data, importMemoryManagement == ManageMemory);
ch->SetComplete(true);
}
else
{
ch=m_Channels[n];
// ok, let's combine the volumes!
if(ch.GetPointer()==NULL)
ch=new ImageDataItem(m_PixelType, m_Dimension, m_Dimensions, NULL, true);
ch->SetComplete(true);
size_t size=m_OffsetTable[m_Dimension-1]*(m_PixelType.GetBpe()/8);
unsigned int t;
ImageDataItemPointerArray::iterator slicesIt = m_Slices.begin()+n*m_Dimensions[2]*m_Dimensions[3];
for(t=0;t<m_Dimensions[3];++t)
{
int posVol;
ImageDataItemPointer vol;
posVol=GetVolumeIndex(t,n);
vol=GetVolumeData(t,n,data,importMemoryManagement);
if(vol->GetParent()!=ch)
{
// copy data of volume in channel
size_t offset = ((size_t) t)*m_OffsetTable[3]*(m_PixelType.GetBpe()/8);
std::memcpy(static_cast<char*>(ch->GetData())+offset, vol->GetData(), size);
mitkIpPicDescriptor * pic = vol->GetPicDescriptor();
// replace old volume with reference to channel
vol=new ImageDataItem(*ch, 3, data, importMemoryManagement == ManageMemory, offset);
vol->SetComplete(true);
mitkIpFuncCopyTags(vol->GetPicDescriptor(), pic);
m_Volumes[posVol]=vol;
// get rid of slices - they may point to old volume
ImageDataItemPointer dnull=NULL;
for(unsigned int i = 0; i < m_Dimensions[2]; ++i, ++slicesIt)
{
assert(slicesIt != m_Slices.end());
*slicesIt = dnull;
}
}
}
if(ch->GetPicDescriptor()->info->tags_head==NULL)
mitkIpFuncCopyTags(ch->GetPicDescriptor(), m_Volumes[GetVolumeIndex(0,n)]->GetPicDescriptor());
}
return m_Channels[n]=ch;
}
// channel is unavailable. Can we calculate it?
if((GetSource()!=NULL) && (GetSource()->Updating()==false))
{
// ... wir muessen rechnen!!! ....
m_RequestedRegion.SetIndex(0, 0);
m_RequestedRegion.SetIndex(1, 0);
m_RequestedRegion.SetIndex(2, 0);
m_RequestedRegion.SetIndex(3, 0);
m_RequestedRegion.SetIndex(4, n);
m_RequestedRegion.SetSize(0, m_Dimensions[0]);
m_RequestedRegion.SetSize(1, m_Dimensions[1]);
m_RequestedRegion.SetSize(2, m_Dimensions[2]);
m_RequestedRegion.SetSize(3, m_Dimensions[3]);
m_RequestedRegion.SetSize(4, 1);
m_RequestedRegionInitialized=true;
GetSource()->Update();
// did it work?
if(IsChannelSet(n))
//yes: now we can call ourselves without the risk of a endless loop (see "if" above)
return GetChannelData(n,data,importMemoryManagement);
else
return NULL;
}
else
{
ImageDataItemPointer item = AllocateChannelData(n,data,importMemoryManagement);
item->SetComplete(true);
return item;
}
}
bool mitk::Image::IsSliceSet(int s, int t, int n) const
{
if(IsValidSlice(s,t,n)==false) return false;
if(m_Slices[GetSliceIndex(s,t,n)].GetPointer()!=NULL)
return true;
ImageDataItemPointer ch, vol;
vol=m_Volumes[GetVolumeIndex(t,n)];
if((vol.GetPointer()!=NULL) && (vol->IsComplete()))
return true;
ch=m_Channels[n];
if((ch.GetPointer()!=NULL) && (ch->IsComplete()))
return true;
return false;
}
bool mitk::Image::IsVolumeSet(int t, int n) const
{
if(IsValidVolume(t,n)==false) return false;
ImageDataItemPointer ch, vol;
// volume directly available?
vol=m_Volumes[GetVolumeIndex(t,n)];
if((vol.GetPointer()!=NULL) && (vol->IsComplete()))
return true;
// is volume available as part of a channel that is available?
ch=m_Channels[n];
if((ch.GetPointer()!=NULL) && (ch->IsComplete()))
return true;
// let's see if all slices of the volume are set, so that we can (could) combine them to a volume
unsigned int s;
for(s=0;s<m_Dimensions[2];++s)
if(m_Slices[GetSliceIndex(s,t,n)].GetPointer()==NULL)
return false;
return true;
}
bool mitk::Image::IsChannelSet(int n) const
{
if(IsValidChannel(n)==false) return false;
ImageDataItemPointer ch, vol;
ch=m_Channels[n];
if((ch.GetPointer()!=NULL) && (ch->IsComplete()))
return true;
// let's see if all volumes are set, so that we can (could) combine them to a channel
unsigned int t;
for(t=0;t<m_Dimensions[3];++t)
if(IsVolumeSet(t,n)==false)
return false;
return true;
}
bool mitk::Image::SetSlice(const void *data, int s, int t, int n)
{
// const_cast is no risk for ImportMemoryManagementType == CopyMemory
return SetImportSlice(const_cast<void*>(data), s, t, n, CopyMemory);
}
bool mitk::Image::SetVolume(const void *data, int t, int n)
{
// const_cast is no risk for ImportMemoryManagementType == CopyMemory
return SetImportVolume(const_cast<void*>(data), t, n, CopyMemory);
}
bool mitk::Image::SetChannel(const void *data, int n)
{
// const_cast is no risk for ImportMemoryManagementType == CopyMemory
return SetImportChannel(const_cast<void*>(data), n, CopyMemory);
}
bool mitk::Image::SetImportSlice(void *data, int s, int t, int n, ImportMemoryManagementType importMemoryManagement)
{
if(IsValidSlice(s,t,n)==false) return false;
ImageDataItemPointer sl;
if(IsSliceSet(s,t,n))
{
sl=GetSliceData(s,t,n,data,importMemoryManagement);
if(sl->GetManageMemory()==false)
{
sl=AllocateSliceData(s,t,n,data,importMemoryManagement);
if(sl.GetPointer()==NULL) return false;
}
if ( sl->GetData() != data )
std::memcpy(sl->GetData(), data, m_OffsetTable[2]*(m_PixelType.GetBpe()/8));
sl->Modified();
//we have changed the data: call Modified()!
Modified();
}
else
{
sl=AllocateSliceData(s,t,n,data,importMemoryManagement);
if(sl.GetPointer()==NULL) return false;
if ( sl->GetData() != data )
std::memcpy(sl->GetData(), data, m_OffsetTable[2]*(m_PixelType.GetBpe()/8));
//we just added a missing slice, which is not regarded as modification.
//Therefore, we do not call Modified()!
}
return true;
}
bool mitk::Image::SetImportVolume(void *data, int t, int n, ImportMemoryManagementType importMemoryManagement)
{
if(IsValidVolume(t,n)==false) return false;
ImageDataItemPointer vol;
if(IsVolumeSet(t,n))
{
vol=GetVolumeData(t,n,data,importMemoryManagement);
if(vol->GetManageMemory()==false)
{
vol=AllocateVolumeData(t,n,data,importMemoryManagement);
if(vol.GetPointer()==NULL) return false;
}
if ( vol->GetData() != data )
std::memcpy(vol->GetData(), data, m_OffsetTable[3]*(m_PixelType.GetBpe()/8));
vol->Modified();
vol->SetComplete(true);
//we have changed the data: call Modified()!
Modified();
}
else
{
vol=AllocateVolumeData(t,n,data,importMemoryManagement);
if(vol.GetPointer()==NULL) return false;
if ( vol->GetData() != data )
{
std::memcpy(vol->GetData(), data, m_OffsetTable[3]*(m_PixelType.GetBpe()/8));
}
vol->SetComplete(true);
//we just added a missing Volume, which is not regarded as modification.
//Therefore, we do not call Modified()!
}
return true;
}
bool mitk::Image::SetImportChannel(void *data, int n, ImportMemoryManagementType importMemoryManagement)
{
if(IsValidChannel(n)==false) return false;
ImageDataItemPointer ch;
if(IsChannelSet(n))
{
ch=GetChannelData(n,data,importMemoryManagement);
if(ch->GetManageMemory()==false)
{
ch=AllocateChannelData(n,data,importMemoryManagement);
if(ch.GetPointer()==NULL) return false;
}
if ( ch->GetData() != data )
std::memcpy(ch->GetData(), data, m_OffsetTable[4]*(m_PixelType.GetBpe()/8));
ch->Modified();
ch->SetComplete(true);
//we have changed the data: call Modified()!
Modified();
}
else
{
ch=AllocateChannelData(n,data,importMemoryManagement);
if(ch.GetPointer()==NULL) return false;
if ( ch->GetData() != data )
std::memcpy(ch->GetData(), data, m_OffsetTable[4]*(m_PixelType.GetBpe()/8));
ch->SetComplete(true);
//we just added a missing Channel, which is not regarded as modification.
//Therefore, we do not call Modified()!
}
return true;
}
bool mitk::Image::SetPicSlice(const mitkIpPicDescriptor *pic, int s, int t, int n, ImportMemoryManagementType /*importMemoryManagement*/)
{
if(pic==NULL) return false;
if(pic->dim!=2) return false;
if((pic->n[0]!=m_Dimensions[0]) || (pic->n[1]!=m_Dimensions[1])) return false;
if(SetSlice(pic->data,s,t,n)) //@todo: add geometry!
{
ImageDataItemPointer sl;
sl=GetSliceData(s,t,n,NULL,CopyMemory);
mitkIpFuncCopyTags(sl->GetPicDescriptor(), const_cast<mitkIpPicDescriptor *>(pic));
return true;
}
else
return false;
}
bool mitk::Image::SetPicVolume(const mitkIpPicDescriptor *pic, int t, int n, ImportMemoryManagementType /*importMemoryManagement*/)
{
if(pic==NULL) return false;
if((pic->dim==2) && ((m_Dimension==2) || ((m_Dimension>2) && (m_Dimensions[2]==1)))) return SetPicSlice(pic, 0, t, n);
if(pic->dim!=3) return false;
if((pic->n[0]!=m_Dimensions[0]) || (pic->n[1]!=m_Dimensions[1]) || (pic->n[2]!=m_Dimensions[2])) return false;
if(SetVolume(pic->data,t,n)) //@todo: add geometry!
{
ImageDataItemPointer vol;
vol=GetVolumeData(t,n,NULL,CopyMemory);
mitkIpFuncCopyTags(vol->GetPicDescriptor(), const_cast<mitkIpPicDescriptor *>(pic));
return true;
}
else
return false;
}
bool mitk::Image::SetPicChannel(const mitkIpPicDescriptor *pic, int n, ImportMemoryManagementType /*importMemoryManagement*/)
{
if(pic==NULL) return false;
if(pic->dim<=3) return SetPicVolume(pic, 0, n);
if(pic->dim!=m_Dimension) return false;
unsigned int i;
for(i=0;i<m_Dimension; ++i)
{
if(pic->n[i]!=m_Dimensions[i]) return false;
}
if(SetChannel(pic->data,n)) //@todo: add geometry!
{
ImageDataItemPointer ch;
ch=GetChannelData(n,NULL,CopyMemory);
// commented the next line, because
// it crashes when called from mitkDICOMFileReader for the Live3D data
// mitkIpFuncCopyTags(ch->GetPicDescriptor(), pic);
return true;
}
else
return false;
}
void mitk::Image::Initialize()
{
ImageDataItemPointerArray::iterator it, end;
for( it=m_Slices.begin(), end=m_Slices.end(); it!=end; ++it )
{
(*it)=NULL;
}
for( it=m_Volumes.begin(), end=m_Volumes.end(); it!=end; ++it )
{
(*it)=NULL;
}
for( it=m_Channels.begin(), end=m_Channels.end(); it!=end; ++it )
{
(*it)=NULL;
}
m_CompleteData = NULL;
this->GetTimeSelector(); // just to create m_TimeSelectorForExtremaObject
SetRequestedRegionToLargestPossibleRegion();
}
mitk::ImageTimeSelector* mitk::Image::GetTimeSelector() const
{
if(m_TimeSelectorForExtremaObject.IsNull())
{
m_TimeSelectorForExtremaObject = ImageTimeSelector::New();
ImageTimeSelector* timeSelector = static_cast<mitk::ImageTimeSelector*>( m_TimeSelectorForExtremaObject.GetPointer() );
timeSelector->SetInput(this);
this->UnRegister();
}
return static_cast<ImageTimeSelector*>( m_TimeSelectorForExtremaObject.GetPointer() );
}
void mitk::Image::Initialize(const mitk::PixelType& type, unsigned int dimension, unsigned int *dimensions, unsigned int channels)
{
Clear();
m_Dimension=dimension;
if(!dimensions)
itkExceptionMacro(<< "invalid zero dimension image");
unsigned int i;
for(i=0;i<dimension;++i)
{
if(dimensions[i]<1)
itkExceptionMacro(<< "invalid dimension[" << i << "]: " << dimensions[i]);
}
m_Dimensions=new unsigned int[m_Dimension>4?m_Dimension:4];
std::memcpy(m_Dimensions, dimensions, sizeof(unsigned int)*m_Dimension);
if(m_Dimension<4)
{
unsigned int *p;
for(i=0,p=m_Dimensions+m_Dimension;i<4-m_Dimension;++i, ++p)
*p=1;
}
for(i=0;i<4;++i)
{
m_LargestPossibleRegion.SetIndex(i, 0);
m_LargestPossibleRegion.SetSize (i, m_Dimensions[i]);
}
m_LargestPossibleRegion.SetIndex(i, 0);
m_LargestPossibleRegion.SetSize(i, channels);
if(m_LargestPossibleRegion.GetNumberOfPixels()==0)
{
delete [] m_Dimensions;
m_Dimensions = NULL;
return;
}
m_PixelType=type;
PlaneGeometry::Pointer planegeometry = PlaneGeometry::New();
planegeometry->InitializeStandardPlane(m_Dimensions[0], m_Dimensions[1]);
SlicedGeometry3D::Pointer slicedGeometry = SlicedGeometry3D::New();
slicedGeometry->InitializeEvenlySpaced(planegeometry, m_Dimensions[2]);
if(dimension>=4)
{
TimeBounds timebounds;
timebounds[0] = 0.0;
timebounds[1] = 1.0;
slicedGeometry->SetTimeBounds(timebounds);
}
TimeSlicedGeometry::Pointer timeSliceGeometry = TimeSlicedGeometry::New();
timeSliceGeometry->InitializeEvenlyTimed(slicedGeometry, m_Dimensions[3]);
timeSliceGeometry->ImageGeometryOn();
SetGeometry(timeSliceGeometry);
ImageDataItemPointer dnull=NULL;
m_Channels.assign(GetNumberOfChannels(), dnull);
m_Volumes.assign(GetNumberOfChannels()*m_Dimensions[3], dnull);
m_Slices.assign(GetNumberOfChannels()*m_Dimensions[3]*m_Dimensions[2], dnull);
ComputeOffsetTable();
Initialize();
m_Initialized = true;
}
void mitk::Image::Initialize(const mitk::PixelType& type, const mitk::Geometry3D& geometry, unsigned int channels, int tDim )
{
unsigned int dimensions[5];
dimensions[0] = (unsigned int)(geometry.GetExtent(0)+0.5);
dimensions[1] = (unsigned int)(geometry.GetExtent(1)+0.5);
dimensions[2] = (unsigned int)(geometry.GetExtent(2)+0.5);
dimensions[3] = 0;
dimensions[4] = 0;
unsigned int dimension = 2;
if ( dimensions[2] > 1 )
dimension = 3;
if ( tDim > 0)
{
dimensions[3] = tDim;
}
else
{
const mitk::TimeSlicedGeometry* timeGeometry = dynamic_cast<const mitk::TimeSlicedGeometry*>(&geometry);
if ( timeGeometry != NULL )
{
dimensions[3] = timeGeometry->GetTimeSteps();
}
}
if ( dimensions[3] > 1 )
dimension = 4;
Initialize( type, dimension, dimensions, channels );
SetGeometry(static_cast<Geometry3D*>(geometry.Clone().GetPointer()));
mitk::BoundingBox::BoundsArrayType bounds = geometry.GetBoundingBox()->GetBounds();
if( (bounds[0] != 0.0) || (bounds[2] != 0.0) || (bounds[4] != 0.0) )
{
SlicedGeometry3D* slicedGeometry = GetSlicedGeometry(0);
mitk::Point3D origin; origin.Fill(0.0);
slicedGeometry->IndexToWorld(origin, origin);
bounds[1]-=bounds[0]; bounds[3]-=bounds[2]; bounds[5]-=bounds[4];
bounds[0] = 0.0; bounds[2] = 0.0; bounds[4] = 0.0;
slicedGeometry->SetBounds(bounds);
slicedGeometry->GetIndexToWorldTransform()->SetOffset(origin.Get_vnl_vector().data_block());
GetTimeSlicedGeometry()->InitializeEvenlyTimed(slicedGeometry, m_Dimensions[3]);
}
}
void mitk::Image::Initialize(const mitk::PixelType& type, int sDim, const mitk::Geometry2D& geometry2d, bool flipped, unsigned int channels, int tDim )
{
SlicedGeometry3D::Pointer slicedGeometry = SlicedGeometry3D::New();
slicedGeometry->InitializeEvenlySpaced(static_cast<Geometry2D*>(geometry2d.Clone().GetPointer()), sDim, flipped);
Initialize(type, *slicedGeometry, channels, tDim);
}
void mitk::Image::Initialize(const mitk::Image* image)
{
Initialize(*image->GetPixelType().GetTypeId(), *image->GetTimeSlicedGeometry());
}
void mitk::Image::Initialize(vtkImageData* vtkimagedata, int channels, int tDim, int sDim)
{
if(vtkimagedata==NULL) return;
m_Dimension=vtkimagedata->GetDataDimension();
unsigned int i, *tmpDimensions=new unsigned int[m_Dimension>4?m_Dimension:4];
for(i=0;i<m_Dimension;++i) tmpDimensions[i]=vtkimagedata->GetDimensions()[i];
if(m_Dimension<4)
{
unsigned int *p;
for(i=0,p=tmpDimensions+m_Dimension;i<4-m_Dimension;++i, ++p)
*p=1;
}
if(sDim>=0)
{
tmpDimensions[2]=sDim;
if(m_Dimension < 3)
m_Dimension = 3;
}
if(tDim>=0)
{
tmpDimensions[3]=tDim;
if(m_Dimension < 4)
m_Dimension = 4;
}
mitk::PixelType pixelType;
switch ( vtkimagedata->GetScalarType() )
{
case VTK_BIT:
case VTK_CHAR:
pixelType.Initialize(typeid(char), vtkimagedata->GetNumberOfScalarComponents());
break;
case VTK_UNSIGNED_CHAR:
pixelType.Initialize(typeid(unsigned char), vtkimagedata->GetNumberOfScalarComponents());
break;
case VTK_SHORT:
pixelType.Initialize(typeid(short), vtkimagedata->GetNumberOfScalarComponents());
break;
case VTK_UNSIGNED_SHORT:
pixelType.Initialize(typeid(unsigned short), vtkimagedata->GetNumberOfScalarComponents());
break;
case VTK_INT:
pixelType.Initialize(typeid(int), vtkimagedata->GetNumberOfScalarComponents());
break;
case VTK_UNSIGNED_INT:
pixelType.Initialize(typeid(unsigned int), vtkimagedata->GetNumberOfScalarComponents());
break;
case VTK_LONG:
pixelType.Initialize(typeid(long), vtkimagedata->GetNumberOfScalarComponents());
break;
case VTK_UNSIGNED_LONG:
pixelType.Initialize(typeid(unsigned long), vtkimagedata->GetNumberOfScalarComponents());
break;
case VTK_FLOAT:
pixelType.Initialize(typeid(float), vtkimagedata->GetNumberOfScalarComponents());
break;
case VTK_DOUBLE:
pixelType.Initialize(typeid(double), vtkimagedata->GetNumberOfScalarComponents());
break;
default:
break;
}
Initialize(pixelType,
m_Dimension,
tmpDimensions,
channels);
#if ((VTK_MAJOR_VERSION > 4) || ((VTK_MAJOR_VERSION==4) && (VTK_MINOR_VERSION>=4) ))
const double *spacinglist = vtkimagedata->GetSpacing();
#else
const float *spacinglist = vtkimagedata->GetSpacing();
#endif
Vector3D spacing;
FillVector3D(spacing, spacinglist[0], 1.0, 1.0);
if(m_Dimension>=2)
spacing[1]=spacinglist[1];
if(m_Dimension>=3)
spacing[2]=spacinglist[2];
// access origin of vtkImage
Point3D origin;
vtkFloatingPointType vtkorigin[3];
vtkimagedata->GetOrigin(vtkorigin);
FillVector3D(origin, vtkorigin[0], 0.0, 0.0);
if(m_Dimension>=2)
origin[1]=vtkorigin[1];
if(m_Dimension>=3)
origin[2]=vtkorigin[2];
SlicedGeometry3D* slicedGeometry = GetSlicedGeometry(0);
// re-initialize PlaneGeometry with origin and direction
PlaneGeometry* planeGeometry = static_cast<PlaneGeometry*>(slicedGeometry->GetGeometry2D(0));
planeGeometry->SetOrigin(origin);
// re-initialize SlicedGeometry3D
slicedGeometry->SetOrigin(origin);
slicedGeometry->SetSpacing(spacing);
GetTimeSlicedGeometry()->InitializeEvenlyTimed(slicedGeometry, m_Dimensions[3]);
delete [] tmpDimensions;
}
void mitk::Image::Initialize(const mitkIpPicDescriptor* pic, int channels, int tDim, int sDim)
{
if(pic==NULL) return;
Clear();
m_Dimension=pic->dim;
m_Dimensions=new unsigned int[m_Dimension>4?m_Dimension:4];
std::memcpy(m_Dimensions, pic->n, sizeof(unsigned int)*m_Dimension);
if(m_Dimension<4)
{
unsigned int i, *p;
for(i=0,p=m_Dimensions+m_Dimension;i<4-m_Dimension;++i, ++p)
*p=1;
}
if(sDim>=0)
{
m_Dimensions[2]=sDim;
if(m_Dimension < 3)
m_Dimension = 3;
}
if(tDim>=0)
{
m_Dimensions[3]=tDim;
if(m_Dimension < 4)
m_Dimension = 4;
}
unsigned int i;
for(i=0;i<4;++i)
{
m_LargestPossibleRegion.SetIndex(i, 0);
m_LargestPossibleRegion.SetSize (i, m_Dimensions[i]);
}
m_LargestPossibleRegion.SetIndex(i, 0);
m_LargestPossibleRegion.SetSize(i, channels);
m_PixelType=PixelType(pic);
SlicedGeometry3D::Pointer slicedGeometry = SlicedGeometry3D::New();
PicHelper::InitializeEvenlySpaced(pic, m_Dimensions[2], slicedGeometry);
TimeSlicedGeometry::Pointer timeSliceGeometry = TimeSlicedGeometry::New();
timeSliceGeometry->InitializeEvenlyTimed(slicedGeometry, m_Dimensions[3]);
timeSliceGeometry->ImageGeometryOn();
SetGeometry(timeSliceGeometry);
ImageDataItemPointer dnull=NULL;
m_Channels.assign(GetNumberOfChannels(), dnull);
m_Volumes.assign(GetNumberOfChannels()*m_Dimensions[3], dnull);
m_Slices.assign(GetNumberOfChannels()*m_Dimensions[3]*m_Dimensions[2], dnull);
ComputeOffsetTable();
Initialize();
m_Initialized = true;
}
bool mitk::Image::IsValidSlice(int s, int t, int n) const
{
if(m_Initialized)
return ((s>=0) && (s<(int)m_Dimensions[2]) && (t>=0) && (t< (int) m_Dimensions[3]) && (n>=0) && (n< (int)GetNumberOfChannels()));
else
return false;
}
bool mitk::Image::IsValidVolume(int t, int n) const
{
if(m_Initialized)
return IsValidSlice(0, t, n);
else
return false;
}
bool mitk::Image::IsValidChannel(int n) const
{
if(m_Initialized)
return IsValidSlice(0, 0, n);
else
return false;
}
void mitk::Image::ComputeOffsetTable()
{
if(m_OffsetTable!=NULL)
delete [] m_OffsetTable;
m_OffsetTable=new size_t[m_Dimension>4 ? m_Dimension+1 : 4+1];
unsigned int i;
size_t num=1;
m_OffsetTable[0] = 1;
for (i=0; i < m_Dimension; ++i)
{
num *= m_Dimensions[i];
m_OffsetTable[i+1] = num;
}
for (;i < 4; ++i)
m_OffsetTable[i+1] = num;
}
int mitk::Image::GetSliceIndex(int s, int t, int n) const
{
if(IsValidSlice(s,t,n)==false) return false;
return ((size_t)s)+((size_t) t)*m_Dimensions[2]+((size_t) n)*m_Dimensions[3]*m_Dimensions[2]; //??
}
int mitk::Image::GetVolumeIndex(int t, int n) const
{
if(IsValidVolume(t,n)==false) return false;
return ((size_t)t)+((size_t) n)*m_Dimensions[3]; //??
}
mitk::Image::ImageDataItemPointer mitk::Image::AllocateSliceData(int s, int t, int n, void *data, ImportMemoryManagementType importMemoryManagement)
{
int pos;
pos=GetSliceIndex(s,t,n);
// is slice available as part of a volume that is available?
ImageDataItemPointer sl, ch, vol;
vol=m_Volumes[GetVolumeIndex(t,n)];
if(vol.GetPointer()!=NULL)
{
sl=new ImageDataItem(*vol, 2, data, importMemoryManagement == ManageMemory, ((size_t) s)*m_OffsetTable[2]*(m_PixelType.GetBpe()/8));
sl->SetComplete(true);
return m_Slices[pos]=sl;
}
// is slice available as part of a channel that is available?
ch=m_Channels[n];
if(ch.GetPointer()!=NULL)
{
sl=new ImageDataItem(*ch, 2, data, importMemoryManagement == ManageMemory, (((size_t) s)*m_OffsetTable[2]+((size_t) t)*m_OffsetTable[3])*(m_PixelType.GetBpe()/8));
sl->SetComplete(true);
return m_Slices[pos]=sl;
}
// allocate new volume (instead of a single slice to keep data together!)
m_Volumes[GetVolumeIndex(t,n)]=vol=AllocateVolumeData(t,n,NULL,importMemoryManagement);
sl=new ImageDataItem(*vol, 2, data, importMemoryManagement == ManageMemory, ((size_t) s)*m_OffsetTable[2]*(m_PixelType.GetBpe()/8));
sl->SetComplete(true);
return m_Slices[pos]=sl;
////ALTERNATIVE:
//// allocate new slice
//sl=new ImageDataItem(m_PixelType, 2, m_Dimensions);
//m_Slices[pos]=sl;
//return vol;
}
mitk::Image::ImageDataItemPointer mitk::Image::AllocateVolumeData(int t, int n, void *data, ImportMemoryManagementType importMemoryManagement)
{
int pos;
pos=GetVolumeIndex(t,n);
// is volume available as part of a channel that is available?
ImageDataItemPointer ch, vol;
ch=m_Channels[n];
if(ch.GetPointer()!=NULL)
{
vol=new ImageDataItem(*ch, 3, data, importMemoryManagement == ManageMemory, (((size_t) t)*m_OffsetTable[3])*(m_PixelType.GetBpe()/8));
return m_Volumes[pos]=vol;
}
// allocate new volume
if(importMemoryManagement == CopyMemory)
{
vol=new ImageDataItem(m_PixelType, 3, m_Dimensions, NULL, true);
if(data != NULL)
std::memcpy(vol->GetData(), data, m_OffsetTable[3]*(m_PixelType.GetBpe()/8));
}
else
{
vol=new ImageDataItem(m_PixelType, 3, m_Dimensions, data, importMemoryManagement == ManageMemory);
}
m_Volumes[pos]=vol;
return vol;
}
mitk::Image::ImageDataItemPointer mitk::Image::AllocateChannelData(int n, void *data, ImportMemoryManagementType importMemoryManagement)
{
ImageDataItemPointer ch;
// allocate new channel
if(importMemoryManagement == CopyMemory)
{
ch=new ImageDataItem(m_PixelType, m_Dimension, m_Dimensions, NULL, true);
if(data != NULL)
std::memcpy(ch->GetData(), data, m_OffsetTable[4]*(m_PixelType.GetBpe()/8));
}
else
{
ch=new ImageDataItem(m_PixelType, m_Dimension, m_Dimensions, data, importMemoryManagement == ManageMemory);
}
m_Channels[n]=ch;
return ch;
}
unsigned int* mitk::Image::GetDimensions() const
{
return m_Dimensions;
}
void mitk::Image::Clear()
{
Superclass::Clear();
delete [] m_Dimensions;
m_Dimensions = NULL;
}
void mitk::Image::SetGeometry(Geometry3D* aGeometry3D)
{
// Please be aware of the 0.5 offset/pixel-center issue! See Geometry documentation for further information
if(aGeometry3D->GetImageGeometry()==false)
{
MITK_INFO << "WARNING: Applied a non-image geometry onto an image. Please be SURE that this geometry is pixel-center-based! If it is not, you need to call Geometry3D->ChangeImageGeometryConsideringOriginOffset(true) before calling image->setGeometry(..)\n";
}
Superclass::SetGeometry(aGeometry3D);
GetTimeSlicedGeometry()->ImageGeometryOn();
}
const mitk::Image::HistogramType* mitk::Image::GetScalarHistogram(int t) const
{
mitk::ImageTimeSelector* timeSelector = this->GetTimeSelector();
if(timeSelector!=NULL)
{
timeSelector->SetTimeNr(t);
timeSelector->UpdateLargestPossibleRegion();
mitk::HistogramGenerator* generator = static_cast<mitk::HistogramGenerator*>(m_HistogramGeneratorObject.GetPointer());
generator->SetImage(timeSelector->GetOutput());
generator->ComputeHistogram();
return static_cast<const mitk::Image::HistogramType*>(generator->GetHistogram());
}
return NULL;
}
#include "mitkImageAccessByItk.h"
//#define BOUNDINGOBJECT_IGNORE
template < typename ItkImageType >
void mitk::_ComputeExtremaInItkImage(ItkImageType* itkImage, mitk::Image* mitkImage, int t)
{
typename ItkImageType::RegionType region;
region = itkImage->GetBufferedRegion();
if(region.Crop(itkImage->GetRequestedRegion()) == false) return;
if(region != itkImage->GetRequestedRegion()) return;
itk::ImageRegionConstIterator<ItkImageType> it(itkImage, region);
typedef typename ItkImageType::PixelType TPixel;
TPixel value = 0;
if ( !mitkImage || !mitkImage->IsValidTimeStep( t ) ) return;
mitkImage->Expand(t+1); // make sure we have initialized all arrays
mitkImage->m_CountOfMinValuedVoxels[t] = 0;
mitkImage->m_CountOfMaxValuedVoxels[t] = 0;
mitkImage->m_Scalar2ndMin[t]=
mitkImage->m_ScalarMin[t] = itk::NumericTraits<ScalarType>::max();
mitkImage->m_Scalar2ndMax[t]=
mitkImage->m_ScalarMax[t] = itk::NumericTraits<ScalarType>::NonpositiveMin();
while( !it.IsAtEnd() )
{
value = it.Get();
// if ( (value > mitkImage->m_ScalarMin) && (value < mitkImage->m_Scalar2ndMin) ) mitkImage->m_Scalar2ndMin = value;
// else if ( (value < mitkImage->m_ScalarMax) && (value > mitkImage->m_Scalar2ndMax) ) mitkImage->m_Scalar2ndMax = value;
// else if (value > mitkImage->m_ScalarMax) mitkImage->m_ScalarMax = value;
// else if (value < mitkImage->m_ScalarMin) mitkImage->m_ScalarMin = value;
// if numbers start with 2ndMin or 2ndMax and never have that value again, the previous above logic failed
#ifdef BOUNDINGOBJECT_IGNORE
if( value > -32765)
{
#endif
// update min
if ( value < mitkImage->m_ScalarMin[t] )
{
mitkImage->m_Scalar2ndMin[t] = mitkImage->m_ScalarMin[t]; mitkImage->m_ScalarMin[t] = value;
mitkImage->m_CountOfMinValuedVoxels[t] = 1;
}
else if ( value == mitkImage->m_ScalarMin[t] )
{
++mitkImage->m_CountOfMinValuedVoxels[t];
}
else if ( value < mitkImage->m_Scalar2ndMin[t] )
{
mitkImage->m_Scalar2ndMin[t] = value;
}
// update max
if ( value > mitkImage->m_ScalarMax[t] )
{
mitkImage->m_Scalar2ndMax[t] = mitkImage->m_ScalarMax[t]; mitkImage->m_ScalarMax[t] = value;
mitkImage->m_CountOfMaxValuedVoxels[t] = 1;
}
else if ( value == mitkImage->m_ScalarMax[t] )
{
++mitkImage->m_CountOfMaxValuedVoxels[t];
}
else if ( value > mitkImage->m_Scalar2ndMax[t] )
{
mitkImage->m_Scalar2ndMax[t] = value;
}
#ifdef BOUNDINGOBJECT_IGNORE
}
#endif
++it;
}
//// guard for wrong 2dMin/Max on single constant value images
if (mitkImage->m_ScalarMax[t] == mitkImage->m_ScalarMin[t])
{
mitkImage->m_Scalar2ndMax[t] = mitkImage->m_Scalar2ndMin[t] = mitkImage->m_ScalarMax[t];
}
mitkImage->m_LastRecomputeTimeStamp.Modified();
//MITK_DEBUG <<"extrema "<<itk::NumericTraits<TPixel>::NonpositiveMin()<<" "<<mitkImage->m_ScalarMin<<" "<<mitkImage->m_Scalar2ndMin<<" "<<mitkImage->m_Scalar2ndMax<<" "<<mitkImage->m_ScalarMax<<" "<<itk::NumericTraits<TPixel>::max();
}
bool mitk::Image::IsValidTimeStep(int t) const
{
return ( ( m_Dimension >= 4 && t <= (int)m_Dimensions[3] && t > 0 ) || (t == 0) );
}
-void mitk::Image::Expand( int timeSteps ) const
+void mitk::Image::Expand( unsigned int timeSteps )
{
if(timeSteps < 1) itkExceptionMacro(<< "Invalid timestep in Image!");
if(! IsValidTimeStep( timeSteps-1 ) ) return;
- if(timeSteps > (int)m_ScalarMin.size() )
+ Superclass::Expand(timeSteps);
+ if(timeSteps > m_ScalarMin.size() )
{
m_ScalarMin.resize(timeSteps, itk::NumericTraits<ScalarType>::max());
m_ScalarMax.resize(timeSteps, itk::NumericTraits<ScalarType>::NonpositiveMin());
m_Scalar2ndMin.resize(timeSteps, itk::NumericTraits<ScalarType>::max());
m_Scalar2ndMax.resize(timeSteps, itk::NumericTraits<ScalarType>::NonpositiveMin());
m_CountOfMinValuedVoxels.resize(timeSteps, 0);
m_CountOfMaxValuedVoxels.resize(timeSteps, 0);
}
}
void mitk::Image::ResetImageStatistics() const
{
m_ScalarMin.assign(1, itk::NumericTraits<ScalarType>::max());
m_ScalarMax.assign(1, itk::NumericTraits<ScalarType>::NonpositiveMin());
m_Scalar2ndMin.assign(1, itk::NumericTraits<ScalarType>::max());
m_Scalar2ndMax.assign(1, itk::NumericTraits<ScalarType>::NonpositiveMin());
m_CountOfMinValuedVoxels.assign(1, 0);
m_CountOfMaxValuedVoxels.assign(1, 0);
}
void mitk::Image::ComputeImageStatistics(int t) const
{
// timestep valid?
if (!IsValidTimeStep(t)) return;
// image modified?
if (this->GetMTime() > m_LastRecomputeTimeStamp.GetMTime())
this->ResetImageStatistics();
// adapt vector length
- this->Expand(t+1);
+ // the const_cast is necessary since the whole statistics are provided
+ // with const-methods but are actually stored inside the object with mutable
+ // members. This should be resolved in a redesign of the image class.
+ const_cast<mitk::Image*>(this)->Expand(t+1);
// do we have valid information already?
if( m_ScalarMin[t] != itk::NumericTraits<ScalarType>::max() ||
m_Scalar2ndMin[t] != itk::NumericTraits<ScalarType>::max() ) return; // Values already calculated before...
if(this->m_PixelType.GetNumberOfComponents() == 1)
{
// recompute
mitk::ImageTimeSelector* timeSelector = this->GetTimeSelector();
if(timeSelector!=NULL)
{
timeSelector->SetTimeNr(t);
timeSelector->UpdateLargestPossibleRegion();
mitk::Image* image = timeSelector->GetOutput();
mitk::Image* thisImage = const_cast<Image*>(this);
AccessByItk_2( image, _ComputeExtremaInItkImage, thisImage, t );
}
}
else if(this->m_PixelType.GetNumberOfComponents() > 1)
{
m_ScalarMin[t] = 0;
m_ScalarMax[t] = 255;
}
}
mitk::ScalarType mitk::Image::GetScalarValueMin(int t) const
{
ComputeImageStatistics(t);
return m_ScalarMin[t];
}
mitk::ScalarType mitk::Image::GetScalarValueMax(int t) const
{
ComputeImageStatistics(t);
return m_ScalarMax[t];
}
mitk::ScalarType mitk::Image::GetScalarValue2ndMin(int t) const
{
ComputeImageStatistics(t);
return m_Scalar2ndMin[t];
}
mitk::ScalarType mitk::Image::GetScalarValue2ndMax(int t) const
{
ComputeImageStatistics(t);
return m_Scalar2ndMax[t];
}
mitk::ScalarType mitk::Image::GetCountOfMinValuedVoxels(int t) const
{
ComputeImageStatistics(t);
return m_CountOfMinValuedVoxels[t];
}
mitk::ScalarType mitk::Image::GetCountOfMaxValuedVoxels(int t) const
{
ComputeImageStatistics(t);
return m_CountOfMaxValuedVoxels[t];
}
void mitk::Image::PrintSelf(std::ostream& os, itk::Indent indent) const
{
unsigned char i;
if(m_Initialized)
{
os << indent << " PixelType: " << m_PixelType.GetTypeId()->name() << std::endl;
os << indent << " BitsPerElement: " << m_PixelType.GetBpe() << std::endl;
os << indent << " NumberOfComponents: " << m_PixelType.GetNumberOfComponents() << std::endl;
os << indent << " BitsPerComponent: " << m_PixelType.GetBitsPerComponent() << std::endl;
os << indent << " Dimension: " << m_Dimension << std::endl;
os << indent << " Dimensions: ";
for(i=0; i < m_Dimension; ++i)
os << GetDimension(i) << " ";
os << std::endl;
}
else
{
os << indent << " Image not initialized: m_Initialized: false" << std::endl;
}
Superclass::PrintSelf(os,indent);
}
bool mitk::Image::IsRotated() const
{
const mitk::Geometry3D* geo = this->GetGeometry();
bool ret = false;
if(geo)
{
const vnl_matrix_fixed<float, 3, 3> & mx = geo->GetIndexToWorldTransform()->GetMatrix().GetVnlMatrix();
float ref = 0;
for(short k = 0; k < 3; ++k)
ref += mx[k][k];
ref/=1000; // Arbitrary value; if a non-diagonal (nd) element is bigger then this, matrix is considered nd.
for(short i = 0; i < 3; ++i)
{
for(short j = 0; j < 3; ++j)
{
if(i != j)
{
if(abs(mx[i][j]) > ref) // matrix is nd
ret = true;
}
}
}
}
return ret;
}
diff --git a/Core/Code/DataManagement/mitkImage.h b/Core/Code/DataManagement/mitkImage.h
index 12225ae0ff..2889acfde0 100644
--- a/Core/Code/DataManagement/mitkImage.h
+++ b/Core/Code/DataManagement/mitkImage.h
@@ -1,663 +1,663 @@
/*=========================================================================
Program: Medical Imaging & Interaction Toolkit
Language: C++
Date: $Date$
Version: $Revision$
Copyright (c) German Cancer Research Center, Division of Medical and
Biological Informatics. All rights reserved.
See MITKCopyright.txt or http://www.mitk.org/copyright.html for details.
This software is distributed WITHOUT ANY WARRANTY; without even
the implied warranty of MERCHANTABILITY or FITNESS FOR A PARTICULAR
PURPOSE. See the above copyright notices for more information.
=========================================================================*/
#ifndef MITKIMAGE_H_HEADER_INCLUDED_C1C2FCD2
#define MITKIMAGE_H_HEADER_INCLUDED_C1C2FCD2
#include "mitkCommon.h"
#include "mitkSlicedData.h"
#include "mitkPixelType.h"
#include "mitkBaseData.h"
#include "mitkLevelWindow.h"
#include "mitkPlaneGeometry.h"
#include "mitkImageDataItem.h"
#ifndef __itkHistogram_h
#include <itkHistogram.h>
#endif
class vtkImageData;
namespace mitk {
class SubImageSelector;
//class ImageDataItem;
class ImageTimeSelector;
//##Documentation
//## @brief Image class for storing images
//##
//## Can be asked for header information, the data vector,
//## the mitkIpPicDescriptor struct or vtkImageData objects. If not the complete
//## data is required, the appropriate SubImageSelector class should be used
//## for access.
//## Image organizes sets of slices (s x 2D), volumes (t x 3D) and channels (n
//## x ND). Channels are for different kind of data, e.g., morphology in
//## channel 0, velocities in channel 1. All channels must have the same Geometry! In
//## particular, the dimensions of all channels are the same, only the pixel-type
//## may differ between channels.
//##
//## For importing ITK images use of mitk::ITKImageImport is recommended, see
//## \ref Adaptor.
//##
//## For ITK v3.8 and older: Converting coordinates from the ITK physical
//## coordinate system (which does not support rotated images) to the MITK world
//## coordinate system should be performed via the Geometry3D of the Image, see
//## Geometry3D::WorldToItkPhysicalPoint.
//## @ingroup Data
class MITK_CORE_EXPORT Image : public SlicedData
{
friend class SubImageSelector;
public:
mitkClassMacro(Image, SlicedData);
itkNewMacro(Self);
mitkCloneMacro(Image);
/** Smart Pointer type to a ImageDataItem. */
typedef itk::SmartPointerForwardReference<ImageDataItem> ImageDataItemPointer;
//## @param ImportMemoryManagementType This parameter is evaluated when setting new data to an image.
//## The different options are:
//## CopyMemory: Data to be set is copied and assigned to a new memory block. Data memory block will be freed on deletion of mitk::Image.
//## MamageMemory: Data to be set will be referenced, and Data memory block will be freed on deletion of mitk::Image.
//## Reference Memory: Data to be set will be referenced, but Data memory block will not be freed on deletion of mitk::Image.
//## DontManageMemory = ReferenceMemory.
enum ImportMemoryManagementType { CopyMemory, ManageMemory, ReferenceMemory, DontManageMemory = ReferenceMemory };
//##Documentation
//## @brief Vector container of SmartPointers to ImageDataItems;
//## Class is only for internal usage to allow convenient access to all slices over iterators;
//## See documentation of ImageDataItem for details.
typedef std::vector<ImageDataItemPointer> ImageDataItemPointerArray;
typedef itk::Statistics::Histogram<double> HistogramType;
public:
//##Documentation
//## @brief Returns the PixelType of channel @a n.
const mitk::PixelType& GetPixelType(int n = 0) const;
//##Documentation
//## @brief Get dimension of the image
//##
unsigned int GetDimension() const;
//##Documentation
//## @brief Get the size of dimension @a i (e.g., i=0 results in the number of pixels in x-direction).
//##
//## @sa GetDimensions()
unsigned int GetDimension(int i) const;
//## @brief Get the data vector of the complete image, i.e., of all channels linked together.
//##
//## If you only want to access a slice, volume at a specific time or single channel
//## use one of the SubImageSelector classes.
virtual void* GetData();
//## @brief Get the pixel value at one specific index position.
//## @brief Get the pixel value at one specific position.
//##
//## The pixel type is always being converted to double.
double GetPixelValueByIndex(const mitk::Index3D& position, unsigned int timestep = 0);
//## @brief Get the pixel value at one specific world position.
//##
//## The pixel type is always being converted to double.
double GetPixelValueByWorldCoordinate(const mitk::Point3D& position, unsigned int timestep = 0);
//##Documentation
//## @brief Get a volume at a specific time @a t of channel @a n as a vtkImageData.
virtual vtkImageData* GetVtkImageData(int t = 0, int n = 0);
//##Documentation
//## @brief Get the complete image, i.e., all channels linked together, as a @a mitkIpPicDescriptor.
//##
//## If you only want to access a slice, volume at a specific time or single channel
//## use one of the SubImageSelector classes.
virtual mitkIpPicDescriptor* GetPic();
//##Documentation
//## @brief Check whether slice @a s at time @a t in channel @a n is set
virtual bool IsSliceSet(int s = 0, int t = 0, int n = 0) const;
//##Documentation
//## @brief Check whether volume at time @a t in channel @a n is set
virtual bool IsVolumeSet(int t = 0, int n = 0) const;
//##Documentation
//## @brief Check whether the channel @a n is set
virtual bool IsChannelSet(int n = 0) const;
//##Documentation
//## @brief Set @a data as slice @a s at time @a t in channel @a n. It is in
//## the responsibility of the caller to ensure that the data vector @a data
//## is really a slice (at least is not smaller than a slice), since there is
//## no chance to check this.
//##
//## The data is copied to an array managed by the image. If the image shall
//## reference the data, use SetImportSlice with ImportMemoryManagementType
//## set to ReferenceMemory. For importing ITK images use of mitk::
//## ITKImageImport is recommended.
//## @sa SetPicSlice, SetImportSlice, SetImportVolume
virtual bool SetSlice(const void *data, int s = 0, int t = 0, int n = 0);
//##Documentation
//## @brief Set @a data as volume at time @a t in channel @a n. It is in
//## the responsibility of the caller to ensure that the data vector @a data
//## is really a volume (at least is not smaller than a volume), since there is
//## no chance to check this.
//##
//## The data is copied to an array managed by the image. If the image shall
//## reference the data, use SetImportVolume with ImportMemoryManagementType
//## set to ReferenceMemory. For importing ITK images use of mitk::
//## ITKImageImport is recommended.
//## @sa SetPicVolume, SetImportVolume
virtual bool SetVolume(const void *data, int t = 0, int n = 0);
//##Documentation
//## @brief Set @a data in channel @a n. It is in
//## the responsibility of the caller to ensure that the data vector @a data
//## is really a channel (at least is not smaller than a channel), since there is
//## no chance to check this.
//##
//## The data is copied to an array managed by the image. If the image shall
//## reference the data, use SetImportChannel with ImportMemoryManagementType
//## set to ReferenceMemory. For importing ITK images use of mitk::
//## ITKImageImport is recommended.
//## @sa SetPicChannel, SetImportChannel
virtual bool SetChannel(const void *data, int n = 0);
//##Documentation
//## @brief Set @a data as slice @a s at time @a t in channel @a n. It is in
//## the responsibility of the caller to ensure that the data vector @a data
//## is really a slice (at least is not smaller than a slice), since there is
//## no chance to check this.
//##
//## The data is managed according to the parameter \a importMemoryManagement.
//## @sa SetPicSlice
virtual bool SetImportSlice(void *data, int s = 0, int t = 0, int n = 0, ImportMemoryManagementType importMemoryManagement = CopyMemory );
//##Documentation
//## @brief Set @a data as volume at time @a t in channel @a n. It is in
//## the responsibility of the caller to ensure that the data vector @a data
//## is really a volume (at least is not smaller than a volume), since there is
//## no chance to check this.
//##
//## The data is managed according to the parameter \a importMemoryManagement.
//## @sa SetPicVolume
virtual bool SetImportVolume(void *data, int t = 0, int n = 0, ImportMemoryManagementType importMemoryManagement = CopyMemory );
//##Documentation
//## @brief Set @a data in channel @a n. It is in
//## the responsibility of the caller to ensure that the data vector @a data
//## is really a channel (at least is not smaller than a channel), since there is
//## no chance to check this.
//##
//## The data is managed according to the parameter \a importMemoryManagement.
//## @sa SetPicChannel
virtual bool SetImportChannel(void *data, int n = 0, ImportMemoryManagementType importMemoryManagement = CopyMemory );
//##Documentation
//## @brief Set @a pic as slice @a s at time @a t in channel @a n.
//##
//## The data is copied to an array managed by the image.
//## @todo The corresponding @a Geomety3D and depending @a Geometry2D entries
//## are updated according to the information provided in the tags of @a pic.
//## @return @a false : dimensions and/or data-type of @a pic does not
//## comply with image
//## @a true success
virtual bool SetPicSlice(const mitkIpPicDescriptor *pic, int s = 0, int t = 0, int n = 0, ImportMemoryManagementType importMemoryManagement = CopyMemory );
//##Documentation
//## @brief Set @a pic as volume at time @a t in channel @a n.
//##
//## The data is copied to an array managed by the image.
//## @todo The corresponding @a Geomety3D and depending @a Geometry2D entries
//## are updated according to the information provided in the tags of @a pic.
//## @return @a false : dimensions and/or data-type of @a pic does not
//## comply with image
//## @a true success
virtual bool SetPicVolume(const mitkIpPicDescriptor *pic, int t = 0, int n = 0, ImportMemoryManagementType importMemoryManagement = CopyMemory );
//##Documentation
//## @brief Set @a pic in channel @a n.
//##
//## The data is copied to an array managed by the image.
//## @todo The corresponding @a Geomety3D and depending @a Geometry2D entries
//## are updated according to the information provided in the tags of @a pic.
//## @return @a false : dimensions and/or data-type of @a pic does not
//## comply with image
//## @a true success
virtual bool SetPicChannel(const mitkIpPicDescriptor *pic, int n = 0, ImportMemoryManagementType importMemoryManagement = CopyMemory );
//##Documentation
//## initialize new (or re-initialize) image information
//## @warning Initialize() by pic assumes a plane, evenly spaced geometry starting at (0,0,0).
virtual void Initialize(const mitk::PixelType& type, unsigned int dimension, unsigned int *dimensions, unsigned int channels = 1);
//##Documentation
//## initialize new (or re-initialize) image information by a Geometry3D
//##
//## @param tDim override time dimension (@a n[3]) if @a geometry is a TimeSlicedGeometry (if >0)
virtual void Initialize(const mitk::PixelType& type, const mitk::Geometry3D& geometry, unsigned int channels = 1, int tDim=-1);
//##Documentation
//## initialize new (or re-initialize) image information by a Geometry2D and number of slices
//##
//## Initializes the bounding box according to the width/height of the
//## Geometry2D and @a sDim via SlicedGeometry3D::InitializeEvenlySpaced.
//## The spacing is calculated from the Geometry2D.
//## @param tDim override time dimension (@a n[3]) if @a geometry is a TimeSlicedGeometry (if >0)
//## \sa SlicedGeometry3D::InitializeEvenlySpaced
virtual void Initialize(const mitk::PixelType& type, int sDim, const mitk::Geometry2D& geometry2d, bool flipped = false, unsigned int channels = 1, int tDim=-1);
//##Documentation
//## initialize new (or re-initialize) image information by another
//## mitk-image.
//## Only the header is used, not the data vector!
//##
virtual void Initialize(const mitk::Image* image);
//##Documentation
//## initialize new (or re-initialize) image information by @a pic.
//## Dimensions and @a Geometry3D /@a Geometry2D are set according
//## to the tags in @a pic.
//## Only the header is used, not the data vector! Use SetPicVolume(pic)
//## to set the data vector.
//##
//## @param tDim override time dimension (@a n[3]) in @a pic (if >0)
//## @param sDim override z-space dimension (@a n[2]) in @a pic (if >0)
//## @warning Initialize() by pic assumes a plane, evenly spaced geometry starting at (0,0,0).
virtual void Initialize(const mitkIpPicDescriptor* pic, int channels = 1, int tDim = -1, int sDim = -1);
//##Documentation
//## initialize new (or re-initialize) image information by @a vtkimagedata,
//## a vtk-image.
//## Only the header is used, not the data vector! Use
//## SetVolume(vtkimage->GetScalarPointer()) to set the data vector.
//##
//## @param tDim override time dimension in @a vtkimagedata (if >0 and <)
//## @param sDim override z-space dimension in @a vtkimagedata (if >0 and <)
virtual void Initialize(vtkImageData* vtkimagedata, int channels = 1, int tDim = -1, int sDim = -1);
//##Documentation
//## initialize new (or re-initialize) image information by @a itkimage,
//## a templated itk-image.
//## Only the header is used, not the data vector! Use
//## SetVolume(itkimage->GetBufferPointer()) to set the data vector.
//##
//## @param tDim override time dimension in @a itkimage (if >0 and <)
//## @param sDim override z-space dimension in @a itkimage (if >0 and <)
template <typename itkImageType> void InitializeByItk(const itkImageType* itkimage, int channels = 1, int tDim = -1, int sDim=-1)
{
if(itkimage==NULL) return;
MITK_DEBUG << "Initializing MITK image from ITK image.";
// build array with dimensions in each direction with at least 4 entries
m_Dimension=itkimage->GetImageDimension();
unsigned int i, *tmpDimensions=new unsigned int[m_Dimension>4?m_Dimension:4];
for(i=0;i<m_Dimension;++i)
tmpDimensions[i]=itkimage->GetLargestPossibleRegion().GetSize().GetSize()[i];
if(m_Dimension<4)
{
unsigned int *p;
for(i=0,p=tmpDimensions+m_Dimension;i<4-m_Dimension;++i, ++p)
*p=1;
}
// overwrite number of slices if sDim is set
if((m_Dimension>2) && (sDim>=0))
tmpDimensions[2]=sDim;
// overwrite number of time points if tDim is set
if((m_Dimension>3) && (tDim>=0))
tmpDimensions[3]=tDim;
// rough initialization of Image
Initialize(mitk::PixelType(typeid(typename itkImageType::PixelType)),
m_Dimension,
tmpDimensions,
channels);
const typename itkImageType::SpacingType & itkspacing = itkimage->GetSpacing();
MITK_DEBUG << "ITK spacing " << itkspacing;
// access spacing of itk::Image
Vector3D spacing;
FillVector3D(spacing, itkspacing[0], 1.0, 1.0);
if(m_Dimension >= 2)
spacing[1]=itkspacing[1];
if(m_Dimension >= 3)
spacing[2]=itkspacing[2];
// access origin of itk::Image
Point3D origin;
const typename itkImageType::PointType & itkorigin = itkimage->GetOrigin();
MITK_DEBUG << "ITK origin " << itkorigin;
FillVector3D(origin, itkorigin[0], 0.0, 0.0);
if(m_Dimension>=2)
origin[1]=itkorigin[1];
if(m_Dimension>=3)
origin[2]=itkorigin[2];
// access direction of itk::Image and include spacing
const typename itkImageType::DirectionType & itkdirection = itkimage->GetDirection();
MITK_DEBUG << "ITK direction " << itkdirection;
mitk::Matrix3D matrix;
matrix.SetIdentity();
unsigned int j, itkDimMax3 = (m_Dimension >= 3? 3 : m_Dimension);
// check if spacing has no zero entry and itkdirection has no zero columns
bool itkdirectionOk = true;
mitk::ScalarType columnSum;
for( j=0; j < itkDimMax3; ++j )
{
columnSum = 0.0;
for ( i=0; i < itkDimMax3; ++i)
{
columnSum += fabs(itkdirection[i][j]);
}
if(columnSum < mitk::eps)
{
itkdirectionOk = false;
}
if ( (spacing[j] < - mitk::eps) // (normally sized) negative value
&& (j==2) && (m_Dimensions[2] == 1) )
{
// Negative spacings can occur when reading single DICOM slices with ITK via GDCMIO
// In these cases spacing is not determind by ITK correctly (because it distinguishes correctly
// between slice thickness and inter slice distance -- slice distance is meaningless for
// single slices).
// I experienced that ITK produced something meaningful nonetheless because is is
// evaluating the tag "(0018,0088) Spacing between slices" as a fallback. This tag is not
// reliable (http://www.itk.org/pipermail/insight-users/2005-September/014711.html)
// but gives at least a hint.
// In real world cases I experienced that this tag contained the correct inter slice distance
// with a negative sign, so we just invert such negative spacings.
MITK_WARN << "Illegal value of itk::Image::GetSpacing()[" << j <<"]=" << spacing[j] << ". Using inverted value " << -spacing[j];
spacing[j] = -spacing[j];
}
else if (spacing[j] < mitk::eps) // value near zero
{
MITK_ERROR << "Illegal value of itk::Image::GetSpacing()[" << j <<"]=" << spacing[j] << ". Using 1.0 instead.";
spacing[j] = 1.0;
}
}
if(itkdirectionOk == false)
{
MITK_ERROR << "Illegal matrix returned by itk::Image::GetDirection():" << itkdirection << " Using identity instead.";
for ( i=0; i < itkDimMax3; ++i)
for( j=0; j < itkDimMax3; ++j )
if ( i == j )
matrix[i][j] = spacing[j];
else
matrix[i][j] = 0.0;
}
else
{
for ( i=0; i < itkDimMax3; ++i)
for( j=0; j < itkDimMax3; ++j )
matrix[i][j] = itkdirection[i][j]*spacing[j];
}
// re-initialize PlaneGeometry with origin and direction
PlaneGeometry* planeGeometry = static_cast<PlaneGeometry*>(GetSlicedGeometry(0)->GetGeometry2D(0));
planeGeometry->SetOrigin(origin);
planeGeometry->GetIndexToWorldTransform()->SetMatrix(matrix);
// re-initialize SlicedGeometry3D
SlicedGeometry3D* slicedGeometry = GetSlicedGeometry(0);
slicedGeometry->InitializeEvenlySpaced(planeGeometry, m_Dimensions[2]);
slicedGeometry->SetSpacing(spacing);
// re-initialize TimeSlicedGeometry
GetTimeSlicedGeometry()->InitializeEvenlyTimed(slicedGeometry, m_Dimensions[3]);
// clean-up
delete [] tmpDimensions;
this->Initialize();
};
//##Documentation
//## @brief Check whether slice @a s at time @a t in channel @a n is valid, i.e.,
//## is (or can be) inside of the image
virtual bool IsValidSlice(int s = 0, int t = 0, int n = 0) const;
//##Documentation
//## @brief Check whether volume at time @a t in channel @a n is valid, i.e.,
//## is (or can be) inside of the image
virtual bool IsValidVolume(int t = 0, int n = 0) const;
//##Documentation
//## @brief Check whether the channel @a n is valid, i.e.,
//## is (or can be) inside of the image
virtual bool IsValidChannel(int n = 0) const;
//##Documentation
//## @brief Returns true if an image is rotated, i.e. its geometry's
//## transformation matrix has nonzero elements besides the diagonal.
//## Non-diagonal elements are checked if larger then 1/1000 of the matrix' trace.
bool IsRotated() const;
//##Documentation
//## @brief Get the sizes of all dimensions as an integer-array.
//##
//## @sa GetDimension(int i);
unsigned int* GetDimensions() const;
//##Documentation
//## @brief Sets a geometry to an image.
virtual void SetGeometry(Geometry3D* aGeometry3D);
virtual const HistogramType* GetScalarHistogram(int t=0) const;
//##Documentation
//## \brief Get the minimum for scalar images
virtual ScalarType GetScalarValueMin(int t=0) const;
//##Documentation
//## \brief Get the maximum for scalar images
virtual ScalarType GetScalarValueMax(int t=0) const;
//##Documentation
//## \brief Get the second smallest value for scalar images
virtual ScalarType GetScalarValue2ndMin(int t=0) const;
//##Documentation
//## \brief Get the smallest value for scalar images, but do not recompute it first
virtual mitk::ScalarType GetScalarValueMinNoRecompute( unsigned int t = 0 ) const
{
if ( t < m_ScalarMin.size() )
return m_ScalarMin[t];
else return itk::NumericTraits<ScalarType>::max();
}
//##Documentation
//## \brief Get the second smallest value for scalar images, but do not recompute it first
virtual mitk::ScalarType GetScalarValue2ndMinNoRecompute( unsigned int t = 0 ) const
{
if ( t < m_Scalar2ndMin.size() )
return m_Scalar2ndMin[t];
else return itk::NumericTraits<ScalarType>::max();
}
//##Documentation
//## \brief Get the second largest value for scalar images
virtual ScalarType GetScalarValue2ndMax(int t=0) const;
//##Documentation
//## \brief Get the largest value for scalar images, but do not recompute it first
virtual mitk::ScalarType GetScalarValueMaxNoRecompute( unsigned int t = 0 ) const
{
if ( t < m_ScalarMax.size() )
return m_ScalarMax[t];
else return itk::NumericTraits<ScalarType>::NonpositiveMin();
}
//##Documentation
//## \brief Get the second largest value for scalar images, but do not recompute it first
virtual mitk::ScalarType GetScalarValue2ndMaxNoRecompute( unsigned int t = 0 ) const
{
if ( t < m_Scalar2ndMax.size() )
return m_Scalar2ndMax[t];
else return itk::NumericTraits<ScalarType>::NonpositiveMin();
}
//##Documentation
//## \brief Get the count of voxels with the smallest scalar value in the dataset
mitk::ScalarType GetCountOfMinValuedVoxels(int t = 0) const;
//##Documentation
//## \brief Get the count of voxels with the largest scalar value in the dataset
mitk::ScalarType GetCountOfMaxValuedVoxels(int t = 0) const;
//##Documentation
//## \brief Get the count of voxels with the largest scalar value in the dataset
virtual unsigned int GetCountOfMaxValuedVoxelsNoRecompute( unsigned int t = 0 ) const
{
if ( t < m_CountOfMaxValuedVoxels.size() )
return m_CountOfMaxValuedVoxels[t];
else return 0;
}
//##Documentation
//## \brief Get the count of voxels with the smallest scalar value in the dataset
virtual unsigned int GetCountOfMinValuedVoxelsNoRecompute( unsigned int t = 0 ) const
{
if ( t < m_CountOfMinValuedVoxels.size() )
return m_CountOfMinValuedVoxels[t];
else return 0;
}
//##Documentation
//## @warning for internal use only
virtual ImageDataItemPointer GetSliceData(int s = 0, int t = 0, int n = 0, void *data = NULL, ImportMemoryManagementType importMemoryManagement = CopyMemory);
//##Documentation
//## @warning for internal use only
virtual ImageDataItemPointer GetVolumeData(int t = 0, int n = 0, void *data = NULL, ImportMemoryManagementType importMemoryManagement = CopyMemory);
//##Documentation
//## @warning for internal use only
virtual ImageDataItemPointer GetChannelData(int n = 0, void *data = NULL, ImportMemoryManagementType importMemoryManagement = CopyMemory);
template < typename ItkImageType >
friend void _ComputeExtremaInItkImage(ItkImageType* itkImage, mitk::Image * mitkImage, int t);
protected:
int GetSliceIndex(int s = 0, int t = 0, int n = 0) const;
int GetVolumeIndex(int t = 0, int n = 0) const;
void ComputeOffsetTable();
- virtual void Expand( int timeSteps ) const;
+ virtual void Expand( unsigned int timeSteps );
virtual bool IsValidTimeStep(int t) const;
virtual void ResetImageStatistics() const;
virtual void ComputeImageStatistics(int t=0) const;
virtual ImageDataItemPointer AllocateSliceData(int s = 0, int t = 0, int n = 0, void *data = NULL, ImportMemoryManagementType importMemoryManagement = CopyMemory);
virtual ImageDataItemPointer AllocateVolumeData(int t = 0, int n = 0, void *data = NULL, ImportMemoryManagementType importMemoryManagement = CopyMemory);
virtual ImageDataItemPointer AllocateChannelData(int n = 0, void *data = NULL, ImportMemoryManagementType importMemoryManagement = CopyMemory);
Image();
Image(const Image &other);
virtual ~Image();
virtual void Clear();
//## @warning Has to be called by every Initialize method!
virtual void Initialize();
ImageTimeSelector* GetTimeSelector() const;
virtual void PrintSelf(std::ostream& os, itk::Indent indent) const;
mutable ImageDataItemPointerArray m_Channels;
mutable ImageDataItemPointerArray m_Volumes;
mutable ImageDataItemPointerArray m_Slices;
unsigned int m_Dimension;
unsigned int *m_Dimensions;
size_t *m_OffsetTable;
ImageDataItemPointer m_CompleteData;
PixelType m_PixelType;
mutable itk::Object::Pointer m_HistogramGeneratorObject;
mutable itk::Object::Pointer m_TimeSelectorForExtremaObject;
mutable std::vector<unsigned int> m_CountOfMinValuedVoxels;
mutable std::vector<unsigned int> m_CountOfMaxValuedVoxels;
mutable std::vector<ScalarType> m_ScalarMin;
mutable std::vector<ScalarType> m_ScalarMax;
mutable std::vector<ScalarType> m_Scalar2ndMin;
mutable std::vector<ScalarType> m_Scalar2ndMax;
itk::TimeStamp m_LastRecomputeTimeStamp;
};
//##Documentation
//## @brief Cast an itk::Image (with a specific type) to an mitk::Image.
//##
//## CastToMitkImage does not cast pixel types etc., just image data
//## Needs "mitkImage.h" header included.
//## If you get a compile error, try image.GetPointer();
//## @ingroup Adaptor
//## \sa mitkITKImageImport
template <typename ItkOutputImageType>
void CastToMitkImage(const itk::SmartPointer<ItkOutputImageType>& itkimage, itk::SmartPointer<mitk::Image>& mitkoutputimage)
{
if(mitkoutputimage.IsNull())
{
mitkoutputimage = mitk::Image::New();
}
mitkoutputimage->InitializeByItk(itkimage.GetPointer());
mitkoutputimage->SetChannel(itkimage->GetBufferPointer());
}
//##Documentation
//## @brief Cast an itk::Image (with a specific type) to an mitk::Image.
//##
//## CastToMitkImage does not cast pixel types etc., just image data
//## Needs "mitkImage.h" header included.
//## If you get a compile error, try image.GetPointer();
//## @ingroup Adaptor
//## \sa mitkITKImageImport
template <typename ItkOutputImageType>
void CastToMitkImage(const ItkOutputImageType* itkimage, itk::SmartPointer<mitk::Image>& mitkoutputimage)
{
if(mitkoutputimage.IsNull())
{
mitkoutputimage = mitk::Image::New();
}
mitkoutputimage->InitializeByItk(itkimage);
mitkoutputimage->SetChannel(itkimage->GetBufferPointer());
}
} // namespace mitk
#endif /* MITKIMAGE_H_HEADER_INCLUDED_C1C2FCD2 */
diff --git a/Core/Code/DataManagement/mitkLandmarkBasedCurvedGeometry.cpp b/Core/Code/DataManagement/mitkLandmarkBasedCurvedGeometry.cpp
index 3a785dc677..61a36914e4 100644
--- a/Core/Code/DataManagement/mitkLandmarkBasedCurvedGeometry.cpp
+++ b/Core/Code/DataManagement/mitkLandmarkBasedCurvedGeometry.cpp
@@ -1,36 +1,36 @@
/*=========================================================================
Program: Medical Imaging & Interaction Toolkit
Language: C++
Date: $Date$
Version: $Revision$
Copyright (c) German Cancer Research Center, Division of Medical and
Biological Informatics. All rights reserved.
See MITKCopyright.txt or http://www.mitk.org/copyright.html for details.
This software is distributed WITHOUT ANY WARRANTY; without even
the implied warranty of MERCHANTABILITY or FITNESS FOR A PARTICULAR
PURPOSE. See the above copyright notices for more information.
=========================================================================*/
#include "mitkLandmarkBasedCurvedGeometry.h"
#include <vtkAbstractTransform.h>
mitk::LandmarkBasedCurvedGeometry::LandmarkBasedCurvedGeometry()
: m_TargetLandmarks(NULL)
{
}
-mitk::LandmarkBasedCurvedGeometry::~LandmarkBasedCurvedGeometry()
+mitk::LandmarkBasedCurvedGeometry::LandmarkBasedCurvedGeometry(const LandmarkBasedCurvedGeometry& other)
+ : Superclass(other)
{
-
+ SetTargetLandmarks(other.m_TargetLandmarks);
}
-void mitk::LandmarkBasedCurvedGeometry::InitializeGeometry(Self * newGeometry) const
+mitk::LandmarkBasedCurvedGeometry::~LandmarkBasedCurvedGeometry()
{
- Superclass::InitializeGeometry(newGeometry);
- newGeometry->SetTargetLandmarks(m_TargetLandmarks);
+
}
diff --git a/Core/Code/DataManagement/mitkLandmarkBasedCurvedGeometry.h b/Core/Code/DataManagement/mitkLandmarkBasedCurvedGeometry.h
index 8cc2e588d4..584a4a4aae 100644
--- a/Core/Code/DataManagement/mitkLandmarkBasedCurvedGeometry.h
+++ b/Core/Code/DataManagement/mitkLandmarkBasedCurvedGeometry.h
@@ -1,59 +1,61 @@
/*=========================================================================
Program: Medical Imaging & Interaction Toolkit
Language: C++
Date: $Date$
Version: $Revision$
Copyright (c) German Cancer Research Center, Division of Medical and
Biological Informatics. All rights reserved.
See MITKCopyright.txt or http://www.mitk.org/copyright.html for details.
This software is distributed WITHOUT ANY WARRANTY; without even
the implied warranty of MERCHANTABILITY or FITNESS FOR A PARTICULAR
PURPOSE. See the above copyright notices for more information.
=========================================================================*/
#ifndef MITKLANDMARKBASEDCURVEDGEOMETRY_H_HEADER_INCLUDED_C1C68A2C
#define MITKLANDMARKBASEDCURVEDGEOMETRY_H_HEADER_INCLUDED_C1C68A2C
#include "mitkAbstractTransformGeometry.h"
#include "mitkPointSet.h"
namespace mitk {
//##Documentation
//## @brief Superclass of AbstractTransformGeometry sub-classes defined
//## by a set of landmarks.
//##
//## @ingroup Geometry
class MITK_CORE_EXPORT LandmarkBasedCurvedGeometry : public AbstractTransformGeometry
{
public:
mitkClassMacro(LandmarkBasedCurvedGeometry, AbstractTransformGeometry);
//##Documentation
//## @brief Set the landmarks through which the geometry shall pass
itkSetConstObjectMacro(TargetLandmarks, mitk::PointSet::DataType::PointsContainer);
//##Documentation
//## @brief Get the landmarks through which the geometry shall pass
itkGetConstObjectMacro(TargetLandmarks, mitk::PointSet::DataType::PointsContainer);
virtual void ComputeGeometry() = 0;
+ virtual AffineGeometryFrame3D::Pointer Clone() const = 0;
+
protected:
LandmarkBasedCurvedGeometry();
+ LandmarkBasedCurvedGeometry(const LandmarkBasedCurvedGeometry& other);
+
virtual ~LandmarkBasedCurvedGeometry();
-
- void InitializeGeometry(Self * newGeometry) const;
mitk::PointSet::DataType::PointsContainer::ConstPointer m_TargetLandmarks;
};
} // namespace mitk
#endif /* MITKLANDMARKBASEDCURVEDGEOMETRY_H_HEADER_INCLUDED_C1C68A2C */
diff --git a/Core/Code/DataManagement/mitkLandmarkProjectorBasedCurvedGeometry.cpp b/Core/Code/DataManagement/mitkLandmarkProjectorBasedCurvedGeometry.cpp
index e327470ab3..6511906f82 100644
--- a/Core/Code/DataManagement/mitkLandmarkProjectorBasedCurvedGeometry.cpp
+++ b/Core/Code/DataManagement/mitkLandmarkProjectorBasedCurvedGeometry.cpp
@@ -1,78 +1,83 @@
/*=========================================================================
Program: Medical Imaging & Interaction Toolkit
Language: C++
Date: $Date$
Version: $Revision$
Copyright (c) German Cancer Research Center, Division of Medical and
Biological Informatics. All rights reserved.
See MITKCopyright.txt or http://www.mitk.org/copyright.html for details.
This software is distributed WITHOUT ANY WARRANTY; without even
the implied warranty of MERCHANTABILITY or FITNESS FOR A PARTICULAR
PURPOSE. See the above copyright notices for more information.
=========================================================================*/
#include "mitkLandmarkProjectorBasedCurvedGeometry.h"
#include <vtkAbstractTransform.h>
mitk::LandmarkProjectorBasedCurvedGeometry::LandmarkProjectorBasedCurvedGeometry()
: m_LandmarkProjector(NULL), m_InterpolatingAbstractTransform(NULL)
{
}
+mitk::LandmarkProjectorBasedCurvedGeometry::LandmarkProjectorBasedCurvedGeometry(const mitk::LandmarkProjectorBasedCurvedGeometry& other) : Superclass(other)
+{
+ this->SetLandmarkProjector(other.m_LandmarkProjector);
+ this->ComputeGeometry();
+}
+
mitk::LandmarkProjectorBasedCurvedGeometry::~LandmarkProjectorBasedCurvedGeometry()
{
if(m_InterpolatingAbstractTransform!=NULL)
m_InterpolatingAbstractTransform->Delete();
}
void mitk::LandmarkProjectorBasedCurvedGeometry::SetLandmarkProjector(mitk::LandmarkProjector* aLandmarkProjector)
{
itkDebugMacro("setting LandmarkProjector to " << aLandmarkProjector );
if(m_LandmarkProjector != aLandmarkProjector)
{
m_LandmarkProjector = aLandmarkProjector;
if(m_LandmarkProjector.IsNotNull())
{
if(m_FrameGeometry.IsNotNull())
m_LandmarkProjector->SetFrameGeometry(m_FrameGeometry);
if(m_InterpolatingAbstractTransform == NULL)
{
itkWarningMacro(<<"m_InterpolatingAbstractTransform not set.");
}
m_LandmarkProjector->SetInterpolatingAbstractTransform(GetInterpolatingAbstractTransform());
SetVtkAbstractTransform(m_LandmarkProjector->GetCompleteAbstractTransform());
}
Modified();
}
}
void mitk::LandmarkProjectorBasedCurvedGeometry::SetFrameGeometry(const mitk::Geometry3D* frameGeometry)
{
Superclass::SetFrameGeometry(frameGeometry);
if(m_LandmarkProjector.IsNotNull())
m_LandmarkProjector->SetFrameGeometry(frameGeometry);
}
void mitk::LandmarkProjectorBasedCurvedGeometry::ComputeGeometry()
{
if(m_LandmarkProjector.IsNull())
{
itkExceptionMacro(<< "m_LandmarkProjector is not set.");
}
m_LandmarkProjector->ProjectLandmarks(m_TargetLandmarks);
SetPlane(m_LandmarkProjector->GetParameterPlane());
}
-
-void mitk::LandmarkProjectorBasedCurvedGeometry::InitializeGeometry(Self * newGeometry) const
+mitk::AffineGeometryFrame3D::Pointer mitk::LandmarkProjectorBasedCurvedGeometry::Clone() const
{
- Superclass::InitializeGeometry(newGeometry);
- newGeometry->SetLandmarkProjector(m_LandmarkProjector);
- newGeometry->ComputeGeometry();
+ mitk::AffineGeometryFrame3D::Pointer newGeometry = new LandmarkProjectorBasedCurvedGeometry(*this);
+ newGeometry->UnRegister();
+ return newGeometry.GetPointer();
}
diff --git a/Core/Code/DataManagement/mitkLandmarkProjectorBasedCurvedGeometry.h b/Core/Code/DataManagement/mitkLandmarkProjectorBasedCurvedGeometry.h
index 0d42cb1337..9381f90d0b 100644
--- a/Core/Code/DataManagement/mitkLandmarkProjectorBasedCurvedGeometry.h
+++ b/Core/Code/DataManagement/mitkLandmarkProjectorBasedCurvedGeometry.h
@@ -1,59 +1,62 @@
/*=========================================================================
Program: Medical Imaging & Interaction Toolkit
Language: C++
Date: $Date$
Version: $Revision$
Copyright (c) German Cancer Research Center, Division of Medical and
Biological Informatics. All rights reserved.
See MITKCopyright.txt or http://www.mitk.org/copyright.html for details.
This software is distributed WITHOUT ANY WARRANTY; without even
the implied warranty of MERCHANTABILITY or FITNESS FOR A PARTICULAR
PURPOSE. See the above copyright notices for more information.
=========================================================================*/
#ifndef MITKLANDMARKPROJECTORBASEDCURVEDGEOMETRY_H_HEADER_INCLUDED_C1C68A2C
#define MITKLANDMARKPROJECTORBASEDCURVEDGEOMETRY_H_HEADER_INCLUDED_C1C68A2C
#include "mitkLandmarkBasedCurvedGeometry.h"
#include "mitkLandmarkProjector.h"
namespace mitk {
//##Documentation
//## @brief Superclass of AbstractTransformGeometry sub-classes defined
//## by a set of landmarks.
//##
//## @ingroup Geometry
class MITK_CORE_EXPORT LandmarkProjectorBasedCurvedGeometry : public LandmarkBasedCurvedGeometry
{
public:
mitkClassMacro(LandmarkProjectorBasedCurvedGeometry, LandmarkBasedCurvedGeometry);
void SetLandmarkProjector(mitk::LandmarkProjector* aLandmarkProjector);
itkGetConstObjectMacro(LandmarkProjector, mitk::LandmarkProjector);
virtual void SetFrameGeometry(const mitk::Geometry3D* frameGeometry);
virtual void ComputeGeometry();
itkGetConstMacro(InterpolatingAbstractTransform, vtkAbstractTransform*);
+
+ mitk::AffineGeometryFrame3D::Pointer Clone() const;
+
protected:
LandmarkProjectorBasedCurvedGeometry();
+ LandmarkProjectorBasedCurvedGeometry(const LandmarkProjectorBasedCurvedGeometry& other);
+
virtual ~LandmarkProjectorBasedCurvedGeometry();
- void InitializeGeometry(Self * newGeometry) const;
-
mitk::LandmarkProjector::Pointer m_LandmarkProjector;
vtkAbstractTransform* m_InterpolatingAbstractTransform;
};
} // namespace mitk
#endif /* MITKLANDMARKPROJECTORBASEDCURVEDGEOMETRY_H_HEADER_INCLUDED_C1C68A2C */
diff --git a/Core/Code/DataManagement/mitkLevelWindowProperty.h b/Core/Code/DataManagement/mitkLevelWindowProperty.h
index d979cb169f..f5080b2568 100755
--- a/Core/Code/DataManagement/mitkLevelWindowProperty.h
+++ b/Core/Code/DataManagement/mitkLevelWindowProperty.h
@@ -1,63 +1,65 @@
/*=========================================================================
Program: Medical Imaging & Interaction Toolkit
Language: C++
Date: $Date$
Version: $Revision$
Copyright (c) German Cancer Research Center, Division of Medical and
Biological Informatics. All rights reserved.
See MITKCopyright.txt or http://www.mitk.org/copyright.html for details.
This software is distributed WITHOUT ANY WARRANTY; without even
the implied warranty of MERCHANTABILITY or FITNESS FOR A PARTICULAR
PURPOSE. See the above copyright notices for more information.
=========================================================================*/
#ifndef MITKLEVELWINDOWPROPERTY_H_HEADER_INCLUDED_C10EEAA8
#define MITKLEVELWINDOWPROPERTY_H_HEADER_INCLUDED_C10EEAA8
#include "mitkBaseProperty.h"
#include "mitkLevelWindow.h"
namespace mitk {
//##Documentation
//## @brief Property for level/window data
//##
//## @ingroup DataManagement
class MITK_CORE_EXPORT LevelWindowProperty : public BaseProperty
{
protected:
LevelWindow m_LevWin;
LevelWindowProperty();
LevelWindowProperty(const mitk::LevelWindow &levWin);
public:
mitkClassMacro(LevelWindowProperty, BaseProperty);
itkNewMacro(LevelWindowProperty);
mitkNewMacro1Param(LevelWindowProperty, const mitk::LevelWindow&);
virtual ~LevelWindowProperty();
+ virtual BaseProperty& operator=(const BaseProperty& other) { return Superclass::operator=(other); }
+
virtual bool operator==(const BaseProperty& property) const;
const mitk::LevelWindow & GetLevelWindow() const;
void SetLevelWindow(const LevelWindow &levWin);
virtual std::string GetValueAsString() const;
};
} // namespace mitk
#endif /* MITKLEVELWINDOWPROPERTY_H_HEADER_INCLUDED_C10EEAA8 */
diff --git a/Core/Code/DataManagement/mitkMaterial.cpp b/Core/Code/DataManagement/mitkMaterial.cpp
index efb7babfe6..c17e3e512d 100644
--- a/Core/Code/DataManagement/mitkMaterial.cpp
+++ b/Core/Code/DataManagement/mitkMaterial.cpp
@@ -1,390 +1,390 @@
/*=========================================================================
Program: Medical Imaging & Interaction Toolkit
Language: C++
Date: $Date$
Version: $Revision$
Copyright (c) German Cancer Research Center, Division of Medical and
Biological Informatics. All rights reserved.
See MITKCopyright.txt or http://www.mitk.org/copyright.html for details.
This software is distributed WITHOUT ANY WARRANTY; without even
the implied warranty of MERCHANTABILITY or FITNESS FOR A PARTICULAR
PURPOSE. See the above copyright notices for more information.
=========================================================================*/
#include "mitkMaterial.h"
#include "mitkProperties.h"
#include "mitkVtkInterpolationProperty.h"
#include "mitkVtkRepresentationProperty.h"
#include <vtkProperty.h>
#include "mitkDataNode.h"
#include "mitkBaseRenderer.h"
mitk::Material::Material( Color color, vtkFloatingPointType opacity )
{
InitializeStandardValues();
SetColor( color );
SetColorCoefficient( GetColorCoefficient() );
SetSpecularColor( GetSpecularColor() );
SetSpecularCoefficient( GetSpecularCoefficient() );
SetSpecularPower( GetSpecularPower() );
SetOpacity( opacity );
SetInterpolation( GetInterpolation() );
SetRepresentation( GetRepresentation() );
SetLineWidth( GetLineWidth() );
m_Name = "";
}
mitk::Material::Material( vtkFloatingPointType red, vtkFloatingPointType green, vtkFloatingPointType blue, vtkFloatingPointType opacity )
{
InitializeStandardValues();
SetColor( red, green, blue );
SetColorCoefficient( GetColorCoefficient() );
SetSpecularColor( GetSpecularColor() );
SetSpecularCoefficient( GetSpecularCoefficient() );
SetSpecularPower( GetSpecularPower() );
SetOpacity( opacity );
SetInterpolation( GetInterpolation() );
SetRepresentation( GetRepresentation() );
SetLineWidth( GetLineWidth() );
m_Name = "";
}
mitk::Material::Material( vtkFloatingPointType red, vtkFloatingPointType green, vtkFloatingPointType blue,
vtkFloatingPointType colorCoefficient, vtkFloatingPointType specularCoefficient,
vtkFloatingPointType specularPower, vtkFloatingPointType opacity )
{
InitializeStandardValues();
SetColor( red, green, blue );
SetColorCoefficient( colorCoefficient );
SetSpecularColor( GetSpecularColor() );
SetSpecularCoefficient( specularCoefficient );
SetSpecularPower( specularPower );
SetOpacity( opacity );
SetInterpolation( GetInterpolation() );
SetRepresentation( GetRepresentation() );
SetLineWidth( GetLineWidth() );
m_Name = "";
}
mitk::Material::Material( mitk::Material::Color color, vtkFloatingPointType colorCoefficient, vtkFloatingPointType specularCoefficient, vtkFloatingPointType specularPower, vtkFloatingPointType opacity )
{
InitializeStandardValues();
SetColor( color );
SetColorCoefficient( colorCoefficient );
SetSpecularColor( GetSpecularColor() );
SetSpecularCoefficient( specularCoefficient );
SetSpecularPower( specularPower );
SetOpacity( opacity );
SetInterpolation( GetInterpolation() );
SetRepresentation( GetRepresentation() );
SetLineWidth( GetLineWidth() );
}
mitk::Material::Material( )
{
InitializeStandardValues();
SetColor( GetColor() );
SetColorCoefficient( GetColorCoefficient() );
SetSpecularColor( GetSpecularColor() );
SetSpecularCoefficient( GetSpecularCoefficient() );
SetSpecularPower( GetSpecularPower() );
SetOpacity( GetOpacity() );
SetInterpolation( GetInterpolation() );
SetRepresentation( GetRepresentation() );
SetLineWidth( GetLineWidth() );
}
mitk::Material::Material( const Material& property ) : itk::Object()
{
Initialize( property );
}
mitk::Material::Material( const Material& property, vtkFloatingPointType red, vtkFloatingPointType green, vtkFloatingPointType blue, vtkFloatingPointType opacity, std::string name )
{
Initialize( property );
SetColor( red, green, blue );
SetOpacity( opacity );
SetName( name );
}
bool mitk::Material::Assignable(const Material& other) const
{
try
{
const Material& otherinstance = dynamic_cast<const Self&>(other); // dear compiler, please don't optimize this away! Thanks.
otherinstance.GetOpacity();
return true;
}
catch (std::bad_cast)
{
}
return false;
}
mitk::Material& mitk::Material::operator=(const mitk::Material& other)
{
try
{
const Self& otherProp( dynamic_cast<const Self&>(other) );
Initialize(otherProp);
}
catch (std::bad_cast)
{
// nothing to do then
}
return *this;
}
void mitk::Material::SetColor( mitk::Material::Color color )
{
m_Color = color;
Modified();
}
void mitk::Material::SetColor( vtkFloatingPointType red, vtkFloatingPointType green, vtkFloatingPointType blue )
{
m_Color.Set( red, green, blue );
Modified();
}
void mitk::Material::SetColorCoefficient( vtkFloatingPointType coefficient )
{
m_ColorCoefficient = coefficient;
Modified();
}
void mitk::Material::SetSpecularColor( mitk::Material::Color specularColor )
{
m_SpecularColor = specularColor;
Modified();
}
void mitk::Material::SetSpecularColor( vtkFloatingPointType red, vtkFloatingPointType green, vtkFloatingPointType blue )
{
m_SpecularColor.Set( red, green, blue );
Modified();
}
void mitk::Material::SetSpecularCoefficient( vtkFloatingPointType specularCoefficient )
{
m_SpecularCoefficient = specularCoefficient;
Modified();
}
void mitk::Material::SetSpecularPower( vtkFloatingPointType specularPower )
{
m_SpecularPower = specularPower;
Modified();
}
void mitk::Material::SetOpacity( vtkFloatingPointType opacity )
{
m_Opacity = opacity;
Modified();
}
void mitk::Material::SetInterpolation( InterpolationType interpolation )
{
m_Interpolation = interpolation;
Modified();
}
void mitk::Material::SetRepresentation( RepresentationType representation )
{
m_Representation = representation;
Modified();
}
void mitk::Material::SetLineWidth( float lineWidth )
{
m_LineWidth = lineWidth;
Modified();
}
mitk::Material::Color mitk::Material::GetColor() const
{
return m_Color;
}
vtkFloatingPointType mitk::Material::GetColorCoefficient() const
{
return m_ColorCoefficient;
}
mitk::Material::Color mitk::Material::GetSpecularColor() const
{
return m_SpecularColor;
}
vtkFloatingPointType mitk::Material::GetSpecularCoefficient() const
{
return m_SpecularCoefficient;
}
vtkFloatingPointType mitk::Material::GetSpecularPower() const
{
return m_SpecularPower;
}
vtkFloatingPointType mitk::Material::GetOpacity() const
{
return m_Opacity;
}
mitk::Material::InterpolationType mitk::Material::GetInterpolation() const
{
return m_Interpolation;
}
mitk::Material::RepresentationType mitk::Material::GetRepresentation() const
{
return m_Representation;
}
int mitk::Material::GetVtkInterpolation() const
{
switch ( m_Interpolation )
{
case( Flat ) : return VTK_FLAT;
case( Gouraud ) : return VTK_GOURAUD;
case( Phong ) : return VTK_PHONG;
}
return VTK_GOURAUD;
}
int mitk::Material::GetVtkRepresentation() const
{
switch ( m_Representation )
{
case( Points ) : return VTK_POINTS;
case( Wireframe ) : return VTK_WIREFRAME;
case( Surface ) : return VTK_SURFACE;
}
return VTK_SURFACE;
}
float mitk::Material::GetLineWidth() const
{
return m_LineWidth;
}
void mitk::Material::Initialize( const Material& property )
{
this->SetColor( property.GetColor() );
this->SetColorCoefficient( property.GetColorCoefficient() );
this->SetSpecularColor( property.GetSpecularColor() );
this->SetSpecularCoefficient( property.GetSpecularCoefficient() );
this->SetSpecularPower( property.GetSpecularPower() );
this->SetOpacity( property.GetOpacity() );
this->SetInterpolation( property.GetInterpolation() );
this->SetRepresentation( property.GetRepresentation() );
this->SetLineWidth( property.GetLineWidth() );
this->SetName( property.GetName() );
}
bool mitk::Material::operator==( const Material& property ) const
{
const Self * other = dynamic_cast<const Self*>( &property );
if ( other == NULL )
return false;
else
return ( m_Color == other->GetColor() &&
m_ColorCoefficient == other->GetColorCoefficient() &&
m_SpecularColor == other->GetSpecularColor() &&
m_SpecularCoefficient == other->GetSpecularCoefficient() &&
m_SpecularPower == other->GetSpecularPower() &&
m_Opacity == other->GetOpacity() &&
m_Interpolation == other->GetInterpolation() &&
m_Name == other->GetName() &&
m_Representation == other->GetRepresentation() &&
m_LineWidth == other->GetLineWidth()
);
}
void mitk::Material::InitializeStandardValues()
{
m_Color.Set( 0.5, 0.5, 0.0 );
m_ColorCoefficient = 0.5 ;
m_SpecularColor.Set( 1.0, 1.0, 1.0 );
m_SpecularCoefficient = 0.5;
m_SpecularPower = 10.0;
m_Opacity = 1.0 ;
m_Interpolation = Gouraud;
m_Representation = Surface;
m_LineWidth = 1.0;
m_Name = "";
}
void mitk::Material::Update()
{
this->SetColor( this->GetColor() );
this->SetColorCoefficient( this->GetColorCoefficient() );
this->SetSpecularColor( this->GetSpecularColor() );
this->SetSpecularCoefficient( this->GetSpecularCoefficient() );
this->SetSpecularPower( this->GetSpecularPower() );
this->SetOpacity( this->GetOpacity() );
this->SetInterpolation( this->GetInterpolation() );
this->SetRepresentation( this->GetRepresentation() );
}
-void mitk::Material::PrintSelf ( std::ostream &os ) const
+void mitk::Material::PrintSelf ( std::ostream &os, itk::Indent /* unused */ ) const
{
os << "Name: " << GetName() << std::endl;
os << "Color: " << GetColor() << std::endl;
os << "ColorCoefficient" << GetColorCoefficient() << std::endl;
os << "SpecularColor: " << GetSpecularColor() << std::endl;
os << "SpecularCoefficient: " << GetSpecularCoefficient() << std::endl;
os << "SpecularPower: " << GetSpecularPower() << std::endl;
os << "Opacity: " << GetOpacity() << std::endl;
os << "Line width: " << GetLineWidth() << std::endl;
switch ( GetInterpolation() )
{
case ( Flat ) : os << "Interpolation: Flat" << std::endl;
break;
case ( Gouraud ) : os << "Interpolation: Gouraud" << std::endl;
break;
case ( Phong ) : os << "Interpolation: Phong" << std::endl;
break;
}
switch ( GetRepresentation() )
{
case ( Points ) : os << "Representation: Points" << std::endl;
break;
case ( Wireframe ) : os << "Representation: Wireframe" << std::endl;
break;
case ( Surface ) : os << "Representation: Surface" << std::endl;
break;
}
}
diff --git a/Core/Code/DataManagement/mitkMaterial.h b/Core/Code/DataManagement/mitkMaterial.h
index b1214b1f0d..2ad2d200b5 100644
--- a/Core/Code/DataManagement/mitkMaterial.h
+++ b/Core/Code/DataManagement/mitkMaterial.h
@@ -1,478 +1,478 @@
/*=========================================================================
Program: Medical Imaging & Interaction Toolkit
Language: C++
Date: $Date$
Version: $Revision$
Copyright (c) German Cancer Research Center, Division of Medical and
Biological Informatics. All rights reserved.
See MITKCopyright.txt or http://www.mitk.org/copyright.html for details.
This software is distributed WITHOUT ANY WARRANTY; without even
the implied warranty of MERCHANTABILITY or FITNESS FOR A PARTICULAR
PURPOSE. See the above copyright notices for more information.
=========================================================================*/
#ifndef _MITK_MATERIAL_H_
#define _MITK_MATERIAL_H_
#include "mitkCommon.h"
#include <itkRGBPixel.h>
#include <itkObject.h>
#include <itkVectorContainer.h>
#include <vtkSystemIncludes.h>
#include <string>
namespace mitk
{
/**
* Encapsulates 3D visualization properties which are forwarded to vtk for
* color mapping. This includes color, specular coefficient and power, opacity
* interpolation type (flat, gouraud, phong) and representation (points,
* wireframe or surface).
*
* @see vtkProperty
*/
class MITK_CORE_EXPORT Material : public itk::Object
{
public:
mitkClassMacro( Material, itk::Object );
typedef itk::RGBPixel<vtkFloatingPointType> Color;
enum InterpolationType
{
Flat, Gouraud, Phong
};
enum RepresentationType
{
Points, Wireframe, Surface
};
/**
* Constructor. Materials are set to the following default values:
* Color (0.5, 0.5, 0.5) color coefficient 1.0, specular color (1.0, 1.0, 1.0),
* specular coefficient 1.0, specular power 10, opacity 1.0, interpolation
* Gouraud, representation Surface.
* @param node optinally a data tree node may be defined to which the properties
* are forwarded. Please note, that if this node doesn't have the
* needed properties associated, they will be added.
*/
static Pointer New()
{
Pointer smartPtr = new Material( );
smartPtr->UnRegister();
return smartPtr;
}
/**
* Constructor. All values besides the given ones are set to defaults as
* described in the default constructor
* @param color the material color in RGB. Each RGB value should be in the
* range [0..1]
* @param opacity the opacity of the material. 0.0 means fully transparent
* and 1.0 means solid.
* @param node optinally a data tree node may be defined to which the properties
* are forwarded. Please note, that if this node doesn't have the
* needed properties associated, they will be added.
*/
static Pointer New( Color color, vtkFloatingPointType opacity = 1.0f)
{
Pointer smartPtr = new Material(color, opacity );
smartPtr->UnRegister();
return smartPtr;
}
/**
* Constructor. All values besides the given ones are set to defaults as
* described in the default constructor
* @param red the red component of the materials color (range [0..1])
* @param green the green component of the materials color (range [0..1])
* @param blue the blue component of the materials color (range [0..1])
* @param opacity the opacity of the material. 0.0 means fully transparent
* and 1.0 means solid.
* @param node optionally a data tree node may be defined to which the properties
* are forwarded. Please note, that if this node doesn't have the
* needed properties associated, they will be added.
*/
static Pointer New( vtkFloatingPointType red, vtkFloatingPointType green, vtkFloatingPointType blue, vtkFloatingPointType opacity = 1.0f)
{
Pointer smartPtr = new Material(red, green, blue, opacity );
smartPtr->UnRegister();
return smartPtr;
}
/**
* Constructor. All values besides the given ones are set to defaults as
* described in the default constructor
* @param red the red component of the materials color (range [0..1])
* @param green the green component of the materials color (range [0..1])
* @param blue the blue component of the materials color (range [0..1])
* @param colorCoefficient a scaling factor for the color coefficient which
* will be multiplied with each color component (range [0..1]).
* @param specularCoefficient controls in combination with the specular power
* how shiny the material will appear (range [0..1]).
* @param specularPower controls in combination with the specular coefficient
* how shiny the material will appear (range [0..inf]).
* @param opacity the opacity of the material. 0.0 means fully transparent
* and 1.0 means solid.
* @param node optionally a data tree node may be defined to which the properties
* are forwarded. Please note, that if this node doesn't have the
* needed properties associated, they will be added.
*/
static Pointer New( vtkFloatingPointType red, vtkFloatingPointType green, vtkFloatingPointType blue, vtkFloatingPointType colorCoefficient,
vtkFloatingPointType specularCoefficient, vtkFloatingPointType specularPower, vtkFloatingPointType opacity )
{
Pointer smartPtr = new Material(red, green, blue, colorCoefficient, specularCoefficient, specularPower, opacity );
smartPtr->UnRegister();
return smartPtr;
}
/**
* Constructor. All values besides the given ones are set to defaults as
* described in the default constructor
*
* @param color the material color in RGB. Each RGB value should be in the
* range [0..1]
* @param colorCoefficient a scaling factor for the color coefficient which
* will be multiplied with each color component (range [0..1]).
* @param specularCoefficient controls in combination with the specular power
* how shiny the material will appear (range [0..1]).
* @param specularPower controls in combination with the specular coefficient
* how shiny the material will appear (range [0..inf]).
* @param opacity the opacity of the material. 0.0 means fully transparent
* and 1.0 means solid.
* @param node optionally a data tree node may be defined to which the properties
* are forwarded. Please note, that if this node doesn't have the
* needed properties associated, they will be added.
*/
static Pointer New( Color color, vtkFloatingPointType colorCoefficient, vtkFloatingPointType specularCoefficient, vtkFloatingPointType specularPower, vtkFloatingPointType opacity )
{
Pointer smartPtr = new Material(color, colorCoefficient, specularCoefficient, specularPower, opacity );
smartPtr->UnRegister();
return smartPtr;
}
/**
* Copy constructor
*/
mitkNewMacro1Param(Material, const Material&);
/**
* Copy constructor, provided for convinience. The values are copied from property
* and afterwards the values provided for red green blue and opacity are written into the object.
*/
static Pointer New( const Material& property, vtkFloatingPointType red, vtkFloatingPointType green, vtkFloatingPointType blue, vtkFloatingPointType opacity = 1.0, std::string name = "" )
{
Pointer smartPtr = new Material(property, red, green, blue, opacity, name );
smartPtr->UnRegister();
return smartPtr;
}
virtual bool Assignable(const Material& other) const;
virtual Material& operator=(const Material& other);
/* Sets the materials color in RGB space. The rgb components have to be
* in the range [0..1]
* @param color the new color of the material
*/
virtual void SetColor( Color color );
/**
* Sets the materials color in RGB space. The rgb components have to be
* in the range [0..1]
* @param red the red component of the materials color (range [0..1])
* @param green the green component of the materials color (range [0..1])
* @param blue the blue component of the materials color (range [0..1])
*/
virtual void SetColor( vtkFloatingPointType red, vtkFloatingPointType green, vtkFloatingPointType blue );
/**
* Sets a attenuation coefficient for the color. A value of 0 results in
* a black object. VAlid range is [0..1]
* @param coefficient the color attenuation coefficient
*/
virtual void SetColorCoefficient( vtkFloatingPointType coefficient );
/**
* Sets the specular color
* @param color the specular color in RGB. Each RGB value should be in the
* range [0..1]
*/
virtual void SetSpecularColor( Color color );
/**
* Sets the specular color
* @param red the red component of the specular color (range [0..1])
* @param green the green component of the specular color (range [0..1])
* @param blue the blue component of the specular color (range [0..1])
*/
virtual void SetSpecularColor( vtkFloatingPointType red, vtkFloatingPointType green, vtkFloatingPointType blue );
/**
* Sets the specular coefficient which controls the shininess of the object
* together with the specular power
* @param specularCoefficient the new specular coefficient. Valid range
* is [0..1]
*/
virtual void SetSpecularCoefficient( vtkFloatingPointType specularCoefficient );
/**
* Sets the specular power which controls the shininess of the object
* together with the specular coefficient
* @param specularCoefficient the new specular coefficient. Valid range
* is [0..inf]
*/
virtual void SetSpecularPower( vtkFloatingPointType specularPower );
/**
* Sets the opacity of the material, which controls how transparent the
* object appears. Valid range is [0..1], where 0 means fully transparent
* and 1 means a solid surface.
* @param opacity the new opacity of the material
*/
virtual void SetOpacity( vtkFloatingPointType opacity );
/**
* Sets the surface interpolation method of the object rendered using the
* given materials. Valid Interopation types are Flat, Gouraud and Phong.
* See any computer graphics book for their meaning
* @param interpolation the interpolation method used for rendering of
* surfaces.
*/
virtual void SetInterpolation( InterpolationType interpolation );
/**
* Sets the surface representation method of the object rendered using the
* given materials. Valid Interopation types are Points, Wireframe and
* Surface.
* @param representation the representation method used for rendering of
* surfaces.
*/
virtual void SetRepresentation( RepresentationType representation );
/**
* Set/Get the width of a Line. The width is expressed in screen units. The default is 1.0.
*/
virtual void SetLineWidth( float lineWidth );
/**
* @returns the color of the material
*/
virtual Color GetColor() const;
/**
* @returns the color coefficient of the material. Range is [0..1]
*/
virtual vtkFloatingPointType GetColorCoefficient() const;
/**
* @returns the specular color of the material in rgb values, which
* range from 0 .. 1
*/
virtual Color GetSpecularColor() const;
/**
* @returns the specular coefficient used for rendering. Range is [0..1]
*/
virtual vtkFloatingPointType GetSpecularCoefficient() const;
/**
* @returns the specular power. Ranges from 0 to infinity
*/
virtual vtkFloatingPointType GetSpecularPower() const;
/**
* @returns the opacity of the material. Ranges from 0 to 1
*/
virtual vtkFloatingPointType GetOpacity() const;
/**
* @returns the interpolation method used for rendering.
*/
virtual InterpolationType GetInterpolation() const;
/**
* @returns the representation type used for rendering.
*/
virtual RepresentationType GetRepresentation() const;
/**
* @returns the interpolation method used for rendering using the predefined
* vtk constants.
*/
virtual int GetVtkInterpolation() const;
/**
* @returns the representation type used for rendering using the predefined
* vtk constants.
*/
virtual int GetVtkRepresentation() const;
/**
* @returns the line width used for wireframe rendering as a fraction of screen units
*/
virtual float GetLineWidth() const;
/**
* Fills the current materials with the properties of the
* given material.
* @param property the materials which should be copied in the
* current materials
* @param copyDataNode If set to true, the data tree node and renderer
* associated with the material property are also copied. Otherwise
* these member variables will be left untouched
*/
virtual void Initialize( const Material& property );
/**
* comparison operator which uses the member variables for
* comparison
*/
virtual bool operator==( const Material& property ) const;
/**
* Dumps the properties to the out stream out
*/
- void PrintSelf ( std::ostream &os ) const;
+ void PrintSelf ( std::ostream &os, itk::Indent ) const;
/**
* Sets an optional name which may be associated with the material property
* Please note, that this name is NOT forwarded to the data tree node
* as the node name
*/
itkSetMacro( Name, std::string );
/**
* returns the name associated with the material property
*/
itkGetConstMacro( Name, std::string );
protected:
/**
* Constructor. Materials are set to the following default values:
* Color (0.5, 0.5, 0.5) color coefficient 1.0, specular color (1.0, 1.0, 1.0),
* specular coefficient 1.0, specular power 10, opacity 1.0, interpolation
* Gouraud, representation Surface.
* @param node optinally a data tree node may be defined to which the properties
* are forwarded. Please note, that if this node doesn't have the
* needed properties associated, they will be added.
*/
Material( );
/**
* Constructor. All values besides the given ones are set to defaults as
* described in the default constructor
* @param color the material color in RGB. Each RGB value should be in the
* range [0..1]
* @param opacity the opacity of the material. 0.0 means fully transparent
* and 1.0 means solid.
* @param node optinally a data tree node may be defined to which the properties
* are forwarded. Please note, that if this node doesn't have the
* needed properties associated, they will be added.
*/
Material( Color color, vtkFloatingPointType opacity = 1.0f );
/**
* Constructor. All values besides the given ones are set to defaults as
* described in the default constructor
* @param red the red component of the materials color (range [0..1])
* @param green the green component of the materials color (range [0..1])
* @param blue the blue component of the materials color (range [0..1])
* @param opacity the opacity of the material. 0.0 means fully transparent
* and 1.0 means solid.
* @param node optionally a data tree node may be defined to which the properties
* are forwarded. Please note, that if this node doesn't have the
* needed properties associated, they will be added.
*/
Material( vtkFloatingPointType red, vtkFloatingPointType green, vtkFloatingPointType blue, vtkFloatingPointType opacity = 1.0f );
/**
* Constructor. All values besides the given ones are set to defaults as
* described in the default constructor
* @param red the red component of the materials color (range [0..1])
* @param green the green component of the materials color (range [0..1])
* @param blue the blue component of the materials color (range [0..1])
* @param colorCoefficient a scaling factor for the color coefficient which
* will be multiplied with each color component (range [0..1]).
* @param specularCoefficient controls in combination with the specular power
* how shiny the material will appear (range [0..1]).
* @param specularPower controls in combination with the specular coefficient
* how shiny the material will appear (range [0..inf]).
* @param opacity the opacity of the material. 0.0 means fully transparent
* and 1.0 means solid.
* @param node optionally a data tree node may be defined to which the properties
* are forwarded. Please note, that if this node doesn't have the
* needed properties associated, they will be added.
*/
Material( vtkFloatingPointType red, vtkFloatingPointType green, vtkFloatingPointType blue, vtkFloatingPointType colorCoefficient,
vtkFloatingPointType specularCoefficient, vtkFloatingPointType specularPower, vtkFloatingPointType opacity );
/**
* Constructor. All values besides the given ones are set to defaults as
* described in the default constructor
*
* @param color the material color in RGB. Each RGB value should be in the
* range [0..1]
* @param colorCoefficient a scaling factor for the color coefficient which
* will be multiplied with each color component (range [0..1]).
* @param specularCoefficient controls in combination with the specular power
* how shiny the material will appear (range [0..1]).
* @param specularPower controls in combination with the specular coefficient
* how shiny the material will appear (range [0..inf]).
* @param opacity the opacity of the material. 0.0 means fully transparent
* and 1.0 means solid.
* @param node optionally a data tree node may be defined to which the properties
* are forwarded. Please note, that if this node doesn't have the
* needed properties associated, they will be added.
*/
Material( Color color, vtkFloatingPointType colorCoefficient, vtkFloatingPointType specularCoefficient, vtkFloatingPointType specularPower, vtkFloatingPointType opacity );
/**
* Copy constructor
*/
Material( const Material& property );
/**
* Copy constructor, provided for convinience. The values are copied from property
* and afterwards the values provided for red green blue and opacity are written into the object.
*/
Material( const Material& property, vtkFloatingPointType red, vtkFloatingPointType green, vtkFloatingPointType blue, vtkFloatingPointType opacity = 1.0, std::string name = "");
virtual void InitializeStandardValues();
virtual void Update();
std::string m_Name;
Color m_Color;
Color m_SpecularColor;
vtkFloatingPointType m_ColorCoefficient;
vtkFloatingPointType m_SpecularCoefficient;
vtkFloatingPointType m_SpecularPower;
vtkFloatingPointType m_Opacity;
float m_LineWidth;
InterpolationType m_Interpolation;
RepresentationType m_Representation;
};
typedef itk::VectorContainer< unsigned int, Material::Pointer > MaterialVectorContainer;
}
#endif
diff --git a/Core/Code/DataManagement/mitkModalityProperty.h b/Core/Code/DataManagement/mitkModalityProperty.h
index 5d31b4665c..7b5bec4af1 100644
--- a/Core/Code/DataManagement/mitkModalityProperty.h
+++ b/Core/Code/DataManagement/mitkModalityProperty.h
@@ -1,55 +1,57 @@
/*=========================================================================
Program: Medical Imaging & Interaction Toolkit
Language: C++
Date: $Date: 2009-05-15 10:46:54 +0200 (Fr, 15 Mai 2009) $
Version: $Revision: 17272 $
Copyright (c) German Cancer Research Center, Division of Medical and
Biological Informatics. All rights reserved.
See MITKCopyright.txt or http://www.mitk.org/copyright.html for details.
This software is distributed WITHOUT ANY WARRANTY; without even
the implied warranty of MERCHANTABILITY or FITNESS FOR A PARTICULAR
PURPOSE. See the above copyright notices for more information.
=========================================================================*/
#ifndef mitkModalityProperty_h_Included
#define mitkModalityProperty_h_Included
#include "mitkCommon.h"
#include "mitkEnumerationProperty.h"
#include <itkObjectFactory.h>
namespace mitk
{
/**
\brief Enumerates all known modalities
\ingroup DataManagement
*/
class MITK_CORE_EXPORT ModalityProperty : public EnumerationProperty
{
public:
mitkClassMacro(ModalityProperty, EnumerationProperty);
itkNewMacro(ModalityProperty);
mitkNewMacro1Param(ModalityProperty, const IdType&);
mitkNewMacro1Param(ModalityProperty, const std::string&);
+ virtual BaseProperty& operator=(const BaseProperty& other) { return Superclass::operator=(other); }
+
protected:
ModalityProperty();
ModalityProperty( const IdType& value );
ModalityProperty( const std::string& value );
virtual ~ModalityProperty();
virtual void AddEnumerationTypes();
};
} // namespace
#endif
diff --git a/Core/Code/DataManagement/mitkPlaneGeometry.cpp b/Core/Code/DataManagement/mitkPlaneGeometry.cpp
index a0ce9f80a6..290e79a61b 100644
--- a/Core/Code/DataManagement/mitkPlaneGeometry.cpp
+++ b/Core/Code/DataManagement/mitkPlaneGeometry.cpp
@@ -1,764 +1,753 @@
/*=========================================================================
Program: Medical Imaging & Interaction Toolkit
Language: C++
Date: $Date$
Version: $Revision$
Copyright (c) German Cancer Research Center, Division of Medical and
Biological Informatics. All rights reserved.
See MITKCopyright.txt or http://www.mitk.org/copyright.html for details.
This software is distributed WITHOUT ANY WARRANTY; without even
the implied warranty of MERCHANTABILITY or FITNESS FOR A PARTICULAR
PURPOSE. See the above copyright notices for more information.
=========================================================================*/
#include "mitkPlaneGeometry.h"
#include "mitkPlaneOperation.h"
#include "mitkInteractionConst.h"
#include "mitkLine.h"
#include <vtkTransform.h>
#include <vnl/vnl_cross.h>
namespace mitk
{
mitk::PlaneGeometry::PlaneGeometry()
{
Initialize();
}
mitk::PlaneGeometry::~PlaneGeometry()
{
}
void
PlaneGeometry::Initialize()
{
Superclass::Initialize();
}
void
PlaneGeometry::EnsurePerpendicularNormal(mitk::AffineTransform3D *transform)
{
//ensure row(2) of transform to be perpendicular to plane, keep length.
VnlVector normal = vnl_cross_3d(
transform->GetMatrix().GetVnlMatrix().get_column(0),
transform->GetMatrix().GetVnlMatrix().get_column(1) );
normal.normalize();
ScalarType len = transform->GetMatrix()
.GetVnlMatrix().get_column(2).two_norm();
if (len==0) len = 1;
normal*=len;
Matrix3D matrix = transform->GetMatrix();
matrix.GetVnlMatrix().set_column(2, normal);
transform->SetMatrix(matrix);
}
void
PlaneGeometry::SetIndexToWorldTransform(mitk::AffineTransform3D *transform)
{
EnsurePerpendicularNormal(transform);
Superclass::SetIndexToWorldTransform(transform);
}
void
PlaneGeometry::SetBounds(const BoundingBox::BoundsArrayType &bounds)
{
//currently the unit rectangle must be starting at the origin [0,0]
assert(bounds[0]==0);
assert(bounds[2]==0);
//the unit rectangle must be two-dimensional
assert(bounds[1]>0);
assert(bounds[3]>0);
Superclass::SetBounds(bounds);
}
void
PlaneGeometry::IndexToWorld( const Point2D &pt_units, Point2D &pt_mm ) const
{
pt_mm[0]=m_ScaleFactorMMPerUnitX*pt_units[0];
pt_mm[1]=m_ScaleFactorMMPerUnitY*pt_units[1];
}
void PlaneGeometry::WorldToIndex( const Point2D &pt_mm, Point2D &pt_units ) const
{
pt_units[0]=pt_mm[0]*(1.0/m_ScaleFactorMMPerUnitX);
pt_units[1]=pt_mm[1]*(1.0/m_ScaleFactorMMPerUnitY);
}
void PlaneGeometry::IndexToWorld( const Point2D &atPt2d_units,
const Vector2D &vec_units, Vector2D &vec_mm) const
{
MITK_WARN<<"Warning! Call of the deprecated function PlaneGeometry::IndexToWorld(point, vec, vec). Use PlaneGeometry::IndexToWorld(vec, vec) instead!";
this->IndexToWorld(vec_units, vec_mm);
}
void PlaneGeometry::IndexToWorld(const Vector2D &vec_units, Vector2D &vec_mm) const
{
vec_mm[0] = m_ScaleFactorMMPerUnitX * vec_units[0];
vec_mm[1] = m_ScaleFactorMMPerUnitY * vec_units[1];
}
void
PlaneGeometry::WorldToIndex( const Point2D &atPt2d_mm,
const Vector2D &vec_mm, Vector2D &vec_units) const
{
MITK_WARN<<"Warning! Call of the deprecated function PlaneGeometry::WorldToIndex(point, vec, vec). Use PlaneGeometry::WorldToIndex(vec, vec) instead!";
this->WorldToIndex(vec_mm, vec_units);
}
void
PlaneGeometry::WorldToIndex( const Vector2D &vec_mm, Vector2D &vec_units) const
{
vec_units[0] = vec_mm[0] * ( 1.0 / m_ScaleFactorMMPerUnitX );
vec_units[1] = vec_mm[1] * ( 1.0 / m_ScaleFactorMMPerUnitY );
}
void
PlaneGeometry::InitializeStandardPlane( mitk::ScalarType width,
ScalarType height, const Vector3D & spacing,
PlaneGeometry::PlaneOrientation planeorientation,
ScalarType zPosition, bool frontside, bool rotated )
{
AffineTransform3D::Pointer transform;
transform = AffineTransform3D::New();
AffineTransform3D::MatrixType matrix;
AffineTransform3D::MatrixType::InternalMatrixType &vnlmatrix =
matrix.GetVnlMatrix();
vnlmatrix.set_identity();
vnlmatrix(0,0) = spacing[0];
vnlmatrix(1,1) = spacing[1];
vnlmatrix(2,2) = spacing[2];
transform->SetIdentity();
transform->SetMatrix(matrix);
InitializeStandardPlane(width, height, transform.GetPointer(),
planeorientation, zPosition, frontside, rotated);
}
void
PlaneGeometry::InitializeStandardPlane( mitk::ScalarType width,
ScalarType height, const AffineTransform3D* transform,
PlaneGeometry::PlaneOrientation planeorientation, ScalarType zPosition,
bool frontside, bool rotated )
{
Superclass::Initialize();
//construct standard view
Point3D origin;
VnlVector rightDV(3), bottomDV(3);
origin.Fill(0);
int normalDirection;
switch(planeorientation)
{
case Transversal:
if(frontside)
{
if(rotated==false)
{
FillVector3D(origin, 0, 0, zPosition);
FillVector3D(rightDV, 1, 0, 0);
FillVector3D(bottomDV, 0, 1, 0);
}
else
{
FillVector3D(origin, width, height, zPosition);
FillVector3D(rightDV, -1, 0, 0);
FillVector3D(bottomDV, 0, -1, 0);
}
}
else
{
if(rotated==false)
{
FillVector3D(origin, width, 0, zPosition);
FillVector3D(rightDV, -1, 0, 0);
FillVector3D(bottomDV, 0, 1, 0);
}
else
{
FillVector3D(origin, 0, height, zPosition);
FillVector3D(rightDV, 1, 0, 0);
FillVector3D(bottomDV, 0, -1, 0);
}
}
normalDirection = 2;
break;
case Frontal:
if(frontside)
{
if(rotated==false)
{
FillVector3D(origin, 0, zPosition, 0);
FillVector3D(rightDV, 1, 0, 0);
FillVector3D(bottomDV, 0, 0, 1);
}
else
{
FillVector3D(origin, width, zPosition, height);
FillVector3D(rightDV, -1, 0, 0);
FillVector3D(bottomDV, 0, 0, -1);
}
}
else
{
if(rotated==false)
{
FillVector3D(origin, width, zPosition, 0);
FillVector3D(rightDV, -1, 0, 0);
FillVector3D(bottomDV, 0, 0, 1);
}
else
{
FillVector3D(origin, 0, zPosition, height);
FillVector3D(rightDV, 1, 0, 0);
FillVector3D(bottomDV, 0, 0, -1);
}
}
normalDirection = 1;
break;
case Sagittal:
if(frontside)
{
if(rotated==false)
{
FillVector3D(origin, zPosition, 0, 0);
FillVector3D(rightDV, 0, 1, 0);
FillVector3D(bottomDV, 0, 0, 1);
}
else
{
FillVector3D(origin, zPosition, width, height);
FillVector3D(rightDV, 0, -1, 0);
FillVector3D(bottomDV, 0, 0, -1);
}
}
else
{
if(rotated==false)
{
FillVector3D(origin, zPosition, width, 0);
FillVector3D(rightDV, 0, -1, 0);
FillVector3D(bottomDV, 0, 0, 1);
}
else
{
FillVector3D(origin, zPosition, 0, height);
FillVector3D(rightDV, 0, 1, 0);
FillVector3D(bottomDV, 0, 0, -1);
}
}
normalDirection = 0;
break;
default:
itkExceptionMacro("unknown PlaneOrientation");
}
if ( transform != NULL )
{
origin = transform->TransformPoint( origin );
rightDV = transform->TransformVector( rightDV );
bottomDV = transform->TransformVector( bottomDV );
}
ScalarType bounds[6]= { 0, width, 0, height, 0, 1 };
this->SetBounds( bounds );
if ( transform == NULL )
{
this->SetMatrixByVectors( rightDV, bottomDV );
}
else
{
this->SetMatrixByVectors(
rightDV, bottomDV,
transform->GetMatrix().GetVnlMatrix()
.get_column(normalDirection).magnitude()
);
}
this->SetOrigin(origin);
}
void
PlaneGeometry::InitializeStandardPlane( const Geometry3D *geometry3D,
PlaneOrientation planeorientation, ScalarType zPosition,
bool frontside, bool rotated )
{
this->SetReferenceGeometry( const_cast< Geometry3D * >( geometry3D ) );
ScalarType width, height;
const BoundingBox::BoundsArrayType& boundsarray =
geometry3D->GetBoundingBox()->GetBounds();
Vector3D originVector;
FillVector3D(originVector, boundsarray[0], boundsarray[2], boundsarray[4]);
if(geometry3D->GetImageGeometry())
{
FillVector3D( originVector,
originVector[0] - 0.5,
originVector[1] - 0.5,
originVector[2] - 0.5 );
}
switch(planeorientation)
{
case Transversal:
width = geometry3D->GetExtent(0);
height = geometry3D->GetExtent(1);
break;
case Frontal:
width = geometry3D->GetExtent(0);
height = geometry3D->GetExtent(2);
break;
case Sagittal:
width = geometry3D->GetExtent(1);
height = geometry3D->GetExtent(2);
break;
default:
itkExceptionMacro("unknown PlaneOrientation");
}
InitializeStandardPlane( width, height,
geometry3D->GetIndexToWorldTransform(),
planeorientation, zPosition, frontside, rotated );
ScalarType bounds[6]= { 0, width, 0, height, 0, 1 };
this->SetBounds( bounds );
Point3D origin;
originVector = geometry3D->GetIndexToWorldTransform()
->TransformVector( originVector );
origin = GetOrigin() + originVector;
SetOrigin(origin);
}
void
PlaneGeometry::InitializeStandardPlane( const Geometry3D *geometry3D,
bool top, PlaneOrientation planeorientation, bool frontside, bool rotated )
{
ScalarType zPosition;
switch(planeorientation)
{
case Transversal:
zPosition = (top ? 0.5 : geometry3D->GetExtent(2)-1+0.5);
break;
case Frontal:
zPosition = (top ? 0.5 : geometry3D->GetExtent(1)-1+0.5);
break;
case Sagittal:
zPosition = (top ? 0.5 : geometry3D->GetExtent(0)-1+0.5);
break;
default:
itkExceptionMacro("unknown PlaneOrientation");
}
InitializeStandardPlane( geometry3D, planeorientation,
zPosition, frontside, rotated );
}
void
PlaneGeometry::InitializeStandardPlane( const Vector3D &rightVector,
const Vector3D &downVector, const Vector3D *spacing )
{
InitializeStandardPlane( rightVector.Get_vnl_vector(),
downVector.Get_vnl_vector(), spacing );
}
void
PlaneGeometry::InitializeStandardPlane( const VnlVector& rightVector,
const VnlVector &downVector, const Vector3D *spacing )
{
ScalarType width = rightVector.magnitude();
ScalarType height = downVector.magnitude();
InitializeStandardPlane( width, height, rightVector, downVector, spacing );
}
void
PlaneGeometry::InitializeStandardPlane( mitk::ScalarType width,
ScalarType height, const Vector3D &rightVector, const Vector3D &downVector,
const Vector3D *spacing )
{
InitializeStandardPlane(
width, height,
rightVector.Get_vnl_vector(), downVector.Get_vnl_vector(),
spacing );
}
void
PlaneGeometry::InitializeStandardPlane(
mitk::ScalarType width, ScalarType height,
const VnlVector &rightVector, const VnlVector &downVector,
const Vector3D *spacing )
{
assert(width > 0);
assert(height > 0);
VnlVector rightDV = rightVector; rightDV.normalize();
VnlVector downDV = downVector; downDV.normalize();
VnlVector normal = vnl_cross_3d(rightVector, downVector);
normal.normalize();
if(spacing!=NULL)
{
rightDV *= (*spacing)[0];
downDV *= (*spacing)[1];
normal *= (*spacing)[2];
}
AffineTransform3D::Pointer transform = AffineTransform3D::New();
Matrix3D matrix;
matrix.GetVnlMatrix().set_column(0, rightDV);
matrix.GetVnlMatrix().set_column(1, downDV);
matrix.GetVnlMatrix().set_column(2, normal);
transform->SetMatrix(matrix);
transform->SetOffset(m_IndexToWorldTransform->GetOffset());
ScalarType bounds[6] = { 0, width, 0, height, 0, 1 };
this->SetBounds( bounds );
this->SetIndexToWorldTransform( transform );
}
void
PlaneGeometry::InitializePlane( const Point3D &origin,
const Vector3D &normal )
{
VnlVector rightVectorVnl(3), downVectorVnl;
if( Equal( normal[1], 0.0f ) == false )
{
FillVector3D( rightVectorVnl, 1.0f, -normal[0]/normal[1], 0.0f );
rightVectorVnl.normalize();
}
else
{
FillVector3D( rightVectorVnl, 0.0f, 1.0f, 0.0f );
}
downVectorVnl = vnl_cross_3d( normal.Get_vnl_vector(), rightVectorVnl );
downVectorVnl.normalize();
InitializeStandardPlane( rightVectorVnl, downVectorVnl );
SetOrigin(origin);
}
void
PlaneGeometry::SetMatrixByVectors( const VnlVector &rightVector,
const VnlVector &downVector, ScalarType thickness )
{
VnlVector normal = vnl_cross_3d(rightVector, downVector);
normal.normalize();
normal *= thickness;
AffineTransform3D::Pointer transform = AffineTransform3D::New();
Matrix3D matrix;
matrix.GetVnlMatrix().set_column(0, rightVector);
matrix.GetVnlMatrix().set_column(1, downVector);
matrix.GetVnlMatrix().set_column(2, normal);
transform->SetMatrix(matrix);
transform->SetOffset(m_IndexToWorldTransform->GetOffset());
SetIndexToWorldTransform(transform);
}
Vector3D
PlaneGeometry::GetNormal() const
{
Vector3D frontToBack;
frontToBack.Set_vnl_vector( m_IndexToWorldTransform
->GetMatrix().GetVnlMatrix().get_column(2) );
return frontToBack;
}
VnlVector
PlaneGeometry::GetNormalVnl() const
{
return m_IndexToWorldTransform
->GetMatrix().GetVnlMatrix().get_column(2);
}
ScalarType
PlaneGeometry::DistanceFromPlane( const Point3D &pt3d_mm ) const
{
return fabs(SignedDistance( pt3d_mm ));
}
ScalarType
PlaneGeometry::SignedDistance( const Point3D &pt3d_mm ) const
{
return SignedDistanceFromPlane(pt3d_mm);
}
bool
PlaneGeometry::IsAbove( const Point3D &pt3d_mm ) const
{
return SignedDistanceFromPlane(pt3d_mm) > 0;
}
bool
PlaneGeometry::IntersectionLine(
const PlaneGeometry* plane, Line3D& crossline ) const
{
Vector3D normal = this->GetNormal();
normal.Normalize();
Vector3D planeNormal = plane->GetNormal();
planeNormal.Normalize();
Vector3D direction = itk::CrossProduct( normal, planeNormal );
if ( direction.GetSquaredNorm() < eps )
return false;
crossline.SetDirection( direction );
double N1dN2 = normal * planeNormal;
double determinant = 1.0 - N1dN2 * N1dN2;
Vector3D origin = this->GetOrigin().GetVectorFromOrigin();
Vector3D planeOrigin = plane->GetOrigin().GetVectorFromOrigin();
double d1 = normal * origin;
double d2 = planeNormal * planeOrigin;
double c1 = ( d1 - d2 * N1dN2 ) / determinant;
double c2 = ( d2 - d1 * N1dN2 ) / determinant;
Vector3D p = normal * c1 + planeNormal * c2;
crossline.GetPoint().Get_vnl_vector() = p.Get_vnl_vector();
return true;
}
unsigned int
PlaneGeometry::IntersectWithPlane2D(
const PlaneGeometry* plane, Point2D& lineFrom, Point2D &lineTo ) const
{
Line3D crossline;
if ( this->IntersectionLine( plane, crossline ) == false )
return 0;
Point2D point2;
Vector2D direction2;
this->Map( crossline.GetPoint(), point2 );
this->Map( crossline.GetPoint(), crossline.GetDirection(), direction2 );
return
Line3D::RectangleLineIntersection(
0, 0, GetExtentInMM(0), GetExtentInMM(1),
point2, direction2, lineFrom, lineTo );
}
double PlaneGeometry::Angle( const PlaneGeometry *plane ) const
{
return angle(plane->GetMatrixColumn(2), GetMatrixColumn(2));
}
double PlaneGeometry::Angle( const Line3D &line ) const
{
return vnl_math::pi_over_2
- angle( line.GetDirection().Get_vnl_vector(), GetMatrixColumn(2) );
}
bool PlaneGeometry::IntersectionPoint(
const Line3D &line, Point3D &intersectionPoint ) const
{
Vector3D planeNormal = this->GetNormal();
planeNormal.Normalize();
Vector3D lineDirection = line.GetDirection();
lineDirection.Normalize();
double t = planeNormal * lineDirection;
if ( fabs( t ) < eps )
{
return false;
}
Vector3D diff;
diff = this->GetOrigin() - line.GetPoint();
t = ( planeNormal * diff ) / t;
intersectionPoint = line.GetPoint() + lineDirection * t;
return true;
}
bool
PlaneGeometry::IntersectionPointParam( const Line3D &line, double &t ) const
{
Vector3D planeNormal = this->GetNormal();
- planeNormal.Normalize();
Vector3D lineDirection = line.GetDirection();
- lineDirection.Normalize();
t = planeNormal * lineDirection;
if ( fabs( t ) < eps )
{
return false;
}
Vector3D diff;
diff = this->GetOrigin() - line.GetPoint();
t = ( planeNormal * diff ) / t;
return true;
}
bool
PlaneGeometry::IsParallel( const PlaneGeometry *plane ) const
{
return ( (Angle(plane) < 10.0 * mitk::sqrteps ) || ( Angle(plane) > ( vnl_math::pi - 10.0 * sqrteps ) ) ) ;
}
bool
PlaneGeometry::IsOnPlane( const Point3D &point ) const
{
return Distance(point) < eps;
}
bool
PlaneGeometry::IsOnPlane( const Line3D &line ) const
{
return ( (Distance( line.GetPoint() ) < eps)
&& (Distance( line.GetPoint2() ) < eps) );
}
bool
PlaneGeometry::IsOnPlane( const PlaneGeometry *plane ) const
{
return ( IsParallel( plane ) && (Distance( plane->GetOrigin() ) < eps) );
}
Point3D
PlaneGeometry::ProjectPointOntoPlane( const Point3D& pt ) const
{
ScalarType len = this->GetNormalVnl().two_norm();
return pt - this->GetNormal() * this->SignedDistanceFromPlane( pt ) / len;
}
AffineGeometryFrame3D::Pointer
PlaneGeometry::Clone() const
{
- Self::Pointer newGeometry = Self::New();
- newGeometry->Initialize();
- InitializeGeometry(newGeometry);
+ Self::Pointer newGeometry = new PlaneGeometry(*this);
+ newGeometry->UnRegister();
return newGeometry.GetPointer();
}
-
void
PlaneGeometry::ExecuteOperation( Operation *operation )
{
vtkTransform *transform = vtkTransform::New();
transform->SetMatrix( m_VtkMatrix );
switch ( operation->GetOperationType() )
{
case OpORIENT:
{
mitk::PlaneOperation *planeOp = dynamic_cast< mitk::PlaneOperation * >( operation );
if ( planeOp == NULL )
{
return;
}
Point3D center = planeOp->GetPoint();
Vector3D orientationVector = planeOp->GetNormal();
Vector3D defaultVector;
FillVector3D( defaultVector, 0.0, 0.0, 1.0 );
Vector3D rotationAxis = itk::CrossProduct( orientationVector, defaultVector );
//vtkFloatingPointType rotationAngle = acos( orientationVector[2] / orientationVector.GetNorm() );
vtkFloatingPointType rotationAngle = atan2( (double) rotationAxis.GetNorm(), (double) (orientationVector * defaultVector) );
rotationAngle *= 180.0 / vnl_math::pi;
transform->PostMultiply();
transform->Identity();
transform->Translate( center[0], center[1], center[2] );
transform->RotateWXYZ( rotationAngle, rotationAxis[0], rotationAxis[1], rotationAxis[2] );
transform->Translate( -center[0], -center[1], -center[2] );
break;
}
default:
Superclass::ExecuteOperation( operation );
transform->Delete();
return;
}
m_VtkMatrix->DeepCopy(transform->GetMatrix());
this->TransferVtkToItkTransform();
this->Modified();
transform->Delete();
}
-
-void PlaneGeometry::InitializeGeometry( Self *newGeometry ) const
-{
- Superclass::InitializeGeometry(newGeometry);
-}
-
-
void PlaneGeometry::PrintSelf( std::ostream& os, itk::Indent indent ) const
{
Superclass::PrintSelf(os,indent);
os << indent << " Normal: " << GetNormal() << std::endl;
}
} // namespace
diff --git a/Core/Code/DataManagement/mitkPlaneGeometry.h b/Core/Code/DataManagement/mitkPlaneGeometry.h
index 8705674338..ba64a4d029 100644
--- a/Core/Code/DataManagement/mitkPlaneGeometry.h
+++ b/Core/Code/DataManagement/mitkPlaneGeometry.h
@@ -1,424 +1,422 @@
/*=========================================================================
Program: Medical Imaging & Interaction Toolkit
Language: C++
Date: $Date$
Version: $Revision$
Copyright (c) German Cancer Research Center, Division of Medical and
Biological Informatics. All rights reserved.
See MITKCopyright.txt or http://www.mitk.org/copyright.html for details.
This software is distributed WITHOUT ANY WARRANTY; without even
the implied warranty of MERCHANTABILITY or FITNESS FOR A PARTICULAR
PURPOSE. See the above copyright notices for more information.
=========================================================================*/
#ifndef PLANEGEOMETRY_H_HEADER_INCLUDED_C1C68A2C
#define PLANEGEOMETRY_H_HEADER_INCLUDED_C1C68A2C
#include "mitkCommon.h"
#include "mitkGeometry2D.h"
#include <vnl/vnl_cross.h>
namespace mitk {
template < class TCoordRep, unsigned int NPointDimension > class Line;
typedef Line<ScalarType, 3> Line3D;
/**
* \brief Describes a two-dimensional, rectangular plane
*
* \ingroup Geometry
*/
class MITK_CORE_EXPORT PlaneGeometry : public Geometry2D
{
public:
mitkClassMacro(PlaneGeometry,Geometry2D);
/** Method for creation through the object factory. */
itkNewMacro(Self);
enum PlaneOrientation { Transversal, Sagittal, Frontal };
virtual void IndexToWorld(const Point2D &pt_units, Point2D &pt_mm) const;
virtual void WorldToIndex(const Point2D &pt_mm, Point2D &pt_units) const;
//##Documentation
//## @brief Convert (continuous or discrete) index coordinates of a \em vector
//## \a vec_units to world coordinates (in mm)
//## @deprecated First parameter (Point2D) is not used. If possible, please use void IndexToWorld(const mitk::Vector2D& vec_units, mitk::Vector2D& vec_mm) const.
//## For further information about coordinates types, please see the Geometry documentation
virtual void IndexToWorld(const mitk::Point2D &atPt2d_untis, const mitk::Vector2D &vec_units, mitk::Vector2D &vec_mm) const;
//##Documentation
//## @brief Convert (continuous or discrete) index coordinates of a \em vector
//## \a vec_units to world coordinates (in mm)
//## For further information about coordinates types, please see the Geometry documentation
virtual void IndexToWorld(const mitk::Vector2D &vec_units, mitk::Vector2D &vec_mm) const;
//##Documentation
//## @brief Convert world coordinates (in mm) of a \em vector
//## \a vec_mm to (continuous!) index coordinates.
//## @deprecated First parameter (Point2D) is not used. If possible, please use void WorldToIndex(const mitk::Vector2D& vec_mm, mitk::Vector2D& vec_units) const.
//## For further information about coordinates types, please see the Geometry documentation
virtual void WorldToIndex(const mitk::Point2D &atPt2d_mm, const mitk::Vector2D &vec_mm, mitk::Vector2D &vec_units) const;
//##Documentation
//## @brief Convert world coordinates (in mm) of a \em vector
//## \a vec_mm to (continuous!) index coordinates.
//## For further information about coordinates types, please see the Geometry documentation
virtual void WorldToIndex(const mitk::Vector2D &vec_mm, mitk::Vector2D &vec_units) const;
virtual void Initialize();
/**
* \brief Initialize a plane with orientation \a planeorientation
* (default: transversal) with respect to \a geometry3D (default: identity).
* Spacing also taken from \a geometry3D.
*
* \warning A former version of this method created a geometry with unit
* spacing. For unit spacing use
*
* \code
* // for in-plane unit spacing:
* thisgeometry->SetSizeInUnits(thisgeometry->GetExtentInMM(0),
* thisgeometry->GetExtentInMM(1));
* // additionally, for unit spacing in normal direction (former version
* // did not do this):
* thisgeometry->SetExtentInMM(2, 1.0);
* \endcode
*/
virtual void InitializeStandardPlane( const Geometry3D* geometry3D,
PlaneOrientation planeorientation = Transversal, ScalarType zPosition = 0,
bool frontside=true, bool rotated=false );
/**
* \brief Initialize a plane with orientation \a planeorientation
* (default: transversal) with respect to \a geometry3D (default: identity).
* Spacing also taken from \a geometry3D.
*
* \param top if \a true, create plane at top, otherwise at bottom
* (for PlaneOrientation Transversal, for other plane locations respectively)
*/
virtual void InitializeStandardPlane( const Geometry3D* geometry3D, bool top,
PlaneOrientation planeorientation = Transversal,
bool frontside=true, bool rotated=false );
/**
* \brief Initialize a plane with orientation \a planeorientation
* (default: transversal) with respect to \a transform (default: identity)
* given width and height in units.
*
*/
virtual void InitializeStandardPlane( ScalarType width, ScalarType height,
const AffineTransform3D* transform = NULL,
PlaneOrientation planeorientation = Transversal,
ScalarType zPosition = 0, bool frontside=true, bool rotated=false );
/**
* \brief Initialize plane with orientation \a planeorientation
* (default: transversal) given width, height and spacing.
*
*/
virtual void InitializeStandardPlane( ScalarType width, ScalarType height,
const Vector3D & spacing, PlaneOrientation planeorientation = Transversal,
ScalarType zPosition = 0, bool frontside = true, bool rotated = false );
/**
* \brief Initialize plane by width and height in pixels, right-/down-vector
* (itk) to describe orientation in world-space (vectors will be normalized)
* and spacing (default: 1.0 mm in all directions).
*
* The vectors are normalized and multiplied by the respective spacing before
* they are set in the matrix.
*/
virtual void InitializeStandardPlane( ScalarType width, ScalarType height,
const Vector3D& rightVector, const Vector3D& downVector,
const Vector3D *spacing = NULL );
/**
* \brief Initialize plane by width and height in pixels,
* right-/down-vector (vnl) to describe orientation in world-space (vectors
* will be normalized) and spacing (default: 1.0 mm in all directions).
*
* The vectors are normalized and multiplied by the respective spacing
* before they are set in the matrix.
*/
virtual void InitializeStandardPlane( ScalarType width, ScalarType height,
const VnlVector& rightVector, const VnlVector& downVector,
const Vector3D * spacing = NULL );
/**
* \brief Initialize plane by right-/down-vector (itk) and spacing
* (default: 1.0 mm in all directions).
*
* The length of the right-/-down-vector is used as width/height in units,
* respectively. Then, the vectors are normalized and multiplied by the
* respective spacing before they are set in the matrix.
*/
virtual void InitializeStandardPlane( const Vector3D& rightVector,
const Vector3D& downVector, const Vector3D * spacing = NULL );
/**
* \brief Initialize plane by right-/down-vector (vnl) and spacing
* (default: 1.0 mm in all directions).
*
* The length of the right-/-down-vector is used as width/height in units,
* respectively. Then, the vectors are normalized and multiplied by the
* respective spacing before they are set in the matrix.
*/
virtual void InitializeStandardPlane( const VnlVector& rightVector,
const VnlVector& downVector, const Vector3D * spacing = NULL );
/**
* \brief Initialize plane by origin and normal (size is 1.0 mm in
* all directions, direction of right-/down-vector valid but
* undefined).
*
*/
virtual void InitializePlane( const Point3D& origin, const Vector3D& normal);
/**
* \brief Initialize plane by right-/down-vector.
*
* \warning The vectors are set into the matrix as they are,
* \em without normalization!
*/
void SetMatrixByVectors( const VnlVector& rightVector,
const VnlVector& downVector, ScalarType thickness=1.0 );
/**
* \brief Change \a transform so that the third column of the
* transform-martix is perpendicular to the first two columns
*
*/
static void EnsurePerpendicularNormal( AffineTransform3D* transform );
/**
* \brief Normal of the plane
*
*/
Vector3D GetNormal() const;
/**
* \brief Normal of the plane as VnlVector
*
*/
VnlVector GetNormalVnl() const;
virtual ScalarType SignedDistance( const Point3D& pt3d_mm ) const;
virtual bool IsAbove( const Point3D& pt3d_mm ) const;
/**
* \brief Distance of the point from the plane
* (bounding-box \em not considered)
*
*/
ScalarType DistanceFromPlane( const Point3D& pt3d_mm ) const ;
/**
* \brief Signed distance of the point from the plane
* (bounding-box \em not considered)
*
* > 0 : point is in the direction of the direction vector.
*/
inline ScalarType SignedDistanceFromPlane( const Point3D& pt3d_mm ) const
{
ScalarType len = GetNormalVnl().two_norm();
if( len == 0 )
return 0;
return (pt3d_mm-GetOrigin())*GetNormal() / len;
}
/**
* \brief Distance of the plane from another plane
* (bounding-box \em not considered)
*
* Result is 0 if planes are not parallel.
*/
ScalarType DistanceFromPlane(const PlaneGeometry* plane) const
{
return fabs(SignedDistanceFromPlane(plane));
}
/**
* \brief Signed distance of the plane from another plane
* (bounding-box \em not considered)
*
* Result is 0 if planes are not parallel.
*/
inline ScalarType SignedDistanceFromPlane( const PlaneGeometry *plane ) const
{
if(IsParallel(plane))
{
return SignedDistance(plane->GetOrigin());
}
return 0;
}
/**
* \brief Calculate the intersecting line of two planes
*
* \return \a true planes are intersecting
* \return \a false planes do not intersect
*/
bool IntersectionLine( const PlaneGeometry *plane, Line3D &crossline ) const;
/**
* \brief Calculate two points where another plane intersects the border of this plane
*
* \return number of intersection points (0..2). First interection point (if existing)
* is returned in \a lineFrom, second in \a lineTo.
*/
unsigned int IntersectWithPlane2D(const PlaneGeometry *plane,
Point2D &lineFrom, Point2D &lineTo ) const ;
/**
* \brief Calculate the angle between two planes
*
* \return angle in radiants
*/
double Angle( const PlaneGeometry *plane ) const;
/**
* \brief Calculate the angle between the plane and a line
*
* \return angle in radiants
*/
double Angle( const Line3D &line ) const;
/**
* \brief Calculate intersection point between the plane and a line
*
* \param intersectionPoint intersection point
* \return \a true if \em unique intersection exists, i.e., if line
* is \em not on or parallel to the plane
*/
bool IntersectionPoint( const Line3D &line,
Point3D &intersectionPoint ) const;
/**
* \brief Calculate line parameter of intersection point between the
* plane and a line
*
* \param t parameter of line: intersection point is
* line.GetPoint()+t*line.GetDirection()
* \return \a true if \em unique intersection exists, i.e., if line
* is \em not on or parallel to the plane
*/
bool IntersectionPointParam( const Line3D &line, double &t ) const;
/**
* \brief Returns whether the plane is parallel to another plane
*
* @return true iff the normal vectors both point to the same or exactly oposit direction
*/
bool IsParallel( const PlaneGeometry *plane ) const;
/**
* \brief Returns whether the point is on the plane
* (bounding-box \em not considered)
*/
bool IsOnPlane( const Point3D &point ) const;
/**
* \brief Returns whether the line is on the plane
* (bounding-box \em not considered)
*/
bool IsOnPlane( const Line3D &line ) const;
/**
* \brief Returns whether the plane is on the plane
* (bounding-box \em not considered)
*
* @return true iff the normal vector of the planes point to the same or the exactly oposit direction and
* the distance of the planes is < eps
*
*/
bool IsOnPlane( const PlaneGeometry *plane ) const;
/**
* \brief Returns the lot from the point to the plane
*/
Point3D ProjectPointOntoPlane( const Point3D &pt ) const;
virtual void SetIndexToWorldTransform( AffineTransform3D *transform);
virtual void SetBounds( const BoundingBox::BoundsArrayType &bounds );
AffineGeometryFrame3D::Pointer Clone() const;
/** Implements operation to re-orient the plane */
virtual void ExecuteOperation( Operation *operation );
protected:
PlaneGeometry();
virtual ~PlaneGeometry();
- virtual void InitializeGeometry( Self *newGeometry ) const;
-
virtual void PrintSelf( std::ostream &os, itk::Indent indent ) const;
private:
/**
* \brief Compares plane with another plane: \a true if IsOnPlane
* (bounding-box \em not considered)
*/
virtual bool operator==( const PlaneGeometry * ) const { return false; };
/**
* \brief Compares plane with another plane: \a false if IsOnPlane
* (bounding-box \em not considered)
*/
virtual bool operator!=( const PlaneGeometry * ) const { return false; };
};
} // namespace mitk
#endif /* PLANEGEOMETRY_H_HEADER_INCLUDED_C1C68A2C */
diff --git a/Core/Code/DataManagement/mitkPlaneOrientationProperty.h b/Core/Code/DataManagement/mitkPlaneOrientationProperty.h
index a268d2bd69..b8d88db95c 100644
--- a/Core/Code/DataManagement/mitkPlaneOrientationProperty.h
+++ b/Core/Code/DataManagement/mitkPlaneOrientationProperty.h
@@ -1,113 +1,115 @@
/*=========================================================================
Program: Medical Imaging & Interaction Toolkit
Language: C++
Date: $Date: 2008-04-14 19:45:53 +0200 (Mo, 14 Apr 2008) $
Version: $Revision: 14081 $
Copyright (c) German Cancer Research Center, Division of Medical and
Biological Informatics. All rights reserved.
See MITKCopyright.txt or http://www.mitk.org/copyright.html for details.
This software is distributed WITHOUT ANY WARRANTY; without even
the implied warranty of MERCHANTABILITY or FITNESS FOR A PARTICULAR
PURPOSE. See the above copyright notices for more information.
=========================================================================*/
#ifndef MITK_PLANE_DECORATION_PROPERTY__H
#define MITK_PLANE_DECORATION_PROPERTY__H
#include "mitkEnumerationProperty.h"
namespace mitk
{
/**
* Property which controls whether 2D line representation of a PlaneGeometry
* should have small arrows at both ends to indicate the orientation of
* the plane, and whether the arrows should be oriented in the direction of
* the plane's normal or against it.
*
* Valid values of the enumeration property are
* - PLANE_DECORATION_NONE (no arrows)
* - PLANE_DECORATION_POSITIVE_ORIENTATION (arrows pointing upwards)
* - PLANE_DECORATION_NEGATIVE_ORIENTATION (arrows pointing downwards)
*
* See also mitk::Geometry2DDataMapper2D::DrawOrientationArrow()
*/
class MITK_CORE_EXPORT PlaneOrientationProperty : public EnumerationProperty
{
public:
mitkClassMacro( PlaneOrientationProperty, EnumerationProperty );
itkNewMacro(PlaneOrientationProperty);
mitkNewMacro1Param(PlaneOrientationProperty, const IdType&);
mitkNewMacro1Param(PlaneOrientationProperty, const std::string&);
+ virtual BaseProperty& operator=(const BaseProperty& other) { return Superclass::operator=(other); }
+
enum
{
PLANE_DECORATION_NONE,
PLANE_DECORATION_POSITIVE_ORIENTATION,
PLANE_DECORATION_NEGATIVE_ORIENTATION
};
/**
* Returns the state of plane decoration.
*/
virtual int GetPlaneDecoration();
/**
* Sets the decoration type to no decoration.
*/
virtual void SetPlaneDecorationToNone();
/**
* Sets the decoration type to arrows in positive plane direction.
*/
virtual void SetPlaneDecorationToPositiveOrientation();
/**
* Sets the decoration type to arrows in negative plane direction.
*/
virtual void SetPlaneDecorationToNegativeOrientation();
protected:
/**
* Constructor. Sets the decoration type to none.
*/
PlaneOrientationProperty( );
/**
* Constructor. Sets the decoration type to the given value. If it is not
* valid, the interpolation is set to none
*/
PlaneOrientationProperty( const IdType &value );
/**
* Constructor. Sets the decoration type to the given value. If it is not
* valid, the representation is set to none
*/
PlaneOrientationProperty( const std::string &value );
/**
* this function is overridden as protected, so that the user may not add
* additional invalid types.
*/
virtual bool AddEnum( const std::string &name, const IdType &id );
/**
* Adds the standard enumeration types with corresponding strings.
*/
virtual void AddDecorationTypes();
};
} // end of namespace mitk
#endif
diff --git a/Core/Code/DataManagement/mitkPointSet.cpp b/Core/Code/DataManagement/mitkPointSet.cpp
index 7a381fcbcd..9919675ed7 100755
--- a/Core/Code/DataManagement/mitkPointSet.cpp
+++ b/Core/Code/DataManagement/mitkPointSet.cpp
@@ -1,782 +1,782 @@
/*=========================================================================
Program: Medical Imaging & Interaction Toolkit
Language: C++
Date: $Date$
Version: $Revision$
Copyright (c) German Cancer Research Center, Division of Medical and
Biological Informatics. All rights reserved.
See MITKCopyright.txt or http://www.mitk.org/copyright.html for details.
This software is distributed WITHOUT ANY WARRANTY; without even
the implied warranty of MERCHANTABILITY or FITNESS FOR A PARTICULAR
PURPOSE. See the above copyright notices for more information.
=========================================================================*/
#include "mitkPointSet.h"
#include "mitkPointOperation.h"
#include "mitkInteractionConst.h"
#include <itkSmartPointerForwardReference.txx>
mitk::PointSet::PointSet()
{
this->InitializeEmpty();
}
mitk::PointSet::PointSet(const PointSet &other): BaseData(other),
m_PointSetSeries(other.m_PointSetSeries),
m_CalculateBoundingBox(other.m_CalculateBoundingBox)
{
}
mitk::PointSet::~PointSet()
{
this->ClearData();
}
void mitk::PointSet::ClearData()
{
m_PointSetSeries.clear();
Superclass::ClearData();
}
void mitk::PointSet::InitializeEmpty()
{
m_PointSetSeries.resize( 1 );
m_PointSetSeries[0] = DataType::New();
PointDataContainer::Pointer pointData = PointDataContainer::New();
m_PointSetSeries[0]->SetPointData( pointData );
m_CalculateBoundingBox = false;
Superclass::InitializeTimeSlicedGeometry(1);
m_Initialized = true;
}
-bool mitk::PointSet::IsEmpty(unsigned int t) const
+bool mitk::PointSet::IsEmptyTimeStep(unsigned int t) const
{
return IsInitialized() && (GetSize(t) == 0);
}
void mitk::PointSet::Expand( unsigned int timeSteps )
{
// Check if the vector is long enough to contain the new element
// at the given position. If not, expand it with sufficient pre-initialized
// elements.
//
// NOTE: This method will never REDUCE the vector size; it should only
// be used to make sure that the vector has enough elements to include the
// specified time step.
unsigned int oldSize = m_PointSetSeries.size();
if ( timeSteps > oldSize )
{
Superclass::Expand( timeSteps );
m_PointSetSeries.resize( timeSteps );
for ( unsigned int i = oldSize; i < timeSteps; ++i )
{
m_PointSetSeries[i] = DataType::New();
PointDataContainer::Pointer pointData = PointDataContainer::New();
m_PointSetSeries[i]->SetPointData( pointData );
}
//if the size changes, then compute the bounding box
m_CalculateBoundingBox = true;
this->InvokeEvent( PointSetExtendTimeRangeEvent() );
}
}
unsigned int mitk::PointSet::GetPointSetSeriesSize() const
{
return m_PointSetSeries.size();
}
int mitk::PointSet::GetSize( unsigned int t ) const
{
if ( t < m_PointSetSeries.size() )
{
return m_PointSetSeries[t]->GetNumberOfPoints();
}
else
{
return 0;
}
}
mitk::PointSet::DataType::Pointer mitk::PointSet::GetPointSet( int t ) const
{
if ( t < (int)m_PointSetSeries.size() )
{
return m_PointSetSeries[t];
}
else
{
return NULL;
}
}
int mitk::PointSet::SearchPoint( Point3D point, float distance, int t ) const
{
if ( t >= (int)m_PointSetSeries.size() )
{
return -1;
}
// Out is the point which is checked to be the searched point
PointType out;
out.Fill( 0 );
PointType indexPoint;
this->GetGeometry( t )->WorldToIndex(point, indexPoint);
// Searching the first point in the Set, that is +- distance far away fro
// the given point
unsigned int i;
PointsContainer::Iterator it, end;
end = m_PointSetSeries[t]->GetPoints()->End();
int bestIndex = -1;
distance = distance * distance;
// To correct errors from converting index to world and world to index
if (distance == 0.0)
{
distance = 0.000001;
}
ScalarType bestDist = distance;
ScalarType dist, tmp;
for ( it = m_PointSetSeries[t]->GetPoints()->Begin(), i = 0;
it != end;
++it, ++i )
{
bool ok = m_PointSetSeries[t]->GetPoints()
->GetElementIfIndexExists( it->Index(), &out );
if ( !ok )
{
return -1;
}
else if ( indexPoint == out ) //if totally equal
{
return it->Index();
}
//distance calculation
tmp = out[0] - indexPoint[0]; dist = tmp * tmp;
tmp = out[1] - indexPoint[1]; dist += tmp * tmp;
tmp = out[2] - indexPoint[2]; dist += tmp * tmp;
if ( dist < bestDist )
{
bestIndex = it->Index();
bestDist = dist;
}
}
return bestIndex;
}
mitk::PointSet::PointType
mitk::PointSet::GetPoint( PointIdentifier id, int t ) const
{
PointType out;
out.Fill(0);
if ( (unsigned int) t >= m_PointSetSeries.size() )
{
return out;
}
if ( m_PointSetSeries[t]->GetPoints()->IndexExists(id) )
{
m_PointSetSeries[t]->GetPoint( id, &out );
this->GetGeometry(t)->IndexToWorld( out, out );
return out;
}
else
{
return out;
}
}
bool
mitk::PointSet
::GetPointIfExists( PointIdentifier id, PointType* point, int t ) const
{
if ( (unsigned int) t >= m_PointSetSeries.size() )
{
return false;
}
if ( m_PointSetSeries[t]->GetPoints()->GetElementIfIndexExists(id, point) )
{
this->GetGeometry( t )->IndexToWorld( *point, *point );
return true;
}
else
{
return false;
}
}
void mitk::PointSet::SetPoint( PointIdentifier id, PointType point, int t )
{
// Adapt the size of the data vector if necessary
this->Expand( t+1 );
mitk::Point3D indexPoint;
this->GetGeometry( t )->WorldToIndex( point, indexPoint );
m_PointSetSeries[t]->SetPoint( id, indexPoint );
PointDataType defaultPointData;
defaultPointData.id = id;
defaultPointData.selected = false;
defaultPointData.pointSpec = mitk::PTUNDEFINED;
m_PointSetSeries[t]->SetPointData( id, defaultPointData );
//boundingbox has to be computed anyway
m_CalculateBoundingBox = true;
this->Modified();
}
void mitk::PointSet::SetPoint( PointIdentifier id, PointType point, PointSpecificationType spec, int t )
{
// Adapt the size of the data vector if necessary
this->Expand( t+1 );
mitk::Point3D indexPoint;
this->GetGeometry( t )->WorldToIndex( point, indexPoint );
m_PointSetSeries[t]->SetPoint( id, indexPoint );
PointDataType defaultPointData;
defaultPointData.id = id;
defaultPointData.selected = false;
defaultPointData.pointSpec = spec;
m_PointSetSeries[t]->SetPointData( id, defaultPointData );
//boundingbox has to be computed anyway
m_CalculateBoundingBox = true;
this->Modified();
}
void mitk::PointSet::InsertPoint( PointIdentifier id, PointType point, int t )
{
if ( (unsigned int) t < m_PointSetSeries.size() )
{
mitk::Point3D indexPoint;
mitk::Geometry3D* tempGeometry = this->GetGeometry( t );
if (tempGeometry == NULL)
{
MITK_INFO<< __FILE__ << ", l." << __LINE__ << ": GetGeometry of "<< t <<" returned NULL!" << std::endl;
return;
}
tempGeometry->WorldToIndex( point, indexPoint );
m_PointSetSeries[t]->GetPoints()->InsertElement( id, indexPoint );
PointDataType defaultPointData;
defaultPointData.id = id;
defaultPointData.selected = false;
defaultPointData.pointSpec = mitk::PTUNDEFINED;
m_PointSetSeries[t]->GetPointData()->InsertElement(id, defaultPointData);
//boundingbox has to be computed anyway
m_CalculateBoundingBox = true;
this->Modified();
}
}
void mitk::PointSet::InsertPoint( PointIdentifier id, PointType point, PointSpecificationType spec, int t )
{
if ( (unsigned int) t < m_PointSetSeries.size() )
{
mitk::Point3D indexPoint;
mitk::Geometry3D* tempGeometry = this->GetGeometry( t );
if (tempGeometry == NULL)
{
MITK_INFO<< __FILE__ << ", l." << __LINE__ << ": GetGeometry of "<< t <<" returned NULL!" << std::endl;
return;
}
tempGeometry->WorldToIndex( point, indexPoint );
m_PointSetSeries[t]->GetPoints()->InsertElement( id, indexPoint );
PointDataType defaultPointData;
defaultPointData.id = id;
defaultPointData.selected = false;
defaultPointData.pointSpec = spec;
m_PointSetSeries[t]->GetPointData()->InsertElement(id, defaultPointData);
//boundingbox has to be computed anyway
m_CalculateBoundingBox = true;
this->Modified();
}
}
bool mitk::PointSet::SwapPointPosition( PointIdentifier id, bool moveUpwards, int t )
{
if(IndexExists(id, t) )
{
PointType point = GetPoint(id,t);
if(moveUpwards)
{//up
if(IndexExists(id-1,t))
{
InsertPoint(id, GetPoint(id - 1, t), t);
InsertPoint(id-1,point,t);
this->Modified();
return true;
}
}
else
{//down
if(IndexExists(id+1,t))
{
InsertPoint(id, GetPoint(id + 1, t), t);
InsertPoint(id+1,point,t);
this->Modified();
return true;
}
}
}
return false;
}
bool mitk::PointSet::IndexExists( int position, int t ) const
{
if ( (unsigned int) t < m_PointSetSeries.size() )
{
return m_PointSetSeries[t]->GetPoints()->IndexExists( position );
}
else
{
return false;
}
}
bool mitk::PointSet::GetSelectInfo( int position, int t ) const
{
if ( this->IndexExists( position, t ) )
{
PointDataType pointData = { 0, false, PTUNDEFINED };
m_PointSetSeries[t]->GetPointData( position, &pointData );
return pointData.selected;
}
else
{
return false;
}
}
void mitk::PointSet::SetSelectInfo( int position, bool selected, int t )
{
if ( this->IndexExists( position, t ) )
{
// timeStep to ms
ScalarType timeInMS = this->GetTimeSlicedGeometry()->TimeStepToMS( t );
// point
Point3D point = this->GetPoint( position, t );
PointOperation* op;
if (selected)
{
op = new mitk::PointOperation(OpSELECTPOINT, timeInMS, point, position );
}
else
{
op = new mitk::PointOperation(OpDESELECTPOINT, timeInMS, point, position );
}
this->ExecuteOperation( op );
}
}
mitk::PointSpecificationType mitk::PointSet::GetSpecificationTypeInfo( int position, int t ) const
{
if ( this->IndexExists( position, t ) )
{
PointDataType pointData = { 0, false, PTUNDEFINED };
m_PointSetSeries[t]->GetPointData( position, &pointData );
return pointData.pointSpec;
}
else
{
return PTUNDEFINED;
}
}
int mitk::PointSet::GetNumberOfSelected( int t ) const
{
if ( (unsigned int) t >= m_PointSetSeries.size() )
{
return 0;
}
int numberOfSelected = 0;
PointDataIterator it;
for ( it = m_PointSetSeries[t]->GetPointData()->Begin();
it != m_PointSetSeries[t]->GetPointData()->End();
it++ )
{
if (it->Value().selected == true)
{
++numberOfSelected;
}
}
return numberOfSelected;
}
int mitk::PointSet::SearchSelectedPoint( int t ) const
{
if ( (unsigned int) t >= m_PointSetSeries.size() )
{
return -1;
}
PointDataIterator it;
for ( it = m_PointSetSeries[t]->GetPointData()->Begin();
it != m_PointSetSeries[t]->GetPointData()->End();
it++ )
{
if ( it->Value().selected == true )
{
return it->Index();
}
}
return -1;
}
void mitk::PointSet::ExecuteOperation( Operation* operation )
{
int timeStep = -1;
mitkCheckOperationTypeMacro(PointOperation, operation, pointOp);
if ( pointOp )
{
timeStep = this->GetTimeSlicedGeometry()
->MSToTimeStep( pointOp->GetTimeInMS() );
}
if ( timeStep < 0 )
{
MITK_ERROR << "Time step (" << timeStep << ") outside of PointSet time bounds" << std::endl;
return;
}
switch (operation->GetOperationType())
{
case OpNOTHING:
break;
case OpINSERT://inserts the point at the given position and selects it.
{
int position = pointOp->GetIndex();
PointType pt;
pt.CastFrom(pointOp->GetPoint());
//transfer from world to index coordinates
mitk::Geometry3D* geometry = this->GetGeometry( timeStep );
if (geometry == NULL)
{
MITK_INFO<<"GetGeometry returned NULL!\n";
return;
}
geometry->WorldToIndex(pt, pt);
m_PointSetSeries[timeStep]->GetPoints()->InsertElement(position, pt);
PointDataType pointData =
{
pointOp->GetIndex(),
pointOp->GetSelected(),
pointOp->GetPointType()
};
m_PointSetSeries[timeStep]->GetPointData()
->InsertElement(position, pointData);
this->Modified();
//boundingbox has to be computed
m_CalculateBoundingBox = true;
this->InvokeEvent( PointSetAddEvent() );
this->OnPointSetChange();
}
break;
case OpMOVE://moves the point given by index
{
PointType pt;
pt.CastFrom(pointOp->GetPoint());
//transfer from world to index coordinates
this->GetGeometry( timeStep )->WorldToIndex(pt, pt);
// Copy new point into container
m_PointSetSeries[timeStep]->SetPoint(pointOp->GetIndex(), pt);
// Insert a default point data object to keep the containers in sync
// (if no point data object exists yet)
PointDataType pointData;
if ( !m_PointSetSeries[timeStep]->GetPointData( pointOp->GetIndex(), &pointData ) )
{
m_PointSetSeries[timeStep]->SetPointData( pointOp->GetIndex(), pointData );
}
this->OnPointSetChange();
this->Modified();
//boundingbox has to be computed anyway
m_CalculateBoundingBox = true;
this->InvokeEvent( PointSetMoveEvent() );
}
break;
case OpREMOVE://removes the point at given by position
{
m_PointSetSeries[timeStep]->GetPoints()->DeleteIndex((unsigned)pointOp->GetIndex());
m_PointSetSeries[timeStep]->GetPointData()->DeleteIndex((unsigned)pointOp->GetIndex());
this->OnPointSetChange();
this->Modified();
//boundingbox has to be computed anyway
m_CalculateBoundingBox = true;
this->InvokeEvent( PointSetRemoveEvent() );
}
break;
case OpSELECTPOINT://select the given point
{
PointDataType pointData = {0, false, PTUNDEFINED};
m_PointSetSeries[timeStep]->GetPointData(pointOp->GetIndex(), &pointData);
pointData.selected = true;
m_PointSetSeries[timeStep]->SetPointData(pointOp->GetIndex(), pointData);
this->Modified();
}
break;
case OpDESELECTPOINT://unselect the given point
{
PointDataType pointData = {0, false, PTUNDEFINED};
m_PointSetSeries[timeStep]->GetPointData(pointOp->GetIndex(), &pointData);
pointData.selected = false;
m_PointSetSeries[timeStep]->SetPointData(pointOp->GetIndex(), pointData);
this->Modified();
}
break;
case OpSETPOINTTYPE:
{
PointDataType pointData = {0, false, PTUNDEFINED};
m_PointSetSeries[timeStep]->GetPointData(pointOp->GetIndex(), &pointData);
pointData.pointSpec = pointOp->GetPointType();
m_PointSetSeries[timeStep]->SetPointData(pointOp->GetIndex(), pointData);
this->Modified();
}
break;
case OpMOVEPOINTUP: // swap content of point with ID pointOp->GetIndex() with the point preceding it in the container // move point position within the pointset
{
PointIdentifier currentID = pointOp->GetIndex();
/* search for point with this id and point that precedes this one in the data container */
PointsContainer::STLContainerType points = m_PointSetSeries[timeStep]->GetPoints()->CastToSTLContainer();
PointsContainer::STLContainerType::iterator it = points.find(currentID);
if (it == points.end()) // ID not found
break;
if (it == points.begin()) // we are at the first element, there is no previous element
break;
/* get and cache current point & pointdata and previous point & pointdata */
--it;
PointIdentifier prevID = it->first;
if (this->SwapPointContents(prevID, currentID, timeStep) == true)
this->Modified();
}
break;
case OpMOVEPOINTDOWN: // move point position within the pointset
{
PointIdentifier currentID = pointOp->GetIndex();
/* search for point with this id and point that succeeds this one in the data container */
PointsContainer::STLContainerType points = m_PointSetSeries[timeStep]->GetPoints()->CastToSTLContainer();
PointsContainer::STLContainerType::iterator it = points.find(currentID);
if (it == points.end()) // ID not found
break;
++it;
if (it == points.end()) // ID is already the last element, there is no succeeding element
break;
/* get and cache current point & pointdata and previous point & pointdata */
PointIdentifier nextID = it->first;
if (this->SwapPointContents(nextID, currentID, timeStep) == true)
this->Modified();
}
break;
default:
itkWarningMacro("mitkPointSet could not understrand the operation. Please check!");
break;
}
//to tell the mappers, that the data is modified and has to be updated
//only call modified if anything is done, so call in cases
//this->Modified();
mitk::OperationEndEvent endevent(operation);
((const itk::Object*)this)->InvokeEvent(endevent);
//*todo has to be done here, cause of update-pipeline not working yet
// As discussed lately, don't mess with the rendering from inside data structures
//mitk::RenderingManager::GetInstance()->RequestUpdateAll();
}
void mitk::PointSet::UpdateOutputInformation()
{
if ( this->GetSource( ) )
{
this->GetSource( )->UpdateOutputInformation( );
}
//
// first make sure, that the associated time sliced geometry has
// the same number of geometry 3d's as PointSets are present
//
mitk::TimeSlicedGeometry* timeGeometry = GetTimeSlicedGeometry();
if ( timeGeometry->GetTimeSteps() != m_PointSetSeries.size() )
{
itkExceptionMacro(<<"timeGeometry->GetTimeSteps() != m_PointSetSeries.size() -- use Initialize(timeSteps) with correct number of timeSteps!");
}
// This is needed to detect zero objects
mitk::ScalarType nullpoint[]={0,0,0,0,0,0};
BoundingBox::BoundsArrayType itkBoundsNull(nullpoint);
//
// Iterate over the PointSets and update the Geometry
// information of each of the items.
//
if (m_CalculateBoundingBox)
{
for ( unsigned int i = 0 ; i < m_PointSetSeries.size() ; ++i )
{
const DataType::BoundingBoxType *bb = m_PointSetSeries[i]->GetBoundingBox();
BoundingBox::BoundsArrayType itkBounds = bb->GetBounds();
if ( m_PointSetSeries[i].IsNull() || (m_PointSetSeries[i]->GetNumberOfPoints() == 0)
|| (itkBounds == itkBoundsNull) )
{
itkBounds = itkBoundsNull;
continue;
}
// Ensure minimal bounds of 1.0 in each dimension
for ( unsigned int j = 0; j < 3; ++j )
{
if ( itkBounds[j*2+1] - itkBounds[j*2] < 1.0 )
{
BoundingBox::CoordRepType center =
(itkBounds[j*2] + itkBounds[j*2+1]) / 2.0;
itkBounds[j*2] = center - 0.5;
itkBounds[j*2+1] = center + 0.5;
}
}
this->GetGeometry(i)->SetBounds(itkBounds);
}
m_CalculateBoundingBox = false;
}
this->GetTimeSlicedGeometry()->UpdateInformation();
}
void mitk::PointSet::SetRequestedRegionToLargestPossibleRegion()
{
}
bool mitk::PointSet::RequestedRegionIsOutsideOfTheBufferedRegion()
{
return false;
}
bool mitk::PointSet::VerifyRequestedRegion()
{
return true;
}
void mitk::PointSet::SetRequestedRegion( itk::DataObject * )
{
}
void mitk::PointSet::PrintSelf( std::ostream& os, itk::Indent indent ) const
{
Superclass::PrintSelf(os, indent);
os << indent << "Number timesteps: " << m_PointSetSeries.size() << "\n";
unsigned int i = 0;
for (PointSetSeries::const_iterator it = m_PointSetSeries.begin(); it != m_PointSetSeries.end(); ++it)
{
os << indent << "Timestep " << i++ << ": \n";
MeshType::Pointer ps = *it;
itk::Indent nextIndent = indent.GetNextIndent();
ps->Print(os, nextIndent);
MeshType::PointsContainer* points = ps->GetPoints();
MeshType::PointDataContainer* datas = ps->GetPointData();
MeshType::PointDataContainer::Iterator dataIterator = datas->Begin();
for (MeshType::PointsContainer::Iterator pointIterator = points->Begin();
pointIterator != points->End();
++pointIterator, ++dataIterator)
{
os << nextIndent << "Point " << pointIterator->Index() << ": [";
os << pointIterator->Value().GetElement(0);
for (unsigned int i = 1; i < PointType::GetPointDimension(); ++i)
{
os << ", " << pointIterator->Value().GetElement(i);
}
os << "]";
os << ", selected: " << dataIterator->Value().selected << ", point spec: " << dataIterator->Value().pointSpec << "\n";
}
}
}
bool mitk::PointSet::SwapPointContents(PointIdentifier id1, PointIdentifier id2, int timeStep)
{
/* search and cache contents */
PointType p1;
if (m_PointSetSeries[timeStep]->GetPoint(id1, &p1) == false)
return false;
PointDataType data1;
if (m_PointSetSeries[timeStep]->GetPointData(id1, &data1) == false)
return false;
PointType p2;
if (m_PointSetSeries[timeStep]->GetPoint(id2, &p2) == false)
return false;
PointDataType data2;
if (m_PointSetSeries[timeStep]->GetPointData(id2, &data2) == false)
return false;
/* now swap contents */
m_PointSetSeries[timeStep]->SetPoint(id1, p2);
m_PointSetSeries[timeStep]->SetPointData(id1, data2);
m_PointSetSeries[timeStep]->SetPoint(id2, p1);
m_PointSetSeries[timeStep]->SetPointData(id2, data1);
return true;
-}
\ No newline at end of file
+}
diff --git a/Core/Code/DataManagement/mitkPointSet.h b/Core/Code/DataManagement/mitkPointSet.h
index 9297a2bf23..c868f44b30 100755
--- a/Core/Code/DataManagement/mitkPointSet.h
+++ b/Core/Code/DataManagement/mitkPointSet.h
@@ -1,274 +1,274 @@
/*=========================================================================
Program: Medical Imaging & Interaction Toolkit
Language: C++
Date: $Date$
Version: $Revision$
Copyright (c) German Cancer Research Center, Division of Medical and
Biological Informatics. All rights reserved.
See MITKCopyright.txt or http://www.mitk.org/copyright.html for details.
This software is distributed WITHOUT ANY WARRANTY; without even
the implied warranty of MERCHANTABILITY or FITNESS FOR A PARTICULAR
PURPOSE. See the above copyright notices for more information.
=========================================================================*/
#ifndef MITKPointSet_H_HEADER_INCLUDED
#define MITKPointSet_H_HEADER_INCLUDED
#include "mitkBaseData.h"
#include <itkMesh.h>
#include <itkDefaultDynamicMeshTraits.h>
namespace mitk {
/**
* \brief Data structure which stores a set of points. Superclass of
* mitk::Mesh.
*
* 3D points are grouped within a point set; for time resolved usage, one point
* set is created and maintained per time step. A point entry consists of the
* point coordinates and point data.
*
* The point data includes a point ID (unique identifier to address this point
* within the point set), the selection state of the point and the type of
* the point.
*
* For further information about different point types see
* mitk::PointSpecificationType in mitkVector.h.
*
* Inserting a point is accompanied by an event, containing an index. The new
* point is inserted into the list at the specified position. At the same time
* an internal ID is generated and stored for the point. Points at specific time
* steps are accessed by specifying the time step number (which defaults to 0).
*
* The points of itk::PointSet stores the points in a pointContainer
* (MapContainer). The points are best accessed by using a ConstIterator (as
* defined in MapContainer); avoid access via index.
*
* The class internally uses an itk::Mesh for each time step, because
* mitk::Mesh is derived from mitk::PointSet and needs the itk::Mesh structure
* which is also derived from itk::PointSet. Thus several typedefs which seem
* to be in wrong place, are declared here (for example SelectedLinesType).
*
* \section mitkPointSetDisplayOptions
*
* The default mappers for this data structure are mitk::PointSetGLMapper2D and
* mitk::PointSetVtkMapper3D. See these classes for display options which can
* can be set via properties.
*
* \section Events
*
* PointSet issues the following events, for which observers can register
* (the below events are grouped into a class hierarchy as indicated by
* identation level; e.g. PointSetSizeChangeEvent comprises PointSetAddEvent
* and PointSetRemoveEvent):
*
* <tt>
* PointSetEvent <i>subsumes all PointSet events</i>
* PointSetMoveEvent <i>issued when a point of the PointSet is moved</i>
* PointSetSizeChangeEvent <i>subsumes add and remove events</i>
* PointSetAddEvent <i>issued when a point is added to the PointSet</i>
* PointSetRemoveEvent <i>issued when a point is removed from the PointSet</i>
* </tt>
* \ingroup PSIO
* \ingroup Data
*/
class MITK_CORE_EXPORT PointSet : public BaseData
{
public:
mitkClassMacro(PointSet, BaseData);
itkNewMacro(Self);
mitkCloneMacro(PointSet);
typedef mitk::ScalarType CoordinateType;
typedef mitk::ScalarType InterpolationWeightType;
static const unsigned int PointDimension = 3;
static const unsigned int MaxTopologicalDimension = 3;
/**
* \brief struct for data of a point
*/
struct PointDataType
{
unsigned int id; //to give the point a special ID
bool selected; //information about if the point is selected
mitk::PointSpecificationType pointSpec; //specifies the type of the point
};
/**
* \brief cellDataType, that stores all indexes of the lines, that are
* selected e.g.: points A,B and C.Between A and B there is a line with
* index 0. If vector of cellData contains 1 and 2, then the lines between
* B and C and C and A is selected.
*/
typedef std::vector<unsigned int> SelectedLinesType;
typedef SelectedLinesType::iterator SelectedLinesIter;
struct CellDataType
{
//used to set the whole cell on selected
bool selected;
//indexes of selected lines. 0 is between pointId 0 and 1
SelectedLinesType selectedLines;
//is the polygon already finished and closed
bool closed;
};
typedef itk::DefaultDynamicMeshTraits<
PointDataType, PointDimension, MaxTopologicalDimension,
CoordinateType, InterpolationWeightType, CellDataType > MeshTraits;
typedef itk::Mesh<PointDataType, PointDimension, MeshTraits> MeshType;
typedef MeshType DataType;
typedef DataType::PointType PointType;
typedef DataType::PointIdentifier PointIdentifier;
typedef DataType::PointsContainer PointsContainer;
typedef DataType::PointsContainerIterator PointsIterator;
typedef DataType::PointsContainer::ConstIterator PointsConstIterator;
typedef DataType::PointDataContainer PointDataContainer;
typedef DataType::PointDataContainerIterator PointDataIterator;
virtual void Expand( unsigned int timeSteps );
/** \brief executes the given Operation */
virtual void ExecuteOperation(Operation* operation);
/** \brief returns the current size of the point-list */
virtual int GetSize( unsigned int t = 0 ) const;
virtual unsigned int GetPointSetSeriesSize() const;
/** \brief returns the pointset */
virtual DataType::Pointer GetPointSet( int t = 0 ) const;
/**
* \brief Get the point with ID id in world coordinates
*
* check if the ID exists. If it doesn't exist, then return 0,0,0
*/
PointType GetPoint( PointIdentifier id, int t = 0 ) const;
/**
* \brief Get the point with ID id in world coordinates
*
* If a point exists for the ID id, the point is returned in the parameter point
* and the method returns true. If the ID does not exist, the method returns false
*/
bool GetPointIfExists( PointIdentifier id, PointType* point, int t = 0 ) const;
/**
* \brief Set the given point in world coordinate system into the itkPointSet.
*/
void SetPoint( PointIdentifier id, PointType point, int t = 0 );
/**
* \brief Set the given point in world coordinate system with the given PointSpecificationType
*/
void SetPoint( PointIdentifier id, PointType point, PointSpecificationType spec, int t = 0 );
/**
* \brief Set the given point in world coordinate system into the itkPointSet.
*/
void InsertPoint( PointIdentifier id, PointType point, int t = 0 );
/**
* \brief Set the given point in world coordinate system with given PointSpecificationType
*/
void InsertPoint( PointIdentifier id, PointType point, PointSpecificationType spec, int t );
/**
* \brief Swap a point at the given position (id) with the upper point (moveUpwards=true) or with the lower point (moveUpwards=false).
* If upper or lower index does not exist false is returned, if swap was successful true.
*/
bool SwapPointPosition( PointIdentifier id, bool moveUpwards, int t = 0 );
/**
* \brief searches a selected point and returns the id of that point.
* If no point is found, then -1 is returned
*/
virtual int SearchSelectedPoint( int t = 0 ) const;
/** \brief returns true if a point exists at this position */
virtual bool IndexExists( int position, int t = 0 ) const;
/** \brief to get the state selected/unselected of the point on the
* position
*/
virtual bool GetSelectInfo( int position, int t = 0 ) const;
virtual void SetSelectInfo( int position, bool selected, int t = 0 );
/** \brief to get the type of the point at the position and the moment */
virtual PointSpecificationType GetSpecificationTypeInfo( int position, int t ) const;
/** \brief returns the number of selected points */
virtual int GetNumberOfSelected( int t = 0 ) const;
/**
* \brief searches a point in the list == point +/- distance
*
* \param point is in world coordinates.
* \param distance is in mm.
* returns -1 if no point is found
* or the position in the list of the first match
*/
int SearchPoint( Point3D point, float distance, int t = 0 ) const;
- virtual bool IsEmpty(unsigned int t) const;
+ virtual bool IsEmptyTimeStep(unsigned int t) const;
//virtual methods, that need to be implemented
virtual void UpdateOutputInformation();
virtual void SetRequestedRegionToLargestPossibleRegion();
virtual bool RequestedRegionIsOutsideOfTheBufferedRegion();
virtual bool VerifyRequestedRegion();
virtual void SetRequestedRegion(itk::DataObject *data);
//Method for subclasses
virtual void OnPointSetChange(){};
protected:
PointSet();
PointSet(const PointSet &other);
virtual ~PointSet();
virtual void PrintSelf(std::ostream& os, itk::Indent indent) const; ///< print content of the object to os
virtual void ClearData();
virtual void InitializeEmpty();
/** \brief swaps point coordinates and point data of the points with identifiers id1 and id2 */
bool SwapPointContents(PointIdentifier id1, PointIdentifier id2, int t = 0 );
typedef std::vector< DataType::Pointer > PointSetSeries;
PointSetSeries m_PointSetSeries;
/**
* @brief flag to indicate the right time to call SetBounds
**/
bool m_CalculateBoundingBox;
};
itkEventMacro( PointSetEvent, itk::AnyEvent );
itkEventMacro( PointSetMoveEvent, PointSetEvent );
itkEventMacro( PointSetSizeChangeEvent, PointSetEvent );
itkEventMacro( PointSetAddEvent, PointSetSizeChangeEvent );
itkEventMacro( PointSetRemoveEvent, PointSetSizeChangeEvent );
itkEventMacro( PointSetExtendTimeRangeEvent, PointSetEvent );
} // namespace mitk
#endif /* MITKPointSet_H_HEADER_INCLUDED */
diff --git a/Core/Code/DataManagement/mitkPropertyList.cpp b/Core/Code/DataManagement/mitkPropertyList.cpp
index 03879b3ced..c464d702cf 100644
--- a/Core/Code/DataManagement/mitkPropertyList.cpp
+++ b/Core/Code/DataManagement/mitkPropertyList.cpp
@@ -1,317 +1,293 @@
/*=========================================================================
Program: Medical Imaging & Interaction Toolkit
Language: C++
Date: $Date$
Version: $Revision$
Copyright (c) German Cancer Research Center, Division of Medical and
Biological Informatics. All rights reserved.
See MITKCopyright.txt or http://www.mitk.org/copyright.html for details.
This software is distributed WITHOUT ANY WARRANTY; without even
the implied warranty of MERCHANTABILITY or FITNESS FOR A PARTICULAR
PURPOSE. See the above copyright notices for more information.
=========================================================================*/
#include "mitkPropertyList.h"
#include "mitkProperties.h"
#include "mitkStringProperty.h"
#include "mitkVector.h"
mitk::BaseProperty* mitk::PropertyList::GetProperty(const std::string& propertyKey) const
{
PropertyMap::const_iterator it;
it=m_Properties.find( propertyKey );
- if(it!=m_Properties.end() && it->second.second )
- return it->second.first;
+ if(it!=m_Properties.end())
+ return it->second;
else
return NULL;
}
void mitk::PropertyList::SetProperty(const std::string& propertyKey, BaseProperty* property)
{
if (!property) return;
//make sure that BaseProperty*, which may have just been created and never been
//assigned to a SmartPointer, is registered/unregistered properly. If we do not
//do that, it will a) not deleted in case it is identical to the old one or
//b) possibly deleted when temporarily added to a smartpointer somewhere below.
BaseProperty::Pointer tmpSmartPointerToProperty = property;
PropertyMap::iterator it( m_Properties.find( propertyKey ) );
// Is a property with key @a propertyKey contained in the list?
if( it != m_Properties.end() )
{
// yes
//is the property contained in the list identical to the new one?
- if( it->second.first == property)
+ if( it->second == property)
{
// yes? do nothing and return.
return;
}
// compatible? then use operator= to assign value
- if (it->second.first->Assignable( *property ))
+ if (it->second->Assignable( *property ))
{
- bool changed = (it->second.first->GetValueAsString() != property->GetValueAsString());
- *(static_cast<BaseProperty*>(it->second.first.GetPointer())) = *property;
+ bool changed = (it->second->GetValueAsString() != property->GetValueAsString());
+ *(static_cast<BaseProperty*>(it->second.GetPointer())) = *property;
// muellerm,20.10: added modified event
if(changed)
this->Modified();
return;
}
- if ( typeid( *(it->second.first.GetPointer()) ) != typeid( *property ) )
+ if ( typeid( *(it->second.GetPointer()) ) != typeid( *property ) )
{
// Accept only if the two types are matching. For replacing, use
// ReplaceProperty.
MITK_ERROR << "In " __FILE__ ", l." << __LINE__
<< ": Trying to set existing property to a property with different type."
<< " Use ReplaceProperty() instead."
<< std::endl;
return;
}
// If types are identical, but the property has no operator= (s.a.),
// overwrite the pointer.
- it->second.first = property;
+ it->second = property;
return;
}
//no? add/replace it.
PropertyMapElementType newProp;
newProp.first = propertyKey;
- newProp.second = std::pair<BaseProperty::Pointer,bool>(property,true);
+ newProp.second = property;
m_Properties.insert ( newProp );
this->Modified();
}
void mitk::PropertyList::ReplaceProperty(const std::string& propertyKey, BaseProperty* property)
{
if (!property) return;
PropertyMap::iterator it( m_Properties.find( propertyKey ) );
// Is a property with key @a propertyKey contained in the list?
if( it != m_Properties.end() )
{
- it->second.first=NULL;
+ it->second=NULL;
m_Properties.erase(it);
}
//no? add/replace it.
PropertyMapElementType newProp;
newProp.first = propertyKey;
- newProp.second = std::pair<BaseProperty::Pointer,bool>(property,true);
+ newProp.second = property;
m_Properties.insert ( newProp );
Modified();
}
mitk::PropertyList::PropertyList()
{
}
mitk::PropertyList::~PropertyList()
{
Clear();
}
/**
* Consider the list as changed when any of the properties has changed recently.
*/
unsigned long mitk::PropertyList::GetMTime() const
{
for ( PropertyMap::const_iterator it = m_Properties.begin() ;
it != m_Properties.end();
++it )
{
- if( it->second.first.IsNull() )
+ if( it->second.IsNull() )
{
itkWarningMacro(<< "Property '" << it->first <<"' contains nothing (NULL).");
continue;
}
- if( Superclass::GetMTime() < it->second.first->GetMTime() )
+ if( Superclass::GetMTime() < it->second->GetMTime() )
{
Modified();
break;
}
}
return Superclass::GetMTime();
}
bool mitk::PropertyList::DeleteProperty(const std::string& propertyKey)
{
PropertyMap::iterator it;
it=m_Properties.find( propertyKey );
if(it!=m_Properties.end())
{
- it->second.first=NULL;
+ it->second=NULL;
m_Properties.erase(it);
Modified();
return true;
}
return false;
}
mitk::PropertyList::Pointer mitk::PropertyList::Clone()
{
mitk::PropertyList::Pointer newPropertyList = PropertyList::New();
// copy the map
newPropertyList->m_Properties = m_Properties;
return newPropertyList.GetPointer();
}
void mitk::PropertyList::Clear()
{
PropertyMap::iterator it = m_Properties.begin(), end = m_Properties.end();
while(it!=end)
{
- it->second.first = NULL;
+ it->second = NULL;
++it;
}
m_Properties.clear();
}
-bool mitk::PropertyList::IsEnabled(const std::string& propertyKey)
-{
- PropertyMap::iterator it = m_Properties.find( propertyKey );
- if (it != m_Properties.end() && it->second.second)
- {
- return true;
- }
- else
- {
- return false;
- }
-}
-
-
-void mitk::PropertyList::SetEnabled(const std::string& propertyKey, bool enabled)
-{
- PropertyMap::iterator it = m_Properties.find( propertyKey );
- if (it != m_Properties.end() && it->second.second != enabled)
- {
- it->second.second = enabled;
- this->Modified();
- }
-}
-
void mitk::PropertyList::ConcatenatePropertyList(PropertyList *pList, bool replace)
{
if (pList)
{
const PropertyMap* propertyMap = pList->GetMap();
for ( PropertyMap::const_iterator iter = propertyMap->begin(); // m_PropertyList is created in the constructor, so we don't check it here
iter != propertyMap->end();
++iter )
{
const std::string key = iter->first;
- BaseProperty* value = iter->second.first;
+ BaseProperty* value = iter->second;
if (replace)
{
ReplaceProperty( key.c_str(), value );
}
else
{
SetProperty( key.c_str(), value );
}
}
}
}
bool mitk::PropertyList::GetBoolProperty(const char* propertyKey, bool& boolValue) const
{
BoolProperty *gp = dynamic_cast<BoolProperty*>( GetProperty(propertyKey) );
if ( gp != NULL )
{
boolValue = gp->GetValue();
return true;
}
return false;
// Templated Method does not work on Macs
//return GetPropertyValue<bool>(propertyKey, boolValue);
}
bool mitk::PropertyList::GetIntProperty(const char* propertyKey, int &intValue) const
{
IntProperty *gp = dynamic_cast<IntProperty*>( GetProperty(propertyKey) );
if ( gp != NULL )
{
intValue = gp->GetValue();
return true;
}
return false;
// Templated Method does not work on Macs
//return GetPropertyValue<int>(propertyKey, intValue);
}
bool mitk::PropertyList::GetFloatProperty(const char* propertyKey, float &floatValue) const
{
FloatProperty *gp = dynamic_cast<FloatProperty*>( GetProperty(propertyKey) );
if ( gp != NULL )
{
floatValue = gp->GetValue();
return true;
}
return false;
// Templated Method does not work on Macs
//return GetPropertyValue<float>(propertyKey, floatValue);
}
bool mitk::PropertyList::GetStringProperty(const char* propertyKey, std::string& stringValue) const
{
StringProperty* sp= dynamic_cast<StringProperty*>(GetProperty(propertyKey));
if ( sp != NULL )
{
stringValue = sp->GetValue();
return true;
}
return false;
}
void mitk::PropertyList::SetIntProperty(const char* propertyKey, int intValue)
{
SetProperty(propertyKey, mitk::IntProperty::New(intValue));
}
void mitk::PropertyList::SetBoolProperty( const char* propertyKey, bool boolValue)
{
SetProperty(propertyKey, mitk::BoolProperty::New(boolValue));
}
void mitk::PropertyList::SetFloatProperty( const char* propertyKey, float floatValue)
{
SetProperty(propertyKey, mitk::FloatProperty::New(floatValue));
}
void mitk::PropertyList::SetStringProperty( const char* propertyKey, const char* stringValue)
{
SetProperty(propertyKey, mitk::StringProperty::New(stringValue));
}
diff --git a/Core/Code/DataManagement/mitkPropertyList.h b/Core/Code/DataManagement/mitkPropertyList.h
index e2b9fbdeca..e8d4409c3c 100644
--- a/Core/Code/DataManagement/mitkPropertyList.h
+++ b/Core/Code/DataManagement/mitkPropertyList.h
@@ -1,215 +1,208 @@
/*=========================================================================
Program: Medical Imaging & Interaction Toolkit
Language: C++
Date: $Date$
Version: $Revision$
Copyright (c) German Cancer Research Center, Division of Medical and
Biological Informatics. All rights reserved.
See MITKCopyright.txt or http://www.mitk.org/copyright.html for details.
This software is distributed WITHOUT ANY WARRANTY; without even
the implied warranty of MERCHANTABILITY or FITNESS FOR A PARTICULAR
PURPOSE. See the above copyright notices for more information.
=========================================================================*/
#ifndef PROPERTYLIST_H_HEADER_INCLUDED_C1C77D8D
#define PROPERTYLIST_H_HEADER_INCLUDED_C1C77D8D
#include "mitkCommon.h"
#include "mitkBaseProperty.h"
#include "mitkGenericProperty.h"
#include "mitkUIDGenerator.h"
#include <itkObjectFactory.h>
#include <string>
#include <map>
namespace mitk {
class XMLWriter;
/**
* @brief Key-value list holding instances of BaseProperty
*
* This list is meant to hold an arbitrary list of "properties",
* which should describe the object associated with this list.
*
* Usually you will use PropertyList as part of a DataNode
* object - in this context the properties describe the data object
* held by the DataNode (e.g. whether the object is rendered at
* all, which color is used for rendering, what name should be
* displayed for the object, etc.)
*
* The values in the list are not fixed, you may introduce any kind
* of property that seems useful - all you have to do is inherit
* from BaseProperty.
*
* The list is organized as a key-value pairs, i.e.
*
* \li "name" : pointer to a StringProperty
* \li "visible" : pointer to a BoolProperty
* \li "color" : pointer to a ColorProperty
* \li "volume" : pointer to a FloatProperty
*
* Please see the documentation of SetProperty and ReplaceProperty for two
* quite different semantics. Normally SetProperty is what you want - this
* method will try to change the value of an existing property and will
* not allow you to replace e.g. a ColorProperty with an IntProperty.
*
* @ingroup DataManagement
*/
class MITK_CORE_EXPORT PropertyList : public itk::Object
{
public:
mitkClassMacro(PropertyList, itk::Object);
/**
* Method for creation through the object factory.
*/
itkNewMacro(Self);
/**
* Map structure to hold the properties: the map key is a string,
- * the value consists of the actual property object (BaseProperty) and
- * a bool flag (indicating whether a property is "enabled").
- *
- * The "enabled" flag is there to "keep a property without showing it", i.e.
- * GetProperty will not tell that there such a thing. Is there any real world use for this? (bug #1052)
+ * the value consists of the actual property object (BaseProperty).
*/
- typedef std::map< std::string,std::pair<BaseProperty::Pointer,bool> > PropertyMap;
- typedef std::pair< std::string,std::pair<BaseProperty::Pointer,bool> > PropertyMapElementType;
+ typedef std::map< std::string, BaseProperty::Pointer> PropertyMap;
+ typedef std::pair< std::string, BaseProperty::Pointer> PropertyMapElementType;
/**
* @brief Get a property by its name.
*/
mitk::BaseProperty* GetProperty(const std::string& propertyKey) const;
/**
* @brief Set a property in the list/map by value.
*
* The actual OBJECT holding the value of the property is not replaced, but its value
* is modified to match that of @a property. To really replace the object holding the
* property - which would make sense if you want to change the type (bool, string) of the property
* - call ReplaceProperty.
*/
void SetProperty(const std::string& propertyKey, BaseProperty* property);
/**
* @brief Set a property object in the list/map by reference.
*
* The actual OBJECT holding the value of the property is replaced by this function.
* This is useful if you want to change the type of the property, like from BoolProperty to StringProperty.
* Another use is to share one and the same property object among several ProperyList/DataNode objects, which
* makes them appear synchronized.
*/
void ReplaceProperty(const std::string& propertyKey, BaseProperty* property);
/**
* @brief Set a property object in the list/map by reference.
*/
void ConcatenatePropertyList(PropertyList *pList, bool replace = false);
//##Documentation
//## @brief Convenience access method for GenericProperty<T> properties
//## (T being the type of the second parameter)
//## @return @a true property was found
template <typename T>
bool GetPropertyValue(const char* propertyKey, T & value) const
{
GenericProperty<T>* gp= dynamic_cast<GenericProperty<T>*>(GetProperty(propertyKey));
if ( gp != NULL )
{
value = gp->GetValue();
return true;
}
return false;
}
/**
* @brief Convenience method to access the value of a BoolProperty
*/
bool GetBoolProperty(const char* propertyKey, bool& boolValue) const;
/**
* @brief Convenience method to set the value of a BoolProperty
*/
void SetBoolProperty( const char* propertyKey, bool boolValue);
/**
* @brief Convenience method to access the value of an IntProperty
*/
bool GetIntProperty(const char* propertyKey, int &intValue) const;
/**
* @brief Convenience method to set the value of an IntProperty
*/
void SetIntProperty(const char* propertyKey, int intValue);
/**
* @brief Convenience method to access the value of a FloatProperty
*/
bool GetFloatProperty(const char* propertyKey, float &floatValue) const;
/**
* @brief Convenience method to set the value of a FloatProperty
*/
void SetFloatProperty( const char* propertyKey, float floatValue);
/**
* @brief Convenience method to access the value of a StringProperty
*/
bool GetStringProperty(const char* propertyKey, std::string& stringValue) const;
/**
* @brief Convenience method to set the value of a StringProperty
*/
void SetStringProperty( const char* propertyKey, const char* stringValue);
/**
* @brief Get the timestamp of the last change of the map or the last change of one of
* the properties store in the list (whichever is later).
*/
virtual unsigned long GetMTime() const;
/**
* @brief Remove a property from the list/map.
*/
bool DeleteProperty(const std::string& propertyKey);
const PropertyMap* GetMap() const { return &m_Properties; }
bool IsEmpty() const { return m_Properties.empty(); }
virtual Pointer Clone();
virtual void Clear();
- virtual bool IsEnabled(const std::string& propertyKey);
- virtual void SetEnabled(const std::string& propertyKey,bool enabled);
-
protected:
PropertyList();
virtual ~PropertyList();
/**
* @brief Map of properties.
*/
PropertyMap m_Properties;
};
} // namespace mitk
#endif /* PROPERTYLIST_H_HEADER_INCLUDED_C1C77D8D */
diff --git a/Core/Code/DataManagement/mitkResliceMethodProperty.h b/Core/Code/DataManagement/mitkResliceMethodProperty.h
index c94060c749..e858ec8b22 100644
--- a/Core/Code/DataManagement/mitkResliceMethodProperty.h
+++ b/Core/Code/DataManagement/mitkResliceMethodProperty.h
@@ -1,51 +1,53 @@
/*=========================================================================
Program: Medical Imaging & Interaction Toolkit
Language: C++
Date: $Date: 2008-04-14 19:45:53 +0200 (Mo, 14 Apr 2008) $
Version: $Revision: 14081 $
Copyright (c) German Cancer Research Center, Division of Medical and
Biological Informatics. All rights reserved.
See MITKCopyright.txt or http://www.mitk.org/copyright.html for details.
This software is distributed WITHOUT ANY WARRANTY; without even
the implied warranty of MERCHANTABILITY or FITNESS FOR A PARTICULAR
PURPOSE. See the above copyright notices for more information.
=========================================================================*/
#ifndef __MITKRESLICEMETHODENUMPROPERTY_H
#define __MITKRESLICEMETHODENUMPROPERTY_H
#include "mitkEnumerationProperty.h"
namespace mitk
{
/**
* Encapsulates the thick slices method enumeration
*/
class MITK_CORE_EXPORT ResliceMethodProperty : public EnumerationProperty
{
public:
mitkClassMacro( ResliceMethodProperty, EnumerationProperty );
itkNewMacro(ResliceMethodProperty);
mitkNewMacro1Param(ResliceMethodProperty, const IdType&);
mitkNewMacro1Param(ResliceMethodProperty, const std::string&);
+
+ virtual BaseProperty& operator=(const BaseProperty& other) { return Superclass::operator=(other); }
protected:
ResliceMethodProperty( );
ResliceMethodProperty( const IdType& value );
ResliceMethodProperty( const std::string& value );
void AddThickSlicesTypes();
};
} // end of namespace mitk
#endif //_MITK_VTK_SCALARMODE_PROPERTY__H_
diff --git a/Core/Code/DataManagement/mitkShaderProperty.cpp b/Core/Code/DataManagement/mitkShaderProperty.cpp
index d0c40a9f15..884d9ac92f 100644
--- a/Core/Code/DataManagement/mitkShaderProperty.cpp
+++ b/Core/Code/DataManagement/mitkShaderProperty.cpp
@@ -1,100 +1,100 @@
/*=========================================================================
Program: Medical Imaging & Interaction Toolkit
Language: C++
Date: $Date: 2007-12-11 14:46:19 +0100 (Di, 11 Dez 2007) $
Version: $Revision: 13129 $
Copyright (c) German Cancer Research Center, Division of Medical and
Biological Informatics. All rights reserved.
See MITKCopyright.txt or http://www.mitk.org/copyright.html for details.
This software is distributed WITHOUT ANY WARRANTY; without even
the implied warranty of MERCHANTABILITY or FITNESS FOR A PARTICULAR
PURPOSE. See the above copyright notices for more information.
=========================================================================*/
#include <vtkAbstractMapper.h>
#include "mitkShaderProperty.h"
#include "mitkShaderRepository.h"
#include <itkDirectory.h>
#include <itksys/SystemTools.hxx>
mitk::ShaderProperty::ShaderProperty( )
{
AddShaderTypes();
SetShader( (IdType)0 );
}
mitk::ShaderProperty::ShaderProperty( const IdType& value )
{
AddShaderTypes();
SetShader(value);
}
mitk::ShaderProperty::ShaderProperty( const std::string& value )
{
AddShaderTypes();
SetShader(value);
}
void mitk::ShaderProperty::SetShader( const IdType& value )
{
if ( IsValidEnumerationValue( value ) )
SetValue( value );
else
SetValue( (IdType)0 );
}
void mitk::ShaderProperty::SetShader( const std::string& value )
{
if ( IsValidEnumerationValue( value ) )
SetValue( value );
else
SetValue( (IdType)0 );
}
mitk::EnumerationProperty::IdType mitk::ShaderProperty::GetShaderId()
{
return GetValueAsId();
}
std::string mitk::ShaderProperty::GetShaderName()
{
return GetValueAsString();
}
void mitk::ShaderProperty::AddShaderTypes()
{
AddEnum( "fixed" );
std::list<mitk::ShaderRepository::Shader::Pointer> *l
= mitk::ShaderRepository::GetGlobalShaderRepository()->GetShaders();
std::list<mitk::ShaderRepository::Shader::Pointer>::const_iterator i = l->begin();
while( i != l->end() )
{
AddEnum( (*i)->name );
i++;
}
}
-bool mitk::ShaderProperty::AddEnum( const std::string& name )
+bool mitk::ShaderProperty::AddEnum( const std::string& name ,const IdType& /*id*/)
{
Element e;
e.name=name;
bool success=Superclass::AddEnum( e.name, (IdType)shaderList.size() );
shaderList.push_back(e);
return success;
}
diff --git a/Core/Code/DataManagement/mitkShaderProperty.h b/Core/Code/DataManagement/mitkShaderProperty.h
index 6d84923d79..5438935d66 100644
--- a/Core/Code/DataManagement/mitkShaderProperty.h
+++ b/Core/Code/DataManagement/mitkShaderProperty.h
@@ -1,96 +1,103 @@
/*=========================================================================
Program: Medical Imaging & Interaction Toolkit
Language: C++
Date: $Date: 2008-04-14 19:45:53 +0200 (Mo, 14 Apr 2008) $
Version: $Revision: 14081 $
Copyright (c) German Cancer Research Center, Division of Medical and
Biological Informatics. All rights reserved.
See MITKCopyright.txt or http://www.mitk.org/copyright.html for details.
This software is distributed WITHOUT ANY WARRANTY; without even
the implied warranty of MERCHANTABILITY or FITNESS FOR A PARTICULAR
PURPOSE. See the above copyright notices for more information.
=========================================================================*/
#ifndef __MITKSHADERENUMPROPERTY_H
#define __MITKSHADERENUMPROPERTY_H
#include "mitkEnumerationProperty.h"
namespace mitk
{
/**
* Encapsulates the shader enumeration
*/
class MITK_CORE_EXPORT ShaderProperty : public EnumerationProperty
{
public:
class Element {
public:
std::string name;
};
mitkClassMacro( ShaderProperty, EnumerationProperty );
itkNewMacro(ShaderProperty);
+
mitkNewMacro1Param(ShaderProperty, const IdType&);
mitkNewMacro1Param(ShaderProperty, const std::string&);
/**
* Returns the current scalar mode value as defined by VTK constants.
* @returns the current scalar mode as VTK constant.
*/
IdType GetShaderId();
std::string GetShaderName();
void SetShader(const IdType& i);
void SetShader(const std::string& i);
+ virtual BaseProperty& operator=(const BaseProperty& other)
+ {
+ shaderList = dynamic_cast<const ShaderProperty&>(other).shaderList;
+ return Superclass::operator=(other);
+ }
+
protected:
std::list<Element> shaderList;
/**
* Constructor. Sets the representation to a default value of surface(2)
*/
ShaderProperty( );
/**
* \brief Sets the scalar mode to the given value. If it is not
* valid, the scalar mode is set to default (0).
* @param value the integer representation of the scalar mode
*/
ShaderProperty( const IdType& value );
/**
* \brief Sets the scalar mode to the given value. If it is not
* valid, the representation is set to default (0).
* @param value the string representation of the scalar mode
*/
ShaderProperty( const std::string& value );
/**
* this function is overridden as protected, so that the user may not add
* additional invalid scalar mode types.
*/
- bool AddEnum( const std::string& name );
+ bool AddEnum( const std::string& name, const IdType& id = 0);
/**
- * Adds the enumeration types as defined by vtk to the list of known
+ * Adds the enumeration types as defined by vtk to the list of known
* enumeration values.
*/
void AddShaderTypes();
};
} // end of namespace mitk
#endif //_MITK_VTK_SCALARMODE_PROPERTY__H_
diff --git a/Core/Code/DataManagement/mitkSlicedGeometry3D.cpp b/Core/Code/DataManagement/mitkSlicedGeometry3D.cpp
index 3a6c5b0200..14324eb55e 100644
--- a/Core/Code/DataManagement/mitkSlicedGeometry3D.cpp
+++ b/Core/Code/DataManagement/mitkSlicedGeometry3D.cpp
@@ -1,840 +1,836 @@
/*=========================================================================
Program: Medical Imaging & Interaction Toolkit
Language: C++
Date: $Date$
Version: $Revision$
Copyright (c) German Cancer Research Center, Division of Medical and
Biological Informatics. All rights reserved.
See MITKCopyright.txt or http://www.mitk.org/copyright.html for details.
This software is distributed WITHOUT ANY WARRANTY; without even
the implied warranty of MERCHANTABILITY or FITNESS FOR A PARTICULAR
PURPOSE. See the above copyright notices for more information.
=========================================================================*/
#include "mitkSlicedGeometry3D.h"
#include "mitkPlaneGeometry.h"
#include "mitkRotationOperation.h"
#include "mitkPlaneOperation.h"
#include "mitkInteractionConst.h"
#include "mitkSliceNavigationController.h"
mitk::SlicedGeometry3D::SlicedGeometry3D()
: m_EvenlySpaced( true ),
m_Slices( 0 ),
m_ReferenceGeometry( NULL ),
m_SliceNavigationController( NULL )
{
- this->Initialize( m_Slices );
+ this->InitializeSlicedGeometry( m_Slices );
}
+mitk::SlicedGeometry3D::SlicedGeometry3D(const SlicedGeometry3D& other)
+: Superclass(other),
+ m_EvenlySpaced( other.m_EvenlySpaced ),
+ m_Slices( other.m_Slices ),
+ m_ReferenceGeometry( other.m_ReferenceGeometry ),
+ m_SliceNavigationController( other.m_SliceNavigationController )
+{
+
+ SetSpacing( other.GetSpacing() );
+ SetDirectionVector( other.GetDirectionVector() );
+
+ if ( m_EvenlySpaced )
+ {
+ AffineGeometryFrame3D::Pointer geometry = other.m_Geometry2Ds[0]->Clone();
+ Geometry2D* geometry2D = dynamic_cast<Geometry2D*>(geometry.GetPointer());
+ assert(geometry2D!=NULL);
+ SetGeometry2D(geometry2D, 0);
+ }
+ else
+ {
+ unsigned int s;
+ for ( s = 0; s < other.m_Slices; ++s )
+ {
+ if ( other.m_Geometry2Ds[s].IsNull() )
+ {
+ assert(other.m_EvenlySpaced);
+ m_Geometry2Ds[s] = NULL;
+ }
+ else
+ {
+ AffineGeometryFrame3D::Pointer geometry = other.m_Geometry2Ds[s]->Clone();
+ Geometry2D* geometry2D = dynamic_cast<Geometry2D*>(geometry.GetPointer());
+ assert(geometry2D!=NULL);
+ SetGeometry2D(geometry2D, s);
+ }
+ }
+ }
+}
mitk::SlicedGeometry3D::~SlicedGeometry3D()
{
}
mitk::Geometry2D *
mitk::SlicedGeometry3D::GetGeometry2D( int s ) const
{
mitk::Geometry2D::Pointer geometry2D = NULL;
if ( this->IsValidSlice(s) )
{
geometry2D = m_Geometry2Ds[s];
// If (a) m_EvenlySpaced==true, (b) we don't have a Geometry2D stored
// for the requested slice, and (c) the first slice (s=0)
// is a PlaneGeometry instance, then we calculate the geometry of the
// requested as the plane of the first slice shifted by m_Spacing[2]*s
// in the direction of m_DirectionVector.
if ( (m_EvenlySpaced) && (geometry2D.IsNull()) )
{
PlaneGeometry *firstSlice = dynamic_cast< PlaneGeometry * > (
m_Geometry2Ds[0].GetPointer() );
if ( firstSlice != NULL )
{
if ( (m_DirectionVector[0] == 0.0)
&& (m_DirectionVector[1] == 0.0)
&& (m_DirectionVector[2] == 0.0) )
{
m_DirectionVector = firstSlice->GetNormal();
m_DirectionVector.Normalize();
}
Vector3D direction;
direction = m_DirectionVector * m_Spacing[2];
mitk::PlaneGeometry::Pointer requestedslice;
requestedslice = static_cast< mitk::PlaneGeometry * >(
firstSlice->Clone().GetPointer() );
requestedslice->SetOrigin(
requestedslice->GetOrigin() + direction * s );
geometry2D = requestedslice;
m_Geometry2Ds[s] = geometry2D;
}
}
return geometry2D;
}
else
{
return NULL;
}
}
const mitk::BoundingBox *
mitk::SlicedGeometry3D::GetBoundingBox() const
{
assert(m_BoundingBox.IsNotNull());
return m_BoundingBox.GetPointer();
}
bool
mitk::SlicedGeometry3D::SetGeometry2D( mitk::Geometry2D *geometry2D, int s )
{
if ( this->IsValidSlice(s) )
{
m_Geometry2Ds[s] = geometry2D;
m_Geometry2Ds[s]->SetReferenceGeometry( m_ReferenceGeometry );
return true;
}
return false;
}
void
-mitk::SlicedGeometry3D::Initialize( unsigned int slices )
+mitk::SlicedGeometry3D::InitializeSlicedGeometry( unsigned int slices )
{
Superclass::Initialize();
m_Slices = slices;
Geometry2D::Pointer gnull = NULL;
m_Geometry2Ds.assign( m_Slices, gnull );
Vector3D spacing;
spacing.Fill( 1.0 );
this->SetSpacing( spacing );
m_DirectionVector.Fill( 0 );
}
void
mitk::SlicedGeometry3D::InitializeEvenlySpaced(
mitk::Geometry2D* geometry2D, unsigned int slices, bool flipped )
{
assert( geometry2D != NULL );
this->InitializeEvenlySpaced(
geometry2D, geometry2D->GetExtentInMM(2)/geometry2D->GetExtent(2),
slices, flipped );
}
void
mitk::SlicedGeometry3D::InitializeEvenlySpaced(
mitk::Geometry2D* geometry2D, mitk::ScalarType zSpacing,
unsigned int slices, bool flipped )
{
assert( geometry2D != NULL );
assert( geometry2D->GetExtent(0) > 0 );
assert( geometry2D->GetExtent(1) > 0 );
geometry2D->Register();
Superclass::Initialize();
m_Slices = slices;
BoundingBox::BoundsArrayType bounds = geometry2D->GetBounds();
bounds[4] = 0;
bounds[5] = slices;
// clear and reserve
Geometry2D::Pointer gnull = NULL;
m_Geometry2Ds.assign( m_Slices, gnull );
Vector3D directionVector = geometry2D->GetAxisVector(2);
directionVector.Normalize();
directionVector *= zSpacing;
if ( flipped == false )
{
// Normally we should use the following four lines to create a copy of
// the transform contrained in geometry2D, because it may not be changed
// by us. But we know that SetSpacing creates a new transform without
// changing the old (coming from geometry2D), so we can use the fifth
// line instead. We check this at (**).
//
// AffineTransform3D::Pointer transform = AffineTransform3D::New();
// transform->SetMatrix(geometry2D->GetIndexToWorldTransform()->GetMatrix());
// transform->SetOffset(geometry2D->GetIndexToWorldTransform()->GetOffset());
// SetIndexToWorldTransform(transform);
m_IndexToWorldTransform = const_cast< AffineTransform3D * >(
geometry2D->GetIndexToWorldTransform() );
}
else
{
directionVector *= -1.0;
m_IndexToWorldTransform = AffineTransform3D::New();
m_IndexToWorldTransform->SetMatrix(
geometry2D->GetIndexToWorldTransform()->GetMatrix() );
AffineTransform3D::OutputVectorType scaleVector;
FillVector3D(scaleVector, 1.0, 1.0, -1.0);
m_IndexToWorldTransform->Scale(scaleVector, true);
m_IndexToWorldTransform->SetOffset(
geometry2D->GetIndexToWorldTransform()->GetOffset() );
}
mitk::Vector3D spacing;
FillVector3D( spacing,
geometry2D->GetExtentInMM(0) / bounds[1],
geometry2D->GetExtentInMM(1) / bounds[3],
zSpacing );
// Ensure that spacing differs from m_Spacing to make SetSpacing change the
// matrix.
m_Spacing[2] = zSpacing - 1;
this->SetDirectionVector( directionVector );
this->SetBounds( bounds );
this->SetGeometry2D( geometry2D, 0 );
this->SetSpacing( spacing );
this->SetEvenlySpaced();
this->SetTimeBounds( geometry2D->GetTimeBounds() );
assert(m_IndexToWorldTransform.GetPointer()
!= geometry2D->GetIndexToWorldTransform()); // (**) see above.
this->SetFrameOfReferenceID( geometry2D->GetFrameOfReferenceID() );
this->SetImageGeometry( geometry2D->GetImageGeometry() );
geometry2D->UnRegister();
}
void
mitk::SlicedGeometry3D::InitializePlanes(
const mitk::Geometry3D *geometry3D,
mitk::PlaneGeometry::PlaneOrientation planeorientation,
bool top, bool frontside, bool rotated )
{
m_ReferenceGeometry = const_cast< Geometry3D * >( geometry3D );
PlaneGeometry::Pointer planeGeometry = mitk::PlaneGeometry::New();
planeGeometry->InitializeStandardPlane(
geometry3D, top, planeorientation, frontside, rotated );
ScalarType viewSpacing = 1;
unsigned int slices = 1;
switch ( planeorientation )
{
case PlaneGeometry::Transversal:
viewSpacing = geometry3D->GetSpacing()[2];
slices = (unsigned int) geometry3D->GetExtent( 2 );
break;
case PlaneGeometry::Frontal:
viewSpacing = geometry3D->GetSpacing()[1];
slices = (unsigned int) geometry3D->GetExtent( 1 );
break;
case PlaneGeometry::Sagittal:
viewSpacing = geometry3D->GetSpacing()[0];
slices = (unsigned int) geometry3D->GetExtent( 0 );
break;
default:
itkExceptionMacro("unknown PlaneOrientation");
}
mitk::Vector3D normal = this->AdjustNormal( planeGeometry->GetNormal() );
ScalarType directedExtent =
fabs( m_ReferenceGeometry->GetExtentInMM( 0 ) * normal[0] )
+ fabs( m_ReferenceGeometry->GetExtentInMM( 1 ) * normal[1] )
+ fabs( m_ReferenceGeometry->GetExtentInMM( 2 ) * normal[2] );
if ( directedExtent >= viewSpacing )
{
slices = static_cast< int >(directedExtent / viewSpacing + 0.5);
}
else
{
slices = 1;
}
bool flipped = (top == false);
if ( frontside == false )
{
flipped = !flipped;
}
if ( planeorientation == PlaneGeometry::Frontal )
{
flipped = !flipped;
}
this->InitializeEvenlySpaced( planeGeometry, viewSpacing, slices, flipped );
}
void
mitk::SlicedGeometry3D
::ReinitializePlanes( const Point3D &center, const Point3D &referencePoint )
{
// Need a reference frame to align the rotated planes
if ( !m_ReferenceGeometry )
{
return;
}
// Get first plane of plane stack
PlaneGeometry *firstPlane =
dynamic_cast< PlaneGeometry * >( m_Geometry2Ds[0].GetPointer() );
// If plane stack is empty, exit
if ( firstPlane == NULL )
{
return;
}
// Calculate the "directed" spacing when taking the plane (defined by its axes
// vectors and normal) as the reference coordinate frame.
//
// This is done by calculating the radius of the ellipsoid defined by the
// original volume spacing axes, in the direction of the respective axis of the
// reference frame.
mitk::Vector3D axis0 = firstPlane->GetAxisVector(0);
mitk::Vector3D axis1 = firstPlane->GetAxisVector(1);
mitk::Vector3D normal = firstPlane->GetNormal();
normal.Normalize();
Vector3D spacing;
spacing[0] = this->CalculateSpacing( axis0 );
spacing[1] = this->CalculateSpacing( axis1 );
spacing[2] = this->CalculateSpacing( normal );
Superclass::SetSpacing( spacing );
// Now we need to calculate the number of slices in the plane's normal
// direction, so that the entire volume is covered. This is done by first
// calculating the dot product between the volume diagonal (the maximum
// distance inside the volume) and the normal, and dividing this value by
// the directed spacing calculated above.
ScalarType directedExtent =
fabs( m_ReferenceGeometry->GetExtentInMM( 0 ) * normal[0] )
+ fabs( m_ReferenceGeometry->GetExtentInMM( 1 ) * normal[1] )
+ fabs( m_ReferenceGeometry->GetExtentInMM( 2 ) * normal[2] );
if ( directedExtent >= spacing[2] )
{
m_Slices = static_cast< unsigned int >(directedExtent / spacing[2] + 0.5);
}
else
{
m_Slices = 1;
}
// The origin of our "first plane" needs to be adapted to this new extent.
// To achieve this, we first calculate the current distance to the volume's
// center, and then shift the origin in the direction of the normal by the
// difference between this distance and half of the new extent.
double centerOfRotationDistance =
firstPlane->SignedDistanceFromPlane( center );
if ( centerOfRotationDistance > 0 )
{
firstPlane->SetOrigin( firstPlane->GetOrigin()
+ normal * (centerOfRotationDistance - directedExtent / 2.0)
);
m_DirectionVector = normal;
}
else
{
firstPlane->SetOrigin( firstPlane->GetOrigin()
+ normal * (directedExtent / 2.0 + centerOfRotationDistance)
);
m_DirectionVector = -normal;
}
// Now we adjust this distance according with respect to the given reference
// point: we need to make sure that the point is touched by one slice of the
// new slice stack.
double referencePointDistance =
firstPlane->SignedDistanceFromPlane( referencePoint );
int referencePointSlice = static_cast< int >(
referencePointDistance / spacing[2]);
double alignmentValue =
referencePointDistance / spacing[2] - referencePointSlice;
firstPlane->SetOrigin(
firstPlane->GetOrigin() + normal * alignmentValue * spacing[2] );
// Finally, we can clear the previous geometry stack and initialize it with
// our re-initialized "first plane".
m_Geometry2Ds.assign( m_Slices, Geometry2D::Pointer( NULL ) );
if ( m_Slices > 0 )
{
m_Geometry2Ds[0] = firstPlane;
}
// Reinitialize SNC with new number of slices
m_SliceNavigationController->GetSlice()->SetSteps( m_Slices );
this->Modified();
}
double
mitk::SlicedGeometry3D::CalculateSpacing( const mitk::Vector3D &d ) const
{
// Need the spacing of the underlying dataset / geometry
if ( !m_ReferenceGeometry )
{
return 1.0;
}
// The following can be derived from the ellipsoid equation
//
// 1 = x^2/a^2 + y^2/b^2 + z^2/c^2
//
// where (a,b,c) = spacing of original volume (ellipsoid radii)
// and (x,y,z) = scaled coordinates of vector d (according to ellipsoid)
//
const mitk::Vector3D &spacing = m_ReferenceGeometry->GetSpacing();
double scaling = d[0]*d[0] / (spacing[0] * spacing[0])
+ d[1]*d[1] / (spacing[1] * spacing[1])
+ d[2]*d[2] / (spacing[2] * spacing[2]);
scaling = sqrt( scaling );
return ( sqrt( d[0]*d[0] + d[1]*d[1] + d[2]*d[2] ) / scaling );
}
mitk::Vector3D
mitk::SlicedGeometry3D::AdjustNormal( const mitk::Vector3D &normal ) const
{
Geometry3D::TransformType::Pointer inverse = Geometry3D::TransformType::New();
m_ReferenceGeometry->GetIndexToWorldTransform()->GetInverse( inverse );
Vector3D transformedNormal = inverse->TransformVector( normal );
transformedNormal.Normalize();
return transformedNormal;
}
void
mitk::SlicedGeometry3D::SetImageGeometry( const bool isAnImageGeometry )
{
Superclass::SetImageGeometry( isAnImageGeometry );
mitk::Geometry3D* geometry;
unsigned int s;
for ( s = 0; s < m_Slices; ++s )
{
geometry = m_Geometry2Ds[s];
if ( geometry!=NULL )
{
geometry->SetImageGeometry( isAnImageGeometry );
}
}
}
void
mitk::SlicedGeometry3D::ChangeImageGeometryConsideringOriginOffset( const bool isAnImageGeometry )
{
mitk::Geometry3D* geometry;
unsigned int s;
for ( s = 0; s < m_Slices; ++s )
{
geometry = m_Geometry2Ds[s];
if ( geometry!=NULL )
{
geometry->ChangeImageGeometryConsideringOriginOffset( isAnImageGeometry );
}
}
Superclass::ChangeImageGeometryConsideringOriginOffset( isAnImageGeometry );
}
bool
mitk::SlicedGeometry3D::IsValidSlice( int s ) const
{
return ((s >= 0) && (s < (int)m_Slices));
}
void
mitk::SlicedGeometry3D::SetReferenceGeometry( Geometry3D *referenceGeometry )
{
m_ReferenceGeometry = referenceGeometry;
std::vector<Geometry2D::Pointer>::iterator it;
for ( it = m_Geometry2Ds.begin(); it != m_Geometry2Ds.end(); ++it )
{
(*it)->SetReferenceGeometry( referenceGeometry );
}
}
void
mitk::SlicedGeometry3D::SetSpacing( const mitk::Vector3D &aSpacing )
{
bool hasEvenlySpacedPlaneGeometry = false;
mitk::Point3D origin;
mitk::Vector3D rightDV, bottomDV;
BoundingBox::BoundsArrayType bounds;
assert(aSpacing[0]>0 && aSpacing[1]>0 && aSpacing[2]>0);
// In case of evenly-spaced data: re-initialize instances of Geometry2D,
// since the spacing influences them
if ((m_EvenlySpaced) && (m_Geometry2Ds.size() > 0))
{
mitk::Geometry2D::ConstPointer firstGeometry =
m_Geometry2Ds[0].GetPointer();
const PlaneGeometry *planeGeometry =
dynamic_cast< const PlaneGeometry * >( firstGeometry.GetPointer() );
if (planeGeometry != NULL )
{
this->WorldToIndex( planeGeometry->GetOrigin(), origin );
this->WorldToIndex( planeGeometry->GetAxisVector(0), rightDV );
this->WorldToIndex( planeGeometry->GetAxisVector(1), bottomDV );
bounds = planeGeometry->GetBounds();
hasEvenlySpacedPlaneGeometry = true;
}
}
Superclass::SetSpacing(aSpacing);
mitk::Geometry2D::Pointer firstGeometry;
// In case of evenly-spaced data: re-initialize instances of Geometry2D,
// since the spacing influences them
if ( hasEvenlySpacedPlaneGeometry )
{
//create planeGeometry according to new spacing
this->IndexToWorld( origin, origin );
this->IndexToWorld( rightDV, rightDV );
this->IndexToWorld( bottomDV, bottomDV );
mitk::PlaneGeometry::Pointer planeGeometry = mitk::PlaneGeometry::New();
planeGeometry->SetImageGeometry( this->GetImageGeometry() );
planeGeometry->SetReferenceGeometry( m_ReferenceGeometry );
planeGeometry->InitializeStandardPlane(
rightDV.Get_vnl_vector(), bottomDV.Get_vnl_vector(), &m_Spacing );
planeGeometry->SetOrigin(origin);
planeGeometry->SetBounds(bounds);
firstGeometry = planeGeometry;
}
else if ( (m_EvenlySpaced) && (m_Geometry2Ds.size() > 0) )
{
firstGeometry = m_Geometry2Ds[0].GetPointer();
}
//clear and reserve
Geometry2D::Pointer gnull=NULL;
m_Geometry2Ds.assign(m_Slices, gnull);
if ( m_Slices > 0 )
{
m_Geometry2Ds[0] = firstGeometry;
}
this->Modified();
}
void
mitk::SlicedGeometry3D
::SetSliceNavigationController( SliceNavigationController *snc )
{
m_SliceNavigationController = snc;
}
mitk::SliceNavigationController *
mitk::SlicedGeometry3D::GetSliceNavigationController()
{
return m_SliceNavigationController;
}
void
mitk::SlicedGeometry3D::SetEvenlySpaced(bool on)
{
if(m_EvenlySpaced!=on)
{
m_EvenlySpaced=on;
this->Modified();
}
}
void
mitk::SlicedGeometry3D
::SetDirectionVector( const mitk::Vector3D& directionVector )
{
Vector3D diff = m_DirectionVector - directionVector;
if ( (m_DirectionVector.GetSquaredNorm() == 0.0)
|| (diff.GetNorm() >= vnl_math::float_eps) )
{
m_DirectionVector = directionVector;
m_DirectionVector.Normalize();
this->Modified();
}
}
void
mitk::SlicedGeometry3D::SetTimeBounds( const mitk::TimeBounds& timebounds )
{
Superclass::SetTimeBounds( timebounds );
unsigned int s;
for ( s = 0; s < m_Slices; ++s )
{
if(m_Geometry2Ds[s].IsNotNull())
{
m_Geometry2Ds[s]->SetTimeBounds( timebounds );
}
}
m_TimeBounds = timebounds;
}
mitk::AffineGeometryFrame3D::Pointer
mitk::SlicedGeometry3D::Clone() const
{
- Self::Pointer newGeometry = Self::New();
- newGeometry->Initialize(m_Slices);
- InitializeGeometry(newGeometry);
+ Self::Pointer newGeometry = new SlicedGeometry3D(*this);
+ newGeometry->UnRegister();
return newGeometry.GetPointer();
}
-
-void
-mitk::SlicedGeometry3D::InitializeGeometry( Self *newGeometry ) const
-{
- Superclass::InitializeGeometry( newGeometry );
-
- newGeometry->SetEvenlySpaced( m_EvenlySpaced );
- newGeometry->SetSpacing( this->GetSpacing() );
- newGeometry->SetDirectionVector( this->GetDirectionVector() );
-
- newGeometry->SetSliceNavigationController( m_SliceNavigationController );
- newGeometry->m_ReferenceGeometry = m_ReferenceGeometry;
-
- if ( m_EvenlySpaced )
- {
- AffineGeometryFrame3D::Pointer geometry = m_Geometry2Ds[0]->Clone();
- Geometry2D* geometry2D = dynamic_cast<Geometry2D*>(geometry.GetPointer());
- assert(geometry2D!=NULL);
- newGeometry->SetGeometry2D(geometry2D, 0);
- }
- else
- {
- unsigned int s;
- for ( s = 0; s < m_Slices; ++s )
- {
- if ( m_Geometry2Ds[s].IsNull() )
- {
- assert(m_EvenlySpaced);
- }
- else
- {
- AffineGeometryFrame3D::Pointer geometry = m_Geometry2Ds[s]->Clone();
- Geometry2D* geometry2D = dynamic_cast<Geometry2D*>(geometry.GetPointer());
- assert(geometry2D!=NULL);
- newGeometry->SetGeometry2D(geometry2D, s);
- }
- }
- }
-}
-
-
void
mitk::SlicedGeometry3D::PrintSelf( std::ostream& os, itk::Indent indent ) const
{
Superclass::PrintSelf(os,indent);
os << indent << " EvenlySpaced: " << m_EvenlySpaced << std::endl;
if ( m_EvenlySpaced )
{
os << indent << " DirectionVector: " << m_DirectionVector << std::endl;
}
os << indent << " Slices: " << m_Slices << std::endl;
os << std::endl;
os << indent << " GetGeometry2D(0): ";
if ( this->GetGeometry2D(0) == NULL )
{
os << "NULL" << std::endl;
}
else
{
this->GetGeometry2D(0)->Print(os, indent);
}
}
void
mitk::SlicedGeometry3D::ExecuteOperation(Operation* operation)
{
switch ( operation->GetOperationType() )
{
case OpNOTHING:
break;
case OpROTATE:
if ( m_EvenlySpaced )
{
// Need a reference frame to align the rotation
if ( m_ReferenceGeometry )
{
// Clear all generated geometries and then rotate only the first slice.
// The other slices will be re-generated on demand
// Save first slice
Geometry2D::Pointer geometry2D = m_Geometry2Ds[0];
RotationOperation *rotOp = dynamic_cast< RotationOperation * >( operation );
// Generate a RotationOperation using the dataset center instead of
// the supplied rotation center. This is necessary so that the rotated
// zero-plane does not shift away. The supplied center is instead used
// to adjust the slice stack afterwards.
Point3D center = m_ReferenceGeometry->GetCenter();
RotationOperation centeredRotation(
rotOp->GetOperationType(),
center,
rotOp->GetVectorOfRotation(),
rotOp->GetAngleOfRotation()
);
// Rotate first slice
geometry2D->ExecuteOperation( &centeredRotation );
// Clear the slice stack and adjust it according to the center of
// the dataset and the supplied rotation center (see documentation of
// ReinitializePlanes)
this->ReinitializePlanes( center, rotOp->GetCenterOfRotation() );
if ( m_SliceNavigationController )
{
m_SliceNavigationController->SelectSliceByPoint(
rotOp->GetCenterOfRotation() );
m_SliceNavigationController->AdjustSliceStepperRange();
}
Geometry3D::ExecuteOperation( &centeredRotation );
}
}
else
{
// Reach through to all slices
for (std::vector<Geometry2D::Pointer>::iterator iter = m_Geometry2Ds.begin();
iter != m_Geometry2Ds.end();
++iter)
{
(*iter)->ExecuteOperation(operation);
}
}
break;
case OpORIENT:
if ( m_EvenlySpaced )
{
// Save first slice
Geometry2D::Pointer geometry2D = m_Geometry2Ds[0];
PlaneGeometry *planeGeometry = dynamic_cast< PlaneGeometry * >(
geometry2D.GetPointer() );
PlaneOperation *planeOp = dynamic_cast< PlaneOperation * >( operation );
// Need a PlaneGeometry, a PlaneOperation and a reference frame to
// carry out the re-orientation
if ( m_ReferenceGeometry && planeGeometry && planeOp )
{
// Clear all generated geometries and then rotate only the first slice.
// The other slices will be re-generated on demand
// Generate a RotationOperation by calculating the angle between
// the current and the requested slice orientation
Point3D center = m_ReferenceGeometry->GetCenter();
const mitk::Vector3D &currentNormal = planeGeometry->GetNormal();
const mitk::Vector3D &newNormal = planeOp->GetNormal();
Vector3D rotationAxis = itk::CrossProduct( newNormal, currentNormal );
vtkFloatingPointType rotationAngle = - atan2(
(double) rotationAxis.GetNorm(),
(double) (newNormal * currentNormal) );
rotationAngle *= 180.0 / vnl_math::pi;
RotationOperation centeredRotation(
mitk::OpROTATE,
center,
rotationAxis,
rotationAngle
);
// Rotate first slice
geometry2D->ExecuteOperation( &centeredRotation );
// Clear the slice stack and adjust it according to the center of
// rotation and plane position (see documentation of ReinitializePlanes)
this->ReinitializePlanes( center, planeOp->GetPoint() );
if ( m_SliceNavigationController )
{
m_SliceNavigationController->SelectSliceByPoint( planeOp->GetPoint() );
m_SliceNavigationController->AdjustSliceStepperRange();
}
Geometry3D::ExecuteOperation( &centeredRotation );
}
}
else
{
// Reach through to all slices
for (std::vector<Geometry2D::Pointer>::iterator iter = m_Geometry2Ds.begin();
iter != m_Geometry2Ds.end();
++iter)
{
(*iter)->ExecuteOperation(operation);
}
}
break;
}
this->Modified();
}
diff --git a/Core/Code/DataManagement/mitkSlicedGeometry3D.h b/Core/Code/DataManagement/mitkSlicedGeometry3D.h
index 16f347797e..d3c5ae5580 100644
--- a/Core/Code/DataManagement/mitkSlicedGeometry3D.h
+++ b/Core/Code/DataManagement/mitkSlicedGeometry3D.h
@@ -1,324 +1,323 @@
/*=========================================================================
Program: Medical Imaging & Interaction Toolkit
Language: C++
Date: $Date$
Version: $Revision$
Copyright (c) German Cancer Research Center, Division of Medical and
Biological Informatics. All rights reserved.
See MITKCopyright.txt or http://www.mitk.org/copyright.html for details.
This software is distributed WITHOUT ANY WARRANTY; without even
the implied warranty of MERCHANTABILITY or FITNESS FOR A PARTICULAR
PURPOSE. See the above copyright notices for more information.
=========================================================================*/
#ifndef MITKSLICEDGEOMETRY3D_H_HEADER_INCLUDED_C1EBD0AD
#define MITKSLICEDGEOMETRY3D_H_HEADER_INCLUDED_C1EBD0AD
#include "mitkGeometry3D.h"
#include "mitkPlaneGeometry.h"
namespace mitk {
class SliceNavigationController;
class NavigationController;
/** \brief Describes the geometry of a data object consisting of slices.
*
* A Geometry2D can be requested for each slice. In the case of
* \em evenly-spaced, \em plane geometries (m_EvenlySpaced==true),
* only the 2D-geometry of the first slice has to be set (to an instance of
* PlaneGeometry). The 2D geometries of the other slices are calculated
* by shifting the first slice in the direction m_DirectionVector by
* m_Spacing.z * sliceNumber. The m_Spacing member (which is only
* relevant in the case m_EvenlySpaced==true) descibes the size of a voxel
* (in mm), i.e., m_Spacing.x is the voxel width in the x-direction of the
* plane. It is derived from the reference geometry of this SlicedGeometry3D,
* which usually would be the global geometry describing how datasets are to
* be resliced.
*
* By default, slices are oriented in the direction of one of the main axes
* (x, y, z). However, by means of rotation, it is possible to realign the
* slices in any possible direction. In case of an inclined plane, the spacing
* is derived as a product of the (regular) geometry spacing and the direction
* vector of the plane.
*
* SlicedGeometry3D and the associated Geometry2Ds have to be initialized in
* the method GenerateOutputInformation() of BaseProcess (or CopyInformation /
* UpdateOutputInformation of BaseData, if possible, e.g., by analyzing pic
* tags in Image) subclasses. See also
*
* \sa itk::ProcessObject::GenerateOutputInformation(),
* \sa itk::DataObject::CopyInformation() and
* \a itk::DataObject::UpdateOutputInformation().
*
* Rule: everything is in mm (or ms for temporal information) if not
* stated otherwise.
*
* \warning The hull (i.e., transform, bounding-box and
* time-bounds) is only guaranteed to be up-to-date after calling
* UpdateInformation().
*
* \ingroup Geometry
*/
class MITK_CORE_EXPORT SlicedGeometry3D : public mitk::Geometry3D
{
public:
mitkClassMacro(SlicedGeometry3D, Geometry3D);
/** Method for creation through the object factory. */
itkNewMacro(Self);
/**
* \brief Returns the Geometry2D of the slice (\a s).
*
* If (a) m_EvenlySpaced==true, (b) we don't have a Geometry2D stored
* for the requested slice, and (c) the first slice (s=0)
* is a PlaneGeometry instance, then we calculate the geometry of the
* requested as the plane of the first slice shifted by m_Spacing[3]*s
* in the direction of m_DirectionVector.
*
* \warning The Geometry2Ds are not necessarily up-to-date and not even
* initialized.
*
* The Geometry2Ds have to be initialized in the method
* GenerateOutputInformation() of BaseProcess (or CopyInformation /
* UpdateOutputInformation of BaseData, if possible, e.g., by analyzing
* pic tags in Image) subclasses. See also
*
* \sa itk::ProcessObject::GenerateOutputInformation(),
* \sa itk::DataObject::CopyInformation() and
* \sa itk::DataObject::UpdateOutputInformation().
*/
virtual mitk::Geometry2D* GetGeometry2D( int s ) const;
/**
* \brief Set Geometry2D of slice \a s.
*/
virtual bool SetGeometry2D( mitk::Geometry2D *geometry2D, int s );
//##Documentation
//## @brief When switching from an Image Geometry to a normal Geometry (and the other way around), you have to change the origin as well (See Geometry Documentation)! This function will change the "isImageGeometry" bool flag and changes the origin respectively.
virtual void ChangeImageGeometryConsideringOriginOffset( const bool isAnImageGeometry );
virtual void SetTimeBounds( const mitk::TimeBounds& timebounds );
virtual const mitk::BoundingBox* GetBoundingBox() const;
/**
* \brief Get the number of slices
*/
itkGetConstMacro( Slices, unsigned int );
/**
* \brief Check whether a slice exists
*/
virtual bool IsValidSlice( int s = 0 ) const;
virtual void SetReferenceGeometry( Geometry3D *referenceGeometry );
/**
* \brief Set the spacing (m_Spacing), in direction of the plane normal.
*
* INTERNAL METHOD.
*/
virtual void SetSpacing( const mitk::Vector3D &aSpacing );
/**
* \brief Set the SliceNavigationController corresponding to this sliced
* geometry.
*
* The SNC needs to be informed when the number of slices in the geometry
* changes, which can occur whenthe slices are re-oriented by rotation.
*/
virtual void SetSliceNavigationController(
mitk::SliceNavigationController *snc );
mitk::SliceNavigationController *GetSliceNavigationController();
/**
* \brief Set/Get whether the SlicedGeometry3D is evenly-spaced
* (m_EvenlySpaced)
*
* If (a) m_EvenlySpaced==true, (b) we don't have a Geometry2D stored for
* the requested slice, and (c) the first slice (s=0) is a PlaneGeometry
* instance, then we calculate the geometry of the requested as the plane
* of the first slice shifted by m_Spacing.z * s in the direction of
* m_DirectionVector.
*
* \sa GetGeometry2D
*/
itkGetConstMacro(EvenlySpaced, bool);
virtual void SetEvenlySpaced(bool on = true);
/**
* \brief Set/Get the vector between slices for the evenly-spaced case
* (m_EvenlySpaced==true).
*
* If the direction-vector is (0,0,0) (the default) and the first
* 2D geometry is a PlaneGeometry, then the direction-vector will be
* calculated from the plane normal.
*
* \sa m_DirectionVector
*/
virtual void SetDirectionVector(const mitk::Vector3D& directionVector);
itkGetConstMacro(DirectionVector, const mitk::Vector3D&);
virtual AffineGeometryFrame3D::Pointer Clone() const;
static const std::string SLICES;
const static std::string DIRECTION_VECTOR;
const static std::string EVENLY_SPACED;
/**
* \brief Tell this instance how many Geometry2Ds it shall manage. Bounding
* box and the Geometry2Ds must be set additionally by calling the respective
* methods!
*
* \warning Bounding box and the 2D-geometries must be set additionally: use
* SetBounds(), SetGeometry().
*/
- virtual void Initialize( unsigned int slices );
+ virtual void InitializeSlicedGeometry( unsigned int slices );
/**
* \brief Completely initialize this instance as evenly-spaced with slices
* parallel to the provided Geometry2D that is used as the first slice and
* for spacing calculation.
*
* Initializes the bounding box according to the width/height of the
* Geometry2D and \a slices. The spacing is calculated from the Geometry2D.
*/
virtual void InitializeEvenlySpaced( mitk::Geometry2D *geometry2D,
unsigned int slices, bool flipped=false );
/**
* \brief Completely initialize this instance as evenly-spaced with slices
* parallel to the provided Geometry2D that is used as the first slice and
* for spacing calculation (except z-spacing).
*
* Initializes the bounding box according to the width/height of the
* Geometry2D and \a slices. The x-/y-spacing is calculated from the
* Geometry2D.
*/
virtual void InitializeEvenlySpaced( mitk::Geometry2D *geometry2D,
mitk::ScalarType zSpacing, unsigned int slices, bool flipped=false );
/**
* \brief Completely initialize this instance as evenly-spaced plane slices
* parallel to a side of the provided Geometry3D and using its spacing
* information.
*
* Initializes the bounding box according to the width/height of the
* Geometry3D and the number of slices according to
* Geometry3D::GetExtent(2).
*
* \param planeorientation side parallel to which the slices will be oriented
* \param top if \a true, create plane at top, otherwise at bottom
* (for PlaneOrientation Transversal, for other plane locations respectively)
* \param frontside defines the side of the plane (the definition of
* front/back is somewhat arbitrary)
*
* \param rotate rotates the plane by 180 degree around its normal (the
* definition of rotated vs not rotated is somewhat arbitrary)
*/
virtual void InitializePlanes( const mitk::Geometry3D *geometry3D,
mitk::PlaneGeometry::PlaneOrientation planeorientation, bool top=true,
bool frontside=true, bool rotated=false );
virtual void SetImageGeometry(const bool isAnImageGeometry);
virtual void ExecuteOperation(Operation* operation);
protected:
SlicedGeometry3D();
+ SlicedGeometry3D(const SlicedGeometry3D& other);
+
virtual ~SlicedGeometry3D();
/**
* Reinitialize plane stack after rotation. More precisely, the first plane
* of the stack needs to spatially aligned, in two respects:
*
* 1. Re-alignment with respect to the dataset center; this is necessary
* since the distance from the first palne to the center could otherwise
* continuously decrease or increase.
* 2. Re-alignment with respect to a given reference point; the reference
* point is a location which the user wants to be exactly touched by one
* plane of the plane stack. The first plane is minimally shifted to
* ensure this touching. Usually, the reference point would be the
* point around which the geometry is rotated.
*/
virtual void ReinitializePlanes( const Point3D &center,
const Point3D &referencePoint );
ScalarType GetLargestExtent( const Geometry3D *geometry );
-
- virtual void InitializeGeometry(Self * newGeometry) const;
-
void PrintSelf(std::ostream& os, itk::Indent indent) const;
/** Calculate "directed spacing", i.e. the spacing in directions
* non-orthogonal to the coordinate axes. This is done via the
* ellipsoid equation.
*/
double CalculateSpacing( const mitk::Vector3D &direction ) const;
/** The extent of the slice stack, i.e. the number of slices, depends on the
* plane normal. For rotated geometries, the geometry's transform needs to
* be accounted in this calculation.
*/
mitk::Vector3D AdjustNormal( const mitk::Vector3D &normal ) const;
/**
* Container for the 2D-geometries contained within this SliceGeometry3D.
*/
mutable std::vector<Geometry2D::Pointer> m_Geometry2Ds;
/**
* If (a) m_EvenlySpaced==true, (b) we don't have a Geometry2D stored
* for the requested slice, and (c) the first slice (s=0)
* is a PlaneGeometry instance, then we calculate the geometry of the
* requested as the plane of the first slice shifted by m_Spacing.z*s
* in the direction of m_DirectionVector.
*
* \sa GetGeometry2D
*/
bool m_EvenlySpaced;
/**
* Vector between slices for the evenly-spaced case (m_EvenlySpaced==true).
* If the direction-vector is (0,0,0) (the default) and the first
* 2D geometry is a PlaneGeometry, then the direction-vector will be
* calculated from the plane normal.
*/
mutable mitk::Vector3D m_DirectionVector;
/** Number of slices this SliceGeometry3D is descibing. */
unsigned int m_Slices;
/** Underlying Geometry3D for this SlicedGeometry */
mitk::Geometry3D *m_ReferenceGeometry;
/** SNC correcsponding to this geometry; used to reflect changes in the
* number of slices due to rotation. */
//mitk::NavigationController *m_NavigationController;
mitk::SliceNavigationController *m_SliceNavigationController;
};
} // namespace mitk
#endif /* MITKSLICEDGEOMETRY3D_H_HEADER_INCLUDED_C1EBD0AD */
diff --git a/Core/Code/DataManagement/mitkSurface.cpp b/Core/Code/DataManagement/mitkSurface.cpp
index 45809a5d8f..c769ff7c15 100644
--- a/Core/Code/DataManagement/mitkSurface.cpp
+++ b/Core/Code/DataManagement/mitkSurface.cpp
@@ -1,384 +1,384 @@
/*=========================================================================
Program: Medical Imaging & Interaction Toolkit
Language: C++
Date: $Date$
Version: $Revision$
Copyright (c) German Cancer Research Center, Division of Medical and
Biological Informatics. All rights reserved.
See MITKCopyright.txt or http://www.mitk.org/copyright.html for details.
This software is distributed WITHOUT ANY WARRANTY; without even
the implied warranty of MERCHANTABILITY or FITNESS FOR A PARTICULAR
PURPOSE. See the above copyright notices for more information.
=========================================================================*/
#include "mitkSurface.h"
#include "mitkInteractionConst.h"
#include "mitkSurfaceOperation.h"
#include <vtkPolyData.h>
#include "vtkSmartPointer.h"
#include <itkSmartPointerForwardReference.txx>
mitk::Surface::Surface() :
m_CalculateBoundingBox( false )
{
this->InitializeEmpty();
}
mitk::Surface::Surface(const mitk::Surface& other) : BaseData(other),
m_CalculateBoundingBox(other.m_CalculateBoundingBox),
m_RequestedRegion(other.m_RequestedRegion),
m_LargestPossibleRegion(other.m_LargestPossibleRegion)
{
if(other.m_PolyDataSeries.at(0) != NULL)
{
m_PolyDataSeries = std::vector<vtkPolyData*>();
for ( VTKPolyDataSeries::const_iterator it = other.m_PolyDataSeries.begin(); it != other.m_PolyDataSeries.end(); ++it )
{
vtkSmartPointer<vtkPolyData> poly = vtkSmartPointer<vtkPolyData>::New();
poly->DeepCopy(*it);
m_PolyDataSeries.push_back(poly.GetPointer());
}
}
else
{
this->InitializeEmpty();
}
}
mitk::Surface::~Surface()
{
this->ClearData();
}
void mitk::Surface::ClearData()
{
for ( VTKPolyDataSeries::iterator it = m_PolyDataSeries.begin(); it != m_PolyDataSeries.end(); ++it )
{
if ( ( *it ) != NULL )
( *it )->Delete();
}
m_PolyDataSeries.clear();
Superclass::ClearData();
}
void mitk::Surface::InitializeEmpty()
{
vtkPolyData* pdnull = NULL;
m_PolyDataSeries.resize( 1, pdnull );
Superclass::InitializeTimeSlicedGeometry(1);
m_Initialized = true;
}
void mitk::Surface::SetVtkPolyData( vtkPolyData* polydata, unsigned int t )
{
// Adapt the size of the data vector if necessary
this->Expand( t+1 );
if(m_PolyDataSeries[ t ] != NULL)
{
if ( m_PolyDataSeries[ t ] == polydata )
return;
// we do not need the reference on the object any longer
m_PolyDataSeries[ t ]->Delete();
}
m_PolyDataSeries[ t ] = polydata;
// call m_VtkPolyData->Register(NULL) to tell
// the reference counting that we want to keep a
// reference on the object
if(m_PolyDataSeries[ t ] != NULL)
{
m_PolyDataSeries[ t ]->Register( NULL );
}
this->Modified();
m_CalculateBoundingBox = true;
}
-bool mitk::Surface::IsEmpty(unsigned int t) const
+bool mitk::Surface::IsEmptyTimeStep(unsigned int t) const
{
if(!IsInitialized())
return false;
vtkPolyData* polydata = const_cast<Surface*>(this)->GetVtkPolyData(t);
return
(polydata == NULL) ||
(
(polydata->GetNumberOfVerts() <= 0) &&
(polydata->GetNumberOfPolys() <= 0) &&
(polydata->GetNumberOfStrips() <= 0) &&
(polydata->GetNumberOfLines() <= 0)
);
}
vtkPolyData* mitk::Surface::GetVtkPolyData( unsigned int t )
{
if ( t < m_PolyDataSeries.size() )
{
vtkPolyData* polydata = m_PolyDataSeries[ t ];
if((polydata==NULL) && (GetSource().GetPointer()!=NULL))
{
RegionType requestedregion;
requestedregion.SetIndex(3, t);
requestedregion.SetSize(3, 1);
SetRequestedRegion(&requestedregion);
GetSource()->Update();
}
polydata = m_PolyDataSeries[ t ];
return polydata;
}
else
return NULL;
}
void mitk::Surface::UpdateOutputInformation()
{
if ( this->GetSource() )
{
this->GetSource()->UpdateOutputInformation();
}
if ( ( m_CalculateBoundingBox ) && ( m_PolyDataSeries.size() > 0 ) )
CalculateBoundingBox();
else
GetTimeSlicedGeometry()->UpdateInformation();
}
void mitk::Surface::CalculateBoundingBox()
{
//
// first make sure, that the associated time sliced geometry has
// the same number of geometry 3d's as vtkPolyDatas are present
//
mitk::TimeSlicedGeometry* timeGeometry = GetTimeSlicedGeometry();
if ( timeGeometry->GetTimeSteps() != m_PolyDataSeries.size() )
{
itkExceptionMacro(<<"timeGeometry->GetTimeSteps() != m_PolyDataSeries.size() -- use Initialize(timeSteps) with correct number of timeSteps!");
}
//
// Iterate over the vtkPolyDatas and update the Geometry
// information of each of the items.
//
for ( unsigned int i = 0 ; i < m_PolyDataSeries.size() ; ++i )
{
vtkPolyData* polyData = m_PolyDataSeries[ i ];
vtkFloatingPointType bounds[ ] = {0.0, 0.0, 0.0, 0.0, 0.0, 0.0};
if ( ( polyData != NULL ) && ( polyData->GetNumberOfPoints() > 0 ) )
{
polyData->Update();
polyData->ComputeBounds();
polyData->GetBounds( bounds );
}
mitk::Geometry3D::Pointer g3d = timeGeometry->GetGeometry3D( i );
assert( g3d.IsNotNull() );
g3d->SetFloatBounds( bounds );
}
timeGeometry->UpdateInformation();
mitk::BoundingBox::Pointer bb = const_cast<mitk::BoundingBox*>( timeGeometry->GetBoundingBox() );
itkDebugMacro( << "boundingbox min: "<< bb->GetMinimum());
itkDebugMacro( << "boundingbox max: "<< bb->GetMaximum());
m_CalculateBoundingBox = false;
}
void mitk::Surface::SetRequestedRegionToLargestPossibleRegion()
{
m_RequestedRegion = GetLargestPossibleRegion();
}
bool mitk::Surface::RequestedRegionIsOutsideOfTheBufferedRegion()
{
RegionType::IndexValueType end = m_RequestedRegion.GetIndex(3)+m_RequestedRegion.GetSize(3);
if(((RegionType::IndexValueType)m_PolyDataSeries.size())<end)
return true;
for( RegionType::IndexValueType t=m_RequestedRegion.GetIndex(3); t<end; ++t )
if(m_PolyDataSeries[t]==NULL)
return true;
return false;
}
bool mitk::Surface::VerifyRequestedRegion()
{
if( (m_RequestedRegion.GetIndex(3)>=0) &&
(m_RequestedRegion.GetIndex(3)+m_RequestedRegion.GetSize(3)<=m_PolyDataSeries.size()) )
return true;
return false;
}
void mitk::Surface::SetRequestedRegion( itk::DataObject *data )
{
mitk::Surface *surfaceData;
surfaceData = dynamic_cast<mitk::Surface*>(data);
if (surfaceData)
{
m_RequestedRegion = surfaceData->GetRequestedRegion();
}
else
{
// pointer could not be cast back down
itkExceptionMacro( << "mitk::Surface::SetRequestedRegion(DataObject*) cannot cast " << typeid(data).name() << " to " << typeid(Surface*).name() );
}
}
void mitk::Surface::SetRequestedRegion(Surface::RegionType *region) //by arin
{
if(region!=NULL)
{
m_RequestedRegion = *region;
}
else
{
// pointer could not be cast back down
itkExceptionMacro( << "mitk::Surface::SetRequestedRegion(Surface::RegionType*) cannot cast " << typeid(region).name() << " to " << typeid(Surface*).name() );
}
}
void mitk::Surface::CopyInformation( const itk::DataObject * data)
{
Superclass::CopyInformation( data );
const mitk::Surface* surfaceData;
surfaceData = dynamic_cast<const mitk::Surface*>( data );
if ( surfaceData )
{
m_LargestPossibleRegion = surfaceData->GetLargestPossibleRegion();
}
else
{
// pointer could not be cast back down
itkExceptionMacro( << "mitk::Surface::CopyInformation(const DataObject *data) cannot cast " << typeid(data).name() << " to " << typeid(surfaceData).name() );
}
}
void mitk::Surface::Update()
{
if ( GetSource() == NULL )
{
for ( VTKPolyDataSeries::iterator it = m_PolyDataSeries.begin() ; it != m_PolyDataSeries.end() ; ++it )
{
if ( ( *it ) != NULL )
( *it )->Update();
}
}
Superclass::Update();
}
void mitk::Surface::Expand( unsigned int timeSteps )
{
// check if the vector is long enough to contain the new element
// at the given position. If not, expand it with sufficient zero-filled elements.
if ( timeSteps > m_PolyDataSeries.size() )
{
Superclass::Expand( timeSteps );
vtkPolyData* pdnull = NULL;
m_PolyDataSeries.resize( timeSteps, pdnull );
m_CalculateBoundingBox = true;
}
}
void mitk::Surface::ExecuteOperation(Operation *operation)
{
switch ( operation->GetOperationType() )
{
case OpSURFACECHANGED:
mitk::SurfaceOperation* surfOp = dynamic_cast<mitk::SurfaceOperation*>(operation);
if( ! surfOp ) break;
unsigned int time = surfOp->GetTimeStep();
if(m_PolyDataSeries[ time ] != NULL)
{
vtkPolyData* updatePoly = surfOp->GetVtkPolyData();
if( updatePoly ){
this->SetVtkPolyData( updatePoly, time );
this->CalculateBoundingBox();
}
}
break;
}
this->Modified();
}
unsigned int mitk::Surface::GetSizeOfPolyDataSeries() const
{
return m_PolyDataSeries.size();
}
void mitk::Surface::Graft( const DataObject* data )
{
const Self* surface;
try
{
surface = dynamic_cast<const Self*>( data );
}
catch(...)
{
itkExceptionMacro( << "mitk::Surface::Graft cannot cast "
<< typeid(data).name() << " to "
<< typeid(const Self *).name() );
return;
}
if(!surface)
{
// pointer could not be cast back down
itkExceptionMacro( << "mitk::Surface::Graft cannot cast "
<< typeid(data).name() << " to "
<< typeid(const Self *).name() );
return;
}
this->CopyInformation( data );
//clear list of PolyData's
m_PolyDataSeries.clear();
// do copy
for (unsigned int i=0; i<surface->GetSizeOfPolyDataSeries(); i++)
{
m_PolyDataSeries.push_back(vtkPolyData::New());
m_PolyDataSeries.back()->DeepCopy( const_cast<mitk::Surface*>(surface)->GetVtkPolyData( i ) );
//CopyStructure( const_cast<mitk::Surface*>(surface)->GetVtkPolyData( i ) );
}
}
void mitk::Surface::PrintSelf( std::ostream& os, itk::Indent indent ) const
{
Superclass::PrintSelf(os, indent);
os << indent << "\nNumber PolyDatas: " << m_PolyDataSeries.size() << "\n";
unsigned int count = 0;
for (VTKPolyDataSeries::const_iterator it = m_PolyDataSeries.begin(); it != m_PolyDataSeries.end(); ++it)
{
vtkPolyData* pd = *it;
if(pd != NULL)
{
os << "\n";
os << indent << "PolyData at time step " << count << ". \n";
os << indent << "Number of cells " << pd->GetNumberOfCells() << ": \n";
os << indent << "Number of points " << pd->GetNumberOfPoints() << ": \n\n";
os << indent << "VTKPolyData : \n";
pd->Print(os);
}
else
os << indent << "\nEmpty PolyData at time step " << count << ".\n";
count++;
}
-}
\ No newline at end of file
+}
diff --git a/Core/Code/DataManagement/mitkSurface.h b/Core/Code/DataManagement/mitkSurface.h
index 450183ac1a..7eeae09582 100644
--- a/Core/Code/DataManagement/mitkSurface.h
+++ b/Core/Code/DataManagement/mitkSurface.h
@@ -1,116 +1,116 @@
/*=========================================================================
Program: Medical Imaging & Interaction Toolkit
Language: C++
Date: $Date$
Version: $Revision$
Copyright (c) German Cancer Research Center, Division of Medical and
Biological Informatics. All rights reserved.
See MITKCopyright.txt or http://www.mitk.org/copyright.html for details.
This software is distributed WITHOUT ANY WARRANTY; without even
the implied warranty of MERCHANTABILITY or FITNESS FOR A PARTICULAR
PURPOSE. See the above copyright notices for more information.
=========================================================================*/
#ifndef MITKSURFACEDATA_H_HEADER_INCLUDED
#define MITKSURFACEDATA_H_HEADER_INCLUDED
#include "mitkBaseData.h"
#include "itkImageRegion.h"
class vtkPolyData;
namespace mitk {
//##Documentation
//## @brief Class for storing surfaces (vtkPolyData)
//## @ingroup Data
class MITK_CORE_EXPORT Surface : public BaseData
{
protected:
public:
// not yet the best chioce of a region-type for surfaces, but it works for the time being
typedef itk::ImageRegion< 5 > RegionType;
mitkClassMacro(Surface, BaseData);
itkNewMacro(Self);
mitkCloneMacro(Surface);
virtual void SetVtkPolyData(vtkPolyData* polydata, unsigned int t = 0);
virtual vtkPolyData* GetVtkPolyData(unsigned int t = 0);
virtual void UpdateOutputInformation();
virtual void SetRequestedRegionToLargestPossibleRegion();
virtual bool RequestedRegionIsOutsideOfTheBufferedRegion();
virtual bool VerifyRequestedRegion();
virtual void SetRequestedRegion(itk::DataObject *data);
virtual void SetRequestedRegion(Surface::RegionType *region);
virtual void CopyInformation(const itk::DataObject *data);
- virtual bool IsEmpty(unsigned int t) const;
+ virtual bool IsEmptyTimeStep(unsigned int t) const;
unsigned int GetSizeOfPolyDataSeries() const;
virtual void Update();
virtual void Expand( unsigned int timeSteps = 1 );
virtual void Graft( const DataObject* data );
const RegionType& GetLargestPossibleRegion() const
{
m_LargestPossibleRegion.SetIndex(3, 0);
m_LargestPossibleRegion.SetSize(3, GetTimeSlicedGeometry()->GetTimeSteps());
return m_LargestPossibleRegion;
}
//##Documentation
//## Get the region object that defines the size and starting index
//## for the region of the image requested (i.e., the region of the
//## image to be operated on by a filter).
virtual const RegionType& GetRequestedRegion() const
{
return m_RequestedRegion;
}
void CalculateBoundingBox();
virtual void PrintSelf( std::ostream& os, itk::Indent indent ) const;
virtual void ExecuteOperation(Operation *operation);
protected:
typedef std::vector< vtkPolyData* > VTKPolyDataSeries;
Surface();
Surface(const Surface& other);
virtual ~Surface();
virtual void ClearData();
virtual void InitializeEmpty();
//member variables
VTKPolyDataSeries m_PolyDataSeries; /// variable holds the poly datas of the surface
mutable RegionType m_LargestPossibleRegion; /// variable holds the largest possible region the surface is contained in
RegionType m_RequestedRegion;
bool m_CalculateBoundingBox; /// flag to calculate the bounding box
};
} // namespace mitk
#endif /* MITKSURFACEDATA_H_HEADER_INCLUDED */
diff --git a/Core/Code/DataManagement/mitkThinPlateSplineCurvedGeometry.cpp b/Core/Code/DataManagement/mitkThinPlateSplineCurvedGeometry.cpp
index a13b3d8699..d7f9d60d49 100644
--- a/Core/Code/DataManagement/mitkThinPlateSplineCurvedGeometry.cpp
+++ b/Core/Code/DataManagement/mitkThinPlateSplineCurvedGeometry.cpp
@@ -1,105 +1,103 @@
/*=========================================================================
Program: Medical Imaging & Interaction Toolkit
Language: C++
Date: $Date$
Version: $Revision$
Copyright (c) German Cancer Research Center, Division of Medical and
Biological Informatics. All rights reserved.
See MITKCopyright.txt or http://www.mitk.org/copyright.html for details.
This software is distributed WITHOUT ANY WARRANTY; without even
the implied warranty of MERCHANTABILITY or FITNESS FOR A PARTICULAR
PURPOSE. See the above copyright notices for more information.
=========================================================================*/
#include "mitkThinPlateSplineCurvedGeometry.h"
#include <vtkThinPlateSplineTransform.h>
#include <vtkPoints.h>
mitk::ThinPlateSplineCurvedGeometry::ThinPlateSplineCurvedGeometry()
{
m_InterpolatingAbstractTransform = m_ThinPlateSplineTransform = vtkThinPlateSplineTransform::New();
m_VtkTargetLandmarks = vtkPoints::New();
m_VtkProjectedLandmarks = vtkPoints::New();
m_ThinPlateSplineTransform->SetInverseIterations(5000);
}
+mitk::ThinPlateSplineCurvedGeometry::ThinPlateSplineCurvedGeometry(const ThinPlateSplineCurvedGeometry& other ) : Superclass(other)
+{
+ this->SetSigma(other.GetSigma());
+}
+
mitk::ThinPlateSplineCurvedGeometry::~ThinPlateSplineCurvedGeometry()
{
// don't need to delete m_ThinPlateSplineTransform, because it is
// the same as m_InterpolatingAbstractTransform, which will be deleted
// by the superclass.
if(m_VtkTargetLandmarks!=NULL)
m_VtkTargetLandmarks->Delete();
if(m_VtkProjectedLandmarks!=NULL)
m_VtkProjectedLandmarks->Delete();
}
bool mitk::ThinPlateSplineCurvedGeometry::IsValid() const
{
return m_TargetLandmarks.IsNotNull() && (m_TargetLandmarks->Size() >= 3) && m_LandmarkProjector.IsNotNull();
}
void mitk::ThinPlateSplineCurvedGeometry::SetSigma(float sigma)
{
m_ThinPlateSplineTransform->SetSigma(sigma);
}
float mitk::ThinPlateSplineCurvedGeometry::GetSigma() const
{
return m_ThinPlateSplineTransform->GetSigma();
}
void mitk::ThinPlateSplineCurvedGeometry::ComputeGeometry()
{
Superclass::ComputeGeometry();
const mitk::PointSet::DataType::PointsContainer *finalTargetLandmarks, *projectedTargetLandmarks;
finalTargetLandmarks = m_LandmarkProjector->GetFinalTargetLandmarks();
projectedTargetLandmarks = m_LandmarkProjector->GetProjectedLandmarks();
mitk::PointSet::DataType::PointsContainer::ConstIterator targetIt, projectedIt;
targetIt = finalTargetLandmarks->Begin();
projectedIt = projectedTargetLandmarks->Begin();
//initialize Thin-Plate-Spline
m_VtkTargetLandmarks->Reset();
m_VtkProjectedLandmarks->Reset();
vtkIdType id;
int size=finalTargetLandmarks->Size();
for(id=0; id < size; ++id, ++targetIt, ++projectedIt)
{
const mitk::PointSet::PointType& target = targetIt->Value();
m_VtkTargetLandmarks->InsertPoint(id, target[0], target[1], target[2]);
const mitk::PointSet::PointType& projected = projectedIt->Value();
m_VtkProjectedLandmarks->InsertPoint(id, projected[0], projected[1], projected[2]);
}
m_VtkTargetLandmarks->Modified();
m_VtkProjectedLandmarks->Modified();
m_ThinPlateSplineTransform->SetSourceLandmarks(m_VtkProjectedLandmarks);
m_ThinPlateSplineTransform->SetTargetLandmarks(m_VtkTargetLandmarks);
}
mitk::AffineGeometryFrame3D::Pointer mitk::ThinPlateSplineCurvedGeometry::Clone() const
{
- Self::Pointer newGeometry = Self::New();
- newGeometry->Initialize();
- InitializeGeometry(newGeometry);
- return newGeometry.GetPointer();
-}
-
-void mitk::ThinPlateSplineCurvedGeometry::InitializeGeometry(Self * newGeometry) const
-{
- newGeometry->SetSigma(GetSigma());
- Superclass::InitializeGeometry(newGeometry);
+ mitk::AffineGeometryFrame3D::Pointer newGeometry = new Self(*this);
+ newGeometry->UnRegister();
+ return newGeometry.GetPointer();
}
diff --git a/Core/Code/DataManagement/mitkThinPlateSplineCurvedGeometry.h b/Core/Code/DataManagement/mitkThinPlateSplineCurvedGeometry.h
index 33cbad9374..ecf988245b 100644
--- a/Core/Code/DataManagement/mitkThinPlateSplineCurvedGeometry.h
+++ b/Core/Code/DataManagement/mitkThinPlateSplineCurvedGeometry.h
@@ -1,68 +1,69 @@
/*=========================================================================
Program: Medical Imaging & Interaction Toolkit
Language: C++
Date: $Date$
Version: $Revision$
Copyright (c) German Cancer Research Center, Division of Medical and
Biological Informatics. All rights reserved.
See MITKCopyright.txt or http://www.mitk.org/copyright.html for details.
This software is distributed WITHOUT ANY WARRANTY; without even
the implied warranty of MERCHANTABILITY or FITNESS FOR A PARTICULAR
PURPOSE. See the above copyright notices for more information.
=========================================================================*/
#ifndef MITKTHINPLATESPLINECURVEDGEOMETRY_H_HEADER_INCLUDED_C1C68A2C
#define MITKTHINPLATESPLINECURVEDGEOMETRY_H_HEADER_INCLUDED_C1C68A2C
#include "mitkLandmarkProjectorBasedCurvedGeometry.h"
class vtkPoints;
class vtkThinPlateSplineTransform;
namespace mitk {
//##Documentation
//## @brief Thin-plate-spline-based landmark-based curved geometry
//##
//## @ingroup Geometry
class MITK_CORE_EXPORT ThinPlateSplineCurvedGeometry : public LandmarkProjectorBasedCurvedGeometry
{
public:
mitkClassMacro(ThinPlateSplineCurvedGeometry, LandmarkProjectorBasedCurvedGeometry);
itkNewMacro(Self);
virtual void ComputeGeometry();
virtual AffineGeometryFrame3D::Pointer Clone() const;
vtkThinPlateSplineTransform* GetThinPlateSplineTransform() const
{
return m_ThinPlateSplineTransform;
}
virtual void SetSigma(float sigma);
virtual float GetSigma() const;
virtual bool IsValid() const;
protected:
ThinPlateSplineCurvedGeometry();
+ ThinPlateSplineCurvedGeometry(const ThinPlateSplineCurvedGeometry& other );
+
virtual ~ThinPlateSplineCurvedGeometry();
vtkThinPlateSplineTransform* m_ThinPlateSplineTransform;
vtkPoints* m_VtkTargetLandmarks;
vtkPoints* m_VtkProjectedLandmarks;
- void InitializeGeometry(Self * newGeometry) const;
};
} // namespace mitk
#endif /* MITKTHINPLATESPLINECURVEDGEOMETRY_H_HEADER_INCLUDED_C1C68A2C */
diff --git a/Core/Code/DataManagement/mitkTimeSlicedGeometry.cpp b/Core/Code/DataManagement/mitkTimeSlicedGeometry.cpp
index d4bfdc26ba..a80a942880 100644
--- a/Core/Code/DataManagement/mitkTimeSlicedGeometry.cpp
+++ b/Core/Code/DataManagement/mitkTimeSlicedGeometry.cpp
@@ -1,426 +1,417 @@
/*=========================================================================
Program: Medical Imaging & Interaction Toolkit
Language: C++
Date: $Date$
Version: $Revision$
Copyright (c) German Cancer Research Center, Division of Medical and
Biological Informatics. All rights reserved.
See MITKCopyright.txt or http://www.mitk.org/copyright.html for details.
This software is distributed WITHOUT ANY WARRANTY; without even
the implied warranty of MERCHANTABILITY or FITNESS FOR A PARTICULAR
PURPOSE. See the above copyright notices for more information.
=========================================================================*/
#include "mitkTimeSlicedGeometry.h"
void mitk::TimeSlicedGeometry::UpdateInformation()
{
if(m_TimeSteps==0) return;
unsigned long maxModifiedTime = 0, curModifiedTime;
mitk::ScalarType stmin, stmax;
stmin= ScalarTypeNumericTraits::NonpositiveMin();
stmax= ScalarTypeNumericTraits::max();
TimeBounds timeBounds;
timeBounds[0]=stmax; timeBounds[1]=stmin;
mitk::BoundingBox::Pointer boundingBox=mitk::BoundingBox::New();
mitk::BoundingBox::PointsContainer::Pointer pointscontainer=mitk::BoundingBox::PointsContainer::New();
unsigned int t;
mitk::Geometry3D* geometry3d;
mitk::BoundingBox::ConstPointer nextBoundingBox;
mitk::BoundingBox::PointIdentifier pointid=0;
// Need to check for zero bounding boxes
mitk::ScalarType zeropoint[]={0,0,0,0,0,0};
BoundingBox::BoundsArrayType itkBoundsZero(zeropoint);
for(t=0; t < m_TimeSteps; ++t)
{
geometry3d = GetGeometry3D(t);
assert(geometry3d!=NULL);
curModifiedTime = geometry3d->GetMTime();
if(maxModifiedTime < curModifiedTime)
maxModifiedTime = curModifiedTime;
const TimeBounds & curTimeBounds = geometry3d->GetTimeBounds();
if((curTimeBounds[0] > stmin) && (curTimeBounds[0] < timeBounds[0]))
timeBounds[0] = curTimeBounds[0];
if((curTimeBounds[1] < stmax) && (curTimeBounds[1] > timeBounds[1]))
timeBounds[1] = curTimeBounds[1];
nextBoundingBox = geometry3d->GetBoundingBox();
assert(nextBoundingBox.IsNotNull());
// Only respect non-zero BBes
if (nextBoundingBox->GetBounds() == itkBoundsZero)
{
continue;
}
const mitk::BoundingBox::PointsContainer * nextPoints = nextBoundingBox->GetPoints();
if(nextPoints!=NULL)
{
mitk::BoundingBox::PointsContainer::ConstIterator pointsIt = nextPoints->Begin();
while (pointsIt != nextPoints->End() )
{
pointscontainer->InsertElement( pointid++, pointsIt->Value());
++pointsIt;
}
}
}
if(!(timeBounds[0] < stmax))
{
timeBounds[0] = stmin;
timeBounds[1] = stmax;
}
m_TimeBounds = timeBounds;
assert(timeBounds[0]<=timeBounds[1]);
boundingBox->SetPoints(pointscontainer);
boundingBox->ComputeBoundingBox();
m_BoundingBox = boundingBox;
SetIndexToWorldTransform(GetGeometry3D(0)->GetIndexToWorldTransform());
if(this->GetMTime() < maxModifiedTime)
Modified();
}
mitk::Geometry3D* mitk::TimeSlicedGeometry::GetGeometry3D(int t) const
{
mitk::Geometry3D::Pointer geometry3d = NULL;
if(IsValidTime(t))
{
geometry3d = m_Geometry3Ds[t];
//if (a) we don't have a Geometry3D stored for the requested time,
//(b) m_EvenlyTimed is activated and (c) the first geometry (t=0)
//is set, then we clone the geometry and set the m_TimeBounds accordingly.
if((m_EvenlyTimed) && (geometry3d.IsNull()))
{
const Geometry3D* firstgeometry=m_Geometry3Ds[0].GetPointer();
assert(firstgeometry != NULL);
mitk::Geometry3D::Pointer requestedgeometry;
requestedgeometry = dynamic_cast<Geometry3D*>(firstgeometry->Clone().GetPointer());
if ( requestedgeometry.IsNull() ) itkExceptionMacro("Geometry is NULL!");
TimeBounds timebounds = requestedgeometry->GetTimeBounds();
if(timebounds[1]<ScalarTypeNumericTraits::max())
{
mitk::ScalarType later = (timebounds[1]-timebounds[0])*t;
timebounds[0]+=later; timebounds[1]+=later;
requestedgeometry->SetTimeBounds(timebounds);
}
geometry3d = requestedgeometry;
m_Geometry3Ds[t] = geometry3d;
}
}
else
return NULL;
return geometry3d;
}
bool mitk::TimeSlicedGeometry::SetGeometry3D(mitk::Geometry3D* geometry3D, int t)
{
if(IsValidTime(t))
{
m_Geometry3Ds[t]=geometry3D;
return true;
}
return false;
}
int mitk::TimeSlicedGeometry::MSToTimeStep(mitk::ScalarType time_in_ms) const
{
if(time_in_ms < m_TimeBounds[0])
return -1;
if(time_in_ms >= m_TimeBounds[1])
return m_TimeSteps;
if(m_EvenlyTimed)
{
if(m_TimeBounds[0] == m_TimeBounds[1])
return 0;
if((m_TimeBounds[0]>ScalarTypeNumericTraits::NonpositiveMin()) && (m_TimeBounds[1]<ScalarTypeNumericTraits::max()))
{
return (int) ceil(((time_in_ms - m_TimeBounds[0])/(m_TimeBounds[1]-m_TimeBounds[0])*m_TimeSteps)-0.5);
}
return 0;
}
else
{
unsigned int t;
for ( t = 0; t < m_TimeSteps; ++t )
{
const TimeBounds& timeBounds = GetGeometry3D( t )->GetTimeBounds();
if( (timeBounds[0] <= time_in_ms) && (time_in_ms <= timeBounds[1]) )
{
return t;
}
}
}
return 0;
}
mitk::ScalarType mitk::TimeSlicedGeometry::TimeStepToMS(int timestep) const
{
if(IsValidTime(timestep)==false)
return ScalarTypeNumericTraits::max();
if(m_EvenlyTimed)
{
if ( timestep == 0 )
return m_TimeBounds[0];
else
{
assert( ! (m_TimeBounds[0] == ScalarTypeNumericTraits::NonpositiveMin() && m_TimeBounds[1] == ScalarTypeNumericTraits::max() ) );
return ((mitk::ScalarType)timestep)/m_TimeSteps*(m_TimeBounds[1]-m_TimeBounds[0])+m_TimeBounds[0];
}
}
else
{
return GetGeometry3D(timestep)->GetTimeBounds()[0];
}
}
int mitk::TimeSlicedGeometry::TimeStepToTimeStep(
const mitk::TimeSlicedGeometry *referenceGeometry, int t) const
{
int timeStep;
if ( referenceGeometry->GetTimeSteps() > 1 )
{
// referenceGeometry is nD+t
timeStep = this->MSToTimeStep( referenceGeometry->TimeStepToMS( t ) );
}
else
{
// referenceGEometry is nD (only one time step)
timeStep = 0;
}
return timeStep;
}
-void mitk::TimeSlicedGeometry::Initialize(unsigned int timeSteps)
+void mitk::TimeSlicedGeometry::InitializeEvenlyTimed(unsigned int timeSteps)
{
Geometry3D::Pointer geometry3D = Geometry3D::New();
geometry3D->Initialize();
InitializeEvenlyTimed(geometry3D, timeSteps);
}
void mitk::TimeSlicedGeometry::InitializeEvenlyTimed(mitk::Geometry3D* geometry3D, unsigned int timeSteps)
{
assert(geometry3D!=NULL);
geometry3D->Register();
InitializeEmpty(timeSteps);
AffineTransform3D::Pointer transform = AffineTransform3D::New();
transform->SetMatrix(geometry3D->GetIndexToWorldTransform()->GetMatrix());
transform->SetOffset(geometry3D->GetIndexToWorldTransform()->GetOffset());
SetIndexToWorldTransform(transform);
SetBounds(geometry3D->GetBounds());
SetGeometry3D(geometry3D, 0);
SetEvenlyTimed();
UpdateInformation();
SetFrameOfReferenceID(geometry3D->GetFrameOfReferenceID());
SetImageGeometry(geometry3D->GetImageGeometry());
geometry3D->UnRegister();
}
void mitk::TimeSlicedGeometry::InitializeEmpty(unsigned int timeSteps)
{
m_IndexToWorldTransform = NULL;
Superclass::Initialize();
m_TimeSteps = timeSteps;
// initialize with empty geometries
Geometry3D::Pointer gnull=NULL;
m_Geometry3Ds.assign(m_TimeSteps, gnull);
}
void mitk::TimeSlicedGeometry::ExpandToNumberOfTimeSteps( unsigned int timeSteps )
{
if( timeSteps <= m_TimeSteps ) return;
if(m_TimeSteps == 1)
{
Geometry3D* g3d = m_Geometry3Ds[0];
const TimeBounds & timeBounds = g3d->GetTimeBounds();
if( (timeBounds[0] == ScalarTypeNumericTraits::NonpositiveMin()) ||
(timeBounds[1]==ScalarTypeNumericTraits::max())
)
{
mitk::ScalarType timeBounds[] = {0.0, 1.0};
m_Geometry3Ds[0]->SetTimeBounds( timeBounds );
}
}
// Expand to Number of time steps; initialize with empty geometries
Geometry3D::Pointer gnull=NULL;
m_Geometry3Ds.resize(timeSteps, gnull);
m_TimeSteps = timeSteps;
UpdateInformation();
}
mitk::TimeSlicedGeometry::TimeSlicedGeometry() : m_TimeSteps(0), m_EvenlyTimed(false)
{
}
+mitk::TimeSlicedGeometry::TimeSlicedGeometry(const TimeSlicedGeometry& other) : Geometry3D(other), m_TimeSteps(other.m_TimeSteps), m_EvenlyTimed(other.m_EvenlyTimed)
+{
+ m_Geometry3Ds.resize(m_TimeSteps);
+ unsigned int t;
+ for(t=0; t<m_TimeSteps; ++t)
+ {
+ if(other.m_Geometry3Ds[t].IsNull())
+ {
+ assert(other.m_EvenlyTimed);
+ SetGeometry3D(NULL,t);
+ }
+ else
+ {
+ SetGeometry3D(dynamic_cast<Geometry3D*>(other.m_Geometry3Ds[t]->Clone().GetPointer()), t);
+ }
+ }
+}
+
mitk::TimeSlicedGeometry::~TimeSlicedGeometry()
{
}
void mitk::TimeSlicedGeometry::SetImageGeometry(const bool isAnImageGeometry)
{
Superclass::SetImageGeometry(isAnImageGeometry);
mitk::Geometry3D* geometry3d;
unsigned int t;
for(t=0; t<m_TimeSteps; ++t)
{
geometry3d = m_Geometry3Ds[t];
if(geometry3d!=NULL)
geometry3d->SetImageGeometry(isAnImageGeometry);
}
}
void mitk::TimeSlicedGeometry::ChangeImageGeometryConsideringOriginOffset(const bool isAnImageGeometry)
{
mitk::Geometry3D* geometry3d;
unsigned int t;
for(t=0; t<m_TimeSteps; ++t)
{
geometry3d = m_Geometry3Ds[t];
if(geometry3d!=NULL)
geometry3d->ChangeImageGeometryConsideringOriginOffset(isAnImageGeometry);
}
Superclass::ChangeImageGeometryConsideringOriginOffset(isAnImageGeometry);
}
void mitk::TimeSlicedGeometry::SetEvenlyTimed(bool on)
{
m_EvenlyTimed = on;
Modified();
}
bool mitk::TimeSlicedGeometry::IsValidTime(int t) const
{
return (t>=0) && (t< (int)m_TimeSteps);
}
void mitk::TimeSlicedGeometry::CopyTimes(const mitk::TimeSlicedGeometry* timeslicedgeometry, unsigned int t, unsigned int endtimeindex)
{
if(endtimeindex >= timeslicedgeometry->GetTimeSteps())
endtimeindex = timeslicedgeometry->GetTimeSteps()-1;
if(endtimeindex >= this->GetTimeSteps())
endtimeindex = this->GetTimeSteps()-1;
for(; t <= endtimeindex; ++t)
{
mitk::Geometry3D* geometry3d = GetGeometry3D(t);
mitk::Geometry3D* othergeometry3d = timeslicedgeometry->GetGeometry3D(t);
assert((geometry3d!=NULL) && (othergeometry3d!=NULL));
geometry3d->SetTimeBounds(othergeometry3d->GetTimeBounds());
}
UpdateInformation();
}
mitk::AffineGeometryFrame3D::Pointer mitk::TimeSlicedGeometry::Clone() const
{
- Self::Pointer newGeometry = Self::New();
- newGeometry->Initialize(m_TimeSteps);
- InitializeGeometry(newGeometry);
- return newGeometry.GetPointer();
-}
-
-mitk::TimeSlicedGeometry::Pointer mitk::TimeSlicedGeometry::CloneCopy() const
-{
- Self::Pointer newGeometry = Self::New();
- newGeometry->Initialize(m_TimeSteps);
- InitializeGeometry(newGeometry);
+ Self::Pointer newGeometry = new TimeSlicedGeometry(*this);
+ newGeometry->UnRegister();
return newGeometry.GetPointer();
}
-void mitk::TimeSlicedGeometry::InitializeGeometry(Self * newGeometry) const
-{
- Superclass::InitializeGeometry(newGeometry);
-
- newGeometry->SetEvenlyTimed(m_EvenlyTimed);
- unsigned int t;
- for(t=0; t<m_TimeSteps; ++t)
- {
- if(m_Geometry3Ds[t].IsNull())
- {
- assert(m_EvenlyTimed);
- }
- else
- {
- newGeometry->SetGeometry3D(dynamic_cast<Geometry3D*>(m_Geometry3Ds[t]->Clone().GetPointer()), t);
- }
- }
-}
void mitk::TimeSlicedGeometry::PrintSelf(std::ostream& os, itk::Indent indent) const
{
//Superclass::PrintSelf(os,indent);
os << indent << " EvenlyTimed: " << m_EvenlyTimed << std::endl;
os << indent << " TimeSteps: " << m_TimeSteps << std::endl;
os << std::endl;
os << indent << " GetGeometry3D(0): ";
if(GetGeometry3D(0)==NULL)
os << "NULL" << std::endl;
else
GetGeometry3D(0)->Print(os, indent);
}
void mitk::TimeSlicedGeometry::ExecuteOperation(Operation* operation)
{
// reach through to all time steps
for (std::vector<Geometry3D::Pointer>::iterator iter = m_Geometry3Ds.begin();
iter != m_Geometry3Ds.end();
++iter)
{
(*iter)->ExecuteOperation(operation);
}
Geometry3D::ExecuteOperation(operation);
this->Modified();
}
diff --git a/Core/Code/DataManagement/mitkTimeSlicedGeometry.h b/Core/Code/DataManagement/mitkTimeSlicedGeometry.h
index 8e1f0374a2..27726dad24 100644
--- a/Core/Code/DataManagement/mitkTimeSlicedGeometry.h
+++ b/Core/Code/DataManagement/mitkTimeSlicedGeometry.h
@@ -1,179 +1,178 @@
/*=========================================================================
Program: Medical Imaging & Interaction Toolkit
Language: C++
Date: $Date$
Version: $Revision$
Copyright (c) German Cancer Research Center, Division of Medical and
Biological Informatics. All rights reserved.
See MITKCopyright.txt or http://www.mitk.org/copyright.html for details.
This software is distributed WITHOUT ANY WARRANTY; without even
the implied warranty of MERCHANTABILITY or FITNESS FOR A PARTICULAR
PURPOSE. See the above copyright notices for more information.
=========================================================================*/
#ifndef TIMESLICEDGEOMETRY_H_HEADER_INCLUDED_C1EBD0AD
#define TIMESLICEDGEOMETRY_H_HEADER_INCLUDED_C1EBD0AD
#include "mitkGeometry3D.h"
namespace mitk {
//##Documentation
//## @brief Describes a geometry consisting of several geometries which
//## exist at different times.
//##
//## The geometry contains m_TimeSteps geometries, which can be accessed
//## using GetGeometry3D(int t). To convert between world-time in
//## milliseconds and the integer timestep-number use MSToTimeStep.
//## The hull (in space and time) of the TimeSlicedGeometry contains all
//## contained geometries.
//## @warning The hull (i.e., transform, bounding-box and
//## time-bounds) is only guaranteed to be up-to-date after calling
//## UpdateInformation().
//##
//## TimeSlicedGeometry and the associated Geometry3Ds have to be
//## initialized in the method GenerateOutputInformation() of BaseProcess (or
//## CopyInformation/ UpdateOutputInformation of BaseData, if possible, e.g.,
//## by analyzing pic tags in Image) subclasses. See also
//## itk::ProcessObject::GenerateOutputInformation(),
//## itk::DataObject::CopyInformation() and
//## itk::DataObject::UpdateOutputInformation().
//##
//## @ingroup Geometry
class MITK_CORE_EXPORT TimeSlicedGeometry : public Geometry3D
{
public:
mitkClassMacro(TimeSlicedGeometry, Geometry3D);
itkNewMacro(Self);
//##Documentation
//## @brief Re-calculate the hull of the contained geometries.
//##
//## The transforms, bounding-box and time-bounds of this
//## geometry (stored in members of the super-class Geometry3D)
//## are re-calculated from the contained geometries.
void UpdateInformation();
//##Documentation
//## @brief Get the number of time-steps
itkGetConstMacro(TimeSteps, unsigned int);
//##Documentation
//## @brief Set/Get whether the TimeSlicedGeometry is evenly-timed (m_EvenlyTimed)
//##
//## If (a) we don't have a Geometry3D stored for the requested time,
//## (b) m_EvenlyTimed is activated and (c) the first geometry (t=0)
//## is set, then we clone the geometry and set the m_TimeBounds accordingly.
//## \sa GetGeometry3D
itkGetConstMacro(EvenlyTimed, bool);
virtual void SetEvenlyTimed(bool on = true);
//##Documentation
//## @brief Set the Geometry3D for time @a t
virtual bool SetGeometry3D(mitk::Geometry3D* geometry3D, int t);
//##Documentation
//## @brief When switching from an Image Geometry to a normal Geometry (and the other way around), you have to change the origin as well (See Geometry Documentation)! This function will change the "isImageGeometry" bool flag and changes the origin respectively.
virtual void ChangeImageGeometryConsideringOriginOffset( const bool isAnImageGeometry );
//##Documentation
//## @brief Get the Geometry3D at time @a t
virtual mitk::Geometry3D* GetGeometry3D(int t) const;
//##Documentation
//## @brief Test whether @a t is a valid time step
virtual bool IsValidTime(int t) const;
//##Documentation
//## @brief Convert time in ms to a time step
virtual int MSToTimeStep(mitk::ScalarType time_in_ms) const;
//##Documentation
//## @brief Convert time step to time in ms
virtual mitk::ScalarType TimeStepToMS(int timestep) const;
//##Documentation
//## @brief Convert time step in the reference TimeSlicedGeometry to time step
//## in this TimeSlicedGeometry.
virtual int TimeStepToTimeStep(const mitk::TimeSlicedGeometry *referenceGeometry, int t) const;
//##Documentation
//## @brief Completely initialize this instance as evenly-timed with
//## \a timeSteps geometries of type Geometry3D, each initialized by
//## Geometry3D::Initialize().
- virtual void Initialize(unsigned int timeSteps);
+ virtual void InitializeEvenlyTimed(unsigned int timeSteps);
//##Documentation
//## @brief Completely initialize this instance as evenly-timed with
//## \a timeSteps geometries identical to the provided Geometry3D
//## except for the time bounds
virtual void InitializeEvenlyTimed(mitk::Geometry3D* geometry3D, unsigned int timeSteps);
//##Documentation
//## @brief Initialize this instance to contain \a timeSteps
//## geometries, but without setting them yet
virtual void InitializeEmpty(unsigned int timeSteps);
//##Documentation
//## @brief Expand the number of time steps contained
//## to \a timeSteps.
//##
//## New, additional time steps will be initialized empty.
//## Only enlargement of the time steps vector is intended and possible.
virtual void ExpandToNumberOfTimeSteps( unsigned int timeSteps );
virtual void SetImageGeometry(const bool isAnImageGeometry);
//##Documentation
//## @brief Copy the m_TimeBounds of the geometries contained
//## in timeslicedgeometry into the geometries contained in this
//## TimeSlicedGeometry object.
//##
//## Useful for initialization of the TimeSlicedGeometry of the
//## output in GenerateOutputInformation() methods of process objects,
//## see for example BoundingObjectCutter::GenerateOutputInformation().
//## @param t start time index
//## @param endtimeindex (endtimeindex) is the time index of
//## the last geometry whose time-bounds are copied. If
//## timeslicedgeometry or this TimeSlicedGeometry object does
//## not contain enough geometries, endtimeindex is reduced
//## appropriately.
void CopyTimes(const mitk::TimeSlicedGeometry* timeslicedgeometry, unsigned int t=0, unsigned int endtimeindex = itk::NumericTraits<unsigned int>::max());
//##Documentation
//## @brief duplicates the geometry
virtual AffineGeometryFrame3D::Pointer Clone() const;
TimeSlicedGeometry::Pointer CloneCopy() const;
virtual void ExecuteOperation(Operation* operation);
protected:
TimeSlicedGeometry();
+ TimeSlicedGeometry(const TimeSlicedGeometry& other);
virtual ~TimeSlicedGeometry();
- void InitializeGeometry(Self * newGeometry) const;
-
virtual void PrintSelf(std::ostream& os, itk::Indent indent) const;
mutable std::vector<Geometry3D::Pointer> m_Geometry3Ds;
//##Documentation
//## @brief Number of time steps
unsigned int m_TimeSteps;
//##Documentation
//## @brief \a true in case the time steps have equal length
bool m_EvenlyTimed;
static const std::string EVENLY_TIMED;
static const std::string TIME_STEPS;
};
} // namespace mitk
#endif /* TIMESLICEDGEOMETRY_H_HEADER_INCLUDED_C1EBD0AD */
diff --git a/Core/Code/DataManagement/mitkTransferFunctionProperty.h b/Core/Code/DataManagement/mitkTransferFunctionProperty.h
index 129f2dacaa..e17af7b605 100644
--- a/Core/Code/DataManagement/mitkTransferFunctionProperty.h
+++ b/Core/Code/DataManagement/mitkTransferFunctionProperty.h
@@ -1,81 +1,81 @@
/*=========================================================================
Program: Medical Imaging & Interaction Toolkit
Language: C++
Date: $Date$
Version: $Revision$
Copyright (c) German Cancer Research Center, Division of Medical and
Biological Informatics. All rights reserved.
See MITKCopyright.txt or http://www.mitk.org/copyright.html for details.
This software is distributed WITHOUT ANY WARRANTY; without even
the implied warranty of MERCHANTABILITY or FITNESS FOR A PARTICULAR
PURPOSE. See the above copyright notices for more information.
=========================================================================*/
#ifndef MITKTRANFERFUNCTIONPROPERTY_H_HEADER_INCLUDED
#define MITKTRANFERFUNCTIONPROPERTY_H_HEADER_INCLUDED
#include "mitkBaseProperty.h"
#include "mitkTransferFunction.h"
namespace mitk {
class MITK_CORE_EXPORT TransferFunctionProperty : public BaseProperty
{
public:
mitkClassMacro(TransferFunctionProperty, BaseProperty);
itkNewMacro(TransferFunctionProperty);
mitkNewMacro1Param(TransferFunctionProperty, mitk::TransferFunction::Pointer);
itkSetMacro(Value, mitk::TransferFunction::Pointer );
itkGetConstMacro(Value, mitk::TransferFunction::Pointer );
/**
*
*/
virtual bool operator==(const BaseProperty& property) const {
const Self *other = dynamic_cast<const Self*>(&property);
if(other==NULL)
return false;
else
return *(m_Value.GetPointer()) == *(other->m_Value.GetPointer());
}
-
+ virtual BaseProperty& operator=(const BaseProperty& other) { return Superclass::operator=(other); }
/**
*
*/
std::string GetValueAsString() const {
std::stringstream myStr;
myStr << GetValue() ;
return myStr.str();
}
protected:
mitk::TransferFunction::Pointer m_Value;
TransferFunctionProperty()
: BaseProperty()
{};
virtual ~TransferFunctionProperty()
{
};
TransferFunctionProperty( mitk::TransferFunction::Pointer value )
: BaseProperty(), m_Value( value )
{};
};
// typedef GenericProperty<mitk::TransferFunction::Pointer> TransferFunctionProperty;
} // namespace mitk
#endif /* MITKTRANFERFUNCTIONPROPERTY_H_HEADER_INCLUDED */
diff --git a/Core/Code/DataManagement/mitkVector.h b/Core/Code/DataManagement/mitkVector.h
index d523b7077f..295f9faa91 100644
--- a/Core/Code/DataManagement/mitkVector.h
+++ b/Core/Code/DataManagement/mitkVector.h
@@ -1,355 +1,436 @@
/*=========================================================================
Program: Medical Imaging & Interaction Toolkit
Language: C++
Date: $Date$
Version: $Revision$
Copyright (c) German Cancer Research Center, Division of Medical and
Biological Informatics. All rights reserved.
See MITKCopyright.txt or http://www.mitk.org/copyright.html for details.
This software is distributed WITHOUT ANY WARRANTY; without even
the implied warranty of MERCHANTABILITY or FITNESS FOR A PARTICULAR
PURPOSE. See the above copyright notices for more information.
=========================================================================*/
#ifndef MITKVECTOR_H_HEADER_INCLUDED_C1EBD0AD
#define MITKVECTOR_H_HEADER_INCLUDED_C1EBD0AD
#include <itkPoint.h>
#include <float.h>
#include <itkIndex.h>
#include <itkContinuousIndex.h>
#include <itkVector.h>
#include <itkMatrix.h>
#include <itkTransform.h>
#include <vnl/vnl_quaternion.h>
#include "mitkCommon.h"
#ifndef DOXYGEN_SKIP
namespace mitk {
typedef float ScalarType;
typedef itk::Matrix<ScalarType, 3, 3> Matrix3D;
typedef itk::Matrix<ScalarType,4,4> Matrix4D;
typedef vnl_matrix_fixed<ScalarType, 3, 3> VnlMatrix3D;
typedef itk::Transform<ScalarType, 3, 3> Transform3D;
typedef vnl_vector<ScalarType> VnlVector;
typedef vnl_vector_ref<ScalarType> VnlVectorRef;
typedef itk::Point<ScalarType,2> Point2D;
typedef itk::Point<ScalarType,3> Point3D;
typedef itk::Point<ScalarType,4> Point4D;
typedef itk::Point<int,2> Point2I;
typedef itk::Point<int,3> Point3I;
typedef itk::Point<int,4> Point4I;
typedef itk::Vector<ScalarType,2> Vector2D;
typedef itk::Vector<ScalarType,3> Vector3D;
typedef itk::Index<3> Index3D;
typedef itk::ContinuousIndex<ScalarType, 3> ContinuousIndex3D;
typedef vnl_quaternion<ScalarType> Quaternion;
//##Documentation
//##@brief enumeration of the type a point can be
enum PointSpecificationType
{
PTUNDEFINED = 0,
PTSTART,
PTCORNER,
PTEDGE,
PTEND
};
typedef itk::NumericTraits<mitk::ScalarType> ScalarTypeNumericTraits;
MITK_CORE_EXPORT extern const ScalarType eps;
MITK_CORE_EXPORT extern const ScalarType sqrteps;
MITK_CORE_EXPORT extern const double large;
template <class T> class VectorTraits {
public:
typedef T ValueType;
};
template <> class VectorTraits<VnlVector> {
public:
typedef ScalarType ValueType;
};
template<> class VectorTraits<double[4]> {
public:
typedef double ValueType;
};
template<> class VectorTraits< itk::Index<5> > {
public:
typedef itk::Index<5>::IndexValueType ValueType;
};
template<> class VectorTraits< itk::Index<3> > {
public:
typedef itk::Index<3>::IndexValueType ValueType;
};
template<> class VectorTraits< long int [3]> {
public:
typedef long int ValueType;
};
template<> class VectorTraits< float [3]> {
public:
typedef float ValueType;
};
template<> class VectorTraits< double [3]> {
public:
typedef double ValueType;
};
template<> class VectorTraits< vnl_vector_fixed<ScalarType, 3> > {
public:
typedef ScalarType ValueType;
};
template<> class VectorTraits< long unsigned int[3]> {
public:
typedef long unsigned int ValueType;
};
template<> class VectorTraits< unsigned int *> {
public:
typedef unsigned int ValueType;
};
template<> class VectorTraits< ScalarType[4] > {
public:
typedef ScalarType ValueType;
};
template<> class VectorTraits< itk::Vector<float,3> > {
public:
typedef float ValueType;
};
template<> class VectorTraits< itk::Point<float,3> > {
public:
typedef float ValueType;
};
template<> class VectorTraits< itk::Point<float,4> > {
public:
typedef float ValueType;
};
template<> class VectorTraits< itk::Vector<double,3> > {
public:
typedef double ValueType;
};
template<> class VectorTraits< itk::Point<double,3> > {
public:
typedef double ValueType;
};
template<> class VectorTraits< itk::Vector<int,3> > {
public:
typedef int ValueType;
};
template<> class VectorTraits< itk::Point<int,3> > {
public:
typedef int ValueType;
};
template <class Tin, class Tout>
inline void itk2vtk(const Tin& in, Tout& out)
{
out[0]=(typename VectorTraits<Tout>::ValueType)(in[0]);
out[1]=(typename VectorTraits<Tout>::ValueType)(in[1]);
out[2]=(typename VectorTraits<Tout>::ValueType)(in[2]);
}
template <class Tin, class Tout>
inline void vtk2itk(const Tin& in, Tout& out)
{
out[0]=(typename VectorTraits<Tout>::ValueType)(in[0]);
out[1]=(typename VectorTraits<Tout>::ValueType)(in[1]);
out[2]=(typename VectorTraits<Tout>::ValueType)(in[2]);
}
template <class Tout>
inline void FillVector3D(Tout& out, ScalarType x, ScalarType y, ScalarType z)
{
out[0] = (typename VectorTraits<Tout>::ValueType)x;
out[1] = (typename VectorTraits<Tout>::ValueType)y;
out[2] = (typename VectorTraits<Tout>::ValueType)z;
}
template <class Tout>
inline void FillVector4D(Tout& out, ScalarType x, ScalarType y, ScalarType z, ScalarType t)
{
out[0] = (typename VectorTraits<Tout>::ValueType)x;
out[1] = (typename VectorTraits<Tout>::ValueType)y;
out[2] = (typename VectorTraits<Tout>::ValueType)z;
out[3] = (typename VectorTraits<Tout>::ValueType)t;
}
template <class Tin, class Tout>
inline void vnl2vtk(const vnl_vector<Tin>& in, Tout *out)
{
unsigned int i;
for(i=0; i<in.size();++i)
out[i]=(Tout) (in[i]);
}
template <class Tin, class Tout>
inline void vtk2vnl(const Tin *in, vnl_vector<Tout>& out)
{
unsigned int i;
for(i=0; i<out.size();++i)
out[i]=(Tout) (in[i]);
}
template <class Tin, class Tout>
inline void vtk2vnlref(const Tin *in, vnl_vector_ref<Tout>& out)
{
unsigned int i;
for(i=0; i<out.size();++i)
out[i]=(Tout) (in[i]);
}
template <class Tin, class Tout, unsigned int n>
inline void vnl2vtk(const vnl_vector_fixed<Tin, n>& in, Tout *out)
{
unsigned int i;
for(i=0; i<in.size();++i)
out[i]=(Tout) (in[i]);
}
template <class Tin, class Tout, unsigned int n>
inline void vtk2vnl(const Tin *in, vnl_vector_fixed<Tout, n>& out)
{
unsigned int i;
for(i=0; i<out.size();++i)
out[i]=(Tout) (in[i]);
}
template <class T, unsigned int NVectorDimension>
itk::Vector<T, NVectorDimension> operator+(const itk::Vector<T, NVectorDimension> &vector, const itk::Point<T, NVectorDimension> &point)
{
itk::Vector<T, NVectorDimension> sub;
for( unsigned int i=0; i<NVectorDimension; i++)
{
sub[i] = vector[i]+point[i];
}
return sub;
}
template <class T, unsigned int NVectorDimension>
inline itk::Vector<T, NVectorDimension>& operator+=(itk::Vector<T, NVectorDimension> &vector, const itk::Point<T, NVectorDimension> &point)
{
for( unsigned int i=0; i<NVectorDimension; i++)
{
vector[i] += point[i];
}
return vector;
}
template <class T, unsigned int NVectorDimension>
itk::Vector<T, NVectorDimension> operator-(const itk::Vector<T, NVectorDimension> &vector, const itk::Point<T, NVectorDimension> &point)
{
itk::Vector<T, NVectorDimension> sub;
for( unsigned int i=0; i<NVectorDimension; i++)
{
sub[i] = vector[i]-point[i];
}
return sub;
}
template <class T, unsigned int NVectorDimension>
inline itk::Vector<T, NVectorDimension>& operator-=(itk::Vector<T, NVectorDimension> &vector, const itk::Point<T, NVectorDimension> &point)
{
for( unsigned int i=0; i<NVectorDimension; i++)
{
vector[i] -= point[i];
}
return vector;
}
+/*!
+\brief Check for matrix equality with a user defined accuracy. As an equality metric the root mean squared error (RMS) of all elements is calculated.
+\param matrix1 first vnl matrix
+\param matrix2 second vnl matrix
+\epsilon user defined accuracy bounds
+*/
+template <typename TCoordRep, unsigned int NRows, unsigned int NCols>
+inline bool MatrixEqualRMS(const vnl_matrix_fixed<TCoordRep,NRows,NCols>& matrix1,const vnl_matrix_fixed<TCoordRep,NRows,NCols>& matrix2,mitk::ScalarType epsilon=mitk::eps)
+{
+ if ( (matrix1.rows() == matrix2.rows()) && (matrix1.cols() == matrix2.cols()) )
+ {
+ vnl_matrix_fixed<TCoordRep,NRows,NCols> differenceMatrix = matrix1-matrix2;
+ if (differenceMatrix.rms()<epsilon)
+ {
+ return true;
+ }
+ else
+ {
+ return false;
+ }
+ }
+ else
+ {
+ return false;
+ }
+}
+
+/*!
+\brief Check for matrix equality with a user defined accuracy. As an equality metric the root mean squared error (RMS) of all elements is calculated.
+\param matrix1 first itk matrix
+\param matrix2 second itk matrix
+\epsilon user defined accuracy bounds
+*/
+template <typename TCoordRep, unsigned int NRows, unsigned int NCols>
+inline bool MatrixEqualRMS(const itk::Matrix<TCoordRep, NRows, NCols>& matrix1,const itk::Matrix<TCoordRep, NRows, NCols>& matrix2,mitk::ScalarType epsilon=mitk::eps)
+{
+ return mitk::MatrixEqualRMS(matrix1.GetVnlMatrix(),matrix2.GetVnlMatrix(),epsilon);
+}
+
+/*!
+\brief Check for element-wise matrix equality with a user defined accuracy.
+\param matrix1 first vnl matrix
+\param matrix2 second vnl matrix
+\epsilon user defined accuracy bounds
+*/
+template <typename TCoordRep, unsigned int NRows, unsigned int NCols>
+inline bool MatrixEqualElementWise(const vnl_matrix_fixed<TCoordRep,NRows,NCols>& matrix1,const vnl_matrix_fixed<TCoordRep,NRows,NCols>& matrix2,mitk::ScalarType epsilon=mitk::eps)
+{
+ if ( (matrix1.rows() == matrix2.rows()) && (matrix1.cols() == matrix2.cols()) )
+ {
+ for( unsigned int r=0; r<NRows; r++)
+ {
+ for( unsigned int c=0; c<NCols; c++ )
+ {
+ TCoordRep difference = fabs(matrix1(r,c)-matrix2(r,c));
+ if (difference>epsilon)
+ {
+ return false;
+ }
+ }
+ }
+ return true;
+ }
+ else
+ {
+ return false;
+ }
+}
+
+/*!
+\brief Check for element-wise matrix equality with a user defined accuracy.
+\param matrix1 first itk matrix
+\param matrix2 second itk matrix
+\epsilon user defined accuracy bounds
+*/
+template <typename TCoordRep, unsigned int NRows, unsigned int NCols>
+inline bool MatrixEqualElementWise(const itk::Matrix<TCoordRep, NRows, NCols>& matrix1,const itk::Matrix<TCoordRep, NRows, NCols>& matrix2,mitk::ScalarType epsilon=mitk::eps)
+{
+ return mitk::MatrixEqualElementWise(matrix1.GetVnlMatrix(),matrix2.GetVnlMatrix(),epsilon);
+}
+
template <typename TCoordRep, unsigned int NPointDimension>
- inline bool Equal(const itk::Vector<TCoordRep, NPointDimension>& vector1, const itk::Vector<TCoordRep, NPointDimension>& vector2)
+inline bool Equal(const itk::Vector<TCoordRep, NPointDimension>& vector1, const itk::Vector<TCoordRep, NPointDimension>& vector2)
{
typename itk::Vector<TCoordRep, NPointDimension>::VectorType diff = vector1-vector2;
return diff.GetSquaredNorm() < mitk::eps;
}
template <typename TCoordRep, unsigned int NPointDimension>
inline bool Equal(const itk::Point<TCoordRep, NPointDimension>& vector1, const itk::Point<TCoordRep, NPointDimension>& vector2)
{
typename itk::Point<TCoordRep, NPointDimension>::VectorType diff = vector1-vector2;
return diff.GetSquaredNorm() < mitk::eps;
}
inline bool Equal(const mitk::VnlVector& vector1, const mitk::VnlVector& vector2)
{
mitk::VnlVector diff = vector1-vector2;
return diff.squared_magnitude() < mitk::eps;
}
inline bool Equal(double scalar1, double scalar2)
{
return fabs(scalar1-scalar2) < mitk::eps;
}
template <typename TCoordRep, unsigned int NPointDimension>
inline bool Equal(const vnl_vector_fixed<TCoordRep, NPointDimension> & vector1, const vnl_vector_fixed<TCoordRep, NPointDimension>& vector2)
{
vnl_vector_fixed<TCoordRep, NPointDimension> diff = vector1-vector2;
return diff.squared_magnitude() < mitk::eps;
}
template <typename U, typename V, unsigned int NRows, unsigned int NColumns>
inline void TransferMatrix(const itk::Matrix<U, NRows, NColumns>& in, itk::Matrix<V, NRows, NColumns>& out)
{
for (unsigned int i = 0; i < in.RowDimensions; ++i)
for (unsigned int j = 0; j < in.ColumnDimensions; ++j)
out[i][j] = in[i][j];
}
} // namespace mitk
#endif //DOXYGEN_SKIP
/*
* This part of the code has been shifted here to avoid compiler clashes
* caused by including <itkAffineGeometryFrame.h> before the declaration of
* the Equal() methods above. This problem occurs when using MSVC and is
* probably related to a compiler bug.
*/
#include <itkAffineGeometryFrame.h>
namespace mitk
{
typedef itk::AffineGeometryFrame<ScalarType, 3>::TransformType AffineTransform3D;
}
#define mitkSetConstReferenceMacro(name,type) \
virtual void Set##name (const type & _arg) \
{ \
itkDebugMacro("setting " << #name " to " << _arg ); \
if (this->m_##name != _arg) \
{ \
this->m_##name = _arg; \
this->Modified(); \
} \
}
#define mitkSetVectorMacro(name,type) \
mitkSetConstReferenceMacro(name,type)
#define mitkGetVectorMacro(name,type) \
itkGetConstReferenceMacro(name,type)
#endif /* MITKVECTOR_H_HEADER_INCLUDED_C1EBD0AD */
diff --git a/Core/Code/DataManagement/mitkVtkInterpolationProperty.h b/Core/Code/DataManagement/mitkVtkInterpolationProperty.h
index 46120c2f1d..60e8b5757c 100644
--- a/Core/Code/DataManagement/mitkVtkInterpolationProperty.h
+++ b/Core/Code/DataManagement/mitkVtkInterpolationProperty.h
@@ -1,103 +1,105 @@
/*=========================================================================
Program: Medical Imaging & Interaction Toolkit
Language: C++
Date: $Date$
Version: $Revision$
Copyright (c) German Cancer Research Center, Division of Medical and
Biological Informatics. All rights reserved.
See MITKCopyright.txt or http://www.mitk.org/copyright.html for details.
This software is distributed WITHOUT ANY WARRANTY; without even
the implied warranty of MERCHANTABILITY or FITNESS FOR A PARTICULAR
PURPOSE. See the above copyright notices for more information.
=========================================================================*/
#ifndef _MITK_VTK_INTERPOLATION_PROPERTY__H_
#define _MITK_VTK_INTERPOLATION_PROPERTY__H_
#include "mitkEnumerationProperty.h"
namespace mitk
{
/**
* Encapsulates the enumeration vtkInterpolation. Valid values are
* (VTK constant/Id/string representation):
* VTK_FLAT/0/Flat, VTK_GOURAUD/1/Gouraud, VTK_PHONG/2/Phong
* Default is the Gouraud interpolation
*/
class MITK_CORE_EXPORT VtkInterpolationProperty : public EnumerationProperty
{
public:
mitkClassMacro( VtkInterpolationProperty, EnumerationProperty );
itkNewMacro(VtkInterpolationProperty);
mitkNewMacro1Param(VtkInterpolationProperty, const IdType&);
mitkNewMacro1Param(VtkInterpolationProperty, const std::string&);
+
+ virtual BaseProperty& operator=(const BaseProperty& other) { return Superclass::operator=(other); }
/**
* Returns the current interpolation value as defined by VTK constants.
* @returns the current interpolation as VTK constant.
*/
virtual int GetVtkInterpolation();
/**
* Sets the interpolation type to VTK_FLAT.
*/
virtual void SetInterpolationToFlat();
/**
* Sets the interpolation type to VTK_WIREFRAME.
*/
virtual void SetInterpolationToGouraud();
/**
* Sets the interpolation type to VTK_SURFACE.
*/
virtual void SetInterpolationToPhong();
protected:
/**
* Constructor. Sets the representation to a default value of surface(2)
*/
VtkInterpolationProperty( );
/**
* Constructor. Sets the interpolation to the given value. If it is not
* valid, the interpolation is set to gouraud(1)
* @param value the integer representation of the interpolation
*/
VtkInterpolationProperty( const IdType& value );
/**
* Constructor. Sets the interpolation to the given value. If it is not
* valid, the representation is set to gouraud(1)
* @param value the string representation of the interpolation
*/
VtkInterpolationProperty( const std::string& value );
/**
* this function is overridden as protected, so that the user may not add
* additional invalid interpolation types.
*/
virtual bool AddEnum( const std::string& name, const IdType& id );
/**
* Adds the enumeration types as defined by vtk to the list of known
* enumeration values.
*/
virtual void AddInterpolationTypes();
};
} // end of namespace mitk
#endif
diff --git a/Core/Code/DataManagement/mitkVtkRepresentationProperty.h b/Core/Code/DataManagement/mitkVtkRepresentationProperty.h
index 98ded81c08..eacc4a8e96 100644
--- a/Core/Code/DataManagement/mitkVtkRepresentationProperty.h
+++ b/Core/Code/DataManagement/mitkVtkRepresentationProperty.h
@@ -1,101 +1,103 @@
/*=========================================================================
Program: Medical Imaging & Interaction Toolkit
Language: C++
Date: $Date$
Version: $Revision$
Copyright (c) German Cancer Research Center, Division of Medical and
Biological Informatics. All rights reserved.
See MITKCopyright.txt or http://www.mitk.org/copyright.html for details.
This software is distributed WITHOUT ANY WARRANTY; without even
the implied warranty of MERCHANTABILITY or FITNESS FOR A PARTICULAR
PURPOSE. See the above copyright notices for more information.
=========================================================================*/
#ifndef _MITK_VTK_REPRESENTATION_PROPERTY__H_
#define _MITK_VTK_REPRESENTATION_PROPERTY__H_
#include "mitkEnumerationProperty.h"
namespace mitk
{
/**
* Encapsulates the enumeration vtkRepresentation. Valid values are
* (VTK constant/Id/string representation):
* VTK_POINTS/0/Points, VTK_WIREFRAME/1/Wireframe, VTK_SURFACE/2/Surface
* Default is the Surface representation
*/
class MITK_CORE_EXPORT VtkRepresentationProperty : public EnumerationProperty
{
public:
mitkClassMacro( VtkRepresentationProperty, EnumerationProperty );
itkNewMacro(VtkRepresentationProperty);
mitkNewMacro1Param(VtkRepresentationProperty, const IdType&);
mitkNewMacro1Param(VtkRepresentationProperty, const std::string&);
/**
* Returns the current representation value as defined by VTK constants.
* @returns the current representation as VTK constant.
*/
virtual int GetVtkRepresentation();
/**
* Sets the representation type to VTK_POINTS.
*/
virtual void SetRepresentationToPoints();
/**
* Sets the representation type to VTK_WIREFRAME.
*/
virtual void SetRepresentationToWireframe();
/**
* Sets the representation type to VTK_SURFACE.
*/
virtual void SetRepresentationToSurface();
+
+ virtual BaseProperty& operator=(const BaseProperty& other) { return Superclass::operator=(other); }
protected:
/**
* Constructor. Sets the representation to a default value of Surface(2)
*/
VtkRepresentationProperty( );
/**
* Constructor. Sets the representation to the given value. If it is not
* valid, the representation is set to Surface(2)
* @param value the integer representation of the representation
*/
VtkRepresentationProperty( const IdType& value );
/**
* Constructor. Sets the representation to the given value. If it is not
* valid, the representation is set to Surface(2)
* @param value the string representation of the representation
*/
VtkRepresentationProperty( const std::string& value );
/**
* this function is overridden as protected, so that the user may not add
* additional invalid representation types.
*/
virtual bool AddEnum( const std::string& name, const IdType& id );
/**
* Adds the enumeration types as defined by vtk to the list of known
* enumeration values.
*/
virtual void AddRepresentationTypes();
};
} // end of namespace mitk
#endif
diff --git a/Core/Code/DataManagement/mitkVtkResliceInterpolationProperty.h b/Core/Code/DataManagement/mitkVtkResliceInterpolationProperty.h
index dbf4c9944b..4ee164c299 100644
--- a/Core/Code/DataManagement/mitkVtkResliceInterpolationProperty.h
+++ b/Core/Code/DataManagement/mitkVtkResliceInterpolationProperty.h
@@ -1,99 +1,101 @@
/*=========================================================================
Program: Medical Imaging & Interaction Toolkit
Language: C++
Date: $Date$
Version: $Revision: $
Copyright (c) German Cancer Research Center, Division of Medical and
Biological Informatics. All rights reserved.
See MITKCopyright.txt or http://www.mitk.org/copyright.html for details.
This software is distributed WITHOUT ANY WARRANTY; without even
the implied warranty of MERCHANTABILITY or FITNESS FOR A PARTICULAR
PURPOSE. See the above copyright notices for more information.
=========================================================================*/
#ifndef _MITK_VTK_RESLICE_INTERPOLATION_PROPERTY__H_
#define _MITK_VTK_RESLICE_INTERPOLATION_PROPERTY__H_
#include "mitkEnumerationProperty.h"
#include <vtkImageReslice.h>
namespace mitk
{
/**
* Encapsulates the enumeration for reslice interpolation. Valid values are
* (VTK constant/Id/string representation):
* VTK_RESLICE_NEAREST, VTK_RESLICE_LINEAR, VTK_RESLICE_CUBIC
* Default is VTK_RESLICE_NEAREST
*/
class MITK_CORE_EXPORT VtkResliceInterpolationProperty : public EnumerationProperty
{
public:
mitkClassMacro( VtkResliceInterpolationProperty, EnumerationProperty );
itkNewMacro(VtkResliceInterpolationProperty);
mitkNewMacro1Param(VtkResliceInterpolationProperty, const IdType&);
mitkNewMacro1Param(VtkResliceInterpolationProperty, const std::string&);
+
+ virtual BaseProperty& operator=(const BaseProperty& other) { return Superclass::operator=(other); }
/**
* Returns the current interpolation value as defined by VTK constants.
*/
virtual int GetInterpolation();
/**
* Sets the interpolation type to VTK_RESLICE_NEAREST.
*/
virtual void SetInterpolationToNearest();
/**
* Sets the interpolation type to VTK_RESLICE_LINEAR.
*/
virtual void SetInterpolationToLinear();
/**
* Sets the interpolation type to VTK_RESLICE_CUBIC.
*/
virtual void SetInterpolationToCubic();
protected:
/** Sets reslice interpolation mode to default (VTK_RESLICE_NEAREST).
*/
VtkResliceInterpolationProperty( );
/**
* Constructor. Sets reslice interpolation to the given value.
*/
VtkResliceInterpolationProperty( const IdType& value );
/**
* Constructor. Sets reslice interpolation to the given value.
*/
VtkResliceInterpolationProperty( const std::string& value );
/**
* this function is overridden as protected, so that the user may not add
* additional invalid interpolation types.
*/
virtual bool AddEnum( const std::string& name, const IdType& id );
/**
* Adds the enumeration types as defined by vtk to the list of known
* enumeration values.
*/
virtual void AddInterpolationTypes();
};
} // end of namespace mitk
#endif
diff --git a/Core/Code/DataManagement/mitkVtkScalarModeProperty.h b/Core/Code/DataManagement/mitkVtkScalarModeProperty.h
index a161a5a58d..9daac9822f 100644
--- a/Core/Code/DataManagement/mitkVtkScalarModeProperty.h
+++ b/Core/Code/DataManagement/mitkVtkScalarModeProperty.h
@@ -1,101 +1,103 @@
/*=========================================================================
Program: Medical Imaging & Interaction Toolkit
Language: C++
Date: $Date$
Version: $Revision$
Copyright (c) German Cancer Research Center, Division of Medical and
Biological Informatics. All rights reserved.
See MITKCopyright.txt or http://www.mitk.org/copyright.html for details.
This software is distributed WITHOUT ANY WARRANTY; without even
the implied warranty of MERCHANTABILITY or FITNESS FOR A PARTICULAR
PURPOSE. See the above copyright notices for more information.
=========================================================================*/
#ifndef _MITK_VTK_SCALARMODE_PROPERTY__H_
#define _MITK_VTK_SCALARMODE_PROPERTY__H_
#include "mitkEnumerationProperty.h"
namespace mitk
{
/**
* Encapsulates the enumeration vtkInterpolation. Valid values are
* (VTK constant/Id/string representation):
* \li VTK_SCALAR_MODE_DEFAULT/0/Default,
* \li VTK_SCALAR_MODE_USE_POINT_DATA/1/PointData,
* \li VTK_SCALAR_MODE_USE_CELL_DATA/2/CellData
* \li VTK_SCALAR_MODE_USE_POINT_FIELD_DATA/3/PointFieldData
* \li VTK_SCALAR_MODE_USE_CELL_FIELD_DATA/4/CellFieldData
*/
class MITK_CORE_EXPORT VtkScalarModeProperty : public EnumerationProperty
{
public:
mitkClassMacro( VtkScalarModeProperty, EnumerationProperty );
itkNewMacro(VtkScalarModeProperty);
mitkNewMacro1Param(VtkScalarModeProperty, const IdType&);
mitkNewMacro1Param(VtkScalarModeProperty, const std::string&);
-
+
+ virtual BaseProperty& operator=(const BaseProperty& other) { return Superclass::operator=(other); }
+
/**
* Returns the current scalar mode value as defined by VTK constants.
* @returns the current scalar mode as VTK constant.
*/
virtual int GetVtkScalarMode();
virtual void SetScalarModeToDefault();
virtual void SetScalarModeToPointData();
virtual void SetScalarModeToCellData();
virtual void SetScalarModeToPointFieldData();
virtual void SetScalarModeToCellFieldData();
protected:
/**
* Constructor. Sets the representation to a default value of surface(2)
*/
VtkScalarModeProperty( );
/**
* \brief Sets the scalar mode to the given value. If it is not
* valid, the scalar mode is set to default (0).
* @param value the integer representation of the scalar mode
*/
VtkScalarModeProperty( const IdType& value );
/**
* \brief Sets the scalar mode to the given value. If it is not
* valid, the representation is set to default (0).
* @param value the string representation of the scalar mode
*/
VtkScalarModeProperty( const std::string& value );
/**
* this function is overridden as protected, so that the user may not add
* additional invalid scalar mode types.
*/
virtual bool AddEnum( const std::string& name, const IdType& id );
/**
* Adds the enumeration types as defined by vtk to the list of known
* enumeration values.
*/
virtual void AddInterpolationTypes();
};
} // end of namespace mitk
#endif //_MITK_VTK_SCALARMODE_PROPERTY__H_
diff --git a/Core/Code/DataManagement/mitkVtkVolumeRenderingProperty.h b/Core/Code/DataManagement/mitkVtkVolumeRenderingProperty.h
index c9fbdf4712..b7838cfc89 100644
--- a/Core/Code/DataManagement/mitkVtkVolumeRenderingProperty.h
+++ b/Core/Code/DataManagement/mitkVtkVolumeRenderingProperty.h
@@ -1,95 +1,97 @@
/*=========================================================================
Program: Medical Imaging & Interaction Toolkit
Language: C++
Date: $Date$
Version: $Revision: $
Copyright (c) German Cancer Research Center, Division of Medical and
Biological Informatics. All rights reserved.
See MITKCopyright.txt or http://www.mitk.org/copyright.html for details.
This software is distributed WITHOUT ANY WARRANTY; without even
the implied warranty of MERCHANTABILITY or FITNESS FOR A PARTICULAR
PURPOSE. See the above copyright notices for more information.
=========================================================================*/
#ifndef _MITK_VTK_VOLUME_RENDERING_PROPERTY__H_
#define _MITK_VTK_VOLUME_RENDERING_PROPERTY__H_
#include "mitkEnumerationProperty.h"
#define VTK_RAY_CAST_COMPOSITE_FUNCTION 1
#define VTK_VOLUME_RAY_CAST_MIP_FUNCTION 2
namespace mitk
{
/**
* Encapsulates the enumeration for volume rendering. Valid values are
* (VTK constant/Id/string representation):
* VTK_VOLUME_RAY_CAST_MIP_FUNCTION
* VTK_RAY_CAST_COMPOSITE_FUNCTION
* Default is NULL
*/
class MITK_CORE_EXPORT VtkVolumeRenderingProperty : public EnumerationProperty
{
public:
mitkClassMacro( VtkVolumeRenderingProperty, EnumerationProperty );
itkNewMacro(VtkVolumeRenderingProperty);
mitkNewMacro1Param(VtkVolumeRenderingProperty, const IdType&);
mitkNewMacro1Param(VtkVolumeRenderingProperty, const std::string&);
+ virtual BaseProperty& operator=(const BaseProperty& other) { return Superclass::operator=(other); }
+
/**
* Returns the current volume rendering type
*/
virtual int GetRenderingType();
/**
* Sets the rendering type to VTK_VOLUME_RAY_CAST_MIP_FUNCTION
*/
virtual void SetRenderingTypeToMIP();
/**
* Sets the rendering type to VTK_RAY_CAST_COMPOSITE_FUNCTION
*/
virtual void SetRenderingTypeToComposite();
protected:
/** Sets rendering type to default (VTK_RAY_CAST_COMPOSITE_FUNCTION).
*/
VtkVolumeRenderingProperty( );
/**
* Constructor. Sets rendering type to the given value.
*/
VtkVolumeRenderingProperty( const IdType& value );
/**
* Constructor. Sets rendering type to the given value.
*/
VtkVolumeRenderingProperty( const std::string& value );
/**
* this function is overridden as protected, so that the user may not add
* additional invalid rendering types.
*/
virtual bool AddEnum( const std::string& name, const IdType& id );
/**
* Adds the enumeration types as defined by vtk to the list of known
* enumeration values.
*/
virtual void AddRenderingTypes();
};
} // end of namespace mitk
#endif
diff --git a/Core/Code/DataManagement/mitkWeakPointerProperty.h b/Core/Code/DataManagement/mitkWeakPointerProperty.h
index dd71bfb88d..bea8d5de23 100644
--- a/Core/Code/DataManagement/mitkWeakPointerProperty.h
+++ b/Core/Code/DataManagement/mitkWeakPointerProperty.h
@@ -1,56 +1,58 @@
/*=========================================================================
Program: Medical Imaging & Interaction Toolkit
Language: C++
Date: $Date$
Version: $Revision$
Copyright (c) German Cancer Research Center, Division of Medical and
Biological Informatics. All rights reserved.
See MITKCopyright.txt or http://www.mitk.org/copyright.html for details.
This software is distributed WITHOUT ANY WARRANTY; without even
the implied warranty of MERCHANTABILITY or FITNESS FOR A PARTICULAR
PURPOSE. See the above copyright notices for more information.
=========================================================================*/
#ifndef MITKWEAKPOINTERPROPERTY_H_HEADER_INCLUDED_C126B791
#define MITKWEAKPOINTERPROPERTY_H_HEADER_INCLUDED_C126B791
#include "mitkCommon.h"
#include "mitkBaseProperty.h"
#include "itkWeakPointer.h"
namespace mitk {
//##Documentation
//## @brief Property containing a smart-pointer
//##
//## @ingroup DataManagement
class MITK_CORE_EXPORT WeakPointerProperty : public BaseProperty
{
public:
mitkClassMacro(WeakPointerProperty, BaseProperty);
mitkNewMacro1Param(WeakPointerProperty, itk::Object*);
virtual bool operator==(const BaseProperty& property) const;
+ virtual BaseProperty& operator=(const BaseProperty& other) { return Superclass::operator=(other); }
+
virtual ~WeakPointerProperty();
itk::Object::Pointer GetWeakPointer() const;
void SetWeakPointer(itk::Object* pointer);
protected:
itk::WeakPointer<itk::Object> m_WeakPointer;
WeakPointerProperty(itk::Object* pointer);
};
} // namespace mitk
#endif /* MITKWEAKPOINTERPROPERTY_H_HEADER_INCLUDED_C126B791 */
diff --git a/Core/Code/IO/mitkDicomSeriesReader.cpp b/Core/Code/IO/mitkDicomSeriesReader.cpp
index de6e93caca..ee9f70666d 100644
--- a/Core/Code/IO/mitkDicomSeriesReader.cpp
+++ b/Core/Code/IO/mitkDicomSeriesReader.cpp
@@ -1,968 +1,1006 @@
/*=========================================================================
Program: Medical Imaging & Interaction Toolkit
Language: C++
Date: $Date$
Version: $Revision$
Copyright (c) German Cancer Research Center, Division of Medical and
Biological Informatics. All rights reserved.
See MITKCopyright.txt or http://www.mitk.org/copyright.html for details.
This software is distributed WITHOUT ANY WARRANTY; without even
the implied warranty of MERCHANTABILITY or FITNESS FOR A PARTICULAR
PURPOSE. See the above copyright notices for more information.
=========================================================================*/
// uncomment for learning more about the internal sorting mechanisms
//#define MBILOG_ENABLE_DEBUG
#include <mitkDicomSeriesReader.h>
#include <itkGDCMSeriesFileNames.h>
#include <gdcmAttribute.h>
#include <gdcmPixmapReader.h>
#include <gdcmStringFilter.h>
#include <gdcmDirectory.h>
#include <gdcmScanner.h>
#include "mitkProperties.h"
namespace mitk
{
typedef itk::GDCMSeriesFileNames DcmFileNamesGeneratorType;
DataNode::Pointer
DicomSeriesReader::LoadDicomSeries(const StringContainer &filenames, bool sort, bool check_4d, UpdateCallBackMethod callback)
{
DataNode::Pointer node = DataNode::New();
if (DicomSeriesReader::LoadDicomSeries(filenames, *node, sort, check_4d, callback))
{
if( filenames.empty() )
{
return NULL;
}
return node;
}
else
{
return NULL;
}
}
bool
DicomSeriesReader::LoadDicomSeries(const StringContainer &filenames, DataNode &node, bool sort, bool check_4d, UpdateCallBackMethod callback)
{
if( filenames.empty() )
{
MITK_WARN << "Calling LoadDicomSeries with empty filename string container. Probably invalid application logic.";
node.SetData(NULL);
return true; // this is not actually an error but the result is very simple
}
DcmIoType::Pointer io = DcmIoType::New();
try
{
if (io->CanReadFile(filenames.front().c_str()))
{
io->SetFileName(filenames.front().c_str());
io->ReadImageInformation();
switch (io->GetComponentType())
{
case DcmIoType::UCHAR:
DicomSeriesReader::LoadDicom<unsigned char>(filenames, node, sort, check_4d, callback);
return true;
case DcmIoType::CHAR:
DicomSeriesReader::LoadDicom<char>(filenames, node, sort, check_4d, callback);
return true;
case DcmIoType::USHORT:
DicomSeriesReader::LoadDicom<unsigned short>(filenames, node, sort, check_4d, callback);
return true;
case DcmIoType::SHORT:
DicomSeriesReader::LoadDicom<short>(filenames, node, sort, check_4d, callback);
return true;
case DcmIoType::UINT:
DicomSeriesReader::LoadDicom<unsigned int>(filenames, node, sort, check_4d, callback);
return true;
case DcmIoType::INT:
DicomSeriesReader::LoadDicom<int>(filenames, node, sort, check_4d, callback);
return true;
case DcmIoType::ULONG:
DicomSeriesReader::LoadDicom<long unsigned int>(filenames, node, sort, check_4d, callback);
return true;
case DcmIoType::LONG:
DicomSeriesReader::LoadDicom<long int>(filenames, node, sort, check_4d, callback);
return true;
case DcmIoType::FLOAT:
DicomSeriesReader::LoadDicom<float>(filenames, node, sort, check_4d, callback);
return true;
case DcmIoType::DOUBLE:
DicomSeriesReader::LoadDicom<double>(filenames, node, sort, check_4d, callback);
return true;
default:
MITK_ERROR << "Found unsupported DICOM pixel type: (enum value) " << io->GetComponentType();
}
}
}
catch(itk::MemoryAllocationError& e)
{
MITK_ERROR << "Out of memory. Cannot load DICOM series: " << e.what();
}
catch(std::exception& e)
{
MITK_ERROR << "Error encountered when loading DICOM series:" << e.what();
}
catch(...)
{
MITK_ERROR << "Unspecified error encountered when loading DICOM series.";
}
return false;
}
bool
DicomSeriesReader::IsDicom(const std::string &filename)
{
DcmIoType::Pointer io = DcmIoType::New();
return io->CanReadFile(filename.c_str());
}
bool
DicomSeriesReader::IsPhilips3DDicom(const std::string &filename)
{
DcmIoType::Pointer io = DcmIoType::New();
if (io->CanReadFile(filename.c_str()))
{
//Look at header Tag 3001,0010 if it is "Philips3D"
gdcm::Reader reader;
reader.SetFileName(filename.c_str());
reader.Read();
gdcm::DataSet &data_set = reader.GetFile().GetDataSet();
gdcm::StringFilter sf;
sf.SetFile(reader.GetFile());
if (data_set.FindDataElement(gdcm::Tag(0x3001, 0x0010)) &&
(sf.ToString(gdcm::Tag(0x3001, 0x0010)) == "Philips3D "))
{
return true;
}
}
return false;
}
bool
DicomSeriesReader::ReadPhilips3DDicom(const std::string &filename, mitk::Image::Pointer output_image)
{
// Now get PhilipsSpecific Tags
gdcm::PixmapReader reader;
reader.SetFileName(filename.c_str());
reader.Read();
gdcm::DataSet &data_set = reader.GetFile().GetDataSet();
gdcm::StringFilter sf;
sf.SetFile(reader.GetFile());
gdcm::Attribute<0x0028,0x0011> dimTagX; // coloumns || sagittal
gdcm::Attribute<0x3001,0x1001, gdcm::VR::UL, gdcm::VM::VM1> dimTagZ; //I have no idea what is VM1. // (Philips specific) // transversal
gdcm::Attribute<0x0028,0x0010> dimTagY; // rows || coronal
gdcm::Attribute<0x0028,0x0008> dimTagT; // how many frames
gdcm::Attribute<0x0018,0x602c> spaceTagX; // Spacing in X , unit is "physicalTagx" (usually centimeter)
gdcm::Attribute<0x0018,0x602e> spaceTagY;
gdcm::Attribute<0x3001,0x1003, gdcm::VR::FD, gdcm::VM::VM1> spaceTagZ; // (Philips specific)
gdcm::Attribute<0x0018,0x6024> physicalTagX; // if 3, then spacing params are centimeter
gdcm::Attribute<0x0018,0x6026> physicalTagY;
gdcm::Attribute<0x3001,0x1002, gdcm::VR::US, gdcm::VM::VM1> physicalTagZ; // (Philips specific)
dimTagX.Set(data_set);
dimTagY.Set(data_set);
dimTagZ.Set(data_set);
dimTagT.Set(data_set);
spaceTagX.Set(data_set);
spaceTagY.Set(data_set);
spaceTagZ.Set(data_set);
physicalTagX.Set(data_set);
physicalTagY.Set(data_set);
physicalTagZ.Set(data_set);
unsigned int
dimX = dimTagX.GetValue(),
dimY = dimTagY.GetValue(),
dimZ = dimTagZ.GetValue(),
dimT = dimTagT.GetValue(),
physicalX = physicalTagX.GetValue(),
physicalY = physicalTagY.GetValue(),
physicalZ = physicalTagZ.GetValue();
float
spaceX = spaceTagX.GetValue(),
spaceY = spaceTagY.GetValue(),
spaceZ = spaceTagZ.GetValue();
if (physicalX == 3) // spacing parameter in cm, have to convert it to mm.
spaceX = spaceX * 10;
if (physicalY == 3) // spacing parameter in cm, have to convert it to mm.
spaceY = spaceY * 10;
if (physicalZ == 3) // spacing parameter in cm, have to convert it to mm.
spaceZ = spaceZ * 10;
// Ok, got all necessary Tags!
// Now read Pixeldata (7fe0,0010) X x Y x Z x T Elements
const gdcm::Pixmap &pixels = reader.GetPixmap();
gdcm::RAWCodec codec;
codec.SetPhotometricInterpretation(gdcm::PhotometricInterpretation::MONOCHROME2);
codec.SetPixelFormat(pixels.GetPixelFormat());
codec.SetPlanarConfiguration(0);
gdcm::DataElement out;
codec.Decode(data_set.GetDataElement(gdcm::Tag(0x7fe0, 0x0010)), out);
const gdcm::ByteValue *bv = out.GetByteValue();
const char *new_pixels = bv->GetPointer();
// Create MITK Image + Geometry
typedef itk::Image<unsigned char, 4> ImageType; //Pixeltype might be different sometimes? Maybe read it out from header
ImageType::RegionType myRegion;
ImageType::SizeType mySize;
ImageType::IndexType myIndex;
ImageType::SpacingType mySpacing;
ImageType::Pointer imageItk = ImageType::New();
mySpacing[0] = spaceX;
mySpacing[1] = spaceY;
mySpacing[2] = spaceZ;
mySpacing[3] = 1;
myIndex[0] = 0;
myIndex[1] = 0;
myIndex[2] = 0;
myIndex[3] = 0;
mySize[0] = dimX;
mySize[1] = dimY;
mySize[2] = dimZ;
mySize[3] = dimT;
myRegion.SetSize( mySize);
myRegion.SetIndex( myIndex );
imageItk->SetSpacing(mySpacing);
imageItk->SetRegions( myRegion);
imageItk->Allocate();
imageItk->FillBuffer(0);
itk::ImageRegionIterator<ImageType> iterator(imageItk, imageItk->GetLargestPossibleRegion());
iterator.GoToBegin();
unsigned long pixCount = 0;
unsigned long planeSize = dimX*dimY;
unsigned long planeCount = 0;
unsigned long timeCount = 0;
unsigned long numberOfSlices = dimZ;
while (!iterator.IsAtEnd())
{
unsigned long adressedPixel =
pixCount
+ (numberOfSlices-1-planeCount)*planeSize // add offset to adress the first pixel of current plane
+ timeCount*numberOfSlices*planeSize; // add time offset
iterator.Set( new_pixels[ adressedPixel ] );
pixCount++;
++iterator;
if (pixCount == planeSize)
{
pixCount = 0;
planeCount++;
}
if (planeCount == numberOfSlices)
{
planeCount = 0;
timeCount++;
}
if (timeCount == dimT)
{
break;
}
}
mitk::CastToMitkImage(imageItk, output_image);
return true; // actually never returns false yet.. but exception possible
}
DicomSeriesReader::TwoStringContainers
DicomSeriesReader::AnalyzeFileForITKImageSeriesReaderSpacingAssumption(
const StringContainer& files,
const gdcm::Scanner::MappingType& tagValueMappings_)
{
// result.first = files that fit ITK's assumption
// result.second = files that do not fit, should be run through AnalyzeFileForITKImageSeriesReaderSpacingAssumption() again
TwoStringContainers result;
// we const_cast here, because I could not use a map.at(), which would make the code much more readable
gdcm::Scanner::MappingType& tagValueMappings = const_cast<gdcm::Scanner::MappingType&>(tagValueMappings_);
const gdcm::Tag tagImagePositionPatient(0x0020,0x0032); // Image Position (Patient)
const gdcm::Tag tagImageOrientation(0x0020, 0x0037); // Image Orientation
Vector3D fromFirstToSecondOrigin; fromFirstToSecondOrigin.Fill(0.0);
bool fromFirstToSecondOriginInitialized(false);
Point3D thisOrigin;
Point3D lastOrigin;
Point3D lastDifferentOrigin;
bool lastOriginInitialized(false);
MITK_DEBUG << "--------------------------------------------------------------------------------";
MITK_DEBUG << "Analyzing files for z-spacing assumption of ITK's ImageSeriesReader ";
unsigned int fileIndex(0);
for (StringContainer::const_iterator fileIter = files.begin();
fileIter != files.end();
++fileIter, ++fileIndex)
{
bool fileFitsIntoPattern(false);
std::string thisOriginString;
// Read tag value into point3D. PLEASE replace this by appropriate GDCM code if you figure out how to do that
const char* value = tagValueMappings[fileIter->c_str()][tagImagePositionPatient];
if (value)
{
thisOriginString = value;
}
std::istringstream originReader(thisOriginString);
std::string coordinate;
unsigned int dim(0);
while( std::getline( originReader, coordinate, '\\' ) ) thisOrigin[dim++] = atof(coordinate.c_str());
if (dim != 3)
{
MITK_ERROR << "Reader implementation made wrong assumption on tag (0020,0032). Found " << dim << "instead of 3 values.";
}
MITK_DEBUG << " " << fileIndex << " " << *fileIter
<< " at "
<< thisOriginString << "(" << thisOrigin[0] << "," << thisOrigin[1] << "," << thisOrigin[2] << ")";
if ( lastOriginInitialized && (thisOrigin == lastOrigin) )
{
MITK_DEBUG << " ==> Sort away " << *fileIter << " for separate time step"; // we already have one occupying this position
result.second.push_back( *fileIter );
fileFitsIntoPattern = false;
}
else
{
if (!fromFirstToSecondOriginInitialized && lastOriginInitialized) // calculate vector as soon as possible when we get a new position
{
fromFirstToSecondOrigin = thisOrigin - lastDifferentOrigin;
fromFirstToSecondOriginInitialized = true;
// Now make sure this direction is along the normal vector of the first slice
// If this is NOT the case, then we have a data set with a TILTED GANTRY geometry,
// which cannot be loaded into a single mitk::Image at the moment
// Again ugly code to read tag Image Orientation into two vEctors
Vector3D right; right.Fill(0.0);
Vector3D up; right.Fill(0.0); // might be down as well, but it is just a name at this point
std::string thisOrientationString;
const char* value = tagValueMappings[fileIter->c_str()][tagImageOrientation];
if (value)
{
thisOrientationString = value;
}
std::istringstream orientationReader(thisOrientationString);
std::string coordinate;
unsigned int dim(0);
while( std::getline( orientationReader, coordinate, '\\' ) )
if (dim<3) right[dim++] = atof(coordinate.c_str());
else up[dim++ - 3] = atof(coordinate.c_str());
if (dim != 6)
{
MITK_ERROR << "Reader implementation made wrong assumption on tag (0020,0037). Found " << dim << "instead of 6 values.";
}
/*
Determine if line (thisOrigin + l * normal) contains lastDifferentOrigin.
Done by calculating the distance of lastDifferentOrigin from line (thisOrigin + l *normal)
E.g. http://mathworld.wolfram.com/Point-LineDistance3-Dimensional.html
squared distance = | (pointAlongNormal - thisOrign) x (thisOrigin - lastDifferentOrigin) | ^ 2
/
|pointAlongNormal - thisOrigin| ^ 2
( x meaning the cross product )
MITK_DEBUG << "Tilt check: right vector (" << right[0] << "," << right[1] << "," << right[2] << "), "
"up vector (" << up[0] << "," << up[1] << "," << up[2] << ")";
*/
Vector3D normal = itk::CrossProduct(right, up);
Point3D pointAlongNormal = thisOrigin + normal;
double numerator = itk::CrossProduct( pointAlongNormal - thisOrigin , thisOrigin - lastDifferentOrigin ).GetSquaredNorm();
double denominator = (pointAlongNormal - thisOrigin).GetSquaredNorm();
double distance = sqrt(numerator / denominator);
if (distance > 0.001) // mitk::eps is too small; 1/1000 of a mm should be enough to detect tilt
{
MITK_DEBUG << " Series might contain a tilted geometry";
MITK_DEBUG << " Distance of expected slice origin from actual slice origin: " << distance;
MITK_DEBUG << " ==> Sort away " << *fileIter << " for later analysis";
/* Pessimistic approach: split block right here
result.first.assign( files.begin(), fileIter );
result.second.insert( result.second.end(), fileIter, files.end() );
return result; // stop processing with first split
*/
/* optimistic approach: save file for later, check all further files */
result.second.push_back(*fileIter);
fileFitsIntoPattern = false;
}
else
{
result.first.push_back(*fileIter); // this file is good for current block
fileFitsIntoPattern = true;
}
}
else if (fromFirstToSecondOriginInitialized) // we already know the offset between slices
{
Point3D assumedOrigin = lastDifferentOrigin + fromFirstToSecondOrigin;
Vector3D originError = assumedOrigin - thisOrigin;
double norm = originError.GetNorm();
double toleratedError(0.005); // max. 1/10mm error when measurement crosses 20 slices in z direction
if (norm > toleratedError)
{
MITK_DEBUG << " File does not fit into the inter-slice distance pattern (diff = "
<< norm << ", allowed "
<< toleratedError << ").";
MITK_DEBUG << " Expected position (" << assumedOrigin[0] << ","
<< assumedOrigin[1] << ","
<< assumedOrigin[2] << "), got position ("
<< thisOrigin[0] << ","
<< thisOrigin[1] << ","
<< thisOrigin[2] << ")";
MITK_DEBUG << " ==> Sort away " << *fileIter << " for later analysis";
// At this point we know we deviated from the expectation of ITK's ImageSeriesReader
// We split the input file list at this point, i.e. all files up to this one (excluding it)
// are returned as group 1, the remaining files (including the faulty one) are group 2
/*
Pessimistic approach: split right here:
result.first.assign( files.begin(), fileIter );
result.second.insert( result.second.end(), fileIter, files.end() );
return result; // stop processing with first split
*/
/* Optimistic approach: check if any of the remaining slices fits in */
result.second.push_back( *fileIter ); // sort away for further analysis
fileFitsIntoPattern = false;
}
else
{
result.first.push_back(*fileIter); // this file is good for current block
fileFitsIntoPattern = true;
}
}
else // this should be the very first slice
{
result.first.push_back(*fileIter); // this file is good for current block
fileFitsIntoPattern = true;
}
}
// recored current origin for reference in later iterations
if ( !lastOriginInitialized || fileFitsIntoPattern && (thisOrigin != lastOrigin) )
{
lastDifferentOrigin = thisOrigin;
}
lastOrigin = thisOrigin;
lastOriginInitialized = true;
}
return result;
}
DicomSeriesReader::UidFileNamesMap
DicomSeriesReader::GetSeries(const StringContainer& files, const StringContainer &restrictions)
{
return GetSeries(files, true, restrictions);
}
DicomSeriesReader::UidFileNamesMap
-DicomSeriesReader::GetSeries(const StringContainer& files, bool sortTo3DPlust, const StringContainer &restrictions)
+DicomSeriesReader::GetSeries(const StringContainer& files, bool sortTo3DPlust, const StringContainer& /*restrictions*/)
{
/**
assumption about this method:
returns a map of uid-like-key --> list(filename)
each entry should contain filenames that have images of same
- series instance uid (automatically done by GDCMSeriesFileNames
- 0020,0037 image orientation (patient)
- 0028,0030 pixel spacing (x,y)
- 0018,0050 slice thickness
*/
UidFileNamesMap groupsOfSimilarImages; // preliminary result, refined into the final result mapOf3DPlusTBlocks
// use GDCM directly, itk::GDCMSeriesFileNames does not work with GDCM 2
// PART I: scan files for sorting relevant DICOM tags,
// separate images that differ in any of those
// attributes (they cannot possibly form a 3D block)
// scan for relevant tags in dicom files
gdcm::Scanner scanner;
const gdcm::Tag tagSeriesInstanceUID(0x0020,0x000e); // Series Instance UID
scanner.AddTag( tagSeriesInstanceUID );
const gdcm::Tag tagImageOrientation(0x0020, 0x0037); // image orientation
scanner.AddTag( tagImageOrientation );
const gdcm::Tag tagPixelSpacing(0x0028, 0x0030); // pixel spacing
scanner.AddTag( tagPixelSpacing );
const gdcm::Tag tagSliceThickness(0x0018, 0x0050); // slice thickness
scanner.AddTag( tagSliceThickness );
const gdcm::Tag tagNumberOfRows(0x0028, 0x0010); // number rows
scanner.AddTag( tagNumberOfRows );
const gdcm::Tag tagNumberOfColumns(0x0028, 0x0011); // number cols
scanner.AddTag( tagNumberOfColumns );
// additional tags read in this scan to allow later analysis
// THESE tag are not used for initial separating of files
const gdcm::Tag tagImagePositionPatient(0x0020,0x0032); // Image Position (Patient)
scanner.AddTag( tagImagePositionPatient );
// TODO add further restrictions from arguments
// let GDCM scan files
if ( !scanner.Scan( files ) )
{
MITK_ERROR << "gdcm::Scanner failed when scanning " << files.size() << " input files.";
return groupsOfSimilarImages;
}
// assign files IDs that will separate them for loading into image blocks
for (gdcm::Scanner::ConstIterator fileIter = scanner.Begin();
fileIter != scanner.End();
++fileIter)
{
//MITK_DEBUG << "Scan file " << fileIter->first << std::endl;
if ( std::string(fileIter->first).empty() ) continue; // TODO understand why Scanner has empty string entries
// we const_cast here, because I could not use a map.at() function in CreateMoreUniqueSeriesIdentifier.
// doing the same thing with find would make the code less readable. Since we forget the Scanner results
// anyway after this function, we can simply tolerate empty map entries introduced by bad operator[] access
std::string moreUniqueSeriesId = CreateMoreUniqueSeriesIdentifier( const_cast<gdcm::Scanner::TagToValue&>(fileIter->second) );
groupsOfSimilarImages [ moreUniqueSeriesId ].push_back( fileIter->first );
}
// PART III: sort slices spatially
for ( UidFileNamesMap::const_iterator groupIter = groupsOfSimilarImages.begin(); groupIter != groupsOfSimilarImages.end(); ++groupIter )
{
try
{
groupsOfSimilarImages[ groupIter->first ] = SortSeriesSlices( groupIter->second ); // sort each slice group spatially
} catch(...)
{
MITK_ERROR << "Catched something.";
}
}
// PART II: analyze pre-sorted images for valid blocks (i.e. blocks of equal z-spacing),
// separate into multiple blocks if necessary.
//
// Analysis performs the following steps:
// * imitate itk::ImageSeriesReader: use the distance between the first two images as z-spacing
// * check what images actually fulfill ITK's z-spacing assumption
// * separate all images that fail the test into new blocks, re-iterate analysis for these blocks
UidFileNamesMap mapOf3DPlusTBlocks; // final result of this function
for ( UidFileNamesMap::const_iterator groupIter = groupsOfSimilarImages.begin(); groupIter != groupsOfSimilarImages.end(); ++groupIter )
{
UidFileNamesMap mapOf3DBlocks; // intermediate result for only this group(!)
StringContainer filesStillToAnalyze = groupIter->second;
std::string groupUID = groupIter->first;
unsigned int subgroup(0);
MITK_DEBUG << "Analyze group " << groupUID;
while (!filesStillToAnalyze.empty()) // repeat until all files are grouped somehow
{
TwoStringContainers analysisResult = AnalyzeFileForITKImageSeriesReaderSpacingAssumption( filesStillToAnalyze, scanner.GetMappings() );
// enhance the UID for additional groups
std::stringstream newGroupUID;
newGroupUID << groupUID << '.' << subgroup;
mapOf3DBlocks[ newGroupUID.str() ] = analysisResult.first;
MITK_DEBUG << "Result: sorted 3D group " << newGroupUID.str() << " with " << mapOf3DBlocks[ newGroupUID.str() ].size() << " files";
++subgroup;
filesStillToAnalyze = analysisResult.second; // remember what needs further analysis
}
// end of grouping, now post-process groups
// PART IV: attempt to group blocks to 3D+t blocks if requested
// inspect entries of mapOf3DBlocks
// - if number of files is identical to previous entry, collect for 3D+t block
// - as soon as number of files changes from previous entry, record collected blocks as 3D+t block, start a new one, continue
// decide whether or not to group 3D blocks into 3D+t blocks where possible
if ( !sortTo3DPlust )
{
// copy 3D blocks to output
// TODO avoid collisions (or prove impossibility)
mapOf3DPlusTBlocks.insert( mapOf3DBlocks.begin(), mapOf3DBlocks.end() );
}
else
{
// sort 3D+t (as described in "PART IV")
MITK_DEBUG << "================================================================================";
MITK_DEBUG << "3D+t analysis:";
unsigned int numberOfFilesInPreviousBlock(0);
std::string previousBlockKey;
for ( UidFileNamesMap::const_iterator block3DIter = mapOf3DBlocks.begin();
block3DIter != mapOf3DBlocks.end();
++block3DIter )
{
unsigned int numberOfFilesInThisBlock = block3DIter->second.size();
std::string thisBlockKey = block3DIter->first;
if (numberOfFilesInPreviousBlock == 0)
{
numberOfFilesInPreviousBlock = numberOfFilesInThisBlock;
mapOf3DPlusTBlocks[thisBlockKey].insert( mapOf3DPlusTBlocks[thisBlockKey].end(),
block3DIter->second.begin(),
block3DIter->second.end() );
MITK_DEBUG << " 3D+t group " << thisBlockKey << " started";
previousBlockKey = thisBlockKey;
}
else
{
bool identicalOrigins;
try {
// check whether this and the previous block share a comon origin
// TODO should be safe, but a little try/catch or other error handling wouldn't hurt
std::string thisOriginString = scanner.GetValue( mapOf3DBlocks[thisBlockKey].front().c_str(), tagImagePositionPatient );
std::string previousOriginString = scanner.GetValue( mapOf3DBlocks[previousBlockKey].front().c_str(), tagImagePositionPatient );
// also compare last origin, because this might differ if z-spacing is different
std::string thisDestinationString = scanner.GetValue( mapOf3DBlocks[thisBlockKey].back().c_str(), tagImagePositionPatient );
std::string previousDestinationString = scanner.GetValue( mapOf3DBlocks[previousBlockKey].back().c_str(), tagImagePositionPatient );
identicalOrigins = ( (thisOriginString == previousOriginString) && (thisDestinationString == previousDestinationString) );
} catch(...)
{
identicalOrigins = false;
}
if (identicalOrigins && (numberOfFilesInPreviousBlock == numberOfFilesInThisBlock))
{
// group with previous block
mapOf3DPlusTBlocks[previousBlockKey].insert( mapOf3DPlusTBlocks[previousBlockKey].end(),
block3DIter->second.begin(),
block3DIter->second.end() );
MITK_DEBUG << " --> group enhanced with another timestep";
}
else
{
// start a new block
mapOf3DPlusTBlocks[thisBlockKey].insert( mapOf3DPlusTBlocks[thisBlockKey].end(),
block3DIter->second.begin(),
block3DIter->second.end() );
MITK_DEBUG << " ==> group closed with " << mapOf3DPlusTBlocks[previousBlockKey].size() / numberOfFilesInPreviousBlock << " time steps";
previousBlockKey = thisBlockKey;
MITK_DEBUG << " 3D+t group " << thisBlockKey << " started";
}
}
numberOfFilesInPreviousBlock = numberOfFilesInThisBlock;
}
}
}
MITK_DEBUG << "================================================================================";
MITK_DEBUG << "Summary: ";
for ( UidFileNamesMap::const_iterator groupIter = mapOf3DPlusTBlocks.begin(); groupIter != mapOf3DPlusTBlocks.end(); ++groupIter )
{
MITK_DEBUG << " Image volume " << groupIter->first << " with " << groupIter->second.size() << " files";
}
MITK_DEBUG << "Done. ";
MITK_DEBUG << "================================================================================";
return mapOf3DPlusTBlocks;
}
DicomSeriesReader::UidFileNamesMap
DicomSeriesReader::GetSeries(const std::string &dir, const StringContainer &restrictions)
{
gdcm::Directory directoryLister;
directoryLister.Load( dir.c_str(), false ); // non-recursive
return GetSeries(directoryLister.GetFilenames(), restrictions);
}
std::string
DicomSeriesReader::CreateSeriesIdentifierPart( gdcm::Scanner::TagToValue& tagValueMap, const gdcm::Tag& tag )
{
std::string result;
try
{
result = IDifyTagValue( tagValueMap[ tag ] ? tagValueMap[ tag ] : std::string("") );
}
catch (std::exception& e)
{
MITK_WARN << "Could not access tag " << tag << ": " << e.what();
}
return result;
}
std::string
DicomSeriesReader::CreateMoreUniqueSeriesIdentifier( gdcm::Scanner::TagToValue& tagValueMap )
{
const gdcm::Tag tagSeriesInstanceUID(0x0020,0x000e); // Series Instance UID
const gdcm::Tag tagImageOrientation(0x0020, 0x0037); // image orientation
const gdcm::Tag tagPixelSpacing(0x0028, 0x0030); // pixel spacing
const gdcm::Tag tagSliceThickness(0x0018, 0x0050); // slice thickness
const gdcm::Tag tagNumberOfRows(0x0028, 0x0010); // number rows
const gdcm::Tag tagNumberOfColumns(0x0028, 0x0011); // number cols
std::string constructedID;
try
{
constructedID = tagValueMap[ tagSeriesInstanceUID ];
}
catch (std::exception& e)
{
MITK_ERROR << "CreateMoreUniqueSeriesIdentifier() could not access series instance UID. Something is seriously wrong with this image.";
MITK_ERROR << "Error from exception: " << e.what();
}
constructedID += CreateSeriesIdentifierPart( tagValueMap, tagNumberOfRows );
constructedID += CreateSeriesIdentifierPart( tagValueMap, tagNumberOfColumns );
constructedID += CreateSeriesIdentifierPart( tagValueMap, tagPixelSpacing );
constructedID += CreateSeriesIdentifierPart( tagValueMap, tagSliceThickness );
constructedID += CreateSeriesIdentifierPart( tagValueMap, tagImageOrientation );
constructedID.resize( constructedID.length() - 1 ); // cut of trailing '.'
return constructedID;
}
std::string
DicomSeriesReader::IDifyTagValue(const std::string& value)
{
std::string IDifiedValue( value );
if (value.empty()) throw std::logic_error("IDifyTagValue() illegaly called with empty tag value");
// Eliminate non-alnum characters, including whitespace...
// that may have been introduced by concats.
for(std::size_t i=0; i<IDifiedValue.size(); i++)
{
while(i<IDifiedValue.size()
&& !( IDifiedValue[i] == '.'
|| (IDifiedValue[i] >= 'a' && IDifiedValue[i] <= 'z')
|| (IDifiedValue[i] >= '0' && IDifiedValue[i] <= '9')
|| (IDifiedValue[i] >= 'A' && IDifiedValue[i] <= 'Z')))
{
IDifiedValue.erase(i, 1);
}
}
IDifiedValue += ".";
return IDifiedValue;
}
DicomSeriesReader::StringContainer
DicomSeriesReader::GetSeries(const std::string &dir, const std::string &series_uid, const StringContainer &restrictions)
{
UidFileNamesMap allSeries = GetSeries(dir, restrictions);
StringContainer resultingFileList;
for ( UidFileNamesMap::const_iterator idIter = allSeries.begin();
idIter != allSeries.end();
++idIter )
{
if ( idIter->first.find( series_uid ) == 0 ) // this ID starts with given series_uid
{
resultingFileList.insert( resultingFileList.end(), idIter->second.begin(), idIter->second.end() ); // append
}
}
return resultingFileList;
}
DicomSeriesReader::StringContainer
DicomSeriesReader::SortSeriesSlices(const StringContainer &unsortedFilenames)
{
gdcm::Sorter sorter;
sorter.SetSortFunction(DicomSeriesReader::GdcmSortFunction);
try
{
sorter.Sort(unsortedFilenames);
return sorter.GetFilenames();
}
catch(std::logic_error& e)
{
MITK_WARN << "Sorting error. Leaving series unsorted.";
return unsortedFilenames;
}
}
bool
DicomSeriesReader::GdcmSortFunction(const gdcm::DataSet &ds1, const gdcm::DataSet &ds2)
{
// make sure we habe Image Position and Orientation
if ( ! (
ds1.FindDataElement(gdcm::Tag(0x0020,0x0032)) &&
ds1.FindDataElement(gdcm::Tag(0x0020,0x0037)) &&
ds2.FindDataElement(gdcm::Tag(0x0020,0x0032)) &&
ds2.FindDataElement(gdcm::Tag(0x0020,0x0037))
)
)
{
MITK_WARN << "Dicom images are missing attributes for a meaningful sorting.";
throw std::logic_error("Dicom images are missing attributes for a meaningful sorting.");
}
gdcm::Attribute<0x0020,0x0032> image_pos1; // Image Position (Patient)
gdcm::Attribute<0x0020,0x0037> image_orientation1; // Image Orientation (Patient)
image_pos1.Set(ds1);
image_orientation1.Set(ds1);
gdcm::Attribute<0x0020,0x0032> image_pos2;
gdcm::Attribute<0x0020,0x0037> image_orientation2;
image_pos2.Set(ds2);
image_orientation2.Set(ds2);
if (image_orientation1 != image_orientation2)
{
MITK_ERROR << "Dicom images have different orientations.";
throw std::logic_error("Dicom images have different orientations. Call GetSeries() first to separate images.");
}
double normal[3];
normal[0] = image_orientation1[1] * image_orientation1[5] - image_orientation1[2] * image_orientation1[4];
normal[1] = image_orientation1[2] * image_orientation1[3] - image_orientation1[0] * image_orientation1[5];
normal[2] = image_orientation1[0] * image_orientation1[4] - image_orientation1[1] * image_orientation1[3];
double
dist1 = 0.0,
dist2 = 0.0;
for (unsigned char i = 0u; i < 3u; ++i)
{
dist1 += normal[i] * image_pos1[i];
dist2 += normal[i] * image_pos2[i];
}
if ( fabs(dist1 - dist2) < mitk::eps)
{
gdcm::Attribute<0x0008,0x0032> acq_time1; // Acquisition time (may be missing, so we check existence first)
gdcm::Attribute<0x0008,0x0032> acq_time2;
if (ds1.FindDataElement(gdcm::Tag(0x0008,0x0032)))
acq_time1.Set(ds1);
if (ds2.FindDataElement(gdcm::Tag(0x0008,0x0032)))
acq_time2.Set(ds2);
// TODO this could lead to comparison of unset times (does Attribute initialize to good defaults?)
// exception: same position: compare by acquisition time
return acq_time1 < acq_time2;
}
else
{
// default: compare position
return dist1 < dist2;
}
}
std::string DicomSeriesReader::GetConfigurationString()
{
std::stringstream configuration;
configuration << "MITK_USE_GDCMIO: ";
configuration << "true";
configuration << "\n";
configuration << "GDCM_VERSION: ";
#ifdef GDCM_MAJOR_VERSION
configuration << GDCM_VERSION;
#endif
//configuration << "\n";
return configuration.str();
}
+
+void DicomSeriesReader::CopyMetaDataToImageProperties(StringContainer filenames, const gdcm::Scanner::MappingType &tagValueMappings_, DcmIoType *io, Image *image)
+{
+ std::list<StringContainer> imageBlock;
+ imageBlock.push_back(filenames);
+ CopyMetaDataToImageProperties(imageBlock, tagValueMappings_, io, image);
+}
-void DicomSeriesReader::CopyMetaDataToImageProperties( const StringContainer& files, DcmIoType* io, Image* image )
+void DicomSeriesReader::CopyMetaDataToImageProperties( std::list<StringContainer> imageBlock, const gdcm::Scanner::MappingType& tagValueMappings_, DcmIoType* io, Image* image)
{
if (!io || !image) return;
StringLookupTable filesForSlices;
+ StringLookupTable sliceLocationForSlices;
+ StringLookupTable instanceNumberForSlices;
+ StringLookupTable SOPInstanceNumberForSlices;
+
+ gdcm::Scanner::MappingType& tagValueMappings = const_cast<gdcm::Scanner::MappingType&>(tagValueMappings_);
- unsigned int slice(0);
- for ( StringContainer::const_iterator fIter = files.begin();
- fIter != files.end();
- ++fIter, ++slice )
+ //DICOM tags which should be added to the image properties
+ const gdcm::Tag tagSliceLocation(0x0020, 0x1041); // slice location
+
+ const gdcm::Tag tagInstanceNumber(0x0020, 0x0013); // (image) instance number
+
+ const gdcm::Tag tagSOPInstanceNumber(0x0008, 0x0018); // SOP instance number
+ unsigned int timeStep(0);
+
+ std::string propertyKeySliceLocation = "dicom.image.0020.1041";
+ std::string propertyKeyInstanceNumber = "dicom.image.0020.0013";
+ std::string propertyKeySOPInstanceNumber = "dicom.image.0008.0018";
+
+ for ( std::list<StringContainer>::iterator i = imageBlock.begin(); i != imageBlock.end(); i++, timeStep++ )
{
- filesForSlices.SetTableValue( slice, *fIter );
- }
- image->SetProperty( "files", StringLookupTableProperty::New( filesForSlices ) );
+ const StringContainer& files = (*i);
+ unsigned int slice(0);
+ for ( StringContainer::const_iterator fIter = files.begin();
+ fIter != files.end();
+ ++fIter, ++slice )
+ {
+ filesForSlices.SetTableValue( slice, *fIter );
+ gdcm::Scanner::TagToValue tagValueMapForFile = tagValueMappings[fIter->c_str()];
+ if(tagValueMapForFile.find(tagSliceLocation) != tagValueMapForFile.end())
+ sliceLocationForSlices.SetTableValue(slice, tagValueMapForFile[tagSliceLocation]);
+ if(tagValueMapForFile.find(tagInstanceNumber) != tagValueMapForFile.end())
+ instanceNumberForSlices.SetTableValue(slice, tagValueMapForFile[tagInstanceNumber]);
+ if(tagValueMapForFile.find(tagSOPInstanceNumber) != tagValueMapForFile.end())
+ SOPInstanceNumberForSlices.SetTableValue(slice, tagValueMapForFile[tagSOPInstanceNumber]);
+ }
+
+ image->SetProperty( "files", StringLookupTableProperty::New( filesForSlices ) );
+ //If more than one time step add postfix ".t" + timestep
+ if(timeStep != 0)
+ {
+ propertyKeySliceLocation.append(".t" + timeStep);
+ propertyKeyInstanceNumber.append(".t" + timeStep);
+ propertyKeySOPInstanceNumber.append(".t" + timeStep);
+ }
+ image->SetProperty( propertyKeySliceLocation.c_str(), StringLookupTableProperty::New( sliceLocationForSlices ) );
+ image->SetProperty( propertyKeyInstanceNumber.c_str(), StringLookupTableProperty::New( instanceNumberForSlices ) );
+ image->SetProperty( propertyKeySOPInstanceNumber.c_str(), StringLookupTableProperty::New( SOPInstanceNumberForSlices ) );
+ }
/*
TODO
DICOM tags for patient, study, series level can easily be copied from
io->GetMetaDataDictionary to appropriate mitk::Image::m_PropertyList entries.
Keys should follow the format "dicom.patient.gggg.eeee",
values the raw strings from ITK initially, no type specific handling.
-
- Image level attributes will cause an additional run of the files
- through gdcm::Scanner probably. Tags of interest would be:
-
- (0020,1041) Slice Location (for verification of loading)
- (0020,0013) Instance Number (for display and visual reference against PACS for users)
- (0008,0018) SOP Instance UID (for real reference to PACS in applications)
-
*/
}
} // end namespace mitk
#include <mitkDicomSeriesReader.txx>
diff --git a/Core/Code/IO/mitkDicomSeriesReader.h b/Core/Code/IO/mitkDicomSeriesReader.h
index 63117021f0..81df6c582a 100644
--- a/Core/Code/IO/mitkDicomSeriesReader.h
+++ b/Core/Code/IO/mitkDicomSeriesReader.h
@@ -1,439 +1,445 @@
/*=========================================================================
Program: Medical Imaging & Interaction Toolkit
Language: C++
Date: $Date$
Version: $Revision$
Copyright (c) German Cancer Research Center, Division of Medical and
Biological Informatics. All rights reserved.
See MITKCopyright.txt or http://www.mitk.org/copyright.html for details.
This software is distributed WITHOUT ANY WARRANTY; without even
the implied warranty of MERCHANTABILITY or FITNESS FOR A PARTICULAR
PURPOSE. See the above copyright notices for more information.
=========================================================================*/
#ifndef mitkDicomSeriesReader_h
#define mitkDicomSeriesReader_h
#include "mitkDataNode.h"
#include "mitkConfig.h"
#include <itkGDCMImageIO.h>
#include <itkImageSeriesReader.h>
#include <itkCommand.h>
#include <gdcmConfigure.h>
#include <gdcmDataSet.h>
#include <gdcmRAWCodec.h>
#include <gdcmSorter.h>
#include <gdcmScanner.h>
#include <gdcmPixmapReader.h>
#include <gdcmStringFilter.h>
namespace mitk
{
/**
\brief Loading DICOM images as MITK images.
- \ref DicomSeriesReader_purpose
- \ref DicomSeriesReader_limitations
- \ref DicomSeriesReader_usage
- \ref DicomSeriesReader_sorting
- \ref DicomSeriesReader_sorting1
- \ref DicomSeriesReader_sorting2
- \ref DicomSeriesReader_sorting3
- \ref DicomSeriesReader_sorting4
- \ref DicomSeriesReader_tests
\section DicomSeriesReader_purpose Purpose
DicomSeriesReader serves as a central class for loading DICOM images as mitk::Image.
As the term "DICOM image" covers a huge variety of possible modalities and
implementations, and since MITK assumes that 3D images are made up of continuous blocks
of slices without any gaps or changes in orientation, the loading mechanism must
implement a number of decisions and compromises.
<b>The main intention of this implementation is not efficiency but correcness of generated slice positions!</b>
\section DicomSeriesReader_limitations Assumptions and limitations
The class is working only with GDCM 2.0.14 (or possibly newer). This version is the
default of an MITK super-build. Support for other versions or ITK's DicomIO was dropped
because of the associated complexity of DicomSeriesReader.
\b Assumptions
- expected to work for SOP Classes CT Image Storage and MR Image Storage (NOT for the "Enhanced" variants containing multi-frame images)
- special treatment for a certain type of Philips 3D ultrasound (recogized by tag 3001,0010 set to "Philips3D")
- loader will always attempt to read multiple single slices as a single 3D image volume (i.e. mitk::Image)
- slices will be grouped by basic properties such as orientation, rows, columns, spacing and grouped into as large blocks as possible
\b Options
- images that cover the same piece of space (i.e. position, orientation, and dimensions are equal)
can be interpreted as time-steps of the same image, i.e. a series will be loaded as 3D+t
\b Limitations
- the 3D+t assumption only works if all time-steps have an equal number of slices and if all
have the Acquisition Time attribute set to meaningful values
- Images from tilted CT gantries CAN ONLY be loaded as a series of single-slice images, since
mitk::Image or the accompanying mapper are not (yet?) capable of representing such geometries
- Secondary Capture images are expected to have the (0018,2010) tag describing the pixel spacing.
If only the (0028,0030) tag is set, the spacing will be misinterpreted as (1,1)
\section DicomSeriesReader_usage Usage
The starting point for an application is a set of DICOM files that should be loaded.
For convenience, DicomSeriesReader can also parse a whole directory for DICOM files,
but an application should better know exactly what to load.
Loading is then done in two steps:
1. <b>Group the files into spatial blocks</b> by calling GetSeries().
This method will sort all passed files into meaningful blocks that
could fit into an mitk::Image. Sorting for 3D+t loading is optional but default.
The \b return value of this function is a list of identifiers similar to
DICOM UIDs, each associated to a sorted list of file names.
2. <b>Load a sorted set of files</b> by calling LoadDicomSeries().
This method expects go receive the sorting output of GetSeries().
The method will then invoke ITK methods to actually load the
files into memory and put them into mitk::Images. Again, loading
as 3D+t is optional.
Example:
\code
// only a directory is known at this point: /home/who/dicom
DicomSeriesReader::UidFileNamesMap allImageBlocks = DicomSeriesReader::GetSeries("/home/who/dicom/");
// file now divided into groups of identical image size, orientation, spacing, etc.
// each of these lists should be loadable as an mitk::Image.
DicomSeriesReader::StringContainer seriesToLoad = allImageBlocks[...]; // decide what to load
// final step: load into DataNode (can result in 3D+t image)
DataNode::Pointer node = DicomSeriesReader::LoadDicomSeries( oneBlockSorted );
Image::Pointer image = dynamic_cast<mitk::Image*>( node->GetData() );
\endcode
\section DicomSeriesReader_sorting Logic for sorting 2D slices from DICOM images into 3D+t blocks for mitk::Image
The general sorting mechanism (implemented in GetSeries) groups and sorts a set of DICOM files, each assumed to contain a single CT/MR slice.
In the following we refer to those file groups as "blocks", since this is what they are meant to become when loaded into an mitk::Image.
\subsection DicomSeriesReader_sorting1 Step 1: Avoiding pure non-sense
A first pass separates slices that cannot possibly be loaded together because of restrictions of mitk::Image.
After this steps, each block contains only slices that match in all of the following DICOM tags:
- (0020,0037) Image Orientation
- (0028,0030) Pixel Spacing
- (0018,0050) Slice Thickness
- (0028,0010) Number Of Rows
- (0028,0011) Number Of Columns
- (0020,000e) Series Instance UID : could be argued about, might be dropped in the future (optionally)
\subsection DicomSeriesReader_sorting2 Step 2: Sort slices spatially
Before slices are further analyzed, they are sorted spatially. As implemented by GdcmSortFunction(),
slices are sorted by
1. distance from origin (calculated using (0020,0032) Image Position Patient and (0020,0037) Image Orientation)
2. when distance is equal, (0008,0032) Acquisition Time is used as a backup criterion (necessary for meaningful 3D+t sorting)
\subsection DicomSeriesReader_sorting3 Step 3: Ensure equal z spacing
Since inter-slice distance is not recorded in DICOM tags, we must ensure that blocks are made up of
slices that have equal distances between neighboring slices. This is especially necessary because itk::ImageSeriesReader
is later used for the actual loading, and this class expects (and does nocht verify) equal inter-slice distance.
To achieve such grouping, the inter-slice distance is calculated from the first two different slice positions of a block.
Following slices are added to a block as long as they can be added by adding the calculated inter-slice distance to the
last slice of the block. Slices that do not fit into the expected distance pattern, are set aside for further analysis.
This grouping is done until each file has been assigned to a group.
Slices that share a position in space are also sorted into separate blocks during this step.
So the result of this step is a set of blocks that contain only slices with equal z spacing
and uniqe slices at each position.
\subsection DicomSeriesReader_sorting4 Step 4 (optional): group 3D blocks as 3D+t when possible
This last step depends on an option of GetSeries(). When requested, image blocks from the previous step are merged again
whenever two blocks occupy the same portion of space (i.e. same origin, number of slices and z-spacing).
\section DicomSeriesReader_tests Tests regarding DICOM loading
A number of tests have been implemented to check our assumptions regarding DICOM loading. Please see \ref DICOMTesting
*/
class MITK_CORE_EXPORT DicomSeriesReader
{
public:
/**
\brief Lists of filenames.
*/
typedef std::vector<std::string> StringContainer;
/**
\brief For grouped lists of filenames, assigned an ID each.
*/
typedef std::map<std::string, StringContainer> UidFileNamesMap;
/**
\brief Interface for the progress callback.
*/
typedef void (*UpdateCallBackMethod)(float);
/**
\brief Provide combination of preprocessor defines that was active during compilation.
Since this class is a combination of several possible implementations, separated only
by ifdef's, calling instances might want to know which flags were active at compile time.
*/
static std::string GetConfigurationString();
/**
\brief Checks if a specific file contains DICOM data.
*/
static
bool
IsDicom(const std::string &filename);
/**
\brief see other GetSeries().
Find all series (and sub-series -- see details) in a particular directory.
*/
static UidFileNamesMap GetSeries(const std::string &dir,
const StringContainer &restrictions = StringContainer());
/**
\brief see other GetSeries().
\warning Untested, could or could not work.
This differs only by having an additional restriction to a single known DICOM series.
Internally, it uses the other GetSeries() method.
*/
static StringContainer GetSeries(const std::string &dir,
const std::string &series_uid,
const StringContainer &restrictions = StringContainer());
/**
\brief PREFERRED version of this method - scan and sort DICOM files.
Parse a list of files for images of DICOM series.
For each series, an enumeration of the files contained in it is created.
\return The resulting maps UID-like keys (based on Series Instance UID and slice properties) to sorted lists of file names.
SeriesInstanceUID will be enhanced to be unique for each set of file names
that is later loadable as a single mitk::Image. This implies that
Image orientation, slice thickness, pixel spacing, rows, and columns
must be the same for each file (i.e. the image slice contained in the file).
If this separation logic requires that a SeriesInstanceUID must be made more specialized,
it will follow the same logic as itk::GDCMSeriesFileNames to enhance the UID with
more digits and dots.
Optionally, more tags can be used to separate files into different logical series by setting
the restrictions parameter.
\warning Adding restrictions is not yet implemented!
*/
static
UidFileNamesMap
GetSeries(const StringContainer& files, bool sortTo3DPlust, const StringContainer &restrictions = StringContainer());
/**
\brief See other GetSeries().
Use GetSeries(const StringContainer& files, bool sortTo3DPlust, const StringContainer &restrictions) instead.
*/
static
UidFileNamesMap
GetSeries(const StringContainer& files, const StringContainer &restrictions = StringContainer());
/**
Loads a DICOM series composed by the file names enumerated in the file names container.
If a callback method is supplied, it will be called after every progress update with a progress value in [0,1].
\param filenames The filenames to load.
\param sort Whether files should be sorted spatially (true) or not (false - maybe useful if presorted)
\param load4D Whether to load the files as 3D+t (if possible)
*/
static DataNode::Pointer LoadDicomSeries(const StringContainer &filenames,
bool sort = true,
bool load4D = true,
UpdateCallBackMethod callback = 0);
/**
\brief See LoadDicomSeries! Just a slightly different interface.
*/
static bool LoadDicomSeries(const StringContainer &filenames,
DataNode &node,
bool sort = true,
bool load4D = true,
UpdateCallBackMethod callback = 0);
protected:
/**
\brief for internal sorting.
*/
typedef std::pair<StringContainer, StringContainer> TwoStringContainers;
/**
\brief Ensure an equal z-spacing for a group of files.
Internally used by GetSeries. Returns two lists: the first one contins slices of equal inter-slice spacing.
The second list contains remaining files, which need to be run through AnalyzeFileForITKImageSeriesReaderSpacingAssumption again.
Relevant code that is matched here is in
itkImageSeriesReader.txx (ImageSeriesReader<TOutputImage>::GenerateOutputInformation(void)), lines 176 to 245 (as of ITK 3.20)
*/
static
TwoStringContainers
- AnalyzeFileForITKImageSeriesReaderSpacingAssumption(const StringContainer& files, const gdcm::Scanner::MappingType& tagValueMappings);
+ AnalyzeFileForITKImageSeriesReaderSpacingAssumption(const StringContainer& files, const gdcm::Scanner::MappingType& tagValueMappings_);
/**
\brief Sort a set of file names in an order that is meaningful for loading them into an mitk::Image.
\warning This method assumes that input files are similar in basic properties such as
slice thicknes, image orientation, pixel spacing, rows, columns.
It should always be ok to put the result of a call to GetSeries(..) into this method.
Sorting order is determined by
1. image position along its normal (distance from world origin)
2. acquisition time
If P<n> denotes a position and T<n> denotes a time step, this method will order slices from three timesteps like this:
\verbatim
P1T1 P1T2 P1T3 P2T1 P2T2 P2T3 P3T1 P3T2 P3T3
\endverbatim
*/
static StringContainer SortSeriesSlices(const StringContainer &unsortedFilenames);
public:
/**
\brief Checks if a specific file is a Philips3D ultrasound DICOM file.
*/
static bool IsPhilips3DDicom(const std::string &filename);
protected:
/**
\brief Read a Philips3D ultrasound DICOM file and put into an mitk::Image.
*/
static bool ReadPhilips3DDicom(const std::string &filename, mitk::Image::Pointer output_image);
/**
\brief Construct a UID that takes into account sorting criteria from GetSeries().
*/
static std::string CreateMoreUniqueSeriesIdentifier( gdcm::Scanner::TagToValue& tagValueMap );
/**
\brief Helper for CreateMoreUniqueSeriesIdentifier
*/
static std::string CreateSeriesIdentifierPart( gdcm::Scanner::TagToValue& tagValueMap, const gdcm::Tag& tag );
/**
\brief Helper for CreateMoreUniqueSeriesIdentifier
*/
static std::string IDifyTagValue(const std::string& value);
typedef itk::GDCMImageIO DcmIoType;
/**
\brief Progress callback for DicomSeriesReader.
*/
class CallbackCommand : public itk::Command
{
public:
CallbackCommand(UpdateCallBackMethod callback)
: m_Callback(callback)
{
}
void Execute(const itk::Object *caller, const itk::EventObject&)
{
(*this->m_Callback)(static_cast<const itk::ProcessObject*>(caller)->GetProgress());
}
void Execute(itk::Object *caller, const itk::EventObject&)
{
(*this->m_Callback)(static_cast<itk::ProcessObject*>(caller)->GetProgress());
}
protected:
UpdateCallBackMethod m_Callback;
};
+ /**
+ \brief Scan for slice image information
+ */
+ static void ScanForSliceInformation( const StringContainer &filenames, gdcm::Scanner& scanner );
+
/**
\brief Performs actual loading of a series and creates an image having the specified pixel type.
*/
template <typename PixelType>
static
void
LoadDicom(const StringContainer &filenames, DataNode &node, bool sort, bool check_4d, UpdateCallBackMethod callback);
/**
\brief Feed files into itk::ImageSeriesReader and retrieve a 3D MITK image.
\param command can be used for progress reporting
*/
template <typename PixelType>
static
Image::Pointer
LoadDICOMByITK( const StringContainer&, CallbackCommand* command = NULL);
/**
\brief Sort files into time step blocks of a 3D+t image.
Called by LoadDicom. Expects to be fed a single list of filenames that have been sorted by
GetSeries previously (one map entry). This method will check how many timestep can be filled
with given files.
Assumption is that the number of time steps is determined by how often the first position in
space repeats. I.e. if the first three files in the input parameter all describe the same
location in space, we'll construct three lists of files. and sort the remaining files into them.
\todo We can probably remove this method if we somehow transfer 3D+t information from GetSeries to LoadDicomSeries.
*/
static
std::list<StringContainer>
- SortIntoBlocksFor3DplusT( const StringContainer& presortedFilenames, bool sort, bool& canLoadAs4D );
+ SortIntoBlocksFor3DplusT( const StringContainer& presortedFilenames, const gdcm::Scanner::MappingType& tagValueMappings_, bool sort, bool& canLoadAs4D);
/**
\brief Defines spatial sorting for sorting by GDCM 2.
Sorts by image position along image normal (distance from world origin).
In cases of conflict, acquisition time is used as a secondary sort criterium.
*/
static
bool
GdcmSortFunction(const gdcm::DataSet &ds1, const gdcm::DataSet &ds2);
/**
\brief Copy information about files and DICOM tags from ITK's MetaDataDictionary
and from the list of input files to the PropertyList of mitk::Image.
\todo Tag copy must follow; image level will cause some additional files parsing, probably.
*/
- static void CopyMetaDataToImageProperties( const StringContainer& files, DcmIoType* io, Image* image );
+ static void CopyMetaDataToImageProperties( StringContainer filenames, const gdcm::Scanner::MappingType& tagValueMappings_, DcmIoType* io, Image* image);
+ static void CopyMetaDataToImageProperties( std::list<StringContainer> imageBlock, const gdcm::Scanner::MappingType& tagValueMappings_, DcmIoType* io, Image* image);
};
}
#endif /* MITKDICOMSERIESREADER_H_ */
diff --git a/Core/Code/IO/mitkDicomSeriesReader.txx b/Core/Code/IO/mitkDicomSeriesReader.txx
index bb85786ef1..998ea4dc11 100644
--- a/Core/Code/IO/mitkDicomSeriesReader.txx
+++ b/Core/Code/IO/mitkDicomSeriesReader.txx
@@ -1,270 +1,307 @@
/*=========================================================================
Program: Medical Imaging & Interaction Toolkit
Language: C++
Date: $Date$
Version: $Revision$
Copyright (c) German Cancer Research Center, Division of Medical and
Biological Informatics. All rights reserved.
See MITKCopyright.txt or http://www.mitk.org/copyright.html for details.
This software is distributed WITHOUT ANY WARRANTY; without even
the implied warranty of MERCHANTABILITY or FITNESS FOR A PARTICULAR
PURPOSE. See the above copyright notices for more information.
=========================================================================*/
#ifndef MITKDICOMSERIESREADER_TXX_
#define MITKDICOMSERIESREADER_TXX_
#include <mitkDicomSeriesReader.h>
#include <itkImageSeriesReader.h>
+#include <mitkProperties.h>
namespace mitk
{
template <typename PixelType>
void DicomSeriesReader::LoadDicom(const StringContainer &filenames, DataNode &node, bool sort, bool load4D, UpdateCallBackMethod callback)
{
const char* previousCLocale = setlocale(LC_NUMERIC, NULL);
setlocale(LC_NUMERIC, "C");
std::locale previousCppLocale( std::cin.getloc() );
std::locale l( "C" );
std::cin.imbue(l);
try
{
mitk::Image::Pointer image = mitk::Image::New();
CallbackCommand *command = callback ? new CallbackCommand(callback) : 0;
/* special case for Philips 3D+t ultrasound images */
if ( DicomSeriesReader::IsPhilips3DDicom(filenames.front().c_str()) )
{
ReadPhilips3DDicom(filenames.front().c_str(), image);
}
else
{
/* default case: assume "normal" image blocks, possibly 3D+t */
bool canLoadAs4D(true);
- std::list<StringContainer> imageBlocks = SortIntoBlocksFor3DplusT( filenames, sort, canLoadAs4D );
+ gdcm::Scanner scanner;
+ ScanForSliceInformation(filenames, scanner);
+
+ std::list<StringContainer> imageBlocks = SortIntoBlocksFor3DplusT( filenames, scanner.GetMappings(), sort, canLoadAs4D );
unsigned int volume_count = imageBlocks.size();
if (volume_count == 1 || !canLoadAs4D || !load4D)
{
image = LoadDICOMByITK<PixelType>( imageBlocks.front() , command ); // load first 3D block
}
else
{
// It is 3D+t! Read it and store into mitk image
typedef itk::Image<PixelType, 4> ImageType;
typedef itk::ImageSeriesReader<ImageType> ReaderType;
DcmIoType::Pointer io = DcmIoType::New();
typename ReaderType::Pointer reader = ReaderType::New();
reader->SetImageIO(io);
reader->ReverseOrderOff();
if (command)
{
reader->AddObserver(itk::ProgressEvent(), command);
}
unsigned int act_volume = 1u;
reader->SetFileNames(imageBlocks.front());
reader->Update();
image->InitializeByItk(reader->GetOutput(), 1, volume_count);
image->SetImportVolume(reader->GetOutput()->GetBufferPointer(), 0u);
- DicomSeriesReader::CopyMetaDataToImageProperties( imageBlocks.front(), io, image );
+ gdcm::Scanner scanner;
+ ScanForSliceInformation(filenames, scanner);
+
+ DicomSeriesReader::CopyMetaDataToImageProperties( imageBlocks, scanner.GetMappings(), io, image);
MITK_DEBUG << "Volume dimension: [" << image->GetDimension(0) << ", "
<< image->GetDimension(1) << ", "
<< image->GetDimension(2) << ", "
<< image->GetDimension(3) << "]";
#if (GDCM_MAJOR_VERSION == 2) && (GDCM_MINOR_VERSION < 1) && (GDCM_BUILD_VERSION < 15)
// workaround for a GDCM 2 bug until version 2.0.15:
// GDCM read spacing vector wrongly. Instead of "row spacing, column spacing", it misinterprets the DICOM tag as "column spacing, row spacing".
// this is undone here, until we use a GDCM that has this issue fixed.
// From the commit comments, GDCM 2.0.15 fixed the spacing interpretation with bug 2901181
// http://sourceforge.net/tracker/index.php?func=detail&aid=2901181&group_id=137895&atid=739587
Vector3D correctedImageSpacing = image->GetGeometry()->GetSpacing();
std::swap( correctedImageSpacing[0], correctedImageSpacing[1] );
image->GetGeometry()->SetSpacing( correctedImageSpacing );
#endif
MITK_DEBUG << "Volume spacing: [" << image->GetGeometry()->GetSpacing()[0] << ", "
<< image->GetGeometry()->GetSpacing()[1] << ", "
<< image->GetGeometry()->GetSpacing()[2] << "]";
for (std::list<StringContainer>::iterator df_it = ++imageBlocks.begin(); df_it != imageBlocks.end(); ++df_it)
{
reader->SetFileNames(*df_it);
reader->Update();
image->SetImportVolume(reader->GetOutput()->GetBufferPointer(), act_volume++);
}
}
}
node.SetData( image );
setlocale(LC_NUMERIC, previousCLocale);
std::cin.imbue(previousCppLocale);
}
catch (std::exception& e)
{
// reset locale then throw up
setlocale(LC_NUMERIC, previousCLocale);
std::cin.imbue(previousCppLocale);
throw e;
}
}
template <typename PixelType>
Image::Pointer DicomSeriesReader::LoadDICOMByITK( const StringContainer& filenames, CallbackCommand* command )
{
/******** Normal Case, 3D (also for GDCM < 2 usable) ***************/
mitk::Image::Pointer image = mitk::Image::New();
typedef itk::Image<PixelType, 3> ImageType;
typedef itk::ImageSeriesReader<ImageType> ReaderType;
DcmIoType::Pointer io = DcmIoType::New();
typename ReaderType::Pointer reader = ReaderType::New();
reader->SetImageIO(io);
reader->ReverseOrderOff();
if (command)
{
reader->AddObserver(itk::ProgressEvent(), command);
}
reader->SetFileNames(filenames);
reader->Update();
image->InitializeByItk(reader->GetOutput());
image->SetImportVolume(reader->GetOutput()->GetBufferPointer());
+ gdcm::Scanner scanner;
+ ScanForSliceInformation(filenames, scanner);
+
+ DicomSeriesReader::CopyMetaDataToImageProperties( filenames, scanner.GetMappings(), io, image);
MITK_DEBUG << "Volume dimension: [" << image->GetDimension(0) << ", "
<< image->GetDimension(1) << ", "
<< image->GetDimension(2) << "]";
#if (GDCM_MAJOR_VERSION == 2) && (GDCM_MINOR_VERSION < 1) && (GDCM_BUILD_VERSION < 15)
// workaround for a GDCM 2 bug until version 2.0.15:
// GDCM read spacing vector wrongly. Instead of "row spacing, column spacing", it misinterprets the DICOM tag as "column spacing, row spacing".
// this is undone here, until we use a GDCM that has this issue fixed.
// From the commit comments, GDCM 2.0.15 fixed the spacing interpretation with bug 2901181
// http://sourceforge.net/tracker/index.php?func=detail&aid=2901181&group_id=137895&atid=739587
Vector3D correctedImageSpacing = image->GetGeometry()->GetSpacing();
std::swap( correctedImageSpacing[0], correctedImageSpacing[1] );
image->GetGeometry()->SetSpacing( correctedImageSpacing );
#endif
MITK_DEBUG << "Volume spacing: [" << image->GetGeometry()->GetSpacing()[0] << ", "
<< image->GetGeometry()->GetSpacing()[1] << ", "
<< image->GetGeometry()->GetSpacing()[2] << "]";
return image;
}
-
+
+void
+DicomSeriesReader::ScanForSliceInformation(const StringContainer &filenames, gdcm::Scanner& scanner)
+{
+ const gdcm::Tag ippTag(0x0020,0x0032); //Image position (Patient)
+ scanner.AddTag(ippTag);
+
+ // TODO what if tags don't exist?
+ const gdcm::Tag tagSliceLocation(0x0020, 0x1041); // slice location
+ scanner.AddTag( tagSliceLocation );
+
+ const gdcm::Tag tagInstanceNumber(0x0020, 0x0013); // (image) instance number
+ scanner.AddTag( tagInstanceNumber );
+
+ const gdcm::Tag tagSOPInstanceNumber(0x0008, 0x0018); // SOP instance number
+ scanner.AddTag( tagSOPInstanceNumber );
+
+ scanner.Scan(filenames); // make available image position for each file
+}
+
std::list<DicomSeriesReader::StringContainer>
-DicomSeriesReader::SortIntoBlocksFor3DplusT( const StringContainer& presortedFilenames, bool sort, bool& canLoadAs4D )
+DicomSeriesReader::SortIntoBlocksFor3DplusT(
+ const StringContainer& presortedFilenames,
+ const gdcm::Scanner::MappingType& tagValueMappings,
+ bool /*sort*/,
+ bool& canLoadAs4D )
{
std::list<StringContainer> imageBlocks;
// ignore sort request, because most likely re-sorting is now needed due to changes in GetSeries(bug #8022)
StringContainer sorted_filenames = DicomSeriesReader::SortSeriesSlices(presortedFilenames);
-
- gdcm::Tag ippTag(0x0020,0x0032); //Image position (Patient)
- gdcm::Scanner scanner;
-
- scanner.AddTag(ippTag);
- scanner.Scan(sorted_filenames); // make available image position for each file
-
+
std::string firstPosition;
unsigned int numberOfBlocks(0); // number of 3D image blocks
+ const gdcm::Tag ippTag(0x0020,0x0032); //Image position (Patient)
+
// loop files to determine number of image blocks
for (StringContainer::const_iterator fileIter = sorted_filenames.begin();
fileIter != sorted_filenames.end();
++fileIter)
{
- std::string position = scanner.GetValue( fileIter->c_str(), ippTag);
+ gdcm::Scanner::TagToValue tagToValueMap = tagValueMappings.find( fileIter->c_str() )->second;
+
+ if(tagToValueMap.find(ippTag) == tagToValueMap.end())
+ {
+ continue;
+ }
+
+ std::string position = tagToValueMap.find(ippTag)->second;
MITK_DEBUG << " " << *fileIter << " at " << position;
if (firstPosition.empty())
{
firstPosition = position;
}
if ( position == firstPosition )
{
++numberOfBlocks;
}
else
{
break; // enough information to know the number of image blocks
}
}
MITK_DEBUG << " ==> Assuming " << numberOfBlocks << " time steps";
if (numberOfBlocks == 0) return imageBlocks; // only possible if called with no files
// loop files to sort them into image blocks
unsigned int numberOfExpectedSlices(0);
for (unsigned int block = 0; block < numberOfBlocks; ++block)
{
StringContainer filesOfCurrentBlock;
for ( StringContainer::const_iterator fileIter = sorted_filenames.begin() + block;
fileIter != sorted_filenames.end();
//fileIter += numberOfBlocks) // TODO shouldn't this work? give invalid iterators on first attempts
)
{
filesOfCurrentBlock.push_back( *fileIter );
for (unsigned int b = 0; b < numberOfBlocks; ++b)
{
if (fileIter != sorted_filenames.end())
++fileIter;
}
}
imageBlocks.push_back(filesOfCurrentBlock);
if (block == 0)
{
numberOfExpectedSlices = filesOfCurrentBlock.size();
}
else
{
if (filesOfCurrentBlock.size() != numberOfExpectedSlices)
{
MITK_WARN << "DicomSeriesReader expected " << numberOfBlocks
<< " image blocks of "
<< numberOfExpectedSlices
<< " images each. Block "
<< block
<< " got "
<< filesOfCurrentBlock.size()
<< " instead. Cannot load this as 3D+t"; // TODO implement recovery (load as many slices 3D+t as much as possible)
canLoadAs4D = false;
}
}
}
return imageBlocks;
}
}
#endif
diff --git a/Core/Code/IO/mitkFileWriterWithInformation.h b/Core/Code/IO/mitkFileWriterWithInformation.h
index 933a8ca983..9cfd05c8d9 100644
--- a/Core/Code/IO/mitkFileWriterWithInformation.h
+++ b/Core/Code/IO/mitkFileWriterWithInformation.h
@@ -1,42 +1,42 @@
/*=========================================================================
Program: Medical Imaging & Interaction Toolkit
Language: C++
Date: $Date$
Version: $Revision$
Copyright (c) German Cancer Research Center, Division of Medical and
Biological Informatics. All rights reserved.
See MITKCopyright.txt or http://www.mitk.org/copyright.html for details.
This software is distributed WITHOUT ANY WARRANTY; without even
the implied warranty of MERCHANTABILITY or FITNESS FOR A PARTICULAR
PURPOSE. See the above copyright notices for more information.
=========================================================================*/
#ifndef FILEWRITERWITHINFORMATION_H_INCLUDED
#define FILEWRITERWITHINFORMATION_H_INCLUDED
#include "mitkFileWriter.h"
#include "mitkBaseData.h"
namespace mitk {
/**
* \brief Interface for FileWriters with extra information.
* Should be merged into FileWriter.
*/
class MITK_CORE_EXPORT FileWriterWithInformation : public FileWriter {
public:
mitkClassMacro(FileWriterWithInformation,FileWriter);
virtual const char *GetDefaultFilename() = 0;
virtual const char *GetFileDialogPattern() = 0;
virtual const char *GetDefaultExtension() = 0;
- virtual bool CanWriteDataType(BaseData::Pointer data) = 0;
+ virtual bool CanWriteBaseDataType(BaseData::Pointer data) = 0;
virtual void DoWrite(BaseData::Pointer data) = 0;
};
}
#endif
diff --git a/Core/Code/IO/mitkImageWriter.cpp b/Core/Code/IO/mitkImageWriter.cpp
index 64602eacbc..9c628a7a23 100644
--- a/Core/Code/IO/mitkImageWriter.cpp
+++ b/Core/Code/IO/mitkImageWriter.cpp
@@ -1,297 +1,312 @@
/*=========================================================================
Program: Medical Imaging & Interaction Toolkit
Language: C++
Date: $Date$
Version: $Revision$
Copyright (c) German Cancer Research Center, Division of Medical and
Biological Informatics. All rights reserved.
See MITKCopyright.txt or http://www.mitk.org/copyright.html for details.
This software is distributed WITHOUT ANY WARRANTY; without even
the implied warranty of MERCHANTABILITY or FITNESS FOR A PARTICULAR
PURPOSE. See the above copyright notices for more information.
=========================================================================*/
#include "mitkImageWriter.h"
#include "mitkItkPictureWrite.h"
#include "mitkImage.h"
#include "mitkImageTimeSelector.h"
#include "mitkPicFileWriter.h"
#include "mitkImageAccessByItk.h"
#include <itkImageIOBase.h>
#include <itkImageIOFactory.h>
mitk::ImageWriter::ImageWriter()
{
this->SetNumberOfRequiredInputs( 1 );
m_MimeType = "";
SetDefaultExtension();
}
mitk::ImageWriter::~ImageWriter()
{
}
void mitk::ImageWriter::SetDefaultExtension()
{
m_Extension = ".mhd";
}
#include <vtkConfigure.h>
#if ((VTK_MAJOR_VERSION > 4) || ((VTK_MAJOR_VERSION==4) && (VTK_MINOR_VERSION>=4) ))
#include <vtkImageData.h>
#include <vtkXMLImageDataWriter.h>
static void writeVti(const char * filename, mitk::Image* image, int t=0)
{
vtkXMLImageDataWriter * vtkwriter = vtkXMLImageDataWriter::New();
vtkwriter->SetFileName( filename );
vtkwriter->SetInput(image->GetVtkImageData(t));
vtkwriter->Write();
vtkwriter->Delete();
}
#endif
void mitk::ImageWriter::WriteByITK(mitk::Image* image, const std::string& fileName)
{
// Pictures and picture series like .png are written via a different mechanism then volume images.
// So, they are still multiplexed and thus not support vector images.
if (fileName.find(".png") != std::string::npos || fileName.find(".tif") != std::string::npos || fileName.find(".jpg") != std::string::npos)
{
AccessByItk_1( image, _mitkItkPictureWrite, fileName );
return;
}
// Implementation of writer using itkImageIO directly. This skips the use
// of templated itkImageFileWriter, which saves the multiplexing on MITK side.
unsigned int dimension = image->GetDimension();
unsigned int* dimensions = image->GetDimensions();
mitk::PixelType pixelType = image->GetPixelType();
mitk::Vector3D spacing = image->GetGeometry()->GetSpacing();
mitk::Point3D origin = image->GetGeometry()->GetOrigin();
itk::ImageIOBase::Pointer imageIO = itk::ImageIOFactory::CreateImageIO( fileName.c_str(),
itk::ImageIOFactory::WriteMode );
if(imageIO.IsNull())
{
itkExceptionMacro(<< "Error: Could not create itkImageIO via factory for file " << fileName);
}
// Set the necessary information for imageIO
imageIO->SetNumberOfDimensions(dimension);
imageIO->SetPixelTypeInfo( *(pixelType.GetTypeId()) );
if(pixelType.GetNumberOfComponents() > 1)
imageIO->SetNumberOfComponents(pixelType.GetNumberOfComponents());
itk::ImageIORegion ioRegion( dimension );
for(unsigned int i=0; i<dimension; i++)
{
imageIO->SetDimensions(i,dimensions[i]);
imageIO->SetSpacing(i,spacing[i]);
imageIO->SetOrigin(i,origin[i]);
mitk::Vector3D direction;
direction.Set_vnl_vector(image->GetGeometry()->GetIndexToWorldTransform()->GetMatrix().GetVnlMatrix().get_column(i));
vnl_vector< double > axisDirection(dimension);
for(unsigned int j=0; j<dimension; j++)
{
axisDirection[j] = direction[j]/spacing[i];
}
imageIO->SetDirection( i, axisDirection );
ioRegion.SetSize(i, image->GetLargestPossibleRegion().GetSize(i) );
ioRegion.SetIndex(i, image->GetLargestPossibleRegion().GetIndex(i) );
}
imageIO->SetIORegion(ioRegion);
imageIO->SetFileName(fileName);
const void * data = image->GetData();
imageIO->Write(data);
}
void mitk::ImageWriter::GenerateData()
{
if ( m_FileName == "" )
{
itkWarningMacro( << "Sorry, filename has not been set!" );
return ;
}
FILE* tempFile = fopen(m_FileName.c_str(),"w");
if (tempFile==NULL)
{
itkExceptionMacro(<<"File location not writeable");
return;
}
fclose(tempFile);
remove(m_FileName.c_str());
mitk::Image::Pointer input = const_cast<mitk::Image*>(this->GetInput());
#if ((VTK_MAJOR_VERSION > 4) || ((VTK_MAJOR_VERSION==4) && (VTK_MINOR_VERSION>=4) ))
bool vti = (m_Extension.find(".vti") != std::string::npos);
#endif
- if ( m_Extension.find(".pic") == std::string::npos )
+ // If the extension is NOT .pic and NOT .nrrd the following block is entered
+ if ( m_Extension.find(".pic") == std::string::npos
+ && m_Extension.find(".nrrd") == std::string::npos)
{
if(input->GetDimension() > 3)
{
int t, timesteps;
timesteps = input->GetDimension(3);
ImageTimeSelector::Pointer timeSelector = ImageTimeSelector::New();
timeSelector->SetInput(input);
mitk::Image::Pointer image = timeSelector->GetOutput();
for(t = 0; t < timesteps; ++t)
{
::itk::OStringStream filename;
timeSelector->SetTimeNr(t);
timeSelector->Update();
if(input->GetTimeSlicedGeometry()->IsValidTime(t))
{
const mitk::TimeBounds& timebounds = input->GetTimeSlicedGeometry()->GetGeometry3D(t)->GetTimeBounds();
filename << m_FileName.c_str() << "_S" << std::setprecision(0) << timebounds[0] << "_E" << std::setprecision(0) << timebounds[1] << "_T" << t << m_Extension;
}
else
{
itkWarningMacro(<<"Error on write: TimeSlicedGeometry invalid of image " << filename << ".");
filename << m_FileName.c_str() << "_T" << t << m_Extension;
}
#if ((VTK_MAJOR_VERSION > 4) || ((VTK_MAJOR_VERSION==4) && (VTK_MINOR_VERSION>=4) ))
if ( vti )
{
writeVti(filename.str().c_str(), input, t);
}
else
#endif
{
WriteByITK(input, filename.str());
}
}
}
#if ((VTK_MAJOR_VERSION > 4) || ((VTK_MAJOR_VERSION==4) && (VTK_MINOR_VERSION>=4) ))
else if ( vti )
{
::itk::OStringStream filename;
filename << m_FileName.c_str() << m_Extension;
writeVti(filename.str().c_str(), input);
}
#endif
else
{
::itk::OStringStream filename;
filename << m_FileName.c_str() << m_Extension;
WriteByITK(input, filename.str());
}
}
else
{
+ // use the PicFileWriter for the .pic data type
+ if( m_Extension.find(".pic") != std::string::npos )
+ {
PicFileWriter::Pointer picWriter = PicFileWriter::New();
size_t found;
found = m_FileName.find( m_Extension ); // !!! HAS to be at the very end of the filename (not somewhere in the middle)
if( m_FileName.length() > 3 && found != m_FileName.length() - 4 )
{
//if Extension not in Filename
::itk::OStringStream filename;
filename << m_FileName.c_str() << m_Extension;
picWriter->SetFileName( filename.str().c_str() );
}
else
{
picWriter->SetFileName( m_FileName.c_str() );
}
- picWriter->SetInput( input );
+ picWriter->SetInputImage( input );
picWriter->Write();
+ }
+
+ // use the ITK .nrrd Image writer
+ if( m_Extension.find(".nrrd") != std::string::npos )
+ {
+ ::itk::OStringStream filename;
+ filename << this->m_FileName.c_str() << this->m_Extension;
+ WriteByITK(input, filename.str());
+ }
+
}
m_MimeType = "application/MITK.Pic";
}
bool mitk::ImageWriter::CanWriteDataType( DataNode* input )
{
if ( input )
{
mitk::BaseData* data = input->GetData();
if ( data )
{
mitk::Image::Pointer image = dynamic_cast<mitk::Image*>( data );
if( image.IsNotNull() )
{
//"SetDefaultExtension()" set m_Extension to ".mhd" ?????
m_Extension = ".pic";
return true;
}
}
}
return false;
}
void mitk::ImageWriter::SetInput( DataNode* input )
{
if( input && CanWriteDataType( input ) )
this->ProcessObject::SetNthInput( 0, dynamic_cast<mitk::Image*>( input->GetData() ) );
}
std::string mitk::ImageWriter::GetWritenMIMEType()
{
return m_MimeType;
}
std::vector<std::string> mitk::ImageWriter::GetPossibleFileExtensions()
{
std::vector<std::string> possibleFileExtensions;
possibleFileExtensions.push_back(".pic");
possibleFileExtensions.push_back(".bmp");
possibleFileExtensions.push_back(".dcm");
possibleFileExtensions.push_back(".DCM");
possibleFileExtensions.push_back(".dicom");
possibleFileExtensions.push_back(".DICOM");
possibleFileExtensions.push_back(".gipl");
possibleFileExtensions.push_back(".gipl.gz");
possibleFileExtensions.push_back(".mha");
possibleFileExtensions.push_back(".nii");
possibleFileExtensions.push_back(".nrrd");
possibleFileExtensions.push_back(".nhdr");
possibleFileExtensions.push_back(".png");
possibleFileExtensions.push_back(".PNG");
possibleFileExtensions.push_back(".spr");
possibleFileExtensions.push_back(".mhd");
possibleFileExtensions.push_back(".vtk");
possibleFileExtensions.push_back(".vti");
possibleFileExtensions.push_back(".hdr");
possibleFileExtensions.push_back(".png");
possibleFileExtensions.push_back(".tif");
possibleFileExtensions.push_back(".jpg");
return possibleFileExtensions;
}
std::string mitk::ImageWriter::GetFileExtension()
{
return m_Extension;
}
void mitk::ImageWriter::SetInput( mitk::Image* image )
{
this->ProcessObject::SetNthInput( 0, image );
}
const mitk::Image* mitk::ImageWriter::GetInput()
{
if ( this->GetNumberOfInputs() < 1 )
{
return NULL;
}
else
{
return static_cast< const mitk::Image * >( this->ProcessObject::GetInput( 0 ) );
}
}
diff --git a/Core/Code/IO/mitkItkPictureWrite.cpp b/Core/Code/IO/mitkItkPictureWrite.cpp
index 0913526280..d8fa5aa18b 100644
--- a/Core/Code/IO/mitkItkPictureWrite.cpp
+++ b/Core/Code/IO/mitkItkPictureWrite.cpp
@@ -1,125 +1,128 @@
/*=========================================================================
Program: Medical Imaging & Interaction Toolkit
Language: C++
Date: $Date$
Version: $Revision$
Copyright (c) German Cancer Research Center, Division of Medical and
Biological Informatics. All rights reserved.
See MITKCopyright.txt or http://www.mitk.org/copyright.html for details.
This software is distributed WITHOUT ANY WARRANTY; without even
the implied warranty of MERCHANTABILITY or FITNESS FOR A PARTICULAR
PURPOSE. See the above copyright notices for more information.
=========================================================================*/
#include "mitkItkPictureWrite.h"
-#include "mitkImageAccessByItk.h"
+#include <mitkInstantiateAccessFunctions.h>
#include <itkNumericSeriesFileNames.h>
#include <itkImageSeriesWriter.h>
#include <itkRescaleIntensityImageFilter.h>
template < typename TPixel, unsigned int VImageDimension >
void _mitkItkPictureWrite(itk::Image< TPixel, VImageDimension >* itkImage, const std::string& fileName)
{
typedef itk::Image< TPixel, VImageDimension > TImageType;
typedef itk::Image<unsigned char,3> OutputImage3DType;
typedef itk::Image<unsigned char,2> OutputImage2DType;
typename itk::RescaleIntensityImageFilter<TImageType, OutputImage3DType>::Pointer rescaler = itk::RescaleIntensityImageFilter<TImageType, OutputImage3DType>::New();
rescaler->SetInput(itkImage);
rescaler->SetOutputMinimum(0);
rescaler->SetOutputMaximum(255);
itk::NumericSeriesFileNames::Pointer numericFileNameWriter = itk::NumericSeriesFileNames::New();
itk::ImageSeriesWriter<OutputImage3DType, OutputImage2DType>::Pointer writer = itk::ImageSeriesWriter<OutputImage3DType, OutputImage2DType >::New();
int numberOfSlices = itkImage->GetLargestPossibleRegion().GetSize()[2];
std::string finalFileName = fileName;
std::string::size_type pos = fileName.find_last_of(".",fileName.length()-1);
if(pos==std::string::npos)
finalFileName.append(".%d.png");
else
finalFileName.insert(pos,".%d");
numericFileNameWriter->SetEndIndex(numberOfSlices);
numericFileNameWriter->SetSeriesFormat(finalFileName.c_str());
numericFileNameWriter->Modified();
writer->SetInput( rescaler->GetOutput() );
writer->SetFileNames(numericFileNameWriter->GetFileNames());
writer->Update();
}
-InstantiateAccessFunction_1(_mitkItkPictureWrite, const std::string&);
+#define InstantiateAccessFunction__mitkItkPictureWrite(pixelType, dim) \
+ template MITK_CORE_EXPORT void _mitkItkPictureWrite(itk::Image<pixelType,dim>*, const std::string&);
+
+InstantiateAccessFunction(_mitkItkPictureWrite)
// typedef itk::Image<itk::RGBPixel<unsigned char>, 2> itkImageRGBUC2;
// template <> void _mitkItkImageWrite<itk::RGBPixel<unsigned char>, 2>(itkImageRGBUC2* itkImage, const std::string& fileName)
// {
// typedef itkImageRGBUC2 TImageType;
//
// itk::ImageFileWriter<TImageType>::Pointer writer = itk::ImageFileWriter<TImageType>::New();
// writer->SetInput( itkImage );
// writer->SetFileName( fileName.c_str() );
// writer->Update();
// };
//
// typedef itk::Image<itk::RGBPixel<unsigned char>, 3> itkImageRGBUC3;
// template <> void _mitkItkImageWrite<itk::RGBPixel<unsigned char>, 3>(itkImageRGBUC3* itkImage, const std::string& fileName)
// {
// typedef itkImageRGBUC3 TImageType;
//
// itk::ImageFileWriter<TImageType>::Pointer writer = itk::ImageFileWriter<TImageType>::New();
// writer->SetInput( itkImage );
// writer->SetFileName( fileName.c_str() );
// writer->Update();
// };
//
// typedef itk::Image<itk::DiffusionTensor3D<float>, 3> itkImageDTIF3;
// template <> void _mitkItkImageWrite<itk::DiffusionTensor3D<float>, 3>(itkImageDTIF3* itkImage, const std::string& fileName)
// {
// typedef itkImageDTIF3 TImageType;
//
// itk::ImageFileWriter<TImageType>::Pointer writer = itk::ImageFileWriter<TImageType>::New();
// writer->SetInput( itkImage );
// writer->SetFileName( fileName.c_str() );
// writer->Update();
// };
//
// typedef itk::Image<itk::DiffusionTensor3D<double>, 3> itkImageDTID3;
// template <> void _mitkItkImageWrite<itk::DiffusionTensor3D<double>, 3>(itkImageDTID3* itkImage, const std::string& fileName)
// {
// typedef itkImageDTID3 TImageType;
//
// itk::ImageFileWriter<TImageType>::Pointer writer = itk::ImageFileWriter<TImageType>::New();
// writer->SetInput( itkImage );
// writer->SetFileName( fileName.c_str() );
// writer->Update();
// };
//
// typedef itk::Image<itk::DiffusionTensor3D<float>, 2> itkImageDTIF2;
// template <> void _mitkItkImageWrite<itk::DiffusionTensor3D<float>, 2>(itkImageDTIF2* itkImage, const std::string& fileName)
// {
// typedef itkImageDTIF2 TImageType;
//
// itk::ImageFileWriter<TImageType>::Pointer writer = itk::ImageFileWriter<TImageType>::New();
// writer->SetInput( itkImage );
// writer->SetFileName( fileName.c_str() );
// writer->Update();
// };
//
// typedef itk::Image<itk::DiffusionTensor3D<double>, 2> itkImageDTID2;
// template <> void _mitkItkImageWrite<itk::DiffusionTensor3D<double>, 2>(itkImageDTID2* itkImage, const std::string& fileName)
// {
// typedef itkImageDTID2 TImageType;
//
// itk::ImageFileWriter<TImageType>::Pointer writer = itk::ImageFileWriter<TImageType>::New();
// writer->SetInput( itkImage );
// writer->SetFileName( fileName.c_str() );
// writer->Update();
// };
diff --git a/Core/Code/IO/mitkLookupTableProperty.h b/Core/Code/IO/mitkLookupTableProperty.h
index 2592838c26..89744d02ac 100755
--- a/Core/Code/IO/mitkLookupTableProperty.h
+++ b/Core/Code/IO/mitkLookupTableProperty.h
@@ -1,64 +1,66 @@
/*=========================================================================
Program: Medical Imaging & Interaction Toolkit
Language: C++
Date: $Date$
Version: $Revision$
Copyright (c) German Cancer Research Center, Division of Medical and
Biological Informatics. All rights reserved.
See MITKCopyright.txt or http://www.mitk.org/copyright.html for details.
This software is distributed WITHOUT ANY WARRANTY; without even
the implied warranty of MERCHANTABILITY or FITNESS FOR A PARTICULAR
PURPOSE. See the above copyright notices for more information.
=========================================================================*/
#ifndef MITKLookupTablePROPERTY_H_HEADER_INCLUDED_C10EEAA8
#define MITKLookupTablePROPERTY_H_HEADER_INCLUDED_C10EEAA8
#include "mitkCommon.h"
#include "mitkBaseProperty.h"
#include "mitkLookupTable.h"
namespace mitk {
//##Documentation
//## @brief Property for LookupTable data
//##
//## @ingroup DataManagement
class MITK_CORE_EXPORT LookupTableProperty : public BaseProperty
{
protected:
LookupTable::Pointer m_LookupTable;
LookupTableProperty();
LookupTableProperty(const mitk::LookupTable::Pointer lut);
// LookupTableProperty(const mitk::LookupTable& aLookupTable);
public:
mitkClassMacro(LookupTableProperty, BaseProperty);
itkNewMacro(LookupTableProperty);
mitkNewMacro1Param(LookupTableProperty, const mitk::LookupTable::Pointer);
+ virtual BaseProperty& operator=(const BaseProperty& other) { return Superclass::operator=(other); }
+
virtual ~LookupTableProperty();
virtual bool operator==(const BaseProperty& property) const;
itkGetObjectMacro(LookupTable, LookupTable );
void SetLookupTable(const mitk::LookupTable::Pointer aLookupTable);
};
} // namespace mitk
#endif /* MITKLookupTablePROPERTY_H_HEADER_INCLUDED_C10EEAA8 */
diff --git a/Core/Code/IO/mitkPicFileWriter.cpp b/Core/Code/IO/mitkPicFileWriter.cpp
index 3a8e58b878..a227112b5b 100644
--- a/Core/Code/IO/mitkPicFileWriter.cpp
+++ b/Core/Code/IO/mitkPicFileWriter.cpp
@@ -1,297 +1,297 @@
/*=========================================================================
Program: Medical Imaging & Interaction Toolkit
Language: C++
Date: $Date$
Version: $Revision$
Copyright (c) German Cancer Research Center, Division of Medical and
Biological Informatics. All rights reserved.
See MITKCopyright.txt or http://www.mitk.org/copyright.html for details.
This software is distributed WITHOUT ANY WARRANTY; without even
the implied warranty of MERCHANTABILITY or FITNESS FOR A PARTICULAR
PURPOSE. See the above copyright notices for more information.
=========================================================================*/
#include "mitkPicFileWriter.h"
#include "mitkPicFileReader.h"
extern "C"
{
size_t _mitkIpPicFWrite( const void *ptr, size_t size, size_t nitems, mitkIpPicFile_t stream);
}
mitk::PicFileWriter::PicFileWriter()
{
this->SetNumberOfRequiredInputs( 1 );
}
mitk::PicFileWriter::~PicFileWriter()
{
}
void mitk::PicFileWriter::GenerateData()
{
if ( m_FileName == "" )
{
itkWarningMacro( << "Sorry, filename has not been set!" );
return ;
}
std::ofstream testfilehandle( m_FileName.c_str(), std::ios::out);
if (!testfilehandle.good())
{
testfilehandle.close();
itkExceptionMacro(<<"File location '" << m_FileName << "' not writeable");
}
else
{
testfilehandle.close();
}
Image::Pointer input = const_cast<Image*>(this->GetInput());
if ( input.IsNull() )
{
itkExceptionMacro(<< "Nothing to write: Input is NULL." );
}
mitkIpPicDescriptor * picImage = input->GetPic();
SlicedGeometry3D* slicedGeometry = input->GetSlicedGeometry();
if (slicedGeometry != NULL)
{
//set tag "REAL PIXEL SIZE"
const Vector3D & spacing = slicedGeometry->GetSpacing();
mitkIpPicTSV_t *pixelSizeTag;
pixelSizeTag = mitkIpPicQueryTag( picImage, "REAL PIXEL SIZE" );
if (!pixelSizeTag)
{
pixelSizeTag = (mitkIpPicTSV_t *) malloc( sizeof(mitkIpPicTSV_t) );
pixelSizeTag->type = mitkIpPicFloat;
pixelSizeTag->bpe = 32;
strcpy(pixelSizeTag->tag, "REAL PIXEL SIZE");
pixelSizeTag->dim = 1;
pixelSizeTag->n[0] = 3;
pixelSizeTag->value = malloc( sizeof(float) * 3 );
mitkIpPicAddTag (picImage, pixelSizeTag);
}
((float*)pixelSizeTag->value)[0] = spacing[0];
((float*)pixelSizeTag->value)[1] = spacing[1];
((float*)pixelSizeTag->value)[2] = spacing[2];
//set tag "ISG"
//ISG == offset/origin transformation matrix(matrix) spancings
//ISG == offset0 offset1 offset2 spalte0_0 spalte0_1 spalte0_2 spalte1_0 spalte1_1 spalte1_2 spalte2_0 spalte2_1 spalte2_2 spacing0 spacing1 spacing2
mitkIpPicTSV_t *geometryTag;
geometryTag = mitkIpPicQueryTag( picImage, "ISG" );
if (!geometryTag)
{
geometryTag = (mitkIpPicTSV_t *) malloc( sizeof(mitkIpPicTSV_t) );
geometryTag->type = mitkIpPicFloat;
geometryTag->bpe = 32;
strcpy(geometryTag->tag, "ISG");
geometryTag->dim = 2;
geometryTag->n[0] = 3;
geometryTag->n[1] = 4;
geometryTag->value = malloc( sizeof(float) * 3 * 4 );
mitkIpPicAddTag (picImage, geometryTag);
}
const AffineTransform3D::OffsetType& offset = slicedGeometry->GetIndexToWorldTransform()->GetOffset();
((float*)geometryTag->value)[0] = offset[0];
((float*)geometryTag->value)[1] = offset[1];
((float*)geometryTag->value)[2] = offset[2];
const AffineTransform3D::MatrixType& matrix = slicedGeometry->GetIndexToWorldTransform()->GetMatrix();
const AffineTransform3D::MatrixType::ValueType* row0 = matrix[0];
const AffineTransform3D::MatrixType::ValueType* row1 = matrix[1];
const AffineTransform3D::MatrixType::ValueType* row2 = matrix[2];
Vector3D v;
FillVector3D(v, row0[0], row1[0], row2[0]);
v.Normalize();
((float*)geometryTag->value)[3] = v[0];
((float*)geometryTag->value)[4] = v[1];
((float*)geometryTag->value)[5] = v[2];
FillVector3D(v, row0[1], row1[1], row2[1]);
v.Normalize();
((float*)geometryTag->value)[6] = v[0];
((float*)geometryTag->value)[7] = v[1];
((float*)geometryTag->value)[8] = v[2];
((float*)geometryTag->value)[9] = spacing[0];
((float*)geometryTag->value)[10] = spacing[1];
((float*)geometryTag->value)[11] = spacing[2];
}
PicFileReader::ConvertHandedness(picImage); // flip upside-down in MITK coordinates
// Following line added to detect write errors. If saving .pic files from the plugin is broken again,
// please report a bug, don't just remove this line!
int ret = MITKIpPicPut((char*)(m_FileName.c_str()), picImage);
if (ret != 0)
{
PicFileReader::ConvertHandedness(picImage); // flip back from upside-down state
throw std::ios_base::failure("Error during .pic file writing in "__FILE__);
}
PicFileReader::ConvertHandedness(picImage); // flip back from upside-down state
}
-void mitk::PicFileWriter::SetInput( Image* image )
+void mitk::PicFileWriter::SetInputImage( Image* image )
{
this->ProcessObject::SetNthInput( 0, image );
}
const mitk::Image* mitk::PicFileWriter::GetInput()
{
if ( this->GetNumberOfInputs() < 1 )
{
return NULL;
}
else
{
return static_cast< const Image * >( this->ProcessObject::GetInput( 0 ) );
}
}
int mitk::PicFileWriter::MITKIpPicPut( char *outfile_name, mitkIpPicDescriptor *pic )
{
FILE* outfile;
mitkIpUInt4_t len;
mitkIpUInt4_t tags_len;
if( pic->info->write_protect )
{
fprintf( stderr, "mitkIpPicPut: sorry, can't write (missing tags !!!)\n" );
//return( -1 );
}
if( mitkIpPicEncryptionType(pic) != ' ' )
{
fprintf( stderr, "mitkIpPicPut: warning: was encrypted !!!\n" );
}
if( outfile_name == NULL )
outfile = stdout;
else if( strcmp(outfile_name, "stdout") == 0 )
outfile = stdout;
else
{
mitkIpPicRemoveFile( outfile_name );
// Removed due to linker problems when compiling
// an mitk chili plugin using msvc: there appear
// unresolved external symbol errors to function
// _ipPicGetWriteCompression()
/*
if( mitkIpPicGetWriteCompression() )
{
char buff[1024];
sprintf( buff, "%s.gz", outfile_name );
outfile = (FILE*) mitkIpPicFOpen( buff, "wb" ); // cast to prevent warning.
}
else
*/
outfile = fopen( outfile_name, "wb" );
}
if( outfile == NULL )
{
fprintf( stderr, "mitkIpPicPut: sorry, error opening outfile\n" );
return( -1 );
}
tags_len = _mitkIpPicTagsSize( pic->info->tags_head );
len = tags_len + 3 * sizeof(mitkIpUInt4_t)
+ pic->dim * sizeof(mitkIpUInt4_t);
/* write oufile */
if( mitkIpPicEncryptionType(pic) == ' ' )
mitkIpPicFWrite( mitkIpPicVERSION, 1, sizeof(mitkIpPicTag_t), outfile );
else
mitkIpPicFWrite( pic->info->version, 1, sizeof(mitkIpPicTag_t), outfile );
mitkIpPicFWriteLE( &len, sizeof(mitkIpUInt4_t), 1, outfile );
mitkIpPicFWriteLE( &(pic->type), sizeof(mitkIpUInt4_t), 1, outfile );
mitkIpPicFWriteLE( &(pic->bpe), sizeof(mitkIpUInt4_t), 1, outfile );
mitkIpPicFWriteLE( &(pic->dim), sizeof(mitkIpUInt4_t), 1, outfile );
mitkIpPicFWriteLE( pic->n, sizeof(mitkIpUInt4_t), pic->dim, outfile );
_mitkIpPicWriteTags( pic->info->tags_head, outfile, mitkIpPicEncryptionType(pic) );
// Removed due to linker problems when compiling
// an mitk chili plugin using msvc: there appear
// unresolved external symbol errors to function
// _ipPicGetWriteCompression()
/*
if( mitkIpPicGetWriteCompression() )
pic->info->pixel_start_in_file = mitkIpPicFTell( outfile );
else
*/
pic->info->pixel_start_in_file = ftell( outfile );
if( pic->data )
{
size_t number_of_elements = _mitkIpPicElements(pic);
size_t bytes_per_element = pic->bpe / 8;
size_t number_of_bytes = number_of_elements * bytes_per_element;
size_t block_size = 1024*1024; /* Use 1 MB blocks. Make sure that block size is smaller than 2^31 */
size_t number_of_blocks = number_of_bytes / block_size;
size_t remaining_bytes = number_of_bytes % block_size;
size_t bytes_written = 0;
size_t block_nr = 0;
mitkIpUInt1_t* data = (mitkIpUInt1_t*) pic->data;
assert( data != NULL );
if( pic->type == mitkIpPicNonUniform )
{
for ( block_nr = 0 ; block_nr < number_of_blocks ; ++block_nr )
bytes_written += mitkIpPicFWrite( data + ( block_nr * block_size ), 1, block_size, outfile );
bytes_written += mitkIpPicFWrite( data + ( number_of_blocks * block_size ), 1, remaining_bytes, outfile );
}
else
{
for ( block_nr = 0 ; block_nr < number_of_blocks ; ++block_nr )
bytes_written += mitkIpPicFWriteLE( data + ( block_nr * block_size ), 1, block_size, outfile );
bytes_written += mitkIpPicFWriteLE( data + ( number_of_blocks * block_size ), 1, remaining_bytes, outfile );
}
if ( bytes_written != number_of_bytes )
{
fprintf( stderr, "Error while writing (ferror indicates %u), only %u bytes were written! Eof indicator is %u.\n", ferror(outfile), ( (unsigned int) ( bytes_written ) ), feof(outfile) );
fclose( outfile );
return( -1 );
}
}
if( outfile != stdout )
{
// Removed due to linker problems when compiling
// an mitk chili plugin using msvc: there appear
// unresolved external symbol errors to function
// _ipPicGetWriteCompression()
/*
if( mitkIpPicGetWriteCompression() )
mitkIpPicFClose( outfile );
else
*/
fclose( outfile );
}
return( 0 );
}
std::vector<std::string> mitk::PicFileWriter::GetPossibleFileExtensions()
{
std::vector<std::string> possibleFileExtensions;
possibleFileExtensions.push_back(".pic");
return possibleFileExtensions;
}
diff --git a/Core/Code/IO/mitkPicFileWriter.h b/Core/Code/IO/mitkPicFileWriter.h
index 2b6bf7fcbc..b4e4bbb709 100644
--- a/Core/Code/IO/mitkPicFileWriter.h
+++ b/Core/Code/IO/mitkPicFileWriter.h
@@ -1,117 +1,117 @@
/*=========================================================================
Program: Medical Imaging & Interaction Toolkit
Language: C++
Date: $Date$
Version: $Revision$
Copyright (c) German Cancer Research Center, Division of Medical and
Biological Informatics. All rights reserved.
See MITKCopyright.txt or http://www.mitk.org/copyright.html for details.
This software is distributed WITHOUT ANY WARRANTY; without even
the implied warranty of MERCHANTABILITY or FITNESS FOR A PARTICULAR
PURPOSE. See the above copyright notices for more information.
=========================================================================*/
#ifndef _MITK_PIC_FILE_WRITER__H_
#define _MITK_PIC_FILE_WRITER__H_
#include <mitkFileWriter.h>
#include <mitkIpPic.h>
namespace mitk
{
class Image;
/**
* @brief Writer for mitk::Image
* @ingroup IO
*/
class MITK_CORE_EXPORT PicFileWriter : public mitk::FileWriter
{
public:
mitkClassMacro( PicFileWriter, mitk::FileWriter );
itkNewMacro( Self );
mitkWriterMacro;
/**
* Sets the filename of the file to write.
* @param _arg the name of the file to write.
*/
itkSetStringMacro( FileName );
/**
* @returns the name of the file to be written to disk.
*/
itkGetStringMacro( FileName );
/**
* @warning multiple write not (yet) supported
*/
itkSetStringMacro( FilePrefix );
/**
* @warning multiple write not (yet) supported
*/
itkGetStringMacro( FilePrefix );
/**
* @warning multiple write not (yet) supported
*/
itkSetStringMacro( FilePattern );
/**
* @warning multiple write not (yet) supported
*/
itkGetStringMacro( FilePattern );
/**
* Sets the 0'th input object for the filter.
* @param input the first input for the filter.
*/
- void SetInput( mitk::Image* input );
+ void SetInputImage( mitk::Image* input );
/**
* @returns the 0'th input object of the filter.
*/
const mitk::Image* GetInput();
/**
* @return possible file extensions for the data type associated with the writer
*/
virtual std::vector<std::string> GetPossibleFileExtensions();
protected:
/**
* Constructor.
*/
PicFileWriter();
/**
* Virtual destructor.
*/
virtual ~PicFileWriter();
virtual void GenerateData();
virtual int MITKIpPicPut( char *outfile_name, mitkIpPicDescriptor *pic );
std::string m_FileName;
std::string m_FilePrefix;
std::string m_FilePattern;
};
}
#endif //_MITK_PIC_FILE_WRITER__H_
diff --git a/Core/Code/Interactions/StateMachine.xml b/Core/Code/Interactions/StateMachine.xml
index af135a413c..e4ee5a9729 100644
--- a/Core/Code/Interactions/StateMachine.xml
+++ b/Core/Code/Interactions/StateMachine.xml
@@ -1,3684 +1,3715 @@
<?xml version="1.0" encoding="utf-8"?>
<!-- Event_Id = 0: this is a * transition with all other eventId's not declared in that state -->
<mitkInteraktionStates xmlns="http://tempuri.org/StateMachine.xsd" STYLE="User001">
<!-- ***WARNING*** do not use any &, % and so on in NAME -->
<!-- -->
<!-- -->
<!-- EventDescriptions -->
<events STYLE="standard">
<!-- Null Event -->
<!-- not here defined, cause this will never be send from external to mitk (to be mapped in mitkEventMapper to an mitk-event)-->
<!-- left MouseButton -->
<event NAME="left MouseBN" ID="1" TYPE="Type_MouseButtonPress" BUTTON="BS_LeftButton" BUTTONSTATE="0x0000" KEY="Key_none" />
<!-- right MouseButton -->
<event NAME="right MouseBN" ID="2" TYPE="Type_MouseButtonPress" BUTTON="BS_RightButton" BUTTONSTATE="0x0000" KEY="Key_none" />
<!-- Shift + left MouseButton -->
<event NAME="left MouseBN + Shift" ID="3" TYPE="Type_MouseButtonPress" BUTTON="BS_LeftButton" BUTTONSTATE="0x0100" KEY="Key_none" />
<!-- middle MouseButton -->
<event NAME="middle MouseBN" ID="4" TYPE="Type_MouseButtonPress" BUTTON="BS_MidButton" BUTTONSTATE="0x0000" KEY="Key_none" />
<!-- Ctrl + left MouseButton -->
<event NAME="CTRL+leftBN" ID="5" TYPE="Type_MouseButtonPress" BUTTON="BS_LeftButton" BUTTONSTATE="0x0200" KEY="Key_none" />
<!-- Ctrl + middle MouseButton -->
<event NAME="CTRL+middleBN" ID="6" TYPE="Type_MouseButtonPress" BUTTON="BS_MidButton" BUTTONSTATE="0x0200" KEY="Key_none" />
<!-- Ctrl + right MouseButton -->
<event NAME="CTRL+rightBN" ID="7" TYPE="Type_MouseButtonPress" BUTTON="BS_RightButton" BUTTONSTATE="0x0200" KEY="Key_none" />
<!-- left MouseButton DoubleClick-->
<event NAME="left MouseBN DC" ID="8" TYPE="Type_MouseButtonDblClick" BUTTON="BS_LeftButton" BUTTONSTATE="0x0000" KEY="Key_none" />
<!-- MouseWheel-->
<event NAME="MouseWheel" ID="9" TYPE="Type_Wheel" BUTTON="BS_NoButton" BUTTONSTATE="0x0000" KEY="Key_none" />
<!-- Strg + N -->
<event NAME="Strg + N" ID="10" TYPE="Type_KeyPress" BUTTON="BS_NoButton" BUTTONSTATE="0x0200" KEY="Key_N" />
<!-- Strg + E -->
<event NAME="Strg + E" ID="11" TYPE="Type_KeyPress" BUTTON="BS_NoButton" BUTTONSTATE="0x0200" KEY="Key_E" />
<!-- Delete -->
<event NAME="Delete" ID="12" TYPE="Type_KeyPress" BUTTON="BS_NoButton" BUTTONSTATE="0x0000" KEY="Key_Delete" />
<!-- Esc -->
<event NAME="Escape" ID="14" TYPE="Type_KeyPress" BUTTON="BS_NoButton" BUTTONSTATE="0x0000" KEY="Key_Escape" />
<!-- N-->
<event NAME="N" ID="13" TYPE="Type_KeyPress" BUTTON="BS_NoButton" BUTTONSTATE="0x0000" KEY="Key_N" />
<!-- P-->
<event NAME="P" ID="15" TYPE="Type_KeyPress" BUTTON="BS_NoButton" BUTTONSTATE="0x0000" KEY="Key_P" />
<!-- R-->
<event NAME="R" ID="16" TYPE="Type_KeyPress" BUTTON="BS_NoButton" BUTTONSTATE="0x0000" KEY="Key_R" />
<!-- T-->
<event NAME="T" ID="17" TYPE="Type_KeyPress" BUTTON="BS_NoButton" BUTTONSTATE="0x0000" KEY="Key_T" />
<!-- S-->
<event NAME="S" ID="18" TYPE="Type_KeyPress" BUTTON="BS_NoButton" BUTTONSTATE="0x0000" KEY="Key_S" />
<!-- E -->
<event NAME="E" ID="19" TYPE="Type_KeyPress" BUTTON="BS_NoButton" BUTTONSTATE="0x0000" KEY="Key_E" />
<!-- Strg + Alt + A -->
<event NAME="Strg+Alt+A" ID="20" TYPE="Type_KeyPress" BUTTON="BS_NoButton" BUTTONSTATE="0x0600" KEY="Key_A" />
<!-- Strg + Alt + B -->
<event NAME="Strg+Alt+B" ID="21" TYPE="Type_KeyPress" BUTTON="BS_NoButton" BUTTONSTATE="0x0600" KEY="Key_B" />
<!-- H-->
<event NAME="H" ID="22" TYPE="Type_KeyPress" BUTTON="BS_NoButton" BUTTONSTATE="0x0000" KEY="Key_H" />
<!-- Return -->
<event NAME="Return" ID="23" TYPE="Type_KeyPress" BUTTON="BS_NoButton" BUTTONSTATE="0x0000" KEY="Key_Return" />
<!-- Enter -->
<event NAME="Enter" ID="24" TYPE="Type_KeyPress" BUTTON="BS_NoButton" BUTTONSTATE="0x0000" KEY="Key_Enter" />
<!-- Space -->
<event NAME="Space" ID="25" TYPE="Type_KeyPress" BUTTON="BS_NoButton" BUTTONSTATE="0x0000" KEY="Key_Space" />
<!-- Plus -->
<event NAME="Plus" ID="26" TYPE="Type_KeyPress" BUTTON="BS_NoButton" BUTTONSTATE="0x0000" KEY="Key_Plus" />
<!-- Minus -->
<event NAME="Minus" ID="27" TYPE="Type_KeyPress" BUTTON="BS_NoButton" BUTTONSTATE="0x0000" KEY="Key_Minus" />
<!-- Strg + Alt + H -->
<event NAME="Strg+Alt+H" ID="30" TYPE="Type_KeyPress" BUTTON="BS_NoButton" BUTTONSTATE="0x0600" KEY="Key_H" />
<!-- Strg + Alt + I -->
<event NAME="Strg+Alt+I" ID="31" TYPE="Type_KeyPress" BUTTON="BS_NoButton" BUTTONSTATE="0x0600" KEY="Key_I" />
<!-- Strg + Alt + S -->
<event NAME="Strg+Alt+S" ID="40" TYPE="Type_KeyPress" BUTTON="BS_NoButton" BUTTONSTATE="0x0600" KEY="Key_S" />
<!-- ArrowUp -->
<event NAME="ArrowUp" ID="50" TYPE="Type_KeyPress" BUTTON="BS_NoButton" BUTTONSTATE="0x0000" KEY="Key_Up" />
<!-- ArrowDown -->
<event NAME="ArrowDown" ID="51" TYPE="Type_KeyPress" BUTTON="BS_NoButton" BUTTONSTATE="0x0000" KEY="Key_Down" />
<!-- ArrowLeft -->
<event NAME="ArrowLeft" ID="52" TYPE="Type_KeyPress" BUTTON="BS_NoButton" BUTTONSTATE="0x0000" KEY="Key_Left" />
<!-- ArrowRight -->
<event NAME="ArrowRight" ID="53" TYPE="Type_KeyPress" BUTTON="BS_NoButton" BUTTONSTATE="0x0000" KEY="Key_Right" />
<!-- ArrowUp + Shift -->
<event NAME="ArrowUp+Shift" ID="54" TYPE="Type_KeyPress" BUTTON="BS_NoButton" BUTTONSTATE="0x0100" KEY="Key_Up" />
<!-- ArrowDown +Shift -->
<event NAME="ArrowDown+Shift" ID="55" TYPE="Type_KeyPress" BUTTON="BS_NoButton" BUTTONSTATE="0x0100" KEY="Key_Down" />
<!-- Alt -->
<event NAME="Alt" ID="90" TYPE="Type_KeyPress" BUTTON="BS_NoButton" BUTTONSTATE="0x0400" KEY="Key_Alt" />
<!-- Strg + B -->
<event NAME="Strg+B" ID="91" TYPE="Type_KeyPress" BUTTON="BS_NoButton" BUTTONSTATE="0x0200" KEY="Key_B" />
<!-- leftMouseButtonRelease -->
<event NAME="leftMouseRelease" ID="505" TYPE="Type_MouseButtonRelease" BUTTON="BS_LeftButton" BUTTONSTATE="0x0001" KEY="Key_none" />
<!-- MiddleMouseButtonRelease -->
<event NAME="MiddleMouseRelease" ID="506" TYPE="Type_MouseButtonRelease" BUTTON="BS_MidButton" BUTTONSTATE="0x0004" KEY="Key_none" />
<!-- RightMouseButtonRelease -->
<event NAME="RightMouseRelease" ID="507" TYPE="Type_MouseButtonRelease" BUTTON="BS_RightButton" BUTTONSTATE="0x0002" KEY="Key_none" />
<!-- Shift + left MouseButtonRelease -->
<event NAME="left MouseBNRelease+Shift" ID="508" TYPE="Type_MouseButtonRelease" BUTTON="BS_LeftButton" BUTTONSTATE="0x0101" KEY="Key_none" />
<!-- MouseMove -->
<event NAME="MouseMove" ID="520" TYPE="Type_MouseMove" BUTTON="BS_NoButton" BUTTONSTATE="0x0000" KEY="Key_none" />
<!-- left MouseButton and MouseWheel -->
<event NAME="leftBN+MouseWheel" ID="521" TYPE="Type_Wheel" BUTTON="BS_LeftButton" BUTTONSTATE="0x0001" KEY="Key_none" />
<!-- right MouseButton and MouseWheel -->
<event NAME="rightBN+MouseWheel" ID="522" TYPE="Type_Wheel" BUTTON="BS_RightButton" BUTTONSTATE="0x0002" KEY="Key_none" />
<!-- middle MouseButton and MouseWheel -->
<event NAME="middleBN+MouseWheel" ID="523" TYPE="Type_Wheel" BUTTON="BS_MidButton" BUTTONSTATE="0x0004" KEY="Key_none" />
<!-- left MouseButton and MouseMove -->
<event NAME="leftBN+MouseMove" ID="530" TYPE="Type_MouseMove" BUTTON="BS_NoButton" BUTTONSTATE="0x0001" KEY="Key_none" />
<!-- right MouseButton and MouseMove -->
<event NAME="rightBN+MouseMove" ID="531" TYPE="Type_MouseMove" BUTTON="BS_NoButton" BUTTONSTATE="0x0002" KEY="Key_none" />
<!-- middle MouseButton and MouseMove -->
<event NAME="middleBN+MouseMove" ID="533" TYPE="Type_MouseMove" BUTTON="BS_NoButton" BUTTONSTATE="0x0004" KEY="Key_none" />
<!-- CTRL + left MouseButton and MouseMove -->
<event NAME="CTRL+leftBN+MouseMove" ID="534" TYPE="Type_MouseMove" BUTTON="BS_NoButton" BUTTONSTATE="0x0201" KEY="Key_none" />
<!-- CTRL + right MouseButton and MouseMove -->
<event NAME="CTRL+rightBN+MouseMove" ID="535" TYPE="Type_MouseMove" BUTTON="BS_NoButton" BUTTONSTATE="0x0202" KEY="Key_none" />
<!-- CTRL + middle MouseButton and MouseMove -->
<event NAME="CTRL+middleBN+MouseMove" ID="536" TYPE="Type_MouseMove" BUTTON="BS_NoButton" BUTTONSTATE="0x0204" KEY="Key_none" />
<!-- CTRL + left MouseButtonRelease -->
<event NAME="CTRL+leftBNRelease" ID="537" TYPE="Type_MouseButtonRelease" BUTTON="BS_LeftButton" BUTTONSTATE="0x0201" KEY="Key_none" />
<!-- CTRL + right MouseButtonRelease -->
<event NAME="CTRL+rightBNRelease" ID="538" TYPE="Type_MouseButtonRelease" BUTTON="BS_RightButton" BUTTONSTATE="0x0202" KEY="Key_none" />
<!-- CTRL + middle MouseButtonRelease -->
<event NAME="CTRL+middleBNRelease" ID="539" TYPE="Type_MouseButtonRelease" BUTTON="BS_MidButton" BUTTONSTATE="0x0204" KEY="Key_none" />
<!-- Shift + Ctrl + left MouseButton -->
<event NAME="SHIFT+CTRL+MousePress" ID="540" TYPE="Type_MouseButtonPress" BUTTON="BS_LeftButton" BUTTONSTATE="0x0300" KEY="Key_none" />
<!-- Shift + Ctrl + left MouseButtonMove -->
<event NAME="SHIFT+CTRL+MouseMove" ID="542" TYPE="Type_MouseMove" BUTTON="BS_NoButton" BUTTONSTATE="0x0301" KEY="Key_none" />
<!-- Shift + Ctrl + left MouseButtonRelease -->
<event NAME="SHIFT+CTRL+MouseRelease" ID="543" TYPE="Type_MouseButtonRelease" BUTTON="BS_LeftButton" BUTTONSTATE="0x0301" KEY="Key_none" />
<!-- Shift + left MouseButton and MouseMove -->
<event NAME="Shift+leftBN+MouseMove" ID="541" TYPE="Type_MouseMove" BUTTON="BS_NoButton" BUTTONSTATE="0x0101" KEY="Key_none" />
<!-- ALT + left MouseButton -->
<event NAME="ALT+leftBN" ID="600" TYPE="Type_MouseButtonPress" BUTTON="BS_LeftButton" BUTTONSTATE="0x0400" KEY="Key_none" />
<!-- ALT + left MouseButton and MouseMove -->
<event NAME="ALT+leftBN+MouseMove" ID="610" TYPE="Type_MouseMove" BUTTON="BS_NoButton" BUTTONSTATE="0x0401" KEY="Key_none" />
<!-- ALT + leftMouseButtonRelease -->
<event NAME="ALT+leftMouseRelease" ID="620" TYPE="Type_MouseButtonRelease" BUTTON="BS_LeftButton" BUTTONSTATE="0x0401" KEY="Key_none" />
<!-- SHIFT + rightMouseButtonPress -->
<event NAME="Shift+rightMousePress" ID="2000" TYPE="Type_MouseButtonPress" BUTTON="BS_RightButton" BUTTONSTATE="0x0100" KEY="Key_none" />
<!-- SHIFT + rightMouseButtonMove -->
<event NAME="Shift+rightMouseMove" ID="2001" TYPE="Type_MouseMove" BUTTON="BS_NoButton" BUTTONSTATE="0x0102" KEY="Key_none" />
<!-- SHIFT + rightMouseButtonRelease -->
<event NAME="Shift+rightMouseRelease" ID="2002" TYPE="Type_MouseButtonRelease" BUTTON="BS_RightButton" BUTTONSTATE="0x0102" KEY="Key_none" />
<!-- SHIFT + middleMouseButtonPress -->
<event NAME="Shift+middleMousePress" ID="2003" TYPE="Type_MouseButtonPress" BUTTON="BS_MidButton" BUTTONSTATE="0x0100" KEY="Key_none" />
<!-- SHIFT + middleMouseButtonMove -->
<event NAME="Shift+middleMouseMove" ID="2004" TYPE="Type_MouseMove" BUTTON="BS_NoButton" BUTTONSTATE="0x0104" KEY="Key_none" />
<!-- SHIFT + middleMouseButtonRelease -->
<event NAME="Shift+middleMouseRelease" ID="2005" TYPE="Type_MouseButtonRelease" BUTTON="BS_MidButton" BUTTONSTATE="0x0104" KEY="Key_none" />
<!-- -->
<!-- -->
<!-- own thrown events -->
<!-- *****Important*****: has to be set in mitkInteractionConst.h-->
<event NAME="new" ID="1000" TYPE="Type_User" BUTTON="BS_NoButton" BUTTONSTATE="0x0000" KEY="Key_none" />
<event NAME="old" ID="1001" TYPE="Type_User" BUTTON="BS_NoButton" BUTTONSTATE="0x0000" KEY="Key_none" />
<event NAME="finished" ID="1002" TYPE="Type_User" BUTTON="BS_NoButton" BUTTONSTATE="0x0000" KEY="Key_none" />
<event NAME="StSELECT" ID="1003" TYPE="Type_User" BUTTON="BS_NoButton" BUTTONSTATE="0x0000" KEY="Key_none" />
<event NAME="StDESELECT" ID="1004" TYPE="Type_User" BUTTON="BS_NoButton" BUTTONSTATE="0x0000" KEY="Key_none" />
<event NAME="EIDNO" ID="1003" TYPE="Type_User" BUTTON="BS_NoButton" BUTTONSTATE="0x0000" KEY="Key_none" />
<event NAME="EIDYES" ID="1004" TYPE="Type_User" BUTTON="BS_NoButton" BUTTONSTATE="0x0000" KEY="Key_none" />
<event NAME="same" ID="1005" TYPE="Type_User" BUTTON="BS_NoButton" BUTTONSTATE="0x0000" KEY="Key_none" />
<event NAME="no and last object" ID="1006" TYPE="Type_User" BUTTON="BS_NoButton" BUTTONSTATE="0x0000" KEY="Key_none" />
<event NAME="no and not last object" ID="1007" TYPE="Type_User" BUTTON="BS_NoButton" BUTTONSTATE="0x0000" KEY="Key_none" />
<event NAME="last" ID="1008" TYPE="Type_User" BUTTON="BS_NoButton" BUTTONSTATE="0x0000" KEY="Key_none" />
<event NAME="not last" ID="1009" TYPE="Type_User" BUTTON="BS_NoButton" BUTTONSTATE="0x0000" KEY="Key_none" />
<event NAME="SetStateMachineToSelectedMode" ID="1030" TYPE="Type_User" BUTTON="BS_NoButton" BUTTONSTATE="0x0000" KEY="Key_none" />
<event NAME="SetStateMachineToDeselectedMode" ID="1031" TYPE="Type_User" BUTTON="BS_NoButton" BUTTONSTATE="0x0000" KEY="Key_none" />
<!-- for n-PointRoi-->
<event NAME="StSMALERNMINUS1 " ID="1010" TYPE="Type_User" BUTTON="BS_NoButton" BUTTONSTATE="0x0000" KEY="Key_none" />
<event NAME="StLARGERNMINUS1" ID="1011" TYPE="Type_User" BUTTON="BS_NoButton" BUTTONSTATE="0x0000" KEY="Key_none" />
<!-- -->
<event NAME="ActivateTool" ID="1300" TYPE="Type_User" BUTTON="BS_NoButton" BUTTONSTATE="0x0000" KEY="Key_none" />
<!-- -->
<!-- Sonstiges -->
<!--<event NAME="PositionEvent" ID="1012" TYPE="Type_MouseButtonPress" BUTTON="BS_LeftButton" BUTTONSTATE="0x0000" KEY="Key_none" />-->
<!-- DoubleClick <event NAME="PositionEvent" ID="510" TYPE="4" BUTTON="0x0001" BUTTONSTATE="0x0000" KEY="0xffff" />-->
<!--<event NAME="StSmallerN" ID="1014" TYPE="Type_User" BUTTON="BS_NoButton" BUTTONSTATE="0x0000" KEY="Key_none" />-->
<!--<event NAME="StEqualsN" ID="1015" TYPE="Type_User" BUTTON="BS_NoButton" BUTTONSTATE="0x0000" KEY="Key_none" />-->
<!--<event NAME="StLargerN" ID="1016" TYPE="Type_User" BUTTON="BS_NoButton" BUTTONSTATE="0x0000" KEY="Key_none" />-->
<!-- for external thrown Events-->
<event NAME="clear" ID="1100" TYPE="Type_User" BUTTON="BS_NoButton" BUTTONSTATE="0x0000" KEY="Key_none" />
<!-- Puncture Application -->
<event NAME="print" ID="3001" TYPE="Type_Application" BUTTON="BS_NoButton" BUTTONSTATE="0x0000" KEY="Key_none" />
</events>
<!-- Beginning of state machine patterns-->
<!-- TutorialStep10Begin -->
<stateMachine NAME="SelectAndMoveObjectWithArrowKeys">
<state NAME="start" ID="1" START_STATE="TRUE" X_POS="3" Y_POS="40" WIDTH="100" HEIGHT="50">
<transition NAME="CheckIfObjectIsPicked" NEXT_STATE_ID="2" EVENT_ID="1">
<action ID="30" />
<!-- 30 = AcCHECKELEMENT -->
</transition>
</state>
<state NAME="Guard_IsObjectPicked" ID="2" X_POS="282" Y_POS="23" WIDTH="126" HEIGHT="50">
<transition NAME="yes" NEXT_STATE_ID="10" EVENT_ID="1004">
<action ID="65" />
<!-- AcSELECT -->
<action ID="1101" />
<!--AcMODE_SELECT-->
</transition>
<transition NAME="no" NEXT_STATE_ID="1" EVENT_ID="1003">
<action ID="75" />
<!-- AcDESELECT -->
<action ID="1100" />
<!--AcMODE_DESELECT-->
</transition>
</state>
<state NAME="object selected" ID="10" X_POS="714" Y_POS="85" WIDTH="100" HEIGHT="50">
<transition NAME="CheckIfObjectIsPicked" NEXT_STATE_ID="2" EVENT_ID="1">
<action ID="30" />
<!-- AcCHECKELEMENT -->
</transition>
<transition NAME="z+" NEXT_STATE_ID="10" EVENT_ID="50">
<action ID="92" > <!-- AcMove -->
<intParameter NAME="DIRECTION_X" VALUE="0" />
<intParameter NAME="DIRECTION_Y" VALUE="0" />
<intParameter NAME="DIRECTION_Z" VALUE="1" />
</action>
</transition>
<transition NAME="z-" NEXT_STATE_ID="10" EVENT_ID="51">
<action ID="92" > <!-- AcMove -->
<intParameter NAME="DIRECTION_X" VALUE="0" />
<intParameter NAME="DIRECTION_Y" VALUE="0" />
<intParameter NAME="DIRECTION_Z" VALUE="-1" />
</action>
</transition>
<transition NAME="x+" NEXT_STATE_ID="10" EVENT_ID="52">
<action ID="92" > <!-- AcMove -->
<intParameter NAME="DIRECTION_X" VALUE="1" />
<intParameter NAME="DIRECTION_Y" VALUE="0" />
<intParameter NAME="DIRECTION_Z" VALUE="0" />
</action>
</transition>
<transition NAME="x-" NEXT_STATE_ID="10" EVENT_ID="53">
<action ID="92" > <!-- AcMove -->
<intParameter NAME="DIRECTION_X" VALUE="-1" />
<intParameter NAME="DIRECTION_Y" VALUE="0" />
<intParameter NAME="DIRECTION_Z" VALUE="0" />
</action>
</transition>
<transition NAME="y+" NEXT_STATE_ID="10" EVENT_ID="54">
<action ID="92" > <!-- AcMove -->
<intParameter NAME="DIRECTION_X" VALUE="0" />
<intParameter NAME="DIRECTION_Y" VALUE="1" />
<intParameter NAME="DIRECTION_Z" VALUE="0" />
</action>
</transition>
<transition NAME="y-" NEXT_STATE_ID="10" EVENT_ID="55">
<action ID="92" > <!-- AcMove -->
<intParameter NAME="DIRECTION_X" VALUE="0" />
<intParameter NAME="DIRECTION_Y" VALUE="-1" />
<intParameter NAME="DIRECTION_Z" VALUE="0" />
</action>
</transition>
</state>
</stateMachine>
<!-- TutorialStep10End -->
<stateMachine NAME="AffineInteractions click to select">
<state NAME="start" ID="1" START_STATE="TRUE" X_POS="3" Y_POS="40" WIDTH="100" HEIGHT="50">
<transition NAME="leftButtonPress" NEXT_STATE_ID="2" EVENT_ID="1">
<!-- 30 = SeCHECKELEMENT -->
<action ID="30" />
</transition>
</state>
<state NAME="object selected check" ID="2" X_POS="282" Y_POS="23" WIDTH="126" HEIGHT="50">
<transition NAME="yes" NEXT_STATE_ID="10" EVENT_ID="1004">
<!-- EIDYES -->
<action ID="0" />
</transition>
<transition NAME="no" NEXT_STATE_ID="1" EVENT_ID="1003">
<!-- EIDNO -->
<action ID="0" />
</transition>
</state>
<state NAME="neutral" ID="10" X_POS="714" Y_POS="85" WIDTH="100" HEIGHT="50">
<transition NAME="leftButtonPress" NEXT_STATE_ID="20" EVENT_ID="1">
<!-- 30 = SeCHECKELEMENT -->
<action ID="30" />
</transition>
<transition NAME="rightButtonPress" NEXT_STATE_ID="31" EVENT_ID="2">
<!-- 1002 = SeSCALESTART -->
<action ID="1002" />
</transition>
<transition NAME="middleButtonPress" NEXT_STATE_ID="41" EVENT_ID="4">
<!-- 1004 = SeROTATESTART -->
<action ID="1004" />
</transition>
</state>
<state NAME="object deselect check" ID="20" X_POS="57" Y_POS="396" WIDTH="122" HEIGHT="50">
<transition NAME="yes" NEXT_STATE_ID="21" EVENT_ID="1004">
<!-- 1000 = SeTRANSLATESTART -->
<action ID="1000" />
</transition>
<transition NAME="no" NEXT_STATE_ID="1" EVENT_ID="1003">
<!-- EIDNO -->
<action ID="0" />
</transition>
</state>
<state NAME="translating" ID="21" X_POS="203" Y_POS="150" WIDTH="100" HEIGHT="50">
<transition NAME="leftButtonMove" NEXT_STATE_ID="21" EVENT_ID="530">
<!-- 1001 = SeTRANSLATE -->
<action ID="1000" />
</transition>
<transition NAME="leftButtonRelease" NEXT_STATE_ID="10" EVENT_ID="505">
<!-- 0 = no action -->
<action ID="0" />
</transition>
</state>
<state NAME="scaling" ID="31" X_POS="347" Y_POS="459" WIDTH="100" HEIGHT="50">
<transition NAME="rightButtonMove" NEXT_STATE_ID="31" EVENT_ID="531">
<!-- 1003 = SeSCALE -->
<action ID="1003" />
</transition>
<transition NAME="rightButtonRelease" NEXT_STATE_ID="10" EVENT_ID="507">
<!-- 0 = no action -->
<action ID="0" />
</transition>
</state>
<state NAME="rotating" ID="41" X_POS="657" Y_POS="465" WIDTH="100" HEIGHT="50">
<transition NAME="middleButtonMove" NEXT_STATE_ID="41" EVENT_ID="533">
<!-- 1005 = SeROTATE -->
<action ID="1005" />
</transition>
<transition NAME="middleButtonRelease" NEXT_STATE_ID="10" EVENT_ID="506">
<!-- 0 = no action -->
<action ID="0" />
</transition>
</state>
</stateMachine>
<stateMachine NAME="AffineInteractions ctrl-drag">
<!-- affine interactions standard statemachine -->
<state NAME="start" ID="0" START_STATE="TRUE" X_POS="29" Y_POS="70" WIDTH="100" HEIGHT="50">
<transition NAME="leftButtonPress" NEXT_STATE_ID="12" EVENT_ID="5">
<!-- CTRL+LBM_Down -->
<action ID="30">
<!--AcCHECKELEMENT-->
</action>
</transition>
<transition NAME="leftButtonPress" NEXT_STATE_ID="12" EVENT_ID="540">
<!-- SHIFT+CTRL+LBM_Down -->
<action ID="11">
<!--AcADD-->
</action>
</transition>
<transition NAME="middleButtonPress" NEXT_STATE_ID="14" EVENT_ID="6">
<!-- CTRL+MBM_Down -->
<action ID="30">
<!--AcCHECKELEMENT-->
</action>
</transition>
<transition NAME="rightButtonPress" NEXT_STATE_ID="13" EVENT_ID="7">
<!-- CTRL+RBM_Down -->
<action ID="30">
<!--AcCHECKELEMENT-->
</action>
</transition>
</state>
<state NAME="picked guard Translate" ID="12" X_POS="376" Y_POS="34" WIDTH="151" HEIGHT="50">
<transition NAME="yes" NEXT_STATE_ID="2" EVENT_ID="1004">
<!-- EIDYES -->
<action ID="1101">
<!--AcMODE_SELECT-->
</action>
<action ID="1000">
<!--AcTRANSLATESTART-->
</action>
</transition>
<transition NAME="no" NEXT_STATE_ID="0" EVENT_ID="1003">
<!-- StNO -->
</transition>
</state>
<state NAME="picked guard Scale" ID="13" X_POS="647" Y_POS="312" WIDTH="100" HEIGHT="50">
<transition NAME="yes" NEXT_STATE_ID="3" EVENT_ID="1004">
<!-- EIDYES -->
<action ID="1101">
<!--AcMODE_SELECT-->
</action>
<action ID="1002">
<!--AcSCALESTART-->
</action>
</transition>
<transition NAME="no" NEXT_STATE_ID="0" EVENT_ID="1003">
<!-- StNO -->
<action ID="0" />
</transition>
</state>
<state NAME="picked guard Rotate" ID="14" X_POS="33" Y_POS="467" WIDTH="110" HEIGHT="50">
<transition NAME="yes" NEXT_STATE_ID="4" EVENT_ID="1004">
<!-- EIDYES -->
<action ID="1101">
<!--AcMODE_SELECT-->
</action>
<action ID="1004" />
</transition>
<transition NAME="no" NEXT_STATE_ID="0" EVENT_ID="1003">
<!-- StNO -->
<action ID="0" />
</transition>
</state>
<state NAME="translating" ID="2" X_POS="724" Y_POS="59" WIDTH="100" HEIGHT="50">
<transition NAME="leftButtonMove" NEXT_STATE_ID="2" EVENT_ID="534">
<!-- CTRL+LBM_Move -->
<action ID="1001">
<!--AcTRANSLATE-->
</action>
</transition>
<transition NAME="leftButtonRelease" NEXT_STATE_ID="0" EVENT_ID="505">
<!-- LBM_Release-->
<action ID="1100">
<!--AcMODE_DESELECT-->
</action>
<action ID="1008">
<!--AcTRANSLATEEND-->
</action>
</transition>
<transition NAME="leftButtonRelease" NEXT_STATE_ID="0" EVENT_ID="537">
<!-- CTRL+LBM_Release -->
<action ID="1100">
<!--AcMODE_DESELECT-->
</action>
<action ID="1008">
<!--AcTRANSLATEEND-->
</action>
</transition>
</state>
<state NAME="rotating" ID="4" X_POS="371" Y_POS="481" WIDTH="100" HEIGHT="50">
<transition NAME="middleButtonMove" NEXT_STATE_ID="4" EVENT_ID="536">
<!-- CTRL+MBM_Move-->
<action ID="1005">
<!--AcROTATE-->
</action>
</transition>
<transition NAME="middleButtonRelease" NEXT_STATE_ID="0" EVENT_ID="506">
<!-- MBM_Release-->
<action ID="1100">
<!--AcMODE_DESELECT-->
</action>
<action ID="1010">
<!--AcROTATEEEND-->
</action>
</transition>
<transition NAME="middleButtonRelease" NEXT_STATE_ID="0" EVENT_ID="539">
<!-- CTRL+MBM_Release-->
<action ID="1100">
<!--AcMODE_DESELECT-->
</action>
<action ID="1010">
<!--AcROTATEEEND-->
</action>
</transition>
</state>
<state NAME="scaling" ID="3" X_POS="710" Y_POS="432" WIDTH="100" HEIGHT="50">
<transition NAME="rightButtonMove" NEXT_STATE_ID="3" EVENT_ID="535">
<!-- CTRL+RBM_Move -->
<action ID="1003">
<!--AcROTATE -->
</action>
</transition>
<transition NAME="rightButtonRelease" NEXT_STATE_ID="0" EVENT_ID="507">
<!-- RBM_Release ==> SeSCALE -->
<action ID="1100">
<!--AcMODE_DESELECT-->
</action>
<action ID="1009">
<!--AcSCALEEND-->
</action>
</transition>
<transition NAME="rightButtonRelease" NEXT_STATE_ID="0" EVENT_ID="538">
<!-- CTRL+RBM_Release ==> SeSCALE -->
<action ID="1100">
<!--AcMODE_DESELECT-->
</action>
<action ID="1009">
<!--AcSCALEEND-->
</action>
</transition>
</state>
</stateMachine>
<!-- obsolete state machine pattern to be removed in future releases
<stateMachine NAME="drag">
<state NAME="neutral" ID="1" START_STATE="TRUE" X_POS="232" Y_POS="131" WIDTH="100" HEIGHT="50">
<transition NAME="check picked" NEXT_STATE_ID="1" EVENT_ID="1">
<action ID="80" />
</transition>
<transition NAME="continue" NEXT_STATE_ID="1" EVENT_ID="530">
<action ID="90" />
</transition>
<transition NAME="exit" NEXT_STATE_ID="1" EVENT_ID="505">
<action ID="42" />
</transition>
</state>
<state NAME="picked guard" ID="2" X_POS="94" Y_POS="360" WIDTH="100" HEIGHT="50">
<transition NAME="yes" NEXT_STATE_ID="3" EVENT_ID="1004">
<action ID="0" />
</transition>
<transition NAME="no" NEXT_STATE_ID="3" EVENT_ID="1003">
<action ID="0" />
</transition>
</state>
<state NAME="move" ID="3" X_POS="368" Y_POS="289" WIDTH="100" HEIGHT="50">
<transition NAME="continue" NEXT_STATE_ID="3" EVENT_ID="530">
<action ID="90" />
</transition>
<transition NAME="exit" NEXT_STATE_ID="1" EVENT_ID="505">
<action ID="42" />
</transition>
</state>
</stateMachine>
-->
<stateMachine NAME="dragWithCtrl">
<state NAME="neutral" ID="1" START_STATE="TRUE" X_POS="439" Y_POS="166" WIDTH="100" HEIGHT="50">
<transition NAME="check picked" NEXT_STATE_ID="1" EVENT_ID="5">
<action ID="80" />
</transition>
<transition NAME="continue" NEXT_STATE_ID="1" EVENT_ID="534">
<action ID="90" />
</transition>
<transition NAME="exit" NEXT_STATE_ID="1" EVENT_ID="537">
<action ID="42" />
</transition>
<transition NAME="exit" NEXT_STATE_ID="1" EVENT_ID="505">
<action ID="42" />
</transition>
<transition NAME="remove" NEXT_STATE_ID="1" EVENT_ID="12">
<action ID="100">
<!--AcREMOVEPOINT-->
</action>
</transition>
</state>
<!-- not reached so removed!
<state NAME="picked guard" ID="2" X_POS="141" Y_POS="427" WIDTH="100" HEIGHT="50">
<transition NAME="yes" NEXT_STATE_ID="3" EVENT_ID="1004">
<action ID="0" />
</transition>
<transition NAME="no" NEXT_STATE_ID="3" EVENT_ID="1003">
<action ID="0" />
</transition>
</state>
<state NAME="move" ID="3" X_POS="560" Y_POS="381" WIDTH="100" HEIGHT="50">
<transition NAME="continue" NEXT_STATE_ID="3" EVENT_ID="534">
<action ID="90" />
</transition>
<transition NAME="exit" NEXT_STATE_ID="1" EVENT_ID="505">
<action ID="42" />
</transition>
<transition NAME="exit" NEXT_STATE_ID="1" EVENT_ID="537">
<action ID="42" />
</transition>
</state>
-->
</stateMachine>
<stateMachine NAME="focus">
<state NAME="neutral" ID="1" START_STATE="TRUE" X_POS="250" Y_POS="191" WIDTH="100" HEIGHT="50">
<transition NAME="changefocus" NEXT_STATE_ID="1" EVENT_ID="1">
<action ID="0" />
</transition>
</state>
</stateMachine>
<stateMachine NAME="global">
<!-- Behaviour the global statemachine -->
<state NAME="neutral" ID="1" START_STATE="TRUE" X_POS="203" Y_POS="168" WIDTH="100" HEIGHT="50">
<transition NAME="edit objects" NEXT_STATE_ID="2" EVENT_ID="1013" />
<!--EIDEDIT-->
<transition NAME="transmitt to all" NEXT_STATE_ID="1" EVENT_ID="0">
<!--EventId = 0-> all other events not defined here-->
<action ID="1200">
<!--AcINFORMLISTENERS-->
</action>
<action ID="1201">
<!--AcASKINTERACTORS-->
</action>
</transition>
</state>
<state NAME="edit object" ID="2" X_POS="508" Y_POS="404" WIDTH="100" HEIGHT="50">
<transition NAME="ready" NEXT_STATE_ID="1" EVENT_ID="1002" />
<!--EIDFINISHED-->
<transition NAME="transmitt to interactors only" NEXT_STATE_ID="2" EVENT_ID="0">
<action ID="1201">
<!--AcASKINTERACTORS-->
</action>
</transition>
</state>
</stateMachine>
<stateMachine NAME="leftmouse">
<state NAME="neutral" ID="1" START_STATE="TRUE" X_POS="197" Y_POS="164" WIDTH="100" HEIGHT="50">
<transition NAME="send Koordinates" NEXT_STATE_ID="1" EVENT_ID="1" SIDE_EFFECT_ID="80">
<action ID="80" />
</transition>
<transition NAME="send Koordinates Move" NEXT_STATE_ID="1" EVENT_ID="530" SIDE_EFFECT_ID="80">
<action ID="80" />
</transition>
</state>
</stateMachine>
<stateMachine NAME="measureinteractor">
<!-- Behaviour for measuring a length with lines-->
<state NAME="unbuild" ID="0" START_STATE="TRUE" X_POS="167" Y_POS="49" WIDTH="100" HEIGHT="50">
<transition NAME="forceSSD" NEXT_STATE_ID="1" EVENT_ID="3">
<action ID="5">
<!--AcINITNEWOBJECT-->
</action>
<action ID="1550">
<!--AcFORCESUBINTERACTORS-->
</action>
<action ID="1102">
<!--AcMODESUBSELECT-->
</action>
<action ID="2000">
<!--AcTRANSMITEVENT-->
</action>
</transition>
</state>
<state NAME="BuildUpSSD" ID="1" X_POS="433" Y_POS="329" WIDTH="100" HEIGHT="50">
<transition NAME="SubInteractorDeselect" NEXT_STATE_ID="10" EVENT_ID="1020">
<!-- necessary transition of the state subSelected. the event will produced from the hirachical interactor -->
<action ID="1101">
<!--AcMODEDESELECT-->
</action>
</transition>
<transition NAME="reinit" NEXT_STATE_ID="0" EVENT_ID="2">
<action ID="101" />
<action ID="1100">
<!--AcMODEDESELECT-->
</action>
</transition>
</state>
<state NAME="selected" ID="10" X_POS="617" Y_POS="56" WIDTH="100" HEIGHT="50">
<transition NAME="remove" NEXT_STATE_ID="0" EVENT_ID="12">
<action ID="101" />
<action ID="1100">
<!--AcMODEDESELECT-->
</action>
</transition>
<transition NAME="reinit" NEXT_STATE_ID="0" EVENT_ID="2">
<action ID="101" />
<action ID="1100">
<!--AcMODEDESELECT-->
</action>
</transition>
</state>
</stateMachine>
<stateMachine NAME="meshmove">
<state NAME="neutral" ID="1" START_STATE="TRUE" X_POS="193" Y_POS="74" WIDTH="100" HEIGHT="50">
<transition NAME="check picked" NEXT_STATE_ID="2" EVENT_ID="1">
<action ID="30" />
</transition>
</state>
<state NAME="picked guard" ID="2" X_POS="98" Y_POS="296" WIDTH="100" HEIGHT="50">
<transition NAME="yes" NEXT_STATE_ID="3" EVENT_ID="1004">
<action ID="0" />
</transition>
<transition NAME="no" NEXT_STATE_ID="1" EVENT_ID="1003">
<action ID="0" />
</transition>
</state>
<state NAME="move" ID="3" X_POS="467" Y_POS="276" WIDTH="100" HEIGHT="50">
<transition NAME="continue" NEXT_STATE_ID="3" EVENT_ID="530">
<action ID="90" />
</transition>
<transition NAME="exit" NEXT_STATE_ID="1" EVENT_ID="505">
<action ID="666" />
</transition>
</state>
</stateMachine>
<stateMachine NAME="navigation">
<state NAME="neutral" ID="1" START_STATE="TRUE" X_POS="189" Y_POS="175" WIDTH="100" HEIGHT="50">
<transition NAME="send Koordinates press" NEXT_STATE_ID="1" EVENT_ID="1">
<action ID="92" />
</transition>
<transition NAME="send Koordinates move" NEXT_STATE_ID="1" EVENT_ID="530">
<action ID="92" />
</transition>
<transition NAME="send Koordinates release" NEXT_STATE_ID="1" EVENT_ID="505">
<action ID="42" />
</transition>
</state>
</stateMachine>
<stateMachine NAME="PositionTracker">
<state NAME="neutral" ID="1" START_STATE="TRUE" X_POS="212" Y_POS="188" WIDTH="100" HEIGHT="50">
<transition NAME="Mouse Move" EVENT_ID="520" NEXT_STATE_ID="1">
<action ID="92">
<!--AcMove-->
</action>
</transition>
</state>
</stateMachine>
<stateMachine NAME="picking">
<state NAME="neutral" ID="1" START_STATE="TRUE" X_POS="264" Y_POS="239" WIDTH="100" HEIGHT="50">
<transition NAME="do picking" NEXT_STATE_ID="1" EVENT_ID="3">
<action ID="1003" />
</transition>
</state>
</stateMachine>
<stateMachine NAME="PressMoveRelease">
<state NAME="neutral" ID="1" START_STATE="TRUE" X_POS="197" Y_POS="183" WIDTH="100" HEIGHT="50">
<transition NAME="send Koordinates press" NEXT_STATE_ID="1" EVENT_ID="1">
<action ID="80" />
</transition>
<transition NAME="send Koordinates move" NEXT_STATE_ID="1" EVENT_ID="530">
<action ID="90" />
</transition>
<transition NAME="send Koordinates release" NEXT_STATE_ID="1" EVENT_ID="505">
<action ID="42" />
</transition>
</state>
</stateMachine>
<stateMachine NAME="PressMoveReleaseAndPointSetting">
<state NAME="neutral" ID="1" START_STATE="TRUE">
<transition NAME="press" NEXT_STATE_ID="1" EVENT_ID="1">
<action ID="80" />
</transition>
<transition NAME="Shift+press" NEXT_STATE_ID="1" EVENT_ID="3">
<action ID="10" />
</transition>
<transition NAME="move" NEXT_STATE_ID="1" EVENT_ID="530">
<action ID="90" />
</transition>
<transition NAME="release" NEXT_STATE_ID="1" EVENT_ID="505">
<action ID="42" />
</transition>
<transition NAME="ENTF" NEXT_STATE_ID="1" EVENT_ID="12">
<action ID="100" />
</transition>
</state>
</stateMachine>
<stateMachine NAME="PressMoveReleaseWithCTRLInversionAllMouseMoves">
<state NAME="neutral" ID="1" START_STATE="TRUE">
<transition NAME="press" NEXT_STATE_ID="1" EVENT_ID="1">
<action ID="80" />
</transition>
<transition NAME="CTRL+press" NEXT_STATE_ID="2" EVENT_ID="5">
<action ID="80" />
<action ID="49014" />
</transition>
<transition NAME="move w/ left button" NEXT_STATE_ID="1" EVENT_ID="530">
<action ID="90" />
</transition>
<transition NAME="move" NEXT_STATE_ID="1" EVENT_ID="520">
<action ID="90" />
</transition>
<transition NAME="CTRL+move" NEXT_STATE_ID="2" EVENT_ID="534">
<action ID="90" />
<action ID="49014" />
</transition>
<transition NAME="release" NEXT_STATE_ID="1" EVENT_ID="505">
<action ID="42" />
</transition>
<transition NAME="CTRL+release" NEXT_STATE_ID="1" EVENT_ID="537">
<action ID="49014" />
<action ID="42" />
<action ID="49014" />
</transition>
</state>
<state NAME="inverted" ID="2">
<transition NAME="CTRL+move" NEXT_STATE_ID="2" EVENT_ID="534">
<action ID="90" />
</transition>
<transition NAME="move w/o left button" NEXT_STATE_ID="1" EVENT_ID="520">
<action ID="90" />
<action ID="49014" />
</transition>
<transition NAME="move" NEXT_STATE_ID="1" EVENT_ID="530">
<action ID="90" />
<action ID="49014" />
</transition>
<transition NAME="CTRL+release" NEXT_STATE_ID="1" EVENT_ID="537">
<action ID="42" />
<action ID="49014" />
</transition>
<transition NAME="release" NEXT_STATE_ID="1" EVENT_ID="505">
<action ID="42" />
<action ID="49014" />
</transition>
</state>
</stateMachine>
<stateMachine NAME="PressMoveReleaseWithCTRLInversion">
<state NAME="neutral" ID="1" START_STATE="TRUE">
<transition NAME="press" NEXT_STATE_ID="1" EVENT_ID="1">
<action ID="80" />
</transition>
<transition NAME="CTRL+press" NEXT_STATE_ID="2" EVENT_ID="5">
<action ID="80" />
<action ID="49014" />
</transition>
<transition NAME="move w/ left button" NEXT_STATE_ID="1" EVENT_ID="530">
<action ID="90" />
</transition>
<transition NAME="CTRL+move" NEXT_STATE_ID="2" EVENT_ID="534">
<action ID="90" />
<action ID="49014" />
</transition>
<transition NAME="release" NEXT_STATE_ID="1" EVENT_ID="505">
<action ID="42" />
</transition>
<transition NAME="CTRL+release" NEXT_STATE_ID="1" EVENT_ID="537">
<action ID="49014" />
<action ID="42" />
<action ID="49014" />
</transition>
</state>
<state NAME="inverted" ID="2">
<transition NAME="CTRL+move" NEXT_STATE_ID="2" EVENT_ID="534">
<action ID="90" />
</transition>
<transition NAME="move" NEXT_STATE_ID="1" EVENT_ID="530">
<action ID="90" />
<action ID="49014" />
</transition>
<transition NAME="CTRL+release" NEXT_STATE_ID="1" EVENT_ID="537">
<action ID="42" />
<action ID="49014" />
</transition>
<transition NAME="release" NEXT_STATE_ID="1" EVENT_ID="505">
<action ID="42" />
<action ID="49014" />
</transition>
</state>
</stateMachine>
<stateMachine NAME="seedroi">
<state NAME="neutral" ID="1" START_STATE="TRUE" X_POS="381" Y_POS="315" WIDTH="100" HEIGHT="50">
<transition NAME="send Koordinates" NEXT_STATE_ID="1" EVENT_ID="3">
<action ID="80" />
</transition>
</state>
</stateMachine>
<stateMachine NAME="seedsinteractor">
<!-- Behaviour of Seed Points -->
<state NAME="drawSeeds" ID="0" START_STATE="TRUE" X_POS="125" Y_POS="102" WIDTH="100" HEIGHT="50">
<transition NAME="drawForegroundSeed" NEXT_STATE_ID="1" EVENT_ID="3">
<action ID="1101">
<!--AcMODE_SELECT-->
</action>
<action ID="45">
<!--AcINITFOREGROUND-->
</action>
<action ID="11">
<!--AcADD-->
</action>
</transition>
<transition NAME="drawBackgroundSeed" NEXT_STATE_ID="2" EVENT_ID="2000">
<action ID="1101">
<!--AcMODE_SELECT-->
</action>
<action ID="46">
<!--AcINITBACKGROUND-->
</action>
<action ID="11">
<!--AcADD-->
</action>
</transition>
<transition NAME="drawNeutralSeed" NEXT_STATE_ID="3" EVENT_ID="2003">
<action ID="1101">
<!--AcMODE_SELECT-->
</action>
<action ID="47">
<!--AcINITNEUTRAL-->
</action>
<action ID="11">
<!--AcADD-->
</action>
</transition>
</state>
<state NAME="drawForeground" ID="1" X_POS="515" Y_POS="108" WIDTH="100" HEIGHT="50">
<transition NAME="drawForegroundSeeds" NEXT_STATE_ID="1" EVENT_ID="541">
<action ID="92">
<!--AcMOVE-->
</action>
</transition>
<transition NAME="drawSeeds" NEXT_STATE_ID="0" EVENT_ID="508">
<action ID="44">
<!--AcFINISH-->
</action>
<action ID="1100">
<!--AcMODE_DESELECT-->
</action>
</transition>
</state>
<state NAME="drawBackground" ID="2" X_POS="510" Y_POS="323" WIDTH="100" HEIGHT="50">
<transition NAME="drawBackgroundSeeds" NEXT_STATE_ID="2" EVENT_ID="2001">
<action ID="92">
<!--AcMOVE-->
</action>
</transition>
<transition NAME="drawSeeds" NEXT_STATE_ID="0" EVENT_ID="2002">
<action ID="44">
<!--AcFINISH-->
</action>
<action ID="1100">
<!--AcMODE_DESELECT-->
</action>
</transition>
</state>
<state NAME="drawNeutral" ID="3" X_POS="290" Y_POS="478" WIDTH="100" HEIGHT="50">
<transition NAME="drawNeutralSeeds" NEXT_STATE_ID="3" EVENT_ID="2004">
<action ID="92">
<!--AcMOVE-->
</action>
</transition>
<transition NAME="drawSeeds" NEXT_STATE_ID="0" EVENT_ID="2005">
<action ID="44">
<!--AcFINISH-->
</action>
<action ID="1100">
<!--AcMODE_DESELECT-->
</action>
</transition>
</state>
</stateMachine>
<stateMachine NAME="vesseltreeinteraction">
<state NAME="neutral" ID="1" START_STATE="TRUE" X_POS="268" Y_POS="260" WIDTH="100" HEIGHT="50">
<transition NAME="do picking" NEXT_STATE_ID="1" EVENT_ID="5">
<action ID="1600" />
</transition>
<transition NAME="do picking" NEXT_STATE_ID="1" EVENT_ID="8">
<action ID="1600" />
</transition>
</state>
</stateMachine>
<stateMachine NAME="YetAnotherVesselTreeInteractor">
<!-- state machine for vessel TREE interaction -->
<state NAME="no-vessel-picked" ID="0" START_STATE="TRUE" X_POS="282" Y_POS="146" WIDTH="100" HEIGHT="50">
<transition NAME="checkpicked" NEXT_STATE_ID="1" EVENT_ID="5">
<action ID="30">
<!--AcCHECKELEMENT-->
</action>
</transition>
<transition NAME="checkpicked" NEXT_STATE_ID="1" EVENT_ID="8">
<action ID="30">
<!--AcCHECKELEMENT-->
</action>
</transition>
</state>
<state NAME="check-guard" ID="1" X_POS="91" Y_POS="347" WIDTH="100" HEIGHT="50">
<transition NAME="check-successful" NEXT_STATE_ID="2" EVENT_ID="1004">
<action ID="65">
<!--AcSELECT-->
</action>
</transition>
<transition NAME="check-not-successful" NEXT_STATE_ID="0" EVENT_ID="1003">
<action ID="75">
<!--AcDESELECT-->
</action>
</transition>
</state>
<state NAME="vessel-picked" ID="2" X_POS="419" Y_POS="340" WIDTH="100" HEIGHT="50">
<transition NAME="checkpicked" NEXT_STATE_ID="1" EVENT_ID="5">
<action ID="30">
<!--AcCHECKELEMENT-->
</action>
</transition>
<transition NAME="checkpicked" NEXT_STATE_ID="1" EVENT_ID="8">
<action ID="30">
<!--AcCHECKELEMENT-->
</action>
</transition>
</state>
</stateMachine>
<!-- state machine for vessel TREE interaction with multiple selection -->
<stateMachine NAME="YetAnotherVesselTreeInteractorMultipleSelection">
<state NAME="no-vessel-picked" ID="0" START_STATE="TRUE" X_POS="282" Y_POS="146" WIDTH="100" HEIGHT="50">
<transition NAME="checkpicked" NEXT_STATE_ID="1" EVENT_ID="5">
<action ID="30">
<!--AcCHECKELEMENT-->
</action>
</transition>
<transition NAME="checkpicked" NEXT_STATE_ID="1" EVENT_ID="8">
<action ID="30">
<!--AcCHECKELEMENT-->
</action>
</transition>
</state>
<state NAME="CheckPicked-GuardState" ID="1" X_POS="91" Y_POS="347" WIDTH="100" HEIGHT="50">
<transition NAME="picked-vessel" NEXT_STATE_ID="2" EVENT_ID="1004">
<action ID="65">
<!--AcSELECT-->
</action>
</transition>
<transition NAME="no-vessel-picked" NEXT_STATE_ID="0" EVENT_ID="1003">
<action ID="75">
<!--AcDESELECT-->
</action>
</transition>
</state>
<state NAME="vessel-selected" ID="2" X_POS="419" Y_POS="340" WIDTH="100" HEIGHT="50">
<transition NAME="checkpicked" NEXT_STATE_ID="3" EVENT_ID="5">
<action ID="30">
<!--AcCHECKELEMENT-->
</action>
</transition>
<transition NAME="checkpicked" NEXT_STATE_ID="1" EVENT_ID="8">
<action ID="30">
<!--AcCHECKELEMENT-->
</action>
</transition>
</state>
<state NAME="guard-add-vessel2selection" ID="3" X_POS="419" Y_POS="340" WIDTH="100" HEIGHT="50">
<transition NAME="vessel-picked" NEXT_STATE_ID="2" EVENT_ID="1004">
<action ID="61">
<!--AcSELECTANOTHEROBJECT-->
</action>
</transition>
<transition NAME="no-vessel-picked" NEXT_STATE_ID="2" EVENT_ID="1003" />
</state>
</stateMachine>
<stateMachine NAME="AriadneAssistent">
<!-- Behaviour of the AriadneAssistent -->
<state NAME="start" ID="1" START_STATE="TRUE" X_POS="500" Y_POS="530" WIDTH="100" HEIGHT="50">
<transition NAME="EV_INIT" NEXT_STATE_ID="2" EVENT_ID="5551001">
<action ID="55500010">
<!--AC_INIT-->
</action>
</transition>
</state>
<state NAME="chooseApplication" ID="2" X_POS="616" Y_POS="351" WIDTH="100" HEIGHT="50">
<transition NAME="EV_PATH_COLLECTION_SELECTED" NEXT_STATE_ID="3" EVENT_ID="5551003">
<action ID="5550001">
<!--AC_SET_NEXT_BUTTON_VISIBLE-->
</action>
</transition>
<transition NAME="EV_NAVIGATION_SELECTED" NEXT_STATE_ID="40" EVENT_ID="5551004">
<action ID="5550001">
<!--AC_SET_NEXT_BUTTON_VISIBLE-->
</action>
</transition>
</state>
<state NAME="choosePathCollection" ID="3" X_POS="657" Y_POS="23" WIDTH="126" HEIGHT="50">
<transition NAME="EV_NEXT" NEXT_STATE_ID="4" EVENT_ID="5551007">
<action ID="5550003">
<!--AC_SET_PREVIOUS_BUTTON_VISIBLE-->
</action>
<action ID="5550002">
<!--AC_SET_NEXT_BUTTON_INVISIBLE-->
</action>
<action ID="5550005">
<!--AC_SET_ASSISTAND_WIDGET_STECK-->
<intParameter NAME="WIDGET_ID" VALUE="1" />
</action>
</transition>
<transition NAME="EV_NAVIGATION_SELECTED" NEXT_STATE_ID="40" EVENT_ID="5551004" />
<transition NAME="EV_INIT" NEXT_STATE_ID="2" EVENT_ID="5551001">
<action ID="55500010">
<!--AC_INIT-->
</action>
</transition>
</state>
<state NAME="mountSensorForPathCollection" ID="4" X_POS="331" Y_POS="11" WIDTH="167" HEIGHT="50">
<transition NAME="EV_DONE" NEXT_STATE_ID="5" EVENT_ID="5551008">
<action ID="5550001">
<!--AC_SET_NEXT_BUTTON_VISIBLE-->
</action>
</transition>
<transition NAME="EV_PREVIOUS" NEXT_STATE_ID="2" EVENT_ID="5551002">
<action ID="5550004">
<!--AC_SET_PREVIOUS_BUTTON_INVISIBLE-->
</action>
<action ID="5550001">
<!--AC_SET_NEXT_BUTTON_VISIBLE-->
</action>
<action ID="55500011">
<!--AC_SET_APPLICATION_SELECTED_FALSE-->
</action>
<action ID="5550005">
<!--AC_SET_ASSISTAND_WIDGET_STECK-->
<intParameter NAME="WIDGET_ID" VALUE="0" />
</action>
</transition>
<transition NAME="EV_INIT" NEXT_STATE_ID="2" EVENT_ID="5551001">
<action ID="55500010">
<!--AC_INIT-->
</action>
</transition>
</state>
<state NAME="sensorMountedForPathCollection" ID="5" X_POS="7" Y_POS="26" WIDTH="191" HEIGHT="50">
<transition NAME="EV_NEXT" NEXT_STATE_ID="7" EVENT_ID="5551007">
<action ID="5550002">
<!--AC_SET_NEXT_BUTTON_INVISIBLE-->
</action>
<action ID="55500012">
<!--AC_SENSOR_ATTACHED-->
</action>
<action ID="5550005">
<!--AC_SET_ASSISTAND_WIDGET_STECK-->
<intParameter NAME="WIDGET_ID" VALUE="2" />
</action>
<action ID="5550008">
<!--AC_CHECK_LANDMARK_COUNT-->
<intParameter NAME="MIN_COUNT" VALUE="3" />
</action>
</transition>
<transition NAME="EV_PREVIOUS" NEXT_STATE_ID="4" EVENT_ID="5551002">
<action ID="5550009">
<!--AC_SET_DONE_FALSE-->
</action>
<action ID="5550002">
<!--AC_SET_NEXT_BUTTON_INVISIBLE-->
</action>
</transition>
<transition NAME="EV_INIT" NEXT_STATE_ID="2" EVENT_ID="5551001">
<action ID="55500010">
<!--AC_INIT-->
</action>
</transition>
</state>
<state NAME="setLandmarks" ID="6" X_POS="229" Y_POS="369" WIDTH="100" HEIGHT="50">
<transition NAME="EV_NEW_LANDMARK" NEXT_STATE_ID="7" EVENT_ID="5551009">
<action ID="5550008">
<!--AC_CHECK_LANDMARK_COUNT-->
<intParameter NAME="MIN_COUNT" VALUE="3" />
</action>
</transition>
<transition NAME="EV_PREVIOUS" NEXT_STATE_ID="4" EVENT_ID="5551002">
<action ID="5550005">
<!--AC_SET_ASSISTAND_WIDGET_STECK-->
<intParameter NAME="WIDGET_ID" VALUE="1" />
</action>
<action ID="5550009">
<!--AC_SET_DONE_FALSE-->
</action>
</transition>
<transition NAME="EV_INIT" NEXT_STATE_ID="2" EVENT_ID="5551001">
<action ID="55500010">
<!--AC_INIT-->
</action>
</transition>
</state>
<state NAME="checkCount" ID="7" X_POS="-5" Y_POS="255" WIDTH="100" HEIGHT="50">
<transition NAME="EV_READY_FOR_COLLECTING_PATH" NEXT_STATE_ID="8" EVENT_ID="5551006">
<action ID="5550001">
<!--AC_SET_NEXT_BUTTON_VISIBLE-->
</action>
</transition>
<transition NAME="EV_LESS_THEN_MIN_COUNT" NEXT_STATE_ID="6" EVENT_ID="5551005" />
<transition NAME="EV_INIT" NEXT_STATE_ID="2" EVENT_ID="5551001">
<action ID="55500010">
<!--AC_INIT-->
</action>
</transition>
</state>
<state NAME="readyForCollectingPath" ID="8" X_POS="-5" Y_POS="462" WIDTH="146" HEIGHT="50">
<transition NAME="EV_NEXT" NEXT_STATE_ID="9" EVENT_ID="5551007">
<action ID="5550005">
<!--AC_SET_ASSISTAND_WIDGET_STECK-->
<intParameter NAME="WIDGET_ID" VALUE="4" />
</action>
<action ID="55500014">
<!--AC_START_APPLICATION_TEXT-->
<stringParameter NAME="START_APPLICATION_TEXT" VALUE="Ariadne is now ready for path collection" />
</action>
<action ID="5550007">
<!--AC_SET_NEXT_BUTTON_TEXT-->
<stringParameter NAME="BUTTON_TEXT" VALUE="Start" />
</action>
</transition>
<transition NAME="EV_PREVIOUS" NEXT_STATE_ID="4" EVENT_ID="5551002">
<action ID="5550005">
<!--AC_SET_ASSISTAND_WIDGET_STECK-->
<intParameter NAME="WIDGET_ID" VALUE="1" />
</action>
<action ID="5550002">
<!--AC_SET_NEXT_BUTTON_INVISIBLE-->
</action>
<action ID="5550009">
<!--AC_SET_DONE_FALSE-->
</action>
</transition>
<transition NAME="EV_REMOVE_LANDMARK" NEXT_STATE_ID="7" EVENT_ID="5551010">
<action ID="5550002">
<!--AC_SET_NEXT_BUTTON_INVISIBLE-->
</action>
<action ID="5550007">
<!--AC_SET_NEXT_BUTTON_TEXT-->
<stringParameter NAME="BUTTON_TEXT" VALUE="&gt;" />
</action>
<action ID="5550008">
<!--AC_CHECK_LANDMARK_COUNT-->
<intParameter NAME="MIN_COUNT" VALUE="3" />
</action>
</transition>
<transition NAME="EV_INIT" NEXT_STATE_ID="2" EVENT_ID="5551001">
<action ID="55500010">
<!--AC_INIT-->
</action>
</transition>
</state>
<state NAME="collectingPath" ID="9" X_POS="30" Y_POS="607" WIDTH="100" HEIGHT="50">
<transition NAME="EV_NEXT" NEXT_STATE_ID="2" EVENT_ID="5551007">
<action ID="55500013">
<!--AC_CLOSE_ASSISTENT-->
</action>
<action ID="55500011">
<!--AC_SET_APPLICATION_SELECTED_FALSE-->
</action>
<action ID="5550002">
<!--AC_SET_NEXT_BUTTON_INVISIBLE-->
</action>
<action ID="5550004">
<!--AC_SET_PREVIOUS_BUTTON_INVISIBLE-->
</action>
<action ID="55500016">
<!--AC_START_PATHCOLLECTION-->
</action>
<action ID="5550005">
<!--AC_SET_ASSISTAND_WIDGET_STECK-->
<intParameter NAME="WIDGET_ID" VALUE="0" />
</action>
<action ID="5550007">
<!--AC_SET_NEXT_BUTTON_TEXT-->
<stringParameter NAME="BUTTON_TEXT" VALUE="&gt;" />
</action>
</transition>
<transition NAME="EV_PREVIOUS" NEXT_STATE_ID="8" EVENT_ID="5551002">
<action ID="5550005">
<!--AC_SET_ASSISTAND_WIDGET_STECK-->
<intParameter NAME="WIDGET_ID" VALUE="2" />
</action>
<action ID="5550007">
<!--AC_SET_NEXT_BUTTON_TEXT-->
<stringParameter NAME="BUTTON_TEXT" VALUE="&gt;" />
</action>
</transition>
<transition NAME="EV_INIT" NEXT_STATE_ID="2" EVENT_ID="5551001">
<action ID="55500010">
<!--AC_INIT-->
</action>
<action ID="5550007">
<!--AC_SET_NEXT_BUTTON_TEXT-->
<stringParameter NAME="BUTTON_TEXT" VALUE="&gt;" />
</action>
</transition>
</state>
<state NAME="chooseNavigation" ID="40" X_POS="1080" Y_POS="38" WIDTH="100" HEIGHT="50">
<transition NAME="EV_PATH_COLLECTION_SELECTED" NEXT_STATE_ID="3" EVENT_ID="5551003" />
<transition NAME="EV_INIT" NEXT_STATE_ID="2" EVENT_ID="5551001">
<action ID="55500010">
<!--AC_INIT-->
</action>
</transition>
<transition NAME="EV_NEXT" NEXT_STATE_ID="41" EVENT_ID="5551007">
<action ID="5550003">
<!--AC_SET_PREVIOUS_BUTTON_VISIBLE-->
</action>
<action ID="5550002">
<!--AC_SET_NEXT_BUTTON_INVISIBLE-->
</action>
<action ID="5550005">
<!--AC_SET_ASSISTAND_WIDGET_STECK-->
<intParameter NAME="WIDGET_ID" VALUE="3" />
</action>
</transition>
<transition NAME="EV_INIT" NEXT_STATE_ID="2" EVENT_ID="5551001">
<action ID="55500010">
<!--AC_INIT-->
</action>
</transition>
</state>
<state NAME="chooseData" ID="41" X_POS="1100" Y_POS="199" WIDTH="100" HEIGHT="50">
<transition NAME="EV_DONE" NEXT_STATE_ID="42" EVENT_ID="5551008">
<action ID="5550001">
<!--AC_SET_NEXT_BUTTON_VISIBLE-->
</action>
</transition>
<transition NAME="EV_PREVIOUS" NEXT_STATE_ID="2" EVENT_ID="5551002">
<action ID="5550004">
<!--AC_SET_PREVIOUS_BUTTON_INVISIBLE-->
</action>
<action ID="5550001">
<!--AC_SET_NEXT_BUTTON_VISIBLE-->
</action>
<action ID="55500011">
<!--AC_SET_APPLICATION_SELECTED_FALSE-->
</action>
<action ID="5550005">
<!--AC_SET_ASSISTAND_WIDGET_STECK-->
<intParameter NAME="WIDGET_ID" VALUE="0" />
</action>
</transition>
<transition NAME="EV_INIT" NEXT_STATE_ID="2" EVENT_ID="5551001">
<action ID="55500010">
<!--AC_INIT-->
</action>
</transition>
</state>
<state NAME="dataChoosed" ID="42" X_POS="1111" Y_POS="353" WIDTH="100" HEIGHT="50">
<transition NAME="EV_NEXT" NEXT_STATE_ID="43" EVENT_ID="5551007">
<action ID="55500017">
<!--AC_LOAD_LANDMARKS-->
</action>
<action ID="5550002">
<!--AC_SET_NEXT_BUTTON_INVISIBLE-->
</action>
<action ID="5550005">
<!--AC_SET_ASSISTAND_WIDGET_STECK-->
<intParameter NAME="WIDGET_ID" VALUE="1" />
</action>
</transition>
<transition NAME="EV_PREVIOUS" NEXT_STATE_ID="2" EVENT_ID="5551002">
<action ID="5550004">
<!--AC_SET_PREVIOUS_BUTTON_INVISIBLE-->
</action>
<action ID="5550001">
<!--AC_SET_NEXT_BUTTON_VISIBLE-->
</action>
<action ID="55500011">
<!--AC_SET_APPLICATION_SELECTED_FALSE-->
</action>
<action ID="5550005">
<!--AC_SET_ASSISTAND_WIDGET_STECK-->
<intParameter NAME="WIDGET_ID" VALUE="0" />
</action>
</transition>
<transition NAME="EV_INIT" NEXT_STATE_ID="2" EVENT_ID="5551001">
<action ID="55500010">
<!--AC_INIT-->
</action>
</transition>
</state>
<state NAME="mountSensorForNavigation" ID="43" X_POS="1059" Y_POS="473" WIDTH="144" HEIGHT="50">
<transition NAME="EV_DONE" NEXT_STATE_ID="44" EVENT_ID="5551008">
<action ID="5550001">
<!--AC_SET_NEXT_BUTTON_VISIBLE-->
</action>
</transition>
<transition NAME="EV_PREVIOUS" NEXT_STATE_ID="42" EVENT_ID="5551002">
<action ID="5550001">
<!--AC_SET_NEXT_BUTTON_VISIBLE-->
</action>
<action ID="5550005">
<!--AC_SET_ASSISTAND_WIDGET_STECK-->
<intParameter NAME="WIDGET_ID" VALUE="3" />
</action>
</transition>
<transition NAME="EV_INIT" NEXT_STATE_ID="2" EVENT_ID="5551001">
<action ID="55500010">
<!--AC_INIT-->
</action>
</transition>
</state>
<state NAME="sensorMountedForNavigation" ID="44" X_POS="844" Y_POS="613" WIDTH="100" HEIGHT="50">
<transition NAME="EV_NEXT" NEXT_STATE_ID="46" EVENT_ID="5551007">
<action ID="5550002">
<!--AC_SET_NEXT_BUTTON_INVISIBLE-->
</action>
<action ID="55500012">
<!--AC_SENSOR_ATTACHED-->
</action>
<action ID="5550005">
<!--AC_SET_ASSISTAND_WIDGET_STECK-->
<intParameter NAME="WIDGET_ID" VALUE="2" />
</action>
<action ID="5550008">
<!--AC_CHECK_LANDMARK_COUNT-->
<intParameter NAME="MIN_COUNT" VALUE="3" />
</action>
</transition>
<transition NAME="EV_PREVIOUS" NEXT_STATE_ID="43" EVENT_ID="5551002">
<action ID="5550009">
<!--AC_SET_DONE_FALSE-->
</action>
<action ID="5550002">
<!--AC_SET_NEXT_BUTTON_INVISIBLE-->
</action>
</transition>
<transition NAME="EV_INIT" NEXT_STATE_ID="2" EVENT_ID="5551001">
<action ID="55500010">
<!--AC_INIT-->
</action>
</transition>
</state>
<state NAME="setLandmarks" ID="45" X_POS="1110" Y_POS="754" WIDTH="100" HEIGHT="50">
<transition NAME="EV_NEW_LANDMARK" NEXT_STATE_ID="46" EVENT_ID="5551009">
<action ID="5550008">
<!--AC_CHECK_LANDMARK_COUNT-->
<intParameter NAME="MIN_COUNT" VALUE="3" />
</action>
</transition>
<transition NAME="EV_PREVIOUS" NEXT_STATE_ID="43" EVENT_ID="5551002">
<action ID="5550005">
<!--AC_SET_ASSISTAND_WIDGET_STECK-->
<intParameter NAME="WIDGET_ID" VALUE="3" />
</action>
<action ID="5550009">
<!--AC_SET_DONE_FALSE-->
</action>
</transition>
<transition NAME="EV_INIT" NEXT_STATE_ID="2" EVENT_ID="5551001">
<action ID="55500010">
<!--AC_INIT-->
</action>
</transition>
</state>
<state NAME="checkCount" ID="46" X_POS="615" Y_POS="748" WIDTH="100" HEIGHT="50">
<transition NAME="EV_READY_FOR_COLLECTING_PATH" NEXT_STATE_ID="47" EVENT_ID="5551006">
<action ID="5550001">
<!--AC_SET_NEXT_BUTTON_VISIBLE-->
</action>
</transition>
<transition NAME="EV_LESS_THEN_MIN_COUNT" NEXT_STATE_ID="45" EVENT_ID="5551005" />
<transition NAME="EV_INIT" NEXT_STATE_ID="2" EVENT_ID="5551001">
<action ID="55500010">
<!--AC_INIT-->
</action>
</transition>
</state>
<state NAME="readyForNavigation" ID="47" X_POS="120" Y_POS="750" WIDTH="115" HEIGHT="50">
<transition NAME="EV_NEXT" NEXT_STATE_ID="48" EVENT_ID="5551007">
<action ID="55500018">
<!--AC_CALCULATE_LANDMARK_TRANSFORM-->
</action>
<action ID="5550005">
<!--AC_SET_ASSISTAND_WIDGET_STECK-->
<intParameter NAME="WIDGET_ID" VALUE="4" />
</action>
<action ID="55500014">
<!--AC_START_APPLICATION_TEXT-->
<stringParameter NAME="START_APPLICATION_TEXT" VALUE="Ariadne is now ready for navigation" />
</action>
<action ID="5550007">
<!--AC_SET_NEXT_BUTTON_TEXT-->
<stringParameter NAME="BUTTON_TEXT" VALUE="Start" />
</action>
</transition>
<transition NAME="EV_PREVIOUS" NEXT_STATE_ID="43" EVENT_ID="5551002">
<action ID="5550005">
<!--AC_SET_ASSISTAND_WIDGET_STECK-->
<intParameter NAME="WIDGET_ID" VALUE="3" />
</action>
<action ID="5550002">
<!--AC_SET_NEXT_BUTTON_INVISIBLE-->
</action>
<action ID="5550009">
<!--AC_SET_DONE_FALSE-->
</action>
</transition>
<transition NAME="EV_REMOVE_LANDMARK" NEXT_STATE_ID="46" EVENT_ID="5551010">
<action ID="5550002">
<!--AC_SET_NEXT_BUTTON_INVISIBLE-->
</action>
<action ID="5550007">
<!--AC_SET_NEXT_BUTTON_TEXT-->
<stringParameter NAME="BUTTON_TEXT" VALUE="&gt;" />
</action>
<action ID="5550008">
<!--AC_CHECK_LANDMARK_COUNT-->
<intParameter NAME="MIN_COUNT" VALUE="3" />
</action>
</transition>
<transition NAME="EV_INIT" NEXT_STATE_ID="2" EVENT_ID="5551001">
<action ID="55500010">
<!--AC_INIT-->
</action>
</transition>
</state>
<state NAME="Navigation" ID="48" X_POS="164" Y_POS="623" WIDTH="100" HEIGHT="50">
<transition NAME="EV_NEXT" NEXT_STATE_ID="2" EVENT_ID="5551007">
<action ID="55500013">
<!--AC_CLOSE_ASSISTENT-->
</action>
<action ID="55500011">
<!--AC_SET_APPLICATION_SELECTED_FALSE-->
</action>
<action ID="5550002">
<!--AC_SET_NEXT_BUTTON_INVISIBLE-->
</action>
<action ID="5550004">
<!--AC_SET_PREVIOUS_BUTTON_INVISIBLE-->
</action>
<action ID="55500015">
<!--AC_START_NAVIGATION-->
</action>
<action ID="5550005">
<!--AC_SET_ASSISTAND_WIDGET_STECK-->
<intParameter NAME="WIDGET_ID" VALUE="0" />
</action>
<action ID="5550007">
<!--AC_SET_NEXT_BUTTON_TEXT-->
<stringParameter NAME="BUTTON_TEXT" VALUE="&gt;" />
</action>
</transition>
<transition NAME="EV_PREVIOUS" NEXT_STATE_ID="47" EVENT_ID="5551002">
<action ID="5550005">
<!--AC_SET_ASSISTAND_WIDGET_STECK-->
<intParameter NAME="WIDGET_ID" VALUE="2" />
</action>
<action ID="5550007">
<!--AC_SET_NEXT_BUTTON_TEXT-->
<stringParameter NAME="BUTTON_TEXT" VALUE="&gt;" />
</action>
</transition>
<transition NAME="EV_INIT" NEXT_STATE_ID="2" EVENT_ID="5551001">
<action ID="55500010">
<!--AC_INIT-->
</action>
<action ID="5550007">
<!--AC_SET_NEXT_BUTTON_TEXT-->
<stringParameter NAME="BUTTON_TEXT" VALUE="&gt;" />
</action>
</transition>
</state>
</stateMachine>
<stateMachine NAME="AffineInteractions ctrl-drag_marcus">
<state NAME="start" ID="0" START_STATE="TRUE" X_POS="314" Y_POS="214" WIDTH="100" HEIGHT="50">
<transition NAME="leftButtonPress" NEXT_STATE_ID="12" EVENT_ID="1">
<!-- 30 = SeCHECKELEMENT -->
<action ID="30" />
</transition>
<transition NAME="rightButtonPress" NEXT_STATE_ID="13" EVENT_ID="2">
<!-- 1002 = SeSCALESTART -->
<action ID="30" />
</transition>
<transition NAME="middleButtonPress" NEXT_STATE_ID="14" EVENT_ID="4">
<!-- 1004 = SeROTATESTART -->
<action ID="30" />
</transition>
</state>
<state NAME="picked guard Translate" ID="12" X_POS="52" Y_POS="62" WIDTH="143" HEIGHT="50">
<transition NAME="yes" NEXT_STATE_ID="2" EVENT_ID="1004">
<!-- EIDYES -->
<action ID="1000" />
</transition>
<transition NAME="no" NEXT_STATE_ID="0" EVENT_ID="1003">
<!-- StNO -->
<action ID="0" />
</transition>
</state>
<state NAME="picked guard Scale" ID="13" X_POS="848" Y_POS="233" WIDTH="100" HEIGHT="50">
<transition NAME="yes" NEXT_STATE_ID="3" EVENT_ID="1004">
<!-- EIDYES -->
<action ID="1002" />
</transition>
<transition NAME="no" NEXT_STATE_ID="0" EVENT_ID="1003">
<!-- StNO -->
<action ID="0" />
</transition>
</state>
<state NAME="picked guard Rotate" ID="14" X_POS="37" Y_POS="334" WIDTH="100" HEIGHT="50">
<transition NAME="yes" NEXT_STATE_ID="4" EVENT_ID="1004">
<!-- EIDYES -->
<action ID="1004" />
</transition>
<transition NAME="no" NEXT_STATE_ID="0" EVENT_ID="1003">
<!-- StNO -->
<action ID="0" />
</transition>
</state>
<state NAME="translating" ID="2" X_POS="481" Y_POS="47" WIDTH="100" HEIGHT="50">
<transition NAME="leftButtonMove" NEXT_STATE_ID="2" EVENT_ID="530">
<!-- 1000 = SeTRANSLATE -->
<action ID="1001" />
</transition>
<transition NAME="leftButtonRelease" NEXT_STATE_ID="0" EVENT_ID="505">
<!-- 1000 = SeTRANSLATE -->
<action ID="1001" />
</transition>
<transition NAME="leftButtonRelease" NEXT_STATE_ID="0" EVENT_ID="537">
<!-- CTRL+LBM_Release ==> SeTRANSLATE -->
<action ID="1001" />
</transition>
</state>
<state NAME="scaling" ID="3" X_POS="630" Y_POS="461" WIDTH="100" HEIGHT="50">
<transition NAME="rightButtonMove" NEXT_STATE_ID="3" EVENT_ID="531">
<!-- 1003 = SeSCALE -->
<action ID="1003" />
</transition>
<transition NAME="rightButtonRelease" NEXT_STATE_ID="0" EVENT_ID="507">
<!-- 1003 = SeSCALE -->
<action ID="1003" />
</transition>
<transition NAME="rightButtonRelease" NEXT_STATE_ID="0" EVENT_ID="538">
<!-- CTRL+RBM_Release ==> SeSCALE -->
<action ID="1003" />
</transition>
</state>
<state NAME="rotating" ID="4" X_POS="295" Y_POS="487" WIDTH="100" HEIGHT="50">
<transition NAME="middleButtonMove" NEXT_STATE_ID="4" EVENT_ID="533">
<!-- 1005 = SeROTATE -->
<action ID="1005" />
</transition>
<transition NAME="middleButtonRelease" NEXT_STATE_ID="0" EVENT_ID="506">
<!-- 1005 = SeROTATE -->
<action ID="1005" />
</transition>
<transition NAME="middleButtonRelease" NEXT_STATE_ID="0" EVENT_ID="539">
<!-- 1005 = SeROTATE -->
<action ID="1005" />
</transition>
</state>
</stateMachine>
<stateMachine NAME="connectpointsinteractor">
<!-- Behaviour for connecting points using mitk::ConnectPointsInteractor -->
<state NAME="ready" ID="1" START_STATE="TRUE" X_POS="357" Y_POS="236" WIDTH="100" HEIGHT="50">
<transition NAME="addPoint but check n" NEXT_STATE_ID="1" EVENT_ID="3">
<action ID="10">
<!--AcADDPOINT-->
</action>
</transition>
<transition NAME="remove" NEXT_STATE_ID="1" EVENT_ID="12">
<action ID="100">
<!--AcREMOVEPOINT-->
</action>
</transition>
</state>
</stateMachine>
<stateMachine NAME="coordinate-supply">
<state NAME="neutral" ID="1" START_STATE="TRUE" X_POS="439" Y_POS="228" WIDTH="100" HEIGHT="50">
<transition NAME="send Koordinates release" NEXT_STATE_ID="1" EVENT_ID="505">
<action ID="42" />
</transition>
</state>
</stateMachine>
<stateMachine NAME="EasySegmentation">
<state NAME="Checking for ActivateToolEvents" ID="0" START_STATE="TRUE" X_POS="193" Y_POS="206" WIDTH="174" HEIGHT="50">
<transition NAME="OnActivateToolEvent" EVENT_ID="1300" NEXT_STATE_ID="0">
<action ID="48009">
<!-- AcActivateTool -->
</action>
</transition>
</state>
</stateMachine>
<stateMachine NAME="segmentation-interactor-tool:movenzoom">
<state NAME="Ready to start" ID="0" START_STATE="TRUE">
<transition NAME="OnLeftMouseDown" EVENT_ID="1" NEXT_STATE_ID="3" />
<transition NAME="OnMiddleMouseDown" EVENT_ID="4" NEXT_STATE_ID="1">
<action ID="9">
<!-- AcInitMove -->
</action>
</transition>
<transition NAME="OnRightMouseDown" EVENT_ID="2" NEXT_STATE_ID="2">
<action ID="1011">
<!-- AcInitZoom -->
</action>
</transition>
</state>
<state NAME="Moving" ID="1">
<transition NAME="OnMouseMove" EVENT_ID="533" NEXT_STATE_ID="1">
<action ID="92">
<!-- AcMove -->
</action>
</transition>
<transition NAME="OnMiddleMouseUp" EVENT_ID="506" NEXT_STATE_ID="0" />
</state>
<state NAME="Zooming" ID="2">
<transition NAME="OnMouseMove" EVENT_ID="531" NEXT_STATE_ID="2">
<action ID="1012">
<!-- AcZoom -->
</action>
</transition>
<transition NAME="OnRightMouseUp" EVENT_ID="507" NEXT_STATE_ID="0" />
</state>
<state NAME="Click" ID="3">
<transition NAME="OnLeftMouseUp" EVENT_ID="505" NEXT_STATE_ID="0">
<action ID="31">
<!-- AcCheckObject -->
</action>
</transition>
</state>
</stateMachine>
<stateMachine NAME="segmentation-interactor-tool:needle">
<state NAME="Ready to start" ID="0" START_STATE="TRUE">
<transition NAME="OnMouseMove" EVENT_ID="520" NEXT_STATE_ID="0">
<action ID="49006">
<!-- AcUpdatePoint -->
</action>
</transition>
<transition NAME="OnKeyH" EVENT_ID="22" NEXT_STATE_ID="0">
<action ID="49004">
<!-- AcMovePoint1 -->
</action>
</transition>
<transition NAME="OnKeyT" EVENT_ID="17" NEXT_STATE_ID="0">
<action ID="49005">
<!-- AcMovePoint2 -->
</action>
</transition>
<transition NAME="OnKeyEsc" EVENT_ID="14" NEXT_STATE_ID="7">
<action ID="49009">
<!-- AcDisplayOptions -->
</action>
<action ID="49010">
<!-- AcCycle (cycle to first different needle) -->
</action>
</transition>
<transition NAME="OnLeftMouseDown" EVENT_ID="1" NEXT_STATE_ID="3">
<action ID="31">
<!-- AcCheckObject -->
</action>
</transition>
<transition NAME="OnMiddleMouseDown" EVENT_ID="4" NEXT_STATE_ID="1">
<action ID="9">
<!-- AcInitMove -->
</action>
</transition>
<transition NAME="OnRightMouseDown" EVENT_ID="2" NEXT_STATE_ID="2">
<action ID="1011">
<!-- AcInitZoom -->
</action>
</transition>
<transition NAME="OnShiftLeftMouseDown" EVENT_ID="3" NEXT_STATE_ID="0">
<action ID="21">
<!-- AcCheckPoint -->
</action>
</transition>
</state>
<state NAME="Moving" ID="1">
<transition NAME="OnMouseMove" EVENT_ID="533" NEXT_STATE_ID="1">
<action ID="92">
<!-- AcMove -->
</action>
</transition>
<transition NAME="OnMiddleMouseUp" EVENT_ID="506" NEXT_STATE_ID="0" />
</state>
<state NAME="Zooming" ID="2">
<transition NAME="OnMouseMove" EVENT_ID="531" NEXT_STATE_ID="2">
<action ID="1012">
<!-- AcZoom -->
</action>
</transition>
<transition NAME="OnRightMouseUp" EVENT_ID="507" NEXT_STATE_ID="0" />
</state>
<state NAME="Descision: what to drag?" ID="3">
<transition NAME="OnTip" EVENT_ID="1050" NEXT_STATE_ID="4" />
<transition NAME="OnHead" EVENT_ID="1051" NEXT_STATE_ID="5" />
<transition NAME="OnBody" EVENT_ID="1052" NEXT_STATE_ID="6" />
<transition NAME="OnNothing" EVENT_ID="1003" NEXT_STATE_ID="0" />
</state>
<state NAME="Tip dragging" ID="4">
<transition NAME="OnMouseMove" EVENT_ID="530" NEXT_STATE_ID="4">
<action ID="49002">
<!-- AcRotateAroundHead (Point1)-->
</action>
</transition>
<transition NAME="OnLeftMouseUp" EVENT_ID="505" NEXT_STATE_ID="0" />
</state>
<state NAME="Head dragging" ID="5">
<transition NAME="OnMouseMove" EVENT_ID="530" NEXT_STATE_ID="5">
<action ID="49003">
<!-- AcRotateAroundTip (Point2)-->
</action>
</transition>
<transition NAME="OnLeftMouseUp" EVENT_ID="505" NEXT_STATE_ID="0" />
</state>
<state NAME="Body dragging" ID="6">
<transition NAME="OnMouseMove" EVENT_ID="530" NEXT_STATE_ID="6">
<action ID="1001">
<!-- AcTranslate -->
</action>
</transition>
<transition NAME="OnLeftMouseUp" EVENT_ID="505" NEXT_STATE_ID="0" />
</state>
<state NAME="Needle choosing" ID="7">
<transition NAME="OnKeyEsc" EVENT_ID="14" NEXT_STATE_ID="7">
<action ID="49010">
<!-- AcCycle -->
</action>
</transition>
<transition NAME="OnKeyReturn" EVENT_ID="23" NEXT_STATE_ID="0">
<action ID="49011">
<!-- AcAccept -->
</action>
</transition>
<transition NAME="OnKeyReturn" EVENT_ID="24" NEXT_STATE_ID="0">
<action ID="49011">
<!-- AcAccept -->
</action>
</transition>
<transition NAME="OnKeySpace" EVENT_ID="25" NEXT_STATE_ID="0">
<action ID="49011">
<!-- AcAccept -->
</action>
</transition>
</state>
</stateMachine>
<stateMachine NAME="segmentation-interactor-tool:bubble">
<state NAME="Ready to start" ID="0" START_STATE="TRUE">
<!-- initial state: outside anything and checking for collisions -->
<transition NAME="OnLeftMouseDown" EVENT_ID="1" NEXT_STATE_ID="2">
<action ID="31">
<!-- AcCheckObject -->
</action>
</transition>
</state>
<state NAME="Drawing line" ID="1">
<!-- line drawing started, now always update the end point of the line -->
<transition NAME="OnEscape" EVENT_ID="14" NEXT_STATE_ID="0">
<action ID="48008">
<!-- AcCancel -->
</action>
</transition>
<transition NAME="OnMouseMove" EVENT_ID="530" NEXT_STATE_ID="1">
<action ID="48003">
<!-- AcUpdateLine -->
</action>
</transition>
<transition NAME="OnLeftMouseUp" EVENT_ID="505" NEXT_STATE_ID="0">
<action ID="48005">
<!-- AcTerminateLine -->
</action>
<action ID="48007">
<!-- AcCreateObjectFromLine -->
</action>
<action ID="48008">
<!-- AcCancel -->
</action>
</transition>
</state>
<state NAME="Decide between creating and modifying. modify?" ID="2">
<transition NAME="OnNo" EVENT_ID="1003" NEXT_STATE_ID="1">
<action ID="48004">
<!-- AcInitLine -->
</action>
</transition>
<transition NAME="OnYes" EVENT_ID="1004" NEXT_STATE_ID="6" />
</state>
<state NAME="Decide between left and right movement. Left?" ID="5">
<transition NAME="OnNo" EVENT_ID="1003" NEXT_STATE_ID="6">
<action ID="49012">
<!-- AcIncrease -->
</action>
</transition>
<transition NAME="OnYes" EVENT_ID="1004" NEXT_STATE_ID="6">
<action ID="49013">
<!-- AcDecrease -->
</action>
</transition>
</state>
<state NAME="Decide between left and right movement. Left?" ID="6">
<transition NAME="OnMouseMove" EVENT_ID="530" NEXT_STATE_ID="5">
<action ID="8">
<!-- AcInitMovement -->
</action>
</transition>
<transition NAME="OnMouseUp" EVENT_ID="505" NEXT_STATE_ID="0" />
</state>
</stateMachine>
<stateMachine NAME="pointinteractor">
<state NAME="unselected" ID="0" START_STATE="TRUE" X_POS="17" Y_POS="23" WIDTH="100" HEIGHT="50">
<transition NAME="addPoint" NEXT_STATE_ID="1" EVENT_ID="3">
<action ID="1101">
<!--AcMODESELECT-->
</action>
<action ID="10">
<!--AcADDPOINT-->
</action>
<action ID="30">
<!--AcCHECKELEMENT-->
<intParameter NAME="precision" VALUE="4" />
</action>
</transition>
<transition NAME="checkpicked" NEXT_STATE_ID="2" EVENT_ID="1">
<action ID="30">
<!--AcCHECKELEMENT-->
<intParameter NAME="precision" VALUE="4" />
</action>
</transition>
</state>
<state NAME="selected" ID="1" X_POS="663" Y_POS="89" WIDTH="100" HEIGHT="50">
<transition NAME="deselect all and add point" NEXT_STATE_ID="1" EVENT_ID="3">
<action ID="72">
<!--AcDESELECTALL-->
</action>
<action ID="10">
<!--AcADDPOINT-->
</action>
<action ID="30">
<!--AcCHECKELEMENT-->
<intParameter NAME="precision" VALUE="4" />
</action>
</transition>
<transition NAME="remove" NEXT_STATE_ID="5" EVENT_ID="12">
<action ID="1500">
<!--AcCHECKGREATERONE-->
</action>
</transition>
<transition NAME="checkSamePick" NEXT_STATE_ID="3" EVENT_ID="1">
<action ID="34">
<!--AcCHECKSELECTED-->
<intParameter NAME="precision" VALUE="4" />
</action>
</transition>
<transition NAME="deselect all" NEXT_STATE_ID="0" EVENT_ID="2000">
<action ID="72">
<!--AcDESELECTALL-->
</action>
<action ID="1100">
<!--AcMODEDESELECT-->
</action>
</transition>
</state>
<state NAME="checkpicked" ID="2" X_POS="385" Y_POS="221" WIDTH="100" HEIGHT="50">
<transition NAME="EIDNo" NEXT_STATE_ID="0" EVENT_ID="1003" />
<transition NAME="EIDYes" NEXT_STATE_ID="1" EVENT_ID="1004">
<action ID="1101">
<!--AcMODESELECT-->
</action>
<action ID="65">
<!--AcSELECT-->
</action>
</transition>
</state>
<state NAME="checkStillPicked" ID="3" X_POS="417" Y_POS="497" WIDTH="100" HEIGHT="50">
<transition NAME="EIDNo" NEXT_STATE_ID="0" EVENT_ID="1003">
<action ID="72">
<!--AcDESELECTALL-->
</action>
<action ID="1100">
<!--AcMODEDESELECT-->
</action>
</transition>
<transition NAME="EIDYes" NEXT_STATE_ID="4" EVENT_ID="1004">
<action ID="8">
<!--AcINITMOVEMENT-->
</action>
</transition>
</state>
<state NAME="moves" ID="4" X_POS="799" Y_POS="483" WIDTH="100" HEIGHT="50">
<transition NAME="mousemove" NEXT_STATE_ID="4" EVENT_ID="530">
<action ID="91">
<!--AcMOVESELECTED-->
</action>
</transition>
<transition NAME="finishmove" NEXT_STATE_ID="1" EVENT_ID="505">
<action ID="42">
<!--AcFINISHMOVEMENT-->
</action>
</transition>
</state>
<state NAME="checkGreaterOne" ID="5" X_POS="416" Y_POS="344" WIDTH="100" HEIGHT="50">
<transition NAME="StYes" NEXT_STATE_ID="1" EVENT_ID="1004">
<action ID="100">
<!--AcREMOVEPOINT-->
</action>
<action ID="61">
<!--AcSELECTANOTHEROBJECT-->
</action>
</transition>
<transition NAME="StNo" NEXT_STATE_ID="0" EVENT_ID="1003">
<action ID="100">
<!--AcREMOVEPOINT-->
</action>
<action ID="1100">
<!--AcMODEDESELECT-->
</action>
</transition>
</state>
</stateMachine>
<stateMachine NAME="pointselectorinteractor">
<state NAME="unselected" ID="0" START_STATE="TRUE" X_POS="17" Y_POS="23" WIDTH="100" HEIGHT="50">
<transition NAME="addPoint" NEXT_STATE_ID="1" EVENT_ID="3">
<action ID="1101">
<!--AcMODESELECT-->
</action>
<action ID="10">
<!--AcADDPOINT-->
</action>
<action ID="30">
<!--AcCHECKELEMENT-->
<intParameter NAME="precision" VALUE="4" />
</action>
</transition>
<transition NAME="checkpicked" NEXT_STATE_ID="2" EVENT_ID="1">
<action ID="30">
<!--AcCHECKELEMENT-->
<intParameter NAME="precision" VALUE="4" />
</action>
</transition>
</state>
<state NAME="selected" ID="1" X_POS="663" Y_POS="89" WIDTH="100" HEIGHT="50">
<transition NAME="deselect all and add point" NEXT_STATE_ID="1" EVENT_ID="3">
<action ID="72">
<!--AcDESELECTALL-->
</action>
<action ID="10">
<!--AcADDPOINT-->
</action>
<action ID="30">
<!--AcCHECKELEMENT-->
<intParameter NAME="precision" VALUE="4" />
</action>
</transition>
<transition NAME="remove" NEXT_STATE_ID="5" EVENT_ID="12">
<action ID="1500">
<!--AcCHECKGREATERONE-->
</action>
</transition>
<transition NAME="checkSamePick" NEXT_STATE_ID="3" EVENT_ID="1">
<action ID="34">
<!--AcCHECKSELECTED-->
<intParameter NAME="precision" VALUE="4" />
</action>
</transition>
<transition NAME="deselect all" NEXT_STATE_ID="0" EVENT_ID="2000">
<action ID="72">
<!--AcDESELECTALL-->
</action>
<action ID="1100">
<!--AcMODEDESELECT-->
</action>
</transition>
</state>
<state NAME="checkpicked" ID="2" X_POS="385" Y_POS="221" WIDTH="100" HEIGHT="50">
<transition NAME="EIDNo" NEXT_STATE_ID="0" EVENT_ID="1003" />
<transition NAME="EIDYes" NEXT_STATE_ID="1" EVENT_ID="1004">
<action ID="1101">
<!--AcMODESELECT-->
</action>
<action ID="65">
<!--AcSELECT-->
</action>
</transition>
</state>
<state NAME="checkStillPicked" ID="3" X_POS="417" Y_POS="497" WIDTH="100" HEIGHT="50">
<transition NAME="EIDNo" NEXT_STATE_ID="0" EVENT_ID="1003">
<action ID="72">
<!--AcDESELECTALL-->
</action>
<action ID="1100">
<!--AcMODEDESELECT-->
</action>
</transition>
<transition NAME="EIDYes" NEXT_STATE_ID="4" EVENT_ID="1004">
<action ID="8">
<!--AcINITMOVEMENT-->
</action>
</transition>
</state>
<state NAME="moves" ID="4" X_POS="799" Y_POS="483" WIDTH="100" HEIGHT="50">
<transition NAME="mousemove" NEXT_STATE_ID="4" EVENT_ID="530">
<action ID="91">
<!--AcMOVESELECTED-->
</action>
</transition>
<transition NAME="finishmove" NEXT_STATE_ID="1" EVENT_ID="505">
<action ID="42">
<!--AcFINISHMOVEMENT-->
</action>
</transition>
</state>
<state NAME="checkGreaterOne" ID="5" X_POS="416" Y_POS="344" WIDTH="100" HEIGHT="50">
<transition NAME="StYes" NEXT_STATE_ID="1" EVENT_ID="1004">
<action ID="100">
<!--AcREMOVEPOINT-->
</action>
<action ID="61">
<!--AcSELECTANOTHEROBJECT-->
</action>
</transition>
<transition NAME="StNo" NEXT_STATE_ID="0" EVENT_ID="1003">
<action ID="100">
<!--AcREMOVEPOINT-->
</action>
<action ID="1100">
<!--AcMODEDESELECT-->
</action>
</transition>
</state>
</stateMachine>
<stateMachine NAME="pointsetinteractor">
<!-- Behaviour of a set of Points. a defined number of points can be set/removed/selected/deselectd/moved -->
<state NAME="no points or loaded points" ID="1" START_STATE="TRUE" X_POS="1066" Y_POS="281" WIDTH="100" HEIGHT="50">
<transition NAME="0SmallerPointsLoadedSmallerN" NEXT_STATE_ID="2" EVENT_ID="1014" /> <!-- If points have been loaded, goto right state; checked in constructor -->
<transition NAME="PointsLoadedGreaterEqualsN" NEXT_STATE_ID="4" EVENT_ID="1015" /> <!-- If points have been loaded, goto right state; checked in constructor -->
<transition NAME="addPoint but check n" NEXT_STATE_ID="3" EVENT_ID="3">
<action ID="1101" />
<!--AcMODE_SELECT-->
<action ID="32" />
</transition>
<transition NAME="checkn Delete" NEXT_STATE_ID="30" EVENT_ID="12">
<action ID="330" />
<!--AcCHECKNUMBEROFPOINTS-->
</transition>
<transition NAME="SetThisStatemachineOnSelected" NEXT_STATE_ID="1" EVENT_ID="1030">
<action ID="1101" />
<!--AcMODE_SELECT-->
</transition>
<transition NAME="SetThisStatemachineOnDeselected" NEXT_STATE_ID="1" EVENT_ID="1031">
<action ID="1100" />
<!--AcMODE_DESELECT-->
</transition>
</state>
<state NAME="space left" ID="2" X_POS="659" Y_POS="257" WIDTH="100" HEIGHT="50">
<transition NAME="addPoint but check n" NEXT_STATE_ID="3" EVENT_ID="3">
<action ID="32" />
</transition>
<transition NAME="Select or move point Space" NEXT_STATE_ID="10" EVENT_ID="1">
<action ID="30" />
</transition>
<transition NAME="check selected and Delete" NEXT_STATE_ID="31" EVENT_ID="12">
<action ID="340" />
<!--AcCHECKONESELECTED-->
</transition>
<transition NAME="DeselectAll" NEXT_STATE_ID="2" EVENT_ID="14">
<!--Event = ESC-->
<action ID="72" />
<!--AcDESELECTALL-->
<action ID="1100" />
<!--AcMODE_DESELECT-->
</transition>
</state>
<state NAME="checkedN" ID="3" X_POS="745" Y_POS="744" WIDTH="100" HEIGHT="50">
<transition NAME="n smaller N" NEXT_STATE_ID="40" EVENT_ID="1010">
<action ID="37" />
</transition>
<transition NAME="n greater equals N" NEXT_STATE_ID="41" EVENT_ID="1011">
<action ID="37" />
</transition>
</state>
<state NAME="set full" ID="4" X_POS="267" Y_POS="633" WIDTH="100" HEIGHT="50">
<transition NAME="Select or move point FULL" NEXT_STATE_ID="20" EVENT_ID="1">
<action ID="30" />
<!--AcCHECKELEMENT-->
</transition>
<transition NAME="checkn Delete selected Point" NEXT_STATE_ID="30" EVENT_ID="12">
<action ID="330" />
<!--AcCHECKNUMBEROFPOINTS-->
</transition>
<transition NAME="DeselectAll" NEXT_STATE_ID="2" EVENT_ID="14">
<!--Event = ESC-->
<action ID="72" />
<!--AcDESELECTALL-->
<action ID="1100" />
<!--AcMODEDESELECT-->
</transition>
</state>
<state NAME="picked NotFull" ID="10" X_POS="903" Y_POS="38" WIDTH="100" HEIGHT="50">
<transition NAME="StNo" NEXT_STATE_ID="2" EVENT_ID="1003">
<action ID="72" />
<!--AcDESELECTALL-->
<action ID="1100" />
<!--AcMODEDESELECT-->
</transition>
<transition NAME="StYes" NEXT_STATE_ID="11" EVENT_ID="1004">
<action ID="34" />
<!--AcCHECKSELECTED-->
<action ID="1101" />
<!--AcMODESELECT-->
</transition>
</state>
<state NAME="already selected Space" ID="11" X_POS="391" Y_POS="11" WIDTH="100" HEIGHT="50">
<transition NAME="StNo" NEXT_STATE_ID="2" EVENT_ID="1003">
<action ID="60" />
</transition>
<transition NAME="StYes" NEXT_STATE_ID="12" EVENT_ID="1004">
<action ID="8" />
</transition>
</state>
<state NAME="move Point Space" ID="12" X_POS="100" Y_POS="99" WIDTH="100" HEIGHT="50">
<transition NAME="move point" NEXT_STATE_ID="12" EVENT_ID="530">
<action ID="91" />
</transition>
<transition NAME="finish move" NEXT_STATE_ID="2" EVENT_ID="505">
<action ID="42" />
</transition>
<transition NAME="Safety init" NEXT_STATE_ID="12" EVENT_ID="1">
<action ID="8" />
</transition>
</state>
<state NAME="picked Full" ID="20" X_POS="122" Y_POS="766" WIDTH="100" HEIGHT="50">
<transition NAME="StNO" NEXT_STATE_ID="4" EVENT_ID="1003">
<action ID="72" />
<!--AcDESELECTALL-->
<action ID="1100" />
<!--AcMODEDESELECT-->
</transition>
<transition NAME="StYES" NEXT_STATE_ID="21" EVENT_ID="1004">
<action ID="34" />
<!--AcCHECKSELECTED-->
<action ID="1101" />
<!--AcMODESELECT-->
</transition>
</state>
<state NAME="selected Full" ID="21" X_POS="23" Y_POS="485" WIDTH="100" HEIGHT="50">
<transition NAME="StNo" NEXT_STATE_ID="4" EVENT_ID="1003">
<action ID="60" />
<!--AcSELECTPICKEDOBJECT-->
</transition>
<transition NAME="StYes" NEXT_STATE_ID="22" EVENT_ID="1004">
<action ID="8" />
<!--AcINITMOVEMENT-->
</transition>
</state>
<state NAME="move Point Full" ID="22" X_POS="67" Y_POS="255" WIDTH="100" HEIGHT="50">
<!-- since the MouseMove Event is send by QT we don't have the information about the position of the point in the list. we had it before, when we checked, if it was picked, or if it was selected -->
<transition NAME="move point" NEXT_STATE_ID="22" EVENT_ID="530">
<action ID="91" />
</transition>
<transition NAME="finish move" NEXT_STATE_ID="4" EVENT_ID="505">
<action ID="42" />
</transition>
<transition NAME="Safety init" NEXT_STATE_ID="22" EVENT_ID="1">
<action ID="8" />
</transition>
</state>
<state NAME="checkn Delete" ID="30" X_POS="1124" Y_POS="708" WIDTH="100" HEIGHT="50">
<transition NAME="StillFull" NEXT_STATE_ID="4" EVENT_ID="1015">
<action ID="100" />
<!--AcREMOVEPOINT-->
</transition>
<transition NAME="NotEmptyNotFull" NEXT_STATE_ID="2" EVENT_ID="1014">
<action ID="100" />
<!--AcREMOVEPOINT-->
</transition>
<transition NAME="WillBeEmpty" NEXT_STATE_ID="1" EVENT_ID="1017">
<action ID="100" />
<!--AcREMOVEPOINT-->
<action ID="1100" />
<!--AcMODEDESELECT-->
</transition>
</state>
<state NAME="selected space left" ID="31" X_POS="22" Y_POS="480" WIDTH="90" HEIGHT="50">
<transition NAME="StNo" NEXT_STATE_ID="2" EVENT_ID="1003" />
<transition NAME="StYes" NEXT_STATE_ID="30" EVENT_ID="1004">
<action ID="330" />
<!--AcCHECKNUMBEROFPOINTS-->
</transition>
</state>
<state NAME="checkedPositionEventSmallerN" ID="40" X_POS="267" Y_POS="301" WIDTH="173" HEIGHT="50">
<transition NAME="PositionEvent" NEXT_STATE_ID="2" EVENT_ID="1004">
<action ID="10" />
<!--AcADDPOINT-->
<action ID="1100" />
<!--AcMODE_DESELECT-->
</transition>
<transition NAME="others" NEXT_STATE_ID="2" EVENT_ID="1003">
<action ID="1100" />
<!--AcMODE_DESELECT-->
</transition>
</state>
<state NAME="checkedPositionEventGreaterN" ID="41" X_POS="562" Y_POS="424" WIDTH="168" HEIGHT="50">
<transition NAME="PositionEvent" NEXT_STATE_ID="4" EVENT_ID="1004">
<action ID="10" />
<!--AcADDPOINT-->
<action ID="1100" />
<!--AcMODE_DESELECT-->
</transition>
<transition NAME="others" NEXT_STATE_ID="2" EVENT_ID="1003">
<action ID="1100" />
<!--AcMODE_DESELECT-->
</transition>
</state>
</stateMachine>
<stateMachine NAME="onlymovepointsetinteractor">
<!-- Behaviour of a set of Points. The points can only be selected and moved.-->
<state NAME="no points or loaded points" ID="1" START_STATE="TRUE" X_POS="1066" Y_POS="281" WIDTH="100" HEIGHT="50">
<transition NAME="0SmallerPointsLoadedSmallerN" NEXT_STATE_ID="2" EVENT_ID="1014" /> <!-- If points have been loaded, goto right state; checked in constructor -->
<transition NAME="PointsLoadedGreaterEqualsN" NEXT_STATE_ID="2" EVENT_ID="1015" /> <!-- If points have been loaded, goto right state; checked in constructor -->
<transition NAME="SetThisStatemachineOnSelected" NEXT_STATE_ID="1" EVENT_ID="1030">
<action ID="1101">
<!--AcMODE_SELECT-->
</action>
</transition>
<transition NAME="SetThisStatemachineOnDeselected" NEXT_STATE_ID="1" EVENT_ID="1031">
<action ID="1100">
<!--AcMODE_DESELECT-->
</action>
</transition>
</state>
<state NAME="loaded points" ID="2" X_POS="659" Y_POS="257" WIDTH="100" HEIGHT="50">
<transition NAME="Select or move point" NEXT_STATE_ID="10" EVENT_ID="1">
<action ID="30" />
</transition>
<transition NAME="DeselectAll" NEXT_STATE_ID="2" EVENT_ID="14">
<!--Event = ESC-->
<action ID="72">
<!--AcDESELECTALL-->
</action>
<action ID="1100">
<!--AcMODE_DESELECT-->
</action>
</transition>
</state>
<state NAME="picked point" ID="10" X_POS="903" Y_POS="38" WIDTH="100" HEIGHT="50">
<transition NAME="StNo" NEXT_STATE_ID="2" EVENT_ID="1003">
<action ID="72">
<!--AcDESELECTALL-->
</action>
<action ID="1100">
<!--AcMODEDESELECT-->
</action>
</transition>
<transition NAME="StYes" NEXT_STATE_ID="11" EVENT_ID="1004">
<action ID="34">
<!--AcCHECKSELECTED-->
</action>
<action ID="1101">
<!--AcMODESELECT-->
</action>
</transition>
</state>
<state NAME="already selected point" ID="11" X_POS="391" Y_POS="11" WIDTH="100" HEIGHT="50">
<transition NAME="StNo" NEXT_STATE_ID="2" EVENT_ID="1003">
<action ID="60" />
</transition>
<transition NAME="StYes" NEXT_STATE_ID="12" EVENT_ID="1004">
<action ID="8" />
</transition>
</state>
<state NAME="move point" ID="12" X_POS="100" Y_POS="99" WIDTH="100" HEIGHT="50">
<transition NAME="move point" NEXT_STATE_ID="12" EVENT_ID="530">
<action ID="91" />
</transition>
<transition NAME="finish move" NEXT_STATE_ID="2" EVENT_ID="505">
<action ID="42" />
</transition>
<transition NAME="Safety init" NEXT_STATE_ID="12" EVENT_ID="1">
<action ID="8" />
</transition>
</state>
</stateMachine>
<stateMachine NAME="seedpointsetinteractor">
<!-- Behaviour of one Point. Point is added by clicking left Mouse Button and holding Shift-->
<state NAME="no point" ID="1" START_STATE="TRUE" X_POS="59" Y_POS="45" WIDTH="169" HEIGHT="50">
<transition NAME="0SmallerPointsLoadedSmallerN" NEXT_STATE_ID="10" EVENT_ID="1014" /> <!-- If point has been loaded, goto right state; checked in constructor -->
<transition NAME="PointsLoadedGreaterEqualsN" NEXT_STATE_ID="10" EVENT_ID="1015" /> <!-- If point has been loaded, goto right state; checked in constructor -->
<transition NAME="addPoint" NEXT_STATE_ID="2" EVENT_ID="3">
<action ID="1101">
<!--AcMODESELECT-->
</action>
<action ID="37" />
<!--AcCHECKOPERATION-->
</transition>
</state>
<state NAME="checkPositionEvent" ID="2" X_POS="164" Y_POS="334" WIDTH="166" HEIGHT="50">
<transition NAME="PositionEvent" NEXT_STATE_ID="10" EVENT_ID="1004">
<action ID="10" />
<!--AcADDPOINT-->
</transition>
<transition NAME="others" NEXT_STATE_ID="1" EVENT_ID="1003">
<action ID="0" />
</transition>
</state>
<state NAME="point" ID="10" X_POS="914" Y_POS="734" WIDTH="100" HEIGHT="50">
<transition NAME="insertPoint" NEXT_STATE_ID="11" EVENT_ID="3">
<action ID="37" />
<!--AcCHECKOPERATION-->
</transition>
<transition NAME="Select or move point" NEXT_STATE_ID="12" EVENT_ID="1">
<action ID="30" />
<!--AcCHECKELEMENT-->
</transition>
<transition NAME="check selected and delete" NEXT_STATE_ID="15" EVENT_ID="12">
<action ID="340" />
<!--AcCHECKONESELECTED-->
</transition>
</state>
<state NAME="checkedPositionEventPoint" ID="11" X_POS="758" Y_POS="478" WIDTH="100" HEIGHT="50">
<transition NAME="PositionEvent" NEXT_STATE_ID="10" EVENT_ID="1004">
<action ID="103" />
<!--AcREMOVEALL-->
<action ID="10" />
<!--AcADDPOINT-->
</transition>
<transition NAME="others" NEXT_STATE_ID="10" EVENT_ID="1003">
<action ID="0" />
</transition>
</state>
<state NAME="picked point" ID="12" X_POS="23" Y_POS="560" WIDTH="150" HEIGHT="50">
<transition NAME="StNo" NEXT_STATE_ID="10" EVENT_ID="1003">
<action ID="72" />
<!--AcDESELECTALL-->
<action ID="1100" />
<!--AcMODEDESELECT-->
</transition>
<transition NAME="StYes" NEXT_STATE_ID="13" EVENT_ID="1004">
<action ID="34" />
<!--AcCHECKSELECTED-->
<action ID="1101" />
<!--AcMODESELECT-->
</transition>
</state>
<state NAME="selected" ID="13" X_POS="23" Y_POS="485" WIDTH="100" HEIGHT="50">
<transition NAME="StNo" NEXT_STATE_ID="10" EVENT_ID="1003">
<action ID="60" />
<!--AcSELECTPICKEDOBJECT-->
</transition>
<transition NAME="StYes" NEXT_STATE_ID="14" EVENT_ID="1004">
<action ID="8" />
<!--AcINITMOVEMENT-->
</transition>
</state>
<state NAME="move Point" ID="14" X_POS="76" Y_POS="731" WIDTH="100" HEIGHT="50">
<transition NAME="move point" NEXT_STATE_ID="14" EVENT_ID="530">
<action ID="91" />
<!--AcMOVESELECTED-->
</transition>
<transition NAME="finish move" NEXT_STATE_ID="10" EVENT_ID="505">
<action ID="42" />
<!--AcFINISHMOVEMENT-->
</transition>
<transition NAME="Safety init" NEXT_STATE_ID="14" EVENT_ID="1">
<action ID="8" />
<!--AcINITMOVEMENT-->
</transition>
</state>
<state NAME="already selected" ID="15" X_POS="23" Y_POS="560" WIDTH="150" HEIGHT="50">
<transition NAME="StNo" NEXT_STATE_ID="10" EVENT_ID="1003" />
<transition NAME="StYes" NEXT_STATE_ID="16" EVENT_ID="1004">
<action ID="33" />
<!--AcCHECKEQUALS1-->
</transition>
</state>
<state NAME="delete" ID="16" X_POS="1151" Y_POS="19" WIDTH="100" HEIGHT="50">
<transition NAME="equalsOne" NEXT_STATE_ID="1" EVENT_ID="1004">
<action ID="100" />
<!--AcREMOVEPOINT-->
<action ID="1100" />
<!--AcMODEDESELECT-->
</transition>
<transition NAME="largerOne" NEXT_STATE_ID="10" EVENT_ID="1003">
<action ID="100" />
<!--AcREMOVEPOINT-->
</transition>
</state>
</stateMachine>
<stateMachine NAME="VesselGraphInteractor">
<state NAME="Start" ID="1" START_STATE="TRUE" X_POS="1390" Y_POS="-1" WIDTH="100" HEIGHT="50">
<transition NAME="goToCheckPicking" NEXT_STATE_ID="2" EVENT_ID="5">
<action ID="31">
<!--AcCHECKOBJECT-->
</action>
</transition>
<transition NAME="goToCheckPicking" NEXT_STATE_ID="2" EVENT_ID="8">
<action ID="31">
<!--AcCHECKOBJECT-->
</action>
</transition>
</state>
<state NAME="CheckPicking" ID="2" X_POS="515" Y_POS="263" WIDTH="100" HEIGHT="50">
<transition NAME="noPicked" NEXT_STATE_ID="4" EVENT_ID="1003">
<action ID="66">
<!-- AcSELECTPOINT -->
</action>
</transition>
<transition NAME="yesPicked" NEXT_STATE_ID="3" EVENT_ID="1004">
<action ID="69">
<!-- AcSELECTSUBOBJECT -->
</action>
</transition>
</state>
<state NAME="OneVesselPicked" ID="3" X_POS="1488" Y_POS="350" WIDTH="100" HEIGHT="50">
<transition NAME="goToCheckPicking" NEXT_STATE_ID="5" EVENT_ID="5">
<action ID="31">
<!-- AcCHECKOBJECT -->
</action>
</transition>
<transition NAME="goToCheckPicking" NEXT_STATE_ID="5" EVENT_ID="8">
<action ID="31">
<!-- AcCHECKOBJECT -->
</action>
</transition>
<transition NAME="delete" NEXT_STATE_ID="1" EVENT_ID="12">
<action ID="104">
<!-- AcREMOVESELECTEDSUBOBJECT -->
</action>
</transition>
<transition NAME="deselectAll" NEXT_STATE_ID="1" EVENT_ID="14">
<action ID="72">
<!-- AcDESELECTALL -->
</action>
</transition>
<transition NAME="searchPeriphery" NEXT_STATE_ID="11" EVENT_ID="15">
<action ID="3000">
<!-- AcPERIPHERYSEARCH -->
</action>
</transition>
<transition NAME="searchToRoot" NEXT_STATE_ID="11" EVENT_ID="16">
<action ID="3001">
<!-- AcROOTSEARCH -->
</action>
</transition>
<transition NAME="searchToThickstVessel" NEXT_STATE_ID="11" EVENT_ID="17">
<action ID="3002">
<!-- AcTHICKSTVESSELSEARCH -->
</action>
</transition>
<!--now follow the attibutations for different vessel types-->
<transition NAME="attributation" NEXT_STATE_ID="3" EVENT_ID="20">
<action ID="3005">
<!-- AcATTRIBUTATION -->
<intParameter NAME="attribute_id" VALUE="0" />
</action>
</transition>
<transition NAME="attributation" NEXT_STATE_ID="3" EVENT_ID="21">
<action ID="3005">
<!-- AcATTRIBUTATION -->
<intParameter NAME="attribute_id" VALUE="1" />
</action>
</transition>
<transition NAME="attributation" NEXT_STATE_ID="3" EVENT_ID="30">
<action ID="3005">
<!-- AcATTRIBUTATION -->
<intParameter NAME="attribute_id" VALUE="2" />
</action>
</transition>
<transition NAME="attributation" NEXT_STATE_ID="3" EVENT_ID="31">
<action ID="3005">
<!-- AcATTRIBUTATION -->
<intParameter NAME="attribute_id" VALUE="3" />
</action>
</transition>
<transition NAME="attributation" NEXT_STATE_ID="3" EVENT_ID="40">
<action ID="3005">
<!-- AcATTRIBUTATION -->
<intParameter NAME="attribute_id" VALUE="4" />
</action>
</transition>
<transition NAME="default" NEXT_STATE_ID="1" EVENT_ID="90">
<action ID="3007">
<!-- AcDEFAULT -->
</action>
</transition>
</state>
<state NAME="OnePointPicked" ID="4" X_POS="339" Y_POS="103" WIDTH="100" HEIGHT="50">
<transition NAME="goToCheckPicking" NEXT_STATE_ID="6" EVENT_ID="5">
<action ID="31">
<!-- AcCHECKOBJECT -->
</action>
</transition>
<transition NAME="goToCheckPicking" NEXT_STATE_ID="6" EVENT_ID="8">
<action ID="31">
<!-- AcCHECKOBJECT -->
</action>
</transition>
<transition NAME="deselectAll" NEXT_STATE_ID="1" EVENT_ID="14">
<action ID="72">
<!-- AcDESELECTALL -->
</action>
</transition>
</state>
<state NAME="CheckPicking" ID="5" X_POS="43" Y_POS="721" WIDTH="100" HEIGHT="50">
<transition NAME="noPicked" NEXT_STATE_ID="7" EVENT_ID="1003">
<action ID="66">
<!-- AcSELECTPOINT -->
</action>
</transition>
<transition NAME="yesPicked" NEXT_STATE_ID="13" EVENT_ID="1004">
<action ID="69">
<!-- AcSELECTSUBOBJECT -->
</action>
<action ID="3010">
<!-- AcCHECKBARRIERSTATUS -->
</action>
</transition>
</state>
<state NAME="CheckPicking" ID="6" X_POS="552" Y_POS="156" WIDTH="100" HEIGHT="50">
<transition NAME="noPicked" NEXT_STATE_ID="9" EVENT_ID="1003">
<action ID="66">
<!-- AcSELECTPOINT -->
</action>
</transition>
<transition NAME="yesPicked" NEXT_STATE_ID="7" EVENT_ID="1004">
<action ID="69">
<!-- AcSELECTSUBOBJECT -->
</action>
</transition>
</state>
<state NAME="OneVesselOnePointPicked" ID="7" X_POS="665" Y_POS="378" WIDTH="151" HEIGHT="50">
<transition NAME="ENew" NEXT_STATE_ID="1" EVENT_ID="13">
<action ID="81">
<!-- AcNEWSUBOBJECT -->
</action>
<action ID="72">
<!-- AcDESELECTALL -->
</action>
</transition>
<transition NAME="deselectAll" NEXT_STATE_ID="1" EVENT_ID="14">
<action ID="72">
<!-- AcDESELECTALL -->
</action>
</transition>
<transition NAME="delete" NEXT_STATE_ID="1" EVENT_ID="12">
<action ID="104">
<!-- AcREMOVESELECTEDSUBOBJECT -->
</action>
</transition>
<transition NAME="setVesselElement" NEXT_STATE_ID="7" EVENT_ID="91">
<action ID="3008">
<!-- AcSETVESSELELEMENT-->
</action>
</transition>
<!--now follow the attibutations for different vessel types-->
<transition NAME="attributation" NEXT_STATE_ID="7" EVENT_ID="20">
<action ID="3005">
<!-- AcATTRIBUTATION -->
<intParameter NAME="attribute_id" VALUE="0" />
</action>
</transition>
<transition NAME="attributation" NEXT_STATE_ID="7" EVENT_ID="21">
<action ID="3005">
<!-- AcATTRIBUTATION -->
<intParameter NAME="attribute_id" VALUE="1" />
</action>
</transition>
<transition NAME="attributation" NEXT_STATE_ID="7" EVENT_ID="30">
<action ID="3005">
<!-- AcATTRIBUTATION -->
<intParameter NAME="attribute_id" VALUE="2" />
</action>
</transition>
<transition NAME="attributation" NEXT_STATE_ID="7" EVENT_ID="31">
<action ID="3005">
<!-- AcATTRIBUTATION -->
<intParameter NAME="attribute_id" VALUE="3" />
</action>
</transition>
<transition NAME="attributation" NEXT_STATE_ID="7" EVENT_ID="40">
<action ID="3005">
<!-- AcATTRIBUTATION -->
<intParameter NAME="attribute_id" VALUE="4" />
</action>
</transition>
<transition NAME="default" NEXT_STATE_ID="1" EVENT_ID="90">
<action ID="3007">
<!-- AcDEFAULT -->
</action>
</transition>
</state>
<state NAME="TwoVesselsPicked" ID="8" X_POS="77" Y_POS="79" WIDTH="100" HEIGHT="50">
<transition NAME="ENew" NEXT_STATE_ID="1" EVENT_ID="13">
<action ID="81">
<!-- AcNEWSUBOBJECT -->
</action>
<action ID="72">
<!-- AcDESELECTALL -->
</action>
</transition>
<transition NAME="goToCheckPicking" NEXT_STATE_ID="10" EVENT_ID="5">
<action ID="31">
<!-- AcCHECKOBJECT -->
</action>
</transition>
<transition NAME="goToCheckPicking" NEXT_STATE_ID="10" EVENT_ID="8">
<action ID="31">
<!-- AcCHECKOBJECT -->
</action>
</transition>
<transition NAME="searchShortestPathBetween2Edges" NEXT_STATE_ID="11" EVENT_ID="18">
<action ID="3003">
<!-- AcSHORTESTPATHSEARCH -->
</action>
</transition>
<transition NAME="deselectAll" NEXT_STATE_ID="1" EVENT_ID="14">
<action ID="72">
<!-- AcDESELECTALL -->
</action>
</transition>
<transition NAME="delete" NEXT_STATE_ID="1" EVENT_ID="12">
<action ID="104">
<!-- AcREMOVESELECTEDSUBOBJECT -->
</action>
</transition>
<transition NAME="setVesselElement" NEXT_STATE_ID="8" EVENT_ID="91">
<action ID="3008">
<!-- AcSETVESSELELEMENT-->
</action>
</transition>
<!--now follow the attibutations for different vessel types-->
<transition NAME="attributation" NEXT_STATE_ID="8" EVENT_ID="20">
<action ID="3005">
<!-- AcATTRIBUTATION -->
<intParameter NAME="attribute_id" VALUE="0" />
</action>
</transition>
<transition NAME="attributation" NEXT_STATE_ID="8" EVENT_ID="21">
<action ID="3005">
<!-- AcATTRIBUTATION -->
<intParameter NAME="attribute_id" VALUE="1" />
</action>
</transition>
<transition NAME="attributation" NEXT_STATE_ID="8" EVENT_ID="30">
<action ID="3005">
<!-- AcATTRIBUTATION -->
<intParameter NAME="attribute_id" VALUE="2" />
</action>
</transition>
<transition NAME="attributation" NEXT_STATE_ID="8" EVENT_ID="31">
<action ID="3005">
<!-- AcATTRIBUTATION -->
<intParameter NAME="attribute_id" VALUE="3" />
</action>
</transition>
<transition NAME="attributation" NEXT_STATE_ID="8" EVENT_ID="40">
<action ID="3005">
<!-- AcATTRIBUTATION -->
<intParameter NAME="attribute_id" VALUE="4" />
</action>
</transition>
<transition NAME="default" NEXT_STATE_ID="1" EVENT_ID="90">
<action ID="3007">
<!-- AcDEFAULT -->
</action>
</transition>
</state>
<state NAME="TwoPointsPicked" ID="9" X_POS="748" Y_POS="140" WIDTH="100" HEIGHT="50">
<transition NAME="ENew" NEXT_STATE_ID="1" EVENT_ID="13">
<action ID="81">
<!-- AcNEWSUBOBJECT -->
</action>
</transition>
<transition NAME="deselectAll" NEXT_STATE_ID="1" EVENT_ID="14">
<action ID="72">
<!-- AcDESELECTALL -->
</action>
</transition>
<transition NAME="setVesselElement" NEXT_STATE_ID="9" EVENT_ID="91">
<action ID="3008">
<!-- AcSETVESSELELEMENT-->
</action>
</transition>
</state>
<state NAME="CheckPicking" ID="10" X_POS="642" Y_POS="805" WIDTH="100" HEIGHT="50">
<transition NAME="noPicked" NEXT_STATE_ID="12" EVENT_ID="1003">
<action ID="36">
<!--AcCHECKGREATERTWO-->
</action>
</transition>
<transition NAME="yesPicked" NEXT_STATE_ID="14" EVENT_ID="1004">
<action ID="69">
<!-- AcSELECTSUBOBJECT -->
</action>
<action ID="3010">
<!-- AcCHECKBARRIERSTATUS -->
</action>
</transition>
</state>
<state NAME="MoreVesselsPicked" ID="11" X_POS="933" Y_POS="754" WIDTH="100" HEIGHT="50">
<transition NAME="delete" NEXT_STATE_ID="1" EVENT_ID="12">
<action ID="104">
<!-- AcDESELECTALL -->
</action>
</transition>
<transition NAME="goToCheckPicking" NEXT_STATE_ID="10" EVENT_ID="5">
<action ID="31">
<!-- AcCHECKOBJECT -->
</action>
</transition>
<transition NAME="goToCheckPicking" NEXT_STATE_ID="10" EVENT_ID="8">
<action ID="31">
<!-- AcCHECKOBJECT -->
</action>
</transition>
<transition NAME="deselectAll" NEXT_STATE_ID="1" EVENT_ID="14">
<action ID="72">
<!-- AcDESELECTALL -->
</action>
</transition>
<transition NAME="singleSignal" NEXT_STATE_ID="3" EVENT_ID="19">
<action ID="3004">
<!-- AcSINGLE -->
</action>
</transition>
<!--now follow the attibutations for different vessel types-->
<transition NAME="attributation" NEXT_STATE_ID="11" EVENT_ID="20">
<action ID="3005">
<!-- AcATTRIBUTATION -->
<intParameter NAME="attribute_id" VALUE="0" />
</action>
</transition>
<transition NAME="attributation" NEXT_STATE_ID="11" EVENT_ID="21">
<action ID="3005">
<!-- AcATTRIBUTATION -->
<intParameter NAME="attribute_id" VALUE="1" />
</action>
</transition>
<transition NAME="attributation" NEXT_STATE_ID="11" EVENT_ID="30">
<action ID="3005">
<!-- AcATTRIBUTATION -->
<intParameter NAME="attribute_id" VALUE="2" />
</action>
</transition>
<transition NAME="attributation" NEXT_STATE_ID="11" EVENT_ID="31">
<action ID="3005">
<!-- AcATTRIBUTATION -->
<intParameter NAME="attribute_id" VALUE="3" />
</action>
</transition>
<transition NAME="attributation" NEXT_STATE_ID="11" EVENT_ID="40">
<action ID="3005">
<!-- AcATTRIBUTATION -->
<intParameter NAME="attribute_id" VALUE="4" />
</action>
</transition>
<transition NAME="default" NEXT_STATE_ID="1" EVENT_ID="90">
<action ID="3007">
<!-- AcDEFAULT -->
</action>
</transition>
</state>
<state NAME="CheckNumberPickedVesselsSmaller2" ID="12" X_POS="259" Y_POS="707" WIDTH="188" HEIGHT="50">
<transition NAME="yes" NEXT_STATE_ID="8" EVENT_ID="1004" />
<transition NAME="no" NEXT_STATE_ID="11" EVENT_ID="1003">
<action ID="69">
<!-- AcSELECTSUBOBJECT -->
</action>
</transition>
</state>
<state NAME="CheckBarrierStatus" ID="13" X_POS="8" Y_POS="318" WIDTH="100" HEIGHT="50">
<transition NAME="yes" NEXT_STATE_ID="3" EVENT_ID="1004" />
<transition NAME="no" NEXT_STATE_ID="8" EVENT_ID="1003" />
</state>
<state NAME="CheckBarrierStatus" ID="14" X_POS="557" Y_POS="510" WIDTH="100" HEIGHT="50">
<transition NAME="yes" NEXT_STATE_ID="8" EVENT_ID="1004" />
<transition NAME="no" NEXT_STATE_ID="11" EVENT_ID="1003" />
</state>
</stateMachine>
<stateMachine NAME="slices-rotator">
<state NAME="neutral" ID="1" START_STATE="TRUE">
<!-- mouse down: jump to decision state -->
<transition NAME="mouse down" NEXT_STATE_ID="2" EVENT_ID="1">
<action ID="21">
<!-- AcCheckPoint -->
</action>
</transition>
<transition NAME="mouse move" NEXT_STATE_ID="5" EVENT_ID="520">
<action ID="21">
<!-- AcCheckPoint -->
</action>
</transition>
</state>
<state NAME="rotate?" ID="2">
<transition NAME="yes" NEXT_STATE_ID="3" EVENT_ID="1004" />
<transition NAME="no" NEXT_STATE_ID="4" EVENT_ID="1003">
<action ID="92">
<!--AcMove-->
</action>
</transition>
</state>
<state NAME="rotate" ID="3">
<!-- send rotate events -->
<transition NAME="mouse move" NEXT_STATE_ID="3" EVENT_ID="530">
<action ID="1005">
<!--AcRotate-->
</action>
</transition>
<transition NAME="mouse release" NEXT_STATE_ID="1" EVENT_ID="505">
<action ID="1010">
<!--AcRotateEnd-->
</action>
</transition>
</state>
<state NAME="move" ID="4">
<!-- send move events -->
<transition NAME="mouse move" NEXT_STATE_ID="4" EVENT_ID="530">
<action ID="92">
<!--AcMove-->
</action>
</transition>
<transition NAME="mouse release" NEXT_STATE_ID="1" EVENT_ID="505" />
</state>
<state NAME="rotation possible?" ID="5">
<transition NAME="yes" NEXT_STATE_ID="6" EVENT_ID="1004">
<action ID="1004">
<!--AcRotateStart-->
</action>
</transition>
<transition NAME="no" NEXT_STATE_ID="1" EVENT_ID="1003" />
</state>
<state NAME="rotation possible!" ID="6">
<!-- mouse down: jump to decision state -->
<transition NAME="mouse down" NEXT_STATE_ID="2" EVENT_ID="1">
<action ID="21">
<!-- AcCheckPoint -->
</action>
</transition>
<transition NAME="mouse move" NEXT_STATE_ID="7" EVENT_ID="520">
<action ID="21">
<!-- AcCheckPoint -->
</action>
</transition>
</state>
<state NAME="rotation possible?" ID="7">
<transition NAME="yes" NEXT_STATE_ID="6" EVENT_ID="1004" />
<transition NAME="no" NEXT_STATE_ID="1" EVENT_ID="1003">
<action ID="1010">
<!--AcRotateEnd-->
</action>
</transition>
</state>
</stateMachine>
<stateMachine NAME="dummy">
<!-- Dummy for a null interaction -->
<state NAME="neutral" ID="0" START_STATE="TRUE">
<transition NAME="stay in dummy" NEXT_STATE_ID="0" EVENT_ID="0" />
</state>
</stateMachine>
<stateMachine NAME="SpaceNavigatorInteraction">
<state NAME="neutral" ID="1" START_STATE="TRUE">
<transition NAME="stay in dummy" NEXT_STATE_ID="1" EVENT_ID="4001">
<action ID="4001" />
<!--AcONTDMOUSEINPUT-->
</transition>
<transition NAME="stay with button down" NEXT_STATE_ID="1" EVENT_ID="4002">
<action ID="4002" />
<!--AcONTDMOUSEKEYDOWN-->
</transition>
</state>
</stateMachine>
<stateMachine NAME="WiiMoteHeadtracking">
<state NAME="headtracking" ID="1" START_STATE="TRUE">
<transition NAME="startState" NEXT_STATE_ID="1" EVENT_ID="4003"> <!--EIDWIIMOTEINPUT-->
<action ID="4003" />
<!--AcONWIIMOTEINPUT-->
</transition>
<transition NAME="buttonState" NEXT_STATE_ID="1" EVENT_ID="4004"> <!--EIDWIIMOTEBUTTON-->
<action ID="4004" />
<!--AcRESETVIEW-->
</transition>
<transition NAME="initCalibration" NEXT_STATE_ID="2" EVENT_ID="5551001"> <!--EV_INIT-->
<action ID="55500010" />
<!--AC_INIT-->
</transition>
</state>
<state NAME="calibration" ID="2">
<transition NAME="collectIRData" NEXT_STATE_ID="2" EVENT_ID="4003"> <!--EIDWIIMOTEINPUT-->
<action ID="21" />
<!--AcCHECKPOINT-->
</transition>
<transition NAME="endCalibration" NEXT_STATE_ID="1" EVENT_ID="5551001"> <!--EV_INIT-->
<action ID="44" />
<!--AcFINISH-->
</transition>
</state>
</stateMachine>
<stateMachine NAME="WiiMoteSurfaceInteraction">
<state NAME="start" ID="1" START_STATE="TRUE">
<transition NAME="initial state" NEXT_STATE_ID="2" EVENT_ID="4005"/> <!--EIDWIIMOTEBUTTONB-->
<transition NAME="reset object" NEXT_STATE_ID = "1" EVENT_ID = "4004"> <!--EIDWIIMOTEBUTTON-->
<action ID = "4004" />
<!--AcRESETVIEW-->
</transition>
</state>
<state NAME="Surface Interaction" ID="2">
<transition NAME="stop Surface Interaction" NEXT_STATE_ID="1" EVENT_ID="5551008"> <!--EV_DONE-->
<action ID="4005">
<!-- AcONWIIMOTEBUTTONRELEASED -->
</action>
</transition>
<transition NAME="Input for Surface Interaction" NEXT_STATE_ID="2" EVENT_ID="4003"> <!--EIDWIIMOTEINPUT-->
<action ID="4003">
<!--AcONWIIMOTEINPUT-->
</action>
</transition>
</state>
</stateMachine>
<stateMachine NAME="InteractorTestPattern">
<!-- To Test an Interactor for the right behavior -->
<state NAME="neutral" ID="0" START_STATE="TRUE">
<transition NAME="to1" NEXT_STATE_ID="1" EVENT_ID="4">
<action ID="1101" />
<!--AcMODESELECT-->
</transition>
<transition NAME="to2" NEXT_STATE_ID="2" EVENT_ID="2">
<action ID="1011" />
<!--AcMODESELECT-->
</transition>
</state>
<state NAME="State1" ID="1">
<transition NAME="StayIn1" NEXT_STATE_ID="1" EVENT_ID="533" />
<transition NAME="to0" NEXT_STATE_ID="0" EVENT_ID="506">
<action ID="1100" />
<!--AcMODEDESELECT-->
</transition>
</state>
<state NAME="State2" ID="2">
<transition NAME="StayIn2" NEXT_STATE_ID="2" EVENT_ID="531" />
<transition NAME="finish" NEXT_STATE_ID="0" EVENT_ID="507">
<action ID="1100" />
<!--AcMODEDESELECT-->
</transition>
</state>
</stateMachine>
<stateMachine NAME="shapemodelpointsetinteractor">
<state NAME="Interaction Activated, no point loaded yet" ID="1" START_STATE="TRUE" X_POS="457" Y_POS="506" WIDTH="226" HEIGHT="56">
<transition NAME="SetStateMachineOnDeselected" EVENT_ID="1031" NEXT_STATE_ID="1">
<action ID="1100" />
</transition>
<transition NAME="SetStateMachineOnSelected" EVENT_ID="1030" NEXT_STATE_ID="1">
<action ID="1101" />
</transition>
<transition NAME="Add Point" EVENT_ID="3" NEXT_STATE_ID="2">
<action ID="10" />
</transition>
</state>
<state NAME="One Point" ID="2" X_POS="567" Y_POS="145" WIDTH="100" HEIGHT="50">
<transition NAME="Move Point" EVENT_ID="3" NEXT_STATE_ID="2">
<action ID="103" />
<action ID="10" />
</transition>
<transition NAME="Remove Point" EVENT_ID="12" NEXT_STATE_ID="1">
<action ID="100" />
</transition>
<transition NAME="Check if point is hit by mouse click" EVENT_ID="1" NEXT_STATE_ID="3">
<action ID="30" />
</transition>
<transition NAME="name" EVENT_ID="14" NEXT_STATE_ID="2">
<action ID="72" />
<action ID="1100" />
</transition>
</state>
<state NAME="CheckPoint" ID="3" X_POS="64" Y_POS="52" WIDTH="100" HEIGHT="50">
<transition NAME="Point not hit" EVENT_ID="1003" NEXT_STATE_ID="2">
<action ID="72" />
<action ID="1100" />
</transition>
<transition NAME="Point is hit, check if is selected or not" EVENT_ID="1004" NEXT_STATE_ID="5">
<action ID="34" />
<action ID="1101" />
</transition>
</state>
<state NAME="PointMove" ID="4" X_POS="278" Y_POS="422" WIDTH="100" HEIGHT="50">
<transition NAME="Adjust the Mesh according to point move" EVENT_ID="505" NEXT_STATE_ID="2">
<action ID="42" />
</transition>
<transition NAME="name" EVENT_ID="530" NEXT_STATE_ID="4">
<action ID="1236" />
<action ID="91" />
<action ID="1234" />
</transition>
<transition NAME="name" EVENT_ID="1" NEXT_STATE_ID="4">
<action ID="8" />
</transition>
</state>
<state NAME="Already Selected?" ID="5" X_POS="187" Y_POS="247" WIDTH="100" HEIGHT="50">
<transition NAME="Initialize Movement" EVENT_ID="1004" NEXT_STATE_ID="4">
<action ID="8" />
<action ID="1235" />
</transition>
<transition NAME="name" EVENT_ID="1003" NEXT_STATE_ID="2">
<action ID="60" />
</transition>
</state>
</stateMachine>
<stateMachine NAME="singlepointinteractor">
<!-- Behaviour of one point. This single point can be set, selected and then moved and removed. A setting of a new point will delete the old one.-->
<state NAME="no point or loaded point not selected" ID="1" START_STATE="TRUE" X_POS="18" Y_POS="336" WIDTH="197" HEIGHT="50">
<transition NAME="SetThisStatemachineOnSelected" NEXT_STATE_ID="1" EVENT_ID="1030">
<action ID="1101">
<!--AcMODE_SELECT-->
</action>
</transition>
<transition NAME="SetThisStatemachineOnDeselected" NEXT_STATE_ID="1" EVENT_ID="1031">
<action ID="1100">
<!--AcMODE_DESELECT-->
</action>
</transition>
<transition NAME="addPoint but check n" NEXT_STATE_ID="42" EVENT_ID="3">
<action ID="1101">
<!--AcMODE_SELECT-->
</action>
<action ID="103" />
<action ID="10" />
</transition>
<transition NAME="name" EVENT_ID="1" NEXT_STATE_ID="43">
<action ID="30" />
</transition>
</state>
<state NAME="picked" ID="20" X_POS="693" Y_POS="587" WIDTH="100" HEIGHT="50">
<transition NAME="StNO" NEXT_STATE_ID="1" EVENT_ID="1003">
<action ID="72">
<!--AcDESELECTALL-->
</action>
<action ID="1100">
<!--AcMODEDESELECT-->
</action>
</transition>
<transition NAME="StYes" NEXT_STATE_ID="22" EVENT_ID="1004">
<action ID="8">
<!--AcINITMOVEMENT-->
</action>
<action ID="1101" />
</transition>
</state>
<state NAME="move point" ID="22" X_POS="1135" Y_POS="449" WIDTH="100" HEIGHT="50">
<!-- since the MouseMove Event is send by QT we don't have the information about the position of the point in the list. we had it before, when we checked, if it was picked, or if it was selected -->
<transition NAME="move point" NEXT_STATE_ID="22" EVENT_ID="530">
<action ID="91" />
</transition>
<transition NAME="Safety init" NEXT_STATE_ID="22" EVENT_ID="1">
<action ID="8" />
</transition>
<transition NAME="finish move" NEXT_STATE_ID="42" EVENT_ID="505">
<action ID="42" />
</transition>
</state>
<state NAME="point selected" ID="42" X_POS="674" Y_POS="341" WIDTH="100" HEIGHT="50">
<transition NAME="Select or move point FULL" NEXT_STATE_ID="20" EVENT_ID="1">
<action ID="30">
<!--AcCHECKELEMENT-->
</action>
</transition>
<transition NAME="StYes" NEXT_STATE_ID="1" EVENT_ID="12">
<action ID="100" />
<action ID="1100">
<!--AcMODEDESELECT-->
</action>
</transition>
<transition NAME="name" EVENT_ID="3" NEXT_STATE_ID="42">
<action ID="103" />
<action ID="10" />
</transition>
</state>
<state NAME="picked not yet selected" ID="43" X_POS="681" Y_POS="158" WIDTH="126" HEIGHT="50">
<transition NAME="name" EVENT_ID="1004" NEXT_STATE_ID="42">
<action ID="60" />
</transition>
<transition NAME="name" EVENT_ID="1003" NEXT_STATE_ID="1">
<action ID="72" />
</transition>
</state>
</stateMachine>
<stateMachine NAME="moveNzoom">
<state NAME="neutral" ID="0" START_STATE="TRUE" X_POS="288" Y_POS="81" WIDTH="100" HEIGHT="50">
<transition NAME="initmove" NEXT_STATE_ID="1" EVENT_ID="4">
<action ID="9" />
</transition>
<transition NAME="initzoom" NEXT_STATE_ID="2" EVENT_ID="2">
<action ID="1011" />
</transition>
</state>
<state NAME="move" ID="1" X_POS="170" Y_POS="413" WIDTH="100" HEIGHT="50">
<transition NAME="move" NEXT_STATE_ID="1" EVENT_ID="533">
<action ID="92" />
</transition>
<transition NAME="finish" NEXT_STATE_ID="0" EVENT_ID="506">
<action ID="43" />
</transition>
</state>
<state NAME="zoom" ID="2" X_POS="584" Y_POS="432" WIDTH="100" HEIGHT="50">
<transition NAME="zoom" NEXT_STATE_ID="2" EVENT_ID="531">
<action ID="1012" />
</transition>
<transition NAME="finish" NEXT_STATE_ID="0" EVENT_ID="507" />
</state>
</stateMachine>
<stateMachine NAME="OnePointDoubleClickInteraction">
<state NAME="empty" ID="0" START_STATE="TRUE">
<transition NAME="doubleclick" NEXT_STATE_ID="1" EVENT_ID="8">
<action ID="10" />
</transition>
<transition NAME="delete" NEXT_STATE_ID="0" EVENT_ID="12">
<action ID="103" />
</transition>
</state>
<state NAME="point available" ID="1">
<transition NAME="doubleclick" NEXT_STATE_ID="1" EVENT_ID="8">
<action ID="103" />
<action ID="10" />
</transition>
<transition NAME="delete" NEXT_STATE_ID="0" EVENT_ID="12">
<action ID="103" />
</transition>
</state>
</stateMachine>
<stateMachine NAME="OnePointMouseMoveInteraction">
<state NAME="empty" ID="0" START_STATE="TRUE">
<transition NAME="mousemove" NEXT_STATE_ID="1" EVENT_ID="520">
<action ID="1101" />
<!--AcMODE_SELECT-->
<action ID="10" />
<!-- Add Point -->
</transition>
<transition NAME="mousewheelmove" NEXT_STATE_ID="1" EVENT_ID="9">
<action ID="1101" />
<!--AcMODE_SELECT-->
<action ID="10" />
<!-- Add Point -->
</transition>
<transition NAME="deleteSafety" NEXT_STATE_ID="0" EVENT_ID="12">
<action ID="103" />
<!-- Remove Point -->
<action ID="1100" />
<!--AcMODEDESELECT-->
</transition>
</state>
<state NAME="point available" ID="1">
<transition NAME="mousemove" NEXT_STATE_ID="1" EVENT_ID="520">
<action ID="1101" />
<!--AcMODE_SELECT-->
<action ID="103" />
<!-- Remove Point -->
<action ID="10" />
<!-- Add Point -->
</transition>
<transition NAME="mousewheelmove" NEXT_STATE_ID="1" EVENT_ID="9">
<action ID="1101" />
<!--AcMODE_SELECT-->
<action ID="103" />
<!-- Remove Point -->
<action ID="10" />
<!-- Add Point -->
</transition>
<transition NAME="delete" NEXT_STATE_ID="0" EVENT_ID="12">
<action ID="103" />
<!-- Remove Point -->
<action ID="1100" />
<!--AcMODEDESELECT-->
</transition>
</state>
</stateMachine>
<stateMachine NAME="CurveModelInteractor">
<!-- Behaviour of a set of Points. a defined number of points can be set/removed/selected/deselectd/moved -->
<state NAME="Start" ID="42" START_STATE="TRUE" X_POS="918" Y_POS="441" WIDTH="100" HEIGHT="50">
<transition NAME="name" EVENT_ID="1" NEXT_STATE_ID="43">
<action ID="21" />
</transition>
</state>
<state NAME="IsPointSelected" ID="43" X_POS="470" Y_POS="441" WIDTH="100" HEIGHT="50">
<transition NAME="name" EVENT_ID="1003" NEXT_STATE_ID="42">
<action ID="72" />
</transition>
<transition NAME="name" EVENT_ID="1004" NEXT_STATE_ID="44" />
</state>
<state NAME="PointSelected" ID="44" X_POS="690" Y_POS="204" WIDTH="100" HEIGHT="50">
<transition NAME="name" EVENT_ID="530" NEXT_STATE_ID="44">
<action ID="91" />
</transition>
<transition NAME="name" EVENT_ID="505" NEXT_STATE_ID="42">
<action ID="43" />
</transition>
</state>
</stateMachine>
<stateMachine NAME="singlepointinteractorwithoutshiftclick">
<!-- Behaviour of one point. This single point can be set, selected and then moved and removed. A setting of a new point will delete the old one.-->
<state NAME="no point or loaded point not selected" ID="1" START_STATE="TRUE" X_POS="18" Y_POS="336" WIDTH="197" HEIGHT="50">
<transition NAME="SetThisStatemachineOnSelected" NEXT_STATE_ID="1" EVENT_ID="1030">
<action ID="1101">
<!--AcMODE_SELECT-->
</action>
</transition>
<transition NAME="SetThisStatemachineOnDeselected" NEXT_STATE_ID="1" EVENT_ID="1031">
<action ID="1100">
<!--AcMODE_DESELECT-->
</action>
</transition>
<transition NAME="addPoint" NEXT_STATE_ID="2" EVENT_ID="1">
<action ID="1101" />
<!--AcMODE_SELECT-->
<action ID="103" />
<!--AcREMOVEALL-->
<action ID="10" />
<!--AcADDPOINT-->
</transition>
</state>
<state NAME="point selected" ID="2" X_POS="674" Y_POS="341" WIDTH="100" HEIGHT="50">
<transition NAME="delete point" NEXT_STATE_ID="1" EVENT_ID="12">
<action ID="100" />
<!--AcREMOVEPOINT-->
<action ID="1100">
<!--AcMODEDESELECT-->
</action>
</transition>
<transition NAME="set point" NEXT_STATE_ID="2" EVENT_ID="1" >
<action ID="103" />
<!--AcREMOVEALL-->
<action ID="10" />
<!--AcADDPOINT-->
</transition>
</state>
</stateMachine>
<stateMachine NAME="SeedpointCorrection">
<state NAME="position check" ID="0" START_STATE="TRUE" X_POS="18" Y_POS="336" WIDTH="197" HEIGHT="50">
<transition NAME="nothing found" NEXT_STATE_ID="0" EVENT_ID="1003">
<action ID="48008" />
</transition>
<transition NAME="inside" NEXT_STATE_ID="1" EVENT_ID="1004">
<action ID="31" />
<transition NAME="check position" NEXT_STATE_ID="0" EVENT_ID="520">
<action ID="5000" />
</transition>
<transition NAME="check position 2" NEXT_STATE_ID="0" EVENT_ID="530">
<action ID="5000" />
</transition>
<transition NAME="change BoundingBox" NEXT_STATE_ID="3" EVENT_ID="1013">
<action ID="65" />
</transition>
</transition>
</state>
<state NAME="edit seedpoints" ID="1" X_POS="18" Y_POS="336" WIDTH="197" HEIGHT="50">
<transition NAME="back to start" NEXT_STATE_ID="0" EVENT_ID="520">
<action ID="12" />
</transition>
<transition NAME="initialize correction" NEXT_STATE_ID="2" EVENT_ID="530">
<action ID="5001" />
</transition>
</state>
<state NAME="correct segmentation" ID="2" X_POS="18" Y_POS="336" WIDTH="197" HEIGHT="50">
<transition NAME="draw contour" NEXT_STATE_ID="2" EVENT_ID="530">
<action ID="92" />
</transition>
<transition NAME="calculate result" NEXT_STATE_ID="0" EVENT_ID="505">
<action ID="5002" />
</transition>
</state>
<state NAME="init BoundingBox Resizing" ID="3" X_POS="18" Y_POS="336" WIDTH="197" HEIGHT="50">
<transition NAME="back to start 2" NEXT_STATE_ID="0" EVENT_ID="520">
<action ID="5000" />
</transition>
<transition NAME="add boundingboxinteractor" NEXT_STATE_ID="4" EVENT_ID="1">
<action ID="5003" />
</transition>
</state>
<state NAME="BoundingBox Resizing" ID="4" X_POS="18" Y_POS="336" WIDTH="197" HEIGHT="50">
<transition NAME="calculate result 2" NEXT_STATE_ID="0" EVENT_ID="23">
<action ID="5004" />
</transition>
</state>
</stateMachine>
<stateMachine NAME="BoundingBox Interaction">
<state NAME="position check" ID="0" START_STATE="TRUE" X_POS="18" Y_POS="336" WIDTH="197" HEIGHT="50">
<transition NAME="test" NEXT_STATE_ID="1" EVENT_ID="1">
<action ID="5000" />
</transition>
<transition NAME="test" NEXT_STATE_ID="3" EVENT_ID="520">
<action ID="5000" />
</transition>
</state>
<state NAME="boundingbox resizing initialization" ID="1" X_POS="18" Y_POS="336" WIDTH="197" HEIGHT="50">
<transition NAME="nothing found" NEXT_STATE_ID="0" EVENT_ID="1003">
<action ID="47" />
</transition>
<transition NAME="something found" NEXT_STATE_ID="2" EVENT_ID="1004">
<action ID="94" />
<action ID="110" />
</transition>
</state>
<state NAME="teststate" ID="2" X_POS="18" Y_POS="336" WIDTH="197" HEIGHT="50">
<transition NAME="test 2" NEXT_STATE_ID="2" EVENT_ID="530">
<action ID="11" />
</transition>
<transition NAME="test 3" NEXT_STATE_ID="0" EVENT_ID="505">
<action ID="5" />
</transition>
<transition NAME="test 9" NEXT_STATE_ID="4" EVENT_ID="1003">
<action ID="0" />
</transition>
</state>
<state NAME="teststate 2" ID="3" X_POS="18" Y_POS="336" WIDTH="197" HEIGHT="50">
<transition NAME="test 4" NEXT_STATE_ID="3" EVENT_ID="1004">
<action ID="94" />
</transition>
<transition NAME="test 5" NEXT_STATE_ID="0" EVENT_ID="520">
<action ID="5000" />
</transition>
<transition NAME="test 6" NEXT_STATE_ID="0" EVENT_ID="1003">
<action ID="47" />
</transition>
<transition NAME="test 7" NEXT_STATE_ID="1" EVENT_ID="1">
<action ID="5000" />
</transition>
</state>
<state NAME="teststate 2" ID="4" X_POS="18" Y_POS="336" WIDTH="197" HEIGHT="50">
<transition NAME="test 8" NEXT_STATE_ID="4" EVENT_ID="530">
<action ID="0" />
</transition>
<transition NAME="test 9" NEXT_STATE_ID="0" EVENT_ID="505">
<action ID="0" />
</transition>
</state>
</stateMachine>
<stateMachine NAME="ToolWithWheelInteraction">
<state NAME="ToolIdle" ID="1" START_STATE="TRUE" X_POS="167" Y_POS="365" WIDTH="100" HEIGHT="50">
<transition NAME="MouseWheel" EVENT_ID="9" NEXT_STATE_ID="1">
<action ID="105" />
</transition>
<transition NAME="send Koordinates press" NEXT_STATE_ID="2" EVENT_ID="1">
<action ID="80" />
</transition>
<transition NAME="MouseMove" EVENT_ID="520" NEXT_STATE_ID="1">
<action ID="92" />
</transition>
<transition NAME="name" EVENT_ID="26" NEXT_STATE_ID="1">
<action ID="106" />
</transition>
<transition NAME="name" EVENT_ID="27" NEXT_STATE_ID="1">
<action ID="107" />
</transition>
</state>
<state NAME="ToolInUse" ID="2" X_POS="511" Y_POS="372" WIDTH="100" HEIGHT="50">
<transition NAME="send Koordinates move" NEXT_STATE_ID="2" EVENT_ID="530">
<action ID="90" />
</transition>
<transition NAME="send Koordinates release" NEXT_STATE_ID="1" EVENT_ID="505">
<action ID="42" />
</transition>
<transition NAME="MouseWheel" EVENT_ID="9" NEXT_STATE_ID="2">
<action ID="105" />
</transition>
<transition NAME="name" EVENT_ID="26" NEXT_STATE_ID="2">
<action ID="106" />
</transition>
<transition NAME="name" EVENT_ID="27" NEXT_STATE_ID="2">
<action ID="107" />
</transition>
</state>
</stateMachine>
<stateMachine NAME="AffineInteractor3D">
<state NAME="Start" ID="1" START_STATE="TRUE" X_POS="65" Y_POS="267" WIDTH="100" HEIGHT="50">
<transition NAME="name" EVENT_ID="520" NEXT_STATE_ID="2">
<action ID="31" />
</transition>
</state>
<state NAME="IsOverObject" ID="2" X_POS="352" Y_POS="267" WIDTH="100" HEIGHT="50">
<transition NAME="name" EVENT_ID="1003" NEXT_STATE_ID="1">
<action ID="70" />
</transition>
<transition NAME="name" EVENT_ID="1004" NEXT_STATE_ID="3">
<action ID="60" />
</transition>
<transition NAME="name" EVENT_ID="9" NEXT_STATE_ID="2">
<action ID="49014" />
</transition>
</state>
<state NAME="ObjectSelected" ID="3" X_POS="719" Y_POS="268" WIDTH="100" HEIGHT="50">
<transition NAME="name" EVENT_ID="520" NEXT_STATE_ID="2">
<action ID="31" />
</transition>
<transition NAME="name" EVENT_ID="1" NEXT_STATE_ID="4">
<action ID="9" />
</transition>
<transition NAME="name" EVENT_ID="9" NEXT_STATE_ID="3">
<action ID="49014" />
</transition>
</state>
<state NAME="ObjectInteraction" ID="4" X_POS="598" Y_POS="629" WIDTH="100" HEIGHT="50">
<transition NAME="name" EVENT_ID="530" NEXT_STATE_ID="4">
<action ID="92" />
</transition>
<transition NAME="name" EVENT_ID="505" NEXT_STATE_ID="2">
<action ID="31" />
</transition>
<transition NAME="name" EVENT_ID="521" NEXT_STATE_ID="4">
<action ID="49014" />
<action ID="92" />
</transition>
</state>
</stateMachine>
<stateMachine NAME="Zoom">
<state NAME="neutral" ID="0" START_STATE="TRUE" X_POS="288" Y_POS="81" WIDTH="100" HEIGHT="50">
<transition NAME="initzoom" NEXT_STATE_ID="2" EVENT_ID="1">
<action ID="1011" />
</transition>
</state>
<state NAME="zoom" ID="2" X_POS="584" Y_POS="432" WIDTH="100" HEIGHT="50">
<transition NAME="zoom" NEXT_STATE_ID="2" EVENT_ID="530">
<action ID="1012" />
</transition>
<transition NAME="finish" NEXT_STATE_ID="0" EVENT_ID="505" />
</state>
</stateMachine>
<stateMachine NAME="CtrlZoom">
<state NAME="neutral" ID="0" START_STATE="TRUE" X_POS="288" Y_POS="81" WIDTH="100" HEIGHT="50">
<transition NAME="initzoom" NEXT_STATE_ID="1" EVENT_ID="7">
<action ID="1011" />
</transition>
</state>
<state NAME="zoom" ID="1" X_POS="584" Y_POS="432" WIDTH="100" HEIGHT="50">
<transition NAME="CtrlZoom" NEXT_STATE_ID="1" EVENT_ID="535">
<action ID="1012" />
</transition>
<transition NAME="finish" NEXT_STATE_ID="0" EVENT_ID="538" />
</state>
</stateMachine>
<stateMachine NAME="LeftClickScroll">
<state NAME="neutral" ID="0" START_STATE="TRUE" X_POS="288" Y_POS="81" WIDTH="100" HEIGHT="50">
<transition NAME="initmove" NEXT_STATE_ID="1" EVENT_ID="1">
<action ID="9" />
</transition>
</state>
<state NAME="scroll" ID="1" X_POS="170" Y_POS="413" WIDTH="100" HEIGHT="50">
<transition NAME="scroll" NEXT_STATE_ID="1" EVENT_ID="530">
<action ID="1013" />
</transition>
<transition NAME="finish" NEXT_STATE_ID="0" EVENT_ID="505">
<action ID="43" />
</transition>
</state>
</stateMachine>
<stateMachine NAME="MiddleClickScroll">
<state NAME="neutral" ID="0" START_STATE="TRUE" X_POS="288" Y_POS="81" WIDTH="100" HEIGHT="50">
<transition NAME="initmove" NEXT_STATE_ID="1" EVENT_ID="4">
<action ID="9" />
</transition>
</state>
<state NAME="scroll" ID="1" X_POS="170" Y_POS="413" WIDTH="100" HEIGHT="50">
<transition NAME="scroll" NEXT_STATE_ID="1" EVENT_ID="533">
<action ID="1013" />
</transition>
<transition NAME="finish" NEXT_STATE_ID="0" EVENT_ID="506">
<action ID="43" />
</transition>
</state>
</stateMachine>
<stateMachine NAME="Pan">
<state NAME="neutral" ID="0" START_STATE="TRUE" X_POS="288" Y_POS="81" WIDTH="100" HEIGHT="50">
<transition NAME="initmove" NEXT_STATE_ID="1" EVENT_ID="1">
<action ID="9" />
</transition>
</state>
<state NAME="move" ID="1" X_POS="170" Y_POS="413" WIDTH="100" HEIGHT="50">
<transition NAME="move" NEXT_STATE_ID="1" EVENT_ID="530">
<action ID="92" />
</transition>
<transition NAME="finish" NEXT_STATE_ID="0" EVENT_ID="505">
<action ID="43" />
</transition>
</state>
</stateMachine>
<stateMachine NAME="ShiftClickPan">
<state NAME="neutral" ID="0" START_STATE="TRUE" X_POS="288" Y_POS="81" WIDTH="100" HEIGHT="50">
<transition NAME="initshiftmove" NEXT_STATE_ID="1" EVENT_ID="2000">
<action ID="9" />
</transition>
</state>
<state NAME="shiftmove" ID="1" X_POS="170" Y_POS="413" WIDTH="100" HEIGHT="50">
<transition NAME="shiftmove" NEXT_STATE_ID="1" EVENT_ID="2001">
<action ID="92" />
</transition>
<transition NAME="finish" NEXT_STATE_ID="0" EVENT_ID="2002">
<action ID="43" />
</transition>
</state>
</stateMachine>
<stateMachine NAME="RightClickLevelWindow">
<state NAME="neutral" ID="0" START_STATE="TRUE" X_POS="288" Y_POS="81" WIDTH="100" HEIGHT="50">
<transition NAME="initmove" NEXT_STATE_ID="1" EVENT_ID="2">
<action ID="9" />
</transition>
</state>
<state NAME="levelwindow" ID="1" X_POS="584" Y_POS="432" WIDTH="100" HEIGHT="50">
<transition NAME="levelwindow" NEXT_STATE_ID="1" EVENT_ID="531">
<action ID="1014" />
</transition>
<transition NAME="finish" NEXT_STATE_ID="0" EVENT_ID="507" />
</state>
</stateMachine>
<stateMachine NAME="LeftClickLevelWindow">
<state NAME="neutral" ID="0" START_STATE="TRUE" X_POS="288" Y_POS="81" WIDTH="100" HEIGHT="50">
<transition NAME="initmove" NEXT_STATE_ID="1" EVENT_ID="1">
<action ID="9" />
</transition>
</state>
<state NAME="levelwindow" ID="1" X_POS="584" Y_POS="432" WIDTH="100" HEIGHT="50">
<transition NAME="levelwindow" NEXT_STATE_ID="1" EVENT_ID="530">
<action ID="1014" />
</transition>
<transition NAME="finish" NEXT_STATE_ID="0" EVENT_ID="505" />
</state>
</stateMachine>
<stateMachine NAME="BinaryImageInteractor">
<state NAME="neutral" ID="1" START_STATE="TRUE" X_POS="138" Y_POS="318" WIDTH="100" HEIGHT="50">
<transition NAME="name" EVENT_ID="520" NEXT_STATE_ID="2">
<action ID="30" />
</transition>
</state>
<state NAME="IsOverImage" ID="2" X_POS="447" Y_POS="185" WIDTH="100" HEIGHT="50">
<transition NAME="name" EVENT_ID="1003" NEXT_STATE_ID="1" />
<transition NAME="isOverImage" EVENT_ID="1004" NEXT_STATE_ID="3" />
</state>
<state NAME="PickImage" ID="3" X_POS="803" Y_POS="350" WIDTH="100" HEIGHT="50">
<transition NAME="SelectingImage" EVENT_ID="1" NEXT_STATE_ID="4">
<action ID="60" />
</transition>
<transition NAME="name" EVENT_ID="520" NEXT_STATE_ID="2">
<action ID="30" />
</transition>
</state>
<state NAME="SelectImage" ID="4" X_POS="594" Y_POS="542" WIDTH="100" HEIGHT="50">
<transition NAME="name" EVENT_ID="505" NEXT_STATE_ID="2">
<action ID="30" />
</transition>
</state>
</stateMachine>
<stateMachine NAME="PlanarFigureInteractor">
<!-- Behaviour of a set of Points. a defined number of points can be set/removed/selected/deselectd/moved -->
<state NAME="Start" ID="42" START_STATE="TRUE" X_POS="1368" Y_POS="736" WIDTH="100" HEIGHT="50">
<transition NAME="name" EVENT_ID="0" NEXT_STATE_ID="49">
<action ID="31" />
</transition>
</state>
<state NAME="FigurePlaced" ID="45" X_POS="836" Y_POS="715" WIDTH="100" HEIGHT="50">
<transition NAME="name" EVENT_ID="520" NEXT_STATE_ID="45">
<action ID="90" />
</transition>
<transition NAME="name" EVENT_ID="8" NEXT_STATE_ID="54">
<action ID="33" />
</transition>
<transition NAME="name" EVENT_ID="530" NEXT_STATE_ID="57">
<action ID="90" />
</transition>
<transition NAME="name" EVENT_ID="1" NEXT_STATE_ID="58">
<action ID="21" />
</transition>
</state>
<state NAME="ControlPointSelected" ID="47" X_POS="74" Y_POS="665" WIDTH="128" HEIGHT="50">
<transition NAME="name" EVENT_ID="530" NEXT_STATE_ID="47">
<action ID="90" />
</transition>
<transition NAME="name" EVENT_ID="505" NEXT_STATE_ID="52">
<action ID="76" />
</transition>
</state>
<state NAME="IsLastControlPoint" ID="48" X_POS="1102" Y_POS="732" WIDTH="100" HEIGHT="50">
<transition NAME="name" EVENT_ID="1004" NEXT_STATE_ID="42" />
<transition NAME="name" EVENT_ID="1003" NEXT_STATE_ID="45">
<action ID="10" />
</transition>
</state>
<state NAME="IsPlaced" ID="49" X_POS="1302" Y_POS="201" WIDTH="100" HEIGHT="50">
<transition NAME="name" EVENT_ID="1003" NEXT_STATE_ID="50" />
<transition NAME="name" EVENT_ID="1004" NEXT_STATE_ID="51" />
</state>
<state NAME="PlaceFigure" ID="50" X_POS="868" Y_POS="293" WIDTH="100" HEIGHT="50">
<transition NAME="name" EVENT_ID="1" NEXT_STATE_ID="45">
<action ID="11" />
</transition>
</state>
<state NAME="EditFigure" ID="51" X_POS="804" Y_POS="199" WIDTH="100" HEIGHT="50">
<transition NAME="name" EVENT_ID="520" NEXT_STATE_ID="52">
<action ID="341" />
</transition>
</state>
<state NAME="IsOverFigure" ID="52" X_POS="340" Y_POS="170" WIDTH="100" HEIGHT="50">
<transition NAME="name" EVENT_ID="1003" NEXT_STATE_ID="51" />
<transition NAME="name" EVENT_ID="1004" NEXT_STATE_ID="53" />
</state>
<state NAME="FigureHover" ID="53" X_POS="563" Y_POS="326" WIDTH="115" HEIGHT="50">
<transition NAME="name" EVENT_ID="520" NEXT_STATE_ID="52">
<action ID="341" />
</transition>
<transition NAME="name" EVENT_ID="2" NEXT_STATE_ID="60">
<action ID="60" />
</transition>
<transition NAME="name" EVENT_ID="1" NEXT_STATE_ID="65">
<action ID="34" />
</transition>
</state>
<state NAME="IsMinFigureFinished" ID="54" X_POS="972" Y_POS="929" WIDTH="110" HEIGHT="50">
<transition NAME="name" EVENT_ID="1004" NEXT_STATE_ID="42" />
<transition NAME="name" EVENT_ID="1003" NEXT_STATE_ID="45" />
</state>
<state NAME="ResetFigure" ID="55" X_POS="610" Y_POS="934" WIDTH="100" HEIGHT="50">
<transition NAME="name" EVENT_ID="1003" NEXT_STATE_ID="47" />
<transition NAME="name" EVENT_ID="1004" NEXT_STATE_ID="45" />
</state>
<state NAME="FigurePlacedByDrag" ID="57" X_POS="1047" Y_POS="391" WIDTH="138" HEIGHT="50">
<transition NAME="name" EVENT_ID="530" NEXT_STATE_ID="57">
<action ID="90" />
</transition>
<transition NAME="name" EVENT_ID="505" NEXT_STATE_ID="58">
<action ID="21" />
</transition>
</state>
<state NAME="IsPointValid" ID="58" X_POS="1212" Y_POS="555" WIDTH="100" HEIGHT="50">
<transition NAME="name" EVENT_ID="1004" NEXT_STATE_ID="48">
<action ID="32" />
</transition>
<transition NAME="name" EVENT_ID="1003" NEXT_STATE_ID="45" />
</state>
<state NAME="FigureSelectedForDelete" ID="60" X_POS="308" Y_POS="532" WIDTH="132" HEIGHT="50">
<transition NAME="name" EVENT_ID="1004" NEXT_STATE_ID="52">
<action ID="100" />
</transition>
<transition NAME="name" EVENT_ID="1003" NEXT_STATE_ID="53" />
</state>
<state NAME="IsOverControlPoint" ID="59" X_POS="586" Y_POS="636" WIDTH="120" HEIGHT="50">
<transition NAME="name" EVENT_ID="1004" NEXT_STATE_ID="55">
<action ID="66" />
</transition>
<transition NAME="name" EVENT_ID="1003" NEXT_STATE_ID="47">
<action ID="10" />
</transition>
</state>
<state NAME="FigureSeleced" ID="65" X_POS="740" Y_POS="487" WIDTH="100" HEIGHT="50">
<transition NAME="name" EVENT_ID="1003" NEXT_STATE_ID="53" />
<transition NAME="name" EVENT_ID="1004" NEXT_STATE_ID="59">
<action ID="60" />
</transition>
</state>
</stateMachine>
+ <stateMachine NAME="FiberBundleInteractor">
+ <!-- working with mitk::FiberBundles -->
+ <state NAME="Start" ID="123451" START_STATE="TRUE" X_POS="1368" Y_POS="736" WIDTH="100" HEIGHT="50">
+ <transition NAME="name" EVENT_ID="520" NEXT_STATE_ID="123451">
+ <!-- on EIDMOUSEMOVE keep in state and do AcCHECKHOVERING (which throws EIDFIGUREHOVER or EIDNOFIGUREHOVER if applicable) -->
+ <action ID="341" />
+ </transition>
+ <transition NAME="name" EVENT_ID="12340" NEXT_STATE_ID="123452">
+ <!-- on EIDFIGUREHOVER go to HoverFiber and do nothing --> <!-- previously: AcSELECTPICKEDOBJECT -->
+ <action ID="0" />
+ </transition>
+ </state>
+ <state NAME="HoverFiber" ID="123452" X_POS="340" Y_POS="170" WIDTH="100" HEIGHT="50">
+ <transition NAME="name" EVENT_ID="520" NEXT_STATE_ID="123452">
+ <!-- on EIDMOUSEMOVE keep state and do AcCHECKHOVERING (which throws EIDFIGUREHOVER or EIDNOFIGUREHOVER if applicable) -->
+ <action ID="341" />
+ </transition>
+ <transition NAME="name" EVENT_ID="12340" NEXT_STATE_ID="123452">
+ <!-- on EIDFIGUREHOVER keep state and do nothing --> <!-- previously: AcSELECTPICKEDOBJECT -->
+ <action ID="0" />
+ </transition>
+ <transition NAME="name" EVENT_ID="12341" NEXT_STATE_ID="123451">
+ <!-- on EIDNOFIGUREHOVER go to Start and do nothing --> <!-- previously: AcDESELECTALL -->
+ <action ID="0" />
+ </transition>
+ <transition NAME="name" EVENT_ID="1" NEXT_STATE_ID="123452">
+ <!-- on EIDLEFTMOUSEBTN keep state and do AcREMOVE -->
+ <action ID="101" />
+ </transition>
+ </state>
+ </stateMachine>
</mitkInteraktionStates>
<!-- DOCUMENTATION -->
<!-- This is StateMachine.xml. Includes Information about different StateMachines and Events. Used by EventMapper and StateMachineFactory -->
<!-- /** \example StateMachine.xml -->
<!-- -->
<!-- -->
<!-- FAQ -->
<!-- Question: the Application, that is loading this file doesn't act on the Interaction. Why? -->
<!-- The QXMLFileLoader probably isn't able to load the file due to an error.-->
<!-- Check the file for XML-Syntax like "<" at beginning and "/>" at end -->
diff --git a/Core/Code/Interactions/mitkDisplayVectorInteractorScroll.cpp b/Core/Code/Interactions/mitkDisplayVectorInteractorScroll.cpp
index b3840c8ed7..5ba04bdc38 100644
--- a/Core/Code/Interactions/mitkDisplayVectorInteractorScroll.cpp
+++ b/Core/Code/Interactions/mitkDisplayVectorInteractorScroll.cpp
@@ -1,120 +1,148 @@
/*=========================================================================
Program: Medical Imaging & Interaction Toolkit
Language: C++
Date: $Date: 2010-01-14 14:20:26 +0100 (Thu, 14 Jan 2010) $
Version: $Revision: 21047 $
Copyright (c) German Cancer Research Center, Division of Medical and
Biological Informatics. All rights reserved.
See MITKCopyright.txt or http://www.mitk.org/copyright.html for details.
This software is distributed WITHOUT ANY WARRANTY; without even
the implied warranty of MERCHANTABILITY or FITNESS FOR A PARTICULAR
PURPOSE. See the above copyright notices for more information.
=========================================================================*/
#include "mitkDisplayVectorInteractorScroll.h"
#include "mitkOperation.h"
#include "mitkDisplayCoordinateOperation.h"
//#include "mitkDisplayPositionEvent.h"
#include "mitkUndoController.h"
#include "mitkStateEvent.h"
#include "mitkInteractionConst.h"
#include "mitkAction.h"
void mitk::DisplayVectorInteractorScroll::ExecuteOperation(Operation* itkNotUsed( operation ) )
{
}
bool mitk::DisplayVectorInteractorScroll::ExecuteAction(Action* action, mitk::StateEvent const* stateEvent)
{
bool ok=false;
const DisplayPositionEvent* posEvent=dynamic_cast<const DisplayPositionEvent*>(stateEvent->GetEvent());
if(posEvent==NULL) return false;
int actionId = action->GetActionId();
switch(actionId)
{
case AcINITMOVE:
{
m_Sender=posEvent->GetSender();
m_StartDisplayCoordinate=posEvent->GetDisplayPosition();
m_LastDisplayCoordinate=posEvent->GetDisplayPosition();
m_CurrentDisplayCoordinate=posEvent->GetDisplayPosition();
ok = true;
break;
}
case AcSCROLL:
{
mitk::SliceNavigationController::Pointer sliceNaviController = m_Sender->GetSliceNavigationController();
if(sliceNaviController)
{
int delta = m_LastDisplayCoordinate[1]-posEvent->GetDisplayPosition()[1];
- if(delta>1)
+ // if we moved less than 'm_IndexToSliceModifier' pixels slice ONE slice only
+ if ( delta>0 && delta<m_IndexToSliceModifier )
{
- delta=-1;
+ delta=m_IndexToSliceModifier;
}
- else if(delta<-1)
+ else if(delta<0 && delta>-m_IndexToSliceModifier)
{
- delta=1;
+ delta=-m_IndexToSliceModifier;
}
- int newPos = sliceNaviController->GetSlice()->GetPos() + delta;
+ delta /= m_IndexToSliceModifier;
+ int newPos = sliceNaviController->GetSlice()->GetPos() - delta;
+ // if auto repeat is on, start at first slice if you reach the last slice and vice versa
int maxSlices = sliceNaviController->GetSlice()->GetSteps();
-
- while(newPos<0)
+ if ( m_AutoRepeat )
{
- newPos += maxSlices;
+ while(newPos<0)
+ {
+ newPos += maxSlices;
+ }
+
+ while(newPos>=maxSlices)
+ {
+ newPos -= maxSlices;
+ }
}
-
- while(newPos>=maxSlices)
+ else
{
- newPos -= maxSlices;
+ // if the new slice is below 0 we still show slice 0
+ // due to the stepper using unsigned int we have to do this ourselves
+ if ( newPos < 1 )
+ newPos = 0;
}
+ // set the new position
sliceNaviController->GetSlice()->SetPos( newPos );
}
m_LastDisplayCoordinate=m_CurrentDisplayCoordinate;
m_CurrentDisplayCoordinate=posEvent->GetDisplayPosition();
}
case AcFINISHMOVE:
{
ok = true;
break;
}
default:
ok = false;
break;
}
return ok;
}
+void mitk::DisplayVectorInteractorScroll::SetIndexToSliceModifier( int modifier )
+{
+ m_IndexToSliceModifier = modifier;
+}
+
+void mitk::DisplayVectorInteractorScroll::SetAutoRepeat( bool autoRepeat )
+{
+ m_AutoRepeat = autoRepeat;
+}
+
mitk::DisplayVectorInteractorScroll::DisplayVectorInteractorScroll(const char * type, mitk::OperationActor* destination)
- : mitk::StateMachine(type), m_Sender(NULL), m_Destination(destination)
+ : mitk::StateMachine(type)
+ , m_Sender(NULL)
+ , m_Destination(destination)
+ , m_IndexToSliceModifier(4)
+ , m_AutoRepeat( false )
{
m_StartDisplayCoordinate.Fill(0);
m_LastDisplayCoordinate.Fill(0);
m_CurrentDisplayCoordinate.Fill(0);
m_UndoEnabled = false;
//if(m_Destination==NULL)
// m_Destination=this;
}
mitk::DisplayVectorInteractorScroll::~DisplayVectorInteractorScroll()
{
if ( m_Destination != this )
delete m_Destination;
}
+
diff --git a/Core/Code/Interactions/mitkDisplayVectorInteractorScroll.h b/Core/Code/Interactions/mitkDisplayVectorInteractorScroll.h
index 3e934fa49d..2e40770190 100644
--- a/Core/Code/Interactions/mitkDisplayVectorInteractorScroll.h
+++ b/Core/Code/Interactions/mitkDisplayVectorInteractorScroll.h
@@ -1,84 +1,109 @@
/*=========================================================================
Program: Medical Imaging & Interaction Toolkit
Language: C++
Date: $Date: 2009-05-28 17:19:30 +0200 (Thu, 28 May 2009) $
Version: $Revision: 17495 $
Copyright (c) German Cancer Research Center, Division of Medical and
Biological Informatics. All rights reserved.
See MITKCopyright.txt or http://www.mitk.org/copyright.html for details.
This software is distributed WITHOUT ANY WARRANTY; without even
the implied warranty of MERCHANTABILITY or FITNESS FOR A PARTICULAR
PURPOSE. See the above copyright notices for more information.
=========================================================================*/
#ifndef MITKDISPLAYVECTORINTERACTORSCROLL_H_HEADER_INCLUDED_C10DC4EB
#define MITKDISPLAYVECTORINTERACTORSCROLL_H_HEADER_INCLUDED_C10DC4EB
#include "mitkCommon.h"
#include "mitkBaseRenderer.h"
#include "mitkStateMachine.h"
namespace mitk {
class Operation;
class OperationActor;
/**
* @brief Interactor for scrolling through the slices of an image
*
* This class implements an Interactor for slice-scrolling. It is defined by the 'Scroll'-statemachine which maps 'initmove' to left mousebutton pressed,
* 'scroll' to left mousebutton and move and 'finishmove' to left mousebutton released.
*
* Thus it is possible to scroll through the slices of an image rapidly, without using the mousewheel.
*
* @ingroup MITK_CORE_EXPORT
**/
class MITK_CORE_EXPORT DisplayVectorInteractorScroll : public StateMachine
{
public:
mitkClassMacro(DisplayVectorInteractorScroll, StateMachine);
mitkNewMacro2Param(Self, const char*, OperationActor*);
/**
* @brief Method derived from OperationActor to recieve and execute operations
**/
virtual void ExecuteOperation(Operation* operation);
+ /**
+ * \brief Defines how many slices are scrolled per pixel that the mouse cursor has moved
+ */
+ void SetIndexToSliceModifier( int modifier );
+
+ void SetAutoRepeat( bool autoRepeat );
+
protected:
/**
* @brief Default Constructor
**/
DisplayVectorInteractorScroll(const char * type, mitk::OperationActor* destination=NULL);
/**
* @brief Default Destructor
**/
virtual ~DisplayVectorInteractorScroll();
/**
* @brief Method derived from StateMachine to implement the own actions
**/
virtual bool ExecuteAction(Action* action, mitk::StateEvent const* stateEvent);
-
private:
BaseRenderer::Pointer m_Sender;
mitk::Point2D m_StartDisplayCoordinate;
mitk::Point2D m_LastDisplayCoordinate;
mitk::Point2D m_CurrentDisplayCoordinate;
OperationActor* m_Destination;
+
+ /**
+ * \brief Modifier that defines how many slices are scrolled per pixel that the mouse has moved
+ *
+ * This modifier defines how many slices the scene is scrolled per pixel that the mouse cursor has moved.
+ * By default the modifier is 4. This means that when the user moves the cursor by 4 pixels in Y-direction
+ * the scene is scrolled by one slice. If the user has moved the the cursor by 20 pixels, the scene is
+ * scrolled by 5 slices.
+ *
+ * If the cursor has moved less than m_IndexToSliceModifier pixels the scene is scrolled by one slice.
+ */
+ int m_IndexToSliceModifier;
+
+ /**
+ * \brief Defines if it is possible to scroll endlessly
+ *
+ * If AutoRepeat is on, scrolling further than the last slice will restart at the first slice and vice versa
+ */
+ bool m_AutoRepeat;
};
} // namespace mitk
#endif /* MITKDISPLAYVECTORINTERACTOR_H_HEADER_INCLUDED_C10DC4EB */
diff --git a/Core/Code/Interactions/mitkInteractionConst.h b/Core/Code/Interactions/mitkInteractionConst.h
index 464ecf16b9..b12336b962 100644
--- a/Core/Code/Interactions/mitkInteractionConst.h
+++ b/Core/Code/Interactions/mitkInteractionConst.h
@@ -1,741 +1,743 @@
/*=========================================================================
Program: Medical Imaging & Interaction Toolkit
Language: C++
Date: $Date$
Version: $Revision$
Copyright (c) German Cancer Research Center, Division of Medical and
Biological Informatics. All rights reserved.
See MITKCopyright.txt or http://www.mitk.org/copyright.html for details.
This software is distributed WITHOUT ANY WARRANTY; without even
the implied warranty of MERCHANTABILITY or FITNESS FOR A PARTICULAR
PURPOSE. See the above copyright notices for more information.
=========================================================================*/
#ifndef MITKINTERACTCONST_H
#define MITKINTERACTCONST_H
//##Documentation
//## @file mitkInteractionConst.h
//## @brief Constants for most interaction classes, due to the generic StateMachines.
//##
//## Changes in Type, ButtonState or Key has to be don in mitkEventMapper.cpp, too.
//## @ingroup Interaction
/*Prefixes for Constants:
E = Enumeration
EID = EventId's
Op = Operations
Ac = Action
Type_ = Type of Event
BS_ = ButtonStates and Buttons
Key_ = Keys like in QT
*/
namespace mitk{
//Constants for EventIds; use the according constant to through an event in the code
enum EEventIds
{
EIDNULLEVENT = 0,
EIDLEFTMOUSEBTN = 1,
EIDRIGHTMOUSEBTN = 2,
EIDLEFTMOUSEBTNANDSHIFT = 3,
EIDMIDDLEMOUSEBTN = 4,
EIDLEFTMOUSEBTNANDCTRL = 5,
EIDMIDDLEMOUSEBTNANDCTRL = 6,
EIDRIGHTMOUSEBTNANDCTRL = 7,
EIDLEFTMOUSEBTNDOUBLECLICK = 8,
EIDMOUSEWHEEL = 9,
EIDLEFTMOUSERELEASE = 505,
EIDMIDDLEMOUSERELEASE = 506,
EIDRIGHTMOUSERELEASE = 507,
EIDLEFTMOUSERELEASEANDSHIFT = 508,
EIDMOUSEMOVE = 520,
EIDLEFTMOUSEBTNANDMOUSEWHEEL = 521,
EIDRIGHTMOUSEBTNANDMOUSEWHEEL = 522,
EIDMIDDLEMOUSEBTNANDMOUSEWHEEL = 523,
EIDLEFTMOUSEBTNANDMOUSEMOVE = 530,
EIDRIGHTMOUSEBTNANDMOUSEMOVE = 531,
EIDMIDDLEMOUSEBTNANDMOUSEMOVE = 533,
EIDCTRLANDLEFTMOUSEBTNANDMOUSEMOVE = 534,
EIDCTRLANDRIGHTMOUSEBTNANDMOUSEMOVE = 535,
EIDCTRLANDMIDDLEMOUSEBTNANDMOUSEMOVE = 536,
EIDCTRLANDLEFTMOUSEBTNRELEASE = 537,
EIDCTRLANDRIGHTMOUSEBTNRELEASE = 538,
EIDCTRLANDMIDDLEMOUSEBTNRELEASE = 539,
EIDSHIFTANDCTRLANDMIDDLEMOUSEBTN = 540,
EIDSHIFTANDLEFTMOUSEBTNANDMOUSEMOVE = 541,
EIDSHIFTANDCTRLANDMOUSEMOVE = 542,
EIDSHIFTANDCTRLANDMOUSERELEASE = 543,
EIDALTANDLEFTMOUSEBTN = 600,
EIDALTANDLEFTMOUSEBTNANDMOUSEMOVE = 610,
EIDALTANDLEFTMOUSERELEASE = 620,
EIDSHIFTANDRIGHTMOUSEPRESS = 2000,
EIDSHIFTANDRIGHTMOUSEMOVE = 2001,
EIDSHIFTANDRIGHTMOUSERELEASE = 2002,
EIDSHIFTANDMIDDLEMOUSEPRESS = 2003,
EIDSHIFTANDMIDDLEMOUSEMOVE = 2004,
EIDSHIFTANDMIDDLEMOUSERELEASE = 2005,
EIDSPACENAVIGATORINPUT = 4001, // 3d Mouse, SpaceNavigator input
EIDSPACENAVIGATORKEYDOWN = 4002, // 3d Mouse, KeyDown
EIDWIIMOTEINPUT = 4003, // WiiMote input
EIDWIIMOTEBUTTON = 4004, // WiiMote home button
EIDWIIMOTEBUTTONB = 4005, // WiiMote b button
EIDSTRGANDN = 10,
EIDSTRGANDE = 11,
EIDDELETE = 12,
EIDN = 13,
EIDESCAPE = 14,
EIDP = 15,
EIDR = 16,
EIDT = 17,
EIDS = 18,
EIDE = 19,
EIDSTRGANDALTANDA = 20,
EIDSTRGANDALTANDB = 21,
EIDH = 22,
EIDRETURN = 23,
EIDENTER = 24,
EIDSPACE = 25,
EIDPLUS = 26,
EIDMINUS = 27,
EIDSTRGANDALTANDH = 30,
EIDSTRGANDALTANDI = 31,
EIDSTRGANDALTANDS = 40,
EIDALT = 90,
EIDSTRGANDB = 91,
EIDNEW = 1000,
EIDOLD = 1001,
EIDFINISHED = 1002,
EIDNO = 1003,
EIDYES = 1004,
EIDSAME = 1005,
EIDNOANDLASTOBJECT = 1006,
EIDNOANDNOTLASTOBJECT = 1007,
EIDLAST = 1008,
EIDNOTLAST = 1009,
EIDSTSMALERNMINUS1 = 1010,
EIDSTLARGERNMINUS1 = 1011,
EIDPOSITIONEVENT = 1012,
EIDEDIT = 1013,
EIDSMALLERN = 1014,
EIDEQUALSN = 1015,
EIDLARGERN = 1016,
EIDEMPTY = 1017,
EIDSUBDESELECT = 1020,
EIDSMTOSELECTED = 1030,
EIDSMTODESELECTED = 1031,
EIDTIP = 1050,
EIDHEAD = 1051,
EIDBODY = 1052,
EIDCLEAR = 1100,
EIDACTIVATETOOL = 1300,
EIDPRINT = 3001,
EV_INIT = 5551001,
EV_PREVIOUS = 5551002,
EV_PATH_COLLECTION_SELECTED = 5551003,
EV_NAVIGATION_SELECTED = 5551004,
EV_LESS_THEN_MIN_COUNT = 5551005,
EV_READY = 5551006,
EV_NEXT = 5551007,
EV_DONE = 5551008,
EV_NEW_LANDMARK = 5551009,
EV_REMOVE_LANDMARK = 5551010,
- EIDINSIDE = 2500
+ EIDINSIDE = 2500,
+ EIDFIGUREHOVER = 12340,
+ EIDNOFIGUREHOVER = 12341
};
//##Constants for Operations
//## xomments are always examples of the usage
enum EOperations
{
OpNOTHING = 0,
OpTEST = 1,
OpNEWCELL = 10, //add a new cell
OpADD = 100, //add a point or a vessel
OpUNDOADD = 101,
OpADDLINE = 1001, //add a line
OpINSERT = 200, //insert a point at position
OpINSERTLINE = 201, //insert a line at position
OpINSERTPOINT = 202,
OpCLOSECELL = 250, //close a cell (to a polygon)
OpOPENCELL = 251, //close a cell (to a polygon)
OpMOVE = 300, //move a point
OpMOVELINE = 301, //move a line
OpMOVECELL = 302, //move a line
OpUNDOMOVE = 303,
OpMOVEPOINTUP = 304,
OpMOVEPOINTDOWN = 305,
OpREMOVE = 400, //remove a point at position
OpREMOVELINE = 401, //remove a line at position
OpREMOVECELL = 402, //remove a cell
OpREMOVEPOINT = 403,
OpDELETE = 500, //delete
OpDELETELINE = 501, //delete the last line in a cell
OpUNDELETE = 502,
OpDELETECELL = 505,
OpSTATECHANGE = 600, //change a state
OpTIMECHANGE = 601, //change a state
OpTERMINATE = 666, //change a state
OpSELECTPOINT = 700,
OpSELECTLINE = 701,
OpSELECTCELL = 702,
OpSELECTSUBOBJECT = 703, //for VesselGraphInteractor
//OpSELECTNEWSUBOBJECT = 704, //for VesselGraphInteractor
OpSELECT = 705,
OpDESELECTPOINT = 800,
OpDESELECTLINE = 801,
OpDESELECTCELL = 802,
OpDESELECTSUBOBJECT = 803, //for VesselGraphInteractor
OpDESELECTALL = 804, //for VesselGraphInteractor
OpDESELECT = 805,
OpNAVIGATE = 900,
OpZOOM = 1000,
OpSCALE = 1100,
OpROTATE = 1200,
OpORIENT = 1201,
OpSETPOINTTYPE = 1210,
OpMODECHANGE = 1500,
OpSENDCOORDINATES = 1600,
OpPERIPHERYSEARCH = 2000, //used in VesselGraphInteractor
OpROOTSEARCH = 2001, //used in VesselGraphInteractor
OpTHICKSTVESSELSEARCH = 2002, //used in VesselGraphInteractor
OpSHORTESTPATHSEARCH = 2003, //used in VesselGraphInteractor
OpATTRIBUTATION = 2004, //used in VesselGraphInteractor
OpDEFAULT = 2006, //used in VesselGraphInteractor
OpSURFACECHANGED = 3000, // used for changing polydata in surfaces
};
//##Constants for EventMapping...
//##connects the statemachine.xml-File with the implemented conditions.
//##within one statemachine the choice of the actionconstants is freely
//##
//## ActionId
enum EActions
{
AcDONOTHING = 0,
AcINITNEWOBJECT = 5,
AcINITEDITOBJECT = 6,
AcINITEDITGROUP = 7,
AcINITMOVEMENT = 8,
AcINITMOVE = 9,
AcINITFOREGROUND = 45, // used in SeedsInteractor for setting the foreground seeds
AcINITBACKGROUND = 46, // used in SeedsInteractor for setting the background seeds
AcINITNEUTRAL = 47, // used in SeedsInteractor for setting the neutral seeds (rubber)
AcINITUPDATE = 1235, // For shape model deformation
AcADDPOINT = 10,
AcADD = 11,
AcADDLINE = 12,
AcADDANDFINISH = 13,
AcADDSELECTEDTOGROUP = 64,
AcCHECKPOINT = 21,
AcCHECKLINE = 22,
AcCHECKCELL = 23,
AcCHECKELEMENT = 30, // check if there is a element close enough (picking)
AcCHECKOBJECT = 31, // check if an object is hit
AcCHECKNMINUS1 = 32, // check if the number of elements is equal to N-1
AcCHECKEQUALS1 = 33, // check if the number of elements in the data is equal to 1
AcCHECKNUMBEROFPOINTS = 330, //check the number of elements in the data
AcCHECKSELECTED = 34, // check if the given element is selected or not
AcCHECKONESELECTED = 340, //check if there is an element that is selected
AcCHECKHOVERING = 341, //check if there is an element that is selected
AcCHECKGREATERZERO = 35, // check if the current number of elements is greater than 0
AcCHECKGREATERTWO = 36, // check if the current number of elements is greater than two
AcCHECKOPERATION = 37, // check if the operation is of one spectial type
AcCHECKONESUBINTERACTOR = 38,
AcCHECKSUBINTERACTORS = 39,
AcFINISHOBJECT = 40,
AcFINISHGROUP = 41,
AcFINISHMOVEMENT = 42,
AcFINISHMOVE = 43,
AcFINISH = 44,
AcSEARCHOBJECT = 50,
AcSEARCHGROUP = 51,
AcSEARCHANOTHEROBJECT = 52, // one object is selected and another object is to be added to selection
AcSELECTPICKEDOBJECT = 60, // select the picked object and deselect others
AcSELECTANOTHEROBJECT = 61,
AcSELECTGROUP = 62,
AcSELECTALL = 63,
AcSELECT = 65,
AcSELECTPOINT = 66,
AcSELECTLINE = 68,
AcSELECTCELL = 67,
AcSELECTSUBOBJECT = 69, // used in VesselGraphInteractor
AcDESELECTOBJECT = 70, // deselect picked from group
AcDESELECTALL = 72,
AcDESELECT = 75,
AcDESELECTPOINT = 76,
AcDESELECTLINE = 78,
AcDESELECTCELL = 77,
AcNEWPOINT = 80,
AcNEWSUBOBJECT = 81,
AcMOVEPOINT = 90,
AcMOVESELECTED = 91,
AcMOVE = 92,
AcMOVEPOINTUP = 93,
AcMOVEPOINTDOWN = 94,
AcREMOVEPOINT = 100,
AcREMOVE = 101,
AcREMOVELINE = 102,
AcREMOVEALL = 103,
AcREMOVESELECTEDSUBOBJECT = 104, // used in VesselGraphInteractor
AcWHEEL = 105,
AcPLUS = 106,
AcMINUS = 107,
AcDELETEPOINT = 120,
AcCLEAR = 130, // clear all elements from a list
AcINSERTPOINT = 110,
AcINSERTLINE = 111,
AC_SET_NEXT_BUTTON_VISIBLE = 5550001,
AC_SET_NEXT_BUTTON_INVISIBLE = 5550002,
AC_SET_PREVIOUS_BUTTON_VISIBLE = 5550003,
AC_SET_PREVIOUS_BUTTON_INVISIBLE = 5550004,
AC_SET_ASSISTAND_WIDGET_STECK = 5550005,
AC_SETMAX_COUNT_REF_POINTS = 5550006,
AC_SET_NEXT_BUTTON_TEXT = 5550007,
AC_CHECK_LANDMARK_COUNT = 5550008,
AC_SET_DONE_FALSE = 5550009,
AC_INIT = 55500010,
AC_SET_APPLICATION_SELECTED_FALSE = 55500011,
AC_SENSOR_ATTACHED = 55500012,
AC_CLOSE_ASSISTENT = 55500013,
AC_START_APPLICATION_TEXT = 55500014,
AC_START_NAVIGATION = 55500015,
AC_START_PATHCOLLECTION = 55500016,
AC_LOAD_LANDMARKS = 55500017,
AC_CALCULATE_LANDMARK_TRANSFORM = 55500018,
AcTERMINATE_INTERACTION = 666,
AcTRANSLATESTART = 1000,
AcTRANSLATE = 1001,
AcSCALESTART = 1002,
AcSCALE = 1003,
AcROTATESTART = 1004,
AcROTATE = 1005,
AcINITAFFINEINTERACTIONS = 1006,
AcFINISHAFFINEINTERACTIONS = 1007,
AcTRANSLATEEND = 1008,
AcSCALEEND = 1009,
AcROTATEEND = 1010,
AcINITZOOM = 1011,
AcZOOM = 1012,
AcSCROLL = 1013,
AcLEVELWINDOW = 1014,
AcSETSTARTPOINT = 1050,
AcMODEDESELECT = 1100, // set interactor in not selected mode
AcMODESELECT = 1101, // set interactor in selected mode
AcMODESUBSELECT = 1102, // set interacor in sub selected mode
AcINFORMLISTENERS = 1200, // GlobalInteraction
AcASKINTERACTORS = 1201, // GlobalInteraction
AcCHECKGREATERONE = 1500,
AcCHECKBOUNDINGBOX = 1510,
AcFORCESUBINTERACTORS = 1550,
AcSENDCOORDINATES = 1600,
AcTRANSMITEVENT = 2000, // to transmit an event to a lower Interactor/Statemachine
AcPERIPHERYSEARCH = 3000, // used in VesselGraphInteractor
AcROOTSEARCH = 3001, // used in VesselGraphInteractor
AcTHICKSTVESSELSEARCH = 3002, // used in VesselGraphInteractor
AcSHORTESTPATHSEARCH = 3003, // used in VesselGraphInteractor
AcSINGLE = 3004, // used in VesselGraphInteractor
AcATTRIBUTATION = 3005, // used in VesselGraphInteractor
AcDEFAULT = 3007, // used in VesselGraphInteractor
AcSETVESSELELEMENT = 3008, // used in VesselGraphInteractor
AcCHECKBARRIERSTATUS = 3010, // used in VesselGraphInteractor
AcUPDATEMESH = 1234, // For Shape Model Interaction
AcINCREASE = 49012,
AcDECREASE = 49013,
AcMODIFY = 49014,
AcUNDOUPDATE = 1236, // For restoring a mesh after an update
AcENTEROBJECT = 48000,
AcLEAVEOBJECT = 48001,
AcSWITCHOBJECT = 48002,
AcUPDATELINE = 48003,
AcINITLINE = 48004,
AcTERMINATELINE = 48005,
AcCREATEBOX = 48006,
AcCREATEOBJECTFROMLINE = 48007,
AcCANCEL = 48008,
AcACTIVATETOOL = 48009,
AcROTATEAROUNDPOINT1 = 49002,
AcROTATEAROUNDPOINT2 = 49003,
AcMOVEPOINT1 = 49004,
AcMOVEPOINT2 = 49005,
AcUPDATEPOINT = 49006,
AcDISPLAYOPTIONS = 49009,
AcCYCLE = 49010,
AcACCEPT = 49011,
AcONSPACENAVIGATORMOUSEINPUT = 4001, // On input of 3D Mouse
AcONPACENAVIGATORKEYDOWN = 4002, // On input of 3D Mouse
AcONWIIMOTEINPUT = 4003, // used for wiimote to signal IR input
AcRESETVIEW = 4004, // used for wiimote to reset view
AcONWIIMOTEBUTTONRELEASED = 4005, // stops the surface interaction
AcCHECKPOSITION = 5000,
AcINITIALIZECONTOUR = 5001,
AcCALCULATENEWSEGMENTATION_SP= 5002,
AcINTERACTOR = 5003,
AcCALCULATENEWSEGMENTATION_BB= 5004
};
/*
//!!!!!!!!!!!!!!!!!!!!!!!!
//!!!!!!!!!!!!!!!!!!!!!!!!
//EventMechanism:
//If you change anything from here on, then change in mitkEventMapper.cpp (Array of constants) as well.
//!!!!!!!!!!!!!!!!!!!!!!!!
//!!!!!!!!!!!!!!!!!!!!!!!!
*/
//Type of an Event;
enum EEventType
{
Type_None = 0, // invalid event
Type_Timer = 1, // timer event
Type_MouseButtonPress = 2, // mouse button pressed
Type_MouseButtonRelease = 3, // mouse button released
Type_MouseButtonDblClick = 4, // mouse button double click
Type_MouseMove = 5, // mouse move
Type_KeyPress = 6, // key pressed
Type_KeyRelease = 7, // key released
Type_FocusIn = 8, // keyboard focus received
Type_FocusOut = 9, // keyboard focus lost
Type_Enter = 10, // mouse enters widget
Type_Leave = 11, // mouse leaves widget
Type_Paint = 12, // paint widget
Type_Move = 13, // move widget
Type_Resize = 14, // resize widget
Type_Create = 15, // after object creation
Type_Destroy = 16, // during object destruction
Type_Show = 17, // widget is shown
Type_Hide = 18, // widget is hidden
Type_Close = 19, // request to close widget
Type_Quit = 20, // request to quit application
Type_Reparent = 21, // widget has been reparented
Type_ShowMinimized = 22, // widget is shown minimized
Type_ShowNormal = 23, // widget is shown normal
Type_WindowActivate = 24, // window was activated
Type_WindowDeactivate = 25, // window was deactivated
Type_ShowToParent = 26, // widget is shown to parent
Type_HideToParent = 27, // widget is hidden to parent
Type_ShowMaximized = 28, // widget is shown maximized
Type_ShowFullScreen = 29, // widget is shown full-screen
Type_Accel = 30, // accelerator event
Type_Wheel = 31, // wheel event
Type_AccelAvailable = 32, // accelerator available event
Type_CaptionChange = 33, // caption changed
Type_IconChange = 34, // icon changed
Type_ParentFontChange = 35, // parent font changed
Type_ApplicationFontChange = 36, // application font changed
Type_ParentPaletteChange = 37, // parent palette changed
Type_ApplicationPaletteChange = 38, // application palette changed
Type_PaletteChange = 39, // widget palette changed
Type_Clipboard = 40, // internal clipboard event
Type_Speech = 42, // reserved for speech input
Type_SockAct = 50, // socket activation
Type_AccelOverride = 51, // accelerator override event
Type_DeferredDelete = 52, // deferred delete event
Type_DragEnter = 60, // drag moves into widget
Type_DragMove = 61, // drag moves in widget
Type_DragLeave = 62, // drag leaves or is cancelled
Type_Drop = 63, // actual drop
Type_DragResponse = 64, // drag accepted/rejected
Type_ChildInserted = 70, // new child widget
Type_ChildRemoved = 71, // deleted child widget
Type_LayoutHint = 72, // child min/max size changed
Type_ShowWindowRequest = 73, // widget's window should be mapped
Type_ActivateControl = 80, // ActiveX activation
Type_DeactivateControl = 81, // ActiveX deactivation
Type_ContextMenu = 82, // context popup menu
Type_IMStart = 83, // input method composition start
Type_IMCompose = 84, // input method composition
Type_IMEnd = 85, // input method composition end
Type_Accessibility = 86, // accessibility information is requested
Type_TabletMove = 87, // Wacom tablet event
Type_LocaleChange = 88, // the system locale changed
Type_LanguageChange = 89, // the application language changed
Type_LayoutDirectionChange = 90, // the layout direction changed
Type_Style = 91, // internal style event
Type_TabletPress = 92, // tablet press
Type_TabletRelease = 93, // tablet release
Type_User = 1000, // first user event id
Type_SpaceNavigatorInput = 1094, // 3D mouse input occured
Type_SpaceNavigatorKeyDown = 1095, // 3D mouse input occured
Type_WiiMoteInput = 1096, // WiiMote input occured
Type_WiiMoteButton= 1097, // WiiMote button pressed
Type_MaxUser = 65535
};
//##ButtonState
// mouse/keyboard state values
//QT combinations if MOUSEBUTTONRelease: left MouseButton + ControlButton: 0x201
enum EButtonStates
{
BS_NoButton = 0x0000,
BS_LeftButton = 0x0001,
BS_RightButton = 0x0002,
BS_MidButton = 0x0004,
BS_MouseButtonMask = 0x0007,
BS_ShiftButton = 0x0100,
BS_ControlButton = 0x0200,
BS_AltButton = 0x0400,
BS_MetaButton = 0x0800,
BS_KeyButtonMask = 0x0f00,
BS_Keypad = 0x4000
};
//##Key
enum EKeys
{
Key_Escape = 0x1000, // misc keys
Key_Tab = 0x1001,
Key_Backtab = 0x1002,
Key_BackTab = 0x1002, //= Key_Backtab
Key_Backspace = 0x1003,
Key_BackSpace = 0x1003, //= Key_Backspace
Key_Return = 0x1004,
Key_Enter = 0x1005,
Key_Insert = 0x1006,
Key_Delete = 0x1007,
Key_Pause = 0x1008,
Key_Print = 0x1009,
Key_SysReq = 0x100a,
Key_Home = 0x1010, // cursor movement
Key_End = 0x1011,
Key_Left = 0x1012,
Key_Up = 0x1013,
Key_Right = 0x1014,
Key_Down = 0x1015,
Key_Prior = 0x1016,
Key_PageUp = 0x1016, //=Key_Prior
Key_Next = 0x1017,
Key_PageDown = 0x1017, //=Key_Next
Key_Shift = 0x1020, // modifiers
Key_Control = 0x1021,
Key_Meta = 0x1022,
Key_Alt = 0x1023,
Key_CapsLock = 0x1024,
Key_NumLock = 0x1025,
Key_ScrollLock = 0x1026,
Key_F1 = 0x1030, // function keys
Key_F2 = 0x1031,
Key_F3 = 0x1032,
Key_F4 = 0x1033,
Key_F5 = 0x1034,
Key_F6 = 0x1035,
Key_F7 = 0x1036,
Key_F8 = 0x1037,
Key_F9 = 0x1038,
Key_F10 = 0x1039,
Key_F11 = 0x103a,
Key_F12 = 0x103b,
Key_F13 = 0x103c,
Key_F14 = 0x103d,
Key_F15 = 0x103e,
Key_F16 = 0x103f,
Key_F17 = 0x1040,
Key_F18 = 0x1041,
Key_F19 = 0x1042,
Key_F20 = 0x1043,
Key_F21 = 0x1044,
Key_F22 = 0x1045,
Key_F23 = 0x1046,
Key_F24 = 0x1047,
Key_F25 = 0x1048, // F25 .. F35 only on X11
Key_F26 = 0x1049,
Key_F27 = 0x104a,
Key_F28 = 0x104b,
Key_F29 = 0x104c,
Key_F30 = 0x104d,
Key_F31 = 0x104e,
Key_F32 = 0x104f,
Key_F33 = 0x1050,
Key_F34 = 0x1051,
Key_F35 = 0x1052,
Key_Super_L = 0x1053, // extra keys
Key_Super_R = 0x1054,
Key_Menu = 0x1055,
Key_Hyper_L = 0x1056,
Key_Hyper_R = 0x1057,
Key_Help = 0x1058,
// International input method support (X keycode - = 0xEE00)
// Only interesting if you are writing your own input method
Key_Muhenkan = 0x1122, // Cancel Conversion
Key_Henkan = 0x1123, // Start/Stop Conversion
Key_Hiragana_Katakana = 0x1127, // Hiragana/Katakana toggle
Key_Zenkaku_Hankaku = 0x112A, // Zenkaku/Hankaku toggle
Key_Space = 0x20, // 7 bit printable ASCII
Key_Any = 0x20, //= Key_Space
Key_Exclam = 0x21,
Key_QuoteDbl = 0x22,
Key_NumberSign = 0x23,
Key_Dollar = 0x24,
Key_Percent = 0x25,
Key_Ampersand = 0x26,
Key_Apostrophe = 0x27,
Key_ParenLeft = 0x28,
Key_ParenRight = 0x29,
Key_Asterisk = 0x2a,
Key_Plus = 0x2b,
Key_Comma = 0x2c,
Key_Minus = 0x2d,
Key_Period = 0x2e,
Key_Slash = 0x2f,
Key_0 = 0x30,
Key_1 = 0x31,
Key_2 = 0x32,
Key_3 = 0x33,
Key_4 = 0x34,
Key_5 = 0x35,
Key_6 = 0x36,
Key_7 = 0x37,
Key_8 = 0x38,
Key_9 = 0x39,
Key_Colon = 0x3a,
Key_Semicolon = 0x3b,
Key_Less = 0x3c,
Key_Equal = 0x3d,
Key_Greater = 0x3e,
Key_Question = 0x3f,
Key_At = 0x40,
Key_A = 0x41,
Key_B = 0x42,
Key_C = 0x43,
Key_D = 0x44,
Key_E = 0x45,
Key_F = 0x46,
Key_G = 0x47,
Key_H = 0x48,
Key_I = 0x49,
Key_J = 0x4a,
Key_K = 0x4b,
Key_L = 0x4c,
Key_M = 0x4d,
Key_N = 0x4e,
Key_O = 0x4f,
Key_P = 0x50,
Key_Q = 0x51,
Key_R = 0x52,
Key_S = 0x53,
Key_T = 0x54,
Key_U = 0x55,
Key_V = 0x56,
Key_W = 0x57,
Key_X = 0x58,
Key_Y = 0x59,
Key_Z = 0x5a,
Key_BracketLeft = 0x5b,
Key_Backslash = 0x5c,
Key_BracketRight = 0x5d,
Key_AsciiCircum = 0x5e,
Key_Underscore = 0x5f,
Key_QuoteLeft = 0x60,
Key_BraceLeft = 0x7b,
Key_Bar = 0x7c,
Key_BraceRight = 0x7d,
Key_AsciiTilde = 0x7e,
Key_nobreakspace = 0x0a0,
Key_exclamdown = 0x0a1,
Key_cent = 0x0a2,
Key_sterling = 0x0a3,
Key_currency = 0x0a4,
Key_yen = 0x0a5,
Key_brokenbar = 0x0a6,
Key_section = 0x0a7,
Key_diaeresis = 0x0a8,
Key_copyright = 0x0a9,
Key_ordfeminine = 0x0aa,
Key_guillemotleft = 0x0ab, // left angle quotation mark
Key_notsign = 0x0ac,
Key_hyphen = 0x0ad,
Key_registered = 0x0ae,
Key_macron = 0x0af,
Key_degree = 0x0b0,
Key_plusminus = 0x0b1,
Key_twosuperior = 0x0b2,
Key_threesuperior = 0x0b3,
Key_acute = 0x0b4,
Key_mu = 0x0b5,
Key_paragraph = 0x0b6,
Key_periodcentered = 0x0b7,
Key_cedilla = 0x0b8,
Key_onesuperior = 0x0b9,
Key_masculine = 0x0ba,
Key_guillemotright = 0x0bb, // right angle quotation mark
Key_onequarter = 0x0bc,
Key_onehalf = 0x0bd,
Key_threequarters = 0x0be,
Key_questiondown = 0x0bf,
Key_Agrave = 0x0c0,
Key_Aacute = 0x0c1,
Key_Acircumflex = 0x0c2,
Key_Atilde = 0x0c3,
Key_Adiaeresis = 0x0c4,
Key_Aring = 0x0c5,
Key_AE = 0x0c6,
Key_Ccedilla = 0x0c7,
Key_Egrave = 0x0c8,
Key_Eacute = 0x0c9,
Key_Ecircumflex = 0x0ca,
Key_Ediaeresis = 0x0cb,
Key_Igrave = 0x0cc,
Key_Iacute = 0x0cd,
Key_Icircumflex = 0x0ce,
Key_Idiaeresis = 0x0cf,
Key_ETH = 0x0d0,
Key_Ntilde = 0x0d1,
Key_Ograve = 0x0d2,
Key_Oacute = 0x0d3,
Key_Ocircumflex = 0x0d4,
Key_Otilde = 0x0d5,
Key_Odiaeresis = 0x0d6,
Key_multiply = 0x0d7,
Key_Ooblique = 0x0d8,
Key_Ugrave = 0x0d9,
Key_Uacute = 0x0da,
Key_Ucircumflex = 0x0db,
Key_Udiaeresis = 0x0dc,
Key_Yacute = 0x0dd,
Key_THORN = 0x0de,
Key_ssharp = 0x0df,
Key_agrave = 0x0e0,
Key_aacute = 0x0e1,
Key_acircumflex = 0x0e2,
Key_atilde = 0x0e3,
Key_adiaeresis = 0x0e4,
Key_aring = 0x0e5,
Key_ae = 0x0e6,
Key_ccedilla = 0x0e7,
Key_egrave = 0x0e8,
Key_eacute = 0x0e9,
Key_ecircumflex = 0x0ea,
Key_ediaeresis = 0x0eb,
Key_igrave = 0x0ec,
Key_iacute = 0x0ed,
Key_icircumflex = 0x0ee,
Key_idiaeresis = 0x0ef,
Key_eth = 0x0f0,
Key_ntilde = 0x0f1,
Key_ograve = 0x0f2,
Key_oacute = 0x0f3,
Key_ocircumflex = 0x0f4,
Key_otilde = 0x0f5,
Key_odiaeresis = 0x0f6,
Key_division = 0x0f7,
Key_oslash = 0x0f8,
Key_ugrave = 0x0f9,
Key_uacute = 0x0fa,
Key_ucircumflex = 0x0fb,
Key_udiaeresis = 0x0fc,
Key_yacute = 0x0fd,
Key_thorn = 0x0fe,
Key_ydiaeresis = 0x0ff,
Key_unknown = 0xffff,
Key_none = 0xffff//= Key_unknown
};
}//namespace mitk
#endif //ifndef MITKINTERACTCONST_H
diff --git a/Core/Code/Interactions/mitkPointSetInteractor.cpp b/Core/Code/Interactions/mitkPointSetInteractor.cpp
index 42ae3c31dc..0442048a4e 100644
--- a/Core/Code/Interactions/mitkPointSetInteractor.cpp
+++ b/Core/Code/Interactions/mitkPointSetInteractor.cpp
@@ -1,1174 +1,1169 @@
/*=========================================================================
Program: Medical Imaging & Interaction Toolkit
Language: C++
Date: $Date$
Version: $Revision$
Copyright (c) German Cancer Research Center, Division of Medical and
Biological Informatics. All rights reserved.
See MITKCopyright.txt or http://www.mitk.org/copyright.html for details.
This software is distributed WITHOUT ANY WARRANTY; without even
the implied warranty of MERCHANTABILITY or FITNESS FOR A PARTICULAR
PURPOSE. See the above copyright notices for more information.
=========================================================================*/
#include "mitkPointSetInteractor.h"
#include "mitkPointOperation.h"
#include "mitkPositionEvent.h"
#include "mitkPointSet.h"
//#include "mitkStatusBar.h"
#include "mitkDataNode.h"
#include "mitkInteractionConst.h"
#include "mitkAction.h"
#include "mitkStateEvent.h"
#include "mitkOperationEvent.h"
#include "mitkUndoController.h"
#include "mitkStateMachineFactory.h"
#include "mitkStateTransitionOperation.h"
#include "mitkBaseRenderer.h"
#include "mitkRenderingManager.h"
//how precise must the user pick the point
//default value
const int PRECISION = 5;
mitk::PointSetInteractor
::PointSetInteractor(const char * type, DataNode* dataNode, int n)
-:Interactor(type, dataNode), m_N(n), m_Precision(PRECISION)
+:Interactor(type, dataNode), m_Precision(PRECISION), m_N(n)
{
if (m_N==0)
{
STATEMACHINE_WARN<<"Instanciation of PointSetInteractor which takes care of 0 points does't make sense!\n";
STATEMACHINE_WARN<<"Setting number of points to 1!\n";
m_N = 1;
}
m_LastPoint.Fill(0);
m_SumVec.Fill(0);
this->InitAccordingToNumberOfPoints();
}
mitk::PointSetInteractor::~PointSetInteractor()
{
}
-void mitk::PointSetInteractor::SetPrecision(unsigned int precision)
-{
- m_Precision = precision;
-}
-
//##Documentation
//## overwritten cause this class can handle it better!
float mitk::PointSetInteractor::CanHandleEvent(StateEvent const* stateEvent) const
{
float returnValue = 0.0;
//if it is a key event that can be handled in the current state, then return 0.5
mitk::DisplayPositionEvent const *disPosEvent =
dynamic_cast <const mitk::DisplayPositionEvent *> (stateEvent->GetEvent());
//Key event handling:
if (disPosEvent == NULL)
{
//check, if the current state has a transition waiting for that key event.
if (this->GetCurrentState()->GetTransition(stateEvent->GetId())!=NULL)
{
return 0.5;
}
else
{
return 0;
}
}
//on MouseMove do nothing!
if (stateEvent->GetEvent()->GetType() == mitk::Type_MouseMove)
{
return 0;
}
//get the time of the sender to look for the right transition.
mitk::BaseRenderer* sender = stateEvent->GetEvent()->GetSender();
if (sender != NULL)
{
unsigned int timeStep = sender->GetTimeStep(m_DataNode->GetData());
//if the event can be understood and if there is a transition waiting for that event
mitk::State const* state = this->GetCurrentState(timeStep);
if (state!= NULL)
if (state->GetTransition(stateEvent->GetId())!=NULL)
returnValue = 0.5;//it can be understood
mitk::PointSet *pointSet = dynamic_cast<mitk::PointSet*>(m_DataNode->GetData());
if ( pointSet != NULL )
{
//if we have one point or more, then check if the have been picked
if ( (pointSet->GetSize( timeStep ) > 0)
&& (pointSet->SearchPoint(
disPosEvent->GetWorldPosition(), m_Precision, timeStep) > -1) )
{
returnValue = 1.0;
}
}
}
return returnValue;
}
//TODO: add a new calculation of precision here! Input: StateEvent and Precision
//the method does a 2D picking with display coordinates and display geometry.
//Here the distance between the mouse position and the point is not as relative anymore!
//float mitk::PointSetInteractor::CalculatePrecision(float precision, mitk::StateEvent stateEvent)
//{
// mitk::BaseRenderer *renderer = stateEvent->GetEvent()->GetSender();
// if (renderer != NULL)
// {
// const mitk::DisplayGeometry* displayGeometry = renderer->GetDisplayGeometry();
// if (displayGeometry != NULL)
// displayGeometry->WorldToDisplay(, lineFrom);
// precision =
// }
//
// return precision;
//
//}
void mitk::PointSetInteractor::UnselectAll( unsigned int timeStep, ScalarType timeInMS )
{
mitk::PointSet *pointSet =
dynamic_cast<mitk::PointSet*>( m_DataNode->GetData() );
if ( pointSet == NULL )
{
return;
}
mitk::PointSet::DataType *itkPointSet = pointSet->GetPointSet( timeStep );
if ( itkPointSet == NULL )
{
return;
}
mitk::PointSet::PointsContainer::Iterator it, end;
end = itkPointSet->GetPoints()->End();
for (it = itkPointSet->GetPoints()->Begin(); it != end; it++)
{
int position = it->Index();
PointSet::PointDataType pointData = {0, false, PTUNDEFINED};
itkPointSet->GetPointData( position, &pointData );
//then declare an operation which unselects this point;
//UndoOperation as well!
if ( pointData.selected )
{
mitk::Point3D noPoint;
noPoint.Fill( 0 );
mitk::PointOperation *doOp = new mitk::PointOperation(
OpDESELECTPOINT, timeInMS, noPoint, position);
if ( m_UndoEnabled )
{
mitk::PointOperation *undoOp =
new mitk::PointOperation(OpSELECTPOINT, timeInMS, noPoint, position);
OperationEvent *operationEvent =
new OperationEvent( pointSet, doOp, undoOp );
m_UndoController->SetOperationEvent( operationEvent );
}
pointSet->ExecuteOperation( doOp );
if ( !m_UndoEnabled )
delete doOp;
}
}
}
void mitk::PointSetInteractor::SelectPoint( int position, unsigned int timeStep, ScalarType timeInMS )
{
mitk::PointSet *pointSet = dynamic_cast< mitk::PointSet * >(
m_DataNode->GetData() );
//if List is empty, then no select of a point can be done!
if ( (pointSet == NULL) || (pointSet->GetSize( timeStep ) <= 0) )
{
return;
}
//dummyPoint... not needed anyway
mitk::Point3D noPoint;
noPoint.Fill(0);
mitk::PointOperation *doOp = new mitk::PointOperation(
OpSELECTPOINT, timeInMS, noPoint, position);
if ( m_UndoEnabled )
{
mitk::PointOperation* undoOp = new mitk::PointOperation(
OpDESELECTPOINT, timeInMS, noPoint, position);
OperationEvent *operationEvent = new OperationEvent(pointSet, doOp, undoOp);
m_UndoController->SetOperationEvent(operationEvent);
}
pointSet->ExecuteOperation( doOp );
if ( !m_UndoEnabled )
delete doOp;
}
bool mitk::PointSetInteractor::ExecuteAction( Action* action, mitk::StateEvent const* stateEvent )
{
bool ok = false;//for return type bool
//checking corresponding Data; has to be a PointSet or a subclass
mitk::PointSet* pointSet =
dynamic_cast<mitk::PointSet*>(m_DataNode->GetData());
if ( pointSet == NULL )
{
return false;
}
//get the timestep to support 3D+T
const mitk::Event *theEvent = stateEvent->GetEvent();
mitk::ScalarType timeInMS = 0.0;
//check if the current timestep has to be changed
if ( theEvent )
{
if (theEvent->GetSender() != NULL)
{
//additionaly to m_TimeStep we need timeInMS to satisfy the execution of the operations
timeInMS = theEvent->GetSender()->GetTime();
}
}
//for reading on the points, Id's etc
mitk::PointSet::DataType *itkPointSet = pointSet->GetPointSet( m_TimeStep );
if ( itkPointSet == NULL )
{
return false;
}
mitk::PointSet::PointsContainer *points = itkPointSet->GetPoints();
/*Each case must watch the type of the event!*/
switch (action->GetActionId())
{
case AcDONOTHING:
ok = true;
break;
case AcCHECKOPERATION:
//to check if the given Event is a DisplayPositionEvent.
{
mitk::DisplayPositionEvent const *dispPosEvent =
dynamic_cast <const mitk::DisplayPositionEvent *> (
stateEvent->GetEvent());
if (dispPosEvent != NULL)
{
mitk::StateEvent* newStateEvent =
new mitk::StateEvent(EIDYES, stateEvent->GetEvent());
this->HandleEvent( newStateEvent );
delete newStateEvent;
}
else
{
mitk::StateEvent* newStateEvent =
new mitk::StateEvent(EIDNO, stateEvent->GetEvent());
this->HandleEvent( newStateEvent );
delete newStateEvent;
}
ok = true;
break;
}
case AcADDPOINT:
// Declare two operations: one for the selected state: deselect the last
// one selected and select the new one the other operation is the add
// operation: There the first empty place have to be found and the new
// point inserted into that space
{
mitk::DisplayPositionEvent const *posEvent =
dynamic_cast < const mitk::DisplayPositionEvent * >
(stateEvent->GetEvent());
// Check if it is a DisplayEvent thrown in a 3D window. Then the
// z-information is missing. Returning false might end in the state
// full, but the last point couldn't be added, so the set wouldn't be
// full. So a extra Action that checks the operationtype has been added.
if ( posEvent == NULL )
{
return false;
}
mitk::Point3D itkPoint;
itkPoint = posEvent->GetWorldPosition();
// undo-supported deselect of all points in the DataList; if List is
// empty, then nothing will be unselected
this->UnselectAll( m_TimeStep, timeInMS );
// find the position, the point is to be added to: first entry with
// empty index. If the Set is empty, then start with 0. if not empty,
// then take the first index not occupied
int lastPosition = 0;
if (!points->empty())
{
mitk::PointSet::PointsIterator it, end;
it = points->Begin();
end = points->End();
while( it != end )
{
if (!points->IndexExists(lastPosition))
break;
++it;
++lastPosition;
}
}
PointOperation* doOp = new mitk::PointOperation(
OpINSERT, timeInMS, itkPoint, lastPosition);
if (m_UndoEnabled)
{
// difference between OpDELETE and OpREMOVE is, that OpDELETE deletes
// a point at the end, and OpREMOVE deletes it from the given position
// remove is better, cause we need the position to add or remove the
// point anyway. We can get the last position from size()
PointOperation *undoOp = new mitk::PointOperation(
OpREMOVE, timeInMS, itkPoint, lastPosition);
OperationEvent *operationEvent =
new OperationEvent(pointSet, doOp, undoOp, "Add point");
m_UndoController->SetOperationEvent(operationEvent);
}
//execute the Operation
pointSet->ExecuteOperation(doOp);
if ( !m_UndoEnabled )
delete doOp;
//the point is added and directly selected in PintSet. So no need to call OpSELECTPOINT
ok = true;
// Update the display
mitk::RenderingManager::GetInstance()->RequestUpdateAll();
break;
}
case AcINITMOVEMENT:
{
mitk::PositionEvent const *posEvent = dynamic_cast <const mitk::PositionEvent *> (stateEvent->GetEvent());
if (posEvent == NULL)
return false;
// start of the Movement is stored to calculate the undoKoordinate
// in FinishMovement
m_LastPoint = posEvent->GetWorldPosition();
// initialize a value to calculate the movement through all
// MouseMoveEvents from MouseClick to MouseRelease
m_SumVec.Fill(0);
ok = true;
break;
}
case AcMOVESELECTED://moves all selected Elements
{
mitk::PositionEvent const *posEvent = dynamic_cast <const mitk::PositionEvent *> (stateEvent->GetEvent());
if (posEvent == NULL)
return false;
mitk::Point3D newPoint, resultPoint;
newPoint = posEvent->GetWorldPosition();
// search the elements in the list that are selected then calculate the
// vector, because only with the vector we can move several elements in
// the same direction
// newPoint - lastPoint = vector
// then move all selected and set the lastPoint = newPoint.
// then add all vectors to a summeryVector (to be able to calculate the
// startpoint for undoOperation)
mitk::Vector3D dirVector = newPoint - m_LastPoint;
//sum up all Movement for Undo in FinishMovement
m_SumVec = m_SumVec + dirVector;
mitk::PointSet::PointsIterator it, end;
it = points->Begin();
end = points->End();
while( it != end )
{
int position = it->Index();
if ( pointSet->GetSelectInfo(position, m_TimeStep) )//if selected
{
PointSet::PointType pt = pointSet->GetPoint(position, m_TimeStep);
mitk::Point3D sumVec;
sumVec[0] = pt[0];
sumVec[1] = pt[1];
sumVec[2] = pt[2];
resultPoint = sumVec + dirVector;
PointOperation* doOp = new mitk::PointOperation(OpMOVE, timeInMS,
resultPoint, position);
//execute the Operation
//here no undo is stored, because the movement-steps aren't interesting.
// only the start and the end is interisting to store for undo.
pointSet->ExecuteOperation(doOp);
delete doOp;
}
++it;
}
m_LastPoint = newPoint;//for calculation of the direction vector
ok = true;
// Update the display
mitk::RenderingManager::GetInstance()->RequestUpdateAll();
break;
}
case AcREMOVEPOINT://remove the given Point from the list
{
//if the point to be removed is given by the positionEvent:
mitk::PositionEvent const *posEvent =
dynamic_cast <const mitk::PositionEvent *> (stateEvent->GetEvent());
if (posEvent != NULL)
{
mitk::Point3D itkPoint;
itkPoint = posEvent->GetWorldPosition();
//search the point in the list
int position = pointSet->SearchPoint(itkPoint, 0.0, m_TimeStep);
//distance set to 0, cause we already got the exact point from last
//State checkpointbut we also need the position in the list to remove it
if (position>=0)//found a point
{
PointSet::PointType pt = pointSet->GetPoint(position, m_TimeStep);
itkPoint[0] = pt[0];
itkPoint[1] = pt[1];
itkPoint[2] = pt[2];
//Undo
PointOperation* doOp = new mitk::PointOperation(OpREMOVE,
timeInMS, itkPoint, position);
if (m_UndoEnabled) //write to UndoMechanism
{
PointOperation* undoOp = new mitk::PointOperation(OpINSERT,
timeInMS, itkPoint, position);
OperationEvent *operationEvent = new OperationEvent(pointSet,
doOp, undoOp, "Remove point");
m_UndoController->SetOperationEvent(operationEvent);
}
//execute the Operation
pointSet->ExecuteOperation(doOp);
if ( !m_UndoEnabled )
delete doOp;
/*now select the point "position-1",
and if it is the first in list,
then contine at the last in list*/
//only then a select of a point is possible!
if (pointSet->GetSize( m_TimeStep ) > 0)
{
if (position>0)//not the first in list
{
this->SelectPoint( position-1, m_TimeStep, timeInMS );
}
//it was the first point in list, that was removed, so select
//the last in list
else
{
position = pointSet->GetSize( m_TimeStep ) - 1; //last in list
this->SelectPoint( position, m_TimeStep, timeInMS );
}//else
}//if
ok = true;
}
}
else //no position is given so remove all selected elements
{
//delete all selected points
//search for the selected one and then declare the operations!
mitk::PointSet::PointsContainer::Iterator it, end;
it = points->Begin();
end = points->End();
int position = 0;
int previousExistingPosition = -1;//to recognize the last existing position; needed because the iterator gets invalid if the point is deleted!
int lastDelPrevExistPosition = -1; //the previous position of the last deleted point
while (it != end)
{
if (points->IndexExists(it->Index()))
{
//if point is selected
if ( pointSet->GetSelectInfo(it->Index(), m_TimeStep) )
{
//get the coordinates of that point to be undoable
PointSet::PointType selectedPoint = it->Value();
mitk::Point3D itkPoint;
itkPoint[0] = selectedPoint[0];
itkPoint[1] = selectedPoint[1];
itkPoint[2] = selectedPoint[2];
position = it->Index();
PointOperation* doOp = new mitk::PointOperation(OpREMOVE,
timeInMS, itkPoint, position);
//Undo
if (m_UndoEnabled) //write to UndoMechanism
{
PointOperation* undoOp = new mitk::PointOperation(OpINSERT,
timeInMS, itkPoint, position);
OperationEvent *operationEvent = new OperationEvent(pointSet,
doOp, undoOp, "Remove point");
m_UndoController->SetOperationEvent(operationEvent);
}
pointSet->ExecuteOperation(doOp);
if ( !m_UndoEnabled )
delete doOp;
//after delete the iterator is undefined, so start again
//count to the last existing entry
if (points->Size()>1 && points->IndexExists(previousExistingPosition))
{
for (it = points->Begin(); it != points->End(); it++)
{
if (it->Index() == (unsigned int) previousExistingPosition)
{
lastDelPrevExistPosition = previousExistingPosition;
break; //return if the iterator on the last existing position is found
}
}
}
else // size <= 1 or no previous existing position set
{
//search for the first existing position
for (it = points->Begin(); it != points->End(); it++)
if (points->IndexExists(it->Index()))
{
previousExistingPosition = it->Index();
break;
}
}
//now that we have set the iterator, lets get sure, that the next it++ will not crash!
if (it == end) { break; }
}//if
else
{
previousExistingPosition = it->Index();
}
}//if index exists
it++;
}//while
if (lastDelPrevExistPosition < 0)//the var has not been set because the first element was deleted and there was no prev position
lastDelPrevExistPosition = previousExistingPosition; //go to the end
/*
* now select the point before the point/points that was/were deleted
*/
if (pointSet->GetSize( m_TimeStep ) > 0) //only then a select of a point is possible!
{
if (points->IndexExists(lastDelPrevExistPosition))
{
this->SelectPoint( lastDelPrevExistPosition, m_TimeStep, timeInMS );
}
else
{
//select the first existing element
for (mitk::PointSet::PointsContainer::Iterator it = points->Begin(); it != points->End(); it++)
if (points->IndexExists(it->Index()))
{
this->SelectPoint( it->Index(), m_TimeStep, timeInMS );
break;
}
}
}//if
ok = true;
}//else
}//case
// Update the display
mitk::RenderingManager::GetInstance()->RequestUpdateAll();
break;
// Remove all Points that have been set at once.
// TODO: Undo function not supported yet.
case AcREMOVEALL:
{
if ( !points->empty() )
{
PointSet::PointType pt;
mitk::PointSet::PointsContainer::Iterator it, end;
it = points->Begin();
end = points->End();
int position = 0;
while ( it != end )
{
position = it->Index();
if ( points->IndexExists( position ) )
{
pt = pointSet->GetPoint( position, m_TimeStep );
PointOperation* doOp =
new mitk::PointOperation( OpREMOVE, timeInMS, pt, position );
++it;
pointSet->ExecuteOperation( doOp );
delete doOp;
}
else it++;
}
}
ok = true;
// Update the display
mitk::RenderingManager::GetInstance()->RequestUpdateAll();
break;
}
//Checking if the Point transmitted is close enough to one point. Then
//generate a new event with the point and let this statemaschine
//handle the event.
case AcCHECKELEMENT:
{
mitk::PositionEvent const *posEvent =
dynamic_cast <const mitk::PositionEvent *> (stateEvent->GetEvent());
if (posEvent != NULL)
{
mitk::Point3D worldPoint = posEvent->GetWorldPosition();
int position = pointSet->SearchPoint( worldPoint, m_Precision, m_TimeStep );
if (position>=0)//found a point near enough to the given point
{
//get that point, the one meant by the user!
PointSet::PointType pt = pointSet->GetPoint(position, m_TimeStep);
mitk::Point2D displPoint;
displPoint[0] = worldPoint[0]; displPoint[1] = worldPoint[1];
//new Event with information YES and with the correct point
mitk::PositionEvent const* newPosEvent =
new mitk::PositionEvent(posEvent->GetSender(), Type_None,
BS_NoButton, BS_NoButton, Key_none, displPoint, pt);
mitk::StateEvent* newStateEvent =
new mitk::StateEvent(EIDYES, newPosEvent);
//call HandleEvent to leave the guard-state
this->HandleEvent( newStateEvent );
delete newStateEvent;
delete newPosEvent;
ok = true;
}
else
{
//new Event with information NO
mitk::StateEvent* newStateEvent = new mitk::StateEvent(EIDNO, posEvent);
this->HandleEvent(newStateEvent );
delete newStateEvent;
ok = true;
}
}
else
{
STATEMACHINE_DEBUG("OperationError")<<this->GetType()<<" AcCHECKELEMENT expected PointOperation.";
mitk::DisplayPositionEvent const *disPosEvent =
dynamic_cast <const mitk::DisplayPositionEvent *> (
stateEvent->GetEvent());
if (disPosEvent != NULL)
{ //2d Koordinates for 3D Interaction; return false to redo
//the last statechange
mitk::StateEvent* newStateEvent =
new mitk::StateEvent(EIDNO, disPosEvent);
this->HandleEvent(newStateEvent );
delete newStateEvent;
ok = true;
}
}
break;
}
case AcCHECKONESELECTED:
//check if there is a point that is selected
{
if (pointSet->GetNumberOfSelected(m_TimeStep)>0)
{
mitk::StateEvent* newStateEvent =
new mitk::StateEvent( EIDYES, theEvent);
this->HandleEvent( newStateEvent );
delete newStateEvent;
}
else //not selected then call event EIDNO
{
//new Event with information NO
mitk::StateEvent* newStateEvent =
new mitk::StateEvent( EIDNO, theEvent);
this->HandleEvent( newStateEvent );
delete newStateEvent;
}
ok = true;
break;
}
case AcCHECKSELECTED:
/*check, if the given point is selected:
if no, then send EIDNO
if yes, then send EIDYES*/
// check, if: because of the need to look up the point again, it is
// possible, that we grab the wrong point in case there are two same points
// so maybe we do have to set a global index for further computation,
// as long, as the mouse is moved...
{
int position = -1;
mitk::PositionEvent const *posEvent =
dynamic_cast <const mitk::PositionEvent *> (stateEvent->GetEvent());
if (posEvent == NULL)
return false;
mitk::Point3D worldPoint = posEvent->GetWorldPosition();
position = pointSet->SearchPoint(worldPoint, m_Precision, m_TimeStep);
if (position>=0)
{
mitk::PositionEvent const *newPosEvent =
new mitk::PositionEvent(posEvent->GetSender(),
posEvent->GetType(), posEvent->GetButton(),
posEvent->GetButtonState(), posEvent->GetKey(),
posEvent->GetDisplayPosition(), posEvent->GetWorldPosition());
//if selected on true, then call Event EIDYES
if (pointSet->GetSelectInfo(position, m_TimeStep))
{
mitk::StateEvent* newStateEvent =
new mitk::StateEvent( EIDYES, newPosEvent );
this->HandleEvent( newStateEvent );
delete newStateEvent;
ok = true;
//saving the spot for calculating the direction vector in moving
m_LastPoint = posEvent->GetWorldPosition();
}
else //not selected then call event EIDNO
{
//new Event with information NO
mitk::StateEvent* newStateEvent =
new mitk::StateEvent( EIDNO, newPosEvent );
this->HandleEvent( newStateEvent );
delete newStateEvent;
ok = true;
}
delete newPosEvent;
}
//the position wasn't set properly. If necessary: search the given
//point in list and set var position
else
{
/*
mitk::StatusBar::GetInstance()->DisplayText(
"Message from mitkPointSetInteractor: Error in Actions! Check Config XML-file",
10000);
*/
ok = false;
}
break;
}
//generate Events if the set will be full after the addition of the
// point or not.
case AcCHECKNMINUS1:
{
// number of points not limited->pass on
// "Amount of points in Set is smaller then N-1"
if (m_N<0)
{
mitk::StateEvent* newStateEvent =
new mitk::StateEvent(EIDSTSMALERNMINUS1, stateEvent->GetEvent());
this->HandleEvent( newStateEvent );
delete newStateEvent;
ok = true;
}
else
{
if (pointSet->GetSize( m_TimeStep ) < m_N-1 )
//pointset after addition won't be full
{
mitk::StateEvent* newStateEvent =
new mitk::StateEvent(EIDSTSMALERNMINUS1, stateEvent->GetEvent());
this->HandleEvent( newStateEvent );
delete newStateEvent;
ok = true;
}
else
//after the addition of a point, the container will be full
{
mitk::StateEvent* newStateEvent =
new mitk::StateEvent(EIDSTLARGERNMINUS1, stateEvent->GetEvent());
this->HandleEvent(newStateEvent );
delete newStateEvent;
ok = true;
}//else
}//else
}
break;
case AcCHECKEQUALS1:
{
//the number of points in the list is 1 (or smaler)
if (pointSet->GetSize( m_TimeStep ) <= 1)
{
mitk::StateEvent* newStateEvent =
new mitk::StateEvent(EIDYES, stateEvent->GetEvent());
this->HandleEvent( newStateEvent );
delete newStateEvent;
ok = true;
}
else //more than 1 points in list, so stay in the state!
{
mitk::StateEvent* newStateEvent =
new mitk::StateEvent(EIDNO, stateEvent->GetEvent());
this->HandleEvent(newStateEvent );
delete newStateEvent;
ok = true;
}
}
break;
case AcCHECKNUMBEROFPOINTS:
{
//the number of points in the list is 1 (or smaler), so will be empty after delete
if (pointSet->GetSize( m_TimeStep ) <= 1)
{
mitk::StateEvent* newStateEvent =
new mitk::StateEvent(EIDEMPTY, stateEvent->GetEvent());
this->HandleEvent( newStateEvent );
delete newStateEvent;
ok = true;
}
else if (pointSet->GetSize( m_TimeStep ) <= m_N || m_N <= -1)
//m_N is set to unlimited points allowed or more than 1 points in list, but not full, so stay in the state!
{
mitk::StateEvent* newStateEvent =
new mitk::StateEvent(EIDSMALLERN, stateEvent->GetEvent());
this->HandleEvent(newStateEvent );
delete newStateEvent;
ok = true;
}
else
//pointSet->GetSize( m_TimeStep ) >=m_N.
// This can happen if the points were not added
// by interaction but by loading a .mps file
{
mitk::StateEvent* newStateEvent =
new mitk::StateEvent(EIDEQUALSN, stateEvent->GetEvent());
this->HandleEvent(newStateEvent );
delete newStateEvent;
ok = true;
}
}
break;
case AcSELECTPICKEDOBJECT://and deselect others
{
mitk::PositionEvent const *posEvent =
dynamic_cast <const mitk::PositionEvent *> (stateEvent->GetEvent());
if (posEvent == NULL) return false;
mitk::Point3D itkPoint;
itkPoint = posEvent->GetWorldPosition();
//search the point in the list
int position = pointSet->SearchPoint(itkPoint, 0.0, m_TimeStep);
//distance set to 0, cause we already got the exact point from last
//State checkpoint but we also need the position in the list to move it
if (position>=0)//found a point
{
//first deselect the other points
//undoable deselect of all points in the DataList
this->UnselectAll( m_TimeStep, timeInMS);
PointOperation* doOp = new mitk::PointOperation(OpSELECTPOINT,
timeInMS, itkPoint, position);
//Undo
if (m_UndoEnabled) //write to UndoMechanism
{
PointOperation* undoOp = new mitk::PointOperation(OpDESELECTPOINT,
timeInMS, itkPoint, position);
OperationEvent *operationEvent =
new OperationEvent(pointSet, doOp, undoOp);
m_UndoController->SetOperationEvent(operationEvent);
}
//execute the Operation
pointSet->ExecuteOperation(doOp);
if ( !m_UndoEnabled )
delete doOp;
ok = true;
}
// Update the display
mitk::RenderingManager::GetInstance()->RequestUpdateAll();
break;
}
case AcDESELECTOBJECT:
{
mitk::PositionEvent const *posEvent =
dynamic_cast <const mitk::PositionEvent *> (stateEvent->GetEvent());
if (posEvent == NULL)
return false;
mitk::Point3D itkPoint;
itkPoint = posEvent->GetWorldPosition();
//search the point in the list
int position = pointSet->SearchPoint(itkPoint, 0.0, m_TimeStep);
//distance set to 0, cause we already got the exact point from last
// State checkpoint but we also need the position in the list to move it
if (position>=0)//found a point
{
//Undo
PointOperation* doOp = new mitk::PointOperation(OpDESELECTPOINT,
timeInMS, itkPoint, position);
if (m_UndoEnabled) //write to UndoMechanism
{
PointOperation* undoOp = new mitk::PointOperation(OpSELECTPOINT,
timeInMS, itkPoint, position);
OperationEvent *operationEvent = new OperationEvent(pointSet, doOp, undoOp);
m_UndoController->SetOperationEvent(operationEvent);
}
//execute the Operation
pointSet->ExecuteOperation(doOp);
if ( !m_UndoEnabled )
delete doOp;
ok = true;
}
// Update the display
mitk::RenderingManager::GetInstance()->RequestUpdateAll();
break;
}
case AcDESELECTALL:
{
//undo-supported able deselect of all points in the DataList
this->UnselectAll( m_TimeStep, timeInMS );
ok = true;
// Update the display
mitk::RenderingManager::GetInstance()->RequestUpdateAll();
break;
}
case AcFINISHMOVEMENT:
{
mitk::PositionEvent const *posEvent =
dynamic_cast <const mitk::PositionEvent *> (stateEvent->GetEvent());
if (posEvent == NULL)
return false;
//finish the movement:
//the final point is m_LastPoint
//m_SumVec stores the movement in a vector
//the operation would not be necessary, but we need it for the undo Operation.
//m_LastPoint is for the Operation
//the point for undoOperation calculates from all selected
//elements (point) - m_SumVec
//search all selected elements and move them with undo-functionality.
mitk::PointSet::PointsIterator it, end;
it = points->Begin();
end = points->End();
while( it != end )
{
int position = it->Index();
if ( pointSet->GetSelectInfo(position, m_TimeStep) )//if selected
{
PointSet::PointType pt = pointSet->GetPoint(position, m_TimeStep);
Point3D itkPoint;
itkPoint[0] = pt[0];
itkPoint[1] = pt[1];
itkPoint[2] = pt[2];
PointOperation* doOp = new mitk::PointOperation(OpMOVE,
timeInMS, itkPoint, position);
if ( m_UndoEnabled )//&& (posEvent->GetType() == mitk::Type_MouseButtonRelease)
{
//set the undo-operation, so the final position is undo-able
//calculate the old Position from the already moved position - m_SumVec
mitk::Point3D undoPoint = ( itkPoint - m_SumVec );
PointOperation* undoOp =
new mitk::PointOperation(OpMOVE, timeInMS, undoPoint, position);
OperationEvent *operationEvent =
new OperationEvent(pointSet, doOp, undoOp, "Move point");
m_UndoController->SetOperationEvent(operationEvent);
}
//execute the Operation
pointSet->ExecuteOperation(doOp);
if ( !m_UndoEnabled )
delete doOp;
}
++it;
}
//set every variable for movement calculation to zero
// commented out: increases usebility in derived classes.
/*m_LastPoint.Fill(0);
m_SumVec.Fill(0);*/
//increase the GroupEventId, so that the Undo goes to here
this->IncCurrGroupEventId();
ok = true;
// Update the display
mitk::RenderingManager::GetInstance()->RequestUpdateAll();
break;
}
case AcCLEAR:
{
this->Clear( m_TimeStep, timeInMS );
// Update the display
mitk::RenderingManager::GetInstance()->RequestUpdateAll();
break;
}
default:
return Superclass::ExecuteAction( action, stateEvent );
}
// indicate modification of data tree node
m_DataNode->Modified();
return ok;
}
void mitk::PointSetInteractor::Clear( unsigned int timeStep, ScalarType timeInMS )
{
mitk::Point3D point;
point.Fill(0);
mitk::PointSet *pointSet =
dynamic_cast<mitk::PointSet*>(m_DataNode->GetData());
if ( pointSet == NULL )
{
return;
}
mitk::PointSet::DataType *itkPointSet = pointSet->GetPointSet( timeStep );
if ( itkPointSet == NULL )
{
return;
}
//for reading on the points, Id's etc
mitk::PointSet::PointsContainer *points = itkPointSet->GetPoints();
mitk::PointSet::PointsIterator it, end;
it = points->Begin();
end = points->End();
while( (it != end) && (pointSet->GetSize( timeStep ) > 0) )
{
point = pointSet->GetPoint( it->Index(), timeStep );
PointOperation *doOp = new mitk::PointOperation(
OpREMOVE, timeInMS, point, it->Index());
//write to UndoMechanism
if ( m_UndoEnabled )
{
PointOperation *undoOp = new mitk::PointOperation(
OpINSERT, timeInMS, point, it->Index());
OperationEvent *operationEvent =
new OperationEvent( pointSet, doOp, undoOp );
m_UndoController->SetOperationEvent( operationEvent );
}
//execute the Operation
++it;
pointSet->ExecuteOperation( doOp );
if ( !m_UndoEnabled )
delete doOp;
}
//reset the statemachine
this->ResetStatemachineToStartState(timeStep);
}
void mitk::PointSetInteractor::InitAccordingToNumberOfPoints()
{
if (m_DataNode == NULL)
return;
mitk::PointSet *pointSet = dynamic_cast<mitk::PointSet*>(m_DataNode->GetData());
if ( pointSet != NULL )
{
//resize the CurrentStateVector
this->ExpandStartStateVector(pointSet->GetPointSetSeriesSize());
for (unsigned int timestep = 0; timestep < pointSet->GetPointSetSeriesSize(); timestep++)
{
//go to new timestep
this->UpdateTimeStep(timestep);
int numberOfPoints = pointSet->GetSize( timestep );
if (numberOfPoints == 0)
continue; //pointset is empty
else
{
//we have a set of loaded points. Deselect all points, because they are all set to selected when added!
this->UnselectAll(timestep);
if (numberOfPoints<m_N || m_N <= -1)//if less than specified or specified as unlimited
{
//get the currentState to state "SpaceLeft"
const mitk::Event* nullEvent = new mitk::Event(NULL, Type_User, BS_NoButton, BS_NoButton, Key_none);
mitk::StateEvent* newStateEvent =
new mitk::StateEvent(EIDSMALLERN, nullEvent);
this->HandleEvent( newStateEvent );
delete newStateEvent;
delete nullEvent;
}
else if (numberOfPoints>=m_N)
{
if (numberOfPoints>m_N)
{
STATEMACHINE_WARN<<"Point Set contains more points than needed!\n";//display a warning that there are too many points
}
//get the currentState to state "Set full"
const mitk::Event* nullEvent = new mitk::Event(NULL, Type_User, BS_NoButton, BS_NoButton, Key_none);
mitk::StateEvent* newStateEvent =
new mitk::StateEvent(EIDEQUALSN, nullEvent);
this->HandleEvent( newStateEvent );
delete newStateEvent;
delete nullEvent;
}
}
}
}
return;
}
void mitk::PointSetInteractor::DataChanged()
{
this->InitAccordingToNumberOfPoints();
return;
}
diff --git a/Core/Code/Interactions/mitkPointSetInteractor.h b/Core/Code/Interactions/mitkPointSetInteractor.h
index 3b50800c60..fc09c4256e 100644
--- a/Core/Code/Interactions/mitkPointSetInteractor.h
+++ b/Core/Code/Interactions/mitkPointSetInteractor.h
@@ -1,130 +1,129 @@
/*=========================================================================
Program: Medical Imaging & Interaction Toolkit
Language: C++
Date: $Date$
Version: $Revision$
Copyright (c) German Cancer Research Center, Division of Medical and
Biological Informatics. All rights reserved.
See MITKCopyright.txt or http://www.mitk.org/copyright.html for details.
This software is distributed WITHOUT ANY WARRANTY; without even
the implied warranty of MERCHANTABILITY or FITNESS FOR A PARTICULAR
PURPOSE. See the above copyright notices for more information.
=========================================================================*/
#ifndef MITKPOINTSETINTERACTOR_H_HEADER_INCLUDED_C11202FF
#define MITKPOINTSETINTERACTOR_H_HEADER_INCLUDED_C11202FF
#include "mitkCommon.h"
#include "mitkVector.h"
#include <mitkInteractor.h>
namespace mitk
{
class DataNode;
/**
* \brief Interaction with a set of points.
*
* Points can be added, removed and moved.
* In case the interaction shall be done on a
* loaded set of points, the associated data
* object (mitkPointSet) needs to be loaded
* prior to the instanciation of this object.
* The number of points are checked and the internal
* statemachine set to the apropriate state.
* The management of 0 points is not supported.
* In this case, the amount of managed points is set to 1.
* \ingroup Interaction
*/
class MITK_CORE_EXPORT PointSetInteractor : public Interactor
{
public:
mitkClassMacro(PointSetInteractor, Interactor);
mitkNewMacro3Param(Self, const char*, DataNode*, int);
mitkNewMacro2Param(Self, const char*, DataNode*);
/**
* @brief Clears all the elements from the given timeStep in the list with undo-functionality and
* resets the statemachine
*/
void Clear( unsigned int timeStep = 0, ScalarType timeInMS = 0.0 );
- /** \brief Sets the amount of precision */
- void SetPrecision( unsigned int precision );
+ itkGetMacro( Precision, unsigned int );
+ itkSetMacro( Precision, unsigned int );
/**
* \brief calculates how good the data, this statemachine handles, is hit
* by the event.
*
* overwritten, cause we don't look at the boundingbox, we look at each point
*/
virtual float CanHandleEvent(StateEvent const* stateEvent) const;
/**
*@brief If data changed then initialize according to numbers of loaded points
**/
virtual void DataChanged();
protected:
/**
* \brief Constructor with Param n for limited Set of Points
*
* If no n is set, then the number of points is unlimited
* n=0 is not supported. In this case, n is set to 1.
*/
PointSetInteractor(const char * type, DataNode* dataNode, int n = -1);
/**
* \brief Default Destructor
**/
virtual ~PointSetInteractor();
/**
* @brief Convert the given Actions to Operations and send to data and UndoController
*/
virtual bool ExecuteAction( Action* action, mitk::StateEvent const* stateEvent );
/** \brief Deselects the Points in the PointSet.
* supports Undo if enabled
*/
void UnselectAll( unsigned int timeStep = 0, ScalarType timeInMS = 0.0 );
/**
* \brief Selects the point.
* supports Undo if enabled.
* \param position Needed for declaring operations
*/
void SelectPoint( int position, unsigned int timeStep = 0, ScalarType timeInMS = 0.0 );
/** \brief to calculate a direction vector from last point and actual
* point
*/
Point3D m_LastPoint;
/** \brief summ-vector for Movement */
Vector3D m_SumVec;
+ /** \brief to store the value of precision to pick a point */
+ unsigned int m_Precision;
private:
/**
* \brief the number of possible points in this object
*
* if -1, then no limit set
*/
int m_N;
- /** \brief to store the value of precision to pick a point */
- unsigned int m_Precision;
-
/**
* @brief Init the StatateMachine according to the current number of points in case of a loaded pointset.
**/
void InitAccordingToNumberOfPoints();
};
}
#endif /* MITKPOINTSETINTERACTOR_H_HEADER_INCLUDED_C11202FF */
diff --git a/Core/Code/Rendering/mitkGeometry2DDataVtkMapper3D.cpp b/Core/Code/Rendering/mitkGeometry2DDataVtkMapper3D.cpp
index 5d42144101..310e33db68 100644
--- a/Core/Code/Rendering/mitkGeometry2DDataVtkMapper3D.cpp
+++ b/Core/Code/Rendering/mitkGeometry2DDataVtkMapper3D.cpp
@@ -1,713 +1,713 @@
/*=========================================================================
Program: Medical Imaging & Interaction Toolkit
Language: C++
Date: $Date$
Version: $Revision$
Copyright (c) German Cancer Research Center, Division of Medical and
Biological Informatics. All rights reserved.
See MITKCopyright.txt or http://www.mitk.org/copyright.html for details.
This software is distributed WITHOUT ANY WARRANTY; without even
the implied warranty of MERCHANTABILITY or FITNESS FOR A PARTICULAR
PURPOSE. See the above copyright notices for more information.
=========================================================================*/
#include "mitkGeometry2DDataVtkMapper3D.h"
#include "mitkImageMapperGL2D.h"
#include "mitkLookupTableProperty.h"
#include "mitkSmartPointerProperty.h"
#include "mitkSurface.h"
#include "mitkVtkRepresentationProperty.h"
#include "mitkWeakPointerProperty.h"
#include "mitkNodePredicateDataType.h"
#include "mitkNodePredicateOr.h"
#include <vtkAssembly.h>
#include <vtkDataSetMapper.h>
#include <vtkFeatureEdges.h>
#include <vtkHedgeHog.h>
#include <vtkImageData.h>
#include <vtkLinearTransform.h>
#include <vtkLookupTable.h>
#include <vtkPolyData.h>
#include <vtkPolyDataMapper.h>
#include <vtkProp3DCollection.h>
#include <vtkProperty.h>
#include <vtkTexture.h>
#include <vtkTransformPolyDataFilter.h>
#include <vtkTubeFilter.h>
namespace mitk
{
Geometry2DDataVtkMapper3D::Geometry2DDataVtkMapper3D()
: m_NormalsActorAdded(false),
m_DataStorage(NULL)
{
m_EdgeTuber = vtkTubeFilter::New();
m_EdgeMapper = vtkPolyDataMapper::New();
m_SurfaceCreator = Geometry2DDataToSurfaceFilter::New();
m_SurfaceCreatorBoundingBox = BoundingBox::New();
m_SurfaceCreatorPointsContainer = BoundingBox::PointsContainer::New();
m_Edges = vtkFeatureEdges::New();
m_Edges->BoundaryEdgesOn();
m_Edges->FeatureEdgesOff();
m_Edges->NonManifoldEdgesOff();
m_Edges->ManifoldEdgesOff();
m_EdgeTransformer = vtkTransformPolyDataFilter::New();
m_NormalsTransformer = vtkTransformPolyDataFilter::New();
m_EdgeActor = vtkActor::New();
m_BackgroundMapper = vtkPolyDataMapper::New();
m_BackgroundActor = vtkActor::New();
m_Prop3DAssembly = vtkAssembly::New();
m_ImageAssembly = vtkAssembly::New();
m_SurfaceCreatorBoundingBox->SetPoints( m_SurfaceCreatorPointsContainer );
m_Cleaner = vtkCleanPolyData::New();
m_Cleaner->PieceInvariantOn();
m_Cleaner->ConvertLinesToPointsOn();
m_Cleaner->ConvertPolysToLinesOn();
m_Cleaner->ConvertStripsToPolysOn();
m_Cleaner->PointMergingOn();
// Make sure that the FeatureEdge algorithm is initialized with a "valid"
// (though empty) input
vtkPolyData *emptyPolyData = vtkPolyData::New();
m_Cleaner->SetInput( emptyPolyData );
emptyPolyData->Delete();
m_Edges->SetInput(m_Cleaner->GetOutput());
m_EdgeTransformer->SetInput( m_Edges->GetOutput() );
m_EdgeTuber->SetInput( m_EdgeTransformer->GetOutput() );
m_EdgeTuber->SetVaryRadiusToVaryRadiusOff();
m_EdgeTuber->SetNumberOfSides( 12 );
m_EdgeTuber->CappingOn();
m_EdgeMapper->SetInput( m_EdgeTuber->GetOutput() );
m_EdgeMapper->ScalarVisibilityOff();
m_BackgroundMapper->SetInput(emptyPolyData);
m_EdgeActor->SetMapper( m_EdgeMapper );
m_BackgroundActor->GetProperty()->SetAmbient( 0.5 );
m_BackgroundActor->GetProperty()->SetColor( 0.0, 0.0, 0.0 );
m_BackgroundActor->GetProperty()->SetOpacity( 1.0 );
m_BackgroundActor->SetMapper( m_BackgroundMapper );
vtkProperty * backfaceProperty = m_BackgroundActor->MakeProperty();
backfaceProperty->SetColor( 0.0, 0.0, 0.0 );
m_BackgroundActor->SetBackfaceProperty( backfaceProperty );
backfaceProperty->Delete();
m_FrontHedgeHog = vtkHedgeHog::New();
m_BackHedgeHog = vtkHedgeHog::New();
m_FrontNormalsMapper = vtkPolyDataMapper::New();
m_FrontNormalsMapper->SetInput( m_FrontHedgeHog->GetOutput() );
m_BackNormalsMapper = vtkPolyDataMapper::New();
m_Prop3DAssembly->AddPart( m_EdgeActor );
m_Prop3DAssembly->AddPart( m_ImageAssembly );
m_FrontNormalsActor = vtkActor::New();
m_FrontNormalsActor->SetMapper(m_FrontNormalsMapper);
m_BackNormalsActor = vtkActor::New();
m_BackNormalsActor->SetMapper(m_BackNormalsMapper);
m_DefaultLookupTable = vtkLookupTable::New();
m_DefaultLookupTable->SetTableRange( -1024.0, 4096.0 );
m_DefaultLookupTable->SetSaturationRange( 0.0, 0.0 );
m_DefaultLookupTable->SetHueRange( 0.0, 0.0 );
m_DefaultLookupTable->SetValueRange( 0.0, 1.0 );
m_DefaultLookupTable->Build();
m_DefaultLookupTable->SetTableValue( 0, 0.0, 0.0, 0.0, 0.0 );
m_ImageMapperDeletedCommand = MemberCommandType::New();
m_ImageMapperDeletedCommand->SetCallbackFunction(
this, &Geometry2DDataVtkMapper3D::ImageMapperDeletedCallback );
}
Geometry2DDataVtkMapper3D::~Geometry2DDataVtkMapper3D()
{
m_ImageAssembly->Delete();
m_Prop3DAssembly->Delete();
m_EdgeTuber->Delete();
m_EdgeMapper->Delete();
m_EdgeTransformer->Delete();
m_Cleaner->Delete();
m_Edges->Delete();
m_NormalsTransformer->Delete();
m_EdgeActor->Delete();
m_BackgroundMapper->Delete();
m_BackgroundActor->Delete();
m_DefaultLookupTable->Delete();
m_FrontNormalsMapper->Delete();
m_FrontNormalsActor->Delete();
m_FrontHedgeHog->Delete();
m_BackNormalsMapper->Delete();
m_BackNormalsActor->Delete();
m_BackHedgeHog->Delete();
// Delete entries in m_ImageActors list one by one
m_ImageActors.clear();
LookupTablePropertiesList::iterator it;
for(it = m_LookupTableProperties.begin(); it != m_LookupTableProperties.end();++it)
{
if ( it->second.LookupTableSource != NULL )
{
it->second.LookupTableSource->Delete();
it->second.LookupTableSource = NULL;
}
}
m_DataStorage = NULL;
}
vtkProp* Geometry2DDataVtkMapper3D::GetVtkProp(mitk::BaseRenderer * /*renderer*/)
{
if ( (this->GetDataNode() != NULL )
&& (m_ImageAssembly != NULL) )
{
// Do not transform the entire Prop3D assembly, but only the image part
// here. The colored frame is transformed elsewhere (via m_EdgeTransformer),
// since only vertices should be transformed there, not the poly data
// itself, to avoid distortion for anisotropic datasets.
m_ImageAssembly->SetUserTransform( this->GetDataNode()->GetVtkTransform() );
}
return m_Prop3DAssembly;
}
void Geometry2DDataVtkMapper3D::UpdateVtkTransform(mitk::BaseRenderer * /*renderer*/)
{
m_ImageAssembly->SetUserTransform(
this->GetDataNode()->GetVtkTransform(this->GetTimestep()) );
}
const Geometry2DData* Geometry2DDataVtkMapper3D::GetInput()
{
return static_cast<const Geometry2DData * > ( GetData() );
}
void Geometry2DDataVtkMapper3D::SetDataStorageForTexture(mitk::DataStorage* storage)
{
if(storage != NULL && m_DataStorage != storage )
{
m_DataStorage = storage;
this->Modified();
}
}
void Geometry2DDataVtkMapper3D::ImageMapperDeletedCallback(
itk::Object *caller, const itk::EventObject& /*event*/ )
{
ImageMapperGL2D *imageMapper = dynamic_cast< ImageMapperGL2D * >( caller );
if ( (imageMapper != NULL) )
{
if ( m_ImageActors.count( imageMapper ) > 0)
{
m_ImageActors[imageMapper].m_Sender = NULL; // sender is already destroying itself
m_ImageActors.erase( imageMapper );
}
if ( m_LookupTableProperties.count( imageMapper ) > 0 )
{
m_LookupTableProperties[imageMapper].LookupTableSource->Delete();
m_LookupTableProperties.erase( imageMapper );
}
}
}
- void Geometry2DDataVtkMapper3D::GenerateData(BaseRenderer* renderer)
+ void Geometry2DDataVtkMapper3D::GenerateDataForRenderer(BaseRenderer* renderer)
{
SetVtkMapperImmediateModeRendering(m_EdgeMapper);
SetVtkMapperImmediateModeRendering(m_BackgroundMapper);
// Remove all actors from the assembly, and re-initialize it with the
// edge actor
m_ImageAssembly->GetParts()->RemoveAllItems();
if ( !this->IsVisible(renderer) )
{
// visibility has explicitly to be set in the single actors
// due to problems when using cell picking:
// even if the assembly is invisible, the renderer contains
// references to the assemblies parts. During picking the
// visibility of each part is checked, and not only for the
// whole assembly.
m_ImageAssembly->VisibilityOff();
m_EdgeActor->VisibilityOff();
return;
}
// visibility has explicitly to be set in the single actors
// due to problems when using cell picking:
// even if the assembly is invisible, the renderer contains
// references to the assemblies parts. During picking the
// visibility of each part is checked, and not only for the
// whole assembly.
m_ImageAssembly->VisibilityOn();
m_EdgeActor->VisibilityOn();
Geometry2DData::Pointer input = const_cast< Geometry2DData * >(this->GetInput());
if (input.IsNotNull() && (input->GetGeometry2D() != NULL))
{
SmartPointerProperty::Pointer surfacecreatorprop;
surfacecreatorprop = dynamic_cast< SmartPointerProperty * >(GetDataNode()->GetProperty("surfacegeometry", renderer));
if ( (surfacecreatorprop.IsNull())
|| (surfacecreatorprop->GetSmartPointer().IsNull())
|| ((m_SurfaceCreator = dynamic_cast<Geometry2DDataToSurfaceFilter*>
(surfacecreatorprop->GetSmartPointer().GetPointer())).IsNull() ) )
{
m_SurfaceCreator->PlaceByGeometryOn();
surfacecreatorprop = SmartPointerProperty::New( m_SurfaceCreator );
GetDataNode()->SetProperty("surfacegeometry", surfacecreatorprop);
}
m_SurfaceCreator->SetInput(input);
int res;
if (GetDataNode()->GetIntProperty("xresolution", res, renderer))
{
m_SurfaceCreator->SetXResolution(res);
}
if (GetDataNode()->GetIntProperty("yresolution", res, renderer))
{
m_SurfaceCreator->SetYResolution(res);
}
double tubeRadius = 1.0; // Radius of tubular edge surrounding plane
// Clip the Geometry2D with the reference geometry bounds (if available)
if ( input->GetGeometry2D()->HasReferenceGeometry() )
{
Geometry3D *referenceGeometry =
input->GetGeometry2D()->GetReferenceGeometry();
BoundingBox::PointType boundingBoxMin, boundingBoxMax;
boundingBoxMin = referenceGeometry->GetBoundingBox()->GetMinimum();
boundingBoxMax = referenceGeometry->GetBoundingBox()->GetMaximum();
if ( referenceGeometry->GetImageGeometry() )
{
for ( unsigned int i = 0; i < 3; ++i )
{
boundingBoxMin[i] -= 0.5;
boundingBoxMax[i] -= 0.5;
}
}
m_SurfaceCreatorPointsContainer->CreateElementAt( 0 ) = boundingBoxMin;
m_SurfaceCreatorPointsContainer->CreateElementAt( 1 ) = boundingBoxMax;
m_SurfaceCreatorBoundingBox->ComputeBoundingBox();
m_SurfaceCreator->SetBoundingBox( m_SurfaceCreatorBoundingBox );
tubeRadius = referenceGeometry->GetDiagonalLength() / 450.0;
}
// If no reference geometry is available, clip with the current global
// bounds
else if (m_DataStorage.IsNotNull())
{
m_SurfaceCreator->SetBoundingBox(m_DataStorage->ComputeVisibleBoundingBox(NULL, "includeInBoundingBox"));
tubeRadius = sqrt( m_SurfaceCreator->GetBoundingBox()->GetDiagonalLength2() ) / 450.0;
}
// Calculate the surface of the Geometry2D
m_SurfaceCreator->Update();
Surface *surface = m_SurfaceCreator->GetOutput();
// Check if there's something to display, otherwise return
if ( (surface->GetVtkPolyData() == 0 )
|| (surface->GetVtkPolyData()->GetNumberOfCells() == 0) )
{
m_ImageAssembly->VisibilityOff();
return;
}
// add a graphical representation of the surface normals if requested
DataNode* node = this->GetDataNode();
bool displayNormals = false;
bool colorTwoSides = false;
bool invertNormals = false;
node->GetBoolProperty("draw normals 3D", displayNormals, renderer);
node->GetBoolProperty("color two sides", colorTwoSides, renderer);
node->GetBoolProperty("invert normals", invertNormals, renderer);
//if we want to draw the display normals or render two sides we have to get the colors
if( displayNormals || colorTwoSides )
{
//get colors
float frontColor[3] = { 0.0, 0.0, 1.0 };
node->GetColor( frontColor, renderer, "front color" );
float backColor[3] = { 1.0, 0.0, 0.0 };
node->GetColor( backColor, renderer, "back color" );
if ( displayNormals )
{
m_NormalsTransformer->SetInput( surface->GetVtkPolyData() );
m_NormalsTransformer->SetTransform(node->GetVtkTransform(this->GetTimestep()) );
m_FrontHedgeHog->SetInput( m_NormalsTransformer->GetOutput() );
m_FrontHedgeHog->SetVectorModeToUseNormal();
m_FrontHedgeHog->SetScaleFactor( invertNormals ? 1.0 : -1.0 );
m_FrontNormalsActor->GetProperty()->SetColor( frontColor[0], frontColor[1], frontColor[2] );
m_BackHedgeHog->SetInput( m_NormalsTransformer->GetOutput() );
m_BackHedgeHog->SetVectorModeToUseNormal();
m_BackHedgeHog->SetScaleFactor( invertNormals ? -1.0 : 1.0 );
m_BackNormalsActor->GetProperty()->SetColor( backColor[0], backColor[1], backColor[2] );
//if there is no actor added yet, add one
if ( !m_NormalsActorAdded )
{
m_Prop3DAssembly->AddPart( m_FrontNormalsActor );
m_Prop3DAssembly->AddPart( m_BackNormalsActor );
m_NormalsActorAdded = true;
}
}
//if we don't want to display normals AND there is an actor added remove the actor
else if ( m_NormalsActorAdded )
{
m_Prop3DAssembly->RemovePart( m_FrontNormalsActor );
m_Prop3DAssembly->RemovePart( m_BackNormalsActor );
m_NormalsActorAdded = false;
}
if ( colorTwoSides )
{
if ( !invertNormals )
{
m_BackgroundActor->GetProperty()->SetColor( backColor[0], backColor[1], backColor[2] );
m_BackgroundActor->GetBackfaceProperty()->SetColor( frontColor[0], frontColor[1], frontColor[2] );
}
else
{
m_BackgroundActor->GetProperty()->SetColor( frontColor[0], frontColor[1], frontColor[2] );
m_BackgroundActor->GetBackfaceProperty()->SetColor( backColor[0], backColor[1], backColor[2] );
}
}
}
// Add black background for all images (which may be transparent)
m_BackgroundMapper->SetInput( surface->GetVtkPolyData() );
m_ImageAssembly->AddPart( m_BackgroundActor );
LayerSortedActorList layerSortedActors;
// Traverse the data tree to find nodes resliced by ImageMapperGL2D
mitk::NodePredicateOr::Pointer p = mitk::NodePredicateOr::New();
//use a predicate to get all data nodes which are "images" or inherit from mitk::Image
mitk::TNodePredicateDataType< mitk::Image >::Pointer predicateAllImages = mitk::TNodePredicateDataType< mitk::Image >::New();
mitk::DataStorage::SetOfObjects::ConstPointer all = m_DataStorage->GetSubset(predicateAllImages);
//process all found images
for (mitk::DataStorage::SetOfObjects::ConstIterator it = all->Begin(); it != all->End(); ++it)
{
DataNode *node = it->Value();
if (node != NULL)
this->ProcessNode(node, renderer, surface, layerSortedActors);
}
// Add all image actors to the assembly, sorted according to
// layer property
LayerSortedActorList::iterator actorIt;
for ( actorIt = layerSortedActors.begin(); actorIt != layerSortedActors.end(); ++actorIt )
{
m_ImageAssembly->AddPart( actorIt->second );
}
// Configurate the tube-shaped frame: size according to the surface
// bounds, color as specified in the plane's properties
vtkPolyData *surfacePolyData = surface->GetVtkPolyData();
m_Cleaner->SetInput(surfacePolyData);
m_EdgeTransformer->SetTransform(this->GetDataNode()->GetVtkTransform(this->GetTimestep()) );
// Adjust the radius according to extent
m_EdgeTuber->SetRadius( tubeRadius );
// Get the plane's color and set the tube properties accordingly
ColorProperty::Pointer colorProperty;
colorProperty = dynamic_cast<ColorProperty*>(this->GetDataNode()->GetProperty( "color" ));
if ( colorProperty.IsNotNull() )
{
const Color& color = colorProperty->GetColor();
m_EdgeActor->GetProperty()->SetColor(color.GetRed(), color.GetGreen(), color.GetBlue());
}
else
{
m_EdgeActor->GetProperty()->SetColor( 1.0, 1.0, 1.0 );
}
m_ImageAssembly->SetUserTransform(this->GetDataNode()->GetVtkTransform(this->GetTimestep()) );
}
VtkRepresentationProperty* representationProperty;
this->GetDataNode()->GetProperty(representationProperty, "material.representation", renderer);
if ( representationProperty != NULL )
m_BackgroundActor->GetProperty()->SetRepresentation( representationProperty->GetVtkRepresentation() );
}
void Geometry2DDataVtkMapper3D::ProcessNode( DataNode * node, BaseRenderer* renderer,
Surface * surface, LayerSortedActorList &layerSortedActors )
{
if ( node != NULL )
{
//we need to get the information from the 2D mapper to render the texture on the 3D plane
ImageMapperGL2D *imageMapper = dynamic_cast< ImageMapperGL2D * >( node->GetMapper(1) ); //GetMapper(1) provides the 2D mapper for the data node
//if there is a 2D mapper, which is not the standard image mapper...
if(!imageMapper && node->GetMapper(1))
{ //... check if it is the composite mapper
std::string cname(node->GetMapper(1)->GetNameOfClass());
if(!cname.compare("CompositeMapper")) //string.compare returns 0 if the two strings are equal.
{
//get the standard image mapper.
//This is a special case in MITK and does only work for the CompositeMapper.
imageMapper = dynamic_cast<ImageMapperGL2D* >( node->GetMapper(3) );
}
}
if ( (node->IsVisible(renderer)) && imageMapper )
{
WeakPointerProperty::Pointer rendererProp =
dynamic_cast< WeakPointerProperty * >(GetDataNode()->GetPropertyList()->GetProperty("renderer"));
if ( rendererProp.IsNotNull() )
{
BaseRenderer::Pointer planeRenderer = dynamic_cast< BaseRenderer * >(rendererProp->GetWeakPointer().GetPointer());
if ( planeRenderer.IsNotNull() )
{
// If it has not been initialized already in a previous pass,
// generate an actor, a lookup table and a texture object to
// render the image associated with the ImageMapperGL2D.
vtkActor *imageActor;
vtkDataSetMapper *dataSetMapper = NULL;
vtkLookupTable *lookupTable;
vtkTexture *texture;
if ( m_ImageActors.count( imageMapper ) == 0 )
{
dataSetMapper = vtkDataSetMapper::New();
//Enable rendering without copying the image.
dataSetMapper->ImmediateModeRenderingOn();
lookupTable = vtkLookupTable::New();
lookupTable->DeepCopy( m_DefaultLookupTable );
texture = vtkTexture::New();
texture->SetLookupTable( lookupTable );
texture->RepeatOff();
imageActor = vtkActor::New();
imageActor->GetProperty()->SetAmbient( 0.5 );
imageActor->SetMapper( dataSetMapper );
imageActor->SetTexture( texture );
// Make imageActor the sole owner of the mapper and texture
// objects
lookupTable->UnRegister( NULL );
dataSetMapper->UnRegister( NULL );
texture->UnRegister( NULL );
// Store the actor so that it may be accessed in following
// passes.
m_ImageActors[imageMapper].Initialize(imageActor, imageMapper, m_ImageMapperDeletedCommand);
}
else
{
// Else, retrieve the actor and associated objects from the
// previous pass.
imageActor = m_ImageActors[imageMapper].m_Actor;
dataSetMapper = (vtkDataSetMapper *)imageActor->GetMapper();
texture = imageActor->GetTexture();
//BUG (#1551) added dynamic cast for VTK5.2 support
#if ( ( VTK_MAJOR_VERSION >= 5 ) && ( VTK_MINOR_VERSION>=2) )
lookupTable = dynamic_cast<vtkLookupTable*>(texture->GetLookupTable());
#else
lookupTable = texture->GetLookupTable();
#endif
}
// Set poly data new each time its object changes (e.g. when
// switching between planar and curved geometries)
if ( (dataSetMapper != NULL) && (dataSetMapper->GetInput() != surface->GetVtkPolyData()) )
{
dataSetMapper->SetInput( surface->GetVtkPolyData() );
}
imageActor->GetMapper()->GetInput()->Update();
imageActor->GetMapper()->Update();
// We have to do this before GenerateAllData() is called
// since there may be no RendererInfo for renderer yet,
// thus GenerateAllData won't update the (non-existing)
// RendererInfo for renderer. By calling GetRendererInfo
// a RendererInfo will be created for renderer (if it does not
// exist yet).
imageMapper->GetRendererInfo( planeRenderer );
imageMapper->GenerateAllData();
// ensure the right openGL context, as 3D widgets may render and take their plane texture from 2D image mappers
renderer->GetRenderWindow()->MakeCurrent();
// Retrieve and update image to be mapped
const ImageMapperGL2D::RendererInfo *rit = imageMapper->GetRendererInfo( planeRenderer );
if(rit->m_Image != NULL)
{
rit->m_Image->Update();
//set the 2D image as texture for the 3D plane
texture->SetInput( rit->m_Image );
//default level window
ScalarType windowMin = 0.0;
ScalarType windowMax = 255.0;
LevelWindow levelWindow;
bool binary = false;
node->GetBoolProperty( "binary", binary, renderer );
// check for "use color"
bool useColor = false;
node->GetBoolProperty( "use color", useColor, planeRenderer );
// VTK (mis-)interprets unsigned char (binary) images as color images;
// So, we must manually turn on their mapping through a (gray scale) lookup table;
texture->SetMapColorScalarsThroughLookupTable(binary);
//if we have a binary image, the range is just 0 to 1
if( binary )
{
windowMin = 0;
windowMax = 1;
useColor = true;
}
// check for level-window-prop and use it if it exists
if( !binary &&
( node->GetLevelWindow( levelWindow, planeRenderer, "levelWindow" )
|| node->GetLevelWindow( levelWindow, planeRenderer ) ) )
{
windowMin = levelWindow.GetLowerWindowBound();
windowMax = levelWindow.GetUpperWindowBound();
}
vtkLookupTable *lookupTableSource;
// check for LookupTable
LookupTableProperty::Pointer lookupTableProp;
lookupTableProp = dynamic_cast< LookupTableProperty * >(node->GetPropertyList()->GetProperty( "LookupTable" ));
// If there is a lookup table supplied and we don't
// want to use the color property, use it;
//otherwise, use the default grayscale table
if ( lookupTableProp.IsNotNull() && !useColor )
{
lookupTableSource = lookupTableProp->GetLookupTable()->GetVtkLookupTable();
}
else
{
lookupTableSource = m_DefaultLookupTable;
}
LookupTableProperties &lutProperties =
m_LookupTableProperties[imageMapper];
// If there has been some change since the last pass which
// makes it necessary to re-build the lookup table, do it.
if ( (lutProperties.LookupTableSource != lookupTableSource)
|| (lutProperties.windowMin != windowMin)
|| (lutProperties.windowMax != windowMax) )
{
// Note the values for the next pass (lutProperties is a
// reference to the list entry!)
if ( lutProperties.LookupTableSource != NULL )
{
lutProperties.LookupTableSource->Delete();
}
lutProperties.LookupTableSource = lookupTableSource;
lutProperties.LookupTableSource->Register( NULL );
lutProperties.windowMin = windowMin;
lutProperties.windowMax = windowMax;
lookupTable->DeepCopy( lookupTableSource );
lookupTable->SetRange( windowMin, windowMax );
}
//get the color
float rgb[3] = { 1.0, 1.0, 1.0 };
node->GetColor( rgb, renderer );
// Apply color property (of the node, not of the plane)
// if we want to use the color
if(useColor)
{
imageActor->GetProperty()->SetColor( rgb[0], rgb[1], rgb[2] );
}
else //else default color = white to avoid site effects from the lookuptable
{
imageActor->GetProperty()->SetColor( 1, 1, 1 );
}
// Apply opacity property (of the node, not of the plane)
float opacity = 0.999;
node->GetOpacity( opacity, renderer );
imageActor->GetProperty()->SetOpacity( opacity );
// Set texture interpolation on/off
bool textureInterpolation = node->IsOn( "texture interpolation", renderer );
texture->SetInterpolate( textureInterpolation );
// Store this actor to be added to the actor assembly, sort
// by layer
int layer = 1;
node->GetIntProperty( "layer", layer );
layerSortedActors.insert(std::pair< int, vtkActor * >( layer, imageActor ) );
}
}
}
}
}
}
void Geometry2DDataVtkMapper3D::ActorInfo::Initialize(vtkActor* actor, itk::Object* sender, itk::Command* command)
{
m_Actor = actor;
m_Sender = sender;
// Get informed when ImageMapper object is deleted, so that
// the data structures built here can be deleted as well
m_ObserverID = sender->AddObserver( itk::DeleteEvent(), command );
}
Geometry2DDataVtkMapper3D::ActorInfo::ActorInfo() : m_Actor(NULL), m_Sender(NULL), m_ObserverID(0)
{
}
Geometry2DDataVtkMapper3D::ActorInfo::~ActorInfo()
{
if(m_Sender != NULL)
{
m_Sender->RemoveObserver(m_ObserverID);
}
if(m_Actor != NULL)
{
m_Actor->Delete();
}
}
} // namespace mitk
diff --git a/Core/Code/Rendering/mitkGeometry2DDataVtkMapper3D.h b/Core/Code/Rendering/mitkGeometry2DDataVtkMapper3D.h
index a19efee794..fd05eb282a 100644
--- a/Core/Code/Rendering/mitkGeometry2DDataVtkMapper3D.h
+++ b/Core/Code/Rendering/mitkGeometry2DDataVtkMapper3D.h
@@ -1,234 +1,234 @@
/*=========================================================================
Program: Medical Imaging & Interaction Toolkit
Language: C++
Date: $Date$
Version: $Revision$
Copyright (c) German Cancer Research Center, Division of Medical and
Biological Informatics. All rights reserved.
See MITKCopyright.txt or http://www.mitk.org/copyright.html for details.
This software is distributed WITHOUT ANY WARRANTY; without even
the implied warranty of MERCHANTABILITY or FITNESS FOR A PARTICULAR
PURPOSE. See the above copyright notices for more information.
=========================================================================*/
#ifndef MITKGEOMETRY2DDATAVTKMAPPER3D_H_HEADER_INCLUDED_C196C71F
#define MITKGEOMETRY2DDATAVTKMAPPER3D_H_HEADER_INCLUDED_C196C71F
#include "mitkCommon.h"
#include "mitkVtkMapper3D.h"
#include "mitkDataStorage.h"
#include "mitkGeometry2DDataToSurfaceFilter.h"
#include "mitkWeakPointer.h"
#include <vtkSystemIncludes.h>
#include <vtkCleanPolyData.h>
class vtkActor;
class vtkPolyDataMapper;
class vtkDataSetMapper;
class vtkLookupTable;
class vtkAssembly;
class vtkFeatureEdges;
class vtkTubeFilter;
class vtkTransformPolyDataFilter;
class vtkHedgeHog;
namespace mitk {
class Geometry2DData;
class BaseRenderer;
class ImageMapperGL2D;
class DataStorage;
/**
* \brief Vtk-based mapper to display a Geometry2D in a 3D window
* \ingroup Mapper
*
* Uses a Geometry2DDataToSurfaceFilter object to create a vtkPolyData representation of a given Geometry2D instance.
* Geometry2D may either contain a common flat plane or a curved plane (ThinPlateSplineCurvedGeometry).
*
* The vtkPolyData object is then decorated by a colored tube on the edges and by image textures if possible
* (currently this requires that there is a 2D render window rendering the same geometry as this mapper).
*
* Properties that influence rendering are:
*
* - \b "color": (ColorProperty) Color of the tubed frame.
* - \b "xresolution": (FloatProperty) Resolution (=number of tiles) in x direction. Only relevant for ThinPlateSplineCurvedGeometry
* - \b "yresolution": (FloatProperty) Resolution (=number of tiles) in y direction. Only relevant for ThinPlateSplineCurvedGeometry
* - \b "draw normals 3D": (BoolProperty) If true, a vtkHedgeHog is used to display normals for the generated surface object. Useful to distinguish front and back of a plane. Hedgehogs are colored according to "front color" and "back color"
* - \b "color two sides": (BoolProperty) If true, front and back side of the plane are colored differently ("front color" and "back color")
* - \b "invert normals": (BoolProperty) Inverts front/back for display.
* - \b "front color": (ColorProperty) Color for front side of the plane
* - \b "back color": (ColorProperty) Color for back side of the plane
* - \b "material.representation": (BoolProperty) Choose the representation to draw the mesh in (Surface, Wireframe, Point Cloud)
* - \b "surfacegeometry": TODO: Add documentation
* - \b "LookupTable": (LookupTableProperty) Set the lookuptable to render with.
*
* Note: The following properties are set for each image individually, and thus, also influence the rendering of this mapper:
*
* - \b "texture interpolation": (BoolProperty) Turn on/off the texture interpolation of each image
* - \b "use color": (BoolProperty) Decide whether we want to use the color property or a lookuptable.
* - \b "binary": (BoolProperty) Binary image handling: Color the value=1.0 with the color property and make the background (value=0.0) of the image translucent.
* - \b "layer": (IntProperty) Controls what image is considered "on top" of another. In the case that two should inhabit the same space, higher layer occludes lower layer.
* - \b "opacity": (FloatProperty) Set the opacity for each rendered image.
* - \b "color": (FloatProperty) Set the color for each rendered image.
*
* The internal filter pipeline which combines a (sometimes deformed) 2D surface
* with a nice frame and image textures is illustrated in the following sketch:
*
* \image html mitkGeometry2DDataVtkMapper3D.png "Internal filter pipeline"
*
*/
class MITK_CORE_EXPORT Geometry2DDataVtkMapper3D : public VtkMapper3D
{
public:
mitkClassMacro(Geometry2DDataVtkMapper3D, VtkMapper3D);
itkNewMacro(Geometry2DDataVtkMapper3D);
/**
* Overloaded since the displayed color-frame of the image mustn't be
* transformed after generation of poly data, but before (vertex coordinates
* only)
*/
virtual vtkProp *GetVtkProp(mitk::BaseRenderer *renderer);
virtual void UpdateVtkTransform(mitk::BaseRenderer *renderer);
/**
* \brief Get the Geometry2DData to map
*/
virtual const Geometry2DData *GetInput();
/**
* \brief All images found when traversing the (sub-) tree starting at
* \a iterator which are resliced by an ImageMapperGL2D will be mapped.
* This method is used to set the data storage to traverse. This offers
* the possibility to use this mapper for other data storages (not only
* the default data storage).
*/
virtual void SetDataStorageForTexture(mitk::DataStorage* storage);
protected:
typedef std::multimap< int, vtkActor * > LayerSortedActorList;
Geometry2DDataVtkMapper3D();
virtual ~Geometry2DDataVtkMapper3D();
- virtual void GenerateData(BaseRenderer* renderer);
+ virtual void GenerateDataForRenderer(BaseRenderer* renderer);
void ProcessNode( DataNode * node, BaseRenderer* renderer, Surface * surface, LayerSortedActorList &layerSortedActors );
void ImageMapperDeletedCallback( itk::Object *caller, const itk::EventObject &event );
/** \brief general PropAssembly to hold the entire scene */
vtkAssembly *m_Prop3DAssembly;
/** \brief PropAssembly to hold the planes */
vtkAssembly *m_ImageAssembly;
Geometry2DDataToSurfaceFilter::Pointer m_SurfaceCreator;
BoundingBox::Pointer m_SurfaceCreatorBoundingBox;
BoundingBox::PointsContainer::Pointer m_SurfaceCreatorPointsContainer;
/** \brief Edge extractor for tube-shaped frame */
vtkFeatureEdges *m_Edges;
/** \brief Filter to apply object transform to the extracted edges */
vtkTransformPolyDataFilter *m_EdgeTransformer;
/** \brief Source to create the tube-shaped frame */
vtkTubeFilter *m_EdgeTuber;
/** \brief Mapper for the tube-shaped frame */
vtkPolyDataMapper *m_EdgeMapper;
/** \brief Actor for the tube-shaped frame */
vtkActor *m_EdgeActor;
/** \brief Mapper for black plane background */
vtkPolyDataMapper *m_BackgroundMapper;
/** \brief Actor for black plane background */
vtkActor *m_BackgroundActor;
/** \brief Transforms the suface before applying the glyph filter */
vtkTransformPolyDataFilter* m_NormalsTransformer;
/** \brief Mapper for normals representation (thin lines) */
vtkPolyDataMapper* m_FrontNormalsMapper;
vtkPolyDataMapper* m_BackNormalsMapper;
/** \brief Generates lines for surface normals */
vtkHedgeHog* m_FrontHedgeHog;
vtkHedgeHog* m_BackHedgeHog;
/** \brief Actor to hold the normals arrows */
vtkActor* m_FrontNormalsActor;
vtkActor* m_BackNormalsActor;
/** Cleans the polyline in order to avoid phantom boundaries */
vtkCleanPolyData *m_Cleaner;
/** Internal flag, if actors for normals are already added to m_Prop3DAssembly*/
bool m_NormalsActorAdded;
/** \brief The DataStorage defines which part of the data tree is traversed for renderering. */
mitk::WeakPointer<mitk::DataStorage> m_DataStorage;
/** A default grayscale lookup-table, used for reference */
vtkLookupTable *m_DefaultLookupTable;
class MITK_CORE_EXPORT ActorInfo
{
public:
vtkActor * m_Actor;
// we do not need a smart-pointer, because we delete our
// connection, when the referenced mapper is destroyed
itk::Object* m_Sender;
unsigned long m_ObserverID;
void Initialize(vtkActor* actor, itk::Object* sender, itk::Command* command);
ActorInfo();
~ActorInfo();
};
/** \brief List holding the vtkActor to map the image into 3D for each
* ImageMapper
*/
typedef std::map< ImageMapperGL2D *, ActorInfo > ActorList;
ActorList m_ImageActors;
struct LookupTableProperties
{
LookupTableProperties()
: LookupTableSource( NULL ),
windowMin( 0.0 ),
windowMax( 4096.0 )
{}
vtkLookupTable *LookupTableSource;
vtkFloatingPointType windowMin;
vtkFloatingPointType windowMax;
};
typedef std::map< ImageMapperGL2D *, LookupTableProperties >
LookupTablePropertiesList;
/** \brief List holding some lookup table properties of the previous pass */
LookupTablePropertiesList m_LookupTableProperties;
// responsiblity to remove the observer upon its destruction
typedef itk::MemberCommand< Geometry2DDataVtkMapper3D > MemberCommandType;
MemberCommandType::Pointer m_ImageMapperDeletedCommand;
};
} // namespace mitk
#endif /* MITKGEOMETRY2DDATAVTKMAPPER3D_H_HEADER_INCLUDED_C196C71F */
diff --git a/Core/Code/Rendering/mitkImageMapperGL2D.cpp b/Core/Code/Rendering/mitkImageMapperGL2D.cpp
index 8bc256e8c6..4dcfdf44fd 100644
--- a/Core/Code/Rendering/mitkImageMapperGL2D.cpp
+++ b/Core/Code/Rendering/mitkImageMapperGL2D.cpp
@@ -1,1392 +1,1392 @@
/*=========================================================================
Program: Medical Imaging & Interaction Toolkit
Language: C++
Date: $Date$
Version: $Revision$
Copyright (c) German Cancer Research Center, Division of Medical and
Biological Informatics. All rights reserved.
See MITKCopyright.txt or http://www.mitk.org/copyright.html for details.
This software is distributed WITHOUT ANY WARRANTY; without even
the implied warranty of MERCHANTABILITY or FITNESS FOR A PARTICULAR
PURPOSE. See the above copyright notices for more information.
=========================================================================*/
#include "mitkImageMapperGL2D.h"
#include "widget.h"
#include "picimage.h"
#include "pic2vtk.h"
#include "mitkTimeSlicedGeometry.h"
#include "mitkPlaneGeometry.h"
#include "mitkDataNode.h"
#include "mitkVtkPropRenderer.h"
#include "mitkLookupTableProperty.h"
#include "mitkProperties.h"
#include "mitkLevelWindowProperty.h"
#include "mitkVtkResliceInterpolationProperty.h"
#include "mitkVolumeCalculator.h"
#include "mitkImageSliceSelector.h"
#include "mitkAbstractTransformGeometry.h"
#include "mitkDataNodeFactory.h"
#include "mitkResliceMethodProperty.h"
#include <vtkTransform.h>
#include <vtkGeneralTransform.h>
#include <vtkMatrix4x4.h>
#include <vtkLookupTable.h>
#include <vtkImageData.h>
#include <vtkPoints.h>
#include <vtkFloatArray.h>
#include <vtkLinearTransform.h>
#include <vtkImageReslice.h>
#include <vtkImageChangeInformation.h>
#include "vtkMitkThickSlicesFilter.h"
#include "itkRGBAPixel.h"
int mitk::ImageMapperGL2D::numRenderer = 0;
mitk::ImageMapperGL2D::ImageMapperGL2D()
{
}
mitk::ImageMapperGL2D::~ImageMapperGL2D()
{
this->Clear();
this->InvokeEvent( itk::DeleteEvent() );
}
void
mitk::ImageMapperGL2D::Paint( mitk::BaseRenderer *renderer )
{
if ( !this->IsVisible( renderer ) )
{
return;
}
this->Update( renderer );
RendererInfo &rendererInfo = this->AccessRendererInfo( renderer );
iil4mitkPicImage *image = rendererInfo.Get_iil4mitkImage();
if ( ( image == NULL ) || ( image->image() == NULL ) )
{
return;
}
const mitk::DisplayGeometry *displayGeometry = renderer->GetDisplayGeometry();
Vector2D topLeft = displayGeometry->GetOriginInMM();
Vector2D bottomRight = topLeft + displayGeometry->GetSizeInMM();
topLeft[0] *= rendererInfo.m_PixelsPerMM[0];
topLeft[1] *= rendererInfo.m_PixelsPerMM[1];
bottomRight[0] *= rendererInfo.m_PixelsPerMM[0];
bottomRight[1] *= rendererInfo.m_PixelsPerMM[1];
topLeft += rendererInfo.m_Overlap;
bottomRight += rendererInfo.m_Overlap;
Vector2D diag = ( topLeft - bottomRight );
//float size = diag.GetNorm();
glMatrixMode( GL_PROJECTION );
glLoadIdentity();
glOrtho( topLeft[0], bottomRight[0], topLeft[1], bottomRight[1], 0.0, 1.0 );
glMatrixMode( GL_MODELVIEW );
glDepthMask(GL_FALSE);
// Define clipping planes to clip the image according to the bounds
// correlating to the current world geometry. The "extent" of the bounds
// needs to be enlarged by an "overlap" factor, in order to make the
// remaining area are large enough to cover rotated planes also.
//
// Note that this can be improved on, by not merely using a large enough
// rectangle for clipping, but using the side surfaces of the transformed
// 3D bounds as clipping planes instead. This would clip even rotates
// planes at their exact intersection lines with the 3D bounding box.
//GLdouble eqn0[4] = { 1.0, 0.0, 0.0, 0.0 };
//GLdouble eqn1[4] = { -1.0, 0.0, 0.0, rendererInfo.m_Extent[0]
// + 2.0 * rendererInfo.m_Overlap[0]/* - rendererInfo.m_PixelsPerMM[0]*/ };
//MITK_INFO << "X: " << rendererInfo.m_Extent[0]
// + 2.0 * rendererInfo.m_Overlap[0] - rendererInfo.m_PixelsPerMM[0] << std::endl;
//GLdouble eqn2[4] = { 0.0, 1.0, 0.0, 0.0 };
//GLdouble eqn3[4] = { 0.0, -1.0, 0.0, rendererInfo.m_Extent[1]
// + 2.0 * rendererInfo.m_Overlap[1]/* - rendererInfo.m_PixelsPerMM[1]*/ };
//MITK_INFO << "Y:" << rendererInfo.m_Extent[1]
// + 2.0 * rendererInfo.m_Overlap[1] - rendererInfo.m_PixelsPerMM[1] << std::endl;
// IW commented out the previous lines and reverted to rev. 9358
// (version before rev. 9443) See bug #625
GLdouble eqn0[4] = {0.0, 1.0, 0.0, 0.0};
GLdouble eqn1[4] = {1.0, 0.0, 0.0, 0.0};
GLdouble eqn2[4] = {-1.0, 0.0 , 0.0, image->width()};
GLdouble eqn3[4] = {0, -1.0, 0.0, image->height() };
glClipPlane( GL_CLIP_PLANE0, eqn0 );
glEnable( GL_CLIP_PLANE0 );
glClipPlane( GL_CLIP_PLANE1, eqn1 );
glEnable( GL_CLIP_PLANE1 );
glClipPlane( GL_CLIP_PLANE2, eqn2 );
glEnable( GL_CLIP_PLANE2 );
glClipPlane( GL_CLIP_PLANE3, eqn3 );
glEnable( GL_CLIP_PLANE3 );
// Render the image
image->setInterpolation( rendererInfo.m_TextureInterpolation );
image->display( renderer->GetRenderWindow() );
// Disable the utilized clipping planes
glDisable( GL_CLIP_PLANE0 );
glDisable( GL_CLIP_PLANE1 );
glDisable( GL_CLIP_PLANE2 );
glDisable( GL_CLIP_PLANE3 );
// display volume property, if it exists and should be displayed
bool shouldShowVolume = false, binary = false;
float segmentationVolume = -1.0;
mitk::DataNode *node = this->GetDataNode();
mitk::Image* mitkimage = dynamic_cast<mitk::Image*>(node->GetData());
// Check if a volume in ml can be drawn in the image.
// This is the case if:
// 1. The property "showVolume" is true AND [
// 2.1 The image has a volume stored as property (3D case) OR
// 2.2 The image is 3D or 4D and binary, so the volume can be calculated ]
if (
(node->GetBoolProperty("showVolume", shouldShowVolume)) &&
(shouldShowVolume) &&
(
(node->GetFloatProperty("volume", segmentationVolume) )
||
(mitkimage != NULL &&
mitkimage->GetDimension() >= 3 &&
node->GetBoolProperty("binary", binary) &&
binary)
)
)
{
// calculate screen position for text by searching for the object border
mitkIpPicDescriptor* pic = image->image();
// search object border in current slice
unsigned int s_x = 0;
unsigned int s_y = 0;
unsigned int s_n = 0;
for(unsigned int y=0;y<pic->n[1];y++)
for(unsigned int x=0;x<pic->n[0];x++)
{
bool set=false;
switch ( pic->bpe )
{
case 8: {
mitkIpInt1_t *current = static_cast< mitkIpInt1_t *>( pic->data );
current += y*pic->n[0] + x;
if(current[0]) set=true;
break; }
case 16: {
mitkIpInt2_t *current = static_cast< mitkIpInt2_t *>( pic->data );
current += y*pic->n[0] + x;
if(current[0]) set=true;
break; }
case 24: {
mitkIpInt1_t *current = static_cast< mitkIpInt1_t *>( pic->data );
current += ( y*pic->n[0] + x )*3;
if(current[0]||current[1]||current[2]) set=true;
break; }
}
if(set)
{
if ( x > s_x ) s_x = x;
if ( y > s_y ) s_y = y;
s_n++;
}
}
// if an object has been found, draw annotation
if ( s_n>0 )
{
// make sure a segmentation volume is present
if( segmentationVolume <= 0 )
{
// if not, check if the image is truly binary
if( mitkimage->GetScalarValueMax( renderer->GetTimeStep() ) == 1 )
{
// if yes, get the volume from image statistics
segmentationVolume = mitk::VolumeCalculator::ComputeVolume(
mitkimage->GetSlicedGeometry()->GetSpacing(), mitkimage->GetCountOfMaxValuedVoxelsNoRecompute(renderer->GetTimeStep()));
}
}
// create text
std::stringstream volumeString;
volumeString << std::fixed << std::setprecision(1) << segmentationVolume;
std::string unit;
if (node->GetStringProperty("volume annotation unit", unit))
{
volumeString << " " << unit;
}
else
{
volumeString << " ml";
}
// draw text
mitk::VtkPropRenderer* OpenGLrenderer = dynamic_cast<mitk::VtkPropRenderer*>( renderer );
//calc index pos
Point2D pt2D;
pt2D[0] = s_x;
pt2D[1] = s_y;
//calc index pos with spacing
const Geometry2D *worldGeometry = renderer->GetCurrentWorldGeometry2D();
//calc display coord
worldGeometry->IndexToWorld( pt2D, pt2D );
displayGeometry->WorldToDisplay( pt2D, pt2D );
mitk::ColorProperty::Pointer annotationColorProp;
mitk::Color annotationColor;
annotationColor.Set(0,1,0);
if (node->GetProperty(annotationColorProp, "volume annotation color"))
{
annotationColor = annotationColorProp->GetColor();
}
bool hover = false;
bool selected = false;
GetDataNode()->GetBoolProperty("binaryimage.ishovering", hover, renderer);
GetDataNode()->GetBoolProperty("selected", selected, renderer);
if(hover)
{
mitk::ColorProperty::Pointer colorprop = dynamic_cast<mitk::ColorProperty*>(GetDataNode()->GetProperty
("binaryimage.hoveringcolor", renderer));
if(colorprop.IsNotNull())
annotationColor = colorprop->GetColor();
}
if(selected)
{
mitk::ColorProperty::Pointer colorprop = dynamic_cast<mitk::ColorProperty*>(GetDataNode()->GetProperty
("binaryimage.selectedcolor", renderer));
if(colorprop.IsNotNull())
annotationColor = colorprop->GetColor();
}
OpenGLrenderer->WriteSimpleText(volumeString.str(), pt2D[0]+1, pt2D[1]-1,0,0,0); //this is a shadow
OpenGLrenderer->WriteSimpleText(volumeString.str(), pt2D[0] , pt2D[1] ,annotationColor.GetRed()
,annotationColor.GetGreen()
,annotationColor.GetBlue());
}
}
//glPushMatrix();
glMatrixMode( GL_PROJECTION );
glLoadIdentity();
glOrtho(
0.0, displayGeometry->GetDisplayWidth(),
0.0, displayGeometry->GetDisplayHeight(),
0.0, 1.0
);
glDepthMask(GL_TRUE);
//glMatrixMode( GL_MODELVIEW );
//glPopMatrix();
}
const mitk::ImageMapperGL2D::InputImageType *
mitk::ImageMapperGL2D::GetInput( void )
{
return static_cast< const mitk::ImageMapperGL2D::InputImageType * >( this->GetData() );
}
int
mitk::ImageMapperGL2D::GetAssociatedChannelNr( mitk::BaseRenderer *renderer )
{
RendererInfo &rendererInfo = this->AccessRendererInfo( renderer );
return rendererInfo.GetRendererID();
}
void
-mitk::ImageMapperGL2D::GenerateData( mitk::BaseRenderer *renderer )
+mitk::ImageMapperGL2D::GenerateDataForRenderer( mitk::BaseRenderer *renderer )
{
mitk::Image *input = const_cast< mitk::ImageMapperGL2D::InputImageType * >(
this->GetInput()
);
input->Update();
if ( input == NULL )
{
return;
}
RendererInfo &rendererInfo = this->AccessRendererInfo( renderer );
rendererInfo.Squeeze();
iil4mitkPicImage *image = new iil4mitkPicImage( 512 );
rendererInfo.Set_iil4mitkImage( image );
this->ApplyProperties( renderer );
const Geometry2D *worldGeometry = renderer->GetCurrentWorldGeometry2D();
if( ( worldGeometry == NULL ) || ( !worldGeometry->IsValid() ) || ( !worldGeometry->GetReferenceGeometry() ))
{
return;
}
// check if there is something to display.
if ( ! input->IsVolumeSet( this->GetTimestep() ) ) return;
Image::RegionType requestedRegion = input->GetLargestPossibleRegion();
requestedRegion.SetIndex( 3, this->GetTimestep() );
requestedRegion.SetSize( 3, 1 );
requestedRegion.SetSize( 4, 1 );
input->SetRequestedRegion( &requestedRegion );
input->Update();
vtkImageData* inputData = input->GetVtkImageData( this->GetTimestep() );
if ( inputData == NULL )
{
return;
}
vtkFloatingPointType spacing[3];
inputData->GetSpacing( spacing );
// how big the area is in physical coordinates: widthInMM x heightInMM pixels
mitk::ScalarType widthInMM, heightInMM;
// where we want to sample
Point3D origin;
Vector3D right, bottom, normal;
Vector3D rightInIndex, bottomInIndex;
// take transform of input image into account
const TimeSlicedGeometry *inputTimeGeometry = input->GetTimeSlicedGeometry();
const Geometry3D* inputGeometry = inputTimeGeometry->GetGeometry3D( this->GetTimestep() );
ScalarType mmPerPixel[2];
// Bounds information for reslicing (only reuqired if reference geometry
// is present)
vtkFloatingPointType bounds[6];
bool boundsInitialized = false;
for ( int i = 0; i < 6; ++i )
{
bounds[i] = 0.0;
}
// Do we have a simple PlaneGeometry?
if ( dynamic_cast< const PlaneGeometry * >( worldGeometry ) != NULL )
{
const PlaneGeometry *planeGeometry =
static_cast< const PlaneGeometry * >( worldGeometry );
origin = planeGeometry->GetOrigin();
right = planeGeometry->GetAxisVector( 0 );
bottom = planeGeometry->GetAxisVector( 1 );
normal = planeGeometry->GetNormal();
bool inPlaneResampleExtentByGeometry = false;
GetDataNode()->GetBoolProperty(
"in plane resample extent by geometry",
inPlaneResampleExtentByGeometry, renderer
);
if ( inPlaneResampleExtentByGeometry )
{
// Resampling grid corresponds to the current world geometry. This
// means that the spacing of the output 2D image depends on the
// currently selected world geometry, and *not* on the image itself.
rendererInfo.m_Extent[0] = worldGeometry->GetExtent( 0 );
rendererInfo.m_Extent[1] = worldGeometry->GetExtent( 1 );
}
else
{
// Resampling grid corresponds to the input geometry. This means that
// the spacing of the output 2D image is directly derived from the
// associated input image, regardless of the currently selected world
// geometry.
inputGeometry->WorldToIndex( right, rightInIndex );
inputGeometry->WorldToIndex( bottom, bottomInIndex );
rendererInfo.m_Extent[0] = rightInIndex.GetNorm();
rendererInfo.m_Extent[1] = bottomInIndex.GetNorm();
}
// Get the extent of the current world geometry and calculate resampling
// spacing therefrom.
widthInMM = worldGeometry->GetExtentInMM( 0 );
heightInMM = worldGeometry->GetExtentInMM( 1 );
mmPerPixel[0] = widthInMM / rendererInfo.m_Extent[0];
mmPerPixel[1] = heightInMM / rendererInfo.m_Extent[1];
right.Normalize();
bottom.Normalize();
normal.Normalize();
origin += right * ( mmPerPixel[0] * 0.5 );
origin += bottom * ( mmPerPixel[1] * 0.5 );
widthInMM -= mmPerPixel[0];
heightInMM -= mmPerPixel[1];
// Use inverse transform of the input geometry for reslicing the 3D image
rendererInfo.m_Reslicer->SetResliceTransform(
inputGeometry->GetVtkTransform()->GetLinearInverse() );
// Set background level to TRANSLUCENT (see Geometry2DDataVtkMapper3D)
rendererInfo.m_Reslicer->SetBackgroundLevel( -32768 );
// If a reference geometry does exist (as would usually be the case for
// PlaneGeometry), store it in rendererInfo so that we have access to it
// in Paint.
//
// Note: this is currently not strictly required, but could facilitate
// correct plane clipping.
if ( worldGeometry->GetReferenceGeometry() )
{
rendererInfo.m_ReferenceGeometry = worldGeometry->GetReferenceGeometry();
// Calculate the actual bounds of the transformed plane clipped by the
// dataset bounding box; this is required for drawing the texture at the
// correct position during 3D mapping.
boundsInitialized = this->CalculateClippedPlaneBounds(
rendererInfo.m_ReferenceGeometry, planeGeometry, bounds );
}
}
// Do we have an AbstractTransformGeometry?
else if ( dynamic_cast< const AbstractTransformGeometry * >( worldGeometry ) )
{
const mitk::AbstractTransformGeometry* abstractGeometry =
dynamic_cast< const AbstractTransformGeometry * >(worldGeometry);
rendererInfo.m_Extent[0] = abstractGeometry->GetParametricExtent(0);
rendererInfo.m_Extent[1] = abstractGeometry->GetParametricExtent(1);
widthInMM = abstractGeometry->GetParametricExtentInMM(0);
heightInMM = abstractGeometry->GetParametricExtentInMM(1);
mmPerPixel[0] = widthInMM / rendererInfo.m_Extent[0];
mmPerPixel[1] = heightInMM / rendererInfo.m_Extent[1];
origin = abstractGeometry->GetPlane()->GetOrigin();
right = abstractGeometry->GetPlane()->GetAxisVector(0);
right.Normalize();
bottom = abstractGeometry->GetPlane()->GetAxisVector(1);
bottom.Normalize();
normal = abstractGeometry->GetPlane()->GetNormal();
normal.Normalize();
// Use a combination of the InputGeometry *and* the possible non-rigid
// AbstractTransformGeometry for reslicing the 3D Image
vtkGeneralTransform *composedResliceTransform = vtkGeneralTransform::New();
composedResliceTransform->Identity();
composedResliceTransform->Concatenate(
inputGeometry->GetVtkTransform()->GetLinearInverse() );
composedResliceTransform->Concatenate(
abstractGeometry->GetVtkAbstractTransform()
);
rendererInfo.m_Reslicer->SetResliceTransform( composedResliceTransform );
composedResliceTransform->UnRegister( NULL ); // decrease RC
// Set background level to BLACK instead of translucent, to avoid
// boundary artifacts (see Geometry2DDataVtkMapper3D)
rendererInfo.m_Reslicer->SetBackgroundLevel( -1023 );
}
else
{
return;
}
// Make sure that the image to display has a certain minimum size.
if ( (rendererInfo.m_Extent[0] <= 2) && (rendererInfo.m_Extent[1] <= 2) )
{
return;
}
// Initialize the interpolation mode for resampling; switch to nearest
// neighbor if the input image is too small.
if ( (input->GetDimension() >= 3) && (input->GetDimension(2) > 1) )
{
VtkResliceInterpolationProperty *resliceInterpolationProperty;
this->GetDataNode()->GetProperty(
resliceInterpolationProperty, "reslice interpolation" );
int interpolationMode = VTK_RESLICE_NEAREST;
if ( resliceInterpolationProperty != NULL )
{
interpolationMode = resliceInterpolationProperty->GetInterpolation();
}
switch ( interpolationMode )
{
case VTK_RESLICE_NEAREST:
rendererInfo.m_Reslicer->SetInterpolationModeToNearestNeighbor();
break;
case VTK_RESLICE_LINEAR:
rendererInfo.m_Reslicer->SetInterpolationModeToLinear();
break;
case VTK_RESLICE_CUBIC:
rendererInfo.m_Reslicer->SetInterpolationModeToCubic();
break;
}
}
else
{
rendererInfo.m_Reslicer->SetInterpolationModeToNearestNeighbor();
}
int thickSlicesMode = 0;
int thickSlicesNum = 1;
// Thick slices parameters
if( inputData->GetNumberOfScalarComponents() == 1 ) // for now only single component are allowed
{
DataNode *dn=renderer->GetCurrentWorldGeometry2DNode();
if(dn)
{
ResliceMethodProperty *resliceMethodEnumProperty=0;
if( dn->GetProperty( resliceMethodEnumProperty, "reslice.thickslices" ) && resliceMethodEnumProperty )
thickSlicesMode = resliceMethodEnumProperty->GetValueAsId();
IntProperty *intProperty=0;
if( dn->GetProperty( intProperty, "reslice.thickslices.num" ) && intProperty )
{
thickSlicesNum = intProperty->GetValue();
if(thickSlicesNum < 1) thickSlicesNum=1;
if(thickSlicesNum > 100) thickSlicesNum=100;
}
}
else
{
MITK_WARN << "no associated widget plane data tree node found";
}
}
rendererInfo.m_UnitSpacingImageFilter->SetInput( inputData );
rendererInfo.m_Reslicer->SetInput( rendererInfo.m_UnitSpacingImageFilter->GetOutput() );
//rendererInfo.m_Reslicer->SetOutputOrigin( 0.0, 0.0, 0.0 );
//rendererInfo.m_Reslicer->SetOutputDimensionality( 3 );
rendererInfo.m_PixelsPerMM[0] = 1.0 / mmPerPixel[0];
rendererInfo.m_PixelsPerMM[1] = 1.0 / mmPerPixel[1];
//calulate the originArray and the orientations for the reslice-filter
double originArray[3];
itk2vtk( origin, originArray );
rendererInfo.m_Reslicer->SetResliceAxesOrigin( originArray );
double cosines[9];
// direction of the X-axis of the sampled result
vnl2vtk( right.Get_vnl_vector(), cosines );
// direction of the Y-axis of the sampled result
vnl2vtk( bottom.Get_vnl_vector(), cosines + 3 );
// normal of the plane
vnl2vtk( normal.Get_vnl_vector(), cosines + 6 );
rendererInfo.m_Reslicer->SetResliceAxesDirectionCosines( cosines );
int xMin, xMax, yMin, yMax;
if ( boundsInitialized )
{
// Calculate output extent (integer values)
xMin = static_cast< int >( bounds[0] / mmPerPixel[0] + 0.5 );
xMax = static_cast< int >( bounds[1] / mmPerPixel[0] + 0.5 );
yMin = static_cast< int >( bounds[2] / mmPerPixel[1] + 0.5 );
yMax = static_cast< int >( bounds[3] / mmPerPixel[1] + 0.5 );
// Calculate the extent by which the maximal plane (due to plane rotation)
// overlaps the regular plane size.
rendererInfo.m_Overlap[0] = -xMin;
rendererInfo.m_Overlap[1] = -yMin;
}
else
{
// If no reference geometry is available, we also don't know about the
// maximum plane size; so the overlap is just ignored
rendererInfo.m_Overlap.Fill( 0.0 );
xMin = yMin = 0;
xMax = static_cast< int >( rendererInfo.m_Extent[0]
- rendererInfo.m_PixelsPerMM[0] + 0.5 );
yMax = static_cast< int >( rendererInfo.m_Extent[1]
- rendererInfo.m_PixelsPerMM[1] + 0.5 );
}
// Disallow huge dimensions
if ( (xMax-xMin) * (yMax-yMin) > 4096*4096 )
{
return;
}
// Calculate dataset spacing in plane z direction (NOT spacing of current
// world geometry)
double dataZSpacing = 1.0;
normal.Normalize();
Vector3D normInIndex;
inputGeometry->WorldToIndex( normal, normInIndex );
if(thickSlicesMode > 0)
{
dataZSpacing = 1.0 / normInIndex.GetNorm();
rendererInfo.m_Reslicer->SetOutputDimensionality( 3 );
rendererInfo.m_Reslicer->SetOutputExtent( xMin, xMax-1, yMin, yMax-1, -thickSlicesNum, 0+thickSlicesNum );
}
else
{
rendererInfo.m_Reslicer->SetOutputDimensionality( 2 );
rendererInfo.m_Reslicer->SetOutputExtent( xMin, xMax-1, yMin, yMax-1, 0, 0 );
}
rendererInfo.m_Reslicer->SetOutputOrigin( 0.0, 0.0, 0.0 );
rendererInfo.m_Reslicer->SetOutputSpacing( mmPerPixel[0], mmPerPixel[1], dataZSpacing );
// xMax and yMax are meant exclusive until now, whereas
// SetOutputExtent wants an inclusive bound. Thus, we need
// to subtract 1.
// Do the reslicing. Modified() is called to make sure that the reslicer is
// executed even though the input geometry information did not change; this
// is necessary when the input /em data, but not the /em geometry changes.
// The reslicing result is used both for 2D and for 3D mapping. 2D mapping
// currently uses PIC data structures, while 3D mapping uses VTK data. Thus,
// the reslicing result needs to be stored twice.
// 1. Check the result
vtkImageData* reslicedImage = 0;
if(thickSlicesMode>0)
{
rendererInfo.m_TSFilter->SetThickSliceMode( thickSlicesMode-1 );
rendererInfo.m_TSFilter->SetInput( rendererInfo.m_Reslicer->GetOutput() );
rendererInfo.m_TSFilter->Modified();
rendererInfo.m_TSFilter->Update();
reslicedImage = rendererInfo.m_TSFilter->GetOutput();
}
else
{
rendererInfo.m_Reslicer->Modified();
rendererInfo.m_Reslicer->Update();
reslicedImage = rendererInfo.m_Reslicer->GetOutput();
}
if((reslicedImage == NULL) || (reslicedImage->GetDataDimension() < 1))
{
MITK_WARN << "reslicer returned empty image";
return;
}
// 2. Convert the resampling result to PIC image format
mitkIpPicDescriptor *pic = Pic2vtk::convert( reslicedImage );
if (pic == NULL)
{
return;
}
bool imageIs2D = true;
if ( pic->dim == 1 )
{
pic->dim = 2;
pic->n[1] = 1;
imageIs2D = false;
}
assert( pic->dim == 2 );
rendererInfo.m_Pic = pic;
if ( pic->bpe == 24 && reslicedImage->GetScalarType()==VTK_UNSIGNED_CHAR ) // RGB image
m_iil4mitkMode = iil4mitkImage::RGB;
else if ( pic->bpe == 32 && reslicedImage->GetScalarType()==VTK_UNSIGNED_CHAR ) // RGBA image
m_iil4mitkMode = iil4mitkImage::RGBA;
- image->setImage( pic, m_iil4mitkMode );
+ image->setPicImage( pic, m_iil4mitkMode );
image->setInterpolation( false );
image->setRegion( 0, 0, pic->n[0], pic->n[1] );
// 3. Store the result in a VTK image
if ( imageIs2D )
{
if ( rendererInfo.m_Image == NULL )
{
rendererInfo.m_Image = vtkImageData::New();//reslicedImage;
}
rendererInfo.m_Image->DeepCopy( reslicedImage );
rendererInfo.m_Image->Update();
}
else
{
if ( rendererInfo.m_Image != NULL )
{
rendererInfo.m_Image->Delete();
}
rendererInfo.m_Image = NULL;
}
// We have been modified
rendererInfo.m_LastUpdateTime.Modified();
}
double
mitk::ImageMapperGL2D::CalculateSpacing( const mitk::Geometry3D *geometry, const mitk::Vector3D &d ) const
{
// The following can be derived from the ellipsoid equation
//
// 1 = x^2/a^2 + y^2/b^2 + z^2/c^2
//
// where (a,b,c) = spacing of original volume (ellipsoid radii)
// and (x,y,z) = scaled coordinates of vector d (according to ellipsoid)
//
const mitk::Vector3D &spacing = geometry->GetSpacing();
double scaling = d[0]*d[0] / (spacing[0] * spacing[0])
+ d[1]*d[1] / (spacing[1] * spacing[1])
+ d[2]*d[2] / (spacing[2] * spacing[2]);
scaling = sqrt( scaling );
return ( sqrt( d[0]*d[0] + d[1]*d[1] + d[2]*d[2] ) / scaling );
}
bool
mitk::ImageMapperGL2D
::LineIntersectZero( vtkPoints *points, int p1, int p2,
vtkFloatingPointType *bounds )
{
vtkFloatingPointType point1[3];
vtkFloatingPointType point2[3];
points->GetPoint( p1, point1 );
points->GetPoint( p2, point2 );
if ( (point1[2] * point2[2] <= 0.0) && (point1[2] != point2[2]) )
{
double x, y;
x = ( point1[0] * point2[2] - point1[2] * point2[0] ) / ( point2[2] - point1[2] );
y = ( point1[1] * point2[2] - point1[2] * point2[1] ) / ( point2[2] - point1[2] );
if ( x < bounds[0] ) { bounds[0] = x; }
if ( x > bounds[1] ) { bounds[1] = x; }
if ( y < bounds[2] ) { bounds[2] = y; }
if ( y > bounds[3] ) { bounds[3] = y; }
bounds[4] = bounds[5] = 0.0;
return true;
}
return false;
}
bool
mitk::ImageMapperGL2D
::CalculateClippedPlaneBounds( const Geometry3D *boundingGeometry,
const PlaneGeometry *planeGeometry, vtkFloatingPointType *bounds )
{
// Clip the plane with the bounding geometry. To do so, the corner points
// of the bounding box are transformed by the inverse transformation
// matrix, and the transformed bounding box edges derived therefrom are
// clipped with the plane z=0. The resulting min/max values are taken as
// bounds for the image reslicer.
const mitk::BoundingBox *boundingBox = boundingGeometry->GetBoundingBox();
mitk::BoundingBox::PointType bbMin = boundingBox->GetMinimum();
mitk::BoundingBox::PointType bbMax = boundingBox->GetMaximum();
mitk::BoundingBox::PointType bbCenter = boundingBox->GetCenter();
vtkPoints *points = vtkPoints::New();
if(boundingGeometry->GetImageGeometry())
{
points->InsertPoint( 0, bbMin[0]-0.5, bbMin[1]-0.5, bbMin[2]-0.5 );
points->InsertPoint( 1, bbMin[0]-0.5, bbMin[1]-0.5, bbMax[2]-0.5 );
points->InsertPoint( 2, bbMin[0]-0.5, bbMax[1]-0.5, bbMax[2]-0.5 );
points->InsertPoint( 3, bbMin[0]-0.5, bbMax[1]-0.5, bbMin[2]-0.5 );
points->InsertPoint( 4, bbMax[0]-0.5, bbMin[1]-0.5, bbMin[2]-0.5 );
points->InsertPoint( 5, bbMax[0]-0.5, bbMin[1]-0.5, bbMax[2]-0.5 );
points->InsertPoint( 6, bbMax[0]-0.5, bbMax[1]-0.5, bbMax[2]-0.5 );
points->InsertPoint( 7, bbMax[0]-0.5, bbMax[1]-0.5, bbMin[2]-0.5 );
}
else
{
points->InsertPoint( 0, bbMin[0], bbMin[1], bbMin[2] );
points->InsertPoint( 1, bbMin[0], bbMin[1], bbMax[2] );
points->InsertPoint( 2, bbMin[0], bbMax[1], bbMax[2] );
points->InsertPoint( 3, bbMin[0], bbMax[1], bbMin[2] );
points->InsertPoint( 4, bbMax[0], bbMin[1], bbMin[2] );
points->InsertPoint( 5, bbMax[0], bbMin[1], bbMax[2] );
points->InsertPoint( 6, bbMax[0], bbMax[1], bbMax[2] );
points->InsertPoint( 7, bbMax[0], bbMax[1], bbMin[2] );
}
vtkPoints *newPoints = vtkPoints::New();
vtkTransform *transform = vtkTransform::New();
transform->Identity();
transform->Concatenate(
planeGeometry->GetVtkTransform()->GetLinearInverse()
);
transform->Concatenate( boundingGeometry->GetVtkTransform() );
transform->TransformPoints( points, newPoints );
bounds[0] = bounds[2] = 10000000.0;
bounds[1] = bounds[3] = -10000000.0;
bounds[4] = bounds[5] = 0.0;
this->LineIntersectZero( newPoints, 0, 1, bounds );
this->LineIntersectZero( newPoints, 1, 2, bounds );
this->LineIntersectZero( newPoints, 2, 3, bounds );
this->LineIntersectZero( newPoints, 3, 0, bounds );
this->LineIntersectZero( newPoints, 0, 4, bounds );
this->LineIntersectZero( newPoints, 1, 5, bounds );
this->LineIntersectZero( newPoints, 2, 6, bounds );
this->LineIntersectZero( newPoints, 3, 7, bounds );
this->LineIntersectZero( newPoints, 4, 5, bounds );
this->LineIntersectZero( newPoints, 5, 6, bounds );
this->LineIntersectZero( newPoints, 6, 7, bounds );
this->LineIntersectZero( newPoints, 7, 4, bounds );
// clean up vtk data
points->Delete();
newPoints->Delete();
transform->Delete();
if ( (bounds[0] > 9999999.0) || (bounds[2] > 9999999.0)
|| (bounds[1] < -9999999.0) || (bounds[3] < -9999999.0) )
{
return false;
}
else
{
// The resulting bounds must be adjusted by the plane spacing, since we
// we have so far dealt with index coordinates
const float *planeSpacing = planeGeometry->GetFloatSpacing();
bounds[0] *= planeSpacing[0];
bounds[1] *= planeSpacing[0];
bounds[2] *= planeSpacing[1];
bounds[3] *= planeSpacing[1];
bounds[4] *= planeSpacing[2];
bounds[5] *= planeSpacing[2];
return true;
}
}
void
mitk::ImageMapperGL2D::GenerateAllData()
{
RendererInfoMap::iterator it, end = m_RendererInfo.end();
for ( it = m_RendererInfo.begin(); it != end; ++it)
{
this->Update( it->first );
}
}
void
mitk::ImageMapperGL2D::Clear()
{
RendererInfoMap::iterator it, end = m_RendererInfo.end();
for ( it = m_RendererInfo.begin(); it != end; ++it )
{
it->second.RemoveObserver();
it->second.Squeeze();
}
m_RendererInfo.clear();
}
void
mitk::ImageMapperGL2D::ApplyProperties(mitk::BaseRenderer* renderer)
{
RendererInfo &rendererInfo = this->AccessRendererInfo( renderer );
iil4mitkPicImage *image = rendererInfo.Get_iil4mitkImage();
assert( image != NULL );
float rgba[4]= { 1.0f, 1.0f, 1.0f, 1.0f };
float opacity = 1.0f;
// check for color prop and use it for rendering if it exists
// binary image hovering & binary image selection
bool hover = false;
bool selected = false;
GetDataNode()->GetBoolProperty("binaryimage.ishovering", hover, renderer);
GetDataNode()->GetBoolProperty("selected", selected, renderer);
if(hover && !selected)
{
mitk::ColorProperty::Pointer colorprop = dynamic_cast<mitk::ColorProperty*>(GetDataNode()->GetProperty
("binaryimage.hoveringcolor", renderer));
if(colorprop.IsNotNull())
memcpy(rgba, colorprop->GetColor().GetDataPointer(), 3*sizeof(float));
else
GetColor( rgba, renderer );
}
if(selected)
{
mitk::ColorProperty::Pointer colorprop = dynamic_cast<mitk::ColorProperty*>(GetDataNode()->GetProperty
("binaryimage.selectedcolor", renderer));
if(colorprop.IsNotNull())
memcpy(rgba, colorprop->GetColor().GetDataPointer(), 3*sizeof(float));
else
GetColor( rgba, renderer );
}
if(!hover && !selected)
{
GetColor( rgba, renderer );
}
// check for opacity prop and use it for rendering if it exists
GetOpacity( opacity, renderer );
rgba[3] = opacity;
// check for interpolation properties
bool textureInterpolation = false;
GetDataNode()->GetBoolProperty(
"texture interpolation", textureInterpolation, renderer
);
rendererInfo.m_TextureInterpolation = textureInterpolation;
mitk::LevelWindow levelWindow;
mitk::LevelWindow opacLevelWindow;
bool binary = false;
this->GetDataNode()->GetBoolProperty( "binary", binary, renderer );
if ( binary )
{
image->setExtrema(0, 1);
image->setOpacityExtrema( 0.0, 255.0 );
image->setBinary(true);
bool binaryOutline = false;
if ( this->GetInput()->GetPixelType().GetBpe() <= 8 )
{
if (this->GetDataNode()->GetBoolProperty( "outline binary", binaryOutline, renderer ))
{
image->setOutline(binaryOutline);
float binaryOutlineWidth(1.0);
if (this->GetDataNode()->GetFloatProperty( "outline width", binaryOutlineWidth, renderer ))
{
image->setOutlineWidth(binaryOutlineWidth);
}
}
}
else
{
//this->GetDataNode()->SetBoolProperty( "outline binary", false, renderer );
//this->GetDataNode()->SetFloatProperty( "opacity", 0.3, renderer );
//set opacity
//rgba[3] = 0.3;
MITK_WARN << "Type of all binary images should be (un)signed char. Outline does not work on other pixel types!";
}
}
else
{
if( !this->GetLevelWindow( levelWindow, renderer, "levelWindow" ) )
{
this->GetLevelWindow( levelWindow, renderer );
}
image->setExtrema( levelWindow.GetLowerWindowBound(), levelWindow.GetUpperWindowBound() );
// obtain opacity level window
if( this->GetLevelWindow( opacLevelWindow, renderer, "opaclevelwindow" ) )
{
image->setOpacityExtrema( opacLevelWindow.GetLowerWindowBound(), opacLevelWindow.GetUpperWindowBound() );
}
else
{
image->setOpacityExtrema( 0.0, 255.0 );
}
}
bool useColor = false;
GetDataNode()->GetBoolProperty( "use color", useColor, renderer );
mitk::LookupTableProperty::Pointer LookupTableProp;
if ( !useColor )
{
LookupTableProp = dynamic_cast<mitk::LookupTableProperty*>(
this->GetDataNode()->GetProperty("LookupTable"));
if ( LookupTableProp.IsNull() )
{
useColor = true;
}
}
if ( useColor || binary )
{
// If lookup table use is NOT requested (or we have a binary image...):
m_iil4mitkMode = iil4mitkImage::INTENSITY_ALPHA;
image->setColor( rgba[0], rgba[1], rgba[2], rgba[3] );
}
else
{
// If lookup table use is requested:
m_iil4mitkMode = iil4mitkImage::COLOR_ALPHA;
// only update the lut, when the properties have changed...
if ( LookupTableProp->GetLookupTable()->GetMTime()
<= this->GetDataNode()->GetPropertyList()->GetMTime() )
{
LookupTableProp->GetLookupTable()->ChangeOpacityForAll( opacity );
LookupTableProp->GetLookupTable()->ChangeOpacity(0, 0.0);
}
image->setColors(LookupTableProp->GetLookupTable()->GetRawLookupTable());
}
}
void
mitk::ImageMapperGL2D::Update(mitk::BaseRenderer* renderer)
{
mitk::Image* data = const_cast<mitk::ImageMapperGL2D::InputImageType *>(
this->GetInput()
);
if ( data == NULL )
{
return;
}
if ( !IsVisible(renderer) )
{
return;
}
// Calculate time step of the input data for the specified renderer (integer value)
this->CalculateTimeStep( renderer );
// Check if time step is valid
const TimeSlicedGeometry *dataTimeGeometry = data->GetTimeSlicedGeometry();
if ( ( dataTimeGeometry == NULL )
|| ( dataTimeGeometry->GetTimeSteps() == 0 )
|| ( !dataTimeGeometry->IsValidTime( this->GetTimestep() ) ) )
{
return;
}
const DataNode *node = this->GetDataNode();
RendererInfo& rendererInfo = AccessRendererInfo( renderer );
iil4mitkPicImage* image = rendererInfo.Get_iil4mitkImage();
data->UpdateOutputInformation();
if ( (image == NULL)
|| (rendererInfo.m_LastUpdateTime < node->GetMTime())
|| (rendererInfo.m_LastUpdateTime < data->GetPipelineMTime())
|| (rendererInfo.m_LastUpdateTime
< renderer->GetCurrentWorldGeometry2DUpdateTime())
|| (rendererInfo.m_LastUpdateTime
< renderer->GetDisplayGeometryUpdateTime()) )
{
- this->GenerateData( renderer );
+ this->GenerateDataForRenderer( renderer );
}
else if ( rendererInfo.m_LastUpdateTime
< renderer->GetCurrentWorldGeometry2D()->GetMTime() )
{
- this->GenerateData( renderer );
+ this->GenerateDataForRenderer( renderer );
}
else if ( (rendererInfo.m_LastUpdateTime < node->GetPropertyList()->GetMTime())
|| (rendererInfo.m_LastUpdateTime
< node->GetPropertyList(renderer)->GetMTime()) )
{
- this->GenerateData( renderer );
+ this->GenerateDataForRenderer( renderer );
// since we have checked that nothing important has changed, we can set
// m_LastUpdateTime to the current time
rendererInfo.m_LastUpdateTime.Modified();
}
}
void
mitk::ImageMapperGL2D
::DeleteRendererCallback( itk::Object *object, const itk::EventObject & )
{
mitk::BaseRenderer *renderer = dynamic_cast< mitk::BaseRenderer* >( object );
if ( renderer )
{
m_RendererInfo.erase( renderer );
}
}
mitk::ImageMapperGL2D::RendererInfo
::RendererInfo()
: m_RendererID(-1),
m_iil4mitkImage(NULL),
m_Renderer(NULL),
m_Pic(NULL),
m_UnitSpacingImageFilter( NULL ),
m_Reslicer( NULL ),
m_TSFilter( NULL ),
m_Image(NULL),
m_ReferenceGeometry(NULL),
m_TextureInterpolation(true),
m_ObserverID( 0 )
{
m_PixelsPerMM.Fill(0);
};
mitk::ImageMapperGL2D::RendererInfo
::~RendererInfo()
{
this->Squeeze();
if ( m_UnitSpacingImageFilter != NULL )
{
m_UnitSpacingImageFilter->Delete();
}
if ( m_Reslicer != NULL )
{
m_Reslicer->Delete();
}
if ( m_TSFilter != NULL )
{
m_TSFilter->Delete();
}
if ( m_Image != NULL )
{
m_Image->Delete();
}
}
void
mitk::ImageMapperGL2D::RendererInfo
::Set_iil4mitkImage( iil4mitkPicImage *iil4mitkImage )
{
assert( iil4mitkImage != NULL );
delete m_iil4mitkImage;
m_iil4mitkImage = iil4mitkImage;
}
void
mitk::ImageMapperGL2D::RendererInfo::Squeeze()
{
delete m_iil4mitkImage;
m_iil4mitkImage = NULL;
if ( m_Pic != NULL )
{
mitkIpPicFree(m_Pic);
m_Pic = NULL;
}
if ( m_Image != NULL )
{
m_Image->Delete();
m_Image = NULL;
}
}
void
mitk::ImageMapperGL2D::RendererInfo::RemoveObserver()
{
if ( m_ObserverID != 0 )
{
// m_ObserverID has to be decreased by one. Was incremented by one after creation to make the test m_ObserverID != 0 possible.
m_Renderer->RemoveObserver( m_ObserverID-1 );
}
}
void mitk::ImageMapperGL2D::RendererInfo::Initialize( int rendererID, mitk::BaseRenderer *renderer,
unsigned long observerID )
{
// increase ID by one to avoid 0 ID, has to be decreased before remove of the observer
m_ObserverID = observerID+1;
assert(rendererID>=0);
assert(m_RendererID<0);
m_RendererID = rendererID;
m_Renderer = renderer;
m_Image = vtkImageData::New();
m_Reslicer = vtkImageReslice::New();
m_TSFilter = vtkMitkThickSlicesFilter::New();
m_Reslicer->ReleaseDataFlagOn();
m_TSFilter->ReleaseDataFlagOn();
m_UnitSpacingImageFilter = vtkImageChangeInformation::New();
m_UnitSpacingImageFilter->SetOutputSpacing( 1.0, 1.0, 1.0 );
}
void mitk::ImageMapperGL2D::SetDefaultProperties(mitk::DataNode* node, mitk::BaseRenderer* renderer, bool overwrite)
{
mitk::Image::Pointer image = dynamic_cast<mitk::Image*>(node->GetData());
// Properties common for both images and segmentations
node->AddProperty( "use color", mitk::BoolProperty::New( true ), renderer, overwrite );
node->AddProperty( "outline binary", mitk::BoolProperty::New( false ), renderer, overwrite );
node->AddProperty( "outline width", mitk::FloatProperty::New( 1.0 ), renderer, overwrite );
if(image->IsRotated()) node->AddProperty( "reslice interpolation", mitk::VtkResliceInterpolationProperty::New(VTK_RESLICE_CUBIC) );
else node->AddProperty( "reslice interpolation", mitk::VtkResliceInterpolationProperty::New() );
node->AddProperty( "texture interpolation", mitk::BoolProperty::New( mitk::DataNodeFactory::m_TextureInterpolationActive ) ); // set to user configurable default value (see global options)
node->AddProperty( "in plane resample extent by geometry", mitk::BoolProperty::New( false ) );
node->AddProperty( "bounding box", mitk::BoolProperty::New( false ) );
bool isBinaryImage(false);
if ( ! node->GetBoolProperty("binary", isBinaryImage) )
{
// ok, property is not set, use heuristic to determine if this
// is a binary image
mitk::Image::Pointer centralSliceImage;
ScalarType minValue = 0.0;
ScalarType maxValue = 0.0;
ScalarType min2ndValue = 0.0;
ScalarType max2ndValue = 0.0;
mitk::ImageSliceSelector::Pointer sliceSelector = mitk::ImageSliceSelector::New();
sliceSelector->SetInput(image);
sliceSelector->SetSliceNr(image->GetDimension(2)/2);
sliceSelector->SetTimeNr(image->GetDimension(3)/2);
sliceSelector->SetChannelNr(image->GetDimension(4)/2);
sliceSelector->Update();
centralSliceImage = sliceSelector->GetOutput();
if ( centralSliceImage.IsNotNull() && centralSliceImage->IsInitialized() )
{
minValue = centralSliceImage->GetScalarValueMin();
maxValue = centralSliceImage->GetScalarValueMax();
min2ndValue = centralSliceImage->GetScalarValue2ndMin();
max2ndValue = centralSliceImage->GetScalarValue2ndMax();
}
if ( minValue == maxValue )
{
// centralSlice is strange, lets look at all data
minValue = image->GetScalarValueMin();
maxValue = image->GetScalarValueMaxNoRecompute();
min2ndValue = image->GetScalarValue2ndMinNoRecompute();
max2ndValue = image->GetScalarValue2ndMaxNoRecompute();
}
isBinaryImage = ( maxValue == min2ndValue && minValue == max2ndValue );
}
// some more properties specific for a binary...
if (isBinaryImage)
{
node->AddProperty( "opacity", mitk::FloatProperty::New(0.3f), renderer, overwrite );
node->AddProperty( "color", ColorProperty::New(1.0,0.0,0.0), renderer, overwrite );
node->AddProperty( "binaryimage.selectedcolor", ColorProperty::New(1.0,0.0,0.0), renderer, overwrite );
node->AddProperty( "binaryimage.selectedannotationcolor", ColorProperty::New(1.0,0.0,0.0), renderer, overwrite );
node->AddProperty( "binaryimage.hoveringcolor", ColorProperty::New(1.0,0.0,0.0), renderer, overwrite );
node->AddProperty( "binaryimage.hoveringannotationcolor", ColorProperty::New(1.0,0.0,0.0), renderer, overwrite );
node->AddProperty( "binary", mitk::BoolProperty::New( true ), renderer, overwrite );
node->AddProperty("layer", mitk::IntProperty::New(10), renderer, overwrite);
}
else //...or image type object
{
node->AddProperty( "opacity", mitk::FloatProperty::New(1.0f), renderer, overwrite );
node->AddProperty( "color", ColorProperty::New(1.0,1.0,1.0), renderer, overwrite );
node->AddProperty( "binary", mitk::BoolProperty::New( false ), renderer, overwrite );
node->AddProperty("layer", mitk::IntProperty::New(0), renderer, overwrite);
}
if(image.IsNotNull() && image->IsInitialized())
{
if((overwrite) || (node->GetProperty("levelwindow", renderer)==NULL))
{
mitk::LevelWindowProperty::Pointer levWinProp = mitk::LevelWindowProperty::New();
mitk::LevelWindow levelwindow;
levelwindow.SetAuto( image, true, true );
levWinProp->SetLevelWindow( levelwindow );
node->SetProperty( "levelwindow", levWinProp, renderer );
}
if(((overwrite) || (node->GetProperty("opaclevelwindow", renderer)==NULL))
&& (image->GetPixelType().GetItkTypeId() && *(image->GetPixelType().GetItkTypeId()) == typeid(itk::RGBAPixel<unsigned char>)))
{
mitk::LevelWindow opaclevwin;
opaclevwin.SetRangeMinMax(0,255);
opaclevwin.SetWindowBounds(0,255);
mitk::LevelWindowProperty::Pointer prop = mitk::LevelWindowProperty::New(opaclevwin);
node->SetProperty( "opaclevelwindow", prop, renderer );
}
if((overwrite) || (node->GetProperty("LookupTable", renderer)==NULL))
{
// add a default rainbow lookup table for color mapping
mitk::LookupTable::Pointer mitkLut = mitk::LookupTable::New();
vtkLookupTable* vtkLut = mitkLut->GetVtkLookupTable();
vtkLut->SetHueRange(0.6667, 0.0);
vtkLut->SetTableRange(0.0, 20.0);
vtkLut->Build();
mitk::LookupTableProperty::Pointer mitkLutProp = mitk::LookupTableProperty::New();
mitkLutProp->SetLookupTable(mitkLut);
node->SetProperty( "LookupTable", mitkLutProp );
}
}
Superclass::SetDefaultProperties(node, renderer, overwrite);
}
diff --git a/Core/Code/Rendering/mitkImageMapperGL2D.h b/Core/Code/Rendering/mitkImageMapperGL2D.h
index f628ed3341..d7aea797f8 100644
--- a/Core/Code/Rendering/mitkImageMapperGL2D.h
+++ b/Core/Code/Rendering/mitkImageMapperGL2D.h
@@ -1,298 +1,298 @@
/*=========================================================================
Program: Medical Imaging & Interaction Toolkit
Language: C++
Date: $Date$
Version: $Revision$
Copyright (c) German Cancer Research Center, Division of Medical and
Biological Informatics. All rights reserved.
See MITKCopyright.txt or http://www.mitk.org/copyright.html for details.
This software is distributed WITHOUT ANY WARRANTY; without even
the implied warranty of MERCHANTABILITY or FITNESS FOR A PARTICULAR
PURPOSE. See the above copyright notices for more information.
=========================================================================*/
#ifndef MITKIMAGEMAPPER2D_H_HEADER_INCLUDED_C10E906E
#define MITKIMAGEMAPPER2D_H_HEADER_INCLUDED_C10E906E
#include "mitkCommon.h"
#include "mitkGLMapper2D.h"
#include "mitkBaseRenderer.h"
#include <map>
#include <assert.h>
#include <itkCommand.h>
#include <itkEventObject.h>
#include <vtkSystemIncludes.h>
class iil4mitkPicImage;
class Vtk2itk;
class vtkImageReslice;
class vtkLookupTable;
class vtkGeneralTransform;
class vtkImageChangeInformation;
class vtkPoints;
class vtkMitkThickSlicesFilter;
namespace mitk {
/** \brief Mapper to resample and display 2D slices of a 3D image.
*
* Currently implemented for mapping on PlaneGeometry and
* AbstractTransformGeometry. The resulting 2D image (by reslicing the
* underlying 3D input image appropriately) can either be directly rendered
* in a 2D view or just be calculated to be used later on by another
* rendering entity, e.g. in texture mapping in a 3D view.
*
* This results in a flipped version when used for texture mapping. Furthermore,
* not the complete rectangular area described by the Geometry2D from the renderer
* is resampled, @em if the Geometry2D is larger than the image dimension in the
* requested direction. This results in a stretched version when used for texture
* mapping.
*
* Properties that can be set for images and influence the imageMapper2D are:
*
* - \b "modality": (mitkModalityProperty) Modality of the image
* - \b "opacity": (FloatProperty) Opacity of the image
* - \b "color": (ColorProperty) Color of the image
* - \b "use color": (BoolProperty) Use the color of the image or not
* - \b "binary": (BoolProperty) is the image a binary image or not
* - \b "outline binary": (BoolProperty) show outline of the image or not
* - \b "texture interpolation": (BoolProperty) texture interpolation of the image
* - \b "reslice interpolation": (VtkResliceInterpolationProperty) reslice interpolation of the image
* - \b "in plane resample extent by geometry": (BoolProperty) Do it or not
* - \b "bounding box": (BoolProperty) Is the Bounding Box of the image shown or not
* - \b "layer": (IntProperty) Layer of the image
* - \b "volume annotation color": (ColorProperty) color of the volume annotation
* - \b "volume annotation unit": (StringProperty) annotation unit as string (does not implicit convert the unit!)
unit is ml/cm3
* The default properties are:
* - \b "opacity", mitk::FloatProperty::New(0.3f), renderer, overwrite )
* - \b "color", ColorProperty::New(1.0,0.0,0.0), renderer, overwrite )
* - \b "use color", mitk::BoolProperty::New( true ), renderer, overwrite )
* - \b "binary", mitk::BoolProperty::New( true ), renderer, overwrite )
* - \b "outline binary", mitk::BoolProperty::New( false ), renderer, overwrite )
* - \b "texture interpolation", mitk::BoolProperty::New( mitk::DataNodeFactory::m_TextureInterpolationActive ) )
* - \b "reslice interpolation", mitk::VtkResliceInterpolationProperty::New() )
* - \b "in plane resample extent by geometry", mitk::BoolProperty::New( false ) )
* - \b "bounding box", mitk::BoolProperty::New( false ) )
* - \b "layer", mitk::IntProperty::New(10), renderer, overwrite)
* If the modality-property is set for an image, the mapper uses modality-specific default properties,
* e.g. color maps, if they are defined.
* \ingroup Mapper
*/
class MITK_CORE_EXPORT ImageMapperGL2D : public GLMapper2D
{
public:
/** Standard class typedefs. */
mitkClassMacro( ImageMapperGL2D,GLMapper2D );
/** Method for creation through the object factory. */
itkNewMacro(Self);
/** Some convenient typedefs. */
typedef mitk::Image InputImageType;
typedef InputImageType::Pointer InputImagePointer;
typedef InputImageType::ConstPointer InputImageConstPointer;
typedef SlicedData::RegionType InputImageRegionType;
/** \brief Get the Image to map */
const InputImageType *GetInput(void);
/** \brief Calls Update() for all associated renderers. */
virtual void GenerateAllData();
/** \brief Renders the (priorly) resampled image onto the screen. */
virtual void Paint( mitk::BaseRenderer *renderer );
/** \brief Checks whether this mapper needs to update itself and generate
* data. */
virtual void Update(mitk::BaseRenderer * renderer);
virtual void ApplyProperties(mitk::BaseRenderer* renderer);
/** \brief Internal storage class for data needed for rendering into a
* renderer
*/
class MITK_CORE_EXPORT RendererInfo
{
/** \brief internal id of the renderer the data is stored for */
int m_RendererID;
/** \brief stored iil4mitkPicImage containing the texture to display for
* 2D rendering (cf. m_Image) */
iil4mitkPicImage* m_iil4mitkImage;
mitk::BaseRenderer* m_Renderer;
public:
/** \brief timestamp of last update of stored data */
itk::TimeStamp m_LastUpdateTime;
/** \brief stored data as a mitkIpPicDescriptor */
mitkIpPicDescriptor *m_Pic;
/** \brief number of pixels per mm in x- and y-direction of the resampled */
Vector2D m_PixelsPerMM;
/** \brief Extent (in pixels) of the image */
Vector2D m_Extent;
/** \brief Overlap (in pixels) to ensure coverage of rotated images also */
Vector2D m_Overlap;
/** \brief Using unit spacing for resampling makes life easier */
vtkImageChangeInformation *m_UnitSpacingImageFilter;
/** \brief The actual reslicer (one per renderer) */
vtkImageReslice *m_Reslicer;
/** \brief Thickslices post filtering */
vtkMitkThickSlicesFilter *m_TSFilter;
/** \brief Extracted image for 3D rendering (cf. m_iil4mitkImage) */
vtkImageData *m_Image;
/** \brief Reference geometry associated with the world geometry */
const Geometry3D *m_ReferenceGeometry;
bool m_TextureInterpolation;
/** \brief stores the id of the observer for delete event of renderer */
unsigned long m_ObserverID;
RendererInfo();
~RendererInfo();
inline bool IsInitialized() const
{
return m_RendererID >= 0;
}
void Initialize( int rendererID, mitk::BaseRenderer *renderer,
unsigned long observerID );
void Set_iil4mitkImage(iil4mitkPicImage* iil4mitkImage);
inline iil4mitkPicImage* Get_iil4mitkImage() const
{
return m_iil4mitkImage;
}
inline int GetRendererID() const
{
return m_RendererID;
}
void RemoveObserver();
void Squeeze();
}; // RendererInfo
/** \brief Get the internal id of the renderer
* \sa RendererInfo
*/
virtual int GetAssociatedChannelNr( mitk::BaseRenderer *renderer );
/** \brief Get the RendererInfo for \a renderer */
const RendererInfo *GetRendererInfo( mitk::BaseRenderer *renderer )
{
return &this->AccessRendererInfo(renderer);
}
/** \brief Release memory allocated for buffering */
virtual void Clear();
static void SetDefaultProperties(mitk::DataNode* node, mitk::BaseRenderer* renderer = NULL, bool overwrite = false);
protected:
ImageMapperGL2D();
virtual ~ImageMapperGL2D();
/** Does the actual resampling, without rendering the image yet. */
- virtual void GenerateData(mitk::BaseRenderer *renderer);
+ virtual void GenerateDataForRenderer(mitk::BaseRenderer *renderer);
/** \brief Get the RendererInfo for @a renderer */
inline RendererInfo & AccessRendererInfo( mitk::BaseRenderer* renderer )
{
RendererInfo& rendererInfo = m_RendererInfo[renderer];
if(rendererInfo.IsInitialized()==false)
{
// Add observer for renderer reset events (RendererInfo will
// automatically be removed from list when a Renderer is deleted)
//
// Note: observer ID is passed to rendererInfo, which will take
// responsiblity to remove the observer upon its destruction
typedef itk::MemberCommand< ImageMapperGL2D > MemberCommandType;
MemberCommandType::Pointer deleteRendererCommand =
MemberCommandType::New();
deleteRendererCommand->SetCallbackFunction(
this, &ImageMapperGL2D::DeleteRendererCallback );
unsigned long observerID = renderer->AddObserver(
BaseRenderer::RendererResetEvent(), deleteRendererCommand );
// Initialize RendererInfo
rendererInfo.Initialize( ImageMapperGL2D::numRenderer++, renderer, observerID );
}
return rendererInfo;
}
void DeleteRendererCallback( itk::Object *object, const itk::EventObject & );
double CalculateSpacing( const mitk::Geometry3D *geometry,
const mitk::Vector3D &d ) const;
bool LineIntersectZero( vtkPoints *points, int p1, int p2,
vtkFloatingPointType *bounds );
bool CalculateClippedPlaneBounds( const Geometry3D *boundingGeometry,
const PlaneGeometry *planeGeometry, vtkFloatingPointType *bounds );
/** \brief Number of renderers data is stored for
* \todo General concept for keeping data for rendering required
* \todo static?
*/
static int numRenderer;
protected:
typedef std::map<BaseRenderer*,RendererInfo> RendererInfoMap;
/** \brief Map of instances of RendererInfo
* \sa RendererInfo
*/
RendererInfoMap m_RendererInfo;
vtkGeneralTransform *m_ComposedResliceTransform;
private:
int m_iil4mitkMode;
};
} // namespace mitk
#endif /* MITKIMAGEMAPPER2D_H_HEADER_INCLUDED_C10E906E */
diff --git a/Core/Code/Rendering/mitkMapper.cpp b/Core/Code/Rendering/mitkMapper.cpp
index 42e293d42d..69df73e073 100644
--- a/Core/Code/Rendering/mitkMapper.cpp
+++ b/Core/Code/Rendering/mitkMapper.cpp
@@ -1,158 +1,158 @@
/*=========================================================================
Program: Medical Imaging & Interaction Toolkit
Language: C++
Date: $Date$
Version: $Revision$
Copyright (c) German Cancer Research Center, Division of Medical and
Biological Informatics. All rights reserved.
See MITKCopyright.txt or http://www.mitk.org/copyright.html for details.
This software is distributed WITHOUT ANY WARRANTY; without even
the implied warranty of MERCHANTABILITY or FITNESS FOR A PARTICULAR
PURPOSE. See the above copyright notices for more information.
=========================================================================*/
#include "mitkMapper.h"
#include "mitkDataNode.h"
#include "mitkBaseRenderer.h"
#include "mitkProperties.h"
mitk::Mapper::Mapper()
: m_VtkBased( true ), m_TimeStep( 0 )
{
}
mitk::Mapper::~Mapper()
{
}
mitk::BaseData* mitk::Mapper::GetData() const
{
return m_DataNode->GetData();
}
mitk::DataNode* mitk::Mapper::GetDataNode() const
{
itkDebugMacro("returning DataNode address " << this->m_DataNode );
return this->m_DataNode.GetPointer();
}
bool mitk::Mapper::GetColor(float rgb[3], mitk::BaseRenderer* renderer, const char* name) const
{
const mitk::DataNode* node=GetDataNode();
if(node==NULL)
return false;
return node->GetColor(rgb, renderer, name);
}
bool mitk::Mapper::GetVisibility(bool &visible, mitk::BaseRenderer* renderer, const char* name) const
{
const mitk::DataNode* node=GetDataNode();
if(node==NULL)
return false;
return node->GetVisibility(visible, renderer, name);
}
bool mitk::Mapper::GetOpacity(float &opacity, mitk::BaseRenderer* renderer, const char* name) const
{
const mitk::DataNode* node=GetDataNode();
if(node==NULL)
return false;
return node->GetOpacity(opacity, renderer, name);
}
bool mitk::Mapper::GetLevelWindow(mitk::LevelWindow& levelWindow, mitk::BaseRenderer* renderer, const char* name) const
{
const mitk::DataNode* node=GetDataNode();
if(node==NULL)
return false;
return node->GetLevelWindow(levelWindow, renderer, name);
}
bool mitk::Mapper::IsVisible(mitk::BaseRenderer* renderer, const char* name) const
{
bool visible=true;
GetVisibility(visible, renderer, name);
return visible;
}
void mitk::Mapper::GenerateData()
{
}
-void mitk::Mapper::GenerateData(mitk::BaseRenderer* /*renderer*/)
+void mitk::Mapper::GenerateDataForRenderer(mitk::BaseRenderer* /*renderer*/)
{
}
void mitk::Mapper::CalculateTimeStep( mitk::BaseRenderer *renderer )
{
if ( ( renderer != NULL ) && ( m_DataNode.GetPointer() != NULL ) )
{
m_TimeStep = renderer->GetTimeStep(m_DataNode->GetData());
}
else
{
m_TimeStep = 0;
}
}
void mitk::Mapper::Update(mitk::BaseRenderer *renderer)
{
const DataNode* node = GetDataNode();
assert(node!=NULL);
//safety cause there are datatreenodes that have no defined data (video-nodes and root)
unsigned int dataMTime = 0;
mitk::BaseData::Pointer data = static_cast<mitk::BaseData *>(node->GetData());
if (data.IsNotNull())
{
dataMTime = data->GetMTime();
}
// Calculate time step of the input data for the specified renderer (integer value)
this->CalculateTimeStep( renderer );
// Check if time step is valid
const TimeSlicedGeometry *dataTimeGeometry = data->GetTimeSlicedGeometry();
if ( ( dataTimeGeometry == NULL )
|| ( dataTimeGeometry->GetTimeSteps() == 0 )
|| ( !dataTimeGeometry->IsValidTime( m_TimeStep ) ) )
{
// TimeSlicedGeometry or time step is not valid for this data:
// reset mapper so that nothing is displayed
this->ResetMapper( renderer );
return;
}
if(
(m_LastUpdateTime < GetMTime()) ||
(m_LastUpdateTime < node->GetDataReferenceChangedTime()) ||
(m_LastUpdateTime < dataMTime) ||
(renderer && (m_LastUpdateTime < renderer->GetTimeStepUpdateTime()))
)
{
this->GenerateData();
m_LastUpdateTime.Modified();
}
- this->GenerateData(renderer);
+ this->GenerateDataForRenderer(renderer);
}
void mitk::Mapper::SetDefaultProperties(mitk::DataNode* node, mitk::BaseRenderer* renderer, bool overwrite)
{
node->AddProperty( "visible", mitk::BoolProperty::New(true), renderer, overwrite );
node->AddProperty( "layer", mitk::IntProperty::New(0), renderer, overwrite);
node->AddProperty( "name", mitk::StringProperty::New("No Name!"), renderer, overwrite );
}
diff --git a/Core/Code/Rendering/mitkMapper.h b/Core/Code/Rendering/mitkMapper.h
index 92f81284ad..a91e35d73d 100644
--- a/Core/Code/Rendering/mitkMapper.h
+++ b/Core/Code/Rendering/mitkMapper.h
@@ -1,287 +1,287 @@
/*=========================================================================
Program: Medical Imaging & Interaction Toolkit
Language: C++
Date: $Date$
Version: $Revision$
Copyright (c) German Cancer Research Center, Division of Medical and
Biological Informatics. All rights reserved.
See MITKCopyright.txt or http://www.mitk.org/copyright.html for details.
This software is distributed WITHOUT ANY WARRANTY; without even
the implied warranty of MERCHANTABILITY or FITNESS FOR A PARTICULAR
PURPOSE. See the above copyright notices for more information.
=========================================================================*/
#ifndef MAPPER_H_HEADER_INCLUDED_C1E6EA08
#define MAPPER_H_HEADER_INCLUDED_C1E6EA08
#include "mitkCommon.h"
#include "mitkBaseRenderer.h"
#include "mitkLevelWindow.h"
#include <itkObject.h>
#include <itkWeakPointer.h>
//Just included to get VTK version
#include <vtkConfigure.h>
class vtkWindow;
class vtkProp;
namespace mitk {
class BaseRenderer;
class BaseData;
class DataNode;
/** \brief Interface for accessing (templated) LocalStorageHandler instances.
*/
class BaseLocalStorageHandler
{
public:
virtual ~BaseLocalStorageHandler() {}
virtual void ClearLocalStorage(mitk::BaseRenderer *renderer,bool unregisterFromBaseRenderer=true )=0;
};
//##Documentation
//## @brief Base class of all mappers, 2D as well as 3D
//##
//## Base class of all Mappers, 2D as well as 3D.
//## Subclasses of mitk::Mapper control the creation of rendering primitives
//## that interface to the graphics library (e.g., OpenGL, vtk).
//## @todo Should Mapper be a subclass of ImageSource?
//## @ingroup Mapper
class MITK_CORE_EXPORT Mapper : public itk::Object
{
public:
mitkClassMacro(Mapper, itk::Object);
//##Documentation
//## @brief Set the DataNode containing the data to map
itkSetObjectMacro(DataNode, DataNode);
//##Documentation
//## @brief Get the data to map
//##
//## Returns the mitk::BaseData object associated with this mapper.
//## @returns the mitk::BaseData associated with this mapper.
BaseData* GetData() const;
//##Documentation
//## @brief Get the DataNode containing the data to map
virtual DataNode* GetDataNode() const;
//##Documentation
//## @brief Convenience access method for color properties (instances of
//## ColorProperty)
//## @return @a true property was found
virtual bool GetColor(float rgb[3], BaseRenderer* renderer, const char* name = "color") const;
//##Documentation
//## @brief Convenience access method for visibility properties (instances
//## of BoolProperty)
//## @return @a true property was found
//## @sa IsVisible
virtual bool GetVisibility(bool &visible, BaseRenderer* renderer, const char* name = "visible") const;
//##Documentation
//## @brief Convenience access method for opacity properties (instances of
//## FloatProperty)
//## @return @a true property was found
virtual bool GetOpacity(float &opacity, BaseRenderer* renderer, const char* name = "opacity") const;
//##Documentation
//## @brief Convenience access method for color properties (instances of
//## LevelWindoProperty)
//## @return @a true property was found
virtual bool GetLevelWindow(LevelWindow &levelWindow, BaseRenderer* renderer, const char* name = "levelwindow") const;
//##Documentation
//## @brief Convenience access method for visibility properties (instances
//## of BoolProperty). Return value is the visibility. Default is
//## visible==true, i.e., true is returned even if the property (@a
//## propertyKey) is not found.
//##
//## Thus, the return value has a different meaning than in the
//## GetVisibility method!
//## @sa GetVisibility
virtual bool IsVisible(BaseRenderer* renderer, const char* name = "visible") const;
virtual void Update(BaseRenderer* renderer);
virtual void MitkRenderOverlay(BaseRenderer* renderer) = 0;
virtual void MitkRenderOpaqueGeometry(BaseRenderer* renderer) = 0;
virtual void MitkRenderTranslucentGeometry(BaseRenderer* renderer) = 0;
#if ( ( VTK_MAJOR_VERSION >= 5 ) && ( VTK_MINOR_VERSION>=2) )
virtual void MitkRenderVolumetricGeometry(BaseRenderer* renderer) = 0;
#endif
/**
* \brief Returns whether this is an vtk-based mapper
*/
bool IsVtkBased() const
{
return m_VtkBased;
}
/** \brief Returns true if this mapper owns the specified vtkProp for
* the given BaseRenderer.
*
* Note: returns false by default; should be implemented for VTK-based
* Mapper subclasses. */
virtual bool HasVtkProp( const vtkProp* /*prop*/, BaseRenderer* /*renderer*/ )
{
return false;
}
/**
* \brief Release vtk-based graphics resources. Must be overwritten in
* subclasses if vtkProps are used.
*/
virtual void ReleaseGraphicsResources(vtkWindow*) { };
/** \brief Set default values of properties used by this mapper
* to \a node
*
* \param node The node for which the properties are set
* \param overwrite overwrite existing properties (default: \a false)
* \param renderer defines which property list of node is used
* (default: \a NULL, i.e. default property list)
*/
static void SetDefaultProperties(DataNode* node, BaseRenderer* renderer = NULL, bool overwrite = false);
/** \brief Returns the current time step as calculated from the renderer */
int GetTimestep() const {return m_TimeStep;};
/** Returns true if this Mapper currently allows for Level-of-Detail rendering.
* This reflects whether this Mapper currently invokes StartEvent, EndEvent, and
* ProgressEvent on BaseRenderer. */
virtual bool IsLODEnabled( BaseRenderer * /*renderer*/ ) const { return false; }
protected:
Mapper();
virtual ~Mapper();
//##Documentation
//## @brief Generate the data needed for rendering (independent of a specific renderer)
virtual void GenerateData();
//##Documentation
//## @brief Generate the data needed for rendering into @a renderer
- virtual void GenerateData(BaseRenderer* renderer);
+ virtual void GenerateDataForRenderer(BaseRenderer* renderer);
//## Updates the time step, which is sometimes needed in subclasses
virtual void CalculateTimeStep( BaseRenderer* renderer );
//## Reset the mapper (i.e., make sure that nothing is displayed) if no
//## valid data is present.
//##
//## To be implemented in sub-classes.
virtual void ResetMapper( BaseRenderer* /*renderer*/ ) { };
bool m_VtkBased;
itk::WeakPointer<DataNode> m_DataNode;
//##Documentation
//## @brief timestamp of last update of stored data
itk::TimeStamp m_LastUpdateTime;
private:
//## The current time step of the dataset to be rendered, for use in subclasses
//## The momentary timestep can be accessed via the GetTimestep() method.
int m_TimeStep;
public:
/** \brief Base class for mapper specific rendering ressources.
*/
class BaseLocalStorage
{
};
/** \brief Templated class for management of LocalStorage implementations in Mappers.
*
* The LocalStorageHandler is responsible for providing a LocalStorage to a
* concrete mitk::Mapper subclass. Each RenderWindow / mitk::BaseRenderer is
* assigned its own LocalStorage instance so that all contained ressources
* (actors, shaders, textures, ...) are provided individually per window.
*
*/
template<class L> class LocalStorageHandler : public mitk::BaseLocalStorageHandler
{
protected:
std::map<mitk::BaseRenderer *,L*> m_BaseRenderer2LS;
public:
/** \brief deallocates a local storage for a specifc BaseRenderer (if the
* BaseRenderer is itself deallocating it in its destructor, it has to set
* unregisterFromBaseRenderer=false)
*/
virtual void ClearLocalStorage(mitk::BaseRenderer *renderer,bool unregisterFromBaseRenderer=true )
{
//MITK_INFO << "deleting a localstorage on a mapper request";
if(unregisterFromBaseRenderer)
renderer->UnregisterLocalStorageHandler( this );
L *l = m_BaseRenderer2LS[renderer];
m_BaseRenderer2LS.erase( renderer );
delete l;
}
/** \brief Retrieves a LocalStorage for a specific BaseRenderer.
*
* Should be used by mappers in GenerateData() and ApplyProperties()
*/
L *GetLocalStorage(mitk::BaseRenderer *forRenderer)
{
L *l = m_BaseRenderer2LS[ forRenderer ];
if(!l)
{
//MITK_INFO << "creating new localstorage";
l = new L;
m_BaseRenderer2LS[ forRenderer ] = l;
forRenderer->RegisterLocalStorageHandler( this );
}
return l;
}
~LocalStorageHandler()
{
typename std::map<mitk::BaseRenderer *,L*>::iterator it;
for ( it=m_BaseRenderer2LS.begin() ; it != m_BaseRenderer2LS.end(); it++ )
{
(*it).first->UnregisterLocalStorageHandler(this);
delete (*it).second;
}
m_BaseRenderer2LS.clear();
}
};
};
} // namespace mitk
#endif /* MAPPER_H_HEADER_INCLUDED_C1E6EA08 */
diff --git a/Core/Code/Rendering/mitkPointSetVtkMapper3D.cpp b/Core/Code/Rendering/mitkPointSetVtkMapper3D.cpp
index 825f472f76..3325013275 100755
--- a/Core/Code/Rendering/mitkPointSetVtkMapper3D.cpp
+++ b/Core/Code/Rendering/mitkPointSetVtkMapper3D.cpp
@@ -1,676 +1,673 @@
/*=========================================================================
Program: Medical Imaging & Interaction Toolkit
Language: C++
Date: $Date$
Version: $Revision$
Copyright (c) German Cancer Research Center, Division of Medical and
Biological Informatics. All rights reserved.
See MITKCopyright.txt or http://www.mitk.org/copyright.html for details.
This software is distributed WITHOUT ANY WARRANTY; without even
the implied warranty of MERCHANTABILITY or FITNESS FOR A PARTICULAR
PURPOSE. See the above copyright notices for more information.
=========================================================================*/
#include "mitkPointSetVtkMapper3D.h"
#include "mitkDataNode.h"
#include "mitkProperties.h"
#include "mitkColorProperty.h"
#include "mitkVtkPropRenderer.h"
#include "mitkPointSet.h"
#include <vtkActor.h>
#include <vtkAppendPolyData.h>
#include <vtkPropAssembly.h>
#include <vtkTubeFilter.h>
#include <vtkRenderer.h>
#include <vtkSphereSource.h>
#include <vtkCubeSource.h>
#include <vtkConeSource.h>
#include <vtkCylinderSource.h>
#include <vtkProperty.h>
#include <vtkPolyDataMapper.h>
#include <vtkCellArray.h>
#include <vtkVectorText.h>
#include <vtkTransform.h>
#include <vtkTransformPolyDataFilter.h>
#if (VTK_MAJOR_VERSION >= 5)
#include <vtkPolyDataAlgorithm.h>
#else
#include <vtkPolyData.h>
#endif
#include <stdlib.h>
const mitk::PointSet* mitk::PointSetVtkMapper3D::GetInput()
{
return static_cast<const mitk::PointSet * > ( GetData() );
}
mitk::PointSetVtkMapper3D::PointSetVtkMapper3D()
: m_vtkSelectedPointList(NULL),
m_vtkUnselectedPointList(NULL),
//m_vtkContourPolyData(NULL),
m_VtkSelectedPolyDataMapper(NULL),
m_VtkUnselectedPolyDataMapper(NULL),
//m_vtkContourPolyDataMapper(NULL),
m_vtkTextList(NULL),
//m_Contour(NULL),
//m_TubeFilter(NULL),
m_NumberOfSelectedAdded(0),
m_NumberOfUnselectedAdded(0),
m_PointSize(1.0),
m_ContourRadius(0.5)
{
//propassembly
m_PointsAssembly = vtkPropAssembly::New();
//creating actors to be able to set transform
m_SelectedActor = vtkActor::New();
m_UnselectedActor = vtkActor::New();
m_ContourActor = vtkActor::New();
}
mitk::PointSetVtkMapper3D::~PointSetVtkMapper3D()
{
m_PointsAssembly->Delete();
m_SelectedActor->Delete();
m_UnselectedActor->Delete();
m_ContourActor->Delete();
}
void mitk::PointSetVtkMapper3D::ReleaseGraphicsResources(vtkWindow *renWin)
{
m_PointsAssembly->ReleaseGraphicsResources(renWin);
m_SelectedActor->ReleaseGraphicsResources(renWin);
m_UnselectedActor->ReleaseGraphicsResources(renWin);
m_ContourActor->ReleaseGraphicsResources(renWin);
}
void mitk::PointSetVtkMapper3D::CreateVTKRenderObjects()
{
m_vtkSelectedPointList = vtkAppendPolyData::New();
m_vtkUnselectedPointList = vtkAppendPolyData::New();
m_PointsAssembly->VisibilityOn();
if(m_PointsAssembly->GetParts()->IsItemPresent(m_SelectedActor))
m_PointsAssembly->RemovePart(m_SelectedActor);
if(m_PointsAssembly->GetParts()->IsItemPresent(m_UnselectedActor))
m_PointsAssembly->RemovePart(m_UnselectedActor);
if(m_PointsAssembly->GetParts()->IsItemPresent(m_ContourActor))
m_PointsAssembly->RemovePart(m_ContourActor);
// exceptional displaying for PositionTracker -> MouseOrientationTool
int mapperID;
bool isInputDevice=false;
if( this->GetDataNode()->GetBoolProperty("inputdevice",isInputDevice) && isInputDevice )
{
if( this->GetDataNode()->GetIntProperty("BaseRendererMapperID",mapperID) && mapperID == 2)
return; //The event for the PositionTracker came from the 3d widget and not needs to be displayed
}
// get and update the PointSet
mitk::PointSet::Pointer input = const_cast<mitk::PointSet*>(this->GetInput());
/* only update the input data, if the property tells us to */
bool update = true;
this->GetDataNode()->GetBoolProperty("updateDataOnRender", update);
if (update == true)
input->Update();
int timestep = this->GetTimestep();
mitk::PointSet::DataType::Pointer itkPointSet = input->GetPointSet( timestep );
if ( itkPointSet.GetPointer() == NULL)
{
m_PointsAssembly->VisibilityOff();
return;
}
mitk::PointSet::PointsContainer::Iterator pointsIter;
mitk::PointSet::PointDataContainer::Iterator pointDataIter;
int j;
m_NumberOfSelectedAdded = 0;
m_NumberOfUnselectedAdded = 0;
//create contour
bool makeContour = false;
this->GetDataNode()->GetBoolProperty("show contour", makeContour);
if (makeContour)
{
this->CreateContour(NULL);
}
//now fill selected and unselected pointList
//get size of Points in Property
m_PointSize = 2;
mitk::FloatProperty::Pointer pointSizeProp = dynamic_cast<mitk::FloatProperty *>(this->GetDataNode()->GetProperty("pointsize"));
if ( pointSizeProp.IsNotNull() )
m_PointSize = pointSizeProp->GetValue();
//get the property for creating a label onto every point only once
bool showLabel = true;
this->GetDataNode()->GetBoolProperty("show label", showLabel);
const char * pointLabel=NULL;
if(showLabel)
{
if(dynamic_cast<mitk::StringProperty *>(this->GetDataNode()->GetPropertyList()->GetProperty("label")) != NULL)
pointLabel =dynamic_cast<mitk::StringProperty *>(this->GetDataNode()->GetPropertyList()->GetProperty("label"))->GetValue();
else
showLabel = false;
}
//check if the list for the PointDataContainer is the same size as the PointsContainer. Is not, then the points were inserted manually and can not be visualized according to the PointData (selected/unselected)
bool pointDataBroken = (itkPointSet->GetPointData()->Size() != itkPointSet->GetPoints()->Size());
//now add an object for each point in data
pointDataIter = itkPointSet->GetPointData()->Begin();
for (j=0, pointsIter=itkPointSet->GetPoints()->Begin();
pointsIter!=itkPointSet->GetPoints()->End();
pointsIter++, j++)
{
//check for the pointtype in data and decide which geom-object to take and then add to the selected or unselected list
int pointType;
if(itkPointSet->GetPointData()->size() == 0 || pointDataBroken)
pointType = mitk::PTUNDEFINED;
else
pointType = pointDataIter.Value().pointSpec;
#if (VTK_MAJOR_VERSION >= 5)
vtkPolyDataAlgorithm *source;
#else
vtkPolyDataSource *source;
#endif
switch (pointType)
{
case mitk::PTUNDEFINED:
{
vtkSphereSource *sphere = vtkSphereSource::New();
sphere->SetRadius(m_PointSize);
itk::Point<float> point1 = pointsIter->Value();
sphere->SetCenter(point1[0],point1[1],point1[2]);
//sphere->SetCenter(pointsIter.Value()[0],pointsIter.Value()[1],pointsIter.Value()[2]);
//MouseOrientation Tool (PositionTracker)
if(isInputDevice)
{
sphere->SetThetaResolution(10);
sphere->SetPhiResolution(10);
}
else
{
sphere->SetThetaResolution(20);
sphere->SetPhiResolution(20);
}
source = sphere;
}
break;
case mitk::PTSTART:
{
vtkCubeSource *cube = vtkCubeSource::New();
cube->SetXLength(m_PointSize/2);
cube->SetYLength(m_PointSize/2);
cube->SetZLength(m_PointSize/2);
itk::Point<float> point1 = pointsIter->Value();
cube->SetCenter(point1[0],point1[1],point1[2]);
source = cube;
}
break;
case mitk::PTCORNER:
{
vtkConeSource *cone = vtkConeSource::New();
cone->SetRadius(m_PointSize);
itk::Point<float> point1 = pointsIter->Value();
cone->SetCenter(point1[0],point1[1],point1[2]);
cone->SetResolution(20);
source = cone;
}
break;
case mitk::PTEDGE:
{
vtkCylinderSource *cylinder = vtkCylinderSource::New();
cylinder->SetRadius(m_PointSize);
itk::Point<float> point1 = pointsIter->Value();
cylinder->SetCenter(point1[0],point1[1],point1[2]);
cylinder->SetResolution(20);
source = cylinder;
}
break;
case mitk::PTEND:
{
vtkSphereSource *sphere = vtkSphereSource::New();
sphere->SetRadius(m_PointSize);
itk::Point<float> point1 = pointsIter->Value();
sphere->SetThetaResolution(20);
sphere->SetPhiResolution(20);
source = sphere;
}
break;
default:
{
vtkSphereSource *sphere = vtkSphereSource::New();
sphere->SetRadius(m_PointSize);
itk::Point<float> point1 = pointsIter->Value();
sphere->SetCenter(point1[0],point1[1],point1[2]);
sphere->SetThetaResolution(20);
sphere->SetPhiResolution(20);
source = sphere;
}
break;
}
if (!pointDataBroken)
{
if (pointDataIter.Value().selected)
{
m_vtkSelectedPointList->AddInput(source->GetOutput());
++m_NumberOfSelectedAdded;
}
else
{
m_vtkUnselectedPointList->AddInput(source->GetOutput());
++m_NumberOfUnselectedAdded;
}
}
else
{
m_vtkUnselectedPointList->AddInput(source->GetOutput());
++m_NumberOfUnselectedAdded;
}
source->Delete();
if (showLabel)
{
char buffer[20];
std::string l = pointLabel;
if ( input->GetSize()>1 )
{
sprintf(buffer,"%d",j+1);
l.append(buffer);
}
// Define the text for the label
vtkVectorText *label = vtkVectorText::New();
label->SetText(l.c_str());
//# Set up a transform to move the label to a new position.
vtkTransform *aLabelTransform =vtkTransform::New();
aLabelTransform->Identity();
itk::Point<float> point1 = pointsIter->Value();
aLabelTransform->Translate(point1[0]+2,point1[1]+2,point1[2]);
aLabelTransform->Scale(5.7,5.7,5.7);
//# Move the label to a new position.
vtkTransformPolyDataFilter *labelTransform = vtkTransformPolyDataFilter::New();
labelTransform->SetTransform(aLabelTransform);
aLabelTransform->Delete();
labelTransform->SetInput(label->GetOutput());
label->Delete();
//add it to the wright PointList
if (pointType)
{
m_vtkSelectedPointList->AddInput(labelTransform->GetOutput());
++m_NumberOfSelectedAdded;
}
else
{
m_vtkUnselectedPointList->AddInput(labelTransform->GetOutput());
++m_NumberOfUnselectedAdded;
}
labelTransform->Delete();
}
if(pointDataIter != itkPointSet->GetPointData()->End())
pointDataIter++;
} // end FOR
//now according to number of elements added to selected or unselected, build up the rendering pipeline
if (m_NumberOfSelectedAdded > 0)
{
m_VtkSelectedPolyDataMapper = vtkPolyDataMapper::New();
m_VtkSelectedPolyDataMapper->SetInput(m_vtkSelectedPointList->GetOutput());
//create a new instance of the actor
m_SelectedActor->Delete();
m_SelectedActor = vtkActor::New();
m_SelectedActor->SetMapper(m_VtkSelectedPolyDataMapper);
m_VtkSelectedPolyDataMapper->Delete();
m_PointsAssembly->AddPart(m_SelectedActor);
}
m_vtkSelectedPointList->Delete();
if (m_NumberOfUnselectedAdded > 0)
{
m_VtkUnselectedPolyDataMapper = vtkPolyDataMapper::New();
m_VtkUnselectedPolyDataMapper->SetInput(m_vtkUnselectedPointList->GetOutput());
//create a new instance of the actor
m_UnselectedActor->Delete();
m_UnselectedActor = vtkActor::New();
m_UnselectedActor->SetMapper(m_VtkUnselectedPolyDataMapper);
m_VtkUnselectedPolyDataMapper->Delete();
m_PointsAssembly->AddPart(m_UnselectedActor);
}
m_vtkUnselectedPointList->Delete();
}
void mitk::PointSetVtkMapper3D::GenerateData()
{
//create new vtk render objects (e.g. sphere for a point)
this->CreateVTKRenderObjects();
//apply props
- Superclass::ApplyProperties( m_ContourActor, NULL );
- this->ApplyProperties(NULL);
+ this->ApplyProperties(m_ContourActor,NULL);
}
-void mitk::PointSetVtkMapper3D::GenerateData( mitk::BaseRenderer *renderer )
+void mitk::PointSetVtkMapper3D::GenerateDataForRenderer( mitk::BaseRenderer *renderer )
{
SetVtkMapperImmediateModeRendering(m_VtkSelectedPolyDataMapper);
SetVtkMapperImmediateModeRendering(m_VtkUnselectedPolyDataMapper);
mitk::FloatProperty::Pointer pointSizeProp = dynamic_cast<mitk::FloatProperty *>(this->GetDataNode()->GetProperty("pointsize"));
mitk::FloatProperty::Pointer contourSizeProp = dynamic_cast<mitk::FloatProperty *>(this->GetDataNode()->GetProperty("contoursize"));
// only create new vtk render objects if property values were changed
if ( pointSizeProp.IsNotNull() && contourSizeProp.IsNotNull() )
{
if (m_PointSize!=pointSizeProp->GetValue() || m_ContourRadius!= contourSizeProp->GetValue())
{
this->CreateVTKRenderObjects();
}
}
-
- Superclass::ApplyProperties( m_ContourActor, renderer );
- this->ApplyProperties(renderer);
+ this->ApplyProperties(m_ContourActor,renderer);
if(IsVisible(renderer)==false)
{
m_UnselectedActor->VisibilityOff();
m_SelectedActor->VisibilityOff();
m_ContourActor->VisibilityOff();
return;
}
bool showPoints = true;
this->GetDataNode()->GetBoolProperty("show points", showPoints);
if(showPoints)
{
m_UnselectedActor->VisibilityOn();
m_SelectedActor->VisibilityOn();
}
else
{
m_UnselectedActor->VisibilityOff();
m_SelectedActor->VisibilityOff();
}
if(dynamic_cast<mitk::FloatProperty *>(this->GetDataNode()->GetProperty("opacity")) != NULL)
{
mitk::FloatProperty::Pointer pointOpacity =dynamic_cast<mitk::FloatProperty *>(this->GetDataNode()->GetProperty("opacity"));
float opacity = pointOpacity->GetValue();
m_ContourActor->GetProperty()->SetOpacity(opacity);
m_UnselectedActor->GetProperty()->SetOpacity(opacity);
m_SelectedActor->GetProperty()->SetOpacity(opacity);
}
bool makeContour = false;
this->GetDataNode()->GetBoolProperty("show contour", makeContour);
if (makeContour)
{
m_ContourActor->VisibilityOn();
}
else
{
m_ContourActor->VisibilityOff();
}
}
void mitk::PointSetVtkMapper3D::ResetMapper( BaseRenderer* /*renderer*/ )
{
m_PointsAssembly->VisibilityOff();
}
vtkProp* mitk::PointSetVtkMapper3D::GetVtkProp(mitk::BaseRenderer * /*renderer*/)
{
return m_PointsAssembly;
}
void mitk::PointSetVtkMapper3D::UpdateVtkTransform(mitk::BaseRenderer * /*renderer*/)
{
vtkLinearTransform * vtktransform =
this->GetDataNode()->GetVtkTransform(this->GetTimestep());
m_SelectedActor->SetUserTransform(vtktransform);
m_UnselectedActor->SetUserTransform(vtktransform);
m_ContourActor->SetUserTransform(vtktransform);
}
-void mitk::PointSetVtkMapper3D::ApplyProperties(mitk::BaseRenderer* renderer)
+void mitk::PointSetVtkMapper3D::ApplyProperties(vtkActor* actor, mitk::BaseRenderer* renderer)
{
+ Superclass::ApplyProperties(actor,renderer);
//check for color props and use it for rendering of selected/unselected points and contour
//due to different params in VTK (double/float) we have to convert!
//vars to convert to
vtkFloatingPointType unselectedColor[4]={1.0f,1.0f,0.0f,1.0f};//yellow
vtkFloatingPointType selectedColor[4]={1.0f,0.0f,0.0f,1.0f};//red
vtkFloatingPointType contourColor[4]={1.0f,0.0f,0.0f,1.0f};//red
//different types for color!!!
mitk::Color tmpColor;
double opacity = 1.0;
//check if there is an unselected property
if (dynamic_cast<mitk::ColorProperty*>(this->GetDataNode()->GetPropertyList(renderer)->GetProperty("unselectedcolor")) != NULL)
{
tmpColor = dynamic_cast<mitk::ColorProperty *>(this->GetDataNode()->GetPropertyList(renderer)->GetProperty("unselectedcolor"))->GetValue();
unselectedColor[0] = tmpColor[0];
unselectedColor[1] = tmpColor[1];
unselectedColor[2] = tmpColor[2];
unselectedColor[3] = 1.0f; //!!define a new ColorProp to be able to pass alpha value
}
else if (dynamic_cast<mitk::ColorProperty*>(this->GetDataNode()->GetPropertyList(NULL)->GetProperty("unselectedcolor")) != NULL)
{
tmpColor = dynamic_cast<mitk::ColorProperty *>(this->GetDataNode()->GetPropertyList(NULL)->GetProperty("unselectedcolor"))->GetValue();
unselectedColor[0] = tmpColor[0];
unselectedColor[1] = tmpColor[1];
unselectedColor[2] = tmpColor[2];
unselectedColor[3] = 1.0f; //!!define a new ColorProp to be able to pass alpha value
}
else
{
//check if the node has a color
float unselectedColorTMP[4]={1.0f,1.0f,0.0f,1.0f};//yellow
m_DataNode->GetColor(unselectedColorTMP, NULL);
unselectedColor[0] = unselectedColorTMP[0];
unselectedColor[1] = unselectedColorTMP[1];
unselectedColor[2] = unselectedColorTMP[2];
//unselectedColor[3] stays 1.0f
}
//get selected property
if (dynamic_cast<mitk::ColorProperty*>(this->GetDataNode()->GetPropertyList(renderer)->GetProperty("selectedcolor")) != NULL)
{
tmpColor = dynamic_cast<mitk::ColorProperty *>(this->GetDataNode()->GetPropertyList(renderer)->GetProperty("selectedcolor"))->GetValue();
selectedColor[0] = tmpColor[0];
selectedColor[1] = tmpColor[1];
selectedColor[2] = tmpColor[2];
selectedColor[3] = 1.0f;
}
else if (dynamic_cast<mitk::ColorProperty*>(this->GetDataNode()->GetPropertyList(NULL)->GetProperty("selectedcolor")) != NULL)
{
tmpColor = dynamic_cast<mitk::ColorProperty *>(this->GetDataNode()->GetPropertyList(NULL)->GetProperty("selectedcolor"))->GetValue();
selectedColor[0] = tmpColor[0];
selectedColor[1] = tmpColor[1];
selectedColor[2] = tmpColor[2];
selectedColor[3] = 1.0f;
}
//get contour property
if (dynamic_cast<mitk::ColorProperty*>(this->GetDataNode()->GetPropertyList(renderer)->GetProperty("contourcolor")) != NULL)
{
tmpColor = dynamic_cast<mitk::ColorProperty *>(this->GetDataNode()->GetPropertyList(renderer)->GetProperty("contourcolor"))->GetValue();
contourColor[0] = tmpColor[0];
contourColor[1] = tmpColor[1];
contourColor[2] = tmpColor[2];
contourColor[3] = 1.0f;
}
else if (dynamic_cast<mitk::ColorProperty*>(this->GetDataNode()->GetPropertyList(NULL)->GetProperty("contourcolor")) != NULL)
{
tmpColor = dynamic_cast<mitk::ColorProperty *>(this->GetDataNode()->GetPropertyList(NULL)->GetProperty("contourcolor"))->GetValue();
contourColor[0] = tmpColor[0];
contourColor[1] = tmpColor[1];
contourColor[2] = tmpColor[2];
contourColor[3] = 1.0f;
}
if(dynamic_cast<mitk::FloatProperty *>(this->GetDataNode()->GetPropertyList(renderer)->GetProperty("opacity")) != NULL)
{
mitk::FloatProperty::Pointer pointOpacity =dynamic_cast<mitk::FloatProperty *>(this->GetDataNode()->GetPropertyList(renderer)->GetProperty("opacity"));
opacity = pointOpacity->GetValue();
}
else if(dynamic_cast<mitk::FloatProperty *>(this->GetDataNode()->GetPropertyList(NULL)->GetProperty("opacity")) != NULL)
{
mitk::FloatProperty::Pointer pointOpacity =dynamic_cast<mitk::FloatProperty *>(this->GetDataNode()->GetPropertyList(NULL)->GetProperty("opacity"));
opacity = pointOpacity->GetValue();
}
//finished color / opacity fishing!
//check if a contour shall be drawn
bool makeContour = false;
this->GetDataNode()->GetBoolProperty("show contour", makeContour, renderer);
int visibleBefore = m_ContourActor->GetVisibility();
if(makeContour && (m_ContourActor != NULL) )
{
if ( visibleBefore == 0)//was not visible before, so create it.
this->CreateContour(renderer);
m_ContourActor->GetProperty()->SetColor(contourColor);
m_ContourActor->GetProperty()->SetOpacity(opacity);
}
m_SelectedActor->GetProperty()->SetColor(selectedColor);
m_SelectedActor->GetProperty()->SetOpacity(opacity);
m_UnselectedActor->GetProperty()->SetColor(unselectedColor);
m_UnselectedActor->GetProperty()->SetOpacity(opacity);
}
void mitk::PointSetVtkMapper3D::CreateContour(mitk::BaseRenderer* renderer)
{
vtkAppendPolyData* vtkContourPolyData = vtkAppendPolyData::New();
vtkPolyDataMapper* vtkContourPolyDataMapper = vtkPolyDataMapper::New();
vtkPoints *points = vtkPoints::New();
vtkCellArray *polys = vtkCellArray::New();
mitk::PointSet::PointsContainer::Iterator pointsIter;
mitk::PointSet::PointDataContainer::Iterator pointDataIter;
int j;
// get and update the PointSet
mitk::PointSet::Pointer input = const_cast<mitk::PointSet*>(this->GetInput());
//input->Update();
int timestep = this->GetTimestep();
mitk::PointSet::DataType::Pointer itkPointSet = input->GetPointSet( timestep );
if ( itkPointSet.GetPointer() == NULL)
{
return;
}
for (j=0, pointsIter=itkPointSet->GetPoints()->Begin(); pointsIter!=itkPointSet->GetPoints()->End() ; pointsIter++,j++)
{
vtkIdType cell[2] = {j-1,j};
itk::Point<float> point1 = pointsIter->Value();
points->InsertPoint(j,point1[0],point1[1],point1[2]);
if (j>0)
polys->InsertNextCell(2,cell);
}
bool close;
if (dynamic_cast<mitk::BoolProperty *>(this->GetDataNode()->GetPropertyList()->GetProperty("close contour"), renderer) == NULL)
close = false;
else
close = dynamic_cast<mitk::BoolProperty *>(this->GetDataNode()->GetPropertyList()->GetProperty("close contour"), renderer)->GetValue();
if (close)
{
vtkIdType cell[2] = {j-1,0};
polys->InsertNextCell(2,cell);
}
vtkPolyData* contour = vtkPolyData::New();
contour->SetPoints(points);
points->Delete();
contour->SetLines(polys);
polys->Delete();
contour->Update();
vtkTubeFilter* tubeFilter = vtkTubeFilter::New();
tubeFilter->SetNumberOfSides( 12 );
tubeFilter->SetInput(contour);
contour->Delete();
//check for property contoursize.
m_ContourRadius = 0.5;
mitk::FloatProperty::Pointer contourSizeProp = dynamic_cast<mitk::FloatProperty *>(this->GetDataNode()->GetProperty("contoursize") );
if (contourSizeProp.IsNotNull())
m_ContourRadius = contourSizeProp->GetValue();
tubeFilter->SetRadius( m_ContourRadius );
tubeFilter->Update();
//add to pipeline
vtkContourPolyData->AddInput(tubeFilter->GetOutput());
tubeFilter->Delete();
vtkContourPolyDataMapper->SetInput(vtkContourPolyData->GetOutput());
vtkContourPolyData->Delete();
//create a new instance of the actor
m_ContourActor->Delete();
m_ContourActor = vtkActor::New();
m_ContourActor->SetMapper(vtkContourPolyDataMapper);
vtkContourPolyDataMapper->Delete();
m_PointsAssembly->AddPart(m_ContourActor);
}
void mitk::PointSetVtkMapper3D::SetDefaultProperties(mitk::DataNode* node, mitk::BaseRenderer* renderer, bool overwrite)
{
node->AddProperty( "line width", mitk::IntProperty::New(2), renderer, overwrite );
node->AddProperty( "pointsize", mitk::FloatProperty::New(1.0), renderer, overwrite);
node->AddProperty( "selectedcolor", mitk::ColorProperty::New(1.0f, 0.0f, 0.0f), renderer, overwrite); //red
node->AddProperty( "color", mitk::ColorProperty::New(1.0f, 1.0f, 0.0f), renderer, overwrite); //yellow
node->AddProperty( "show contour", mitk::BoolProperty::New(false), renderer, overwrite );
node->AddProperty( "contourcolor", mitk::ColorProperty::New(1.0f, 0.0f, 0.0f), renderer, overwrite);
node->AddProperty( "contoursize", mitk::FloatProperty::New(0.5), renderer, overwrite );
- node->AddProperty( "close contour", mitk::BoolProperty::New(false), renderer, overwrite );
node->AddProperty( "show points", mitk::BoolProperty::New(true), renderer, overwrite );
node->AddProperty( "updateDataOnRender", mitk::BoolProperty::New(true), renderer, overwrite );
Superclass::SetDefaultProperties(node, renderer, overwrite);
}
diff --git a/Core/Code/Rendering/mitkPointSetVtkMapper3D.h b/Core/Code/Rendering/mitkPointSetVtkMapper3D.h
index cd5ecd542a..e56181d05e 100755
--- a/Core/Code/Rendering/mitkPointSetVtkMapper3D.h
+++ b/Core/Code/Rendering/mitkPointSetVtkMapper3D.h
@@ -1,158 +1,158 @@
/*=========================================================================
Program: Medical Imaging & Interaction Toolkit
Language: C++
Date: $Date$
Version: $Revision$
Copyright (c) German Cancer Research Center, Division of Medical and
Biological Informatics. All rights reserved.
See MITKCopyright.txt or http://www.mitk.org/copyright.html for details.
This software is distributed WITHOUT ANY WARRANTY; without even
the implied warranty of MERCHANTABILITY or FITNESS FOR A PARTICULAR
PURPOSE. See the above copyright notices for more information.
=========================================================================*/
#ifndef MITKPointSetVtkMAPPER3D_H_HEADER_INCLUDED_C1907273
#define MITKPointSetVtkMAPPER3D_H_HEADER_INCLUDED_C1907273
#include "mitkCommon.h"
#include "mitkVtkMapper3D.h"
#include "mitkBaseRenderer.h"
class vtkActor;
class vtkPropAssembly;
class vtkAppendPolyData;
class vtkPolyData;
class vtkTubeFilter;
class vtkPolyDataMapper;
namespace mitk {
class PointSet;
/**
* @brief Vtk-based mapper for PointSet
*
* Due to the need of different colors for selected
* and unselected points and the facts, that we also have a contour and
* labels for the points, the vtk structure is build up the following way:
*
* We have two AppendPolyData, one selected, and one unselected and one
* for a contour between the points. Each one is connected to an own
* PolyDaraMapper and an Actor. The different color for the unselected and
* selected state and for the contour is read from properties.
*
* "unselectedcolor", "selectedcolor" and "contourcolor" are the strings,
* that are looked for. Pointlabels are added besides the selected or the
* deselected points.
*
* Then the three Actors are combined inside a vtkPropAssembly and this
* object is returned in GetProp() and so hooked up into the rendering
* pipeline.
* Properties that can be set for point sets and influence the PointSetVTKMapper3D are:
*
* - \b "color": (ColorProperty*) Color of the point set
* - \b "Opacity": (FloatProperty) Opacity of the point set
* - \b "show contour": (BoolProperty) If the contour of the points are visible
* - \b "contourSizeProp":(FloatProperty) Contour size of the points
The default properties are:
* - \b "line width": (IntProperty::New(2), renderer, overwrite )
* - \b "pointsize": (FloatProperty::New(1.0), renderer, overwrite)
* - \b "selectedcolor": (ColorProperty::New(1.0f, 0.0f, 0.0f), renderer, overwrite) //red
* - \b "color": (ColorProperty::New(1.0f, 1.0f, 0.0f), renderer, overwrite) //yellow
* - \b "show contour": (BoolProperty::New(false), renderer, overwrite )
* - \b "contourcolor": (ColorProperty::New(1.0f, 0.0f, 0.0f), renderer, overwrite)
* - \b "contoursize": (FloatProperty::New(0.5), renderer, overwrite )
* - \b "close contour": (BoolProperty::New(false), renderer, overwrite )
* - \b "show points": (BoolProperty::New(true), renderer, overwrite )
* - \b "updateDataOnRender": (BoolProperty::New(true), renderer, overwrite )
*Other properties looked for are:
*
* - \b "show contour": if set to on, lines between the points are shown
* - \b "close contour": if set to on, the open strip is closed (first point
* connected with last point)
* - \b "pointsize": size of the points mapped
* - \b "label": text of the Points to show besides points
* - \b "contoursize": size of the contour drawn between the points
* (if not set, the pointsize is taken)
*
* @ingroup Mapper
*/
class MITK_CORE_EXPORT PointSetVtkMapper3D : public VtkMapper3D
{
public:
mitkClassMacro(PointSetVtkMapper3D, VtkMapper3D);
itkNewMacro(Self);
virtual const mitk::PointSet* GetInput();
//overwritten from VtkMapper3D to be able to return a
//m_PointsAssembly which is much faster than a vtkAssembly
virtual vtkProp* GetVtkProp(mitk::BaseRenderer* renderer);
virtual void UpdateVtkTransform(mitk::BaseRenderer* renderer);
static void SetDefaultProperties(mitk::DataNode* node, mitk::BaseRenderer* renderer = NULL, bool overwrite = false);
void ReleaseGraphicsResources(vtkWindow *renWin);
protected:
PointSetVtkMapper3D();
virtual ~PointSetVtkMapper3D();
virtual void GenerateData();
- virtual void GenerateData(mitk::BaseRenderer* renderer);
+ virtual void GenerateDataForRenderer(mitk::BaseRenderer* renderer);
virtual void ResetMapper( BaseRenderer* renderer );
- virtual void ApplyProperties(mitk::BaseRenderer* renderer);
+ virtual void ApplyProperties(vtkActor* actor, mitk::BaseRenderer* renderer);
virtual void CreateContour(mitk::BaseRenderer* renderer);
virtual void CreateVTKRenderObjects();
vtkAppendPolyData *m_vtkSelectedPointList;
vtkAppendPolyData *m_vtkUnselectedPointList;
// vtkAppendPolyData *m_vtkContourPolyData;
vtkPolyDataMapper *m_VtkSelectedPolyDataMapper;
vtkPolyDataMapper *m_VtkUnselectedPolyDataMapper;
// vtkPolyDataMapper *m_vtkContourPolyDataMapper;
vtkActor *m_SelectedActor;
vtkActor *m_UnselectedActor;
vtkActor *m_ContourActor;
vtkPropAssembly *m_PointsAssembly;
//help for contour between points
vtkAppendPolyData *m_vtkTextList;
//vtkPolyData *m_Contour;
//vtkTubeFilter *m_TubeFilter;
//variables to be able to log, how many inputs have been added to PolyDatas
unsigned int m_NumberOfSelectedAdded;
unsigned int m_NumberOfUnselectedAdded;
//variables to check if an update of the vtk objects is needed
ScalarType m_PointSize;
ScalarType m_ContourRadius;
};
} // namespace mitk
#endif /* MITKPointSetVtkMAPPER3D_H_HEADER_INCLUDED_C1907273 */
diff --git a/Core/Code/Rendering/mitkSurfaceGLMapper2D.cpp b/Core/Code/Rendering/mitkSurfaceGLMapper2D.cpp
index f4ed1d65e0..d0e2343b99 100644
--- a/Core/Code/Rendering/mitkSurfaceGLMapper2D.cpp
+++ b/Core/Code/Rendering/mitkSurfaceGLMapper2D.cpp
@@ -1,543 +1,543 @@
/*=========================================================================
Program: Medical Imaging & Interaction Toolkit
Language: C++
Date: $Date$
Version: $Revision$
Copyright (c) German Cancer Research Center, Division of Medical and
Biological Informatics. All rights reserved.
See MITKCopyright.txt or http://www.mitk.org/copyright.html for details.
This software is distributed WITHOUT ANY WARRANTY; without even
the implied warranty of MERCHANTABILITY or FITNESS FOR A PARTICULAR
PURPOSE. See the above copyright notices for more information.
=========================================================================*/
#include <mitkGL.h>
#include "mitkSurfaceGLMapper2D.h"
#include "mitkBaseRenderer.h"
#include "mitkPlaneGeometry.h"
#include "mitkSurface.h"
#include "mitkColorProperty.h"
#include "mitkProperties.h"
#include "mitkVtkScalarModeProperty.h"
#include "mitkAbstractTransformGeometry.h"
#include "mitkLookupTableProperty.h"
#include <vtkPolyData.h>
#include <vtkPlane.h>
#include <vtkCutter.h>
#include <vtkPoints.h>
#include <vtkCellArray.h>
#include <vtkLookupTable.h>
#include <vtkPointData.h>
#include <vtkCellData.h>
#include <vtkDataArray.h>
#include <vtkLinearTransform.h>
#include <vtkAbstractMapper.h>
#include <vtkPKdTree.h>
#include <vtkStripper.h>
mitk::SurfaceGLMapper2D::SurfaceGLMapper2D()
: m_Plane( vtkPlane::New() ),
m_Cutter( vtkCutter::New() ),
m_LUT( vtkLookupTable::New() ),
m_PointLocator( vtkPKdTree::New() ),
m_Stripper( vtkStripper::New() ),
m_DrawNormals(false),
m_FrontNormalLengthInPixels(10.0),
m_BackNormalLengthInPixels(10.0)
{
// default for normals on front side = green
m_FrontSideColor[0] = 0.0;
m_FrontSideColor[1] = 1.0;
m_FrontSideColor[2] = 0.0;
m_FrontSideColor[3] = 1.0;
// default for normals on back side = red
m_BackSideColor[0] = 1.0;
m_BackSideColor[1] = 0.0;
m_BackSideColor[2] = 0.0;
m_BackSideColor[3] = 1.0;
// default for line color = yellow
m_LineColor[0] = 1.0;
m_LineColor[1] = 1.0;
m_LineColor[2] = 0.0;
m_LineColor[3] = 1.0;
m_Cutter->SetCutFunction(m_Plane);
m_Cutter->GenerateValues(1,0,1);
m_LUT->SetTableRange(0,255);
m_LUT->SetNumberOfColors(255);
m_LUT->SetRampToLinear();
m_LUT->Build();
}
mitk::SurfaceGLMapper2D::~SurfaceGLMapper2D()
{
m_Plane->Delete();
m_Cutter->Delete();
m_LUT->Delete();
m_PointLocator->Delete();
m_Stripper->Delete();
}
const mitk::Surface *mitk::SurfaceGLMapper2D::GetInput(void)
{
if(m_Surface.IsNotNull())
return m_Surface;
return static_cast<const Surface * > ( GetData() );
}
-void mitk::SurfaceGLMapper2D::SetDataNode( mitk::DataNode::Pointer node )
+void mitk::SurfaceGLMapper2D::SetDataNode( mitk::DataNode* node )
{
Superclass::SetDataNode( node );
bool useCellData;
if (dynamic_cast<BoolProperty *>(node->GetProperty("deprecated useCellDataForColouring")) == NULL)
useCellData = false;
else
useCellData = dynamic_cast<BoolProperty *>(node->GetProperty("deprecated useCellDataForColouring"))->GetValue();
if (!useCellData)
{
// search min/max point scalars over all time steps
vtkFloatingPointType dataRange[2] = {0,0};
vtkFloatingPointType range[2];
Surface::Pointer input = const_cast< Surface* >(dynamic_cast<const Surface*>( this->GetDataNode()->GetData() ));
if(input.IsNull()) return;
const TimeSlicedGeometry::Pointer inputTimeGeometry = input->GetTimeSlicedGeometry();
if(( inputTimeGeometry.IsNull() ) || ( inputTimeGeometry->GetTimeSteps() == 0 ) ) return;
for (unsigned int timestep=0; timestep<inputTimeGeometry->GetTimeSteps(); timestep++)
{
vtkPolyData * vtkpolydata = input->GetVtkPolyData( timestep );
if((vtkpolydata==NULL) || (vtkpolydata->GetNumberOfPoints() < 1 )) continue;
vtkDataArray *vpointscalars = vtkpolydata->GetPointData()->GetScalars();
if (vpointscalars) {
vpointscalars->GetRange( range, 0 );
if (dataRange[0]==0 && dataRange[1]==0) {
dataRange[0] = range[0];
dataRange[1] = range[1];
}
else {
if (range[0] < dataRange[0]) dataRange[0] = range[0];
if (range[1] > dataRange[1]) dataRange[1] = range[1];
}
}
}
if (dataRange[1] - dataRange[0] > 0) {
m_LUT->SetTableRange( dataRange );
m_LUT->Build();
}
}
}
void mitk::SurfaceGLMapper2D::Paint(mitk::BaseRenderer * renderer)
{
if(IsVisible(renderer)==false) return;
Surface::Pointer input = const_cast<Surface*>(this->GetInput());
if(input.IsNull())
return;
//
// get the TimeSlicedGeometry of the input object
//
const TimeSlicedGeometry* inputTimeGeometry = input->GetTimeSlicedGeometry();
if(( inputTimeGeometry == NULL ) || ( inputTimeGeometry->GetTimeSteps() == 0 ) )
return;
if (dynamic_cast<IntProperty *>(this->GetDataNode()->GetProperty("line width")) == NULL)
m_LineWidth = 1;
else
m_LineWidth = dynamic_cast<IntProperty *>(this->GetDataNode()->GetProperty("line width"))->GetValue();
//
// get the world time
//
Geometry2D::ConstPointer worldGeometry = renderer->GetCurrentWorldGeometry2D();
assert( worldGeometry.IsNotNull() );
ScalarType time = worldGeometry->GetTimeBounds()[ 0 ];
int timestep=0;
if( time > ScalarTypeNumericTraits::NonpositiveMin() )
timestep = inputTimeGeometry->MSToTimeStep( time );
// int timestep = this->GetTimestep();
if( inputTimeGeometry->IsValidTime( timestep ) == false )
return;
vtkPolyData * vtkpolydata = input->GetVtkPolyData( timestep );
if((vtkpolydata==NULL) || (vtkpolydata->GetNumberOfPoints() < 1 ))
return;
PlaneGeometry::ConstPointer worldPlaneGeometry = dynamic_cast<const PlaneGeometry*>(worldGeometry.GetPointer());
//apply color and opacity read from the PropertyList
ApplyProperties(renderer);
if (m_DrawNormals)
{
m_PointLocator->SetDataSet( vtkpolydata );
m_PointLocator->BuildLocatorFromPoints( vtkpolydata->GetPoints() );
}
if(vtkpolydata!=NULL)
{
Point3D point;
Vector3D normal;
//Check if Lookup-Table is already given, else use standard one.
vtkFloatingPointType* scalarLimits = m_LUT->GetTableRange();
vtkFloatingPointType scalarsMin = scalarLimits[0], scalarsMax = scalarLimits[1];
vtkLookupTable *lut;// = vtkLookupTable::New();
LookupTableProperty::Pointer lookupTableProp;
this->GetDataNode()->GetProperty(lookupTableProp, "LookupTable", renderer);
if (lookupTableProp.IsNotNull() )
{
lut = lookupTableProp->GetLookupTable()->GetVtkLookupTable();
if (dynamic_cast<FloatProperty *>(this->GetDataNode()->GetProperty("ScalarsRangeMinimum")) != NULL)
scalarsMin = dynamic_cast<FloatProperty*>(this->GetDataNode()->GetProperty("ScalarsRangeMinimum"))->GetValue();
if (dynamic_cast<FloatProperty *>(this->GetDataNode()->GetProperty("ScalarsRangeMaximum")) != NULL)
scalarsMax = dynamic_cast<FloatProperty*>(this->GetDataNode()->GetProperty("ScalarsRangeMaximum"))->GetValue();
// check if the scalar range has been changed, e.g. manually, for the data tree node, and rebuild the LUT if necessary.
double* oldRange = lut->GetTableRange();
if( oldRange[0] != scalarsMin || oldRange[1] != scalarsMax )
{
lut->SetTableRange(scalarsMin, scalarsMax);
lut->Build();
}
}
else
{
lut = m_LUT;
}
vtkLinearTransform * vtktransform = GetDataNode()->GetVtkTransform(timestep);
if(worldPlaneGeometry.IsNotNull())
{
// set up vtkPlane according to worldGeometry
point=worldPlaneGeometry->GetOrigin();
normal=worldPlaneGeometry->GetNormal(); normal.Normalize();
m_Plane->SetTransform((vtkAbstractTransform*)NULL);
}
else
{
AbstractTransformGeometry::ConstPointer worldAbstractGeometry = dynamic_cast<const AbstractTransformGeometry*>(renderer->GetCurrentWorldGeometry2D());
if(worldAbstractGeometry.IsNotNull())
{
AbstractTransformGeometry::ConstPointer surfaceAbstractGeometry = dynamic_cast<const AbstractTransformGeometry*>(input->GetTimeSlicedGeometry()->GetGeometry3D(0));
if(surfaceAbstractGeometry.IsNotNull()) //@todo substitude by operator== after implementation, see bug id 28
{
PaintCells(renderer, vtkpolydata, worldGeometry, renderer->GetDisplayGeometry(), vtktransform, lut);
return;
}
else
{
//@FIXME: does not work correctly. Does m_Plane->SetTransform really transforms a "flat plane" into a "curved plane"?
return;
// set up vtkPlane according to worldGeometry
point=const_cast<BoundingBox*>(worldAbstractGeometry->GetParametricBoundingBox())->GetMinimum();
FillVector3D(normal, 0, 0, 1);
m_Plane->SetTransform(worldAbstractGeometry->GetVtkAbstractTransform()->GetInverse());
}
}
else
return;
}
vtkFloatingPointType vp[3], vnormal[3];
vnl2vtk(point.Get_vnl_vector(), vp);
vnl2vtk(normal.Get_vnl_vector(), vnormal);
//normally, we would need to transform the surface and cut the transformed surface with the cutter.
//This might be quite slow. Thus, the idea is, to perform an inverse transform of the plane instead.
//@todo It probably does not work for scaling operations yet:scaling operations have to be
//dealed with after the cut is performed by scaling the contour.
vtkLinearTransform * inversetransform = vtktransform->GetLinearInverse();
inversetransform->TransformPoint(vp, vp);
inversetransform->TransformNormalAtPoint(vp, vnormal, vnormal);
m_Plane->SetOrigin(vp);
m_Plane->SetNormal(vnormal);
//set data into cutter
m_Cutter->SetInput(vtkpolydata);
m_Cutter->Update();
// m_Cutter->GenerateCutScalarsOff();
// m_Cutter->SetSortByToSortByCell();
if (m_DrawNormals)
{
m_Stripper->SetInput( m_Cutter->GetOutput() );
// calculate the cut
m_Stripper->Update();
PaintCells(renderer, m_Stripper->GetOutput(), worldGeometry, renderer->GetDisplayGeometry(), vtktransform, lut, vtkpolydata);
}
else
{
PaintCells(renderer, m_Cutter->GetOutput(), worldGeometry, renderer->GetDisplayGeometry(), vtktransform, lut, vtkpolydata);
}
}
}
void mitk::SurfaceGLMapper2D::PaintCells(mitk::BaseRenderer* renderer, vtkPolyData* contour,
const Geometry2D* worldGeometry,
const DisplayGeometry* displayGeometry,
vtkLinearTransform * vtktransform,
vtkLookupTable *lut,
vtkPolyData* original3DObject)
{
// deprecated settings
bool usePointData = false;
bool useCellData = false;
this->GetDataNode()->GetBoolProperty("deprecated useCellDataForColouring", useCellData);
bool scalarVisibility = false;
this->GetDataNode()->GetBoolProperty("scalar visibility", scalarVisibility);
if(scalarVisibility)
{
VtkScalarModeProperty* scalarMode;
if(this->GetDataNode()->GetProperty(scalarMode, "scalar mode", renderer))
{
if( (scalarMode->GetVtkScalarMode() == VTK_SCALAR_MODE_USE_POINT_DATA) ||
(scalarMode->GetVtkScalarMode() == VTK_SCALAR_MODE_DEFAULT) )
{
usePointData = true;
}
if(scalarMode->GetVtkScalarMode() == VTK_SCALAR_MODE_USE_CELL_DATA)
{
useCellData = true;
}
}
else
{
usePointData = true;
}
}
vtkPoints *vpoints = contour->GetPoints();
vtkDataArray *vpointscalars = contour->GetPointData()->GetScalars();
vtkCellArray *vlines = contour->GetLines();
vtkDataArray* vcellscalars = contour->GetCellData()->GetScalars();
Point3D p; Point2D p2d, last;
int i, j;
int numberOfLines = vlines->GetNumberOfCells();
glLineWidth( m_LineWidth );
glBegin (GL_LINES);
glColor4fv(m_LineColor);
double distanceSinceLastNormal(0.0);
vlines->InitTraversal();
for(i=0;i<numberOfLines;++i)
{
vtkIdType *cell(NULL);
vtkIdType cellSize(0);
vtkFloatingPointType vp[3];
vlines->GetNextCell(cellSize, cell);
vpoints->GetPoint(cell[0], vp);
//take transformation via vtktransform into account
vtktransform->TransformPoint(vp, vp);
vtk2itk(vp, p);
//convert 3D point (in mm) to 2D point on slice (also in mm)
worldGeometry->Map(p, p2d);
//convert point (until now mm and in world coordinates) to display coordinates (units )
displayGeometry->WorldToDisplay(p2d, p2d);
last=p2d;
for(j=1; j<cellSize; ++j)
{
vpoints->GetPoint(cell[j], vp);
Point3D originalPoint;
vtk2itk(vp, originalPoint);
//take transformation via vtktransform into account
vtktransform->TransformPoint(vp, vp);
vtk2itk(vp, p);
//convert 3D point (in mm) to 2D point on slice (also in mm)
worldGeometry->Map(p, p2d);
//convert point (until now mm and in world coordinates) to display coordinates (units )
displayGeometry->WorldToDisplay(p2d, p2d);
vtkFloatingPointType color[3];
if (useCellData && vcellscalars != NULL )
{
// color each cell according to cell data
lut->GetColor( vcellscalars->GetComponent(i,0),color);
glColor3f(color[0],color[1],color[2]);
glVertex2f(last[0], last[1]);
glVertex2f(p2d[0], p2d[1]);
}
else if (usePointData && vpointscalars != NULL )
{
lut->GetColor( vpointscalars->GetComponent(cell[j-1],0),color);
glColor3f(color[0],color[1],color[2]);
glVertex2f(last[0], last[1]);
lut->GetColor( vpointscalars->GetComponent(cell[j],0),color);
glColor3f(color[0],color[1],color[2]);
glVertex2f(p2d[0], p2d[1]);
}
else
{
glVertex2f(last[0], last[1]);
glVertex2f(p2d[0], p2d[1]);
// draw normals ?
if (m_DrawNormals && original3DObject)
{
distanceSinceLastNormal += sqrt((p2d[0]-last[0])*(p2d[0]-last[0]) + (p2d[1]-last[1])*(p2d[1]-last[1]));
if (distanceSinceLastNormal >= 5.0)
{
distanceSinceLastNormal = 0.0;
vtkPointData* pointData = original3DObject->GetPointData();
if (!pointData) break;
vtkDataArray* normalsArray = pointData->GetNormals();
if (!normalsArray) break;
// find 3D point closest to the currently drawn point
double distance(0.0);
vtkIdType closestPointId = m_PointLocator->FindClosestPoint(originalPoint[0], originalPoint[1], originalPoint[2], distance);
if (closestPointId >= 0)
{
// find normal of 3D object at this 3D point
double* normal = normalsArray->GetTuple3(closestPointId);
double transformedNormal[3];
vtktransform->TransformNormal(normal, transformedNormal);
Vector3D normalITK;
vtk2itk(transformedNormal, normalITK);
normalITK.Normalize();
// calculate a point (point from the cut 3D object) + (normal vector of closest point)
Point3D tip3D = p + normalITK;
// map this point into our 2D coordinate system
Point2D tip2D;
worldGeometry->Map(tip3D, tip2D);
displayGeometry->WorldToDisplay(tip2D, tip2D);
// calculate 2D vector from point to point+normal, normalize it to standard length
Vector2D tipVectorGLFront = tip2D - p2d;
tipVectorGLFront.Normalize();
tipVectorGLFront *= m_FrontNormalLengthInPixels;
Vector2D tipVectorGLBack = p2d - tip2D;
tipVectorGLBack.Normalize();
tipVectorGLBack *= m_BackNormalLengthInPixels;
Point2D tipPoint2D = p2d + tipVectorGLFront;
Point2D backTipPoint2D = p2d + tipVectorGLBack;
// draw normalized mapped normal vector
glColor4f(m_BackSideColor[0], m_BackSideColor[1], m_BackSideColor[2], m_BackSideColor[3]); // red backside
glVertex2f(p2d[0], p2d[1]);
glVertex2f(tipPoint2D[0], tipPoint2D[1]);
glColor4f(m_FrontSideColor[0], m_FrontSideColor[1], m_FrontSideColor[2], m_FrontSideColor[3]); // green backside
glVertex2f(p2d[0], p2d[1]);
glVertex2f(backTipPoint2D[0], backTipPoint2D[1]);
glColor4fv(m_LineColor); // back to line color
}
}
}
}
last=p2d;
}
}
glEnd();
glLineWidth(1.0);
}
void mitk::SurfaceGLMapper2D::SetDefaultProperties(mitk::DataNode* node, mitk::BaseRenderer* renderer, bool overwrite)
{
node->AddProperty( "line width", IntProperty::New(2), renderer, overwrite );
node->AddProperty( "scalar mode", VtkScalarModeProperty::New(), renderer, overwrite );
node->AddProperty( "draw normals 2D", BoolProperty::New(false), renderer, overwrite );
node->AddProperty( "invert normals", BoolProperty::New(false), renderer, overwrite );
node->AddProperty( "front color", ColorProperty::New(0.0, 1.0, 0.0), renderer, overwrite );
node->AddProperty( "back color", ColorProperty::New(1.0, 0.0, 0.0), renderer, overwrite );
node->AddProperty( "front normal lenth (px)", FloatProperty::New(10.0), renderer, overwrite );
node->AddProperty( "back normal lenth (px)", FloatProperty::New(10.0), renderer, overwrite );
node->AddProperty( "layer", mitk::IntProperty::New(100), renderer, overwrite);
Superclass::SetDefaultProperties(node, renderer, overwrite);
}
void mitk::SurfaceGLMapper2D::ApplyProperties(mitk::BaseRenderer* renderer)
{
Superclass::ApplyProperties(renderer);
GetDataNode()->GetBoolProperty("draw normals 2D", m_DrawNormals, renderer);
// check for color and opacity properties, use it for rendering if they exists
GetColor(m_LineColor, renderer /*, "color" */);
GetOpacity(m_LineColor[3], renderer /*, "color" */);
bool invertNormals(false);
if (DataNode* node = GetDataNode())
{
node->GetBoolProperty("invert normals", invertNormals, renderer);
}
if (!invertNormals)
{
GetColor(m_FrontSideColor, renderer, "front color");
GetOpacity(m_FrontSideColor[3], renderer);
GetColor(m_BackSideColor, renderer, "back color");
GetOpacity(m_BackSideColor[3], renderer);
if (DataNode* node = GetDataNode())
{
node->GetFloatProperty( "front normal lenth (px)", m_FrontNormalLengthInPixels, renderer );
node->GetFloatProperty( "back normal lenth (px)", m_BackNormalLengthInPixels, renderer );
}
}
else
{
GetColor(m_FrontSideColor, renderer, "back color");
GetOpacity(m_FrontSideColor[3], renderer);
GetColor(m_BackSideColor, renderer, "front color");
GetOpacity(m_BackSideColor[3], renderer);
if (DataNode* node = GetDataNode())
{
node->GetFloatProperty( "back normal lenth (px)", m_FrontNormalLengthInPixels, renderer );
node->GetFloatProperty( "front normal lenth (px)", m_BackNormalLengthInPixels, renderer );
}
}
}
diff --git a/Core/Code/Rendering/mitkSurfaceGLMapper2D.h b/Core/Code/Rendering/mitkSurfaceGLMapper2D.h
index 6553fc1723..435c92b807 100644
--- a/Core/Code/Rendering/mitkSurfaceGLMapper2D.h
+++ b/Core/Code/Rendering/mitkSurfaceGLMapper2D.h
@@ -1,156 +1,156 @@
/*=========================================================================
Program: Medical Imaging & Interaction Toolkit
Language: C++
Date: $Date$
Version: $Revision$
Copyright (c) German Cancer Research Center, Division of Medical and
Biological Informatics. All rights reserved.
See MITKCopyright.txt or http://www.mitk.org/copyright.html for details.
This software is distributed WITHOUT ANY WARRANTY; without even
the implied warranty of MERCHANTABILITY or FITNESS FOR A PARTICULAR
PURPOSE. See the above copyright notices for more information.
=========================================================================*/
#ifndef MITKSURFACEDATAMAPPER2D_H_HEADER_INCLUDED_C10EB2E8
#define MITKSURFACEDATAMAPPER2D_H_HEADER_INCLUDED_C10EB2E8
#include "mitkCommon.h"
#include "mitkGLMapper2D.h"
#include "mitkSurface.h"
class vtkCutter;
class vtkPlane;
class vtkLookupTable;
class vtkLinearTransform;
class vtkPKdTree;
class vtkStripper;
namespace mitk {
class BaseRenderer;
class Geometry2D;
class DisplayGeometry;
/**
* @brief OpenGL-based mapper to display a Surface in a 2D window.
*
* Displays a 2D cut through a Surface object (vtkPolyData). This
* is basically done in two steps:
*
* 1. Cut a slice out of a (input) vtkPolyData object. The slice may be a flat plane (PlaneGeometry)
* or a curved plane (ThinPlateSplineCurvedGeometry). The actual cutting is done by a vtkCutter.
* The result of cutting is a (3D) vtkPolyData object, which contains only points and lines
* describing the cut.
*
* 2. Paint the cut out slice by means of OpenGL. To do this, all lines of the cut object are traversed.
* For each line segment, both end points are transformed from 3D into the 2D system of the associated
* renderer and then drawn by OpenGL.
*
* There is a mode to display normals of the input surface object (see properties below). If this mode
* is on, then the drawing of the 2D cut is slightly more complicated. For each line segment of the cut,
* we take the end point (p2d) of this line and search the input vtkPolyData object for the closest point to p2d (p3D-input).
* We then read out the surface normal for p3D-input. We map this normal into our 2D coordinate system and
* then draw a line from p2d to (p2d+mapped normal). This drawing of surface normals will only work if the
* input vtkPolyData actually HAS normals. If you have a vtkPolyData without normals, use the vtkPolyDataNormals
* filter to generate normals.
*
* Properties that influence rendering are:
*
* - \b "color": (ColorProperty) Color of surface object
* - \b "line width": (IntProperty) Width in pixels of the lines drawn.
* - \b "scalar visibility": (BoolProperty) Whether point/cell data values (from vtkPolyData) should be used to influence colors
* - \b "scalar mode": (BoolProperty) If "scalar visibility" is on, whether to use point data or cell data for coloring.
* - \b "LookupTable": (LookupTableProperty) A lookup table to translate point/cell data values (from vtkPolyData) to colors
* - \b "ScalarsRangeMinimum": (FloatProperty) Range of the lookup table
* - \b "ScalarsRangeMaximum": (FloatProperty) Range of the lookup table
* - \b "draw normals 2D": (BoolProperty) If true, normals are drawn (if present in vtkPolyData)
* - \b "invert normals": (BoolProperty) Inverts front/back for display.
* - \b "front color": (ColorProperty) Color for normals display on front side of the plane
* - \b "front normal length (px)": (FloatProperty) Length of the front side normals in pixels.
* - \b "back color": (ColorProperty) Color for normals display on back side of the plane
* - \b "back normal length (px)": (FloatProperty) Length of the back side normals in pixels.
*
*/
class MITK_CORE_EXPORT SurfaceGLMapper2D : public GLMapper2D
{
public:
mitkClassMacro(SurfaceGLMapper2D, GLMapper2D);
itkNewMacro(Self);
const Surface* GetInput(void);
virtual void Paint(BaseRenderer* renderer);
/**
* @brief The Surface to map can be explicitly set by this method.
*
* If it is set, it is used instead of the data stored in the DataNode.
* This enables to use the mapper also internally from other mappers.
*/
itkSetConstObjectMacro(Surface, Surface);
/**
* @brief Get the Surface set explicitly.
*
* @return NULL is returned if no Surface is set to be used instead of DataNode::GetData().
* @sa SetSurface
*/
itkGetConstObjectMacro(Surface, Surface);
/**
*\brief Overwritten to initialize lookup table for point scalar data
*/
- void SetDataNode( DataNode::Pointer node );
+ void SetDataNode( DataNode* node );
/**
* \brief Generate OpenGL primitives for the VTK contour held in contour.
*/
void PaintCells(BaseRenderer* renderer, vtkPolyData* contour,
const Geometry2D* worldGeometry,
const DisplayGeometry* displayGeometry,
vtkLinearTransform* vtktransform,
vtkLookupTable* lut = NULL,
vtkPolyData* original3DObject = NULL);
static void SetDefaultProperties(DataNode* node, BaseRenderer* renderer = NULL, bool overwrite = false);
virtual void ApplyProperties(BaseRenderer* renderer);
protected:
SurfaceGLMapper2D();
virtual ~SurfaceGLMapper2D();
vtkPlane* m_Plane;
vtkCutter* m_Cutter;
Surface::ConstPointer m_Surface;
vtkLookupTable* m_LUT;
int m_LineWidth;
vtkPKdTree* m_PointLocator;
vtkStripper* m_Stripper;
bool m_DrawNormals;
float m_FrontSideColor[4];
float m_BackSideColor[4];
float m_LineColor[4];
float m_FrontNormalLengthInPixels;
float m_BackNormalLengthInPixels;
};
} // namespace mitk
#endif /* MITKSURFACEDATAMAPPER2D_H_HEADER_INCLUDED_C10EB2E8 */
diff --git a/Core/Code/Rendering/mitkSurfaceVtkMapper3D.cpp b/Core/Code/Rendering/mitkSurfaceVtkMapper3D.cpp
index 5bea4a7510..9d652e843c 100644
--- a/Core/Code/Rendering/mitkSurfaceVtkMapper3D.cpp
+++ b/Core/Code/Rendering/mitkSurfaceVtkMapper3D.cpp
@@ -1,456 +1,456 @@
/*=========================================================================
Program: Medical Imaging & Interaction Toolkit
Language: C++
Date: $Date$
Version: $Revision$
Copyright (c) German Cancer Research Center, Division of Medical and
Biological Informatics. All rights reserved.
See MITKCopyright.txt or http://www.mitk.org/copyright.html for details.
This software is distributed WITHOUT ANY WARRANTY; without even
the implied warranty of MERCHANTABILITY or FITNESS FOR A PARTICULAR
PURPOSE. See the above copyright notices for more information.
=========================================================================*/
#include "mitkSurfaceVtkMapper3D.h"
#include "mitkDataNode.h"
#include "mitkProperties.h"
#include "mitkColorProperty.h"
#include "mitkLookupTableProperty.h"
#include "mitkVtkRepresentationProperty.h"
#include "mitkVtkInterpolationProperty.h"
#include "mitkVtkScalarModeProperty.h"
#include "mitkClippingProperty.h"
#include "mitkShaderProperty.h"
#include "mitkShaderRepository.h"
#include <vtkActor.h>
#include <vtkProperty.h>
#include <vtkPolyData.h>
#include <vtkPolyDataMapper.h>
#include <vtkPolyDataNormals.h>
#include <vtkPointData.h>
#include <vtkPlaneCollection.h>
const mitk::Surface* mitk::SurfaceVtkMapper3D::GetInput()
{
return static_cast<const mitk::Surface * > ( GetData() );
}
mitk::SurfaceVtkMapper3D::SurfaceVtkMapper3D()
{
// m_Prop3D = vtkActor::New();
m_GenerateNormals = false;
}
mitk::SurfaceVtkMapper3D::~SurfaceVtkMapper3D()
{
// m_Prop3D->Delete();
}
-void mitk::SurfaceVtkMapper3D::GenerateData(mitk::BaseRenderer* renderer)
+void mitk::SurfaceVtkMapper3D::GenerateDataForRenderer(mitk::BaseRenderer* renderer)
{
LocalStorage *ls = m_LSH.GetLocalStorage(renderer);
bool visible = IsVisible(renderer);
if(visible==false)
{
ls->m_Actor->VisibilityOff();
return;
}
//
// set the input-object at time t for the mapper
//
mitk::Surface::Pointer input = const_cast< mitk::Surface* >( this->GetInput() );
vtkPolyData * polydata = input->GetVtkPolyData( this->GetTimestep() );
if(polydata == NULL)
{
ls->m_Actor->VisibilityOff();
return;
}
if ( m_GenerateNormals )
{
ls->m_VtkPolyDataNormals->SetInput( polydata );
ls->m_VtkPolyDataMapper->SetInput( ls->m_VtkPolyDataNormals->GetOutput() );
}
else
{
ls->m_VtkPolyDataMapper->SetInput( polydata );
}
//
// apply properties read from the PropertyList
//
ApplyProperties(ls->m_Actor, renderer);
if(visible)
ls->m_Actor->VisibilityOn();
}
void mitk::SurfaceVtkMapper3D::ResetMapper( BaseRenderer* renderer )
{
LocalStorage *ls = m_LSH.GetLocalStorage(renderer);
ls->m_Actor->VisibilityOff();
}
void mitk::SurfaceVtkMapper3D::ApplyMitkPropertiesToVtkProperty(mitk::DataNode *node, vtkProperty* property, mitk::BaseRenderer* renderer)
{
// Colors
{
double ambient [3] = { 0.5,0.5,0.0 };
double diffuse [3] = { 0.5,0.5,0.0 };
double specular[3] = { 1.0,1.0,1.0 };
float coeff_ambient = 0.5f;
float coeff_diffuse = 0.5f;
float coeff_specular= 0.5f;
float power_specular=10.0f;
// Color
{
mitk::ColorProperty::Pointer p;
node->GetProperty(p, "color", renderer);
if(p.IsNotNull())
{
mitk::Color c = p->GetColor();
ambient[0]=c.GetRed(); ambient[1]=c.GetGreen(); ambient[2]=c.GetBlue();
diffuse[0]=c.GetRed(); diffuse[1]=c.GetGreen(); diffuse[2]=c.GetBlue();
// Setting specular color to the same, make physically no real sense, however vtk rendering slows down, if these colors are different.
specular[0]=c.GetRed(); specular[1]=c.GetGreen(); specular[2]=c.GetBlue();
}
}
// Ambient
{
mitk::ColorProperty::Pointer p;
node->GetProperty(p, "material.ambientColor", renderer);
if(p.IsNotNull())
{
mitk::Color c = p->GetColor();
ambient[0]=c.GetRed(); ambient[1]=c.GetGreen(); ambient[2]=c.GetBlue();
}
}
// Diffuse
{
mitk::ColorProperty::Pointer p;
node->GetProperty(p, "material.diffuseColor", renderer);
if(p.IsNotNull())
{
mitk::Color c = p->GetColor();
diffuse[0]=c.GetRed(); diffuse[1]=c.GetGreen(); diffuse[2]=c.GetBlue();
}
}
// Specular
{
mitk::ColorProperty::Pointer p;
node->GetProperty(p, "material.specularColor", renderer);
if(p.IsNotNull())
{
mitk::Color c = p->GetColor();
specular[0]=c.GetRed(); specular[1]=c.GetGreen(); specular[2]=c.GetBlue();
}
}
// Ambient coeff
{
node->GetFloatProperty("material.ambientCoefficient", coeff_ambient, renderer);
}
// Diffuse coeff
{
node->GetFloatProperty("material.diffuseCoefficient", coeff_diffuse, renderer);
}
// Specular coeff
{
node->GetFloatProperty("material.specularCoefficient", coeff_specular, renderer);
}
// Specular power
{
node->GetFloatProperty("material.specularPower", power_specular, renderer);
}
property->SetAmbient( coeff_ambient );
property->SetDiffuse( coeff_diffuse );
property->SetSpecular( coeff_specular );
property->SetSpecularPower( power_specular );
property->SetAmbientColor( ambient );
property->SetDiffuseColor( diffuse );
property->SetSpecularColor( specular );
}
// Render mode
{
// Opacity
{
float opacity = 1.0f;
if( node->GetOpacity(opacity,renderer) )
property->SetOpacity( opacity );
}
// Wireframe line width
{
float lineWidth = 1;
node->GetFloatProperty("material.wireframeLineWidth", lineWidth, renderer);
property->SetLineWidth( lineWidth );
}
// Representation
{
mitk::VtkRepresentationProperty::Pointer p;
node->GetProperty(p, "material.representation", renderer);
if(p.IsNotNull())
property->SetRepresentation( p->GetVtkRepresentation() );
}
// Interpolation
{
mitk::VtkInterpolationProperty::Pointer p;
node->GetProperty(p, "material.interpolation", renderer);
if(p.IsNotNull())
property->SetInterpolation( p->GetVtkInterpolation() );
}
}
}
void mitk::SurfaceVtkMapper3D::ApplyProperties(vtkActor* /*actor*/, mitk::BaseRenderer* renderer)
{
LocalStorage *ls = m_LSH.GetLocalStorage(renderer);
// Applying shading properties
{
Superclass::ApplyProperties( ls->m_Actor, renderer ) ;
// VTK Properties
ApplyMitkPropertiesToVtkProperty( this->GetDataNode(), ls->m_Actor->GetProperty(), renderer );
// Shaders
mitk::ShaderRepository::GetGlobalShaderRepository()->ApplyProperties(this->GetDataNode(),ls->m_Actor,renderer,ls->m_ShaderTimestampUpdate);
}
mitk::LookupTableProperty::Pointer lookupTableProp;
this->GetDataNode()->GetProperty(lookupTableProp, "LookupTable", renderer);
if (lookupTableProp.IsNotNull() )
{
ls->m_VtkPolyDataMapper->SetLookupTable(lookupTableProp->GetLookupTable()->GetVtkLookupTable());
}
mitk::LevelWindow levelWindow;
if(this->GetDataNode()->GetLevelWindow(levelWindow, renderer, "levelWindow"))
{
ls->m_VtkPolyDataMapper->SetScalarRange(levelWindow.GetLowerWindowBound(),levelWindow.GetUpperWindowBound());
}
else
if(this->GetDataNode()->GetLevelWindow(levelWindow, renderer))
{
ls->m_VtkPolyDataMapper->SetScalarRange(levelWindow.GetLowerWindowBound(),levelWindow.GetUpperWindowBound());
}
bool scalarVisibility = false;
this->GetDataNode()->GetBoolProperty("scalar visibility", scalarVisibility);
ls->m_VtkPolyDataMapper->SetScalarVisibility( (scalarVisibility ? 1 : 0) );
if(scalarVisibility)
{
mitk::VtkScalarModeProperty* scalarMode;
if(this->GetDataNode()->GetProperty(scalarMode, "scalar mode", renderer))
{
ls->m_VtkPolyDataMapper->SetScalarMode(scalarMode->GetVtkScalarMode());
}
else
ls->m_VtkPolyDataMapper->SetScalarModeToDefault();
bool colorMode = false;
this->GetDataNode()->GetBoolProperty("color mode", colorMode);
ls->m_VtkPolyDataMapper->SetColorMode( (colorMode ? 1 : 0) );
float scalarsMin = 0;
if (dynamic_cast<mitk::FloatProperty *>(this->GetDataNode()->GetProperty("ScalarsRangeMinimum")) != NULL)
scalarsMin = dynamic_cast<mitk::FloatProperty*>(this->GetDataNode()->GetProperty("ScalarsRangeMinimum"))->GetValue();
float scalarsMax = 1.0;
if (dynamic_cast<mitk::FloatProperty *>(this->GetDataNode()->GetProperty("ScalarsRangeMaximum")) != NULL)
scalarsMax = dynamic_cast<mitk::FloatProperty*>(this->GetDataNode()->GetProperty("ScalarsRangeMaximum"))->GetValue();
ls->m_VtkPolyDataMapper->SetScalarRange(scalarsMin,scalarsMax);
}
// deprecated settings
bool deprecatedUseCellData = false;
this->GetDataNode()->GetBoolProperty("deprecated useCellDataForColouring", deprecatedUseCellData);
bool deprecatedUsePointData = false;
this->GetDataNode()->GetBoolProperty("deprecated usePointDataForColouring", deprecatedUsePointData);
if (deprecatedUseCellData)
{
ls->m_VtkPolyDataMapper->SetColorModeToDefault();
ls->m_VtkPolyDataMapper->SetScalarRange(0,255);
ls->m_VtkPolyDataMapper->ScalarVisibilityOn();
ls->m_VtkPolyDataMapper->SetScalarModeToUseCellData();
ls->m_Actor->GetProperty()->SetSpecular (1);
ls->m_Actor->GetProperty()->SetSpecularPower (50);
ls->m_Actor->GetProperty()->SetInterpolationToPhong();
}
else if (deprecatedUsePointData)
{
float scalarsMin = 0;
if (dynamic_cast<mitk::FloatProperty *>(this->GetDataNode()->GetProperty("ScalarsRangeMinimum")) != NULL)
scalarsMin = dynamic_cast<mitk::FloatProperty*>(this->GetDataNode()->GetProperty("ScalarsRangeMinimum"))->GetValue();
float scalarsMax = 0.1;
if (dynamic_cast<mitk::FloatProperty *>(this->GetDataNode()->GetProperty("ScalarsRangeMaximum")) != NULL)
scalarsMax = dynamic_cast<mitk::FloatProperty*>(this->GetDataNode()->GetProperty("ScalarsRangeMaximum"))->GetValue();
ls->m_VtkPolyDataMapper->SetScalarRange(scalarsMin,scalarsMax);
ls->m_VtkPolyDataMapper->SetColorModeToMapScalars();
ls->m_VtkPolyDataMapper->ScalarVisibilityOn();
ls->m_Actor->GetProperty()->SetSpecular (1);
ls->m_Actor->GetProperty()->SetSpecularPower (50);
ls->m_Actor->GetProperty()->SetInterpolationToPhong();
}
int deprecatedScalarMode = VTK_COLOR_MODE_DEFAULT;
if(this->GetDataNode()->GetIntProperty("deprecated scalar mode", deprecatedScalarMode, renderer))
{
ls->m_VtkPolyDataMapper->SetScalarMode(deprecatedScalarMode);
ls->m_VtkPolyDataMapper->ScalarVisibilityOn();
ls->m_Actor->GetProperty()->SetSpecular (1);
ls->m_Actor->GetProperty()->SetSpecularPower (50);
//m_Actor->GetProperty()->SetInterpolationToPhong();
}
// Check whether one or more ClippingProperty objects have been defined for
// this node. Check both renderer specific and global property lists, since
// properties in both should be considered.
const PropertyList::PropertyMap *rendererProperties = this->GetDataNode()->GetPropertyList( renderer )->GetMap();
const PropertyList::PropertyMap *globalProperties = this->GetDataNode()->GetPropertyList( NULL )->GetMap();
// Add clipping planes (if any)
ls->m_ClippingPlaneCollection->RemoveAllItems();
PropertyList::PropertyMap::const_iterator it;
for ( it = rendererProperties->begin(); it != rendererProperties->end(); ++it )
{
- this->CheckForClippingProperty( renderer,(*it).second.first.GetPointer() );
+ this->CheckForClippingProperty( renderer,(*it).second.GetPointer() );
}
for ( it = globalProperties->begin(); it != globalProperties->end(); ++it )
{
- this->CheckForClippingProperty( renderer,(*it).second.first.GetPointer() );
+ this->CheckForClippingProperty( renderer,(*it).second.GetPointer() );
}
if ( ls->m_ClippingPlaneCollection->GetNumberOfItems() > 0 )
{
ls->m_VtkPolyDataMapper->SetClippingPlanes( ls->m_ClippingPlaneCollection );
}
else
{
ls->m_VtkPolyDataMapper->RemoveAllClippingPlanes();
}
}
vtkProp *mitk::SurfaceVtkMapper3D::GetVtkProp(mitk::BaseRenderer *renderer)
{
LocalStorage *ls = m_LSH.GetLocalStorage(renderer);
return ls->m_Actor;
}
void mitk::SurfaceVtkMapper3D::CheckForClippingProperty( mitk::BaseRenderer* renderer, mitk::BaseProperty *property )
{
LocalStorage *ls = m_LSH.GetLocalStorage(renderer);
// m_Prop3D = ls->m_Actor;
ClippingProperty *clippingProperty = dynamic_cast< ClippingProperty * >( property );
if ( (clippingProperty != NULL)
&& (clippingProperty->GetClippingEnabled()) )
{
const Point3D &origin = clippingProperty->GetOrigin();
const Vector3D &normal = clippingProperty->GetNormal();
vtkPlane *clippingPlane = vtkPlane::New();
clippingPlane->SetOrigin( origin[0], origin[1], origin[2] );
clippingPlane->SetNormal( normal[0], normal[1], normal[2] );
ls->m_ClippingPlaneCollection->AddItem( clippingPlane );
clippingPlane->UnRegister( NULL );
}
}
void mitk::SurfaceVtkMapper3D::SetDefaultPropertiesForVtkProperty(mitk::DataNode* node, mitk::BaseRenderer* renderer, bool overwrite)
{
// Shading
{
node->AddProperty( "material.wireframeLineWidth", mitk::FloatProperty::New(1.0f) , renderer, overwrite );
node->AddProperty( "material.ambientCoefficient" , mitk::FloatProperty::New(0.05f) , renderer, overwrite );
node->AddProperty( "material.diffuseCoefficient" , mitk::FloatProperty::New(0.9f) , renderer, overwrite );
node->AddProperty( "material.specularCoefficient", mitk::FloatProperty::New(1.0f) , renderer, overwrite );
node->AddProperty( "material.specularPower" , mitk::FloatProperty::New(16.0f) , renderer, overwrite );
//node->AddProperty( "material.ambientColor" , mitk::ColorProperty::New(1.0f,1.0f,1.0f), renderer, overwrite );
//node->AddProperty( "material.diffuseColor" , mitk::ColorProperty::New(1.0f,1.0f,1.0f), renderer, overwrite );
//node->AddProperty( "material.specularColor" , mitk::ColorProperty::New(1.0f,1.0f,1.0f), renderer, overwrite );
node->AddProperty( "material.representation" , mitk::VtkRepresentationProperty::New() , renderer, overwrite );
node->AddProperty( "material.interpolation" , mitk::VtkInterpolationProperty::New() , renderer, overwrite );
}
// Shaders
{
mitk::ShaderRepository::GetGlobalShaderRepository()->AddDefaultProperties(node,renderer,overwrite);
}
}
void mitk::SurfaceVtkMapper3D::SetDefaultProperties(mitk::DataNode* node, mitk::BaseRenderer* renderer, bool overwrite)
{
node->AddProperty( "color", mitk::ColorProperty::New(1.0f,1.0f,1.0f), renderer, overwrite );
node->AddProperty( "opacity", mitk::FloatProperty::New(1.0), renderer, overwrite );
mitk::SurfaceVtkMapper3D::SetDefaultPropertiesForVtkProperty(node,renderer,overwrite); // Shading
node->AddProperty( "scalar visibility", mitk::BoolProperty::New(false), renderer, overwrite );
node->AddProperty( "color mode", mitk::BoolProperty::New(false), renderer, overwrite );
node->AddProperty( "scalar mode", mitk::VtkScalarModeProperty::New(), renderer, overwrite );
mitk::Surface::Pointer surface = dynamic_cast<Surface*>(node->GetData());
if(surface.IsNotNull())
{
if((surface->GetVtkPolyData() != 0) && (surface->GetVtkPolyData()->GetPointData() != NULL) && (surface->GetVtkPolyData()->GetPointData()->GetScalars() != 0))
{
node->AddProperty( "scalar visibility", mitk::BoolProperty::New(true), renderer, overwrite );
node->AddProperty( "color mode", mitk::BoolProperty::New(true), renderer, overwrite );
}
}
Superclass::SetDefaultProperties(node, renderer, overwrite);
}
void mitk::SurfaceVtkMapper3D::SetImmediateModeRenderingOn(int /*on*/)
{
/*
if (m_VtkPolyDataMapper != NULL)
m_VtkPolyDataMapper->SetImmediateModeRendering(on);
*/
}
diff --git a/Core/Code/Rendering/mitkSurfaceVtkMapper3D.h b/Core/Code/Rendering/mitkSurfaceVtkMapper3D.h
index 70c7f57fea..6cc22e20f7 100644
--- a/Core/Code/Rendering/mitkSurfaceVtkMapper3D.h
+++ b/Core/Code/Rendering/mitkSurfaceVtkMapper3D.h
@@ -1,162 +1,162 @@
/*=========================================================================
Program: Medical Imaging & Interaction Toolkit
Language: C++
Date: $Date$
Version: $Revision$
Copyright (c) German Cancer Research Center, Division of Medical and
Biological Informatics. All rights reserved.
See MITKCopyright.txt or http://www.mitk.org/copyright.html for details.
This software is distributed WITHOUT ANY WARRANTY; without even
the implied warranty of MERCHANTABILITY or FITNESS FOR A PARTICULAR
PURPOSE. See the above copyright notices for more information.
=========================================================================*/
#ifndef MITKSURFACEDATAVTKMAPPER3D_H_HEADER_INCLUDED_C1907273
#define MITKSURFACEDATAVTKMAPPER3D_H_HEADER_INCLUDED_C1907273
#include "mitkCommon.h"
#include "mitkVtkMapper3D.h"
#include "mitkSurface.h"
#include "mitkBaseRenderer.h"
#include <vtkActor.h>
#include <vtkOpenGLPolyDataMapper.h>
#include <vtkPainterPolyDataMapper.h>
#include <vtkPolyDataMapper.h>
#include <vtkPolyDataNormals.h>
#include <vtkPlaneCollection.h>
namespace mitk {
//##Documentation
//## @brief Vtk-based mapper for Surface
//##
//## @ingroup Mapper
/**
* @brief Vtk-based mapper for Surface
*
* Properties that can be set for surfaces and influence the surfaceVTKMapper3D are:
*
* - \b "color": (ColorProperty) Diffuse color of the surface object (this property will be read when material.diffuseColor is not defined)
* - \b "Opacity": (FloatProperty) Opacity of the surface object
* - \b "material.ambientColor": (ColorProperty) Ambient color of the surface object
* - \b "material.ambientCoefficient": ( FloatProperty) Ambient coefficient of the surface object
* - \b "material.diffuseColor": ( ColorProperty) Diffuse color of the surface object
* - \b "material.diffuseCoefficient": (FloatProperty) Diffuse coefficient of the surface object
* - \b "material.specularColor": (ColorProperty) Specular Color of the surface object
* - \b "material.specularCoefficient": (FloatProperty) Specular coefficient of the surface object
* - \b "material.specularPower": (FloatProperty) Specular power of the surface object
* - \b "material.interpolation": (VtkInterpolationProperty) Interpolation
* - \b "material.representation": (VtkRepresentationProperty*) Representation
* - \b "material.wireframeLineWidth": (FloatProperty) Width in pixels of the lines drawn.
* - \b "scalar visibility": (BoolProperty) If the scarlars of the surface are visible
* Properties to look for are:
*
* - \b "scalar visibility": if set to on, scalars assigned to the data are shown
* Turn this on if using a lookup table.
* - \b "ScalarsRangeMinimum": Optional. Can be used to store the scalar min, e.g.
* for the level window settings.
* - \b "ScalarsRangeMaximum": Optional. See above.
*
* There might be still some other, deprecated properties. These will not be documented anymore.
* Please check the source if you really need them.
*
* @ingroup Mapper
*/
class MITK_CORE_EXPORT SurfaceVtkMapper3D : public VtkMapper3D
{
public:
mitkClassMacro(SurfaceVtkMapper3D, VtkMapper3D);
itkNewMacro(Self);
itkSetMacro(GenerateNormals, bool);
itkGetMacro(GenerateNormals, bool);
//enable ImmediateModeRendering for vtkMapping
//yet to solve bug 1398
void SetImmediateModeRenderingOn(int on = 1);
itkGetMacro(ImmediateModeRenderingOn, int);
virtual const mitk::Surface* GetInput();
virtual vtkProp *GetVtkProp(mitk::BaseRenderer *renderer);
virtual void ApplyProperties(vtkActor* actor, mitk::BaseRenderer* renderer);
static void SetDefaultProperties(mitk::DataNode* node, mitk::BaseRenderer* renderer = NULL, bool overwrite = false);
protected:
SurfaceVtkMapper3D();
virtual ~SurfaceVtkMapper3D();
- virtual void GenerateData(mitk::BaseRenderer* renderer);
+ virtual void GenerateDataForRenderer(mitk::BaseRenderer* renderer);
virtual void ResetMapper( mitk::BaseRenderer* renderer );
/** Checks whether the specified property is a ClippingProperty and if yes,
* adds it to m_ClippingPlaneCollection (internal method). */
virtual void CheckForClippingProperty( mitk::BaseRenderer* renderer, mitk::BaseProperty *property );
bool m_GenerateNormals;
//enable ImmediateModeRendering for the vtkMapper
int m_ImmediateModeRenderingOn;
public:
class LocalStorage : public mitk::Mapper::BaseLocalStorage
{
public:
vtkActor* m_Actor;
vtkPolyDataMapper *m_VtkPolyDataMapper;
vtkPolyDataNormals *m_VtkPolyDataNormals;
vtkPlaneCollection *m_ClippingPlaneCollection;
itk::TimeStamp m_ShaderTimestampUpdate;
LocalStorage()
{
m_VtkPolyDataMapper = vtkOpenGLPolyDataMapper::New();
m_VtkPolyDataNormals = vtkPolyDataNormals::New();
m_Actor = vtkActor::New();
m_ClippingPlaneCollection = vtkPlaneCollection::New();
m_Actor->SetMapper(m_VtkPolyDataMapper);
}
~LocalStorage()
{
m_VtkPolyDataMapper->Delete();
m_VtkPolyDataNormals->Delete();
m_Actor->Delete();
m_ClippingPlaneCollection->Delete();
}
};
mitk::Mapper::LocalStorageHandler<LocalStorage> m_LSH;
static void ApplyMitkPropertiesToVtkProperty(mitk::DataNode *node, vtkProperty* property, mitk::BaseRenderer* renderer);
static void SetDefaultPropertiesForVtkProperty(mitk::DataNode* node, mitk::BaseRenderer* renderer, bool overwrite);
};
} // namespace mitk
#endif /* MITKSURFACEDATAVTKMAPPER3D_H_HEADER_INCLUDED_C1907273 */
diff --git a/Core/Code/Rendering/mitkVolumeDataVtkMapper3D.cpp b/Core/Code/Rendering/mitkVolumeDataVtkMapper3D.cpp
index 2e6ddb937f..b1fce0c004 100644
--- a/Core/Code/Rendering/mitkVolumeDataVtkMapper3D.cpp
+++ b/Core/Code/Rendering/mitkVolumeDataVtkMapper3D.cpp
@@ -1,706 +1,706 @@
/*=========================================================================
Program: Medical Imaging & Interaction Toolkit
Language: C++
Date: $Date$
Version: $Revision$
Copyright (c) German Cancer Research Center, Division of Medical and
Biological Informatics. All rights reserved.
See MITKCopyright.txt or http://www.mitk.org/copyright.html for details.
This software is distributed WITHOUT ANY WARRANTY; without even
the implied warranty of MERCHANTABILITY or FITNESS FOR A PARTICULAR
PURPOSE. See the above copyright notices for more information.
=========================================================================*/
#include "mitkVolumeDataVtkMapper3D.h"
#include "mitkDataNode.h"
#include "mitkProperties.h"
#include "mitkLevelWindow.h"
#include "mitkColorProperty.h"
#include "mitkLevelWindowProperty.h"
#include "mitkLookupTableProperty.h"
#include "mitkTransferFunctionProperty.h"
#include "mitkTransferFunctionInitializer.h"
#include "mitkColorProperty.h"
#include "mitkVtkPropRenderer.h"
#include "mitkRenderingManager.h"
#include <vtkActor.h>
#include <vtkProperty.h>
#include <vtkVolumeRayCastMapper.h>
#include <vtkVolumeTextureMapper2D.h>
#include <vtkVolume.h>
#include <vtkVolumeProperty.h>
#include <vtkColorTransferFunction.h>
#include <vtkPiecewiseFunction.h>
#include <vtkVolumeRayCastCompositeFunction.h>
#include <vtkVolumeRayCastMIPFunction.h>
#include <vtkFiniteDifferenceGradientEstimator.h>
#include <vtkRenderWindow.h>
#include <vtkRenderWindowInteractor.h>
#include <vtkImageShiftScale.h>
#include <vtkImageChangeInformation.h>
#include <vtkImageWriter.h>
#include <vtkImageData.h>
#include <vtkLODProp3D.h>
#include <vtkImageResample.h>
#include <vtkPlane.h>
#include <vtkImplicitPlaneWidget.h>
#include <vtkAssembly.h>
#include <vtkCubeSource.h>
#include <vtkPolyDataMapper.h>
#include "mitkVtkVolumeRenderingProperty.h"
#include <itkMultiThreader.h>
const mitk::Image* mitk::VolumeDataVtkMapper3D::GetInput()
{
return static_cast<const mitk::Image*> ( GetData() );
}
mitk::VolumeDataVtkMapper3D::VolumeDataVtkMapper3D()
: m_Mask( NULL )
{
m_PlaneSet = false;
m_ClippingPlane = vtkPlane::New();
m_PlaneWidget = vtkImplicitPlaneWidget::New();
/*
m_T2DMapper = vtkVolumeTextureMapper2D::New();
m_T2DMapper->SetMaximumNumberOfPlanes( 100 );
*/
m_HiResMapper = vtkVolumeRayCastMapper::New();
m_HiResMapper->SetSampleDistance(1.0); // 4 rays for every pixel
m_HiResMapper->IntermixIntersectingGeometryOn();
m_HiResMapper->SetNumberOfThreads( itk::MultiThreader::GetGlobalDefaultNumberOfThreads() );
/*
vtkVolumeRayCastCompositeFunction* compositeFunction = vtkVolumeRayCastCompositeFunction::New();
compositeFunction->SetCompositeMethodToClassifyFirst();
m_HiResMapper->SetVolumeRayCastFunction(compositeFunction);
compositeFunction->Delete();
vtkVolumeRayCastMIPFunction* mipFunction = vtkVolumeRayCastMIPFunction::New();
m_HiResMapper->SetVolumeRayCastFunction(mipFunction);
mipFunction->Delete();
*/
vtkFiniteDifferenceGradientEstimator* gradientEstimator =
vtkFiniteDifferenceGradientEstimator::New();
m_HiResMapper->SetGradientEstimator(gradientEstimator);
gradientEstimator->Delete();
m_VolumePropertyLow = vtkVolumeProperty::New();
m_VolumePropertyMed = vtkVolumeProperty::New();
m_VolumePropertyHigh = vtkVolumeProperty::New();
m_VolumeLOD = vtkLODProp3D::New();
m_VolumeLOD->VisibilityOff();
m_HiResID = m_VolumeLOD->AddLOD(m_HiResMapper,m_VolumePropertyHigh,0.0); // RayCast
// m_LowResID = m_VolumeLOD->AddLOD(m_T2DMapper,m_VolumePropertyLow,0.0); // TextureMapper2D
m_MedResID = m_VolumeLOD->AddLOD(m_HiResMapper,m_VolumePropertyMed,0.0); // RayCast
m_Resampler = vtkImageResample::New();
m_Resampler->SetAxisMagnificationFactor(0,0.25);
m_Resampler->SetAxisMagnificationFactor(1,0.25);
m_Resampler->SetAxisMagnificationFactor(2,0.25);
// For abort rendering mechanism
m_VolumeLOD->AutomaticLODSelectionOff();
m_BoundingBox = vtkCubeSource::New();
m_BoundingBox->SetXLength( 0.0 );
m_BoundingBox->SetYLength( 0.0 );
m_BoundingBox->SetZLength( 0.0 );
m_BoundingBoxMapper = vtkPolyDataMapper::New();
m_BoundingBoxMapper->SetInput( m_BoundingBox->GetOutput() );
m_BoundingBoxActor = vtkActor::New();
m_BoundingBoxActor->SetMapper( m_BoundingBoxMapper );
m_BoundingBoxActor->GetProperty()->SetColor( 1.0, 1.0, 1.0 );
m_BoundingBoxActor->GetProperty()->SetRepresentationToWireframe();
// BoundingBox rendering is not working due to problem with assembly
// transformation; see bug #454
// If commenting in the following, do not forget to comment in the
// m_Prop3DAssembly->Delete() line in the destructor.
//m_Prop3DAssembly = vtkAssembly::New();
//m_Prop3DAssembly->AddPart( m_VolumeLOD );
//m_Prop3DAssembly->AddPart( m_BoundingBoxActor );
//m_Prop3D = m_Prop3DAssembly;
m_ImageCast = vtkImageShiftScale::New();
m_ImageCast->SetOutputScalarTypeToUnsignedShort();
m_ImageCast->ClampOverflowOn();
m_UnitSpacingImageFilter = vtkImageChangeInformation::New();
m_UnitSpacingImageFilter->SetInput(m_ImageCast->GetOutput());
m_UnitSpacingImageFilter->SetOutputSpacing( 1.0, 1.0, 1.0 );
m_ImageMaskFilter = vtkImageMask::New();
m_ImageMaskFilter->SetMaskedOutputValue(0xffff);
this->m_Resampler->SetInput( this->m_UnitSpacingImageFilter->GetOutput() );
this->m_HiResMapper->SetInput( this->m_UnitSpacingImageFilter->GetOutput() );
// m_T2DMapper->SetInput(m_Resampler->GetOutput());
this->CreateDefaultTransferFunctions();
}
vtkProp *mitk::VolumeDataVtkMapper3D::GetVtkProp(mitk::BaseRenderer * /*renderer*/)
{
return m_VolumeLOD;
}
mitk::VolumeDataVtkMapper3D::~VolumeDataVtkMapper3D()
{
m_UnitSpacingImageFilter->Delete();
m_ImageCast->Delete();
// m_T2DMapper->Delete();
m_HiResMapper->Delete();
m_Resampler->Delete();
m_VolumePropertyLow->Delete();
m_VolumePropertyMed->Delete();
m_VolumePropertyHigh->Delete();
m_VolumeLOD->Delete();
m_ClippingPlane->Delete();
m_PlaneWidget->Delete();
// m_Prop3DAssembly->Delete();
m_BoundingBox->Delete();
m_BoundingBoxMapper->Delete();
m_BoundingBoxActor->Delete();
m_ImageMaskFilter->Delete();
m_DefaultColorTransferFunction->Delete();
m_DefaultOpacityTransferFunction->Delete();
m_DefaultGradientTransferFunction->Delete();
if (m_Mask)
{
m_Mask->Delete();
}
}
-void mitk::VolumeDataVtkMapper3D::GenerateData( mitk::BaseRenderer *renderer )
+void mitk::VolumeDataVtkMapper3D::GenerateDataForRenderer( mitk::BaseRenderer *renderer )
{
SetVtkMapperImmediateModeRendering(m_BoundingBoxMapper);
mitk::Image *input = const_cast< mitk::Image * >( this->GetInput() );
if ( !input || !input->IsInitialized() )
return;
vtkRenderWindow* renderWindow = renderer->GetRenderWindow();
bool volumeRenderingEnabled = true;
if (this->IsVisible(renderer)==false ||
this->GetDataNode() == NULL ||
dynamic_cast<mitk::BoolProperty*>(GetDataNode()->GetProperty("volumerendering",renderer))==NULL ||
dynamic_cast<mitk::BoolProperty*>(GetDataNode()->GetProperty("volumerendering",renderer))->GetValue() == false
)
{
volumeRenderingEnabled = false;
// Check if a bounding box should be displayed around the dataset
// (even if volume rendering is disabled)
bool hasBoundingBox = false;
this->GetDataNode()->GetBoolProperty( "bounding box", hasBoundingBox );
if ( !hasBoundingBox )
{
m_BoundingBoxActor->VisibilityOff();
}
else
{
m_BoundingBoxActor->VisibilityOn();
const BoundingBox::BoundsArrayType &bounds =
input->GetTimeSlicedGeometry()->GetBounds();
m_BoundingBox->SetBounds(
bounds[0], bounds[1],
bounds[2], bounds[3],
bounds[4], bounds[5] );
ColorProperty *colorProperty;
if ( this->GetDataNode()->GetProperty(
colorProperty, "color" ) )
{
const mitk::Color &color = colorProperty->GetColor();
m_BoundingBoxActor->GetProperty()->SetColor(
color[0], color[1], color[2] );
}
else
{
m_BoundingBoxActor->GetProperty()->SetColor(
1.0, 1.0, 1.0 );
}
}
}
// Don't do anything if VR is disabled
if ( !volumeRenderingEnabled )
{
m_VolumeLOD->VisibilityOff();
return;
}
else
{
mitk::VtkVolumeRenderingProperty* vrp=dynamic_cast<mitk::VtkVolumeRenderingProperty*>(GetDataNode()->GetProperty("volumerendering configuration",renderer));
if(vrp)
{
int renderingValue = vrp->GetValueAsId();
switch(renderingValue)
{
case VTK_VOLUME_RAY_CAST_MIP_FUNCTION:
{
vtkVolumeRayCastMIPFunction* mipFunction = vtkVolumeRayCastMIPFunction::New();
m_HiResMapper->SetVolumeRayCastFunction(mipFunction);
mipFunction->Delete();
MITK_INFO <<"in switch" <<std::endl;
break;
}
case VTK_RAY_CAST_COMPOSITE_FUNCTION:
{
vtkVolumeRayCastCompositeFunction* compositeFunction = vtkVolumeRayCastCompositeFunction::New();
compositeFunction->SetCompositeMethodToClassifyFirst();
m_HiResMapper->SetVolumeRayCastFunction(compositeFunction);
compositeFunction->Delete();
break;
}
default:
MITK_ERROR <<"Warning: invalid volume rendering option. " << std::endl;
}
}
m_VolumeLOD->VisibilityOn();
}
this->SetPreferences();
/*
switch ( mitk::RenderingManager::GetInstance()->GetNextLOD( renderer ) )
{
case 0:
m_VolumeLOD->SetSelectedLODID(m_MedResID); m_LowResID );
break;
default:
case 1:
m_VolumeLOD->SetSelectedLODID( m_HiResID );
break;
}
*/
m_VolumeLOD->SetSelectedLODID( m_HiResID );
assert(input->GetTimeSlicedGeometry());
const Geometry3D* worldgeometry = renderer->GetCurrentWorldGeometry();
if(worldgeometry==NULL)
{
GetDataNode()->SetProperty("volumerendering",mitk::BoolProperty::New(false));
return;
}
vtkImageData *inputData = input->GetVtkImageData( this->GetTimestep() );
if(inputData==NULL)
return;
m_ImageCast->SetInput( inputData );
//If mask exists, process mask before resampling.
if (this->m_Mask)
{
this->m_ImageMaskFilter->SetImageInput(this->m_UnitSpacingImageFilter->GetOutput());
this->m_Resampler->SetInput(this->m_ImageMaskFilter->GetOutput());
this->m_HiResMapper->SetInput(this->m_ImageMaskFilter->GetOutput());
}
else
{
this->m_Resampler->SetInput(this->m_UnitSpacingImageFilter->GetOutput());
this->m_HiResMapper->SetInput(this->m_UnitSpacingImageFilter->GetOutput());
}
this->UpdateTransferFunctions( renderer );
vtkRenderWindowInteractor *interactor = renderWindow->GetInteractor();
float frameRate;
if( this->GetDataNode()->GetFloatProperty( "framerate", frameRate ) && frameRate > 0 && frameRate <= 60)
{
interactor->SetDesiredUpdateRate( frameRate );
interactor->SetStillUpdateRate( frameRate );
}
else if( frameRate > 60 )
{
this->GetDataNode()->SetProperty( "framerate",mitk::FloatProperty::New(60));
interactor->SetDesiredUpdateRate( 60 );
interactor->SetStillUpdateRate( 60 );
}
else
{
this->GetDataNode()->SetProperty( "framerate",mitk::FloatProperty::New(0.00001));
interactor->SetDesiredUpdateRate( 0.00001 );
interactor->SetStillUpdateRate( 0.00001 );
}
if ( m_RenderWindowInitialized.find( renderWindow ) == m_RenderWindowInitialized.end() )
{
m_RenderWindowInitialized.insert( renderWindow );
// mitk::RenderingManager::GetInstance()->SetNextLOD( 0, renderer );
mitk::RenderingManager::GetInstance()->SetShading( true, 0 );
mitk::RenderingManager::GetInstance()->SetShading( true, 1 );
//mitk::RenderingManager::GetInstance()->SetShading( true, 2 );
mitk::RenderingManager::GetInstance()->SetShadingValues(
m_VolumePropertyHigh->GetAmbient(),
m_VolumePropertyHigh->GetDiffuse(),
m_VolumePropertyHigh->GetSpecular(),
m_VolumePropertyHigh->GetSpecularPower());
mitk::RenderingManager::GetInstance()->SetClippingPlaneStatus(false);
}
this->SetClippingPlane( interactor );
}
void mitk::VolumeDataVtkMapper3D::CreateDefaultTransferFunctions()
{
m_DefaultOpacityTransferFunction = vtkPiecewiseFunction::New();
m_DefaultOpacityTransferFunction->AddPoint( 0.0, 0.0 );
m_DefaultOpacityTransferFunction->AddPoint( 255.0, 0.8 );
m_DefaultOpacityTransferFunction->ClampingOn();
m_DefaultGradientTransferFunction = vtkPiecewiseFunction::New();
m_DefaultGradientTransferFunction->AddPoint( 0.0, 0.0 );
m_DefaultGradientTransferFunction->AddPoint( 255.0, 0.8 );
m_DefaultGradientTransferFunction->ClampingOn();
m_DefaultColorTransferFunction = vtkColorTransferFunction::New();
m_DefaultColorTransferFunction->AddRGBPoint( 0.0, 0.0, 0.0, 0.0 );
m_DefaultColorTransferFunction->AddRGBPoint( 127.5, 1, 1, 0.0 );
m_DefaultColorTransferFunction->AddRGBPoint( 255.0, 0.8, 0.2, 0 );
m_DefaultColorTransferFunction->ClampingOn();
}
void mitk::VolumeDataVtkMapper3D::UpdateTransferFunctions( mitk::BaseRenderer *renderer )
{
vtkPiecewiseFunction *opacityTransferFunction = NULL;
vtkPiecewiseFunction *gradientTransferFunction = NULL;
vtkColorTransferFunction *colorTransferFunction = NULL;
mitk::LookupTableProperty::Pointer lookupTableProp;
lookupTableProp = dynamic_cast<mitk::LookupTableProperty*>(this->GetDataNode()->GetProperty("LookupTable"));
mitk::TransferFunctionProperty::Pointer transferFunctionProp = dynamic_cast<mitk::TransferFunctionProperty*>(this->GetDataNode()->GetProperty("TransferFunction"));
if ( transferFunctionProp.IsNotNull() ) {
opacityTransferFunction = transferFunctionProp->GetValue()->GetScalarOpacityFunction();
gradientTransferFunction = transferFunctionProp->GetValue()->GetGradientOpacityFunction();
colorTransferFunction = transferFunctionProp->GetValue()->GetColorTransferFunction();
}
else if (lookupTableProp.IsNotNull() )
{
lookupTableProp->GetLookupTable()->CreateOpacityTransferFunction(opacityTransferFunction);
opacityTransferFunction->ClampingOn();
lookupTableProp->GetLookupTable()->CreateGradientTransferFunction(gradientTransferFunction);
gradientTransferFunction->ClampingOn();
lookupTableProp->GetLookupTable()->CreateColorTransferFunction(colorTransferFunction);
colorTransferFunction->ClampingOn();
}
else
{
opacityTransferFunction = m_DefaultOpacityTransferFunction;
gradientTransferFunction = m_DefaultGradientTransferFunction;
colorTransferFunction = m_DefaultColorTransferFunction;
float rgb[3]={1.0f,1.0f,1.0f};
// check for color prop and use it for rendering if it exists
if(GetColor(rgb, renderer))
{
colorTransferFunction->AddRGBPoint( 0.0, 0.0, 0.0, 0.0 );
colorTransferFunction->AddRGBPoint( 127.5, rgb[0], rgb[1], rgb[2] );
colorTransferFunction->AddRGBPoint( 255.0, rgb[0], rgb[1], rgb[2] );
}
}
if (this->m_Mask)
{
opacityTransferFunction->AddPoint(0xffff, 0.0);
}
m_VolumePropertyLow->SetColor( colorTransferFunction );
m_VolumePropertyLow->SetScalarOpacity( opacityTransferFunction );
m_VolumePropertyLow->SetGradientOpacity( gradientTransferFunction );
m_VolumePropertyLow->SetInterpolationTypeToNearest();
m_VolumePropertyMed->SetColor( colorTransferFunction );
m_VolumePropertyMed->SetScalarOpacity( opacityTransferFunction );
m_VolumePropertyMed->SetGradientOpacity( gradientTransferFunction );
m_VolumePropertyMed->SetInterpolationTypeToNearest();
m_VolumePropertyHigh->SetColor( colorTransferFunction );
m_VolumePropertyHigh->SetScalarOpacity( opacityTransferFunction );
m_VolumePropertyHigh->SetGradientOpacity( gradientTransferFunction );
m_VolumePropertyHigh->SetInterpolationTypeToLinear();
}
/* Shading enabled / disabled */
void mitk::VolumeDataVtkMapper3D::SetPreferences()
{
//LOD 0
/*if(mitk::RenderingManager::GetInstance()->GetShading(0))
{
m_VolumePropertyLow->ShadeOn();
m_VolumePropertyLow->SetAmbient(mitk::RenderingManager::GetInstance()->GetShadingValues()[0]);
m_VolumePropertyLow->SetDiffuse(mitk::RenderingManager::GetInstance()->GetShadingValues()[1]);
m_VolumePropertyLow->SetSpecular(mitk::RenderingManager::GetInstance()->GetShadingValues()[2]);
m_VolumePropertyLow->SetSpecularPower(mitk::RenderingManager::GetInstance()->GetShadingValues()[3]);
}
else*/
{
m_VolumePropertyLow->ShadeOff();
}
//LOD 1
/*if(mitk::RenderingManager::GetInstance()->GetShading(1))
{
m_VolumePropertyMed->ShadeOn();
m_VolumePropertyMed->SetAmbient(mitk::RenderingManager::GetInstance()->GetShadingValues()[0]);
m_VolumePropertyMed->SetDiffuse(mitk::RenderingManager::GetInstance()->GetShadingValues()[1]);
m_VolumePropertyMed->SetSpecular(mitk::RenderingManager::GetInstance()->GetShadingValues()[2]);
m_VolumePropertyMed->SetSpecularPower(mitk::RenderingManager::GetInstance()->GetShadingValues()[3]);
}
else*/
{
m_VolumePropertyMed->ShadeOff();
}
//LOD 2
/*
if(mitk::RenderingManager::GetInstance()->GetShading(2))
{
m_VolumePropertyHigh->ShadeOn();
//Shading Properties
m_VolumePropertyHigh->SetAmbient(mitk::RenderingManager::GetInstance()->GetShadingValues()[0]);
m_VolumePropertyHigh->SetDiffuse(mitk::RenderingManager::GetInstance()->GetShadingValues()[1]);
m_VolumePropertyHigh->SetSpecular(mitk::RenderingManager::GetInstance()->GetShadingValues()[2]);
m_VolumePropertyHigh->SetSpecularPower(mitk::RenderingManager::GetInstance()->GetShadingValues()[3]);
}
else
{
m_VolumePropertyHigh->ShadeOff();
}
*/
}
/* Adds A Clipping Plane to the Mapper */
void mitk::VolumeDataVtkMapper3D::SetClippingPlane(vtkRenderWindowInteractor* interactor)
{
if(mitk::RenderingManager::GetInstance()->GetClippingPlaneStatus()) //if clipping plane is enabled
{
if(!m_PlaneSet)
{
m_PlaneWidget->SetInteractor(interactor);
m_PlaneWidget->SetPlaceFactor(1.0);
m_PlaneWidget->SetInput(m_UnitSpacingImageFilter->GetOutput());
m_PlaneWidget->OutlineTranslationOff(); //disables scaling of the bounding box
#if (VTK_MAJOR_VERSION >= 5)
m_PlaneWidget->ScaleEnabledOff(); //disables scaling of the bounding box
#endif
m_PlaneWidget->DrawPlaneOff(); //clipping plane is transparent
mitk::Image* input = const_cast<mitk::Image *>(this->GetInput());
/*places the widget within the specified bounds*/
m_PlaneWidget->PlaceWidget(
input->GetGeometry()->GetOrigin()[0],(input->GetGeometry()->GetOrigin()[0])+(input->GetDimension(0))*(input->GetVtkImageData()->GetSpacing()[0]), input->GetGeometry()->GetOrigin()[1],(input->GetGeometry()->GetOrigin()[1])+(input->GetDimension(1))*(input->GetVtkImageData()->GetSpacing()[1]), input->GetGeometry()->GetOrigin()[2],(input->GetGeometry()->GetOrigin()[2])+(input->GetDimension(2))*(input->GetVtkImageData()->GetSpacing()[2]));
// m_T2DMapper->AddClippingPlane(m_ClippingPlane);
m_HiResMapper->AddClippingPlane(m_ClippingPlane);
}
m_PlaneWidget->GetPlane(m_ClippingPlane);
m_PlaneSet = true;
}
else //if clippingplane is disabled
{
if(m_PlaneSet) //if plane exists
{
DelClippingPlane();
}
}
}
/* Removes the clipping plane */
void mitk::VolumeDataVtkMapper3D::DelClippingPlane()
{
// m_T2DMapper->RemoveAllClippingPlanes();
m_HiResMapper->RemoveAllClippingPlanes();
m_PlaneSet = false;
}
void mitk::VolumeDataVtkMapper3D::ApplyProperties(vtkActor* /*actor*/, mitk::BaseRenderer* /*renderer*/)
{
}
void mitk::VolumeDataVtkMapper3D::SetDefaultProperties(mitk::DataNode* node, mitk::BaseRenderer* renderer, bool overwrite)
{
node->AddProperty( "volumerendering", mitk::BoolProperty::New( false ), renderer, overwrite );
node->AddProperty( "volumerendering configuration", mitk::VtkVolumeRenderingProperty::New( 1 ), renderer, overwrite );
node->AddProperty( "binary", mitk::BoolProperty::New( false ), renderer, overwrite );
mitk::Image::Pointer image = dynamic_cast<mitk::Image*>(node->GetData());
if(image.IsNotNull() && image->IsInitialized())
{
if((overwrite) || (node->GetProperty("levelwindow", renderer)==NULL))
{
mitk::LevelWindowProperty::Pointer levWinProp = mitk::LevelWindowProperty::New();
mitk::LevelWindow levelwindow;
levelwindow.SetAuto( image );
levWinProp->SetLevelWindow( levelwindow );
node->SetProperty( "levelwindow", levWinProp, renderer );
}
if((overwrite) || (node->GetProperty("LookupTable", renderer)==NULL))
{
// add a default rainbow lookup table for color mapping
mitk::LookupTable::Pointer mitkLut = mitk::LookupTable::New();
vtkLookupTable* vtkLut = mitkLut->GetVtkLookupTable();
vtkLut->SetHueRange(0.6667, 0.0);
vtkLut->SetTableRange(0.0, 20.0);
vtkLut->Build();
mitk::LookupTableProperty::Pointer mitkLutProp = mitk::LookupTableProperty::New();
mitkLutProp->SetLookupTable(mitkLut);
node->SetProperty( "LookupTable", mitkLutProp );
}
if((overwrite) || (node->GetProperty("TransferFunction", renderer)==NULL))
{
// add a default transfer function
mitk::TransferFunction::Pointer tf = mitk::TransferFunction::New();
mitk::TransferFunctionInitializer::Pointer tfInit = mitk::TransferFunctionInitializer::New(tf);
tfInit->SetTransferFunctionMode(0);
node->SetProperty ( "TransferFunction", mitk::TransferFunctionProperty::New ( tf.GetPointer() ) );
}
}
Superclass::SetDefaultProperties(node, renderer, overwrite);
}
bool mitk::VolumeDataVtkMapper3D::IsLODEnabled( mitk::BaseRenderer * /*renderer*/ ) const
{
return false;
// Volume mapper is LOD enabled if volumerendering is enabled
/*
return
dynamic_cast<mitk::BoolProperty*>(GetDataNode()->GetProperty("volumerendering",renderer)) != NULL &&
dynamic_cast<mitk::BoolProperty*>(GetDataNode()->GetProperty("volumerendering",renderer))->GetValue() == true;
*/
}
void mitk::VolumeDataVtkMapper3D::EnableMask()
{
if (!this->m_Mask)
{
const Image *orig_image = this->GetInput();
unsigned int *dimensions = orig_image->GetDimensions();
this->m_Mask = vtkImageData::New();
this->m_Mask->SetDimensions(dimensions[0], dimensions[1], dimensions[2]);
this->m_Mask->SetScalarTypeToUnsignedChar();
this->m_Mask->SetNumberOfScalarComponents(1);
this->m_Mask->AllocateScalars();
unsigned char *mask_data = static_cast<unsigned char*>(this->m_Mask->GetScalarPointer());
unsigned int size = dimensions[0] * dimensions[1] * dimensions[2];
for (unsigned int i = 0u; i < size; ++i)
{
*mask_data++ = 1u;
}
this->m_ImageMaskFilter->SetMaskInput(this->m_Mask);
this->m_ImageMaskFilter->Modified();
}
}
void mitk::VolumeDataVtkMapper3D::DisableMask()
{
if (this->m_Mask)
{
this->m_Mask->Delete();
this->m_Mask = 0;
}
}
mitk::Image::Pointer mitk::VolumeDataVtkMapper3D::GetMask()
{
if (this->m_Mask)
{
Image::Pointer mask = Image::New();
mask->Initialize(this->m_Mask);
mask->SetImportVolume(this->m_Mask->GetScalarPointer(), 0, 0, Image::ReferenceMemory);
mask->SetGeometry(this->GetInput()->GetGeometry());
return mask;
}
return 0;
}
void mitk::VolumeDataVtkMapper3D::UpdateMask()
{
if (this->m_Mask)
{
this->m_ImageMaskFilter->Modified();
}
}
bool mitk::VolumeDataVtkMapper3D::SetMask(const mitk::Image* mask)
{
if (this->m_Mask)
{
if (mask->GetPixelType() == PixelType(typeid(unsigned char)))
{
Image *img = const_cast<Image*>(mask);
this->m_Mask->DeepCopy(img->GetVtkImageData());
this->m_ImageMaskFilter->Modified();
return true;
}
}
return false;
}
diff --git a/Core/Code/Rendering/mitkVolumeDataVtkMapper3D.h b/Core/Code/Rendering/mitkVolumeDataVtkMapper3D.h
index 0e66a89524..bd3351d229 100644
--- a/Core/Code/Rendering/mitkVolumeDataVtkMapper3D.h
+++ b/Core/Code/Rendering/mitkVolumeDataVtkMapper3D.h
@@ -1,151 +1,151 @@
/*=========================================================================
Program: Medical Imaging & Interaction Toolkit
Language: C++
Date: $Date$
Version: $Revision$
Copyright (c) German Cancer Research Center, Division of Medical and
Biological Informatics. All rights reserved.
See MITKCopyright.txt or http://www.mitk.org/copyright.html for details.
This software is distributed WITHOUT ANY WARRANTY; without even
the implied warranty of MERCHANTABILITY or FITNESS FOR A PARTICULAR
PURPOSE. See the above copyright notices for more information.
=========================================================================*/
#ifndef MITKVOLUMEDATAVTKMAPPER3D_H_HEADER_INCLUDED
#define MITKVOLUMEDATAVTKMAPPER3D_H_HEADER_INCLUDED
#include "mitkCommon.h"
#include "mitkVtkMapper3D.h"
#include "mitkBaseRenderer.h"
#include "mitkImage.h"
#include <vtkVolumeProperty.h>
#include <vtkRenderWindowInteractor.h>
#include <vtkPlane.h>
#include <vtkImplicitPlaneWidget.h>
#include <vtkImageMask.h>
#include <vector>
#include <set>
class vtkAssembly;
class vtkVolumeRayCastMapper;
class vtkFixedPointVolumeRayCastMapper;
class vtkVolumeTextureMapper2D;
class vtkVolumeMapper;
class vtkVolume;
class vtkObject;
class vtkImageShiftScale;
class vtkImageChangeInformation;
class vtkLODProp3D;
class vtkImageResample;
class vtkCubeSource;
class vtkPolyDataMapper;
class vtkActor;
namespace mitk {
/************************************************************************/
/* Properties that influence the mapper are:
*
* - \b "level window": for the level window of the volume data
* - \b "LookupTable" : for the lookup table of the volume data
* - \b "TransferFunction" (mitk::TransferFunctionProperty): for the used transfer function of the volume data
************************************************************************/
//##Documentation
//## @brief Vtk-based mapper for VolumeData
//##
//## @ingroup Mapper
class MITK_CORE_EXPORT VolumeDataVtkMapper3D : public VtkMapper3D
{
public:
mitkClassMacro(VolumeDataVtkMapper3D, VtkMapper3D);
itkNewMacro(Self);
virtual const mitk::Image* GetInput();
virtual void ApplyProperties(vtkActor* actor, mitk::BaseRenderer* renderer);
virtual void EnableMask();
virtual void DisableMask();
Image::Pointer GetMask();
bool SetMask(const Image* mask);
virtual void UpdateMask();
static void SetDefaultProperties(mitk::DataNode* node, mitk::BaseRenderer* renderer = NULL, bool overwrite = false);
/** Returns true if this Mapper currently allows for Level-of-Detail rendering.
* This reflects whether this Mapper currently invokes StartEvent, EndEvent, and
* ProgressEvent on BaseRenderer. */
virtual bool IsLODEnabled( BaseRenderer *renderer = NULL ) const;
virtual vtkProp *GetVtkProp(mitk::BaseRenderer *renderer);
protected:
VolumeDataVtkMapper3D();
virtual ~VolumeDataVtkMapper3D();
- virtual void GenerateData(mitk::BaseRenderer* renderer);
+ virtual void GenerateDataForRenderer(mitk::BaseRenderer* renderer);
void CreateDefaultTransferFunctions();
void UpdateTransferFunctions( mitk::BaseRenderer *renderer );
void SetPreferences();
void SetClippingPlane(vtkRenderWindowInteractor* interactor);
void DelClippingPlane();
vtkImageShiftScale* m_ImageCast;
vtkImageChangeInformation* m_UnitSpacingImageFilter;
vtkVolumeProperty* m_VolumePropertyLow;
vtkVolumeProperty* m_VolumePropertyMed;
vtkVolumeProperty* m_VolumePropertyHigh;
vtkVolumeTextureMapper2D* m_T2DMapper;
vtkVolumeRayCastMapper* m_HiResMapper;
vtkImageResample* m_Resampler;
vtkLODProp3D* m_VolumeLOD;
vtkCubeSource *m_BoundingBox;
vtkPolyDataMapper *m_BoundingBoxMapper;
vtkActor *m_BoundingBoxActor;
vtkAssembly *m_Prop3DAssembly;
vtkPlane* m_ClippingPlane;
vtkImplicitPlaneWidget* m_PlaneWidget;
vtkImageData *m_Mask;
vtkImageMask *m_ImageMaskFilter;
vtkPiecewiseFunction *m_DefaultOpacityTransferFunction;
vtkPiecewiseFunction *m_DefaultGradientTransferFunction;
vtkColorTransferFunction *m_DefaultColorTransferFunction;
int m_LowResID;
int m_MedResID;
int m_HiResID;
bool m_PlaneSet;
double m_PlaneNormalA;
double m_PlaneNormalB;
double m_PlaneNormalC;
std::set< vtkRenderWindow * > m_RenderWindowInitialized;
};
} // namespace mitk
#endif /* MITKVOLUMEDATAVTKMAPPER3D_H_HEADER_INCLUDED */
diff --git a/Core/Code/Rendering/mitkVtkPropRenderer.h b/Core/Code/Rendering/mitkVtkPropRenderer.h
index 295a6b99a3..eeb4bbea6c 100644
--- a/Core/Code/Rendering/mitkVtkPropRenderer.h
+++ b/Core/Code/Rendering/mitkVtkPropRenderer.h
@@ -1,193 +1,193 @@
/*=========================================================================
Program: Medical Imaging & Interaction Toolkit
Language: C++
Date: $Date: 2007-09-22 12:01:41 +0200 (Sa, 22 Sep 2007) $
Version: $Revision: 12241 $
Copyright (c) German Cancer Research Center, Division of Medical and
Biological Informatics. All rights reserved.
See MITKCopyright.txt or http://www.mitk.org/copyright.html for details.
This software is distributed WITHOUT ANY WARRANTY; without even
the implied warranty of MERCHANTABILITY or FITNESS FOR A PARTICULAR
PURPOSE. See the above copyright notices for more information.
=========================================================================*/
#ifndef MITKVtkPropRenderer_H_HEADER_INCLUDED_C1C29F6D
#define MITKVtkPropRenderer_H_HEADER_INCLUDED_C1C29F6D
#include "mitkCommon.h"
#include "mitkBaseRenderer.h"
#include "mitkDataStorage.h"
#include "mitkRenderingManager.h"
#include <itkCommand.h>
#include <map>
#include <utility>
class vtkRenderWindow;
class vtkLight;
class vtkLightKit;
class vtkWorldPointPicker;
class vtkPointPicker;
class vtkCellPicker;
class vtkTextActor;
class vtkTextProperty;
class vtkAssemblyPath;
namespace mitk
{
class Mapper;
/*!
\brief VtkPropRenderer
VtkPropRenderer organizes the MITK rendering process. The MITK rendering process is completely integrated into the VTK rendering pipeline.
The vtkMitkRenderProp is a custom vtkProp derived class, which implements the rendering interface between MITK and VTK. It redirects render() calls to the VtkPropRenderer, which is responsible for rendering of the datatreenodes.
VtkPropRenderer replaces the old OpenGLRenderer.
\sa rendering
\ingroup rendering
*/
class MITK_CORE_EXPORT VtkPropRenderer : public BaseRenderer
{
// Workaround for Displaylistbug
private:
bool didCount;
void checkState();
// Workaround END
public:
mitkClassMacro(VtkPropRenderer,BaseRenderer);
mitkNewMacro3Param(VtkPropRenderer, const char*, vtkRenderWindow *, mitk::RenderingManager* );
typedef std::map<int,Mapper*> MappersMapType;
// Render - called by vtkMitkRenderProp, returns the number of props rendered
#if ( ( VTK_MAJOR_VERSION >= 5 ) && ( VTK_MINOR_VERSION>=2) )
enum RenderType{Opaque,Translucent,Overlay,Volumetric};
#else
enum RenderType{Opaque,Translucent,Overlay};
#endif
int Render(RenderType type);
// Active current renderwindow
virtual void MakeCurrent();
virtual void SetDataStorage( mitk::DataStorage* storage ); ///< set the datastorage that will be used for rendering
virtual void InitRenderer(vtkRenderWindow* renderwindow);
virtual void Update(mitk::DataNode* datatreenode);
virtual void SetMapperID(const MapperSlotId mapperId);
// Size
virtual void InitSize(int w, int h);
virtual void Resize(int w, int h);
// Picking
enum PickingMode{ WorldPointPicking, PointPicking };
- itkSetMacro( PickingMode, PickingMode );
- itkGetMacro( PickingMode, PickingMode );
+ itkSetEnumMacro( PickingMode, PickingMode );
+ itkGetEnumMacro( PickingMode, PickingMode );
virtual void PickWorldPoint(const Point2D& displayPoint, Point3D& worldPoint) const;
virtual mitk::DataNode *PickObject( const Point2D &displayPosition, Point3D &worldPosition ) const;
// Simple text rendering method
int WriteSimpleText(std::string text, double posX, double posY, double color1 = 0.0, double color2 = 1.0, double color3 = 0.0);
vtkTextProperty * GetTextLabelProperty(int text_id);
// Initialization / geometry handling
/** This method calculates the bounds of the DataStorage (if it contains any
* valid data), creates a geometry from these bounds and sets it as world
* geometry of the renderer.
*
* Call this method to re-initialize the renderer to the current DataStorage
* (e.g. after loading an additional dataset), to ensure that the view is
* aligned correctly.
*/
virtual bool SetWorldGeometryToDataStorageBounds();
/**
* \brief Used by vtkPointPicker/vtkPicker.
* This will query a list of all objects in MITK and provide every vtk based mapper to the picker.
*/
void InitPathTraversal();
/**
* \brief Used by vtkPointPicker/vtkPicker.
* This will query a list of all objects in MITK and provide every vtk based mapper to the picker.
*/
vtkAssemblyPath* GetNextPath();
const vtkWorldPointPicker *GetWorldPointPicker() const;
const vtkPointPicker *GetPointPicker() const;
const vtkCellPicker *GetCellPicker() const;
/**
* \brief Release vtk-based graphics resources. Called by
* vtkMitkRenderProp::ReleaseGraphicsResources.
*/
virtual void ReleaseGraphicsResources(vtkWindow *renWin);
#if ( ( VTK_MAJOR_VERSION >= 5 ) && ( VTK_MINOR_VERSION>=2) )
MappersMapType GetMappersMap() const;
#endif
static bool useImmediateModeRendering();
protected:
VtkPropRenderer( const char* name = "VtkPropRenderer", vtkRenderWindow * renWin = NULL, mitk::RenderingManager* rm = NULL );
virtual ~VtkPropRenderer();
virtual void Update();
private:
// switch between orthogonal opengl projection (2D rendering via mitk::GLMapper2D) and perspective projection (3D rendering)
void Enable2DOpenGL();
void Disable2DOpenGL();
// prepare all mitk::mappers for rendering
void PrepareMapperQueue();
bool m_InitNeeded;
bool m_ResizeNeeded;
bool m_VtkMapperPresent;
bool m_NewRenderer;
// Picking
vtkWorldPointPicker * m_WorldPointPicker;
vtkPointPicker * m_PointPicker;
vtkCellPicker * m_CellPicker;
PickingMode m_PickingMode;
// Explicit use of SmartPointer to avoid circular #includes
itk::SmartPointer< mitk::Mapper > m_CurrentWorldGeometry2DMapper;
vtkLightKit* m_LightKit;
// sorted list of mappers
MappersMapType m_MappersMap;
// rendering of text
vtkRenderer * m_TextRenderer;
typedef std::map<unsigned int,vtkTextActor*> TextMapType;
TextMapType m_TextCollection;
DataStorage::SetOfObjects::ConstPointer m_PickingObjects;
DataStorage::SetOfObjects::const_iterator m_PickingObjectsIterator;
};
} // namespace mitk
#endif /* MITKVtkPropRenderer_H_HEADER_INCLUDED_C1C29F6D */
diff --git a/Core/Code/Testing/CMakeLists.txt b/Core/Code/Testing/CMakeLists.txt
index 63b08c7cc0..0dc1fbdf1d 100644
--- a/Core/Code/Testing/CMakeLists.txt
+++ b/Core/Code/Testing/CMakeLists.txt
@@ -1,34 +1,36 @@
MITK_CREATE_MODULE_TESTS(LABELS MITK-Core)
# MITK_INSTALL_TARGETS(EXECUTABLES MitkTestDriver)
mitkAddCustomModuleTest(mitkPicFileReaderTest_emptyFile mitkPicFileReaderTest ${CMAKE_CURRENT_SOURCE_DIR}/Data/emptyFile.pic)
mitkAddCustomModuleTest(mitkPicFileReaderTest_emptyGzipFile mitkPicFileReaderTest ${CMAKE_CURRENT_SOURCE_DIR}/Data/emptyFile.pic.gz)
mitkAddCustomModuleTest(mitkDICOMLocaleTest_spacingOk_CT mitkDICOMLocaleTest ${MITK_DATA_DIR}/spacing-ok-ct.dcm)
mitkAddCustomModuleTest(mitkDICOMLocaleTest_spacingOk_MR mitkDICOMLocaleTest ${MITK_DATA_DIR}/spacing-ok-mr.dcm)
mitkAddCustomModuleTest(mitkDICOMLocaleTest_spacingOk_SC mitkDICOMLocaleTest ${MITK_DATA_DIR}/spacing-ok-sc.dcm)
mitkAddCustomModuleTest(mitkEventMapperTest_Test1And2 mitkEventMapperTest ${MITK_DATA_DIR}/TestStateMachine1.xml ${MITK_DATA_DIR}/TestStateMachine2.xml)
mitkAddCustomModuleTest(mitkNodeDependentPointSetInteractorTest mitkNodeDependentPointSetInteractorTest ${MITK_DATA_DIR}/Pic3D.pic.gz ${MITK_DATA_DIR}/BallBinary30x30x30.pic.gz)
mitkAddCustomModuleTest(mitkDataStorageTest_US4DCyl mitkDataStorageTest ${MITK_DATA_DIR}/US4DCyl.pic.gz)
mitkAddCustomModuleTest(mitkStateMachineFactoryTest_TestStateMachine1_2 mitkStateMachineFactoryTest ${MITK_DATA_DIR}/TestStateMachine1.xml ${MITK_DATA_DIR}/TestStateMachine2.xml)
+mitkAddCustomModuleTest(mitkDicomSeriesReaderTest_CTImage mitkDicomSeriesReaderTest ${MITK_DATA_DIR}/TinyCTAbdomen)
+
ADD_TEST(mitkPointSetLocaleTest ${CMAKE_RUNTIME_OUTPUT_DIRECTORY}/${TESTDRIVER} mitkPointSetLocaleTest ${MITK_DATA_DIR}/pointSet.mps)
SET_PROPERTY(TEST mitkPointSetLocaleTest PROPERTY LABELS MITK-Core)
ADD_TEST(mitkPicFileReaderTest_emptyGzipFile ${CMAKE_RUNTIME_OUTPUT_DIRECTORY}/${TESTDRIVER} mitkPicFileReaderTest ${CMAKE_CURRENT_SOURCE_DIR}/Data/emptyFile.pic.gz)
SET_PROPERTY(TEST mitkPicFileReaderTest_emptyGzipFile PROPERTY LABELS MITK-Core)
ADD_TEST(mitkImageTest_brainImage ${CMAKE_RUNTIME_OUTPUT_DIRECTORY}/${TESTDRIVER} mitkImageTest ${MITK_DATA_DIR}/brain.mhd)
SET_PROPERTY(TEST mitkImageTest_brainImage PROPERTY LABELS MITK-Core)
ADD_TEST(mitkImageTest_4DImageData ${CMAKE_RUNTIME_OUTPUT_DIRECTORY}/${TESTDRIVER} mitkImageTest ${MITK_DATA_DIR}/US4DCyl.pic.gz)
SET_PROPERTY(TEST mitkImageTest_4DImageData PROPERTY LABELS MITK-Core)
ADD_TEST(mitkImageWriterTest_nrrdImage ${CMAKE_RUNTIME_OUTPUT_DIRECTORY}/${TESTDRIVER} mitkImageWriterTest ${MITK_DATA_DIR}/NrrdWritingTestImage.jpg)
SET_PROPERTY(TEST mitkImageWriterTest_nrrdImage PROPERTY LABELS MITK-Core)
add_subdirectory(DICOMTesting)
diff --git a/Core/Code/Testing/DICOMTesting/CMakeLists.txt b/Core/Code/Testing/DICOMTesting/CMakeLists.txt
index 5cf1837afb..e5ae20d32f 100644
--- a/Core/Code/Testing/DICOMTesting/CMakeLists.txt
+++ b/Core/Code/Testing/DICOMTesting/CMakeLists.txt
@@ -1,33 +1,38 @@
if (BUILD_TESTING)
if (GDCM_DIR)
# clear variables from prior files.cmake
set(MODULE_TESTS)
set(MODULE_IMAGE_TESTS)
set(MODULE_TESTIMAGES)
set(MODULE_CUSTOM_TESTS)
set(H_FILES)
set(CPP_FILES)
# now create a new module only for testing purposes
MITK_CREATE_MODULE( mitkDICOMTesting
DEPENDS Mitk # mitkCore.so
)
+MITK_CHECK_MODULE(_RESULT mitkDICOMTesting)
+IF(_RESULT)
+ MESSAGE(STATUS "mitkDICOMTesting application won't be built. Missing: ${_RESULT}")
+ELSE(_RESULT)
# add helpful applications
MITK_USE_MODULE( mitkDICOMTesting )
include_directories(${CMAKE_CURRENT_SOURCE_DIR} ${CMAKE_CURRENT_BINARY_DIR} ${ALL_INCLUDE_DIRECTORIES})
# dumps out image information
add_executable(DumpDICOMMitkImage DumpDICOMMitkImage.cpp)
target_link_libraries(DumpDICOMMitkImage ${ALL_LIBRARIES})
# compares dumped out image information against reference dump
add_executable(VerifyDICOMMitkImageDump VerifyDICOMMitkImageDump.cpp)
target_link_libraries(VerifyDICOMMitkImageDump ${ALL_LIBRARIES})
add_subdirectory(Testing)
+ENDIF()
endif()
endif()
diff --git a/Core/Code/Testing/files.cmake b/Core/Code/Testing/files.cmake
index f4d4aea409..bceafab826 100644
--- a/Core/Code/Testing/files.cmake
+++ b/Core/Code/Testing/files.cmake
@@ -1,91 +1,94 @@
# tests with no extra command line parameter
SET(MODULE_TESTS
+ mitkAccessByItkTest.cpp
mitkCoreObjectFactoryTest.cpp
mitkPointSetWriterTest.cpp
mitkMaterialTest.cpp
mitkActionTest.cpp
mitkEnumerationPropertyTest.cpp
mitkEventTest.cpp
mitkFocusManagerTest.cpp
mitkGenericPropertyTest.cpp
mitkGeometry3DTest.cpp
mitkGeometryDataToSurfaceFilterTest.cpp
mitkGlobalInteractionTest.cpp
mitkImageDataItemTest.cpp
#mitkImageMapper2DTest.cpp
mitkImageGeneratorTest.cpp
mitkBaseDataTest.cpp
#mitkImageToItkTest.cpp
+ mitkInstantiateAccessFunctionTest.cpp
mitkInteractorTest.cpp
mitkITKThreadingTest.cpp
# mitkLevelWindowManagerTest.cpp
mitkLevelWindowTest.cpp
mitkMessageTest.cpp
#mitkPipelineSmartPointerCorrectnessTest.cpp
mitkPixelTypeTest.cpp
mitkPlaneGeometryTest.cpp
mitkPointSetFileIOTest.cpp
mitkPointSetTest.cpp
mitkPointSetInteractorTest.cpp
mitkPropertyListTest.cpp
#mitkRegistrationBaseTest.cpp
#mitkSegmentationInterpolationTest.cpp
mitkSlicedGeometry3DTest.cpp
mitkSliceNavigationControllerTest.cpp
mitkStateMachineTest.cpp
mitkStateTest.cpp
mitkSurfaceTest.cpp
mitkSurfaceToSurfaceFilterTest.cpp
mitkTimeSlicedGeometryTest.cpp
mitkTransitionTest.cpp
mitkUndoControllerTest.cpp
mitkVtkWidgetRenderingTest.cpp
mitkVerboseLimitedLinearUndoTest.cpp
mitkWeakPointerTest.cpp
mitkTransferFunctionTest.cpp
#mitkAbstractTransformGeometryTest.cpp
#mitkPicFileIOTest.cpp
mitkStepperTest.cpp
itkTotalVariationDenoisingImageFilterTest.cpp
mitkRenderingManagerTest.cpp
vtkMitkThickSlicesFilterTest.cpp
mitkNodePredicateSourceTest.cpp
+ mitkVectorTest.cpp
)
# test with image filename as an extra command line parameter
SET(MODULE_IMAGE_TESTS
mitkSurfaceVtkWriterTest.cpp
mitkPicFileWriterTest.cpp
#mitkImageSliceSelectorTest.cpp
mitkImageTimeSelectorTest.cpp
mitkPicFileReaderTest.cpp
# mitkVtkPropRendererTest.cpp
mitkDataNodeFactoryTest.cpp
#mitkSTLFileReaderTest.cpp
)
# list of images for which the tests are run
SET(MODULE_TESTIMAGES
US4DCyl.pic.gz
Pic3D.pic.gz
Pic2DplusT.pic.gz
BallBinary30x30x30.pic.gz
binary.stl
ball.stl
)
SET(MODULE_CUSTOM_TESTS
#mitkLabeledImageToSurfaceFilterTest.cpp
#mitkExternalToolsTest.cpp
mitkDataStorageTest.cpp
mitkDataNodeTest.cpp
mitkDicomSeriesReaderTest.cpp
mitkDICOMLocaleTest.cpp
mitkEventMapperTest.cpp
mitkNodeDependentPointSetInteractorTest.cpp
mitkStateMachineFactoryTest.cpp
mitkPointSetLocaleTest.cpp
mitkImageTest.cpp
mitkImageWriterTest.cpp
)
diff --git a/Core/Code/Testing/mitkAccessByItkTest.cpp b/Core/Code/Testing/mitkAccessByItkTest.cpp
new file mode 100644
index 0000000000..53354356f9
--- /dev/null
+++ b/Core/Code/Testing/mitkAccessByItkTest.cpp
@@ -0,0 +1,240 @@
+/*=========================================================================
+
+Program: Medical Imaging & Interaction Toolkit
+Language: C++
+Date: $Date$
+Version: $Revision: 17495 $
+
+Copyright (c) German Cancer Research Center, Division of Medical and
+Biological Informatics. All rights reserved.
+See MITKCopyright.txt or http://www.mitk.org/copyright.html for details.
+
+This software is distributed WITHOUT ANY WARRANTY; without even
+the implied warranty of MERCHANTABILITY or FITNESS FOR A PARTICULAR
+PURPOSE. See the above copyright notices for more information.
+
+=========================================================================*/
+
+#include <stdexcept>
+
+#include "mitkTestingMacros.h"
+
+#include <mitkITKImageImport.h>
+#include <mitkImageAccessByItk.h>
+
+#define TestImageType(type, dim) \
+ MITK_TEST_CONDITION(typeid(type) == typeid(TPixel) && dim == VDimension, "Checking for correct type itk::Image<" #type "," #dim ">")
+
+class AccessByItkTest
+{
+public:
+
+ typedef AccessByItkTest Self;
+
+ typedef itk::Image<int, 2> IntImage2D;
+ typedef itk::Image<int, 3> IntImage3D;
+ typedef itk::Image<float, 2> FloatImage2D;
+ typedef itk::Image<float, 3> FloatImage3D;
+
+ enum EImageType {
+ Unknown = 0,
+ Int2D,
+ Int3D,
+ Float2D,
+ Float3D
+ };
+
+ void testAccessByItk()
+ {
+ mitk::Image::Pointer mitkIntImage2D = createMitkImage<IntImage2D>();
+ mitk::Image::ConstPointer mitkIntImage3D(createMitkImage<IntImage3D>());
+ mitk::Image::ConstPointer mitkFloatImage2D(createMitkImage<FloatImage2D>());
+ mitk::Image::Pointer mitkFloatImage3D = createMitkImage<FloatImage3D>();
+
+ AccessByItk(mitkIntImage2D, AccessItkImage);
+ AccessByItk(mitkIntImage3D, AccessItkImage);
+ AccessByItk(mitkFloatImage2D, AccessItkImage);
+ AccessByItk(mitkFloatImage3D, AccessItkImage);
+
+ AccessByItk_n(mitkIntImage2D, AccessItkImage, (Int2D, 2));
+ AccessByItk_n(mitkIntImage3D, AccessItkImage, (Int3D, 2));
+ AccessByItk_n(mitkFloatImage2D, AccessItkImage, (Float2D, 2));
+ AccessByItk_n(mitkFloatImage3D, AccessItkImage, (Float3D, 2));
+ }
+
+ void testAccessFixedDimensionByItk()
+ {
+ mitk::Image::Pointer mitkIntImage2D = createMitkImage<IntImage2D>();
+ mitk::Image::ConstPointer mitkIntImage3D(createMitkImage<IntImage3D>());
+ mitk::Image::ConstPointer mitkFloatImage2D(createMitkImage<FloatImage2D>());
+ mitk::Image::Pointer mitkFloatImage3D = createMitkImage<FloatImage3D>();
+
+ AccessFixedDimensionByItk(mitkIntImage2D, AccessItkImage, 2);
+ AccessFixedDimensionByItk(mitkIntImage3D, AccessItkImage, 3);
+ AccessFixedDimensionByItk(mitkFloatImage2D, AccessItkImage, 2);
+ AccessFixedDimensionByItk(mitkFloatImage3D, AccessItkImage, 3);
+
+ AccessFixedDimensionByItk_n(mitkIntImage2D, AccessItkImage, 2, (Int2D, 2));
+ AccessFixedDimensionByItk_n(mitkIntImage3D, AccessItkImage, 3, (Int3D, 2));
+ AccessFixedDimensionByItk_n(mitkFloatImage2D, AccessItkImage, 2, (Float2D, 2));
+ AccessFixedDimensionByItk_n(mitkFloatImage3D, AccessItkImage, 3, (Float3D, 2));
+
+ // Test for wrong dimension
+ MITK_TEST_FOR_EXCEPTION_BEGIN(const mitk::AccessByItkException&)
+ AccessFixedDimensionByItk(mitkFloatImage3D, AccessItkImage, 2);
+ MITK_TEST_FOR_EXCEPTION_END(const mitk::AccessByItkException&)
+
+ MITK_TEST_FOR_EXCEPTION_BEGIN(const mitk::AccessByItkException&)
+ AccessFixedDimensionByItk_n(mitkFloatImage3D, AccessItkImage, 2, (Float3D, 2));
+ MITK_TEST_FOR_EXCEPTION_END(const mitk::AccessByItkException&)
+ }
+
+ void testAccessFixedPixelTypeByItk()
+ {
+ mitk::Image::Pointer mitkIntImage2D = createMitkImage<IntImage2D>();
+ mitk::Image::ConstPointer mitkIntImage3D(createMitkImage<IntImage3D>());
+ mitk::Image::ConstPointer mitkFloatImage2D(createMitkImage<FloatImage2D>());
+ mitk::Image::Pointer mitkFloatImage3D = createMitkImage<FloatImage3D>();
+
+ AccessFixedPixelTypeByItk(mitkIntImage2D, AccessItkImage, (int)(float));
+ AccessFixedPixelTypeByItk(mitkIntImage3D, AccessItkImage, (int)(float));
+ AccessFixedPixelTypeByItk(mitkFloatImage2D, AccessItkImage, (int)(float));
+ AccessFixedPixelTypeByItk(mitkFloatImage3D, AccessItkImage, (int)(float));
+
+ AccessFixedPixelTypeByItk_n(mitkIntImage2D, AccessItkImage, (int)(float), (Int2D, 2));
+ AccessFixedPixelTypeByItk_n(mitkIntImage3D, AccessItkImage, (int)(float), (Int3D, 2));
+ AccessFixedPixelTypeByItk_n(mitkFloatImage2D, AccessItkImage, (int)(float), (Float2D, 2));
+ AccessFixedPixelTypeByItk_n(mitkFloatImage3D, AccessItkImage, (int)(float), (Float3D, 2));
+
+ // Test for wrong pixel type
+ MITK_TEST_FOR_EXCEPTION_BEGIN(const mitk::AccessByItkException&)
+ AccessFixedPixelTypeByItk(mitkFloatImage3D, AccessItkImage, (int));
+ MITK_TEST_FOR_EXCEPTION_END(const mitk::AccessByItkException&)
+
+ MITK_TEST_FOR_EXCEPTION_BEGIN(const mitk::AccessByItkException&)
+ AccessFixedPixelTypeByItk_n(mitkFloatImage3D, AccessItkImage, (int), (Float3D, 2));
+ MITK_TEST_FOR_EXCEPTION_END(const mitk::AccessByItkException&)
+
+ }
+
+ void testAccessFixedTypeByItk()
+ {
+ mitk::Image::Pointer mitkIntImage2D = createMitkImage<IntImage2D>();
+ mitk::Image::ConstPointer mitkIntImage3D(createMitkImage<IntImage3D>());
+ mitk::Image::ConstPointer mitkFloatImage2D(createMitkImage<FloatImage2D>());
+ mitk::Image::Pointer mitkFloatImage3D = createMitkImage<FloatImage3D>();
+
+ AccessFixedTypeByItk(mitkIntImage2D, AccessItkImage, (int)(float), (2)(3));
+ AccessFixedTypeByItk(mitkIntImage3D, AccessItkImage, (int)(float), (2)(3));
+ AccessFixedTypeByItk(mitkFloatImage2D, AccessItkImage, (int)(float), (2)(3));
+ AccessFixedTypeByItk(mitkFloatImage3D, AccessItkImage, (int)(float), (2)(3));
+
+ AccessFixedTypeByItk_n(mitkIntImage2D, AccessItkImage, (int)(float), (2)(3), (Int2D, 2));
+ AccessFixedTypeByItk_n(mitkIntImage3D, AccessItkImage, (int)(float), (2)(3), (Int3D, 2));
+ AccessFixedTypeByItk_n(mitkFloatImage2D, AccessItkImage, (int)(float), (2)(3), (Float2D, 2));
+ AccessFixedTypeByItk_n(mitkFloatImage3D, AccessItkImage, (int)(float), (2)(3), (Float3D, 2));
+
+ // Test for wrong dimension
+ MITK_TEST_FOR_EXCEPTION_BEGIN(const mitk::AccessByItkException&)
+ AccessFixedTypeByItk(mitkFloatImage3D, AccessItkImage, (float), (2));
+ MITK_TEST_FOR_EXCEPTION_END(const mitk::AccessByItkException&)
+
+ MITK_TEST_FOR_EXCEPTION_BEGIN(const mitk::AccessByItkException&)
+ AccessFixedTypeByItk_n(mitkFloatImage3D, AccessItkImage, (float), (2), (Float3D, 2));
+ MITK_TEST_FOR_EXCEPTION_END(const mitk::AccessByItkException&)
+
+ // Test for wrong pixel type
+ MITK_TEST_FOR_EXCEPTION_BEGIN(const mitk::AccessByItkException&)
+ AccessFixedTypeByItk(mitkFloatImage3D, AccessItkImage, (int), (3));
+ MITK_TEST_FOR_EXCEPTION_END(const mitk::AccessByItkException&)
+
+ MITK_TEST_FOR_EXCEPTION_BEGIN(const mitk::AccessByItkException&)
+ AccessFixedTypeByItk_n(mitkFloatImage3D, AccessItkImage, (int), (3), (Float3D, 2));
+ MITK_TEST_FOR_EXCEPTION_END(const mitk::AccessByItkException&)
+ }
+
+ void testAccessTwoImagesFixedDimensionByItk()
+ {
+ mitk::Image::Pointer mitkIntImage2D = createMitkImage<IntImage2D>();
+ mitk::Image::ConstPointer mitkFloatImage2D(createMitkImage<FloatImage2D>());
+
+ AccessTwoImagesFixedDimensionByItk(mitkIntImage2D, mitkFloatImage2D, AccessTwoItkImages, 2);
+ }
+
+ template<typename TPixel, unsigned int VDimension>
+ void AccessItkImage(itk::Image<TPixel, VDimension>*,
+ EImageType param1 = Unknown, int param2 = 0, int param3 = 0)
+ {
+ switch (param1)
+ {
+ case Int2D: TestImageType(int , 2) break;
+ case Int3D: TestImageType(int, 3) break;
+ case Float2D: TestImageType(float, 2) break;
+ case Float3D: TestImageType(float, 3) break;
+ default: break;
+ }
+
+ if (param2)
+ {
+ MITK_TEST_CONDITION(param2 == 2, "Checking for correct second parameter")
+ }
+ if (param3)
+ {
+ MITK_TEST_CONDITION(param3 == 3, "Checking for correct third parameter")
+ }
+ }
+
+private:
+
+ template<typename TPixel1, unsigned int VDimension1, typename TPixel2, unsigned int VDimension2>
+ void AccessTwoItkImages(itk::Image<TPixel1,VDimension1>* /*itkImage1*/, itk::Image<TPixel2,VDimension2>* /*itkImage2*/)
+ {
+ if (!(typeid(int) == typeid(TPixel1) && typeid(float) == typeid(TPixel2) &&
+ VDimension1 == 2 && VDimension2 == 2))
+ {
+ throw std::runtime_error("Image type mismatch");
+ }
+ }
+
+ template<typename ImageType>
+ mitk::Image::Pointer createMitkImage()
+ {
+ typename ImageType::Pointer itkImage = ImageType::New();
+ typename ImageType::IndexType start;
+ start.Fill(0);
+ typename ImageType::SizeType size;
+ size.Fill(3);
+ typename ImageType::RegionType region;
+ region.SetSize(size);
+ region.SetIndex(start);
+ itkImage->SetRegions(region);
+ itkImage->Allocate();
+ return mitk::GrabItkImageMemory(itkImage);
+ }
+};
+
+int mitkAccessByItkTest(int /*argc*/, char* /*argv*/[])
+{
+
+ MITK_TEST_BEGIN("AccessByItk")
+
+ AccessByItkTest accessTest;
+
+ MITK_TEST_OUTPUT(<< "Testing AccessByItk macro")
+ accessTest.testAccessByItk();
+
+ MITK_TEST_OUTPUT(<< "Testing AccessFixedDimensionByItk macro")
+ accessTest.testAccessFixedDimensionByItk();
+
+ MITK_TEST_OUTPUT(<< "Testing AccessFixedTypeByItk macro")
+ accessTest.testAccessFixedTypeByItk();
+
+ MITK_TEST_OUTPUT(<< "Testing AccessFixedPixelTypeByItk macro")
+ accessTest.testAccessFixedPixelTypeByItk();
+
+ MITK_TEST_OUTPUT(<< "Testing AccessTwoImagesFixedDimensionByItk macro")
+ accessTest.testAccessTwoImagesFixedDimensionByItk();
+
+ MITK_TEST_END()
+
+}
diff --git a/Core/Code/Testing/mitkBaseDataTest.cpp b/Core/Code/Testing/mitkBaseDataTest.cpp
index fa700efae2..4b02e21e4f 100644
--- a/Core/Code/Testing/mitkBaseDataTest.cpp
+++ b/Core/Code/Testing/mitkBaseDataTest.cpp
@@ -1,117 +1,121 @@
/*=========================================================================
Program: Medical Imaging & Interaction Toolkit
Language: C++
Date: $Date$
Version: $Revision: 17495 $
Copyright (c) German Cancer Research Center, Division of Medical and
Biological Informatics. All rights reserved.
See MITKCopyright.txt or http://www.mitk.org/copyright.html for details.
This software is distributed WITHOUT ANY WARRANTY; without even
the implied warranty of MERCHANTABILITY or FITNESS FOR A PARTICULAR
PURPOSE. See the above copyright notices for more information.
=========================================================================*/
#include "mitkBaseDataTestImplementation.h"
#include "mitkStringProperty.h"
#include "mitkTestingMacros.h"
#include "itkImage.h"
int mitkBaseDataTest(int /*argc*/, char* /*argv*/[])
{
MITK_TEST_BEGIN("BaseData")
//Create a BaseData implementation
MITK_INFO << "Creating a base data instance...";
mitk::BaseDataTestImplementation::Pointer baseDataImpl = mitk::BaseDataTestImplementation::New();
MITK_TEST_CONDITION_REQUIRED(baseDataImpl.IsNotNull(),"Testing instantiation");
MITK_TEST_CONDITION(baseDataImpl->IsInitialized(), "BaseDataTestImplementation is initialized");
MITK_TEST_CONDITION(baseDataImpl->IsEmpty(), "BaseDataTestImplementation is initialized and empty");
MITK_TEST_CONDITION(baseDataImpl->GetExternalReferenceCount()== baseDataImpl->GetReferenceCount(), "Checks external reference count!");
mitk::BaseDataTestImplementation::Pointer cloneBaseData = baseDataImpl->Clone();
MITK_TEST_CONDITION_REQUIRED(cloneBaseData.IsNotNull(),"Testing instantiation of base data clone");
MITK_TEST_CONDITION(cloneBaseData->IsInitialized(), "Clone of BaseDataTestImplementation is initialized");
MITK_TEST_CONDITION(cloneBaseData->IsEmpty(), "Clone of BaseDataTestImplementation is initialized and empty");
MITK_TEST_CONDITION(cloneBaseData->GetExternalReferenceCount()== cloneBaseData->GetReferenceCount(), "Checks external reference count of base data clone!");
MITK_INFO << "Testing setter and getter for geometries...";
//test method GetTimeSlicedGeometry()
MITK_TEST_CONDITION(baseDataImpl->GetTimeSlicedGeometry(), "Testing creation of TimeSlicedGeometry");
mitk::TimeSlicedGeometry* geo = NULL;
baseDataImpl->SetGeometry(geo);
MITK_TEST_CONDITION(baseDataImpl->GetTimeSlicedGeometry() == NULL, "Reset Geometry");
mitk::TimeSlicedGeometry::Pointer geo2 = mitk::TimeSlicedGeometry::New();
baseDataImpl->SetGeometry(geo2);
baseDataImpl->InitializeTimeSlicedGeometry(2);
MITK_TEST_CONDITION(baseDataImpl->GetTimeSlicedGeometry() == geo2, "Correct Reinit of TimeslicedGeometry");
//test method GetGeometry(int timeStep)
MITK_TEST_CONDITION(baseDataImpl->GetGeometry(1) != NULL, "... and single Geometries");
//test method Expand(unsigned int timeSteps)
baseDataImpl->Expand(5);
MITK_TEST_CONDITION(baseDataImpl->GetTimeSteps() == 5, "Expand the geometry to further time slices!");
//test method GetUpdatedGeometry(int timeStep);
mitk::Geometry3D::Pointer geo3 = mitk::Geometry3D::New();
- baseDataImpl->SetGeometry(geo3, 1);
+ mitk::TimeSlicedGeometry::Pointer timeSlicedGeometry = baseDataImpl->GetTimeSlicedGeometry();
+ if (timeSlicedGeometry.IsNotNull() )
+ {
+ timeSlicedGeometry->SetGeometry3D(geo3, 1);
+ }
MITK_TEST_CONDITION(baseDataImpl->GetUpdatedGeometry(1) == geo3, "Set Geometry for time step 1");
MITK_TEST_CONDITION(baseDataImpl->GetMTime()!= 0, "Check if modified time is set");
baseDataImpl->SetClonedGeometry(geo3, 1);
float x[3];
x[0] = 2;
x[1] = 4;
x[2] = 6;
mitk::Point3D p3d(x);
baseDataImpl->SetOrigin(p3d);
geo3->SetOrigin(p3d);
MITK_TEST_CONDITION(baseDataImpl->GetGeometry(1)->GetOrigin() == geo3->GetOrigin(), "Testing Origin set");
cloneBaseData = baseDataImpl->Clone();
MITK_TEST_CONDITION(cloneBaseData->GetGeometry(1)->GetOrigin() == geo3->GetOrigin(), "Testing origin set in clone!");
- MITK_TEST_CONDITION(!baseDataImpl->IsEmpty(1), "Is not empty before clear()!");
+ MITK_TEST_CONDITION(!baseDataImpl->IsEmptyTimeStep(1), "Is not empty before clear()!");
baseDataImpl->Clear();
- MITK_TEST_CONDITION(baseDataImpl->IsEmpty(1), "...but afterwards!");
+ MITK_TEST_CONDITION(baseDataImpl->IsEmptyTimeStep(1), "...but afterwards!");
//test method Set-/GetProperty()
baseDataImpl->SetProperty("property38", mitk::StringProperty::New("testproperty"));
//baseDataImpl->SetProperty("visibility", mitk::BoolProperty::New());
MITK_TEST_CONDITION(baseDataImpl->GetProperty("property38")->GetValueAsString() == "testproperty","Check if base property is set correctly!");
cloneBaseData = baseDataImpl->Clone();
MITK_TEST_CONDITION(cloneBaseData->GetProperty("property38")->GetValueAsString() == "testproperty", "Testing origin set in clone!");
//test method Set-/GetPropertyList
mitk::PropertyList::Pointer propertyList = mitk::PropertyList::New();
propertyList->SetFloatProperty("floatProperty1", 123.45);
propertyList->SetBoolProperty("visibility",true);
propertyList->SetStringProperty("nameXY","propertyName");
baseDataImpl->SetPropertyList(propertyList);
bool value = false;
MITK_TEST_CONDITION(baseDataImpl->GetPropertyList() == propertyList, "Check if base property list is set correctly!");
MITK_TEST_CONDITION(baseDataImpl->GetPropertyList()->GetBoolProperty("visibility", value) == true, "Check if base property is set correctly in the property list!");
//test method UpdateOutputInformation()
baseDataImpl->UpdateOutputInformation();
MITK_TEST_CONDITION(baseDataImpl->GetUpdatedTimeSlicedGeometry() == geo2, "TimeSlicedGeometry update!");
//Test method CopyInformation()
mitk::BaseDataTestImplementation::Pointer newBaseData = mitk::BaseDataTestImplementation::New();
newBaseData->CopyInformation(baseDataImpl);
MITK_TEST_CONDITION_REQUIRED( newBaseData->GetTimeSlicedGeometry()->GetTimeSteps() == 5, "Check copying of of Basedata Data Object!");
MITK_TEST_END()
}
diff --git a/Core/Code/Testing/mitkDataStorageTest.cpp b/Core/Code/Testing/mitkDataStorageTest.cpp
index 4adb181e9c..78f2008f7e 100644
--- a/Core/Code/Testing/mitkDataStorageTest.cpp
+++ b/Core/Code/Testing/mitkDataStorageTest.cpp
@@ -1,871 +1,872 @@
/*=========================================================================
Program: Medical Imaging & Interaction Toolkit
Language: C++
Date: $Date$
Version: $Revision$
Copyright (c) German Cancer Research Center, Division of Medical and
Biological Informatics. All rights reserved.
See MITKCopyright.txt or http://www.mitk.org/copyright.html for details.
This software is distributed WITHOUT ANY WARRANTY; without even
the implied warranty of MERCHANTABILITY or FITNESS FOR A PARTICULAR
PURPOSE. See the above copyright notices for more information.
=========================================================================*/
#include <fstream>
#include <algorithm>
#include "mitkImage.h"
#include "mitkSurface.h"
#include "mitkStringProperty.h"
#include "mitkColorProperty.h"
#include "mitkGroupTagProperty.h"
#include "mitkDataNode.h"
#include "mitkReferenceCountWatcher.h"
#include "mitkDataStorage.h"
#include "mitkStandaloneDataStorage.h"
#include "mitkNodePredicateProperty.h"
#include "mitkNodePredicateDataType.h"
#include "mitkNodePredicateDimension.h"
#include "mitkNodePredicateData.h"
#include "mitkNodePredicateNot.h"
#include "mitkNodePredicateAnd.h"
#include "mitkNodePredicateOr.h"
#include "mitkNodePredicateSource.h"
#include "mitkMessage.h"
#include "mitkPicFileReader.h"
#include "mitkTestingMacros.h"
void TestDataStorage(mitk::DataStorage* ds, std::string filename);
namespace mitk
{
class TestStandaloneDataStorage: public StandaloneDataStorage
{
public:
mitkClassMacro(TestStandaloneDataStorage, mitk::DataStorage);
itkNewMacro(Self);
std::map<const mitk::DataNode*, unsigned long>
GetModifiedObserverTags() const {return m_NodeModifiedObserverTags;}
std::map<const mitk::DataNode*, unsigned long>
GetDeletedObserverTags() const { return m_NodeDeleteObserverTags; }
protected:
TestStandaloneDataStorage() {}
};
}
class DSEventReceiver // Helper class for event testing
{
public:
const mitk::DataNode* m_NodeAdded;
const mitk::DataNode* m_NodeRemoved;
DSEventReceiver()
: m_NodeAdded(NULL), m_NodeRemoved(NULL)
{
}
void OnAdd(const mitk::DataNode* node)
{
m_NodeAdded = node;
}
void OnRemove(const mitk::DataNode* node)
{
m_NodeRemoved = node;
}
};
///
/// \brief a class for checking if the datastorage is really thread safe
///
/// Therefore it listens to a node contained in the datastorage. when this node
/// gets removed and deleted, this class gets informed by calling OnObjectDelete().
/// in OnObjectDelete() an empty node gets added. this must not cause a deadlock
///
struct ItkDeleteEventListener
{
ItkDeleteEventListener( mitk::DataStorage* ds )
: m_Node(0), m_DataStorage(ds),
m_DeleteObserverTag(0)
{
}
void SetNode( mitk::DataNode* _Node )
{
if(m_Node)
return;
m_Node = _Node;
itk::MemberCommand<ItkDeleteEventListener>::Pointer onObjectDelete =
itk::MemberCommand<ItkDeleteEventListener>::New();
onObjectDelete->SetCallbackFunction(this, &ItkDeleteEventListener::OnObjectDelete);
m_DeleteObserverTag = m_Node->AddObserver(itk::DeleteEvent(), onObjectDelete);
}
- void OnObjectDelete( const itk::Object *caller, const itk::EventObject & )
+ void OnObjectDelete( const itk::Object* /*caller*/, const itk::EventObject & )
{
mitk::DataNode::Pointer node = mitk::DataNode::New();
m_DataStorage->Add( node ); // SHOULD NOT CAUSE A DEADLOCK!
m_DataStorage->Remove( node ); // tidy up: remove the empty node again
m_Node = 0;
}
protected:
mitk::DataNode* m_Node;
mitk::DataStorage::Pointer m_DataStorage;
unsigned int m_DeleteObserverTag;
};
//## Documentation
//## main testing method
//## NOTE: the current Singleton implementation of DataTreeStorage will lead to crashes if a testcase fails
//## and therefore mitk::DataStorage::ShutdownSingleton() is not called.
int mitkDataStorageTest(int argc, char* argv[])
{
MITK_TEST_BEGIN("DataStorageTest");
// muellerm: test observer tag remove
mitk::TestStandaloneDataStorage::Pointer testDS
= mitk::TestStandaloneDataStorage::New();
mitk::DataNode::Pointer n1 = mitk::DataNode::New();
testDS->Add(n1);
MITK_TEST_CONDITION_REQUIRED(
testDS->GetModifiedObserverTags().size()==1, "Testing if modified"
" observer was added.");
MITK_TEST_CONDITION_REQUIRED(
testDS->GetDeletedObserverTags().size()==1, "Testing if delete"
" observer was added.");
testDS->Remove(n1);
MITK_TEST_CONDITION_REQUIRED(
testDS->GetModifiedObserverTags().size()==0, "Testing if modified"
" observer was removed.");
MITK_TEST_CONDITION_REQUIRED(
testDS->GetDeletedObserverTags().size()==0, "Testing if delete"
" observer was removed.");
/* Create StandaloneDataStorage */
MITK_TEST_OUTPUT( << "Create StandaloneDataStorage : ");
mitk::StandaloneDataStorage::Pointer sds;
try
{
sds = mitk::StandaloneDataStorage::New();
MITK_TEST_CONDITION_REQUIRED(sds.IsNotNull(), "Testing Instatiation");
}
catch (...)
{
MITK_TEST_FAILED_MSG( << "Exception during creation of StandaloneDataStorage");
}
MITK_TEST_OUTPUT( << "Testing StandaloneDataStorage: ");
+ MITK_TEST_CONDITION_REQUIRED(argc>1, "Testing correct test invocation");
TestDataStorage(sds,argv[1]);
// TODO: Add specific StandaloneDataStorage Tests here
sds = NULL;
MITK_TEST_END();
}
//##Documentation
//## @brief Test for the DataStorage class and its associated classes (e.g. the predicate classes)
//## This method will be called once for each subclass of DataStorage
void TestDataStorage( mitk::DataStorage* ds, std::string filename )
{
/* DataStorage valid? */
MITK_TEST_CONDITION_REQUIRED(ds != NULL, "DataStorage valid?");
mitk::PicFileReader::Pointer reader = mitk::PicFileReader::New();
reader -> SetFileName(filename.c_str());
reader -> Update();
mitk::Image::Pointer image = reader -> GetOutput();
// create some DataNodes to fill the ds
mitk::DataNode::Pointer n1 = mitk::DataNode::New(); // node with image and name property
// mitk::Image::Pointer image = mitk::Image::New();
// unsigned int imageDimensions[] = { 10, 10, 10, 10 };
// mitk::PixelType pt(typeid(int));
// image->Initialize( pt, 4, imageDimensions );
n1->SetData(image);
n1->SetProperty("name", mitk::StringProperty::New("Node 1 - Image Node"));
mitk::DataStorage::SetOfObjects::Pointer parents1 = mitk::DataStorage::SetOfObjects::New();
mitk::DataNode::Pointer n2 = mitk::DataNode::New(); // node with surface and name and color properties
mitk::Surface::Pointer surface = mitk::Surface::New();
n2->SetData(surface);
n2->SetProperty("name", mitk::StringProperty::New("Node 2 - Surface Node"));
mitk::Color color; color.Set(1.0f, 1.0f, 0.0f);
n2->SetColor(color);
n2->SetProperty("Resection Proposal 1", mitk::GroupTagProperty::New());
mitk::DataStorage::SetOfObjects::Pointer parents2 = mitk::DataStorage::SetOfObjects::New();
parents2->InsertElement(0, n1); // n1 (image node) is source of n2 (surface node)
mitk::DataNode::Pointer n3 = mitk::DataNode::New(); // node without data but with name property
n3->SetProperty("name", mitk::StringProperty::New("Node 3 - Empty Node"));
n3->SetProperty("Resection Proposal 1", mitk::GroupTagProperty::New());
n3->SetProperty("Resection Proposal 2", mitk::GroupTagProperty::New());
mitk::DataStorage::SetOfObjects::Pointer parents3 = mitk::DataStorage::SetOfObjects::New();
parents3->InsertElement(0, n2); // n2 is source of n3
mitk::DataNode::Pointer n4 = mitk::DataNode::New(); // node without data but with color property
n4->SetColor(color);
n4->SetProperty("Resection Proposal 2", mitk::GroupTagProperty::New());
mitk::DataStorage::SetOfObjects::Pointer parents4 = mitk::DataStorage::SetOfObjects::New();
parents4->InsertElement(0, n2);
parents4->InsertElement(1, n3); // n2 and n3 are sources of n4
mitk::DataNode::Pointer n5 = mitk::DataNode::New(); // extra node
n5->SetProperty("name", mitk::StringProperty::New("Node 5"));
try /* adding objects */
{
/* Add an object */
ds->Add(n1, parents1);
MITK_TEST_CONDITION_REQUIRED((ds->GetAll()->Size() == 1) && (ds->GetAll()->GetElement(0) == n1), "Testing Adding a new object");
/* Check exception on adding the same object again */
MITK_TEST_OUTPUT( << "Check exception on adding the same object again: ");
MITK_TEST_FOR_EXCEPTION(..., ds->Add(n1, parents1));
MITK_TEST_CONDITION(ds->GetAll()->Size() == 1, "Test if object count is correct after exception");
/* Add an object that has a source object */
ds->Add(n2, parents2);
MITK_TEST_CONDITION_REQUIRED(ds->GetAll()->Size() == 2, "Testing Adding an object that has a source object");
/* Add some more objects needed for further tests */
ds->Add(n3, parents3); // n3 object that has name property and one parent
ds->Add(n4, parents4); // n4 object that has color property
ds->Add(n5); // n5 has no parents
MITK_TEST_CONDITION_REQUIRED(ds->GetAll()->Size() == 5, "Adding some more objects needed for further tests");
}
catch(...)
{
MITK_TEST_FAILED_MSG( << "Exeption during object creation");
}
try /* object retrieval methods */
{
/* Requesting all Objects */
{
const mitk::DataStorage::SetOfObjects::ConstPointer all = ds->GetAll();
std::vector<mitk::DataNode::Pointer> stlAll = all->CastToSTLConstContainer();
MITK_TEST_CONDITION(
(stlAll.size() == 5) // check if all tree nodes are in resultset
&& (std::find(stlAll.begin(), stlAll.end(), n1) != stlAll.end()) && (std::find(stlAll.begin(), stlAll.end(), n2) != stlAll.end())
&& (std::find(stlAll.begin(), stlAll.end(), n3) != stlAll.end()) && (std::find(stlAll.begin(), stlAll.end(), n4) != stlAll.end())
&& (std::find(stlAll.begin(), stlAll.end(), n5) != stlAll.end()),
"Testing GetAll()"
);
}
/* Requesting a named object */
{
mitk::NodePredicateProperty::Pointer predicate(mitk::NodePredicateProperty::New("name", mitk::StringProperty::New("Node 2 - Surface Node")));
mitk::DataStorage::SetOfObjects::ConstPointer all = ds->GetSubset(predicate);
MITK_TEST_CONDITION((all->Size() == 1) && (all->GetElement(0) == n2), "Requesting a named object");
}
/* Requesting objects of specific data type */
{
mitk::NodePredicateDataType::Pointer predicate(mitk::NodePredicateDataType::New("Image"));
mitk::DataStorage::SetOfObjects::ConstPointer all = ds->GetSubset(predicate);
MITK_TEST_CONDITION((all->Size() == 1) && (all->GetElement(0) == n1), "Requesting objects of specific data type")
}
/* Requesting objects of specific dimension */
{
mitk::NodePredicateDimension::Pointer predicate(mitk::NodePredicateDimension::New( 4 ));
mitk::DataStorage::SetOfObjects::ConstPointer all = ds->GetSubset(predicate);
MITK_TEST_CONDITION((all->Size() == 1) && (all->GetElement(0) == n1), "Requesting objects of specific dimension")
}
/* Requesting objects with specific data object */
{
mitk::NodePredicateData::Pointer predicate(mitk::NodePredicateData::New(image));
mitk::DataStorage::SetOfObjects::ConstPointer all = ds->GetSubset(predicate);
MITK_TEST_CONDITION((all->Size() == 1) && (all->GetElement(0) == n1), "Requesting objects with specific data object")
}
/* Requesting objects with NULL data */
{
mitk::NodePredicateData::Pointer predicate(mitk::NodePredicateData::New(NULL));
mitk::DataStorage::SetOfObjects::ConstPointer all = ds->GetSubset(predicate);
MITK_TEST_CONDITION(
(all->Size() == 3)
&& (std::find(all->begin(), all->end(), n3) != all->end())
&& (std::find(all->begin(), all->end(), n4) != all->end())
&& (std::find(all->begin(), all->end(), n5) != all->end())
, "Requesting objects with NULL data");
}
/* Requesting objects that meet a conjunction criteria */
{
mitk::NodePredicateDataType::Pointer p1 = mitk::NodePredicateDataType::New("Surface");
mitk::NodePredicateProperty::Pointer p2 = mitk::NodePredicateProperty::New("color", mitk::ColorProperty::New(color));
mitk::NodePredicateAnd::Pointer predicate = mitk::NodePredicateAnd::New();
predicate->AddPredicate(p1);
predicate->AddPredicate(p2); // objects must be of datatype "Surface" and have red color (= n2)
const mitk::DataStorage::SetOfObjects::ConstPointer all = ds->GetSubset(predicate);
MITK_TEST_CONDITION((all->Size() == 1) && (all->GetElement(0) == n2), "Requesting objects that meet a conjunction criteria");
}
/* Requesting objects that meet a disjunction criteria */
{
mitk::NodePredicateDataType::Pointer p1(mitk::NodePredicateDataType::New("Image"));
mitk::NodePredicateProperty::Pointer p2(mitk::NodePredicateProperty::New("color", mitk::ColorProperty::New(color)));
mitk::NodePredicateOr::Pointer predicate = mitk::NodePredicateOr::New();
predicate->AddPredicate(p1);
predicate->AddPredicate(p2); // objects must be of datatype "Surface" or have red color (= n1, n2, n4)
const mitk::DataStorage::SetOfObjects::ConstPointer all = ds->GetSubset(predicate);
MITK_TEST_CONDITION(
(all->Size() == 3)
&& (std::find(all->begin(), all->end(), n1) != all->end())
&& (std::find(all->begin(), all->end(), n2) != all->end())
&& (std::find(all->begin(), all->end(), n4) != all->end()),
"Requesting objects that meet a disjunction criteria");
}
/* Requesting objects that do not meet a criteria */
{
mitk::ColorProperty::Pointer cp = mitk::ColorProperty::New(color);
mitk::NodePredicateProperty::Pointer proppred(mitk::NodePredicateProperty::New("color", cp));
mitk::NodePredicateNot::Pointer predicate(mitk::NodePredicateNot::New(proppred));
const mitk::DataStorage::SetOfObjects::ConstPointer all = ds->GetSubset(predicate);
std::vector<mitk::DataNode::Pointer> stlAll = all->CastToSTLConstContainer();
MITK_TEST_CONDITION(
(all->Size() == 3) // check if correct objects are in resultset
&& (std::find(stlAll.begin(), stlAll.end(), n1) != stlAll.end())
&& (std::find(stlAll.begin(), stlAll.end(), n3) != stlAll.end())
&& (std::find(stlAll.begin(), stlAll.end(), n5) != stlAll.end()), "Requesting objects that do not meet a criteria");
}
/* Requesting *direct* source objects */
{
const mitk::DataStorage::SetOfObjects::ConstPointer all = ds->GetSources(n3, NULL, true); // Get direct parents of n3 (=n2)
std::vector<mitk::DataNode::Pointer> stlAll = all->CastToSTLConstContainer();
MITK_TEST_CONDITION(
(all->Size() == 1) && (std::find(stlAll.begin(), stlAll.end(), n2) != stlAll.end()),
"Requesting *direct* source objects");
}
/* Requesting *all* source objects */
{
const mitk::DataStorage::SetOfObjects::ConstPointer all = ds->GetSources(n3, NULL, false); // Get all parents of n3 (= n1 + n2)
std::vector<mitk::DataNode::Pointer> stlAll = all->CastToSTLConstContainer();
MITK_TEST_CONDITION(
(all->Size() == 2)
&& (std::find(stlAll.begin(), stlAll.end(), n1) != stlAll.end())
&& (std::find(stlAll.begin(), stlAll.end(), n2) != stlAll.end()),
"Requesting *all* source objects"); // check if n1 and n2 are the resultset
}
/* Requesting *all* sources of object with multiple parents */
{
const mitk::DataStorage::SetOfObjects::ConstPointer all = ds->GetSources(n4, NULL, false); // Get all parents of n4 (= n1 + n2 + n3)
std::vector<mitk::DataNode::Pointer> stlAll = all->CastToSTLConstContainer();
MITK_TEST_CONDITION(
(all->Size() == 3)
&& (std::find(stlAll.begin(), stlAll.end(), n1) != stlAll.end())
&& (std::find(stlAll.begin(), stlAll.end(), n2) != stlAll.end())
&& (std::find(stlAll.begin(), stlAll.end(), n3) != stlAll.end()) // check if n1 and n2 and n3 are the resultset
, "Requesting *all* sources of object with multiple parents");
}
/* Requesting *direct* derived objects */
{
const mitk::DataStorage::SetOfObjects::ConstPointer all = ds->GetDerivations(n1, NULL, true); // Get direct childs of n1 (=n2)
std::vector<mitk::DataNode::Pointer> stlAll = all->CastToSTLConstContainer();
MITK_TEST_CONDITION(
(all->Size() == 1)
&& (std::find(stlAll.begin(), stlAll.end(), n2) != stlAll.end())// check if n1 is the resultset
, "Requesting *direct* derived objects");
}
///* Requesting *direct* derived objects with multiple parents/derivations */
{
const mitk::DataStorage::SetOfObjects::ConstPointer all = ds->GetDerivations(n2, NULL, true); // Get direct childs of n2 (=n3 + n4)
std::vector<mitk::DataNode::Pointer> stlAll = all->CastToSTLConstContainer();
MITK_TEST_CONDITION(
(all->Size() == 2)
&& (std::find(stlAll.begin(), stlAll.end(), n3) != stlAll.end()) // check if n3 is the resultset
&& (std::find(stlAll.begin(), stlAll.end(), n4) != stlAll.end()) // check if n4 is the resultset
, "Requesting *direct* derived objects with multiple parents/derivations");
}
//* Requesting *all* derived objects */
{
const mitk::DataStorage::SetOfObjects::ConstPointer all = ds->GetDerivations(n1, NULL, false); // Get all childs of n1 (=n2, n3, n4)
std::vector<mitk::DataNode::Pointer> stlAll = all->CastToSTLConstContainer();
MITK_TEST_CONDITION(
(all->Size() == 3)
&& (std::find(stlAll.begin(), stlAll.end(), n2) != stlAll.end())
&& (std::find(stlAll.begin(), stlAll.end(), n3) != stlAll.end())
&& (std::find(stlAll.begin(), stlAll.end(), n4) != stlAll.end())
, "Requesting *all* derived objects");
}
/* Checking for circular source relationships */
{
parents1->InsertElement(0, n4); // make n1 derived from n4 (which is derived from n2, which is derived from n1)
const mitk::DataStorage::SetOfObjects::ConstPointer all = ds->GetSources(n4, NULL, false); // Get all parents of n4 (= n1 + n2 + n3, not n4 itself and not multiple versions of the nodes!)
std::vector<mitk::DataNode::Pointer> stlAll = all->CastToSTLConstContainer();
MITK_TEST_CONDITION(
(all->Size() == 3)
&& (std::find(stlAll.begin(), stlAll.end(), n1) != stlAll.end())
&& (std::find(stlAll.begin(), stlAll.end(), n2) != stlAll.end())
&& (std::find(stlAll.begin(), stlAll.end(), n3) != stlAll.end()) // check if n1 and n2 and n3 are the resultset
, "Checking for circular source relationships");
}
///* Checking for circular derivation relationships can not be performed, because the internal derivations datastructure
// can not be accessed from the outside. (Therefore it should not be possible to create these circular relations */
//* Checking GroupTagProperty */
{
mitk::GroupTagProperty::Pointer tp = mitk::GroupTagProperty::New();
mitk::NodePredicateProperty::Pointer pred(mitk::NodePredicateProperty::New("Resection Proposal 1", tp));
const mitk::DataStorage::SetOfObjects::ConstPointer all = ds->GetSubset(pred);
std::vector<mitk::DataNode::Pointer> stlAll = all->CastToSTLConstContainer();
MITK_TEST_CONDITION(
(all->Size() == 2) // check if n2 and n3 are in resultset
&& (std::find(stlAll.begin(), stlAll.end(), n2) != stlAll.end())
&& (std::find(stlAll.begin(), stlAll.end(), n3) != stlAll.end())
, "Checking GroupTagProperty");
}
/* Checking GroupTagProperty 2 */
{
mitk::GroupTagProperty::Pointer tp = mitk::GroupTagProperty::New();
mitk::NodePredicateProperty::Pointer pred(mitk::NodePredicateProperty::New("Resection Proposal 2", tp));
const mitk::DataStorage::SetOfObjects::ConstPointer all = ds->GetSubset(pred);
std::vector<mitk::DataNode::Pointer> stlAll = all->CastToSTLConstContainer();
MITK_TEST_CONDITION(
(all->Size() == 2) // check if n3 and n4 are in resultset
&& (std::find(stlAll.begin(), stlAll.end(), n3) != stlAll.end())
&& (std::find(stlAll.begin(), stlAll.end(), n4) != stlAll.end())
, "Checking GroupTagProperty 2");
}
/* Checking direct sources with condition */
{
mitk::NodePredicateDataType::Pointer pred = mitk::NodePredicateDataType::New("Surface");
const mitk::DataStorage::SetOfObjects::ConstPointer all = ds->GetSources(n4, pred, true);
std::vector<mitk::DataNode::Pointer> stlAll = all->CastToSTLConstContainer();
MITK_TEST_CONDITION(
(all->Size() == 1) // check if n2 is in resultset
&& (std::find(stlAll.begin(), stlAll.end(), n2) != stlAll.end())
, "checking direct sources with condition");
}
/* Checking all sources with condition */
{
mitk::NodePredicateDataType::Pointer pred = mitk::NodePredicateDataType::New("Image");
const mitk::DataStorage::SetOfObjects::ConstPointer all = ds->GetSources(n4, pred, false);
std::vector<mitk::DataNode::Pointer> stlAll = all->CastToSTLConstContainer();
MITK_TEST_CONDITION(
(all->Size() == 1) // check if n1 is in resultset
&& (std::find(stlAll.begin(), stlAll.end(), n1) != stlAll.end())
, "Checking all sources with condition");
}
/* Checking all sources with condition with empty resultset */
{
mitk::NodePredicateDataType::Pointer pred = mitk::NodePredicateDataType::New("VesselTree");
const mitk::DataStorage::SetOfObjects::ConstPointer all = ds->GetSources(n4, pred, false);
MITK_TEST_CONDITION(all->Size() == 0 , "Checking all sources with condition with empty resultset"); // check if resultset is empty
}
/* Checking direct derivations with condition */
{
mitk::NodePredicateProperty::Pointer pred = mitk::NodePredicateProperty::New("color");
const mitk::DataStorage::SetOfObjects::ConstPointer all = ds->GetDerivations(n1, pred, true);
std::vector<mitk::DataNode::Pointer> stlAll = all->CastToSTLConstContainer();
MITK_TEST_CONDITION(
(all->Size() == 1) // check if n2 is in resultset
&& (std::find(stlAll.begin(), stlAll.end(), n2) != stlAll.end())
, "Checking direct derivations with condition");
}
/* Checking all derivations with condition */
{
mitk::NodePredicateProperty::Pointer pred = mitk::NodePredicateProperty::New("color");
const mitk::DataStorage::SetOfObjects::ConstPointer all = ds->GetDerivations(n1, pred, false);
std::vector<mitk::DataNode::Pointer> stlAll = all->CastToSTLConstContainer();
MITK_TEST_CONDITION(
(all->Size() == 2) // check if n2 and n4 are in resultset
&& (std::find(stlAll.begin(), stlAll.end(), n2) != stlAll.end())
&& (std::find(stlAll.begin(), stlAll.end(), n4) != stlAll.end())
, "Checking direct derivations with condition");
}
/* Checking named node method */
MITK_TEST_CONDITION(ds->GetNamedNode("Node 2 - Surface Node") == n2, "Checking named node method");
MITK_TEST_CONDITION(ds->GetNamedNode(std::string("Node 2 - Surface Node")) == n2, "Checking named node(std::string) method");
/* Checking named node method with wrong name */
MITK_TEST_CONDITION(ds->GetNamedNode("This name does not exist") == NULL, "Checking named node method with wrong name");
/* Checking named object method */
MITK_TEST_CONDITION(ds->GetNamedObject<mitk::Image>("Node 1 - Image Node") == image, "Checking named object method");
MITK_TEST_CONDITION(ds->GetNamedObject<mitk::Image>(std::string("Node 1 - Image Node")) == image, "Checking named object(std::string) method");
/* Checking named object method with wrong DataType */
MITK_TEST_CONDITION(ds->GetNamedObject<mitk::Surface>("Node 1 - Image Node") == NULL, "Checking named object method with wrong DataType");
/* Checking named object method with wrong name */
MITK_TEST_CONDITION(ds->GetNamedObject<mitk::Image>("This name does not exist") == NULL, "Checking named object method with wrong name");
/* Checking GetNamedDerivedNode with valid name and direct derivation only */
MITK_TEST_CONDITION(ds->GetNamedDerivedNode("Node 2 - Surface Node", n1, true) == n2, "Checking GetNamedDerivedNode with valid name & direct derivation only");
/* Checking GetNamedDerivedNode with invalid Name and direct derivation only */
MITK_TEST_CONDITION(ds->GetNamedDerivedNode("wrong name", n1, true) == NULL, "Checking GetNamedDerivedNode with invalid name & direct derivation only");
/* Checking GetNamedDerivedNode with invalid Name and direct derivation only */
MITK_TEST_CONDITION(ds->GetNamedDerivedNode("Node 3 - Empty Node", n1, false) == n3, "Checking GetNamedDerivedNode with invalid name & direct derivation only");
/* Checking GetNamedDerivedNode with valid Name but direct derivation only */
MITK_TEST_CONDITION(ds->GetNamedDerivedNode("Node 3 - Empty Node", n1, true) == NULL, "Checking GetNamedDerivedNode with valid Name but direct derivation only");
/* Checking GetNode with valid predicate */
{
mitk::NodePredicateDataType::Pointer p(mitk::NodePredicateDataType::New("Image"));
MITK_TEST_CONDITION(ds->GetNode(p) == n1, "Checking GetNode with valid predicate");
}
/* Checking GetNode with invalid predicate */
{
mitk::NodePredicateDataType::Pointer p(mitk::NodePredicateDataType::New("PointSet"));
MITK_TEST_CONDITION(ds->GetNode(p) == NULL, "Checking GetNode with invalid predicate");
}
} // object retrieval methods
catch(...)
{
MITK_TEST_FAILED_MSG( << "Exeption during object retrieval (GetXXX() Methods)");
}
try /* object removal methods */
{
/* Checking removal of a node without relations */
{
mitk::DataNode::Pointer extra = mitk::DataNode::New();
extra->SetProperty("name", mitk::StringProperty::New("extra"));
mitk::ReferenceCountWatcher::Pointer watcher = new mitk::ReferenceCountWatcher(extra);
int refCountbeforeDS = watcher->GetReferenceCount();
ds->Add(extra);
MITK_TEST_CONDITION(ds->GetNamedNode("extra") == extra, "Adding extra node");
ds->Remove(extra);
MITK_TEST_CONDITION(
(ds->GetNamedNode("extra") == NULL)
&& (refCountbeforeDS == watcher->GetReferenceCount())
, "Checking removal of a node without relations");
extra = NULL;
}
/* Checking removal of a node with a parent */
{
mitk::DataNode::Pointer extra = mitk::DataNode::New();
extra->SetProperty("name", mitk::StringProperty::New("extra"));
mitk::ReferenceCountWatcher::Pointer watcher = new mitk::ReferenceCountWatcher(extra);
int refCountbeforeDS = watcher->GetReferenceCount();
ds->Add(extra, n1); // n1 is parent of extra
MITK_TEST_CONDITION(
(ds->GetNamedNode("extra") == extra)
&& (ds->GetDerivations(n1)->Size() == 2) // n2 and extra should be derived from n1
, "Adding extra node");
ds->Remove(extra);
MITK_TEST_CONDITION(
(ds->GetNamedNode("extra") == NULL)
&& (refCountbeforeDS == watcher->GetReferenceCount())
&& (ds->GetDerivations(n1)->Size() == 1)
, "Checking removal of a node with a parent");
extra = NULL;
}
/* Checking removal of a node with two parents */
{
mitk::DataNode::Pointer extra = mitk::DataNode::New();
extra->SetProperty("name", mitk::StringProperty::New("extra"));
mitk::ReferenceCountWatcher::Pointer watcher = new mitk::ReferenceCountWatcher(extra);
int refCountbeforeDS = watcher->GetReferenceCount();
mitk::DataStorage::SetOfObjects::Pointer p = mitk::DataStorage::SetOfObjects::New();
p->push_back(n1);
p->push_back(n2);
ds->Add(extra, p); // n1 and n2 are parents of extra
MITK_TEST_CONDITION(
(ds->GetNamedNode("extra") == extra)
&& (ds->GetDerivations(n1)->Size() == 2) // n2 and extra should be derived from n1
&& (ds->GetDerivations(n2)->Size() == 3)
, "add extra node");
ds->Remove(extra);
MITK_TEST_CONDITION(
(ds->GetNamedNode("extra") == NULL)
&& (refCountbeforeDS == watcher->GetReferenceCount())
&& (ds->GetDerivations(n1)->Size() == 1) // after remove, only n2 should be derived from n1
&& (ds->GetDerivations(n2)->Size() == 2) // after remove, only n3 and n4 should be derived from n2
, "Checking removal of a node with two parents");
extra = NULL;
}
/* Checking removal of a node with two derived nodes */
{
mitk::DataNode::Pointer extra = mitk::DataNode::New();
extra->SetProperty("name", mitk::StringProperty::New("extra"));
mitk::ReferenceCountWatcher::Pointer watcher = new mitk::ReferenceCountWatcher(extra);
int refCountbeforeDS = watcher->GetReferenceCount();
ds->Add(extra);
mitk::DataNode::Pointer d1 = mitk::DataNode::New();
d1->SetProperty("name", mitk::StringProperty::New("d1"));
ds->Add(d1, extra);
mitk::DataNode::Pointer d2 = mitk::DataNode::New();
d2->SetProperty("name", mitk::StringProperty::New("d2"));
ds->Add(d2, extra);
MITK_TEST_CONDITION(
(ds->GetNamedNode("extra") == extra)
&& (ds->GetNamedNode("d1") == d1)
&& (ds->GetNamedNode("d2") == d2)
&& (ds->GetSources(d1)->Size() == 1) // extra should be source of d1
&& (ds->GetSources(d2)->Size() == 1) // extra should be source of d2
&& (ds->GetDerivations(extra)->Size() == 2) // d1 and d2 should be derived from extra
, "add extra node");
ds->Remove(extra);
MITK_TEST_CONDITION(
(ds->GetNamedNode("extra") == NULL)
&& (ds->GetNamedNode("d1") == d1)
&& (ds->GetNamedNode("d2") == d2)
&& (refCountbeforeDS == watcher->GetReferenceCount())
&& (ds->GetSources(d1)->Size() == 0) // after remove, d1 should not have a source anymore
&& (ds->GetSources(d2)->Size() == 0) // after remove, d2 should not have a source anymore
, "Checking removal of a node with two derived nodes");
extra = NULL;
}
/* Checking removal of a node with two parents and two derived nodes */
{
mitk::DataNode::Pointer extra = mitk::DataNode::New();
extra->SetProperty("name", mitk::StringProperty::New("extra"));
mitk::ReferenceCountWatcher::Pointer watcher = new mitk::ReferenceCountWatcher(extra);
mitk::ReferenceCountWatcher::Pointer n1watcher = new mitk::ReferenceCountWatcher(n1);
int refCountbeforeDS = watcher->GetReferenceCount();
mitk::DataStorage::SetOfObjects::Pointer p = mitk::DataStorage::SetOfObjects::New();
p->push_back(n1);
p->push_back(n2);
ds->Add(extra, p); // n1 and n2 are parents of extra
mitk::DataNode::Pointer d1 = mitk::DataNode::New();
d1->SetProperty("name", mitk::StringProperty::New("d1x"));
ds->Add(d1, extra);
mitk::DataNode::Pointer d2 = mitk::DataNode::New();
d2->SetProperty("name", mitk::StringProperty::New("d2x"));
ds->Add(d2, extra);
MITK_TEST_CONDITION(
(ds->GetNamedNode("extra") == extra)
&& (ds->GetNamedNode("d1x") == d1)
&& (ds->GetNamedNode("d2x") == d2)
&& (ds->GetSources(d1)->Size() == 1) // extra should be source of d1
&& (ds->GetSources(d2)->Size() == 1) // extra should be source of d2
&& (ds->GetDerivations(n1)->Size() == 2) // n2 and extra should be derived from n1
&& (ds->GetDerivations(n2)->Size() == 3) // n3, n4 and extra should be derived from n2
&& (ds->GetDerivations(extra)->Size() == 2) // d1 and d2 should be derived from extra
, "add extra node");
ds->Remove(extra);
MITK_TEST_CONDITION(
(ds->GetNamedNode("extra") == NULL)
&& (ds->GetNamedNode("d1x") == d1)
&& (ds->GetNamedNode("d2x") == d2)
&& (refCountbeforeDS == watcher->GetReferenceCount())
&& (ds->GetDerivations(n1)->Size() == 1) // after remove, only n2 should be derived from n1
&& (ds->GetDerivations(n2)->Size() == 2) // after remove, only n3 and n4 should be derived from n2
&& (ds->GetSources(d1)->Size() == 0) // after remove, d1 should not have a source anymore
&& (ds->GetSources(d2)->Size() == 0) // after remove, d2 should not have a source anymore
, "Checking removal of a node with two parents and two derived nodes");
extra = NULL;
}
}
catch(...)
{
MITK_TEST_FAILED_MSG( << "Exeption during object removal methods");
}
/* Checking for node is it's own parent exception */
{
MITK_TEST_FOR_EXCEPTION_BEGIN(...);
mitk::DataNode::Pointer extra = mitk::DataNode::New();
extra->SetProperty("name", mitk::StringProperty::New("extra"));
mitk::DataStorage::SetOfObjects::Pointer p = mitk::DataStorage::SetOfObjects::New();
p->push_back(n1);
p->push_back(extra); // extra is parent of extra!!!
ds->Add(extra, p);
MITK_TEST_FOR_EXCEPTION_END(...);
}
/* Checking reference count of node after add and remove */
{
mitk::DataNode::Pointer extra = mitk::DataNode::New();
mitk::ReferenceCountWatcher::Pointer watcher = new mitk::ReferenceCountWatcher(extra);
extra->SetProperty("name", mitk::StringProperty::New("extra"));
mitk::DataStorage::SetOfObjects::Pointer p = mitk::DataStorage::SetOfObjects::New();
p->push_back(n1);
p->push_back(n3);
ds->Add(extra, p);
extra = NULL;
ds->Remove(ds->GetNamedNode("extra"));
MITK_TEST_CONDITION(watcher->GetReferenceCount() == 0, "Checking reference count of node after add and remove");
}
/* Checking removal of a node with two derived nodes [ dataStorage->GetDerivations( rootNode )] see bug #3426 */
{
mitk::DataNode::Pointer extra = mitk::DataNode::New();
extra->SetProperty("name", mitk::StringProperty::New("extra"));
ds->Add(extra);
mitk::DataNode::Pointer d1y = mitk::DataNode::New();
d1y->SetProperty("name", mitk::StringProperty::New("d1y"));
mitk::ReferenceCountWatcher::Pointer watcherD1y = new mitk::ReferenceCountWatcher(d1y);
int refCountbeforeDS = watcherD1y->GetReferenceCount();
ds->Add(d1y, extra);
mitk::DataNode::Pointer d2y = mitk::DataNode::New();
d2y->SetProperty("name", mitk::StringProperty::New("d2y"));
ds->Add(d2y, extra);
MITK_TEST_CONDITION(
(ds->GetNamedNode("extra") == extra)
&& (ds->GetNamedNode("d1y") == d1y)
&& (ds->GetNamedNode("d2y") == d2y)
&& (ds->GetSources(d1y)->Size() == 1) // extra should be source of d1y
&& (ds->GetSources(d2y)->Size() == 1) // extra should be source of d2y
&& (ds->GetDerivations(extra)->Size() == 2) // d1y and d2y should be derived from extra
, "add extra node");
ds->Remove(ds->GetDerivations( extra));
MITK_TEST_CONDITION(
(ds->GetNamedNode("extra") == extra)
&& (ds->GetNamedNode("d1y") == NULL) // d1y should be NULL now
&& (ds->GetNamedNode("d2y") == NULL) // d2y should be NULL now
&& (refCountbeforeDS == watcherD1y->GetReferenceCount())
, "Checking removal of subset of two derived nodes from one parent node");
ds->Remove(extra);
MITK_TEST_CONDITION(
(ds->GetNamedNode("extra") == NULL)
, "Checking removal of a parent node");
extra = NULL;
}
/* Checking GetGrouptags() */
{
const std::set<std::string> groupTags = ds->GetGroupTags();
MITK_TEST_CONDITION(
(groupTags.size() == 2)
&& (std::find(groupTags.begin(), groupTags.end(), "Resection Proposal 1") != groupTags.end())
&& (std::find(groupTags.begin(), groupTags.end(), "Resection Proposal 2") != groupTags.end())
, "Checking GetGrouptags()");
}
/* Checking Event handling */
DSEventReceiver listener;
try
{
ds->AddNodeEvent += mitk::MessageDelegate1<DSEventReceiver, const mitk::DataNode*>(&listener, &DSEventReceiver::OnAdd);
ds->RemoveNodeEvent += mitk::MessageDelegate1<DSEventReceiver, const mitk::DataNode*>(&listener, &DSEventReceiver::OnRemove);
mitk::DataNode::Pointer extra = mitk::DataNode::New();
mitk::ReferenceCountWatcher::Pointer watcher = new mitk::ReferenceCountWatcher(extra);
ds->Add(extra);
MITK_TEST_CONDITION(listener.m_NodeAdded == extra.GetPointer(), "Checking AddEvent");
ds->Remove(extra);
MITK_TEST_CONDITION(listener.m_NodeRemoved == extra.GetPointer(), "Checking RemoveEvent");
/* RemoveListener */
ds->AddNodeEvent -= mitk::MessageDelegate1<DSEventReceiver, const mitk::DataNode*>(&listener, &DSEventReceiver::OnAdd);
ds->RemoveNodeEvent -= mitk::MessageDelegate1<DSEventReceiver, const mitk::DataNode*>(&listener, &DSEventReceiver::OnRemove);
listener.m_NodeAdded = NULL;
listener.m_NodeRemoved = NULL;
ds->Add(extra);
ds->Remove(extra);
MITK_TEST_CONDITION((listener.m_NodeRemoved == NULL) && (listener.m_NodeAdded == NULL), "Checking RemoveListener");
std::cout << "Pointer handling after event handling: " << std::flush;
extra = NULL; // delete reference to the node. its memory should be freed now
MITK_TEST_CONDITION(watcher->GetReferenceCount() == 0, "Pointer handling after event handling");
}
catch(...)
{
/* cleanup */
ds->AddNodeEvent -= mitk::MessageDelegate1<DSEventReceiver, const mitk::DataNode*>(&listener, &DSEventReceiver::OnAdd);
ds->RemoveNodeEvent -= mitk::MessageDelegate1<DSEventReceiver, const mitk::DataNode*>(&listener, &DSEventReceiver::OnRemove);
MITK_TEST_FAILED_MSG( << "Exception during object removal methods");
}
//Checking ComputeBoundingGeometry3D method*/
const mitk::DataStorage::SetOfObjects::ConstPointer all = ds->GetAll();
mitk::TimeSlicedGeometry::Pointer geometry = ds->ComputeBoundingGeometry3D();
MITK_TEST_CONDITION(geometry->GetTimeSteps()==4, "Test for number or time steps with ComputeBoundingGeometry()");
mitk::TimeBounds timebounds = geometry->GetTimeBounds();
MITK_TEST_CONDITION((timebounds[0]==0)&&(timebounds[1]==4),"Test for timebounds with ComputeBoundingGeometry()");
for (unsigned int i=0; i<geometry->GetTimeSteps(); i++)
{
mitk::Geometry3D::Pointer subGeometry = geometry->GetGeometry3D(i);
mitk::TimeBounds bounds = subGeometry->GetTimeBounds();
MITK_TEST_CONDITION((bounds[0]==i)&&(bounds[1]==i+1),"Test for timebounds of geometry at different time steps with ComputeBoundingGeometry()");
}
geometry = ds->ComputeBoundingGeometry3D(all);
MITK_TEST_CONDITION(geometry->GetTimeSteps()==4, "Test for number or time steps with ComputeBoundingGeometry(allNodes)");
timebounds = geometry->GetTimeBounds();
MITK_TEST_CONDITION((timebounds[0]==0)&&(timebounds[1]==4),"Test for timebounds with ComputeBoundingGeometry(allNodes)");
for (unsigned int i=0; i<geometry->GetTimeSteps(); i++)
{
mitk::Geometry3D::Pointer subGeometry = geometry->GetGeometry3D(i);
mitk::TimeBounds bounds = subGeometry->GetTimeBounds();
MITK_TEST_CONDITION((bounds[0]==i)&&(bounds[1]==i+1),"Test for timebounds of geometry at different time steps with ComputeBoundingGeometry()");
}
// test for thread safety of DataStorage
try
{
mitk::StandaloneDataStorage::Pointer standaloneDataStorage
= mitk::StandaloneDataStorage::New();
ItkDeleteEventListener listener( standaloneDataStorage );
{
mitk::DataNode::Pointer emptyNode = mitk::DataNode::New();
mitk::DataNode* pEmptyNode = emptyNode;
listener.SetNode( emptyNode );
standaloneDataStorage->Add( emptyNode );
emptyNode = 0; // emptyNode is still alive because standaloneDataStorage
// owns it
standaloneDataStorage->Remove( pEmptyNode ); // this should not freeze the whole thing
}
}
catch(...)
{
MITK_TEST_FAILED_MSG( << "Exception during testing DataStorage thread safe");
}
/* Clear DataStorage */
ds->Remove(ds->GetAll());
MITK_TEST_CONDITION(ds->GetAll()->Size() == 0, "Checking Clear DataStorage");
}
diff --git a/Core/Code/Testing/mitkDicomSeriesReaderTest.cpp b/Core/Code/Testing/mitkDicomSeriesReaderTest.cpp
index 04c6994b4d..cd9a64e886 100644
--- a/Core/Code/Testing/mitkDicomSeriesReaderTest.cpp
+++ b/Core/Code/Testing/mitkDicomSeriesReaderTest.cpp
@@ -1,44 +1,163 @@
/*=========================================================================
Program: Medical Imaging & Interaction Toolkit
Language: C++
Date: $Date: 2008-02-25 17:27:17 +0100 (Mo, 25 Feb 2008) $
Version: $Revision: 7837 $
Copyright (c) German Cancer Research Center, Division of Medical and
Biological Informatics. All rights reserved.
See MITKCopyright.txt or http://www.mitk.org/copyright.html for details.
This software is distributed WITHOUT ANY WARRANTY; without even
the implied warranty of MERCHANTABILITY or FITNESS FOR A PARTICULAR
PURPOSE. See the above copyright notices for more information.
=========================================================================*/
#include "mitkTestingMacros.h"
#include <iostream>
#include "mitkDicomSeriesReader.h"
+#include "mitkProperties.h"
+static std::map<std::string, std::map<gdcm::Tag, std::string> > GetTagInformationFromFile(mitk::DicomSeriesReader::StringContainer files)
+{
+ gdcm::Scanner scanner;
+ std::map<std::string, std::map<gdcm::Tag, std::string> > tagInformations;
+
+ const gdcm::Tag tagSliceLocation(0x0020, 0x1041); // slice location
+ scanner.AddTag( tagSliceLocation );
+
+ const gdcm::Tag tagInstanceNumber(0x0020, 0x0013); // (image) instance number
+ scanner.AddTag( tagInstanceNumber );
+
+ const gdcm::Tag tagSOPInstanceNumber(0x0008, 0x0018); // SOP instance number
+ scanner.AddTag( tagSOPInstanceNumber );
+
+ //unsigned int slice(0);
+ scanner.Scan(files);
+
+// return const_cast<gdcm::Scanner::MappingType&>(scanner.GetMappings());
+ gdcm::Scanner::MappingType& tagValueMappings = const_cast<gdcm::Scanner::MappingType&>(scanner.GetMappings());
+
+ for(std::vector<std::string>::const_iterator fIter = files.begin();
+ fIter != files.end();
+ ++fIter)
+ {
+ std::map<gdcm::Tag, std::string> tags;
+ tags.insert(std::pair<gdcm::Tag, std::string> (tagSliceLocation, tagValueMappings[fIter->c_str()][tagSliceLocation]));
+ tags.insert(std::pair<gdcm::Tag, std::string> (tagInstanceNumber, tagValueMappings[fIter->c_str()][tagInstanceNumber]));
+ tags.insert(std::pair<gdcm::Tag, std::string> (tagSOPInstanceNumber, tagValueMappings[fIter->c_str()][tagSOPInstanceNumber]));
+
+ tagInformations.insert(std::pair<std::string, std::map<gdcm::Tag, std::string> > (fIter->c_str(), tags));
+ }
+
+ return tagInformations;
+}
+
int mitkDicomSeriesReaderTest(int argc, char* argv[])
{
// always start with this!
MITK_TEST_BEGIN("DicomSeriesReader")
- mitk::DicomSeriesReader::StringContainer files;
-
- for (int i = 1 ; i < argc ; i++ )
+ if(argc < 1)
{
- files.push_back(std::string(argv[i]));
+ MITK_ERROR << "No directory given!";
+ return -1;
}
- if (! files.empty() )
+
+ char* dir;
+ dir = argv[1];
+
+ //check if DICOMTags have been set as property for mitk::Image
+ mitk::DicomSeriesReader::UidFileNamesMap seriesInFiles = mitk::DicomSeriesReader::GetSeries( dir );
+ std::list<mitk::Image::Pointer> images;
+ std::map<mitk::Image::Pointer, mitk::DicomSeriesReader::StringContainer> fileMap;
+
+ // TODO sort series UIDs, implementation of map iterator might differ on different platforms (or verify this is a standard topic??)
+ for (mitk::DicomSeriesReader::UidFileNamesMap::const_iterator seriesIter = seriesInFiles.begin();
+ seriesIter != seriesInFiles.end();
+ ++seriesIter)
{
- for (int i = 0 ; i < 10 ; i++ ) {
- mitk::DataNode::Pointer node = mitk::DicomSeriesReader::LoadDicomSeries(files);
- MITK_TEST_CONDITION_REQUIRED(node.IsNotNull(),"Testing node")
+ mitk::DicomSeriesReader::StringContainer files = seriesIter->second;
+
+ mitk::DataNode::Pointer node = mitk::DicomSeriesReader::LoadDicomSeries( files );
+ MITK_TEST_CONDITION_REQUIRED(node.IsNotNull(),"Testing node")
+
+ if (node.IsNotNull())
+ {
+ mitk::Image::Pointer image = dynamic_cast<mitk::Image*>( node->GetData() );
+
+ images.push_back( image );
+ fileMap.insert( std::pair<mitk::Image::Pointer, mitk::DicomSeriesReader::StringContainer>(image,files));
+ }
}
+
+ //Test if DICOM tags have been added correctly to the mitk::image properties
+
+ const gdcm::Tag tagSliceLocation(0x0020, 0x1041); // slice location
+ const gdcm::Tag tagInstanceNumber(0x0020, 0x0013); // (image) instance number
+ const gdcm::Tag tagSOPInstanceNumber(0x0008, 0x0018); // SOP instance number
+
+ for ( std::list<mitk::Image::Pointer>::const_iterator imageIter = images.begin();
+ imageIter != images.end();
+ ++imageIter )
+ {
+ const mitk::Image::Pointer image = *imageIter;
+
+ //Get tag information for all dicom files of this image
+ std::map<std::string, std::map<gdcm::Tag, std::string> > tagInformations = GetTagInformationFromFile((*fileMap.find(image)).second);
+
+ mitk::StringLookupTableProperty* sliceLocation = dynamic_cast<mitk::StringLookupTableProperty*>(image->GetProperty("dicom.image.0020.1041").GetPointer());
+ mitk::StringLookupTableProperty* instanceNumber = dynamic_cast<mitk::StringLookupTableProperty*>(image->GetProperty("dicom.image.0020.0013").GetPointer());
+ mitk::StringLookupTableProperty* SOPInstnaceNumber = dynamic_cast<mitk::StringLookupTableProperty*>(image->GetProperty("dicom.image.0008.0018").GetPointer());
+
+ mitk::StringLookupTableProperty* files = dynamic_cast<mitk::StringLookupTableProperty*>(image->GetProperty("files").GetPointer());
+
+ MITK_TEST_CONDITION(sliceLocation != NULL, "Test if tag for slice location has been set to mitk image");
+ if(sliceLocation != NULL)
+ {
+ for(int i = 0; i < sliceLocation->GetValue().GetLookupTable().size(); i++)
+ {
+ if(i < files->GetValue().GetLookupTable().size())
+ {
+ MITK_INFO << "Table value: " << sliceLocation->GetValue().GetTableValue(i) << " and File value: " << tagInformations[files->GetValue().GetTableValue(i).c_str()][tagSliceLocation] << std::endl;
+ MITK_INFO << "Filename: " << files->GetValue().GetTableValue(i).c_str() << std::endl;
+ MITK_TEST_CONDITION(sliceLocation->GetValue().GetTableValue(i) == tagInformations[files->GetValue().GetTableValue(i).c_str()][tagSliceLocation], "Test if value for slice location is correct");
+ }
+ }
+ }
+
+ MITK_TEST_CONDITION(instanceNumber != NULL, "Test if tag for image instance number has been set to mitk image");
+ if(instanceNumber != NULL)
+ {
+ for(int i = 0; i < instanceNumber->GetValue().GetLookupTable().size(); i++)
+ {
+ if(i < files->GetValue().GetLookupTable().size())
+ {
+ MITK_INFO << "Table value: " << instanceNumber->GetValue().GetTableValue(i) << " and File value: " << tagInformations[files->GetValue().GetTableValue(i).c_str()][tagInstanceNumber] << std::endl;
+ MITK_INFO << "Filename: " << files->GetValue().GetTableValue(i).c_str() << std::endl;
+ MITK_TEST_CONDITION(instanceNumber->GetValue().GetTableValue(i) == tagInformations[files->GetValue().GetTableValue(i).c_str()][tagInstanceNumber], "Test if value for instance number is correct");
+ }
+ }
+ }
+
+ MITK_TEST_CONDITION(SOPInstnaceNumber != NULL, "Test if tag for SOP instance number has been set to mitk image");
+ if(SOPInstnaceNumber != NULL)
+ {
+ for(int i = 0; i < SOPInstnaceNumber->GetValue().GetLookupTable().size(); i++)
+ {
+ if(i < files->GetValue().GetLookupTable().size())
+ {
+ MITK_INFO << "Table value: " << instanceNumber->GetValue().GetTableValue(i) << " and File value: " << tagInformations[files->GetValue().GetTableValue(i).c_str()][tagSOPInstanceNumber] << std::endl;
+ MITK_INFO << "Filename: " << files->GetValue().GetTableValue(i).c_str() << std::endl;
+ MITK_TEST_CONDITION(SOPInstnaceNumber->GetValue().GetTableValue(i) == tagInformations[files->GetValue().GetTableValue(i).c_str()][tagSOPInstanceNumber], "Test if value for SOP instance number is correct");
+ }
+ }
+ }
}
MITK_TEST_END()
}
diff --git a/Core/Code/Testing/mitkImageToItkTest.cpp b/Core/Code/Testing/mitkImageToItkTest.cpp
index 5ac76c1c02..df403c3a1b 100644
--- a/Core/Code/Testing/mitkImageToItkTest.cpp
+++ b/Core/Code/Testing/mitkImageToItkTest.cpp
@@ -1,272 +1,271 @@
/*=========================================================================
Program: Medical Imaging & Interaction Toolkit
Language: C++
Date: $Date$
Version: $Revision$
Copyright (c) German Cancer Research Center, Division of Medical and
Biological Informatics. All rights reserved.
See MITKCopyright.txt or http://www.mitk.org/copyright.html for details.
This software is distributed WITHOUT ANY WARRANTY; without even
the implied warranty of MERCHANTABILITY or FITNESS FOR A PARTICULAR
PURPOSE. See the above copyright notices for more information.
=========================================================================*/
#include "mitkImage.h"
-#include "mitkImageAccessByItk.h"
#include "mitkITKImageImport.h"
#include "mitkReferenceCountWatcher.h"
#include "itkDiffusionTensor3D.h"
#include "itkConfidenceDiffusionTensor3D.h"
#include <mitkImageCast.h>
#include <fstream>
int compareGeometries(mitk::Geometry3D* geometry1, mitk::Geometry3D* geometry2)
{
std::cout << "Testing transfer of GetGeometry()->GetOrigin(): " << std::flush;
if(mitk::Equal(geometry1->GetOrigin(), geometry2->GetOrigin()) == false)
{
std::cout<<"[FAILED]"<<std::endl;
return EXIT_FAILURE;
}
std::cout<<"[PASSED]"<<std::endl;
std::cout << "Testing transfer of GetGeometry()->GetSpacing(): " << std::flush;
if(mitk::Equal(geometry1->GetSpacing(), geometry2->GetSpacing()) == false)
{
std::cout<<"[FAILED]"<<std::endl;
return EXIT_FAILURE;
}
std::cout<<"[PASSED]"<<std::endl;
int i;
for(i=0; i<3; ++i)
{
std::cout << "Testing transfer of GetGeometry()->GetAxisVector(" << i << "): " << std::flush;
if(mitk::Equal(geometry1->GetAxisVector(i), geometry2->GetAxisVector(i)) == false)
{
std::cout<<"[FAILED]"<<std::endl;
return EXIT_FAILURE;
}
std::cout<<"[PASSED]"<<std::endl;
}
return EXIT_SUCCESS;
}
template <class ImageType>
int testBackCasting(mitk::Image* imgMem, typename ImageType::Pointer & itkImage, bool disconnectAfterImport)
{
int result;
if(itkImage.IsNull())
{
std::cout<<"[FAILED]"<<std::endl;
return EXIT_FAILURE;
}
int *p = (int*)itkImage->GetBufferPointer();
if(p==NULL)
{
std::cout<<"[FAILED]"<<std::endl;
return EXIT_FAILURE;
}
std::cout<<"[PASSED]"<<std::endl;
std::cout << "Testing mitk::CastToMitkImage: " << std::flush;
mitk::Image::Pointer mitkImage = mitk::Image::New();
mitk::CastToMitkImage( itkImage, mitkImage );
std::cout<<"[PASSED]"<<std::endl;
result = compareGeometries(imgMem->GetGeometry(), mitkImage->GetGeometry());
if(result != EXIT_SUCCESS)
return result;
std::cout << "Testing whether data after mitk::CastToMitkImage is available: " << std::flush;
if(mitkImage->IsChannelSet()==false)
{
std::cout<<"[FAILED]"<<std::endl;
return EXIT_FAILURE;
}
std::cout<<"[PASSED]"<<std::endl;
std::cout << "Testing mitk::ImportItkImage: " << std::flush;
mitkImage = mitk::ImportItkImage(itkImage);
std::cout<<"[PASSED]"<<std::endl;
if(disconnectAfterImport)
{
std::cout << "Testing DisconnectPipeline() on mitk::Image into which was imported : " << std::flush;
mitkImage->DisconnectPipeline();
std::cout<<"[PASSED]"<<std::endl;
}
result = compareGeometries(imgMem->GetGeometry(), mitkImage->GetGeometry());
if(result != EXIT_SUCCESS)
return result;
std::cout << "Testing whether data after mitk::ImportItkImage is available: " << std::flush;
if(mitkImage->IsChannelSet()==false)
{
std::cout<<"[FAILED]"<<std::endl;
return EXIT_FAILURE;
}
std::cout<<"[PASSED]"<<std::endl;
return EXIT_SUCCESS;
}
template <unsigned int dim>
int testImageToItkAndBack(mitk::Image* imgMem)
{
int result;
int *p = (int*)imgMem->GetData();
if(p==NULL)
{
std::cout<<"[FAILED]"<<std::endl;
return EXIT_FAILURE;
}
std::cout<<"[PASSED]"<<std::endl;
std::cout << "Testing for dimension " << dim << ": " << std::flush;
std::cout << "Testing mitk::ImageToItk: " << std::flush;
typedef itk::Image<int,dim> ImageType;
typename mitk::ImageToItk<ImageType>::Pointer toItkFilter = mitk::ImageToItk<ImageType>::New();
toItkFilter->SetInput(imgMem);
toItkFilter->Update();
typename ImageType::Pointer itkImage = toItkFilter->GetOutput();
result = testBackCasting<ImageType>(imgMem, itkImage, false);
if(result != EXIT_SUCCESS)
return result;
std::cout << "Testing mitk::ImageToItk (with subsequent DisconnectPipeline, see below): " << std::flush;
result = testBackCasting<ImageType>(imgMem, itkImage, true);
if(result != EXIT_SUCCESS)
return result;
return EXIT_SUCCESS;
}
int mitkImageToItkTest(int /*argc*/, char* /*argv*/[])
{
int result;
//Create Image out of nowhere
mitk::Image::Pointer imgMem;
mitk::PixelType pt(typeid(int));
std::cout << "Testing creation of Image: ";
imgMem=mitk::Image::New();
if(imgMem.IsNull())
{
std::cout<<"[FAILED]"<<std::endl;
return EXIT_FAILURE;
}
std::cout<<"[PASSED]"<<std::endl;
// geometry information for image
mitk::Point3D origin;
mitk::Vector3D right, bottom;
mitk::Vector3D spacing;
mitk::FillVector3D(origin, 17.0, 19.92, 7.83);
mitk::FillVector3D(right, 1.0, 2.0, 3.0);
mitk::FillVector3D(bottom, 0.0, -3.0, 2.0);
mitk::FillVector3D(spacing, 0.78, 0.91, 2.23);
std::cout << "Testing InitializeStandardPlane(rightVector, downVector, spacing): " << std::flush;
mitk::PlaneGeometry::Pointer planegeometry = mitk::PlaneGeometry::New();
planegeometry->InitializeStandardPlane(100, 100, right, bottom, &spacing);
planegeometry->SetOrigin(origin);
std::cout << "done" << std::endl;
std::cout << "Testing Initialize(const mitk::PixelType& type, int sDim, const mitk::PlaneGeometry& geometry) and GetData(): ";
imgMem->Initialize(mitk::PixelType(typeid(int)), 40, *planegeometry); //XXXXXXXXXXXXXXXXXXXXXCHANGE!
result = testImageToItkAndBack<3>(imgMem);
if(result != EXIT_SUCCESS)
return result;
std::cout << "Testing mitk::CastToItkImage with casting (mitk int to itk float): " << std::flush;
typedef itk::Image<float,3> ImageType;
ImageType::Pointer itkImage;
mitk::CastToItkImage( imgMem, itkImage );
result = testBackCasting<ImageType>(imgMem, itkImage, false);
if(result != EXIT_SUCCESS)
return result;
result = testBackCasting<ImageType>(imgMem, itkImage, true);
if(result != EXIT_SUCCESS)
return result;
std::cout << "Testing Initialize(const mitk::PixelType& type, int sDim, const mitk::PlaneGeometry& geometry) and GetData(): ";
imgMem->Initialize(mitk::PixelType(typeid(int)), 40, *planegeometry, false, 1, 6);
result = testImageToItkAndBack<4>(imgMem);
if(result != EXIT_SUCCESS)
return result;
std::cout << "Testing mitk::CastToItkImage again (mitk float to itk float): " << std::flush;
imgMem->Initialize(mitk::PixelType(typeid(float)), 40, *planegeometry);
mitk::CastToItkImage( imgMem, itkImage );
std::cout<<"[PASSED]"<<std::endl;
mitk::ImageDataItem::Pointer imageDataItem = imgMem->GetChannelData().GetPointer();
std::cout << "Testing destruction of original mitk::Image: " << std::flush;
imgMem = NULL;
std::cout<<"[PASSED]"<<std::endl;
std::cout << "Testing reference count mitk::ImageDataItem, which is responsible for the memory still used within the itk::Image: " << std::flush;
if(imageDataItem->GetReferenceCount()-1 != 1) // 1 count by imageDataItem itself
{
std::cout<< imageDataItem->GetReferenceCount()-1 << " != 1. [FAILED]" << std::endl;
return EXIT_FAILURE;
}
std::cout<<"[PASSED]"<<std::endl;
std::cout << "Testing destruction of itk::Image: " << std::flush;
itkImage = NULL;
std::cout<<"[PASSED]"<<std::endl;
std::cout << "Testing reference count mitk::ImageDataItem, which should now have been freed by itk::Image: " << std::flush;
if(imageDataItem->GetReferenceCount()-1 != 0) // 1 count by imageDataItem itself
{
std::cout<< imageDataItem->GetReferenceCount()-1 << " != 0. [FAILED]" << std::endl;
return EXIT_FAILURE;
}
std::cout<<"[PASSED]"<<std::endl;
imgMem=mitk::Image::New();
itk::Image<itk::DiffusionTensor3D<float>,3>::Pointer diffImage;
imgMem->Initialize(mitk::PixelType(typeid(itk::DiffusionTensor3D<float>)), 40, *planegeometry);
mitk::CastToItkImage( imgMem, diffImage );
imgMem->InitializeByItk(diffImage.GetPointer());
std::cout<<"[PASSED]"<<std::endl;
itk::Image<itk::DiffusionTensor3D<double>,3>::Pointer diffImage2;
imgMem->Initialize(mitk::PixelType(typeid(itk::DiffusionTensor3D<double>)), 40, *planegeometry);
mitk::CastToItkImage( imgMem, diffImage2 );
imgMem->InitializeByItk(diffImage2.GetPointer());
std::cout<<"[PASSED]"<<std::endl;
itk::Image<itk::ConfidenceDiffusionTensor3D<float>,3>::Pointer confDiffImage;
imgMem->Initialize(mitk::PixelType(typeid(itk::ConfidenceDiffusionTensor3D<float>)), 40, *planegeometry);
mitk::CastToItkImage( imgMem, confDiffImage );
imgMem->InitializeByItk(confDiffImage.GetPointer());
std::cout<<"[PASSED]"<<std::endl;
itk::Image<itk::ConfidenceDiffusionTensor3D<double>,3>::Pointer confDiffImage2;
imgMem->Initialize(mitk::PixelType(typeid(itk::ConfidenceDiffusionTensor3D<double>)), 40, *planegeometry);
mitk::CastToItkImage( imgMem, confDiffImage2 );
imgMem->InitializeByItk(confDiffImage2.GetPointer());
std::cout<<"[PASSED]"<<std::endl;
std::cout<<"[TEST DONE]"<<std::endl;
return EXIT_SUCCESS;
}
diff --git a/Core/Code/Testing/mitkInstantiateAccessFunctionTest.cpp b/Core/Code/Testing/mitkInstantiateAccessFunctionTest.cpp
new file mode 100644
index 0000000000..f3a4546cb9
--- /dev/null
+++ b/Core/Code/Testing/mitkInstantiateAccessFunctionTest.cpp
@@ -0,0 +1,50 @@
+/*=========================================================================
+
+Program: Medical Imaging & Interaction Toolkit
+Language: C++
+Date: $Date$
+Version: $Revision: 17495 $
+
+Copyright (c) German Cancer Research Center, Division of Medical and
+Biological Informatics. All rights reserved.
+See MITKCopyright.txt or http://www.mitk.org/copyright.html for details.
+
+This software is distributed WITHOUT ANY WARRANTY; without even
+the implied warranty of MERCHANTABILITY or FITNESS FOR A PARTICULAR
+PURPOSE. See the above copyright notices for more information.
+
+=========================================================================*/
+
+
+#include "mitkTestingMacros.h"
+
+#include <mitkInstantiateAccessFunctions.h>
+
+// This is a "compile test", meaning that this file calls all InstantiateAccessFunction macros
+// and must successfully compile.
+class InstantiateAccessFunctionTest
+{
+public:
+
+ template<typename TPixel, unsigned int VDimension>
+ void AccessItkImage(itk::Image<TPixel, VDimension>*, int)
+ { }
+
+};
+
+#define InstantiateAccessFunction_AccessItkImage(Pixel, Dim) \
+ template void InstantiateAccessFunctionTest::AccessItkImage(itk::Image<Pixel, Dim>*, int);
+
+InstantiateAccessFunctionForFixedPixelType(AccessItkImage, (float)(double))
+InstantiateAccessFunctionForIntegralPixelTypes(AccessItkImage)
+
+int mitkInstantiateAccessFunctionTest(int /*argc*/, char* /*argv*/[])
+{
+
+ MITK_TEST_BEGIN("InstantiateAccessFunction")
+
+ MITK_TEST_OUTPUT(<< "Successfully compiled")
+
+ MITK_TEST_END()
+
+}
diff --git a/Core/Code/Testing/mitkPicFileWriterTest.cpp b/Core/Code/Testing/mitkPicFileWriterTest.cpp
index 8fc6244a9c..c526be2809 100644
--- a/Core/Code/Testing/mitkPicFileWriterTest.cpp
+++ b/Core/Code/Testing/mitkPicFileWriterTest.cpp
@@ -1,113 +1,113 @@
/*=========================================================================
Program: Medical Imaging & Interaction Toolkit
Language: C++
Date: $Date$
Version: $Revision: 7837 $
Copyright (c) German Cancer Research Center, Division of Medical and
Biological Informatics. All rights reserved.
See MITKCopyright.txt or http://www.mitk.org/copyright.html for details.
This software is distributed WITHOUT ANY WARRANTY; without even
the implied warranty of MERCHANTABILITY or FITNESS FOR A PARTICULAR
PURPOSE. See the above copyright notices for more information.
=========================================================================*/
#include "mitkPicFileWriter.h"
#include "mitkDataNodeFactory.h"
#include "mitkTestingMacros.h"
/**
* Simple example for a test for the (non-existent) class "PicFileWriter".
*
* argc and argv are the command line parameters which were passed to
* the ADD_TEST command in the CMakeLists.txt file. For the automatic
* tests, argv is either empty for the simple tests or contains the filename
* of a test image for the image tests (see CMakeLists.txt).
*/
int mitkPicFileWriterTest(int argc , char* argv[])
{
// always start with this!
MITK_TEST_BEGIN("PicFileWriter")
// let's create an object of our class
mitk::PicFileWriter::Pointer myPicFileWriter = mitk::PicFileWriter::New();
// first test: did this work?
// using MITK_TEST_CONDITION_REQUIRED makes the test stop after failure, since
// it makes no sense to continue without an object.
MITK_TEST_CONDITION_REQUIRED(myPicFileWriter.IsNotNull(),"Testing instantiation")
// load image
std::cout << "Loading file: " << std::flush;
if(argc==0)
{
std::cout<<"no file specified [FAILED]"<<std::endl;
return EXIT_FAILURE;
}
mitk::Image::Pointer image = NULL;
try{
// test for exception handling of NULL image
std::cout << "Testing handling of NULL image " << std::flush;
MITK_TEST_FOR_EXCEPTION_BEGIN(itk::ExceptionObject)
- myPicFileWriter->SetInput(image);
+ myPicFileWriter->SetInputImage(image);
myPicFileWriter->SetFileName("/usr/bin");
myPicFileWriter->Update();
MITK_TEST_FOR_EXCEPTION_END(itk::ExceptionObject)
}
catch(...) {
std::cout << "Success: Writer warns on NULL image." << std::endl;
}
mitk::DataNodeFactory::Pointer factory = mitk::DataNodeFactory::New();
try
{
std::cout<<argv[1]<<std::endl;
factory->SetFileName( argv[1] );
factory->Update();
if(factory->GetNumberOfOutputs()<1)
{
std::cout<<"file could not be loaded [FAILED]"<<std::endl;
return EXIT_FAILURE;
}
mitk::DataNode::Pointer node = factory->GetOutput( 0 );
image = dynamic_cast<mitk::Image*>(node->GetData());
if(image.IsNull())
{
std::cout<<"file "<< argv[1]<< "is not an image - test will not be applied [PASSED]"<<std::endl;
std::cout<<"[TEST DONE]"<<std::endl;
return EXIT_SUCCESS;
}
}
catch ( itk::ExceptionObject & ex )
{
std::cout << "Exception: " << ex << "[FAILED]" << std::endl;
return EXIT_FAILURE;
}
MITK_TEST_CONDITION_REQUIRED(image.IsNotNull(),"loaded image not NULL")
try{
// test for exception handling
MITK_TEST_FOR_EXCEPTION_BEGIN(itk::ExceptionObject)
- myPicFileWriter->SetInput(image);
+ myPicFileWriter->SetInputImage(image);
myPicFileWriter->SetFileName("/usr/bin");
myPicFileWriter->Update();
MITK_TEST_FOR_EXCEPTION_END(itk::ExceptionObject)
}
catch(...) {
//this means that a wrong exception (i.e. no itk:Exception) has been thrown
std::cout << "Wrong exception (i.e. no itk:Exception) caught during write [FAILED]" << std::endl;
return EXIT_FAILURE;
}
// always end with this!
MITK_TEST_END()
}
diff --git a/Core/Code/Testing/mitkPointSetTest.cpp b/Core/Code/Testing/mitkPointSetTest.cpp
index cf37b04ecb..d812b356d5 100644
--- a/Core/Code/Testing/mitkPointSetTest.cpp
+++ b/Core/Code/Testing/mitkPointSetTest.cpp
@@ -1,610 +1,610 @@
/*=========================================================================
Program: Medical Imaging & Interaction Toolkit
Language: C++
Date: $Date$
Version: $Revision$
Copyright (c) German Cancer Research Center, Division of Medical and
Biological Informatics. All rights reserved.
See MITKCopyright.txt or http://www.mitk.org/copyright.html for details.
This software is distributed WITHOUT ANY WARRANTY; without even
the implied warranty of MERCHANTABILITY or FITNESS FOR A PARTICULAR
PURPOSE. See the above copyright notices for more information.
=========================================================================*/
#include "mitkTestingMacros.h"
#include <mitkPointSet.h>
#include <mitkVector.h>
#include <mitkPointOperation.h>
#include <mitkInteractionConst.h>
#include <fstream>
class mitkPointSetTestClass { public:
static void TestGetITKPointSet(mitk::PointSet *pointSet)
{
//try to get the itkPointSet
mitk::PointSet::DataType::Pointer itkdata = NULL;
itkdata = pointSet->GetPointSet();
MITK_TEST_CONDITION( itkdata.IsNotNull(), "try to get the itkPointSet from a newly created PointSet" )
}
static void TestGetSizeIsZero(mitk::PointSet *pointSet)
{
//fresh PointSet has to be empty!
MITK_TEST_CONDITION( pointSet->GetSize() == 0, "check if the PointSet size is 0 " )
}
static void TestIsEmpty(mitk::PointSet *pointSet)
{
- MITK_TEST_CONDITION(pointSet->IsEmpty(0), "check if the PointSet is empty" )
+ MITK_TEST_CONDITION(pointSet->IsEmptyTimeStep(0), "check if the PointSet is empty" )
}
static void TestCreateOperationAndAddPoint(mitk::PointSet *pointSet)
{
int id = 0;
mitk::Point3D point;
point.Fill(1);
mitk::PointOperation* doOp = new mitk::PointOperation(mitk::OpINSERT, point, id);
pointSet->ExecuteOperation(doOp);
MITK_TEST_CONDITION( pointSet->GetSize()==1 && pointSet->IndexExists(id), "check if added points exists" )
delete doOp;
mitk::Point3D tempPoint;
tempPoint.Fill(0);
tempPoint = pointSet->GetPoint(id);
MITK_TEST_CONDITION( point == tempPoint, "check if added point contains real value" )
}
static void TestAddSecondPoint(mitk::PointSet *pointSet)
{
//add a point directly
int id=0;
mitk::Point3D point;
mitk::FillVector3D(point, 1.0, 2.0, 3.0);
++id;
pointSet->GetPointSet()->GetPoints()->InsertElement(id, point);
MITK_TEST_CONDITION( pointSet->GetSize()==2 ||pointSet->IndexExists(id), "check if added points exists" )
mitk::Point3D tempPoint;
tempPoint.Fill(0);
tempPoint = pointSet->GetPoint(id);
MITK_TEST_CONDITION( point == tempPoint, "check if added point contains real value" )
}
static void TestIsNotEmpty(mitk::PointSet *pointSet)
{
//PointSet can not be empty!
- MITK_TEST_CONDITION( !pointSet->IsEmpty(0), "check if the PointSet is not empty " )
+ MITK_TEST_CONDITION( !pointSet->IsEmptyTimeStep(0), "check if the PointSet is not empty " )
/*
std::cout << "check if the PointSet is not empty ";
if (pointSet->IsEmpty(0))
{
std::cout<<"[FAILED]"<<std::endl;
return EXIT_FAILURE;
}
std::cout<<"[PASSED]"<<std::endl;
*/
}
static void TestSwapPointPositionUpwards(mitk::PointSet *pointSet)
{
//Check SwapPointPosition upwards
mitk::Point3D point;
mitk::Point3D tempPoint;
point = pointSet->GetPoint(1);
pointSet->SwapPointPosition(1, true);
tempPoint = pointSet->GetPoint(0);
MITK_TEST_CONDITION( point == tempPoint, "check SwapPointPosition upwards" )
/*
if(point != tempPoint)
{
std::cout<<"[FAILED]"<<std::endl;
return EXIT_FAILURE;
}
std::cout<<"[PASSED]"<<std::endl;
*/
}
static void TestSwapPointPositionUpwardsNotPossible(mitk::PointSet *pointSet)
{
//Check SwapPointPosition upwards not possible
MITK_TEST_CONDITION( pointSet->SwapPointPosition(0, true)==false, "check SwapPointPosition upwards not possible" )
/*
if(pointSet->SwapPointPosition(0, true))
{
std::cout<<"[FAILED]"<<std::endl;
return EXIT_FAILURE;
}
std::cout<<"[PASSED]"<<std::endl;
*/
}
static void TestSwapPointPositionDownwards(mitk::PointSet *pointSet)
{
//Check SwapPointPosition downwards
mitk::Point3D point;
mitk::Point3D tempPoint;
point = pointSet->GetPoint(0);
pointSet->SwapPointPosition(0, false);
tempPoint = pointSet->GetPoint(1);
MITK_TEST_CONDITION( point == tempPoint, "check SwapPointPosition down" )
/*
if(point != tempPoint)
{
std::cout<<"[FAILED]"<<std::endl;
return EXIT_FAILURE;
}
std::cout<<"[PASSED]"<<std::endl;
*/
}
static void TestSwapPointPositionDownwardsNotPossible(mitk::PointSet * /*pointSet*/)
{
mitk::PointSet::Pointer pointSet2 = mitk::PointSet::New();
int id = 0;
mitk::Point3D point;
point.Fill(1);
pointSet2->SetPoint(id, point);
//Check SwapPointPosition downwards not possible
MITK_TEST_CONDITION(!pointSet2->SwapPointPosition(id, false), "check SwapPointPosition downwards not possible" )
/*
if(pointSet->SwapPointPosition(1, false))
{
std::cout<<"[FAILED]"<<std::endl;
return EXIT_FAILURE;
}
std::cout<<"[PASSED]"<<std::endl;
*/
}
static void TestPointOperationOpMove(mitk::PointSet *pointSet)
{
//check opMOVE ExecuteOperation
int id=1;
mitk::Point3D point1;
mitk::Point3D tempPoint;
point1.Fill(2);
mitk::PointOperation* doOp = new mitk::PointOperation(mitk::OpMOVE, point1, id);
pointSet->ExecuteOperation(doOp);
tempPoint = pointSet->GetPoint(id);
MITK_TEST_CONDITION(tempPoint == point1 , "check PointOperation OpMove " )
delete doOp;
/*
if (tempPoint != point1)
{
std::cout<<"[FAILED]"<<std::endl;
return EXIT_FAILURE;
}
delete doOp;
std::cout<<"[PASSED]"<<std::endl;
*/
}
static void TestPointOperationOpRemove(mitk::PointSet *pointSet)
{
//check OpREMOVE ExecuteOperation
int id=0;
mitk::Point3D point;
mitk::Point3D tempPoint;
point = pointSet->GetPoint(id);
mitk::PointOperation* doOp = new mitk::PointOperation(mitk::OpREMOVE, point, id);
pointSet->ExecuteOperation(doOp);
tempPoint = pointSet->GetPoint(id);
MITK_TEST_CONDITION(!pointSet->IndexExists(id) , "check PointOperation OpREMOVE " )
delete doOp;
/*
if(pointSet->IndexExists(id))
{
std::cout<<"[FAILED]"<<std::endl;
return EXIT_FAILURE;
}
delete doOp;
std::cout<<"[PASSED]"<<std::endl;
*/
}
static void TestPointOperationOpSelectPoint(mitk::PointSet *pointSet)
{
mitk::Point3D point4;
//check OpSELECTPOINT ExecuteOperation
mitk::PointOperation* doOp = new mitk::PointOperation(mitk::OpSELECTPOINT, point4,4);
pointSet->ExecuteOperation(doOp);
MITK_TEST_CONDITION(pointSet->GetSelectInfo(4) , "check PointOperation OpSELECTPOINT " )
delete doOp;
/*
if (!pointSet->GetSelectInfo(4))
{
std::cout<<"[FAILED]"<<std::endl;
return EXIT_FAILURE;
}
delete doOp;
std::cout<<"[PASSED]"<<std::endl;
*/
}
static void TestGetNumberOfSelected(mitk::PointSet *pointSet)
{
// check GetNumeberOfSelected
MITK_TEST_CONDITION(pointSet->GetNumberOfSelected() == 1 , "check GetNumeberOfSelected " )
/*
if(pointSet->GetNumberOfSelected() != 1)
{
std::cout<<"[FAILED]"<<std::endl;
return EXIT_FAILURE;
}
std::cout<<"[PASSED]"<<std::endl;
*/
}
static void TestSearchSelectedPoint(mitk::PointSet *pointSet)
{
// check SearchSelectedPoint
MITK_TEST_CONDITION(pointSet->SearchSelectedPoint() == 4 , "check SearchSelectedPoint " )
/*
if( pointSet->SearchSelectedPoint() != 4)
{
std::cout<<"[FAILED]"<<std::endl;
return EXIT_FAILURE;
}
std::cout<<"[PASSED]"<<std::endl;
*/
}
static void TestOpDeselectPoint(mitk::PointSet *pointSet)
{
//check OpDESELECTPOINT ExecuteOperation
mitk::Point3D point4;
mitk::PointOperation* doOp = new mitk::PointOperation(mitk::OpDESELECTPOINT, point4,4);
pointSet->ExecuteOperation(doOp);
MITK_TEST_CONDITION(!pointSet->GetSelectInfo(4) , "check PointOperation OpDESELECTPOINT " )
MITK_TEST_CONDITION(pointSet->GetNumberOfSelected() == 0 , "check GetNumeberOfSelected " )
delete doOp;
/*
if (pointSet->GetSelectInfo(4))
{
std::cout<<"[FAILED]"<<std::endl;
return EXIT_FAILURE;
}
delete doOp;
std::cout<<"[PASSED]"<<std::endl;
if(pointSet->GetNumberOfSelected() != 0)
{
std::cout<<"[FAILED]"<<std::endl;
return EXIT_FAILURE;
}
std::cout<<"[PASSED]"<<std::endl;
*/
}
static void TestOpMovePointUp(mitk::PointSet *pointSet)
{
//check OpMOVEPOINTUP ExecuteOperation
int id = 4;
mitk::Point3D point4;
mitk::Point3D point;
mitk::Point3D tempPoint;
point = pointSet->GetPoint(id);
mitk::PointOperation* doOp = new mitk::PointOperation(mitk::OpMOVEPOINTUP, point4, id);
pointSet->ExecuteOperation(doOp);
tempPoint = pointSet->GetPoint(id-1);
MITK_TEST_CONDITION(tempPoint == point , "check PointOperation OpMOVEPOINTUP " )
delete doOp;
/*
if (tempPoint != point)
{
std::cout<<"[FAILED]"<<std::endl;
return EXIT_FAILURE;
}
delete doOp;
std::cout<<"[PASSED]"<<std::endl;
*/
}
static void TestOpMovePointDown(mitk::PointSet *pointSet)
{
//check OpMOVEPOINTDown ExecuteOperation
int id = 2;
mitk::Point3D point;
mitk::Point3D point2;
mitk::Point3D tempPoint;
point = pointSet->GetPoint(id);
mitk::PointOperation* doOp = new mitk::PointOperation(mitk::OpMOVEPOINTDOWN, point2, id);
pointSet->ExecuteOperation(doOp);
tempPoint = pointSet->GetPoint(id+1);
MITK_TEST_CONDITION(tempPoint == point , "check PointOperation OpMOVEPOINTDOWN " )
delete doOp;
/*
if (tempPoint != point)
{
std::cout<<"[FAILED]"<<std::endl;
return EXIT_FAILURE;
}
std::cout<<"[PASSED]"<<std::endl;
*/
}
static void TestSetSelectInfo(mitk::PointSet *pointSet)
{
//check SetSelectInfo
pointSet->SetSelectInfo(2, true);
MITK_TEST_CONDITION(pointSet->GetSelectInfo(2) , "check SetSelectInfo" )
/*
if (!pointSet->GetSelectInfo(2))
{
std::cout<<"[FAILED]"<<std::endl;
return EXIT_FAILURE;
}
delete doOp;
std::cout<<"[PASSED]"<<std::endl;
*/
}
static void TestInsertPointWithPointSpecification(mitk::PointSet *pointSet)
{
//check InsertPoint with PointSpecification
mitk::Point3D point5;
mitk::Point3D tempPoint;
point5.Fill(7);
pointSet->SetPoint(5, point5, mitk::PTEDGE );
tempPoint = pointSet->GetPoint(5);
MITK_TEST_CONDITION(tempPoint == point5, "check InsertPoint with PointSpecification" )
/*
if (tempPoint != point5)
{
std::cout<<"[FAILED]"<<std::endl;
return EXIT_FAILURE;
}
std::cout<<"[PASSED]"<<std::endl;
*/
}
static void TestGetPointIfExists(mitk::PointSet *pointSet)
{
//check GetPointIfExists
mitk::Point3D point5;
mitk::Point3D tempPoint;
point5.Fill(7);
mitk::PointSet::PointType tmpPoint;
pointSet->GetPointIfExists(5, &tmpPoint);
MITK_TEST_CONDITION(tmpPoint == point5, "check GetPointIfExists: " )
/*
if (tmpPoint != point5)
{
std::cout<<"[FAILED]"<<std::endl;
return EXIT_FAILURE;
}
std::cout<<"[PASSED]"<<std::endl;
*/
}
static void TestCreateHoleInThePointIDs(mitk::PointSet *pointSet)
{
// create a hole in the point IDs
mitk::Point3D point;
mitk::PointSet::PointType p10, p11, p12;
p10.Fill(10.0);
p11.Fill(11.0);
p12.Fill(12.0);
pointSet->InsertPoint(10, p10);
pointSet->InsertPoint(11, p11);
pointSet->InsertPoint(12, p12);
MITK_TEST_CONDITION((pointSet->IndexExists(10) == true) || (pointSet->IndexExists(11) == true) || (pointSet->IndexExists(12) == true), "add points with id 10, 11, 12: " )
//check OpREMOVE ExecuteOperation
int id = 11;
mitk::PointOperation* doOp = new mitk::PointOperation(mitk::OpREMOVE, point, id);
pointSet->ExecuteOperation(doOp);
MITK_TEST_CONDITION(!pointSet->IndexExists(id), "remove point id 11: ")
/*
if(pointSet->IndexExists(id))
{
std::cout<<"[FAILED]"<<std::endl;
return EXIT_FAILURE;
}
delete doOp;
std::cout<<"[PASSED]"<<std::endl;
*/
//mitk::PointOperation* doOp = new mitk::PointOperation(mitk::OpMOVEPOINTUP, p12, 12);
//pointSet->ExecuteOperation(doOp);
delete doOp;
//check OpMOVEPOINTUP ExecuteOperation
doOp = new mitk::PointOperation(mitk::OpMOVEPOINTUP, p12, 12);
pointSet->ExecuteOperation(doOp);
delete doOp;
mitk::PointSet::PointType newP10 = pointSet->GetPoint(10);
mitk::PointSet::PointType newP12 = pointSet->GetPoint(12);
MITK_TEST_CONDITION(((newP10 == p12) && (newP12 == p10)) == true, "check PointOperation OpMOVEPOINTUP for point id 12:" )
//check OpMOVEPOINTDOWN ExecuteOperation
doOp = new mitk::PointOperation(mitk::OpMOVEPOINTDOWN, p10, 10);
pointSet->ExecuteOperation(doOp);
delete doOp;
newP10 = pointSet->GetPoint(10);
newP12 = pointSet->GetPoint(12);
MITK_TEST_CONDITION(((newP10 == p10) && (newP12 == p12)) == true, "check PointOperation OpMOVEPOINTDOWN for point id 10: ")
}
static void TestOpMovePointUpOnFirstPoint(mitk::PointSet *pointSet)
{
//check OpMOVEPOINTUP on first point ExecuteOperation
mitk::PointSet::PointType p1 = pointSet->GetPoint(1);
mitk::PointSet::PointType p2 = pointSet->GetPoint(2);
mitk::PointOperation* doOp = new mitk::PointOperation(mitk::OpMOVEPOINTUP, p1, 1);
pointSet->ExecuteOperation(doOp);
delete doOp;
mitk::PointSet::PointType newP1 = pointSet->GetPoint(1);
mitk::PointSet::PointType newP2 = pointSet->GetPoint(2);
MITK_TEST_CONDITION(((newP1 == p1) && (newP2 == p2)) == true, "check PointOperation OpMOVEPOINTUP for point id 1: ")
/*
if (((newP1 == p1) && (newP2 == p2)) == false)
{
std::cout<<"[FAILED]"<<std::endl;
return EXIT_FAILURE;
}
std::cout<<"[PASSED]"<<std::endl;
*/
}
static void TestPointContainerPointDataContainer(mitk::PointSet* ps)
{
mitk::PointSet::PointsContainer* pc = ps->GetPointSet()->GetPoints();
mitk::PointSet::PointDataContainer* pd = ps->GetPointSet()->GetPointData();
MITK_TEST_CONDITION_REQUIRED(pc->Size() == pd->Size(), "PointContainer and PointDataContainer have same size");
mitk::PointSet::PointsContainer::ConstIterator pIt = pc->Begin();
mitk::PointSet::PointDataContainer::ConstIterator dIt = pd->Begin();
bool failed = false;
for (; pIt != pc->End(); ++pIt, ++dIt)
if (pIt->Index() != dIt->Index())
{
failed = true;
break;
}
MITK_TEST_CONDITION(failed == false, "Indices in PointContainer and PointDataContainer are equal");
}
};
int mitkPointSetTest(int /*argc*/, char* /*argv*/[])
{
MITK_TEST_BEGIN("PointSet")
//Create PointSet
mitk::PointSet::Pointer pointSet = mitk::PointSet::New();
MITK_TEST_CONDITION_REQUIRED(pointSet.IsNotNull(),"Testing instantiation")
mitkPointSetTestClass::TestGetITKPointSet(pointSet);
mitkPointSetTestClass::TestGetSizeIsZero(pointSet);
mitkPointSetTestClass::TestIsEmpty(pointSet);
mitkPointSetTestClass::TestCreateOperationAndAddPoint(pointSet);
mitk::Point3D point2, point3, point4;
point2.Fill(3);
point3.Fill(4);
point4.Fill(5);
pointSet->InsertPoint(2,point2);
pointSet->InsertPoint(3,point3);
pointSet->InsertPoint(4,point4);
mitkPointSetTestClass::TestAddSecondPoint(pointSet);
mitkPointSetTestClass::TestIsNotEmpty(pointSet);
mitkPointSetTestClass::TestSwapPointPositionUpwards(pointSet);
mitkPointSetTestClass::TestSwapPointPositionUpwardsNotPossible(pointSet);
mitkPointSetTestClass::TestSwapPointPositionDownwards(pointSet);
mitkPointSetTestClass::TestSwapPointPositionDownwardsNotPossible(pointSet);
mitkPointSetTestClass::TestPointOperationOpMove(pointSet);
mitkPointSetTestClass::TestPointOperationOpRemove(pointSet);
mitkPointSetTestClass::TestPointOperationOpSelectPoint(pointSet);
mitkPointSetTestClass::TestGetNumberOfSelected(pointSet);
mitkPointSetTestClass::TestSearchSelectedPoint(pointSet);
mitkPointSetTestClass::TestOpDeselectPoint(pointSet);
mitkPointSetTestClass::TestOpMovePointUp(pointSet);
mitkPointSetTestClass::TestOpMovePointDown(pointSet);
mitkPointSetTestClass::TestSetSelectInfo(pointSet);
mitkPointSetTestClass::TestInsertPointWithPointSpecification(pointSet);
mitkPointSetTestClass::TestGetPointIfExists(pointSet);
mitkPointSetTestClass::TestCreateHoleInThePointIDs(pointSet);
mitkPointSetTestClass::TestOpMovePointUpOnFirstPoint(pointSet);
MITK_TEST_OUTPUT(<< "Test InsertPoint(), SetPoint() and SwapPointPosition()");
mitk::PointSet::PointType point;
mitk::FillVector3D(point, 2.2, 3.3, -4.4);
/* call everything that might modify PointContainer and PointDataContainer */
pointSet->InsertPoint(17, point);
pointSet->SetPoint(4, point);
pointSet->SetPoint(7, point);
pointSet->SetPoint(2, point);
pointSet->SwapPointPosition(7, true);
pointSet->SwapPointPosition(3, true);
pointSet->SwapPointPosition(2, false);
mitkPointSetTestClass::TestPointContainerPointDataContainer(pointSet);
MITK_TEST_OUTPUT(<< "Test OpREMOVE");
mitk::PointOperation op1(mitk::OpREMOVE, mitk::Point3D(), 2); // existing index
pointSet->ExecuteOperation(&op1);
mitk::PointOperation op1b(mitk::OpREMOVE, mitk::Point3D(), 112); // non existing index
pointSet->ExecuteOperation(&op1b);
mitkPointSetTestClass::TestPointContainerPointDataContainer(pointSet);
MITK_TEST_OUTPUT(<< "Test OpMove");
mitk::PointOperation op2(mitk::OpMOVE, mitk::Point3D(), 4); // existing index
pointSet->ExecuteOperation(&op2);
mitk::PointOperation op3(mitk::OpMOVE, mitk::Point3D(), 34); // non existing index
pointSet->ExecuteOperation(&op3);
mitkPointSetTestClass::TestPointContainerPointDataContainer(pointSet);
MITK_TEST_OUTPUT(<< "Test OpINSERT");
mitk::PointOperation op4(mitk::OpINSERT, mitk::Point3D(), 38); // non existing index
pointSet->ExecuteOperation(&op4);
mitk::PointOperation op5(mitk::OpINSERT, mitk::Point3D(), 17); // existing index
pointSet->ExecuteOperation(&op5);
mitkPointSetTestClass::TestPointContainerPointDataContainer(pointSet);
mitk::PointSet::Pointer clonePS = pointSet->Clone();
mitkPointSetTestClass::TestIsNotEmpty(clonePS);
MITK_TEST_CONDITION_REQUIRED(clonePS->GetPointSetSeriesSize() == pointSet->GetPointSetSeriesSize(), "Testing cloned point set's size!");
MITK_TEST_CONDITION_REQUIRED(clonePS.GetPointer() != pointSet.GetPointer(), "Testing that the clone is not the source PS!");
MITK_TEST_CONDITION_REQUIRED(clonePS->GetGeometry()->GetCenter() == pointSet->GetGeometry()->GetCenter() , "Testing if the geometry is cloned correctly!");
MITK_TEST_CONDITION_REQUIRED(clonePS->GetPropertyList()->GetMap()->size() == pointSet->GetPropertyList()->GetMap()->size() , "Testing if the property list is cloned correctly!");
MITK_TEST_END();
}
diff --git a/Core/Code/Testing/mitkSlicedGeometry3DTest.cpp b/Core/Code/Testing/mitkSlicedGeometry3DTest.cpp
index ef88935be2..d63dd2995d 100644
--- a/Core/Code/Testing/mitkSlicedGeometry3DTest.cpp
+++ b/Core/Code/Testing/mitkSlicedGeometry3DTest.cpp
@@ -1,257 +1,257 @@
/*=========================================================================
Program: Medical Imaging & Interaction Toolkit
Language: C++
Date: $Date$
Version: $Revision$
Copyright (c) German Cancer Research Center, Division of Medical and
Biological Informatics. All rights reserved.
See MITKCopyright.txt or http://www.mitk.org/copyright.html for details.
This software is distributed WITHOUT ANY WARRANTY; without even
the implied warranty of MERCHANTABILITY or FITNESS FOR A PARTICULAR
PURPOSE. See the above copyright notices for more information.
=========================================================================*/
#include "mitkImage.h"
#include "mitkPlaneGeometry.h"
#include "mitkTimeSlicedGeometry.h"
#include "mitkSlicedGeometry3D.h"
#include "mitkTestingMacros.h"
#include <vnl/vnl_quaternion.h>
#include <vnl/vnl_quaternion.txx>
#include <fstream>
void mitkSlicedGeometry3D_ChangeImageGeometryConsideringOriginOffset_Test()
{
//Tests for Offset
MITK_TEST_OUTPUT( << "====== NOW RUNNING: Tests for pixel-center-based offset concerns ========");
// create a SlicedGeometry3D
mitk::SlicedGeometry3D::Pointer slicedGeo3D=mitk::SlicedGeometry3D::New();
int num_slices = 5;
- slicedGeo3D->Initialize(num_slices); // 5 slices
+ slicedGeo3D->InitializeSlicedGeometry(num_slices); // 5 slices
mitk::Point3D newOrigin;
newOrigin[0] = 91.3;
newOrigin[1] = -13.3;
newOrigin[2] = 0;
slicedGeo3D->SetOrigin(newOrigin);
mitk::Vector3D newSpacing;
newSpacing[0] = 1.0f;
newSpacing[1] = 0.9f;
newSpacing[2] = 0.3f;
slicedGeo3D->SetSpacing(newSpacing);
// create subslices as well
for (int i=0; i < num_slices; i++)
{
mitk::Geometry2D::Pointer geo2d = mitk::Geometry2D::New();
geo2d->Initialize();
slicedGeo3D->SetGeometry2D(geo2d,i);
}
// now run tests
MITK_TEST_OUTPUT( << "Testing whether slicedGeo3D->GetImageGeometry() is false by default");
MITK_TEST_CONDITION_REQUIRED( slicedGeo3D->GetImageGeometry()==false, "");
MITK_TEST_OUTPUT( << "Testing whether first and last geometry in the SlicedGeometry3D have GetImageGeometry()==false by default");
mitk::Geometry3D* subSliceGeo2D_first = slicedGeo3D->GetGeometry2D(0);
mitk::Geometry3D* subSliceGeo2D_last = slicedGeo3D->GetGeometry2D(num_slices-1);
MITK_TEST_CONDITION_REQUIRED( subSliceGeo2D_first->GetImageGeometry()==false, "");
MITK_TEST_CONDITION_REQUIRED( subSliceGeo2D_last->GetImageGeometry()==false, "");
// Save some Origins and cornerpoints
mitk::Point3D OriginSlicedGeo( slicedGeo3D->GetOrigin() );
mitk::Point3D OriginFirstGeo( subSliceGeo2D_first->GetOrigin() );
mitk::Point3D OriginLastGeo( subSliceGeo2D_last->GetOrigin() );
mitk::Point3D CornerPoint0SlicedGeo(slicedGeo3D->GetCornerPoint(0));
mitk::Point3D CornerPoint1FirstGeo(subSliceGeo2D_first->GetCornerPoint(1));
mitk::Point3D CornerPoint2LastGeo(subSliceGeo2D_last->GetCornerPoint(2));
MITK_TEST_OUTPUT( << "Calling slicedGeo3D->ChangeImageGeometryConsideringOriginOffset(true)");
//std::cout << "vorher Origin: " << subSliceGeo2D_first->GetOrigin() << std::endl;
//std::cout << "vorher Corner: " << subSliceGeo2D_first->GetCornerPoint(0) << std::endl;
slicedGeo3D->ChangeImageGeometryConsideringOriginOffset(true);
//std::cout << "nachher Origin: " << subSliceGeo2D_first->GetOrigin() << std::endl;
//std::cout << "nachher Corner: " << subSliceGeo2D_first->GetCornerPoint(0) << std::endl;
MITK_TEST_OUTPUT( << "Testing whether slicedGeo3D->GetImageGeometry() is now true");
MITK_TEST_CONDITION_REQUIRED( slicedGeo3D->GetImageGeometry()==true, "");
MITK_TEST_OUTPUT( << "Testing whether first and last geometry in the SlicedGeometry3D have GetImageGeometry()==true now");
MITK_TEST_CONDITION_REQUIRED( subSliceGeo2D_first->GetImageGeometry()==true, "");
MITK_TEST_CONDITION_REQUIRED( subSliceGeo2D_last->GetImageGeometry()==true, "");
MITK_TEST_OUTPUT( << "Testing wether offset has been added to origins");
// Manually adding Offset.
OriginSlicedGeo[0] += (slicedGeo3D->GetSpacing()[0]) / 2;
OriginSlicedGeo[1] += (slicedGeo3D->GetSpacing()[1]) / 2;
OriginSlicedGeo[2] += (slicedGeo3D->GetSpacing()[2]) / 2;
OriginFirstGeo[0] += (subSliceGeo2D_first->GetSpacing()[0]) / 2;
OriginFirstGeo[1] += (subSliceGeo2D_first->GetSpacing()[1]) / 2;
OriginFirstGeo[2] += (subSliceGeo2D_first->GetSpacing()[2]) / 2;
OriginLastGeo[0] += (subSliceGeo2D_last->GetSpacing()[0]) / 2;
OriginLastGeo[1] += (subSliceGeo2D_last->GetSpacing()[1]) / 2;
OriginLastGeo[2] += (subSliceGeo2D_last->GetSpacing()[2]) / 2;
MITK_TEST_CONDITION_REQUIRED( subSliceGeo2D_first->GetCornerPoint(1)==CornerPoint1FirstGeo, "");
MITK_TEST_CONDITION_REQUIRED( subSliceGeo2D_last->GetCornerPoint(2)==CornerPoint2LastGeo, "");
MITK_TEST_CONDITION_REQUIRED( slicedGeo3D->GetCornerPoint(0)==CornerPoint0SlicedGeo, "");
MITK_TEST_CONDITION_REQUIRED( slicedGeo3D->GetOrigin()==OriginSlicedGeo, "");
MITK_TEST_CONDITION_REQUIRED( subSliceGeo2D_first->GetOrigin()==OriginFirstGeo, "");
MITK_TEST_CONDITION_REQUIRED( subSliceGeo2D_last->GetOrigin()==OriginLastGeo, "");
MITK_TEST_OUTPUT( << "Calling slicedGeo3D->ChangeImageGeometryConsideringOriginOffset(false)");
slicedGeo3D->ChangeImageGeometryConsideringOriginOffset(false);
MITK_TEST_OUTPUT( << "Testing whether slicedGeo3D->GetImageGeometry() is now false");
MITK_TEST_CONDITION_REQUIRED( slicedGeo3D->GetImageGeometry()==false, "");
MITK_TEST_OUTPUT( << "Testing whether first and last geometry in the SlicedGeometry3D have GetImageGeometry()==false now");
MITK_TEST_CONDITION_REQUIRED( subSliceGeo2D_first->GetImageGeometry()==false, "");
MITK_TEST_CONDITION_REQUIRED( subSliceGeo2D_last->GetImageGeometry()==false, "");
MITK_TEST_OUTPUT( << "Testing wether offset has been added to origins of geometry");
// Manually substracting Offset.
OriginSlicedGeo[0] -= (slicedGeo3D->GetSpacing()[0]) / 2;
OriginSlicedGeo[1] -= (slicedGeo3D->GetSpacing()[1]) / 2;
OriginSlicedGeo[2] -= (slicedGeo3D->GetSpacing()[2]) / 2;
OriginFirstGeo[0] -= (subSliceGeo2D_first->GetSpacing()[0]) / 2;
OriginFirstGeo[1] -= (subSliceGeo2D_first->GetSpacing()[1]) / 2;
OriginFirstGeo[2] -= (subSliceGeo2D_first->GetSpacing()[2]) / 2;
OriginLastGeo[0] -= (subSliceGeo2D_last->GetSpacing()[0]) / 2;
OriginLastGeo[1] -= (subSliceGeo2D_last->GetSpacing()[1]) / 2;
OriginLastGeo[2] -= (subSliceGeo2D_last->GetSpacing()[2]) / 2;
MITK_TEST_CONDITION_REQUIRED( subSliceGeo2D_first->GetCornerPoint(1)==CornerPoint1FirstGeo, "");
MITK_TEST_CONDITION_REQUIRED( subSliceGeo2D_last->GetCornerPoint(2)==CornerPoint2LastGeo, "");
MITK_TEST_CONDITION_REQUIRED( slicedGeo3D->GetCornerPoint(0)==CornerPoint0SlicedGeo, "");
MITK_TEST_CONDITION_REQUIRED( slicedGeo3D->GetOrigin()==OriginSlicedGeo, "");
MITK_TEST_CONDITION_REQUIRED( subSliceGeo2D_first->GetOrigin()==OriginFirstGeo, "");
MITK_TEST_CONDITION_REQUIRED( subSliceGeo2D_last->GetOrigin()==OriginLastGeo, "");
MITK_TEST_OUTPUT( << "ALL SUCCESSFULLY!");
}
int mitkSlicedGeometry3DTest(int /*argc*/, char* /*argv*/[])
{
mitk::PlaneGeometry::Pointer planegeometry1 = mitk::PlaneGeometry::New();
mitk::Point3D origin;
mitk::Vector3D right, bottom, normal;
mitk::ScalarType width, height;
mitk::ScalarType widthInMM, heightInMM, thicknessInMM;
width = 100; widthInMM = width;
height = 200; heightInMM = height;
thicknessInMM = 3.5;
mitk::FillVector3D(origin, 4.5, 7.3, 11.2);
mitk::FillVector3D(right, widthInMM, 0, 0);
mitk::FillVector3D(bottom, 0, heightInMM, 0);
mitk::FillVector3D(normal, 0, 0, thicknessInMM);
std::cout << "Initializing planegeometry1 by InitializeStandardPlane(rightVector, downVector, spacing = NULL): "<<std::endl;
planegeometry1->InitializeStandardPlane(right.Get_vnl_vector(), bottom.Get_vnl_vector());
std::cout << "Setting planegeometry2 to a cloned version of planegeometry1: "<<std::endl;
mitk::PlaneGeometry::Pointer planegeometry2;
planegeometry2 = dynamic_cast<mitk::PlaneGeometry*>(planegeometry1->Clone().GetPointer());;
std::cout << "Changing the IndexToWorldTransform of planegeometry2 to a rotated version by SetIndexToWorldTransform() (keep origin): "<<std::endl;
mitk::AffineTransform3D::Pointer transform = mitk::AffineTransform3D::New();
mitk::AffineTransform3D::MatrixType::InternalMatrixType vnlmatrix;
vnlmatrix = planegeometry2->GetIndexToWorldTransform()->GetMatrix().GetVnlMatrix();
mitk::VnlVector axis(3);
mitk::FillVector3D(axis, 1.0, 1.0, 1.0); axis.normalize();
vnl_quaternion<mitk::ScalarType> rotation(axis, 0.123);
vnlmatrix = rotation.rotation_matrix_transpose()*vnlmatrix;
mitk::Matrix3D matrix;
matrix = vnlmatrix;
transform->SetMatrix(matrix);
transform->SetOffset(planegeometry2->GetIndexToWorldTransform()->GetOffset());
right.Set_vnl_vector( rotation.rotation_matrix_transpose()*right.Get_vnl_vector() );
bottom.Set_vnl_vector(rotation.rotation_matrix_transpose()*bottom.Get_vnl_vector());
normal.Set_vnl_vector(rotation.rotation_matrix_transpose()*normal.Get_vnl_vector());
planegeometry2->SetIndexToWorldTransform(transform);
std::cout << "Setting planegeometry3 to the backside of planegeometry2: " <<std::endl;
mitk::PlaneGeometry::Pointer planegeometry3 = mitk::PlaneGeometry::New();
planegeometry3->InitializeStandardPlane(planegeometry2, mitk::PlaneGeometry::Transversal, 0, false);
std::cout << "Testing SlicedGeometry3D::InitializeEvenlySpaced(planegeometry3, zSpacing = 1, slices = 5, flipped = false): " <<std::endl;
mitk::SlicedGeometry3D::Pointer slicedWorldGeometry=mitk::SlicedGeometry3D::New();
unsigned int numSlices = 5;
slicedWorldGeometry->InitializeEvenlySpaced(planegeometry3, 1, numSlices, false);
std::cout << "Testing availability and type (PlaneGeometry) of first geometry in the SlicedGeometry3D: ";
mitk::PlaneGeometry* accessedplanegeometry3 = dynamic_cast<mitk::PlaneGeometry*>(slicedWorldGeometry->GetGeometry2D(0));
if(accessedplanegeometry3==NULL)
{
std::cout<<"[FAILED]"<<std::endl;
return EXIT_FAILURE;
}
std::cout<<"[PASSED]"<<std::endl;
std::cout << "Testing whether the first geometry in the SlicedGeometry3D is identical to planegeometry3 by axis comparison and origin: "<<std::endl;
if((mitk::Equal(accessedplanegeometry3->GetAxisVector(0), planegeometry3->GetAxisVector(0))==false) ||
(mitk::Equal(accessedplanegeometry3->GetAxisVector(1), planegeometry3->GetAxisVector(1))==false) ||
(mitk::Equal(accessedplanegeometry3->GetAxisVector(2), planegeometry3->GetAxisVector(2))==false) ||
(mitk::Equal(accessedplanegeometry3->GetOrigin(), planegeometry3->GetOrigin())==false))
{
std::cout<<"[FAILED]"<<std::endl;
return EXIT_FAILURE;
}
std::cout<<"[PASSED]"<<std::endl;
std::cout << "Testing availability and type (PlaneGeometry) of the last geometry in the SlicedGeometry3D: ";
mitk::PlaneGeometry* accessedplanegeometry3last = dynamic_cast<mitk::PlaneGeometry*>(slicedWorldGeometry->GetGeometry2D(numSlices-1));
mitk::Point3D origin3last; origin3last = planegeometry3->GetOrigin()+slicedWorldGeometry->GetDirectionVector()*(numSlices-1);
if(accessedplanegeometry3last==NULL)
{
std::cout<<"[FAILED]"<<std::endl;
return EXIT_FAILURE;
}
std::cout<<"[PASSED]"<<std::endl;
std::cout << "Testing whether the last geometry in the SlicedGeometry3D is identical to planegeometry3 by axis comparison: "<<std::endl;
if((mitk::Equal(accessedplanegeometry3last->GetAxisVector(0), planegeometry3->GetAxisVector(0))==false) ||
(mitk::Equal(accessedplanegeometry3last->GetAxisVector(1), planegeometry3->GetAxisVector(1))==false) ||
(mitk::Equal(accessedplanegeometry3last->GetAxisVector(2), planegeometry3->GetAxisVector(2))==false) ||
(mitk::Equal(accessedplanegeometry3last->GetOrigin(), origin3last)==false) ||
(mitk::Equal(accessedplanegeometry3last->GetIndexToWorldTransform()->GetOffset(), origin3last.GetVectorFromOrigin())==false))
{
std::cout<<"[FAILED]"<<std::endl;
return EXIT_FAILURE;
}
std::cout<<"[PASSED]"<<std::endl;
std::cout << "Again for first slice - Testing availability and type (PlaneGeometry) of first geometry in the SlicedGeometry3D: ";
accessedplanegeometry3 = dynamic_cast<mitk::PlaneGeometry*>(slicedWorldGeometry->GetGeometry2D(0));
if(accessedplanegeometry3==NULL)
{
std::cout<<"[FAILED]"<<std::endl;
return EXIT_FAILURE;
}
std::cout<<"[PASSED]"<<std::endl;
std::cout << "Again for first slice - Testing whether the first geometry in the SlicedGeometry3D is identical to planegeometry3 by axis comparison and origin: "<<std::endl;
if((mitk::Equal(accessedplanegeometry3->GetAxisVector(0), planegeometry3->GetAxisVector(0))==false) ||
(mitk::Equal(accessedplanegeometry3->GetAxisVector(1), planegeometry3->GetAxisVector(1))==false) ||
(mitk::Equal(accessedplanegeometry3->GetAxisVector(2), planegeometry3->GetAxisVector(2))==false) ||
(mitk::Equal(accessedplanegeometry3->GetOrigin(), planegeometry3->GetOrigin())==false) ||
(mitk::Equal(accessedplanegeometry3->GetIndexToWorldTransform()->GetOffset(), planegeometry3->GetOrigin().GetVectorFromOrigin())==false))
{
std::cout<<"[FAILED]"<<std::endl;
return EXIT_FAILURE;
}
std::cout<<"[PASSED]"<<std::endl;
mitkSlicedGeometry3D_ChangeImageGeometryConsideringOriginOffset_Test();
std::cout<<"[TEST DONE]"<<std::endl;
return EXIT_SUCCESS;
}
diff --git a/Core/Code/Testing/mitkStateMachineFactoryTest.cpp b/Core/Code/Testing/mitkStateMachineFactoryTest.cpp
index d41be2b61f..5cba2525ee 100644
--- a/Core/Code/Testing/mitkStateMachineFactoryTest.cpp
+++ b/Core/Code/Testing/mitkStateMachineFactoryTest.cpp
@@ -1,94 +1,95 @@
/*=========================================================================
Program: Medical Imaging & Interaction Toolkit
Language: C++
Date: $Date$
Version: $Revision$
Copyright (c) German Cancer Research Center, Division of Medical and
Biological Informatics. All rights reserved.
See MITKCopyright.txt or http://www.mitk.org/copyright.html for details.
This software is distributed WITHOUT ANY WARRANTY; without even
the implied warranty of MERCHANTABILITY or FITNESS FOR A PARTICULAR
PURPOSE. See the above copyright notices for more information.
=========================================================================*/
#include <mitkStateMachineFactory.h>
#include <mitkState.h>
#include "mitkTestingMacros.h"
#include <mitkInteractionConst.h>
int mitkStateMachineFactoryTest(int argc, char* argv[])
{
MITK_TEST_BEGIN("StateMachineFactory")
//create statemachinefactory
mitk::StateMachineFactory* statemachineFactory = mitk::StateMachineFactory::New();
//load standard behavior
MITK_TEST_CONDITION_REQUIRED(statemachineFactory->LoadStandardBehavior(),"Testing LoadStandardBehavior(): ")
//get the first state of the statemachine "global" (mitkGlobalInteraction)
mitk::State::Pointer state = statemachineFactory->GetStartState("global");
MITK_TEST_CONDITION_REQUIRED(state.IsNotNull(),"Testing GetStartState() of GlobalInteraction state machine pattern: ")
-
+
+ MITK_TEST_CONDITION_REQUIRED(argc>2, "Testing correct test invocation");
std::string xmlFileName1 = argv[1];
MITK_TEST_CONDITION_REQUIRED(!xmlFileName1.empty(),"Getting xml file 1: ")
MITK_TEST_CONDITION_REQUIRED(statemachineFactory->LoadBehavior(xmlFileName1),"Parsing xml file 1: ")
state = statemachineFactory->GetStartState("test1");
MITK_TEST_CONDITION_REQUIRED(state.IsNotNull(),"Testing GetStartState() of test1 state machine pattern: ")
//global still accessible?
state = statemachineFactory->GetStartState("global");
MITK_TEST_CONDITION_REQUIRED(state.IsNotNull(),"Testing if previous loaded state machine patterns are still accessible: ")
std::string xmlFileName2 = argv[2];
MITK_TEST_CONDITION_REQUIRED(!xmlFileName2.empty(),"Getting xml file 2: ")
MITK_TEST_CONDITION_REQUIRED(statemachineFactory->LoadBehavior(xmlFileName2),"Parsing xml file 2. Schould throw a fatal error due to already existing pattern name: ")
state = statemachineFactory->GetStartState("test4");
MITK_TEST_CONDITION_REQUIRED(state.IsNotNull(),"Testing GetStartState() of test4 state machine pattern: ")
state = statemachineFactory->GetStartState("global");
MITK_TEST_CONDITION_REQUIRED(state.IsNotNull(),"Testing if previous loaded state machine pattern (global) is still accessible: ")
state = statemachineFactory->GetStartState("test1");
MITK_TEST_CONDITION_REQUIRED(state.IsNotNull(),"Testing if previous loaded state machine pattern (test1) is still accessible: ")
//manually create a state machine pattern and add it to factory
std::string patternName("manuallyCreatedStateMachine");
mitk::StateMachineFactory::StateMachineMapType* allStatesMap = new mitk::StateMachineFactory::StateMachineMapType();
mitk::State::Pointer state1 = mitk::State::New("firstState", 1);
mitk::Transition* transition1 = new mitk::Transition("goto2", 2, mitk::EIDNULLEVENT);
mitk::Action::Pointer action1 = mitk::Action::New(mitk::AcDONOTHING);
transition1->AddAction(action1);
state1->AddTransition(transition1);
allStatesMap->insert(mitk::StateMachineFactory::StateMachineMapType::value_type(state1->GetId(), state1));
mitk::State::Pointer state2 = mitk::State::New("secondState", 2);
transition1->SetNextState(state2);
mitk::Transition* transition2 = new mitk::Transition("goto1", 1, mitk::EIDNULLEVENT);
mitk::Action::Pointer action2 = mitk::Action::New(mitk::AcDONOTHING);
transition2->AddAction(action2);
transition2->SetNextState(state1);
state2->AddTransition(transition2);
allStatesMap->insert(mitk::StateMachineFactory::StateMachineMapType::value_type(state2->GetId(), state2));
//now add to factory
statemachineFactory->AddStateMachinePattern(patternName.c_str(), state1, allStatesMap);
//check if it is accessable
state = statemachineFactory->GetStartState("global");
MITK_TEST_CONDITION_REQUIRED(state.IsNotNull(),"Testing if previous loaded state machine pattern (global) is still accessible: ")
state = statemachineFactory->GetStartState("test1");
MITK_TEST_CONDITION_REQUIRED(state.IsNotNull(),"Testing if previous loaded state machine pattern (test1) is still accessible: ")
state = statemachineFactory->GetStartState(patternName.c_str());
MITK_TEST_CONDITION_REQUIRED(state.IsNotNull(),"Testing if manually created and added state machine pattern is accessible: ")
statemachineFactory->Delete();
//states, transitions and actions are freed in StateMachineFactory
// always end with this!
MITK_TEST_END();
}
diff --git a/Core/Code/Testing/mitkTimeSlicedGeometryTest.cpp b/Core/Code/Testing/mitkTimeSlicedGeometryTest.cpp
index b646378810..ccba0d8cb2 100644
--- a/Core/Code/Testing/mitkTimeSlicedGeometryTest.cpp
+++ b/Core/Code/Testing/mitkTimeSlicedGeometryTest.cpp
@@ -1,454 +1,454 @@
/*=========================================================================
Program: Medical Imaging & Interaction Toolkit
Language: C++
Date: $Date: 2006-06-09 15:24:07 +0200 (Fr, 09 Jun 2006) $
Version: $Revision: 7074 $
Copyright (c) German Cancer Research Center, Division of Medical and
Biological Informatics. All rights reserved.
See MITKCopyright.txt or http://www.mitk.org/copyright.html for details.
This software is distributed WITHOUT ANY WARRANTY; without even
the implied warranty of MERCHANTABILITY or FITNESS FOR A PARTICULAR
PURPOSE. See the above copyright notices for more information.
=========================================================================*/
#include "mitkImage.h"
#include "mitkPlaneGeometry.h"
#include "mitkTimeSlicedGeometry.h"
#include "mitkSlicedGeometry3D.h"
#include "mitkGeometry2D.h"
#include "mitkTestingMacros.h"
#include <vnl/vnl_quaternion.h>
#include <vnl/vnl_quaternion.txx>
#include <fstream>
void mitkTimeSlicedGeometry_ChangeImageGeometryConsideringOriginOffset_Test()
{
// additional tests to check the function ChangeImageGeometryConsideringOriginOffset(..)
//first create a new timeslicedgeometry
mitk::TimeSlicedGeometry::Pointer geoTime = mitk::TimeSlicedGeometry::New();
mitk::Geometry3D::Pointer geo3d = mitk::Geometry3D::New();
geo3d->Initialize();
int numOfTimeSteps = 5;
geoTime->InitializeEvenlyTimed(geo3d, numOfTimeSteps);
for (int i=0; i < numOfTimeSteps; i++)
{
mitk::Geometry3D::Pointer geo3d_sub = mitk::Geometry3D::New();
geo3d_sub->Initialize();
geoTime->SetGeometry3D(geo3d_sub, i);
}
MITK_TEST_OUTPUT( << "Testing whether geoTime->GetImageGeometry() is false by default");
MITK_TEST_CONDITION_REQUIRED( geoTime->GetImageGeometry()==false, "");
MITK_TEST_OUTPUT( << "Testing whether first and last geometry in the geoTime have GetImageGeometry()==false by default");
mitk::Geometry3D* subSliceGeo3D_first = geoTime->GetGeometry3D(0);
mitk::Geometry3D* subSliceGeo3D_last = geoTime->GetGeometry3D(numOfTimeSteps-1);
MITK_TEST_CONDITION_REQUIRED( subSliceGeo3D_first->GetImageGeometry()==false, "");
MITK_TEST_CONDITION_REQUIRED( subSliceGeo3D_last->GetImageGeometry()==false, "");
// Save some Origins and cornerpoints
mitk::Point3D OriginTimeGeo( geoTime->GetOrigin() );
mitk::Point3D OriginFirstGeo( subSliceGeo3D_first->GetOrigin() );
mitk::Point3D OriginLastGeo( subSliceGeo3D_last->GetOrigin() );
mitk::Point3D CornerPoint0TimeGeo(geoTime->GetCornerPoint(0));
mitk::Point3D CornerPoint1FirstGeo(subSliceGeo3D_first->GetCornerPoint(1));
mitk::Point3D CornerPoint2LastGeo(subSliceGeo3D_last->GetCornerPoint(2));
//std::cout << "vorher Origin: " << subSliceGeo3D_first->GetOrigin() << std::endl;
//std::cout << "vorher Corner: " << subSliceGeo3D_first->GetCornerPoint(0) << std::endl;
MITK_TEST_OUTPUT( << "Calling geoTime->ChangeImageGeometryConsideringOriginOffset(true)");
geoTime->ChangeImageGeometryConsideringOriginOffset(true);
//std::cout << "nachher Origin: " << subSliceGeo3D_first->GetOrigin() << std::endl;
//std::cout << "nachher Corner: " << subSliceGeo3D_first->GetCornerPoint(0) << std::endl;
MITK_TEST_OUTPUT( << "Testing whether geoTime->GetImageGeometry() is now true");
MITK_TEST_CONDITION_REQUIRED( geoTime->GetImageGeometry()==true, "");
MITK_TEST_OUTPUT( << "Testing whether first and last geometry in the SlicedGeometry3D have GetImageGeometry()==true now");
MITK_TEST_CONDITION_REQUIRED( subSliceGeo3D_first->GetImageGeometry()==true, "");
MITK_TEST_CONDITION_REQUIRED( subSliceGeo3D_last->GetImageGeometry()==true, "");
MITK_TEST_OUTPUT( << "Testing wether offset has been added to origins");
// Manually adding Offset.
OriginTimeGeo[0] += (geoTime->GetSpacing()[0]) / 2;
OriginTimeGeo[1] += (geoTime->GetSpacing()[1]) / 2;
OriginTimeGeo[2] += (geoTime->GetSpacing()[2]) / 2;
OriginFirstGeo[0] += (subSliceGeo3D_first->GetSpacing()[0]) / 2;
OriginFirstGeo[1] += (subSliceGeo3D_first->GetSpacing()[1]) / 2;
OriginFirstGeo[2] += (subSliceGeo3D_first->GetSpacing()[2]) / 2;
OriginLastGeo[0] += (subSliceGeo3D_last->GetSpacing()[0]) / 2;
OriginLastGeo[1] += (subSliceGeo3D_last->GetSpacing()[1]) / 2;
OriginLastGeo[2] += (subSliceGeo3D_last->GetSpacing()[2]) / 2;
MITK_TEST_CONDITION_REQUIRED( subSliceGeo3D_first->GetCornerPoint(1)==CornerPoint1FirstGeo, "");
MITK_TEST_CONDITION_REQUIRED( subSliceGeo3D_last->GetCornerPoint(2)==CornerPoint2LastGeo, "");
MITK_TEST_CONDITION_REQUIRED( geoTime->GetCornerPoint(0)==CornerPoint0TimeGeo, "");
MITK_TEST_CONDITION_REQUIRED( geoTime->GetOrigin()==OriginTimeGeo, "");
MITK_TEST_CONDITION_REQUIRED( subSliceGeo3D_first->GetOrigin()==OriginFirstGeo, "");
MITK_TEST_CONDITION_REQUIRED( subSliceGeo3D_last->GetOrigin()==OriginLastGeo, "");
MITK_TEST_OUTPUT( << "Calling geoTime->ChangeImageGeometryConsideringOriginOffset(false)");
geoTime->ChangeImageGeometryConsideringOriginOffset(false);
MITK_TEST_OUTPUT( << "Testing whether geoTime->GetImageGeometry() is now false");
MITK_TEST_CONDITION_REQUIRED( geoTime->GetImageGeometry()==false, "");
MITK_TEST_OUTPUT( << "Testing whether first and last geometry in the geoTime have GetImageGeometry()==false now");
MITK_TEST_CONDITION_REQUIRED( subSliceGeo3D_first->GetImageGeometry()==false, "");
MITK_TEST_CONDITION_REQUIRED( subSliceGeo3D_last->GetImageGeometry()==false, "");
MITK_TEST_OUTPUT( << "Testing wether offset has been added to origins");
// Manually substracting Offset.
OriginTimeGeo[0] -= (geoTime->GetSpacing()[0]) / 2;
OriginTimeGeo[1] -= (geoTime->GetSpacing()[1]) / 2;
OriginTimeGeo[2] -= (geoTime->GetSpacing()[2]) / 2;
OriginFirstGeo[0] -= (subSliceGeo3D_first->GetSpacing()[0]) / 2;
OriginFirstGeo[1] -= (subSliceGeo3D_first->GetSpacing()[1]) / 2;
OriginFirstGeo[2] -= (subSliceGeo3D_first->GetSpacing()[2]) / 2;
OriginLastGeo[0] -= (subSliceGeo3D_last->GetSpacing()[0]) / 2;
OriginLastGeo[1] -= (subSliceGeo3D_last->GetSpacing()[1]) / 2;
OriginLastGeo[2] -= (subSliceGeo3D_last->GetSpacing()[2]) / 2;
MITK_TEST_CONDITION_REQUIRED( subSliceGeo3D_first->GetCornerPoint(1)==CornerPoint1FirstGeo, "");
MITK_TEST_CONDITION_REQUIRED( subSliceGeo3D_last->GetCornerPoint(2)==CornerPoint2LastGeo, "");
MITK_TEST_CONDITION_REQUIRED( geoTime->GetCornerPoint(0)==CornerPoint0TimeGeo, "");
MITK_TEST_CONDITION_REQUIRED( geoTime->GetOrigin()==OriginTimeGeo, "");
MITK_TEST_CONDITION_REQUIRED( subSliceGeo3D_first->GetOrigin()==OriginFirstGeo, "");
MITK_TEST_CONDITION_REQUIRED( subSliceGeo3D_last->GetOrigin()==OriginLastGeo, "");
}
int mitkTimeSlicedGeometryTest(int /*argc*/, char* /*argv*/[])
{
mitk::PlaneGeometry::Pointer planegeometry = mitk::PlaneGeometry::New();
mitk::Point3D origin;
mitk::Vector3D right, bottom, normal;
mitk::ScalarType width, height;
mitk::ScalarType widthInMM, heightInMM, thicknessInMM;
width = 100; widthInMM = width*0.5;
height = 200; heightInMM = height*1.2;
thicknessInMM = 1.5;
mitk::FillVector3D(origin, 2.5, -3.3, 17.2);
mitk::FillVector3D(right, widthInMM, 0, 0);
mitk::FillVector3D(bottom, 0, heightInMM, 0);
mitk::FillVector3D(normal, 0, 0, thicknessInMM);
std::cout << "Creating TimeSlicedGeometry" <<std::endl;
mitk::TimeSlicedGeometry::Pointer timeSlicedGeometry = mitk::TimeSlicedGeometry::New();
if(timeSlicedGeometry.IsNull())
{
std::cout<<"[FAILED]"<<std::endl;
return EXIT_FAILURE;
}
std::cout<<"[PASSED]"<<std::endl;
unsigned int numOfTimeSteps = 5;
std::cout << "Testing TimeSlicedGeometry::Initialize(timesteps = " << numOfTimeSteps << "): " <<std::endl;
- timeSlicedGeometry->Initialize(numOfTimeSteps);
+ timeSlicedGeometry->InitializeEvenlyTimed(numOfTimeSteps);
std::cout<<"[PASSED]"<<std::endl;
std::cout << "Testing TimeSlicedGeometry::GetTimeSteps()==" << numOfTimeSteps << ": " <<std::endl;
if(timeSlicedGeometry->GetTimeSteps()!=numOfTimeSteps)
{
std::cout<<"[FAILED]"<<std::endl;
return EXIT_FAILURE;
}
std::cout<<"[PASSED]"<<std::endl;
std::cout << "Testing TimeSlicedGeometry::GetEvenlyTimed(): " <<std::endl;
if(timeSlicedGeometry->GetEvenlyTimed()!=true)
{
std::cout<<"[FAILED]"<<std::endl;
return EXIT_FAILURE;
}
std::cout<<"[PASSED]"<<std::endl;
mitk::TimeBounds timeBounds1;
timeBounds1[0] = 1.3;
timeBounds1[1] = 2.4;
std::cout << "Initializing a PlaneGeometry by InitializeStandardPlane(rightVector, downVector, spacing = NULL): "<<std::endl;
planegeometry->InitializeStandardPlane(right.Get_vnl_vector(), bottom.Get_vnl_vector());
std::cout<<"[PASSED]"<<std::endl;
std::cout << "Setting TimeBounds of PlaneGeometry by SetTimeBounds(): "<<std::endl;
planegeometry->SetTimeBounds(timeBounds1);
std::cout<<"[PASSED]"<<std::endl;
std::cout << "Testing PlaneGeometry::GetTimeBounds(): "<<std::endl;
if(planegeometry->GetTimeBounds() != timeBounds1)
{
std::cout<<"[FAILED]"<<std::endl;
return EXIT_FAILURE;
}
std::cout<<"[PASSED]"<<std::endl;
--numOfTimeSteps;
std::cout << "Testing TimeSlicedGeometry::InitializeEvenlyTimed(planegeometry, timesteps = " << numOfTimeSteps << "): " <<std::endl;
mitk::TimeSlicedGeometry::Pointer timeSlicedGeometry2 = mitk::TimeSlicedGeometry::New();
timeSlicedGeometry2->InitializeEvenlyTimed(planegeometry, numOfTimeSteps);
std::cout<<"[PASSED]"<<std::endl;
std::cout << "Testing TimeSlicedGeometry::GetTimeSteps()==" << numOfTimeSteps << ": " <<std::endl;
if(timeSlicedGeometry2->GetTimeSteps() != numOfTimeSteps)
{
std::cout<<"[FAILED]"<<std::endl;
return EXIT_FAILURE;
}
std::cout<<"[PASSED]"<<std::endl;
std::cout << "Testing TimeSlicedGeometry::GetEvenlyTimed(): " <<std::endl;
if(timeSlicedGeometry2->GetEvenlyTimed()!=true)
{
std::cout<<"[FAILED]"<<std::endl;
return EXIT_FAILURE;
}
std::cout<<"[PASSED]"<<std::endl;
std::cout << "Testing TimeSlicedGeometry::TimeStepToMS(): " << std::endl;
if(fabs(timeSlicedGeometry2->TimeStepToMS( 2 ) - 3.5) > mitk::eps)
{
std::cout<<"[FAILED]"<<std::endl;
return EXIT_FAILURE;
}
std::cout<<"[PASSED]"<<std::endl;
std::cout << "Testing TimeSlicedGeometry::MSToTimeStep(): " << std::endl;
if(timeSlicedGeometry2->MSToTimeStep( 3.6 ) != 2)
{
std::cout<<"[FAILED]"<<std::endl;
return EXIT_FAILURE;
}
std::cout<<"[PASSED]"<<std::endl;
std::cout << "Testing TimeSlicedGeometry::TimeStepToTimeStep(): " << std::endl;
// Re-use timeSlicedGeometry with new time bounds
mitk::TimeBounds timeBounds;
timeBounds[0] = 0.0;
timeBounds[1] = 1.0;
mitk::Geometry3D::Pointer geometry = mitk::Geometry3D::New();
geometry->Initialize();
geometry->SetTimeBounds( timeBounds );
timeSlicedGeometry->InitializeEvenlyTimed( geometry, numOfTimeSteps+1 );
if(timeSlicedGeometry2->TimeStepToTimeStep( timeSlicedGeometry, 4 ) != 2)
{
std::cout<<"[FAILED]"<<std::endl;
return EXIT_FAILURE;
}
std::cout<<"[PASSED]"<<std::endl;
std::cout << "Testing availability and type (PlaneGeometry) of first geometry in the TimeSlicedGeometry: ";
mitk::PlaneGeometry* accessedplanegeometry = dynamic_cast<mitk::PlaneGeometry*>(timeSlicedGeometry2->GetGeometry3D(0));
if(accessedplanegeometry==NULL)
{
std::cout<<"[FAILED]"<<std::endl;
return EXIT_FAILURE;
}
std::cout<<"[PASSED]"<<std::endl;
std::cout << "Testing identity of first geometry to the planegeometry in the TimeSlicedGeometry (should not be cloned): ";
if(accessedplanegeometry != planegeometry.GetPointer())
{
std::cout<<"[FAILED]"<<std::endl;
return EXIT_FAILURE;
}
std::cout<<"[PASSED]"<<std::endl;
std::cout << "Testing whether the spatial part of the first geometry in the TimeSlicedGeometry is identical to planegeometry by axis comparison and origin: "<<std::endl;
if((mitk::Equal(accessedplanegeometry->GetAxisVector(0), planegeometry->GetAxisVector(0))==false) ||
(mitk::Equal(accessedplanegeometry->GetAxisVector(1), planegeometry->GetAxisVector(1))==false) ||
(mitk::Equal(accessedplanegeometry->GetAxisVector(2), planegeometry->GetAxisVector(2))==false) ||
(mitk::Equal(accessedplanegeometry->GetOrigin(), planegeometry->GetOrigin())==false))
{
std::cout<<"[FAILED]"<<std::endl;
return EXIT_FAILURE;
}
std::cout<<"[PASSED]"<<std::endl;
std::cout << "Testing timebounds of first geometry: "<<std::endl;
if( timeBounds1 != accessedplanegeometry->GetTimeBounds() )
{
std::cout<<"[FAILED]"<<std::endl;
return EXIT_FAILURE;
}
std::cout<<"[PASSED]"<<std::endl;
std::cout << "Testing availability and type (PlaneGeometry) of second geometry in the TimeSlicedGeometry: ";
mitk::PlaneGeometry* secondplanegeometry = dynamic_cast<mitk::PlaneGeometry*>(timeSlicedGeometry2->GetGeometry3D(1));
if(secondplanegeometry==NULL)
{
std::cout<<"[FAILED]"<<std::endl;
return EXIT_FAILURE;
}
std::cout<<"[PASSED]"<<std::endl;
std::cout << "Testing PlaneGeometry::GetTimeBounds(): "<<std::endl;
const mitk::TimeBounds & secondtimebounds = secondplanegeometry->GetTimeBounds();
if( (timeBounds1[1] != secondtimebounds[0]) || (secondtimebounds[1] != secondtimebounds[0] + timeBounds1[1]-timeBounds1[0]) )
{
std::cout<<"[FAILED]"<<std::endl;
return EXIT_FAILURE;
}
std::cout<<"[PASSED]"<<std::endl;
std::cout << "Testing whether the spatial part of the second geometry in the TimeSlicedGeometry is identical to planegeometry by axis comparison and origin: "<<std::endl;
if((mitk::Equal(secondplanegeometry->GetAxisVector(0), planegeometry->GetAxisVector(0))==false) ||
(mitk::Equal(secondplanegeometry->GetAxisVector(1), planegeometry->GetAxisVector(1))==false) ||
(mitk::Equal(secondplanegeometry->GetAxisVector(2), planegeometry->GetAxisVector(2))==false) ||
(mitk::Equal(secondplanegeometry->GetOrigin(), planegeometry->GetOrigin())==false))
{
std::cout<<"[FAILED]"<<std::endl;
return EXIT_FAILURE;
}
std::cout<<"[PASSED]"<<std::endl;
// non-evenly-timed
std::cout << "Creating (new) TimeSlicedGeometry" <<std::endl;
timeSlicedGeometry2 = mitk::TimeSlicedGeometry::New();
if(timeSlicedGeometry2.IsNull())
{
std::cout<<"[FAILED]"<<std::endl;
return EXIT_FAILURE;
}
std::cout<<"[PASSED]"<<std::endl;
numOfTimeSteps += 7;
std::cout << "Testing TimeSlicedGeometry::InitializeEmpty(timesteps = " << numOfTimeSteps << "): " <<std::endl;
timeSlicedGeometry2->InitializeEmpty(numOfTimeSteps);
std::cout << "Testing TimeSlicedGeometry::GetEvenlyTimed():" <<std::endl;
if(timeSlicedGeometry2->GetEvenlyTimed()!=false)
{
std::cout<<"[FAILED]"<<std::endl; ///\todo additionally test Initialize, default should be non-evenly-timed
return EXIT_FAILURE;
}
std::cout<<"[PASSED]"<<std::endl;
std::cout << "Testing TimeSlicedGeometry::SetEvenlyTimed(false):" <<std::endl;
timeSlicedGeometry2->SetEvenlyTimed(false);
std::cout<<"[PASSED]"<<std::endl;
std::cout << "Testing TimeSlicedGeometry::GetEvenlyTimed()==false:" <<std::endl;
if(timeSlicedGeometry2->GetEvenlyTimed()!=false)
{
std::cout<<"[FAILED]"<<std::endl;
return EXIT_FAILURE;
}
std::cout<<"[PASSED]"<<std::endl;
std::cout << "Testing TimeSlicedGeometry::GetTimeSteps()==" << numOfTimeSteps << ": " <<std::endl;
if(timeSlicedGeometry2->GetTimeSteps() != numOfTimeSteps)
{
std::cout<<"[FAILED]"<<std::endl;
return EXIT_FAILURE;
}
std::cout<<"[PASSED]"<<std::endl;
std::cout << "Testing availability of first geometry in the TimeSlicedGeometry (should not exist): ";
mitk::Geometry3D* accessedgeometry = timeSlicedGeometry2->GetGeometry3D(0);
if(accessedgeometry!=NULL)
{
std::cout<<"[FAILED]"<<std::endl;
return EXIT_FAILURE;
}
std::cout<<"[PASSED]"<<std::endl;
std::cout << "Testing TimeSlicedGeometry::SetGeometry3D(planegeometry, timesteps = 0): " <<std::endl;
timeSlicedGeometry2->SetGeometry3D(planegeometry, 0);
std::cout<<"[PASSED]"<<std::endl;
std::cout << "Testing availability and type (PlaneGeometry) of first geometry in the TimeSlicedGeometry: ";
accessedplanegeometry = dynamic_cast<mitk::PlaneGeometry*>(timeSlicedGeometry2->GetGeometry3D(0));
if(accessedplanegeometry==NULL)
{
std::cout<<"[FAILED]"<<std::endl;
return EXIT_FAILURE;
}
std::cout<<"[PASSED]"<<std::endl;
std::cout << "Testing identity of first geometry to the planegeometry in the TimeSlicedGeometry: ";
if(accessedplanegeometry != planegeometry.GetPointer())
{
std::cout<<"[FAILED]"<<std::endl;
return EXIT_FAILURE;
}
std::cout<<"[PASSED]"<<std::endl;
std::cout << "Testing availability of second geometry in the TimeSlicedGeometry (should not exist): ";
accessedgeometry = timeSlicedGeometry2->GetGeometry3D(1);
if(accessedgeometry!=NULL)
{
std::cout<<"[FAILED]"<<std::endl;
return EXIT_FAILURE;
}
std::cout<<"[PASSED]"<<std::endl;
std::cout << "Setting planegeometry2 to a cloned version of planegeometry: "<<std::endl;
mitk::PlaneGeometry::Pointer planegeometry2;
planegeometry2 = dynamic_cast<mitk::PlaneGeometry*>(planegeometry->Clone().GetPointer());;
std::cout<<"[PASSED]"<<std::endl;
std::cout << "Changing timebounds of planegeometry2: "<<std::endl;
mitk::TimeBounds timeBounds3;
timeBounds3[0] = timeBounds[1];
timeBounds3[1] = timeBounds3[0]+13.2334;
planegeometry2->SetTimeBounds(timeBounds3);
std::cout<<"[PASSED]"<<std::endl;
std::cout << "Testing TimeSlicedGeometry::SetGeometry3D(planegeometry2, timesteps = 1): " <<std::endl;
timeSlicedGeometry2->SetGeometry3D(planegeometry2, 1);
std::cout<<"[PASSED]"<<std::endl;
std::cout << "Testing availability and type (PlaneGeometry) of second geometry in the TimeSlicedGeometry: ";
accessedplanegeometry = dynamic_cast<mitk::PlaneGeometry*>(timeSlicedGeometry2->GetGeometry3D(1));
if(accessedplanegeometry==NULL)
{
std::cout<<"[FAILED]"<<std::endl;
return EXIT_FAILURE;
}
std::cout<<"[PASSED]"<<std::endl;
std::cout << "Testing identity of second geometry to the planegeometry2 in the TimeSlicedGeometry: ";
if(accessedplanegeometry != planegeometry2.GetPointer())
{
std::cout<<"[FAILED]"<<std::endl;
return EXIT_FAILURE;
}
std::cout<<"[PASSED]"<<std::endl;
std::cout << "Testing timebounds of second geometry: "<<std::endl;
if( timeBounds3 != accessedplanegeometry->GetTimeBounds() )
{
std::cout<<"[FAILED]"<<std::endl;
return EXIT_FAILURE;
}
std::cout<<"[PASSED]"<<std::endl;
// run additional tests to check the function ChangeImageGeometryConsideringOriginOffset(..)
mitkTimeSlicedGeometry_ChangeImageGeometryConsideringOriginOffset_Test();
std::cout<<"[TEST DONE]"<<std::endl;
return EXIT_SUCCESS;
}
diff --git a/Core/Code/Testing/mitkVectorTest.cpp b/Core/Code/Testing/mitkVectorTest.cpp
new file mode 100644
index 0000000000..b4f15e05e6
--- /dev/null
+++ b/Core/Code/Testing/mitkVectorTest.cpp
@@ -0,0 +1,126 @@
+/*=========================================================================
+
+Program: Medical Imaging & Interaction Toolkit
+Language: C++
+Date: $Date$
+Version: $Revision$
+
+Copyright (c) German Cancer Research Center, Division of Medical and
+Biological Informatics. All rights reserved.
+See MITKCopyright.txt or http://www.mitk.org/copyright.html for details.
+
+This software is distributed WITHOUT ANY WARRANTY; without even
+the implied warranty of MERCHANTABILITY or FITNESS FOR A PARTICULAR
+PURPOSE. See the above copyright notices for more information.
+
+=========================================================================*/
+
+#include <mitkTestingMacros.h>
+#include <mitkVector.h>
+
+int mitkVectorTest(int /*argc*/, char* /*argv*/[])
+{
+ MITK_TEST_BEGIN("mitkVector");
+ // test itk vector equality methods
+ itk::Vector<float,3> itkVector_1;
+ itkVector_1[0] = 4.6;
+ itkVector_1[1] = 9.76543;
+ itkVector_1[2] = 746.09;
+
+ itk::Vector<float,3> itkVector_2;
+ itk::Vector<float,3> itkVector_3;
+ for (int i=0; i<3; i++)
+ {
+ itkVector_2[i] = itkVector_1[i] - sqrt(mitk::eps/3);
+ itkVector_3[i] = itkVector_1[i] - sqrt(mitk::eps/3.1);
+ }
+
+ MITK_TEST_CONDITION_REQUIRED(mitk::Equal(itkVector_1,itkVector_1), "Test vector equality using the same vector with mitk::eps");
+ MITK_TEST_CONDITION_REQUIRED(!mitk::Equal(itkVector_1,itkVector_2), "Test vector equality using different vectors with an element-wise difference greater than mitk::eps");
+ MITK_TEST_CONDITION_REQUIRED(mitk::Equal(itkVector_1,itkVector_3), "Test vector equality using different vectors with an element-wise difference less than mitk::eps");
+ // test itk point equality methods
+ itk::Point<float,3> itkPoint_1;
+ itk::Point<float,3> itkPoint_2;
+ itk::Point<float,3> itkPoint_3;
+ for (int i=0; i<3; i++)
+ {
+ itkPoint_1[i] = itkVector_1[i];
+ itkPoint_2[i] = itkVector_2[i];
+ itkPoint_3[i] = itkVector_3[i];
+ }
+ MITK_TEST_CONDITION_REQUIRED(mitk::Equal(itkPoint_1,itkPoint_1), "Test point equality using the same point with mitk::eps");
+ MITK_TEST_CONDITION_REQUIRED(!mitk::Equal(itkPoint_1,itkPoint_2), "Test point equality using different points with an element-wise difference greater than mitk::eps");
+ MITK_TEST_CONDITION_REQUIRED(mitk::Equal(itkPoint_1,itkPoint_3), "Test point equality using different points with an element-wise difference less than mitk::eps");
+ // test mitk vnl vector equality methods
+ mitk::VnlVector mitk_vnl_vector_1(3);
+ mitk::VnlVector mitk_vnl_vector_2(3);
+ mitk::VnlVector mitk_vnl_vector_3(3);
+ for (int i=0; i<3; i++)
+ {
+ mitk_vnl_vector_1.put(i,itkVector_1[i]);
+ mitk_vnl_vector_2.put(i,itkVector_2[i]);
+ mitk_vnl_vector_3.put(i,itkVector_3[i]);
+ }
+ MITK_TEST_CONDITION_REQUIRED(mitk::Equal(mitk_vnl_vector_1,mitk_vnl_vector_1), "Test mitk vnl vector equality using the same mitk vnl vector with mitk::eps");
+ MITK_TEST_CONDITION_REQUIRED(!mitk::Equal(mitk_vnl_vector_1,mitk_vnl_vector_2), "Test mitk vnl vector equality using different mitk vnl vectors with an element-wise difference greater than mitk::eps");
+ MITK_TEST_CONDITION_REQUIRED(mitk::Equal(mitk_vnl_vector_1,mitk_vnl_vector_3), "Test mitk vnl vector equality using different mitk vnl vectors with an element-wise difference less than mitk::eps");
+ // test vnl_vector equality method
+ vnl_vector_fixed<mitk::ScalarType,7> vnlVector_1;
+ vnlVector_1[3] = 56.98;
+ vnlVector_1[4] = 22.32;
+ vnlVector_1[5] = 1.00;
+ vnlVector_1[6] = 119.02;
+ vnl_vector_fixed<mitk::ScalarType,7> vnlVector_2;
+ vnl_vector_fixed<mitk::ScalarType,7> vnlVector_3;
+ for (int i=0; i<7; i++)
+ {
+ if (i<3)
+ {
+ vnlVector_1.put(i,itkVector_1[i]);
+ }
+ vnlVector_2[i] = vnlVector_1[i]- sqrt(mitk::eps/6.9);
+ vnlVector_3[i] = vnlVector_1[i]- sqrt(mitk::eps/7.1);
+ }
+ MITK_TEST_CONDITION_REQUIRED(mitk::Equal(vnlVector_1,vnlVector_1), "Test vnl vector equality using the same vnl vector with mitk::eps");
+ MITK_TEST_CONDITION_REQUIRED(!mitk::Equal(vnlVector_1,vnlVector_2), "Test vnl vector equality using different vnl vectors with an element-wise difference greater than mitk::eps");
+ MITK_TEST_CONDITION_REQUIRED(mitk::Equal(vnlVector_1,vnlVector_3), "Test vnl vector equality using different vnl vectors with an element-wise difference less than mitk::eps");
+
+ // test scalar equality method
+ double scalar1 = 0.5689;
+ double scalar2 = scalar1 + mitk::eps;
+ double scalar3 = scalar1 + mitk::eps*0.95;
+ MITK_TEST_CONDITION_REQUIRED(mitk::Equal(scalar1,scalar1), "Test scalar equality using the same scalar with mitk::eps");
+ MITK_TEST_CONDITION_REQUIRED(!mitk::Equal(scalar1,scalar2), "Test scalar equality using the different scalars with a difference greater than mitk::eps");
+ MITK_TEST_CONDITION_REQUIRED(mitk::Equal(scalar1,scalar3), "Test scalar equality using the different scalars with a difference less than mitk::eps");
+
+ // test matrix equality methods
+ vnl_matrix_fixed<mitk::ScalarType,3,3> vnlMatrix3x3_1;
+ vnlMatrix3x3_1(0,0) = 1.1;
+ vnlMatrix3x3_1(0,1) = 0.4;
+ vnlMatrix3x3_1(0,2) = 5.3;
+ vnlMatrix3x3_1(1,0) = 2.7;
+ vnlMatrix3x3_1(1,1) = 3578.56418;
+ vnlMatrix3x3_1(1,2) = 123.56;
+ vnlMatrix3x3_1(2,0) = 546.89;
+ vnlMatrix3x3_1(2,1) = 0.0001;
+ vnlMatrix3x3_1(2,2) = 1.0;
+ vnl_matrix_fixed<mitk::ScalarType,3,3> vnlMatrix3x3_2;
+ vnlMatrix3x3_2(0,0) = 1.1000009;
+ vnlMatrix3x3_2(0,1) = 0.4000009;
+ vnlMatrix3x3_2(0,2) = 5.3000009;
+ vnlMatrix3x3_2(1,0) = 2.7000009;
+ vnlMatrix3x3_2(1,1) = 3578.5641809;
+ vnlMatrix3x3_2(1,2) = 123.5600009;
+ vnlMatrix3x3_2(2,0) = 546.8900009;
+ vnlMatrix3x3_2(2,1) = 0.0001009;
+ vnlMatrix3x3_2(2,2) = 1.0000009;
+
+ mitk::ScalarType epsilon = 0.000001;
+ MITK_TEST_CONDITION_REQUIRED(mitk::MatrixEqualElementWise(vnlMatrix3x3_1,vnlMatrix3x3_1,0.0),"Test for matrix equality with given epsilon=0.0 and exactly the same matrix elements");
+ MITK_TEST_CONDITION_REQUIRED(!mitk::MatrixEqualElementWise(vnlMatrix3x3_1,vnlMatrix3x3_2,0.0),"Test for matrix equality with given epsilon=0.0 and slightly different matrix elements");
+ MITK_TEST_CONDITION_REQUIRED(mitk::MatrixEqualElementWise(vnlMatrix3x3_1,vnlMatrix3x3_2,epsilon),"Test for matrix equality with given epsilon and slightly different matrix elements");
+ MITK_TEST_CONDITION_REQUIRED(!mitk::MatrixEqualRMS(vnlMatrix3x3_1,vnlMatrix3x3_2,0.0),"Test for matrix equality with given epsilon=0.0 and slightly different matrix elements");
+ MITK_TEST_CONDITION_REQUIRED(mitk::MatrixEqualRMS(vnlMatrix3x3_1,vnlMatrix3x3_2,epsilon),"Test for matrix equality with given epsilon and slightly different matrix elements");
+
+ MITK_TEST_END();
+}
diff --git a/Core/Code/files.cmake b/Core/Code/files.cmake
index 99a9f7f4e8..a0c3235dc8 100644
--- a/Core/Code/files.cmake
+++ b/Core/Code/files.cmake
@@ -1,226 +1,277 @@
SET(H_FILES
+ Algorithms/itkImportMitkImageContainer.h
+ Algorithms/itkImportMitkImageContainer.txx
Algorithms/itkLocalVariationImageFilter.h
+ Algorithms/itkLocalVariationImageFilter.txx
+ Algorithms/itkMITKScalarImageToHistogramGenerator.h
+ Algorithms/itkMITKScalarImageToHistogramGenerator.txx
Algorithms/itkTotalVariationDenoisingImageFilter.h
+ Algorithms/itkTotalVariationDenoisingImageFilter.txx
Algorithms/itkTotalVariationSingleIterationImageFilter.h
+ Algorithms/itkTotalVariationSingleIterationImageFilter.txx
+
+ Algorithms/mitkImageAccessByItk.h
+ Algorithms/mitkImageCast.h
+ Algorithms/mitkImageToItk.h
+ Algorithms/mitkImageToItk.txx
+ Algorithms/mitkInstantiateAccessFunctions.h
+ Algorithms/mitkITKImageImport.h
+ Algorithms/mitkITKImageImport.txx
+ Algorithms/mitkPixelTypeList.h
+
+ # Preprocessor macros taken from Boost
+ Algorithms/mitkPPArithmeticDec.h
+ Algorithms/mitkPPArgCount.h
+ Algorithms/mitkPPCat.h
+ Algorithms/mitkPPConfig.h
+ Algorithms/mitkPPControlExprIIf.h
+ Algorithms/mitkPPControlIf.h
+ Algorithms/mitkPPControlIIf.h
+ Algorithms/mitkPPDebugError.h
+ Algorithms/mitkPPDetailAutoRec.h
+ Algorithms/mitkPPDetailDMCAutoRec.h
+ Algorithms/mitkPPExpand.h
+ Algorithms/mitkPPFacilitiesEmpty.h
+ Algorithms/mitkPPFacilitiesExpand.h
+ Algorithms/mitkPPLogicalBool.h
+ Algorithms/mitkPPRepetitionDetailDMCFor.h
+ Algorithms/mitkPPRepetitionDetailEDGFor.h
+ Algorithms/mitkPPRepetitionDetailFor.h
+ Algorithms/mitkPPRepetitionDetailMSVCFor.h
+ Algorithms/mitkPPRepetitionFor.h
+ Algorithms/mitkPPSeqElem.h
+ Algorithms/mitkPPSeqForEach.h
+ Algorithms/mitkPPSeqForEachProduct.h
+ Algorithms/mitkPPSeq.h
+ Algorithms/mitkPPSeqEnum.h
+ Algorithms/mitkPPSeqSize.h
+ Algorithms/mitkPPSeqToTuple.h
+ Algorithms/mitkPPStringize.h
+ Algorithms/mitkPPTupleEat.h
+ Algorithms/mitkPPTupleElem.h
+ Algorithms/mitkPPTupleRem.h
+ Algorithms/mitkClippedSurfaceBoundsCalculator.h
+
DataManagement/mitkCommon.h
Interactions/mitkEventMapperAddOn.h
)
SET(CPP_FILES
Algorithms/mitkBaseDataSource.cpp
Algorithms/mitkBaseProcess.cpp
Algorithms/mitkCoreObjectFactoryBase.cpp
Algorithms/mitkCoreObjectFactory.cpp
Algorithms/mitkDataNodeFactory.cpp
Algorithms/mitkDataNodeSource.cpp
Algorithms/mitkGeometry2DDataToSurfaceFilter.cpp
Algorithms/mitkHistogramGenerator.cpp
Algorithms/mitkImageCaster.cpp
Algorithms/mitkImageCastPart1.cpp
Algorithms/mitkImageCastPart2.cpp
Algorithms/mitkImageCastPart3.cpp
Algorithms/mitkImageCastPart4.cpp
Algorithms/mitkImageChannelSelector.cpp
Algorithms/mitkImageSliceSelector.cpp
Algorithms/mitkImageSource.cpp
Algorithms/mitkImageTimeSelector.cpp
Algorithms/mitkImageToImageFilter.cpp
Algorithms/mitkPointSetSource.cpp
Algorithms/mitkPointSetToPointSetFilter.cpp
Algorithms/mitkRGBToRGBACastImageFilter.cpp
Algorithms/mitkSubImageSelector.cpp
Algorithms/mitkSurfaceSource.cpp
Algorithms/mitkSurfaceToSurfaceFilter.cpp
Algorithms/mitkUIDGenerator.cpp
Algorithms/mitkVolumeCalculator.cpp
+ Algorithms/mitkClippedSurfaceBoundsCalculator.cpp
Controllers/mitkBaseController.cpp
Controllers/mitkCallbackFromGUIThread.cpp
Controllers/mitkCameraController.cpp
Controllers/mitkCameraRotationController.cpp
Controllers/mitkFocusManager.cpp
Controllers/mitkLimitedLinearUndo.cpp
Controllers/mitkOperationEvent.cpp
Controllers/mitkProgressBar.cpp
Controllers/mitkRenderingManager.cpp
Controllers/mitkSliceNavigationController.cpp
Controllers/mitkSlicesCoordinator.cpp
Controllers/mitkSlicesRotator.cpp
Controllers/mitkSlicesSwiveller.cpp
Controllers/mitkStatusBar.cpp
Controllers/mitkStepper.cpp
Controllers/mitkTestManager.cpp
Controllers/mitkUndoController.cpp
Controllers/mitkVerboseLimitedLinearUndo.cpp
Controllers/mitkVtkInteractorCameraController.cpp
Controllers/mitkVtkLayerController.cpp
DataManagement/mitkAbstractTransformGeometry.cpp
DataManagement/mitkAnnotationProperty.cpp
DataManagement/mitkApplicationCursor.cpp
DataManagement/mitkBaseData.cpp
DataManagement/mitkBaseProperty.cpp
DataManagement/mitkClippingProperty.cpp
DataManagement/mitkColorProperty.cpp
DataManagement/mitkDataStorage.cpp
#DataManagement/mitkDataTree.cpp
DataManagement/mitkDataNode.cpp
#DataManagement/mitkDataTreeStorage.cpp
DataManagement/mitkDisplayGeometry.cpp
DataManagement/mitkEnumerationProperty.cpp
DataManagement/mitkGeometry2D.cpp
DataManagement/mitkGeometry2DData.cpp
DataManagement/mitkGeometry3D.cpp
DataManagement/mitkGeometryData.cpp
DataManagement/mitkGroupTagProperty.cpp
DataManagement/mitkImage.cpp
DataManagement/mitkImageDataItem.cpp
DataManagement/mitkLandmarkBasedCurvedGeometry.cpp
DataManagement/mitkLandmarkProjectorBasedCurvedGeometry.cpp
DataManagement/mitkLandmarkProjector.cpp
DataManagement/mitkLevelWindow.cpp
DataManagement/mitkLevelWindowManager.cpp
DataManagement/mitkLevelWindowPreset.cpp
DataManagement/mitkLevelWindowProperty.cpp
DataManagement/mitkLookupTable.cpp
DataManagement/mitkLookupTables.cpp # specializations of GenericLookupTable
DataManagement/mitkMemoryUtilities.cpp
DataManagement/mitkModalityProperty.cpp
DataManagement/mitkModeOperation.cpp
DataManagement/mitkNodePredicateAnd.cpp
DataManagement/mitkNodePredicateBase.cpp
DataManagement/mitkNodePredicateCompositeBase.cpp
DataManagement/mitkNodePredicateData.cpp
DataManagement/mitkNodePredicateDataType.cpp
DataManagement/mitkNodePredicateDimension.cpp
DataManagement/mitkNodePredicateFirstLevel.cpp
DataManagement/mitkNodePredicateNot.cpp
DataManagement/mitkNodePredicateOr.cpp
DataManagement/mitkNodePredicateProperty.cpp
DataManagement/mitkNodePredicateSource.cpp
DataManagement/mitkPlaneOrientationProperty.cpp
DataManagement/mitkPlaneGeometry.cpp
DataManagement/mitkPlaneOperation.cpp
DataManagement/mitkPointOperation.cpp
DataManagement/mitkPointSet.cpp
DataManagement/mitkProperties.cpp
DataManagement/mitkPropertyList.cpp
DataManagement/mitkRotationOperation.cpp
DataManagement/mitkSlicedData.cpp
DataManagement/mitkSlicedGeometry3D.cpp
DataManagement/mitkSmartPointerProperty.cpp
DataManagement/mitkStandaloneDataStorage.cpp
DataManagement/mitkStateTransitionOperation.cpp
DataManagement/mitkStringProperty.cpp
DataManagement/mitkSurface.cpp
DataManagement/mitkSurfaceOperation.cpp
DataManagement/mitkThinPlateSplineCurvedGeometry.cpp
DataManagement/mitkTimeSlicedGeometry.cpp
DataManagement/mitkTransferFunction.cpp
DataManagement/mitkTransferFunctionInitializer.cpp
DataManagement/mitkVector.cpp
DataManagement/mitkVtkInterpolationProperty.cpp
DataManagement/mitkVtkRepresentationProperty.cpp
DataManagement/mitkVtkResliceInterpolationProperty.cpp
DataManagement/mitkVtkScalarModeProperty.cpp
DataManagement/mitkVtkVolumeRenderingProperty.cpp
DataManagement/mitkWeakPointerProperty.cpp
DataManagement/mitkShaderProperty.cpp
DataManagement/mitkResliceMethodProperty.cpp
DataManagement/mitkMaterial.cpp
Interactions/mitkAction.cpp
Interactions/mitkAffineInteractor.cpp
Interactions/mitkCoordinateSupplier.cpp
Interactions/mitkDisplayCoordinateOperation.cpp
Interactions/mitkDisplayInteractor.cpp
Interactions/mitkDisplayPositionEvent.cpp
Interactions/mitkDisplayVectorInteractor.cpp
Interactions/mitkDisplayVectorInteractorLevelWindow.cpp
Interactions/mitkDisplayVectorInteractorScroll.cpp
Interactions/mitkEvent.cpp
Interactions/mitkEventDescription.cpp
Interactions/mitkEventMapper.cpp
Interactions/mitkGlobalInteraction.cpp
Interactions/mitkInteractor.cpp
Interactions/mitkMouseMovePointSetInteractor.cpp
Interactions/mitkMoveSurfaceInteractor.cpp
Interactions/mitkNodeDepententPointSetInteractor.cpp
Interactions/mitkPointSetInteractor.cpp
Interactions/mitkPositionEvent.cpp
Interactions/mitkPositionTracker.cpp
Interactions/mitkState.cpp
Interactions/mitkStateEvent.cpp
Interactions/mitkStateMachine.cpp
Interactions/mitkStateMachineFactory.cpp
Interactions/mitkTransition.cpp
Interactions/mitkWheelEvent.cpp
Interactions/mitkKeyEvent.cpp
Interactions/mitkVtkEventAdapter.cpp
IO/mitkBaseDataIOFactory.cpp
IO/mitkDicomSeriesReader.cpp
IO/mitkFileReader.cpp
IO/mitkFileSeriesReader.cpp
IO/mitkFileWriter.cpp
IO/mitkIpPicGet.c
IO/mitkImageGenerator.cpp
IO/mitkImageWriter.cpp
IO/mitkImageWriterFactory.cpp
IO/mitkItkImageFileIOFactory.cpp
IO/mitkItkImageFileReader.cpp
IO/mitkItkPictureWrite.cpp
IO/mitkLookupTableProperty.cpp
IO/mitkOperation.cpp
IO/mitkPicFileIOFactory.cpp
IO/mitkPicFileReader.cpp
IO/mitkPicFileWriter.cpp
IO/mitkPicHelper.cpp
IO/mitkPicVolumeTimeSeriesIOFactory.cpp
IO/mitkPicVolumeTimeSeriesReader.cpp
IO/mitkPixelType.cpp
IO/mitkPointSetIOFactory.cpp
IO/mitkPointSetReader.cpp
IO/mitkPointSetWriter.cpp
IO/mitkPointSetWriterFactory.cpp
IO/mitkRawImageFileReader.cpp
IO/mitkStandardFileLocations.cpp
IO/mitkSTLFileIOFactory.cpp
IO/mitkSTLFileReader.cpp
IO/mitkSurfaceVtkWriter.cpp
IO/mitkSurfaceVtkWriterFactory.cpp
IO/mitkVtiFileIOFactory.cpp
IO/mitkVtiFileReader.cpp
IO/mitkVtkImageIOFactory.cpp
IO/mitkVtkImageReader.cpp
IO/mitkVtkSurfaceIOFactory.cpp
IO/mitkVtkSurfaceReader.cpp
IO/vtkPointSetXMLParser.cpp
IO/mitkLog.cpp
Rendering/mitkBaseRenderer.cpp
Rendering/mitkVtkMapper2D.cpp
Rendering/mitkVtkMapper3D.cpp
Rendering/mitkRenderWindowFrame.cpp
Rendering/mitkGeometry2DDataMapper2D.cpp
Rendering/mitkGeometry2DDataVtkMapper3D.cpp
Rendering/mitkGLMapper2D.cpp
Rendering/mitkGradientBackground.cpp
Rendering/mitkManufacturerLogo.cpp
Rendering/mitkMapper2D.cpp
Rendering/mitkMapper3D.cpp
Rendering/mitkMapper.cpp
Rendering/mitkPointSetGLMapper2D.cpp
Rendering/mitkPointSetVtkMapper3D.cpp
Rendering/mitkPolyDataGLMapper2D.cpp
Rendering/mitkSurfaceGLMapper2D.cpp
Rendering/mitkSurfaceVtkMapper3D.cpp
Rendering/mitkVolumeDataVtkMapper3D.cpp
Rendering/mitkVtkPropRenderer.cpp
Rendering/mitkVtkWidgetRendering.cpp
Rendering/vtkMitkRectangleProp.cpp
Rendering/vtkMitkRenderProp.cpp
Rendering/mitkVtkEventProvider.cpp
Rendering/mitkRenderWindow.cpp
Rendering/mitkRenderWindowBase.cpp
Rendering/mitkShaderRepository.cpp
Rendering/mitkImageMapperGL2D.cpp
Rendering/vtkMitkThickSlicesFilter.cpp
)
diff --git a/CoreUI/Bundles/org.mitk.core.services/src/internal/mitkPluginActivator.h b/CoreUI/Bundles/org.mitk.core.services/src/internal/mitkPluginActivator.h
index 85a5aabfd3..aad76afeff 100644
--- a/CoreUI/Bundles/org.mitk.core.services/src/internal/mitkPluginActivator.h
+++ b/CoreUI/Bundles/org.mitk.core.services/src/internal/mitkPluginActivator.h
@@ -1,52 +1,51 @@
/*=========================================================================
Program: Medical Imaging & Interaction Toolkit
Language: C++
Date: $Date$
Version: $Revision$
Copyright (c) German Cancer Research Center, Division of Medical and
Biological Informatics. All rights reserved.
See MITKCopyright.txt or http://www.mitk.org/copyright.html for details.
This software is distributed WITHOUT ANY WARRANTY; without even
the implied warranty of MERCHANTABILITY or FITNESS FOR A PARTICULAR
PURPOSE. See the above copyright notices for more information.
=========================================================================*/
#ifndef MITKCORESERVICESPLUGIN_H_
#define MITKCORESERVICESPLUGIN_H_
#include <berryPlugin.h>
#include <berryIBundleContext.h>
-#include "mitkCoreServicesPluginDll.h"
#include "mitkIDataStorageService.h"
namespace mitk
{
-class MITK_CORE_SERVICES_PLUGIN org_mitk_core_services_Activator : public QObject, public ctkPluginActivator
+class org_mitk_core_services_Activator : public QObject, public ctkPluginActivator
{
Q_OBJECT
Q_INTERFACES(ctkPluginActivator)
public:
static const std::string PLUGIN_ID;
void start(ctkPluginContext* context);
void stop(ctkPluginContext* context);
private:
mitk::IDataStorageService::Pointer dataStorageService;
};
typedef org_mitk_core_services_Activator PluginActivator;
}
#endif /*MITKCORESERVICESPLUGIN_H_*/
diff --git a/CoreUI/Bundles/org.mitk.core.services/src/mitkCoreServicesPluginDll.h b/CoreUI/Bundles/org.mitk.core.services/src/mitkCoreServicesPluginDll.h
deleted file mode 100644
index f1fc12926f..0000000000
--- a/CoreUI/Bundles/org.mitk.core.services/src/mitkCoreServicesPluginDll.h
+++ /dev/null
@@ -1,43 +0,0 @@
-/*=========================================================================
-
-Program: Medical Imaging & Interaction Toolkit
-Language: C++
-Date: $Date$
-Version: $Revision$
-
-Copyright (c) German Cancer Research Center, Division of Medical and
-Biological Informatics. All rights reserved.
-See MITKCopyright.txt or http://www.mitk.org/copyright.html for details.
-
-This software is distributed WITHOUT ANY WARRANTY; without even
-the implied warranty of MERCHANTABILITY or FITNESS FOR A PARTICULAR
-PURPOSE. See the above copyright notices for more information.
-
-=========================================================================*/
-
-#ifndef MITKCORESERVICESPLUGINDLL_H_
-#define MITKCORESERVICESPLUGINDLL_H_
-
-
-//
-// The following block is the standard way of creating macros which make exporting
-// from a DLL simpler. All files within this DLL are compiled with the MITK_EXPORTS
-// symbol defined on the command line. this symbol should not be defined on any project
-// that uses this DLL. This way any other project whose source files include this file see
-// MITK_API functions as being imported from a DLL, wheras this DLL sees symbols
-// defined with this macro as being exported.
-//
-#if defined(_WIN32) // && !defined(MITK_STATIC)
- #if defined(org_mitk_core_services_EXPORTS)
- #define MITK_CORE_SERVICES_PLUGIN __declspec(dllexport)
- #else
- #define MITK_CORE_SERVICES_PLUGIN __declspec(dllimport)
- #endif
-#endif
-
-
-#if !defined(MITK_CORE_SERVICES_PLUGIN)
- #define MITK_CORE_SERVICES_PLUGIN
-#endif
-
-#endif /*MITKCORESERVICESPLUGINDLL_H_*/
diff --git a/CoreUI/Bundles/org.mitk.core.services/src/mitkIDataStorageReference.h b/CoreUI/Bundles/org.mitk.core.services/src/mitkIDataStorageReference.h
index d1335f581c..73630284de 100644
--- a/CoreUI/Bundles/org.mitk.core.services/src/mitkIDataStorageReference.h
+++ b/CoreUI/Bundles/org.mitk.core.services/src/mitkIDataStorageReference.h
@@ -1,48 +1,48 @@
/*=========================================================================
Program: Medical Imaging & Interaction Toolkit
Language: C++
Date: $Date$
Version: $Revision$
Copyright (c) German Cancer Research Center, Division of Medical and
Biological Informatics. All rights reserved.
See MITKCopyright.txt or http://www.mitk.org/copyright.html for details.
This software is distributed WITHOUT ANY WARRANTY; without even
the implied warranty of MERCHANTABILITY or FITNESS FOR A PARTICULAR
PURPOSE. See the above copyright notices for more information.
=========================================================================*/
#ifndef MITKIDATASTORAGEREFERENCE_H_
#define MITKIDATASTORAGEREFERENCE_H_
#include <berryObject.h>
#include <berryMacros.h>
-#include "mitkCoreServicesPluginDll.h"
+#include <org_mitk_core_services_Export.h>
#include <mitkDataStorage.h>
namespace mitk
{
struct MITK_CORE_SERVICES_PLUGIN IDataStorageReference : public berry::Object
{
berryInterfaceMacro(IDataStorageReference, mitk);
virtual DataStorage::Pointer GetDataStorage() const = 0;
virtual bool IsDefault() const = 0;
virtual std::string GetLabel() const = 0;
virtual void SetLabel(const std::string& label) = 0;
virtual bool operator==(const IDataStorageReference* o) const = 0;
};
}
#endif /*MITKIDATASTORAGEREFERENCE_H_*/
diff --git a/CoreUI/Bundles/org.mitk.core.services/src/mitkIDataStorageService.h b/CoreUI/Bundles/org.mitk.core.services/src/mitkIDataStorageService.h
index 01bcb01254..4bbfcc94ad 100644
--- a/CoreUI/Bundles/org.mitk.core.services/src/mitkIDataStorageService.h
+++ b/CoreUI/Bundles/org.mitk.core.services/src/mitkIDataStorageService.h
@@ -1,52 +1,52 @@
/*=========================================================================
Program: Medical Imaging & Interaction Toolkit
Language: C++
Date: $Date$
Version: $Revision$
Copyright (c) German Cancer Research Center, Division of Medical and
Biological Informatics. All rights reserved.
See MITKCopyright.txt or http://www.mitk.org/copyright.html for details.
This software is distributed WITHOUT ANY WARRANTY; without even
the implied warranty of MERCHANTABILITY or FITNESS FOR A PARTICULAR
PURPOSE. See the above copyright notices for more information.
=========================================================================*/
#ifndef MITKIDATASTORAGESERVICE_H_
#define MITKIDATASTORAGESERVICE_H_
#include <berryService.h>
-#include "mitkCoreServicesPluginDll.h"
+#include <org_mitk_core_services_Export.h>
#include "mitkIDataStorageReference.h"
#include <string>
#include <QtPlugin>
namespace mitk
{
struct MITK_CORE_SERVICES_PLUGIN IDataStorageService : public berry::Service
{
berryInterfaceMacro(IDataStorageService, berry);
static const std::string ID;
virtual IDataStorageReference::Pointer CreateDataStorage(const std::string& label) = 0;
virtual std::vector<IDataStorageReference::Pointer> GetDataStorageReferences() const = 0;
virtual IDataStorageReference::Pointer GetDefaultDataStorage() const = 0;
virtual IDataStorageReference::Pointer GetActiveDataStorage() const = 0;
virtual void SetActiveDataStorage(IDataStorageReference::Pointer dataStorageRef) = 0;
};
}
Q_DECLARE_INTERFACE(mitk::IDataStorageService, "org.mitk.service.IDataStorageService")
#endif /*MITKIDATASTORAGESERVICE_H_*/
diff --git a/CoreUI/Bundles/org.mitk.gui.qt.common/resources/StateMachine.xml b/CoreUI/Bundles/org.mitk.gui.qt.common/resources/StateMachine.xml
index 97595aea40..46a38090fa 100644
--- a/CoreUI/Bundles/org.mitk.gui.qt.common/resources/StateMachine.xml
+++ b/CoreUI/Bundles/org.mitk.gui.qt.common/resources/StateMachine.xml
@@ -1,3713 +1,3744 @@
<?xml version="1.0" encoding="utf-8"?>
<!-- Event_Id = 0: this is a * transition with all other eventId's not declared in that state -->
<mitkInteraktionStates xmlns="http://tempuri.org/StateMachine.xsd" STYLE="User001">
<!-- ***WARNING*** do not use any &, % and so on in NAME -->
<!-- -->
<!-- -->
<!-- EventDescriptions -->
<events STYLE="standard">
<!-- Null Event -->
<!-- not here defined, cause this will never be send from external to mitk (to be mapped in mitkEventMapper to an mitk-event)-->
<!-- left MouseButton -->
<event NAME="left MouseBN" ID="1" TYPE="Type_MouseButtonPress" BUTTON="BS_LeftButton" BUTTONSTATE="0x0000" KEY="Key_none" />
<!-- right MouseButton -->
<event NAME="right MouseBN" ID="2" TYPE="Type_MouseButtonPress" BUTTON="BS_RightButton" BUTTONSTATE="0x0000" KEY="Key_none" />
<!-- Shift + left MouseButton -->
<event NAME="left MouseBN + Shift" ID="3" TYPE="Type_MouseButtonPress" BUTTON="BS_LeftButton" BUTTONSTATE="0x0100" KEY="Key_none" />
<!-- middle MouseButton -->
<event NAME="middle MouseBN" ID="4" TYPE="Type_MouseButtonPress" BUTTON="BS_MidButton" BUTTONSTATE="0x0000" KEY="Key_none" />
<!-- Ctrl + left MouseButton -->
<event NAME="CTRL+leftBN" ID="5" TYPE="Type_MouseButtonPress" BUTTON="BS_LeftButton" BUTTONSTATE="0x0200" KEY="Key_none" />
<!-- Ctrl + middle MouseButton -->
<event NAME="CTRL+middleBN" ID="6" TYPE="Type_MouseButtonPress" BUTTON="BS_MidButton" BUTTONSTATE="0x0200" KEY="Key_none" />
<!-- Ctrl + right MouseButton -->
<event NAME="CTRL+rightBN" ID="7" TYPE="Type_MouseButtonPress" BUTTON="BS_RightButton" BUTTONSTATE="0x0200" KEY="Key_none" />
<!-- left MouseButton DoubleClick-->
<event NAME="left MouseBN DC" ID="8" TYPE="Type_MouseButtonDblClick" BUTTON="BS_LeftButton" BUTTONSTATE="0x0000" KEY="Key_none" />
<!-- MouseWheel-->
<event NAME="MouseWheel" ID="9" TYPE="Type_Wheel" BUTTON="BS_NoButton" BUTTONSTATE="0x0000" KEY="Key_none" />
<!-- Strg + N -->
<event NAME="Strg + N" ID="10" TYPE="Type_KeyPress" BUTTON="BS_NoButton" BUTTONSTATE="0x0200" KEY="Key_N" />
<!-- Strg + E -->
<event NAME="Strg + E" ID="11" TYPE="Type_KeyPress" BUTTON="BS_NoButton" BUTTONSTATE="0x0200" KEY="Key_E" />
<!-- Delete -->
<event NAME="Delete" ID="12" TYPE="Type_KeyPress" BUTTON="BS_NoButton" BUTTONSTATE="0x0000" KEY="Key_Delete" />
<!-- Esc -->
<event NAME="Escape" ID="14" TYPE="Type_KeyPress" BUTTON="BS_NoButton" BUTTONSTATE="0x0000" KEY="Key_Escape" />
<!-- N-->
<event NAME="N" ID="13" TYPE="Type_KeyPress" BUTTON="BS_NoButton" BUTTONSTATE="0x0000" KEY="Key_N" />
<!-- P-->
<event NAME="P" ID="15" TYPE="Type_KeyPress" BUTTON="BS_NoButton" BUTTONSTATE="0x0000" KEY="Key_P" />
<!-- R-->
<event NAME="R" ID="16" TYPE="Type_KeyPress" BUTTON="BS_NoButton" BUTTONSTATE="0x0000" KEY="Key_R" />
<!-- T-->
<event NAME="T" ID="17" TYPE="Type_KeyPress" BUTTON="BS_NoButton" BUTTONSTATE="0x0000" KEY="Key_T" />
<!-- S-->
<event NAME="S" ID="18" TYPE="Type_KeyPress" BUTTON="BS_NoButton" BUTTONSTATE="0x0000" KEY="Key_S" />
<!-- E -->
<event NAME="E" ID="19" TYPE="Type_KeyPress" BUTTON="BS_NoButton" BUTTONSTATE="0x0000" KEY="Key_E" />
<!-- Strg + Alt + A -->
<event NAME="Strg+Alt+A" ID="20" TYPE="Type_KeyPress" BUTTON="BS_NoButton" BUTTONSTATE="0x0600" KEY="Key_A" />
<!-- Strg + Alt + B -->
<event NAME="Strg+Alt+B" ID="21" TYPE="Type_KeyPress" BUTTON="BS_NoButton" BUTTONSTATE="0x0600" KEY="Key_B" />
<!-- H-->
<event NAME="H" ID="22" TYPE="Type_KeyPress" BUTTON="BS_NoButton" BUTTONSTATE="0x0000" KEY="Key_H" />
<!-- Return -->
<event NAME="Return" ID="23" TYPE="Type_KeyPress" BUTTON="BS_NoButton" BUTTONSTATE="0x0000" KEY="Key_Return" />
<!-- Enter -->
<event NAME="Enter" ID="24" TYPE="Type_KeyPress" BUTTON="BS_NoButton" BUTTONSTATE="0x0000" KEY="Key_Enter" />
<!-- Space -->
<event NAME="Space" ID="25" TYPE="Type_KeyPress" BUTTON="BS_NoButton" BUTTONSTATE="0x0000" KEY="Key_Space" />
<!-- Plus -->
<event NAME="Plus" ID="26" TYPE="Type_KeyPress" BUTTON="BS_NoButton" BUTTONSTATE="0x0000" KEY="Key_Plus" />
<!-- Minus -->
<event NAME="Minus" ID="27" TYPE="Type_KeyPress" BUTTON="BS_NoButton" BUTTONSTATE="0x0000" KEY="Key_Minus" />
<!-- Strg + Alt + H -->
<event NAME="Strg+Alt+H" ID="30" TYPE="Type_KeyPress" BUTTON="BS_NoButton" BUTTONSTATE="0x0600" KEY="Key_H" />
<!-- Strg + Alt + I -->
<event NAME="Strg+Alt+I" ID="31" TYPE="Type_KeyPress" BUTTON="BS_NoButton" BUTTONSTATE="0x0600" KEY="Key_I" />
<!-- Strg + Alt + S -->
<event NAME="Strg+Alt+S" ID="40" TYPE="Type_KeyPress" BUTTON="BS_NoButton" BUTTONSTATE="0x0600" KEY="Key_S" />
<!-- ArrowUp -->
<event NAME="ArrowUp" ID="50" TYPE="Type_KeyPress" BUTTON="BS_NoButton" BUTTONSTATE="0x0000" KEY="Key_Up" />
<!-- ArrowDown -->
<event NAME="ArrowDown" ID="51" TYPE="Type_KeyPress" BUTTON="BS_NoButton" BUTTONSTATE="0x0000" KEY="Key_Down" />
<!-- ArrowLeft -->
<event NAME="ArrowLeft" ID="52" TYPE="Type_KeyPress" BUTTON="BS_NoButton" BUTTONSTATE="0x0000" KEY="Key_Left" />
<!-- ArrowRight -->
<event NAME="ArrowRight" ID="53" TYPE="Type_KeyPress" BUTTON="BS_NoButton" BUTTONSTATE="0x0000" KEY="Key_Right" />
<!-- ArrowUp + Shift -->
<event NAME="ArrowUp+Shift" ID="54" TYPE="Type_KeyPress" BUTTON="BS_NoButton" BUTTONSTATE="0x0100" KEY="Key_Up" />
<!-- ArrowDown +Shift -->
<event NAME="ArrowDown+Shift" ID="55" TYPE="Type_KeyPress" BUTTON="BS_NoButton" BUTTONSTATE="0x0100" KEY="Key_Down" />
<!-- Alt -->
<event NAME="Alt" ID="90" TYPE="Type_KeyPress" BUTTON="BS_NoButton" BUTTONSTATE="0x0400" KEY="Key_Alt" />
<!-- Strg + B -->
<event NAME="Strg+B" ID="91" TYPE="Type_KeyPress" BUTTON="BS_NoButton" BUTTONSTATE="0x0200" KEY="Key_B" />
<!-- leftMouseButtonRelease -->
<event NAME="leftMouseRelease" ID="505" TYPE="Type_MouseButtonRelease" BUTTON="BS_LeftButton" BUTTONSTATE="0x0001" KEY="Key_none" />
<!-- MiddleMouseButtonRelease -->
<event NAME="MiddleMouseRelease" ID="506" TYPE="Type_MouseButtonRelease" BUTTON="BS_MidButton" BUTTONSTATE="0x0004" KEY="Key_none" />
<!-- RightMouseButtonRelease -->
<event NAME="RightMouseRelease" ID="507" TYPE="Type_MouseButtonRelease" BUTTON="BS_RightButton" BUTTONSTATE="0x0002" KEY="Key_none" />
<!-- Shift + left MouseButtonRelease -->
<event NAME="left MouseBNRelease+Shift" ID="508" TYPE="Type_MouseButtonRelease" BUTTON="BS_LeftButton" BUTTONSTATE="0x0101" KEY="Key_none" />
<!-- MouseMove -->
<event NAME="MouseMove" ID="520" TYPE="Type_MouseMove" BUTTON="BS_NoButton" BUTTONSTATE="0x0000" KEY="Key_none" />
<!-- left MouseButton and MouseWheel -->
<event NAME="leftBN+MouseWheel" ID="521" TYPE="Type_Wheel" BUTTON="BS_LeftButton" BUTTONSTATE="0x0001" KEY="Key_none" />
<!-- right MouseButton and MouseWheel -->
<event NAME="rightBN+MouseWheel" ID="522" TYPE="Type_Wheel" BUTTON="BS_RightButton" BUTTONSTATE="0x0002" KEY="Key_none" />
<!-- middle MouseButton and MouseWheel -->
<event NAME="middleBN+MouseWheel" ID="523" TYPE="Type_Wheel" BUTTON="BS_MidButton" BUTTONSTATE="0x0004" KEY="Key_none" />
<!-- left MouseButton and MouseMove -->
<event NAME="leftBN+MouseMove" ID="530" TYPE="Type_MouseMove" BUTTON="BS_NoButton" BUTTONSTATE="0x0001" KEY="Key_none" />
<!-- right MouseButton and MouseMove -->
<event NAME="rightBN+MouseMove" ID="531" TYPE="Type_MouseMove" BUTTON="BS_NoButton" BUTTONSTATE="0x0002" KEY="Key_none" />
<!-- middle MouseButton and MouseMove -->
<event NAME="middleBN+MouseMove" ID="533" TYPE="Type_MouseMove" BUTTON="BS_NoButton" BUTTONSTATE="0x0004" KEY="Key_none" />
<!-- CTRL + left MouseButton and MouseMove -->
<event NAME="CTRL+leftBN+MouseMove" ID="534" TYPE="Type_MouseMove" BUTTON="BS_NoButton" BUTTONSTATE="0x0201" KEY="Key_none" />
<!-- CTRL + right MouseButton and MouseMove -->
<event NAME="CTRL+rightBN+MouseMove" ID="535" TYPE="Type_MouseMove" BUTTON="BS_NoButton" BUTTONSTATE="0x0202" KEY="Key_none" />
<!-- CTRL + middle MouseButton and MouseMove -->
<event NAME="CTRL+middleBN+MouseMove" ID="536" TYPE="Type_MouseMove" BUTTON="BS_NoButton" BUTTONSTATE="0x0204" KEY="Key_none" />
<!-- CTRL + left MouseButtonRelease -->
<event NAME="CTRL+leftBNRelease" ID="537" TYPE="Type_MouseButtonRelease" BUTTON="BS_LeftButton" BUTTONSTATE="0x0201" KEY="Key_none" />
<!-- CTRL + right MouseButtonRelease -->
<event NAME="CTRL+rightBNRelease" ID="538" TYPE="Type_MouseButtonRelease" BUTTON="BS_RightButton" BUTTONSTATE="0x0202" KEY="Key_none" />
<!-- CTRL + middle MouseButtonRelease -->
<event NAME="CTRL+middleBNRelease" ID="539" TYPE="Type_MouseButtonRelease" BUTTON="BS_MidButton" BUTTONSTATE="0x0204" KEY="Key_none" />
<!-- Shift + Ctrl + left MouseButton -->
<event NAME="SHIFT+CTRL+MousePress" ID="540" TYPE="Type_MouseButtonPress" BUTTON="BS_LeftButton" BUTTONSTATE="0x0300" KEY="Key_none" />
<!-- Shift + Ctrl + left MouseButtonMove -->
<event NAME="SHIFT+CTRL+MouseMove" ID="542" TYPE="Type_MouseMove" BUTTON="BS_NoButton" BUTTONSTATE="0x0301" KEY="Key_none" />
<!-- Shift + Ctrl + left MouseButtonRelease -->
<event NAME="SHIFT+CTRL+MouseRelease" ID="543" TYPE="Type_MouseButtonRelease" BUTTON="BS_LeftButton" BUTTONSTATE="0x0301" KEY="Key_none" />
<!-- Shift + left MouseButton and MouseMove -->
<event NAME="Shift+leftBN+MouseMove" ID="541" TYPE="Type_MouseMove" BUTTON="BS_NoButton" BUTTONSTATE="0x0101" KEY="Key_none" />
<!-- ALT + left MouseButton -->
<event NAME="ALT+leftBN" ID="600" TYPE="Type_MouseButtonPress" BUTTON="BS_LeftButton" BUTTONSTATE="0x0400" KEY="Key_none" />
<!-- ALT + left MouseButton and MouseMove -->
<event NAME="ALT+leftBN+MouseMove" ID="610" TYPE="Type_MouseMove" BUTTON="BS_NoButton" BUTTONSTATE="0x0401" KEY="Key_none" />
<!-- ALT + leftMouseButtonRelease -->
<event NAME="ALT+leftMouseRelease" ID="620" TYPE="Type_MouseButtonRelease" BUTTON="BS_LeftButton" BUTTONSTATE="0x0401" KEY="Key_none" />
<!-- SHIFT + rightMouseButtonPress -->
<event NAME="Shift+rightMousePress" ID="2000" TYPE="Type_MouseButtonPress" BUTTON="BS_RightButton" BUTTONSTATE="0x0100" KEY="Key_none" />
<!-- SHIFT + rightMouseButtonMove -->
<event NAME="Shift+rightMouseMove" ID="2001" TYPE="Type_MouseMove" BUTTON="BS_NoButton" BUTTONSTATE="0x0102" KEY="Key_none" />
<!-- SHIFT + rightMouseButtonRelease -->
<event NAME="Shift+rightMouseRelease" ID="2002" TYPE="Type_MouseButtonRelease" BUTTON="BS_RightButton" BUTTONSTATE="0x0102" KEY="Key_none" />
<!-- SHIFT + middleMouseButtonPress -->
<event NAME="Shift+middleMousePress" ID="2003" TYPE="Type_MouseButtonPress" BUTTON="BS_MidButton" BUTTONSTATE="0x0100" KEY="Key_none" />
<!-- SHIFT + middleMouseButtonMove -->
<event NAME="Shift+middleMouseMove" ID="2004" TYPE="Type_MouseMove" BUTTON="BS_NoButton" BUTTONSTATE="0x0104" KEY="Key_none" />
<!-- SHIFT + middleMouseButtonRelease -->
<event NAME="Shift+middleMouseRelease" ID="2005" TYPE="Type_MouseButtonRelease" BUTTON="BS_MidButton" BUTTONSTATE="0x0104" KEY="Key_none" />
<!-- -->
<!-- -->
<!-- own thrown events -->
<!-- *****Important*****: has to be set in mitkInteractionConst.h-->
<event NAME="new" ID="1000" TYPE="Type_User" BUTTON="BS_NoButton" BUTTONSTATE="0x0000" KEY="Key_none" />
<event NAME="old" ID="1001" TYPE="Type_User" BUTTON="BS_NoButton" BUTTONSTATE="0x0000" KEY="Key_none" />
<event NAME="finished" ID="1002" TYPE="Type_User" BUTTON="BS_NoButton" BUTTONSTATE="0x0000" KEY="Key_none" />
<event NAME="StSELECT" ID="1003" TYPE="Type_User" BUTTON="BS_NoButton" BUTTONSTATE="0x0000" KEY="Key_none" />
<event NAME="StDESELECT" ID="1004" TYPE="Type_User" BUTTON="BS_NoButton" BUTTONSTATE="0x0000" KEY="Key_none" />
<event NAME="EIDNO" ID="1003" TYPE="Type_User" BUTTON="BS_NoButton" BUTTONSTATE="0x0000" KEY="Key_none" />
<event NAME="EIDYES" ID="1004" TYPE="Type_User" BUTTON="BS_NoButton" BUTTONSTATE="0x0000" KEY="Key_none" />
<event NAME="same" ID="1005" TYPE="Type_User" BUTTON="BS_NoButton" BUTTONSTATE="0x0000" KEY="Key_none" />
<event NAME="no and last object" ID="1006" TYPE="Type_User" BUTTON="BS_NoButton" BUTTONSTATE="0x0000" KEY="Key_none" />
<event NAME="no and not last object" ID="1007" TYPE="Type_User" BUTTON="BS_NoButton" BUTTONSTATE="0x0000" KEY="Key_none" />
<event NAME="last" ID="1008" TYPE="Type_User" BUTTON="BS_NoButton" BUTTONSTATE="0x0000" KEY="Key_none" />
<event NAME="not last" ID="1009" TYPE="Type_User" BUTTON="BS_NoButton" BUTTONSTATE="0x0000" KEY="Key_none" />
<event NAME="SetStateMachineToSelectedMode" ID="1030" TYPE="Type_User" BUTTON="BS_NoButton" BUTTONSTATE="0x0000" KEY="Key_none" />
<event NAME="SetStateMachineToDeselectedMode" ID="1031" TYPE="Type_User" BUTTON="BS_NoButton" BUTTONSTATE="0x0000" KEY="Key_none" />
<!-- for n-PointRoi-->
<event NAME="StSMALERNMINUS1 " ID="1010" TYPE="Type_User" BUTTON="BS_NoButton" BUTTONSTATE="0x0000" KEY="Key_none" />
<event NAME="StLARGERNMINUS1" ID="1011" TYPE="Type_User" BUTTON="BS_NoButton" BUTTONSTATE="0x0000" KEY="Key_none" />
<!-- -->
<event NAME="ActivateTool" ID="1300" TYPE="Type_User" BUTTON="BS_NoButton" BUTTONSTATE="0x0000" KEY="Key_none" />
<!-- -->
<!-- Sonstiges -->
<!--<event NAME="PositionEvent" ID="1012" TYPE="Type_MouseButtonPress" BUTTON="BS_LeftButton" BUTTONSTATE="0x0000" KEY="Key_none" />-->
<!-- DoubleClick <event NAME="PositionEvent" ID="510" TYPE="4" BUTTON="0x0001" BUTTONSTATE="0x0000" KEY="0xffff" />-->
<!--<event NAME="StSmallerN" ID="1014" TYPE="Type_User" BUTTON="BS_NoButton" BUTTONSTATE="0x0000" KEY="Key_none" />-->
<!--<event NAME="StEqualsN" ID="1015" TYPE="Type_User" BUTTON="BS_NoButton" BUTTONSTATE="0x0000" KEY="Key_none" />-->
<!--<event NAME="StLargerN" ID="1016" TYPE="Type_User" BUTTON="BS_NoButton" BUTTONSTATE="0x0000" KEY="Key_none" />-->
<!-- for external thrown Events-->
<event NAME="clear" ID="1100" TYPE="Type_User" BUTTON="BS_NoButton" BUTTONSTATE="0x0000" KEY="Key_none" />
<!-- Puncture Application -->
<event NAME="print" ID="3001" TYPE="Type_Application" BUTTON="BS_NoButton" BUTTONSTATE="0x0000" KEY="Key_none" />
</events>
<!-- Beginning of state machine patterns-->
<!-- TutorialStep10Begin -->
<stateMachine NAME="SelectAndMoveObjectWithArrowKeys">
<state NAME="start" ID="1" START_STATE="TRUE" X_POS="3" Y_POS="40" WIDTH="100" HEIGHT="50">
<transition NAME="CheckIfObjectIsPicked" NEXT_STATE_ID="2" EVENT_ID="1">
<action ID="30" />
<!-- 30 = AcCHECKELEMENT -->
</transition>
</state>
<state NAME="Guard_IsObjectPicked" ID="2" X_POS="282" Y_POS="23" WIDTH="126" HEIGHT="50">
<transition NAME="yes" NEXT_STATE_ID="10" EVENT_ID="1004">
<action ID="65" />
<!-- AcSELECT -->
<action ID="1101" />
<!--AcMODE_SELECT-->
</transition>
<transition NAME="no" NEXT_STATE_ID="1" EVENT_ID="1003">
<action ID="75" />
<!-- AcDESELECT -->
<action ID="1100" />
<!--AcMODE_DESELECT-->
</transition>
</state>
<state NAME="object selected" ID="10" X_POS="714" Y_POS="85" WIDTH="100" HEIGHT="50">
<transition NAME="CheckIfObjectIsPicked" NEXT_STATE_ID="2" EVENT_ID="1">
<action ID="30" />
<!-- AcCHECKELEMENT -->
</transition>
<transition NAME="z+" NEXT_STATE_ID="10" EVENT_ID="50">
<action ID="92">
<!-- AcMove -->
<intParameter NAME="DIRECTION_X" VALUE="0" />
<intParameter NAME="DIRECTION_Y" VALUE="0" />
<intParameter NAME="DIRECTION_Z" VALUE="1" />
</action>
</transition>
<transition NAME="z-" NEXT_STATE_ID="10" EVENT_ID="51">
<action ID="92">
<!-- AcMove -->
<intParameter NAME="DIRECTION_X" VALUE="0" />
<intParameter NAME="DIRECTION_Y" VALUE="0" />
<intParameter NAME="DIRECTION_Z" VALUE="-1" />
</action>
</transition>
<transition NAME="x+" NEXT_STATE_ID="10" EVENT_ID="52">
<action ID="92">
<!-- AcMove -->
<intParameter NAME="DIRECTION_X" VALUE="1" />
<intParameter NAME="DIRECTION_Y" VALUE="0" />
<intParameter NAME="DIRECTION_Z" VALUE="0" />
</action>
</transition>
<transition NAME="x-" NEXT_STATE_ID="10" EVENT_ID="53">
<action ID="92">
<!-- AcMove -->
<intParameter NAME="DIRECTION_X" VALUE="-1" />
<intParameter NAME="DIRECTION_Y" VALUE="0" />
<intParameter NAME="DIRECTION_Z" VALUE="0" />
</action>
</transition>
<transition NAME="y+" NEXT_STATE_ID="10" EVENT_ID="54">
<action ID="92">
<!-- AcMove -->
<intParameter NAME="DIRECTION_X" VALUE="0" />
<intParameter NAME="DIRECTION_Y" VALUE="1" />
<intParameter NAME="DIRECTION_Z" VALUE="0" />
</action>
</transition>
<transition NAME="y-" NEXT_STATE_ID="10" EVENT_ID="55">
<action ID="92">
<!-- AcMove -->
<intParameter NAME="DIRECTION_X" VALUE="0" />
<intParameter NAME="DIRECTION_Y" VALUE="-1" />
<intParameter NAME="DIRECTION_Z" VALUE="0" />
</action>
</transition>
</state>
</stateMachine>
<!-- TutorialStep10End -->
<stateMachine NAME="AffineInteractions click to select">
<state NAME="start" ID="1" START_STATE="TRUE" X_POS="3" Y_POS="40" WIDTH="100" HEIGHT="50">
<transition NAME="leftButtonPress" NEXT_STATE_ID="2" EVENT_ID="1">
<!-- 30 = SeCHECKELEMENT -->
<action ID="30" />
</transition>
</state>
<state NAME="object selected check" ID="2" X_POS="282" Y_POS="23" WIDTH="126" HEIGHT="50">
<transition NAME="yes" NEXT_STATE_ID="10" EVENT_ID="1004">
<!-- EIDYES -->
<action ID="0" />
</transition>
<transition NAME="no" NEXT_STATE_ID="1" EVENT_ID="1003">
<!-- EIDNO -->
<action ID="0" />
</transition>
</state>
<state NAME="neutral" ID="10" X_POS="714" Y_POS="85" WIDTH="100" HEIGHT="50">
<transition NAME="leftButtonPress" NEXT_STATE_ID="20" EVENT_ID="1">
<!-- 30 = SeCHECKELEMENT -->
<action ID="30" />
</transition>
<transition NAME="rightButtonPress" NEXT_STATE_ID="31" EVENT_ID="2">
<!-- 1002 = SeSCALESTART -->
<action ID="1002" />
</transition>
<transition NAME="middleButtonPress" NEXT_STATE_ID="41" EVENT_ID="4">
<!-- 1004 = SeROTATESTART -->
<action ID="1004" />
</transition>
</state>
<state NAME="object deselect check" ID="20" X_POS="57" Y_POS="396" WIDTH="122" HEIGHT="50">
<transition NAME="yes" NEXT_STATE_ID="21" EVENT_ID="1004">
<!-- 1000 = SeTRANSLATESTART -->
<action ID="1000" />
</transition>
<transition NAME="no" NEXT_STATE_ID="1" EVENT_ID="1003">
<!-- EIDNO -->
<action ID="0" />
</transition>
</state>
<state NAME="translating" ID="21" X_POS="203" Y_POS="150" WIDTH="100" HEIGHT="50">
<transition NAME="leftButtonMove" NEXT_STATE_ID="21" EVENT_ID="530">
<!-- 1001 = SeTRANSLATE -->
<action ID="1000" />
</transition>
<transition NAME="leftButtonRelease" NEXT_STATE_ID="10" EVENT_ID="505">
<!-- 0 = no action -->
<action ID="0" />
</transition>
</state>
<state NAME="scaling" ID="31" X_POS="347" Y_POS="459" WIDTH="100" HEIGHT="50">
<transition NAME="rightButtonMove" NEXT_STATE_ID="31" EVENT_ID="531">
<!-- 1003 = SeSCALE -->
<action ID="1003" />
</transition>
<transition NAME="rightButtonRelease" NEXT_STATE_ID="10" EVENT_ID="507">
<!-- 0 = no action -->
<action ID="0" />
</transition>
</state>
<state NAME="rotating" ID="41" X_POS="657" Y_POS="465" WIDTH="100" HEIGHT="50">
<transition NAME="middleButtonMove" NEXT_STATE_ID="41" EVENT_ID="533">
<!-- 1005 = SeROTATE -->
<action ID="1005" />
</transition>
<transition NAME="middleButtonRelease" NEXT_STATE_ID="10" EVENT_ID="506">
<!-- 0 = no action -->
<action ID="0" />
</transition>
</state>
</stateMachine>
<stateMachine NAME="AffineInteractions ctrl-drag">
<!-- affine interactions standard statemachine -->
<state NAME="start" ID="0" START_STATE="TRUE" X_POS="29" Y_POS="70" WIDTH="100" HEIGHT="50">
<transition NAME="leftButtonPress" NEXT_STATE_ID="12" EVENT_ID="5">
<!-- CTRL+LBM_Down -->
<action ID="30">
<!--AcCHECKELEMENT-->
</action>
</transition>
<transition NAME="leftButtonPress" NEXT_STATE_ID="12" EVENT_ID="540">
<!-- SHIFT+CTRL+LBM_Down -->
<action ID="11">
<!--AcADD-->
</action>
</transition>
<transition NAME="middleButtonPress" NEXT_STATE_ID="14" EVENT_ID="6">
<!-- CTRL+MBM_Down -->
<action ID="30">
<!--AcCHECKELEMENT-->
</action>
</transition>
<transition NAME="rightButtonPress" NEXT_STATE_ID="13" EVENT_ID="7">
<!-- CTRL+RBM_Down -->
<action ID="30">
<!--AcCHECKELEMENT-->
</action>
</transition>
</state>
<state NAME="picked guard Translate" ID="12" X_POS="376" Y_POS="34" WIDTH="151" HEIGHT="50">
<transition NAME="yes" NEXT_STATE_ID="2" EVENT_ID="1004">
<!-- EIDYES -->
<action ID="1101">
<!--AcMODE_SELECT-->
</action>
<action ID="1000">
<!--AcTRANSLATESTART-->
</action>
</transition>
<transition NAME="no" NEXT_STATE_ID="0" EVENT_ID="1003">
<!-- StNO -->
</transition>
</state>
<state NAME="picked guard Scale" ID="13" X_POS="647" Y_POS="312" WIDTH="100" HEIGHT="50">
<transition NAME="yes" NEXT_STATE_ID="3" EVENT_ID="1004">
<!-- EIDYES -->
<action ID="1101">
<!--AcMODE_SELECT-->
</action>
<action ID="1002">
<!--AcSCALESTART-->
</action>
</transition>
<transition NAME="no" NEXT_STATE_ID="0" EVENT_ID="1003">
<!-- StNO -->
<action ID="0" />
</transition>
</state>
<state NAME="picked guard Rotate" ID="14" X_POS="33" Y_POS="467" WIDTH="110" HEIGHT="50">
<transition NAME="yes" NEXT_STATE_ID="4" EVENT_ID="1004">
<!-- EIDYES -->
<action ID="1101">
<!--AcMODE_SELECT-->
</action>
<action ID="1004" />
</transition>
<transition NAME="no" NEXT_STATE_ID="0" EVENT_ID="1003">
<!-- StNO -->
<action ID="0" />
</transition>
</state>
<state NAME="translating" ID="2" X_POS="724" Y_POS="59" WIDTH="100" HEIGHT="50">
<transition NAME="leftButtonMove" NEXT_STATE_ID="2" EVENT_ID="534">
<!-- CTRL+LBM_Move -->
<action ID="1001">
<!--AcTRANSLATE-->
</action>
</transition>
<transition NAME="leftButtonRelease" NEXT_STATE_ID="0" EVENT_ID="505">
<!-- LBM_Release-->
<action ID="1100">
<!--AcMODE_DESELECT-->
</action>
<action ID="1008">
<!--AcTRANSLATEEND-->
</action>
</transition>
<transition NAME="leftButtonRelease" NEXT_STATE_ID="0" EVENT_ID="537">
<!-- CTRL+LBM_Release -->
<action ID="1100">
<!--AcMODE_DESELECT-->
</action>
<action ID="1008">
<!--AcTRANSLATEEND-->
</action>
</transition>
</state>
<state NAME="rotating" ID="4" X_POS="371" Y_POS="481" WIDTH="100" HEIGHT="50">
<transition NAME="middleButtonMove" NEXT_STATE_ID="4" EVENT_ID="536">
<!-- CTRL+MBM_Move-->
<action ID="1005">
<!--AcROTATE-->
</action>
</transition>
<transition NAME="middleButtonRelease" NEXT_STATE_ID="0" EVENT_ID="506">
<!-- MBM_Release-->
<action ID="1100">
<!--AcMODE_DESELECT-->
</action>
<action ID="1010">
<!--AcROTATEEEND-->
</action>
</transition>
<transition NAME="middleButtonRelease" NEXT_STATE_ID="0" EVENT_ID="539">
<!-- CTRL+MBM_Release-->
<action ID="1100">
<!--AcMODE_DESELECT-->
</action>
<action ID="1010">
<!--AcROTATEEEND-->
</action>
</transition>
</state>
<state NAME="scaling" ID="3" X_POS="710" Y_POS="432" WIDTH="100" HEIGHT="50">
<transition NAME="rightButtonMove" NEXT_STATE_ID="3" EVENT_ID="535">
<!-- CTRL+RBM_Move -->
<action ID="1003">
<!--AcROTATE -->
</action>
</transition>
<transition NAME="rightButtonRelease" NEXT_STATE_ID="0" EVENT_ID="507">
<!-- RBM_Release ==> SeSCALE -->
<action ID="1100">
<!--AcMODE_DESELECT-->
</action>
<action ID="1009">
<!--AcSCALEEND-->
</action>
</transition>
<transition NAME="rightButtonRelease" NEXT_STATE_ID="0" EVENT_ID="538">
<!-- CTRL+RBM_Release ==> SeSCALE -->
<action ID="1100">
<!--AcMODE_DESELECT-->
</action>
<action ID="1009">
<!--AcSCALEEND-->
</action>
</transition>
</state>
</stateMachine>
<!-- obsolete state machine pattern to be removed in future releases
<stateMachine NAME="drag">
<state NAME="neutral" ID="1" START_STATE="TRUE" X_POS="232" Y_POS="131" WIDTH="100" HEIGHT="50">
<transition NAME="check picked" NEXT_STATE_ID="1" EVENT_ID="1">
<action ID="80" />
</transition>
<transition NAME="continue" NEXT_STATE_ID="1" EVENT_ID="530">
<action ID="90" />
</transition>
<transition NAME="exit" NEXT_STATE_ID="1" EVENT_ID="505">
<action ID="42" />
</transition>
</state>
<state NAME="picked guard" ID="2" X_POS="94" Y_POS="360" WIDTH="100" HEIGHT="50">
<transition NAME="yes" NEXT_STATE_ID="3" EVENT_ID="1004">
<action ID="0" />
</transition>
<transition NAME="no" NEXT_STATE_ID="3" EVENT_ID="1003">
<action ID="0" />
</transition>
</state>
<state NAME="move" ID="3" X_POS="368" Y_POS="289" WIDTH="100" HEIGHT="50">
<transition NAME="continue" NEXT_STATE_ID="3" EVENT_ID="530">
<action ID="90" />
</transition>
<transition NAME="exit" NEXT_STATE_ID="1" EVENT_ID="505">
<action ID="42" />
</transition>
</state>
</stateMachine>
-->
<stateMachine NAME="dragWithCtrl">
<state NAME="neutral" ID="1" START_STATE="TRUE" X_POS="439" Y_POS="166" WIDTH="100" HEIGHT="50">
<transition NAME="check picked" NEXT_STATE_ID="1" EVENT_ID="5">
<action ID="80" />
</transition>
<transition NAME="continue" NEXT_STATE_ID="1" EVENT_ID="534">
<action ID="90" />
</transition>
<transition NAME="exit" NEXT_STATE_ID="1" EVENT_ID="537">
<action ID="42" />
</transition>
<transition NAME="exit" NEXT_STATE_ID="1" EVENT_ID="505">
<action ID="42" />
</transition>
<transition NAME="remove" NEXT_STATE_ID="1" EVENT_ID="12">
<action ID="100">
<!--AcREMOVEPOINT-->
</action>
</transition>
</state>
<!-- not reached so removed!
<state NAME="picked guard" ID="2" X_POS="141" Y_POS="427" WIDTH="100" HEIGHT="50">
<transition NAME="yes" NEXT_STATE_ID="3" EVENT_ID="1004">
<action ID="0" />
</transition>
<transition NAME="no" NEXT_STATE_ID="3" EVENT_ID="1003">
<action ID="0" />
</transition>
</state>
<state NAME="move" ID="3" X_POS="560" Y_POS="381" WIDTH="100" HEIGHT="50">
<transition NAME="continue" NEXT_STATE_ID="3" EVENT_ID="534">
<action ID="90" />
</transition>
<transition NAME="exit" NEXT_STATE_ID="1" EVENT_ID="505">
<action ID="42" />
</transition>
<transition NAME="exit" NEXT_STATE_ID="1" EVENT_ID="537">
<action ID="42" />
</transition>
</state>
-->
</stateMachine>
<stateMachine NAME="focus">
<state NAME="neutral" ID="1" START_STATE="TRUE" X_POS="250" Y_POS="191" WIDTH="100" HEIGHT="50">
<transition NAME="changefocus" NEXT_STATE_ID="1" EVENT_ID="1">
<action ID="0" />
</transition>
</state>
</stateMachine>
<stateMachine NAME="global">
<!-- Behaviour the global statemachine -->
<state NAME="neutral" ID="1" START_STATE="TRUE" X_POS="203" Y_POS="168" WIDTH="100" HEIGHT="50">
<transition NAME="edit objects" NEXT_STATE_ID="2" EVENT_ID="1013" />
<!--EIDEDIT-->
<transition NAME="transmitt to all" NEXT_STATE_ID="1" EVENT_ID="0">
<!--EventId = 0-> all other events not defined here-->
<action ID="1200">
<!--AcINFORMLISTENERS-->
</action>
<action ID="1201">
<!--AcASKINTERACTORS-->
</action>
</transition>
</state>
<state NAME="edit object" ID="2" X_POS="508" Y_POS="404" WIDTH="100" HEIGHT="50">
<transition NAME="ready" NEXT_STATE_ID="1" EVENT_ID="1002" />
<!--EIDFINISHED-->
<transition NAME="transmitt to interactors only" NEXT_STATE_ID="2" EVENT_ID="0">
<action ID="1201">
<!--AcASKINTERACTORS-->
</action>
</transition>
</state>
</stateMachine>
<stateMachine NAME="leftmouse">
<state NAME="neutral" ID="1" START_STATE="TRUE" X_POS="197" Y_POS="164" WIDTH="100" HEIGHT="50">
<transition NAME="send Koordinates" NEXT_STATE_ID="1" EVENT_ID="1" SIDE_EFFECT_ID="80">
<action ID="80" />
</transition>
<transition NAME="send Koordinates Move" NEXT_STATE_ID="1" EVENT_ID="530" SIDE_EFFECT_ID="80">
<action ID="80" />
</transition>
</state>
</stateMachine>
<stateMachine NAME="measureinteractor">
<!-- Behaviour for measuring a length with lines-->
<state NAME="unbuild" ID="0" START_STATE="TRUE" X_POS="167" Y_POS="49" WIDTH="100" HEIGHT="50">
<transition NAME="forceSSD" NEXT_STATE_ID="1" EVENT_ID="3">
<action ID="5">
<!--AcINITNEWOBJECT-->
</action>
<action ID="1550">
<!--AcFORCESUBINTERACTORS-->
</action>
<action ID="1102">
<!--AcMODESUBSELECT-->
</action>
<action ID="2000">
<!--AcTRANSMITEVENT-->
</action>
</transition>
</state>
<state NAME="BuildUpSSD" ID="1" X_POS="433" Y_POS="329" WIDTH="100" HEIGHT="50">
<transition NAME="SubInteractorDeselect" NEXT_STATE_ID="10" EVENT_ID="1020">
<!-- necessary transition of the state subSelected. the event will produced from the hirachical interactor -->
<action ID="1101">
<!--AcMODEDESELECT-->
</action>
</transition>
<transition NAME="reinit" NEXT_STATE_ID="0" EVENT_ID="2">
<action ID="101" />
<action ID="1100">
<!--AcMODEDESELECT-->
</action>
</transition>
</state>
<state NAME="selected" ID="10" X_POS="617" Y_POS="56" WIDTH="100" HEIGHT="50">
<transition NAME="remove" NEXT_STATE_ID="0" EVENT_ID="12">
<action ID="101" />
<action ID="1100">
<!--AcMODEDESELECT-->
</action>
</transition>
<transition NAME="reinit" NEXT_STATE_ID="0" EVENT_ID="2">
<action ID="101" />
<action ID="1100">
<!--AcMODEDESELECT-->
</action>
</transition>
</state>
</stateMachine>
<stateMachine NAME="meshmove">
<state NAME="neutral" ID="1" START_STATE="TRUE" X_POS="193" Y_POS="74" WIDTH="100" HEIGHT="50">
<transition NAME="check picked" NEXT_STATE_ID="2" EVENT_ID="1">
<action ID="30" />
</transition>
</state>
<state NAME="picked guard" ID="2" X_POS="98" Y_POS="296" WIDTH="100" HEIGHT="50">
<transition NAME="yes" NEXT_STATE_ID="3" EVENT_ID="1004">
<action ID="0" />
</transition>
<transition NAME="no" NEXT_STATE_ID="1" EVENT_ID="1003">
<action ID="0" />
</transition>
</state>
<state NAME="move" ID="3" X_POS="467" Y_POS="276" WIDTH="100" HEIGHT="50">
<transition NAME="continue" NEXT_STATE_ID="3" EVENT_ID="530">
<action ID="90" />
</transition>
<transition NAME="exit" NEXT_STATE_ID="1" EVENT_ID="505">
<action ID="666" />
</transition>
</state>
</stateMachine>
<stateMachine NAME="navigation">
<state NAME="neutral" ID="1" START_STATE="TRUE" X_POS="189" Y_POS="175" WIDTH="100" HEIGHT="50">
<transition NAME="send Koordinates press" NEXT_STATE_ID="1" EVENT_ID="1">
<action ID="92" />
</transition>
<transition NAME="send Koordinates move" NEXT_STATE_ID="1" EVENT_ID="530">
<action ID="92" />
</transition>
<transition NAME="send Koordinates release" NEXT_STATE_ID="1" EVENT_ID="505">
<action ID="42" />
</transition>
</state>
</stateMachine>
<stateMachine NAME="PositionTracker">
<state NAME="neutral" ID="1" START_STATE="TRUE" X_POS="212" Y_POS="188" WIDTH="100" HEIGHT="50">
<transition NAME="Mouse Move" EVENT_ID="520" NEXT_STATE_ID="1">
<action ID="92">
<!--AcMove-->
</action>
</transition>
</state>
</stateMachine>
<stateMachine NAME="picking">
<state NAME="neutral" ID="1" START_STATE="TRUE" X_POS="264" Y_POS="239" WIDTH="100" HEIGHT="50">
<transition NAME="do picking" NEXT_STATE_ID="1" EVENT_ID="3">
<action ID="1003" />
</transition>
</state>
</stateMachine>
<stateMachine NAME="PressMoveRelease">
<state NAME="neutral" ID="1" START_STATE="TRUE" X_POS="197" Y_POS="183" WIDTH="100" HEIGHT="50">
<transition NAME="send Koordinates press" NEXT_STATE_ID="1" EVENT_ID="1">
<action ID="80" />
</transition>
<transition NAME="send Koordinates move" NEXT_STATE_ID="1" EVENT_ID="530">
<action ID="90" />
</transition>
<transition NAME="send Koordinates release" NEXT_STATE_ID="1" EVENT_ID="505">
<action ID="42" />
</transition>
</state>
</stateMachine>
<stateMachine NAME="PressMoveReleaseAndPointSetting">
<state NAME="neutral" ID="1" START_STATE="TRUE">
<transition NAME="press" NEXT_STATE_ID="1" EVENT_ID="1">
<action ID="80" />
</transition>
<transition NAME="Shift+press" NEXT_STATE_ID="1" EVENT_ID="3">
<action ID="10" />
</transition>
<transition NAME="move" NEXT_STATE_ID="1" EVENT_ID="530">
<action ID="90" />
</transition>
<transition NAME="release" NEXT_STATE_ID="1" EVENT_ID="505">
<action ID="42" />
</transition>
<transition NAME="ENTF" NEXT_STATE_ID="1" EVENT_ID="12">
<action ID="100" />
</transition>
</state>
</stateMachine>
<stateMachine NAME="PressMoveReleaseWithCTRLInversionAllMouseMoves">
<state NAME="neutral" ID="1" START_STATE="TRUE">
<transition NAME="press" NEXT_STATE_ID="1" EVENT_ID="1">
<action ID="80" />
</transition>
<transition NAME="CTRL+press" NEXT_STATE_ID="2" EVENT_ID="5">
<action ID="80" />
<action ID="49014" />
</transition>
<transition NAME="move w/ left button" NEXT_STATE_ID="1" EVENT_ID="530">
<action ID="90" />
</transition>
<transition NAME="move" NEXT_STATE_ID="1" EVENT_ID="520">
<action ID="90" />
</transition>
<transition NAME="CTRL+move" NEXT_STATE_ID="2" EVENT_ID="534">
<action ID="90" />
<action ID="49014" />
</transition>
<transition NAME="release" NEXT_STATE_ID="1" EVENT_ID="505">
<action ID="42" />
</transition>
<transition NAME="CTRL+release" NEXT_STATE_ID="1" EVENT_ID="537">
<action ID="49014" />
<action ID="42" />
<action ID="49014" />
</transition>
</state>
<state NAME="inverted" ID="2">
<transition NAME="CTRL+move" NEXT_STATE_ID="2" EVENT_ID="534">
<action ID="90" />
</transition>
<transition NAME="move w/o left button" NEXT_STATE_ID="1" EVENT_ID="520">
<action ID="90" />
<action ID="49014" />
</transition>
<transition NAME="move" NEXT_STATE_ID="1" EVENT_ID="530">
<action ID="90" />
<action ID="49014" />
</transition>
<transition NAME="CTRL+release" NEXT_STATE_ID="1" EVENT_ID="537">
<action ID="42" />
<action ID="49014" />
</transition>
<transition NAME="release" NEXT_STATE_ID="1" EVENT_ID="505">
<action ID="42" />
<action ID="49014" />
</transition>
</state>
</stateMachine>
<stateMachine NAME="PressMoveReleaseWithCTRLInversion">
<state NAME="neutral" ID="1" START_STATE="TRUE">
<transition NAME="press" NEXT_STATE_ID="1" EVENT_ID="1">
<action ID="80" />
</transition>
<transition NAME="CTRL+press" NEXT_STATE_ID="2" EVENT_ID="5">
<action ID="80" />
<action ID="49014" />
</transition>
<transition NAME="move w/ left button" NEXT_STATE_ID="1" EVENT_ID="530">
<action ID="90" />
</transition>
<transition NAME="CTRL+move" NEXT_STATE_ID="2" EVENT_ID="534">
<action ID="90" />
<action ID="49014" />
</transition>
<transition NAME="release" NEXT_STATE_ID="1" EVENT_ID="505">
<action ID="42" />
</transition>
<transition NAME="CTRL+release" NEXT_STATE_ID="1" EVENT_ID="537">
<action ID="49014" />
<action ID="42" />
<action ID="49014" />
</transition>
</state>
<state NAME="inverted" ID="2">
<transition NAME="CTRL+move" NEXT_STATE_ID="2" EVENT_ID="534">
<action ID="90" />
</transition>
<transition NAME="move" NEXT_STATE_ID="1" EVENT_ID="530">
<action ID="90" />
<action ID="49014" />
</transition>
<transition NAME="CTRL+release" NEXT_STATE_ID="1" EVENT_ID="537">
<action ID="42" />
<action ID="49014" />
</transition>
<transition NAME="release" NEXT_STATE_ID="1" EVENT_ID="505">
<action ID="42" />
<action ID="49014" />
</transition>
</state>
</stateMachine>
<stateMachine NAME="seedroi">
<state NAME="neutral" ID="1" START_STATE="TRUE" X_POS="381" Y_POS="315" WIDTH="100" HEIGHT="50">
<transition NAME="send Koordinates" NEXT_STATE_ID="1" EVENT_ID="3">
<action ID="80" />
</transition>
</state>
</stateMachine>
<stateMachine NAME="seedsinteractor">
<!-- Behaviour of Seed Points -->
<state NAME="drawSeeds" ID="0" START_STATE="TRUE" X_POS="125" Y_POS="102" WIDTH="100" HEIGHT="50">
<transition NAME="drawForegroundSeed" NEXT_STATE_ID="1" EVENT_ID="3">
<action ID="1101">
<!--AcMODE_SELECT-->
</action>
<action ID="45">
<!--AcINITFOREGROUND-->
</action>
<action ID="11">
<!--AcADD-->
</action>
</transition>
<transition NAME="drawBackgroundSeed" NEXT_STATE_ID="2" EVENT_ID="2000">
<action ID="1101">
<!--AcMODE_SELECT-->
</action>
<action ID="46">
<!--AcINITBACKGROUND-->
</action>
<action ID="11">
<!--AcADD-->
</action>
</transition>
<transition NAME="drawNeutralSeed" NEXT_STATE_ID="3" EVENT_ID="2003">
<action ID="1101">
<!--AcMODE_SELECT-->
</action>
<action ID="47">
<!--AcINITNEUTRAL-->
</action>
<action ID="11">
<!--AcADD-->
</action>
</transition>
</state>
<state NAME="drawForeground" ID="1" X_POS="515" Y_POS="108" WIDTH="100" HEIGHT="50">
<transition NAME="drawForegroundSeeds" NEXT_STATE_ID="1" EVENT_ID="541">
<action ID="92">
<!--AcMOVE-->
</action>
</transition>
<transition NAME="drawSeeds" NEXT_STATE_ID="0" EVENT_ID="508">
<action ID="44">
<!--AcFINISH-->
</action>
<action ID="1100">
<!--AcMODE_DESELECT-->
</action>
</transition>
</state>
<state NAME="drawBackground" ID="2" X_POS="510" Y_POS="323" WIDTH="100" HEIGHT="50">
<transition NAME="drawBackgroundSeeds" NEXT_STATE_ID="2" EVENT_ID="2001">
<action ID="92">
<!--AcMOVE-->
</action>
</transition>
<transition NAME="drawSeeds" NEXT_STATE_ID="0" EVENT_ID="2002">
<action ID="44">
<!--AcFINISH-->
</action>
<action ID="1100">
<!--AcMODE_DESELECT-->
</action>
</transition>
</state>
<state NAME="drawNeutral" ID="3" X_POS="290" Y_POS="478" WIDTH="100" HEIGHT="50">
<transition NAME="drawNeutralSeeds" NEXT_STATE_ID="3" EVENT_ID="2004">
<action ID="92">
<!--AcMOVE-->
</action>
</transition>
<transition NAME="drawSeeds" NEXT_STATE_ID="0" EVENT_ID="2005">
<action ID="44">
<!--AcFINISH-->
</action>
<action ID="1100">
<!--AcMODE_DESELECT-->
</action>
</transition>
</state>
</stateMachine>
<stateMachine NAME="vesseltreeinteraction">
<state NAME="neutral" ID="1" START_STATE="TRUE" X_POS="268" Y_POS="260" WIDTH="100" HEIGHT="50">
<transition NAME="do picking" NEXT_STATE_ID="1" EVENT_ID="5">
<action ID="1600" />
</transition>
<transition NAME="do picking" NEXT_STATE_ID="1" EVENT_ID="8">
<action ID="1600" />
</transition>
</state>
</stateMachine>
<stateMachine NAME="YetAnotherVesselTreeInteractor">
<!-- state machine for vessel TREE interaction -->
<state NAME="no-vessel-picked" ID="0" START_STATE="TRUE" X_POS="282" Y_POS="146" WIDTH="100" HEIGHT="50">
<transition NAME="checkpicked" NEXT_STATE_ID="1" EVENT_ID="5">
<action ID="30">
<!--AcCHECKELEMENT-->
</action>
</transition>
<transition NAME="checkpicked" NEXT_STATE_ID="1" EVENT_ID="8">
<action ID="30">
<!--AcCHECKELEMENT-->
</action>
</transition>
</state>
<state NAME="check-guard" ID="1" X_POS="91" Y_POS="347" WIDTH="100" HEIGHT="50">
<transition NAME="check-successful" NEXT_STATE_ID="2" EVENT_ID="1004">
<action ID="65">
<!--AcSELECT-->
</action>
</transition>
<transition NAME="check-not-successful" NEXT_STATE_ID="0" EVENT_ID="1003">
<action ID="75">
<!--AcDESELECT-->
</action>
</transition>
</state>
<state NAME="vessel-picked" ID="2" X_POS="419" Y_POS="340" WIDTH="100" HEIGHT="50">
<transition NAME="checkpicked" NEXT_STATE_ID="1" EVENT_ID="5">
<action ID="30">
<!--AcCHECKELEMENT-->
</action>
</transition>
<transition NAME="checkpicked" NEXT_STATE_ID="1" EVENT_ID="8">
<action ID="30">
<!--AcCHECKELEMENT-->
</action>
</transition>
</state>
</stateMachine>
<!-- state machine for vessel TREE interaction with multiple selection -->
<stateMachine NAME="YetAnotherVesselTreeInteractorMultipleSelection">
<state NAME="no-vessel-picked" ID="0" START_STATE="TRUE" X_POS="282" Y_POS="146" WIDTH="100" HEIGHT="50">
<transition NAME="checkpicked" NEXT_STATE_ID="1" EVENT_ID="5">
<action ID="30">
<!--AcCHECKELEMENT-->
</action>
</transition>
<transition NAME="checkpicked" NEXT_STATE_ID="1" EVENT_ID="8">
<action ID="30">
<!--AcCHECKELEMENT-->
</action>
</transition>
</state>
<state NAME="CheckPicked-GuardState" ID="1" X_POS="91" Y_POS="347" WIDTH="100" HEIGHT="50">
<transition NAME="picked-vessel" NEXT_STATE_ID="2" EVENT_ID="1004">
<action ID="65">
<!--AcSELECT-->
</action>
</transition>
<transition NAME="no-vessel-picked" NEXT_STATE_ID="0" EVENT_ID="1003">
<action ID="75">
<!--AcDESELECT-->
</action>
</transition>
</state>
<state NAME="vessel-selected" ID="2" X_POS="419" Y_POS="340" WIDTH="100" HEIGHT="50">
<transition NAME="checkpicked" NEXT_STATE_ID="3" EVENT_ID="5">
<action ID="30">
<!--AcCHECKELEMENT-->
</action>
</transition>
<transition NAME="checkpicked" NEXT_STATE_ID="1" EVENT_ID="8">
<action ID="30">
<!--AcCHECKELEMENT-->
</action>
</transition>
</state>
<state NAME="guard-add-vessel2selection" ID="3" X_POS="419" Y_POS="340" WIDTH="100" HEIGHT="50">
<transition NAME="vessel-picked" NEXT_STATE_ID="2" EVENT_ID="1004">
<action ID="61">
<!--AcSELECTANOTHEROBJECT-->
</action>
</transition>
<transition NAME="no-vessel-picked" NEXT_STATE_ID="2" EVENT_ID="1003" />
</state>
</stateMachine>
<stateMachine NAME="AriadneAssistent">
<!-- Behaviour of the AriadneAssistent -->
<state NAME="start" ID="1" START_STATE="TRUE" X_POS="500" Y_POS="530" WIDTH="100" HEIGHT="50">
<transition NAME="EV_INIT" NEXT_STATE_ID="2" EVENT_ID="5551001">
<action ID="55500010">
<!--AC_INIT-->
</action>
</transition>
</state>
<state NAME="chooseApplication" ID="2" X_POS="616" Y_POS="351" WIDTH="100" HEIGHT="50">
<transition NAME="EV_PATH_COLLECTION_SELECTED" NEXT_STATE_ID="3" EVENT_ID="5551003">
<action ID="5550001">
<!--AC_SET_NEXT_BUTTON_VISIBLE-->
</action>
</transition>
<transition NAME="EV_NAVIGATION_SELECTED" NEXT_STATE_ID="40" EVENT_ID="5551004">
<action ID="5550001">
<!--AC_SET_NEXT_BUTTON_VISIBLE-->
</action>
</transition>
</state>
<state NAME="choosePathCollection" ID="3" X_POS="657" Y_POS="23" WIDTH="126" HEIGHT="50">
<transition NAME="EV_NEXT" NEXT_STATE_ID="4" EVENT_ID="5551007">
<action ID="5550003">
<!--AC_SET_PREVIOUS_BUTTON_VISIBLE-->
</action>
<action ID="5550002">
<!--AC_SET_NEXT_BUTTON_INVISIBLE-->
</action>
<action ID="5550005">
<!--AC_SET_ASSISTAND_WIDGET_STECK-->
<intParameter NAME="WIDGET_ID" VALUE="1" />
</action>
</transition>
<transition NAME="EV_NAVIGATION_SELECTED" NEXT_STATE_ID="40" EVENT_ID="5551004" />
<transition NAME="EV_INIT" NEXT_STATE_ID="2" EVENT_ID="5551001">
<action ID="55500010">
<!--AC_INIT-->
</action>
</transition>
</state>
<state NAME="mountSensorForPathCollection" ID="4" X_POS="331" Y_POS="11" WIDTH="167" HEIGHT="50">
<transition NAME="EV_DONE" NEXT_STATE_ID="5" EVENT_ID="5551008">
<action ID="5550001">
<!--AC_SET_NEXT_BUTTON_VISIBLE-->
</action>
</transition>
<transition NAME="EV_PREVIOUS" NEXT_STATE_ID="2" EVENT_ID="5551002">
<action ID="5550004">
<!--AC_SET_PREVIOUS_BUTTON_INVISIBLE-->
</action>
<action ID="5550001">
<!--AC_SET_NEXT_BUTTON_VISIBLE-->
</action>
<action ID="55500011">
<!--AC_SET_APPLICATION_SELECTED_FALSE-->
</action>
<action ID="5550005">
<!--AC_SET_ASSISTAND_WIDGET_STECK-->
<intParameter NAME="WIDGET_ID" VALUE="0" />
</action>
</transition>
<transition NAME="EV_INIT" NEXT_STATE_ID="2" EVENT_ID="5551001">
<action ID="55500010">
<!--AC_INIT-->
</action>
</transition>
</state>
<state NAME="sensorMountedForPathCollection" ID="5" X_POS="7" Y_POS="26" WIDTH="191" HEIGHT="50">
<transition NAME="EV_NEXT" NEXT_STATE_ID="7" EVENT_ID="5551007">
<action ID="5550002">
<!--AC_SET_NEXT_BUTTON_INVISIBLE-->
</action>
<action ID="55500012">
<!--AC_SENSOR_ATTACHED-->
</action>
<action ID="5550005">
<!--AC_SET_ASSISTAND_WIDGET_STECK-->
<intParameter NAME="WIDGET_ID" VALUE="2" />
</action>
<action ID="5550008">
<!--AC_CHECK_LANDMARK_COUNT-->
<intParameter NAME="MIN_COUNT" VALUE="3" />
</action>
</transition>
<transition NAME="EV_PREVIOUS" NEXT_STATE_ID="4" EVENT_ID="5551002">
<action ID="5550009">
<!--AC_SET_DONE_FALSE-->
</action>
<action ID="5550002">
<!--AC_SET_NEXT_BUTTON_INVISIBLE-->
</action>
</transition>
<transition NAME="EV_INIT" NEXT_STATE_ID="2" EVENT_ID="5551001">
<action ID="55500010">
<!--AC_INIT-->
</action>
</transition>
</state>
<state NAME="setLandmarks" ID="6" X_POS="229" Y_POS="369" WIDTH="100" HEIGHT="50">
<transition NAME="EV_NEW_LANDMARK" NEXT_STATE_ID="7" EVENT_ID="5551009">
<action ID="5550008">
<!--AC_CHECK_LANDMARK_COUNT-->
<intParameter NAME="MIN_COUNT" VALUE="3" />
</action>
</transition>
<transition NAME="EV_PREVIOUS" NEXT_STATE_ID="4" EVENT_ID="5551002">
<action ID="5550005">
<!--AC_SET_ASSISTAND_WIDGET_STECK-->
<intParameter NAME="WIDGET_ID" VALUE="1" />
</action>
<action ID="5550009">
<!--AC_SET_DONE_FALSE-->
</action>
</transition>
<transition NAME="EV_INIT" NEXT_STATE_ID="2" EVENT_ID="5551001">
<action ID="55500010">
<!--AC_INIT-->
</action>
</transition>
</state>
<state NAME="checkCount" ID="7" X_POS="-5" Y_POS="255" WIDTH="100" HEIGHT="50">
<transition NAME="EV_READY_FOR_COLLECTING_PATH" NEXT_STATE_ID="8" EVENT_ID="5551006">
<action ID="5550001">
<!--AC_SET_NEXT_BUTTON_VISIBLE-->
</action>
</transition>
<transition NAME="EV_LESS_THEN_MIN_COUNT" NEXT_STATE_ID="6" EVENT_ID="5551005" />
<transition NAME="EV_INIT" NEXT_STATE_ID="2" EVENT_ID="5551001">
<action ID="55500010">
<!--AC_INIT-->
</action>
</transition>
</state>
<state NAME="readyForCollectingPath" ID="8" X_POS="-5" Y_POS="462" WIDTH="146" HEIGHT="50">
<transition NAME="EV_NEXT" NEXT_STATE_ID="9" EVENT_ID="5551007">
<action ID="5550005">
<!--AC_SET_ASSISTAND_WIDGET_STECK-->
<intParameter NAME="WIDGET_ID" VALUE="4" />
</action>
<action ID="55500014">
<!--AC_START_APPLICATION_TEXT-->
<stringParameter NAME="START_APPLICATION_TEXT" VALUE="Ariadne is now ready for path collection" />
</action>
<action ID="5550007">
<!--AC_SET_NEXT_BUTTON_TEXT-->
<stringParameter NAME="BUTTON_TEXT" VALUE="Start" />
</action>
</transition>
<transition NAME="EV_PREVIOUS" NEXT_STATE_ID="4" EVENT_ID="5551002">
<action ID="5550005">
<!--AC_SET_ASSISTAND_WIDGET_STECK-->
<intParameter NAME="WIDGET_ID" VALUE="1" />
</action>
<action ID="5550002">
<!--AC_SET_NEXT_BUTTON_INVISIBLE-->
</action>
<action ID="5550009">
<!--AC_SET_DONE_FALSE-->
</action>
</transition>
<transition NAME="EV_REMOVE_LANDMARK" NEXT_STATE_ID="7" EVENT_ID="5551010">
<action ID="5550002">
<!--AC_SET_NEXT_BUTTON_INVISIBLE-->
</action>
<action ID="5550007">
<!--AC_SET_NEXT_BUTTON_TEXT-->
<stringParameter NAME="BUTTON_TEXT" VALUE="&gt;" />
</action>
<action ID="5550008">
<!--AC_CHECK_LANDMARK_COUNT-->
<intParameter NAME="MIN_COUNT" VALUE="3" />
</action>
</transition>
<transition NAME="EV_INIT" NEXT_STATE_ID="2" EVENT_ID="5551001">
<action ID="55500010">
<!--AC_INIT-->
</action>
</transition>
</state>
<state NAME="collectingPath" ID="9" X_POS="30" Y_POS="607" WIDTH="100" HEIGHT="50">
<transition NAME="EV_NEXT" NEXT_STATE_ID="2" EVENT_ID="5551007">
<action ID="55500013">
<!--AC_CLOSE_ASSISTENT-->
</action>
<action ID="55500011">
<!--AC_SET_APPLICATION_SELECTED_FALSE-->
</action>
<action ID="5550002">
<!--AC_SET_NEXT_BUTTON_INVISIBLE-->
</action>
<action ID="5550004">
<!--AC_SET_PREVIOUS_BUTTON_INVISIBLE-->
</action>
<action ID="55500016">
<!--AC_START_PATHCOLLECTION-->
</action>
<action ID="5550005">
<!--AC_SET_ASSISTAND_WIDGET_STECK-->
<intParameter NAME="WIDGET_ID" VALUE="0" />
</action>
<action ID="5550007">
<!--AC_SET_NEXT_BUTTON_TEXT-->
<stringParameter NAME="BUTTON_TEXT" VALUE="&gt;" />
</action>
</transition>
<transition NAME="EV_PREVIOUS" NEXT_STATE_ID="8" EVENT_ID="5551002">
<action ID="5550005">
<!--AC_SET_ASSISTAND_WIDGET_STECK-->
<intParameter NAME="WIDGET_ID" VALUE="2" />
</action>
<action ID="5550007">
<!--AC_SET_NEXT_BUTTON_TEXT-->
<stringParameter NAME="BUTTON_TEXT" VALUE="&gt;" />
</action>
</transition>
<transition NAME="EV_INIT" NEXT_STATE_ID="2" EVENT_ID="5551001">
<action ID="55500010">
<!--AC_INIT-->
</action>
<action ID="5550007">
<!--AC_SET_NEXT_BUTTON_TEXT-->
<stringParameter NAME="BUTTON_TEXT" VALUE="&gt;" />
</action>
</transition>
</state>
<state NAME="chooseNavigation" ID="40" X_POS="1080" Y_POS="38" WIDTH="100" HEIGHT="50">
<transition NAME="EV_PATH_COLLECTION_SELECTED" NEXT_STATE_ID="3" EVENT_ID="5551003" />
<transition NAME="EV_INIT" NEXT_STATE_ID="2" EVENT_ID="5551001">
<action ID="55500010">
<!--AC_INIT-->
</action>
</transition>
<transition NAME="EV_NEXT" NEXT_STATE_ID="41" EVENT_ID="5551007">
<action ID="5550003">
<!--AC_SET_PREVIOUS_BUTTON_VISIBLE-->
</action>
<action ID="5550002">
<!--AC_SET_NEXT_BUTTON_INVISIBLE-->
</action>
<action ID="5550005">
<!--AC_SET_ASSISTAND_WIDGET_STECK-->
<intParameter NAME="WIDGET_ID" VALUE="3" />
</action>
</transition>
<transition NAME="EV_INIT" NEXT_STATE_ID="2" EVENT_ID="5551001">
<action ID="55500010">
<!--AC_INIT-->
</action>
</transition>
</state>
<state NAME="chooseData" ID="41" X_POS="1100" Y_POS="199" WIDTH="100" HEIGHT="50">
<transition NAME="EV_DONE" NEXT_STATE_ID="42" EVENT_ID="5551008">
<action ID="5550001">
<!--AC_SET_NEXT_BUTTON_VISIBLE-->
</action>
</transition>
<transition NAME="EV_PREVIOUS" NEXT_STATE_ID="2" EVENT_ID="5551002">
<action ID="5550004">
<!--AC_SET_PREVIOUS_BUTTON_INVISIBLE-->
</action>
<action ID="5550001">
<!--AC_SET_NEXT_BUTTON_VISIBLE-->
</action>
<action ID="55500011">
<!--AC_SET_APPLICATION_SELECTED_FALSE-->
</action>
<action ID="5550005">
<!--AC_SET_ASSISTAND_WIDGET_STECK-->
<intParameter NAME="WIDGET_ID" VALUE="0" />
</action>
</transition>
<transition NAME="EV_INIT" NEXT_STATE_ID="2" EVENT_ID="5551001">
<action ID="55500010">
<!--AC_INIT-->
</action>
</transition>
</state>
<state NAME="dataChoosed" ID="42" X_POS="1111" Y_POS="353" WIDTH="100" HEIGHT="50">
<transition NAME="EV_NEXT" NEXT_STATE_ID="43" EVENT_ID="5551007">
<action ID="55500017">
<!--AC_LOAD_LANDMARKS-->
</action>
<action ID="5550002">
<!--AC_SET_NEXT_BUTTON_INVISIBLE-->
</action>
<action ID="5550005">
<!--AC_SET_ASSISTAND_WIDGET_STECK-->
<intParameter NAME="WIDGET_ID" VALUE="1" />
</action>
</transition>
<transition NAME="EV_PREVIOUS" NEXT_STATE_ID="2" EVENT_ID="5551002">
<action ID="5550004">
<!--AC_SET_PREVIOUS_BUTTON_INVISIBLE-->
</action>
<action ID="5550001">
<!--AC_SET_NEXT_BUTTON_VISIBLE-->
</action>
<action ID="55500011">
<!--AC_SET_APPLICATION_SELECTED_FALSE-->
</action>
<action ID="5550005">
<!--AC_SET_ASSISTAND_WIDGET_STECK-->
<intParameter NAME="WIDGET_ID" VALUE="0" />
</action>
</transition>
<transition NAME="EV_INIT" NEXT_STATE_ID="2" EVENT_ID="5551001">
<action ID="55500010">
<!--AC_INIT-->
</action>
</transition>
</state>
<state NAME="mountSensorForNavigation" ID="43" X_POS="1059" Y_POS="473" WIDTH="144" HEIGHT="50">
<transition NAME="EV_DONE" NEXT_STATE_ID="44" EVENT_ID="5551008">
<action ID="5550001">
<!--AC_SET_NEXT_BUTTON_VISIBLE-->
</action>
</transition>
<transition NAME="EV_PREVIOUS" NEXT_STATE_ID="42" EVENT_ID="5551002">
<action ID="5550001">
<!--AC_SET_NEXT_BUTTON_VISIBLE-->
</action>
<action ID="5550005">
<!--AC_SET_ASSISTAND_WIDGET_STECK-->
<intParameter NAME="WIDGET_ID" VALUE="3" />
</action>
</transition>
<transition NAME="EV_INIT" NEXT_STATE_ID="2" EVENT_ID="5551001">
<action ID="55500010">
<!--AC_INIT-->
</action>
</transition>
</state>
<state NAME="sensorMountedForNavigation" ID="44" X_POS="844" Y_POS="613" WIDTH="100" HEIGHT="50">
<transition NAME="EV_NEXT" NEXT_STATE_ID="46" EVENT_ID="5551007">
<action ID="5550002">
<!--AC_SET_NEXT_BUTTON_INVISIBLE-->
</action>
<action ID="55500012">
<!--AC_SENSOR_ATTACHED-->
</action>
<action ID="5550005">
<!--AC_SET_ASSISTAND_WIDGET_STECK-->
<intParameter NAME="WIDGET_ID" VALUE="2" />
</action>
<action ID="5550008">
<!--AC_CHECK_LANDMARK_COUNT-->
<intParameter NAME="MIN_COUNT" VALUE="3" />
</action>
</transition>
<transition NAME="EV_PREVIOUS" NEXT_STATE_ID="43" EVENT_ID="5551002">
<action ID="5550009">
<!--AC_SET_DONE_FALSE-->
</action>
<action ID="5550002">
<!--AC_SET_NEXT_BUTTON_INVISIBLE-->
</action>
</transition>
<transition NAME="EV_INIT" NEXT_STATE_ID="2" EVENT_ID="5551001">
<action ID="55500010">
<!--AC_INIT-->
</action>
</transition>
</state>
<state NAME="setLandmarks" ID="45" X_POS="1110" Y_POS="754" WIDTH="100" HEIGHT="50">
<transition NAME="EV_NEW_LANDMARK" NEXT_STATE_ID="46" EVENT_ID="5551009">
<action ID="5550008">
<!--AC_CHECK_LANDMARK_COUNT-->
<intParameter NAME="MIN_COUNT" VALUE="3" />
</action>
</transition>
<transition NAME="EV_PREVIOUS" NEXT_STATE_ID="43" EVENT_ID="5551002">
<action ID="5550005">
<!--AC_SET_ASSISTAND_WIDGET_STECK-->
<intParameter NAME="WIDGET_ID" VALUE="3" />
</action>
<action ID="5550009">
<!--AC_SET_DONE_FALSE-->
</action>
</transition>
<transition NAME="EV_INIT" NEXT_STATE_ID="2" EVENT_ID="5551001">
<action ID="55500010">
<!--AC_INIT-->
</action>
</transition>
</state>
<state NAME="checkCount" ID="46" X_POS="615" Y_POS="748" WIDTH="100" HEIGHT="50">
<transition NAME="EV_READY_FOR_COLLECTING_PATH" NEXT_STATE_ID="47" EVENT_ID="5551006">
<action ID="5550001">
<!--AC_SET_NEXT_BUTTON_VISIBLE-->
</action>
</transition>
<transition NAME="EV_LESS_THEN_MIN_COUNT" NEXT_STATE_ID="45" EVENT_ID="5551005" />
<transition NAME="EV_INIT" NEXT_STATE_ID="2" EVENT_ID="5551001">
<action ID="55500010">
<!--AC_INIT-->
</action>
</transition>
</state>
<state NAME="readyForNavigation" ID="47" X_POS="120" Y_POS="750" WIDTH="115" HEIGHT="50">
<transition NAME="EV_NEXT" NEXT_STATE_ID="48" EVENT_ID="5551007">
<action ID="55500018">
<!--AC_CALCULATE_LANDMARK_TRANSFORM-->
</action>
<action ID="5550005">
<!--AC_SET_ASSISTAND_WIDGET_STECK-->
<intParameter NAME="WIDGET_ID" VALUE="4" />
</action>
<action ID="55500014">
<!--AC_START_APPLICATION_TEXT-->
<stringParameter NAME="START_APPLICATION_TEXT" VALUE="Ariadne is now ready for navigation" />
</action>
<action ID="5550007">
<!--AC_SET_NEXT_BUTTON_TEXT-->
<stringParameter NAME="BUTTON_TEXT" VALUE="Start" />
</action>
</transition>
<transition NAME="EV_PREVIOUS" NEXT_STATE_ID="43" EVENT_ID="5551002">
<action ID="5550005">
<!--AC_SET_ASSISTAND_WIDGET_STECK-->
<intParameter NAME="WIDGET_ID" VALUE="3" />
</action>
<action ID="5550002">
<!--AC_SET_NEXT_BUTTON_INVISIBLE-->
</action>
<action ID="5550009">
<!--AC_SET_DONE_FALSE-->
</action>
</transition>
<transition NAME="EV_REMOVE_LANDMARK" NEXT_STATE_ID="46" EVENT_ID="5551010">
<action ID="5550002">
<!--AC_SET_NEXT_BUTTON_INVISIBLE-->
</action>
<action ID="5550007">
<!--AC_SET_NEXT_BUTTON_TEXT-->
<stringParameter NAME="BUTTON_TEXT" VALUE="&gt;" />
</action>
<action ID="5550008">
<!--AC_CHECK_LANDMARK_COUNT-->
<intParameter NAME="MIN_COUNT" VALUE="3" />
</action>
</transition>
<transition NAME="EV_INIT" NEXT_STATE_ID="2" EVENT_ID="5551001">
<action ID="55500010">
<!--AC_INIT-->
</action>
</transition>
</state>
<state NAME="Navigation" ID="48" X_POS="164" Y_POS="623" WIDTH="100" HEIGHT="50">
<transition NAME="EV_NEXT" NEXT_STATE_ID="2" EVENT_ID="5551007">
<action ID="55500013">
<!--AC_CLOSE_ASSISTENT-->
</action>
<action ID="55500011">
<!--AC_SET_APPLICATION_SELECTED_FALSE-->
</action>
<action ID="5550002">
<!--AC_SET_NEXT_BUTTON_INVISIBLE-->
</action>
<action ID="5550004">
<!--AC_SET_PREVIOUS_BUTTON_INVISIBLE-->
</action>
<action ID="55500015">
<!--AC_START_NAVIGATION-->
</action>
<action ID="5550005">
<!--AC_SET_ASSISTAND_WIDGET_STECK-->
<intParameter NAME="WIDGET_ID" VALUE="0" />
</action>
<action ID="5550007">
<!--AC_SET_NEXT_BUTTON_TEXT-->
<stringParameter NAME="BUTTON_TEXT" VALUE="&gt;" />
</action>
</transition>
<transition NAME="EV_PREVIOUS" NEXT_STATE_ID="47" EVENT_ID="5551002">
<action ID="5550005">
<!--AC_SET_ASSISTAND_WIDGET_STECK-->
<intParameter NAME="WIDGET_ID" VALUE="2" />
</action>
<action ID="5550007">
<!--AC_SET_NEXT_BUTTON_TEXT-->
<stringParameter NAME="BUTTON_TEXT" VALUE="&gt;" />
</action>
</transition>
<transition NAME="EV_INIT" NEXT_STATE_ID="2" EVENT_ID="5551001">
<action ID="55500010">
<!--AC_INIT-->
</action>
<action ID="5550007">
<!--AC_SET_NEXT_BUTTON_TEXT-->
<stringParameter NAME="BUTTON_TEXT" VALUE="&gt;" />
</action>
</transition>
</state>
</stateMachine>
<stateMachine NAME="AffineInteractions ctrl-drag_marcus">
<state NAME="start" ID="0" START_STATE="TRUE" X_POS="314" Y_POS="214" WIDTH="100" HEIGHT="50">
<transition NAME="leftButtonPress" NEXT_STATE_ID="12" EVENT_ID="1">
<!-- 30 = SeCHECKELEMENT -->
<action ID="30" />
</transition>
<transition NAME="rightButtonPress" NEXT_STATE_ID="13" EVENT_ID="2">
<!-- 1002 = SeSCALESTART -->
<action ID="30" />
</transition>
<transition NAME="middleButtonPress" NEXT_STATE_ID="14" EVENT_ID="4">
<!-- 1004 = SeROTATESTART -->
<action ID="30" />
</transition>
</state>
<state NAME="picked guard Translate" ID="12" X_POS="52" Y_POS="62" WIDTH="143" HEIGHT="50">
<transition NAME="yes" NEXT_STATE_ID="2" EVENT_ID="1004">
<!-- EIDYES -->
<action ID="1000" />
</transition>
<transition NAME="no" NEXT_STATE_ID="0" EVENT_ID="1003">
<!-- StNO -->
<action ID="0" />
</transition>
</state>
<state NAME="picked guard Scale" ID="13" X_POS="848" Y_POS="233" WIDTH="100" HEIGHT="50">
<transition NAME="yes" NEXT_STATE_ID="3" EVENT_ID="1004">
<!-- EIDYES -->
<action ID="1002" />
</transition>
<transition NAME="no" NEXT_STATE_ID="0" EVENT_ID="1003">
<!-- StNO -->
<action ID="0" />
</transition>
</state>
<state NAME="picked guard Rotate" ID="14" X_POS="37" Y_POS="334" WIDTH="100" HEIGHT="50">
<transition NAME="yes" NEXT_STATE_ID="4" EVENT_ID="1004">
<!-- EIDYES -->
<action ID="1004" />
</transition>
<transition NAME="no" NEXT_STATE_ID="0" EVENT_ID="1003">
<!-- StNO -->
<action ID="0" />
</transition>
</state>
<state NAME="translating" ID="2" X_POS="481" Y_POS="47" WIDTH="100" HEIGHT="50">
<transition NAME="leftButtonMove" NEXT_STATE_ID="2" EVENT_ID="530">
<!-- 1000 = SeTRANSLATE -->
<action ID="1001" />
</transition>
<transition NAME="leftButtonRelease" NEXT_STATE_ID="0" EVENT_ID="505">
<!-- 1000 = SeTRANSLATE -->
<action ID="1001" />
</transition>
<transition NAME="leftButtonRelease" NEXT_STATE_ID="0" EVENT_ID="537">
<!-- CTRL+LBM_Release ==> SeTRANSLATE -->
<action ID="1001" />
</transition>
</state>
<state NAME="scaling" ID="3" X_POS="630" Y_POS="461" WIDTH="100" HEIGHT="50">
<transition NAME="rightButtonMove" NEXT_STATE_ID="3" EVENT_ID="531">
<!-- 1003 = SeSCALE -->
<action ID="1003" />
</transition>
<transition NAME="rightButtonRelease" NEXT_STATE_ID="0" EVENT_ID="507">
<!-- 1003 = SeSCALE -->
<action ID="1003" />
</transition>
<transition NAME="rightButtonRelease" NEXT_STATE_ID="0" EVENT_ID="538">
<!-- CTRL+RBM_Release ==> SeSCALE -->
<action ID="1003" />
</transition>
</state>
<state NAME="rotating" ID="4" X_POS="295" Y_POS="487" WIDTH="100" HEIGHT="50">
<transition NAME="middleButtonMove" NEXT_STATE_ID="4" EVENT_ID="533">
<!-- 1005 = SeROTATE -->
<action ID="1005" />
</transition>
<transition NAME="middleButtonRelease" NEXT_STATE_ID="0" EVENT_ID="506">
<!-- 1005 = SeROTATE -->
<action ID="1005" />
</transition>
<transition NAME="middleButtonRelease" NEXT_STATE_ID="0" EVENT_ID="539">
<!-- 1005 = SeROTATE -->
<action ID="1005" />
</transition>
</state>
</stateMachine>
<stateMachine NAME="connectpointsinteractor">
<!-- Behaviour for connecting points using mitk::ConnectPointsInteractor -->
<state NAME="ready" ID="1" START_STATE="TRUE" X_POS="357" Y_POS="236" WIDTH="100" HEIGHT="50">
<transition NAME="addPoint but check n" NEXT_STATE_ID="1" EVENT_ID="3">
<action ID="10">
<!--AcADDPOINT-->
</action>
</transition>
<transition NAME="remove" NEXT_STATE_ID="1" EVENT_ID="12">
<action ID="100">
<!--AcREMOVEPOINT-->
</action>
</transition>
</state>
</stateMachine>
<stateMachine NAME="coordinate-supply">
<state NAME="neutral" ID="1" START_STATE="TRUE" X_POS="439" Y_POS="228" WIDTH="100" HEIGHT="50">
<transition NAME="send Koordinates release" NEXT_STATE_ID="1" EVENT_ID="505">
<action ID="42" />
</transition>
</state>
</stateMachine>
<stateMachine NAME="EasySegmentation">
<state NAME="Checking for ActivateToolEvents" ID="0" START_STATE="TRUE" X_POS="193" Y_POS="206" WIDTH="174" HEIGHT="50">
<transition NAME="OnActivateToolEvent" EVENT_ID="1300" NEXT_STATE_ID="0">
<action ID="48009">
<!-- AcActivateTool -->
</action>
</transition>
</state>
</stateMachine>
<stateMachine NAME="segmentation-interactor-tool:movenzoom">
<state NAME="Ready to start" ID="0" START_STATE="TRUE">
<transition NAME="OnLeftMouseDown" EVENT_ID="1" NEXT_STATE_ID="3" />
<transition NAME="OnMiddleMouseDown" EVENT_ID="4" NEXT_STATE_ID="1">
<action ID="9">
<!-- AcInitMove -->
</action>
</transition>
<transition NAME="OnRightMouseDown" EVENT_ID="2" NEXT_STATE_ID="2">
<action ID="1011">
<!-- AcInitZoom -->
</action>
</transition>
</state>
<state NAME="Moving" ID="1">
<transition NAME="OnMouseMove" EVENT_ID="533" NEXT_STATE_ID="1">
<action ID="92">
<!-- AcMove -->
</action>
</transition>
<transition NAME="OnMiddleMouseUp" EVENT_ID="506" NEXT_STATE_ID="0" />
</state>
<state NAME="Zooming" ID="2">
<transition NAME="OnMouseMove" EVENT_ID="531" NEXT_STATE_ID="2">
<action ID="1012">
<!-- AcZoom -->
</action>
</transition>
<transition NAME="OnRightMouseUp" EVENT_ID="507" NEXT_STATE_ID="0" />
</state>
<state NAME="Click" ID="3">
<transition NAME="OnLeftMouseUp" EVENT_ID="505" NEXT_STATE_ID="0">
<action ID="31">
<!-- AcCheckObject -->
</action>
</transition>
</state>
</stateMachine>
<stateMachine NAME="segmentation-interactor-tool:needle">
<state NAME="Ready to start" ID="0" START_STATE="TRUE">
<transition NAME="OnMouseMove" EVENT_ID="520" NEXT_STATE_ID="0">
<action ID="49006">
<!-- AcUpdatePoint -->
</action>
</transition>
<transition NAME="OnKeyH" EVENT_ID="22" NEXT_STATE_ID="0">
<action ID="49004">
<!-- AcMovePoint1 -->
</action>
</transition>
<transition NAME="OnKeyT" EVENT_ID="17" NEXT_STATE_ID="0">
<action ID="49005">
<!-- AcMovePoint2 -->
</action>
</transition>
<transition NAME="OnKeyEsc" EVENT_ID="14" NEXT_STATE_ID="7">
<action ID="49009">
<!-- AcDisplayOptions -->
</action>
<action ID="49010">
<!-- AcCycle (cycle to first different needle) -->
</action>
</transition>
<transition NAME="OnLeftMouseDown" EVENT_ID="1" NEXT_STATE_ID="3">
<action ID="31">
<!-- AcCheckObject -->
</action>
</transition>
<transition NAME="OnMiddleMouseDown" EVENT_ID="4" NEXT_STATE_ID="1">
<action ID="9">
<!-- AcInitMove -->
</action>
</transition>
<transition NAME="OnRightMouseDown" EVENT_ID="2" NEXT_STATE_ID="2">
<action ID="1011">
<!-- AcInitZoom -->
</action>
</transition>
<transition NAME="OnShiftLeftMouseDown" EVENT_ID="3" NEXT_STATE_ID="0">
<action ID="21">
<!-- AcCheckPoint -->
</action>
</transition>
</state>
<state NAME="Moving" ID="1">
<transition NAME="OnMouseMove" EVENT_ID="533" NEXT_STATE_ID="1">
<action ID="92">
<!-- AcMove -->
</action>
</transition>
<transition NAME="OnMiddleMouseUp" EVENT_ID="506" NEXT_STATE_ID="0" />
</state>
<state NAME="Zooming" ID="2">
<transition NAME="OnMouseMove" EVENT_ID="531" NEXT_STATE_ID="2">
<action ID="1012">
<!-- AcZoom -->
</action>
</transition>
<transition NAME="OnRightMouseUp" EVENT_ID="507" NEXT_STATE_ID="0" />
</state>
<state NAME="Descision: what to drag?" ID="3">
<transition NAME="OnTip" EVENT_ID="1050" NEXT_STATE_ID="4" />
<transition NAME="OnHead" EVENT_ID="1051" NEXT_STATE_ID="5" />
<transition NAME="OnBody" EVENT_ID="1052" NEXT_STATE_ID="6" />
<transition NAME="OnNothing" EVENT_ID="1003" NEXT_STATE_ID="0" />
</state>
<state NAME="Tip dragging" ID="4">
<transition NAME="OnMouseMove" EVENT_ID="530" NEXT_STATE_ID="4">
<action ID="49002">
<!-- AcRotateAroundHead (Point1)-->
</action>
</transition>
<transition NAME="OnLeftMouseUp" EVENT_ID="505" NEXT_STATE_ID="0" />
</state>
<state NAME="Head dragging" ID="5">
<transition NAME="OnMouseMove" EVENT_ID="530" NEXT_STATE_ID="5">
<action ID="49003">
<!-- AcRotateAroundTip (Point2)-->
</action>
</transition>
<transition NAME="OnLeftMouseUp" EVENT_ID="505" NEXT_STATE_ID="0" />
</state>
<state NAME="Body dragging" ID="6">
<transition NAME="OnMouseMove" EVENT_ID="530" NEXT_STATE_ID="6">
<action ID="1001">
<!-- AcTranslate -->
</action>
</transition>
<transition NAME="OnLeftMouseUp" EVENT_ID="505" NEXT_STATE_ID="0" />
</state>
<state NAME="Needle choosing" ID="7">
<transition NAME="OnKeyEsc" EVENT_ID="14" NEXT_STATE_ID="7">
<action ID="49010">
<!-- AcCycle -->
</action>
</transition>
<transition NAME="OnKeyReturn" EVENT_ID="23" NEXT_STATE_ID="0">
<action ID="49011">
<!-- AcAccept -->
</action>
</transition>
<transition NAME="OnKeyReturn" EVENT_ID="24" NEXT_STATE_ID="0">
<action ID="49011">
<!-- AcAccept -->
</action>
</transition>
<transition NAME="OnKeySpace" EVENT_ID="25" NEXT_STATE_ID="0">
<action ID="49011">
<!-- AcAccept -->
</action>
</transition>
</state>
</stateMachine>
<stateMachine NAME="segmentation-interactor-tool:bubble">
<state NAME="Ready to start" ID="0" START_STATE="TRUE">
<!-- initial state: outside anything and checking for collisions -->
<transition NAME="OnLeftMouseDown" EVENT_ID="1" NEXT_STATE_ID="2">
<action ID="31">
<!-- AcCheckObject -->
</action>
</transition>
</state>
<state NAME="Drawing line" ID="1">
<!-- line drawing started, now always update the end point of the line -->
<transition NAME="OnEscape" EVENT_ID="14" NEXT_STATE_ID="0">
<action ID="48008">
<!-- AcCancel -->
</action>
</transition>
<transition NAME="OnMouseMove" EVENT_ID="530" NEXT_STATE_ID="1">
<action ID="48003">
<!-- AcUpdateLine -->
</action>
</transition>
<transition NAME="OnLeftMouseUp" EVENT_ID="505" NEXT_STATE_ID="0">
<action ID="48005">
<!-- AcTerminateLine -->
</action>
<action ID="48007">
<!-- AcCreateObjectFromLine -->
</action>
<action ID="48008">
<!-- AcCancel -->
</action>
</transition>
</state>
<state NAME="Decide between creating and modifying. modify?" ID="2">
<transition NAME="OnNo" EVENT_ID="1003" NEXT_STATE_ID="1">
<action ID="48004">
<!-- AcInitLine -->
</action>
</transition>
<transition NAME="OnYes" EVENT_ID="1004" NEXT_STATE_ID="6" />
</state>
<state NAME="Decide between left and right movement. Left?" ID="5">
<transition NAME="OnNo" EVENT_ID="1003" NEXT_STATE_ID="6">
<action ID="49012">
<!-- AcIncrease -->
</action>
</transition>
<transition NAME="OnYes" EVENT_ID="1004" NEXT_STATE_ID="6">
<action ID="49013">
<!-- AcDecrease -->
</action>
</transition>
</state>
<state NAME="Decide between left and right movement. Left?" ID="6">
<transition NAME="OnMouseMove" EVENT_ID="530" NEXT_STATE_ID="5">
<action ID="8">
<!-- AcInitMovement -->
</action>
</transition>
<transition NAME="OnMouseUp" EVENT_ID="505" NEXT_STATE_ID="0" />
</state>
</stateMachine>
<stateMachine NAME="pointinteractor">
<state NAME="unselected" ID="0" START_STATE="TRUE" X_POS="17" Y_POS="23" WIDTH="100" HEIGHT="50">
<transition NAME="addPoint" NEXT_STATE_ID="1" EVENT_ID="3">
<action ID="1101">
<!--AcMODESELECT-->
</action>
<action ID="10">
<!--AcADDPOINT-->
</action>
<action ID="30">
<!--AcCHECKELEMENT-->
<intParameter NAME="precision" VALUE="4" />
</action>
</transition>
<transition NAME="checkpicked" NEXT_STATE_ID="2" EVENT_ID="1">
<action ID="30">
<!--AcCHECKELEMENT-->
<intParameter NAME="precision" VALUE="4" />
</action>
</transition>
</state>
<state NAME="selected" ID="1" X_POS="663" Y_POS="89" WIDTH="100" HEIGHT="50">
<transition NAME="deselect all and add point" NEXT_STATE_ID="1" EVENT_ID="3">
<action ID="72">
<!--AcDESELECTALL-->
</action>
<action ID="10">
<!--AcADDPOINT-->
</action>
<action ID="30">
<!--AcCHECKELEMENT-->
<intParameter NAME="precision" VALUE="4" />
</action>
</transition>
<transition NAME="remove" NEXT_STATE_ID="5" EVENT_ID="12">
<action ID="1500">
<!--AcCHECKGREATERONE-->
</action>
</transition>
<transition NAME="checkSamePick" NEXT_STATE_ID="3" EVENT_ID="1">
<action ID="34">
<!--AcCHECKSELECTED-->
<intParameter NAME="precision" VALUE="4" />
</action>
</transition>
<transition NAME="deselect all" NEXT_STATE_ID="0" EVENT_ID="2000">
<action ID="72">
<!--AcDESELECTALL-->
</action>
<action ID="1100">
<!--AcMODEDESELECT-->
</action>
</transition>
</state>
<state NAME="checkpicked" ID="2" X_POS="385" Y_POS="221" WIDTH="100" HEIGHT="50">
<transition NAME="EIDNo" NEXT_STATE_ID="0" EVENT_ID="1003" />
<transition NAME="EIDYes" NEXT_STATE_ID="1" EVENT_ID="1004">
<action ID="1101">
<!--AcMODESELECT-->
</action>
<action ID="65">
<!--AcSELECT-->
</action>
</transition>
</state>
<state NAME="checkStillPicked" ID="3" X_POS="417" Y_POS="497" WIDTH="100" HEIGHT="50">
<transition NAME="EIDNo" NEXT_STATE_ID="0" EVENT_ID="1003">
<action ID="72">
<!--AcDESELECTALL-->
</action>
<action ID="1100">
<!--AcMODEDESELECT-->
</action>
</transition>
<transition NAME="EIDYes" NEXT_STATE_ID="4" EVENT_ID="1004">
<action ID="8">
<!--AcINITMOVEMENT-->
</action>
</transition>
</state>
<state NAME="moves" ID="4" X_POS="799" Y_POS="483" WIDTH="100" HEIGHT="50">
<transition NAME="mousemove" NEXT_STATE_ID="4" EVENT_ID="530">
<action ID="91">
<!--AcMOVESELECTED-->
</action>
</transition>
<transition NAME="finishmove" NEXT_STATE_ID="1" EVENT_ID="505">
<action ID="42">
<!--AcFINISHMOVEMENT-->
</action>
</transition>
</state>
<state NAME="checkGreaterOne" ID="5" X_POS="416" Y_POS="344" WIDTH="100" HEIGHT="50">
<transition NAME="StYes" NEXT_STATE_ID="1" EVENT_ID="1004">
<action ID="100">
<!--AcREMOVEPOINT-->
</action>
<action ID="61">
<!--AcSELECTANOTHEROBJECT-->
</action>
</transition>
<transition NAME="StNo" NEXT_STATE_ID="0" EVENT_ID="1003">
<action ID="100">
<!--AcREMOVEPOINT-->
</action>
<action ID="1100">
<!--AcMODEDESELECT-->
</action>
</transition>
</state>
</stateMachine>
<stateMachine NAME="pointselectorinteractor">
<state NAME="unselected" ID="0" START_STATE="TRUE" X_POS="17" Y_POS="23" WIDTH="100" HEIGHT="50">
<transition NAME="addPoint" NEXT_STATE_ID="1" EVENT_ID="3">
<action ID="1101">
<!--AcMODESELECT-->
</action>
<action ID="10">
<!--AcADDPOINT-->
</action>
<action ID="30">
<!--AcCHECKELEMENT-->
<intParameter NAME="precision" VALUE="4" />
</action>
</transition>
<transition NAME="checkpicked" NEXT_STATE_ID="2" EVENT_ID="1">
<action ID="30">
<!--AcCHECKELEMENT-->
<intParameter NAME="precision" VALUE="4" />
</action>
</transition>
</state>
<state NAME="selected" ID="1" X_POS="663" Y_POS="89" WIDTH="100" HEIGHT="50">
<transition NAME="deselect all and add point" NEXT_STATE_ID="1" EVENT_ID="3">
<action ID="72">
<!--AcDESELECTALL-->
</action>
<action ID="10">
<!--AcADDPOINT-->
</action>
<action ID="30">
<!--AcCHECKELEMENT-->
<intParameter NAME="precision" VALUE="4" />
</action>
</transition>
<transition NAME="remove" NEXT_STATE_ID="5" EVENT_ID="12">
<action ID="1500">
<!--AcCHECKGREATERONE-->
</action>
</transition>
<transition NAME="checkSamePick" NEXT_STATE_ID="3" EVENT_ID="1">
<action ID="34">
<!--AcCHECKSELECTED-->
<intParameter NAME="precision" VALUE="4" />
</action>
</transition>
<transition NAME="deselect all" NEXT_STATE_ID="0" EVENT_ID="2000">
<action ID="72">
<!--AcDESELECTALL-->
</action>
<action ID="1100">
<!--AcMODEDESELECT-->
</action>
</transition>
</state>
<state NAME="checkpicked" ID="2" X_POS="385" Y_POS="221" WIDTH="100" HEIGHT="50">
<transition NAME="EIDNo" NEXT_STATE_ID="0" EVENT_ID="1003" />
<transition NAME="EIDYes" NEXT_STATE_ID="1" EVENT_ID="1004">
<action ID="1101">
<!--AcMODESELECT-->
</action>
<action ID="65">
<!--AcSELECT-->
</action>
</transition>
</state>
<state NAME="checkStillPicked" ID="3" X_POS="417" Y_POS="497" WIDTH="100" HEIGHT="50">
<transition NAME="EIDNo" NEXT_STATE_ID="0" EVENT_ID="1003">
<action ID="72">
<!--AcDESELECTALL-->
</action>
<action ID="1100">
<!--AcMODEDESELECT-->
</action>
</transition>
<transition NAME="EIDYes" NEXT_STATE_ID="4" EVENT_ID="1004">
<action ID="8">
<!--AcINITMOVEMENT-->
</action>
</transition>
</state>
<state NAME="moves" ID="4" X_POS="799" Y_POS="483" WIDTH="100" HEIGHT="50">
<transition NAME="mousemove" NEXT_STATE_ID="4" EVENT_ID="530">
<action ID="91">
<!--AcMOVESELECTED-->
</action>
</transition>
<transition NAME="finishmove" NEXT_STATE_ID="1" EVENT_ID="505">
<action ID="42">
<!--AcFINISHMOVEMENT-->
</action>
</transition>
</state>
<state NAME="checkGreaterOne" ID="5" X_POS="416" Y_POS="344" WIDTH="100" HEIGHT="50">
<transition NAME="StYes" NEXT_STATE_ID="1" EVENT_ID="1004">
<action ID="100">
<!--AcREMOVEPOINT-->
</action>
<action ID="61">
<!--AcSELECTANOTHEROBJECT-->
</action>
</transition>
<transition NAME="StNo" NEXT_STATE_ID="0" EVENT_ID="1003">
<action ID="100">
<!--AcREMOVEPOINT-->
</action>
<action ID="1100">
<!--AcMODEDESELECT-->
</action>
</transition>
</state>
</stateMachine>
<stateMachine NAME="pointsetinteractor">
<!-- Behaviour of a set of Points. a defined number of points can be set/removed/selected/deselectd/moved -->
<state NAME="no points or loaded points" ID="1" START_STATE="TRUE" X_POS="1066" Y_POS="281" WIDTH="100" HEIGHT="50">
<transition NAME="0SmallerPointsLoadedSmallerN" NEXT_STATE_ID="2" EVENT_ID="1014" />
<!-- If points have been loaded, goto right state; checked in constructor -->
<transition NAME="PointsLoadedGreaterEqualsN" NEXT_STATE_ID="4" EVENT_ID="1015" />
<!-- If points have been loaded, goto right state; checked in constructor -->
<transition NAME="addPoint but check n" NEXT_STATE_ID="3" EVENT_ID="3">
<action ID="1101">
<!--AcMODE_SELECT-->
</action>
<action ID="32" />
</transition>
<transition NAME="checkn Delete" NEXT_STATE_ID="30" EVENT_ID="12">
<action ID="330" />
<!--AcCHECKNUMBEROFPOINTS-->
</transition>
<transition NAME="SetThisStatemachineOnSelected" NEXT_STATE_ID="1" EVENT_ID="1030">
<action ID="1101">
<!--AcMODE_SELECT-->
</action>
</transition>
<transition NAME="SetThisStatemachineOnDeselected" NEXT_STATE_ID="1" EVENT_ID="1031">
<action ID="1100">
<!--AcMODE_DESELECT-->
</action>
</transition>
</state>
<state NAME="space left" ID="2" X_POS="659" Y_POS="257" WIDTH="100" HEIGHT="50">
<transition NAME="addPoint but check n" NEXT_STATE_ID="3" EVENT_ID="3">
<action ID="32" />
</transition>
<transition NAME="Select or move point Space" NEXT_STATE_ID="10" EVENT_ID="1">
<action ID="30" />
</transition>
<transition NAME="check selected and Delete" NEXT_STATE_ID="31" EVENT_ID="12">
<action ID="340" />
<!--AcCHECKONESELECTED-->
</transition>
<transition NAME="DeselectAll" NEXT_STATE_ID="2" EVENT_ID="14">
<!--Event = ESC-->
<action ID="72">
<!--AcDESELECTALL-->
</action>
<action ID="1100">
<!--AcMODE_DESELECT-->
</action>
</transition>
</state>
<state NAME="checkedN" ID="3" X_POS="745" Y_POS="744" WIDTH="100" HEIGHT="50">
<transition NAME="n smaller N" NEXT_STATE_ID="40" EVENT_ID="1010">
<action ID="37" />
</transition>
<transition NAME="n greater equals N" NEXT_STATE_ID="41" EVENT_ID="1011">
<action ID="37" />
</transition>
</state>
<state NAME="set full" ID="4" X_POS="267" Y_POS="633" WIDTH="100" HEIGHT="50">
<transition NAME="Select or move point FULL" NEXT_STATE_ID="20" EVENT_ID="1">
<action ID="30">
<!--AcCHECKELEMENT-->
</action>
</transition>
<transition NAME="checkn Delete selected Point" NEXT_STATE_ID="30" EVENT_ID="12">
<action ID="330">
<!--AcCHECKNUMBEROFPOINTS-->
</action>
</transition>
<transition NAME="DeselectAll" NEXT_STATE_ID="2" EVENT_ID="14">
<!--Event = ESC-->
<action ID="72">
<!--AcDESELECTALL-->
</action>
<action ID="1100">
<!--AcMODEDESELECT-->
</action>
</transition>
</state>
<state NAME="picked NotFull" ID="10" X_POS="903" Y_POS="38" WIDTH="100" HEIGHT="50">
<transition NAME="StNo" NEXT_STATE_ID="2" EVENT_ID="1003">
<action ID="72">
<!--AcDESELECTALL-->
</action>
<action ID="1100">
<!--AcMODEDESELECT-->
</action>
</transition>
<transition NAME="StYes" NEXT_STATE_ID="11" EVENT_ID="1004">
<action ID="34">
<!--AcCHECKSELECTED-->
</action>
<action ID="1101">
<!--AcMODESELECT-->
</action>
</transition>
</state>
<state NAME="already selected Space" ID="11" X_POS="391" Y_POS="11" WIDTH="100" HEIGHT="50">
<transition NAME="StNo" NEXT_STATE_ID="2" EVENT_ID="1003">
<action ID="60" />
</transition>
<transition NAME="StYes" NEXT_STATE_ID="12" EVENT_ID="1004">
<action ID="8" />
</transition>
</state>
<state NAME="move Point Space" ID="12" X_POS="100" Y_POS="99" WIDTH="100" HEIGHT="50">
<transition NAME="move point" NEXT_STATE_ID="12" EVENT_ID="530">
<action ID="91" />
</transition>
<transition NAME="finish move" NEXT_STATE_ID="2" EVENT_ID="505">
<action ID="42" />
</transition>
<transition NAME="Safety init" NEXT_STATE_ID="12" EVENT_ID="1">
<action ID="8" />
</transition>
</state>
<state NAME="picked Full" ID="20" X_POS="122" Y_POS="766" WIDTH="100" HEIGHT="50">
<transition NAME="StNO" NEXT_STATE_ID="4" EVENT_ID="1003">
<action ID="72">
<!--AcDESELECTALL-->
</action>
<action ID="1100">
<!--AcMODEDESELECT-->
</action>
</transition>
<transition NAME="StYES" NEXT_STATE_ID="21" EVENT_ID="1004">
<action ID="34">
<!--AcCHECKSELECTED-->
</action>
<action ID="1101">
<!--AcMODESELECT-->
</action>
</transition>
</state>
<state NAME="selected Full" ID="21" X_POS="23" Y_POS="485" WIDTH="100" HEIGHT="50">
<transition NAME="StNo" NEXT_STATE_ID="4" EVENT_ID="1003">
<action ID="60">
<!--AcSELECTPICKEDOBJECT-->
</action>
</transition>
<transition NAME="StYes" NEXT_STATE_ID="22" EVENT_ID="1004">
<action ID="8">
<!--AcINITMOVEMENT-->
</action>
</transition>
</state>
<state NAME="move Point Full" ID="22" X_POS="67" Y_POS="255" WIDTH="100" HEIGHT="50">
<!-- since the MouseMove Event is send by QT we don't have the information about the position of the point in the list. we had it before, when we checked, if it was picked, or if it was selected -->
<transition NAME="move point" NEXT_STATE_ID="22" EVENT_ID="530">
<action ID="91" />
</transition>
<transition NAME="finish move" NEXT_STATE_ID="4" EVENT_ID="505">
<action ID="42" />
</transition>
<transition NAME="Safety init" NEXT_STATE_ID="22" EVENT_ID="1">
<action ID="8" />
</transition>
</state>
<state NAME="checkn Delete" ID="30" X_POS="1124" Y_POS="708" WIDTH="100" HEIGHT="50">
<transition NAME="StillFull" NEXT_STATE_ID="4" EVENT_ID="1015">
<action ID="100" />
</transition>
<transition NAME="NotEmptyNotFull" NEXT_STATE_ID="2" EVENT_ID="1014">
<action ID="100" />
</transition>
<transition NAME="WillBeEmpty" NEXT_STATE_ID="1" EVENT_ID="1017">
<action ID="100" />
<!--AcREMOVEPOINT-->
<action ID="1100">
<!--AcMODEDESELECT-->
</action>
</transition>
</state>
<state NAME="selected space left" ID="31" X_POS="22" Y_POS="480" WIDTH="90" HEIGHT="50">
<transition NAME="StNo" NEXT_STATE_ID="2" EVENT_ID="1003" />
<transition NAME="StYes" NEXT_STATE_ID="30" EVENT_ID="1004">
<action ID="330" />
<!--AcCHECKNUMBEROFPOINTS-->
</transition>
</state>
<state NAME="checkedPositionEventSmallerN" ID="40" X_POS="267" Y_POS="301" WIDTH="173" HEIGHT="50">
<transition NAME="PositionEvent" NEXT_STATE_ID="2" EVENT_ID="1004">
<action ID="10" />
<!--AcADDPOINT-->
</transition>
<transition NAME="others" NEXT_STATE_ID="2" EVENT_ID="1003">
<action ID="0" />
</transition>
</state>
<state NAME="checkedPositionEventGreaterN" ID="41" X_POS="562" Y_POS="424" WIDTH="168" HEIGHT="50">
<transition NAME="PositionEvent" NEXT_STATE_ID="4" EVENT_ID="1004">
<action ID="10" />
</transition>
<transition NAME="others" NEXT_STATE_ID="2" EVENT_ID="1003">
<action ID="0" />
</transition>
</state>
</stateMachine>
<stateMachine NAME="onlymovepointsetinteractor">
<!-- Behaviour of a set of Points. The points can only be selected and moved.-->
<state NAME="no points or loaded points" ID="1" START_STATE="TRUE" X_POS="1066" Y_POS="281" WIDTH="100" HEIGHT="50">
<transition NAME="0SmallerPointsLoadedSmallerN" NEXT_STATE_ID="2" EVENT_ID="1014" />
<!-- If points have been loaded, goto right state; checked in constructor -->
<transition NAME="PointsLoadedGreaterEqualsN" NEXT_STATE_ID="2" EVENT_ID="1015" />
<!-- If points have been loaded, goto right state; checked in constructor -->
<transition NAME="SetThisStatemachineOnSelected" NEXT_STATE_ID="1" EVENT_ID="1030">
<action ID="1101">
<!--AcMODE_SELECT-->
</action>
</transition>
<transition NAME="SetThisStatemachineOnDeselected" NEXT_STATE_ID="1" EVENT_ID="1031">
<action ID="1100">
<!--AcMODE_DESELECT-->
</action>
</transition>
</state>
<state NAME="loaded points" ID="2" X_POS="659" Y_POS="257" WIDTH="100" HEIGHT="50">
<transition NAME="Select or move point" NEXT_STATE_ID="10" EVENT_ID="1">
<action ID="30" />
</transition>
<transition NAME="DeselectAll" NEXT_STATE_ID="2" EVENT_ID="14">
<!--Event = ESC-->
<action ID="72">
<!--AcDESELECTALL-->
</action>
<action ID="1100">
<!--AcMODE_DESELECT-->
</action>
</transition>
</state>
<state NAME="picked point" ID="10" X_POS="903" Y_POS="38" WIDTH="100" HEIGHT="50">
<transition NAME="StNo" NEXT_STATE_ID="2" EVENT_ID="1003">
<action ID="72">
<!--AcDESELECTALL-->
</action>
<action ID="1100">
<!--AcMODEDESELECT-->
</action>
</transition>
<transition NAME="StYes" NEXT_STATE_ID="11" EVENT_ID="1004">
<action ID="34">
<!--AcCHECKSELECTED-->
</action>
<action ID="1101">
<!--AcMODESELECT-->
</action>
</transition>
</state>
<state NAME="already selected point" ID="11" X_POS="391" Y_POS="11" WIDTH="100" HEIGHT="50">
<transition NAME="StNo" NEXT_STATE_ID="2" EVENT_ID="1003">
<action ID="60" />
</transition>
<transition NAME="StYes" NEXT_STATE_ID="12" EVENT_ID="1004">
<action ID="8" />
</transition>
</state>
<state NAME="move point" ID="12" X_POS="100" Y_POS="99" WIDTH="100" HEIGHT="50">
<transition NAME="move point" NEXT_STATE_ID="12" EVENT_ID="530">
<action ID="91" />
</transition>
<transition NAME="finish move" NEXT_STATE_ID="2" EVENT_ID="505">
<action ID="42" />
</transition>
<transition NAME="Safety init" NEXT_STATE_ID="12" EVENT_ID="1">
<action ID="8" />
</transition>
</state>
</stateMachine>
<stateMachine NAME="seedpointsetinteractor">
<!-- Behaviour of one Point. Point is added by clicking left Mouse Button and holding Shift-->
<state NAME="no point" ID="1" START_STATE="TRUE" X_POS="59" Y_POS="45" WIDTH="169" HEIGHT="50">
<transition NAME="0SmallerPointsLoadedSmallerN" NEXT_STATE_ID="10" EVENT_ID="1014" />
<!-- If point has been loaded, goto right state; checked in constructor -->
<transition NAME="PointsLoadedGreaterEqualsN" NEXT_STATE_ID="10" EVENT_ID="1015" />
<!-- If point has been loaded, goto right state; checked in constructor -->
<transition NAME="addPoint" NEXT_STATE_ID="2" EVENT_ID="3">
<action ID="1101">
<!--AcMODESELECT-->
</action>
<action ID="37" />
<!--AcCHECKOPERATION-->
</transition>
</state>
<state NAME="checkPositionEvent" ID="2" X_POS="164" Y_POS="334" WIDTH="166" HEIGHT="50">
<transition NAME="PositionEvent" NEXT_STATE_ID="10" EVENT_ID="1004">
<action ID="10" />
<!--AcADDPOINT-->
</transition>
<transition NAME="others" NEXT_STATE_ID="1" EVENT_ID="1003">
<action ID="0" />
</transition>
</state>
<state NAME="point" ID="10" X_POS="914" Y_POS="734" WIDTH="100" HEIGHT="50">
<transition NAME="insertPoint" NEXT_STATE_ID="11" EVENT_ID="3">
<action ID="37" />
<!--AcCHECKOPERATION-->
</transition>
<transition NAME="Select or move point" NEXT_STATE_ID="12" EVENT_ID="1">
<action ID="30" />
<!--AcCHECKELEMENT-->
</transition>
<transition NAME="check selected and delete" NEXT_STATE_ID="15" EVENT_ID="12">
<action ID="340" />
<!--AcCHECKONESELECTED-->
</transition>
</state>
<state NAME="checkedPositionEventPoint" ID="11" X_POS="758" Y_POS="478" WIDTH="100" HEIGHT="50">
<transition NAME="PositionEvent" NEXT_STATE_ID="10" EVENT_ID="1004">
<action ID="103" />
<!--AcREMOVEALL-->
<action ID="10" />
<!--AcADDPOINT-->
</transition>
<transition NAME="others" NEXT_STATE_ID="10" EVENT_ID="1003">
<action ID="0" />
</transition>
</state>
<state NAME="picked point" ID="12" X_POS="23" Y_POS="560" WIDTH="150" HEIGHT="50">
<transition NAME="StNo" NEXT_STATE_ID="10" EVENT_ID="1003">
<action ID="72" />
<!--AcDESELECTALL-->
<action ID="1100" />
<!--AcMODEDESELECT-->
</transition>
<transition NAME="StYes" NEXT_STATE_ID="13" EVENT_ID="1004">
<action ID="34" />
<!--AcCHECKSELECTED-->
<action ID="1101" />
<!--AcMODESELECT-->
</transition>
</state>
<state NAME="selected" ID="13" X_POS="23" Y_POS="485" WIDTH="100" HEIGHT="50">
<transition NAME="StNo" NEXT_STATE_ID="10" EVENT_ID="1003">
<action ID="60" />
<!--AcSELECTPICKEDOBJECT-->
</transition>
<transition NAME="StYes" NEXT_STATE_ID="14" EVENT_ID="1004">
<action ID="8" />
<!--AcINITMOVEMENT-->
</transition>
</state>
<state NAME="move Point" ID="14" X_POS="76" Y_POS="731" WIDTH="100" HEIGHT="50">
<transition NAME="move point" NEXT_STATE_ID="14" EVENT_ID="530">
<action ID="91" />
<!--AcMOVESELECTED-->
</transition>
<transition NAME="finish move" NEXT_STATE_ID="10" EVENT_ID="505">
<action ID="42" />
<!--AcFINISHMOVEMENT-->
</transition>
<transition NAME="Safety init" NEXT_STATE_ID="14" EVENT_ID="1">
<action ID="8" />
<!--AcINITMOVEMENT-->
</transition>
</state>
<state NAME="already selected" ID="15" X_POS="23" Y_POS="560" WIDTH="150" HEIGHT="50">
<transition NAME="StNo" NEXT_STATE_ID="10" EVENT_ID="1003" />
<transition NAME="StYes" NEXT_STATE_ID="16" EVENT_ID="1004">
<action ID="33" />
<!--AcCHECKEQUALS1-->
</transition>
</state>
<state NAME="delete" ID="16" X_POS="1151" Y_POS="19" WIDTH="100" HEIGHT="50">
<transition NAME="equalsOne" NEXT_STATE_ID="1" EVENT_ID="1004">
<action ID="100" />
<!--AcREMOVEPOINT-->
<action ID="1100" />
<!--AcMODEDESELECT-->
</transition>
<transition NAME="largerOne" NEXT_STATE_ID="10" EVENT_ID="1003">
<action ID="100" />
<!--AcREMOVEPOINT-->
</transition>
</state>
</stateMachine>
<stateMachine NAME="VesselGraphInteractor">
<state NAME="Start" ID="1" START_STATE="TRUE" X_POS="1390" Y_POS="-1" WIDTH="100" HEIGHT="50">
<transition NAME="goToCheckPicking" NEXT_STATE_ID="2" EVENT_ID="5">
<action ID="31">
<!--AcCHECKOBJECT-->
</action>
</transition>
<transition NAME="goToCheckPicking" NEXT_STATE_ID="2" EVENT_ID="8">
<action ID="31">
<!--AcCHECKOBJECT-->
</action>
</transition>
</state>
<state NAME="CheckPicking" ID="2" X_POS="515" Y_POS="263" WIDTH="100" HEIGHT="50">
<transition NAME="noPicked" NEXT_STATE_ID="4" EVENT_ID="1003">
<action ID="66">
<!-- AcSELECTPOINT -->
</action>
</transition>
<transition NAME="yesPicked" NEXT_STATE_ID="3" EVENT_ID="1004">
<action ID="69">
<!-- AcSELECTSUBOBJECT -->
</action>
</transition>
</state>
<state NAME="OneVesselPicked" ID="3" X_POS="1488" Y_POS="350" WIDTH="100" HEIGHT="50">
<transition NAME="goToCheckPicking" NEXT_STATE_ID="5" EVENT_ID="5">
<action ID="31">
<!-- AcCHECKOBJECT -->
</action>
</transition>
<transition NAME="goToCheckPicking" NEXT_STATE_ID="5" EVENT_ID="8">
<action ID="31">
<!-- AcCHECKOBJECT -->
</action>
</transition>
<transition NAME="delete" NEXT_STATE_ID="1" EVENT_ID="12">
<action ID="104">
<!-- AcREMOVESELECTEDSUBOBJECT -->
</action>
</transition>
<transition NAME="deselectAll" NEXT_STATE_ID="1" EVENT_ID="14">
<action ID="72">
<!-- AcDESELECTALL -->
</action>
</transition>
<transition NAME="searchPeriphery" NEXT_STATE_ID="11" EVENT_ID="15">
<action ID="3000">
<!-- AcPERIPHERYSEARCH -->
</action>
</transition>
<transition NAME="searchToRoot" NEXT_STATE_ID="11" EVENT_ID="16">
<action ID="3001">
<!-- AcROOTSEARCH -->
</action>
</transition>
<transition NAME="searchToThickstVessel" NEXT_STATE_ID="11" EVENT_ID="17">
<action ID="3002">
<!-- AcTHICKSTVESSELSEARCH -->
</action>
</transition>
<!--now follow the attibutations for different vessel types-->
<transition NAME="attributation" NEXT_STATE_ID="3" EVENT_ID="20">
<action ID="3005">
<!-- AcATTRIBUTATION -->
<intParameter NAME="attribute_id" VALUE="0" />
</action>
</transition>
<transition NAME="attributation" NEXT_STATE_ID="3" EVENT_ID="21">
<action ID="3005">
<!-- AcATTRIBUTATION -->
<intParameter NAME="attribute_id" VALUE="1" />
</action>
</transition>
<transition NAME="attributation" NEXT_STATE_ID="3" EVENT_ID="30">
<action ID="3005">
<!-- AcATTRIBUTATION -->
<intParameter NAME="attribute_id" VALUE="2" />
</action>
</transition>
<transition NAME="attributation" NEXT_STATE_ID="3" EVENT_ID="31">
<action ID="3005">
<!-- AcATTRIBUTATION -->
<intParameter NAME="attribute_id" VALUE="3" />
</action>
</transition>
<transition NAME="attributation" NEXT_STATE_ID="3" EVENT_ID="40">
<action ID="3005">
<!-- AcATTRIBUTATION -->
<intParameter NAME="attribute_id" VALUE="4" />
</action>
</transition>
<transition NAME="default" NEXT_STATE_ID="1" EVENT_ID="90">
<action ID="3007">
<!-- AcDEFAULT -->
</action>
</transition>
</state>
<state NAME="OnePointPicked" ID="4" X_POS="339" Y_POS="103" WIDTH="100" HEIGHT="50">
<transition NAME="goToCheckPicking" NEXT_STATE_ID="6" EVENT_ID="5">
<action ID="31">
<!-- AcCHECKOBJECT -->
</action>
</transition>
<transition NAME="goToCheckPicking" NEXT_STATE_ID="6" EVENT_ID="8">
<action ID="31">
<!-- AcCHECKOBJECT -->
</action>
</transition>
<transition NAME="deselectAll" NEXT_STATE_ID="1" EVENT_ID="14">
<action ID="72">
<!-- AcDESELECTALL -->
</action>
</transition>
</state>
<state NAME="CheckPicking" ID="5" X_POS="43" Y_POS="721" WIDTH="100" HEIGHT="50">
<transition NAME="noPicked" NEXT_STATE_ID="7" EVENT_ID="1003">
<action ID="66">
<!-- AcSELECTPOINT -->
</action>
</transition>
<transition NAME="yesPicked" NEXT_STATE_ID="13" EVENT_ID="1004">
<action ID="69">
<!-- AcSELECTSUBOBJECT -->
</action>
<action ID="3010">
<!-- AcCHECKBARRIERSTATUS -->
</action>
</transition>
</state>
<state NAME="CheckPicking" ID="6" X_POS="552" Y_POS="156" WIDTH="100" HEIGHT="50">
<transition NAME="noPicked" NEXT_STATE_ID="9" EVENT_ID="1003">
<action ID="66">
<!-- AcSELECTPOINT -->
</action>
</transition>
<transition NAME="yesPicked" NEXT_STATE_ID="7" EVENT_ID="1004">
<action ID="69">
<!-- AcSELECTSUBOBJECT -->
</action>
</transition>
</state>
<state NAME="OneVesselOnePointPicked" ID="7" X_POS="665" Y_POS="378" WIDTH="151" HEIGHT="50">
<transition NAME="ENew" NEXT_STATE_ID="1" EVENT_ID="13">
<action ID="81">
<!-- AcNEWSUBOBJECT -->
</action>
<action ID="72">
<!-- AcDESELECTALL -->
</action>
</transition>
<transition NAME="deselectAll" NEXT_STATE_ID="1" EVENT_ID="14">
<action ID="72">
<!-- AcDESELECTALL -->
</action>
</transition>
<transition NAME="delete" NEXT_STATE_ID="1" EVENT_ID="12">
<action ID="104">
<!-- AcREMOVESELECTEDSUBOBJECT -->
</action>
</transition>
<transition NAME="setVesselElement" NEXT_STATE_ID="7" EVENT_ID="91">
<action ID="3008">
<!-- AcSETVESSELELEMENT-->
</action>
</transition>
<!--now follow the attibutations for different vessel types-->
<transition NAME="attributation" NEXT_STATE_ID="7" EVENT_ID="20">
<action ID="3005">
<!-- AcATTRIBUTATION -->
<intParameter NAME="attribute_id" VALUE="0" />
</action>
</transition>
<transition NAME="attributation" NEXT_STATE_ID="7" EVENT_ID="21">
<action ID="3005">
<!-- AcATTRIBUTATION -->
<intParameter NAME="attribute_id" VALUE="1" />
</action>
</transition>
<transition NAME="attributation" NEXT_STATE_ID="7" EVENT_ID="30">
<action ID="3005">
<!-- AcATTRIBUTATION -->
<intParameter NAME="attribute_id" VALUE="2" />
</action>
</transition>
<transition NAME="attributation" NEXT_STATE_ID="7" EVENT_ID="31">
<action ID="3005">
<!-- AcATTRIBUTATION -->
<intParameter NAME="attribute_id" VALUE="3" />
</action>
</transition>
<transition NAME="attributation" NEXT_STATE_ID="7" EVENT_ID="40">
<action ID="3005">
<!-- AcATTRIBUTATION -->
<intParameter NAME="attribute_id" VALUE="4" />
</action>
</transition>
<transition NAME="default" NEXT_STATE_ID="1" EVENT_ID="90">
<action ID="3007">
<!-- AcDEFAULT -->
</action>
</transition>
</state>
<state NAME="TwoVesselsPicked" ID="8" X_POS="77" Y_POS="79" WIDTH="100" HEIGHT="50">
<transition NAME="ENew" NEXT_STATE_ID="1" EVENT_ID="13">
<action ID="81">
<!-- AcNEWSUBOBJECT -->
</action>
<action ID="72">
<!-- AcDESELECTALL -->
</action>
</transition>
<transition NAME="goToCheckPicking" NEXT_STATE_ID="10" EVENT_ID="5">
<action ID="31">
<!-- AcCHECKOBJECT -->
</action>
</transition>
<transition NAME="goToCheckPicking" NEXT_STATE_ID="10" EVENT_ID="8">
<action ID="31">
<!-- AcCHECKOBJECT -->
</action>
</transition>
<transition NAME="searchShortestPathBetween2Edges" NEXT_STATE_ID="11" EVENT_ID="18">
<action ID="3003">
<!-- AcSHORTESTPATHSEARCH -->
</action>
</transition>
<transition NAME="deselectAll" NEXT_STATE_ID="1" EVENT_ID="14">
<action ID="72">
<!-- AcDESELECTALL -->
</action>
</transition>
<transition NAME="delete" NEXT_STATE_ID="1" EVENT_ID="12">
<action ID="104">
<!-- AcREMOVESELECTEDSUBOBJECT -->
</action>
</transition>
<transition NAME="setVesselElement" NEXT_STATE_ID="8" EVENT_ID="91">
<action ID="3008">
<!-- AcSETVESSELELEMENT-->
</action>
</transition>
<!--now follow the attibutations for different vessel types-->
<transition NAME="attributation" NEXT_STATE_ID="8" EVENT_ID="20">
<action ID="3005">
<!-- AcATTRIBUTATION -->
<intParameter NAME="attribute_id" VALUE="0" />
</action>
</transition>
<transition NAME="attributation" NEXT_STATE_ID="8" EVENT_ID="21">
<action ID="3005">
<!-- AcATTRIBUTATION -->
<intParameter NAME="attribute_id" VALUE="1" />
</action>
</transition>
<transition NAME="attributation" NEXT_STATE_ID="8" EVENT_ID="30">
<action ID="3005">
<!-- AcATTRIBUTATION -->
<intParameter NAME="attribute_id" VALUE="2" />
</action>
</transition>
<transition NAME="attributation" NEXT_STATE_ID="8" EVENT_ID="31">
<action ID="3005">
<!-- AcATTRIBUTATION -->
<intParameter NAME="attribute_id" VALUE="3" />
</action>
</transition>
<transition NAME="attributation" NEXT_STATE_ID="8" EVENT_ID="40">
<action ID="3005">
<!-- AcATTRIBUTATION -->
<intParameter NAME="attribute_id" VALUE="4" />
</action>
</transition>
<transition NAME="default" NEXT_STATE_ID="1" EVENT_ID="90">
<action ID="3007">
<!-- AcDEFAULT -->
</action>
</transition>
</state>
<state NAME="TwoPointsPicked" ID="9" X_POS="748" Y_POS="140" WIDTH="100" HEIGHT="50">
<transition NAME="ENew" NEXT_STATE_ID="1" EVENT_ID="13">
<action ID="81">
<!-- AcNEWSUBOBJECT -->
</action>
</transition>
<transition NAME="deselectAll" NEXT_STATE_ID="1" EVENT_ID="14">
<action ID="72">
<!-- AcDESELECTALL -->
</action>
</transition>
<transition NAME="setVesselElement" NEXT_STATE_ID="9" EVENT_ID="91">
<action ID="3008">
<!-- AcSETVESSELELEMENT-->
</action>
</transition>
</state>
<state NAME="CheckPicking" ID="10" X_POS="642" Y_POS="805" WIDTH="100" HEIGHT="50">
<transition NAME="noPicked" NEXT_STATE_ID="12" EVENT_ID="1003">
<action ID="36">
<!--AcCHECKGREATERTWO-->
</action>
</transition>
<transition NAME="yesPicked" NEXT_STATE_ID="14" EVENT_ID="1004">
<action ID="69">
<!-- AcSELECTSUBOBJECT -->
</action>
<action ID="3010">
<!-- AcCHECKBARRIERSTATUS -->
</action>
</transition>
</state>
<state NAME="MoreVesselsPicked" ID="11" X_POS="933" Y_POS="754" WIDTH="100" HEIGHT="50">
<transition NAME="delete" NEXT_STATE_ID="1" EVENT_ID="12">
<action ID="104">
<!-- AcDESELECTALL -->
</action>
</transition>
<transition NAME="goToCheckPicking" NEXT_STATE_ID="10" EVENT_ID="5">
<action ID="31">
<!-- AcCHECKOBJECT -->
</action>
</transition>
<transition NAME="goToCheckPicking" NEXT_STATE_ID="10" EVENT_ID="8">
<action ID="31">
<!-- AcCHECKOBJECT -->
</action>
</transition>
<transition NAME="deselectAll" NEXT_STATE_ID="1" EVENT_ID="14">
<action ID="72">
<!-- AcDESELECTALL -->
</action>
</transition>
<transition NAME="singleSignal" NEXT_STATE_ID="3" EVENT_ID="19">
<action ID="3004">
<!-- AcSINGLE -->
</action>
</transition>
<!--now follow the attibutations for different vessel types-->
<transition NAME="attributation" NEXT_STATE_ID="11" EVENT_ID="20">
<action ID="3005">
<!-- AcATTRIBUTATION -->
<intParameter NAME="attribute_id" VALUE="0" />
</action>
</transition>
<transition NAME="attributation" NEXT_STATE_ID="11" EVENT_ID="21">
<action ID="3005">
<!-- AcATTRIBUTATION -->
<intParameter NAME="attribute_id" VALUE="1" />
</action>
</transition>
<transition NAME="attributation" NEXT_STATE_ID="11" EVENT_ID="30">
<action ID="3005">
<!-- AcATTRIBUTATION -->
<intParameter NAME="attribute_id" VALUE="2" />
</action>
</transition>
<transition NAME="attributation" NEXT_STATE_ID="11" EVENT_ID="31">
<action ID="3005">
<!-- AcATTRIBUTATION -->
<intParameter NAME="attribute_id" VALUE="3" />
</action>
</transition>
<transition NAME="attributation" NEXT_STATE_ID="11" EVENT_ID="40">
<action ID="3005">
<!-- AcATTRIBUTATION -->
<intParameter NAME="attribute_id" VALUE="4" />
</action>
</transition>
<transition NAME="default" NEXT_STATE_ID="1" EVENT_ID="90">
<action ID="3007">
<!-- AcDEFAULT -->
</action>
</transition>
</state>
<state NAME="CheckNumberPickedVesselsSmaller2" ID="12" X_POS="259" Y_POS="707" WIDTH="188" HEIGHT="50">
<transition NAME="yes" NEXT_STATE_ID="8" EVENT_ID="1004" />
<transition NAME="no" NEXT_STATE_ID="11" EVENT_ID="1003">
<action ID="69">
<!-- AcSELECTSUBOBJECT -->
</action>
</transition>
</state>
<state NAME="CheckBarrierStatus" ID="13" X_POS="8" Y_POS="318" WIDTH="100" HEIGHT="50">
<transition NAME="yes" NEXT_STATE_ID="3" EVENT_ID="1004" />
<transition NAME="no" NEXT_STATE_ID="8" EVENT_ID="1003" />
</state>
<state NAME="CheckBarrierStatus" ID="14" X_POS="557" Y_POS="510" WIDTH="100" HEIGHT="50">
<transition NAME="yes" NEXT_STATE_ID="8" EVENT_ID="1004" />
<transition NAME="no" NEXT_STATE_ID="11" EVENT_ID="1003" />
</state>
</stateMachine>
<stateMachine NAME="slices-rotator">
<state NAME="neutral" ID="1" START_STATE="TRUE">
<!-- mouse down: jump to decision state -->
<transition NAME="mouse down" NEXT_STATE_ID="2" EVENT_ID="1">
<action ID="21">
<!-- AcCheckPoint -->
</action>
</transition>
<transition NAME="mouse move" NEXT_STATE_ID="5" EVENT_ID="520">
<action ID="21">
<!-- AcCheckPoint -->
</action>
</transition>
</state>
<state NAME="rotate?" ID="2">
<transition NAME="yes" NEXT_STATE_ID="3" EVENT_ID="1004" />
<transition NAME="no" NEXT_STATE_ID="4" EVENT_ID="1003">
<action ID="92">
<!--AcMove-->
</action>
</transition>
</state>
<state NAME="rotate" ID="3">
<!-- send rotate events -->
<transition NAME="mouse move" NEXT_STATE_ID="3" EVENT_ID="530">
<action ID="1005">
<!--AcRotate-->
</action>
</transition>
<transition NAME="mouse release" NEXT_STATE_ID="1" EVENT_ID="505">
<action ID="1010">
<!--AcRotateEnd-->
</action>
</transition>
</state>
<state NAME="move" ID="4">
<!-- send move events -->
<transition NAME="mouse move" NEXT_STATE_ID="4" EVENT_ID="530">
<action ID="92">
<!--AcMove-->
</action>
</transition>
<transition NAME="mouse release" NEXT_STATE_ID="1" EVENT_ID="505" />
</state>
<state NAME="rotation possible?" ID="5">
<transition NAME="yes" NEXT_STATE_ID="6" EVENT_ID="1004">
<action ID="1004">
<!--AcRotateStart-->
</action>
</transition>
<transition NAME="no" NEXT_STATE_ID="1" EVENT_ID="1003" />
</state>
<state NAME="rotation possible!" ID="6">
<!-- mouse down: jump to decision state -->
<transition NAME="mouse down" NEXT_STATE_ID="2" EVENT_ID="1">
<action ID="21">
<!-- AcCheckPoint -->
</action>
</transition>
<transition NAME="mouse move" NEXT_STATE_ID="7" EVENT_ID="520">
<action ID="21">
<!-- AcCheckPoint -->
</action>
</transition>
</state>
<state NAME="rotation possible?" ID="7">
<transition NAME="yes" NEXT_STATE_ID="6" EVENT_ID="1004" />
<transition NAME="no" NEXT_STATE_ID="1" EVENT_ID="1003">
<action ID="1010">
<!--AcRotateEnd-->
</action>
</transition>
</state>
</stateMachine>
<stateMachine NAME="dummy">
<!-- Dummy for a null interaction -->
<state NAME="neutral" ID="0" START_STATE="TRUE">
<transition NAME="stay in dummy" NEXT_STATE_ID="0" EVENT_ID="0" />
</state>
</stateMachine>
<stateMachine NAME="SpaceNavigatorInteraction">
<state NAME="neutral" ID="1" START_STATE="TRUE">
<transition NAME="stay in dummy" NEXT_STATE_ID="1" EVENT_ID="4001">
<action ID="4001" />
<!--AcONTDMOUSEINPUT-->
</transition>
<transition NAME="stay with button down" NEXT_STATE_ID="1" EVENT_ID="4002">
<action ID="4002" />
<!--AcONTDMOUSEKEYDOWN-->
</transition>
</state>
</stateMachine>
<stateMachine NAME="WiiMoteHeadtracking">
<state NAME="headtracking" ID="1" START_STATE="TRUE">
<transition NAME="startState" NEXT_STATE_ID="1" EVENT_ID="4003">
<!--EIDWIIMOTEINPUT-->
<action ID="4003" />
<!--AcONWIIMOTEINPUT-->
</transition>
<transition NAME="buttonState" NEXT_STATE_ID="1" EVENT_ID="4004">
<!--EIDWIIMOTEBUTTON-->
<action ID="4004" />
<!--AcRESETVIEW-->
</transition>
<transition NAME="initCalibration" NEXT_STATE_ID="2" EVENT_ID="5551001">
<!--EV_INIT-->
<action ID="55500010" />
<!--AC_INIT-->
</transition>
</state>
<state NAME="calibration" ID="2">
<transition NAME="collectIRData" NEXT_STATE_ID="2" EVENT_ID="4003">
<!--EIDWIIMOTEINPUT-->
<action ID="21" />
<!--AcCHECKPOINT-->
</transition>
<transition NAME="endCalibration" NEXT_STATE_ID="1" EVENT_ID="5551001">
<!--EV_INIT-->
<action ID="44" />
<!--AcFINISH-->
</transition>
</state>
</stateMachine>
<stateMachine NAME="WiiMoteSurfaceInteraction">
<state NAME="start" ID="1" START_STATE="TRUE">
<transition NAME="initial state" NEXT_STATE_ID="2" EVENT_ID="4005" />
<!--EIDWIIMOTEBUTTONB-->
<transition NAME="reset object" NEXT_STATE_ID="1" EVENT_ID="4004">
<!--EIDWIIMOTEBUTTON-->
<action ID="4004" />
<!--AcRESETVIEW-->
</transition>
</state>
<state NAME="Surface Interaction" ID="2">
<transition NAME="stop Surface Interaction" NEXT_STATE_ID="1" EVENT_ID="5551008">
<!--EV_DONE-->
<action ID="4005">
<!-- AcONWIIMOTEBUTTONRELEASED -->
</action>
</transition>
<transition NAME="input for Surface Interaction" NEXT_STATE_ID="2" EVENT_ID="4003">
<!--EIDWIIMOTEINPUT-->
<action ID="4003">
<!--AcONWIIMOTEINPUT-->
</action>
</transition>
</state>
</stateMachine>
<stateMachine NAME="InteractorTestPattern">
<!-- To Test an Interactor for the right behavior -->
<state NAME="neutral" ID="0" START_STATE="TRUE">
<transition NAME="to1" NEXT_STATE_ID="1" EVENT_ID="4">
<action ID="1101" />
<!--AcMODESELECT-->
</transition>
<transition NAME="to2" NEXT_STATE_ID="2" EVENT_ID="2">
<action ID="1011" />
<!--AcMODESELECT-->
</transition>
</state>
<state NAME="State1" ID="1">
<transition NAME="StayIn1" NEXT_STATE_ID="1" EVENT_ID="533" />
<transition NAME="to0" NEXT_STATE_ID="0" EVENT_ID="506">
<action ID="1100" />
<!--AcMODEDESELECT-->
</transition>
</state>
<state NAME="State2" ID="2">
<transition NAME="StayIn2" NEXT_STATE_ID="2" EVENT_ID="531" />
<transition NAME="finish" NEXT_STATE_ID="0" EVENT_ID="507">
<action ID="1100" />
<!--AcMODEDESELECT-->
</transition>
</state>
</stateMachine>
<stateMachine NAME="shapemodelpointsetinteractor">
<state NAME="Interaction Activated, no point loaded yet" ID="1" START_STATE="TRUE" X_POS="457" Y_POS="506" WIDTH="226" HEIGHT="56">
<transition NAME="SetStateMachineOnDeselected" EVENT_ID="1031" NEXT_STATE_ID="1">
<action ID="1100" />
</transition>
<transition NAME="SetStateMachineOnSelected" EVENT_ID="1030" NEXT_STATE_ID="1">
<action ID="1101" />
</transition>
<transition NAME="Add Point" EVENT_ID="3" NEXT_STATE_ID="2">
<action ID="10" />
</transition>
</state>
<state NAME="One Point" ID="2" X_POS="567" Y_POS="145" WIDTH="100" HEIGHT="50">
<transition NAME="Move Point" EVENT_ID="3" NEXT_STATE_ID="2">
<action ID="103" />
<action ID="10" />
</transition>
<transition NAME="Remove Point" EVENT_ID="12" NEXT_STATE_ID="1">
<action ID="100" />
</transition>
<transition NAME="Check if point is hit by mouse click" EVENT_ID="1" NEXT_STATE_ID="3">
<action ID="30" />
</transition>
<transition NAME="name" EVENT_ID="14" NEXT_STATE_ID="2">
<action ID="72" />
<action ID="1100" />
</transition>
</state>
<state NAME="CheckPoint" ID="3" X_POS="64" Y_POS="52" WIDTH="100" HEIGHT="50">
<transition NAME="Point not hit" EVENT_ID="1003" NEXT_STATE_ID="2">
<action ID="72" />
<action ID="1100" />
</transition>
<transition NAME="Point is hit, check if is selected or not" EVENT_ID="1004" NEXT_STATE_ID="5">
<action ID="34" />
<action ID="1101" />
</transition>
</state>
<state NAME="PointMove" ID="4" X_POS="278" Y_POS="422" WIDTH="100" HEIGHT="50">
<transition NAME="Adjust the Mesh according to point move" EVENT_ID="505" NEXT_STATE_ID="2">
<action ID="42" />
</transition>
<transition NAME="name" EVENT_ID="530" NEXT_STATE_ID="4">
<action ID="1236" />
<action ID="91" />
<action ID="1234" />
</transition>
<transition NAME="name" EVENT_ID="1" NEXT_STATE_ID="4">
<action ID="8" />
</transition>
</state>
<state NAME="Already Selected?" ID="5" X_POS="187" Y_POS="247" WIDTH="100" HEIGHT="50">
<transition NAME="Initialize Movement" EVENT_ID="1004" NEXT_STATE_ID="4">
<action ID="8" />
<action ID="1235" />
</transition>
<transition NAME="name" EVENT_ID="1003" NEXT_STATE_ID="2">
<action ID="60" />
</transition>
</state>
</stateMachine>
<stateMachine NAME="singlepointinteractor">
<!-- Behaviour of one point. This single point can be set, selected and then moved and removed. A setting of a new point will delete the old one.-->
<state NAME="no point or loaded point not selected" ID="1" START_STATE="TRUE" X_POS="18" Y_POS="336" WIDTH="197" HEIGHT="50">
<transition NAME="SetThisStatemachineOnSelected" NEXT_STATE_ID="1" EVENT_ID="1030">
<action ID="1101">
<!--AcMODE_SELECT-->
</action>
</transition>
<transition NAME="SetThisStatemachineOnDeselected" NEXT_STATE_ID="1" EVENT_ID="1031">
<action ID="1100">
<!--AcMODE_DESELECT-->
</action>
</transition>
<transition NAME="addPoint but check n" NEXT_STATE_ID="42" EVENT_ID="3">
<action ID="1101">
<!--AcMODE_SELECT-->
</action>
<action ID="103" />
<action ID="10" />
</transition>
<transition NAME="name" EVENT_ID="1" NEXT_STATE_ID="43">
<action ID="30" />
</transition>
</state>
<state NAME="picked" ID="20" X_POS="693" Y_POS="587" WIDTH="100" HEIGHT="50">
<transition NAME="StNO" NEXT_STATE_ID="1" EVENT_ID="1003">
<action ID="72">
<!--AcDESELECTALL-->
</action>
<action ID="1100">
<!--AcMODEDESELECT-->
</action>
</transition>
<transition NAME="StYes" NEXT_STATE_ID="22" EVENT_ID="1004">
<action ID="8">
<!--AcINITMOVEMENT-->
</action>
<action ID="1101" />
</transition>
</state>
<state NAME="move point" ID="22" X_POS="1135" Y_POS="449" WIDTH="100" HEIGHT="50">
<!-- since the MouseMove Event is send by QT we don't have the information about the position of the point in the list. we had it before, when we checked, if it was picked, or if it was selected -->
<transition NAME="move point" NEXT_STATE_ID="22" EVENT_ID="530">
<action ID="91" />
</transition>
<transition NAME="Safety init" NEXT_STATE_ID="22" EVENT_ID="1">
<action ID="8" />
</transition>
<transition NAME="finish move" NEXT_STATE_ID="42" EVENT_ID="505">
<action ID="42" />
</transition>
</state>
<state NAME="point selected" ID="42" X_POS="674" Y_POS="341" WIDTH="100" HEIGHT="50">
<transition NAME="Select or move point FULL" NEXT_STATE_ID="20" EVENT_ID="1">
<action ID="30">
<!--AcCHECKELEMENT-->
</action>
</transition>
<transition NAME="StYes" NEXT_STATE_ID="1" EVENT_ID="12">
<action ID="100" />
<action ID="1100">
<!--AcMODEDESELECT-->
</action>
</transition>
<transition NAME="name" EVENT_ID="3" NEXT_STATE_ID="42">
<action ID="103" />
<action ID="10" />
</transition>
</state>
<state NAME="picked not yet selected" ID="43" X_POS="681" Y_POS="158" WIDTH="126" HEIGHT="50">
<transition NAME="name" EVENT_ID="1004" NEXT_STATE_ID="42">
<action ID="60" />
</transition>
<transition NAME="name" EVENT_ID="1003" NEXT_STATE_ID="1">
<action ID="72" />
</transition>
</state>
</stateMachine>
<stateMachine NAME="moveNzoom">
<state NAME="neutral" ID="0" START_STATE="TRUE" X_POS="288" Y_POS="81" WIDTH="100" HEIGHT="50">
<transition NAME="initmove" NEXT_STATE_ID="1" EVENT_ID="4">
<action ID="9" />
</transition>
<transition NAME="initzoom" NEXT_STATE_ID="2" EVENT_ID="2">
<action ID="1011" />
</transition>
</state>
<state NAME="move" ID="1" X_POS="170" Y_POS="413" WIDTH="100" HEIGHT="50">
<transition NAME="move" NEXT_STATE_ID="1" EVENT_ID="533">
<action ID="92" />
</transition>
<transition NAME="finish" NEXT_STATE_ID="0" EVENT_ID="506">
<action ID="43" />
</transition>
</state>
<state NAME="zoom" ID="2" X_POS="584" Y_POS="432" WIDTH="100" HEIGHT="50">
<transition NAME="zoom" NEXT_STATE_ID="2" EVENT_ID="531">
<action ID="1012" />
</transition>
<transition NAME="finish" NEXT_STATE_ID="0" EVENT_ID="507" />
</state>
</stateMachine>
<stateMachine NAME="OnePointDoubleClickInteraction">
<state NAME="empty" ID="0" START_STATE="TRUE">
<transition NAME="doubleclick" NEXT_STATE_ID="1" EVENT_ID="8">
<action ID="10" />
</transition>
<transition NAME="delete" NEXT_STATE_ID="0" EVENT_ID="12">
<action ID="103" />
</transition>
</state>
<state NAME="point available" ID="1">
<transition NAME="doubleclick" NEXT_STATE_ID="1" EVENT_ID="8">
<action ID="103" />
<action ID="10" />
</transition>
<transition NAME="delete" NEXT_STATE_ID="0" EVENT_ID="12">
<action ID="103" />
</transition>
</state>
</stateMachine>
<stateMachine NAME="OnePointMouseMoveInteraction">
<state NAME="empty" ID="0" START_STATE="TRUE">
<transition NAME="mousemove" NEXT_STATE_ID="1" EVENT_ID="520">
<action ID="1101" />
<!--AcMODE_SELECT-->
<action ID="10" />
<!-- Add Point -->
</transition>
<transition NAME="mousewheelmove" NEXT_STATE_ID="1" EVENT_ID="9">
<action ID="1101" />
<!--AcMODE_SELECT-->
<action ID="10" />
<!-- Add Point -->
</transition>
<transition NAME="deleteSafety" NEXT_STATE_ID="0" EVENT_ID="12">
<action ID="103" />
<!-- Remove Point -->
<action ID="1100" />
<!--AcMODEDESELECT-->
</transition>
</state>
<state NAME="point available" ID="1">
<transition NAME="mousemove" NEXT_STATE_ID="1" EVENT_ID="520">
<action ID="1101" />
<!--AcMODE_SELECT-->
<action ID="103" />
<!-- Remove Point -->
<action ID="10" />
<!-- Add Point -->
</transition>
<transition NAME="mousewheelmove" NEXT_STATE_ID="1" EVENT_ID="9">
<action ID="1101" />
<!--AcMODE_SELECT-->
<action ID="103" />
<!-- Remove Point -->
<action ID="10" />
<!-- Add Point -->
</transition>
<transition NAME="delete" NEXT_STATE_ID="0" EVENT_ID="12">
<action ID="103" />
<!-- Remove Point -->
<action ID="1100" />
<!--AcMODEDESELECT-->
</transition>
</state>
</stateMachine>
<stateMachine NAME="CurveModelInteractor">
<!-- Behaviour of a set of Points. a defined number of points can be set/removed/selected/deselectd/moved -->
<state NAME="Start" ID="42" START_STATE="TRUE" X_POS="918" Y_POS="441" WIDTH="100" HEIGHT="50">
<transition NAME="name" EVENT_ID="1" NEXT_STATE_ID="43">
<action ID="21" />
</transition>
</state>
<state NAME="IsPointSelected" ID="43" X_POS="470" Y_POS="441" WIDTH="100" HEIGHT="50">
<transition NAME="name" EVENT_ID="1003" NEXT_STATE_ID="42">
<action ID="72" />
</transition>
<transition NAME="name" EVENT_ID="1004" NEXT_STATE_ID="44" />
</state>
<state NAME="PointSelected" ID="44" X_POS="690" Y_POS="204" WIDTH="100" HEIGHT="50">
<transition NAME="name" EVENT_ID="530" NEXT_STATE_ID="44">
<action ID="91" />
</transition>
<transition NAME="name" EVENT_ID="505" NEXT_STATE_ID="42">
<action ID="43" />
</transition>
</state>
</stateMachine>
<stateMachine NAME="singlepointinteractorwithoutshiftclick">
<!-- Behaviour of one point. This single point can be set, selected and then moved and removed. A setting of a new point will delete the old one.-->
<state NAME="no point or loaded point not selected" ID="1" START_STATE="TRUE" X_POS="18" Y_POS="336" WIDTH="197" HEIGHT="50">
<transition NAME="SetThisStatemachineOnSelected" NEXT_STATE_ID="1" EVENT_ID="1030">
<action ID="1101">
<!--AcMODE_SELECT-->
</action>
</transition>
<transition NAME="SetThisStatemachineOnDeselected" NEXT_STATE_ID="1" EVENT_ID="1031">
<action ID="1100">
<!--AcMODE_DESELECT-->
</action>
</transition>
<transition NAME="addPoint" NEXT_STATE_ID="2" EVENT_ID="1">
<action ID="1101" />
<!--AcMODE_SELECT-->
<action ID="103" />
<!--AcREMOVEALL-->
<action ID="10" />
<!--AcADDPOINT-->
</transition>
</state>
<state NAME="point selected" ID="2" X_POS="674" Y_POS="341" WIDTH="100" HEIGHT="50">
<transition NAME="delete point" NEXT_STATE_ID="1" EVENT_ID="12">
<action ID="100" />
<!--AcREMOVEPOINT-->
<action ID="1100">
<!--AcMODEDESELECT-->
</action>
</transition>
<transition NAME="set point" NEXT_STATE_ID="2" EVENT_ID="1">
<action ID="103" />
<!--AcREMOVEALL-->
<action ID="10" />
<!--AcADDPOINT-->
</transition>
</state>
</stateMachine>
<stateMachine NAME="SeedpointCorrection">
<state NAME="position check" ID="0" START_STATE="TRUE" X_POS="18" Y_POS="336" WIDTH="197" HEIGHT="50">
<transition NAME="nothing found" NEXT_STATE_ID="0" EVENT_ID="1003">
<action ID="48008" />
</transition>
<transition NAME="inside" NEXT_STATE_ID="1" EVENT_ID="1004">
<action ID="31" />
<transition NAME="check position" NEXT_STATE_ID="0" EVENT_ID="520">
<action ID="5000" />
</transition>
<transition NAME="check position 2" NEXT_STATE_ID="0" EVENT_ID="530">
<action ID="5000" />
</transition>
<transition NAME="change BoundingBox" NEXT_STATE_ID="3" EVENT_ID="1013">
<action ID="65" />
</transition>
</transition>
</state>
<state NAME="edit seedpoints" ID="1" X_POS="18" Y_POS="336" WIDTH="197" HEIGHT="50">
<transition NAME="back to start" NEXT_STATE_ID="0" EVENT_ID="520">
<action ID="12" />
</transition>
<transition NAME="initialize correction" NEXT_STATE_ID="2" EVENT_ID="530">
<action ID="5001" />
</transition>
</state>
<state NAME="correct segmentation" ID="2" X_POS="18" Y_POS="336" WIDTH="197" HEIGHT="50">
<transition NAME="draw contour" NEXT_STATE_ID="2" EVENT_ID="530">
<action ID="92" />
</transition>
<transition NAME="calculate result" NEXT_STATE_ID="0" EVENT_ID="505">
<action ID="5002" />
</transition>
</state>
<state NAME="init BoundingBox Resizing" ID="3" X_POS="18" Y_POS="336" WIDTH="197" HEIGHT="50">
<transition NAME="back to start 2" NEXT_STATE_ID="0" EVENT_ID="520">
<action ID="5000" />
</transition>
<transition NAME="add boundingboxinteractor" NEXT_STATE_ID="4" EVENT_ID="1">
<action ID="5003" />
</transition>
</state>
<state NAME="BoundingBox Resizing" ID="4" X_POS="18" Y_POS="336" WIDTH="197" HEIGHT="50">
<transition NAME="calculate result 2" NEXT_STATE_ID="0" EVENT_ID="23">
<action ID="5004" />
</transition>
</state>
</stateMachine>
<stateMachine NAME="BoundingBox Interaction">
<state NAME="position check" ID="0" START_STATE="TRUE" X_POS="18" Y_POS="336" WIDTH="197" HEIGHT="50">
<transition NAME="test" NEXT_STATE_ID="1" EVENT_ID="1">
<action ID="5000" />
</transition>
<transition NAME="test" NEXT_STATE_ID="3" EVENT_ID="520">
<action ID="5000" />
</transition>
</state>
<state NAME="boundingbox resizing initialization" ID="1" X_POS="18" Y_POS="336" WIDTH="197" HEIGHT="50">
<transition NAME="nothing found" NEXT_STATE_ID="0" EVENT_ID="1003">
<action ID="47" />
</transition>
<transition NAME="something found" NEXT_STATE_ID="2" EVENT_ID="1004">
<action ID="94" />
<action ID="110" />
</transition>
</state>
<state NAME="teststate" ID="2" X_POS="18" Y_POS="336" WIDTH="197" HEIGHT="50">
<transition NAME="test 2" NEXT_STATE_ID="2" EVENT_ID="530">
<action ID="11" />
</transition>
<transition NAME="test 3" NEXT_STATE_ID="0" EVENT_ID="505">
<action ID="5" />
</transition>
<transition NAME="test 9" NEXT_STATE_ID="4" EVENT_ID="1003">
<action ID="0" />
</transition>
</state>
<state NAME="teststate 2" ID="3" X_POS="18" Y_POS="336" WIDTH="197" HEIGHT="50">
<transition NAME="test 4" NEXT_STATE_ID="3" EVENT_ID="1004">
<action ID="94" />
</transition>
<transition NAME="test 5" NEXT_STATE_ID="0" EVENT_ID="520">
<action ID="5000" />
</transition>
<transition NAME="test 6" NEXT_STATE_ID="0" EVENT_ID="1003">
<action ID="47" />
</transition>
<transition NAME="test 7" NEXT_STATE_ID="1" EVENT_ID="1">
<action ID="5000" />
</transition>
</state>
<state NAME="teststate 2" ID="4" X_POS="18" Y_POS="336" WIDTH="197" HEIGHT="50">
<transition NAME="test 8" NEXT_STATE_ID="4" EVENT_ID="530">
<action ID="0" />
</transition>
<transition NAME="test 9" NEXT_STATE_ID="0" EVENT_ID="505">
<action ID="0" />
</transition>
</state>
</stateMachine>
<stateMachine NAME="ToolWithWheelInteraction">
<state NAME="ToolIdle" ID="1" START_STATE="TRUE" X_POS="167" Y_POS="365" WIDTH="100" HEIGHT="50">
<transition NAME="MouseWheel" EVENT_ID="9" NEXT_STATE_ID="1">
<action ID="105" />
</transition>
<transition NAME="send Koordinates press" NEXT_STATE_ID="2" EVENT_ID="1">
<action ID="80" />
</transition>
<transition NAME="MouseMove" EVENT_ID="520" NEXT_STATE_ID="1">
<action ID="92" />
</transition>
<transition NAME="name" EVENT_ID="26" NEXT_STATE_ID="1">
<action ID="106" />
</transition>
<transition NAME="name" EVENT_ID="27" NEXT_STATE_ID="1">
<action ID="107" />
</transition>
</state>
<state NAME="ToolInUse" ID="2" X_POS="511" Y_POS="372" WIDTH="100" HEIGHT="50">
<transition NAME="send Koordinates move" NEXT_STATE_ID="2" EVENT_ID="530">
<action ID="90" />
</transition>
<transition NAME="send Koordinates release" NEXT_STATE_ID="1" EVENT_ID="505">
<action ID="42" />
</transition>
<transition NAME="MouseWheel" EVENT_ID="9" NEXT_STATE_ID="2">
<action ID="105" />
</transition>
<transition NAME="name" EVENT_ID="26" NEXT_STATE_ID="2">
<action ID="106" />
</transition>
<transition NAME="name" EVENT_ID="27" NEXT_STATE_ID="2">
<action ID="107" />
</transition>
</state>
</stateMachine>
<stateMachine NAME="AffineInteractor3D">
<state NAME="Start" ID="1" START_STATE="TRUE" X_POS="65" Y_POS="267" WIDTH="100" HEIGHT="50">
<transition NAME="name" EVENT_ID="520" NEXT_STATE_ID="2">
<action ID="31" />
</transition>
</state>
<state NAME="IsOverObject" ID="2" X_POS="352" Y_POS="267" WIDTH="100" HEIGHT="50">
<transition NAME="name" EVENT_ID="1003" NEXT_STATE_ID="1">
<action ID="70" />
</transition>
<transition NAME="name" EVENT_ID="1004" NEXT_STATE_ID="3">
<action ID="60" />
</transition>
<transition NAME="name" EVENT_ID="9" NEXT_STATE_ID="2">
<action ID="49014" />
</transition>
</state>
<state NAME="ObjectSelected" ID="3" X_POS="719" Y_POS="268" WIDTH="100" HEIGHT="50">
<transition NAME="name" EVENT_ID="520" NEXT_STATE_ID="2">
<action ID="31" />
</transition>
<transition NAME="name" EVENT_ID="1" NEXT_STATE_ID="4">
<action ID="9" />
</transition>
<transition NAME="name" EVENT_ID="9" NEXT_STATE_ID="3">
<action ID="49014" />
</transition>
</state>
<state NAME="ObjectInteraction" ID="4" X_POS="598" Y_POS="629" WIDTH="100" HEIGHT="50">
<transition NAME="name" EVENT_ID="530" NEXT_STATE_ID="4">
<action ID="92" />
</transition>
<transition NAME="name" EVENT_ID="505" NEXT_STATE_ID="2">
<action ID="31" />
</transition>
<transition NAME="name" EVENT_ID="521" NEXT_STATE_ID="4">
<action ID="49014" />
<action ID="92" />
</transition>
</state>
</stateMachine>
<stateMachine NAME="Zoom">
<state NAME="neutral" ID="0" START_STATE="TRUE" X_POS="288" Y_POS="81" WIDTH="100" HEIGHT="50">
<transition NAME="initzoom" NEXT_STATE_ID="2" EVENT_ID="1">
<action ID="1011" />
</transition>
</state>
<state NAME="zoom" ID="2" X_POS="584" Y_POS="432" WIDTH="100" HEIGHT="50">
<transition NAME="zoom" NEXT_STATE_ID="2" EVENT_ID="530">
<action ID="1012" />
</transition>
<transition NAME="finish" NEXT_STATE_ID="0" EVENT_ID="505" />
</state>
</stateMachine>
<stateMachine NAME="CtrlZoom">
<state NAME="neutral" ID="0" START_STATE="TRUE" X_POS="288" Y_POS="81" WIDTH="100" HEIGHT="50">
<transition NAME="initzoom" NEXT_STATE_ID="1" EVENT_ID="7">
<action ID="1011" />
</transition>
</state>
<state NAME="zoom" ID="1" X_POS="584" Y_POS="432" WIDTH="100" HEIGHT="50">
<transition NAME="CtrlZoom" NEXT_STATE_ID="1" EVENT_ID="535">
<action ID="1012" />
</transition>
<transition NAME="finish" NEXT_STATE_ID="0" EVENT_ID="538" />
</state>
</stateMachine>
<stateMachine NAME="LeftClickScroll">
<state NAME="neutral" ID="0" START_STATE="TRUE" X_POS="288" Y_POS="81" WIDTH="100" HEIGHT="50">
<transition NAME="initmove" NEXT_STATE_ID="1" EVENT_ID="1">
<action ID="9" />
</transition>
</state>
<state NAME="scroll" ID="1" X_POS="170" Y_POS="413" WIDTH="100" HEIGHT="50">
<transition NAME="scroll" NEXT_STATE_ID="1" EVENT_ID="530">
<action ID="1013" />
</transition>
<transition NAME="finish" NEXT_STATE_ID="0" EVENT_ID="505">
<action ID="43" />
</transition>
</state>
</stateMachine>
<stateMachine NAME="MiddleClickScroll">
<state NAME="neutral" ID="0" START_STATE="TRUE" X_POS="288" Y_POS="81" WIDTH="100" HEIGHT="50">
<transition NAME="initmove" NEXT_STATE_ID="1" EVENT_ID="4">
<action ID="9" />
</transition>
</state>
<state NAME="scroll" ID="1" X_POS="170" Y_POS="413" WIDTH="100" HEIGHT="50">
<transition NAME="scroll" NEXT_STATE_ID="1" EVENT_ID="533">
<action ID="1013" />
</transition>
<transition NAME="finish" NEXT_STATE_ID="0" EVENT_ID="506">
<action ID="43" />
</transition>
</state>
</stateMachine>
<stateMachine NAME="Pan">
<state NAME="neutral" ID="0" START_STATE="TRUE" X_POS="288" Y_POS="81" WIDTH="100" HEIGHT="50">
<transition NAME="initmove" NEXT_STATE_ID="1" EVENT_ID="1">
<action ID="9" />
</transition>
</state>
<state NAME="move" ID="1" X_POS="170" Y_POS="413" WIDTH="100" HEIGHT="50">
<transition NAME="move" NEXT_STATE_ID="1" EVENT_ID="530">
<action ID="92" />
</transition>
<transition NAME="finish" NEXT_STATE_ID="0" EVENT_ID="505">
<action ID="43" />
</transition>
</state>
</stateMachine>
<stateMachine NAME="ShiftClickPan">
<state NAME="neutral" ID="0" START_STATE="TRUE" X_POS="288" Y_POS="81" WIDTH="100" HEIGHT="50">
<transition NAME="initshiftmove" NEXT_STATE_ID="1" EVENT_ID="2000">
<action ID="9" />
</transition>
</state>
<state NAME="shiftmove" ID="1" X_POS="170" Y_POS="413" WIDTH="100" HEIGHT="50">
<transition NAME="shiftmove" NEXT_STATE_ID="1" EVENT_ID="2001">
<action ID="92" />
</transition>
<transition NAME="finish" NEXT_STATE_ID="0" EVENT_ID="2002">
<action ID="43" />
</transition>
</state>
</stateMachine>
<stateMachine NAME="RightClickLevelWindow">
<state NAME="neutral" ID="0" START_STATE="TRUE" X_POS="288" Y_POS="81" WIDTH="100" HEIGHT="50">
<transition NAME="initmove" NEXT_STATE_ID="1" EVENT_ID="2">
<action ID="9" />
</transition>
</state>
<state NAME="levelwindow" ID="1" X_POS="584" Y_POS="432" WIDTH="100" HEIGHT="50">
<transition NAME="levelwindow" NEXT_STATE_ID="1" EVENT_ID="531">
<action ID="1014" />
</transition>
<transition NAME="finish" NEXT_STATE_ID="0" EVENT_ID="507" />
</state>
</stateMachine>
<stateMachine NAME="ToolCallbackInteraction">
<state NAME="neutral" ID="0" START_STATE="TRUE" X_POS="288" Y_POS="81" WIDTH="100" HEIGHT="50">
<transition NAME="initmove" NEXT_STATE_ID="1" EVENT_ID="1">
<action ID="9" />
</transition>
</state>
<state NAME="InInteraction" ID="1" X_POS="288" Y_POS="81" WIDTH="100" HEIGHT="50">
<transition NAME="finishmove" NEXT_STATE_ID="0" EVENT_ID="1003" />
</state>
</stateMachine>
<stateMachine NAME="BinaryImageInteractor">
<state NAME="neutral" ID="1" START_STATE="TRUE" X_POS="138" Y_POS="318" WIDTH="100" HEIGHT="50">
<transition NAME="name" EVENT_ID="520" NEXT_STATE_ID="2">
<action ID="30" />
</transition>
</state>
<state NAME="IsOverImage" ID="2" X_POS="447" Y_POS="185" WIDTH="100" HEIGHT="50">
<transition NAME="name" EVENT_ID="1003" NEXT_STATE_ID="1" />
<transition NAME="isOverImage" EVENT_ID="1004" NEXT_STATE_ID="3" />
</state>
<state NAME="PickImage" ID="3" X_POS="803" Y_POS="350" WIDTH="100" HEIGHT="50">
<transition NAME="SelectingImage" EVENT_ID="1" NEXT_STATE_ID="4">
<action ID="60" />
</transition>
<transition NAME="name" EVENT_ID="520" NEXT_STATE_ID="2">
<action ID="30" />
</transition>
</state>
<state NAME="SelectImage" ID="4" X_POS="594" Y_POS="542" WIDTH="100" HEIGHT="50">
<transition NAME="name" EVENT_ID="505" NEXT_STATE_ID="2">
<action ID="30" />
</transition>
</state>
</stateMachine>
<stateMachine NAME="PlanarFigureInteractor">
<!-- Behaviour of a set of Points. a defined number of points can be set/removed/selected/deselectd/moved -->
<state NAME="Start" ID="42" START_STATE="TRUE" X_POS="1368" Y_POS="736" WIDTH="100" HEIGHT="50">
<transition NAME="name" EVENT_ID="0" NEXT_STATE_ID="49">
<action ID="31" />
</transition>
</state>
<state NAME="FigurePlaced" ID="45" X_POS="836" Y_POS="715" WIDTH="100" HEIGHT="50">
<transition NAME="name" EVENT_ID="520" NEXT_STATE_ID="45">
<action ID="90" />
</transition>
<transition NAME="name" EVENT_ID="8" NEXT_STATE_ID="54">
<action ID="33" />
</transition>
<transition NAME="name" EVENT_ID="530" NEXT_STATE_ID="57">
<action ID="90" />
</transition>
<transition NAME="name" EVENT_ID="1" NEXT_STATE_ID="58">
<action ID="21" />
</transition>
</state>
<state NAME="ControlPointSelected" ID="47" X_POS="74" Y_POS="665" WIDTH="128" HEIGHT="50">
<transition NAME="name" EVENT_ID="530" NEXT_STATE_ID="47">
<action ID="90" />
</transition>
<transition NAME="name" EVENT_ID="505" NEXT_STATE_ID="52">
<action ID="76" />
</transition>
</state>
<state NAME="IsLastControlPoint" ID="48" X_POS="1102" Y_POS="732" WIDTH="100" HEIGHT="50">
<transition NAME="name" EVENT_ID="1004" NEXT_STATE_ID="42" />
<transition NAME="name" EVENT_ID="1003" NEXT_STATE_ID="45">
<action ID="10" />
</transition>
</state>
<state NAME="IsPlaced" ID="49" X_POS="1302" Y_POS="201" WIDTH="100" HEIGHT="50">
<transition NAME="name" EVENT_ID="1003" NEXT_STATE_ID="50" />
<transition NAME="name" EVENT_ID="1004" NEXT_STATE_ID="51" />
</state>
<state NAME="PlaceFigure" ID="50" X_POS="868" Y_POS="293" WIDTH="100" HEIGHT="50">
<transition NAME="name" EVENT_ID="1" NEXT_STATE_ID="45">
<action ID="11" />
</transition>
</state>
<state NAME="EditFigure" ID="51" X_POS="804" Y_POS="199" WIDTH="100" HEIGHT="50">
<transition NAME="name" EVENT_ID="520" NEXT_STATE_ID="52">
<action ID="341" />
</transition>
</state>
<state NAME="IsOverFigure" ID="52" X_POS="340" Y_POS="170" WIDTH="100" HEIGHT="50">
<transition NAME="name" EVENT_ID="1003" NEXT_STATE_ID="51" />
<transition NAME="name" EVENT_ID="1004" NEXT_STATE_ID="53" />
</state>
<state NAME="FigureHover" ID="53" X_POS="563" Y_POS="326" WIDTH="115" HEIGHT="50">
<transition NAME="name" EVENT_ID="520" NEXT_STATE_ID="52">
<action ID="341" />
</transition>
<transition NAME="name" EVENT_ID="2" NEXT_STATE_ID="60">
<action ID="60" />
</transition>
<transition NAME="name" EVENT_ID="1" NEXT_STATE_ID="65">
<action ID="34" />
</transition>
</state>
<state NAME="IsMinFigureFinished" ID="54" X_POS="972" Y_POS="929" WIDTH="110" HEIGHT="50">
<transition NAME="name" EVENT_ID="1004" NEXT_STATE_ID="42" />
<transition NAME="name" EVENT_ID="1003" NEXT_STATE_ID="45" />
</state>
<state NAME="ResetFigure" ID="55" X_POS="610" Y_POS="934" WIDTH="100" HEIGHT="50">
<transition NAME="name" EVENT_ID="1003" NEXT_STATE_ID="47" />
<transition NAME="name" EVENT_ID="1004" NEXT_STATE_ID="45" />
</state>
<state NAME="FigurePlacedByDrag" ID="57" X_POS="1047" Y_POS="391" WIDTH="138" HEIGHT="50">
<transition NAME="name" EVENT_ID="530" NEXT_STATE_ID="57">
<action ID="90" />
</transition>
<transition NAME="name" EVENT_ID="505" NEXT_STATE_ID="58">
<action ID="21" />
</transition>
</state>
<state NAME="IsPointValid" ID="58" X_POS="1212" Y_POS="555" WIDTH="100" HEIGHT="50">
<transition NAME="name" EVENT_ID="1004" NEXT_STATE_ID="48">
<action ID="32" />
</transition>
<transition NAME="name" EVENT_ID="1003" NEXT_STATE_ID="45" />
</state>
<state NAME="FigureSelectedForDelete" ID="60" X_POS="308" Y_POS="532" WIDTH="132" HEIGHT="50">
<transition NAME="name" EVENT_ID="1004" NEXT_STATE_ID="52">
<action ID="100" />
</transition>
<transition NAME="name" EVENT_ID="1003" NEXT_STATE_ID="53" />
</state>
<state NAME="IsOverControlPoint" ID="59" X_POS="586" Y_POS="636" WIDTH="120" HEIGHT="50">
<transition NAME="name" EVENT_ID="1004" NEXT_STATE_ID="55">
<action ID="66" />
</transition>
<transition NAME="name" EVENT_ID="1003" NEXT_STATE_ID="47">
<action ID="10" />
</transition>
</state>
<state NAME="FigureSeleced" ID="65" X_POS="740" Y_POS="487" WIDTH="100" HEIGHT="50">
<transition NAME="name" EVENT_ID="1003" NEXT_STATE_ID="53" />
<transition NAME="name" EVENT_ID="1004" NEXT_STATE_ID="59">
<action ID="60" />
</transition>
</state>
</stateMachine>
+<stateMachine NAME="FiberBundleInteractor">
+ <!-- working with mitk::FiberBundles -->
+ <state NAME="Start" ID="123451" START_STATE="TRUE" X_POS="1368" Y_POS="736" WIDTH="100" HEIGHT="50">
+ <transition NAME="name" EVENT_ID="520" NEXT_STATE_ID="123451">
+ <!-- on EIDMOUSEMOVE keep in state and do AcCHECKHOVERING (which throws EIDFIGUREHOVER or EIDNOFIGUREHOVER if applicable) -->
+ <action ID="341" />
+ </transition>
+ <transition NAME="name" EVENT_ID="12340" NEXT_STATE_ID="123452">
+ <!-- on EIDFIGUREHOVER go to HoverFiber and do AcSELECTPICKEDOBJECT -->
+ <action ID="60" />
+ </transition>
+ </state>
+ <state NAME="HoverFiber" ID="123452" X_POS="340" Y_POS="170" WIDTH="100" HEIGHT="50">
+ <transition NAME="name" EVENT_ID="520" NEXT_STATE_ID="123452">
+ <!-- on EIDMOUSEMOVE keep state and do AcCHECKHOVERING (which throws EIDFIGUREHOVER or EIDNOFIGUREHOVER if applicable) -->
+ <action ID="341" />
+ </transition>
+ <transition NAME="name" EVENT_ID="12340" NEXT_STATE_ID="123452">
+ <!-- on EIDFIGUREHOVER keep state and do AcSELECTPICKEDOBJECT -->
+ <action ID="60" />
+ </transition>
+ <transition NAME="name" EVENT_ID="12341" NEXT_STATE_ID="123451">
+ <!-- on EIDNOFIGUREHOVER go to Start and do AcDESELECTALL -->
+ <action ID="72" />
+ </transition>
+ <transition NAME="name" EVENT_ID="1" NEXT_STATE_ID="123452">
+ <!-- on EIDLEFTMOUSEBTN keep state and do AcREMOVE -->
+ <action ID="101" />
+ </transition>
+ </state>
+ </stateMachine>
</mitkInteraktionStates>
<!-- DOCUMENTATION -->
<!-- This is StateMachine.xml. Includes Information about different StateMachines and Events. Used by EventMapper and StateMachineFactory -->
<!-- /** \example StateMachine.xml -->
<!-- -->
<!-- -->
<!-- FAQ -->
<!-- Question: the Application, that is loading this file doesn't act on the Interaction. Why? -->
<!-- The QXMLFileLoader probably isn't able to load the file due to an error.-->
<!-- Check the file for XML-Syntax like "<" at beginning and "/>" at end -->
diff --git a/CoreUI/Bundles/org.mitk.gui.qt.common/resources/mitkEventAndActionConstants.xml b/CoreUI/Bundles/org.mitk.gui.qt.common/resources/mitkEventAndActionConstants.xml
index 7ef09fbd46..c7792a98cc 100644
--- a/CoreUI/Bundles/org.mitk.gui.qt.common/resources/mitkEventAndActionConstants.xml
+++ b/CoreUI/Bundles/org.mitk.gui.qt.common/resources/mitkEventAndActionConstants.xml
@@ -1,381 +1,385 @@
<?xml version="1.0" encoding="utf-8"?>
<mitkInteraktionEvents>
<events>
<eventCategory NAME="NullEvent">
<event NAME="EIDNULLEVENT" ID="0" />
</eventCategory>
<eventCategory NAME="TDMouseEvents">
<event NAME="EIDTDMOUSEINPUT" ID="4001" />
</eventCategory>
<eventCategory NAME="MouseEvents">
<event NAME="EIDLEFTMOUSEBTN" ID="1" />
<event NAME="EIDRIGHTMOUSEBTN" ID="2" />
<event NAME="EIDLEFTMOUSEBTNANDSHIFT" ID="3" />
<event NAME="EIDMIDDLEMOUSEBTN" ID="4" />
<event NAME="EIDLEFTMOUSEBTNANDCTRL" ID="5" />
<event NAME="EIDMIDDLEMOUSEBTNANDCTRL" ID="6" />
<event NAME="EIDRIGHTMOUSEBTNANDCTRL" ID="7" />
<event NAME="EIDLEFTMOUSERELEASE" ID="505" />
<event NAME="EIDMIDDLEMOUSERELEASE" ID="506" />
<event NAME="EIDRIGHTMOUSERELEASE" ID="507" />
<event NAME="EIDLEFTMOUSERELEASEANDSHIFT" ID="508" />
<event NAME="EIDMOUSEMOVE" ID="520" />
<event NAME="EIDLEFTMOUSEBTNANDMOUSEWHEEL" ID="521" />
<event NAME="EIDRIGHTMOUSEBTNANDMOUSEWHEEL" ID="522" />
<event NAME="EIDMIDDLEMOUSEBTNANDMOUSEWHEEL" ID="523" />
<event NAME="EIDLEFTMOUSEBTNANDMOUSEMOVE" ID="530" />
<event NAME="EIDRIGHTMOUSEBTNANDMOUSEMOVE" ID="531" />
<event NAME="EIDMIDDLEMOUSEBTNANDMOUSEMOVE" ID="533" />
<event NAME="EIDCTRLANDLEFTMOUSEBTNANDMOUSEMOVE" ID="534" />
<event NAME="EIDCTRLANDRIGHTMOUSEBTNANDMOUSEMOVE" ID="535" />
<event NAME="EIDCTRLANDMIDDLEMOUSEBTNANDMOUSEMOVE" ID="536" />
<event NAME="EIDCTRLANDLEFTMOUSEBTNRELEASE" ID="537" />
<event NAME="EIDCTRLANDRIGHTMOUSEBTNRELEASE" ID="538" />
<event NAME="EIDCTRLANDMIDDLEMOUSEBTNRELEASE" ID="539" />
<event NAME="EIDSHIFTANDCTRLANDMIDDLEMOUSEBTN" ID="540" />
<event NAME="EIDSHIFTANDLEFTMOUSEBTNANDMOUSEMOVE" ID="541" />
<event NAME="SHIFTANDCTRLANDMOUSEMOVE" ID="542" />
<event NAME="SHIFTANDCTRLANDMOUSERELEASE" ID="543" />
<event NAME="EIDALTANDLEFTMOUSEBTN" ID="600" />
<event NAME="EIDALTANDLEFTMOUSEBTNANDMOUSEMOVE" ID="610" />
<event NAME="EIDALTANDLEFTMOUSERELEASE" ID="620" />
<event NAME="EIDSHIFTANDRIGHTMOUSEPRESS" ID="2000" />
<event NAME="EIDSHIFTANDRIGHTMOUSEMOVE" ID="2001" />
<event NAME="EIDSHIFTANDRIGHTMOUSERELEASE" ID="2002" />
<event NAME="EIDSHIFTANDMIDDLEMOUSEPRESS" ID="2003" />
<event NAME="EIDSHIFTANDMIDDLEMOUSEMOVE" ID="2004" />
<event NAME="EIDSHIFTANDMIDDLEMOUSERELEASE" ID="2005" />
<event NAME="EIDMOUSEWHEEL" ID="9" />
</eventCategory>
<eventCategory NAME="NoMouseEvents">
<event NAME="EIDSTRGANDN" ID="10" />
<event NAME="EIDSTRGANDE" ID="11" />
<event NAME="EIDDELETE" ID="12" />
<event NAME="EIDN" ID="13" />
<event NAME="EIDESCAPE" ID="14" />
<event NAME="EIDP" ID="15" />
<event NAME="EIDR" ID="16" />
<event NAME="EIDT" ID="17" />
<event NAME="EIDS" ID="18" />
<event NAME="EIDE" ID="19" />
<event NAME="EIDSTRGANDALTANDA" ID="20" />
<event NAME="EIDSTRGANDALTANDB" ID="21" />
<event NAME="EIDH" ID="22" />
<event NAME="EIDRETURN" ID="23" />
<event NAME="EIDENTER" ID="24" />
<event NAME="EIDSPACE" ID="25" />
<event NAME="EIDSTRGANDALTANDH" ID="30" />
<event NAME="EIDSTRGANDALTANDI" ID="31" />
<event NAME="EIDSTRGANDALTANDS" ID="40" />
<event NAME="EIDALT" ID="90" />
<event NAME="EIDSTRGANDB" ID="91" />
<event NAME="EIDPLUS" ID="26">
<!---->
</event>
<event NAME="EIDMINUS" ID="27">
<!---->
</event>
</eventCategory>
<eventCategory NAME="own thrown events">
<event NAME="EIDNEW" ID="1000" />
<event NAME="EIDOLD" ID="1001" />
<event NAME="EIDFINISHED" ID="1002" />
<event NAME="EIDNO" ID="1003" />
<event NAME="EIDYES" ID="1004" />
<event NAME="EIDSAME" ID="1005" />
<event NAME="EIDNOANDLASTOBJECT" ID="1006" />
<event NAME="EIDNOANDNOTLASTOBJECT" ID="1007" />
<event NAME="EIDLAST" ID="1008" />
<event NAME="EIDNOTLAST" ID="1009" />
<event NAME="EIDSTSMALERNMINUS1" ID="1010" />
<event NAME="EIDSTLARGERNMINUS1" ID="1011" />
<event NAME="EIDPOSITIONEVENT" ID="1012" />
<event NAME="EIDEDIT" ID="1013" />
<event NAME="EIDSUBDESELECT" ID="1020" />
<event NAME="EIDSMTOSELECTED" ID="1030" />
<event NAME="EIDSMTODESELECTED" ID="1031" />
<event NAME="EIDTIP" ID="1050" />
<event NAME="EIDHEAD" ID="1051" />
<event NAME="EIDBODY" ID="1052" />
</eventCategory>
<eventCategory NAME="external thrown events">
<event NAME="EIDCLEAR" ID="1100" />
<event NAME="EIDACTIVATETOOL" ID="1300" />
</eventCategory>
<eventCategory NAME="Puncture Application">
<event NAME="EIDPRINT" ID="3001" />
</eventCategory>
<eventCategory NAME="AriadneEvents">
<event NAME="EV_INIT" ID="5551001" />
<event NAME="EV_PREVIOUS" ID="5551002" />
<event NAME="EV_PATH_COLLECTION_SELECTED" ID="5551003" />
<event NAME="EV_NAVIGATION_SELECTED" ID="5551004" />
<event NAME="EV_LESS_THEN_MIN_COUNT" ID="5551005" />
<event NAME="EV_READY" ID="5551006" />
<event NAME="EV_NEXT" ID="5551007" />
<event NAME="EV_DONE" ID="5551008" />
<event NAME="EV_NEW_LANDMARK" ID="5551009" />
<event NAME="EV_REMOVE_LANDMARK" ID="5551010" />
</eventCategory>
+ <eventCategory NAME="FiberBundles">
+ <event NAME="EIDFIGUREHOVER" ID="12340" />
+ <event NAME="EIDNOFIGUREHOVER" ID="12341" />
+ </eventCategory>
</events>
<actions>
<actionCategory NAME="DoNothing">
<action NAME="AcDONOTHING" ID="0" />
</actionCategory>
<actionCategory NAME="Init">
<action NAME="AcINITNEWOBJECT" ID="5" />
<action NAME="AcINITEDITOBJECT" ID="6" />
<action NAME="AcINITEDITGROUP" ID="7" />
<action NAME="AcINITMOVEMENT" ID="8" />
<action NAME="AcINITMOVE" ID="9" />
<action NAME="AcINITFOREGROUND" ID="45">
<!--used in SeedsInteractor for setting the foreground seeds-->
</action>
<action NAME="AcINITBACKGROUND" ID="46">
<!--used in SeedsInteractor for setting the background seeds-->
</action>
<action NAME="AcINITNEUTRAL" ID="47">
<!--used in SeedsInteractor for setting the neutral seeds (rubber)-->
</action>
<action NAME="AcINITUPDATE" ID="1235">
<!--For shape model deformation-->
</action>
</actionCategory>
<actionCategory NAME="Add">
<action NAME="AcADDPOINT" ID="10" />
<action NAME="AcADD" ID="11" />
<action NAME="AcADDLINE" ID="12" />
<action NAME="AcADDANDFINISH" ID="13" />
<action NAME="AcADDSELECTEDTOGROUP" ID="64" />
</actionCategory>
<actionCategory NAME="Check">
<action NAME="AcCHECKPOINT" ID="21" />
<action NAME="AcCHECKLINE" ID="22" />
<action NAME="AcCHECKCELL" ID="23" />
<action NAME="AcCHECKELEMENT" ID="30">
<!--check if there is a element close enough (picking)-->
</action>
<action NAME="AcCHECKOBJECT" ID="31">
<!--check if an object is hit-->
</action>
<action NAME="AcCHECKNMINUS1" ID="32">
<!--check if the number of elements is equal to N-1-->
</action>
<action NAME="AcCHECKEQUALS1" ID="33">
<!--check if the number of elements in the data is equal to 1-->
</action>
<action NAME="AcCHECKNUMBEROFPOINTS" ID="330">
<!--check the number of elements in the data-->
</action>
<action NAME="AcCHECKSELECTED" ID="34">
<!--check if the given element is selected or not-->
</action>
<action NAME="AcCHECKONESELECTED" ID="340">
<!--check if there is an element that is selected-->
</action>
<action NAME="AcCHECKHOVERING" ID="341">
<!--check if the cursor is above the given element-->
</action>
<action NAME="AcCHECKGREATERZERO" ID="35">
<!--check if the current number of elements is greater than 0-->
</action>
<action NAME="AcCHECKGREATERTWO" ID="36">
<!--check if the current number of elements is greater than two-->
</action>
<action NAME="AcCHECKOPERATION" ID="37">
<!--check if the operation is of one spectial type-->
</action>
<action NAME="AcCHECKONESUBINTERACTOR" ID="38" />
<action NAME="AcCHECKSUBINTERACTORS" ID="39" />
</actionCategory>
<actionCategory NAME="Finish">
<action NAME="AcFINISHOBJECT" ID="40" />
<action NAME="AcFINISHGROUP" ID="41" />
<action NAME="AcFINISHMOVEMENT" ID="42" />
<action NAME="AcFINISHMOVE" ID="43" />
<action NAME="AcFINISH" ID="44" />
</actionCategory>
<actionCategory NAME="Search">
<action NAME="AcSEARCHOBJECT" ID="50" />
<action NAME="AcSEARCHGROUP" ID="51" />
<action NAME="AcSEARCHANOTHEROBJECT" ID="52">
<!--one object is selected and another object is to be added to selection-->
</action>
</actionCategory>
<actionCategory NAME="Select">
<action NAME="AcSELECTPICKEDOBJECT" ID="60">
<!--select the picked object and deselect others-->
</action>
<action NAME="AcSELECTANOTHEROBJECT" ID="61" />
<action NAME="AcSELECTGROUP" ID="62" />
<action NAME="AcSELECTALL" ID="63" />
<action NAME="AcSELECT" ID="65" />
<action NAME="AcSELECTPOINT" ID="66" />
<action NAME="AcSELECTLINE" ID="68" />
<action NAME="AcSELECTCELL" ID="67" />
<action NAME="AcSELECTSUBOBJECT" ID="69">
<!--used in VesselGraphInteractor-->
</action>
</actionCategory>
<actionCategory NAME="Deselect">
<action NAME="AcDESELECTOBJECT" ID="70">
<!--deselect picked from group-->
</action>
<action NAME="AcDESELECTALL" ID="72" />
<action NAME="AcDESELECT" ID="75" />
<action NAME="AcDESELECTPOINT" ID="76" />
<action NAME="AcDESELECTLINE" ID="78" />
<action NAME="AcDESELECTCELL" ID="77" />
</actionCategory>
<actionCategory NAME="New">
<action NAME="AcNEWPOINT" ID="80" />
<action NAME="AcNEWSUBOBJECT" ID="81" />
</actionCategory>
<actionCategory NAME="Move">
<action NAME="AcMOVEPOINT" ID="90" />
<action NAME="AcMOVESELECTED" ID="91" />
<action NAME="AcMOVE" ID="92" />
</actionCategory>
<actionCategory NAME="Remove">
<action NAME="AcREMOVEPOINT" ID="100" />
<action NAME="AcREMOVE" ID="101" />
<action NAME="AcREMOVELINE" ID="102" />
<action NAME="AcREMOVEALL" ID="103" />
<action NAME="AcREMOVESELECTEDSUBOBJECT" ID="104">
<!--used in VesselGraphInteractor-->
</action>
<action NAME="AcDELETEPOINT" ID="120" />
<action NAME="AcCLEAR" ID="130">
<!--clear all elements from a list-->
</action>
</actionCategory>
<actionCategory NAME="Insert">
<action NAME="AcINSERTPOINT" ID="110" />
<action NAME="AcINSERTLINE" ID="111" />
</actionCategory>
<actionCategory NAME="AriadneActions">
<action NAME="AC_SET_NEXT_BUTTON_VISIBLE" ID="5550001" />
<action NAME="AC_SET_NEXT_BUTTON_INVISIBLE" ID="5550002" />
<action NAME="AC_SET_PREVIOUS_BUTTON_VISIBLE" ID="5550003" />
<action NAME="AC_SET_PREVIOUS_BUTTON_INVISIBLE" ID="5550004" />
<action NAME="AC_SET_ASSISTAND_WIDGET_STECK" ID="5550005" />
<action NAME="AC_SETMAX_COUNT_REF_POINTS" ID="5550006" />
<action NAME="AC_SET_NEXT_BUTTON_TEXT" ID="5550007" />
<action NAME="AC_CHECK_LANDMARK_COUNT" ID="5550008" />
<action NAME="AC_SET_DONE_FALSE" ID="5550009" />
<action NAME="AC_INIT" ID="55500010" />
<action NAME="AC_SET_APPLICATION_SELECTED_FALSE" ID="55500011" />
<action NAME="AC_SENSOR_ATTACHED" ID="55500012" />
<action NAME="AC_CLOSE_ASSISTENT" ID="55500013" />
<action NAME="AC_START_APPLICATION_TEXT" ID="55500014" />
<action NAME="AC_START_NAVIGATION" ID="55500015" />
<action NAME="AC_START_PATHCOLLECTION" ID="55500016" />
<action NAME="AC_LOAD_LANDMARKS" ID="55500017" />
<action NAME="AC_CALCULATE_LANDMARK_TRANSFORM" ID="55500018" />
</actionCategory>
<actionCategory NAME="Misc">
<action NAME="AcTERMINATE_INTERACTION" ID="666" />
<action NAME="AcTRANSLATESTART" ID="1000" />
<action NAME="AcTRANSLATE" ID="1001" />
<action NAME="AcSCALESTART" ID="1002" />
<action NAME="AcSCALE" ID="1003" />
<action NAME="AcROTATESTART" ID="1004" />
<action NAME="AcROTATE" ID="1005" />
<action NAME="AcINITAFFINEINTERACTIONS" ID="1006" />
<action NAME="AcFINISHAFFINEINTERACTIONS" ID="1007" />
<action NAME="AcTRANSLATEEND" ID="1008" />
<action NAME="AcSCALEEND" ID="1009" />
<action NAME="AcROTATEEND" ID="1010" />
<action NAME="AcINITZOOM" ID="1011" />
<action NAME="AcZOOM" ID="1012" />
<action NAME="AcSETSTARTPOINT" ID="1050" />
<action NAME="AcMODEDESELECT" ID="1100">
<!--set interactor in not selected mode-->
</action>
<action NAME="AcMODESELECT" ID="1101">
<!--set interactor in selected mode-->
</action>
<action NAME="AcMODESUBSELECT" ID="1102">
<!--set interacor in sub selected mode-->
</action>
<action NAME="AcINFORMLISTENERS" ID="1200">
<!--GlobalInteraction-->
</action>
<action NAME="AcASKINTERACTORS" ID="1201">
<!--GlobalInteraction-->
</action>
<action NAME="AcCHECKGREATERONE" ID="1500" />
<action NAME="AcCHECKBOUNDINGBOX" ID="1510" />
<action NAME="AcFORCESUBINTERACTORS" ID="1550" />
<action NAME="AcSENDCOORDINATES" ID="1600" />
<action NAME="AcTRANSMITEVENT" ID="2000">
<!--to transmit an event to a lower Interactor/Statemachine-->
</action>
<action NAME="AcPERIPHERYSEARCH" ID="3000">
<!--used in VesselGraphInteractor-->
</action>
<action NAME="AcROOTSEARCH" ID="3001">
<!--used in VesselGraphInteractor-->
</action>
<action NAME="AcTHICKSTVESSELSEARCH" ID="3002">
<!--used in VesselGraphInteractor-->
</action>
<action NAME="AcSHORTESTPATHSEARCH" ID="3003">
<!--used in VesselGraphInteractor-->
</action>
<action NAME="AcSINGLE" ID="3004">
<!--used in VesselGraphInteractor-->
</action>
<action NAME="AcATTRIBUTATION" ID="3005">
<!--used in VesselGraphInteractor-->
</action>
<action NAME="AcDEFAULT" ID="3007">
<!--used in VesselGraphInteractor-->
</action>
<action NAME="AcSETVESSELELEMENT" ID="3008">
<!--used in VesselGraphInteractor-->
</action>
<action NAME="AcCHECKBARRIERSTATUS" ID="3010">
<!--used in VesselGraphInteractor-->
</action>
<action NAME="AcUPDATEMESH" ID="1234">
<!--For Shape Model Interaction-->
</action>
<action NAME="AcINCREASE" ID="49012" />
<action NAME="AcDECREASE" ID="49013" />
<action NAME="AcMODIFY" ID="49014" />
<action NAME="AcUNDOUPDATE" ID="1236">
<!--For restoring a mesh after an update-->
</action>
<action NAME="AcONTDMOUSEINPUT" ID="4002" />
<action NAME="AcWHEEL" ID="105" />
<action NAME="AcPLUS" ID="106">
<!---->
</action>
<action NAME="AcMINUS" ID="107">
<!---->
</action>
</actionCategory>
<actionCategory NAME="SegmentationInteractor">
<action NAME="AcENTEROBJECT" ID="48000" />
<action NAME="AcLEAVEOBJECT" ID="48001" />
<action NAME="AcSWITCHOBJECT" ID="48002" />
<action NAME="AcUPDATELINE" ID="48003" />
<action NAME="AcINITLINE" ID="48004" />
<action NAME="AcTERMINATELINE" ID="48005" />
<action NAME="AcCREATEBOX" ID="48006" />
<action NAME="AcCREATEOBJECTFROMLINE" ID="48007" />
<action NAME="AcCANCEL" ID="48008" />
<action NAME="AcACTIVATETOOL" ID="48009" />
<action NAME="AcROTATEAROUNDPOINT1" ID="49002" />
<action NAME="AcROTATEAROUNDPOINT2" ID="49003" />
<action NAME="AcMOVEPOINT1" ID="49004" />
<action NAME="AcMOVEPOINT2" ID="49005" />
<action NAME="AcUPDATEPOINT" ID="49006" />
<action NAME="AcDISPLAYOPTIONS" ID="49009" />
<action NAME="AcCYCLE" ID="49010" />
<action NAME="AcACCEPT" ID="49011" />
</actionCategory>
</actions>
</mitkInteraktionEvents>
diff --git a/CoreUI/Qmitk/QmitkPropertiesTableModel.cpp b/CoreUI/Qmitk/QmitkPropertiesTableModel.cpp
index a33c149dcf..0dd3a84a0a 100644
--- a/CoreUI/Qmitk/QmitkPropertiesTableModel.cpp
+++ b/CoreUI/Qmitk/QmitkPropertiesTableModel.cpp
@@ -1,582 +1,544 @@
/*=========================================================================
Program: Medical Imaging & Interaction Toolkit
Language: C++
Date: $Date$
Version: $Revision: 18127 $
Copyright (c) German Cancer Research Center, Division of Medical and
Biological Informatics. All rights reserved.
See MITKCopyright.txt or http://www.mitk.org/copyright.html for details.
This software is distributed WITHOUT ANY WARRANTY; without even
the implied warranty of MERCHANTABILITY or FITNESS FOR A PARTICULAR
PURPOSE. See the above copyright notices for more information.
=========================================================================*/
#include "QmitkPropertiesTableModel.h"
//# Own includes
#include "mitkStringProperty.h"
#include "mitkColorProperty.h"
#include "mitkProperties.h"
#include "mitkEnumerationProperty.h"
#include "mitkRenderingManager.h"
#include "QmitkCustomVariants.h"
//# Toolkit includes
#include <itkCommand.h>
#include <QColor>
#include <QBrush>
#include <QStringList>
//# PUBLIC CTORS,DTOR
QmitkPropertiesTableModel::QmitkPropertiesTableModel(QObject* parent, mitk::PropertyList::Pointer _PropertyList)
: QAbstractTableModel(parent)
, m_PropertyList(0)
, m_BlockEvents(false)
, m_SortDescending(false)
, m_FilterKeyWord("")
{
this->SetPropertyList(_PropertyList);
}
QmitkPropertiesTableModel::~QmitkPropertiesTableModel()
{
// remove all event listeners by setting the property list to 0
this->SetPropertyList(0);
}
//# PUBLIC GETTER
mitk::PropertyList::Pointer QmitkPropertiesTableModel::GetPropertyList() const
{
return m_PropertyList.GetPointer();
}
Qt::ItemFlags QmitkPropertiesTableModel::flags(const QModelIndex& index) const
{
// no editing so far, return default (enabled, selectable)
Qt::ItemFlags flags = QAbstractItemModel::flags(index);
if (index.column() == PROPERTY_VALUE_COLUMN)
{
// there are also read only property items -> do not allow editing them
if(index.data(Qt::EditRole).isValid())
flags |= Qt::ItemIsEditable;
if(index.data(Qt::CheckStateRole).isValid())
flags |= Qt::ItemIsUserCheckable;
}
- if (index.column() == PROPERTY_ACTIVE_COLUMN)
- {
- flags |= Qt::ItemIsUserCheckable;
- }
-
return flags;
}
QVariant QmitkPropertiesTableModel::headerData(int section, Qt::Orientation orientation, int role) const
{
if (role != Qt::DisplayRole)
return QVariant();
if (orientation == Qt::Horizontal) {
switch (section)
{
case PROPERTY_NAME_COLUMN:
return tr("Name");
case PROPERTY_VALUE_COLUMN:
return tr("Value");
- case PROPERTY_ACTIVE_COLUMN:
- return tr("Active");
-
default:
return QVariant();
}
}
return QVariant();
}
QVariant QmitkPropertiesTableModel::data(const QModelIndex& index, int role) const
{
// empty data by default
QVariant data;
if(!index.isValid() || m_SelectedProperties.empty() || index.row() > (int)(m_SelectedProperties.size()-1))
return data;
// the properties name
if(index.column() == PROPERTY_NAME_COLUMN)
{
if(role == Qt::DisplayRole)
data = QString::fromStdString(m_SelectedProperties[index.row()].first);
}
// the real properties value
else if(index.column() == PROPERTY_VALUE_COLUMN)
{
- mitk::BaseProperty* baseProp = m_SelectedProperties[index.row()].second.first;
+ mitk::BaseProperty* baseProp = m_SelectedProperties[index.row()].second;
if (const mitk::ColorProperty* colorProp
= dynamic_cast<const mitk::ColorProperty*>(baseProp))
{
mitk::Color col = colorProp->GetColor();
QColor qcol((int)(col.GetRed() * 255), (int)(col.GetGreen() * 255),(int)( col.GetBlue() * 255));
if(role == Qt::DisplayRole)
data.setValue<QColor>(qcol);
else if(role == Qt::EditRole)
data.setValue<QColor>(qcol);
}
else if(mitk::BoolProperty* boolProp = dynamic_cast<mitk::BoolProperty*>(baseProp))
{
if(role == Qt::CheckStateRole)
data = boolProp->GetValue() ? Qt::Checked : Qt::Unchecked;
}
else if (mitk::StringProperty* stringProp = dynamic_cast<mitk::StringProperty*>(baseProp))
{
if(role == Qt::DisplayRole)
data.setValue<QString>(QString::fromStdString(stringProp->GetValue()));
else if(role == Qt::EditRole)
data.setValue<QString>(QString::fromStdString(stringProp->GetValue()));
}
else if (mitk::IntProperty* intProp = dynamic_cast<mitk::IntProperty*>(baseProp))
{
if(role == Qt::DisplayRole)
data.setValue<int>(intProp->GetValue());
else if(role == Qt::EditRole)
data.setValue<int>(intProp->GetValue());
}
else if (mitk::FloatProperty* floatProp = dynamic_cast<mitk::FloatProperty*>(baseProp))
{
if(role == Qt::DisplayRole)
data.setValue<float>(floatProp->GetValue());
else if(role == Qt::EditRole)
data.setValue<float>(floatProp->GetValue());
}
else if (mitk::EnumerationProperty* enumerationProp = dynamic_cast<mitk::EnumerationProperty*>(baseProp))
{
if(role == Qt::DisplayRole)
data.setValue<QString>(QString::fromStdString(baseProp->GetValueAsString()));
else if(role == Qt::EditRole)
{
QStringList values;
for(mitk::EnumerationProperty::EnumConstIterator it=enumerationProp->Begin(); it!=enumerationProp->End()
; it++)
{
values << QString::fromStdString(it->second);
}
data.setValue<QStringList>(values);
}
}
else
{
if(role == Qt::DisplayRole)
- data.setValue<QString>(QString::fromStdString(m_SelectedProperties[index.row()].second.first->GetValueAsString()));
+ data.setValue<QString>(QString::fromStdString(m_SelectedProperties[index.row()].second->GetValueAsString()));
}
}
- // enabled/disabled value
- else if(index.column() == PROPERTY_ACTIVE_COLUMN)
- {
- if (role == Qt::CheckStateRole)
- data = (m_SelectedProperties[index.row()].second.second) ? Qt::Checked : Qt::Unchecked;
- }
-
return data;
}
int QmitkPropertiesTableModel::rowCount(const QModelIndex& /*parent*/) const
{
// return the number of properties in the properties list.
return m_SelectedProperties.size();
}
int QmitkPropertiesTableModel::columnCount(const QModelIndex & /*parent*/)const
{
- return 3;
+ return 2;
}
//# PUBLIC SETTER
void QmitkPropertiesTableModel::SetPropertyList( mitk::PropertyList* _PropertyList )
{
// if propertylist really changed
if(m_PropertyList.GetPointer() != _PropertyList)
{
// Remove delete listener if there was a propertylist before
if(m_PropertyList.IsNotNull())
{
m_PropertyList.ObjectDelete.RemoveListener
(mitk::MessageDelegate1<QmitkPropertiesTableModel
, const itk::Object*>( this, &QmitkPropertiesTableModel::PropertyListDelete ));
}
// set new list
m_PropertyList = _PropertyList;
if(m_PropertyList.IsNotNull())
{
m_PropertyList.ObjectDelete.AddListener
(mitk::MessageDelegate1<QmitkPropertiesTableModel
, const itk::Object*>( this, &QmitkPropertiesTableModel::PropertyListDelete ));
}
this->Reset();
}
}
void QmitkPropertiesTableModel::PropertyListDelete( const itk::Object * /*_PropertyList*/ )
{
if(!m_BlockEvents)
{
m_BlockEvents = true;
this->Reset();
m_BlockEvents = false;
}
}
void QmitkPropertiesTableModel::PropertyModified( const itk::Object *caller, const itk::EventObject & /*event*/ )
{
if(!m_BlockEvents)
{
m_BlockEvents = true;
int row = this->FindProperty(dynamic_cast<const mitk::BaseProperty*>(caller));
QModelIndex indexOfChangedProperty = index(row, 1);
emit dataChanged(indexOfChangedProperty, indexOfChangedProperty);
m_BlockEvents = false;
}
}
void QmitkPropertiesTableModel::PropertyDelete( const itk::Object *caller, const itk::EventObject & /*event*/ )
{
if(!m_BlockEvents)
{
m_BlockEvents = true;
int row = this->FindProperty(dynamic_cast<const mitk::BaseProperty*>(caller));
if(row >= 0)
this->Reset();
m_BlockEvents = false;
}
}
bool QmitkPropertiesTableModel::setData(const QModelIndex &index, const QVariant &value, int role)
{
if (index.isValid() && !m_SelectedProperties.empty() && index.row() < (int)(m_SelectedProperties.size())
&& (role == Qt::EditRole || Qt::CheckStateRole))
{
// block all events now!
m_BlockEvents = true;
// the properties name
if(index.column() == PROPERTY_VALUE_COLUMN)
{
- mitk::BaseProperty* baseProp = m_SelectedProperties[index.row()].second.first;
+ mitk::BaseProperty* baseProp = m_SelectedProperties[index.row()].second;
if (mitk::ColorProperty* colorProp
= dynamic_cast<mitk::ColorProperty*>(baseProp))
{
QColor qcolor = value.value<QColor>();
if(!qcolor.isValid())
return false;
mitk::Color col = colorProp->GetColor();
col.SetRed(qcolor.red() / 255.0);
col.SetGreen(qcolor.green() / 255.0);
col.SetBlue(qcolor.blue() / 255.0);
colorProp->SetColor(col);
m_PropertyList->InvokeEvent(itk::ModifiedEvent());
m_PropertyList->Modified();
mitk::RenderingManager::GetInstance()->RequestUpdateAll();
}
else if(mitk::BoolProperty* boolProp = dynamic_cast<mitk::BoolProperty*>(baseProp))
{
boolProp->SetValue(value.toInt() == Qt::Checked ? true : false);
m_PropertyList->InvokeEvent(itk::ModifiedEvent());
m_PropertyList->Modified();
mitk::RenderingManager::GetInstance()->RequestUpdateAll();
}
else if (mitk::StringProperty* stringProp = dynamic_cast<mitk::StringProperty*>(baseProp))
{
stringProp->SetValue((value.value<QString>()).toStdString());
m_PropertyList->InvokeEvent(itk::ModifiedEvent());
m_PropertyList->Modified();
mitk::RenderingManager::GetInstance()->RequestUpdateAll();
}
else if (mitk::IntProperty* intProp = dynamic_cast<mitk::IntProperty*>(baseProp))
{
int intValue = value.value<int>();
if (intValue != intProp->GetValue())
{
intProp->SetValue(intValue);
m_PropertyList->InvokeEvent(itk::ModifiedEvent());
m_PropertyList->Modified();
mitk::RenderingManager::GetInstance()->RequestUpdateAll();
}
}
else if (mitk::FloatProperty* floatProp = dynamic_cast<mitk::FloatProperty*>(baseProp))
{
float floatValue = value.value<float>();
if (floatValue != floatProp->GetValue())
{
floatProp->SetValue(floatValue);
m_PropertyList->InvokeEvent(itk::ModifiedEvent());
m_PropertyList->Modified();
mitk::RenderingManager::GetInstance()->RequestUpdateAll();
}
}
else if (mitk::EnumerationProperty* enumerationProp = dynamic_cast<mitk::EnumerationProperty*>(baseProp))
{
std::string activatedItem = value.value<QString>().toStdString();
if ( activatedItem != enumerationProp->GetValueAsString() )
{
if ( enumerationProp->IsValidEnumerationValue( activatedItem ) )
{
enumerationProp->SetValue( activatedItem );
m_PropertyList->InvokeEvent( itk::ModifiedEvent() );
m_PropertyList->Modified();
mitk::RenderingManager::GetInstance()->RequestUpdateAll();
}
}
}
}
- // enabled/disabled value
- else if(index.column() == PROPERTY_ACTIVE_COLUMN)
- {
- bool active = value.toInt() == Qt::Checked;
- std::string propertyName = m_SelectedProperties[index.row()].first;
-
- m_PropertyList->SetEnabled(propertyName, active);
- m_SelectedProperties[index.row()].second.second = active;
-
- mitk::RenderingManager::GetInstance()->RequestUpdateAll();
- }
-
// property was changed by us, now we can accept property changes triggered by someone else
m_BlockEvents = false;
emit dataChanged(index, index);
return true;
}
return false;
}
void QmitkPropertiesTableModel::sort( int column, Qt::SortOrder order /*= Qt::AscendingOrder */ )
{
bool sortDescending = (order == Qt::DescendingOrder) ? true: false;
// do not sort twice !!! (dont know why, but qt calls this func twice. STUPID!)
if(sortDescending != m_SortDescending)
{
m_SortDescending = sortDescending;
PropertyDataSetCompareFunction::CompareCriteria _CompareCriteria
= PropertyDataSetCompareFunction::CompareByName;
PropertyDataSetCompareFunction::CompareOperator _CompareOperator
= m_SortDescending ? PropertyDataSetCompareFunction::Greater: PropertyDataSetCompareFunction::Less;
if(column == PROPERTY_VALUE_COLUMN)
_CompareCriteria = PropertyDataSetCompareFunction::CompareByValue;
- else if(column == PROPERTY_ACTIVE_COLUMN)
- _CompareCriteria = PropertyDataSetCompareFunction::CompareByActivity;
-
-
PropertyDataSetCompareFunction compareFunc(_CompareCriteria, _CompareOperator);
std::sort(m_SelectedProperties.begin(), m_SelectedProperties.end(), compareFunc);
QAbstractTableModel::reset();
}
}
//# PROTECTED GETTER
int QmitkPropertiesTableModel::FindProperty( const mitk::BaseProperty* _Property ) const
{
int row = -1;
if(_Property)
{
// search for property that changed and emit datachanged on the corresponding ModelIndex
std::vector<PropertyDataSet >::const_iterator propertyIterator;
for( propertyIterator=m_SelectedProperties.begin(); propertyIterator!=m_SelectedProperties.end()
; propertyIterator++)
{
- if(propertyIterator->second.first == _Property)
+ if(propertyIterator->second == _Property)
break;
}
if(propertyIterator != m_SelectedProperties.end())
row = std::distance(m_SelectedProperties.begin(), propertyIterator);
}
return row;
}
//# PROTECTED SETTER
void QmitkPropertiesTableModel::AddSelectedProperty( PropertyDataSet& _PropertyDataSet )
{
// subscribe for modified event
itk::MemberCommand<QmitkPropertiesTableModel>::Pointer _PropertyDataSetModifiedCommand =
itk::MemberCommand<QmitkPropertiesTableModel>::New();
_PropertyDataSetModifiedCommand->SetCallbackFunction(this, &QmitkPropertiesTableModel::PropertyModified);
- m_PropertyModifiedObserverTags.push_back(_PropertyDataSet.second.first->AddObserver(itk::ModifiedEvent(), _PropertyDataSetModifiedCommand));
+ m_PropertyModifiedObserverTags.push_back(_PropertyDataSet.second->AddObserver(itk::ModifiedEvent(), _PropertyDataSetModifiedCommand));
// subscribe for delete event
itk::MemberCommand<QmitkPropertiesTableModel>::Pointer _PropertyDataSetDeleteCommand =
itk::MemberCommand<QmitkPropertiesTableModel>::New();
_PropertyDataSetDeleteCommand->SetCallbackFunction(this, &QmitkPropertiesTableModel::PropertyDelete);
- m_PropertyDeleteObserverTags.push_back(_PropertyDataSet.second.first->AddObserver(itk::DeleteEvent(), _PropertyDataSetDeleteCommand));
+ m_PropertyDeleteObserverTags.push_back(_PropertyDataSet.second->AddObserver(itk::DeleteEvent(), _PropertyDataSetDeleteCommand));
// add to the selection
m_SelectedProperties.push_back(_PropertyDataSet);
}
void QmitkPropertiesTableModel::RemoveSelectedProperty( unsigned int _Index )
{
PropertyDataSet& _PropertyDataSet = m_SelectedProperties.at(_Index);
// remove modified event listener
- _PropertyDataSet.second.first->RemoveObserver(m_PropertyModifiedObserverTags[_Index]);
+ _PropertyDataSet.second->RemoveObserver(m_PropertyModifiedObserverTags[_Index]);
m_PropertyModifiedObserverTags.erase(m_PropertyModifiedObserverTags.begin()+_Index);
// remove delete event listener
- _PropertyDataSet.second.first->RemoveObserver(m_PropertyDeleteObserverTags[_Index]);
+ _PropertyDataSet.second->RemoveObserver(m_PropertyDeleteObserverTags[_Index]);
m_PropertyDeleteObserverTags.erase(m_PropertyDeleteObserverTags.begin()+_Index);
// remove from selection
m_SelectedProperties.erase(m_SelectedProperties.begin()+_Index);
}
void QmitkPropertiesTableModel::Reset()
{
// remove all selected properties
while(!m_SelectedProperties.empty())
{
this->RemoveSelectedProperty(m_SelectedProperties.size()-1);
}
std::vector<PropertyDataSet> allPredicates;
if(m_PropertyList.IsNotNull())
{
// first of all: collect all properties from the list
for(mitk::PropertyList::PropertyMap::const_iterator it=m_PropertyList->GetMap()->begin()
; it!=m_PropertyList->GetMap()->end()
; it++)
{
- allPredicates.push_back(*it);
+ allPredicates.push_back(*it); //% TODO
}
}
// make a subselection if a keyword is specified
if(!m_FilterKeyWord.empty())
{
std::vector<PropertyDataSet> subSelection;
for(std::vector<PropertyDataSet>::iterator it=allPredicates.begin()
; it!=allPredicates.end()
; it++)
{
// add this to the selection if it is matched by the keyword
if((*it).first.find(m_FilterKeyWord) != std::string::npos)
subSelection.push_back((*it));
}
allPredicates.clear();
allPredicates = subSelection;
}
PropertyDataSet tmpPropertyDataSet;
// add all selected now to the Model
for(std::vector<PropertyDataSet>::iterator it=allPredicates.begin()
; it!=allPredicates.end()
; it++)
{
tmpPropertyDataSet = *it;
this->AddSelectedProperty(tmpPropertyDataSet);
}
// sort the list as indicated by m_SortDescending
this->sort(m_SortDescending);
// model was resetted
QAbstractTableModel::reset();
}
void QmitkPropertiesTableModel::SetFilterPropertiesKeyWord( std::string _FilterKeyWord )
{
m_FilterKeyWord = _FilterKeyWord;
this->Reset();
}
QmitkPropertiesTableModel::PropertyDataSetCompareFunction::PropertyDataSetCompareFunction( CompareCriteria _CompareCriteria
, CompareOperator _CompareOperator )
: m_CompareCriteria(_CompareCriteria)
, m_CompareOperator(_CompareOperator)
{
}
bool QmitkPropertiesTableModel::PropertyDataSetCompareFunction::operator()
( const PropertyDataSet& _Left
, const PropertyDataSet& _Right ) const
{
switch(m_CompareCriteria)
{
case CompareByValue:
if(m_CompareOperator == Less)
- return (_Left.second.first->GetValueAsString() < _Right.second.first->GetValueAsString());
- else
- return (_Left.second.first->GetValueAsString() > _Right.second.first->GetValueAsString());
- break;
-
- case CompareByActivity:
- if(m_CompareOperator == Less)
- return (_Left.second.second < _Right.second.second);
+ return (_Left.second->GetValueAsString() < _Right.second->GetValueAsString());
else
- return (_Left.second.second > _Right.second.second);
+ return (_Left.second->GetValueAsString() > _Right.second->GetValueAsString());
break;
// CompareByName:
default:
if(m_CompareOperator == Less)
return (_Left.first < _Right.first);
else
return (_Left.first > _Right.first);
break;
}
}
QmitkPropertiesTableModel::PropertyListElementFilterFunction::PropertyListElementFilterFunction( const std::string& _FilterKeyWord )
: m_FilterKeyWord(_FilterKeyWord)
{
}
bool QmitkPropertiesTableModel::PropertyListElementFilterFunction::operator()( const PropertyDataSet& _Elem ) const
{
if(m_FilterKeyWord.empty())
return true;
return (_Elem.first.find(m_FilterKeyWord) == 0);
}
diff --git a/CoreUI/Qmitk/QmitkPropertiesTableModel.h b/CoreUI/Qmitk/QmitkPropertiesTableModel.h
index f8d5e67ecc..8a21c120b8 100644
--- a/CoreUI/Qmitk/QmitkPropertiesTableModel.h
+++ b/CoreUI/Qmitk/QmitkPropertiesTableModel.h
@@ -1,253 +1,251 @@
/*=========================================================================
Program: MITK
Language: C++
Date: $Date$
Version: $Revision: 14921 $
Copyright (c) German Cancer Research Center, Division of Medical and
Biological Informatics. All rights reserved.
See MITKCopyright.txt or http://www.mitk.org/copyright.html for details.
This software is distributed WITHOUT ANY WARRANTY; without even
the implied warranty of MERCHANTABILITY or FITNESS FOR A PARTICULAR
PURPOSE. See the above copyright notices for more information.
=========================================================================*/
/// Header guard.
#ifndef QmitkPropertiesTableModel_h
#define QmitkPropertiesTableModel_h
//# Own includes
#include "mitkDataNode.h"
#include "mitkWeakPointer.h"
//# Toolkit includes
#include <QAbstractTableModel>
#include <vector>
#include <string>
//# Forward declarations
///
/// \class QmitkPropertiesTableModel
/// \brief A table model for showing and editing mitk::Properties.
///
/// \see QmitkPropertyDelegate
///
class QMITK_EXPORT QmitkPropertiesTableModel : public QAbstractTableModel
{
//# PUBLIC CTORS,DTOR,TYPEDEFS,CONSTANTS
public:
static const int PROPERTY_NAME_COLUMN = 0;
static const int PROPERTY_VALUE_COLUMN = 1;
- static const int PROPERTY_ACTIVE_COLUMN = 2;
///
/// Typedef for the complete Property Datastructure, which may be written as follows:
- /// Name->(mitk::BaseProperty::Pointer->ActiveFlag)
+ /// Name->(mitk::BaseProperty::Pointer)
///
- typedef std::pair<std::string,std::pair<mitk::BaseProperty::Pointer,bool> > PropertyDataSet;
+ typedef std::pair<std::string, mitk::BaseProperty::Pointer> PropertyDataSet;
///
/// Constructs a new QmitkDataStorageTableModel
/// and sets the DataNode for this TableModel.
QmitkPropertiesTableModel(QObject* parent = 0, mitk::PropertyList::Pointer _PropertyList=0);
///
/// Standard dtor. Nothing to do here.
virtual ~QmitkPropertiesTableModel();
//# PUBLIC GETTER
public:
///
/// Returns the property list of this table model.
///
mitk::PropertyList::Pointer GetPropertyList() const;
///
/// Overwritten from QAbstractTableModel. Returns the flags what can be done with the items (view, edit, ...)
Qt::ItemFlags flags(const QModelIndex& index) const;
///
/// Overwritten from QAbstractTableModel. Returns the flags what can be done with the items (view, edit, ...)
QVariant headerData(int section, Qt::Orientation orientation, int role = Qt::DisplayRole) const;
///
/// Overwritten from QAbstractTableModel. Returns the flags what can be done with the items (view, edit, ...)
QVariant data(const QModelIndex& index, int role = Qt::DisplayRole) const;
///
/// Overwritten from QAbstractTableModel. Returns the flags what can be done with the items (view, edit, ...)
int rowCount(const QModelIndex& parent = QModelIndex()) const;
///
/// Overwritten from QAbstractTableModel. Returns the number of columns. That is usually two in this model:
/// the properties name and its value.
int columnCount(const QModelIndex &parent) const;
//# PUBLIC SETTER
public:
///
/// Sets the Property List to show. Resets the whole model. If _PropertyList is NULL the model is empty.
///
void SetPropertyList(mitk::PropertyList* _PropertyList);
///
/// \brief Gets called when the list is about to be deleted.
///
virtual void PropertyListDelete(const itk::Object *_PropertyList);
///
/// \brief Called when a single property was changed. Send a model changed event to the Qt-outer world.
///
virtual void PropertyModified(const itk::Object *caller, const itk::EventObject &event);
///
/// \brief Called when a single property was changed. Send a model changed event to the Qt-outer world.
///
virtual void PropertyDelete(const itk::Object *caller, const itk::EventObject &event);
///
/// \brief Set a keyword for filtering of properties. Only properties beginning with this string will be shown
///
virtual void SetFilterPropertiesKeyWord(std::string _FilterKeyWord);
///
/// Overridden from QAbstractTableModel. Sets data at index for given role.
///
bool setData(const QModelIndex &index, const QVariant &value,
int role);
///
/// \brief Reimplemented sort function from QAbstractTableModel to enable sorting on the table.
///
void sort ( int column, Qt::SortOrder order = Qt::AscendingOrder );
//#PROTECTED INNER CLASSES
protected:
///
/// \struct PropertyDataSetCompareFunction
/// \brief A struct that inherits from std::binary_function. You can use it in std::sort algorithm for sorting the property list elements.
///
struct PropertyDataSetCompareFunction
: public std::binary_function<PropertyDataSet, PropertyDataSet, bool>
{
///
/// \brief Specifies field of the property with which it will be sorted.
///
enum CompareCriteria {
CompareByName = 0,
- CompareByValue,
- CompareByActivity
+ CompareByValue
};
///
/// \brief Specifies Ascending/descending ordering.
///
enum CompareOperator {
Less = 0,
Greater
};
///
/// \brief Creates a PropertyDataSetCompareFunction. A CompareCriteria and a CompareOperator must be given.
///
PropertyDataSetCompareFunction(CompareCriteria _CompareCriteria = CompareByName, CompareOperator _CompareOperator = Less);
///
/// \brief The reimplemented compare function.
///
bool operator()(const PropertyDataSet& _Left
, const PropertyDataSet& _Right) const;
protected:
CompareCriteria m_CompareCriteria;
CompareOperator m_CompareOperator;
};
///
/// An unary function for selecting Properties in a vector by a key word.
///
struct PropertyListElementFilterFunction
: public std::unary_function<PropertyDataSet, bool>
{
PropertyListElementFilterFunction(const std::string& m_FilterKeyWord);
///
/// \brief The reimplemented compare function.
///
bool operator()(const PropertyDataSet& _Elem) const;
protected:
std::string m_FilterKeyWord;
};
//# PROTECTED GETTER
protected:
///
/// \brief Searches for the specified property and returns the row of the element in this QTableModel.
/// If any errors occur, the function returns -1.
///
int FindProperty(const mitk::BaseProperty* _Property) const;
//# PROTECTED SETTER
protected:
///
/// Adds a property dataset to the current selection.
/// When a property is added a modified and delete listener
/// is appended.
///
void AddSelectedProperty(PropertyDataSet& _PropertyDataSet);
///
/// Removes a property dataset from the current selection.
/// When a property is removed the modified and delete listener
/// are also removed.
///
void RemoveSelectedProperty(unsigned int _Index);
///
/// Reset is called when a new filter keyword is set or a new
/// PropertyList is set. First of all, all priorly selected
/// properties are removed. Then all properties to be
/// selected (specified by the keyword) are added to the selection.
///
void Reset();
//# PROTECTED MEMBERS
protected:
///
/// Holds the pointer to the properties list. Dont use smart pointers here. Instead: Listen
/// to the delete event.
mitk::WeakPointer<mitk::PropertyList> m_PropertyList;
///
/// Store the properties in a vector so that they may be sorted
std::vector<PropertyDataSet > m_SelectedProperties;
///
/// \brief Holds all tags of Modified Event Listeners. We need it to remove them again.
///
std::vector<unsigned long> m_PropertyModifiedObserverTags;
///
/// \brief Holds all tags of Modified Event Listeners. We need it to remove them again.
///
std::vector<unsigned long> m_PropertyDeleteObserverTags;
///
/// \brief Indicates if this class should neglect all incoming events because
/// the class itself triggered the event (e.g. when a property was edited).
///
bool m_BlockEvents;
///
/// \brief The property is true when the property list is sorted in descending order.
///
bool m_SortDescending;
///
/// \brief If set to any value, only properties containing the specified keyword in their name will be shown.
///
std::string m_FilterKeyWord;
};
#endif /* QMITKPROPERTIESTABLEMODEL_H_ */
diff --git a/CoreUI/Qmitk/QmitkSliderLevelWindowWidget.cpp b/CoreUI/Qmitk/QmitkSliderLevelWindowWidget.cpp
index b4f2a8d3ed..a2cab5fdbc 100644
--- a/CoreUI/Qmitk/QmitkSliderLevelWindowWidget.cpp
+++ b/CoreUI/Qmitk/QmitkSliderLevelWindowWidget.cpp
@@ -1,525 +1,531 @@
/*=========================================================================
Program: Medical Imaging & Interaction Toolkit
Language: C++
Date: $Date$
Version: $Revision$
Copyright (c) German Cancer Research Center, Division of Medical and
Biological Informatics. All rights reserved.
See MITKCopyright.txt or http://www.mitk.org/copyright.html for details.
This software is distributed WITHOUT ANY WARRANTY; without even
the implied warranty of MERCHANTABILITY or FITNESS FOR A PARTICULAR
PURPOSE. See the above copyright notices for more information.
=========================================================================*/
#include <QmitkSliderLevelWindowWidget.h>
#include <QCursor>
#include <QPainter>
#include <QToolTip>
#include <QMouseEvent>
#include <itkCommand.h>
#include <QmitkLevelWindowWidgetContextMenu.h>
#include <mitkRenderingManager.h>
+#include <math.h>
+
/**
* Constructor
*/
QmitkSliderLevelWindowWidget::QmitkSliderLevelWindowWidget( QWidget * parent, Qt::WindowFlags f )
: QWidget( parent, f )
{
m_Manager = mitk::LevelWindowManager::New();
itk::ReceptorMemberCommand<QmitkSliderLevelWindowWidget>::Pointer command = itk::ReceptorMemberCommand<QmitkSliderLevelWindowWidget>::New();
command->SetCallbackFunction(this, &QmitkSliderLevelWindowWidget::OnPropertyModified);
m_ObserverTag = m_Manager->AddObserver(itk::ModifiedEvent(), command);
m_IsObserverTagSet = true;
setMouseTracking(true);
m_Resize = false;
m_Bottom = false;
m_CtrlPressed = false;
m_MouseDown = false;
m_Font.setPointSize( 6 );
m_MoveHeight = height() - 25;
m_ScaleVisible = true;
m_Contextmenu = new QmitkLevelWindowWidgetContextMenu(this); //, true);
//setBackgroundMode( Qt::NoBackground );
this->hide();
update();
}
QmitkSliderLevelWindowWidget::~QmitkSliderLevelWindowWidget()
{
if ( m_IsObserverTagSet)
{
m_Manager->RemoveObserver(m_ObserverTag);
m_IsObserverTagSet = false;
}
}
void QmitkSliderLevelWindowWidget::setLevelWindowManager(mitk::LevelWindowManager* levelWindowManager)
{
if ( m_IsObserverTagSet)
{
m_Manager->RemoveObserver(m_ObserverTag);
m_IsObserverTagSet = false;
}
m_Manager = levelWindowManager;
if ( m_Manager.IsNotNull() )
{
itk::ReceptorMemberCommand<QmitkSliderLevelWindowWidget>::Pointer command = itk::ReceptorMemberCommand<QmitkSliderLevelWindowWidget>::New();
command->SetCallbackFunction(this, &QmitkSliderLevelWindowWidget::OnPropertyModified);
m_ObserverTag = m_Manager->AddObserver(itk::ModifiedEvent(), command);
m_IsObserverTagSet = true;
}
}
void QmitkSliderLevelWindowWidget::OnPropertyModified(const itk::EventObject& )
{
try
{
m_LevelWindow = m_Manager->GetLevelWindow();
this->show();
update();
}
catch(...)
{
try
{
this->hide();
}
catch(...)
{
}
}
}
-void QmitkSliderLevelWindowWidget::paintEvent( QPaintEvent* itkNotUsed(e) )
+void QmitkSliderLevelWindowWidget::paintEvent( QPaintEvent* itkNotUsed(e) )
{
QPixmap pm(width(), height());
//pm.fill( static_cast<QWidget*>(parent())->paletteBackgroundColor() );
pm.fill(this, 0, 0);
QPainter painter(&pm);
painter.setFont( m_Font );
//painter.setPen(static_cast<QWidget*>(parent())->paletteForegroundColor());
painter.setPen(this->palette().color(this->foregroundRole()));
-
+
QColor c(93,144,169);
QColor cl = c.light();
QColor cd = c.dark();
painter.setBrush(c);
painter.drawRect(m_Rect);
float mr = m_LevelWindow.GetRange();
if ( mr < 1 )
mr = 1;
-
+
float fact = (float) m_MoveHeight / mr;
//begin draw scale
if (m_ScaleVisible)
{
int minRange = (int)m_LevelWindow.GetRangeMin();
int maxRange = (int)m_LevelWindow.GetRangeMax();
int yValue = m_MoveHeight + (int)(minRange*fact);
QString s = " 0";
if (minRange <= 0 && maxRange >= 0)
{
painter.drawLine( 5, yValue , 15, yValue);
painter.drawText( 21, yValue + 3, s );
}
int count = 1;
int k = 5;
bool enoughSpace = false;
bool enoughSpace2 = false;
- for(int i = m_MoveHeight + (int)(minRange*fact); i < m_MoveHeight;)
+ double dStepSize = pow(10,floor(log10(mr/100))+1);
+
+ for(int i = m_MoveHeight + (int)(minRange*fact); i < m_MoveHeight;)//negative
{
- if (-count*20 < minRange)
+ if (-count*dStepSize < minRange)
break;
- yValue = m_MoveHeight + (int)((minRange + count*20)*fact);
- s = QString::number(-count*20);
- if (count % k && ((20*fact) > 2.5))
+ yValue = m_MoveHeight + (int)((minRange + count*dStepSize)*fact);
+
+ s = QString::number(-count*dStepSize);
+ if (count % k && ((dStepSize*fact) > 2.5))
{
painter.drawLine( 8, yValue, 12, yValue);
enoughSpace = true;
}
else if (!(count % k))
{
- if ((k*20*fact) > 7)
+ if ((k*dStepSize*fact) > 7)
{
painter.drawLine( 5, yValue, 15, yValue);
painter.drawText( 21, yValue + 3, s );
enoughSpace2 = true;
}
else
{
k += 5;
}
}
if (enoughSpace)
{
i=yValue;
count++;
}
else if (enoughSpace2)
{
i=yValue;
count += k;
}
else
{
i=yValue;
count = k;
}
}
count = 1;
k = 5;
enoughSpace = false;
enoughSpace2 = false;
for(int i = m_MoveHeight + (int)(minRange*fact); i >= 0;)
{
- if (count*20 > maxRange)
+ if (count*dStepSize > maxRange)
break;
- yValue = m_MoveHeight + (int)((minRange - count*20)*fact);
- s = QString::number(count*20);
- if(count % k && ((20*fact) > 2.5))
+ yValue = m_MoveHeight + (int)((minRange - count*dStepSize)*fact);
+
+ s = QString::number(count*dStepSize);
+ if(count % k && ((dStepSize*fact) > 2.5))
{
- if (!(minRange > 0 && (count*20) < minRange))
+ if (!(minRange > 0 && (count*dStepSize) < minRange))
painter.drawLine( 8, yValue, 12, yValue);
enoughSpace = true;
}
else if (!(count % k))
{
- if ((k*20*fact) > 7)
+ if ((k*dStepSize*fact) > 7)
{
- if (!(minRange > 0 && (count*20) < minRange))
+ if (!(minRange > 0 && (count*dStepSize) < minRange))
{
painter.drawLine( 5, yValue, 15, yValue);
painter.drawText( 21, yValue + 3, s );
}
enoughSpace2 = true;
}
else
{
k += 5;
}
}
if (enoughSpace)
{
i=yValue;
count++;
}
else if (enoughSpace2)
{
i=yValue;
count += k;
}
else
{
i=yValue;
count = k;
}
}
}
//end draw scale
painter.setPen (cl);
painter.drawLine(m_Rect.topLeft(),m_Rect.topRight());
painter.drawLine(m_Rect.topLeft(),m_Rect.bottomLeft());
-
+
painter.setPen (cd);
painter.drawLine(m_Rect.topRight(),m_Rect.bottomRight());
painter.drawLine(m_Rect.bottomRight(),m_Rect.bottomLeft());
painter.end();
QPainter p (this);
p.drawPixmap(0, 0, pm);
}
/**
*
*/
void QmitkSliderLevelWindowWidget::mouseMoveEvent( QMouseEvent* mouseEvent )
{
if(!mouseEvent)
return;
if ( m_LevelWindow.IsFixed() )
return;
if (!m_MouseDown)
{
if ( mouseEvent->pos().y() >= 0
&& mouseEvent->pos().y() <= (m_Rect.topLeft().y() + 3) )
{
setCursor(Qt::SizeVerCursor);
m_UpperBound.setRect(m_Rect.topLeft().x(), m_Rect.topLeft().y() - 3, 17, 7);
QToolTip::showText(mouseEvent->globalPos(), "Ctrl + left click to change only upper bound", this, m_UpperBound);
m_Resize = true;
}
else if ( mouseEvent->pos().y() >= (m_Rect.bottomLeft().y() - 3) )
{
setCursor(Qt::SizeVerCursor);
m_LowerBound.setRect(m_Rect.bottomLeft().x(), m_Rect.bottomLeft().y() - 3, 17, 7);
QToolTip::showText(mouseEvent->globalPos(), "Ctrl + left click to change only lower bound", this, m_LowerBound);
m_Resize = true;
m_Bottom = true;
}
else
{
setCursor(Qt::ArrowCursor);
m_Resize = false;
m_Bottom = false;
}
}
else {
float fact = (float) m_MoveHeight / m_LevelWindow.GetRange();
if ( m_Leftbutton )
{
if (m_Resize && !m_CtrlPressed)
{
double diff = (mouseEvent->pos().y()) / fact;
diff -= (m_StartPos.y()) / fact;
m_StartPos = mouseEvent->pos();
if (diff == 0) return;
float value;
if (m_Bottom)
value = m_LevelWindow.GetWindow() + ( ( 2 * diff ) );
else
value = m_LevelWindow.GetWindow() - ( ( 2 * diff ) );
if ( value < 0 )
value = 0;
m_LevelWindow.SetLevelWindow( m_LevelWindow.GetLevel(), value );
}
else if(m_Resize && m_CtrlPressed)
{
if (!m_Bottom)
{
double diff = (mouseEvent->pos().y()) / fact;
diff -= (m_StartPos.y()) / fact;
m_StartPos = mouseEvent->pos();
if (diff == 0) return;
float value;
value = m_LevelWindow.GetWindow() - ( ( diff ) );
if ( value < 0 )
value = 0;
float oldWindow;
float oldLevel;
float newLevel;
oldWindow = m_LevelWindow.GetWindow();
oldLevel = m_LevelWindow.GetLevel();
newLevel = oldLevel + (value - oldWindow)/2;
if (!((newLevel + value/2) > m_LevelWindow.GetRangeMax()))
m_LevelWindow.SetLevelWindow( newLevel, value );
}
else
{
double diff = (mouseEvent->pos().y()) / fact;
diff -= (m_StartPos.y()) / fact;
m_StartPos = mouseEvent->pos();
if (diff == 0) return;
float value;
value = m_LevelWindow.GetWindow() + ( ( diff ) );
if ( value < 0 )
value = 0;
float oldWindow;
float oldLevel;
float newLevel;
oldWindow = m_LevelWindow.GetWindow();
oldLevel = m_LevelWindow.GetLevel();
newLevel = oldLevel - (value - oldWindow)/2;
if (!((newLevel - value/2) < m_LevelWindow.GetRangeMin()))
m_LevelWindow.SetLevelWindow( newLevel, value );
}
}
else
{
float maxv = m_LevelWindow.GetRangeMax();
float minv = m_LevelWindow.GetRangeMin();
float wh = m_LevelWindow.GetWindow() / 2;
float level = (m_MoveHeight - mouseEvent->pos().y()) / fact + minv;
double diff = (mouseEvent->pos().x()) / fact;
diff -= (m_StartPos.x()) / fact;
m_StartPos = mouseEvent->pos();
float window;
if (m_Bottom)
window = m_LevelWindow.GetWindow() + ( ( 2 * diff ) );
else
window = m_LevelWindow.GetWindow() - ( ( 2 * diff ) );
if ( window < 0 )
window = 0;
if ( level - wh < minv )
m_LevelWindow.SetLevelWindow( m_LevelWindow.GetRangeMin() + wh, m_LevelWindow.GetWindow() );
else if ( level + wh > maxv )
m_LevelWindow.SetLevelWindow( m_LevelWindow.GetRangeMax() - wh, m_LevelWindow.GetWindow() );
else
m_LevelWindow.SetLevelWindow( level, window );
}
m_Manager->SetLevelWindow(m_LevelWindow);
mitk::RenderingManager::GetInstance()->RequestUpdateAll();
}
}
}
void QmitkSliderLevelWindowWidget::enterEvent ( QEvent * /*event*/ )
{
/*
if(event->type() != QEvent::MouseMove)
return;*/
//mouseMoveEvent( static_cast< QMouseEvent* > ( event ) );
QPoint p = QCursor::pos();
p = this->mapFromGlobal(p);
QMouseEvent ev(QEvent::MouseMove, p, Qt::NoButton, Qt::NoButton , Qt::NoModifier );
this->mouseMoveEvent( &ev );
}
/**
*
*/
void QmitkSliderLevelWindowWidget::mousePressEvent( QMouseEvent* mouseEvent ) {
if ( m_LevelWindow.IsFixed() )
return;
m_MouseDown = true;
m_StartPos = mouseEvent->pos();
if ( mouseEvent->button() == Qt::LeftButton )
{
if (mouseEvent->modifiers() == Qt::ControlModifier || mouseEvent->modifiers() == Qt::ShiftModifier)
{
m_CtrlPressed = true;
}
else
{
m_CtrlPressed = false;
}
m_Leftbutton = true;
}
else
m_Leftbutton = false;
mouseMoveEvent( mouseEvent );
}
/**
*
*/
void QmitkSliderLevelWindowWidget::resizeEvent ( QResizeEvent * event ) {
m_MoveHeight = event->size().height() - 25;
update();
}
/**
*
*/
void QmitkSliderLevelWindowWidget::mouseReleaseEvent( QMouseEvent* )
{
if ( m_LevelWindow.IsFixed() )
return;
m_MouseDown = false;
}
/**
*
*/
void QmitkSliderLevelWindowWidget::update() {
int rectWidth;
if(m_ScaleVisible)
{
rectWidth = 17;
setMinimumSize ( QSize( 50, 50 ) );
setMaximumSize ( QSize( 50, 2000 ) );
setSizePolicy( QSizePolicy( QSizePolicy::Minimum, QSizePolicy::Expanding ) );
}
else
{
rectWidth = 26;
setMinimumSize ( QSize( 40, 50 ) );
setMaximumSize ( QSize( 50, 2000 ) );
setSizePolicy( QSizePolicy( QSizePolicy::Minimum, QSizePolicy::Expanding ) );
}
float mr = m_LevelWindow.GetRange();
if ( mr < 1 )
mr = 1;
float fact = (float) m_MoveHeight / mr;
float rectHeight = m_LevelWindow.GetWindow() * fact;
if ( rectHeight < 15 )
rectHeight = 15;
if ( m_LevelWindow.GetLowerWindowBound() < 0 )
m_Rect.setRect( 2, (int) (m_MoveHeight - (m_LevelWindow.GetUpperWindowBound() - m_LevelWindow.GetRangeMin()) * fact) , rectWidth, (int) rectHeight );
else
m_Rect.setRect( 2, (int) (m_MoveHeight - (m_LevelWindow.GetUpperWindowBound() - m_LevelWindow.GetRangeMin()) * fact), rectWidth, (int) rectHeight );
QWidget::repaint();
}
void QmitkSliderLevelWindowWidget::contextMenuEvent( QContextMenuEvent * )
{
m_Contextmenu->setLevelWindowManager(m_Manager.GetPointer());
QMenu *contextMenu = new QMenu( this );
Q_CHECK_PTR( contextMenu );
if (m_ScaleVisible)
contextMenu->addAction(tr("Hide Scale"), this, SLOT(hideScale()));
else
contextMenu->addAction(tr("Show Scale"), this, SLOT(showScale()));
contextMenu->addSeparator();
m_Contextmenu->getContextMenu(contextMenu);
}
void QmitkSliderLevelWindowWidget::hideScale()
{
m_ScaleVisible = false;
update();
}
void QmitkSliderLevelWindowWidget::showScale()
{
m_ScaleVisible = true;
update();
}
void QmitkSliderLevelWindowWidget::setDataStorage(mitk::DataStorage* ds)
{
m_Manager->SetDataStorage(ds);
}
mitk::LevelWindowManager* QmitkSliderLevelWindowWidget::GetManager()
{
return m_Manager.GetPointer();
}
diff --git a/Documentation/CMakeLists.txt b/Documentation/CMakeLists.txt
index 23a2b9d01a..04b1118b6d 100644
--- a/Documentation/CMakeLists.txt
+++ b/Documentation/CMakeLists.txt
@@ -1,158 +1,158 @@
#
# Variables:
# MITK_DOXYGEN_OUTPUT_DIR: doxygen output directory (optional)
FIND_PACKAGE(Doxygen)
IF(DOXYGEN_FOUND)
OPTION(USE_DOT "Use dot program for generating graphical class diagrams with doxygen, if available" ON)
OPTION(MITK_DOXYGEN_BUILD_ALWAYS "Always build the MITK documentation when building the default target" OFF)
OPTION(MITK_DOXYGEN_GENERATE_QCH_FILES "Use doxygen to generate Qt compressed help files for MITK docs" OFF)
MARK_AS_ADVANCED(USE_DOT MITK_DOXYGEN_BUILD_ALWAYS MITK_DOXYGEN_GENERATE_QCH_FILES)
SET(HAVE_DOT "NO")
IF(DOXYGEN_DOT_EXECUTABLE AND USE_DOT)
SET(HAVE_DOT "YES")
ENDIF()
SET(MITK_DOXYGEN_OUTPUT_DIR ${PROJECT_BINARY_DIR}/Documentation/Doxygen CACHE PATH "Output directory for doxygen generated documentation." )
SET(MITK_DOXYGEN_TAGFILE_NAME ${MITK_DOXYGEN_OUTPUT_DIR}/MITK.tag CACHE INTERNAL "MITK Doxygen tag file")
# Create QCH files for MITK and external projects
SET(MITK_DOXYGEN_GENERATE_QHP "NO")
IF(MITK_DOXYGEN_GENERATE_QCH_FILES)
FIND_PROGRAM(QT_HELPGENERATOR_EXECUTABLE
NAMES qhelpgenerator qhelpgenerator-qt4 qhelpgenerator4
PATHS ${QT_BINARY_DIR}
DOC "The location of the the Qt help generator executable"
NO_DEFAULT_PATH
)
MARK_AS_ADVANCED(QT_HELPGENERATOR_EXECUTABLE)
IF(NOT QT_HELPGENERATOR_EXECUTABLE)
MESSAGE(SEND_ERROR "The Qt help generator could not be found. Disabling qch generation")
ELSE()
SET(MITK_DOXYGEN_GENERATE_QHP "YES")
ENDIF()
# The name of the generated MITK qch file, relative to the
# Doxygen HTML output folder
- SET(MITK_DOXYGEN_QCH_FILE "../MITK-${MITK_WC_REVISION_HASH}.qch")
+ SET(MITK_DOXYGEN_QCH_FILE "../MITK-${MITK_REVISION_ID}.qch")
# Generating ITK and VTK docs it not done yet
#OPTION(MITK_DOXYGEN_GENERATE_VTK_QCH_FILE "Use doxygen to generate a Qt compressed help file for VTK docs" OFF)
#OPTION(MITK_DOXYGEN_GENERATE_ITK_QCH_FILE "Use doxygen to generate a Qt compressed help file for ITK docs" OFF)
#MARK_AS_ADVANCED(MITK_DOXYGEN_GENERATE_VTK_QCH_FILE MITK_DOXYGEN_GENERATE_ITK_QCH_FILE)
ENDIF()
IF(MITK_USE_BLUEBERRY)
FILE(RELATIVE_PATH _blueberry_doxygen_path ${MITK_DOXYGEN_OUTPUT_DIR}/html ${BLUEBERRY_DOXYGEN_OUTPUT_DIR}/html)
SET(BLUEBERRY_DOXYGEN_TAGFILE "${BLUEBERRY_DOXYGEN_TAGFILE_NAME}=${_blueberry_doxygen_path}")
SET(BLUEBERRY_DOXYGEN_LINK "<a class=\"el\" href=\"${_blueberry_doxygen_path}/index.html\">BlueBerry Documentation</a>")
SET(MITK_XP_LINK "\\ref mitkExtPointsIndex")
CONFIGURE_FILE(schema.css ${MITK_DOXYGEN_OUTPUT_DIR}/html/schema.css)
SET(MITK_DOXYGEN_ENABLED_SECTIONS "${MITK_DOXYGEN_ENABLED_SECTIONS} BLUEBERRY")
ENDIF(MITK_USE_BLUEBERRY)
# Compile a doxygen input filter for processing CMake scripts
INCLUDE(mitkFunctionCMakeDoxygenFilterCompile)
mitkFunctionCMakeDoxygenFilterCompile(NAMESPACE "CMake")
# Configure some doxygen options
IF(NOT MITK_DOXYGEN_GENERATE_TODOLIST)
SET(MITK_DOXYGEN_GENERATE_TODOLIST "NO")
ENDIF()
IF(NOT MITK_DOXYGEN_GENERATE_BUGLIST)
SET(MITK_DOXYGEN_GENERATE_BUGLIST "NO")
ENDIF()
IF(NOT MITK_DOXYGEN_HTML_DYNAMIC_SECTIONS)
SET(MITK_DOXYGEN_HTML_DYNAMIC_SECTIONS "NO")
ENDIF()
IF(NOT MITK_DOXYGEN_UML_LOOK)
SET(MITK_DOXYGEN_UML_LOOK "NO")
ENDIF()
IF(NOT MITK_DOXYGEN_GENERATE_DEPRECATEDLIST)
SET(MITK_DOXYGEN_GENERATE_DEPRECATEDLIST "YES")
ENDIF()
IF(NOT DEFINED MITK_DOXYGEN_DOT_NUM_THREADS)
SET(MITK_DOXYGEN_DOT_NUM_THREADS 0)
ENDIF()
CONFIGURE_FILE(Doxygen/MainPage.dox.in
${CMAKE_CURRENT_BINARY_DIR}/Doxygen/MainPage.dox)
CONFIGURE_FILE(doxygen.conf.in
${CMAKE_CURRENT_BINARY_DIR}/doxygen.conf)
IF(MITK_DOXYGEN_BUILD_ALWAYS)
SET(_doc_in_all "ALL")
ELSE()
SET(_doc_in_all "")
ENDIF()
ADD_CUSTOM_TARGET(doc ${_doc_in_all}
${DOXYGEN}
${CMAKE_CURRENT_BINARY_DIR}/doxygen.conf
)
IF (MITK_USE_BLUEBERRY)
# convert the extension points schema files into html
FIND_PACKAGE(Ant)
IF(ANT_FOUND AND BLUEBERRY_DOC_TOOLS_DIR)
LIST(APPEND MITK_XP_GLOB_EXPRESSIONS
${MITK_SOURCE_DIR}/CoreUI/Bundles/plugin.xml
${MITK_SOURCE_DIR}/Modules/Bundles/plugin.xml)
FILE(GLOB_RECURSE _plugin_xmls ${MITK_XP_GLOB_EXPRESSIONS})
MACRO_CONVERT_SCHEMA(INPUT ${_plugin_xmls}
OUTPUT_DIR "${MITK_DOXYGEN_OUTPUT_DIR}/html/extension-points/html"
TARGET_NAME mitkXPDoc
)
ADD_DEPENDENCIES(doc mitkXPDoc)
IF(${PROJECT_NAME} STREQUAL "MITK")
ADD_DEPENDENCIES(doc BlueBerryDoc)
ENDIF()
ENDIF(ANT_FOUND AND BLUEBERRY_DOC_TOOLS_DIR)
ENDIF (MITK_USE_BLUEBERRY)
#IF(MITK_DOXYGEN_GENERATE_ITK_QCH_FILE)
# # add the command to generate the ITK documantation
# ADD_CUSTOM_TARGET(doc-itk
# COMMAND ${DOXYGEN} ${CMAKE_CURRENT_BINARY_DIR}/doxygen.itk.conf)
# ADD_DEPENDENCIES(doc doc-itk)
#ENDIF()
#IF(MITK_DOXYGEN_GENERATE_VTK_QCH_FILE)
# # add the command to generate the VTK documantation
# ADD_CUSTOM_TARGET(doc-vtk
# COMMAND ${DOXYGEN} ${CMAKE_CURRENT_BINARY_DIR}/doxygen.vtk.conf)
# ADD_DEPENDENCIES(doc doc-vtk)
#ENDIF()
ELSE(DOXYGEN_FOUND)
# copy blank documentation page to prevent QtHelp from being shown
# copy the .qhc and .qch files to $MITK_BIN/mitk/bin/ExtBundles/resources/
CONFIGURE_FILE(pregenerated/MITKBlankPage.qch
${MITK_BINARY_DIR}/bin/ExtBundles/org.mitk.gui.qt.extapplication/resources/MITKBlankPage.qch
COPYONLY)
CONFIGURE_FILE(pregenerated/MitkExtQtHelpCollection.qhc
${MITK_BINARY_DIR}/bin/ExtBundles/org.mitk.gui.qt.extapplication/resources/MitkExtQtHelpCollection.qhc
COPYONLY)
ENDIF(DOXYGEN_FOUND)
diff --git a/Documentation/Doxygen/Modules/ModuleAdaptors.dox b/Documentation/Doxygen/Modules/ModuleAdaptors.dox
index 9cfb28d368..b720121389 100644
--- a/Documentation/Doxygen/Modules/ModuleAdaptors.dox
+++ b/Documentation/Doxygen/Modules/ModuleAdaptors.dox
@@ -1,102 +1,142 @@
namespace mitk
{
/**
\defgroup Adaptor Adaptor Classes
\ingroup ProcessAdaptor
\brief This subcategory includes adaptor classes for the integration of algorithms from
other toolkits, especially ITK.
-The task of most of the classes in this category is to deal with the conversion between the (templated) itk::Image and the (not-templated) mitk::Image.
+The task of most of the classes in this category is to deal with the conversion between
+the (templated) itk::Image and the (not-templated) mitk::Image.
Methods for conversion are provided for both directions:
\li \ref MitkToItk
\li \ref ItkToMitk
Care has to be taken regarding the involved coordinate systems, see \ref ItkToMitkCoordinateSystems.
For limitations on ITK-type conversion see the section \ref Limitations.
-VTK-based access to MITK images is straightforward: simply ask your mitk::Image for a \a vtkImageData by calling Image:GetVtkImageData.
-Similarily, to get a \a vtkPolyData from the MITK class for storing surfaces, mitk::Surface, call Surface::GetVtkPolyData.
+VTK-based access to MITK images is straightforward: simply ask your mitk::Image for a
+\a vtkImageData by calling Image:GetVtkImageData. Similarily, to get a \a vtkPolyData
+from the MITK class for storing surfaces, mitk::Surface, call Surface::GetVtkPolyData.
\section MitkToItk MITK to ITK adaptors
-Pixel type and dimension of MITK images can be specified at run time whereas ITK images are templated over the pixel type and the dimension, thus in ITK both need to be specified at compile time.
+Pixel type and dimension of MITK images can be specified at run time whereas ITK images
+are templated over the pixel type and the dimension, thus in ITK both need to be specified
+at compile time.
There two different situations, which are covered in the following sub-sections:
-\li Either you know the pixel type/dimension the ITK image should have at compile time for some reason (e.g., you always create MITK images of a specific pixel type/dimension)
-\li or the pixel type/dimension of an MITK image is really unkown and the ITK image should have the same (unkown) type.
+\li Either you know the pixel type/dimension the ITK image should have at compile time for
+ some reason (e.g., you always create MITK images of a specific pixel type/dimension)
+\li or the pixel type/dimension of an MITK image is really unkown and the ITK image should
+ have the same (unkown) type.
\subsection MitkToFixedItk Converting MITK images to ITK images with known type
If you know the type (pixel type and dimension) of the MITK image you have two options:
-\li mitk::ImageToItk<TOutputImage>: is a process class that takes an mitk::Image as input and produces an itk::Image of the given type \a TOutputImage as output (to be access using \a GetOutput()). In case the MITK image does not have the same type as \a TOutputImage an exception will be thrown.
-\li mitk::CastToItkImage: this function has two parameters, the mitk::Image (input) and a smartpointer to an itk::Image (output, does not need to be initialized). In case the MITK image does not have the same type as the ITK image it will be casted (if possible; done via itk::CastImageFilter).
-
-Thus, mitk::CastToItkImage is the more powerful variant: here it is sufficient that you know what you want to have (the ITK data type), to which the MITK image will be casted, if needed.
+\li mitk::ImageToItk<TOutputImage>: is a process class that takes an mitk::Image as input
+ and produces an itk::Image of the given type \a TOutputImage as output (to be accessed
+ using \a GetOutput()). In case the MITK image does not have the same type as
+ \a TOutputImage an exception will be thrown.
+\li mitk::CastToItkImage: this function has two parameters, the mitk::Image (input) and a
+ smartpointer to an itk::Image (output, does not need to be initialized). In case the
+ MITK image does not have the same type as the ITK image it will be casted
+ (if possible; done via itk::CastImageFilter).
+
+Thus, mitk::CastToItkImage is the more powerful variant: here it is sufficient that you know
+what you want to have (the ITK data type), to which the MITK image will be casted, if needed.
\subsection MitkToUnkownItk Accessing an MITK image as an ITK image (type unkown)
-If you do not know the pixel type/dimension of an MITK image in advance and the ITK image should have the same (unkown) type, e.g., to run a filter on the MITK image data, we cannot really convert to one ITK image. This is simply, because we cannot instantiate an itk::Image object with unkown pixel type/dimension.
+If you do not know the pixel type/dimension of an MITK image in advance and the ITK image should
+have the same (unkown) type, e.g., to run a filter on the MITK image data, we cannot really convert
+to one ITK image. This is simply, because we cannot instantiate an itk::Image object with unkown
+pixel type/dimension.
Nevertheless, MITK provides a way to access an MITK image as if it was an ITK image of unkown type.
To do so, first define an access method, which is templated as an ITK image is:
\code
-template<TPixel, VImageDimension>
+template<typename TPixel, unsigned int VImageDimension>
MyAccessMethod(itk::Image<TPixel, VImageDimension>* itkImage)
{
...
}
\endcode
-If you don't understand this template syntax, we need to refer you to an C++ text book. Understanding template syntax is crucial to successfully using ITK.
+If you don't understand this template syntax, we need to refer you to an C++ text book. Understanding
+template syntax is crucial to successfully using ITK.
-To call this templated method with an (untemplated) mitk::Image, you can use the AccessByItk macro (or one of its variants) from mitkImageAccessByItk.h. This macro checks for
-the actual image type of the mitk::Image and does any neccessary conversions. This works for all typical pixel types and for dimension 2 and 3.
+To call this templated method with an (untemplated) mitk::Image, you can use the #AccessByItk macro
+(or one of its variants) from mitkImageAccessByItk.h. This macro checks for the actual image type of
+the mitk::Image and does any neccessary conversions. This works for all configured pixel types (default
+is char, unsigned char, short, unsigned short, int, unsigned int, float, and double) and dimensions
+(default is 2 and 3). You can change the considered default pixel types and dimensions by modifying
+the CMake variables MITK_ACCESSBYITK_*.
\code
AccessByItk(mitkImage, MyAccessMethod)
\endcode
An example is given in \ref Step6Page.
-The AccessBy... macros create quite a lot of code: the user defined access method has to be compiled for all typical pixel types \em times the two supported dimensions (2 and 3). Therefore, depending on the complexity of the access method, some compilers may run into problems with memory.
-One workaround is to use explicit instantiation and distribute it on multiple files. The macros InstantiateAccessFunction... are for this purpose.
-An example is again given in \ref Step6Page.
-Another workaround is to reduce the created code by fixing either the type (AccessFixedTypeByItk) or dimension (AccessFixedDimensionByItk).
+The AccessBy... macros create quite a lot of code: the user defined access method has to be compiled for
+all considered pixel types \em times the supported dimensions (default is 2 and 3). Therefore, depending
+on the complexity of the access method, some compilers may run into problems with memory.
+One workaround is to use explicit instantiation and distribute it on multiple files. The macro
+#InstantiateAccessFunction and its variants are for this purpose. An example is again given in \ref Step6Page.
+Another workaround is to reduce the created code by fixing either the type (#AccessFixedTypeByItk) or
+dimension (#AccessFixedDimensionByItk).
-There are variants for additional parameters for AccessByItk... and InstantiateAccessFunction..., e.g., AccessFixedTypeByItk_2 allows to pass two additional parameters to the access-function.
+There is one variant of AccessByItk... for passing additional parameters
+to the access-function, called #AccessFixedTypeByItk_n.
\link mitkImage.h \endlink
\link mitkImageCast.h \endlink
\link mitkImageToItk.h \endlink
\link mitkITKImageImport.h \endlink
\section ItkToMitk ITK to MITK adaptors
Converting ITK images to MITK is easier than the other way round. Basically, you have three options:
-\li mitk::ITKImageImport<TInputImage>: is a process class that takes an itk::Image of the given type \a TOutputImage as input and produces an mitk::Image as output (to be access using \a GetOutput()). The image data contained in the itk::Image is referenced, not copied.
-\li mitk::ImportItkImage: this function takes the itk::Image as input and returns an mitk::Image. Internally, it uses the class just described. So again, the image data contained in the itk::Image is referenced, not copied.
-\li mitk::CastToMitkImage: this function has two parameters, the itk::Image (input) and a smartpointer to an mitk::Image (output, does not need to be initialized). In contrast to the other described methods, this functions copies the image data!
+\li mitk::ITKImageImport<TInputImage>: is a process class that takes an itk::Image of the given type
+ \a TOutputImage as input and produces an mitk::Image as output (to be accessed using \a GetOutput()).
+ The image data contained in the itk::Image is referenced, not copied.
+\li mitk::ImportItkImage: this function takes the itk::Image as input and returns an mitk::Image. Internally,
+ it uses the class just described. So again, the image data contained in the itk::Image is referenced, not
+ copied.
+\li mitk::CastToMitkImage: this function has two parameters, the itk::Image (input) and a smartpointer to an
+ mitk::Image (output, does not need to be initialized). In contrast to the other described methods,
+ this function copies the image data!
\section ItkToMitkCoordinateSystems ITK image vs MITK coordinate systems
-Converting coordinates from the ITK physical coordinate system (which does not support rotated images) to the MITK world coordinate system should be performed via the Geometry3D of the Image, see mitk::Geometry3D::WorldToItkPhysicalPoint.
+Converting coordinates from the ITK physical coordinate system (which does not support rotated images) to the
+MITK world coordinate system should be performed via the Geometry3D of the Image,
+see mitk::Geometry3D::WorldToItkPhysicalPoint.
\section Limitations Limitations
-The \ref MitkToItk for unspecified types have to do type multiplexing at compile time. This is done for a limited number of pixel types (\a char, \a short, \a int, \a long, \a double, \a float, and the \a unsigned variants of the integer data types) and for dimensions 2 and 3.
+The \ref MitkToItk for unspecified types have to do type multiplexing at compile time. This is done for a
+limited number of pixel types and dimensions, defined during the CMake configuration process.
-Especially, color image types are not multiplexed. This is because many algorithms do not support color images (e.g. with data type itk::RGBPixel) because they do not have a scalar data type. If your algorithm do support color and you want to multiplex over all scalar as well as the color data type, try the following:
+Especially, color image types are not multiplexed. This is because many algorithms do not support color images
+(e.g. with data type itk::RGBPixel) because they do not have a scalar data type. If your algorithm do support
+color and you want to multiplex over all scalar as well as the color data type, try the following:
\code
- if (myMitkImageThatMaybeColor->GetPixelType()==typeid(itk::RGBPixel<unsigned char>))
- {
- AccessFixedPixelTypeByItk(myMitkImageThatMaybeColor, myAlgorithmFunction, itk::RGBPixel<unsigned char>);
- }
- else
- {
- AccessByItk(myMitkImageThatMaybeColor, myAlgorithmFunction);
- }
+try
+{
+ AccessFixedPixelTypeByItk(myMitkImageThatMaybeColor, // The MITK image which may be a color image
+ myAlgorithmFunction, // The template method being able to handle color
+ MITK_ACCESSBYITK_PIXEL_TYPES_SEQ // The default pixel type sequence
+ (itk::RGBPixel<unsigned char>) // The additional type sequence
+ )
+}
+catch(const mitk::AccessByItkException& e)
+{
+ // add error handling here
+}
\endcode
*/
-}
\ No newline at end of file
+}
diff --git a/Documentation/Doxygen/NewPlugin.dox b/Documentation/Doxygen/NewPlugin.dox
index be78bbb056..8ccb986694 100755
--- a/Documentation/Doxygen/NewPlugin.dox
+++ b/Documentation/Doxygen/NewPlugin.dox
@@ -1,102 +1,107 @@
/**
\page NewPluginPage How to create a new MITK Plug-in
+\attention The procedure described here will generate legacy BlueBerry bundles. MITK switched to using the
+CTK plugin framework and hence it is recommended to create CTK plug-ins instead of BlueBerry bundles. Until
+there is similar generator for CTK-based MITK projects available, please read
+<a href="http://www.mitk.org/wiki/SetupAMitkBasedProject">Set-up a MITK-based Project</a>.
+
\section CmakePluginGen CMake-based plug-in generator
The BundleGenerator is a tool to simplify the process of creating your own MITK project (optional) and plug-ins.
\par Introduction
This how-to will show you how to create a new MITK project together with a new plug-in. You will not need to touch
either the MITK source tree or any MITK binary tree. MITK will be used in the sense of a Software Development Kit (SDK),
providing only header files and binaries (shared objects).
\par Limitations
The CMake based generator will generate only very few classes for you. It can generate an Activator class and a View class for GUI contributions.
Nevertheless, you are advised to use it because it generates the correct plug-in directory structure. In the future, there will be a more
sophisticated generator available.
\par Prerequisites
We will use MITK as a SDK, which we have to set up first. Since there is no SDK package available
yet which you could download and install, we have to follow the steps in
<a href="http://www.mitk.org/wiki/SetupMitkQt4BlueBerry">SetupMitkQt4BlueBerry</a>.
This will set up a binary MITK tree which we can be used later on to link our plug-ins to.
\par
After you have build MITK, you have to think about a name and an id for your new plug-in and/or
your new project. The generator uses the CMake GUI for configuration.
\par Windows
\li Start the CMake GUI
\li Choose \c \<MITK-SRC-DIR\>/Build/Tools/BundleGenerator as source directory
\li Choose a directory for the source code of your project and/or plug-in (create it if it doesn't exist)
\li Press "Configure" and don't care about the generator
\li Follow the steps for "All"
\par Linux
\li Create a directory for the source code of your project and/or plug-in and cd into it.
\li Start <tt>ccmake</tt> with <tt>\<MITK-SRC-DIR\>/Build/Tools/BundleGenerator</tt> as source directory
\li Press "Configure"
\par All
\image html BundleGenerator1.png
\n
\li CUSTOM_PROJECT_NAME (optional): The name of your new project. If empty, only the source code for your plug-in is generated.
MBI members should not supply a value.
\li GUI_SUPPORT: you usually want to contribute to the UI, so leave this ON
\li PLUGIN_ID: Enter an id for the new plug-in. It must be a unique identifier, so the following form is recommended: \c my.domain.identifier.
MBI members should use an id similar to \c org.mitk.gui.qt.isosurface.
\li PLUGIN_NAME: The name of your plug-in in human-readable form. For example: MITK IsoSurface Plug-in
\li PLUGIN_TEMPLATE: Leave this as it is, unless you really know what you are doing.
\li Press "Configure" again and you will get the following screen:
\n
\n
\image html BundleGenerator2.png
\n
\li ACTIVATOR_CLASS (optional): The name of a class (without namespaces) which can be used to react to lifecycle events of your plug-in. See berry::IBundleActivator .
\li CUSTOM_PROJECT_EXECUTABLE (optional/required): If you supplied a CUSTOM_PROJECT_NAME, this variable will hold the name of your executable which will start an BlueBerry Workbench.
\li PLUGIN_VENDOR: The person or institution from which this plug-in comes from. Change to your needs.
\li PLUGIN_VERSION: The version number of your plug-in. This will be used by the platform for managing plug-in dependencies.
\li REQUIRED_PLUGINS: The ids of plug-ins your plug-in directly depends on. Usually you won't need to change something.
\li VIEW_BASE_CLASS: The class from which your new view inherits from. Usually not changed.
\li VIEW_BASE_CLASS_H: The header file for the base class of your new view. Usually not changed.
\li VIEW_CLASS: The name of your new view (i.e. functionality) class.
\li VIEW_ID: A unique id for your new view. Again, it is recommended to use something like my.domain.views.id.
MBI members should use an id similar to \c org.mitk.views.isosurface
\li VIEW_NAME: The name of your view in human-readable form. This name will be shown in the UI of your application.
\li Press "Configure" again, which will give the following screen:
\n
\n
\image html BundleGenerator3.png
\n
If everything looks okay, press "Generate" and CMake will create a directory named Generated/\<CUSTOM_PROJECT_NAME\> (if you set a value for it) or
a directory named Generated/\<PLUGIN_ID\>. You can move or rename the \<CUSTOM_PROJECT_NAME\> directory (or the \<PLUGIN_ID\> directory if you did not create a project)
somewhere else if you want to get rid of the parent directories.
\par Integrating your new plug-in
If you supplied a CUSTOM_PROJECT_NAME value, create a new directory outside of the \<CUSTOM_PROJECT_NAME\> directory for your project's
binary tree. Start CMake again and use \<CUSTOM_PROJECT_NAME\> as source directory and your newly created directory as binary directory.
Go through the configuration and generation process again (you will have to set the variable MITK_DIR to your MITK binary directory)
and you will get project files for your chosen environment. On Windows, use
the supplied \b startVS2008.bat file in your binary tree to start Visual Studio (this will correctly set your path environment variable).
\par
If you did not want to create a new project (because you already have one), copy your new plug-in from the temporary directory
in your project's source tree. (Hint for MBI members: put it in \c \<MITK-SRC-DIR\>/Modules/Bundles or \c \<MITK-MBI-SRC-DIR\>/mbi-sb/Bundles !)
Switch back to the CMake configuration of your custom project (MBI: MITK). On Windows you can just switch the "Where to build the binaries" combobox back
to your projects (MBI: MITKs) binary directory. After pressing "Configure" a new build option for your plug-in should appear.
\section BuildSystem Build system for plug-ins
Just put new files in your plug-in's \c src or \c src/internal directory and edit the \c files.cmake file there.
If you have any fancy stuff like external libraries and include directories you should have a look at the CMake manual and general MITK build system documentation.
\section Troubleshooting Troubleshooting
\par I get "Could not find library" messages and similar stuff when I try to start my project's executable.
This is mostly due to wrong environment settings. On Windows, make sure that you use the supplied batch files to start
Visual Studio or your project's executable. If you still get errors, double check the value of the PATH variable in
your batch files (it must contain MITK's binary directory and paths to the ITK, VTK and Qt libraries.
\par
On Linux, set your LD_LIBRARY_PATH variable accordingly.
*/
diff --git a/Documentation/doxygen.conf.in b/Documentation/doxygen.conf.in
index 1b49ff1295..f71d59beaa 100644
--- a/Documentation/doxygen.conf.in
+++ b/Documentation/doxygen.conf.in
@@ -1,1739 +1,1764 @@
-# Doxyfile 1.7.2
+# Doxyfile 1.7.3
# This file describes the settings to be used by the documentation system
# doxygen (www.doxygen.org) for a project.
#
# All text after a hash (#) is considered a comment and will be ignored.
# The format is:
# TAG = value [value, ...]
# For lists items can also be appended using:
# TAG += value [value, ...]
# Values that contain spaces should be placed between quotes (" ").
#---------------------------------------------------------------------------
# Project related configuration options
#---------------------------------------------------------------------------
# This tag specifies the encoding used for all characters in the config file
# that follow. The default is UTF-8 which is also the encoding used for all
# text before the first occurrence of this tag. Doxygen uses libiconv (or the
# iconv built into libc) for the transcoding. See
# http://www.gnu.org/software/libiconv for the list of possible encodings.
DOXYFILE_ENCODING = UTF-8
# The PROJECT_NAME tag is a single word (or a sequence of words surrounded
# by quotes) that should identify the project.
-PROJECT_NAME = mitk
+PROJECT_NAME = MITK
# The PROJECT_NUMBER tag can be used to enter a project or revision number.
# This could be handy for archiving the generated documentation or
# if some version control system is used.
PROJECT_NUMBER = @MITK_VERSION_STRING@
+# Using the PROJECT_BRIEF tag one can provide an optional one line description
+# for a project that appears at the top of each page and should give viewer a
+# quick idea about the purpose of the project. Keep the description short.
+
+PROJECT_BRIEF = "Medical Imaging Interaction Toolkit"
+
+# With the PROJECT_LOGO tag one can specify an logo or icon that is
+# included in the documentation. The maximum height of the logo should not
+# exceed 55 pixels and the maximum width should not exceed 200 pixels.
+# Doxygen will copy the logo to the output directory.
+
+PROJECT_LOGO =
+
# The OUTPUT_DIRECTORY tag is used to specify the (relative or absolute)
# base path where the generated documentation will be put.
# If a relative path is entered, it will be relative to the location
# where doxygen was started. If left blank the current directory will be used.
OUTPUT_DIRECTORY = @MITK_DOXYGEN_OUTPUT_DIR@
# If the CREATE_SUBDIRS tag is set to YES, then doxygen will create
# 4096 sub-directories (in 2 levels) under the output directory of each output
# format and will distribute the generated files over these directories.
# Enabling this option can be useful when feeding doxygen a huge amount of
# source files, where putting all generated files in the same directory would
# otherwise cause performance problems for the file system.
CREATE_SUBDIRS = NO
# The OUTPUT_LANGUAGE tag is used to specify the language in which all
# documentation generated by doxygen is written. Doxygen will use this
# information to generate all constant output in the proper language.
# The default language is English, other supported languages are:
# Afrikaans, Arabic, Brazilian, Catalan, Chinese, Chinese-Traditional,
# Croatian, Czech, Danish, Dutch, Esperanto, Farsi, Finnish, French, German,
# Greek, Hungarian, Italian, Japanese, Japanese-en (Japanese with English
# messages), Korean, Korean-en, Lithuanian, Norwegian, Macedonian, Persian,
-# Polish, Portuguese, Romanian, Russian, Serbian, Serbian-Cyrilic, Slovak,
+# Polish, Portuguese, Romanian, Russian, Serbian, Serbian-Cyrillic, Slovak,
# Slovene, Spanish, Swedish, Ukrainian, and Vietnamese.
OUTPUT_LANGUAGE = English
# If the BRIEF_MEMBER_DESC tag is set to YES (the default) Doxygen will
# include brief member descriptions after the members that are listed in
# the file and class documentation (similar to JavaDoc).
# Set to NO to disable this.
BRIEF_MEMBER_DESC = YES
# If the REPEAT_BRIEF tag is set to YES (the default) Doxygen will prepend
# the brief description of a member or function before the detailed description.
# Note: if both HIDE_UNDOC_MEMBERS and BRIEF_MEMBER_DESC are set to NO, the
# brief descriptions will be completely suppressed.
REPEAT_BRIEF = YES
# This tag implements a quasi-intelligent brief description abbreviator
# that is used to form the text in various listings. Each string
# in this list, if found as the leading text of the brief description, will be
# stripped from the text and the result after processing the whole list, is
# used as the annotated text. Otherwise, the brief description is used as-is.
# If left blank, the following values are used ("$name" is automatically
# replaced with the name of the entity): "The $name class" "The $name widget"
# "The $name file" "is" "provides" "specifies" "contains"
# "represents" "a" "an" "the"
ABBREVIATE_BRIEF =
# If the ALWAYS_DETAILED_SEC and REPEAT_BRIEF tags are both set to YES then
# Doxygen will generate a detailed section even if there is only a brief
# description.
ALWAYS_DETAILED_SEC = NO
# If the INLINE_INHERITED_MEMB tag is set to YES, doxygen will show all
# inherited members of a class in the documentation of that class as if those
# members were ordinary class members. Constructors, destructors and assignment
# operators of the base classes will not be shown.
INLINE_INHERITED_MEMB = NO
# If the FULL_PATH_NAMES tag is set to YES then Doxygen will prepend the full
# path before files name in the file list and in the header files. If set
# to NO the shortest path that makes the file name unique will be used.
FULL_PATH_NAMES = NO
# If the FULL_PATH_NAMES tag is set to YES then the STRIP_FROM_PATH tag
# can be used to strip a user-defined part of the path. Stripping is
# only done if one of the specified strings matches the left-hand part of
# the path. The tag can be used to show relative paths in the file list.
# If left blank the directory from which doxygen is run is used as the
# path to strip.
STRIP_FROM_PATH =
# The STRIP_FROM_INC_PATH tag can be used to strip a user-defined part of
# the path mentioned in the documentation of a class, which tells
# the reader which header file to include in order to use a class.
# If left blank only the name of the header file containing the class
# definition is used. Otherwise one should specify the include paths that
# are normally passed to the compiler using the -I flag.
STRIP_FROM_INC_PATH =
# If the SHORT_NAMES tag is set to YES, doxygen will generate much shorter
# (but less readable) file names. This can be useful if your file system
# doesn't support long names like on DOS, Mac, or CD-ROM.
SHORT_NAMES = NO
# If the JAVADOC_AUTOBRIEF tag is set to YES then Doxygen
# will interpret the first line (until the first dot) of a JavaDoc-style
# comment as the brief description. If set to NO, the JavaDoc
# comments will behave just like regular Qt-style comments
# (thus requiring an explicit @brief command for a brief description.)
JAVADOC_AUTOBRIEF = NO
# If the QT_AUTOBRIEF tag is set to YES then Doxygen will
# interpret the first line (until the first dot) of a Qt-style
# comment as the brief description. If set to NO, the comments
# will behave just like regular Qt-style comments (thus requiring
# an explicit \brief command for a brief description.)
QT_AUTOBRIEF = NO
# The MULTILINE_CPP_IS_BRIEF tag can be set to YES to make Doxygen
# treat a multi-line C++ special comment block (i.e. a block of //! or ///
# comments) as a brief description. This used to be the default behaviour.
# The new default is to treat a multi-line C++ comment block as a detailed
# description. Set this tag to YES if you prefer the old behaviour instead.
MULTILINE_CPP_IS_BRIEF = NO
# If the INHERIT_DOCS tag is set to YES (the default) then an undocumented
# member inherits the documentation from any documented member that it
# re-implements.
INHERIT_DOCS = YES
# If the SEPARATE_MEMBER_PAGES tag is set to YES, then doxygen will produce
# a new page for each member. If set to NO, the documentation of a member will
# be part of the file/class/namespace that contains it.
SEPARATE_MEMBER_PAGES = NO
# The TAB_SIZE tag can be used to set the number of spaces in a tab.
# Doxygen uses this value to replace tabs by spaces in code fragments.
TAB_SIZE = 8
# This tag can be used to specify a number of aliases that acts
# as commands in the documentation. An alias has the form "name=value".
# For example adding "sideeffect=\par Side Effects:\n" will allow you to
# put the command \sideeffect (or @sideeffect) in the documentation, which
# will result in a user-defined paragraph with heading "Side Effects:".
# You can put \n's in the value part of an alias to insert newlines.
ALIASES = "FIXME=\par Fix Me's:\n" \
"BlueBerry=\if BLUEBERRY" \
"endBlueBerry=\endif" \
"bundlemainpage{1}=\page \1"
# Set the OPTIMIZE_OUTPUT_FOR_C tag to YES if your project consists of C
# sources only. Doxygen will then generate output that is more tailored for C.
# For instance, some of the names that are used will be different. The list
# of all members will be omitted, etc.
OPTIMIZE_OUTPUT_FOR_C = NO
# Set the OPTIMIZE_OUTPUT_JAVA tag to YES if your project consists of Java
# sources only. Doxygen will then generate output that is more tailored for
# Java. For instance, namespaces will be presented as packages, qualified
# scopes will look different, etc.
OPTIMIZE_OUTPUT_JAVA = NO
# Set the OPTIMIZE_FOR_FORTRAN tag to YES if your project consists of Fortran
# sources only. Doxygen will then generate output that is more tailored for
# Fortran.
OPTIMIZE_FOR_FORTRAN = NO
# Set the OPTIMIZE_OUTPUT_VHDL tag to YES if your project consists of VHDL
# sources. Doxygen will then generate output that is tailored for
# VHDL.
OPTIMIZE_OUTPUT_VHDL = NO
# Doxygen selects the parser to use depending on the extension of the files it
# parses. With this tag you can assign which parser to use for a given extension.
# Doxygen has a built-in mapping, but you can override or extend it using this
# tag. The format is ext=language, where ext is a file extension, and language
# is one of the parsers supported by doxygen: IDL, Java, Javascript, CSharp, C,
# C++, D, PHP, Objective-C, Python, Fortran, VHDL, C, C++. For instance to make
# doxygen treat .inc files as Fortran files (default is PHP), and .f files as C
# (default is Fortran), use: inc=Fortran f=C. Note that for custom extensions
# you also need to set FILE_PATTERNS otherwise the files are not read by doxygen.
EXTENSION_MAPPING =
# If you use STL classes (i.e. std::string, std::vector, etc.) but do not want
# to include (a tag file for) the STL sources as input, then you should
# set this tag to YES in order to let doxygen match functions declarations and
# definitions whose arguments contain STL classes (e.g. func(std::string); v.s.
# func(std::string) {}). This also makes the inheritance and collaboration
# diagrams that involve STL classes more complete and accurate.
-BUILTIN_STL_SUPPORT = NO
+BUILTIN_STL_SUPPORT = YES
# If you use Microsoft's C++/CLI language, you should set this option to YES to
# enable parsing support.
CPP_CLI_SUPPORT = NO
# Set the SIP_SUPPORT tag to YES if your project consists of sip sources only.
# Doxygen will parse them like normal C++ but will assume all classes use public
# instead of private inheritance when no explicit protection keyword is present.
SIP_SUPPORT = NO
# For Microsoft's IDL there are propget and propput attributes to indicate getter
# and setter methods for a property. Setting this option to YES (the default)
# will make doxygen replace the get and set methods by a property in the
# documentation. This will only work if the methods are indeed getting or
# setting a simple type. If this is not the case, or you want to show the
# methods anyway, you should set this option to NO.
IDL_PROPERTY_SUPPORT = YES
# If member grouping is used in the documentation and the DISTRIBUTE_GROUP_DOC
# tag is set to YES, then doxygen will reuse the documentation of the first
# member in the group (if any) for the other members of the group. By default
# all members of a group must be documented explicitly.
DISTRIBUTE_GROUP_DOC = NO
# Set the SUBGROUPING tag to YES (the default) to allow class member groups of
# the same type (for instance a group of public functions) to be put as a
# subgroup of that type (e.g. under the Public Functions section). Set it to
# NO to prevent subgrouping. Alternatively, this can be done per class using
# the \nosubgrouping command.
SUBGROUPING = YES
# When TYPEDEF_HIDES_STRUCT is enabled, a typedef of a struct, union, or enum
# is documented as struct, union, or enum with the name of the typedef. So
# typedef struct TypeS {} TypeT, will appear in the documentation as a struct
# with name TypeT. When disabled the typedef will appear as a member of a file,
# namespace, or class. And the struct will be named TypeS. This can typically
# be useful for C code in case the coding convention dictates that all compound
# types are typedef'ed and only the typedef is referenced, never the tag name.
TYPEDEF_HIDES_STRUCT = NO
# The SYMBOL_CACHE_SIZE determines the size of the internal cache use to
# determine which symbols to keep in memory and which to flush to disk.
# When the cache is full, less often used symbols will be written to disk.
# For small to medium size projects (<1000 input files) the default value is
# probably good enough. For larger projects a too small cache size can cause
# doxygen to be busy swapping symbols to and from disk most of the time
-# causing a significant performance penality.
+# causing a significant performance penalty.
# If the system has enough physical memory increasing the cache will improve the
# performance by keeping more symbols in memory. Note that the value works on
# a logarithmic scale so increasing the size by one will roughly double the
# memory usage. The cache size is given by this formula:
# 2^(16+SYMBOL_CACHE_SIZE). The valid range is 0..9, the default is 0,
# corresponding to a cache size of 2^16 = 65536 symbols
SYMBOL_CACHE_SIZE = 0
#---------------------------------------------------------------------------
# Build related configuration options
#---------------------------------------------------------------------------
# If the EXTRACT_ALL tag is set to YES doxygen will assume all entities in
# documentation are documented, even if no documentation was available.
# Private class members and static file members will be hidden unless
# the EXTRACT_PRIVATE and EXTRACT_STATIC tags are set to YES
EXTRACT_ALL = YES
# If the EXTRACT_PRIVATE tag is set to YES all private members of a class
# will be included in the documentation.
EXTRACT_PRIVATE = NO
# If the EXTRACT_STATIC tag is set to YES all static members of a file
# will be included in the documentation.
EXTRACT_STATIC = YES
# If the EXTRACT_LOCAL_CLASSES tag is set to YES classes (and structs)
# defined locally in source files will be included in the documentation.
# If set to NO only classes defined in header files are included.
-EXTRACT_LOCAL_CLASSES = YES
+EXTRACT_LOCAL_CLASSES = NO
# This flag is only useful for Objective-C code. When set to YES local
# methods, which are defined in the implementation section but not in
# the interface are included in the documentation.
# If set to NO (the default) only methods in the interface are included.
EXTRACT_LOCAL_METHODS = NO
# If this flag is set to YES, the members of anonymous namespaces will be
# extracted and appear in the documentation as a namespace called
# 'anonymous_namespace{file}', where file will be replaced with the base
# name of the file that contains the anonymous namespace. By default
# anonymous namespaces are hidden.
EXTRACT_ANON_NSPACES = NO
# If the HIDE_UNDOC_MEMBERS tag is set to YES, Doxygen will hide all
# undocumented members of documented classes, files or namespaces.
# If set to NO (the default) these members will be included in the
# various overviews, but no documentation section is generated.
# This option has no effect if EXTRACT_ALL is enabled.
HIDE_UNDOC_MEMBERS = NO
# If the HIDE_UNDOC_CLASSES tag is set to YES, Doxygen will hide all
# undocumented classes that are normally visible in the class hierarchy.
# If set to NO (the default) these classes will be included in the various
# overviews. This option has no effect if EXTRACT_ALL is enabled.
HIDE_UNDOC_CLASSES = NO
# If the HIDE_FRIEND_COMPOUNDS tag is set to YES, Doxygen will hide all
# friend (class|struct|union) declarations.
# If set to NO (the default) these declarations will be included in the
# documentation.
HIDE_FRIEND_COMPOUNDS = NO
# If the HIDE_IN_BODY_DOCS tag is set to YES, Doxygen will hide any
# documentation blocks found inside the body of a function.
# If set to NO (the default) these blocks will be appended to the
# function's detailed documentation block.
HIDE_IN_BODY_DOCS = NO
# The INTERNAL_DOCS tag determines if documentation
# that is typed after a \internal command is included. If the tag is set
# to NO (the default) then the documentation will be excluded.
# Set it to YES to include the internal documentation.
INTERNAL_DOCS = NO
# If the CASE_SENSE_NAMES tag is set to NO then Doxygen will only generate
# file names in lower-case letters. If set to YES upper-case letters are also
# allowed. This is useful if you have classes or files whose names only differ
# in case and if your file system supports case sensitive file names. Windows
# and Mac users are advised to set this option to NO.
CASE_SENSE_NAMES = YES
# If the HIDE_SCOPE_NAMES tag is set to NO (the default) then Doxygen
# will show members with their full class and namespace scopes in the
# documentation. If set to YES the scope will be hidden.
HIDE_SCOPE_NAMES = NO
# If the SHOW_INCLUDE_FILES tag is set to YES (the default) then Doxygen
# will put a list of the files that are included by a file in the documentation
# of that file.
SHOW_INCLUDE_FILES = YES
# If the FORCE_LOCAL_INCLUDES tag is set to YES then Doxygen
# will list include files with double quotes in the documentation
# rather than with sharp brackets.
FORCE_LOCAL_INCLUDES = NO
# If the INLINE_INFO tag is set to YES (the default) then a tag [inline]
# is inserted in the documentation for inline members.
INLINE_INFO = YES
# If the SORT_MEMBER_DOCS tag is set to YES (the default) then doxygen
# will sort the (detailed) documentation of file and class members
# alphabetically by member name. If set to NO the members will appear in
# declaration order.
SORT_MEMBER_DOCS = YES
# If the SORT_BRIEF_DOCS tag is set to YES then doxygen will sort the
# brief documentation of file, namespace and class members alphabetically
# by member name. If set to NO (the default) the members will appear in
# declaration order.
SORT_BRIEF_DOCS = NO
# If the SORT_MEMBERS_CTORS_1ST tag is set to YES then doxygen
# will sort the (brief and detailed) documentation of class members so that
# constructors and destructors are listed first. If set to NO (the default)
# the constructors will appear in the respective orders defined by
# SORT_MEMBER_DOCS and SORT_BRIEF_DOCS.
# This tag will be ignored for brief docs if SORT_BRIEF_DOCS is set to NO
# and ignored for detailed docs if SORT_MEMBER_DOCS is set to NO.
SORT_MEMBERS_CTORS_1ST = NO
# If the SORT_GROUP_NAMES tag is set to YES then doxygen will sort the
# hierarchy of group names into alphabetical order. If set to NO (the default)
# the group names will appear in their defined order.
SORT_GROUP_NAMES = NO
# If the SORT_BY_SCOPE_NAME tag is set to YES, the class list will be
# sorted by fully-qualified names, including namespaces. If set to
# NO (the default), the class list will be sorted only by class name,
# not including the namespace part.
# Note: This option is not very useful if HIDE_SCOPE_NAMES is set to YES.
# Note: This option applies only to the class list, not to the
# alphabetical list.
-SORT_BY_SCOPE_NAME = NO
+SORT_BY_SCOPE_NAME = YES
+
+# If the STRICT_PROTO_MATCHING option is enabled and doxygen fails to do proper type resolution of all parameters of a function it will reject a
+# match between the prototype and the implementation of a member function even if there is only one candidate or it is obvious which candidate to choose by doing a simple string match. By disabling STRICT_PROTO_MATCHING doxygen
+# will still accept a match between prototype and implementation in such cases.
+
+STRICT_PROTO_MATCHING = NO
# The GENERATE_TODOLIST tag can be used to enable (YES) or
# disable (NO) the todo list. This list is created by putting \todo
# commands in the documentation.
GENERATE_TODOLIST = @MITK_DOXYGEN_GENERATE_TODOLIST@
# The GENERATE_TESTLIST tag can be used to enable (YES) or
# disable (NO) the test list. This list is created by putting \test
# commands in the documentation.
GENERATE_TESTLIST = YES
# The GENERATE_BUGLIST tag can be used to enable (YES) or
# disable (NO) the bug list. This list is created by putting \bug
# commands in the documentation.
GENERATE_BUGLIST = @MITK_DOXYGEN_GENERATE_BUGLIST@
# The GENERATE_DEPRECATEDLIST tag can be used to enable (YES) or
# disable (NO) the deprecated list. This list is created by putting
# \deprecated commands in the documentation.
GENERATE_DEPRECATEDLIST= @MITK_DOXYGEN_GENERATE_DEPRECATEDLIST@
# The ENABLED_SECTIONS tag can be used to enable conditional
# documentation sections, marked by \if sectionname ... \endif.
ENABLED_SECTIONS = @MITK_DOXYGEN_ENABLED_SECTIONS@
# The MAX_INITIALIZER_LINES tag determines the maximum number of lines
# the initial value of a variable or macro consists of for it to appear in
# the documentation. If the initializer consists of more lines than specified
# here it will be hidden. Use a value of 0 to hide initializers completely.
# The appearance of the initializer of individual variables and macros in the
# documentation can be controlled using \showinitializer or \hideinitializer
# command in the documentation regardless of this setting.
-MAX_INITIALIZER_LINES = 30
+MAX_INITIALIZER_LINES = 0
# Set the SHOW_USED_FILES tag to NO to disable the list of files generated
# at the bottom of the documentation of classes and structs. If set to YES the
# list will mention the files that were used to generate the documentation.
SHOW_USED_FILES = YES
# If the sources in your project are distributed over multiple directories
# then setting the SHOW_DIRECTORIES tag to YES will show the directory hierarchy
# in the documentation. The default is NO.
SHOW_DIRECTORIES = NO
# Set the SHOW_FILES tag to NO to disable the generation of the Files page.
# This will remove the Files entry from the Quick Index and from the
# Folder Tree View (if specified). The default is YES.
SHOW_FILES = YES
# Set the SHOW_NAMESPACES tag to NO to disable the generation of the
# Namespaces page.
# This will remove the Namespaces entry from the Quick Index
# and from the Folder Tree View (if specified). The default is YES.
SHOW_NAMESPACES = YES
# The FILE_VERSION_FILTER tag can be used to specify a program or script that
# doxygen should invoke to get the current version for each file (typically from
# the version control system). Doxygen will invoke the program by executing (via
# popen()) the command <command> <input-file>, where <command> is the value of
# the FILE_VERSION_FILTER tag, and <input-file> is the name of an input file
# provided by doxygen. Whatever the program writes to standard output
# is used as the file version. See the manual for examples.
FILE_VERSION_FILTER =
# The LAYOUT_FILE tag can be used to specify a layout file which will be parsed
# by doxygen. The layout file controls the global structure of the generated
# output files in an output format independent way. The create the layout file
# that represents doxygen's defaults, run doxygen with the -l option.
# You can optionally specify a file name after the option, if omitted
# DoxygenLayout.xml will be used as the name of the layout file.
LAYOUT_FILE =
#---------------------------------------------------------------------------
# configuration options related to warning and progress messages
#---------------------------------------------------------------------------
# The QUIET tag can be used to turn on/off the messages that are generated
# by doxygen. Possible values are YES and NO. If left blank NO is used.
QUIET = NO
# The WARNINGS tag can be used to turn on/off the warning messages that are
# generated by doxygen. Possible values are YES and NO. If left blank
# NO is used.
WARNINGS = YES
# If WARN_IF_UNDOCUMENTED is set to YES, then doxygen will generate warnings
# for undocumented members. If EXTRACT_ALL is set to YES then this flag will
# automatically be disabled.
WARN_IF_UNDOCUMENTED = YES
# If WARN_IF_DOC_ERROR is set to YES, doxygen will generate warnings for
# potential errors in the documentation, such as not documenting some
# parameters in a documented function, or documenting parameters that
# don't exist or using markup commands wrongly.
WARN_IF_DOC_ERROR = YES
# The WARN_NO_PARAMDOC option can be enabled to get warnings for
# functions that are documented, but have no documentation for their parameters
# or return value. If set to NO (the default) doxygen will only warn about
# wrong or incomplete parameter documentation, but not about the absence of
# documentation.
WARN_NO_PARAMDOC = NO
# The WARN_FORMAT tag determines the format of the warning messages that
# doxygen can produce. The string should contain the $file, $line, and $text
# tags, which will be replaced by the file and line number from which the
# warning originated and the warning text. Optionally the format may contain
# $version, which will be replaced by the version of the file (if it could
# be obtained via FILE_VERSION_FILTER)
WARN_FORMAT = "$file:$line: $text"
# The WARN_LOGFILE tag can be used to specify a file to which warning
# and error messages should be written. If left blank the output is written
# to stderr.
WARN_LOGFILE =
#---------------------------------------------------------------------------
# configuration options related to the input files
#---------------------------------------------------------------------------
# The INPUT tag can be used to specify the files and/or directories that contain
# documented source files. You may enter file names like "myfile.cpp" or
# directories like "/usr/src/myproject". Separate the files or directories
# with spaces.
INPUT = ./ \
@MITK_SOURCE_DIR@ \
@MITK_BINARY_DIR@ \
@MITK_DOXYGEN_ADDITIONAL_INPUT_DIRS@
# This tag can be used to specify the character encoding of the source files
# that doxygen parses. Internally doxygen uses the UTF-8 encoding, which is
# also the default input encoding. Doxygen uses libiconv (or the iconv built
# into libc) for the transcoding. See http://www.gnu.org/software/libiconv for
# the list of possible encodings.
INPUT_ENCODING = UTF-8
# If the value of the INPUT tag contains directories, you can use the
# FILE_PATTERNS tag to specify one or more wildcard pattern (like *.cpp
# and *.h) to filter out the source-files in the directories. If left
# blank the following patterns are tested:
# *.c *.cc *.cxx *.cpp *.c++ *.d *.java *.ii *.ixx *.ipp *.i++ *.inl *.h *.hh
# *.hxx *.hpp *.h++ *.idl *.odl *.cs *.php *.php3 *.inc *.m *.mm *.dox *.py
-# *.f90 *.f *.vhd *.vhdl
+# *.f90 *.f *.for *.vhd *.vhdl
FILE_PATTERNS = *.h \
*.cpp \
*.dox \
*.txx \
*.cxx \
*.cmake
# The RECURSIVE tag can be used to turn specify whether or not subdirectories
# should be searched for input files as well. Possible values are YES and NO.
# If left blank NO is used.
RECURSIVE = YES
# The EXCLUDE tag can be used to specify files and/or directories that should
# excluded from the INPUT source files. This way you can easily exclude a
# subdirectory from a directory tree whose root is specified with the INPUT tag.
EXCLUDE = @MITK_SOURCE_DIR@/Utilities/vecmath/ \
@MITK_SOURCE_DIR@/Utilities/ann/ \
@MITK_SOURCE_DIR@/Utilities/glew/ \
@MITK_SOURCE_DIR@/Utilities/KWStyle/ \
@MITK_SOURCE_DIR@/Utilities/qwt/ \
@MITK_SOURCE_DIR@/Utilities/qxt/ \
@MITK_SOURCE_DIR@/Utilities/tinyxml/ \
@MITK_SOURCE_DIR@/Utilities/Poco/ \
@MITK_SOURCE_DIR@/BlueBerry/ \
@MITK_SOURCE_DIR@/Deprecated/ \
@MITK_SOURCE_DIR@/Build/ \
@MITK_SOURCE_DIR@/Core/Testing/ \
@MITK_SOURCE_DIR@/CMake/PackageDepends \
@MITK_SOURCE_DIR@/CMake/QBundleTemplate \
@MITK_SOURCE_DIR@/CMakeExternals \
@MITK_SOURCE_DIR@/Modules/QmitkExt/vtkQtChartHeaders/ \
@MITK_DOXYGEN_ADDITIONAL_EXCLUDE_DIRS@
# The EXCLUDE_SYMLINKS tag can be used select whether or not files or
-# directories that are symbolic links (a Unix filesystem feature) are excluded
+# directories that are symbolic links (a Unix file system feature) are excluded
# from the input.
EXCLUDE_SYMLINKS = NO
# If the value of the INPUT tag contains directories, you can use the
# EXCLUDE_PATTERNS tag to specify one or more wildcard patterns to exclude
# certain files from those directories. Note that the wildcards are matched
# against the file with absolute path, so to exclude all test directories
# for example use the pattern */test/*
EXCLUDE_PATTERNS = moc_* \
Register* \
*/files.cmake \
@MITK_BINARY_DIR@/*.cmake
# The EXCLUDE_SYMBOLS tag can be used to specify one or more symbol names
# (namespaces, classes, functions, etc.) that should be excluded from the
# output. The symbol name can be a fully qualified name, a word, or if the
# wildcard * is used, a substring. Examples: ANamespace, AClass,
# AClass::ANamespace, ANamespace::*Test
EXCLUDE_SYMBOLS =
# The EXAMPLE_PATH tag can be used to specify one or more files or
# directories that contain example code fragments that are included (see
# the \include command).
EXAMPLE_PATH = @MITK_SOURCE_DIR@/Applications/Tutorial/ \
@MITK_SOURCE_DIR@/Core/Code/ \
@MITK_SOURCE_DIR@/Applications/Tests/QtFreeRender/
# If the value of the EXAMPLE_PATH tag contains directories, you can use the
# EXAMPLE_PATTERNS tag to specify one or more wildcard pattern (like *.cpp
# and *.h) to filter out the source-files in the directories. If left
# blank all files are included.
EXAMPLE_PATTERNS =
# If the EXAMPLE_RECURSIVE tag is set to YES then subdirectories will be
# searched for input files to be used with the \include or \dontinclude
# commands irrespective of the value of the RECURSIVE tag.
# Possible values are YES and NO. If left blank NO is used.
EXAMPLE_RECURSIVE = YES
# The IMAGE_PATH tag can be used to specify one or more files or
# directories that contain image that are included in the documentation (see
# the \image command).
IMAGE_PATH = @MITK_SOURCE_DIR@/Documentation/Doxygen/ \
@MITK_SOURCE_DIR@/Documentation/Doxygen/Modules/ \
@MITK_SOURCE_DIR@/Documentation/Doxygen/Tutorial/ \
@MITK_SOURCE_DIR@/Core/DataStructures/ \
- @MITK_SOURCE_DIR@
+ @MITK_SOURCE_DIR@
# The INPUT_FILTER tag can be used to specify a program that doxygen should
# invoke to filter for each input file. Doxygen will invoke the filter program
# by executing (via popen()) the command <filter> <input-file>, where <filter>
# is the value of the INPUT_FILTER tag, and <input-file> is the name of an
# input file. Doxygen will then use the output that the filter program writes
# to standard output.
# If FILTER_PATTERNS is specified, this tag will be
# ignored.
INPUT_FILTER =
# The FILTER_PATTERNS tag can be used to specify filters on a per file pattern
# basis.
# Doxygen will compare the file name with each pattern and apply the
# filter if there is a match.
# The filters are a list of the form:
# pattern=filter (like *.cpp=my_cpp_filter). See INPUT_FILTER for further
-# info on how filters are used. If FILTER_PATTERNS is empty, INPUT_FILTER
-# is applied to all files.
+# info on how filters are used. If FILTER_PATTERNS is empty or if
+# non of the patterns match the file name, INPUT_FILTER is applied.
FILTER_PATTERNS = *.cmake=@CMakeDoxygenFilter_EXECUTABLE@
# If the FILTER_SOURCE_FILES tag is set to YES, the input filter (if set using
# INPUT_FILTER) will be used to filter the input files when producing source
# files to browse (i.e. when SOURCE_BROWSER is set to YES).
FILTER_SOURCE_FILES = NO
+# The FILTER_SOURCE_PATTERNS tag can be used to specify source filters per file
+# pattern. A pattern will override the setting for FILTER_PATTERN (if any)
+# and it is also possible to disable source filtering for a specific pattern
+# using *.ext= (so without naming a filter). This option only has effect when
+# FILTER_SOURCE_FILES is enabled.
+
+FILTER_SOURCE_PATTERNS =
+
#---------------------------------------------------------------------------
# configuration options related to source browsing
#---------------------------------------------------------------------------
# If the SOURCE_BROWSER tag is set to YES then a list of source files will
# be generated. Documented entities will be cross-referenced with these sources.
# Note: To get rid of all source code in the generated output, make sure also
# VERBATIM_HEADERS is set to NO.
SOURCE_BROWSER = YES
# Setting the INLINE_SOURCES tag to YES will include the body
# of functions and classes directly in the documentation.
INLINE_SOURCES = NO
# Setting the STRIP_CODE_COMMENTS tag to YES (the default) will instruct
# doxygen to hide any special comment blocks from generated source code
# fragments. Normal C and C++ comments will always remain visible.
STRIP_CODE_COMMENTS = YES
# If the REFERENCED_BY_RELATION tag is set to YES
# then for each documented function all documented
# functions referencing it will be listed.
REFERENCED_BY_RELATION = YES
# If the REFERENCES_RELATION tag is set to YES
# then for each documented function all documented entities
# called/used by that function will be listed.
REFERENCES_RELATION = YES
# If the REFERENCES_LINK_SOURCE tag is set to YES (the default)
# and SOURCE_BROWSER tag is set to YES, then the hyperlinks from
# functions in REFERENCES_RELATION and REFERENCED_BY_RELATION lists will
# link to the source code.
# Otherwise they will link to the documentation.
REFERENCES_LINK_SOURCE = YES
# If the USE_HTAGS tag is set to YES then the references to source code
# will point to the HTML generated by the htags(1) tool instead of doxygen
# built-in source browser. The htags tool is part of GNU's global source
# tagging system (see http://www.gnu.org/software/global/global.html). You
# will need version 4.8.6 or higher.
USE_HTAGS = NO
# If the VERBATIM_HEADERS tag is set to YES (the default) then Doxygen
# will generate a verbatim copy of the header file for each class for
# which an include is specified. Set to NO to disable this.
VERBATIM_HEADERS = YES
#---------------------------------------------------------------------------
# configuration options related to the alphabetical class index
#---------------------------------------------------------------------------
# If the ALPHABETICAL_INDEX tag is set to YES, an alphabetical index
# of all compounds will be generated. Enable this if the project
# contains a lot of classes, structs, unions or interfaces.
ALPHABETICAL_INDEX = YES
# If the alphabetical index is enabled (see ALPHABETICAL_INDEX) then
# the COLS_IN_ALPHA_INDEX tag can be used to specify the number of columns
# in which this list will be split (can be a number in the range [1..20])
COLS_IN_ALPHA_INDEX = 3
# In case all classes in a project start with a common prefix, all
# classes will be put under the same header in the alphabetical index.
# The IGNORE_PREFIX tag can be used to specify one or more prefixes that
# should be ignored while generating the index headers.
IGNORE_PREFIX =
#---------------------------------------------------------------------------
# configuration options related to the HTML output
#---------------------------------------------------------------------------
# If the GENERATE_HTML tag is set to YES (the default) Doxygen will
# generate HTML output.
GENERATE_HTML = YES
# The HTML_OUTPUT tag is used to specify where the HTML docs will be put.
# If a relative path is entered the value of OUTPUT_DIRECTORY will be
# put in front of it. If left blank `html' will be used as the default path.
HTML_OUTPUT = html
# The HTML_FILE_EXTENSION tag can be used to specify the file extension for
# each generated HTML page (for example: .htm,.php,.asp). If it is left blank
# doxygen will generate files with .html extension.
HTML_FILE_EXTENSION = .html
# The HTML_HEADER tag can be used to specify a personal HTML header for
# each generated HTML page. If it is left blank doxygen will generate a
# standard header.
HTML_HEADER =
# The HTML_FOOTER tag can be used to specify a personal HTML footer for
# each generated HTML page. If it is left blank doxygen will generate a
# standard footer.
HTML_FOOTER =
# The HTML_STYLESHEET tag can be used to specify a user-defined cascading
# style sheet that is used by each HTML page. It can be used to
# fine-tune the look of the HTML output. If the tag is left blank doxygen
# will generate a default style sheet. Note that doxygen will try to copy
# the style sheet file to the HTML output directory, so don't put your own
# stylesheet in the HTML output directory as well, or it will be erased!
HTML_STYLESHEET =
# The HTML_COLORSTYLE_HUE tag controls the color of the HTML output.
# Doxygen will adjust the colors in the stylesheet and background images
# according to this color. Hue is specified as an angle on a colorwheel,
# see http://en.wikipedia.org/wiki/Hue for more information.
# For instance the value 0 represents red, 60 is yellow, 120 is green,
# 180 is cyan, 240 is blue, 300 purple, and 360 is red again.
# The allowed range is 0 to 359.
HTML_COLORSTYLE_HUE = 220
# The HTML_COLORSTYLE_SAT tag controls the purity (or saturation) of
# the colors in the HTML output. For a value of 0 the output will use
# grayscales only. A value of 255 will produce the most vivid colors.
HTML_COLORSTYLE_SAT = 100
# The HTML_COLORSTYLE_GAMMA tag controls the gamma correction applied to
# the luminance component of the colors in the HTML output. Values below
# 100 gradually make the output lighter, whereas values above 100 make
# the output darker. The value divided by 100 is the actual gamma applied,
# so 80 represents a gamma of 0.8, The value 220 represents a gamma of 2.2,
# and 100 does not change the gamma.
HTML_COLORSTYLE_GAMMA = 80
# If the HTML_TIMESTAMP tag is set to YES then the footer of each generated HTML
# page will contain the date and time when the page was generated. Setting
# this to NO can help when comparing the output of multiple runs.
HTML_TIMESTAMP = YES
# If the HTML_ALIGN_MEMBERS tag is set to YES, the members of classes,
# files or namespaces will be aligned in HTML using tables. If set to
# NO a bullet list will be used.
HTML_ALIGN_MEMBERS = YES
# If the HTML_DYNAMIC_SECTIONS tag is set to YES then the generated HTML
# documentation will contain sections that can be hidden and shown after the
# page has loaded. For this to work a browser that supports
# JavaScript and DHTML is required (for instance Mozilla 1.0+, Firefox
# Netscape 6.0+, Internet explorer 5.0+, Konqueror, or Safari).
HTML_DYNAMIC_SECTIONS = @MITK_DOXYGEN_HTML_DYNAMIC_SECTIONS@
# If the GENERATE_DOCSET tag is set to YES, additional index files
# will be generated that can be used as input for Apple's Xcode 3
# integrated development environment, introduced with OSX 10.5 (Leopard).
# To create a documentation set, doxygen will generate a Makefile in the
# HTML output directory. Running make will produce the docset in that
# directory and running "make install" will install the docset in
# ~/Library/Developer/Shared/Documentation/DocSets so that Xcode will find
# it at startup.
# See http://developer.apple.com/tools/creatingdocsetswithdoxygen.html
# for more information.
GENERATE_DOCSET = NO
# When GENERATE_DOCSET tag is set to YES, this tag determines the name of the
# feed. A documentation feed provides an umbrella under which multiple
# documentation sets from a single provider (such as a company or product suite)
# can be grouped.
DOCSET_FEEDNAME = "Doxygen generated docs"
# When GENERATE_DOCSET tag is set to YES, this tag specifies a string that
# should uniquely identify the documentation set bundle. This should be a
# reverse domain-name style string, e.g. com.mycompany.MyDocSet. Doxygen
# will append .docset to the name.
DOCSET_BUNDLE_ID = org.doxygen.Project
# When GENERATE_PUBLISHER_ID tag specifies a string that should uniquely identify
# the documentation publisher. This should be a reverse domain-name style
# string, e.g. com.mycompany.MyDocSet.documentation.
DOCSET_PUBLISHER_ID = org.doxygen.Publisher
# The GENERATE_PUBLISHER_NAME tag identifies the documentation publisher.
DOCSET_PUBLISHER_NAME = Publisher
# If the GENERATE_HTMLHELP tag is set to YES, additional index files
# will be generated that can be used as input for tools like the
# Microsoft HTML help workshop to generate a compiled HTML help file (.chm)
# of the generated HTML documentation.
GENERATE_HTMLHELP = NO
# If the GENERATE_HTMLHELP tag is set to YES, the CHM_FILE tag can
# be used to specify the file name of the resulting .chm file. You
# can add a path in front of the file if the result should not be
# written to the html output directory.
CHM_FILE =
# If the GENERATE_HTMLHELP tag is set to YES, the HHC_LOCATION tag can
# be used to specify the location (absolute path including file name) of
# the HTML help compiler (hhc.exe). If non-empty doxygen will try to run
# the HTML help compiler on the generated index.hhp.
HHC_LOCATION =
# If the GENERATE_HTMLHELP tag is set to YES, the GENERATE_CHI flag
# controls if a separate .chi index file is generated (YES) or that
# it should be included in the master .chm file (NO).
GENERATE_CHI = NO
# If the GENERATE_HTMLHELP tag is set to YES, the CHM_INDEX_ENCODING
# is used to encode HtmlHelp index (hhk), content (hhc) and project file
# content.
CHM_INDEX_ENCODING =
# If the GENERATE_HTMLHELP tag is set to YES, the BINARY_TOC flag
# controls whether a binary table of contents is generated (YES) or a
# normal table of contents (NO) in the .chm file.
BINARY_TOC = NO
# The TOC_EXPAND flag can be set to YES to add extra items for group members
# to the contents of the HTML help documentation and to the tree view.
TOC_EXPAND = NO
# If the GENERATE_QHP tag is set to YES and both QHP_NAMESPACE and
# QHP_VIRTUAL_FOLDER are set, an additional index file will be generated
# that can be used as input for Qt's qhelpgenerator to generate a
# Qt Compressed Help (.qch) of the generated HTML documentation.
GENERATE_QHP = @MITK_DOXYGEN_GENERATE_QHP@
# If the QHG_LOCATION tag is specified, the QCH_FILE tag can
# be used to specify the file name of the resulting .qch file.
# The path specified is relative to the HTML output folder.
QCH_FILE = @MITK_DOXYGEN_QCH_FILE@
# The QHP_NAMESPACE tag specifies the namespace to use when generating
# Qt Help Project output. For more information please see
# http://doc.trolltech.com/qthelpproject.html#namespace
QHP_NAMESPACE = "org.mitk"
# The QHP_VIRTUAL_FOLDER tag specifies the namespace to use when generating
# Qt Help Project output. For more information please see
# http://doc.trolltech.com/qthelpproject.html#virtual-folders
QHP_VIRTUAL_FOLDER = MITK
# If QHP_CUST_FILTER_NAME is set, it specifies the name of a custom filter to
# add. For more information please see
# http://doc.trolltech.com/qthelpproject.html#custom-filters
QHP_CUST_FILTER_NAME =
# The QHP_CUST_FILT_ATTRS tag specifies the list of the attributes of the
# custom filter to add. For more information please see
# <a href="http://doc.trolltech.com/qthelpproject.html#custom-filters">
# Qt Help Project / Custom Filters</a>.
QHP_CUST_FILTER_ATTRS =
# The QHP_SECT_FILTER_ATTRS tag specifies the list of the attributes this
# project's
# filter section matches.
# <a href="http://doc.trolltech.com/qthelpproject.html#filter-attributes">
# Qt Help Project / Filter Attributes</a>.
QHP_SECT_FILTER_ATTRS =
# If the GENERATE_QHP tag is set to YES, the QHG_LOCATION tag can
# be used to specify the location of Qt's qhelpgenerator.
# If non-empty doxygen will try to run qhelpgenerator on the generated
# .qhp file.
QHG_LOCATION = @QT_HELPGENERATOR_EXECUTABLE@
# If the GENERATE_ECLIPSEHELP tag is set to YES, additional index files
# will be generated, which together with the HTML files, form an Eclipse help
# plugin. To install this plugin and make it available under the help contents
# menu in Eclipse, the contents of the directory containing the HTML and XML
# files needs to be copied into the plugins directory of eclipse. The name of
# the directory within the plugins directory should be the same as
# the ECLIPSE_DOC_ID value. After copying Eclipse needs to be restarted before
# the help appears.
GENERATE_ECLIPSEHELP = NO
# A unique identifier for the eclipse help plugin. When installing the plugin
# the directory name containing the HTML and XML files should also have
# this name.
ECLIPSE_DOC_ID = org.doxygen.Project
# The DISABLE_INDEX tag can be used to turn on/off the condensed index at
# top of each HTML page. The value NO (the default) enables the index and
# the value YES disables it.
DISABLE_INDEX = NO
# This tag can be used to set the number of enum values (range [0,1..20])
# that doxygen will group on one line in the generated HTML documentation.
# Note that a value of 0 will completely suppress the enum values from appearing in the overview section.
ENUM_VALUES_PER_LINE = 4
# The GENERATE_TREEVIEW tag is used to specify whether a tree-like index
# structure should be generated to display hierarchical information.
# If the tag value is set to YES, a side panel will be generated
# containing a tree-like index structure (just like the one that
# is generated for HTML Help). For this to work a browser that supports
# JavaScript, DHTML, CSS and frames is required (i.e. any modern browser).
# Windows users are probably better off using the HTML help feature.
GENERATE_TREEVIEW = YES
# By enabling USE_INLINE_TREES, doxygen will generate the Groups, Directories,
# and Class Hierarchy pages using a tree view instead of an ordered list.
USE_INLINE_TREES = NO
# If the treeview is enabled (see GENERATE_TREEVIEW) then this tag can be
# used to set the initial width (in pixels) of the frame in which the tree
# is shown.
TREEVIEW_WIDTH = 300
# When the EXT_LINKS_IN_WINDOW option is set to YES doxygen will open
# links to external symbols imported via tag files in a separate window.
EXT_LINKS_IN_WINDOW = NO
# Use this tag to change the font size of Latex formulas included
# as images in the HTML documentation. The default is 10. Note that
# when you change the font size after a successful doxygen run you need
# to manually remove any form_*.png images from the HTML output directory
# to force them to be regenerated.
FORMULA_FONTSIZE = 10
# Use the FORMULA_TRANPARENT tag to determine whether or not the images
# generated for formulas are transparent PNGs. Transparent PNGs are
# not supported properly for IE 6.0, but are supported on all modern browsers.
# Note that when changing this option you need to delete any form_*.png files
# in the HTML output before the changes have effect.
FORMULA_TRANSPARENT = YES
# Enable the USE_MATHJAX option to render LaTeX formulas using MathJax
# (see http://www.mathjax.org) which uses client side Javascript for the
# rendering instead of using prerendered bitmaps. Use this if you do not
# have LaTeX installed or if you want to formulas look prettier in the HTML
# output. When enabled you also need to install MathJax separately and
# configure the path to it using the MATHJAX_RELPATH option.
USE_MATHJAX = NO
# When MathJax is enabled you need to specify the location relative to the
# HTML output directory using the MATHJAX_RELPATH option. The destination
# directory should contain the MathJax.js script. For instance, if the mathjax
# directory is located at the same level as the HTML output directory, then
# MATHJAX_RELPATH should be ../mathjax. The default value points to the mathjax.org site, so you can quickly see the result without installing
# MathJax, but it is strongly recommended to install a local copy of MathJax
# before deployment.
MATHJAX_RELPATH = http://www.mathjax.org/mathjax
# When the SEARCHENGINE tag is enabled doxygen will generate a search box
# for the HTML output. The underlying search engine uses javascript
# and DHTML and should work on any modern browser. Note that when using
# HTML help (GENERATE_HTMLHELP), Qt help (GENERATE_QHP), or docsets
# (GENERATE_DOCSET) there is already a search function so this one should
# typically be disabled. For large projects the javascript based search engine
# can be slow, then enabling SERVER_BASED_SEARCH may provide a better solution.
SEARCHENGINE = YES
# When the SERVER_BASED_SEARCH tag is enabled the search engine will be
# implemented using a PHP enabled web server instead of at the web client
# using Javascript. Doxygen will generate the search PHP script and index
# file to put on the web server. The advantage of the server
# based approach is that it scales better to large projects and allows
# full text search. The disadvantages are that it is more difficult to setup
# and does not have live searching capabilities.
SERVER_BASED_SEARCH = NO
#---------------------------------------------------------------------------
# configuration options related to the LaTeX output
#---------------------------------------------------------------------------
# If the GENERATE_LATEX tag is set to YES (the default) Doxygen will
# generate Latex output.
GENERATE_LATEX = NO
# The LATEX_OUTPUT tag is used to specify where the LaTeX docs will be put.
# If a relative path is entered the value of OUTPUT_DIRECTORY will be
# put in front of it. If left blank `latex' will be used as the default path.
LATEX_OUTPUT = latex
# The LATEX_CMD_NAME tag can be used to specify the LaTeX command name to be
# invoked. If left blank `latex' will be used as the default command name.
# Note that when enabling USE_PDFLATEX this option is only used for
# generating bitmaps for formulas in the HTML output, but not in the
# Makefile that is written to the output directory.
LATEX_CMD_NAME = latex
# The MAKEINDEX_CMD_NAME tag can be used to specify the command name to
# generate index for LaTeX. If left blank `makeindex' will be used as the
# default command name.
MAKEINDEX_CMD_NAME = makeindex
# If the COMPACT_LATEX tag is set to YES Doxygen generates more compact
# LaTeX documents. This may be useful for small projects and may help to
# save some trees in general.
COMPACT_LATEX = NO
# The PAPER_TYPE tag can be used to set the paper type that is used
# by the printer. Possible values are: a4, letter, legal and
# executive. If left blank a4wide will be used.
PAPER_TYPE = a4wide
# The EXTRA_PACKAGES tag can be to specify one or more names of LaTeX
# packages that should be included in the LaTeX output.
EXTRA_PACKAGES = amssymb
# The LATEX_HEADER tag can be used to specify a personal LaTeX header for
# the generated latex document. The header should contain everything until
# the first chapter. If it is left blank doxygen will generate a
# standard header. Notice: only use this tag if you know what you are doing!
LATEX_HEADER =
# If the PDF_HYPERLINKS tag is set to YES, the LaTeX that is generated
# is prepared for conversion to pdf (using ps2pdf). The pdf file will
# contain links (just like the HTML output) instead of page references
# This makes the output suitable for online browsing using a pdf viewer.
PDF_HYPERLINKS = NO
# If the USE_PDFLATEX tag is set to YES, pdflatex will be used instead of
# plain latex in the generated Makefile. Set this option to YES to get a
# higher quality PDF documentation.
USE_PDFLATEX = NO
# If the LATEX_BATCHMODE tag is set to YES, doxygen will add the \\batchmode.
# command to the generated LaTeX files. This will instruct LaTeX to keep
# running if errors occur, instead of asking the user for help.
# This option is also used when generating formulas in HTML.
LATEX_BATCHMODE = NO
# If LATEX_HIDE_INDICES is set to YES then doxygen will not
# include the index chapters (such as File Index, Compound Index, etc.)
# in the output.
LATEX_HIDE_INDICES = NO
# If LATEX_SOURCE_CODE is set to YES then doxygen will include
# source code with syntax highlighting in the LaTeX output.
# Note that which sources are shown also depends on other settings
# such as SOURCE_BROWSER.
LATEX_SOURCE_CODE = NO
#---------------------------------------------------------------------------
# configuration options related to the RTF output
#---------------------------------------------------------------------------
# If the GENERATE_RTF tag is set to YES Doxygen will generate RTF output
# The RTF output is optimized for Word 97 and may not look very pretty with
# other RTF readers or editors.
GENERATE_RTF = NO
# The RTF_OUTPUT tag is used to specify where the RTF docs will be put.
# If a relative path is entered the value of OUTPUT_DIRECTORY will be
# put in front of it. If left blank `rtf' will be used as the default path.
RTF_OUTPUT = rtf
# If the COMPACT_RTF tag is set to YES Doxygen generates more compact
# RTF documents. This may be useful for small projects and may help to
# save some trees in general.
COMPACT_RTF = NO
# If the RTF_HYPERLINKS tag is set to YES, the RTF that is generated
# will contain hyperlink fields. The RTF file will
# contain links (just like the HTML output) instead of page references.
# This makes the output suitable for online browsing using WORD or other
# programs which support those fields.
# Note: wordpad (write) and others do not support links.
RTF_HYPERLINKS = NO
# Load stylesheet definitions from file. Syntax is similar to doxygen's
# config file, i.e. a series of assignments. You only have to provide
# replacements, missing definitions are set to their default value.
RTF_STYLESHEET_FILE =
# Set optional variables used in the generation of an rtf document.
# Syntax is similar to doxygen's config file.
RTF_EXTENSIONS_FILE =
#---------------------------------------------------------------------------
# configuration options related to the man page output
#---------------------------------------------------------------------------
# If the GENERATE_MAN tag is set to YES (the default) Doxygen will
# generate man pages
GENERATE_MAN = NO
# The MAN_OUTPUT tag is used to specify where the man pages will be put.
# If a relative path is entered the value of OUTPUT_DIRECTORY will be
# put in front of it. If left blank `man' will be used as the default path.
MAN_OUTPUT = man
# The MAN_EXTENSION tag determines the extension that is added to
# the generated man pages (default is the subroutine's section .3)
MAN_EXTENSION = .3
# If the MAN_LINKS tag is set to YES and Doxygen generates man output,
# then it will generate one additional man file for each entity
# documented in the real man page(s). These additional files
# only source the real man page, but without them the man command
# would be unable to find the correct page. The default is NO.
MAN_LINKS = NO
#---------------------------------------------------------------------------
# configuration options related to the XML output
#---------------------------------------------------------------------------
# If the GENERATE_XML tag is set to YES Doxygen will
# generate an XML file that captures the structure of
# the code including all documentation.
GENERATE_XML = NO
# The XML_OUTPUT tag is used to specify where the XML pages will be put.
# If a relative path is entered the value of OUTPUT_DIRECTORY will be
# put in front of it. If left blank `xml' will be used as the default path.
XML_OUTPUT = xml
# The XML_SCHEMA tag can be used to specify an XML schema,
# which can be used by a validating XML parser to check the
# syntax of the XML files.
XML_SCHEMA =
# The XML_DTD tag can be used to specify an XML DTD,
# which can be used by a validating XML parser to check the
# syntax of the XML files.
XML_DTD =
# If the XML_PROGRAMLISTING tag is set to YES Doxygen will
# dump the program listings (including syntax highlighting
# and cross-referencing information) to the XML output. Note that
# enabling this will significantly increase the size of the XML output.
XML_PROGRAMLISTING = YES
#---------------------------------------------------------------------------
# configuration options for the AutoGen Definitions output
#---------------------------------------------------------------------------
# If the GENERATE_AUTOGEN_DEF tag is set to YES Doxygen will
# generate an AutoGen Definitions (see autogen.sf.net) file
# that captures the structure of the code including all
# documentation. Note that this feature is still experimental
# and incomplete at the moment.
GENERATE_AUTOGEN_DEF = NO
#---------------------------------------------------------------------------
# configuration options related to the Perl module output
#---------------------------------------------------------------------------
# If the GENERATE_PERLMOD tag is set to YES Doxygen will
# generate a Perl module file that captures the structure of
# the code including all documentation. Note that this
# feature is still experimental and incomplete at the
# moment.
GENERATE_PERLMOD = NO
# If the PERLMOD_LATEX tag is set to YES Doxygen will generate
# the necessary Makefile rules, Perl scripts and LaTeX code to be able
# to generate PDF and DVI output from the Perl module output.
PERLMOD_LATEX = NO
# If the PERLMOD_PRETTY tag is set to YES the Perl module output will be
# nicely formatted so it can be parsed by a human reader.
# This is useful
# if you want to understand what is going on.
# On the other hand, if this
# tag is set to NO the size of the Perl module output will be much smaller
# and Perl will parse it just the same.
PERLMOD_PRETTY = YES
# The names of the make variables in the generated doxyrules.make file
# are prefixed with the string contained in PERLMOD_MAKEVAR_PREFIX.
# This is useful so different doxyrules.make files included by the same
# Makefile don't overwrite each other's variables.
PERLMOD_MAKEVAR_PREFIX =
#---------------------------------------------------------------------------
# Configuration options related to the preprocessor
#---------------------------------------------------------------------------
# If the ENABLE_PREPROCESSING tag is set to YES (the default) Doxygen will
# evaluate all C-preprocessor directives found in the sources and include
# files.
ENABLE_PREPROCESSING = YES
# If the MACRO_EXPANSION tag is set to YES Doxygen will expand all macro
# names in the source code. If set to NO (the default) only conditional
# compilation will be performed. Macro expansion can be done in a controlled
# way by setting EXPAND_ONLY_PREDEF to YES.
MACRO_EXPANSION = YES
# If the EXPAND_ONLY_PREDEF and MACRO_EXPANSION tags are both set to YES
# then the macro expansion is limited to the macros specified with the
# PREDEFINED and EXPAND_AS_DEFINED tags.
EXPAND_ONLY_PREDEF = NO
# If the SEARCH_INCLUDES tag is set to YES (the default) the includes files
# in the INCLUDE_PATH (see below) will be search if a #include is found.
SEARCH_INCLUDES = YES
# The INCLUDE_PATH tag can be used to specify one or more directories that
# contain include files that are not input files but should be processed by
# the preprocessor.
INCLUDE_PATH =
# You can use the INCLUDE_FILE_PATTERNS tag to specify one or more wildcard
# patterns (like *.h and *.hpp) to filter out the header-files in the
# directories. If left blank, the patterns specified with FILE_PATTERNS will
# be used.
INCLUDE_FILE_PATTERNS =
# The PREDEFINED tag can be used to specify one or more macro names that
# are defined before the preprocessor is started (similar to the -D option of
# gcc). The argument of the tag is a list of macros of the form: name
# or name=definition (no spaces). If the definition and the = are
# omitted =1 is assumed. To prevent a macro definition from being
# undefined via #undef or recursively expanded use the := operator
# instead of the = operator.
PREDEFINED = itkNotUsed(x)= \
"itkSetMacro(name,type)= virtual void Set##name (type _arg);" \
"itkGetMacro(name,type)= virtual type Get##name ();" \
"itkGetConstMacro(name,type)= virtual type Get##name () const;" \
"itkSetStringMacro(name)= virtual void Set##name (const char* _arg);" \
"itkGetStringMacro(name)= virtual const char* Get##name () const;" \
"itkSetClampMacro(name,type,min,max)= virtual void Set##name (type _arg);" \
"itkSetObjectMacro(name,type)= virtual void Set##name (type* _arg);" \
"itkGetObjectMacro(name,type)= virtual type* Get##name ();" \
"itkSetConstObjectMacro(name,type)= virtual void Set##name ( const type* _arg);" \
"itkGetConstObjectMacro(name,type)= virtual const type* Get##name ();" \
"itkGetConstReferenceMacro(name,type)= virtual const type& Get##name ();" \
"itkGetConstReferenceObjectMacro(name,type)= virtual const type::Pointer& Get##name () const;" \
"itkBooleanMacro(name)= virtual void name##On (); virtual void name##Off ();" \
"itkSetVector2Macro(name,type)= virtual void Set##name (type _arg1, type _arg2) virtual void Set##name (type _arg[2]);" \
"itkGetVector2Macro(name,type)= virtual type* Get##name () const; virtual void Get##name (type& _arg1, type& _arg2) const; virtual void Get##name (type _arg[2]) const;" \
"itkSetVector3Macro(name,type)= virtual void Set##name (type _arg1, type _arg2, type _arg3) virtual void Set##name (type _arg[3]);" \
"itkGetVector3Macro(name,type)= virtual type* Get##name () const; virtual void Get##name (type& _arg1, type& _arg2, type& _arg3) const; virtual void Get##name (type _arg[3]) const;" \
"itkSetVector4Macro(name,type)= virtual void Set##name (type _arg1, type _arg2, type _arg3, type _arg4) virtual void Set##name (type _arg[4]);" \
"itkGetVector4Macro(name,type)= virtual type* Get##name () const; virtual void Get##name (type& _arg1, type& _arg2, type& _arg3, type& _arg4) const; virtual void Get##name (type _arg[4]) const;" \
"itkSetVector6Macro(name,type)= virtual void Set##name (type _arg1, type _arg2, type _arg3, type _arg4, type _arg5, type _arg6) virtual void Set##name (type _arg[6]);" \
"itkGetVector6Macro(name,type)= virtual type* Get##name () const; virtual void Get##name (type& _arg1, type& _arg2, type& _arg3, type& _arg4, type& _arg5, type& _arg6) const; virtual void Get##name (type _arg[6]) const;" \
"itkSetVectorMacro(name,type,count)= virtual void Set##name(type data[]);" \
"itkGetVectorMacro(name,type,count)= virtual type* Get##name () const;" \
"itkNewMacro(type)= static Pointer New();" \
"itkTypeMacro(thisClass,superclass)= virtual const char *GetClassName() const;" \
"itkConceptMacro(name,concept)= enum { name = 0 };" \
"ITK_NUMERIC_LIMITS= std::numeric_limits" \
"ITK_TYPENAME= typename" \
"FEM_ABSTRACT_CLASS(thisClass,parentClass)= public: /** Standard Self typedef.*/ typedef thisClass Self; /** Standard Superclass typedef. */ typedef parentClass Superclass; /** Pointer or SmartPointer to an object. */ typedef Self* Pointer; /** Const pointer or SmartPointer to an object. */ typedef const Self* ConstPointer; private:" \
"FEM_CLASS(thisClass,parentClass)= FEM_ABSTRACT_CLASS(thisClass,parentClass) public: /** Create a new object from the existing one */ virtual Baseclass::Pointer Clone() const; /** Class ID for FEM object factory */ static const int CLID; /** Virtual function to access the class ID */ virtual int ClassID() const { return CLID; } /** Object creation in an itk compatible way */ static Self::Pointer New() { return new Self(); } private:" \
FREEVERSION \
ERROR_CHECKING \
HAS_TIFF \
HAS_JPEG \
HAS_NETLIB \
HAS_PNG \
HAS_ZLIB \
HAS_GLUT \
HAS_QT \
VCL_USE_NATIVE_STL=1 \
VCL_USE_NATIVE_COMPLEX=1 \
VCL_HAS_BOOL=1 \
VXL_BIG_ENDIAN=1 \
VXL_LITTLE_ENDIAN=0 \
VNL_DLL_DATA= \
size_t=vcl_size_t \
DOXYGEN_SKIP
# If the MACRO_EXPANSION and EXPAND_ONLY_PREDEF tags are set to YES then
# this tag can be used to specify a list of macro names that should be expanded.
# The macro definition that is found in the sources will be used.
-# Use the PREDEFINED tag if you want to use a different macro definition.
+# Use the PREDEFINED tag if you want to use a different macro definition that overrules the definition found in the source code.
EXPAND_AS_DEFINED =
# If the SKIP_FUNCTION_MACROS tag is set to YES (the default) then
-# doxygen's preprocessor will remove all function-like macros that are alone
-# on a line, have an all uppercase name, and do not end with a semicolon. Such
-# function macros are typically used for boiler-plate code, and will confuse
-# the parser if not removed.
+# doxygen's preprocessor will remove all references to function-like macros
+# that are alone on a line, have an all uppercase name, and do not end with a
+# semicolon, because these will confuse the parser if not removed.
SKIP_FUNCTION_MACROS = YES
#---------------------------------------------------------------------------
# Configuration::additions related to external references
#---------------------------------------------------------------------------
# The TAGFILES option can be used to specify one or more tagfiles.
# Optionally an initial location of the external documentation
# can be added for each tagfile. The format of a tag file without
# this location is as follows:
#
# TAGFILES = file1 file2 ...
# Adding location for the tag files is done as follows:
#
# TAGFILES = file1=loc1 "file2 = loc2" ...
# where "loc1" and "loc2" can be relative or absolute paths or
# URLs. If a location is present for each tag, the installdox tool
# does not have to be run to correct the links.
# Note that each tag file must have a unique name
# (where the name does NOT include the path)
# If a tag file is not located in the directory in which doxygen
# is run, you must also specify the path to the tagfile here.
TAGFILES = @BLUEBERRY_DOXYGEN_TAGFILE@
# When a file name is specified after GENERATE_TAGFILE, doxygen will create
# a tag file that is based on the input files it reads.
GENERATE_TAGFILE = @MITK_DOXYGEN_TAGFILE_NAME@
# If the ALLEXTERNALS tag is set to YES all external classes will be listed
# in the class index. If set to NO only the inherited external classes
# will be listed.
ALLEXTERNALS = NO
# If the EXTERNAL_GROUPS tag is set to YES all external groups will be listed
# in the modules index. If set to NO, only the current project's groups will
# be listed.
EXTERNAL_GROUPS = NO
# The PERL_PATH should be the absolute path and name of the perl script
# interpreter (i.e. the result of `which perl').
PERL_PATH = /usr/bin/perl
#---------------------------------------------------------------------------
# Configuration options related to the dot tool
#---------------------------------------------------------------------------
# If the CLASS_DIAGRAMS tag is set to YES (the default) Doxygen will
# generate a inheritance diagram (in HTML, RTF and LaTeX) for classes with base
# or super classes. Setting the tag to NO turns the diagrams off. Note that
# this option also works with HAVE_DOT disabled, but it is recommended to
# install and use dot, since it yields more powerful graphs.
CLASS_DIAGRAMS = YES
# You can define message sequence charts within doxygen comments using the \msc
# command. Doxygen will then run the mscgen tool (see
# http://www.mcternan.me.uk/mscgen/) to produce the chart and insert it in the
# documentation. The MSCGEN_PATH tag allows you to specify the directory where
# the mscgen tool resides. If left empty the tool is assumed to be found in the
# default search path.
MSCGEN_PATH =
# If set to YES, the inheritance and collaboration graphs will hide
# inheritance and usage relations if the target is undocumented
# or is not a class.
HIDE_UNDOC_RELATIONS = YES
# If you set the HAVE_DOT tag to YES then doxygen will assume the dot tool is
# available from the path. This tool is part of Graphviz, a graph visualization
# toolkit from AT&T and Lucent Bell Labs. The other options in this section
# have no effect if this option is set to NO (the default)
HAVE_DOT = @HAVE_DOT@
# The DOT_NUM_THREADS specifies the number of dot invocations doxygen is
# allowed to run in parallel. When set to 0 (the default) doxygen will
# base this on the number of processors available in the system. You can set it
# explicitly to a value larger than 0 to get control over the balance
# between CPU load and processing speed.
DOT_NUM_THREADS = @MITK_DOXYGEN_DOT_NUM_THREADS@
-# By default doxygen will write a font called FreeSans.ttf to the output
-# directory and reference it in all dot files that doxygen generates. This
-# font does not include all possible unicode characters however, so when you need
-# these (or just want a differently looking font) you can specify the font name
-# using DOT_FONTNAME. You need need to make sure dot is able to find the font,
+# By default doxygen will write a font called Helvetica to the output
+# directory and reference it in all dot files that doxygen generates.
+# When you want a differently looking font you can specify the font name
+# using DOT_FONTNAME. You need to make sure dot is able to find the font,
# which can be done by putting it in a standard location or by setting the
# DOTFONTPATH environment variable or by setting DOT_FONTPATH to the directory
# containing the font.
DOT_FONTNAME = FreeSans.ttf
# The DOT_FONTSIZE tag can be used to set the size of the font of dot graphs.
# The default size is 10pt.
DOT_FONTSIZE = 10
# By default doxygen will tell dot to use the output directory to look for the
# FreeSans.ttf font (which doxygen will put there itself). If you specify a
# different font using DOT_FONTNAME you can set the path where dot
# can find it using this tag.
DOT_FONTPATH =
# If the CLASS_GRAPH and HAVE_DOT tags are set to YES then doxygen
# will generate a graph for each documented class showing the direct and
# indirect inheritance relations. Setting this tag to YES will force the
# the CLASS_DIAGRAMS tag to NO.
CLASS_GRAPH = YES
# If the COLLABORATION_GRAPH and HAVE_DOT tags are set to YES then doxygen
# will generate a graph for each documented class showing the direct and
# indirect implementation dependencies (inheritance, containment, and
# class references variables) of the class with other documented classes.
COLLABORATION_GRAPH = YES
# If the GROUP_GRAPHS and HAVE_DOT tags are set to YES then doxygen
# will generate a graph for groups, showing the direct groups dependencies
GROUP_GRAPHS = YES
# If the UML_LOOK tag is set to YES doxygen will generate inheritance and
# collaboration diagrams in a style similar to the OMG's Unified Modeling
# Language.
UML_LOOK = @MITK_DOXYGEN_UML_LOOK@
# If set to YES, the inheritance and collaboration graphs will show the
# relations between templates and their instances.
TEMPLATE_RELATIONS = YES
# If the ENABLE_PREPROCESSING, SEARCH_INCLUDES, INCLUDE_GRAPH, and HAVE_DOT
# tags are set to YES then doxygen will generate a graph for each documented
# file showing the direct and indirect include dependencies of the file with
# other documented files.
INCLUDE_GRAPH = NO
# If the ENABLE_PREPROCESSING, SEARCH_INCLUDES, INCLUDED_BY_GRAPH, and
# HAVE_DOT tags are set to YES then doxygen will generate a graph for each
# documented header file showing the documented files that directly or
# indirectly include this file.
INCLUDED_BY_GRAPH = NO
# If the CALL_GRAPH and HAVE_DOT options are set to YES then
# doxygen will generate a call dependency graph for every global function
# or class method. Note that enabling this option will significantly increase
# the time of a run. So in most cases it will be better to enable call graphs
# for selected functions only using the \callgraph command.
CALL_GRAPH = NO
# If the CALLER_GRAPH and HAVE_DOT tags are set to YES then
# doxygen will generate a caller dependency graph for every global function
# or class method. Note that enabling this option will significantly increase
# the time of a run. So in most cases it will be better to enable caller
# graphs for selected functions only using the \callergraph command.
CALLER_GRAPH = NO
# If the GRAPHICAL_HIERARCHY and HAVE_DOT tags are set to YES then doxygen
# will generate a graphical hierarchy of all classes instead of a textual one.
GRAPHICAL_HIERARCHY = NO
# If the DIRECTORY_GRAPH, SHOW_DIRECTORIES and HAVE_DOT tags are set to YES
# then doxygen will show the dependencies a directory has on other directories
# in a graphical way. The dependency relations are determined by the #include
# relations between the files in the directories.
DIRECTORY_GRAPH = YES
# The DOT_IMAGE_FORMAT tag can be used to set the image format of the images
-# generated by dot. Possible values are png, jpg, or gif.
+# generated by dot. Possible values are png, svg, gif or svg.
# If left blank png will be used.
DOT_IMAGE_FORMAT = png
# The tag DOT_PATH can be used to specify the path where the dot tool can be
# found. If left blank, it is assumed the dot tool can be found in the path.
DOT_PATH = @DOXYGEN_DOT_PATH@
# The DOTFILE_DIRS tag can be used to specify one or more directories that
# contain dot files that are included in the documentation (see the
# \dotfile command).
DOTFILE_DIRS =
# The MSCFILE_DIRS tag can be used to specify one or more directories that
# contain msc files that are included in the documentation (see the
# \mscfile command).
MSCFILE_DIRS =
# The DOT_GRAPH_MAX_NODES tag can be used to set the maximum number of
# nodes that will be shown in the graph. If the number of nodes in a graph
# becomes larger than this value, doxygen will truncate the graph, which is
# visualized by representing a node as a red box. Note that doxygen if the
# number of direct children of the root node in a graph is already larger than
# DOT_GRAPH_MAX_NODES then the graph will not be shown at all. Also note
# that the size of a graph can be further restricted by MAX_DOT_GRAPH_DEPTH.
DOT_GRAPH_MAX_NODES = 50
# The MAX_DOT_GRAPH_DEPTH tag can be used to set the maximum depth of the
# graphs generated by dot. A depth value of 3 means that only nodes reachable
# from the root by following a path via at most 3 edges will be shown. Nodes
# that lay further from the root node will be omitted. Note that setting this
# option to 1 or 2 may greatly reduce the computation time needed for large
# code bases. Also note that the size of a graph can be further restricted by
# DOT_GRAPH_MAX_NODES. Using a depth of 0 means no depth restriction.
MAX_DOT_GRAPH_DEPTH = 0
# Set the DOT_TRANSPARENT tag to YES to generate images with a transparent
# background. This is disabled by default, because dot on Windows does not
# seem to support this out of the box. Warning: Depending on the platform used,
# enabling this option may lead to badly anti-aliased labels on the edges of
# a graph (i.e. they become hard to read).
DOT_TRANSPARENT = NO
# Set the DOT_MULTI_TARGETS tag to YES allow dot to generate multiple output
# files in one run (i.e. multiple -o and -T options on the command line). This
# makes dot run faster, but since only newer versions of dot (>1.8.10)
# support this, this feature is disabled by default.
DOT_MULTI_TARGETS = NO
# If the GENERATE_LEGEND tag is set to YES (the default) Doxygen will
# generate a legend page explaining the meaning of the various boxes and
# arrows in the dot generated graphs.
GENERATE_LEGEND = YES
# If the DOT_CLEANUP tag is set to YES (the default) Doxygen will
# remove the intermediate dot files that are used to generate
# the various graphs.
DOT_CLEANUP = YES
diff --git a/MITKConfig.cmake.in b/MITKConfig.cmake.in
index c0708af8ac..0203523c26 100644
--- a/MITKConfig.cmake.in
+++ b/MITKConfig.cmake.in
@@ -1,129 +1,132 @@
# Update the CMake module path
SET(CMAKE_MODULE_PATH ${CMAKE_MODULE_PATH} "@MITK_SOURCE_DIR@/CMake")
# Include MITK macros
include(MacroParseArguments)
include(mitkFunctionOrganizeSources)
include(mitkFunctionCreateWindowsBatchScript)
include(mitkFunctionInstallProvisioningFiles)
include(mitkMacroCreateModuleConf)
include(mitkMacroCreateModule)
include(mitkMacroCheckModule)
include(mitkMacroCreateModuleTests)
include(mitkFunctionAddCustomModuleTest)
include(mitkMacroUseModule)
include(mitkMacroMultiplexPicType)
include(mitkMacroInstall)
include(mitkMacroInstallHelperApp)
include(mitkMacroInstallTargets)
include(mitkMacroGenerateToolsLibrary)
+include(mitkMacroCreateCTKPlugin)
# The MITK version number
SET(MITK_VERSION_MAJOR "@MITK_VERSION_MAJOR@")
SET(MITK_VERSION_MINOR "@MITK_VERSION_MINOR@")
SET(MITK_VERSION_PATCH "@MITK_VERSION_PATCH@")
# MITK specific variables
SET(MITK_SOURCE_DIR "@MITK_SOURCE_DIR@")
SET(MITK_BINARY_DIR "@MITK_BINARY_DIR@")
SET(UTILITIES_DIR "@UTILITIES_DIR@")
SET(REGISTER_QFUNCTIONALITY_CPP_IN "@REGISTER_QFUNCTIONALITY_CPP_IN@")
SET(MITK_MODULES_CONF_DIR "@MITK_MODULES_CONF_DIR@")
SET(MITK_MODULES_PACKAGE_DEPENDS_DIR "@MITK_MODULES_PACKAGE_DEPENDS_DIR@")
SET(MODULES_PACKAGE_DEPENDS_DIRS "@MODULES_PACKAGE_DEPENDS_DIRS@")
SET(MITK_DOXYGEN_TAGFILE_NAME "@MITK_DOXYGEN_TAGFILE_NAME@")
# Include directory variables
SET(MITK_INCLUDE_DIRS "@MITK_INCLUDE_DIRS@")
SET(QMITK_INCLUDE_DIRS "@QMITK_INCLUDE_DIRS@")
SET(ANN_INCLUDE_DIR "@ANN_INCLUDE_DIR@")
SET(IPSEGMENTATION_INCLUDE_DIR "@IPSEGMENTATION_INCLUDE_DIR@")
SET(VECMATH_INCLUDE_DIR "@VECMATH_INCLUDE_DIR@")
SET(IPFUNC_INCLUDE_DIR "@IPFUNC_INCLUDE_DIR@")
SET(MITK_IGT_INCLUDE_DIRS "@MITK_IGT_INCLUDE_DIRS@")
# Library variables
SET(MITK_LIBRARIES "@MITK_LIBRARIES@")
SET(QMITK_LIBRARIES "@QMITK_LIBRARIES@")
# Link directory variables
SET(MITK_LINK_DIRECTORIES "@MITK_LINK_DIRECTORIES@")
SET(QMITK_LINK_DIRECTORIES "@QMITK_LINK_DIRECTORIES@")
SET(MITK_LIBRARY_DIRS "@CMAKE_LIBRARY_OUTPUT_DIRECTORY@" "@CMAKE_LIBRARY_OUTPUT_DIRECTORY@/plugins")
-SET(MITK_VTK_LIBRARY_DIRS "@VTK_LIBRARY_DIRS@")
-SET(MITK_ITK_LIBRARY_DIRS "@ITK_LIBRARY_DIRS@")
+SET(MITK_VTK_LIBRARY_DIRS "@MITK_VTK_LIBRARY_DIRS@")
+SET(MITK_ITK_LIBRARY_DIRS "@MITK_ITK_LIBRARY_DIRS@")
# External projects
SET(ITK_DIR "@ITK_DIR@")
SET(VTK_DIR "@VTK_DIR@")
SET(DCMTK_DIR "@DCMTK_DIR@")
SET(GDCM_DIR "@GDCM_DIR@")
SET(BOOST_ROOT "@BOOST_ROOT@")
SET(OpenCV_DIR "@OpenCV_DIR@")
SET(MITK_QMAKE_EXECUTABLE "@QT_QMAKE_EXECUTABLE@")
SET(MITK_DATA_DIR "@MITK_DATA_DIR@")
SET(MITK_RUNTIME_PATH "@MITK_RUNTIME_PATH@")
# MITK use variables
SET(MITK_USE_QT @MITK_USE_QT@)
SET(MITK_USE_BLUEBERRY @MITK_USE_BLUEBERRY@)
SET(MITK_USE_Boost @MITK_USE_Boost@)
SET(MITK_USE_CTK @MITK_USE_CTK@)
SET(MITK_USE_DCMTK @MITK_USE_DCMTK@)
SET(MITK_USE_OpenCV @MITK_USE_OpenCV@)
# There is no PocoConfig.cmake, so we set Poco specific CMake variables
# here. This way the call to FIND_PACKAGE(Poco) in BlueBerryConfig.cmake
# finds the Poco distribution supplied by MITK
SET(Poco_INCLUDE_DIR "@MITK_SOURCE_DIR@/Utilities/Poco")
SET(Poco_LIBRARY_DIR "@MITK_BINARY_DIR@/bin")
IF(MITK_USE_IGT)
#INCLUDE(${MITK_DIR}/mitkIGTConfig.cmake)
ENDIF()
IF(NOT MITK_EXPORTS_FILE_INCLUDED)
- SET(MITK_EXPORTS_FILE_INCLUDED 1)
- INCLUDE("@MITK_EXPORTS_FILE@")
+ IF(EXISTS "@MITK_EXPORTS_FILE@")
+ SET(MITK_EXPORTS_FILE_INCLUDED 1)
+ INCLUDE("@MITK_EXPORTS_FILE@")
+ ENDIF(EXISTS "@MITK_EXPORTS_FILE@")
ENDIF()
# BlueBerry support
IF(MITK_USE_BLUEBERRY)
SET(BlueBerry_DIR "@MITK_BINARY_DIR@/BlueBerry")
INCLUDE(mitkMacroCreatePlugin)
IF(NOT MITK_SKIP_BUNDLELIST)
IF(MITK_USE_EXT)
INCLUDE("@MITK_BINARY_DIR@/Bundles/MITKModulesBundleList.cmake")
ENDIF()
ENDIF(NOT MITK_SKIP_BUNDLELIST)
# Don't include the BlueBerry exports file, since the targets are
# also exported in the MITK exports file
SET(BB_PLUGIN_EXPORTS_FILE_INCLUDED 1)
FIND_PACKAGE(BlueBerry)
IF(NOT BlueBerry_FOUND)
MESSAGE(SEND_ERROR "MITK does not seem to be configured with BlueBerry support. Set MITK_USE_BLUEBERRY to ON in your MITK build configuration.")
ENDIF(NOT BlueBerry_FOUND)
SET(MITK_PLUGIN_SOURCE_DIRS "@MITK_SOURCE_DIR@/Bundles")
SET(MITK_PLUGIN_OUTPUT_DIRS )
IF(MITK_USE_EXT)
LIST(APPEND MITK_PLUGIN_OUTPUT_DIRS @MITK_MODULES_PLUGIN_OUTPUT_DIRS@)
ENDIF()
INCLUDE("@MITK_PLUGIN_USE_FILE@")
#SET(CTK_PLUGIN_LIBRARIES ${CTK_PLUGIN_LIBRARIES} @MITK_PLUGIN_TARGETS@)
SET(MITK_PLUGIN_PROVISIONING_FILE "@MITK_EXTAPP_PROVISIONING_FILE@")
SET(MITK_PROVISIONING_FILES
"${BLUEBERRY_PLUGIN_PROVISIONING_FILE}"
"${MITK_PLUGIN_PROVISIONING_FILE}")
ENDIF(MITK_USE_BLUEBERRY)
diff --git a/Modules/Bundles/CMakeLists.txt b/Modules/Bundles/CMakeLists.txt
index 1a2eb6b147..af31859ec0 100644
--- a/Modules/Bundles/CMakeLists.txt
+++ b/Modules/Bundles/CMakeLists.txt
@@ -1,53 +1,66 @@
IF(MITK_USE_BLUEBERRY)
SET(MITK_DEFAULT_SUBPROJECTS MITK-Plugins)
SET(_mitk_bundles_default
)
IF(QT4_FOUND)
LIST(APPEND _mitk_bundles_default "org.mitk.gui.qt.imagenavigator")
# BlueBerry depends on CTK which depends on Qt, so we
# need the Qt include direcotries
INCLUDE(${QT_USE_FILE})
ENDIF()
SET(PLUGIN_EXCLUDE_LIST
org.mitk.core.ext
org.mitk.gui.qt.volumetry
org.mitk.core.jobs
org.mitk.diffusionimaging
org.mitk.gui.qt.diffusionimaging
+ org.mitk.gui.qt.diffusionimagingapp
org.mitk.gui.qt.ext
org.mitk.gui.qt.extapplication
org.mitk.gui.qt.datamanager
org.mitk.gui.qt.regiongrowing
org.mitk.gui.qt.segmentation
org.mitk.planarfigure
org.mitk.gui.qt.igtnavigationtoolmanager
org.mitk.gui.qt.igttrackingtoolbox
+ org.mitk.gui.qt.igttutorial
org.mitk.gui.qt.igttoolpairnavigation
org.mitk.gui.qt.basicimageprocessing
org.mitk.gui.qt.colourimageprocessing
org.mitk.gui.qt.navigationdataplayer
org.mitk.gui.qt.tofutil
+ org.mitk.gui.qt.toftutorial
org.mitk.gui.qt.imagenavigator
org.mitk.gui.qt.moviemaker
org.mitk.gui.qt.deformableregistration
org.mitk.gui.qt.rigidregistration
- )
+ org.mitk.gui.qt.imagestatistics
+ org.mitk.gui.qt.materialeditor
+ org.mitk.gui.qt.simpleexample
+ org.mitk.gui.qt.ugvisualization
+ org.mitk.gui.qt.measurement
+ org.mitk.gui.qt.simplemeasurement
+ org.mitk.gui.qt.imagecropper
+ org.mitk.gui.qt.pointbasedregistration
+ org.mitk.gui.qt.viewinitialization
+ org.mitk.gui.qt.volumevisualization
+ )
MACRO_COLLECT_PLUGINS(OUTPUT_DIR ${CMAKE_RUNTIME_OUTPUT_DIRECTORY}/ExtBundles
CACHE_PLUGIN_SOURCE_DIRS MITK_MODULES_PLUGIN_SOURCE_DIRS
CACHE_PLUGIN_OUTPUT_DIRS MITK_MODULES_PLUGIN_OUTPUT_DIRS
CACHE_PLUGIN_TARGETS MITK_MODULES_ENABLED_PLUGINS
BUNDLE_LIST_PATH "${MITK_BINARY_DIR}/Bundles/MITKModulesBundleList.cmake"
CMAKE_CACHE_PREFIX "MITK"
PLUGIN_DEFAULT_ON ${_mitk_bundles_default}
PLUGIN_EXCLUDES ${PLUGIN_EXCLUDE_LIST}
${MITK_BUILD_ALL_PLUGINS_OPTION})
ENDIF(MITK_USE_BLUEBERRY)
diff --git a/Modules/Bundles/PluginList.cmake b/Modules/Bundles/PluginList.cmake
index 6ac1c79c8e..4d76c3e25f 100644
--- a/Modules/Bundles/PluginList.cmake
+++ b/Modules/Bundles/PluginList.cmake
@@ -1,23 +1,37 @@
SET(MITK_EXT_PLUGINS
org.mitk.core.ext:ON
org.mitk.core.jobs:OFF
+ org.mitk.planarfigure:ON
org.mitk.diffusionimaging:OFF
- org.mitk.gui.qt.diffusionimaging:OFF
org.mitk.gui.qt.ext:ON
org.mitk.gui.qt.extapplication:ON
- org.mitk.gui.qt.segmentation:OFF
- org.mitk.planarfigure:ON
org.mitk.gui.qt.datamanager:ON
+ org.mitk.gui.qt.segmentation:OFF
+ org.mitk.gui.qt.diffusionimaging:OFF
+ org.mitk.gui.qt.diffusionimagingapp:OFF
org.mitk.gui.qt.igtnavigationtoolmanager:OFF
- org.mitk.gui.qt.igttoolpairnavigation:ON
+ org.mitk.gui.qt.igttoolpairnavigation:OFF
org.mitk.gui.qt.igttrackingtoolbox:OFF
org.mitk.gui.qt.regiongrowing:OFF
- org.mitk.gui.qt.navigationdataplayer:ON
+ org.mitk.gui.qt.navigationdataplayer:OFF
org.mitk.gui.qt.basicimageprocessing:OFF
+ org.mitk.gui.qt.igttutorial:OFF
org.mitk.gui.qt.colourimageprocessing:OFF
org.mitk.gui.qt.tofutil:OFF
+ org.mitk.gui.qt.toftutorial:OFF
org.mitk.gui.qt.imagenavigator:ON
- org.mitk.gui.qt.moviemaker:ON
- org.mitk.gui.qt.deformableregistration:ON
- org.mitk.gui.qt.rigidregistration:ON
+ org.mitk.gui.qt.moviemaker:OFF
+ org.mitk.gui.qt.deformableregistration:OFF
+ org.mitk.gui.qt.rigidregistration:OFF
+ org.mitk.gui.qt.imagestatistics:OFF
+ org.mitk.gui.qt.volumetry:OFF
+ org.mitk.gui.qt.materialeditor:OFF
+ org.mitk.gui.qt.simpleexample:OFF
+ org.mitk.gui.qt.ugvisualization:OFF
+ org.mitk.gui.qt.measurement:OFF
+ org.mitk.gui.qt.simplemeasurement:OFF
+ org.mitk.gui.qt.imagecropper:OFF
+ org.mitk.gui.qt.pointbasedregistration:OFF
+ org.mitk.gui.qt.viewinitialization:OFF
+ org.mitk.gui.qt.volumevisualization:OFF
)
diff --git a/Modules/Bundles/org.mitk.diffusionimaging/src/internal/mitkDiffusionImagingActivator.cpp b/Modules/Bundles/org.mitk.diffusionimaging/src/internal/mitkDiffusionImagingActivator.cpp
index 167af0b088..46cc665a87 100644
--- a/Modules/Bundles/org.mitk.diffusionimaging/src/internal/mitkDiffusionImagingActivator.cpp
+++ b/Modules/Bundles/org.mitk.diffusionimaging/src/internal/mitkDiffusionImagingActivator.cpp
@@ -1,54 +1,57 @@
/*=========================================================================
Program: Medical Imaging & Interaction Toolkit
Language: C++
Date: $Date: 2009-07-14 19:11:20 +0200 (Tue, 14 Jul 2009) $
Version: $Revision: 18127 $
Copyright (c) German Cancer Research Center, Division of Medical and
Biological Informatics. All rights reserved.
See MITKCopyright.txt or http://www.mitk.org/copyright.html for details.
This software is distributed WITHOUT ANY WARRANTY; without even
the implied warranty of MERCHANTABILITY or FITNESS FOR A PARTICULAR
PURPOSE. See the above copyright notices for more information.
=========================================================================*/
#include "mitkDiffusionImagingActivator.h"
#include "mitkDiffusionImagingObjectFactory.h"
#include "QmitkNodeDescriptorManager.h"
#include "mitkNodePredicateDataType.h"
#include <QtPlugin>
void
mitk::DiffusionImagingActivator::start(ctkPluginContext* context)
{
Q_UNUSED(context)
RegisterDiffusionImagingObjectFactory();
QmitkNodeDescriptorManager* manager =
QmitkNodeDescriptorManager::GetInstance();
mitk::NodePredicateDataType::Pointer isDiffusionImage = mitk::NodePredicateDataType::New("DiffusionImage");
QmitkNodeDescriptor* desc = new QmitkNodeDescriptor(QObject::tr("DiffusionImage"), QString(":/QmitkDiffusionImaging/QBallData24.png"), isDiffusionImage, manager);
manager->AddDescriptor(desc);
mitk::NodePredicateDataType::Pointer isTensorImage = mitk::NodePredicateDataType::New("TensorImage");
manager->AddDescriptor(new QmitkNodeDescriptor(QObject::tr("TensorImage"), QString(":/QmitkDiffusionImaging/recontensor.png"), isTensorImage, manager));
mitk::NodePredicateDataType::Pointer isQBallImage = mitk::NodePredicateDataType::New("QBallImage");
manager->AddDescriptor(new QmitkNodeDescriptor(QObject::tr("QBallImage"), QString(":/QmitkDiffusionImaging/reconodf.png"), isQBallImage, manager));
+ mitk::NodePredicateDataType::Pointer isFiberBundle = mitk::NodePredicateDataType::New("FiberBundle");
+ manager->AddDescriptor(new QmitkNodeDescriptor(QObject::tr("FiberBundle"), QString(":/QmitkDiffusionImaging/FiberBundle.png"), isFiberBundle, manager));
+
}
void
mitk::DiffusionImagingActivator::stop(ctkPluginContext* context)
{
Q_UNUSED(context)
}
Q_EXPORT_PLUGIN2(org_mitk_diffusionimaging, mitk::DiffusionImagingActivator)
diff --git a/Modules/Bundles/org.mitk.gui.qt.diffusionimaging/files.cmake b/Modules/Bundles/org.mitk.gui.qt.diffusionimaging/files.cmake
index 213a109ef8..11ea4a277a 100644
--- a/Modules/Bundles/org.mitk.gui.qt.diffusionimaging/files.cmake
+++ b/Modules/Bundles/org.mitk.gui.qt.diffusionimaging/files.cmake
@@ -1,65 +1,76 @@
SET(SRC_CPP_FILES
-
+ QmitkODFDetailsWidget.cpp
+ QmitkODFRenderWidget.cpp
)
SET(INTERNAL_CPP_FILES
mitkPluginActivator.cpp
QmitkQBallReconstructionView.cpp
QmitkPreprocessingView.cpp
QmitkDiffusionDicomImportView.cpp
QmitkDiffusionQuantificationView.cpp
QmitkTensorReconstructionView.cpp
QmitkDiffusionImagingPublicPerspective.cpp
- QmitkControlVisualizationPropertiesView.cpp
+ QmitkControlVisualizationPropertiesView.cpp
+ QmitkODFDetailsView.cpp
+ QmitkGlobalFiberTrackingView.cpp
)
SET(UI_FILES
src/internal/QmitkQBallReconstructionViewControls.ui
src/internal/QmitkPreprocessingViewControls.ui
src/internal/QmitkDiffusionDicomImportViewControls.ui
src/internal/QmitkDiffusionQuantificationViewControls.ui
src/internal/QmitkTensorReconstructionViewControls.ui
- src/internal/QmitkControlVisualizationPropertiesViewControls.ui
+ src/internal/QmitkControlVisualizationPropertiesViewControls.ui
+ src/internal/QmitkODFDetailsViewControls.ui
+ src/internal/QmitkGlobalFiberTrackingViewControls.ui
)
SET(MOC_H_FILES
src/internal/mitkPluginActivator.h
src/internal/QmitkQBallReconstructionView.h
src/internal/QmitkPreprocessingView.h
src/internal/QmitkDiffusionDicomImportView.h
src/internal/QmitkDiffusionImagingPublicPerspective.h
src/internal/QmitkDiffusionQuantificationView.h
src/internal/QmitkTensorReconstructionView.h
- src/internal/QmitkControlVisualizationPropertiesView.h
+ src/internal/QmitkControlVisualizationPropertiesView.h
+ src/internal/QmitkODFDetailsView.h
+ src/QmitkODFRenderWidget.h
+ src/QmitkODFDetailsWidget.h
+ src/internal/QmitkGlobalFiberTrackingView.h
)
SET(CACHED_RESOURCE_FILES
# 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
plugin.xml
resources/preprocessing.png
resources/dwiimport.png
resources/quantification.png
resources/reconodf.png
resources/recontensor.png
resources/vizControls.png
+ resources/OdfDetails.png
+ resources/GlobalTracking.png
)
SET(QRC_FILES
# uncomment the following line if you want to use Qt resources
resources/QmitkDiffusionImaging.qrc
)
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/Modules/Bundles/org.mitk.gui.qt.diffusionimaging/plugin.xml b/Modules/Bundles/org.mitk.gui.qt.diffusionimaging/plugin.xml
index 14964e228f..fe30ab1d8a 100644
--- a/Modules/Bundles/org.mitk.gui.qt.diffusionimaging/plugin.xml
+++ b/Modules/Bundles/org.mitk.gui.qt.diffusionimaging/plugin.xml
@@ -1,54 +1,68 @@
<?xml version="1.0" encoding="UTF-8"?>
<?BlueBerry version="0.1"?>
<plugin>
-
+
<extension point="org.blueberry.ui.views">
<view id="org.mitk.views.qballreconstruction"
name="Q-Balls"
icon="resources/reconodf.png"
class="QmitkQBallReconstructionView" />
</extension>
<extension point="org.blueberry.ui.views">
<view id="org.mitk.views.diffusiondicomimport"
name="DICOM Import"
class="QmitkDiffusionDicomImport"
icon="resources/dwiimport.png" />
</extension>
<extension point="org.blueberry.ui.views">
<view id="org.mitk.views.diffusionpreprocessing"
name="Preprocessing"
class="QmitkPreprocessingView"
icon="resources/preprocessing.png" />
</extension>
-
+
<extension point="org.blueberry.ui.views">
<view id="org.mitk.views.diffusionquantification"
name="Quantification"
class="QmitkDiffusionQuantificationView"
icon="resources/quantification.png"/>
</extension>
<extension point="org.blueberry.ui.views">
<view id="org.mitk.views.tensorreconstruction"
name="Tensors"
icon="resources/recontensor.png"
class="QmitkTensorReconstructionView" />
</extension>
<extension point="org.blueberry.ui.views">
<view id="org.mitk.views.controlvisualizationpropertiesview"
name="Visualization"
icon="resources/vizControls.png"
class="QmitkControlVisualizationPropertiesView" />
</extension>
<extension point="org.blueberry.ui.perspectives">
<perspective id="org.mitk.perspectives.publicdiffusionimaging"
- name="Diffusion Imaging Public"
- class="QmitkDiffusionImagingPublicPerspective"
+ name="Diffusion Imaging Public"
+ class="QmitkDiffusionImagingPublicPerspective"
icon="resources/reconodf.png"/>
</extension>
+ <extension point="org.blueberry.ui.views">
+ <view id="org.mitk.views.odfdetails"
+ name="ODF Details"
+ class="QmitkODFDetailsView"
+ icon="resources/OdfDetails.png" />
+ </extension>
+
+ <extension point="org.blueberry.ui.views">
+ <view id="org.mitk.views.globalfibertracking"
+ name="Global Tracking"
+ class="QmitkGlobalFiberTrackingView"
+ icon="resources/GlobalTracking.png" />
+ </extension>
+
</plugin>
diff --git a/Modules/Bundles/org.mitk.gui.qt.diffusionimaging/resources/FiberBundle.png b/Modules/Bundles/org.mitk.gui.qt.diffusionimaging/resources/FiberBundle.png
new file mode 100644
index 0000000000..378292a1a0
Binary files /dev/null and b/Modules/Bundles/org.mitk.gui.qt.diffusionimaging/resources/FiberBundle.png differ
diff --git a/Modules/Bundles/org.mitk.gui.qt.diffusionimaging/resources/GlobalTracking.png b/Modules/Bundles/org.mitk.gui.qt.diffusionimaging/resources/GlobalTracking.png
new file mode 100644
index 0000000000..d875ea96bd
Binary files /dev/null and b/Modules/Bundles/org.mitk.gui.qt.diffusionimaging/resources/GlobalTracking.png differ
diff --git a/Modules/Bundles/org.mitk.gui.qt.diffusionimaging/resources/OdfDetails.png b/Modules/Bundles/org.mitk.gui.qt.diffusionimaging/resources/OdfDetails.png
new file mode 100644
index 0000000000..c1eff6a986
Binary files /dev/null and b/Modules/Bundles/org.mitk.gui.qt.diffusionimaging/resources/OdfDetails.png differ
diff --git a/Modules/Bundles/org.mitk.gui.qt.diffusionimaging/resources/QmitkDiffusionImaging.qrc b/Modules/Bundles/org.mitk.gui.qt.diffusionimaging/resources/QmitkDiffusionImaging.qrc
index dd1bbbb2c5..791d03ae51 100644
--- a/Modules/Bundles/org.mitk.gui.qt.diffusionimaging/resources/QmitkDiffusionImaging.qrc
+++ b/Modules/Bundles/org.mitk.gui.qt.diffusionimaging/resources/QmitkDiffusionImaging.qrc
@@ -1,22 +1,23 @@
<RCC>
<qresource prefix="/QmitkDiffusionImaging">
<file>qball.png</file>
<file>tensor.png</file>
<file>dwi.png</file>
<file>dwiimport.png</file>
<file>quantification.png</file>
<file>reconodf.png</file>
<file>recontensor.png</file>
<file>texIntONIcon.png</file>
<file>texIntOFFIcon.png</file>
<file>vizControls.png</file>
<file>Refresh_48.png</file>
<file>QBallData24.png</file>
<file>glyphsoff_C.png</file>
<file>glyphsoff_S.png</file>
<file>glyphsoff_T.png</file>
<file>glyphson_C.png</file>
<file>glyphson_S.png</file>
<file>glyphson_T.png</file>
+ <file>FiberBundle.png</file>
</qresource>
</RCC>
diff --git a/Modules/Bundles/org.mitk.gui.qt.diffusionimaging/resources/odf.png b/Modules/Bundles/org.mitk.gui.qt.diffusionimaging/resources/odf.png
new file mode 100644
index 0000000000..748b29bfc5
Binary files /dev/null and b/Modules/Bundles/org.mitk.gui.qt.diffusionimaging/resources/odf.png differ
diff --git a/Modules/Bundles/org.mitk.gui.qt.diffusionimaging/src/QmitkODFDetailsWidget.cpp b/Modules/Bundles/org.mitk.gui.qt.diffusionimaging/src/QmitkODFDetailsWidget.cpp
new file mode 100644
index 0000000000..7aec1014fe
--- /dev/null
+++ b/Modules/Bundles/org.mitk.gui.qt.diffusionimaging/src/QmitkODFDetailsWidget.cpp
@@ -0,0 +1,98 @@
+/*=========================================================================
+Copyright (c) German Cancer Research Center, Division of Medical and
+Biological Informatics. All rights reserved.
+See MITKCopyright.txt or http://www.mitk.org/copyright.html for details.
+
+This software is distributed WITHOUT ANY WARRANTY; without even
+the implied warranty of MERCHANTABILITY or FITNESS FOR A PARTICULAR
+PURPOSE. See the above copyright notices for more information.
+
+=========================================================================*/
+
+#include "QmitkODFDetailsWidget.h"
+
+#include "mitkHistogramGenerator.h"
+
+#include <qlabel.h>
+#include <qpen.h>
+#include <qgroupbox.h>
+//#include <qmargins.h>
+
+
+#include <vtkQtChartArea.h>
+#include <vtkQtChartTableSeriesModel.h>
+#include <vtkQtChartStyleManager.h>
+#include <vtkQtChartColorStyleGenerator.h>
+
+#include <vtkQtChartMouseSelection.h>
+#include <vtkQtChartInteractorSetup.h>
+#include <vtkQtChartSeriesSelectionHandler.h>
+#include <vtkQtChartAxisLayer.h>
+#include <vtkQtChartAxis.h>
+#include <vtkQtChartAxisOptions.h>
+#include <vtkQtChartLegend.h>
+#include <vtkQtChartLegendManager.h>
+
+#include <qwt_scale_engine.h>
+#include <qwt_legend.h>
+
+//#include <iostream>
+
+QmitkODFDetailsWidget::QmitkODFDetailsWidget( QWidget * parent )
+ : QmitkPlotWidget(parent)
+{
+ // this->SetAxisTitle( QwtPlot::xBottom, "Grayvalue" );
+ // this->SetAxisTitle( QwtPlot::yLeft, "Probability" );
+ // this->Replot();
+ m_Plot->setCanvasLineWidth(0);
+ m_Plot->setMargin(0);
+
+ QwtLinearScaleEngine* logScale = new QwtLinearScaleEngine();
+ m_Plot->setAxisScaleEngine(0, logScale);
+
+ m_Plot->setAxisScale ( 0, -0.5, 0.5 );
+}
+
+QmitkODFDetailsWidget::~QmitkODFDetailsWidget()
+{
+}
+
+std::vector<double> QmitkODFDetailsWidget::vec(vnl_vector<double> vector)
+{
+ std::vector<double> retval(vector.size());
+ for(unsigned int i=0; i<vector.size(); i++)
+ {
+ retval.at(i) = vector[i];
+ }
+ return retval;
+}
+
+void QmitkODFDetailsWidget::SetParameters( std::vector<double> odfVals )
+{
+ this->Clear();
+
+ std::vector<double> xVals;
+ float max = -1;
+ float min = 1;
+ for (int i=0; i<odfVals.size(); i++){
+ xVals.push_back(i);
+ if (odfVals.at(i)>max)
+ max = odfVals.at(i);
+ if (odfVals.at(i)<min)
+ min = odfVals.at(i);
+ }
+ if(min>0)
+ m_Plot->setAxisScale ( 0, 0, max );
+ else
+ m_Plot->setAxisScale ( 0, min, max );
+
+ int curveId = this->InsertCurve( "ODF Values" );
+ this->SetCurveData( curveId, xVals, odfVals );
+ this->SetCurvePen( curveId, QPen(Qt::blue, 0.5, Qt::SolidLine, Qt::RoundCap, Qt::RoundJoin) );
+
+ QwtLegend* legend = new QwtLegend();
+ m_Plot->insertLegend(legend, QwtPlot::BottomLegend);
+
+ this->Replot();
+}
+
diff --git a/Modules/Bundles/org.mitk.gui.qt.diffusionimaging/src/QmitkODFDetailsWidget.h b/Modules/Bundles/org.mitk.gui.qt.diffusionimaging/src/QmitkODFDetailsWidget.h
new file mode 100644
index 0000000000..e0bee67aaa
--- /dev/null
+++ b/Modules/Bundles/org.mitk.gui.qt.diffusionimaging/src/QmitkODFDetailsWidget.h
@@ -0,0 +1,66 @@
+/*=========================================================================
+
+Program: Medical Imaging & Interaction Toolkit
+Language: C++
+Date: $Date: 2009-05-15 18:09:46 +0200 (Fr, 15 Mai 2009) $
+Version: $Revision: 1.12 $
+
+Copyright (c) German Cancer Research Center, Division of Medical and
+Biological Informatics. All rights reserved.
+See MITKCopyright.txt or http://www.mitk.org/copyright.html for details.
+
+This software is distributed WITHOUT ANY WARRANTY; without even
+the implied warranty of MERCHANTABILITY or FITNESS FOR A PARTICULAR
+PURPOSE. See the above copyright notices for more information.
+
+=========================================================================*/
+
+#ifndef QmitkODFDetailsWidget_H_
+#define QmitkODFDetailsWidget_H_
+
+#include "QmitkPlotWidget.h"
+#include "MitkDiffusionImagingExports.h"
+
+#include "QmitkHistogram.h"
+#include "mitkImage.h"
+#include "mitkPlanarFigure.h"
+
+#include <qlayout.h>
+#include <qtextedit.h>
+#include <qdialog.h>
+
+#include <itkHistogram.h>
+
+#include <vtkQtChartWidget.h>
+#include <vtkQtBarChart.h>
+
+#include <QStandardItemModel>
+
+
+/**
+ * \brief Widget for displaying image histograms based on the vtkQtChart
+ * framework
+ */
+class MitkDiffusionImaging_EXPORT QmitkODFDetailsWidget : public QmitkPlotWidget
+{
+Q_OBJECT
+
+public:
+
+ typedef mitk::Image::HistogramType HistogramType;
+ typedef mitk::Image::HistogramType::ConstIterator HistogramConstIteratorType;
+
+ void SetParameters( std::vector<double> odfVals );
+
+ QmitkODFDetailsWidget( QWidget * /*parent = 0 */);
+ virtual ~QmitkODFDetailsWidget();
+
+ std::vector<double> m_Vals;
+
+private:
+
+ std::vector<double> vec(vnl_vector<double> vector);
+
+};
+
+#endif /* QmitkODFDetailsWidget_H_ */
diff --git a/Modules/Bundles/org.mitk.gui.qt.diffusionimaging/src/QmitkODFRenderWidget.cpp b/Modules/Bundles/org.mitk.gui.qt.diffusionimaging/src/QmitkODFRenderWidget.cpp
new file mode 100644
index 0000000000..2b612f7f72
--- /dev/null
+++ b/Modules/Bundles/org.mitk.gui.qt.diffusionimaging/src/QmitkODFRenderWidget.cpp
@@ -0,0 +1,115 @@
+/*=========================================================================
+
+Program: Medical Imaging & Interaction Toolkit
+Language: C++
+Date: $Date$
+Version: $Revision$
+
+Copyright (c) German Cancer Research Center, Division of Medical and
+Biological Informatics. All rights reserved.
+See MITKCopyright.txt or http://www.mitk.org/copyright.html for details.
+
+This software is distributed WITHOUT ANY WARRANTY; without even
+the implied warranty of MERCHANTABILITY or FITNESS FOR A PARTICULAR
+PURPOSE. See the above copyright notices for more information.
+
+=========================================================================*/
+
+#include "QmitkODFRenderWidget.h"
+#include <mitkLookupTable.h>
+#include <mitkLookupTableProperty.h>
+
+QmitkODFRenderWidget::QmitkODFRenderWidget(QWidget* parent, Qt::WindowFlags f): QWidget(parent, f)
+{
+ //create Layouts
+ QmitkODFRenderWidgetLayout = new QHBoxLayout( this );
+
+ //Set Layout to widget
+ this->setLayout(QmitkODFRenderWidgetLayout);
+
+ //Create RenderWindow
+ m_RenderWindow = new QmitkRenderWindow(this, "odf render widget");
+ m_RenderWindow->setMaximumSize(300,300);
+ //m_RenderWindow->SetLayoutIndex( 3 );
+ QmitkODFRenderWidgetLayout->addWidget( m_RenderWindow );
+}
+
+
+QmitkODFRenderWidget::~QmitkODFRenderWidget()
+{
+}
+
+void QmitkODFRenderWidget::GenerateODF( std::vector<double> odfVals )
+{
+ m_Surface = mitk::Surface::New();
+ m_ds = mitk::StandaloneDataStorage::New();
+ m_Node = mitk::DataNode::New();
+
+ vtkPolyData* m_TemplateOdf = itk::OrientationDistributionFunction<float,QBALL_ODFSIZE>::GetBaseMesh();
+
+ vtkPolyData *polyData = vtkPolyData::New();
+ vtkPoints *points = vtkPoints::New();
+ vtkFloatArray *scalars = vtkFloatArray::New();
+
+ double max = -10000;
+ double min = 10000;
+ for (int i=0; i<odfVals.size(); i++)
+ if(odfVals.at(i)<min)
+ min = odfVals.at(i);
+
+ if (min<0)
+ return;
+
+ for (int i=0; i<odfVals.size(); i++)
+ if(odfVals.at(i)>max)
+ max = odfVals.at(i);
+
+ if (std::abs(max)<mitk::eps)
+ max = 0.0001;
+
+ for (int i=0; i<odfVals.size(); i++){
+ double p[3];
+ m_TemplateOdf->GetPoints()->GetPoint(i,p);
+ double val = odfVals.at(i);
+
+ p[0] *= val;
+ p[1] *= val;
+ p[2] *= val;
+ points->InsertPoint(i,p);
+ scalars->InsertTuple1(i, 1-val/max);
+ }
+
+ polyData->SetPoints(points);
+ vtkCellArray* polys = m_TemplateOdf->GetPolys();
+ polyData->SetPolys(polys);
+ polyData->GetPointData()->SetScalars(scalars);
+
+ polys->Delete();
+ scalars->Delete();
+ points->Delete();
+
+ m_Surface->SetVtkPolyData(polyData);
+ m_Node->SetData(m_Surface);
+
+ mitk::LookupTable::Pointer mitkLut = mitk::LookupTable::New();
+ vtkLookupTable* vtkLut = mitkLut->GetVtkLookupTable();
+ vtkLut->SetTableRange(0, 1);
+
+ vtkLut->Build();
+ mitk::LookupTableProperty::Pointer mitkLutProp = mitk::LookupTableProperty::New();
+ mitkLutProp->SetLookupTable(mitkLut);
+ m_Node->SetProperty( "LookupTable", mitkLutProp );
+
+ m_Node->SetProperty("scalar visibility", mitk::BoolProperty::New(true));
+ m_Node->SetProperty("color mode", mitk::BoolProperty::New(true));
+ m_Node->SetProperty("material.specularCoefficient", mitk::FloatProperty::New(0.5));
+// m_Node->SetProperty("material.diffuseCoefficient", mitk::FloatProperty::New(0.05));
+// m_Node->SetProperty("material.ambientCoefficient", mitk::FloatProperty::New(0.5));
+// m_Node->SetProperty("material.interpolation", mitk::IntProperty::New(2));
+
+ m_ds->Add(m_Node);
+
+ m_RenderWindow->GetRenderer()->SetDataStorage( m_ds );
+ m_RenderWindow->GetRenderer()->SetMapperID( mitk::BaseRenderer::Standard3D );
+
+}
diff --git a/Modules/Bundles/org.mitk.gui.qt.diffusionimaging/src/QmitkODFRenderWidget.h b/Modules/Bundles/org.mitk.gui.qt.diffusionimaging/src/QmitkODFRenderWidget.h
new file mode 100644
index 0000000000..79cbe7afc5
--- /dev/null
+++ b/Modules/Bundles/org.mitk.gui.qt.diffusionimaging/src/QmitkODFRenderWidget.h
@@ -0,0 +1,60 @@
+/*=========================================================================
+
+Program: Medical Imaging & Interaction Toolkit
+Language: C++
+Date: $Date$
+Version: $Revision$
+
+Copyright (c) German Cancer Research Center, Division of Medical and
+Biological Informatics. All rights reserved.
+See MITKCopyright.txt or http://www.mitk.org/copyright.html for details.
+
+This software is distributed WITHOUT ANY WARRANTY; without even
+the implied warranty of MERCHANTABILITY or FITNESS FOR A PARTICULAR
+PURPOSE. See the above copyright notices for more information.
+
+=========================================================================*/
+
+#ifndef QmitkODFRenderWidget_H_
+#define QmitkODFRenderWidget_H_
+
+#include <MitkDiffusionImagingExports.h>
+
+#include <QWidget>
+#include <QmitkRenderWindow.h>
+#include <QBoxLayout>
+#include <vtkPolyData.h>
+#include <mitkSurface.h>
+#include <mitkDataNode.h>
+#include <itkOrientationDistributionFunction.h>
+#include <mitkStandaloneDataStorage.h>
+#include <vtkFloatArray.h>
+#include <vtkPointData.h>
+#include <vtkLookupTable.h>
+#include <vtkDoubleArray.h>
+#include <vtkCellData.h>
+#include <vtkSphereSource.h>
+#include <vtkPolyDataMapper.h>
+
+
+class MitkDiffusionImaging_EXPORT QmitkODFRenderWidget : public QWidget
+{
+ Q_OBJECT
+
+public:
+
+ QmitkODFRenderWidget( QWidget* parent = 0, Qt::WindowFlags f = 0 );
+ virtual ~QmitkODFRenderWidget();
+
+ void GenerateODF( std::vector<double> odfVals );
+
+protected:
+
+ QHBoxLayout* QmitkODFRenderWidgetLayout;
+ QmitkRenderWindow* m_RenderWindow;
+
+ mitk::Surface::Pointer m_Surface;
+ mitk::StandaloneDataStorage::Pointer m_ds;
+ mitk::DataNode::Pointer m_Node;
+};
+#endif /*QmitkODFRenderWidget_H_*/
diff --git a/Modules/Bundles/org.mitk.gui.qt.diffusionimaging/src/internal/QmitkControlVisualizationPropertiesView.cpp b/Modules/Bundles/org.mitk.gui.qt.diffusionimaging/src/internal/QmitkControlVisualizationPropertiesView.cpp
index 8bd40db33b..1cdc1cf345 100644
--- a/Modules/Bundles/org.mitk.gui.qt.diffusionimaging/src/internal/QmitkControlVisualizationPropertiesView.cpp
+++ b/Modules/Bundles/org.mitk.gui.qt.diffusionimaging/src/internal/QmitkControlVisualizationPropertiesView.cpp
@@ -1,1058 +1,1463 @@
/*=========================================================================
Program: Medical Imaging & Interaction Toolkit
Module: $RCSfile$
Language: C++
Date: $Date: 2009-05-28 17:19:30 +0200 (Do, 28 Mai 2009) $
Version: $Revision: 17495 $
Copyright (c) German Cancer Research Center, Division of Medical and
Biological Informatics. All rights reserved.
See MITKCopyright.txt or http://www.mitk.org/copyright.html for details.
This software is distributed WITHOUT ANY WARRANTY; without even
the implied warranty of MERCHANTABILITY or FITNESS FOR A PARTICULAR
PURPOSE. See the above copyright notices for more information.
=========================================================================*/
#include "QmitkControlVisualizationPropertiesView.h"
#include "mitkNodePredicateDataType.h"
#include "mitkDataNodeObject.h"
#include "mitkOdfNormalizationMethodProperty.h"
#include "mitkOdfScaleByProperty.h"
#include "mitkResliceMethodProperty.h"
#include "mitkRenderingManager.h"
#include "mitkDiffusionImage.h"
-
+#include "mitkPlanarFigure.h"
+#include "mitkFiberBundle.h"
#include "QmitkDataStorageComboBox.h"
#include "QmitkStdMultiWidget.h"
+#include "mitkFiberBundleInteractor.h"
+#include "mitkPlanarFigureInteractor.h"
+
+#include "mitkGlobalInteraction.h"
+
+#include "mitkGeometry2D.h"
#include "berryIWorkbenchWindow.h"
#include "berryIWorkbenchPage.h"
#include "berryISelectionService.h"
#include "berryConstants.h"
#include "berryPlatformUI.h"
#include "itkRGBAPixel.h"
+#include "itkTractsToProbabilityImageFilter.h"
#include "qwidgetaction.h"
+#include "qcolordialog.h"
const std::string QmitkControlVisualizationPropertiesView::VIEW_ID = "org.mitk.views.controlvisualizationpropertiesview";
using namespace berry;
struct CvpSelListener : ISelectionListener
{
berryObjectMacro(CvpSelListener);
CvpSelListener(QmitkControlVisualizationPropertiesView* view)
{
m_View = view;
}
void ApplySettings(mitk::DataNode::Pointer node)
{
bool do_vis;
node->GetBoolProperty("VisibleOdfs_T", do_vis);
if(do_vis)
{
m_View->m_Controls->m_VisibleOdfsON_T->setIcon(*m_View->m_IconGlyON_T);
m_View->m_Controls->m_VisibleOdfsON_T->setChecked(true);
m_View->m_GlyIsOn_T = true;
}
else
{
m_View->m_Controls->m_VisibleOdfsON_T->setIcon(*m_View->m_IconGlyOFF_T);
m_View->m_Controls->m_VisibleOdfsON_T->setChecked(false);
m_View->m_GlyIsOn_T = false;
}
node->GetBoolProperty("VisibleOdfs_C", do_vis);
if(do_vis)
{
m_View->m_Controls->m_VisibleOdfsON_C->setIcon(*m_View->m_IconGlyON_C);
m_View->m_Controls->m_VisibleOdfsON_C->setChecked(true);
m_View->m_GlyIsOn_C = true;
}
else
{
m_View->m_Controls->m_VisibleOdfsON_C->setIcon(*m_View->m_IconGlyOFF_C);
m_View->m_Controls->m_VisibleOdfsON_C->setChecked(false);
m_View->m_GlyIsOn_C = false;
}
node->GetBoolProperty("VisibleOdfs_S", do_vis);
if(do_vis)
{
m_View->m_Controls->m_VisibleOdfsON_S->setIcon(*m_View->m_IconGlyON_S);
m_View->m_Controls->m_VisibleOdfsON_S->setChecked(true);
m_View->m_GlyIsOn_S = true;
}
else
{
m_View->m_Controls->m_VisibleOdfsON_S->setIcon(*m_View->m_IconGlyOFF_S);
m_View->m_Controls->m_VisibleOdfsON_S->setChecked(false);
m_View->m_GlyIsOn_S = false;
}
bool tex_int;
node->GetBoolProperty("texture interpolation", tex_int);
if(tex_int)
{
m_View->m_Controls->m_TextureIntON->setIcon(*m_View->m_IconTexON);
m_View->m_Controls->m_TextureIntON->setChecked(true);
m_View->m_TexIsOn = true;
}
else
{
m_View->m_Controls->m_TextureIntON->setIcon(*m_View->m_IconTexOFF);
m_View->m_Controls->m_TextureIntON->setChecked(false);
m_View->m_TexIsOn = false;
}
int val;
node->GetIntProperty("ShowMaxNumber", val);
m_View->m_Controls->m_ShowMaxNumber->setValue(val);
m_View->m_Controls->m_NormalizationDropdown->setCurrentIndex(dynamic_cast<mitk::EnumerationProperty*>(node->GetProperty("Normalization"))->GetValueAsId());
float fval;
node->GetFloatProperty("Scaling",fval);
m_View->m_Controls->m_ScalingFactor->setValue(fval);
m_View->m_Controls->m_AdditionalScaling->setCurrentIndex(dynamic_cast<mitk::EnumerationProperty*>(node->GetProperty("ScaleBy"))->GetValueAsId());
node->GetFloatProperty("IndexParam1",fval);
m_View->m_Controls->m_IndexParam1->setValue(fval);
node->GetFloatProperty("IndexParam2",fval);
m_View->m_Controls->m_IndexParam2->setValue(fval);
}
void DoSelectionChanged(ISelection::ConstPointer selection)
{
// save current selection in member variable
m_View->m_CurrentSelection = selection.Cast<const IStructuredSelection>();
m_View->m_Controls->m_VisibleOdfsON_T->setVisible(false);
m_View->m_Controls->m_VisibleOdfsON_S->setVisible(false);
m_View->m_Controls->m_VisibleOdfsON_C->setVisible(false);
m_View->m_Controls->m_TextureIntON->setVisible(false);
- bool foundDiffusionImage = false;
- bool foundQBIVolume = false;
- bool foundTensorVolume = false;
- bool foundImage = false;
- bool foundMultipleOdfImages = false;
- bool foundRGBAImage = false;
+ m_View->m_Controls->m_ImageControlsFrame->setVisible(false);
+ m_View->m_Controls->m_PlanarFigureControlsFrame->setVisible(false);
+ m_View->m_Controls->m_BundleControlsFrame->setVisible(false);
+ m_View->m_SelectedNode = 0;
+
+ if(m_View->m_CurrentSelection.IsNull())
+ return;
- // do something with the selected items
- if(m_View->m_CurrentSelection)
+ if(m_View->m_CurrentSelection->Size() == 1)
{
- // iterate selection
- for (IStructuredSelection::iterator i = m_View->m_CurrentSelection->Begin();
- i != m_View->m_CurrentSelection->End(); ++i)
+ mitk::DataNodeObject::Pointer nodeObj = m_View->m_CurrentSelection->Begin()->Cast<mitk::DataNodeObject>();
+ if(nodeObj.IsNotNull())
{
+ mitk::DataNode::Pointer node = nodeObj->GetDataNode();
- // extract datatree node
- if (mitk::DataNodeObject::Pointer nodeObj = i->Cast<mitk::DataNodeObject>())
+ if(dynamic_cast<mitk::PlanarFigure*>(node->GetData()) != 0)
{
- mitk::DataNode::Pointer node = nodeObj->GetDataNode();
-
- // only look at interesting types
- if(QString("DiffusionImage").compare(node->GetData()->GetNameOfClass())==0)
- {
- foundDiffusionImage = true;
- bool tex_int;
- node->GetBoolProperty("texture interpolation", tex_int);
- if(tex_int)
- {
- m_View->m_Controls->m_TextureIntON->setIcon(*m_View->m_IconTexON);
- m_View->m_Controls->m_TextureIntON->setChecked(true);
- m_View->m_TexIsOn = true;
- }
- else
- {
- m_View->m_Controls->m_TextureIntON->setIcon(*m_View->m_IconTexOFF);
- m_View->m_Controls->m_TextureIntON->setChecked(false);
- m_View->m_TexIsOn = false;
- }
- int val;
- node->GetIntProperty("DisplayChannel", val);
- m_View->m_Controls->m_DisplayIndex->setValue(val);
-
- QString label = "Channel %1";
- label = label.arg(val);
- m_View->m_Controls->label_channel->setText(label);
+ m_View->m_Controls->m_PlanarFigureControlsFrame->setVisible(true);
+ m_View->m_SelectedNode = node;
+ }
- int maxVal = (dynamic_cast<mitk::DiffusionImage<short>* >(node->GetData()))->GetVectorImage()->GetVectorLength();
- m_View->m_Controls->m_DisplayIndex->setMaximum(maxVal-1);
- }
+ if(dynamic_cast<mitk::FiberBundle*>(node->GetData()) != 0)
+ {
+ MITK_INFO << "Node " << node.GetPointer();
+ MITK_INFO << "pick " << m_View->m_CurrentPickingNode;
+ m_View->m_Controls->m_BundleControlsFrame->setVisible(true);
+ m_View->m_SelectedNode = node;
- else if(QString("QBallImage").compare(node->GetData()->GetNameOfClass())==0)
+ if(m_View->m_CurrentPickingNode != 0 && node.GetPointer() != m_View->m_CurrentPickingNode)
{
- foundMultipleOdfImages = foundQBIVolume || foundTensorVolume;
- foundQBIVolume = true;
- ApplySettings(node);
+ m_View->m_Controls->m_SetInteractor->setEnabled(false);
}
-
- else if(QString("TensorImage").compare(node->GetData()->GetNameOfClass())==0)
+ else
{
- foundMultipleOdfImages = foundQBIVolume || foundTensorVolume;
- foundTensorVolume = true;
- ApplySettings(node);
+ m_View->m_Controls->m_SetInteractor->setEnabled(true);
}
- else if(QString("Image").compare(node->GetData()->GetNameOfClass())==0)
+ mitk::ColorProperty* nodecolor= mitk::ColorProperty::New();
+ node->GetProperty<mitk::ColorProperty>(nodecolor,"color");
+ m_View->m_Controls->m_Color->setAutoFillBackground(true);
+ QString styleSheet = "background-color:rgb(";
+ styleSheet.append(QString::number(nodecolor->GetColor().GetRed()*255.0));
+ styleSheet.append(",");
+ styleSheet.append(QString::number(nodecolor->GetColor().GetGreen()*255.0));
+ styleSheet.append(",");
+ styleSheet.append(QString::number(nodecolor->GetColor().GetBlue()*255.0));
+ styleSheet.append(")");
+ m_View->m_Controls->m_Color->setStyleSheet(styleSheet);
+
+
+ }
+ }
+ }
+
+ if(m_View->m_CurrentSelection->Size() > 0 && m_View->m_SelectedNode == 0)
+ {
+ m_View->m_Controls->m_ImageControlsFrame->setVisible(true);
+
+ bool foundDiffusionImage = false;
+ bool foundQBIVolume = false;
+ bool foundTensorVolume = false;
+ bool foundImage = false;
+ bool foundMultipleOdfImages = false;
+ bool foundRGBAImage = false;
+
+ // do something with the selected items
+ if(m_View->m_CurrentSelection)
+ {
+ // iterate selection
+ for (IStructuredSelection::iterator i = m_View->m_CurrentSelection->Begin();
+ i != m_View->m_CurrentSelection->End(); ++i)
+ {
+
+ // extract datatree node
+ if (mitk::DataNodeObject::Pointer nodeObj = i->Cast<mitk::DataNodeObject>())
{
- foundImage = true;
- mitk::Image::Pointer img = dynamic_cast<mitk::Image*>(node->GetData());
- if(img.IsNotNull() && img->GetPixelType().GetItkTypeId() == &typeid(itk::RGBAPixel<unsigned char>) )
+ mitk::DataNode::Pointer node = nodeObj->GetDataNode();
+
+ // only look at interesting types
+ if(QString("DiffusionImage").compare(node->GetData()->GetNameOfClass())==0)
+ {
+ foundDiffusionImage = true;
+ bool tex_int;
+ node->GetBoolProperty("texture interpolation", tex_int);
+ if(tex_int)
+ {
+ m_View->m_Controls->m_TextureIntON->setIcon(*m_View->m_IconTexON);
+ m_View->m_Controls->m_TextureIntON->setChecked(true);
+ m_View->m_TexIsOn = true;
+ }
+ else
+ {
+ m_View->m_Controls->m_TextureIntON->setIcon(*m_View->m_IconTexOFF);
+ m_View->m_Controls->m_TextureIntON->setChecked(false);
+ m_View->m_TexIsOn = false;
+ }
+ int val;
+ node->GetIntProperty("DisplayChannel", val);
+ m_View->m_Controls->m_DisplayIndex->setValue(val);
+
+ QString label = "Channel %1";
+ label = label.arg(val);
+ m_View->m_Controls->label_channel->setText(label);
+
+ int maxVal = (dynamic_cast<mitk::DiffusionImage<short>* >(node->GetData()))->GetVectorImage()->GetVectorLength();
+ m_View->m_Controls->m_DisplayIndex->setMaximum(maxVal-1);
+ }
+
+ else if(QString("QBallImage").compare(node->GetData()->GetNameOfClass())==0)
{
- foundRGBAImage = true;
+ foundMultipleOdfImages = foundQBIVolume || foundTensorVolume;
+ foundQBIVolume = true;
+ ApplySettings(node);
}
- bool tex_int;
- node->GetBoolProperty("texture interpolation", tex_int);
- if(tex_int)
+ else if(QString("TensorImage").compare(node->GetData()->GetNameOfClass())==0)
{
- m_View->m_Controls->m_TextureIntON->setIcon(*m_View->m_IconTexON);
- m_View->m_Controls->m_TextureIntON->setChecked(true);
- m_View->m_TexIsOn = true;
+ foundMultipleOdfImages = foundQBIVolume || foundTensorVolume;
+ foundTensorVolume = true;
+ ApplySettings(node);
}
- else
+
+ else if(QString("Image").compare(node->GetData()->GetNameOfClass())==0)
{
- m_View->m_Controls->m_TextureIntON->setIcon(*m_View->m_IconTexOFF);
- m_View->m_Controls->m_TextureIntON->setChecked(false);
- m_View->m_TexIsOn = false;
+ foundImage = true;
+ mitk::Image::Pointer img = dynamic_cast<mitk::Image*>(node->GetData());
+ if(img.IsNotNull() && img->GetPixelType().GetItkTypeId() == &typeid(itk::RGBAPixel<unsigned char>) )
+ {
+ foundRGBAImage = true;
+ }
+
+ bool tex_int;
+ node->GetBoolProperty("texture interpolation", tex_int);
+ if(tex_int)
+ {
+ m_View->m_Controls->m_TextureIntON->setIcon(*m_View->m_IconTexON);
+ m_View->m_Controls->m_TextureIntON->setChecked(true);
+ m_View->m_TexIsOn = true;
+ }
+ else
+ {
+ m_View->m_Controls->m_TextureIntON->setIcon(*m_View->m_IconTexOFF);
+ m_View->m_Controls->m_TextureIntON->setChecked(false);
+ m_View->m_TexIsOn = false;
+ }
}
}
}
}
- }
- m_View->m_Controls->m_DisplayIndex->setVisible(foundDiffusionImage);
- m_View->m_Controls->label_channel->setVisible(foundDiffusionImage);
+ m_View->m_Controls->m_DisplayIndex->setVisible(foundDiffusionImage);
+ m_View->m_Controls->label_channel->setVisible(foundDiffusionImage);
- m_View->m_FoundSingleOdfImage = (foundQBIVolume || foundTensorVolume)
- && !foundMultipleOdfImages;
- m_View->m_Controls->m_NumberGlyphsFrame->setVisible(m_View->m_FoundSingleOdfImage);
+ m_View->m_FoundSingleOdfImage = (foundQBIVolume || foundTensorVolume)
+ && !foundMultipleOdfImages;
+ m_View->m_Controls->m_NumberGlyphsFrame->setVisible(m_View->m_FoundSingleOdfImage);
- m_View->m_Controls->m_NormalizationDropdown->setVisible(m_View->m_FoundSingleOdfImage);
- m_View->m_Controls->label->setVisible(m_View->m_FoundSingleOdfImage);
- m_View->m_Controls->m_ScalingFactor->setVisible(m_View->m_FoundSingleOdfImage);
- m_View->m_Controls->m_AdditionalScaling->setVisible(m_View->m_FoundSingleOdfImage);
- m_View->m_Controls->m_NormalizationScalingFrame->setVisible(m_View->m_FoundSingleOdfImage);
+ m_View->m_Controls->m_NormalizationDropdown->setVisible(m_View->m_FoundSingleOdfImage);
+ m_View->m_Controls->label->setVisible(m_View->m_FoundSingleOdfImage);
+ m_View->m_Controls->m_ScalingFactor->setVisible(m_View->m_FoundSingleOdfImage);
+ m_View->m_Controls->m_AdditionalScaling->setVisible(m_View->m_FoundSingleOdfImage);
+ m_View->m_Controls->m_NormalizationScalingFrame->setVisible(m_View->m_FoundSingleOdfImage);
- m_View->m_Controls->OpacMinFrame->setVisible(foundRGBAImage || m_View->m_FoundSingleOdfImage);
+ m_View->m_Controls->OpacMinFrame->setVisible(foundRGBAImage || m_View->m_FoundSingleOdfImage);
- // changed for SPIE paper, Principle curvature scaling
- //m_View->m_Controls->params_frame->setVisible(m_View->m_FoundSingleOdfImage);
- m_View->m_Controls->params_frame->setVisible(false);
+ // changed for SPIE paper, Principle curvature scaling
+ //m_View->m_Controls->params_frame->setVisible(m_View->m_FoundSingleOdfImage);
+ m_View->m_Controls->params_frame->setVisible(false);
- m_View->m_Controls->m_VisibleOdfsON_T->setVisible(m_View->m_FoundSingleOdfImage);
- m_View->m_Controls->m_VisibleOdfsON_S->setVisible(m_View->m_FoundSingleOdfImage);
- m_View->m_Controls->m_VisibleOdfsON_C->setVisible(m_View->m_FoundSingleOdfImage);
+ m_View->m_Controls->m_VisibleOdfsON_T->setVisible(m_View->m_FoundSingleOdfImage);
+ m_View->m_Controls->m_VisibleOdfsON_S->setVisible(m_View->m_FoundSingleOdfImage);
+ m_View->m_Controls->m_VisibleOdfsON_C->setVisible(m_View->m_FoundSingleOdfImage);
- bool foundAnyImage = foundDiffusionImage ||
- foundQBIVolume || foundTensorVolume || foundImage;
+ bool foundAnyImage = foundDiffusionImage ||
+ foundQBIVolume || foundTensorVolume || foundImage;
- m_View->m_Controls->m_Reinit->setVisible(foundAnyImage);
- m_View->m_Controls->m_TextureIntON->setVisible(foundAnyImage);
- m_View->m_Controls->m_TSMenu->setVisible(foundAnyImage);
+ m_View->m_Controls->m_Reinit->setVisible(foundAnyImage);
+ m_View->m_Controls->m_TextureIntON->setVisible(foundAnyImage);
+ m_View->m_Controls->m_TSMenu->setVisible(foundAnyImage);
- if(m_View->m_IsInitialized)
- {
- //m_View->GetSite()->GetWorkbenchWindow()->GetActivePage()
- // ->HideView(IViewPart::Pointer(m_View));
+ if(m_View->m_IsInitialized)
+ {
+ //m_View->GetSite()->GetWorkbenchWindow()->GetActivePage()
+ // ->HideView(IViewPart::Pointer(m_View));
- //berry::PlatformUI::GetWorkbench()->GetActiveWorkbenchWindow()->GetActivePage()
- // ->ShowView(QmitkControlVisualizationPropertiesView::VIEW_ID,
- // "", berry::IWorkbenchPage::VIEW_VISIBLE);
+ //berry::PlatformUI::GetWorkbench()->GetActiveWorkbenchWindow()->GetActivePage()
+ // ->ShowView(QmitkControlVisualizationPropertiesView::VIEW_ID,
+ // "", berry::IWorkbenchPage::VIEW_VISIBLE);
+ }
}
}
void SelectionChanged(IWorkbenchPart::Pointer part, ISelection::ConstPointer selection)
{
// check, if selection comes from datamanager
if (part)
{
QString partname(part->GetPartName().c_str());
if(partname.compare("Datamanager")==0)
{
// apply selection
DoSelectionChanged(selection);
}
}
}
QmitkControlVisualizationPropertiesView* m_View;
};
QmitkControlVisualizationPropertiesView::QmitkControlVisualizationPropertiesView()
: QmitkFunctionality(),
m_Controls(NULL),
m_MultiWidget(NULL),
m_IconTexOFF(new QIcon(":/QmitkDiffusionImaging/texIntOFFIcon.png")),
m_IconTexON(new QIcon(":/QmitkDiffusionImaging/texIntONIcon.png")),
m_IconGlyOFF_T(new QIcon(":/QmitkDiffusionImaging/glyphsoff_T.png")),
m_IconGlyON_T(new QIcon(":/QmitkDiffusionImaging/glyphson_T.png")),
m_IconGlyOFF_C(new QIcon(":/QmitkDiffusionImaging/glyphsoff_C.png")),
m_IconGlyON_C(new QIcon(":/QmitkDiffusionImaging/glyphson_C.png")),
m_IconGlyOFF_S(new QIcon(":/QmitkDiffusionImaging/glyphsoff_S.png")),
- m_IconGlyON_S(new QIcon(":/QmitkDiffusionImaging/glyphson_S.png"))
+ m_IconGlyON_S(new QIcon(":/QmitkDiffusionImaging/glyphson_S.png")),
+ m_CurrentSelection(0),
+ m_CurrentPickingNode(0)
{
currentThickSlicesMode = 1;
m_MyMenu = NULL;
}
QmitkControlVisualizationPropertiesView::QmitkControlVisualizationPropertiesView(const QmitkControlVisualizationPropertiesView& other)
{
Q_UNUSED(other)
throw std::runtime_error("Copy constructor not implemented");
}
QmitkControlVisualizationPropertiesView::~QmitkControlVisualizationPropertiesView()
{
this->GetSite()->GetWorkbenchWindow()->GetSelectionService()->RemovePostSelectionListener(/*"org.mitk.views.datamanager",*/ m_SelListener);
}
void QmitkControlVisualizationPropertiesView::OnThickSlicesModeSelected( QAction* action )
{
currentThickSlicesMode = action->data().toInt();
switch(currentThickSlicesMode)
{
default:
case 1:
this->m_Controls->m_TSMenu->setText("MIP");
break;
case 2:
this->m_Controls->m_TSMenu->setText("SUM");
break;
case 3:
this->m_Controls->m_TSMenu->setText("WEIGH");
break;
}
mitk::DataNode* n;
n = GetDataStorage()->GetNamedNode("widget1Plane"); if(n) n->SetProperty( "reslice.thickslices", mitk::ResliceMethodProperty::New( currentThickSlicesMode ) );
n = GetDataStorage()->GetNamedNode("widget2Plane"); if(n) n->SetProperty( "reslice.thickslices", mitk::ResliceMethodProperty::New( currentThickSlicesMode ) );
n = GetDataStorage()->GetNamedNode("widget3Plane"); if(n) n->SetProperty( "reslice.thickslices", mitk::ResliceMethodProperty::New( currentThickSlicesMode ) );
mitk::BaseRenderer::Pointer renderer =
this->GetActiveStdMultiWidget()->GetRenderWindow1()->GetRenderer();
if(renderer.IsNotNull())
{
renderer->SendUpdateSlice();
}
renderer = this->GetActiveStdMultiWidget()->GetRenderWindow2()->GetRenderer();
if(renderer.IsNotNull())
{
renderer->SendUpdateSlice();
}
renderer = this->GetActiveStdMultiWidget()->GetRenderWindow3()->GetRenderer();
if(renderer.IsNotNull())
{
renderer->SendUpdateSlice();
}
renderer->GetRenderingManager()->RequestUpdateAll();
}
void QmitkControlVisualizationPropertiesView::OnTSNumChanged(int num)
{
if(num==0)
{
mitk::DataNode* n;
n = GetDataStorage()->GetNamedNode("widget1Plane"); if(n) n->SetProperty( "reslice.thickslices", mitk::ResliceMethodProperty::New( 0 ) );
n = GetDataStorage()->GetNamedNode("widget2Plane"); if(n) n->SetProperty( "reslice.thickslices", mitk::ResliceMethodProperty::New( 0 ) );
n = GetDataStorage()->GetNamedNode("widget3Plane"); if(n) n->SetProperty( "reslice.thickslices", mitk::ResliceMethodProperty::New( 0 ) );
}
else
{
mitk::DataNode* n;
n = GetDataStorage()->GetNamedNode("widget1Plane"); if(n) n->SetProperty( "reslice.thickslices", mitk::ResliceMethodProperty::New( currentThickSlicesMode ) );
n = GetDataStorage()->GetNamedNode("widget2Plane"); if(n) n->SetProperty( "reslice.thickslices", mitk::ResliceMethodProperty::New( currentThickSlicesMode ) );
n = GetDataStorage()->GetNamedNode("widget3Plane"); if(n) n->SetProperty( "reslice.thickslices", mitk::ResliceMethodProperty::New( currentThickSlicesMode ) );
n = GetDataStorage()->GetNamedNode("widget1Plane"); if(n) n->SetProperty( "reslice.thickslices.num", mitk::IntProperty::New( num ) );
n = GetDataStorage()->GetNamedNode("widget2Plane"); if(n) n->SetProperty( "reslice.thickslices.num", mitk::IntProperty::New( num ) );
n = GetDataStorage()->GetNamedNode("widget3Plane"); if(n) n->SetProperty( "reslice.thickslices.num", mitk::IntProperty::New( num ) );
}
m_TSLabel->setText(QString::number(num*2+1));
mitk::BaseRenderer::Pointer renderer =
this->GetActiveStdMultiWidget()->GetRenderWindow1()->GetRenderer();
if(renderer.IsNotNull())
{
renderer->SendUpdateSlice();
}
renderer = this->GetActiveStdMultiWidget()->GetRenderWindow2()->GetRenderer();
if(renderer.IsNotNull())
{
renderer->SendUpdateSlice();
}
renderer = this->GetActiveStdMultiWidget()->GetRenderWindow3()->GetRenderer();
if(renderer.IsNotNull())
{
renderer->SendUpdateSlice();
}
renderer->GetRenderingManager()->RequestUpdateAll(mitk::RenderingManager::REQUEST_UPDATE_2DWINDOWS);
}
void QmitkControlVisualizationPropertiesView::CreateQtPartControl(QWidget *parent)
{
if (!m_Controls)
{
// create GUI widgets
m_Controls = new Ui::QmitkControlVisualizationPropertiesViewControls;
m_Controls->setupUi(parent);
this->CreateConnections();
m_MyMenu = new QMenu(parent);
connect( m_MyMenu, SIGNAL( aboutToShow() ), this, SLOT(OnMenuAboutToShow()) );
// button for changing rotation mode
m_Controls->m_TSMenu->setMenu( m_MyMenu );
//m_CrosshairModeButton->setIcon( QIcon( iconCrosshairMode_xpm ) );
m_Controls->params_frame->setVisible(false);
QIcon icon5(":/QmitkDiffusionImaging/Refresh_48.png");
m_Controls->m_Reinit->setIcon(icon5);
m_Controls->m_TextureIntON->setCheckable(true);
m_Controls->m_VisibleOdfsON_T->setCheckable(true);
m_Controls->m_VisibleOdfsON_S->setCheckable(true);
m_Controls->m_VisibleOdfsON_C->setCheckable(true);
#ifndef DIFFUSION_IMAGING_EXTENDED
int size = m_Controls->m_AdditionalScaling->count();
for(int t=0; t<size; t++)
{
if(m_Controls->m_AdditionalScaling->itemText(t).toStdString() == "Scale by ASR")
{
m_Controls->m_AdditionalScaling->removeItem(t);
}
}
#endif
m_Controls->m_OpacitySlider->setRange(0.0,1.0);
m_Controls->m_OpacitySlider->setLowerValue(0.0);
m_Controls->m_OpacitySlider->setUpperValue(0.0);
m_Controls->m_ScalingFrame->setVisible(false);
m_Controls->m_NormalizationFrame->setVisible(false);
}
m_IsInitialized = false;
m_SelListener = berry::ISelectionListener::Pointer(new CvpSelListener(this));
this->GetSite()->GetWorkbenchWindow()->GetSelectionService()->AddPostSelectionListener(/*"org.mitk.views.datamanager",*/ m_SelListener);
berry::ISelection::ConstPointer sel(
this->GetSite()->GetWorkbenchWindow()->GetSelectionService()->GetSelection("org.mitk.views.datamanager"));
m_CurrentSelection = sel.Cast<const IStructuredSelection>();
m_SelListener.Cast<CvpSelListener>()->DoSelectionChanged(sel);
m_IsInitialized = true;
}
void QmitkControlVisualizationPropertiesView::OnMenuAboutToShow ()
{
// THICK SLICE SUPPORT
QMenu *myMenu = m_MyMenu;
myMenu->clear();
QActionGroup* thickSlicesActionGroup = new QActionGroup(myMenu);
thickSlicesActionGroup->setExclusive(true);
mitk::BaseRenderer::Pointer renderer =
this->GetActiveStdMultiWidget()->GetRenderWindow1()->GetRenderer();
int currentTSMode = 0;
{
mitk::ResliceMethodProperty::Pointer m = dynamic_cast<mitk::ResliceMethodProperty*>(renderer->GetCurrentWorldGeometry2DNode()->GetProperty( "reslice.thickslices" ));
if( m.IsNotNull() )
currentTSMode = m->GetValueAsId();
}
const int maxTS = 30;
int currentNum = 0;
{
mitk::IntProperty::Pointer m = dynamic_cast<mitk::IntProperty*>(renderer->GetCurrentWorldGeometry2DNode()->GetProperty( "reslice.thickslices.num" ));
if( m.IsNotNull() )
{
currentNum = m->GetValue();
if(currentNum < 0) currentNum = 0;
if(currentNum > maxTS) currentNum = maxTS;
}
}
if(currentTSMode==0)
currentNum=0;
QSlider *m_TSSlider = new QSlider(myMenu);
m_TSSlider->setMinimum(0);
m_TSSlider->setMaximum(maxTS-1);
m_TSSlider->setValue(currentNum);
m_TSSlider->setOrientation(Qt::Horizontal);
connect( m_TSSlider, SIGNAL( valueChanged(int) ), this, SLOT( OnTSNumChanged(int) ) );
QHBoxLayout* _TSLayout = new QHBoxLayout;
_TSLayout->setContentsMargins(4,4,4,4);
_TSLayout->addWidget(m_TSSlider);
_TSLayout->addWidget(m_TSLabel=new QLabel(QString::number(currentNum*2+1),myMenu));
QWidget* _TSWidget = new QWidget;
_TSWidget->setLayout(_TSLayout);
QActionGroup* thickSliceModeActionGroup = new QActionGroup(myMenu);
thickSliceModeActionGroup->setExclusive(true);
QWidgetAction *m_TSSliderAction = new QWidgetAction(myMenu);
m_TSSliderAction->setDefaultWidget(_TSWidget);
myMenu->addAction(m_TSSliderAction);
QAction* mipThickSlicesAction = new QAction(myMenu);
mipThickSlicesAction->setActionGroup(thickSliceModeActionGroup);
mipThickSlicesAction->setText("MIP (max. intensity proj.)");
mipThickSlicesAction->setCheckable(true);
mipThickSlicesAction->setChecked(currentThickSlicesMode==1);
mipThickSlicesAction->setData(1);
myMenu->addAction( mipThickSlicesAction );
QAction* sumThickSlicesAction = new QAction(myMenu);
sumThickSlicesAction->setActionGroup(thickSliceModeActionGroup);
sumThickSlicesAction->setText("SUM (sum intensity proj.)");
sumThickSlicesAction->setCheckable(true);
sumThickSlicesAction->setChecked(currentThickSlicesMode==2);
sumThickSlicesAction->setData(2);
myMenu->addAction( sumThickSlicesAction );
QAction* weightedThickSlicesAction = new QAction(myMenu);
weightedThickSlicesAction->setActionGroup(thickSliceModeActionGroup);
weightedThickSlicesAction->setText("WEIGHTED (gaussian proj.)");
weightedThickSlicesAction->setCheckable(true);
weightedThickSlicesAction->setChecked(currentThickSlicesMode==3);
weightedThickSlicesAction->setData(3);
myMenu->addAction( weightedThickSlicesAction );
connect( thickSliceModeActionGroup, SIGNAL(triggered(QAction*)), this, SLOT(OnThickSlicesModeSelected(QAction*)) );
}
void QmitkControlVisualizationPropertiesView::StdMultiWidgetAvailable (QmitkStdMultiWidget &stdMultiWidget)
{
m_MultiWidget = &stdMultiWidget;
}
void QmitkControlVisualizationPropertiesView::StdMultiWidgetNotAvailable()
{
m_MultiWidget = NULL;
}
void QmitkControlVisualizationPropertiesView::CreateConnections()
{
if ( m_Controls )
{
connect( (QObject*)(m_Controls->m_DisplayIndex), SIGNAL(valueChanged(int)), this, SLOT(DisplayIndexChanged(int)) );
connect( (QObject*)(m_Controls->m_TextureIntON), SIGNAL(clicked()), this, SLOT(TextIntON()) );
connect( (QObject*)(m_Controls->m_Reinit), SIGNAL(clicked()), this, SLOT(Reinit()) );
connect( (QObject*)(m_Controls->m_VisibleOdfsON_T), SIGNAL(clicked()), this, SLOT(VisibleOdfsON_T()) );
connect( (QObject*)(m_Controls->m_VisibleOdfsON_S), SIGNAL(clicked()), this, SLOT(VisibleOdfsON_S()) );
connect( (QObject*)(m_Controls->m_VisibleOdfsON_C), SIGNAL(clicked()), this, SLOT(VisibleOdfsON_C()) );
connect( (QObject*)(m_Controls->m_ShowMaxNumber), SIGNAL(editingFinished()), this, SLOT(ShowMaxNumberChanged()) );
connect( (QObject*)(m_Controls->m_NormalizationDropdown), SIGNAL(currentIndexChanged(int)), this, SLOT(NormalizationDropdownChanged(int)) );
connect( (QObject*)(m_Controls->m_ScalingFactor), SIGNAL(valueChanged(double)), this, SLOT(ScalingFactorChanged(double)) );
connect( (QObject*)(m_Controls->m_AdditionalScaling), SIGNAL(currentIndexChanged(int)), this, SLOT(AdditionalScaling(int)) );
connect( (QObject*)(m_Controls->m_IndexParam1), SIGNAL(valueChanged(double)), this, SLOT(IndexParam1Changed(double)) );
connect( (QObject*)(m_Controls->m_IndexParam2), SIGNAL(valueChanged(double)), this, SLOT(IndexParam2Changed(double)) );
connect( (QObject*)(m_Controls->m_ScalingCheckbox), SIGNAL(clicked()), this, SLOT(ScalingCheckbox()) );
connect( (QObject*)(m_Controls->m_OpacitySlider), SIGNAL(spanChanged(double,double)), this, SLOT(OpacityChanged(double,double)) );
+ connect((QObject*) m_Controls->m_Wire, SIGNAL(clicked()), (QObject*) this, SLOT(BundleRepresentationWire()));
+ connect((QObject*) m_Controls->m_Tube, SIGNAL(clicked()), (QObject*) this, SLOT(BundleRepresentationTube()));
+ connect((QObject*) m_Controls->m_Color, SIGNAL(clicked()), (QObject*) this, SLOT(BundleRepresentationColor()));
+ connect((QObject*) m_Controls->m_Focus, SIGNAL(clicked()), (QObject*) this, SLOT(PlanarFigureFocus()));
+
+ connect((QObject*) m_Controls->m_SetInteractor, SIGNAL(clicked()), (QObject*) this, SLOT(SetInteractor()));
+
+ connect((QObject*) m_Controls->m_PFWidth, SIGNAL(valueChanged(double)), (QObject*) this, SLOT(PFWidth(double)));
+ connect((QObject*) m_Controls->m_PFColor, SIGNAL(clicked()), (QObject*) this, SLOT(PFColor()));
+
+ connect((QObject*) m_Controls->m_2DHeatmap, SIGNAL(clicked()), (QObject*) this, SLOT(Heatmap()));
+
}
}
void QmitkControlVisualizationPropertiesView::Activated()
{
berry::ISelection::ConstPointer sel(
this->GetSite()->GetWorkbenchWindow()->GetSelectionService()->GetSelection("org.mitk.views.datamanager"));
m_CurrentSelection = sel.Cast<const IStructuredSelection>();
m_SelListener.Cast<CvpSelListener>()->DoSelectionChanged(sel);
QmitkFunctionality::Activated();
}
void QmitkControlVisualizationPropertiesView::Deactivated()
{
QmitkFunctionality::Deactivated();
}
int QmitkControlVisualizationPropertiesView::GetSizeFlags(bool width)
{
if(!width)
{
return berry::Constants::MIN | berry::Constants::MAX | berry::Constants::FILL;
}
else
{
return 0;
}
}
int QmitkControlVisualizationPropertiesView::ComputePreferredSize(bool width, int /*availableParallel*/, int /*availablePerpendicular*/, int preferredResult)
{
if(width==false)
{
return m_FoundSingleOdfImage ? 120 : 80;
}
else
{
return preferredResult;
}
}
mitk::DataStorage::SetOfObjects::Pointer
QmitkControlVisualizationPropertiesView::ActiveSet(std::string classname)
{
if (m_CurrentSelection)
{
mitk::DataStorage::SetOfObjects::Pointer set =
mitk::DataStorage::SetOfObjects::New();
int at = 0;
for (IStructuredSelection::iterator i = m_CurrentSelection->Begin();
i != m_CurrentSelection->End();
++i)
{
if (mitk::DataNodeObject::Pointer nodeObj = i->Cast<mitk::DataNodeObject>())
{
mitk::DataNode::Pointer node = nodeObj->GetDataNode();
if(QString(classname.c_str()).compare(node->GetData()->GetNameOfClass())==0)
{
set->InsertElement(at++, node);
}
}
}
return set;
}
return 0;
}
void QmitkControlVisualizationPropertiesView::SetBoolProp(
mitk::DataStorage::SetOfObjects::Pointer set,
std::string name, bool value)
{
if(set.IsNotNull())
{
mitk::DataStorage::SetOfObjects::const_iterator itemiter( set->begin() );
mitk::DataStorage::SetOfObjects::const_iterator itemiterend( set->end() );
while ( itemiter != itemiterend )
{
(*itemiter)->SetBoolProperty(name.c_str(), value);
++itemiter;
}
}
}
void QmitkControlVisualizationPropertiesView::SetIntProp(
mitk::DataStorage::SetOfObjects::Pointer set,
std::string name, int value)
{
if(set.IsNotNull())
{
mitk::DataStorage::SetOfObjects::const_iterator itemiter( set->begin() );
mitk::DataStorage::SetOfObjects::const_iterator itemiterend( set->end() );
while ( itemiter != itemiterend )
{
(*itemiter)->SetIntProperty(name.c_str(), value);
++itemiter;
}
}
}
void QmitkControlVisualizationPropertiesView::SetFloatProp(
mitk::DataStorage::SetOfObjects::Pointer set,
std::string name, float value)
{
if(set.IsNotNull())
{
mitk::DataStorage::SetOfObjects::const_iterator itemiter( set->begin() );
mitk::DataStorage::SetOfObjects::const_iterator itemiterend( set->end() );
while ( itemiter != itemiterend )
{
(*itemiter)->SetFloatProperty(name.c_str(), value);
++itemiter;
}
}
}
void QmitkControlVisualizationPropertiesView::SetLevelWindowProp(
mitk::DataStorage::SetOfObjects::Pointer set,
std::string name, mitk::LevelWindow value)
{
if(set.IsNotNull())
{
mitk::LevelWindowProperty::Pointer prop = mitk::LevelWindowProperty::New(value);
mitk::DataStorage::SetOfObjects::const_iterator itemiter( set->begin() );
mitk::DataStorage::SetOfObjects::const_iterator itemiterend( set->end() );
while ( itemiter != itemiterend )
{
(*itemiter)->SetProperty(name.c_str(), prop);
++itemiter;
}
}
}
void QmitkControlVisualizationPropertiesView::SetEnumProp(
mitk::DataStorage::SetOfObjects::Pointer set,
std::string name, mitk::EnumerationProperty::Pointer value)
{
if(set.IsNotNull())
{
mitk::DataStorage::SetOfObjects::const_iterator itemiter( set->begin() );
mitk::DataStorage::SetOfObjects::const_iterator itemiterend( set->end() );
while ( itemiter != itemiterend )
{
(*itemiter)->SetProperty(name.c_str(), value);
++itemiter;
}
}
}
void QmitkControlVisualizationPropertiesView::DisplayIndexChanged(int dispIndex)
{
QString label = "Channel %1";
label = label.arg(dispIndex);
m_Controls->label_channel->setText(label);
mitk::DataStorage::SetOfObjects::Pointer set =
ActiveSet("DiffusionImage");
if(set.IsNotNull())
{
mitk::DataStorage::SetOfObjects::const_iterator itemiter( set->begin() );
mitk::DataStorage::SetOfObjects::const_iterator itemiterend( set->end() );
while ( itemiter != itemiterend )
{
(*itemiter)->SetIntProperty("DisplayChannel", dispIndex);
++itemiter;
}
//m_MultiWidget->RequestUpdate();
mitk::RenderingManager::GetInstance()->RequestUpdateAll();
}
}
void QmitkControlVisualizationPropertiesView::Reinit()
{
if (m_CurrentSelection)
{
mitk::DataNodeObject::Pointer nodeObj =
m_CurrentSelection->Begin()->Cast<mitk::DataNodeObject>();
mitk::DataNode::Pointer node = nodeObj->GetDataNode();
mitk::BaseData::Pointer basedata = node->GetData();
if (basedata.IsNotNull())
{
mitk::RenderingManager::GetInstance()->InitializeViews(
basedata->GetTimeSlicedGeometry(), mitk::RenderingManager::REQUEST_UPDATE_ALL, true );
mitk::RenderingManager::GetInstance()->RequestUpdateAll();
}
}
}
void QmitkControlVisualizationPropertiesView::TextIntON()
{
if(m_TexIsOn)
{
m_Controls->m_TextureIntON->setIcon(*m_IconTexOFF);
}
else
{
m_Controls->m_TextureIntON->setIcon(*m_IconTexON);
}
mitk::DataStorage::SetOfObjects::Pointer set =
ActiveSet("DiffusionImage");
SetBoolProp(set,"texture interpolation", !m_TexIsOn);
set = ActiveSet("TensorImage");
SetBoolProp(set,"texture interpolation", !m_TexIsOn);
set = ActiveSet("QBallImage");
SetBoolProp(set,"texture interpolation", !m_TexIsOn);
set = ActiveSet("Image");
SetBoolProp(set,"texture interpolation", !m_TexIsOn);
m_TexIsOn = !m_TexIsOn;
if(m_MultiWidget)
m_MultiWidget->RequestUpdate();
}
void QmitkControlVisualizationPropertiesView::VisibleOdfsON_S()
{
if(m_GlyIsOn_S)
{
m_Controls->m_VisibleOdfsON_S->setIcon(*m_IconGlyOFF_S);
}
else
{
m_Controls->m_VisibleOdfsON_S->setIcon(*m_IconGlyON_S);
}
mitk::DataStorage::SetOfObjects::Pointer set =
ActiveSet("QBallImage");
SetBoolProp(set,"VisibleOdfs_S", !m_GlyIsOn_S);
set = ActiveSet("TensorImage");
SetBoolProp(set,"VisibleOdfs_S", !m_GlyIsOn_S);
m_GlyIsOn_S = !m_GlyIsOn_S;
- VisibleOdfsON(0);
+ VisibleOdfsON(0);
}
void QmitkControlVisualizationPropertiesView::VisibleOdfsON_T()
{
if(m_GlyIsOn_T)
{
m_Controls->m_VisibleOdfsON_T->setIcon(*m_IconGlyOFF_T);
}
else
{
m_Controls->m_VisibleOdfsON_T->setIcon(*m_IconGlyON_T);
}
mitk::DataStorage::SetOfObjects::Pointer set =
ActiveSet("QBallImage");
SetBoolProp(set,"VisibleOdfs_T", !m_GlyIsOn_T);
set = ActiveSet("TensorImage");
SetBoolProp(set,"VisibleOdfs_T", !m_GlyIsOn_T);
m_GlyIsOn_T = !m_GlyIsOn_T;
VisibleOdfsON(1);
}
void QmitkControlVisualizationPropertiesView::VisibleOdfsON_C()
{
if(m_GlyIsOn_C)
{
m_Controls->m_VisibleOdfsON_C->setIcon(*m_IconGlyOFF_C);
}
else
{
m_Controls->m_VisibleOdfsON_C->setIcon(*m_IconGlyON_C);
}
mitk::DataStorage::SetOfObjects::Pointer set =
ActiveSet("QBallImage");
SetBoolProp(set,"VisibleOdfs_C", !m_GlyIsOn_C);
set = ActiveSet("TensorImage");
SetBoolProp(set,"VisibleOdfs_C", !m_GlyIsOn_C);
m_GlyIsOn_C = !m_GlyIsOn_C;
VisibleOdfsON(2);
}
void QmitkControlVisualizationPropertiesView::VisibleOdfsON(int view)
{
if(m_MultiWidget)
m_MultiWidget->RequestUpdate();
}
void QmitkControlVisualizationPropertiesView::ShowMaxNumberChanged()
{
int maxNr = m_Controls->m_ShowMaxNumber->value();
if ( maxNr < 1 )
{
m_Controls->m_ShowMaxNumber->setValue( 1 );
maxNr = 1;
}
mitk::DataStorage::SetOfObjects::Pointer set =
ActiveSet("QBallImage");
SetIntProp(set,"ShowMaxNumber", maxNr);
set = ActiveSet("TensorImage");
SetIntProp(set,"ShowMaxNumber", maxNr);
if(m_MultiWidget)
m_MultiWidget->RequestUpdate();
}
void QmitkControlVisualizationPropertiesView::NormalizationDropdownChanged(int normDropdown)
{
typedef mitk::OdfNormalizationMethodProperty PropType;
PropType::Pointer normMeth = PropType::New();
switch(normDropdown)
{
case 0:
normMeth->SetNormalizationToMinMax();
break;
case 1:
normMeth->SetNormalizationToMax();
break;
case 2:
normMeth->SetNormalizationToNone();
break;
case 3:
normMeth->SetNormalizationToGlobalMax();
break;
default:
normMeth->SetNormalizationToMinMax();
}
mitk::DataStorage::SetOfObjects::Pointer set =
ActiveSet("QBallImage");
SetEnumProp(set,"Normalization", normMeth.GetPointer());
set = ActiveSet("TensorImage");
SetEnumProp(set,"Normalization", normMeth.GetPointer());
if(m_MultiWidget)
m_MultiWidget->RequestUpdate();
}
void QmitkControlVisualizationPropertiesView::ScalingFactorChanged(double scalingFactor)
{
mitk::DataStorage::SetOfObjects::Pointer set =
ActiveSet("QBallImage");
SetFloatProp(set,"Scaling", scalingFactor);
set = ActiveSet("TensorImage");
SetFloatProp(set,"Scaling", scalingFactor);
if(m_MultiWidget)
m_MultiWidget->RequestUpdate();
}
void QmitkControlVisualizationPropertiesView::AdditionalScaling(int additionalScaling)
{
typedef mitk::OdfScaleByProperty PropType;
PropType::Pointer scaleBy = PropType::New();
switch(additionalScaling)
{
case 0:
scaleBy->SetScaleByNothing();
break;
case 1:
scaleBy->SetScaleByGFA();
//m_Controls->params_frame->setVisible(true);
break;
#ifdef DIFFUSION_IMAGING_EXTENDED
case 2:
scaleBy->SetScaleByPrincipalCurvature();
// commented in for SPIE paper, Principle curvature scaling
//m_Controls->params_frame->setVisible(true);
break;
#endif
default:
scaleBy->SetScaleByNothing();
}
mitk::DataStorage::SetOfObjects::Pointer set =
ActiveSet("QBallImage");
SetEnumProp(set,"ScaleBy", scaleBy.GetPointer());
set = ActiveSet("TensorImage");
SetEnumProp(set,"ScaleBy", scaleBy.GetPointer());
if(m_MultiWidget)
m_MultiWidget->RequestUpdate();
}
void QmitkControlVisualizationPropertiesView::IndexParam1Changed(double param1)
{
mitk::DataStorage::SetOfObjects::Pointer set =
ActiveSet("QBallImage");
SetFloatProp(set,"IndexParam1", param1);
set = ActiveSet("TensorImage");
SetFloatProp(set,"IndexParam1", param1);
if(m_MultiWidget)
m_MultiWidget->RequestUpdate();
}
void QmitkControlVisualizationPropertiesView::IndexParam2Changed(double param2)
{
mitk::DataStorage::SetOfObjects::Pointer set =
ActiveSet("QBallImage");
SetFloatProp(set,"IndexParam2", param2);
set = ActiveSet("TensorImage");
SetFloatProp(set,"IndexParam2", param2);
if(m_MultiWidget)
m_MultiWidget->RequestUpdate();
}
void QmitkControlVisualizationPropertiesView::OpacityChanged(double l, double u)
{
mitk::LevelWindow olw;
olw.SetRangeMinMax(l*255, u*255);
mitk::DataStorage::SetOfObjects::Pointer set =
ActiveSet("QBallImage");
SetLevelWindowProp(set,"opaclevelwindow", olw);
set = ActiveSet("TensorImage");
SetLevelWindowProp(set,"opaclevelwindow", olw);
set = ActiveSet("Image");
SetLevelWindowProp(set,"opaclevelwindow", olw);
m_Controls->m_OpacityMinFaLabel->setText(QString::number(l,'f',2) + " : " + QString::number(u,'f',2));
if(m_MultiWidget)
m_MultiWidget->RequestUpdate();
}
void QmitkControlVisualizationPropertiesView::ScalingCheckbox()
{
m_Controls->m_ScalingFrame->setVisible(
m_Controls->m_ScalingCheckbox->isChecked());
}
+
+
+void QmitkControlVisualizationPropertiesView::BundleRepresentationWire()
+{
+ if(m_SelectedNode)
+ {
+ m_SelectedNode->SetProperty("LineWidth",mitk::IntProperty::New(m_Controls->m_LineWidth->value()));
+ m_SelectedNode->SetProperty("ColorCoding",mitk::IntProperty::New(15));
+ mitk::RenderingManager::GetInstance()->ForceImmediateUpdateAll();
+ m_SelectedNode->SetProperty("ColorCoding",mitk::IntProperty::New(18));
+ mitk::RenderingManager::GetInstance()->ForceImmediateUpdateAll();
+ m_SelectedNode->SetProperty("ColorCoding",mitk::IntProperty::New(1));
+ mitk::RenderingManager::GetInstance()->ForceImmediateUpdateAll();
+ m_SelectedNode->SetProperty("ColorCoding",mitk::IntProperty::New(2));
+ mitk::RenderingManager::GetInstance()->ForceImmediateUpdateAll();
+ m_SelectedNode->SetProperty("ColorCoding",mitk::IntProperty::New(3));
+ mitk::RenderingManager::GetInstance()->ForceImmediateUpdateAll();
+ m_SelectedNode->SetProperty("ColorCoding",mitk::IntProperty::New(4));
+ mitk::RenderingManager::GetInstance()->ForceImmediateUpdateAll();
+ m_SelectedNode->SetProperty("ColorCoding",mitk::IntProperty::New(0));
+ mitk::RenderingManager::GetInstance()->ForceImmediateUpdateAll();
+ }
+}
+
+void QmitkControlVisualizationPropertiesView::BundleRepresentationTube()
+{
+ if(m_SelectedNode)
+ {
+ m_SelectedNode->SetProperty("TubeRadius",mitk::FloatProperty::New(m_Controls->m_TubeRadius->value()));
+ m_SelectedNode->SetProperty("ColorCoding",mitk::IntProperty::New(17));
+ mitk::RenderingManager::GetInstance()->ForceImmediateUpdateAll();
+ m_SelectedNode->SetProperty("ColorCoding",mitk::IntProperty::New(13));
+ mitk::RenderingManager::GetInstance()->ForceImmediateUpdateAll();
+ m_SelectedNode->SetProperty("ColorCoding",mitk::IntProperty::New(16));
+ mitk::RenderingManager::GetInstance()->ForceImmediateUpdateAll();
+ m_SelectedNode->SetProperty("ColorCoding",mitk::IntProperty::New(0));
+ mitk::RenderingManager::GetInstance()->ForceImmediateUpdateAll();
+ }
+}
+
+void QmitkControlVisualizationPropertiesView::BundleRepresentationColor()
+{
+ if(m_SelectedNode)
+ {
+ QColor color = QColorDialog::getColor();
+
+ m_Controls->m_Color->setAutoFillBackground(true);
+ QString styleSheet = "background-color:rgb(";
+ styleSheet.append(QString::number(color.red()));
+ styleSheet.append(",");
+ styleSheet.append(QString::number(color.green()));
+ styleSheet.append(",");
+ styleSheet.append(QString::number(color.blue()));
+ styleSheet.append(")");
+ m_Controls->m_Color->setStyleSheet(styleSheet);
+
+ m_SelectedNode->SetProperty("color",mitk::ColorProperty::New(color.red()/255.0, color.green()/255.0, color.blue()/255.0));
+ m_SelectedNode->SetProperty("ColorCoding",mitk::IntProperty::New(14));
+ mitk::RenderingManager::GetInstance()->ForceImmediateUpdateAll();
+ m_SelectedNode->SetProperty("ColorCoding",mitk::IntProperty::New(3));
+ mitk::RenderingManager::GetInstance()->ForceImmediateUpdateAll();
+ m_SelectedNode->SetProperty("ColorCoding",mitk::IntProperty::New(0));
+ mitk::RenderingManager::GetInstance()->ForceImmediateUpdateAll();
+ }
+}
+
+void QmitkControlVisualizationPropertiesView::PlanarFigureFocus()
+{
+ if(m_SelectedNode)
+ {
+ mitk::PlanarFigure* _PlanarFigure = 0;
+ _PlanarFigure = dynamic_cast<mitk::PlanarFigure*> (m_SelectedNode->GetData());
+
+ if (_PlanarFigure)
+ {
+
+ QmitkRenderWindow* selectedRenderWindow = 0;
+
+ QmitkRenderWindow* RenderWindow1 =
+ this->GetActiveStdMultiWidget()->GetRenderWindow1();
+ QmitkRenderWindow* RenderWindow2 =
+ this->GetActiveStdMultiWidget()->GetRenderWindow2();
+ QmitkRenderWindow* RenderWindow3 =
+ this->GetActiveStdMultiWidget()->GetRenderWindow3();
+ QmitkRenderWindow* RenderWindow4 =
+ this->GetActiveStdMultiWidget()->GetRenderWindow4();
+
+ bool PlanarFigureInitializedWindow = false;
+
+ // find initialized renderwindow
+ if (m_SelectedNode->GetBoolProperty("PlanarFigureInitializedWindow",
+ PlanarFigureInitializedWindow, RenderWindow1->GetRenderer()))
+ {
+ selectedRenderWindow = RenderWindow1;
+ }
+
+ if (!selectedRenderWindow && m_SelectedNode->GetBoolProperty(
+ "PlanarFigureInitializedWindow", PlanarFigureInitializedWindow,
+ RenderWindow2->GetRenderer()))
+ {
+ selectedRenderWindow = RenderWindow2;
+ }
+
+ if (!selectedRenderWindow && m_SelectedNode->GetBoolProperty(
+ "PlanarFigureInitializedWindow", PlanarFigureInitializedWindow,
+ RenderWindow3->GetRenderer()))
+ {
+ selectedRenderWindow = RenderWindow3;
+ }
+
+ if (!selectedRenderWindow && m_SelectedNode->GetBoolProperty(
+ "PlanarFigureInitializedWindow", PlanarFigureInitializedWindow,
+ RenderWindow4->GetRenderer()))
+ {
+ selectedRenderWindow = RenderWindow4;
+ }
+
+ const mitk::PlaneGeometry
+ * _PlaneGeometry =
+ dynamic_cast<const mitk::PlaneGeometry*> (_PlanarFigure->GetGeometry2D());
+ mitk::VnlVector normal = _PlaneGeometry->GetNormalVnl();
+
+ mitk::Geometry2D::ConstPointer worldGeometry1 =
+ RenderWindow1->GetRenderer()->GetCurrentWorldGeometry2D();
+ mitk::PlaneGeometry::ConstPointer _Plane1 =
+ dynamic_cast<const mitk::PlaneGeometry*>( worldGeometry1.GetPointer() );
+ mitk::VnlVector normal1 = _Plane1->GetNormalVnl();
+
+ mitk::Geometry2D::ConstPointer worldGeometry2 =
+ RenderWindow2->GetRenderer()->GetCurrentWorldGeometry2D();
+ mitk::PlaneGeometry::ConstPointer _Plane2 =
+ dynamic_cast<const mitk::PlaneGeometry*>( worldGeometry2.GetPointer() );
+ mitk::VnlVector normal2 = _Plane2->GetNormalVnl();
+
+ mitk::Geometry2D::ConstPointer worldGeometry3 =
+ RenderWindow3->GetRenderer()->GetCurrentWorldGeometry2D();
+ mitk::PlaneGeometry::ConstPointer _Plane3 =
+ dynamic_cast<const mitk::PlaneGeometry*>( worldGeometry3.GetPointer() );
+ mitk::VnlVector normal3 = _Plane3->GetNormalVnl();
+
+ normal[0] = fabs(normal[0]); normal[1] = fabs(normal[1]); normal[2] = fabs(normal[2]);
+ normal1[0] = fabs(normal1[0]); normal1[1] = fabs(normal1[1]); normal1[2] = fabs(normal1[2]);
+ normal2[0] = fabs(normal2[0]); normal2[1] = fabs(normal2[1]); normal2[2] = fabs(normal2[2]);
+ normal3[0] = fabs(normal3[0]); normal3[1] = fabs(normal3[1]); normal3[2] = fabs(normal3[2]);
+
+ double ang1 = angle(normal, normal1);
+ double ang2 = angle(normal, normal2);
+ double ang3 = angle(normal, normal3);
+
+ if(ang1 < ang2 && ang1 < ang3)
+ {
+ selectedRenderWindow = RenderWindow1;
+ }
+ else
+ {
+ if(ang2 < ang3)
+ {
+ selectedRenderWindow = RenderWindow2;
+ }
+ else
+ {
+ selectedRenderWindow = RenderWindow3;
+ }
+ }
+
+ // make node visible
+ if (selectedRenderWindow)
+ {
+ mitk::Point3D centerP = _PlaneGeometry->GetOrigin();
+ selectedRenderWindow->GetSliceNavigationController()->ReorientSlices(
+ centerP, _PlaneGeometry->GetNormal());
+ selectedRenderWindow->GetSliceNavigationController()->SelectSliceByPoint(
+ centerP);
+ }
+ }
+
+ // set interactor for new node (if not already set)
+ mitk::PlanarFigureInteractor::Pointer figureInteractor
+ = dynamic_cast<mitk::PlanarFigureInteractor*>(m_SelectedNode->GetInteractor());
+
+ if(figureInteractor.IsNull())
+ figureInteractor = mitk::PlanarFigureInteractor::New("PlanarFigureInteractor", m_SelectedNode);
+
+ mitk::GlobalInteraction::GetInstance()->AddInteractor(figureInteractor);
+
+ m_SelectedNode->SetProperty("planarfigure.iseditable",mitk::BoolProperty::New(true));
+
+ }
+}
+
+void QmitkControlVisualizationPropertiesView::SetInteractor()
+{
+ typedef std::vector<mitk::DataNode*> Container;
+ Container _NodeSet = this->GetDataManagerSelection();
+ mitk::DataNode* node = 0;
+ mitk::FiberBundle* bundle = 0;
+ mitk::FiberBundleInteractor::Pointer bundleInteractor = 0;
+
+ // finally add all nodes to the model
+ for(Container::const_iterator it=_NodeSet.begin(); it!=_NodeSet.end()
+ ; it++)
+ {
+ node = const_cast<mitk::DataNode*>(*it);
+ bundle = dynamic_cast<mitk::FiberBundle*>(node->GetData());
+
+ if(bundle)
+ {
+ bundleInteractor = dynamic_cast<mitk::FiberBundleInteractor*>(node->GetInteractor());
+
+ if(bundleInteractor.IsNotNull())
+ mitk::GlobalInteraction::GetInstance()->RemoveInteractor(bundleInteractor);
+
+ if(!m_Controls->m_SetInteractor->isChecked())
+ {
+ m_Controls->m_SetInteractor->setChecked(false);
+ this->GetActiveStdMultiWidget()->GetRenderWindow4()->setCursor(Qt::ArrowCursor);
+ m_CurrentPickingNode = 0;
+ }
+ else
+ {
+ m_Controls->m_SetInteractor->setChecked(true);
+ bundleInteractor = mitk::FiberBundleInteractor::New("FiberBundleInteractor", node);
+ mitk::GlobalInteraction::GetInstance()->AddInteractor(bundleInteractor);
+ this->GetActiveStdMultiWidget()->GetRenderWindow4()->setCursor(Qt::CrossCursor);
+ m_CurrentPickingNode = node;
+ }
+
+ }
+ }
+
+}
+
+void QmitkControlVisualizationPropertiesView::PFWidth(double width)
+{
+
+ m_SelectedNode->SetProperty("planarfigure.line.width", mitk::FloatProperty::New(width) );
+ m_SelectedNode->SetProperty("planarfigure.shadow.widthmodifier", mitk::FloatProperty::New(width) );
+ m_SelectedNode->SetProperty("planarfigure.outline.width", mitk::FloatProperty::New(width) );
+ m_SelectedNode->SetProperty("planarfigure.helperline.width", mitk::FloatProperty::New(width) );
+
+ mitk::RenderingManager::GetInstance()->RequestUpdateAll();
+}
+
+void QmitkControlVisualizationPropertiesView::PFColor()
+{
+
+ QColor color = QColorDialog::getColor();
+
+ m_Controls->m_PFColor->setAutoFillBackground(true);
+ QString styleSheet = "background-color:rgb(";
+ styleSheet.append(QString::number(color.red()));
+ styleSheet.append(",");
+ styleSheet.append(QString::number(color.green()));
+ styleSheet.append(",");
+ styleSheet.append(QString::number(color.blue()));
+ styleSheet.append(")");
+ m_Controls->m_PFColor->setStyleSheet(styleSheet);
+
+ m_SelectedNode->SetProperty( "planarfigure.default.line.color", mitk::ColorProperty::New(color.red()/255.0, color.green()/255.0, color.blue()/255.0));
+ m_SelectedNode->SetProperty( "planarfigure.default.outline.color", mitk::ColorProperty::New(color.red()/255.0, color.green()/255.0, color.blue()/255.0));
+ m_SelectedNode->SetProperty( "planarfigure.default.helperline.color", mitk::ColorProperty::New(color.red()/255.0, color.green()/255.0, color.blue()/255.0));
+ m_SelectedNode->SetProperty( "planarfigure.default.markerline.color", mitk::ColorProperty::New(color.red()/255.0, color.green()/255.0, color.blue()/255.0));
+ m_SelectedNode->SetProperty( "planarfigure.default.marker.color", mitk::ColorProperty::New(color.red()/255.0, color.green()/255.0, color.blue()/255.0));
+
+ mitk::RenderingManager::GetInstance()->RequestUpdateAll();
+
+// m_SelectedNode->SetProperty( "planarfigure.hover.line.color", mitk::ColorProperty::New(0.0,1.0,0.0) );
+// m_SelectedNode->SetProperty( "planarfigure.hover.outline.color", mitk::ColorProperty::New(0.0,1.0,0.0) );
+// m_SelectedNode->SetProperty( "planarfigure.hover.helperline.color", mitk::ColorProperty::New(0.0,1.0,0.0) );
+// m_SelectedNode->SetProperty( "planarfigure.hover.markerline.color", mitk::ColorProperty::New(0.0,1.0,0.0) );
+// m_SelectedNode->SetProperty( "planarfigure.hover.marker.color", mitk::ColorProperty::New(0.0,1.0,0.0) );
+
+// m_SelectedNode->SetProperty( "planarfigure.selected.line.color", mitk::ColorProperty::New(1.0,0.0,0.0) );
+// m_SelectedNode->SetProperty( "planarfigure.selected.outline.color", mitk::ColorProperty::New(1.0,0.0,0.0) );
+// m_SelectedNode->SetProperty( "planarfigure.selected.helperline.color", mitk::ColorProperty::New(1.0,0.0,0.0) );
+// m_SelectedNode->SetProperty( "planarfigure.selected.markerline.color", mitk::ColorProperty::New(1.0,0.0,0.0) );
+// m_SelectedNode->SetProperty( "planarfigure.selected.marker.color", mitk::ColorProperty::New(1.0,0.0,0.0) );
+
+}
+
+void QmitkControlVisualizationPropertiesView::Heatmap()
+{
+ if(m_SelectedNode)
+ {
+ mitk::FiberBundle* bundle = dynamic_cast<mitk::FiberBundle*>(m_SelectedNode->GetData());
+ if(!bundle)
+ return;
+
+ ///////////////////////////////
+ // Generate unsigned char Image
+ typedef unsigned char OutPixType2;
+
+ // run generator
+ typedef itk::Image< float, 3 > WMPImageType;
+ typedef itk::TractsToProbabilityImageFilter<WMPImageType,
+ OutPixType2> ImageGeneratorType2;
+ ImageGeneratorType2::Pointer generator = ImageGeneratorType2::New();
+ //generator->SetInput(NULL);
+ generator->SetFiberBundle(bundle);
+ generator->SetInvertImage(false);
+ generator->SetUpsamplingFactor(2);
+ generator->SetBinaryEnvelope(false);
+ generator->Update();
+
+ // get result
+ typedef itk::Image<OutPixType2,3> OutType2;
+ OutType2::Pointer outImg = generator->GetOutput();
+
+ mitk::Image::Pointer img2 = mitk::Image::New();
+ img2->InitializeByItk(outImg.GetPointer());
+ img2->SetVolume(outImg->GetBufferPointer());
+
+ // to datastorage
+ mitk::DataNode::Pointer node = mitk::DataNode::New();
+ node->SetData(img2);
+ QString name(m_SelectedNode->GetName().c_str());
+ name += "_heatmap";
+ node->SetName(name.toStdString());
+ node->SetVisibility(true);
+
+ GetDataStorage()->Add(node);
+ }
+}
diff --git a/Modules/Bundles/org.mitk.gui.qt.diffusionimaging/src/internal/QmitkControlVisualizationPropertiesView.h b/Modules/Bundles/org.mitk.gui.qt.diffusionimaging/src/internal/QmitkControlVisualizationPropertiesView.h
index a281ea3c00..55d41f7bcd 100644
--- a/Modules/Bundles/org.mitk.gui.qt.diffusionimaging/src/internal/QmitkControlVisualizationPropertiesView.h
+++ b/Modules/Bundles/org.mitk.gui.qt.diffusionimaging/src/internal/QmitkControlVisualizationPropertiesView.h
@@ -1,142 +1,158 @@
/*=========================================================================
Program: Medical Imaging & Interaction Toolkit
Module: $RCSfile$
Language: C++
Date: $Date: 2009-05-28 17:19:30 +0200 (Do, 28 Mai 2009) $
Version: $Revision: 17495 $
Copyright (c) German Cancer Research Center, Division of Medical and
Biological Informatics. All rights reserved.
See MITKCopyright.txt or http://www.mitk.org/copyright.html for details.
This software is distributed WITHOUT ANY WARRANTY; without even
the implied warranty of MERCHANTABILITY or FITNESS FOR A PARTICULAR
PURPOSE. See the above copyright notices for more information.
=========================================================================*/
#ifndef _QMITKControlVisualizationPropertiesView_H_INCLUDED
#define _QMITKControlVisualizationPropertiesView_H_INCLUDED
#include <QmitkFunctionality.h>
#include <string>
#include "berryISelectionListener.h"
#include "berryIStructuredSelection.h"
#include "berryISizeProvider.h"
#include "ui_QmitkControlVisualizationPropertiesViewControls.h"
#include "mitkEnumerationProperty.h"
/*!
* \ingroup org_mitk_gui_qt_diffusionquantification_internal
*
* \brief QmitkControlVisualizationPropertiesView
*
* Document your class here.
*
* \sa QmitkFunctionality
*/
class QmitkControlVisualizationPropertiesView : public QmitkFunctionality//, public berry::ISizeProvider
{
friend struct CvpSelListener;
// this is needed for all Qt objects that should have a MOC object (everything that derives from QObject)
Q_OBJECT
public:
static const std::string VIEW_ID;
QmitkControlVisualizationPropertiesView();
QmitkControlVisualizationPropertiesView(const QmitkControlVisualizationPropertiesView& other);
virtual ~QmitkControlVisualizationPropertiesView();
virtual void CreateQtPartControl(QWidget *parent);
/// \brief Creation of the connections of main and control widget
virtual void CreateConnections();
/// \brief Called when the functionality is activated
virtual void Activated();
virtual void Deactivated();
virtual void StdMultiWidgetAvailable (QmitkStdMultiWidget &stdMultiWidget);
virtual void StdMultiWidgetNotAvailable();
mitk::DataStorage::SetOfObjects::Pointer ActiveSet(std::string);
void SetBoolProp (mitk::DataStorage::SetOfObjects::Pointer,std::string,bool);
void SetIntProp (mitk::DataStorage::SetOfObjects::Pointer,std::string,int);
void SetFloatProp(mitk::DataStorage::SetOfObjects::Pointer,std::string,float);
void SetLevelWindowProp(mitk::DataStorage::SetOfObjects::Pointer,std::string,mitk::LevelWindow);
void SetEnumProp (mitk::DataStorage::SetOfObjects::Pointer,std::string,mitk::EnumerationProperty::Pointer);
virtual int GetSizeFlags(bool width);
virtual int ComputePreferredSize(bool width, int availableParallel, int availablePerpendicular, int preferredResult);
protected slots:
void DisplayIndexChanged(int);
void TextIntON();
void Reinit();
void VisibleOdfsON(int view);
void VisibleOdfsON_S();
void VisibleOdfsON_T();
void VisibleOdfsON_C();
void ShowMaxNumberChanged();
void NormalizationDropdownChanged(int);
void ScalingFactorChanged(double);
void AdditionalScaling(int);
void IndexParam1Changed(double);
void IndexParam2Changed(double);
void OpacityChanged(double,double);
void ScalingCheckbox();
void OnThickSlicesModeSelected( QAction* action );
void OnTSNumChanged(int num);
void OnMenuAboutToShow ();
+ void BundleRepresentationWire();
+ void BundleRepresentationTube();
+ void BundleRepresentationColor();
+ void PlanarFigureFocus();
+
+ void SetInteractor();
+
+ void PFWidth(double);
+ void PFColor();
+
+ void Heatmap();
+
protected:
Ui::QmitkControlVisualizationPropertiesViewControls* m_Controls;
QmitkStdMultiWidget* m_MultiWidget;
berry::ISelectionListener::Pointer m_SelListener;
berry::IStructuredSelection::ConstPointer m_CurrentSelection;
bool m_FoundSingleOdfImage;
bool m_IsInitialized;
QIcon* m_IconTexOFF;
QIcon* m_IconTexON;
QIcon* m_IconGlyOFF_T;
QIcon* m_IconGlyON_T;
QIcon* m_IconGlyOFF_C;
QIcon* m_IconGlyON_C;
QIcon* m_IconGlyOFF_S;
QIcon* m_IconGlyON_S;
bool m_TexIsOn;
bool m_GlyIsOn_T;
bool m_GlyIsOn_C;
bool m_GlyIsOn_S;
int currentThickSlicesMode;
QLabel* m_TSLabel;
QMenu* m_MyMenu;
+
+ // for planarfigure and bundle handling:
+ mitk::DataNode* m_SelectedNode;
+ mitk::DataNode* m_CurrentPickingNode;
};
#endif // _QMITKControlVisualizationPropertiesView_H_INCLUDED
diff --git a/Modules/Bundles/org.mitk.gui.qt.diffusionimaging/src/internal/QmitkControlVisualizationPropertiesViewControls.ui b/Modules/Bundles/org.mitk.gui.qt.diffusionimaging/src/internal/QmitkControlVisualizationPropertiesViewControls.ui
index e9d1ba7d6b..8143cfa3c1 100644
--- a/Modules/Bundles/org.mitk.gui.qt.diffusionimaging/src/internal/QmitkControlVisualizationPropertiesViewControls.ui
+++ b/Modules/Bundles/org.mitk.gui.qt.diffusionimaging/src/internal/QmitkControlVisualizationPropertiesViewControls.ui
@@ -1,471 +1,700 @@
<?xml version="1.0" encoding="UTF-8"?>
<ui version="4.0">
<class>QmitkControlVisualizationPropertiesViewControls</class>
<widget class="QWidget" name="QmitkControlVisualizationPropertiesViewControls">
<property name="geometry">
<rect>
<x>0</x>
<y>0</y>
- <width>444</width>
- <height>134</height>
+ <width>414</width>
+ <height>268</height>
</rect>
</property>
<property name="sizePolicy">
<sizepolicy hsizetype="Preferred" vsizetype="MinimumExpanding">
<horstretch>0</horstretch>
<verstretch>100</verstretch>
</sizepolicy>
</property>
<property name="minimumSize">
<size>
<width>0</width>
<height>0</height>
</size>
</property>
<property name="windowTitle">
<string>QmitkTemplate</string>
</property>
- <layout class="QVBoxLayout" name="verticalLayout">
+ <layout class="QVBoxLayout" name="verticalLayout_3">
<property name="spacing">
<number>0</number>
</property>
<property name="margin">
<number>0</number>
</property>
<item>
- <widget class="QFrame" name="frame_2">
- <property name="sizePolicy">
- <sizepolicy hsizetype="Expanding" vsizetype="Preferred">
- <horstretch>0</horstretch>
- <verstretch>0</verstretch>
- </sizepolicy>
- </property>
+ <widget class="QFrame" name="m_ImageControlsFrame">
<property name="frameShape">
<enum>QFrame::NoFrame</enum>
</property>
<property name="frameShadow">
<enum>QFrame::Raised</enum>
</property>
- <layout class="QHBoxLayout" name="horizontalLayout_2">
+ <layout class="QVBoxLayout" name="verticalLayout">
<property name="margin">
<number>0</number>
</property>
<item>
- <widget class="QToolButton" name="m_Reinit">
- <property name="toolTip">
- <string comment="Reinit view" extracomment="Reinit view">Reinit view</string>
- </property>
- <property name="statusTip">
- <string comment="Reinit view" extracomment="Reinit view">Reinit view</string>
- </property>
- <property name="whatsThis">
- <string comment="Reinit view" extracomment="Reinit view">Reinit view</string>
- </property>
- <property name="text">
- <string/>
- </property>
- </widget>
- </item>
- <item>
- <widget class="QToolButton" name="m_TextureIntON">
- <property name="toolTip">
- <string comment="Texture interpolation ON" extracomment="Texture interpolation ON">Texture interpolation ON</string>
- </property>
- <property name="statusTip">
- <string comment="Texture interpolation ON" extracomment="Texture interpolation ON">Texture interpolation ON</string>
- </property>
- <property name="whatsThis">
- <string comment="Texture interpolation ON" extracomment="Texture interpolation ON">Texture interpolation ON</string>
- </property>
- <property name="text">
- <string/>
- </property>
- </widget>
- </item>
- <item>
- <widget class="QToolButton" name="m_VisibleOdfsON_T">
- <property name="toolTip">
- <string comment="Toggle visibility of ODF glyphs" extracomment="Toggle visibility of ODF glyphs">Toggle visibility of ODF glyphs</string>
- </property>
- <property name="statusTip">
- <string comment="Toggle visibility of ODF glyphs" extracomment="Toggle visibility of ODF glyphs">Toggle visibility of ODF glyphs</string>
- </property>
- <property name="whatsThis">
- <string comment="Toggle visibility of ODF glyphs" extracomment="Toggle visibility of ODF glyphs">Toggle visibility of ODF glyphs</string>
- </property>
- <property name="text">
- <string/>
- </property>
- </widget>
- </item>
- <item>
- <widget class="QToolButton" name="m_VisibleOdfsON_S">
- <property name="toolTip">
- <string comment="Toggle visibility of ODF glyphs" extracomment="Toggle visibility of ODF glyphs">Toggle visibility of ODF glyphs</string>
+ <widget class="QFrame" name="frame_2">
+ <property name="sizePolicy">
+ <sizepolicy hsizetype="Expanding" vsizetype="Preferred">
+ <horstretch>0</horstretch>
+ <verstretch>0</verstretch>
+ </sizepolicy>
</property>
- <property name="statusTip">
- <string comment="Toggle visibility of ODF glyphs" extracomment="Toggle visibility of ODF glyphs">Toggle visibility of ODF glyphs</string>
- </property>
- <property name="whatsThis">
- <string comment="Toggle visibility of ODF glyphs" extracomment="Toggle visibility of ODF glyphs">Toggle visibility of ODF glyphs</string>
- </property>
- <property name="text">
- <string/>
- </property>
- </widget>
- </item>
- <item>
- <widget class="QToolButton" name="m_VisibleOdfsON_C">
- <property name="toolTip">
- <string comment="Toggle visibility of ODF glyphs" extracomment="Toggle visibility of ODF glyphs">Toggle visibility of ODF glyphs</string>
- </property>
- <property name="statusTip">
- <string comment="Toggle visibility of ODF glyphs" extracomment="Toggle visibility of ODF glyphs">Toggle visibility of ODF glyphs</string>
- </property>
- <property name="whatsThis">
- <string comment="Toggle visibility of ODF glyphs" extracomment="Toggle visibility of ODF glyphs">Toggle visibility of ODF glyphs</string>
- </property>
- <property name="text">
- <string/>
- </property>
- </widget>
- </item>
- <item>
- <widget class="QToolButton" name="m_TSMenu">
- <property name="toolTip">
- <string comment="Toggle visibility of ODF glyphs" extracomment="Toggle visibility of ODF glyphs">Multislice Projection</string>
- </property>
- <property name="statusTip">
- <string comment="Toggle visibility of ODF glyphs" extracomment="Toggle visibility of ODF glyphs">Multislice Projection</string>
- </property>
- <property name="whatsThis">
- <string comment="Toggle visibility of ODF glyphs" extracomment="Toggle visibility of ODF glyphs">Multislice Projection</string>
- </property>
- <property name="text">
- <string>MIP</string>
- </property>
- <property name="popupMode">
- <enum>QToolButton::MenuButtonPopup</enum>
- </property>
- <property name="arrowType">
- <enum>Qt::NoArrow</enum>
- </property>
- </widget>
- </item>
- <item>
- <widget class="QLabel" name="label_channel">
- <property name="text">
- <string>Channel</string>
- </property>
- </widget>
- </item>
- <item>
- <widget class="QSlider" name="m_DisplayIndex">
- <property name="maximum">
- <number>300</number>
- </property>
- <property name="orientation">
- <enum>Qt::Horizontal</enum>
- </property>
- </widget>
- </item>
- <item>
- <widget class="QFrame" name="m_NumberGlyphsFrame">
<property name="frameShape">
<enum>QFrame::NoFrame</enum>
</property>
<property name="frameShadow">
- <enum>QFrame::Plain</enum>
+ <enum>QFrame::Raised</enum>
</property>
- <layout class="QHBoxLayout" name="horizontalLayout_6">
+ <layout class="QHBoxLayout" name="horizontalLayout_2">
<property name="margin">
<number>0</number>
</property>
<item>
- <spacer name="horizontalSpacer">
- <property name="orientation">
- <enum>Qt::Horizontal</enum>
+ <widget class="QToolButton" name="m_Reinit">
+ <property name="toolTip">
+ <string comment="Reinit view" extracomment="Reinit view">Reinit view</string>
</property>
- <property name="sizeHint" stdset="0">
- <size>
- <width>20</width>
- <height>20</height>
- </size>
+ <property name="statusTip">
+ <string comment="Reinit view" extracomment="Reinit view">Reinit view</string>
+ </property>
+ <property name="whatsThis">
+ <string comment="Reinit view" extracomment="Reinit view">Reinit view</string>
+ </property>
+ <property name="text">
+ <string/>
+ </property>
+ <property name="checkable">
+ <bool>true</bool>
+ </property>
+ <property name="checked">
+ <bool>false</bool>
+ </property>
+ </widget>
+ </item>
+ <item>
+ <widget class="QToolButton" name="m_TextureIntON">
+ <property name="toolTip">
+ <string comment="Texture interpolation ON" extracomment="Texture interpolation ON">Texture interpolation ON</string>
+ </property>
+ <property name="statusTip">
+ <string comment="Texture interpolation ON" extracomment="Texture interpolation ON">Texture interpolation ON</string>
+ </property>
+ <property name="whatsThis">
+ <string comment="Texture interpolation ON" extracomment="Texture interpolation ON">Texture interpolation ON</string>
+ </property>
+ <property name="text">
+ <string/>
+ </property>
+ <property name="checkable">
+ <bool>true</bool>
+ </property>
+ <property name="checked">
+ <bool>false</bool>
+ </property>
+ </widget>
+ </item>
+ <item>
+ <widget class="QToolButton" name="m_VisibleOdfsON_T">
+ <property name="toolTip">
+ <string comment="Toggle visibility of ODF glyphs" extracomment="Toggle visibility of ODF glyphs">Toggle visibility of ODF glyphs</string>
+ </property>
+ <property name="statusTip">
+ <string comment="Toggle visibility of ODF glyphs" extracomment="Toggle visibility of ODF glyphs">Toggle visibility of ODF glyphs</string>
+ </property>
+ <property name="whatsThis">
+ <string comment="Toggle visibility of ODF glyphs" extracomment="Toggle visibility of ODF glyphs">Toggle visibility of ODF glyphs</string>
+ </property>
+ <property name="text">
+ <string/>
+ </property>
+ <property name="checkable">
+ <bool>true</bool>
+ </property>
+ <property name="checked">
+ <bool>false</bool>
+ </property>
+ </widget>
+ </item>
+ <item>
+ <widget class="QToolButton" name="m_VisibleOdfsON_S">
+ <property name="toolTip">
+ <string comment="Toggle visibility of ODF glyphs" extracomment="Toggle visibility of ODF glyphs">Toggle visibility of ODF glyphs</string>
+ </property>
+ <property name="statusTip">
+ <string comment="Toggle visibility of ODF glyphs" extracomment="Toggle visibility of ODF glyphs">Toggle visibility of ODF glyphs</string>
</property>
- </spacer>
+ <property name="whatsThis">
+ <string comment="Toggle visibility of ODF glyphs" extracomment="Toggle visibility of ODF glyphs">Toggle visibility of ODF glyphs</string>
+ </property>
+ <property name="text">
+ <string/>
+ </property>
+ <property name="checkable">
+ <bool>true</bool>
+ </property>
+ <property name="checked">
+ <bool>false</bool>
+ </property>
+ </widget>
</item>
<item>
- <widget class="QLabel" name="label_glyphs">
+ <widget class="QToolButton" name="m_VisibleOdfsON_C">
+ <property name="toolTip">
+ <string comment="Toggle visibility of ODF glyphs" extracomment="Toggle visibility of ODF glyphs">Toggle visibility of ODF glyphs</string>
+ </property>
+ <property name="statusTip">
+ <string comment="Toggle visibility of ODF glyphs" extracomment="Toggle visibility of ODF glyphs">Toggle visibility of ODF glyphs</string>
+ </property>
+ <property name="whatsThis">
+ <string comment="Toggle visibility of ODF glyphs" extracomment="Toggle visibility of ODF glyphs">Toggle visibility of ODF glyphs</string>
+ </property>
<property name="text">
- <string>#Glyphs</string>
+ <string/>
+ </property>
+ <property name="checkable">
+ <bool>true</bool>
+ </property>
+ <property name="checked">
+ <bool>false</bool>
+ </property>
+ </widget>
+ </item>
+ <item>
+ <widget class="QToolButton" name="m_TSMenu">
+ <property name="toolTip">
+ <string comment="Toggle visibility of ODF glyphs" extracomment="Toggle visibility of ODF glyphs">Multislice Projection</string>
+ </property>
+ <property name="statusTip">
+ <string comment="Toggle visibility of ODF glyphs" extracomment="Toggle visibility of ODF glyphs">Multislice Projection</string>
+ </property>
+ <property name="whatsThis">
+ <string comment="Toggle visibility of ODF glyphs" extracomment="Toggle visibility of ODF glyphs">Multislice Projection</string>
+ </property>
+ <property name="text">
+ <string>MIP</string>
+ </property>
+ <property name="popupMode">
+ <enum>QToolButton::MenuButtonPopup</enum>
+ </property>
+ <property name="arrowType">
+ <enum>Qt::NoArrow</enum>
</property>
</widget>
</item>
<item>
- <widget class="QSpinBox" name="m_ShowMaxNumber">
+ <widget class="QLabel" name="label_channel">
+ <property name="text">
+ <string>Channel</string>
+ </property>
+ </widget>
+ </item>
+ <item>
+ <widget class="QSlider" name="m_DisplayIndex">
<property name="maximum">
- <number>9999</number>
+ <number>300</number>
+ </property>
+ <property name="orientation">
+ <enum>Qt::Horizontal</enum>
</property>
</widget>
</item>
+ <item>
+ <widget class="QFrame" name="m_NumberGlyphsFrame">
+ <property name="frameShape">
+ <enum>QFrame::NoFrame</enum>
+ </property>
+ <property name="frameShadow">
+ <enum>QFrame::Plain</enum>
+ </property>
+ <layout class="QHBoxLayout" name="horizontalLayout_6">
+ <property name="margin">
+ <number>0</number>
+ </property>
+ <item>
+ <spacer name="horizontalSpacer">
+ <property name="orientation">
+ <enum>Qt::Horizontal</enum>
+ </property>
+ <property name="sizeHint" stdset="0">
+ <size>
+ <width>20</width>
+ <height>20</height>
+ </size>
+ </property>
+ </spacer>
+ </item>
+ <item>
+ <widget class="QLabel" name="label_glyphs">
+ <property name="text">
+ <string>#Glyphs</string>
+ </property>
+ </widget>
+ </item>
+ <item>
+ <widget class="QSpinBox" name="m_ShowMaxNumber">
+ <property name="maximum">
+ <number>9999</number>
+ </property>
+ </widget>
+ </item>
+ </layout>
+ </widget>
+ </item>
</layout>
</widget>
</item>
- </layout>
- </widget>
- </item>
- <item>
- <widget class="QFrame" name="OpacMinFrame">
- <property name="frameShape">
- <enum>QFrame::NoFrame</enum>
- </property>
- <property name="frameShadow">
- <enum>QFrame::Plain</enum>
- </property>
- <layout class="QHBoxLayout" name="horizontalLayout_4">
- <property name="margin">
- <number>0</number>
- </property>
- <item>
- <widget class="QLabel" name="label_4">
- <property name="text">
- <string>Opacity</string>
- </property>
- </widget>
- </item>
- <item>
- <widget class="QmitkFloatingPointSpanSlider" name="m_OpacitySlider">
- <property name="maximum">
- <number>100</number>
- </property>
- <property name="orientation">
- <enum>Qt::Horizontal</enum>
- </property>
- </widget>
- </item>
<item>
- <widget class="QLabel" name="m_OpacityMinFaLabel">
- <property name="minimumSize">
- <size>
- <width>80</width>
- <height>0</height>
- </size>
+ <widget class="QFrame" name="OpacMinFrame">
+ <property name="frameShape">
+ <enum>QFrame::NoFrame</enum>
</property>
- <property name="text">
- <string>0.0 : 0.0</string>
+ <property name="frameShadow">
+ <enum>QFrame::Plain</enum>
</property>
+ <layout class="QHBoxLayout" name="horizontalLayout_4">
+ <property name="margin">
+ <number>0</number>
+ </property>
+ <item>
+ <widget class="QLabel" name="label_4">
+ <property name="text">
+ <string>Opacity</string>
+ </property>
+ </widget>
+ </item>
+ <item>
+ <widget class="QmitkFloatingPointSpanSlider" name="m_OpacitySlider">
+ <property name="maximum">
+ <number>100</number>
+ </property>
+ <property name="orientation">
+ <enum>Qt::Horizontal</enum>
+ </property>
+ </widget>
+ </item>
+ <item>
+ <widget class="QLabel" name="m_OpacityMinFaLabel">
+ <property name="minimumSize">
+ <size>
+ <width>80</width>
+ <height>0</height>
+ </size>
+ </property>
+ <property name="text">
+ <string>0.0 : 0.0</string>
+ </property>
+ </widget>
+ </item>
+ </layout>
</widget>
</item>
- </layout>
- </widget>
- </item>
- <item>
- <widget class="QFrame" name="frame">
- <property name="frameShape">
- <enum>QFrame::NoFrame</enum>
- </property>
- <property name="frameShadow">
- <enum>QFrame::Raised</enum>
- </property>
- <layout class="QVBoxLayout" name="verticalLayout_2">
- <property name="spacing">
- <number>0</number>
- </property>
- <property name="margin">
- <number>0</number>
- </property>
<item>
- <widget class="QFrame" name="m_NormalizationScalingFrame">
+ <widget class="QFrame" name="frame">
<property name="frameShape">
<enum>QFrame::NoFrame</enum>
</property>
<property name="frameShadow">
<enum>QFrame::Raised</enum>
</property>
- <layout class="QGridLayout" name="gridLayout">
- <property name="margin">
+ <layout class="QVBoxLayout" name="verticalLayout_2">
+ <property name="spacing">
<number>0</number>
</property>
- <property name="spacing">
+ <property name="margin">
<number>0</number>
</property>
- <item row="1" column="1">
- <widget class="QFrame" name="m_ScalingFrame">
+ <item>
+ <widget class="QFrame" name="m_NormalizationScalingFrame">
<property name="frameShape">
<enum>QFrame::NoFrame</enum>
</property>
<property name="frameShadow">
- <enum>QFrame::Plain</enum>
+ <enum>QFrame::Raised</enum>
</property>
- <layout class="QHBoxLayout" name="horizontalLayout_3">
+ <layout class="QGridLayout" name="gridLayout">
<property name="margin">
<number>0</number>
</property>
- <item>
- <widget class="QComboBox" name="m_AdditionalScaling">
+ <property name="spacing">
+ <number>0</number>
+ </property>
+ <item row="1" column="1">
+ <widget class="QFrame" name="m_ScalingFrame">
+ <property name="frameShape">
+ <enum>QFrame::NoFrame</enum>
+ </property>
+ <property name="frameShadow">
+ <enum>QFrame::Plain</enum>
+ </property>
+ <layout class="QHBoxLayout" name="horizontalLayout_3">
+ <property name="margin">
+ <number>0</number>
+ </property>
+ <item>
+ <widget class="QComboBox" name="m_AdditionalScaling">
+ <property name="frame">
+ <bool>false</bool>
+ </property>
+ <item>
+ <property name="text">
+ <string>None</string>
+ </property>
+ </item>
+ <item>
+ <property name="text">
+ <string>By GFA</string>
+ </property>
+ </item>
+ <item>
+ <property name="text">
+ <string>By ASR</string>
+ </property>
+ </item>
+ </widget>
+ </item>
+ <item>
+ <widget class="QLabel" name="label">
+ <property name="text">
+ <string>*</string>
+ </property>
+ </widget>
+ </item>
+ <item>
+ <widget class="QDoubleSpinBox" name="m_ScalingFactor"/>
+ </item>
+ </layout>
+ </widget>
+ </item>
+ <item row="0" column="1">
+ <widget class="QCheckBox" name="m_ScalingCheckbox">
+ <property name="text">
+ <string>Scaling</string>
+ </property>
+ </widget>
+ </item>
+ <item row="1" column="0">
+ <widget class="QFrame" name="m_NormalizationFrame">
+ <property name="frameShape">
+ <enum>QFrame::NoFrame</enum>
+ </property>
+ <property name="frameShadow">
+ <enum>QFrame::Plain</enum>
+ </property>
+ <layout class="QHBoxLayout" name="horizontalLayout_5">
+ <property name="spacing">
+ <number>0</number>
+ </property>
+ <property name="margin">
+ <number>0</number>
+ </property>
+ </layout>
+ </widget>
+ </item>
+ <item row="0" column="0">
+ <widget class="QComboBox" name="m_NormalizationDropdown">
<property name="frame">
<bool>false</bool>
</property>
<item>
<property name="text">
- <string>None</string>
+ <string>Min-Max</string>
</property>
</item>
<item>
<property name="text">
- <string>By GFA</string>
+ <string>Max</string>
</property>
</item>
<item>
<property name="text">
- <string>By ASR</string>
+ <string>None</string>
+ </property>
+ </item>
+ <item>
+ <property name="text">
+ <string>Global-Max</string>
</property>
</item>
</widget>
</item>
- <item>
- <widget class="QLabel" name="label">
- <property name="text">
- <string>*</string>
- </property>
- </widget>
- </item>
- <item>
- <widget class="QDoubleSpinBox" name="m_ScalingFactor"/>
- </item>
</layout>
</widget>
</item>
- <item row="0" column="1">
- <widget class="QCheckBox" name="m_ScalingCheckbox">
- <property name="text">
- <string>Scaling</string>
- </property>
- </widget>
- </item>
- <item row="1" column="0">
- <widget class="QFrame" name="m_NormalizationFrame">
+ <item>
+ <widget class="QFrame" name="params_frame">
<property name="frameShape">
<enum>QFrame::NoFrame</enum>
</property>
<property name="frameShadow">
- <enum>QFrame::Plain</enum>
+ <enum>QFrame::Raised</enum>
</property>
- <layout class="QHBoxLayout" name="horizontalLayout_5">
- <property name="spacing">
- <number>0</number>
- </property>
+ <layout class="QHBoxLayout" name="horizontalLayout">
<property name="margin">
<number>0</number>
</property>
+ <item>
+ <widget class="QLabel" name="label_2">
+ <property name="text">
+ <string>Param1</string>
+ </property>
+ </widget>
+ </item>
+ <item>
+ <widget class="QDoubleSpinBox" name="m_IndexParam1">
+ <property name="maximum">
+ <double>9999.989999999999782</double>
+ </property>
+ </widget>
+ </item>
+ <item>
+ <widget class="QLabel" name="label_3">
+ <property name="text">
+ <string>Param2</string>
+ </property>
+ </widget>
+ </item>
+ <item>
+ <widget class="QDoubleSpinBox" name="m_IndexParam2">
+ <property name="maximum">
+ <double>9999.989999999999782</double>
+ </property>
+ </widget>
+ </item>
</layout>
</widget>
</item>
- <item row="0" column="0">
- <widget class="QComboBox" name="m_NormalizationDropdown">
- <property name="frame">
- <bool>false</bool>
- </property>
- <item>
- <property name="text">
- <string>Min-Max</string>
- </property>
- </item>
- <item>
- <property name="text">
- <string>Max</string>
- </property>
- </item>
- <item>
- <property name="text">
- <string>None</string>
- </property>
- </item>
- <item>
- <property name="text">
- <string>Global-Max</string>
- </property>
- </item>
- </widget>
- </item>
</layout>
</widget>
</item>
- <item>
- <widget class="QFrame" name="params_frame">
+ </layout>
+ </widget>
+ </item>
+ <item>
+ <widget class="QFrame" name="m_BundleControlsFrame">
+ <property name="frameShape">
+ <enum>QFrame::NoFrame</enum>
+ </property>
+ <property name="frameShadow">
+ <enum>QFrame::Raised</enum>
+ </property>
+ <layout class="QGridLayout" name="gridLayout_2">
+ <property name="verticalSpacing">
+ <number>3</number>
+ </property>
+ <property name="margin">
+ <number>0</number>
+ </property>
+ <item row="0" column="0">
+ <widget class="QFrame" name="frame_3">
<property name="frameShape">
<enum>QFrame::NoFrame</enum>
</property>
<property name="frameShadow">
<enum>QFrame::Raised</enum>
</property>
- <layout class="QHBoxLayout" name="horizontalLayout">
+ <layout class="QGridLayout" name="gridLayout_3">
<property name="margin">
<number>0</number>
</property>
- <item>
- <widget class="QLabel" name="label_2">
+ <item row="3" column="0">
+ <widget class="QLabel" name="label_5">
+ <property name="maximumSize">
+ <size>
+ <width>43</width>
+ <height>16777215</height>
+ </size>
+ </property>
<property name="text">
- <string>Param1</string>
+ <string>Width</string>
</property>
</widget>
</item>
- <item>
- <widget class="QDoubleSpinBox" name="m_IndexParam1">
- <property name="maximum">
- <double>9999.989999999999782</double>
+ <item row="3" column="1">
+ <widget class="QSpinBox" name="m_LineWidth">
+ <property name="maximumSize">
+ <size>
+ <width>43</width>
+ <height>16777215</height>
+ </size>
+ </property>
+ <property name="value">
+ <number>1</number>
</property>
</widget>
</item>
- <item>
- <widget class="QLabel" name="label_3">
+ <item row="3" column="2">
+ <widget class="QPushButton" name="m_Wire">
<property name="text">
- <string>Param2</string>
+ <string>Wire</string>
</property>
</widget>
</item>
- <item>
- <widget class="QDoubleSpinBox" name="m_IndexParam2">
+ <item row="3" column="3">
+ <widget class="QPushButton" name="m_Color">
+ <property name="text">
+ <string>Set Color</string>
+ </property>
+ </widget>
+ </item>
+ <item row="7" column="2">
+ <widget class="QPushButton" name="m_Tube">
+ <property name="text">
+ <string>Tube</string>
+ </property>
+ </widget>
+ </item>
+ <item row="7" column="3">
+ <widget class="QToolButton" name="m_SetInteractor">
+ <property name="text">
+ <string>Position Crosshair 3D</string>
+ </property>
+ <property name="checkable">
+ <bool>true</bool>
+ </property>
+ <property name="checked">
+ <bool>false</bool>
+ </property>
+ </widget>
+ </item>
+ <item row="7" column="1">
+ <widget class="QDoubleSpinBox" name="m_TubeRadius">
+ <property name="maximumSize">
+ <size>
+ <width>59</width>
+ <height>16777215</height>
+ </size>
+ </property>
<property name="maximum">
- <double>9999.989999999999782</double>
+ <double>10.000000000000000</double>
+ </property>
+ <property name="singleStep">
+ <double>0.050000000000000</double>
+ </property>
+ <property name="value">
+ <double>0.150000000000000</double>
+ </property>
+ </widget>
+ </item>
+ <item row="7" column="0">
+ <widget class="QLabel" name="label_6">
+ <property name="maximumSize">
+ <size>
+ <width>47</width>
+ <height>16777215</height>
+ </size>
+ </property>
+ <property name="text">
+ <string>Radius</string>
</property>
</widget>
</item>
</layout>
</widget>
</item>
+ <item row="1" column="0">
+ <widget class="QPushButton" name="m_2DHeatmap">
+ <property name="text">
+ <string>Generate 2D Heatmap</string>
+ </property>
+ </widget>
+ </item>
+ </layout>
+ </widget>
+ </item>
+ <item>
+ <widget class="QFrame" name="m_PlanarFigureControlsFrame">
+ <property name="frameShape">
+ <enum>QFrame::NoFrame</enum>
+ </property>
+ <property name="frameShadow">
+ <enum>QFrame::Raised</enum>
+ </property>
+ <layout class="QHBoxLayout" name="horizontalLayout_7">
+ <property name="margin">
+ <number>0</number>
+ </property>
+ <item>
+ <widget class="QPushButton" name="m_Focus">
+ <property name="text">
+ <string>Focus Planar Figure</string>
+ </property>
+ </widget>
+ </item>
+ <item>
+ <widget class="QToolButton" name="m_PFColor">
+ <property name="text">
+ <string>Color</string>
+ </property>
+ </widget>
+ </item>
+ <item>
+ <widget class="QLabel" name="label_7">
+ <property name="text">
+ <string>Width</string>
+ </property>
+ <property name="alignment">
+ <set>Qt::AlignRight|Qt::AlignTrailing|Qt::AlignVCenter</set>
+ </property>
+ </widget>
+ </item>
+ <item>
+ <widget class="QDoubleSpinBox" name="m_PFWidth">
+ <property name="decimals">
+ <number>1</number>
+ </property>
+ <property name="singleStep">
+ <double>0.100000000000000</double>
+ </property>
+ <property name="value">
+ <double>2.000000000000000</double>
+ </property>
+ </widget>
+ </item>
</layout>
</widget>
</item>
<item>
<spacer name="spacer1">
<property name="orientation">
<enum>Qt::Vertical</enum>
</property>
<property name="sizeType">
<enum>QSizePolicy::Expanding</enum>
</property>
<property name="sizeHint" stdset="0">
<size>
<width>0</width>
<height>0</height>
</size>
</property>
</spacer>
</item>
</layout>
</widget>
<layoutdefault spacing="6" margin="11"/>
<customwidgets>
<customwidget>
<class>QmitkFloatingPointSpanSlider</class>
<extends>QSlider</extends>
<header>QmitkFloatingPointSpanSlider.h</header>
</customwidget>
</customwidgets>
<includes>
<include location="local">QmitkDataStorageComboBox.h</include>
</includes>
<resources/>
<connections/>
</ui>
diff --git a/Modules/Bundles/org.mitk.gui.qt.diffusionimaging/src/internal/QmitkGlobalFiberTrackingView.cpp b/Modules/Bundles/org.mitk.gui.qt.diffusionimaging/src/internal/QmitkGlobalFiberTrackingView.cpp
new file mode 100644
index 0000000000..30e297870c
--- /dev/null
+++ b/Modules/Bundles/org.mitk.gui.qt.diffusionimaging/src/internal/QmitkGlobalFiberTrackingView.cpp
@@ -0,0 +1,699 @@
+/*=========================================================================
+Copyright (c) German Cancer Research Center, Division of Medical and
+Biological Informatics. All rights reserved.
+See MITKCopyright.txt or http://www.mitk.org/copyright.html for details.
+
+This software is distributed WITHOUT ANY WARRANTY; without even
+the implied warranty of MERCHANTABILITY or FITNESS FOR A PARTICULAR
+PURPOSE. See the above copyright notices for more information.
+
+=========================================================================*/
+
+// Blueberry
+#include <berryISelectionService.h>
+#include <berryIWorkbenchWindow.h>
+
+// Qmitk
+#include "QmitkGlobalFiberTrackingView.h"
+#include <QmitkStdMultiWidget.h>
+
+// Qt
+#include <QMessageBox>
+#include <QFileDialog>
+#include <QDir>
+
+// MITK
+#include <mitkImageCast.h>
+#include <mitkImageToItk.h>
+#include <mitkImageAccessByItk.h>
+#include <mitkProgressBar.h>
+
+// ITK
+#include <itkGlobalTractographyFilter.h>
+#include <itkResampleImageFilter.h>
+
+// MISC
+#include <tinyxml.h>
+
+
+QmitkTrackingWorker::QmitkTrackingWorker(QmitkGlobalFiberTrackingView* view)
+ : m_View(view)
+{
+
+}
+
+void QmitkTrackingWorker::run()
+{
+ MITK_INFO << "Resampling mask images";
+ // setup resampler
+ typedef itk::ResampleImageFilter<QmitkGlobalFiberTrackingView::MaskImgType, QmitkGlobalFiberTrackingView::MaskImgType, float> ResamplerType;
+ ResamplerType::Pointer resampler = ResamplerType::New();
+ resampler->SetOutputSpacing( m_View->m_ItkQBallImage->GetSpacing() );
+ resampler->SetOutputOrigin( m_View->m_ItkQBallImage->GetOrigin() );
+ resampler->SetOutputDirection( m_View->m_ItkQBallImage->GetDirection() );
+ resampler->SetSize( m_View->m_ItkQBallImage->GetLargestPossibleRegion().GetSize() );
+
+ // resample mask image
+ resampler->SetInput( m_View->m_MaskImage );
+ resampler->SetDefaultPixelValue(0);
+ resampler->Update();
+ m_View->m_MaskImage = resampler->GetOutput();
+
+ m_View->m_GlobalTracker = QmitkGlobalFiberTrackingView::GlobalTrackingFilterType::New();
+ m_View->m_GlobalTracker->SetInput0(m_View->m_ItkQBallImage.GetPointer());
+ m_View->m_GlobalTracker->SetMaskImage(m_View->m_MaskImage);
+ m_View->m_GlobalTracker->SetTempStart((float)m_View->m_Controls->m_StartTempSlider->value()/100);
+ m_View->m_GlobalTracker->SetTempEnd((float)m_View->m_Controls->m_EndTempSlider->value()/10000);
+ m_View->m_GlobalTracker->SetNumIt(m_View->m_Iterations);
+ m_View->m_GlobalTracker->SetParticleWeight((float)m_View->m_Controls->m_ParticleWeightSlider->value()/10000);
+ m_View->m_GlobalTracker->SetSubtractMean(m_View->m_Controls->m_MeanSubtractionCheckbox->isChecked());
+ m_View->m_GlobalTracker->SetParticleWidth((float)(m_View->m_Controls->m_ParticleWidthSlider->value())/10);
+ m_View->m_GlobalTracker->SetParticleLength((float)(m_View->m_Controls->m_ParticleLengthSlider->value())/10);
+ m_View->m_GlobalTracker->SetInexBalance((float)m_View->m_Controls->m_InExBalanceSlider->value()/10);
+ m_View->m_GlobalTracker->SetFiberLength(m_View->m_Controls->m_FiberLengthSlider->value());
+
+ m_View->m_GlobalTracker->Update();
+ m_View->m_TrackingThread.quit();
+}
+
+const std::string QmitkGlobalFiberTrackingView::VIEW_ID =
+"org.mitk.views.globalfibertracking";
+
+QmitkGlobalFiberTrackingView::QmitkGlobalFiberTrackingView()
+ : QmitkFunctionality()
+ , m_Controls( 0 )
+ , m_MultiWidget( NULL )
+ , m_ThreadIsRunning(false)
+ , m_GlobalTracker(NULL)
+ , m_QBallImage(NULL)
+ , m_MaskImage(NULL)
+ , m_QBallImageNode(NULL)
+ , m_ItkQBallImage(NULL)
+ , m_FiberBundleNode(NULL)
+ , m_TrackingWorker(this)
+ , m_QBallSelected(false)
+ , m_FibSelected(false)
+ , m_Iterations(10000000)
+ , m_LastStep(0)
+{
+ m_TrackingWorker.moveToThread(&m_TrackingThread);
+ connect(&m_TrackingThread, SIGNAL(started()), this, SLOT(BeforeThread()));
+ connect(&m_TrackingThread, SIGNAL(started()), &m_TrackingWorker, SLOT(run()));
+ connect(&m_TrackingThread, SIGNAL(finished()), this, SLOT(AfterThread()));
+ connect(&m_TrackingThread, SIGNAL(terminated()), this, SLOT(AfterThread()));
+ m_TrackingTimer = new QTimer(this);
+}
+
+QmitkGlobalFiberTrackingView::~QmitkGlobalFiberTrackingView()
+{
+ delete m_TrackingTimer;
+}
+
+// update tracking status and generate fiber bundle
+void QmitkGlobalFiberTrackingView::TimerUpdate()
+{
+ mitk::ProgressBar::GetInstance()->Progress(m_GlobalTracker->GetCurrentStep()-m_LastStep);
+ m_LastStep = m_GlobalTracker->GetCurrentStep();
+ UpdateTrackingStatus();
+ GenerateFiberBundle();
+}
+
+// tell global tractography filter to stop after current step
+void QmitkGlobalFiberTrackingView::StopGlobalTracking()
+{
+ if (m_GlobalTracker.IsNull())
+ return;
+ m_GlobalTracker->SetAbortTracking(true);
+ m_Controls->m_GlobalTrackingStop->setEnabled(false);
+ m_Controls->m_GlobalTrackingStop->setText("Stopping Tractography ...");
+}
+
+// update gui elements and generate fiber bundle after tracking is finished
+void QmitkGlobalFiberTrackingView::AfterThread()
+{
+ m_ThreadIsRunning = false;
+ m_TrackingTimer->stop();
+
+ UpdateGUI();
+ UpdateTrackingStatus();
+ GenerateFiberBundle();
+}
+
+// start tracking timer and update gui elements before tracking is started
+void QmitkGlobalFiberTrackingView::BeforeThread()
+{
+ m_ThreadIsRunning = true;
+ m_TrackingTime = QTime::currentTime();
+ m_ElapsedTime = 0;
+ m_TrackingTimer->start(1000);
+
+ UpdateGUI();
+}
+
+// setup gui elements and signal/slot connections
+void QmitkGlobalFiberTrackingView::CreateQtPartControl( QWidget *parent )
+{
+ // build up qt view, unless already done
+ if ( !m_Controls )
+ {
+ // create GUI widgets from the Qt Designer's .ui file
+ m_Controls = new Ui::QmitkGlobalFiberTrackingViewControls;
+ m_Controls->setupUi( parent );
+
+ AdvancedSettings();
+
+ connect( m_TrackingTimer, SIGNAL(timeout()), this, SLOT(TimerUpdate()) );
+ connect( m_Controls->m_GlobalTrackingStop, SIGNAL(clicked()), this, SLOT(StopGlobalTracking()) );
+ connect( m_Controls->m_GlobalTrackingStart, SIGNAL(clicked()), this, SLOT(StartGlobalTracking()) );
+ connect( m_Controls->m_SetMaskButton, SIGNAL(clicked()), this, SLOT(SetMask()) );
+ connect( m_Controls->m_AdvancedSettingsCheckbox, SIGNAL(clicked()), this, SLOT(AdvancedSettings()) );
+ connect( m_Controls->m_SaveTrackingParameters, SIGNAL(clicked()), this, SLOT(SaveTrackingParameters()) );
+ connect( m_Controls->m_LoadTrackingParameters, SIGNAL(clicked()), this, SLOT(LoadTrackingParameters()) );
+ connect( m_Controls->m_IterationsSlider, SIGNAL(valueChanged(int)), this, SLOT(SetIterations(int)) );
+ connect( m_Controls->m_ParticleWidthSlider, SIGNAL(valueChanged(int)), this, SLOT(SetParticleWidth(int)) );
+ connect( m_Controls->m_ParticleLengthSlider, SIGNAL(valueChanged(int)), this, SLOT(SetParticleLength(int)) );
+ connect( m_Controls->m_InExBalanceSlider, SIGNAL(valueChanged(int)), this, SLOT(SetInExBalance(int)) );
+ connect( m_Controls->m_FiberLengthSlider, SIGNAL(valueChanged(int)), this, SLOT(SetFiberLength(int)) );
+ connect( m_Controls->m_ParticleWeightSlider, SIGNAL(valueChanged(int)), this, SLOT(SetParticleWeight(int)) );
+ connect( m_Controls->m_StartTempSlider, SIGNAL(valueChanged(int)), this, SLOT(SetStartTemp(int)) );
+ connect( m_Controls->m_EndTempSlider, SIGNAL(valueChanged(int)), this, SLOT(SetEndTemp(int)) );
+ }
+}
+
+void QmitkGlobalFiberTrackingView::SetInExBalance(int value)
+{
+ m_Controls->m_InExBalanceLabel->setText(QString::number((float)value/10));
+}
+
+void QmitkGlobalFiberTrackingView::SetFiberLength(int value)
+{
+ m_Controls->m_FiberLengthLabel->setText(QString::number(value));
+}
+
+void QmitkGlobalFiberTrackingView::SetParticleWeight(int value)
+{
+ m_Controls->m_ParticleWeightLabel->setText(QString::number((float)value/10000));
+}
+
+void QmitkGlobalFiberTrackingView::SetStartTemp(int value)
+{
+ m_Controls->m_StartTempLabel->setText(QString::number((float)value/100));
+}
+
+void QmitkGlobalFiberTrackingView::SetEndTemp(int value)
+{
+ m_Controls->m_EndTempLabel->setText(QString::number((float)value/10000));
+}
+
+void QmitkGlobalFiberTrackingView::SetParticleWidth(int value)
+{
+ if (value>0)
+ m_Controls->m_ParticleWidthLabel->setText(QString::number((float)value/10)+" mm");
+ else
+ m_Controls->m_ParticleWidthLabel->setText("auto");
+}
+
+void QmitkGlobalFiberTrackingView::SetParticleLength(int value)
+{
+ if (value>0)
+ m_Controls->m_ParticleLengthLabel->setText(QString::number((float)value/10)+" mm");
+ else
+ m_Controls->m_ParticleLengthLabel->setText("auto");
+}
+
+void QmitkGlobalFiberTrackingView::SetIterations(int value)
+{
+ switch(value)
+ {
+ case 0:
+ m_Controls->m_IterationsLabel->setText("Iterations: 10^4");
+ m_Iterations = 10000;
+ break;
+ case 1:
+ m_Controls->m_IterationsLabel->setText("Iterations: 5x10^4");
+ m_Iterations = 50000;
+ break;
+ case 2:
+ m_Controls->m_IterationsLabel->setText("Iterations: 10^5");
+ m_Iterations = 100000;
+ break;
+ case 3:
+ m_Controls->m_IterationsLabel->setText("Iterations: 5x10^5");
+ m_Iterations = 500000;
+ break;
+ case 4:
+ m_Controls->m_IterationsLabel->setText("Iterations: 10^6");
+ m_Iterations = 1000000;
+ break;
+ case 5:
+ m_Controls->m_IterationsLabel->setText("Iterations: 5x10^6");
+ m_Iterations = 5000000;
+ break;
+ case 6:
+ m_Controls->m_IterationsLabel->setText("Iterations: 10^7");
+ m_Iterations = 10000000;
+ break;
+ case 7:
+ m_Controls->m_IterationsLabel->setText("Iterations: 5x10^7");
+ m_Iterations = 50000000;
+ break;
+ case 8:
+ m_Controls->m_IterationsLabel->setText("10^8");
+ m_Iterations = 100000000;
+ break;
+ case 9:
+ m_Controls->m_IterationsLabel->setText("Iterations: 5x10^8");
+ m_Iterations = 500000000;
+ break;
+ case 10:
+ m_Controls->m_IterationsLabel->setText("Iterations: 10^9");
+ m_Iterations = 1000000000;
+ break;
+ case 11:
+ m_Controls->m_IterationsLabel->setText("Iterations: 5x10^9");
+ m_Iterations = 5000000000;
+ break;
+ }
+
+}
+
+void QmitkGlobalFiberTrackingView::StdMultiWidgetAvailable(QmitkStdMultiWidget &stdMultiWidget)
+{
+ m_MultiWidget = &stdMultiWidget;
+}
+
+void QmitkGlobalFiberTrackingView::StdMultiWidgetNotAvailable()
+{
+ m_MultiWidget = NULL;
+}
+
+// called if datamanager selection changes
+void QmitkGlobalFiberTrackingView::OnSelectionChanged( std::vector<mitk::DataNode*> nodes )
+{
+ m_QBallSelected = false;
+ m_FibSelected = false;
+
+ // iterate all selected objects
+ for( std::vector<mitk::DataNode*>::iterator it = nodes.begin(); it != nodes.end(); ++it )
+ {
+ mitk::DataNode::Pointer node = *it;
+
+ if( node.IsNotNull() && dynamic_cast<mitk::QBallImage*>(node->GetData()) )
+ {
+ m_QBallSelected = true;
+ m_QBallImageNode = node;
+ }
+ else if (node.IsNotNull() && dynamic_cast<mitk::FiberBundle*>(node->GetData()))
+ {
+ m_FibSelected = true;
+ m_FiberBundleNode = node;
+ }
+ }
+
+ UpdateGUI();
+}
+
+// update gui elements displaying trackings status
+void QmitkGlobalFiberTrackingView::UpdateTrackingStatus()
+{
+ if (m_GlobalTracker.IsNull())
+ return;
+
+ m_ElapsedTime += m_TrackingTime.elapsed()/1000;
+ m_TrackingTime.restart();
+ unsigned long hours = m_ElapsedTime/3600;
+ unsigned long minutes = (m_ElapsedTime%3600)/60;
+ unsigned long seconds = m_ElapsedTime%60;
+
+ m_Controls->m_ProposalAcceptance->setText(QString::number(m_GlobalTracker->GetProposalAcceptance()*100)+"%");
+
+ m_Controls->m_TrackingTimeLabel->setText( QString::number(hours)+QString("h ")+QString::number(minutes)+QString("m ")+QString::number(seconds)+QString("s") );
+ m_Controls->m_NumConnectionsLabel->setText( QString::number(m_GlobalTracker->GetNumConnections()) );
+ m_Controls->m_NumParticlesLabel->setText( QString::number(m_GlobalTracker->GetNumParticles()) );
+ m_Controls->m_CurrentStepLabel->setText( QString::number(100*(float)m_GlobalTracker->GetCurrentStep()/m_GlobalTracker->GetSteps())+"%" );
+ m_Controls->m_AcceptedFibersLabel->setText( QString::number(m_GlobalTracker->GetNumAcceptedFibers()) );
+}
+
+// update gui elements (enable/disable elements and set tooltips)
+void QmitkGlobalFiberTrackingView::UpdateGUI()
+{
+ if (!m_ThreadIsRunning && m_QBallSelected)
+ {
+ m_Controls->m_GlobalTrackingStop->setEnabled(false);
+ m_Controls->m_GlobalTrackingStart->setEnabled(true);
+ m_Controls->m_LoadTrackingParameters->setEnabled(true);
+ m_Controls->m_MaskFrame->setEnabled(true);
+ m_Controls->m_IterationsSlider->setEnabled(true);
+ m_Controls->m_AdvancedFrame->setEnabled(true);
+ m_Controls->m_GlobalTrackingStop->setText("Stop Tractography");
+ m_Controls->m_GlobalTrackingStart->setToolTip("Start tractography. No further change of parameters possible.");
+ m_Controls->m_GlobalTrackingStop->setToolTip("");
+ }
+ else if (!m_ThreadIsRunning)
+ {
+ m_Controls->m_GlobalTrackingStop->setEnabled(false);
+ m_Controls->m_GlobalTrackingStart->setEnabled(false);
+ m_Controls->m_LoadTrackingParameters->setEnabled(true);
+ m_Controls->m_MaskFrame->setEnabled(true);
+ m_Controls->m_IterationsSlider->setEnabled(true);
+ m_Controls->m_AdvancedFrame->setEnabled(true);
+ m_Controls->m_GlobalTrackingStop->setText("Stop Tractography");
+ m_Controls->m_GlobalTrackingStart->setToolTip("No Q-Ball image selected.");
+ m_Controls->m_GlobalTrackingStop->setToolTip("");
+ }
+ else
+ {
+ m_Controls->m_GlobalTrackingStop->setEnabled(true);
+ m_Controls->m_GlobalTrackingStart->setEnabled(false);
+ m_Controls->m_LoadTrackingParameters->setEnabled(false);
+ m_Controls->m_MaskFrame->setEnabled(false);
+ m_Controls->m_IterationsSlider->setEnabled(false);
+ m_Controls->m_AdvancedFrame->setEnabled(false);
+ m_Controls->m_AdvancedFrame->setVisible(false);
+ m_Controls->m_AdvancedSettingsCheckbox->setChecked(false);
+ m_Controls->m_GlobalTrackingStart->setToolTip("Tracking in progress.");
+ m_Controls->m_GlobalTrackingStop->setToolTip("Stop tracking and display results.");
+ }
+}
+
+// show/hide advanced settings frame
+void QmitkGlobalFiberTrackingView::AdvancedSettings()
+{
+ m_Controls->m_AdvancedFrame->setVisible(m_Controls->m_AdvancedSettingsCheckbox->isChecked());
+}
+
+// set mask image data node
+void QmitkGlobalFiberTrackingView::SetMask()
+{
+ std::vector<mitk::DataNode*> nodes = GetDataManagerSelection();
+ if (nodes.empty())
+ {
+ m_MaskImageNode = NULL;
+ m_Controls->m_MaskImageEdit->setText("N/A");
+ return;
+ }
+
+ for( std::vector<mitk::DataNode*>::iterator it = nodes.begin();
+ it != nodes.end();
+ ++it )
+ {
+ mitk::DataNode::Pointer node = *it;
+
+ if (node.IsNotNull() && dynamic_cast<mitk::Image*>(node->GetData()))
+ {
+ m_MaskImageNode = node;
+ m_Controls->m_MaskImageEdit->setText(node->GetName().c_str());
+ return;
+ }
+ }
+}
+
+// cast image to float
+template<class InputImageType>
+void QmitkGlobalFiberTrackingView::CastToFloat(InputImageType* image, mitk::Image::Pointer outImage)
+{
+ typedef itk::CastImageFilter<InputImageType, MaskImgType> ItkCastFilter;
+ typename ItkCastFilter::Pointer itkCaster = ItkCastFilter::New();
+ itkCaster->SetInput(image);
+ itkCaster->Update();
+ outImage->InitializeByItk(itkCaster->GetOutput());
+ outImage->SetVolume(itkCaster->GetOutput()->GetBufferPointer());
+}
+
+// check for mask and qbi and start tracking thread
+void QmitkGlobalFiberTrackingView::StartGlobalTracking()
+{
+ if(m_ThreadIsRunning)
+ {
+ MITK_WARN("QmitkGlobalFiberTrackingView")<<"Thread already running!";
+ return;
+ }
+
+ if (!m_QBallSelected)
+ {
+ // Nothing selected. Inform the user and return
+ QMessageBox::information( NULL, "Template", "Please load and select a qball image before starting image processing.");
+ return;
+ }
+
+ // a node itself is not very useful, we need its data item (the image)
+ mitk::BaseData* data = m_QBallImageNode->GetData();
+ if (!data)
+ return;
+
+ // test if this data item is an image or not (could also be a surface or something totally different)
+ m_QBallImage = dynamic_cast<mitk::QBallImage*>( data );
+ if (m_QBallImage.IsNull())
+ return;
+
+ // cast qbi to itk
+ m_ItkQBallImage = ItkQBallImgType::New();
+ mitk::CastToItkImage<ItkQBallImgType>(m_QBallImage, m_ItkQBallImage);
+
+ // mask image found?
+ if(m_Controls->m_MaskImageEdit->text().compare("N/A") != 0)
+ {
+ m_MaskImage = 0;
+ mitk::BaseData* data = m_MaskImageNode->GetData();
+ if (data)
+ {
+ // test if this data item is an image or not (could also be a surface or something totally different)
+ mitk::Image* tmpImage = dynamic_cast<mitk::Image*>( data );
+ if (tmpImage)
+ {
+ mitk::Image::Pointer mitkMaskImg = mitk::Image::New();
+ AccessFixedDimensionByItk_1(tmpImage, CastToFloat, 3, mitkMaskImg);
+ typedef mitk::ImageToItk<MaskImgType> CastType;
+ CastType::Pointer caster = CastType::New();
+ caster->SetInput(mitkMaskImg);
+ caster->Update();
+ m_MaskImage = caster->GetOutput();
+ }
+ }
+ }
+
+ // if no mask image is selected generate it
+ if( m_MaskImage.IsNull() )
+ {
+ m_MaskImage = MaskImgType::New();
+ m_MaskImage->SetSpacing( m_ItkQBallImage->GetSpacing() ); // Set the image spacing
+ m_MaskImage->SetOrigin( m_ItkQBallImage->GetOrigin() ); // Set the image origin
+ m_MaskImage->SetDirection( m_ItkQBallImage->GetDirection() ); // Set the image direction
+ m_MaskImage->SetLargestPossibleRegion( m_ItkQBallImage->GetLargestPossibleRegion());
+ m_MaskImage->SetBufferedRegion( m_ItkQBallImage->GetLargestPossibleRegion() );
+ m_MaskImage->Allocate();
+
+ itk::ImageRegionIterator<MaskImgType> it (m_MaskImage, m_MaskImage->GetLargestPossibleRegion() );
+ for (it = it.Begin(); !it.IsAtEnd(); ++it)
+ {
+ it.Set(1);
+ }
+ }
+
+ int steps = m_Iterations/10000;
+ if (steps<10)
+ steps = 10;
+
+ m_LastStep = 0;
+ mitk::ProgressBar::GetInstance()->AddStepsToDo(steps);
+
+ // start worker thread
+ m_TrackingThread.start(QThread::LowestPriority);
+}
+
+// generate mitkFiberBundle from tracking filter output
+void QmitkGlobalFiberTrackingView::GenerateFiberBundle()
+{
+ if (m_GlobalTracker.IsNull() || m_ItkQBallImage.IsNull() || m_QBallImage.IsNull() || (!m_Controls->m_VisualizationCheckbox->isChecked() && m_ThreadIsRunning))
+ return;
+
+ m_FiberBundle = mitk::FiberBundle::New();
+
+ typedef std::vector< itk::Point<float, 3> > FiberTractType;
+ typedef std::vector< FiberTractType > FiberBundleType;
+
+ FiberBundleType* fiberBundle = m_GlobalTracker->GetFiberBundle();
+
+ for (int i=0; i<fiberBundle->size(); i++)
+ {
+ FiberTractType* tract = &fiberBundle->at(i);
+ for (int j=0; j<tract->size(); j++)
+ m_FiberBundle->PushPoint(i, tract->at(j));
+ }
+ m_FiberBundle->initFiberGroup();
+
+ float bounds[] = {0,0,0};
+ bounds[0] = m_ItkQBallImage->GetLargestPossibleRegion().GetSize().GetElement(0);
+ bounds[1] = m_ItkQBallImage->GetLargestPossibleRegion().GetSize().GetElement(1);
+ bounds[2] = m_ItkQBallImage->GetLargestPossibleRegion().GetSize().GetElement(2);
+ m_FiberBundle->SetBounds(bounds);
+ m_FiberBundle->SetGeometry(m_QBallImage->GetGeometry());
+
+ if (m_FiberBundleNode.IsNotNull()){
+ GetDefaultDataStorage()->Remove(m_FiberBundleNode);
+ m_FiberBundleNode = 0;
+ }
+ m_FiberBundleNode = mitk::DataNode::New();
+ m_FiberBundleNode->SetData(m_FiberBundle);
+
+ QString name(m_QBallImageNode->GetName().c_str());
+ name += "_FiberBundle";
+ m_FiberBundleNode->SetName(name.toStdString());
+ m_FiberBundleNode->SetVisibility(true);
+
+ if(m_QBallImageNode.IsNull())
+ GetDataStorage()->Add(m_FiberBundleNode);
+ else
+ GetDataStorage()->Add(m_FiberBundleNode, m_QBallImageNode);
+}
+
+// save current tracking paramters as xml file (.gtp)
+void QmitkGlobalFiberTrackingView::SaveTrackingParameters()
+{
+ TiXmlDocument documentXML;
+ TiXmlDeclaration* declXML = new TiXmlDeclaration( "1.0", "", "" );
+ documentXML.LinkEndChild( declXML );
+
+ TiXmlElement* mainXML = new TiXmlElement("global_tracking_parameter_file");
+ mainXML->SetAttribute("file_version", "0.1");
+ documentXML.LinkEndChild(mainXML);
+
+ TiXmlElement* paramXML = new TiXmlElement("parameter_set");
+ paramXML->SetAttribute("iterations", m_Iterations);
+ paramXML->SetAttribute("particle_length", QString::number((float)m_Controls->m_ParticleLengthSlider->value()/10).toStdString());
+ paramXML->SetAttribute("particle_width", QString::number((float)m_Controls->m_ParticleWidthSlider->value()/10).toStdString());
+ paramXML->SetAttribute("particle_weight", QString::number((float)m_Controls->m_ParticleWeightSlider->value()/10000).toStdString());
+ paramXML->SetAttribute("temp_start", QString::number((float)m_Controls->m_StartTempSlider->value()/100).toStdString());
+ paramXML->SetAttribute("temp_end", QString::number((float)m_Controls->m_EndTempSlider->value()/10000).toStdString());
+ paramXML->SetAttribute("inexbalance", QString::number((float)m_Controls->m_InExBalanceSlider->value()/10).toStdString());
+ paramXML->SetAttribute("fiber_length", QString::number(m_Controls->m_FiberLengthSlider->value()).toStdString());
+ mainXML->LinkEndChild(paramXML);
+ QString filename = QFileDialog::getSaveFileName(
+ 0,
+ tr("Save Parameters"),
+ QDir::currentPath()+"/param.gtp",
+ tr("Global Tracking Parameters (*.gtp)") );
+
+ if(filename.isEmpty() || filename.isNull())
+ return;
+ if(!filename.endsWith(".gtp"))
+ filename += ".gtp";
+ documentXML.SaveFile( filename.toStdString() );
+}
+
+void QmitkGlobalFiberTrackingView::UpdateIteraionsGUI(unsigned long iterations)
+{
+ switch(iterations)
+ {
+ case 10000:
+ m_Controls->m_IterationsSlider->setValue(0);
+ m_Controls->m_IterationsLabel->setText("Iterations: 10^4");
+ break;
+ case 50000:
+ m_Controls->m_IterationsSlider->setValue(1);
+ m_Controls->m_IterationsLabel->setText("Iterations: 5x10^4");
+ break;
+ case 100000:
+ m_Controls->m_IterationsSlider->setValue(2);
+ m_Controls->m_IterationsLabel->setText("Iterations: 10^5");
+ break;
+ case 500000:
+ m_Controls->m_IterationsSlider->setValue(3);
+ m_Controls->m_IterationsLabel->setText("Iterations: 5x10^5");
+ break;
+ case 1000000:
+ m_Controls->m_IterationsSlider->setValue(4);
+ m_Controls->m_IterationsLabel->setText("Iterations: 10^6");
+ break;
+ case 5000000:
+ m_Controls->m_IterationsSlider->setValue(5);
+ m_Controls->m_IterationsLabel->setText("Iterations: 5x10^6");
+ break;
+ case 10000000:
+ m_Controls->m_IterationsSlider->setValue(6);
+ m_Controls->m_IterationsLabel->setText("Iterations: 10^7");
+ break;
+ case 50000000:
+ m_Controls->m_IterationsSlider->setValue(7);
+ m_Controls->m_IterationsLabel->setText("Iterations: 5x10^7");
+ break;
+ case 100000000:
+ m_Controls->m_IterationsSlider->setValue(8);
+ m_Controls->m_IterationsLabel->setText("Iterations: 10^8");
+ break;
+ case 500000000:
+ m_Controls->m_IterationsSlider->setValue(9);
+ m_Controls->m_IterationsLabel->setText("Iterations: 5x10^8");
+ break;
+ case 1000000000:
+ m_Controls->m_IterationsSlider->setValue(10);
+ m_Controls->m_IterationsLabel->setText("Iterations: 10^9");
+ break;
+ case 5000000000:
+ m_Controls->m_IterationsSlider->setValue(11);
+ m_Controls->m_IterationsLabel->setText("Iterations: 5x10^9");
+ break;
+ }
+}
+
+// load current tracking paramters from xml file (.gtp)
+void QmitkGlobalFiberTrackingView::LoadTrackingParameters()
+{
+ QString filename = QFileDialog::getOpenFileName(0, tr("Load Parameters"), QDir::currentPath(), tr("Global Tracking Parameters (*.gtp)") );
+ if(filename.isEmpty() || filename.isNull())
+ return;
+
+ TiXmlDocument doc( filename.toStdString() );
+ doc.LoadFile();
+
+ TiXmlHandle hDoc(&doc);
+ TiXmlElement* pElem;
+ TiXmlHandle hRoot(0);
+
+ pElem = hDoc.FirstChildElement().Element();
+ hRoot = TiXmlHandle(pElem);
+ pElem = hRoot.FirstChildElement("parameter_set").Element();
+
+ QString iterations(pElem->Attribute("iterations"));
+ m_Iterations = iterations.toULong();
+ UpdateIteraionsGUI(m_Iterations);
+
+ QString particleLength(pElem->Attribute("particle_length"));
+ float pLength = particleLength.toFloat();
+ QString particleWidth(pElem->Attribute("particle_width"));
+ float pWidth = particleWidth.toFloat();
+
+ if (pLength==0)
+ m_Controls->m_ParticleLengthLabel->setText("auto");
+ else
+ m_Controls->m_ParticleLengthLabel->setText(particleLength+" mm");
+ if (pWidth==0)
+ m_Controls->m_ParticleWidthLabel->setText("auto");
+ else
+ m_Controls->m_ParticleWidthLabel->setText(particleWidth+" mm");
+
+ m_Controls->m_ParticleWidthSlider->setValue(pWidth*10);
+ m_Controls->m_ParticleLengthSlider->setValue(pLength*10);
+
+ QString partWeight(pElem->Attribute("particle_weight"));
+ m_Controls->m_ParticleWeightSlider->setValue(partWeight.toFloat()*10000);
+ m_Controls->m_ParticleWeightLabel->setText(partWeight);
+
+ QString startTemp(pElem->Attribute("temp_start"));
+ m_Controls->m_StartTempSlider->setValue(startTemp.toFloat()*100);
+ m_Controls->m_StartTempLabel->setText(startTemp);
+
+ QString endTemp(pElem->Attribute("temp_end"));
+ m_Controls->m_EndTempSlider->setValue(endTemp.toFloat()*10000);
+ m_Controls->m_EndTempLabel->setText(endTemp);
+
+ QString inExBalance(pElem->Attribute("inexbalance"));
+ m_Controls->m_InExBalanceSlider->setValue(inExBalance.toFloat()*10);
+ m_Controls->m_InExBalanceLabel->setText(inExBalance);
+
+
+ QString fiberLength(pElem->Attribute("fiber_length"));
+ m_Controls->m_FiberLengthSlider->setValue(fiberLength.toInt());
+ m_Controls->m_FiberLengthLabel->setText(fiberLength);
+}
+
diff --git a/Modules/Bundles/org.mitk.gui.qt.diffusionimaging/src/internal/QmitkGlobalFiberTrackingView.h b/Modules/Bundles/org.mitk.gui.qt.diffusionimaging/src/internal/QmitkGlobalFiberTrackingView.h
new file mode 100644
index 0000000000..6669acf79a
--- /dev/null
+++ b/Modules/Bundles/org.mitk.gui.qt.diffusionimaging/src/internal/QmitkGlobalFiberTrackingView.h
@@ -0,0 +1,162 @@
+/*=========================================================================
+Program: Medical Imaging & Interaction Toolkit
+Language: C++
+Date: $Date: 2010-03-31 16:40:27 +0200 (Mi, 31 Mrz 2010) $
+Version: $Revision: 21975 $
+
+Copyright (c) German Cancer Research Center, Division of Medical and
+Biological Informatics. All rights reserved.
+See MITKCopyright.txt or http://www.mitk.org/copyright.html for details.
+
+This software is distributed WITHOUT ANY WARRANTY; without even
+the implied warranty of MERCHANTABILITY or FITNESS FOR A PARTICULAR
+PURPOSE. See the above copyright notices for more information.
+
+=========================================================================*/
+
+#ifndef QmitkGlobalFiberTrackingView_h
+#define QmitkGlobalFiberTrackingView_h
+
+#include <berryISelectionListener.h>
+
+#include <QmitkFunctionality.h>
+
+#include "ui_QmitkGlobalFiberTrackingViewControls.h"
+
+#include <mitkQBallImage.h>
+#include <QThread>
+#include <mitkFiberBundle.h>
+#include <QTime>
+#include <itkImage.h>
+
+class QmitkGlobalFiberTrackingView;
+
+class QmitkTrackingWorker : public QObject
+{
+ Q_OBJECT
+
+public:
+
+ QmitkTrackingWorker(QmitkGlobalFiberTrackingView* view);
+
+public slots:
+
+ void run();
+
+private:
+
+ QmitkGlobalFiberTrackingView* m_View;
+};
+
+/*!
+ \brief QmitkGlobalFiberTrackingView
+
+ \warning This application module is not yet documented. Use "svn blame/praise/annotate" and ask the author to provide basic documentation.
+
+ \sa QmitkFunctionality
+ \ingroup Functionalities
+*/
+typedef itk::Image< float, 3 > FloatImageType;
+
+namespace itk
+{
+template<class X, class Y>
+class GlobalTractographyFilter;
+}
+
+class QmitkGlobalFiberTrackingView : public QmitkFunctionality
+{
+ // 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:
+
+ typedef itk::Image<float,3> MaskImgType;
+
+ typedef itk::Vector<float, QBALL_ODFSIZE> OdfVectorType;
+ typedef itk::Image<OdfVectorType, 3> ItkQBallImgType;
+
+ typedef itk::GlobalTractographyFilter<ItkQBallImgType, MaskImgType> GlobalTrackingFilterType;
+
+ static const std::string VIEW_ID;
+
+ QmitkGlobalFiberTrackingView();
+ virtual ~QmitkGlobalFiberTrackingView();
+
+ virtual void CreateQtPartControl(QWidget *parent);
+
+ virtual void StdMultiWidgetAvailable (QmitkStdMultiWidget &stdMultiWidget);
+ virtual void StdMultiWidgetNotAvailable();
+
+signals:
+
+protected slots:
+
+ void StartGlobalTracking();
+ void StopGlobalTracking();
+ void AfterThread();
+ void BeforeThread();
+ void TimerUpdate();
+ void SetMask();
+ void AdvancedSettings();
+ void SaveTrackingParameters();
+ void LoadTrackingParameters();
+ void SetIterations(int value);
+ void SetParticleWidth(int value);
+ void SetParticleLength(int value);
+ void SetInExBalance(int value);
+ void SetFiberLength(int value);
+ void SetParticleWeight(int value);
+ void SetStartTemp(int value);
+ void SetEndTemp(int value);
+
+private:
+
+ // Visualization & GUI
+ void GenerateFiberBundle();
+ void UpdateGUI();
+ void UpdateTrackingStatus();
+
+ /// \brief called by QmitkFunctionality when DataManager's selection has changed
+ virtual void OnSelectionChanged( std::vector<mitk::DataNode*> nodes );
+
+ template<class InputImageType>
+ void CastToFloat(InputImageType* image, typename mitk::Image::Pointer outImage);
+
+ void UpdateIteraionsGUI(unsigned long iterations);
+
+ Ui::QmitkGlobalFiberTrackingViewControls* m_Controls;
+ QmitkStdMultiWidget* m_MultiWidget;
+
+ // data objects
+ mitk::FiberBundle::Pointer m_FiberBundle;
+ MaskImgType::Pointer m_MaskImage;
+ mitk::QBallImage::Pointer m_QBallImage;
+ ItkQBallImgType::Pointer m_ItkQBallImage;
+
+ // data nodes
+ mitk::DataNode::Pointer m_QBallImageNode;
+ mitk::DataNode::Pointer m_MaskImageNode;
+ mitk::DataNode::Pointer m_FiberBundleNode;
+
+ // flags etc.
+ bool m_ThreadIsRunning;
+ QTimer* m_TrackingTimer;
+ QTime m_TrackingTime;
+ unsigned long m_ElapsedTime;
+ bool m_QBallSelected;
+ bool m_FibSelected;
+ unsigned long m_Iterations;
+ int m_LastStep;
+
+ // global tracker and friends
+ itk::SmartPointer<GlobalTrackingFilterType> m_GlobalTracker;
+ QmitkTrackingWorker m_TrackingWorker;
+ QThread m_TrackingThread;
+
+ friend class QmitkTrackingWorker;
+};
+
+#endif // _QMITKGLOBALFIBERTRACKINGVIEW_H_INCLUDED
+
diff --git a/Modules/Bundles/org.mitk.gui.qt.diffusionimaging/src/internal/QmitkGlobalFiberTrackingViewControls.ui b/Modules/Bundles/org.mitk.gui.qt.diffusionimaging/src/internal/QmitkGlobalFiberTrackingViewControls.ui
new file mode 100644
index 0000000000..7f907bfd2b
--- /dev/null
+++ b/Modules/Bundles/org.mitk.gui.qt.diffusionimaging/src/internal/QmitkGlobalFiberTrackingViewControls.ui
@@ -0,0 +1,946 @@
+<?xml version="1.0" encoding="UTF-8"?>
+<ui version="4.0">
+ <class>QmitkGlobalFiberTrackingViewControls</class>
+ <widget class="QWidget" name="QmitkGlobalFiberTrackingViewControls">
+ <property name="geometry">
+ <rect>
+ <x>0</x>
+ <y>0</y>
+ <width>463</width>
+ <height>1011</height>
+ </rect>
+ </property>
+ <property name="sizePolicy">
+ <sizepolicy hsizetype="Expanding" vsizetype="Expanding">
+ <horstretch>0</horstretch>
+ <verstretch>0</verstretch>
+ </sizepolicy>
+ </property>
+ <property name="minimumSize">
+ <size>
+ <width>0</width>
+ <height>0</height>
+ </size>
+ </property>
+ <property name="windowTitle">
+ <string>QmitkTemplate</string>
+ </property>
+ <layout class="QVBoxLayout" name="verticalLayout_2">
+ <property name="spacing">
+ <number>0</number>
+ </property>
+ <property name="leftMargin">
+ <number>3</number>
+ </property>
+ <property name="topMargin">
+ <number>0</number>
+ </property>
+ <property name="rightMargin">
+ <number>3</number>
+ </property>
+ <property name="bottomMargin">
+ <number>0</number>
+ </property>
+ <item>
+ <widget class="QGroupBox" name="groupBox">
+ <property name="title">
+ <string/>
+ </property>
+ <property name="flat">
+ <bool>false</bool>
+ </property>
+ <layout class="QVBoxLayout" name="verticalLayout">
+ <property name="spacing">
+ <number>0</number>
+ </property>
+ <property name="margin">
+ <number>0</number>
+ </property>
+ <item>
+ <widget class="QFrame" name="m_MainFrame">
+ <property name="enabled">
+ <bool>true</bool>
+ </property>
+ <property name="autoFillBackground">
+ <bool>false</bool>
+ </property>
+ <property name="frameShape">
+ <enum>QFrame::NoFrame</enum>
+ </property>
+ <property name="frameShadow">
+ <enum>QFrame::Raised</enum>
+ </property>
+ <layout class="QFormLayout" name="formLayout_2">
+ <property name="fieldGrowthPolicy">
+ <enum>QFormLayout::AllNonFixedFieldsGrow</enum>
+ </property>
+ <property name="horizontalSpacing">
+ <number>0</number>
+ </property>
+ <property name="verticalSpacing">
+ <number>4</number>
+ </property>
+ <property name="margin">
+ <number>0</number>
+ </property>
+ <item row="0" column="0">
+ <widget class="QLabel" name="label_5">
+ <property name="text">
+ <string>Mask Image</string>
+ </property>
+ </widget>
+ </item>
+ <item row="0" column="1">
+ <widget class="QFrame" name="m_MaskFrame">
+ <property name="toolTip">
+ <string>Mask image. Particles will be sampled with a probability according to the voxel value.</string>
+ </property>
+ <property name="frameShape">
+ <enum>QFrame::StyledPanel</enum>
+ </property>
+ <property name="frameShadow">
+ <enum>QFrame::Raised</enum>
+ </property>
+ <layout class="QHBoxLayout" name="horizontalLayout">
+ <property name="margin">
+ <number>0</number>
+ </property>
+ <item>
+ <widget class="QToolButton" name="m_SetMaskButton">
+ <property name="enabled">
+ <bool>true</bool>
+ </property>
+ <property name="text">
+ <string>=&gt;</string>
+ </property>
+ </widget>
+ </item>
+ <item>
+ <widget class="QLineEdit" name="m_MaskImageEdit">
+ <property name="enabled">
+ <bool>true</bool>
+ </property>
+ <property name="text">
+ <string>N/A</string>
+ </property>
+ <property name="readOnly">
+ <bool>true</bool>
+ </property>
+ </widget>
+ </item>
+ </layout>
+ </widget>
+ </item>
+ <item row="1" column="0">
+ <widget class="QLabel" name="m_IterationsLabel">
+ <property name="toolTip">
+ <string/>
+ </property>
+ <property name="statusTip">
+ <string/>
+ </property>
+ <property name="whatsThis">
+ <string/>
+ </property>
+ <property name="text">
+ <string>Iterations: 10^7</string>
+ </property>
+ </widget>
+ </item>
+ <item row="2" column="0">
+ <widget class="QCheckBox" name="m_VisualizationCheckbox">
+ <property name="enabled">
+ <bool>true</bool>
+ </property>
+ <property name="text">
+ <string>Visualize Tractography</string>
+ </property>
+ <property name="checked">
+ <bool>true</bool>
+ </property>
+ </widget>
+ </item>
+ <item row="5" column="0">
+ <widget class="QCheckBox" name="m_AdvancedSettingsCheckbox">
+ <property name="text">
+ <string>Advanced Settings</string>
+ </property>
+ </widget>
+ </item>
+ <item row="6" column="0" colspan="2">
+ <widget class="QFrame" name="m_AdvancedFrame">
+ <property name="enabled">
+ <bool>true</bool>
+ </property>
+ <property name="frameShape">
+ <enum>QFrame::StyledPanel</enum>
+ </property>
+ <property name="frameShadow">
+ <enum>QFrame::Raised</enum>
+ </property>
+ <layout class="QGridLayout" name="gridLayout_2">
+ <property name="horizontalSpacing">
+ <number>0</number>
+ </property>
+ <property name="verticalSpacing">
+ <number>4</number>
+ </property>
+ <property name="margin">
+ <number>0</number>
+ </property>
+ <item row="0" column="1">
+ <widget class="QLabel" name="m_ParticleLengthLabel">
+ <property name="toolTip">
+ <string/>
+ </property>
+ <property name="statusTip">
+ <string/>
+ </property>
+ <property name="whatsThis">
+ <string/>
+ </property>
+ <property name="text">
+ <string>auto</string>
+ </property>
+ <property name="alignment">
+ <set>Qt::AlignLeading|Qt::AlignLeft|Qt::AlignVCenter</set>
+ </property>
+ </widget>
+ </item>
+ <item row="0" column="2">
+ <widget class="QSlider" name="m_ParticleLengthSlider">
+ <property name="toolTip">
+ <string>auto = 1.5 * min. spacing; l</string>
+ </property>
+ <property name="maximum">
+ <number>100</number>
+ </property>
+ <property name="singleStep">
+ <number>1</number>
+ </property>
+ <property name="orientation">
+ <enum>Qt::Horizontal</enum>
+ </property>
+ <property name="tickPosition">
+ <enum>QSlider::NoTicks</enum>
+ </property>
+ </widget>
+ </item>
+ <item row="1" column="1">
+ <widget class="QLabel" name="m_ParticleWidthLabel">
+ <property name="toolTip">
+ <string/>
+ </property>
+ <property name="statusTip">
+ <string/>
+ </property>
+ <property name="whatsThis">
+ <string/>
+ </property>
+ <property name="text">
+ <string>auto</string>
+ </property>
+ <property name="alignment">
+ <set>Qt::AlignLeading|Qt::AlignLeft|Qt::AlignVCenter</set>
+ </property>
+ </widget>
+ </item>
+ <item row="1" column="2">
+ <widget class="QSlider" name="m_ParticleWidthSlider">
+ <property name="toolTip">
+ <string>auto = 0.5 * min. spacing; sigma</string>
+ </property>
+ <property name="maximum">
+ <number>100</number>
+ </property>
+ <property name="singleStep">
+ <number>1</number>
+ </property>
+ <property name="orientation">
+ <enum>Qt::Horizontal</enum>
+ </property>
+ <property name="tickPosition">
+ <enum>QSlider::NoTicks</enum>
+ </property>
+ </widget>
+ </item>
+ <item row="2" column="1">
+ <widget class="QLabel" name="m_ParticleWeightLabel">
+ <property name="toolTip">
+ <string/>
+ </property>
+ <property name="statusTip">
+ <string/>
+ </property>
+ <property name="whatsThis">
+ <string/>
+ </property>
+ <property name="text">
+ <string>0.001</string>
+ </property>
+ <property name="alignment">
+ <set>Qt::AlignLeading|Qt::AlignLeft|Qt::AlignVCenter</set>
+ </property>
+ </widget>
+ </item>
+ <item row="2" column="2">
+ <widget class="QSlider" name="m_ParticleWeightSlider">
+ <property name="toolTip">
+ <string>unitless w</string>
+ </property>
+ <property name="minimum">
+ <number>1</number>
+ </property>
+ <property name="maximum">
+ <number>1000</number>
+ </property>
+ <property name="singleStep">
+ <number>1</number>
+ </property>
+ <property name="value">
+ <number>10</number>
+ </property>
+ <property name="orientation">
+ <enum>Qt::Horizontal</enum>
+ </property>
+ <property name="invertedControls">
+ <bool>true</bool>
+ </property>
+ <property name="tickPosition">
+ <enum>QSlider::NoTicks</enum>
+ </property>
+ </widget>
+ </item>
+ <item row="3" column="1">
+ <widget class="QLabel" name="m_StartTempLabel">
+ <property name="text">
+ <string>0.1</string>
+ </property>
+ <property name="alignment">
+ <set>Qt::AlignLeading|Qt::AlignLeft|Qt::AlignVCenter</set>
+ </property>
+ </widget>
+ </item>
+ <item row="3" column="2">
+ <widget class="QSlider" name="m_StartTempSlider">
+ <property name="minimum">
+ <number>1</number>
+ </property>
+ <property name="maximum">
+ <number>100</number>
+ </property>
+ <property name="singleStep">
+ <number>1</number>
+ </property>
+ <property name="value">
+ <number>10</number>
+ </property>
+ <property name="orientation">
+ <enum>Qt::Horizontal</enum>
+ </property>
+ <property name="invertedAppearance">
+ <bool>false</bool>
+ </property>
+ <property name="invertedControls">
+ <bool>false</bool>
+ </property>
+ <property name="tickPosition">
+ <enum>QSlider::NoTicks</enum>
+ </property>
+ </widget>
+ </item>
+ <item row="4" column="1">
+ <widget class="QLabel" name="m_EndTempLabel">
+ <property name="text">
+ <string>0.001</string>
+ </property>
+ <property name="alignment">
+ <set>Qt::AlignLeading|Qt::AlignLeft|Qt::AlignVCenter</set>
+ </property>
+ </widget>
+ </item>
+ <item row="4" column="2">
+ <widget class="QSlider" name="m_EndTempSlider">
+ <property name="minimum">
+ <number>1</number>
+ </property>
+ <property name="maximum">
+ <number>99</number>
+ </property>
+ <property name="singleStep">
+ <number>1</number>
+ </property>
+ <property name="value">
+ <number>10</number>
+ </property>
+ <property name="orientation">
+ <enum>Qt::Horizontal</enum>
+ </property>
+ <property name="tickPosition">
+ <enum>QSlider::NoTicks</enum>
+ </property>
+ </widget>
+ </item>
+ <item row="5" column="1">
+ <widget class="QLabel" name="m_InExBalanceLabel">
+ <property name="toolTip">
+ <string/>
+ </property>
+ <property name="statusTip">
+ <string/>
+ </property>
+ <property name="whatsThis">
+ <string/>
+ </property>
+ <property name="text">
+ <string>0</string>
+ </property>
+ <property name="alignment">
+ <set>Qt::AlignLeading|Qt::AlignLeft|Qt::AlignVCenter</set>
+ </property>
+ </widget>
+ </item>
+ <item row="5" column="2">
+ <widget class="QSlider" name="m_InExBalanceSlider">
+ <property name="toolTip">
+ <string>IE Bias &lt; 0 &lt; EE Bias</string>
+ </property>
+ <property name="minimum">
+ <number>-50</number>
+ </property>
+ <property name="maximum">
+ <number>50</number>
+ </property>
+ <property name="singleStep">
+ <number>1</number>
+ </property>
+ <property name="orientation">
+ <enum>Qt::Horizontal</enum>
+ </property>
+ <property name="tickPosition">
+ <enum>QSlider::NoTicks</enum>
+ </property>
+ </widget>
+ </item>
+ <item row="6" column="1">
+ <widget class="QLabel" name="m_FiberLengthLabel">
+ <property name="toolTip">
+ <string/>
+ </property>
+ <property name="statusTip">
+ <string/>
+ </property>
+ <property name="whatsThis">
+ <string/>
+ </property>
+ <property name="text">
+ <string>10</string>
+ </property>
+ <property name="alignment">
+ <set>Qt::AlignLeading|Qt::AlignLeft|Qt::AlignVCenter</set>
+ </property>
+ </widget>
+ </item>
+ <item row="6" column="2">
+ <widget class="QSlider" name="m_FiberLengthSlider">
+ <property name="toolTip">
+ <string>Only fibers containing more than the specified number of particles are accepted.</string>
+ </property>
+ <property name="maximum">
+ <number>100</number>
+ </property>
+ <property name="singleStep">
+ <number>1</number>
+ </property>
+ <property name="value">
+ <number>10</number>
+ </property>
+ <property name="orientation">
+ <enum>Qt::Horizontal</enum>
+ </property>
+ <property name="tickPosition">
+ <enum>QSlider::NoTicks</enum>
+ </property>
+ </widget>
+ </item>
+ <item row="0" column="0">
+ <widget class="QLabel" name="m_ParticleLengthLabel_2">
+ <property name="toolTip">
+ <string/>
+ </property>
+ <property name="statusTip">
+ <string/>
+ </property>
+ <property name="whatsThis">
+ <string/>
+ </property>
+ <property name="text">
+ <string>Particle Length:</string>
+ </property>
+ </widget>
+ </item>
+ <item row="1" column="0">
+ <widget class="QLabel" name="m_ParticleWidthLabel_2">
+ <property name="toolTip">
+ <string/>
+ </property>
+ <property name="statusTip">
+ <string/>
+ </property>
+ <property name="whatsThis">
+ <string/>
+ </property>
+ <property name="text">
+ <string>Particle Width:</string>
+ </property>
+ </widget>
+ </item>
+ <item row="2" column="0">
+ <widget class="QLabel" name="m_ParticleWeightLabel_2">
+ <property name="toolTip">
+ <string/>
+ </property>
+ <property name="statusTip">
+ <string/>
+ </property>
+ <property name="whatsThis">
+ <string/>
+ </property>
+ <property name="text">
+ <string>Particle Weight:</string>
+ </property>
+ </widget>
+ </item>
+ <item row="3" column="0">
+ <widget class="QLabel" name="m_StartTempLabel_2">
+ <property name="text">
+ <string>Start Temperature:</string>
+ </property>
+ </widget>
+ </item>
+ <item row="4" column="0">
+ <widget class="QLabel" name="m_EndTempLabel_2">
+ <property name="text">
+ <string>End Temperature:</string>
+ </property>
+ </widget>
+ </item>
+ <item row="5" column="0">
+ <widget class="QLabel" name="m_InExBalanceLabel_2">
+ <property name="toolTip">
+ <string/>
+ </property>
+ <property name="statusTip">
+ <string/>
+ </property>
+ <property name="whatsThis">
+ <string/>
+ </property>
+ <property name="text">
+ <string>Balance In/Ex Energy:</string>
+ </property>
+ </widget>
+ </item>
+ <item row="6" column="0">
+ <widget class="QLabel" name="m_FiberLengthLabel_2">
+ <property name="toolTip">
+ <string/>
+ </property>
+ <property name="statusTip">
+ <string/>
+ </property>
+ <property name="whatsThis">
+ <string/>
+ </property>
+ <property name="text">
+ <string>Min. Fiber Length:</string>
+ </property>
+ </widget>
+ </item>
+ <item row="8" column="0">
+ <widget class="QCheckBox" name="m_MeanSubtractionCheckbox">
+ <property name="enabled">
+ <bool>true</bool>
+ </property>
+ <property name="toolTip">
+ <string>Use mean subtracted ODFs (recommended).</string>
+ </property>
+ <property name="text">
+ <string>Subtract ODF Mean</string>
+ </property>
+ <property name="checked">
+ <bool>true</bool>
+ </property>
+ </widget>
+ </item>
+ <item row="8" column="1">
+ <spacer name="horizontalSpacer">
+ <property name="orientation">
+ <enum>Qt::Horizontal</enum>
+ </property>
+ <property name="sizeType">
+ <enum>QSizePolicy::Fixed</enum>
+ </property>
+ <property name="sizeHint" stdset="0">
+ <size>
+ <width>60</width>
+ <height>20</height>
+ </size>
+ </property>
+ </spacer>
+ </item>
+ </layout>
+ </widget>
+ </item>
+ <item row="7" column="0">
+ <widget class="QCommandLinkButton" name="m_SaveTrackingParameters">
+ <property name="enabled">
+ <bool>true</bool>
+ </property>
+ <property name="toolTip">
+ <string>Save current parameters as xml (.gtp)</string>
+ </property>
+ <property name="layoutDirection">
+ <enum>Qt::LeftToRight</enum>
+ </property>
+ <property name="text">
+ <string>Save Parameters</string>
+ </property>
+ <property name="icon">
+ <iconset>
+ <normaloff>:/qmitk/btnMoveDown.png</normaloff>:/qmitk/btnMoveDown.png</iconset>
+ </property>
+ </widget>
+ </item>
+ <item row="7" column="1">
+ <widget class="QCommandLinkButton" name="m_LoadTrackingParameters">
+ <property name="enabled">
+ <bool>true</bool>
+ </property>
+ <property name="toolTip">
+ <string>Load parameters from xml file (.gtp)</string>
+ </property>
+ <property name="layoutDirection">
+ <enum>Qt::LeftToRight</enum>
+ </property>
+ <property name="text">
+ <string>Load Parameters</string>
+ </property>
+ <property name="icon">
+ <iconset>
+ <normaloff>:/qmitk/btnMoveUp.png</normaloff>:/qmitk/btnMoveUp.png</iconset>
+ </property>
+ </widget>
+ </item>
+ <item row="1" column="1">
+ <widget class="QSlider" name="m_IterationsSlider">
+ <property name="toolTip">
+ <string>Specify number of iterations for the tracking algorithm.</string>
+ </property>
+ <property name="maximum">
+ <number>11</number>
+ </property>
+ <property name="value">
+ <number>6</number>
+ </property>
+ <property name="orientation">
+ <enum>Qt::Horizontal</enum>
+ </property>
+ <property name="tickPosition">
+ <enum>QSlider::TicksBelow</enum>
+ </property>
+ </widget>
+ </item>
+ <item row="8" column="0">
+ <widget class="QCommandLinkButton" name="m_GlobalTrackingStart">
+ <property name="enabled">
+ <bool>false</bool>
+ </property>
+ <property name="toolTip">
+ <string>No Q-Ball image selected.</string>
+ </property>
+ <property name="layoutDirection">
+ <enum>Qt::LeftToRight</enum>
+ </property>
+ <property name="text">
+ <string>Start Tractography</string>
+ </property>
+ <property name="icon">
+ <iconset>
+ <normaloff>:/qmitk/play.xpm</normaloff>:/qmitk/play.xpm</iconset>
+ </property>
+ </widget>
+ </item>
+ <item row="8" column="1">
+ <widget class="QCommandLinkButton" name="m_GlobalTrackingStop">
+ <property name="enabled">
+ <bool>false</bool>
+ </property>
+ <property name="toolTip">
+ <string/>
+ </property>
+ <property name="layoutDirection">
+ <enum>Qt::LeftToRight</enum>
+ </property>
+ <property name="text">
+ <string>Stop Tractography</string>
+ </property>
+ <property name="icon">
+ <iconset>
+ <normaloff>:/qmitk/stop.xpm</normaloff>:/qmitk/stop.xpm</iconset>
+ </property>
+ </widget>
+ </item>
+ </layout>
+ </widget>
+ </item>
+ <item>
+ <widget class="QFrame" name="frame_5">
+ <property name="sizePolicy">
+ <sizepolicy hsizetype="Expanding" vsizetype="Expanding">
+ <horstretch>0</horstretch>
+ <verstretch>0</verstretch>
+ </sizepolicy>
+ </property>
+ <property name="minimumSize">
+ <size>
+ <width>0</width>
+ <height>0</height>
+ </size>
+ </property>
+ <property name="frameShape">
+ <enum>QFrame::StyledPanel</enum>
+ </property>
+ <property name="frameShadow">
+ <enum>QFrame::Raised</enum>
+ </property>
+ <layout class="QGridLayout" name="gridLayout">
+ <property name="horizontalSpacing">
+ <number>0</number>
+ </property>
+ <property name="verticalSpacing">
+ <number>7</number>
+ </property>
+ <property name="margin">
+ <number>0</number>
+ </property>
+ <item row="1" column="0">
+ <widget class="QLabel" name="label_21">
+ <property name="toolTip">
+ <string comment="Will only be updated if tracking is visualized" extracomment="Will only be updated if tracking is visualized">Will only be updated if tracking is visualized</string>
+ </property>
+ <property name="statusTip">
+ <string>Will only be updated if tracking is visualized</string>
+ </property>
+ <property name="whatsThis">
+ <string/>
+ </property>
+ <property name="text">
+ <string>Accepted Fibers:</string>
+ </property>
+ </widget>
+ </item>
+ <item row="1" column="1">
+ <widget class="QLabel" name="m_AcceptedFibersLabel">
+ <property name="toolTip">
+ <string>Will only be updated if tracking is visualized</string>
+ </property>
+ <property name="statusTip">
+ <string/>
+ </property>
+ <property name="whatsThis">
+ <string/>
+ </property>
+ <property name="text">
+ <string>-</string>
+ </property>
+ </widget>
+ </item>
+ <item row="0" column="0">
+ <widget class="QLabel" name="label_23">
+ <property name="toolTip">
+ <string/>
+ </property>
+ <property name="statusTip">
+ <string/>
+ </property>
+ <property name="whatsThis">
+ <string/>
+ </property>
+ <property name="text">
+ <string>Progress:</string>
+ </property>
+ </widget>
+ </item>
+ <item row="0" column="1">
+ <widget class="QLabel" name="m_CurrentStepLabel">
+ <property name="toolTip">
+ <string/>
+ </property>
+ <property name="statusTip">
+ <string/>
+ </property>
+ <property name="whatsThis">
+ <string/>
+ </property>
+ <property name="text">
+ <string>-</string>
+ </property>
+ </widget>
+ </item>
+ <item row="2" column="0">
+ <widget class="QLabel" name="label_24">
+ <property name="toolTip">
+ <string/>
+ </property>
+ <property name="statusTip">
+ <string/>
+ </property>
+ <property name="whatsThis">
+ <string/>
+ </property>
+ <property name="text">
+ <string>Connections:</string>
+ </property>
+ </widget>
+ </item>
+ <item row="3" column="0">
+ <widget class="QLabel" name="label_25">
+ <property name="toolTip">
+ <string/>
+ </property>
+ <property name="statusTip">
+ <string/>
+ </property>
+ <property name="whatsThis">
+ <string/>
+ </property>
+ <property name="text">
+ <string>Particles:</string>
+ </property>
+ </widget>
+ </item>
+ <item row="2" column="1">
+ <widget class="QLabel" name="m_NumConnectionsLabel">
+ <property name="toolTip">
+ <string/>
+ </property>
+ <property name="statusTip">
+ <string/>
+ </property>
+ <property name="whatsThis">
+ <string/>
+ </property>
+ <property name="text">
+ <string>-</string>
+ </property>
+ </widget>
+ </item>
+ <item row="3" column="1">
+ <widget class="QLabel" name="m_NumParticlesLabel">
+ <property name="toolTip">
+ <string/>
+ </property>
+ <property name="statusTip">
+ <string/>
+ </property>
+ <property name="whatsThis">
+ <string/>
+ </property>
+ <property name="text">
+ <string>-</string>
+ </property>
+ </widget>
+ </item>
+ <item row="5" column="0">
+ <widget class="QLabel" name="label_26">
+ <property name="toolTip">
+ <string/>
+ </property>
+ <property name="statusTip">
+ <string/>
+ </property>
+ <property name="whatsThis">
+ <string/>
+ </property>
+ <property name="text">
+ <string>Tracking Time:</string>
+ </property>
+ </widget>
+ </item>
+ <item row="5" column="1">
+ <widget class="QLabel" name="m_TrackingTimeLabel">
+ <property name="toolTip">
+ <string/>
+ </property>
+ <property name="statusTip">
+ <string/>
+ </property>
+ <property name="whatsThis">
+ <string/>
+ </property>
+ <property name="text">
+ <string>-</string>
+ </property>
+ </widget>
+ </item>
+ <item row="4" column="0">
+ <widget class="QLabel" name="label_27">
+ <property name="toolTip">
+ <string/>
+ </property>
+ <property name="statusTip">
+ <string/>
+ </property>
+ <property name="whatsThis">
+ <string/>
+ </property>
+ <property name="text">
+ <string>Proposal Acceptance Rate:</string>
+ </property>
+ </widget>
+ </item>
+ <item row="4" column="1">
+ <widget class="QLabel" name="m_ProposalAcceptance">
+ <property name="toolTip">
+ <string/>
+ </property>
+ <property name="statusTip">
+ <string/>
+ </property>
+ <property name="whatsThis">
+ <string/>
+ </property>
+ <property name="text">
+ <string>-</string>
+ </property>
+ </widget>
+ </item>
+ </layout>
+ </widget>
+ </item>
+ </layout>
+ </widget>
+ </item>
+ <item>
+ <spacer name="spacer1">
+ <property name="orientation">
+ <enum>Qt::Vertical</enum>
+ </property>
+ <property name="sizeType">
+ <enum>QSizePolicy::Expanding</enum>
+ </property>
+ <property name="sizeHint" stdset="0">
+ <size>
+ <width>0</width>
+ <height>0</height>
+ </size>
+ </property>
+ </spacer>
+ </item>
+ </layout>
+ </widget>
+ <layoutdefault spacing="6" margin="11"/>
+ <resources/>
+ <connections/>
+</ui>
diff --git a/Modules/Bundles/org.mitk.gui.qt.diffusionimaging/src/internal/QmitkODFDetailsView.cpp b/Modules/Bundles/org.mitk.gui.qt.diffusionimaging/src/internal/QmitkODFDetailsView.cpp
new file mode 100644
index 0000000000..d2c140e8e5
--- /dev/null
+++ b/Modules/Bundles/org.mitk.gui.qt.diffusionimaging/src/internal/QmitkODFDetailsView.cpp
@@ -0,0 +1,207 @@
+/*=========================================================================
+Copyright (c) German Cancer Research Center, Division of Medical and
+Biological Informatics. All rights reserved.
+See MITKCopyright.txt or http://www.mitk.org/copyright.html for details.
+
+This software is distributed WITHOUT ANY WARRANTY; without even
+the implied warranty of MERCHANTABILITY or FITNESS FOR A PARTICULAR
+PURPOSE. See the above copyright notices for more information.
+
+=========================================================================*/
+
+// Blueberry
+#include <berryISelectionService.h>
+#include <berryIWorkbenchWindow.h>
+
+// Qmitk
+#include "QmitkODFDetailsView.h"
+#include <QmitkStdMultiWidget.h>
+#include <QTableWidgetItem>
+#include <vtkFloatArray.h>
+#include <vtkPointData.h>
+#include <vtkCellData.h>
+#include <vtkLookupTable.h>
+
+const std::string QmitkODFDetailsView::VIEW_ID = "org.mitk.views.odfdetails";
+
+QmitkODFDetailsView::QmitkODFDetailsView()
+ : QmitkFunctionality()
+ , m_Controls( 0 )
+ , m_MultiWidget( NULL )
+{
+ m_VtkActor = vtkActor::New();
+ m_VtkMapper = vtkPolyDataMapper::New();
+ m_Renderer = vtkRenderer::New();
+ m_VtkRenderWindow = vtkRenderWindow::New();
+ m_RenderWindowInteractor = vtkRenderWindowInteractor::New();
+ m_Camera = vtkCamera::New();
+ m_VtkRenderWindow->SetSize(300,300);
+}
+
+QmitkODFDetailsView::~QmitkODFDetailsView()
+{
+ mitk::SliceNavigationController* slicer = m_MultiWidget->mitkWidget1->GetSliceNavigationController();
+ slicer->RemoveObserver(this->m_SliceObserverTag1);
+
+ slicer = m_MultiWidget->mitkWidget2->GetSliceNavigationController();
+ slicer->RemoveObserver(this->m_SliceObserverTag2);
+
+ slicer = m_MultiWidget->mitkWidget3->GetSliceNavigationController();
+ slicer->RemoveObserver(this->m_SliceObserverTag3);
+}
+
+void QmitkODFDetailsView::CreateQtPartControl( QWidget *parent )
+{
+ // build up qt view, unless already done
+ if ( !m_Controls )
+ {
+ // create GUI widgets from the Qt Designer's .ui file
+ m_Controls = new Ui::QmitkODFDetailsViewControls;
+ m_Controls->setupUi( parent );
+
+ this->m_Controls->m_ODFValueTable->setColumnCount(QBALL_ODFSIZE);
+ this->m_Controls->m_ODFValueTable->setRowCount(1);
+ }
+}
+
+void QmitkODFDetailsView::StdMultiWidgetAvailable (QmitkStdMultiWidget &stdMultiWidget)
+{
+ m_MultiWidget = &stdMultiWidget;
+
+ {
+ mitk::SliceNavigationController* slicer = m_MultiWidget->mitkWidget1->GetSliceNavigationController();
+ itk::ReceptorMemberCommand<QmitkODFDetailsView>::Pointer command = itk::ReceptorMemberCommand<QmitkODFDetailsView>::New();
+ command->SetCallbackFunction( this, &QmitkODFDetailsView::OnSliceChanged );
+ m_SliceObserverTag1 = slicer->AddObserver( mitk::SliceNavigationController::GeometrySliceEvent(NULL, 0), command );
+ }
+
+ {
+ mitk::SliceNavigationController* slicer = m_MultiWidget->mitkWidget2->GetSliceNavigationController();
+ itk::ReceptorMemberCommand<QmitkODFDetailsView>::Pointer command = itk::ReceptorMemberCommand<QmitkODFDetailsView>::New();
+ command->SetCallbackFunction( this, &QmitkODFDetailsView::OnSliceChanged );
+ m_SliceObserverTag2 = slicer->AddObserver( mitk::SliceNavigationController::GeometrySliceEvent(NULL, 0), command );
+ }
+
+ {
+ mitk::SliceNavigationController* slicer = m_MultiWidget->mitkWidget3->GetSliceNavigationController();
+ itk::ReceptorMemberCommand<QmitkODFDetailsView>::Pointer command = itk::ReceptorMemberCommand<QmitkODFDetailsView>::New();
+ command->SetCallbackFunction( this, &QmitkODFDetailsView::OnSliceChanged );
+ m_SliceObserverTag3 = slicer->AddObserver( mitk::SliceNavigationController::GeometrySliceEvent(NULL, 0), command );
+ }
+
+}
+
+void QmitkODFDetailsView::StdMultiWidgetNotAvailable()
+{
+
+ {
+ mitk::SliceNavigationController* slicer = m_MultiWidget->mitkWidget1->GetSliceNavigationController();
+ slicer->RemoveObserver( m_SliceObserverTag1 );
+ }
+
+ {
+ mitk::SliceNavigationController* slicer = m_MultiWidget->mitkWidget2->GetSliceNavigationController();
+ slicer->RemoveObserver( m_SliceObserverTag2 );
+ }
+
+ {
+ mitk::SliceNavigationController* slicer = m_MultiWidget->mitkWidget3->GetSliceNavigationController();
+ slicer->RemoveObserver( m_SliceObserverTag3 );
+ }
+
+ m_MultiWidget = NULL;
+}
+
+void QmitkODFDetailsView::OnSliceChanged(const itk::EventObject& /*e*/)
+{
+ m_Values.clear();
+ std::vector<mitk::DataNode*> nodes = this->GetDataManagerSelection();
+ if (nodes.empty()) return;
+ if (!nodes.front()) return;
+ if (nodes.size()>1) return;
+
+ mitk::QBallImage::Pointer img =
+ dynamic_cast<mitk::QBallImage*>(
+ nodes.front()->GetData());
+
+ if (!img) return;
+
+ if (!m_MultiWidget) return;
+
+ m_TemplateOdf = itk::OrientationDistributionFunction<float,QBALL_ODFSIZE>::GetBaseMesh();
+ m_OdfTransform = vtkSmartPointer<vtkTransform>::New();
+ m_OdfTransform->Identity();
+ m_OdfVals = vtkSmartPointer<vtkDoubleArray>::New();
+ m_OdfSource = vtkSmartPointer<vtkOdfSource>::New();
+ itk::OrientationDistributionFunction<double, QBALL_ODFSIZE> odf;
+
+ mitk::Point3D world = m_MultiWidget->GetCrossPosition();
+ mitk::Point3D index;
+ img->GetTimeSlicedGeometry()->WorldToIndex(world, index);
+
+ OdfVectorImgType::Pointer itkQBallImage = OdfVectorImgType::New();
+ mitk::CastToItkImage<OdfVectorImgType>(img, itkQBallImage);
+
+ float sum = 0;
+ float max = itk::NumericTraits<float>::min();
+ float min = itk::NumericTraits<float>::max();
+ std::ostringstream text;
+ if( text.good() )
+ {
+ m_Values.clear();
+ OdfVectorImgType::IndexType ind;
+ ind[0] = (int)(index[0]+0.5);
+ ind[1] = (int)(index[1]+0.5);
+ ind[2] = (int)(index[2]+0.5);
+
+ OdfVectorImgType::PixelType pixel = itkQBallImage->GetPixel(ind);
+
+
+ for (int i=0; i<QBALL_ODFSIZE; i++){
+ odf.SetNthComponent(i, pixel[i]);
+ text.clear();
+ text.str("");
+ text << pixel[i];
+ sum += pixel[i];
+ if (pixel[i]>max)
+ max = pixel[i];
+ if (pixel[i]<min)
+ min = pixel[i];
+
+ QTableWidgetItem* item = new QTableWidgetItem(text.str().c_str());
+ this->m_Controls->m_ODFValueTable->setItem(0,i,item);
+ this->m_Controls->m_ODFValueTable->update();
+
+ m_Values.push_back(pixel[i]);
+ }
+ float mean = sum/QBALL_ODFSIZE;
+
+ text.clear();
+ text.str("");
+ text << sum;
+ this->m_Controls->m_Sum->setText(text.str().c_str());
+ text.clear();
+ text.str("");
+ text << mean ;
+ this->m_Controls->m_Mean->setText(text.str().c_str());
+ text.clear();
+ text.str("");
+ text << ind[0] << ", " << ind[1] << ", " << ind[2];
+ this->m_Controls->m_Pos->setText(text.str().c_str());
+ text.clear();
+ text.str("");
+ text << min;
+ this->m_Controls->m_Min->setText(text.str().c_str());
+ text.clear();
+ text.str("");
+ text << max;
+ this->m_Controls->m_Max->setText(text.str().c_str());
+ text.clear();
+ text.str("");
+ text << odf.GetGeneralizedFractionalAnisotropy();
+ this->m_Controls->m_GFA->setText(text.str().c_str());
+
+ m_Controls->m_ODFDetailsWidget->SetParameters(m_Values);
+ m_Controls->m_ODFRenderWidget->GenerateODF(m_Values);
+ }
+}
diff --git a/Modules/Bundles/org.mitk.gui.qt.diffusionimaging/src/internal/QmitkODFDetailsView.h b/Modules/Bundles/org.mitk.gui.qt.diffusionimaging/src/internal/QmitkODFDetailsView.h
new file mode 100644
index 0000000000..ab90c46448
--- /dev/null
+++ b/Modules/Bundles/org.mitk.gui.qt.diffusionimaging/src/internal/QmitkODFDetailsView.h
@@ -0,0 +1,104 @@
+/*=========================================================================
+
+Copyright (c) German Cancer Research Center, Division of Medical and
+Biological Informatics. All rights reserved.
+See MITKCopyright.txt or http://www.mitk.org/copyright.html for details.
+
+This software is distributed WITHOUT ANY WARRANTY; without even
+the implied warranty of MERCHANTABILITY or FITNESS FOR A PARTICULAR
+PURPOSE. See the above copyright notices for more information.
+
+=========================================================================*/
+
+#ifndef _QMITKQmitkODFDetailsView_H_INCLUDED
+#define _QMITKQmitkODFDetailsView_H_INCLUDED
+
+#include <berryISelectionListener.h>
+
+#include <QmitkFunctionality.h>
+
+#include "ui_QmitkODFDetailsViewControls.h"
+
+#include <itkVectorImage.h>
+#include <itkImage.h>
+#include <mitkDiffusionImage.h>
+#include <itkOrientationDistributionFunction.h>
+#include <mitkQBallImage.h>
+#include <vtkTransform.h>
+#include <vtkDoubleArray.h>
+#include <vtkOdfSource.h>
+#include <vtkSmartPointer.h>
+#include <QmitkRenderWindow.h>
+#include <vtkPolyDataMapper.h>
+#include <vtkRenderer.h>
+#include <vtkCamera.h>
+
+/*!
+ \brief QmitkODFDetailsView
+
+ \warning This application module is not yet documented. Use "svn blame/praise/annotate" and ask the author to provide basic documentation.
+
+ \sa QmitkFunctionality
+ \ingroup Functionalities
+*/
+
+class QmitkODFDetailsView : public QmitkFunctionality
+{
+ // 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;
+
+ QmitkODFDetailsView();
+ QmitkODFDetailsView(const QmitkODFDetailsView& other)
+ {
+ Q_UNUSED(other)
+ throw std::runtime_error("Copy constructor not implemented");
+ }
+ virtual ~QmitkODFDetailsView();
+
+ typedef float TOdfPixelType;
+ typedef itk::Vector<TOdfPixelType,QBALL_ODFSIZE> OdfVectorType;
+ typedef itk::Image<OdfVectorType,3> OdfVectorImgType;
+
+ virtual void CreateQtPartControl(QWidget *parent);
+
+ virtual void StdMultiWidgetAvailable (QmitkStdMultiWidget &stdMultiWidget);
+ virtual void StdMultiWidgetNotAvailable();
+
+ void OnSliceChanged(const itk::EventObject& e);
+
+protected slots:
+
+protected:
+
+ /// \brief called by QmitkFunctionality when DataManager's selection has changed
+
+ Ui::QmitkODFDetailsViewControls* m_Controls;
+
+ QmitkStdMultiWidget* m_MultiWidget;
+ int m_SliceObserverTag1;
+ int m_SliceObserverTag2;
+ int m_SliceObserverTag3;
+
+ vtkPolyData* m_TemplateOdf;
+ vtkSmartPointer<vtkTransform> m_OdfTransform;
+ vtkSmartPointer<vtkDoubleArray> m_OdfVals;
+ vtkSmartPointer<vtkOdfSource> m_OdfSource;
+
+ vtkActor* m_VtkActor;
+ vtkPolyDataMapper* m_VtkMapper;
+ vtkRenderer* m_Renderer;
+ vtkRenderWindow* m_VtkRenderWindow;
+ vtkRenderWindowInteractor* m_RenderWindowInteractor;
+ vtkCamera* m_Camera;
+ std::vector<double> m_Values;
+};
+
+
+
+#endif // _QmitkODFDetailsView_H_INCLUDED
+
diff --git a/Modules/Bundles/org.mitk.gui.qt.diffusionimaging/src/internal/QmitkODFDetailsViewControls.ui b/Modules/Bundles/org.mitk.gui.qt.diffusionimaging/src/internal/QmitkODFDetailsViewControls.ui
new file mode 100644
index 0000000000..73777404dc
--- /dev/null
+++ b/Modules/Bundles/org.mitk.gui.qt.diffusionimaging/src/internal/QmitkODFDetailsViewControls.ui
@@ -0,0 +1,280 @@
+<?xml version="1.0" encoding="UTF-8"?>
+<ui version="4.0">
+ <class>QmitkODFDetailsViewControls</class>
+ <widget class="QWidget" name="QmitkODFDetailsViewControls">
+ <property name="geometry">
+ <rect>
+ <x>0</x>
+ <y>0</y>
+ <width>351</width>
+ <height>734</height>
+ </rect>
+ </property>
+ <property name="minimumSize">
+ <size>
+ <width>0</width>
+ <height>0</height>
+ </size>
+ </property>
+ <property name="windowTitle">
+ <string>QmitkTemplate</string>
+ </property>
+ <layout class="QVBoxLayout" name="verticalLayout_2">
+ <property name="spacing">
+ <number>0</number>
+ </property>
+ <property name="leftMargin">
+ <number>4</number>
+ </property>
+ <property name="topMargin">
+ <number>0</number>
+ </property>
+ <property name="rightMargin">
+ <number>0</number>
+ </property>
+ <property name="bottomMargin">
+ <number>0</number>
+ </property>
+ <item>
+ <widget class="QGroupBox" name="groupBox">
+ <property name="title">
+ <string>ODF Details</string>
+ </property>
+ <layout class="QVBoxLayout" name="verticalLayout">
+ <property name="leftMargin">
+ <number>0</number>
+ </property>
+ <property name="topMargin">
+ <number>9</number>
+ </property>
+ <property name="rightMargin">
+ <number>0</number>
+ </property>
+ <property name="bottomMargin">
+ <number>0</number>
+ </property>
+ </layout>
+ </widget>
+ </item>
+ <item>
+ <widget class="QFrame" name="frame_2">
+ <property name="sizePolicy">
+ <sizepolicy hsizetype="Expanding" vsizetype="Expanding">
+ <horstretch>0</horstretch>
+ <verstretch>0</verstretch>
+ </sizepolicy>
+ </property>
+ <property name="minimumSize">
+ <size>
+ <width>0</width>
+ <height>0</height>
+ </size>
+ </property>
+ <property name="frameShape">
+ <enum>QFrame::NoFrame</enum>
+ </property>
+ <property name="frameShadow">
+ <enum>QFrame::Raised</enum>
+ </property>
+ <layout class="QGridLayout" name="gridLayout">
+ <property name="margin">
+ <number>0</number>
+ </property>
+ <property name="spacing">
+ <number>0</number>
+ </property>
+ <item row="0" column="0">
+ <widget class="QFrame" name="frame">
+ <property name="frameShape">
+ <enum>QFrame::NoFrame</enum>
+ </property>
+ <property name="frameShadow">
+ <enum>QFrame::Raised</enum>
+ </property>
+ <property name="lineWidth">
+ <number>0</number>
+ </property>
+ <layout class="QFormLayout" name="formLayout">
+ <property name="fieldGrowthPolicy">
+ <enum>QFormLayout::AllNonFixedFieldsGrow</enum>
+ </property>
+ <property name="horizontalSpacing">
+ <number>0</number>
+ </property>
+ <property name="verticalSpacing">
+ <number>4</number>
+ </property>
+ <property name="leftMargin">
+ <number>0</number>
+ </property>
+ <property name="topMargin">
+ <number>9</number>
+ </property>
+ <property name="rightMargin">
+ <number>0</number>
+ </property>
+ <property name="bottomMargin">
+ <number>0</number>
+ </property>
+ <item row="0" column="0">
+ <widget class="QLabel" name="label_2">
+ <property name="text">
+ <string>Sum: </string>
+ </property>
+ </widget>
+ </item>
+ <item row="0" column="1">
+ <widget class="QLabel" name="m_Sum">
+ <property name="text">
+ <string/>
+ </property>
+ </widget>
+ </item>
+ <item row="1" column="0">
+ <widget class="QLabel" name="label_3">
+ <property name="text">
+ <string>Mean: </string>
+ </property>
+ </widget>
+ </item>
+ <item row="1" column="1">
+ <widget class="QLabel" name="m_Mean">
+ <property name="text">
+ <string/>
+ </property>
+ </widget>
+ </item>
+ <item row="5" column="0">
+ <widget class="QLabel" name="label_4">
+ <property name="text">
+ <string>Pos:</string>
+ </property>
+ </widget>
+ </item>
+ <item row="5" column="1">
+ <widget class="QLabel" name="m_Pos">
+ <property name="text">
+ <string/>
+ </property>
+ </widget>
+ </item>
+ <item row="7" column="1">
+ <widget class="QLabel" name="m_Pos_2">
+ <property name="text">
+ <string/>
+ </property>
+ </widget>
+ </item>
+ <item row="2" column="1">
+ <widget class="QLabel" name="m_Min">
+ <property name="text">
+ <string/>
+ </property>
+ </widget>
+ </item>
+ <item row="2" column="0">
+ <widget class="QLabel" name="label_5">
+ <property name="text">
+ <string>Min:</string>
+ </property>
+ </widget>
+ </item>
+ <item row="3" column="1">
+ <widget class="QLabel" name="m_Max">
+ <property name="text">
+ <string/>
+ </property>
+ </widget>
+ </item>
+ <item row="3" column="0">
+ <widget class="QLabel" name="label_6">
+ <property name="text">
+ <string>Max:</string>
+ </property>
+ </widget>
+ </item>
+ <item row="4" column="0">
+ <widget class="QLabel" name="label_7">
+ <property name="text">
+ <string>GFA:</string>
+ </property>
+ </widget>
+ </item>
+ <item row="4" column="1">
+ <widget class="QLabel" name="m_GFA">
+ <property name="text">
+ <string/>
+ </property>
+ </widget>
+ </item>
+ </layout>
+ </widget>
+ </item>
+ <item row="0" column="1">
+ <widget class="QmitkODFRenderWidget" name="m_ODFRenderWidget" native="true">
+ <property name="sizePolicy">
+ <sizepolicy hsizetype="Expanding" vsizetype="Expanding">
+ <horstretch>0</horstretch>
+ <verstretch>0</verstretch>
+ </sizepolicy>
+ </property>
+ </widget>
+ </item>
+ </layout>
+ </widget>
+ </item>
+ <item>
+ <widget class="QmitkODFDetailsWidget" name="m_ODFDetailsWidget" native="true">
+ <property name="sizePolicy">
+ <sizepolicy hsizetype="Expanding" vsizetype="Expanding">
+ <horstretch>0</horstretch>
+ <verstretch>0</verstretch>
+ </sizepolicy>
+ </property>
+ <property name="minimumSize">
+ <size>
+ <width>0</width>
+ <height>200</height>
+ </size>
+ </property>
+ </widget>
+ </item>
+ <item>
+ <widget class="QTableWidget" name="m_ODFValueTable"/>
+ </item>
+ <item>
+ <spacer name="spacer1">
+ <property name="orientation">
+ <enum>Qt::Vertical</enum>
+ </property>
+ <property name="sizeType">
+ <enum>QSizePolicy::Expanding</enum>
+ </property>
+ <property name="sizeHint" stdset="0">
+ <size>
+ <width>20</width>
+ <height>220</height>
+ </size>
+ </property>
+ </spacer>
+ </item>
+ </layout>
+ </widget>
+ <layoutdefault spacing="6" margin="11"/>
+ <customwidgets>
+ <customwidget>
+ <class>QmitkODFDetailsWidget</class>
+ <extends>QWidget</extends>
+ <header>QmitkODFDetailsWidget.h</header>
+ <container>1</container>
+ </customwidget>
+ <customwidget>
+ <class>QmitkODFRenderWidget</class>
+ <extends>QWidget</extends>
+ <header>QmitkODFRenderWidget.h</header>
+ <container>1</container>
+ </customwidget>
+ </customwidgets>
+ <resources/>
+ <connections/>
+</ui>
diff --git a/Modules/Bundles/org.mitk.gui.qt.diffusionimaging/src/internal/QmitkQBallReconstructionView.cpp b/Modules/Bundles/org.mitk.gui.qt.diffusionimaging/src/internal/QmitkQBallReconstructionView.cpp
index a999f9163b..b4e45203b0 100644
--- a/Modules/Bundles/org.mitk.gui.qt.diffusionimaging/src/internal/QmitkQBallReconstructionView.cpp
+++ b/Modules/Bundles/org.mitk.gui.qt.diffusionimaging/src/internal/QmitkQBallReconstructionView.cpp
@@ -1,784 +1,784 @@
/*=========================================================================
Program: Medical Imaging & Interaction Toolkit
Module: $RCSfile$
Language: C++
Date: $Date: 2009-05-28 17:19:30 +0200 (Do, 28 Mai 2009) $
-Version: $Revision: 17495 $
-
+Version: $Revision: 17495 $
+
Copyright (c) German Cancer Research Center, Division of Medical and
Biological Informatics. All rights reserved.
See MITKCopyright.txt or http://www.mitk.org/copyright.html for details.
This software is distributed WITHOUT ANY WARRANTY; without even
the implied warranty of MERCHANTABILITY or FITNESS FOR A PARTICULAR
PURPOSE. See the above copyright notices for more information.
=========================================================================*/
//#define MBILOG_ENABLE_DEBUG
#include "QmitkQBallReconstructionView.h"
#include "mitkDiffusionImagingConfigure.h"
// qt includes
#include <QMessageBox>
// itk includes
#include "itkTimeProbe.h"
// mitk includes
#include "mitkProgressBar.h"
#include "mitkStatusBar.h"
#include "mitkNodePredicateDataType.h"
#include "QmitkDataStorageComboBox.h"
#include "QmitkStdMultiWidget.h"
#include "itkDiffusionQballReconstructionImageFilter.h"
#include "itkAnalyticalDiffusionQballReconstructionImageFilter.h"
#include "itkVectorContainer.h"
#include "mitkQBallImage.h"
#include "mitkProperties.h"
#include "mitkVtkResliceInterpolationProperty.h"
#include "mitkLookupTable.h"
#include "mitkLookupTableProperty.h"
#include "mitkTransferFunction.h"
#include "mitkTransferFunctionProperty.h"
#include "mitkDataNodeObject.h"
#include "mitkOdfNormalizationMethodProperty.h"
#include "mitkOdfScaleByProperty.h"
#include "berryIStructuredSelection.h"
#include "berryIWorkbenchWindow.h"
#include "berryISelectionService.h"
#include <boost/version.hpp>
-const std::string QmitkQBallReconstructionView::VIEW_ID =
+const std::string QmitkQBallReconstructionView::VIEW_ID =
"org.mitk.views.qballreconstruction";
#define DI_INFO MITK_INFO("DiffusionImaging")
typedef float TTensorPixelType;
const int QmitkQBallReconstructionView::nrconvkernels = 252;
using namespace berry;
struct QbrSelListener : ISelectionListener
{
berryObjectMacro(QbrSelListener);
QbrSelListener(QmitkQBallReconstructionView* view)
{
m_View = view;
}
void DoSelectionChanged(ISelection::ConstPointer selection)
{
// save current selection in member variable
m_View->m_CurrentSelection = selection.Cast<const IStructuredSelection>();
// do something with the selected items
if(m_View->m_CurrentSelection)
{
bool foundDwiVolume = false;
// iterate selection
- for (IStructuredSelection::iterator i = m_View->m_CurrentSelection->Begin();
+ for (IStructuredSelection::iterator i = m_View->m_CurrentSelection->Begin();
i != m_View->m_CurrentSelection->End(); ++i)
{
// extract datatree node
if (mitk::DataNodeObject::Pointer nodeObj = i->Cast<mitk::DataNodeObject>())
{
mitk::DataNode::Pointer node = nodeObj->GetDataNode();
-
+
// only look at interesting types
if(QString("DiffusionImage").compare(node->GetData()->GetNameOfClass())==0)
{
foundDwiVolume = true;
}
}
}
m_View->m_Controls->m_ButtonStandard->setEnabled(foundDwiVolume);
}
}
void SelectionChanged(IWorkbenchPart::Pointer part, ISelection::ConstPointer selection)
{
// check, if selection comes from datamanager
if (part)
{
QString partname(part->GetPartName().c_str());
if(partname.compare("Datamanager")==0)
{
// apply selection
DoSelectionChanged(selection);
}
}
}
QmitkQBallReconstructionView* m_View;
};
QmitkQBallReconstructionView::QmitkQBallReconstructionView()
: QmitkFunctionality(),
m_Controls(NULL),
m_MultiWidget(NULL)
{
}
QmitkQBallReconstructionView::QmitkQBallReconstructionView(const QmitkQBallReconstructionView& other)
{
Q_UNUSED(other);
throw std::runtime_error("Copy constructor not implemented");
}
//void QmitkQBallReconstructionView::OpactiyChanged(int value)
//{
// if (m_CurrentSelection)
// {
// if (mitk::DataNodeObject::Pointer nodeObj = m_CurrentSelection->Begin()->Cast<mitk::DataNodeObject>())
// {
// mitk::DataNode::Pointer node = nodeObj->GetDataNode();
// if(QString("DiffusionImage").compare(node->GetData()->GetNameOfClass())==0)
// {
// node->SetIntProperty("DisplayChannel", value);
// mitk::RenderingManager::GetInstance()->RequestUpdateAll();
// }
// }
// }
//}
//
//void QmitkQBallReconstructionView::OpactiyActionChanged()
//{
// if (m_CurrentSelection)
// {
// if (mitk::DataNodeObject::Pointer nodeObj = m_CurrentSelection->Begin()->Cast<mitk::DataNodeObject>())
// {
// mitk::DataNode::Pointer node = nodeObj->GetDataNode();
// if(QString("DiffusionImage").compare(node->GetData()->GetNameOfClass())==0)
// {
// int displayChannel = 0.0;
// if(node->GetIntProperty("DisplayChannel", displayChannel))
// {
// m_OpacitySlider->setValue(displayChannel);
// }
// }
// }
// }
-//
+//
// MITK_INFO << "changed";
//}
QmitkQBallReconstructionView::~QmitkQBallReconstructionView()
{
this->GetSite()->GetWorkbenchWindow()->GetSelectionService()->RemovePostSelectionListener(/*"org.mitk.views.datamanager",*/ m_SelListener);
}
void QmitkQBallReconstructionView::CreateQtPartControl(QWidget *parent)
{
if (!m_Controls)
{
// create GUI widgets
m_Controls = new Ui::QmitkQBallReconstructionViewControls;
m_Controls->setupUi(parent);
this->CreateConnections();
QStringList items;
items << "2" << "4" << "6" << "8";
m_Controls->m_QBallReconstructionMaxLLevelComboBox->addItems(items);
m_Controls->m_QBallReconstructionMaxLLevelComboBox->setCurrentIndex(1);
MethodChoosen(m_Controls->m_QBallReconstructionMethodComboBox->currentIndex());
m_Controls->m_QBallReconstructionNumberThreadsSpinbox->setValue(8);
#ifndef DIFFUSION_IMAGING_EXTENDED
m_Controls->m_QBallReconstructionMethodComboBox->removeItem(3);
#endif
AdvancedCheckboxClicked();
// define data type for combobox
//m_Controls->m_ImageSelector->SetDataStorage( this->GetDefaultDataStorage() );
//m_Controls->m_ImageSelector->SetPredicate( mitk::NodePredicateDataType::New("DiffusionImage") );
}
m_SelListener = berry::ISelectionListener::Pointer(new QbrSelListener(this));
this->GetSite()->GetWorkbenchWindow()->GetSelectionService()->AddPostSelectionListener(/*"org.mitk.views.datamanager",*/ m_SelListener);
berry::ISelection::ConstPointer sel(
this->GetSite()->GetWorkbenchWindow()->GetSelectionService()->GetSelection("org.mitk.views.datamanager"));
m_CurrentSelection = sel.Cast<const IStructuredSelection>();
m_SelListener.Cast<QbrSelListener>()->DoSelectionChanged(sel);
}
void QmitkQBallReconstructionView::StdMultiWidgetAvailable (QmitkStdMultiWidget &stdMultiWidget)
{
m_MultiWidget = &stdMultiWidget;
}
void QmitkQBallReconstructionView::StdMultiWidgetNotAvailable()
{
m_MultiWidget = NULL;
}
void QmitkQBallReconstructionView::CreateConnections()
{
if ( m_Controls )
{
connect( (QObject*)(m_Controls->m_ButtonStandard), SIGNAL(clicked()), this, SLOT(ReconstructStandard()) );
connect( (QObject*)(m_Controls->m_AdvancedCheckbox), SIGNAL(clicked()), this, SLOT(AdvancedCheckboxClicked()) );
connect( (QObject*)(m_Controls->m_QBallReconstructionMethodComboBox), SIGNAL(currentIndexChanged(int)), this, SLOT(MethodChoosen(int)) );
}
}
void QmitkQBallReconstructionView::Activated()
{
QmitkFunctionality::Activated();
berry::ISelection::ConstPointer sel(
this->GetSite()->GetWorkbenchWindow()->GetSelectionService()->GetSelection("org.mitk.views.datamanager"));
m_CurrentSelection = sel.Cast<const IStructuredSelection>();
m_SelListener.Cast<QbrSelListener>()->DoSelectionChanged(sel);
}
void QmitkQBallReconstructionView::Deactivated()
{
QmitkFunctionality::Deactivated();
}
void QmitkQBallReconstructionView::ReconstructStandard()
{
int index = m_Controls->m_QBallReconstructionMethodComboBox->currentIndex();
#ifndef DIFFUSION_IMAGING_EXTENDED
if(index>=3)
{
index = index + 1;
}
#endif
switch(index)
{
case 0:
{
// Numerical
Reconstruct(0,0);
break;
}
case 1:
{
// Standard
Reconstruct(1,0);
break;
}
case 2:
{
// Solid Angle
Reconstruct(1,6);
break;
}
case 3:
{
// Constrained Solid Angle
Reconstruct(1,7);
break;
}
case 4:
{
// ADC
Reconstruct(1,4);
break;
}
case 5:
{
// Raw Signal
Reconstruct(1,5);
break;
}
}
}
void QmitkQBallReconstructionView::MethodChoosen(int method)
{
switch(method)
{
case 0:
m_Controls->m_Description->setText("Numerical recon. (Tuch2004)");
break;
case 1:
- m_Controls->m_Description->setText("Spherical harmonics recon. (Desoteaux2007)");
+ m_Controls->m_Description->setText("Spherical harmonics recon. (Descoteaux2007)");
break;
case 2:
m_Controls->m_Description->setText("SH recon. with solid angle consideration (Aganj2009)");
break;
case 3:
m_Controls->m_Description->setText("SH solid angle with non-neg. constraint (Goh2009)");
break;
case 4:
m_Controls->m_Description->setText("SH recon. of the plain ADC-profiles");
break;
case 5:
m_Controls->m_Description->setText("SH recon. of the raw diffusion signal");
break;
}
}
void QmitkQBallReconstructionView::AdvancedCheckboxClicked()
{
bool check = m_Controls->
m_AdvancedCheckbox->isChecked();
-
+
m_Controls->m_QBallReconstructionMaxLLevelTextLabel_2->setVisible(check);
m_Controls->m_QBallReconstructionMaxLLevelComboBox->setVisible(check);
m_Controls->m_QBallReconstructionLambdaTextLabel_2->setVisible(check);
m_Controls->m_QBallReconstructionLambdaLineEdit->setVisible(check);
-
+
m_Controls->m_QBallReconstructionThresholdLabel_2->setVisible(check);
m_Controls->m_QBallReconstructionThreasholdEdit->setVisible(check);
m_Controls->m_OutputB0Image->setVisible(check);
m_Controls->m_QBallReconstructionNumberThreadsLabel_2->setVisible(check);
m_Controls->m_QBallReconstructionNumberThreadsSpinbox->setVisible(check);
m_Controls->label_2->setVisible(check);
//m_Controls->textLabel1_2->setVisible(check);
//m_Controls->m_QBallReconstructionLambdaStepLineEdit->setVisible(check);
//m_Controls->textLabel1_3->setVisible(check);
-
+
m_Controls->frame_2->setVisible(check);
}
void QmitkQBallReconstructionView::Reconstruct(int method, int normalization)
{
if (m_CurrentSelection)
{
mitk::DataStorage::SetOfObjects::Pointer set =
mitk::DataStorage::SetOfObjects::New();
int at = 0;
- for (IStructuredSelection::iterator i = m_CurrentSelection->Begin();
- i != m_CurrentSelection->End();
+ for (IStructuredSelection::iterator i = m_CurrentSelection->Begin();
+ i != m_CurrentSelection->End();
++i)
{
if (mitk::DataNodeObject::Pointer nodeObj = i->Cast<mitk::DataNodeObject>())
{
mitk::DataNode::Pointer node = nodeObj->GetDataNode();
if(QString("DiffusionImage").compare(node->GetData()->GetNameOfClass())==0)
{
set->InsertElement(at++, node);
}
}
}
if(method == 0)
{
NumericalQBallReconstruction(set, normalization);
}
else
{
#if BOOST_VERSION / 100000 > 0
#if BOOST_VERSION / 100 % 1000 > 34
if(method == 1)
{
AnalyticalQBallReconstruction(set, normalization);
}
#else
std::cout << "ERROR: Boost 1.35 minimum required" << std::endl;
QMessageBox::warning(NULL,"ERROR","Boost 1.35 minimum required");
#endif
#else
std::cout << "ERROR: Boost 1.35 minimum required" << std::endl;
QMessageBox::warning(NULL,"ERROR","Boost 1.35 minimum required");
#endif
}
}
}
void QmitkQBallReconstructionView::NumericalQBallReconstruction
- (mitk::DataStorage::SetOfObjects::Pointer inImages, int normalization)
+ (mitk::DataStorage::SetOfObjects::Pointer inImages, int normalization)
{
try
{
itk::TimeProbe clock;
int nrFiles = inImages->size();
if (!nrFiles) return;
QString status;
mitk::ProgressBar::GetInstance()->AddStepsToDo(nrFiles);
- mitk::DataStorage::SetOfObjects::const_iterator itemiter( inImages->begin() );
- mitk::DataStorage::SetOfObjects::const_iterator itemiterend( inImages->end() );
+ mitk::DataStorage::SetOfObjects::const_iterator itemiter( inImages->begin() );
+ mitk::DataStorage::SetOfObjects::const_iterator itemiterend( inImages->end() );
std::vector<mitk::DataNode::Pointer> nodes;
while ( itemiter != itemiterend ) // for all items
{
- mitk::DiffusionImage<DiffusionPixelType>* vols =
+ mitk::DiffusionImage<DiffusionPixelType>* vols =
static_cast<mitk::DiffusionImage<DiffusionPixelType>*>(
(*itemiter)->GetData());
-
+
std::string nodename;
(*itemiter)->GetStringProperty("name", nodename);
++itemiter;
// QBALL RECONSTRUCTION
clock.Start();
MBI_INFO << "QBall reconstruction ";
mitk::StatusBar::GetInstance()->DisplayText(status.sprintf(
"QBall reconstruction for %s", nodename.c_str()).toAscii());
typedef itk::DiffusionQballReconstructionImageFilter
<DiffusionPixelType, DiffusionPixelType, TTensorPixelType, QBALL_ODFSIZE>
QballReconstructionImageFilterType;
-
- QballReconstructionImageFilterType::Pointer filter =
+
+ QballReconstructionImageFilterType::Pointer filter =
QballReconstructionImageFilterType::New();
filter->SetGradientImage( vols->GetDirections(), vols->GetVectorImage() );
filter->SetNumberOfThreads( m_Controls->m_QBallReconstructionNumberThreadsSpinbox->value() );
- filter->SetBValue(vols->GetB_Value());
+ filter->SetBValue(vols->GetB_Value());
filter->SetThreshold( m_Controls->m_QBallReconstructionThreasholdEdit->text().toFloat() );
switch(normalization)
{
case 0:
{
filter->SetNormalizationMethod(QballReconstructionImageFilterType::QBR_STANDARD);
break;
}
case 1:
{
filter->SetNormalizationMethod(QballReconstructionImageFilterType::QBR_B_ZERO_B_VALUE);
break;
}
case 2:
{
filter->SetNormalizationMethod(QballReconstructionImageFilterType::QBR_B_ZERO);
break;
}
case 3:
{
filter->SetNormalizationMethod(QballReconstructionImageFilterType::QBR_NONE);
break;
}
default:
{
filter->SetNormalizationMethod(QballReconstructionImageFilterType::QBR_STANDARD);
}
}
filter->Update();
clock.Stop();
MBI_DEBUG << "took " << clock.GetMeanTime() << "s." ;
// ODFs TO DATATREE
mitk::QBallImage::Pointer image = mitk::QBallImage::New();
image->InitializeByItk( filter->GetOutput() );
//image->SetImportVolume( filter->GetOutput()->GetBufferPointer(), 0, 0, mitk::Image::ImportMemoryManagementType::ManageMemory );
image->SetVolume( filter->GetOutput()->GetBufferPointer() );
mitk::DataNode::Pointer node=mitk::DataNode::New();
node->SetData( image );
QString newname;
newname = newname.append(nodename.c_str());
newname = newname.append("_QN%1").arg(normalization);
SetDefaultNodeProperties(node, newname.toStdString());
nodes.push_back(node);
-
+
// B-Zero TO DATATREE
if(m_Controls->m_OutputB0Image->isChecked())
{
mitk::Image::Pointer image4 = mitk::Image::New();
image4->InitializeByItk( filter->GetBZeroImage().GetPointer() );
image4->SetVolume( filter->GetBZeroImage()->GetBufferPointer() );
mitk::DataNode::Pointer node4=mitk::DataNode::New();
node4->SetData( image4 );
node4->SetProperty( "name", mitk::StringProperty::New(
QString(nodename.c_str()).append("_b0").toStdString()) );
nodes.push_back(node4);
}
mitk::ProgressBar::GetInstance()->Progress();
}
std::vector<mitk::DataNode::Pointer>::iterator nodeIt;
for(nodeIt = nodes.begin(); nodeIt != nodes.end(); ++nodeIt)
GetDefaultDataStorage()->Add(*nodeIt);
mitk::StatusBar::GetInstance()->DisplayText(status.sprintf("Finished Processing %d Files", nrFiles).toAscii());
m_MultiWidget->RequestUpdate();
}
catch (itk::ExceptionObject &ex)
{
MBI_INFO << ex ;
return ;
}
}
void QmitkQBallReconstructionView::AnalyticalQBallReconstruction(
- mitk::DataStorage::SetOfObjects::Pointer inImages,
- int normalization)
+ mitk::DataStorage::SetOfObjects::Pointer inImages,
+ int normalization)
{
try
{
itk::TimeProbe clock;
int nrFiles = inImages->size();
if (!nrFiles) return;
std::vector<float> lambdas;
float minLambda = m_Controls->m_QBallReconstructionLambdaLineEdit->text().toFloat();
lambdas.push_back(minLambda);
int nLambdas = lambdas.size();
-
+
QString status;
mitk::ProgressBar::GetInstance()->AddStepsToDo(nrFiles*nLambdas);
- mitk::DataStorage::SetOfObjects::const_iterator itemiter( inImages->begin() );
- mitk::DataStorage::SetOfObjects::const_iterator itemiterend( inImages->end() );
+ mitk::DataStorage::SetOfObjects::const_iterator itemiter( inImages->begin() );
+ mitk::DataStorage::SetOfObjects::const_iterator itemiterend( inImages->end() );
std::vector<mitk::DataNode::Pointer>* nodes
= new std::vector<mitk::DataNode::Pointer>();
while ( itemiter != itemiterend ) // for all items
{
- mitk::DiffusionImage<DiffusionPixelType>* vols =
+ mitk::DiffusionImage<DiffusionPixelType>* vols =
static_cast<mitk::DiffusionImage<DiffusionPixelType>*>(
(*itemiter)->GetData());
std::string nodename;
(*itemiter)->GetStringProperty("name",nodename);
itemiter++;
// QBALL RECONSTRUCTION
clock.Start();
MBI_INFO << "QBall reconstruction ";
mitk::StatusBar::GetInstance()->DisplayText(status.sprintf(
"QBall reconstruction for %s", nodename.c_str()).toAscii());
for(int i=0; i<nLambdas; i++)
{
float currentLambda = lambdas[i];
switch(m_Controls->m_QBallReconstructionMaxLLevelComboBox->currentIndex())
{
case 0:
{
TemplatedAnalyticalQBallReconstruction<2>(vols, currentLambda, nodename, nodes, normalization);
break;
}
case 1:
{
TemplatedAnalyticalQBallReconstruction<4>(vols, currentLambda, nodename, nodes, normalization);
break;
}
case 2:
{
TemplatedAnalyticalQBallReconstruction<6>(vols, currentLambda, nodename, nodes, normalization);
break;
}
case 3:
{
TemplatedAnalyticalQBallReconstruction<8>(vols, currentLambda, nodename, nodes, normalization);
break;
}
}
clock.Stop();
MBI_DEBUG << "took " << clock.GetMeanTime() << "s." ;
mitk::ProgressBar::GetInstance()->Progress();
}
}
std::vector<mitk::DataNode::Pointer>::iterator nodeIt;
for(nodeIt = nodes->begin(); nodeIt != nodes->end(); ++nodeIt)
GetDefaultDataStorage()->Add(*nodeIt);
m_MultiWidget->RequestUpdate();
mitk::StatusBar::GetInstance()->DisplayText(status.sprintf("Finished Processing %d Files", nrFiles).toAscii());
}
catch (itk::ExceptionObject &ex)
{
MBI_INFO << ex ;
return ;
}
}
template<int L>
void QmitkQBallReconstructionView::TemplatedAnalyticalQBallReconstruction(
mitk::DiffusionImage<DiffusionPixelType>* vols, float lambda,
- std::string nodename, std::vector<mitk::DataNode::Pointer>* nodes,
- int normalization)
+ std::string nodename, std::vector<mitk::DataNode::Pointer>* nodes,
+ int normalization)
{
typedef itk::AnalyticalDiffusionQballReconstructionImageFilter
<DiffusionPixelType,DiffusionPixelType,TTensorPixelType,L,QBALL_ODFSIZE> FilterType;
typename FilterType::Pointer filter = FilterType::New();
filter->SetGradientImage( vols->GetDirections(), vols->GetVectorImage() );
filter->SetNumberOfThreads( m_Controls->m_QBallReconstructionNumberThreadsSpinbox->value() );
- filter->SetBValue(vols->GetB_Value());
+ filter->SetBValue(vols->GetB_Value());
filter->SetThreshold( m_Controls->m_QBallReconstructionThreasholdEdit->text().toFloat() );
filter->SetLambda(lambda);
switch(normalization)
{
case 0:
{
filter->SetNormalizationMethod(FilterType::QBAR_STANDARD);
break;
}
case 1:
{
filter->SetNormalizationMethod(FilterType::QBAR_B_ZERO_B_VALUE);
break;
- }
+ }
case 2:
{
filter->SetNormalizationMethod(FilterType::QBAR_B_ZERO);
break;
}
case 3:
{
filter->SetNormalizationMethod(FilterType::QBAR_NONE);
break;
}
case 4:
{
filter->SetNormalizationMethod(FilterType::QBAR_ADC_ONLY);
break;
}
case 5:
{
filter->SetNormalizationMethod(FilterType::QBAR_RAW_SIGNAL);
break;
}
case 6:
{
filter->SetNormalizationMethod(FilterType::QBAR_SOLID_ANGLE);
break;
}
case 7:
{
filter->SetNormalizationMethod(FilterType::QBAR_NONNEG_SOLID_ANGLE);
break;
}
default:
{
filter->SetNormalizationMethod(FilterType::QBAR_STANDARD);
}
}
filter->Update();
// ODFs TO DATATREE
mitk::QBallImage::Pointer image = mitk::QBallImage::New();
image->InitializeByItk( filter->GetOutput() );
image->SetVolume( filter->GetOutput()->GetBufferPointer() );
mitk::DataNode::Pointer node=mitk::DataNode::New();
node->SetData( image );
QString newname;
newname = newname.append(nodename.c_str());
newname = newname.append("_QA%1").arg(normalization);
SetDefaultNodeProperties(node, newname.toStdString());
nodes->push_back(node);
// mitk::Image::Pointer image5 = mitk::Image::New();
// image5->InitializeByItk( filter->GetODFSumImage().GetPointer() );
// image5->SetVolume( filter->GetODFSumImage()->GetBufferPointer() );
// mitk::DataNode::Pointer node5=mitk::DataNode::New();
// node5->SetData( image5 );
// node5->SetProperty( "name", mitk::StringProperty::New(
// QString(nodename.c_str()).append("_ODF").toStdString()) );
// nodes->push_back(node5);
-
+
// B-Zero TO DATATREE
if(m_Controls->m_OutputB0Image->isChecked())
{
mitk::Image::Pointer image4 = mitk::Image::New();
image4->InitializeByItk( filter->GetBZeroImage().GetPointer() );
image4->SetVolume( filter->GetBZeroImage()->GetBufferPointer() );
mitk::DataNode::Pointer node4=mitk::DataNode::New();
node4->SetData( image4 );
node4->SetProperty( "name", mitk::StringProperty::New(
QString(nodename.c_str()).append("_b0").toStdString()) );
nodes->push_back(node4);
- }
+ }
}
void QmitkQBallReconstructionView::SetDefaultNodeProperties(mitk::DataNode::Pointer node, std::string name)
{
node->SetProperty( "ShowMaxNumber", mitk::IntProperty::New( 500 ) );
node->SetProperty( "Scaling", mitk::FloatProperty::New( 1.0 ) );
node->SetProperty( "Normalization", mitk::OdfNormalizationMethodProperty::New());
node->SetProperty( "ScaleBy", mitk::OdfScaleByProperty::New());
node->SetProperty( "IndexParam1", mitk::FloatProperty::New(2));
node->SetProperty( "IndexParam2", mitk::FloatProperty::New(1));
node->SetProperty( "visible", mitk::BoolProperty::New( true ) );
node->SetProperty( "VisibleOdfs", mitk::BoolProperty::New( false ) );
node->SetProperty ("layer", mitk::IntProperty::New(100));
node->SetProperty( "DoRefresh", mitk::BoolProperty::New( true ) );
//node->SetProperty( "opacity", mitk::FloatProperty::New(1.0f) );
node->SetProperty( "name", mitk::StringProperty::New(name) );
}
//node->SetProperty( "volumerendering", mitk::BoolProperty::New( false ) );
//node->SetProperty( "use color", mitk::BoolProperty::New( true ) );
//node->SetProperty( "texture interpolation", mitk::BoolProperty::New( true ) );
//node->SetProperty( "reslice interpolation", mitk::VtkResliceInterpolationProperty::New() );
//node->SetProperty( "layer", mitk::IntProperty::New(0));
//node->SetProperty( "in plane resample extent by geometry", mitk::BoolProperty::New( false ) );
//node->SetOpacity(1.0f);
- //node->SetColor(1.0,1.0,1.0);
+ //node->SetColor(1.0,1.0,1.0);
//node->SetVisibility(true);
//node->SetProperty( "IsQBallVolume", mitk::BoolProperty::New( true ) );
//mitk::LevelWindowProperty::Pointer levWinProp = mitk::LevelWindowProperty::New();
//mitk::LevelWindow levelwindow;
//// levelwindow.SetAuto( image );
//levWinProp->SetLevelWindow( levelwindow );
//node->GetPropertyList()->SetProperty( "levelwindow", levWinProp );
//// add a default rainbow lookup table for color mapping
//if(!node->GetProperty("LookupTable"))
//{
// mitk::LookupTable::Pointer mitkLut = mitk::LookupTable::New();
// vtkLookupTable* vtkLut = mitkLut->GetVtkLookupTable();
// vtkLut->SetHueRange(0.6667, 0.0);
// vtkLut->SetTableRange(0.0, 20.0);
// vtkLut->Build();
// mitk::LookupTableProperty::Pointer mitkLutProp = mitk::LookupTableProperty::New();
// mitkLutProp->SetLookupTable(mitkLut);
// node->SetProperty( "LookupTable", mitkLutProp );
//}
//if(!node->GetProperty("binary"))
// node->SetProperty( "binary", mitk::BoolProperty::New( false ) );
//// add a default transfer function
//mitk::TransferFunction::Pointer tf = mitk::TransferFunction::New();
//node->SetProperty ( "TransferFunction", mitk::TransferFunctionProperty::New ( tf.GetPointer() ) );
//// set foldername as string property
//mitk::StringProperty::Pointer nameProp = mitk::StringProperty::New( name );
//node->SetProperty( "name", nameProp );
diff --git a/Modules/Bundles/org.mitk.gui.qt.diffusionimaging/src/internal/mitkPluginActivator.cpp b/Modules/Bundles/org.mitk.gui.qt.diffusionimaging/src/internal/mitkPluginActivator.cpp
index 0c6187f534..1715b75d19 100644
--- a/Modules/Bundles/org.mitk.gui.qt.diffusionimaging/src/internal/mitkPluginActivator.cpp
+++ b/Modules/Bundles/org.mitk.gui.qt.diffusionimaging/src/internal/mitkPluginActivator.cpp
@@ -1,36 +1,40 @@
#include "mitkPluginActivator.h"
#include <QtPlugin>
#include "src/internal/QmitkDiffusionImagingPublicPerspective.h"
#include "src/internal/QmitkQBallReconstructionView.h"
#include "src/internal/QmitkPreprocessingView.h"
#include "src/internal/QmitkDiffusionDicomImportView.h"
#include "src/internal/QmitkDiffusionQuantificationView.h"
#include "src/internal/QmitkTensorReconstructionView.h"
#include "src/internal/QmitkControlVisualizationPropertiesView.h"
+#include "src/internal/QmitkODFDetailsView.h"
+#include "src/internal/QmitkGlobalFiberTrackingView.h"
namespace mitk {
void PluginActivator::start(ctkPluginContext* context)
{
BERRY_REGISTER_EXTENSION_CLASS(QmitkDiffusionImagingPublicPerspective, context)
-
+
BERRY_REGISTER_EXTENSION_CLASS(QmitkQBallReconstructionView, context)
BERRY_REGISTER_EXTENSION_CLASS(QmitkPreprocessingView, context)
BERRY_REGISTER_EXTENSION_CLASS(QmitkDiffusionDicomImport, context)
BERRY_REGISTER_EXTENSION_CLASS(QmitkDiffusionQuantificationView, context)
BERRY_REGISTER_EXTENSION_CLASS(QmitkTensorReconstructionView, context)
BERRY_REGISTER_EXTENSION_CLASS(QmitkControlVisualizationPropertiesView, context)
+ BERRY_REGISTER_EXTENSION_CLASS(QmitkODFDetailsView, context)
+ BERRY_REGISTER_EXTENSION_CLASS(QmitkGlobalFiberTrackingView, context)
}
void PluginActivator::stop(ctkPluginContext* context)
{
Q_UNUSED(context)
}
}
Q_EXPORT_PLUGIN2(org_mitk_gui_qt_diffusionimaging, mitk::PluginActivator)
diff --git a/Modules/Bundles/org.mitk.gui.qt.diffusionimagingapp/CMakeLists.txt b/Modules/Bundles/org.mitk.gui.qt.diffusionimagingapp/CMakeLists.txt
new file mode 100644
index 0000000000..e357958be7
--- /dev/null
+++ b/Modules/Bundles/org.mitk.gui.qt.diffusionimagingapp/CMakeLists.txt
@@ -0,0 +1,18 @@
+SET (QT_USE_QTWEBKIT TRUE)
+INCLUDE(${QT_USE_FILE})
+
+IF(QT_QTWEBKIT_FOUND)
+ ADD_DEFINITIONS(-DQT_WEBKIT)
+ENDIF(QT_QTWEBKIT_FOUND)
+
+# The project name must correspond to the directory name of your plug-in
+# and must not contain periods.
+PROJECT(org_mitk_gui_qt_diffusionimagingapp)
+
+MACRO_CREATE_MITK_CTK_PLUGIN(
+ EXPORT_DIRECTIVE DIFFUSIONIMAGING_APP_EXPORT
+ EXPORTED_INCLUDE_SUFFIXES src
+ MODULE_DEPENDENCIES Qmitk SceneSerialization
+)
+
+TARGET_LINK_LIBRARIES(${PLUGIN_TARGET} ${QT_LIBRARIES})
diff --git a/Modules/Bundles/org.mitk.gui.qt.diffusionimagingapp/documentation/MitkDiffusionImagingAppQtHelpCollectionProject.qhcp b/Modules/Bundles/org.mitk.gui.qt.diffusionimagingapp/documentation/MitkDiffusionImagingAppQtHelpCollectionProject.qhcp
new file mode 100644
index 0000000000..de37e2f00b
--- /dev/null
+++ b/Modules/Bundles/org.mitk.gui.qt.diffusionimagingapp/documentation/MitkDiffusionImagingAppQtHelpCollectionProject.qhcp
@@ -0,0 +1,22 @@
+<?xml version="1.0" encoding="utf-8" ?>
+<QHelpCollectionProject version="1.0">
+ <assistant>
+ <title>MITK 3M3 Help</title>
+ <applicationIcon>assistant-logo.png</applicationIcon>
+ <startPage>qthelp://org.mitk.gui.qt.diffusionimagingapp/bundle/index.html</startPage>
+ <applicationIcon>assistant-icon.png</applicationIcon>
+ <enableFilterFunctionality>false</enableFilterFunctionality>
+ <enableDocumentationManager>false</enableDocumentationManager>
+ <enableAddressBar visible="false">true</enableAddressBar>
+ <cacheDirectory>Mitk3M3</cacheDirectory>
+ <aboutMenuText>
+ <text>About MITK 3M3 Help</text>
+ </aboutMenuText>
+ <aboutDialog>
+ <icon>about-logo.png</icon>
+ </aboutDialog>
+ </assistant>
+ <docFiles>
+
+ </docFiles>
+</QHelpCollectionProject>
diff --git a/Modules/Bundles/org.mitk.gui.qt.diffusionimagingapp/documentation/UserManual/Crosshair_Modes.png b/Modules/Bundles/org.mitk.gui.qt.diffusionimagingapp/documentation/UserManual/Crosshair_Modes.png
new file mode 100644
index 0000000000..ffc2717c6f
Binary files /dev/null and b/Modules/Bundles/org.mitk.gui.qt.diffusionimagingapp/documentation/UserManual/Crosshair_Modes.png differ
diff --git a/Modules/Bundles/org.mitk.gui.qt.diffusionimagingapp/documentation/UserManual/GUI.png b/Modules/Bundles/org.mitk.gui.qt.diffusionimagingapp/documentation/UserManual/GUI.png
new file mode 100644
index 0000000000..a31fbfb5c2
Binary files /dev/null and b/Modules/Bundles/org.mitk.gui.qt.diffusionimagingapp/documentation/UserManual/GUI.png differ
diff --git a/Modules/Bundles/org.mitk.gui.qt.diffusionimagingapp/documentation/UserManual/GUI_Commented.png b/Modules/Bundles/org.mitk.gui.qt.diffusionimagingapp/documentation/UserManual/GUI_Commented.png
new file mode 100644
index 0000000000..22ca0a4211
Binary files /dev/null and b/Modules/Bundles/org.mitk.gui.qt.diffusionimagingapp/documentation/UserManual/GUI_Commented.png differ
diff --git a/Modules/Bundles/org.mitk.gui.qt.diffusionimagingapp/documentation/UserManual/Open_Perspective.png b/Modules/Bundles/org.mitk.gui.qt.diffusionimagingapp/documentation/UserManual/Open_Perspective.png
new file mode 100644
index 0000000000..5d48dea11e
Binary files /dev/null and b/Modules/Bundles/org.mitk.gui.qt.diffusionimagingapp/documentation/UserManual/Open_Perspective.png differ
diff --git a/Modules/Bundles/org.mitk.gui.qt.diffusionimagingapp/documentation/UserManual/QmitkDiffusionImagingAppUserManual.dox b/Modules/Bundles/org.mitk.gui.qt.diffusionimagingapp/documentation/UserManual/QmitkDiffusionImagingAppUserManual.dox
new file mode 100644
index 0000000000..f1924cff96
--- /dev/null
+++ b/Modules/Bundles/org.mitk.gui.qt.diffusionimagingapp/documentation/UserManual/QmitkDiffusionImagingAppUserManual.dox
@@ -0,0 +1,139 @@
+/**
+\mainpage The Main Application
+
+Welcome to the MITK 3M3 application, build with the <B>M</B>edical <B>I</B>maging <B>T</B>ool<B>k</B>it ( http://mitk.org/ ).
+
+Available sections:
+ - \ref Qmitk3mApplicationUserManualOverview
+ - \ref Qmitk3mApplicationUserManualUserInterface
+ - \ref Qmitk3mApplicationUserManualPerspectives
+ \isHtml- \ref Qmitk3mApplicationUserManualPerspectivesList
+ \isHtmlend
+
+\section Qmitk3mApplicationUserManualOverview About MITK and MITK 3M3
+
+\image html Welcome.png "The MITK 3M3 Welcome screen"
+
+MITK is an open-source framework that was originally developed as a common framework for Ph.D. students in the Division of Medical and Biological Informatics (MBI) at the German Cancer Research Center. MITK aims at supporting the development of leading-edge medical imaging software with a high degree of interaction.
+
+MITK re-uses virtually anything from VTK and ITK. Thus, it is not at all a competitor to VTK or ITK, but an extension, which tries to ease the combination of both and to add features not supported by VTK or ITK.
+
+Research institutes, medical professionals and companies alike can use MITK as a basic framework for their research and even commercial (thorough code research needed) software due to the BSD-like software license.
+
+Research institutes will profit from the high level of integration of ITK and VTK enhanced with data management, advanced visualization and interaction functionality in a single framework that is supported by a wide variety of researchers and developers. You will not have to reinvent the wheel over and over and can concentrate on your work.
+
+Medical Professionals will profit from MITK and the MITK 3M3 application by using its basic functionalities for research projects. But nonetheless they will be better off, unless they are programmers themselves, to cooperate with a research institute developing with MITK to get the functionalitiy they need. MITK and the presented MITK 3M3 application are not certified medical products and may be used in a research setting only. They must not be used in patient care.
+
+MITK 3M3 is a demonstration of the capabilites of the MITK framework and has been created in a joint effort by the Division of Medical and Biological Informatics (MBI) at the German Cancer Research Center and mint medical.
+
+\section Qmitk3mApplicationUserManualUserInterface The User Interface
+
+The layout of the MITK 3M3 application is designed to give a clear distinction between the different work areas. The following figure gives an overview of the main sections of the user interface.
+
+\image html GUI_Commented.png "The MITK 3M3 User Interface"
+
+The datamanager and the \ref Qmitk3mApplicationUserManualPerspectives have their own help sections. This document explains the use of:
+ - The \ref Qmitk3mApplicationUserManualMultiWidget
+ - The \ref Qmitk3mApplicationUserManualMenu
+ - The \ref Qmitk3mApplicationUserManualLevelWindow
+ - The \ref Qmitk3mApplicationUserManualMemoryUsage
+
+\section Qmitk3mApplicationUserManualMultiWidget Four Window View
+
+\subsection Qmitk3mApplicationUserManualMultiWidgetOverview Overview
+
+The four window view is the heart of the MITK 3M3 image viewing. The standard layout is three 2D windows and one 3D window, with the transversal window in the top left quarter, the sagittal window in the top right quarter, the coronal window in the lower left quarter and the 3D window in the lower right quarter. The different planes form a crosshair that can be seen in the 3D window.
+
+Once you select a point within the picture informations about it are displayed at the bottom of the screen.
+
+\subsection Qmitk3mApplicationUserManualMultiWidgetNavigation Navigation
+
+Left click in any of the 2D windows centers the crosshair on that point. Pressing the right mouse button and moving the mouse zooms in and out. By scrolling with the mouse wheel you can navigate through the slices of the active window and pressing the mouse wheel while moving the mouse moves the image section.
+
+In the 3D window you can rotate the object by pressing the left mouse button and moving the mouse, zoom either with the right mouse button as in 2D or with the mouse wheel, and pan the object by moving the mouse while the mouse wheel is pressed. Placing the cursor within the 3D window and holding the "F" key allows free flight into the 3D view.
+
+\subsection Qmitk3mApplicationUserManualMultiWidgetCustomizingViews Customizing
+
+By moving the cursor to the upper right corner of any window you can activate the window menu. It consists of three buttons.
+
+\image html Crosshair_Modes.png "Crosshair"
+
+The crosshair button allows you toggle the crosshair, reset the view and change the behaviour of the planes.
+
+Activating either of the rotation modes allows you to rotate the planes visible in a 2D window by moving the mouse cursor close to them and click and dragging once it changes to indicate that rotation can be done.
+
+The swivel mode is recommended only for advanced users as the planes can be moved freely by clicking and dragging anywhere within a 2D window.
+
+
+The middle button expands the corresponding window to fullscreen within the four window view.
+
+\image html Views_Choices.png "Layout Choices"
+
+The right button allows you to choose between many different layouts of the four window view to use the one most suited to your task.
+
+\section Qmitk3mApplicationUserManualMenu Menu
+
+\subsection Qmitk3mApplicationUserManualFile File
+This dialog allows you to save, load and clear entire projects, this includes any nodes in the data manager.
+
+\subsection Qmitk3mApplicationUserManualEdit Edit
+This dialog supports undo and redo operations as well as the image navigator, which gives you sliders to navigate through the data quickly.
+
+\subsection Qmitk3mApplicationUserManualWindow Window
+
+This dialog allows you to open a new window, change between perspectives and reset your current one to default settings.
+
+\image html Open_Perspective.png "Open Perspective"
+
+If you want to use an operation of a certain perspective within another perspective the "Show View" menu allows to select a specific function that is opened and can be moved within the working areas according to your wishes. Be aware that not every function works with every perspective in a meaningful way.
+
+\image html Show_Views.png "Show View"
+
+The Preferences dialog allows you to adjust and save your custom settings.
+
+\image html Window_Dropdown.png "Preferences"
+
+\subsection Qmitk3mApplicationUserManualHelp Help
+This dialog contains this help, the welcome screen and information about MITK 3M3.
+
+\section Qmitk3mApplicationUserManualLevelWindow Levelwindow
+
+Once an image is loaded the levelwindow appears to the right hand side of the four window view. With this tool you can adjust the range of grey values displayed and the gradient between them. Moving the lower boundary up results in any pixels having a value lower than that boundary to be displayed as black. Lowering the upper boundary causes all pixels having a value higher than it to be displayed as white.
+
+The pixels with a value between the lower and upper boundary are displayed in different shades of grey. This way a smaller levelwindow results in higher contrasts while cutting of the information outside its range whereas a larger levelwindow displays more information at the cost of contrast and detail.
+
+You can pick the levelwindow with the mouse to move it up and down, while moving the mouse cursor to the left or right to change its size. Picking one of the boundaries with a left click allows you to change the size symmetrically. Holding CTRL and clicking a boundary adjusts only that value.
+
+\section Qmitk3mApplicationUserManualMemoryUsage System Load Indicator
+
+The are in the lower right hand corner of the screen gives information about the memory currently required by the MITK 3M3 application. Keep in mind that image processing is a highly memory intensive task and monitor the indicator to avoid your system freezing while constantly swapping to the hard drive.
+
+\section Qmitk3mApplicationUserManualPerspectives Perspectives
+
+ The different tasks that arise in medical imaging need very different approaches. To acknowledge this circumstance MITK supplies a framework that can be build uppon by very different solutions to those tasks. These solutions are called perspectives, each of them works independently of others although they might be used in sequence to achieve the solution of more difficult problems.
+
+The welcome screen gives an overview and a short description of the perpectives currently supported in MITK 3M3. More information is supplied by their respective help entries.
+
+It is also possible to switch between the perspectives either using the perspective switcher (as seen in \ref Qmitk3mApplicationUserManualUserInterface) or the "Window"->"Open Perspective" dialog.
+
+
+See \ref Qmitk3mApplicationUserManualMenu for more information about switching perspectives.
+\isHtml
+\section Qmitk3mApplicationUserManualPerspectivesList List of perspectives in MITK 3M3
+
+MITK 3M3 features the following perspectives:
+
+ - \subpage org.basicimageprocessing
+ - \subpage org.datamanager
+ - \subpage org.dicom
+ - \subpage org.diffusion
+ - \subpage org.measure
+ - The Registration perspective with
+ - \subpage org.deform.registration
+ - \subpage org.pointbased.reg
+ - \subpage org.rigid.regis
+ - \subpage org.segment
+ - \subpage org_vesseltreeseg
+ - \subpage org.volvis
+\isHtmlend
+*/
diff --git a/Modules/Bundles/org.mitk.gui.qt.diffusionimagingapp/documentation/UserManual/Show_Views.png b/Modules/Bundles/org.mitk.gui.qt.diffusionimagingapp/documentation/UserManual/Show_Views.png
new file mode 100644
index 0000000000..722ed00d39
Binary files /dev/null and b/Modules/Bundles/org.mitk.gui.qt.diffusionimagingapp/documentation/UserManual/Show_Views.png differ
diff --git a/Modules/Bundles/org.mitk.gui.qt.diffusionimagingapp/documentation/UserManual/Top_Right_Corner_Menu.png b/Modules/Bundles/org.mitk.gui.qt.diffusionimagingapp/documentation/UserManual/Top_Right_Corner_Menu.png
new file mode 100644
index 0000000000..865400cc98
Binary files /dev/null and b/Modules/Bundles/org.mitk.gui.qt.diffusionimagingapp/documentation/UserManual/Top_Right_Corner_Menu.png differ
diff --git a/Modules/Bundles/org.mitk.gui.qt.diffusionimagingapp/documentation/UserManual/Views_Choices.png b/Modules/Bundles/org.mitk.gui.qt.diffusionimagingapp/documentation/UserManual/Views_Choices.png
new file mode 100644
index 0000000000..26c6c332d8
Binary files /dev/null and b/Modules/Bundles/org.mitk.gui.qt.diffusionimagingapp/documentation/UserManual/Views_Choices.png differ
diff --git a/Modules/Bundles/org.mitk.gui.qt.diffusionimagingapp/documentation/UserManual/Welcome.png b/Modules/Bundles/org.mitk.gui.qt.diffusionimagingapp/documentation/UserManual/Welcome.png
new file mode 100644
index 0000000000..5d457e766c
Binary files /dev/null and b/Modules/Bundles/org.mitk.gui.qt.diffusionimagingapp/documentation/UserManual/Welcome.png differ
diff --git a/Modules/Bundles/org.mitk.gui.qt.diffusionimagingapp/documentation/UserManual/Window_Dropdown.png b/Modules/Bundles/org.mitk.gui.qt.diffusionimagingapp/documentation/UserManual/Window_Dropdown.png
new file mode 100644
index 0000000000..b3af19556e
Binary files /dev/null and b/Modules/Bundles/org.mitk.gui.qt.diffusionimagingapp/documentation/UserManual/Window_Dropdown.png differ
diff --git a/Modules/Bundles/org.mitk.gui.qt.diffusionimagingapp/documentation/UserManual/theme_black.png b/Modules/Bundles/org.mitk.gui.qt.diffusionimagingapp/documentation/UserManual/theme_black.png
new file mode 100644
index 0000000000..a6fefe17d6
Binary files /dev/null and b/Modules/Bundles/org.mitk.gui.qt.diffusionimagingapp/documentation/UserManual/theme_black.png differ
diff --git a/Modules/Bundles/org.mitk.gui.qt.diffusionimagingapp/documentation/UserManual/theme_default.png b/Modules/Bundles/org.mitk.gui.qt.diffusionimagingapp/documentation/UserManual/theme_default.png
new file mode 100644
index 0000000000..4848e4f3c9
Binary files /dev/null and b/Modules/Bundles/org.mitk.gui.qt.diffusionimagingapp/documentation/UserManual/theme_default.png differ
diff --git a/Modules/Bundles/org.mitk.gui.qt.diffusionimagingapp/documentation/about-logo.png b/Modules/Bundles/org.mitk.gui.qt.diffusionimagingapp/documentation/about-logo.png
new file mode 100644
index 0000000000..bee986bb1c
Binary files /dev/null and b/Modules/Bundles/org.mitk.gui.qt.diffusionimagingapp/documentation/about-logo.png differ
diff --git a/Modules/Bundles/org.mitk.gui.qt.diffusionimagingapp/documentation/assistant-icon.png b/Modules/Bundles/org.mitk.gui.qt.diffusionimagingapp/documentation/assistant-icon.png
new file mode 100644
index 0000000000..169d1d439b
Binary files /dev/null and b/Modules/Bundles/org.mitk.gui.qt.diffusionimagingapp/documentation/assistant-icon.png differ
diff --git a/Modules/Bundles/org.mitk.gui.qt.diffusionimagingapp/documentation/doxygen/modules.dox b/Modules/Bundles/org.mitk.gui.qt.diffusionimagingapp/documentation/doxygen/modules.dox
new file mode 100644
index 0000000000..1c0369f27b
--- /dev/null
+++ b/Modules/Bundles/org.mitk.gui.qt.diffusionimagingapp/documentation/doxygen/modules.dox
@@ -0,0 +1,16 @@
+/**
+ \defgroup org_mitk_diffusionimagingapp org.mitk.diffusionimagingapp Plugin
+ \ingroup MITKPlugins
+
+ \brief Describe your plugin here.
+
+*/
+
+/**
+ \defgroup org_mitk_diffusionimagingapp_internal Internal
+ \ingroup org_mitk_diffusionimagingapp
+
+ \brief This subcategory includes the internal classes of the org.mitk.diffusionimagingapp 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/Modules/Bundles/org.mitk.gui.qt.extapplication/files.cmake b/Modules/Bundles/org.mitk.gui.qt.diffusionimagingapp/files.cmake
similarity index 52%
copy from Modules/Bundles/org.mitk.gui.qt.extapplication/files.cmake
copy to Modules/Bundles/org.mitk.gui.qt.diffusionimagingapp/files.cmake
index 69f823e5e5..9a69bc2ada 100644
--- a/Modules/Bundles/org.mitk.gui.qt.extapplication/files.cmake
+++ b/Modules/Bundles/org.mitk.gui.qt.diffusionimagingapp/files.cmake
@@ -1,52 +1,62 @@
SET(SRC_CPP_FILES
- QmitkExtApplication.cpp
- QmitkExtAppWorkbenchAdvisor.cpp
+ QmitkDiffusionImagingAppApplication.cpp
+ QmitkDiffusionImagingAppWorkbenchAdvisor.cpp
)
SET(INTERNAL_CPP_FILES
- QmitkExtApplicationPlugin.cpp
- QmitkExtDefaultPerspective.cpp
+ QmitkDiffusionImagingAppApplicationPlugin.cpp
+ QmitkDiffusionImagingAppIntroPart.cpp
+ QmitkDiffusionImagingAppPerspective.cpp
+ QmitkWelcomePerspective.cpp
+)
+
+SET(UI_FILES
+ src/internal/QmitkWelcomeScreenViewControls.ui
)
SET(MOC_H_FILES
- src/QmitkExtApplication.h
- src/internal/QmitkExtApplicationPlugin.h
- src/internal/QmitkExtDefaultPerspective.h
+ src/internal/QmitkDiffusionImagingAppIntroPart.h
+ src/internal/QmitkDiffusionImagingAppApplicationPlugin.h
+ src/QmitkDiffusionImagingAppApplication.h
+ src/internal/QmitkDiffusionImagingAppPerspective.h
+ src/internal/QmitkWelcomePerspective.h
)
SET(CACHED_RESOURCE_FILES
# 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
plugin.xml
- resources/icon_research.xpm
+ resources/mintLogo.png
)
SET(QRC_FILES
# uncomment the following line if you want to use Qt resources
- resources/QmitkExtApplication.qrc
+ resources/welcome/QmitkWelcomeScreenView.qrc
+ resources/org_mitk_gui_qt_diffusionimagingapp.qrc
)
-SET(CPP_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})
+
#----------- Qt Help Collection Project -------------#
IF (BLUEBERRY_USE_QT_HELP)
- SET(_plugin_qhcp_input "${CMAKE_CURRENT_SOURCE_DIR}/documentation/MitkExtQtHelpCollectionProject.qhcp")
- SET(_plugin_qhcp_output "${CMAKE_CURRENT_BINARY_DIR}/MitkExtQtHelpCollection_${MITK_WC_REVISION_HASH}.qhc")
+ SET(_plugin_qhcp_input "${CMAKE_CURRENT_SOURCE_DIR}/documentation/MitkDiffusionImagingAppQtHelpCollectionProject.qhcp")
+ SET(_plugin_qhcp_output "${PLUGIN_OUTPUT_DIR}/resources/MitkDiffusionImagingAppQtHelpCollection_${MBI_WC_REVISION_HASH}.qhc")
ADD_CUSTOM_COMMAND(OUTPUT ${_plugin_qhcp_output}
COMMAND ${QT_COLLECTIONGENERATOR_EXECUTABLE} ${_plugin_qhcp_input} -o ${_plugin_qhcp_output}
DEPENDS ${_plugin_qhcp_input}
)
-
- LIST(APPEND CACHED_RESOURCE_FILES ${_plugin_qhcp_output})
+
+ SET(FILE_DEPENDENCIES ${_plugin_qhcp_output})
ENDIF()
diff --git a/Modules/Bundles/org.mitk.gui.qt.diffusionimagingapp/manifest_headers.cmake b/Modules/Bundles/org.mitk.gui.qt.diffusionimagingapp/manifest_headers.cmake
new file mode 100644
index 0000000000..3a70a59d77
--- /dev/null
+++ b/Modules/Bundles/org.mitk.gui.qt.diffusionimagingapp/manifest_headers.cmake
@@ -0,0 +1,8 @@
+set(Plugin-Name "Diffusion Imaging Application Bundle")
+set(Plugin-Version "1.0")
+set(Plugin-Vendor "DKFZ, Medical and Biological Informatics")
+set(Plugin-ContactAddress "http://www.mitk.org")
+set(Require-Plugin org.mitk.gui.qt.ext)
+set(Plugin-Activator QmitkDiffusionImagingAppApplicationPlugin)
+
+
diff --git a/Modules/Bundles/org.mitk.gui.qt.diffusionimagingapp/plugin.xml b/Modules/Bundles/org.mitk.gui.qt.diffusionimagingapp/plugin.xml
new file mode 100644
index 0000000000..82eb16711a
--- /dev/null
+++ b/Modules/Bundles/org.mitk.gui.qt.diffusionimagingapp/plugin.xml
@@ -0,0 +1,25 @@
+<?xml version="1.0" encoding="UTF-8"?>
+<?BlueBerry version="0.1"?>
+<plugin>
+ <extension point="org.blueberry.osgi.applications">
+ <application id="org.mitk.qt.diffusionimagingapp">
+ <run class="QmitkDiffusionImagingAppApplication"/>
+ </application>
+ </extension>
+
+ <extension point="org.blueberry.ui.intro">
+ <intro id="org.mitk.qt.diffusionimagingappintro"
+ class="QmitkDiffusionImagingAppIntroPart"
+ role="editor"/>
+ <introProductBinding
+ productId=""
+ introId="org.mitk.qt.diffusionimagingappintro"/>
+ </extension>
+
+ <extension point="org.blueberry.ui.perspectives">
+ <perspective id="org.mitk.diffusionimagingapp.perspectives.diffusionimagingapp" name="Diffusion Imaging" class="QmitkDiffusionImagingAppPerspective" icon="resources/diffusionimaging.png"/>
+ <perspective id="org.mitk.diffusionimagingapp.perspectives.welcome" name="Welcome" class="QmitkWelcomePerspective" icon="resources/icon_home.png"/>
+ </extension>
+
+</plugin>
+
diff --git a/Modules/Bundles/org.mitk.gui.qt.diffusionimagingapp/resources/ImageProcessing_48.png b/Modules/Bundles/org.mitk.gui.qt.diffusionimagingapp/resources/ImageProcessing_48.png
new file mode 100644
index 0000000000..27dc941ac4
Binary files /dev/null and b/Modules/Bundles/org.mitk.gui.qt.diffusionimagingapp/resources/ImageProcessing_48.png differ
diff --git a/Modules/Bundles/org.mitk.gui.qt.diffusionimagingapp/resources/Measurement_48.png b/Modules/Bundles/org.mitk.gui.qt.diffusionimagingapp/resources/Measurement_48.png
new file mode 100644
index 0000000000..b986ef5a84
Binary files /dev/null and b/Modules/Bundles/org.mitk.gui.qt.diffusionimagingapp/resources/Measurement_48.png differ
diff --git a/Modules/Bundles/org.mitk.gui.qt.diffusionimagingapp/resources/RigidRegistration.xpm b/Modules/Bundles/org.mitk.gui.qt.diffusionimagingapp/resources/RigidRegistration.xpm
new file mode 100644
index 0000000000..51a5f9c4bb
--- /dev/null
+++ b/Modules/Bundles/org.mitk.gui.qt.diffusionimagingapp/resources/RigidRegistration.xpm
@@ -0,0 +1,231 @@
+/* XPM */
+static char *RigidRegistration___[] = {
+/* columns rows colors chars-per-pixel */
+"48 48 177 2",
+" c #6F5F67",
+". c #735C62",
+"X c #5B6B74",
+"o c #577076",
+"O c #587177",
+"+ c #5C747B",
+"@ c #5D797F",
+"# c #796167",
+"$ c #71636B",
+"% c #7F656B",
+"& c #696872",
+"* c #63747C",
+"= c #9B4E61",
+"- c #8A5662",
+"; c #A84D63",
+": c #A55367",
+"> c #AA5167",
+", c #A55569",
+"< c #AB5368",
+"1 c #A45A6C",
+"2 c #AA5A6D",
+"3 c #AC5E71",
+"4 c #81656C",
+"5 c #8F6F77",
+"6 c #906D76",
+"7 c #8F7078",
+"8 c #94767D",
+"9 c #9B727C",
+"0 c #AE6375",
+"q c #B3687A",
+"w c #547B85",
+"e c #5E7B82",
+"r c #5E7D8C",
+"t c #657981",
+"y c #6C7F87",
+"u c #6C7F88",
+"i c #7B7486",
+"p c #707388",
+"a c #887A83",
+"s c #9E7F87",
+"d c #3E8B9E",
+"f c #3B92A7",
+"g c #3696AD",
+"h c #3F98AE",
+"j c #5E8088",
+"k c #548797",
+"l c #558698",
+"z c #598B9C",
+"x c #60858E",
+"c c #6E848B",
+"v c #73868E",
+"b c #7A828D",
+"n c #6C8391",
+"m c #6A8F97",
+"M c #7D8792",
+"N c #758C94",
+"B c #7B8D95",
+"V c #748F9B",
+"C c #7A8E9A",
+"Z c #6D919A",
+"A c #7A9097",
+"S c #72939B",
+"D c #7C949B",
+"F c #7E989E",
+"G c #548FA3",
+"H c #4399AE",
+"J c #4C9AAD",
+"K c #5293A5",
+"L c #5C95A5",
+"P c #5597A9",
+"I c #5499AA",
+"U c #5B9BAB",
+"Y c #459EB3",
+"T c #5A9EB0",
+"R c #6597A2",
+"E c #6994A5",
+"W c #6D9AA5",
+"Q c #659CAB",
+"! c #6C9CAB",
+"~ c #7296A5",
+"^ c #7499A3",
+"/ c #7A9CA5",
+"( c #779BA9",
+") c #45A0B7",
+"_ c #4BA1B6",
+"` c #47A2B8",
+"' c #4AA3B9",
+"] c #4FA8BE",
+"[ c #56A1B4",
+"{ c #5CA1B3",
+"} c #52A6BA",
+"| c #5CA6B8",
+" . c #54A8BC",
+".. c #5CA9BC",
+"X. c #68A0AF",
+"o. c #7DA1A9",
+"O. c #63A1B3",
+"+. c #6EA7B7",
+"@. c #62A7B9",
+"#. c #63ABBD",
+"$. c #6BADBE",
+"%. c #74A2B0",
+"&. c #78A7B3",
+"*. c #70AEBE",
+"=. c #5AAEC2",
+"-. c #67B5C8",
+";. c #74B1C0",
+":. c #7EB5C2",
+">. c #7FBCCB",
+",. c #9F888D",
+"<. c #828C96",
+"1. c #928A92",
+"2. c #9C8990",
+"3. c #82959D",
+"4. c #8A959F",
+"5. c #81989F",
+"6. c #A2848B",
+"7. c #A2888E",
+"8. c #AE8E96",
+"9. c #A99297",
+"0. c #AD9399",
+"q. c #B2999F",
+"w. c #8497A0",
+"e. c #8E96A1",
+"r. c #829CA2",
+"t. c #8A9DA5",
+"y. c #8C9FA8",
+"u. c #9097A2",
+"i. c #9B9EA8",
+"p. c #B59EA4",
+"a. c #8AA0A7",
+"s. c #83A4AC",
+"d. c #8DA2AA",
+"f. c #91A4AC",
+"g. c #98A0AA",
+"h. c #91A8AF",
+"j. c #80A7B6",
+"k. c #87A9B1",
+"l. c #8CAAB2",
+"z. c #94ACB3",
+"x. c #9AACB4",
+"c. c #87B2BD",
+"v. c #95B1B7",
+"b. c #98B1B7",
+"n. c #94B2B9",
+"m. c #98B2B8",
+"M. c #9FB8BF",
+"N. c #A0B5BC",
+"B. c #A1B9BF",
+"V. c #BCB1B8",
+"C. c #CAB3B9",
+"Z. c #8FBAC5",
+"A. c #93BCC7",
+"S. c #9EBAC1",
+"D. c #A3BDC3",
+"F. c #A8BEC5",
+"G. c #9DC0C9",
+"H. c #83C2D1",
+"J. c #A7C0C6",
+"K. c #A8C1C7",
+"L. c #A4C3CA",
+"P. c #AEC7CD",
+"I. c #A5CFDB",
+"U. c #B6CDD4",
+"Y. c #B9D1D7",
+"T. c #BAD5DB",
+"R. c #BFD9DF",
+"E. c #B0D8E2",
+"W. c #BEDFE7",
+"Q. c #C2C1C9",
+"!. c #DBC4CA",
+"~. c #DDC8CE",
+"^. c #E0C9CF",
+"/. c #C3DDE3",
+"(. c #C7E0E7",
+"). c #CEE7ED",
+"_. c None",
+/* pixels */
+"3 3 3 3 3 3 3 3 3 ; : = = = = = = = = < 3 2 2 2 2 2 2 2 ; , , , , , , , , : _._._._._._._._._._.",
+"0 C.C.C.C.C.C.C.C.s . . . . . . . . 4 6.p.p.p.p.p.p.p.p.8 7.,.7.,.,.,.,.,.1 _._._._._._._._._._.",
+"0 C.C.C.C.C.C.C.C.s # . . . . . . . 4 6.p.p.p.p.p.p.p.p.8 ,.,.,.,.,.,.,.,.1 _._._._._._._._._._.",
+"0 C.C.C.C.C.C.C.C.s # . . . . . . . % 6.p.p.p.p.p.p.p.p.8 ,.,.,.,.,.,.,.,.1 _._._._._._._._._._.",
+"0 C.C.C.C.C.C.C.C.s . . . . . . . . % s p.p.p.p.p.p.p.p.8 ,.,.,.,.,.,.,.,.1 _._._._._._._._._._.",
+"0 C.C.C.C.C.C.C.C.,.# . . . . . . . % 6.p.p.p.p.p.p.p.p.8 ,.,.,.,.,.,.,.D 1 _._._._._._._._._._.",
+"0 C.C.C.C.C.C.C.C.s # . . . . . . . % s p.p.p.p.p.p.p.q.8 ,.,.,.7.1.L U I i _._._._._._._._._._.",
+"0 C.C.C.C.C.C.C.C.s # . . . . . . . % ,.p.p.p.p.p.p.p.p.8 ,.,.S P U F r.r.K _._._._._._._._._._.",
+"0 C.C.C.C.C.C.C.C.s . . . . . . . . % 6.p.p.p.p.p.p.p.p.a L P W o.5.5.r.r.U _._._._._._._._._._.",
+"< s s s s s s s s 9 6 8 5 5 5 7 5 5 5 6 7 5 5 5 7 7 n I K ^ r.r.F a.a.F a.F H _._._._._._._._._.",
+"q !.!.!.!.!.!.!.!.6.9.p.q.p.p.p.q.p.6.4 # . . $ k I &.m.A 3.r.r.a.F r.r.F r.J _._._._._._._._._.",
+"q ^.^.^.^.^.^.^.^.6.9.p.p.p.p.p.p.p.7.4 . * K T v.b.b.b.h.t.r.r.r.r.r.r./ r.o.f _._._._._._._._.",
+"q ^.^.^.^.^.^.^.^.6.0.p.p.p.p.p.p.p.,.k K %.m.m.m.m.b.m.b.a.F r.r.r.r.r.r.r.r.H _._._._._._._._.",
+"q ^.^.^.^.^.^.^.^.6.q.p.p.p.p.p.g.O.{ S A m.m.m.m.m.m.m.b.d.w.r.r.r.r.r.r.r.r.R _._._._._._._._.",
+"q ^.^.^.^.^.^.^.^.7.8.p.p.p.%.{ X.r.r.r.v z.m.m.m.b.m.m.b.b.t.5.r.r.r.5./ B Z ^ ` _._._._._._._.",
+"q ^.^.^.^.^.^.^.^.7.8.i.O.O.( r.r.r.r.r.N F b.m.m.m.m.m.b.b.d.r.r.r.5.5.t.4.v.P.;._._._._._._._.",
+"q ^.^.^.^.^.~.~.~.E T X.a.5.a.F r.r.r.r.5.v b.b.m.b.m.m.m.b.v.5.3.5.d.h.D.P.P.P.P._ _._._._._._.",
+"q ^.^.^.^.^.Q.*.$.A.P.r.F / F a.r.r.r.r.r.N a.b.m.m.m.m.m.z.d.f.f.x.P.P.P.P.P.P.P.#._._._._._._.",
+"< 8.0.0.^ [ *.P.P.P.P.a.5.a.r.r./ r.r.r.r.5.B b.m.m.b.a.3.3.5.5.5.P.P.P.P.P.P.P.P.L.' _._._._._.",
+"0 q.( @.Z.P.P.P.P.P.P.J.D F r.r.r.r.r.r.r.r.w.h.z.r.w.r.5.r.r.r.5.h.P.P.P.P.P.P.P.P..._._._._._.",
+"0 C.x.:.P.P.P.P.P.P.P.P.t.5.r.r.r.r.r.r.r.r.t.d.d.d.r.r.r.r.r.r.a.5.P.P.P.P.P.P.P.P.Z._._._._._.",
+"0 C.C.@.P.P.P.P.P.P.P.P.m.4.r.r.r.r.r.5.a.d.d.d.r.r.r.r.r.r.r.r.5.5.m.P.P.P.P.P.P.P.P.} _._._._.",
+"0 C.C.j.G.P.P.P.P.P.P.P.P.5.5.r.r.5.3.3.d.h.b.a.a.r.r.r.r.r.r.r.F 5.a.P.P.P.P.P.P.P.l.{ _._._._.",
+"0 C.C.C.#.P.P.P.P.P.P.P.P.h.5.5.3.3.r.v.b.b.m.h.d.r.r.r.r.r.r.r.a.5.3.L.P.P.P.M.s.^ Z S H _._._.",
+"0 C.C.C.+.L.P.P.P.P.P.P.m.t.<.3.d.m.n.m.m.m.b.m.d.r.r.r.r.r.r.r.r.r.5.d.P.h.o.Z S F r.r.I _._._.",
+"0 C.C.C.C.$.P.P.P.P.f.3.t.m.h.5.m.m.m.b.m.m.m.m.d.d.r.r.r.r.r.r.r.r.r.3.3.b D 5.r.r.r.r./ Y _._.",
+"0 C.C.C.C.@.P.D.h.3.d.P.).)./.<.v.m.m.m.m.b.m.m.b.d.w.r.r.r.r.r.5.4.5.3.A r.r.r.r.r.r.r.r.J _._.",
+"2 0.0.0.0.e.Q t.m.R.).).).).).f./ m.m.m.m.m.m.m.b.r.t.5.r.r.5.D 3.f.P.m.M r.r.r./ r.r.r.r.^ H _.",
+"= 4 4 4 4 4 T ).).).).).).).).U.3.b.m.m.m.m.m.b.b.z.v 5.D 5.d.M.P.P.P.P.5.D r.r.r.r.r.r.r.r.H _.",
+"= . . . . . r I.).).).).).).).).h.d.m.m.b.m.m.m.z.N X * d.P.P.P.P.P.P.P.b.M r.r.r.r.r.r.r.r.R _.",
+"= . . . . . . | ).).).).).).).).K.d.m.m.m.m.r.c + t N t P.P.P.P.P.P.P.P.P.<.F r.r.r.r.r.r.r.r.H ",
+"= . . . . . . z (.).).).).).).).).f.h.z.A * * c 5.r.r.* f.P.P.P.P.P.P.P.P.e.S r.r.r.r.r.F S Z Y ",
+"= . . . . . $.).).).).).).).).m.3.y * B r.r.r.r.r.N A P.P.P.P.P.P.P.P.K.Z a./ 5.S m S k.B...",
+"= . . . . . . P ).).).).).(.F.x.f.3.D r.r.r.r.r.r.F a.v M.P.P.P.P.P.P.P.P.s.N S Z o.v.P.P.P...",
+"= . . . . . . . & >.).).Y.N.h.h.m.P.d.N r.r.r.r.F a.o.5.S f.P.P.P.P.P.P.P.x./ _.s.M.P.P.P.P.P...",
+"= . . . . . . . . T F.x.y.h.F.P.P.P.N.c r.r.r.r.o.F a.5.5.4.J.P.P.P.K.h.d.4.J.k.b.P.P.P.P.P.P...",
+"= - - - - - - - - p ~ x.P.P.P.P.P.P.P.A N r.r.r.5.r.r.r.r.A d.P.m.g.4.z.U.).).P.o.P.P.P.P.P.P.#.",
+"_._._._._._._._._._.[ P.P.P.P.P.P.P.P.m.N r.r.r.r.r.r.F r.F S D a.N.(.).).).).).o.B.P.P.P.P.P...",
+"_._._._._._._._._._.Y G.P.P.P.P.P.P.P.P.S F r.r.r.r.r.D S Z ^ l.).).).).).).).).S.s.P.P.P.P.P...",
+"_._._._._._._._._._._.#.P.P.P.P.P.P.P.P.l.Z r.r.5.S Z o.l.K.m.o.).).).).).).).).(./ P.P.P.P.P...",
+"_._._._._._._._._._._.` K.P.P.P.P.P.P.P.P.Z A Z Z s.M.P.P.P.P./ P.).).).).).).).).n.h.P.P.P.L.' ",
+"_._._._._._._._._._._._.;.P.P.P.P.P.P.P.l.W ^ k.K.P.P.P.P.P.P.l.l.).).).).).).).).T.^ P.Z...` _.",
+"_._._._._._._._._._._._.` P.P.P.P.S.s.m j @ S P.P.P.P.P.P.P.P.P.^ T.).).).).).).).)..._ _._._._.",
+"_._._._._._._._._._._._._.:.P.n.o.x e + o o j v.P.P.P.P.P.P.P.P.k.n.).).).).).E.-.] _._._._._._.",
+"_._._._._._._._._._._._._.` Z j @ o o o o o + / P.P.P.P.P.P.P.P.J.^ /.).).H.=._ _._._._._._._._.",
+"_._._._._._._._._._._._._.g w o o o o o o o o x M.P.P.P.P.P.P.P.P.s.c.-.] _._._._._._._._._._._.",
+"_._._._._._._._._._._._._._.d o o o o o o o O e o.P.P.P.P.P.P.P.;.[ _._._._._._._._._._._._._._.",
+"_._._._._._._._._._._._._._.f d d d d d d d d d h ............' _._._._._._._._._._._._._._._._."
+};
diff --git a/Modules/Bundles/org.mitk.gui.qt.diffusionimagingapp/resources/app-icon.png b/Modules/Bundles/org.mitk.gui.qt.diffusionimagingapp/resources/app-icon.png
new file mode 100644
index 0000000000..169d1d439b
Binary files /dev/null and b/Modules/Bundles/org.mitk.gui.qt.diffusionimagingapp/resources/app-icon.png differ
diff --git a/Modules/Bundles/org.mitk.gui.qt.diffusionimagingapp/resources/diffusionimaging.png b/Modules/Bundles/org.mitk.gui.qt.diffusionimagingapp/resources/diffusionimaging.png
new file mode 100644
index 0000000000..dd5215d698
Binary files /dev/null and b/Modules/Bundles/org.mitk.gui.qt.diffusionimagingapp/resources/diffusionimaging.png differ
diff --git a/Modules/Bundles/org.mitk.gui.qt.diffusionimagingapp/resources/icon_dicom.xpm b/Modules/Bundles/org.mitk.gui.qt.diffusionimagingapp/resources/icon_dicom.xpm
new file mode 100644
index 0000000000..d35e45238c
--- /dev/null
+++ b/Modules/Bundles/org.mitk.gui.qt.diffusionimagingapp/resources/icon_dicom.xpm
@@ -0,0 +1,71 @@
+/* XPM */
+static char *Dicom___[] = {
+/* columns rows colors chars-per-pixel */
+"48 48 17 1",
+" c #00AAD1",
+". c #00A9D2",
+"X c #00A8D3",
+"o c #00A9D3",
+"O c #00AAD2",
+"+ c #00ABD2",
+"@ c #00AAD3",
+"# c #00ABD3",
+"$ c #00ACD3",
+"% c #00A9D4",
+"& c #00A9D5",
+"* c #00AAD4",
+"= c #00ABD4",
+"- c #00AAD5",
+"; c #00ABD5",
+": c #00ACD4",
+"> c None",
+/* pixels */
+">>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>",
+">>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>",
+">>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>",
+">>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>",
+">>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>",
+">>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>",
+">>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>",
+">>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>",
+">>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>",
+">>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>",
+">>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>",
+">>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>",
+">>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>",
+">>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>",
+">>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>",
+">>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>",
+">>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>",
+">>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>",
+">>>>>>>>>>>>>>>>>>>>>>>>>>>>>*>>>>>>>>>>>>>>>>>>",
+">o@@@@*@>>>>@o>>>>>*Oo*#>>*@%O@o>>>>@@%>>>>>@@>>",
+">O@>>>@@@>>>@o>>o.@>>>>>>@O=>>*@#>>>Oo@>>>>+o@o>",
+">O@>>>>>#@>>@o>>+@>>>>>>>*->>>>>@o>>@@@>>>>@@@+>",
+">O@>>>>>%@>>@o>##>>>>>>>o@>>>>>>*%>>@@@.>>>@-@#>",
+">O@>>>>>o@>>@o>@@>>>>>>>=@>>>>>>+@>>O@**>>:@>@@>",
+">O@>>>>>@@>>@o>@@>>>>>>>o*>>>>>>#@>>OX>@>>@O>@@>",
+">O@>>>>>OO>>@o>@@>>>>>>>#@>>>>>>@O>>@+>@O>@@>o*>",
+">O@>>>>>==>>@o>+@>>>>>>>*.>>>>>>@@>>@@> O+@>>#@>",
+">O@>>>>*@>>>@o>>@%>>>>>>>O@>>>>#@->>@>>>***>>@*>",
+">O#@$=@@&>>>@o>>+@@O*=O>>=@.o #O@>>O@>>>@@>>>@@>",
+">O***@->>>>>#->>>>OO@oo>>>>@O+@@>>>;@>>>oO>>>@O>",
+">>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>",
+">>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>",
+">>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>",
+">>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>",
+">>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>",
+">>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>",
+">>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>",
+">>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>",
+">>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>",
+">>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>",
+">>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>",
+">>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>",
+">>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>",
+">>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>",
+">>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>",
+">>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>",
+">>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>",
+">>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>"
+};
diff --git a/Modules/Bundles/org.mitk.gui.qt.diffusionimagingapp/resources/icon_vesseltreesegmentation.png b/Modules/Bundles/org.mitk.gui.qt.diffusionimagingapp/resources/icon_vesseltreesegmentation.png
new file mode 100644
index 0000000000..825792fe64
Binary files /dev/null and b/Modules/Bundles/org.mitk.gui.qt.diffusionimagingapp/resources/icon_vesseltreesegmentation.png differ
diff --git a/Modules/Bundles/org.mitk.gui.qt.diffusionimagingapp/resources/mintLogo.png b/Modules/Bundles/org.mitk.gui.qt.diffusionimagingapp/resources/mintLogo.png
new file mode 100644
index 0000000000..377094bb86
Binary files /dev/null and b/Modules/Bundles/org.mitk.gui.qt.diffusionimagingapp/resources/mintLogo.png differ
diff --git a/Modules/Bundles/org.mitk.gui.qt.diffusionimagingapp/resources/org_mitk_gui_qt_diffusionimagingapp.qrc b/Modules/Bundles/org.mitk.gui.qt.diffusionimagingapp/resources/org_mitk_gui_qt_diffusionimagingapp.qrc
new file mode 100644
index 0000000000..086feb2a7e
--- /dev/null
+++ b/Modules/Bundles/org.mitk.gui.qt.diffusionimagingapp/resources/org_mitk_gui_qt_diffusionimagingapp.qrc
@@ -0,0 +1,6 @@
+<!DOCTYPE RCC><RCC version="1.0">
+ <qresource prefix="/org.mitk.gui.qt.diffusionimagingapp">
+ <file>app-icon.png</file>
+ <file>mintLogo.png</file>
+ </qresource>
+ </RCC>
diff --git a/Modules/Bundles/org.mitk.gui.qt.diffusionimagingapp/resources/segmentation.png b/Modules/Bundles/org.mitk.gui.qt.diffusionimagingapp/resources/segmentation.png
new file mode 100644
index 0000000000..0b6181225b
Binary files /dev/null and b/Modules/Bundles/org.mitk.gui.qt.diffusionimagingapp/resources/segmentation.png differ
diff --git a/Modules/Bundles/org.mitk.gui.qt.diffusionimagingapp/resources/volvis.png b/Modules/Bundles/org.mitk.gui.qt.diffusionimagingapp/resources/volvis.png
new file mode 100644
index 0000000000..37347e5a12
Binary files /dev/null and b/Modules/Bundles/org.mitk.gui.qt.diffusionimagingapp/resources/volvis.png differ
diff --git a/Modules/Bundles/org.mitk.gui.qt.diffusionimagingapp/resources/welcome/QmitkWelcomeScreenView.qrc b/Modules/Bundles/org.mitk.gui.qt.diffusionimagingapp/resources/welcome/QmitkWelcomeScreenView.qrc
new file mode 100644
index 0000000000..99f458fc02
--- /dev/null
+++ b/Modules/Bundles/org.mitk.gui.qt.diffusionimagingapp/resources/welcome/QmitkWelcomeScreenView.qrc
@@ -0,0 +1,34 @@
+<RCC>
+ <qresource prefix="/org.mitk.gui.qt.welcomescreen">
+ <file>style.css</file>
+ <file>function.js</file>
+ <file>pics/background.jpg</file>
+ <file>pics/popup_bttn_close.png</file>
+ <file>pics/dti.jpg</file>
+ <file>pics/dti_animated.gif</file>
+ <file>pics/experimental.png</file>
+ <file>pics/0aref_alltracts.png</file>
+ <file>pics/0aaref_alltracts.png</file>
+ <file>pics/0bref_colormap.gif</file>
+ <file>pics/0bref_colormap.png</file>
+ <file>pics/0cref_t1.gif</file>
+ <file>pics/0cref_t1.png</file>
+ <file>pics/01aCING.png</file>
+ <file>pics/01CING.png</file>
+ <file>pics/02aCORPUS.png</file>
+ <file>pics/02CORPUS.png</file>
+ <file>pics/03aCST.png</file>
+ <file>pics/03CST.png</file>
+ <file>pics/04aFORNIX.png</file>
+ <file>pics/04FORNIX.png</file>
+ <file>pics/05aILF+IFO+UNCUS.png</file>
+ <file>pics/05ILF+IFO+UNCUS.png</file>
+ <file>pics/06aSLF+SOFF+ARCUATE.png</file>
+ <file>pics/06SLF+SOFF+ARCUATE.png</file>
+ <file>pics/07aPEDUNCLES.png</file>
+ <file>pics/07PEDUNCLES.png</file>
+ <file>pics/button_mitka.png</file>
+ <file>pics/button_mitk.png</file>
+ <file>mitkdiffusionimagingappwelcomeview.html</file>
+ </qresource>
+</RCC>
diff --git a/Modules/Bundles/org.mitk.gui.qt.diffusionimagingapp/resources/welcome/function.js b/Modules/Bundles/org.mitk.gui.qt.diffusionimagingapp/resources/welcome/function.js
new file mode 100644
index 0000000000..944631badd
--- /dev/null
+++ b/Modules/Bundles/org.mitk.gui.qt.diffusionimagingapp/resources/welcome/function.js
@@ -0,0 +1,317 @@
+// If you want to create a new button you have to add some data (strings) to the following five arrays.
+// Make sure that you add your data at the same position in each array.
+// The buttons will be generated in order to the array's index. e.g. data at array's index '0' will generate the first button.
+
+// enter the name of your module here
+var moduleNames = new Array("Colormap",
+ "T1 Image",
+ "3D Background",
+ "Cingulum",
+ "Corpus Callosum",
+ "Corticospinal Tract",
+ "Fornix",
+ "ILF, IFO, Uncus",
+ "SLF, SOFF, Arcuate",
+ "ICP, MCP, SCP, ML",
+ "Download MITK");
+
+// add the MITK-link to your module
+var moduleLinks = new Array("mitk://mitk.perspectives/org.mitk.diffusionimagingapp.perspectives.diffusionimagingapp?dataset=./atlas-data/0bref_colormap.mitk",
+ "mitk://mitk.perspectives/org.mitk.diffusionimagingapp.perspectives.diffusionimagingapp?dataset=./atlas-data/0cref_t1.mitk",
+ "mitk://mitk.perspectives/org.mitk.diffusionimagingapp.perspectives.diffusionimagingapp?dataset=./atlas-data/0aref_alltracts.mitk",
+ "mitk://mitk.perspectives/org.mitk.diffusionimagingapp.perspectives.diffusionimagingapp?dataset=./atlas-data/01CING.mitk",
+ "mitk://mitk.perspectives/org.mitk.diffusionimagingapp.perspectives.diffusionimagingapp?dataset=./atlas-data/02CORPUS.mitk",
+ "mitk://mitk.perspectives/org.mitk.diffusionimagingapp.perspectives.diffusionimagingapp?dataset=./atlas-data/03CST.mitk",
+ "mitk://mitk.perspectives/org.mitk.diffusionimagingapp.perspectives.diffusionimagingapp?dataset=./atlas-data/04FORNIX.mitk",
+ "mitk://mitk.perspectives/org.mitk.diffusionimagingapp.perspectives.diffusionimagingapp?dataset=./atlas-data/05ILF+IFO+UNCUS.mitk",
+ "mitk://mitk.perspectives/org.mitk.diffusionimagingapp.perspectives.diffusionimagingapp?dataset=./atlas-data/06SLF+SOFF+ARCUATE.mitk",
+ "mitk://mitk.perspectives/org.mitk.diffusionimagingapp.perspectives.diffusionimagingapp?dataset=./atlas-data/07PEDUNCLES.mitk",
+ "http://www.mitk.org");
+
+// add the filename of your icon for the module. Place the picture in subdirectory "pics".
+// The picture's width should be 136 pixel; the height 123 pixel.
+var picFilenames = new Array("0bref_colormap.png",
+ "0cref_t1.png",
+ "0aref_alltracts.png",
+ "01CING.png",
+ "02CORPUS.png",
+ "03CST.png",
+ "04FORNIX.png",
+ "05ILF+IFO+UNCUS.png",
+ "06SLF+SOFF+ARCUATE.png",
+ "07PEDUNCLES.png",
+ "button_mitk.png");
+
+// if you want to create an animated icon, add the name of your animated gif (placed in subdirectory "pics"). Otherwise enter an empty string "".
+// The animation's width should be 136 pixel; the height 123 pixel.
+var aniFilenames = new Array("0bref_colormap.gif",
+ "0cref_t1.gif",
+ "0aaref_alltracts.png",
+ "01aCING.png",
+ "02aCORPUS.png",
+ "03aCST.png",
+ "04aFORNIX.png",
+ "05aILF+IFO+UNCUS.png",
+ "06aSLF+SOFF+ARCUATE.png",
+ "07aPEDUNCLES.png",
+ "button_mitka.png");
+
+// if your module is not stable, you can mark it as experimental.
+// just set true for experimental or false for stable.
+var experimental = new Array(false,
+ false,
+ false,
+ false,
+ false,
+ false,
+ false,
+ false,
+ false,
+ false,
+ false);
+
+// add the description for your module. The description is displayed in a PopUp-window.
+var moduleDescriptions = new Array("This colormap represents the original diffusion acquisition that was used as input for tractography.",
+ "This T1-weighted image was aquired during the same imaging session as the diffusion image. It is roughly aligned with the diffusion image and provides additional, complementary information.",
+ "This dataset contains all fibers that were found by the global tractography approach. It can serve as a background for better orientation in the 3D view.",
+ "This dataset contains the Cingulum fibers and most important regions of interest that were used to extract it.",
+ "This dataset contains the Corpus Callosum fibers and most important regions of interest that were used to extract it.",
+ "This dataset contains the Corticospinal Tract fibers and most important regions of interest that were used to extract it.",
+ "This dataset contains the Fornix fibers and most important regions of interest that were used to extract it.",
+ "This dataset contains the Inferior Longitudinal Fasciculus, Inferior Fronto-Occipital, and the Uncus fibers and most important regions of interest that were used to extract it.",
+ "This dataset contains the Superior Longitudinal Fasciculus, Superior OFF, and Arcuate fibers and most important regions of interest that were used to extract it.",
+ "This dataset is not in the same world coordinate system as the others and should not be opend in combination with any of the other datasets. It contains a 3D visualization of the cerebellum and the Inferior Cerebral Peduncles, Medial Cerebral Peduncle, Superior Cerebral Peduncles, and Medial Limnisci fibers and the and most important regions of interest that were used to extract it.",
+ "Download MITK");
+
+var bttns = new Array();
+
+var d = document, da = d.all;
+
+// holds id of current mouseover-HTML-element
+var currentTarget;
+
+// get the id of current mouseover-HTML-element
+d.onmouseover = function(o){
+ var e = da ? event.srcElement : o.target;
+ currentTarget = e.id;
+}
+
+
+// build-function called by onload-event in HTML-document
+function createButtons(){
+
+ for (i=0; i < moduleNames.length; i++){
+ bttns[i] = new Button(moduleNames[i],moduleLinks[i], picFilenames[i], aniFilenames[i],moduleDescriptions[i]);
+ bttns[i].createButton();
+ }
+
+ for (i=0; i < moduleNames.length; i++){
+
+ if(experimental[i]){
+ setExperimental(i);
+ }
+ }
+
+ createClearFloat();
+}
+
+// Class Button
+function Button(moduleName, moduleLink, picFilename, aniFilename, moduleDescr){
+
+ // Properties
+ this.bttnID = "bttn" + moduleName;
+ this.modName = moduleName;
+ this.modLink = moduleLink;
+ this.picPath = "pics/" + picFilename;
+ this.aniPath = "pics/" + aniFilename;
+ this.modDescr = moduleDescr;
+
+ // Methods
+ this.createButton = function(){
+
+ // get DIV-wrapper for Button and append it to HTML-document
+ bttnWrapper = this.createWrapper();
+ document.getElementById("bttnField").appendChild(bttnWrapper);
+
+ // get link-element for picture and append it to DIV-wrapper
+ bttnPicLink = this.createPicLink();
+ bttnWrapper.appendChild(bttnPicLink);
+
+ // set HTML attributes for button-element
+ bttn = document.createElement("img");
+ bttn.src = this.picPath;
+ bttn.id = this.bttnID;
+ bttn.className = "modBttn";
+ bttn.height = 123;
+ bttn.width = 136;
+ bttn.onmouseover = function(){startAni(this.id);};
+ bttn.onmouseout = function(){stopAni(this.id);};
+
+ // append button to link-element
+ bttnPicLink.appendChild(bttn);
+
+ // create text-link and add it to DIV-wrapper
+ bttnTxtLink = document.createElement("a");
+ bttnTxtLink.href = this.modLink;
+ bttnTxtLink.className = "txtLink";
+ bttnTxtLink.appendChild(document.createTextNode(this.modName));
+ bttnWrapper.appendChild(bttnTxtLink);
+
+ // create pop-up link for module description
+ bttnPopUpLink = document.createElement("a");
+ modName = this.modName;
+ modDescr = this.modDescr;
+ bttnPopUpLink.onclick = function(){showPopUpWindow();};
+ bttnPopUpLink.className = "popUpLink";
+ bttnPopUpLink.id = "popup" + this.modName;
+ bttnPopUpLink.appendChild(document.createTextNode("more info >>"));
+ bttnWrapper.appendChild(document.createElement("br"));
+ bttnWrapper.appendChild(bttnPopUpLink);
+
+ return bttn;
+ }
+
+ this.createWrapper = function(){
+ bttnWrapper = document.createElement("div");
+ bttnWrapper.id = "wrapper" + this.modName;
+ bttnWrapper.className = "bttnWrap";
+
+ return bttnWrapper;
+ }
+
+ this.createPicLink = function(){
+ picLink = document.createElement("a");
+ picLink.href = this.modLink;
+ picLink.id = "link" + this.modName;
+
+ return picLink;
+ }
+
+}
+
+
+function showPopUpWindow(){
+
+ // modules position in array?
+ modulePos = getPos(currentTarget,"popup");
+
+ // get reference to anchor-element in HTML-document
+ popUpAnchor = document.getElementById("popupAnchor");
+
+ // check if a popUp is open
+ if(popUpAnchor.hasChildNodes()){
+ // if a popUp is open, remove it!
+ popUpAnchor.removeChild(document.getElementById("popup"));
+ }
+
+ // create new container for popUp
+ container = document.createElement("div");
+ container.id = "popup";
+ container.align = "right";
+
+ // append popUp-container to HTML-document
+ popUpAnchor.appendChild(container);
+
+ // create close-button and append it to popUp-container
+ bttnClose = document.createElement("img");
+ bttnClose.src = "pics/popup_bttn_close.png";
+ bttnClose.id = "bttnClose";
+ bttnClose.onclick = function(){closeInfoWindow();};
+ container.appendChild(bttnClose);
+
+ // create container for content-elements
+ contHeadline = document.createElement("div");
+ contHeadline.id = "contHeadline";
+ contDescription = document.createElement("div");
+ contDescription.id = "contDescription";
+ contModLink = document.createElement("div");
+ contModLink.id = "contModLink";
+
+ // append content-container to popUp-container
+ container.appendChild(contHeadline);
+ container.appendChild(contDescription);
+ container.appendChild(contModLink);
+
+ // create text-elements with content
+ headline = document.createTextNode(moduleNames[modulePos] + " ");
+ description = document.createTextNode(moduleDescriptions[modulePos]);
+ moduleLink = document.createElement("a");
+ moduleLink.href = moduleLinks[modulePos] ;
+ moduleLink.className = 'moduleLink';
+ moduleLinkTxt = document.createTextNode("Click here to open the " + moduleNames[modulePos].toLowerCase() + " dataset");
+ moduleLink.appendChild(moduleLinkTxt);
+
+ // append text-elements to their container
+ contHeadline.appendChild(headline);
+ contDescription.appendChild(description);
+ contModLink.appendChild(moduleLink);
+}
+
+function getPos(id,prefix){
+
+ if(prefix == "popup"){
+ targetID = id.slice(5);
+ }else{
+ if(prefix == "bttn"){
+ targetID = id.slice(4);
+ }
+ }
+
+ for(i=0; i < moduleNames.length; i++ ){
+ if(moduleNames[i] == targetID){
+ return i;
+ }
+ }
+}
+
+function setExperimental(modPos){
+ linkID = "link" + moduleNames[modPos];
+
+ expPic = document.createElement("img");
+ expPic.src = "pics/experimental.png";
+ expPic.className = "expPic";
+ //alert(bttns[modPos].bttnID);
+ expPic.onmouseover = function(){startAni(bttns[modPos].bttnID);changeToHover(bttns[modPos].bttnID);};
+ expPic.onmouseout = function(){stopAni(bttns[modPos].bttnID);changeToNormal(bttns[modPos].bttnID);};
+
+ document.getElementById(linkID).appendChild(expPic);
+}
+
+function changeToHover(targetId){
+ bttn = document.getElementById(targetId);
+ bttn.className = "modBttnHover";
+}
+
+function changeToNormal(targetId){
+ bttn = document.getElementById(targetId);
+ bttn.className = "modBttn";
+}
+
+// function to close PopUp-window
+function closeInfoWindow(){
+ popUpAnchor = document.getElementById("popupAnchor");
+ popUpAnchor.removeChild(document.getElementById("popup"));
+}
+
+function createClearFloat(){
+ cf = document.createElement("div");
+ cf.className = "clearfloat";
+ document.getElementById("bttnField").appendChild(cf);
+}
+
+startAni = function(targetId){
+ modulePos = getPos(targetId,"bttn");
+
+ if(aniFilenames[modulePos] != ''){
+ bttn = document.getElementById(targetId);
+ bttn.src = "pics/" + aniFilenames[modulePos];
+ }
+}
+
+stopAni = function(targetId){
+ modulePos = getPos(targetId,"bttn");
+
+ bttn = document.getElementById(targetId);
+ bttn.src = "pics/" + picFilenames[modulePos];
+}
+
diff --git a/Modules/Bundles/org.mitk.gui.qt.diffusionimagingapp/resources/welcome/mitkdiffusionimagingappwelcomeview.html b/Modules/Bundles/org.mitk.gui.qt.diffusionimagingapp/resources/welcome/mitkdiffusionimagingappwelcomeview.html
new file mode 100644
index 0000000000..4836c23bfd
--- /dev/null
+++ b/Modules/Bundles/org.mitk.gui.qt.diffusionimagingapp/resources/welcome/mitkdiffusionimagingappwelcomeview.html
@@ -0,0 +1,36 @@
+<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd">
+<html xmlns="http://www.w3.org/1999/xhtml">
+
+ <head>
+ <meta http-equiv="Content-Type" content="text/html; charset=utf-8" />
+ <title>Springer DTI Atlas - MITK Diffusion Imaging App</title>
+ <link rel="stylesheet" type="text/css" href="style.css">
+ <script language="javascript" src="function.js"></script>
+ </head>
+
+ <body onload="createButtons()" oncontextmenu="return false;">
+
+ <div id="screen">
+
+ <!-- Welcome headline and introduction -->
+ <div id="welcome">
+
+ <h1>Welcome to the Diffusion Imaging Atlas!</h1>
+
+ <!-- PopUps with module description generated by js are placed in here -->
+ <div id="popupAnchor"></div>
+
+ <div id="welcomeText">
+ This viewer will navigate you through all datasets of the Springer Diffusion Imaging Atlas. The application was developed by the German Cancer Research Center (DKFZ) on the basis of the well established, free open source software toolkit MITK. If you are interested in fiber tracking, quantification, group analysis, connectomics, or other open source medical imaging tools, please visit our website www.mitk.org.
+ </div>
+
+ </div>
+
+ <!-- area for module buttons -->
+ <div id="bttnField">
+ <!-- Buttons created by js-fucntion are placed in here -->
+ </div>
+
+ </div>
+ </body>
+</html>
diff --git a/Modules/Bundles/org.mitk.gui.qt.diffusionimagingapp/resources/welcome/pics/01CING.png b/Modules/Bundles/org.mitk.gui.qt.diffusionimagingapp/resources/welcome/pics/01CING.png
new file mode 100644
index 0000000000..ace6381849
Binary files /dev/null and b/Modules/Bundles/org.mitk.gui.qt.diffusionimagingapp/resources/welcome/pics/01CING.png differ
diff --git a/Modules/Bundles/org.mitk.gui.qt.diffusionimagingapp/resources/welcome/pics/01aCING.png b/Modules/Bundles/org.mitk.gui.qt.diffusionimagingapp/resources/welcome/pics/01aCING.png
new file mode 100644
index 0000000000..9ed520200a
Binary files /dev/null and b/Modules/Bundles/org.mitk.gui.qt.diffusionimagingapp/resources/welcome/pics/01aCING.png differ
diff --git a/Modules/Bundles/org.mitk.gui.qt.diffusionimagingapp/resources/welcome/pics/02CORPUS.png b/Modules/Bundles/org.mitk.gui.qt.diffusionimagingapp/resources/welcome/pics/02CORPUS.png
new file mode 100644
index 0000000000..64c1f4ddcb
Binary files /dev/null and b/Modules/Bundles/org.mitk.gui.qt.diffusionimagingapp/resources/welcome/pics/02CORPUS.png differ
diff --git a/Modules/Bundles/org.mitk.gui.qt.diffusionimagingapp/resources/welcome/pics/02aCORPUS.png b/Modules/Bundles/org.mitk.gui.qt.diffusionimagingapp/resources/welcome/pics/02aCORPUS.png
new file mode 100644
index 0000000000..484095abce
Binary files /dev/null and b/Modules/Bundles/org.mitk.gui.qt.diffusionimagingapp/resources/welcome/pics/02aCORPUS.png differ
diff --git a/Modules/Bundles/org.mitk.gui.qt.diffusionimagingapp/resources/welcome/pics/03CST.png b/Modules/Bundles/org.mitk.gui.qt.diffusionimagingapp/resources/welcome/pics/03CST.png
new file mode 100644
index 0000000000..d322f6a8ec
Binary files /dev/null and b/Modules/Bundles/org.mitk.gui.qt.diffusionimagingapp/resources/welcome/pics/03CST.png differ
diff --git a/Modules/Bundles/org.mitk.gui.qt.diffusionimagingapp/resources/welcome/pics/03aCST.png b/Modules/Bundles/org.mitk.gui.qt.diffusionimagingapp/resources/welcome/pics/03aCST.png
new file mode 100644
index 0000000000..16d5296b12
Binary files /dev/null and b/Modules/Bundles/org.mitk.gui.qt.diffusionimagingapp/resources/welcome/pics/03aCST.png differ
diff --git a/Modules/Bundles/org.mitk.gui.qt.diffusionimagingapp/resources/welcome/pics/04FORNIX.png b/Modules/Bundles/org.mitk.gui.qt.diffusionimagingapp/resources/welcome/pics/04FORNIX.png
new file mode 100644
index 0000000000..d111d85f1e
Binary files /dev/null and b/Modules/Bundles/org.mitk.gui.qt.diffusionimagingapp/resources/welcome/pics/04FORNIX.png differ
diff --git a/Modules/Bundles/org.mitk.gui.qt.diffusionimagingapp/resources/welcome/pics/04aFORNIX.png b/Modules/Bundles/org.mitk.gui.qt.diffusionimagingapp/resources/welcome/pics/04aFORNIX.png
new file mode 100644
index 0000000000..7abf26080a
Binary files /dev/null and b/Modules/Bundles/org.mitk.gui.qt.diffusionimagingapp/resources/welcome/pics/04aFORNIX.png differ
diff --git a/Modules/Bundles/org.mitk.gui.qt.diffusionimagingapp/resources/welcome/pics/05ILF+IFO+UNCUS.png b/Modules/Bundles/org.mitk.gui.qt.diffusionimagingapp/resources/welcome/pics/05ILF+IFO+UNCUS.png
new file mode 100644
index 0000000000..2cf33842c6
Binary files /dev/null and b/Modules/Bundles/org.mitk.gui.qt.diffusionimagingapp/resources/welcome/pics/05ILF+IFO+UNCUS.png differ
diff --git a/Modules/Bundles/org.mitk.gui.qt.diffusionimagingapp/resources/welcome/pics/05aILF+IFO+UNCUS.png b/Modules/Bundles/org.mitk.gui.qt.diffusionimagingapp/resources/welcome/pics/05aILF+IFO+UNCUS.png
new file mode 100644
index 0000000000..ef0287c138
Binary files /dev/null and b/Modules/Bundles/org.mitk.gui.qt.diffusionimagingapp/resources/welcome/pics/05aILF+IFO+UNCUS.png differ
diff --git a/Modules/Bundles/org.mitk.gui.qt.diffusionimagingapp/resources/welcome/pics/06SLF+SOFF+ARCUATE.png b/Modules/Bundles/org.mitk.gui.qt.diffusionimagingapp/resources/welcome/pics/06SLF+SOFF+ARCUATE.png
new file mode 100644
index 0000000000..92a6c731ba
Binary files /dev/null and b/Modules/Bundles/org.mitk.gui.qt.diffusionimagingapp/resources/welcome/pics/06SLF+SOFF+ARCUATE.png differ
diff --git a/Modules/Bundles/org.mitk.gui.qt.diffusionimagingapp/resources/welcome/pics/06aSLF+SOFF+ARCUATE.png b/Modules/Bundles/org.mitk.gui.qt.diffusionimagingapp/resources/welcome/pics/06aSLF+SOFF+ARCUATE.png
new file mode 100644
index 0000000000..142312c98d
Binary files /dev/null and b/Modules/Bundles/org.mitk.gui.qt.diffusionimagingapp/resources/welcome/pics/06aSLF+SOFF+ARCUATE.png differ
diff --git a/Modules/Bundles/org.mitk.gui.qt.diffusionimagingapp/resources/welcome/pics/07PEDUNCLES.png b/Modules/Bundles/org.mitk.gui.qt.diffusionimagingapp/resources/welcome/pics/07PEDUNCLES.png
new file mode 100644
index 0000000000..302a31664f
Binary files /dev/null and b/Modules/Bundles/org.mitk.gui.qt.diffusionimagingapp/resources/welcome/pics/07PEDUNCLES.png differ
diff --git a/Modules/Bundles/org.mitk.gui.qt.diffusionimagingapp/resources/welcome/pics/07aPEDUNCLES.png b/Modules/Bundles/org.mitk.gui.qt.diffusionimagingapp/resources/welcome/pics/07aPEDUNCLES.png
new file mode 100644
index 0000000000..0813324109
Binary files /dev/null and b/Modules/Bundles/org.mitk.gui.qt.diffusionimagingapp/resources/welcome/pics/07aPEDUNCLES.png differ
diff --git a/Modules/Bundles/org.mitk.gui.qt.diffusionimagingapp/resources/welcome/pics/0aaref_alltracts.png b/Modules/Bundles/org.mitk.gui.qt.diffusionimagingapp/resources/welcome/pics/0aaref_alltracts.png
new file mode 100644
index 0000000000..15a9758f32
Binary files /dev/null and b/Modules/Bundles/org.mitk.gui.qt.diffusionimagingapp/resources/welcome/pics/0aaref_alltracts.png differ
diff --git a/Modules/Bundles/org.mitk.gui.qt.diffusionimagingapp/resources/welcome/pics/0aref_alltracts.png b/Modules/Bundles/org.mitk.gui.qt.diffusionimagingapp/resources/welcome/pics/0aref_alltracts.png
new file mode 100644
index 0000000000..b00a6ebc45
Binary files /dev/null and b/Modules/Bundles/org.mitk.gui.qt.diffusionimagingapp/resources/welcome/pics/0aref_alltracts.png differ
diff --git a/Modules/Bundles/org.mitk.gui.qt.diffusionimagingapp/resources/welcome/pics/0bref_colormap.gif b/Modules/Bundles/org.mitk.gui.qt.diffusionimagingapp/resources/welcome/pics/0bref_colormap.gif
new file mode 100644
index 0000000000..ac374c6888
Binary files /dev/null and b/Modules/Bundles/org.mitk.gui.qt.diffusionimagingapp/resources/welcome/pics/0bref_colormap.gif differ
diff --git a/Modules/Bundles/org.mitk.gui.qt.diffusionimagingapp/resources/welcome/pics/0bref_colormap.png b/Modules/Bundles/org.mitk.gui.qt.diffusionimagingapp/resources/welcome/pics/0bref_colormap.png
new file mode 100644
index 0000000000..4915331758
Binary files /dev/null and b/Modules/Bundles/org.mitk.gui.qt.diffusionimagingapp/resources/welcome/pics/0bref_colormap.png differ
diff --git a/Modules/Bundles/org.mitk.gui.qt.diffusionimagingapp/resources/welcome/pics/0cref_t1.gif b/Modules/Bundles/org.mitk.gui.qt.diffusionimagingapp/resources/welcome/pics/0cref_t1.gif
new file mode 100644
index 0000000000..76c0121dea
Binary files /dev/null and b/Modules/Bundles/org.mitk.gui.qt.diffusionimagingapp/resources/welcome/pics/0cref_t1.gif differ
diff --git a/Modules/Bundles/org.mitk.gui.qt.diffusionimagingapp/resources/welcome/pics/0cref_t1.png b/Modules/Bundles/org.mitk.gui.qt.diffusionimagingapp/resources/welcome/pics/0cref_t1.png
new file mode 100644
index 0000000000..341fe0b49a
Binary files /dev/null and b/Modules/Bundles/org.mitk.gui.qt.diffusionimagingapp/resources/welcome/pics/0cref_t1.png differ
diff --git a/Modules/Bundles/org.mitk.gui.qt.diffusionimagingapp/resources/welcome/pics/background.jpg b/Modules/Bundles/org.mitk.gui.qt.diffusionimagingapp/resources/welcome/pics/background.jpg
new file mode 100644
index 0000000000..c93f36df92
Binary files /dev/null and b/Modules/Bundles/org.mitk.gui.qt.diffusionimagingapp/resources/welcome/pics/background.jpg differ
diff --git a/Modules/Bundles/org.mitk.gui.qt.diffusionimagingapp/resources/welcome/pics/button_mitk.png b/Modules/Bundles/org.mitk.gui.qt.diffusionimagingapp/resources/welcome/pics/button_mitk.png
new file mode 100644
index 0000000000..821e041d36
Binary files /dev/null and b/Modules/Bundles/org.mitk.gui.qt.diffusionimagingapp/resources/welcome/pics/button_mitk.png differ
diff --git a/Modules/Bundles/org.mitk.gui.qt.diffusionimagingapp/resources/welcome/pics/button_mitka.png b/Modules/Bundles/org.mitk.gui.qt.diffusionimagingapp/resources/welcome/pics/button_mitka.png
new file mode 100644
index 0000000000..baf4f14a46
Binary files /dev/null and b/Modules/Bundles/org.mitk.gui.qt.diffusionimagingapp/resources/welcome/pics/button_mitka.png differ
diff --git a/Modules/Bundles/org.mitk.gui.qt.diffusionimagingapp/resources/welcome/pics/dti.jpg b/Modules/Bundles/org.mitk.gui.qt.diffusionimagingapp/resources/welcome/pics/dti.jpg
new file mode 100644
index 0000000000..2a368ea235
Binary files /dev/null and b/Modules/Bundles/org.mitk.gui.qt.diffusionimagingapp/resources/welcome/pics/dti.jpg differ
diff --git a/Modules/Bundles/org.mitk.gui.qt.diffusionimagingapp/resources/welcome/pics/dti_animated.gif b/Modules/Bundles/org.mitk.gui.qt.diffusionimagingapp/resources/welcome/pics/dti_animated.gif
new file mode 100644
index 0000000000..dcfd99498d
Binary files /dev/null and b/Modules/Bundles/org.mitk.gui.qt.diffusionimagingapp/resources/welcome/pics/dti_animated.gif differ
diff --git a/Modules/Bundles/org.mitk.gui.qt.diffusionimagingapp/resources/welcome/pics/experimental.png b/Modules/Bundles/org.mitk.gui.qt.diffusionimagingapp/resources/welcome/pics/experimental.png
new file mode 100644
index 0000000000..b05093ea2e
Binary files /dev/null and b/Modules/Bundles/org.mitk.gui.qt.diffusionimagingapp/resources/welcome/pics/experimental.png differ
diff --git a/Modules/Bundles/org.mitk.gui.qt.diffusionimagingapp/resources/welcome/pics/popup_bg.png b/Modules/Bundles/org.mitk.gui.qt.diffusionimagingapp/resources/welcome/pics/popup_bg.png
new file mode 100644
index 0000000000..9fef73a742
Binary files /dev/null and b/Modules/Bundles/org.mitk.gui.qt.diffusionimagingapp/resources/welcome/pics/popup_bg.png differ
diff --git a/Modules/Bundles/org.mitk.gui.qt.diffusionimagingapp/resources/welcome/pics/popup_bg_bottom.png b/Modules/Bundles/org.mitk.gui.qt.diffusionimagingapp/resources/welcome/pics/popup_bg_bottom.png
new file mode 100644
index 0000000000..f181fb97e2
Binary files /dev/null and b/Modules/Bundles/org.mitk.gui.qt.diffusionimagingapp/resources/welcome/pics/popup_bg_bottom.png differ
diff --git a/Modules/Bundles/org.mitk.gui.qt.diffusionimagingapp/resources/welcome/pics/popup_bg_middle.png b/Modules/Bundles/org.mitk.gui.qt.diffusionimagingapp/resources/welcome/pics/popup_bg_middle.png
new file mode 100644
index 0000000000..fd477da298
Binary files /dev/null and b/Modules/Bundles/org.mitk.gui.qt.diffusionimagingapp/resources/welcome/pics/popup_bg_middle.png differ
diff --git a/Modules/Bundles/org.mitk.gui.qt.diffusionimagingapp/resources/welcome/pics/popup_bg_top.png b/Modules/Bundles/org.mitk.gui.qt.diffusionimagingapp/resources/welcome/pics/popup_bg_top.png
new file mode 100644
index 0000000000..99424cbbb7
Binary files /dev/null and b/Modules/Bundles/org.mitk.gui.qt.diffusionimagingapp/resources/welcome/pics/popup_bg_top.png differ
diff --git a/Modules/Bundles/org.mitk.gui.qt.diffusionimagingapp/resources/welcome/pics/popup_bttn_close.png b/Modules/Bundles/org.mitk.gui.qt.diffusionimagingapp/resources/welcome/pics/popup_bttn_close.png
new file mode 100644
index 0000000000..279e340beb
Binary files /dev/null and b/Modules/Bundles/org.mitk.gui.qt.diffusionimagingapp/resources/welcome/pics/popup_bttn_close.png differ
diff --git a/Modules/Bundles/org.mitk.gui.qt.diffusionimagingapp/resources/welcome/pics/shadow.png b/Modules/Bundles/org.mitk.gui.qt.diffusionimagingapp/resources/welcome/pics/shadow.png
new file mode 100644
index 0000000000..83eda7b89e
Binary files /dev/null and b/Modules/Bundles/org.mitk.gui.qt.diffusionimagingapp/resources/welcome/pics/shadow.png differ
diff --git a/Modules/Bundles/org.mitk.gui.qt.diffusionimagingapp/resources/welcome/style.css b/Modules/Bundles/org.mitk.gui.qt.diffusionimagingapp/resources/welcome/style.css
new file mode 100644
index 0000000000..edc5605bb4
--- /dev/null
+++ b/Modules/Bundles/org.mitk.gui.qt.diffusionimagingapp/resources/welcome/style.css
@@ -0,0 +1,174 @@
+@charset "utf-8";
+
+body{
+ margin:0px 0px;
+ padding: 0px 0px;
+}
+
+h1{
+ margin:0px 0px;
+ padding: 0px 0px;
+ font-family:"Times New Roman", Times, serif;
+ color:#333;
+}
+
+img{border:none;}
+
+#screen{
+ width:100%;
+ min-height:1060px;
+ height:100%;
+ padding-top:15px;
+ background-color:#888888;
+ background-image:url(pics/background.jpg);
+ background-repeat:repeat-x;
+}
+
+#welcome{
+ min-width:150px;
+ max-width:690px;
+ margin: 0 auto;
+ padding-left:5px;
+ font-family:"Times New Roman", Times, serif;
+ color:#333;
+}
+
+#welcomeText{
+ margin-top:15px;
+ margin-bottom:15px;
+ z-index:1;
+}
+
+#bttnField{
+ min-width:150px;
+ max-width:690px;
+ margin: 0 auto;
+ padding-left:5px;
+}
+
+.bttnWrap{
+ position:relative;
+ float:left;
+ width:140px;
+ height:190px;
+ margin-right:32px;
+ margin-top:5px;
+ z-index:2;
+}
+
+.modBttn{
+ margin-bottom:8px;
+ border: solid 2px #000;
+ -webkit-box-shadow: 5px 5px 6px rgba(0,0,0,0.6);
+}
+
+.modBttn:hover{
+ border: solid 2px #FFF;
+ cursor:pointer;
+ -webkit-box-shadow: none;
+}
+
+.modBttnHover{
+ margin-bottom:8px;
+ border: solid 2px #FFF;
+ cursor:pointer;
+ -webkit-box-shadow: none;
+}
+
+.txtLink{
+ font-family:"Times New Roman", Times, serif;
+ font-size:16px;
+ font-weight:bold;
+ text-decoration:none;
+ cursor:pointer;
+ color:#333;
+}
+
+.txtLink:hover{
+ text-decoration:underline;
+}
+
+.popUpLink{
+ font-family:"Times New Roman", Times, serif;
+ font-size:14px;
+ font-weight:normal;
+ line-height:16px;
+ color:#333;
+}
+
+.popUpLink:hover{
+ text-decoration:underline;
+ cursor:pointer;
+}
+
+#popup{
+ position:fixed;
+ max-width:690px;
+ min-width:150px;
+ background-color:#000000;
+ opacity: 0.8;
+ -webkit-border-radius: 1em;
+ z-index:3;
+ font-family:Arial, Helvetica, sans-serif;
+ color:#FFF;
+}
+
+#bttnClose{
+ position:relative;
+ right:10px;
+ top:10px;
+ cursor:pointer;
+}
+
+#contHeadline{
+ max-width:690px;
+ min-width:150px;
+ margin-left:10px;
+ margin-right:10px;
+ font-weight:bold;
+ font-size:14px;
+ text-align:left;
+}
+
+#contDescription{
+ max-width:690px;
+ min-width:150px;
+ margin-top:15px;
+ margin-bottom:15px;
+ margin-left:10px;
+ margin-right:10px;
+ line-height:21px;
+ font-family:Arial, Helvetica, sans-serif;
+ font-weight:normal;
+ font-size:14px;
+ text-align:left;
+}
+
+#contModLink{
+ max-width:690px;
+ min-width:150px;
+ height:50px;
+ margin-left:10px;
+ margin-right:10px;
+ text-align:left;
+}
+
+.moduleLink{
+ font-family:Arial, Helvetica, sans-serif;
+ color:#FFF;
+}
+
+.expPic{
+ margin-top:-126px;
+}
+
+.clearfloat{clear:both;}
+
+
+
+
+
+
+
+
+
diff --git a/Core/Code/DataManagement/mitkLandmarkBasedCurvedGeometry.cpp b/Modules/Bundles/org.mitk.gui.qt.diffusionimagingapp/src/QmitkDiffusionImagingAppApplication.cpp
similarity index 53%
copy from Core/Code/DataManagement/mitkLandmarkBasedCurvedGeometry.cpp
copy to Modules/Bundles/org.mitk.gui.qt.diffusionimagingapp/src/QmitkDiffusionImagingAppApplication.cpp
index 3a785dc677..fb0987da02 100644
--- a/Core/Code/DataManagement/mitkLandmarkBasedCurvedGeometry.cpp
+++ b/Modules/Bundles/org.mitk.gui.qt.diffusionimagingapp/src/QmitkDiffusionImagingAppApplication.cpp
@@ -1,36 +1,38 @@
/*=========================================================================
-
+
Program: Medical Imaging & Interaction Toolkit
Language: C++
Date: $Date$
Version: $Revision$
-
+
Copyright (c) German Cancer Research Center, Division of Medical and
Biological Informatics. All rights reserved.
See MITKCopyright.txt or http://www.mitk.org/copyright.html for details.
-
+
This software is distributed WITHOUT ANY WARRANTY; without even
the implied warranty of MERCHANTABILITY or FITNESS FOR A PARTICULAR
PURPOSE. See the above copyright notices for more information.
-
+
=========================================================================*/
+#include "QmitkDiffusionImagingAppApplication.h"
-#include "mitkLandmarkBasedCurvedGeometry.h"
-#include <vtkAbstractTransform.h>
+#include <berryPlatformUI.h>
-mitk::LandmarkBasedCurvedGeometry::LandmarkBasedCurvedGeometry()
- : m_TargetLandmarks(NULL)
-{
-}
+#include "QmitkDiffusionImagingAppWorkbenchAdvisor.h"
-mitk::LandmarkBasedCurvedGeometry::~LandmarkBasedCurvedGeometry()
+int QmitkDiffusionImagingAppApplication::Start()
{
+ berry::Display* display = berry::PlatformUI::CreateDisplay();
+ int code = berry::PlatformUI::CreateAndRunWorkbench(display, new QmitkDiffusionImagingAppWorkbenchAdvisor());
+
+ // exit the application with an appropriate return code
+ return code == berry::PlatformUI::RETURN_RESTART
+ ? EXIT_RESTART : EXIT_OK;
}
-void mitk::LandmarkBasedCurvedGeometry::InitializeGeometry(Self * newGeometry) const
+void QmitkDiffusionImagingAppApplication::Stop()
{
- Superclass::InitializeGeometry(newGeometry);
- newGeometry->SetTargetLandmarks(m_TargetLandmarks);
+
}
diff --git a/Core/Code/DataManagement/mitkLandmarkBasedCurvedGeometry.cpp b/Modules/Bundles/org.mitk.gui.qt.diffusionimagingapp/src/QmitkDiffusionImagingAppApplication.h
similarity index 50%
copy from Core/Code/DataManagement/mitkLandmarkBasedCurvedGeometry.cpp
copy to Modules/Bundles/org.mitk.gui.qt.diffusionimagingapp/src/QmitkDiffusionImagingAppApplication.h
index 3a785dc677..89d15a0bdb 100644
--- a/Core/Code/DataManagement/mitkLandmarkBasedCurvedGeometry.cpp
+++ b/Modules/Bundles/org.mitk.gui.qt.diffusionimagingapp/src/QmitkDiffusionImagingAppApplication.h
@@ -1,36 +1,42 @@
/*=========================================================================
-
+
Program: Medical Imaging & Interaction Toolkit
Language: C++
Date: $Date$
Version: $Revision$
-
+
Copyright (c) German Cancer Research Center, Division of Medical and
Biological Informatics. All rights reserved.
See MITKCopyright.txt or http://www.mitk.org/copyright.html for details.
-
+
This software is distributed WITHOUT ANY WARRANTY; without even
the implied warranty of MERCHANTABILITY or FITNESS FOR A PARTICULAR
PURPOSE. See the above copyright notices for more information.
-
+
=========================================================================*/
+#ifndef QMITKDiffusionImagingAppAPPLICATION_H_
+#define QMITKDiffusionImagingAppAPPLICATION_H_
-#include "mitkLandmarkBasedCurvedGeometry.h"
-#include <vtkAbstractTransform.h>
-
-mitk::LandmarkBasedCurvedGeometry::LandmarkBasedCurvedGeometry()
- : m_TargetLandmarks(NULL)
-{
-}
-
-mitk::LandmarkBasedCurvedGeometry::~LandmarkBasedCurvedGeometry()
-{
-
-}
+#include <berryIApplication.h>
-void mitk::LandmarkBasedCurvedGeometry::InitializeGeometry(Self * newGeometry) const
+class QmitkDiffusionImagingAppApplication : public QObject, public berry::IApplication
{
- Superclass::InitializeGeometry(newGeometry);
- newGeometry->SetTargetLandmarks(m_TargetLandmarks);
-}
+ Q_OBJECT
+ Q_INTERFACES(berry::IApplication)
+
+public:
+
+ QmitkDiffusionImagingAppApplication() {}
+ QmitkDiffusionImagingAppApplication(const QmitkDiffusionImagingAppApplication& other)
+ {
+ Q_UNUSED(other)
+ throw std::runtime_error("Copy constructor not implemented");
+ }
+ ~QmitkDiffusionImagingAppApplication() {}
+
+ int Start();
+ void Stop();
+};
+
+#endif /*QMITKDiffusionImagingAppAPPLICATION_H_*/
diff --git a/Modules/Bundles/org.mitk.gui.qt.diffusionimagingapp/src/QmitkDiffusionImagingAppWorkbenchAdvisor.cpp b/Modules/Bundles/org.mitk.gui.qt.diffusionimagingapp/src/QmitkDiffusionImagingAppWorkbenchAdvisor.cpp
new file mode 100644
index 0000000000..2955830b9c
--- /dev/null
+++ b/Modules/Bundles/org.mitk.gui.qt.diffusionimagingapp/src/QmitkDiffusionImagingAppWorkbenchAdvisor.cpp
@@ -0,0 +1,110 @@
+/*=========================================================================
+
+ Program: BlueBerry Platform
+ Language: C++
+ Date: $Date: 2009-10-23 02:59:36 +0200 (Fri, 23 Oct 2009) $
+ Version: $Revision$
+
+ Copyright (c) German Cancer Research Center, Division of Medical and
+ Biological Informatics. All rights reserved.
+ See MITKCopyright.txt or http://www.mitk.org/copyright.html for details.
+
+ This software is distributed WITHOUT ANY WARRANTY; without even
+ the implied warranty of MERCHANTABILITY or FITNESS FOR A PARTICULAR
+ PURPOSE. See the above copyright notices for more information.
+
+ =========================================================================*/
+
+#include "QmitkDiffusionImagingAppWorkbenchAdvisor.h"
+
+#include "internal/QmitkDiffusionImagingAppApplicationPlugin.h"
+
+#include <berryPlatform.h>
+#include <berryIPreferencesService.h>
+#include <berryWorkbenchPreferenceConstants.h>
+#include <berryQtAssistantUtil.h>
+#include <QmitkExtWorkbenchWindowAdvisor.h>
+
+#include <QApplication>
+
+const std::string QmitkDiffusionImagingAppWorkbenchAdvisor::WELCOME_PERSPECTIVE_ID = "org.mitk.diffusionimagingapp.perspectives.welcome";
+
+
+void
+QmitkDiffusionImagingAppWorkbenchAdvisor::Initialize(berry::IWorkbenchConfigurer::Pointer configurer)
+{
+ berry::QtWorkbenchAdvisor::Initialize(configurer);
+
+ configurer->SetSaveAndRestore(true);
+
+ // TODO This should go into the products plugin_customization.ini file (when
+ // the product and branding support is finished, see bug 2146).
+ // This will not work anymore, if bug 2822 is fixed.
+ berry::IPreferencesService::Pointer prefService = berry::Platform::GetServiceRegistry().GetServiceById<berry::IPreferencesService>(berry::IPreferencesService::ID);
+ prefService->GetSystemPreferences()->Put(berry::WorkbenchPreferenceConstants::PREFERRED_SASH_LAYOUT, berry::WorkbenchPreferenceConstants::RIGHT);
+
+ QString collectionFile = QmitkDiffusionImagingAppApplicationPlugin::GetDefault()->GetQtHelpCollectionFile();
+ if (!collectionFile.isEmpty())
+ {
+// berry::QtAssistantUtil::SetHelpCollectionFile(collectionFile);
+// berry::QtAssistantUtil::SetDefaultHelpUrl("qthelp://org.mitk.gui.qt.diffusionimagingapp/bundle/index.html");
+
+ typedef std::vector<berry::IBundle::Pointer> BundleContainer;
+ BundleContainer bundles = berry::Platform::GetBundles();
+ berry::QtAssistantUtil::RegisterQCHFiles(bundles);
+ }
+
+}
+
+berry::WorkbenchWindowAdvisor*
+QmitkDiffusionImagingAppWorkbenchAdvisor::CreateWorkbenchWindowAdvisor(
+ berry::IWorkbenchWindowConfigurer::Pointer configurer)
+{
+ std::vector<std::string> perspExcludeList;
+ perspExcludeList.push_back( std::string("org.mitk.diffusionimagingapp.perspectives.welcome") );
+ perspExcludeList.push_back( std::string("org.mitk.perspectives.diffusionimaginginternal") );
+ perspExcludeList.push_back( std::string("org.mitk.perspectives.publicdiffusionimaging") );
+ perspExcludeList.push_back( std::string("org.mitk.extapp.defaultperspective") );
+ perspExcludeList.push_back( std::string("org.mitk.coreapp.defaultperspective") );
+
+ std::vector<std::string> viewExcludeList;
+ viewExcludeList.push_back( std::string("org.mitk.views.partialvolumeanalysis") );
+ viewExcludeList.push_back( std::string("org.mitk.views.globalfibertracking") );
+ viewExcludeList.push_back( std::string("org.mitk.views.tractbasedspatialstatistics") );
+ viewExcludeList.push_back( std::string("org.mitk.views.fibertracking") );
+ viewExcludeList.push_back( std::string("org.mitk.views.ivim") );
+ viewExcludeList.push_back( std::string("org.mitk.views.qballreconstruction") );
+ viewExcludeList.push_back( std::string("org.mitk.views.diffusiondicomimport") );
+ viewExcludeList.push_back( std::string("org.mitk.views.diffusionpreprocessing") );
+ viewExcludeList.push_back( std::string("org.mitk.views.diffusionquantification") );
+ viewExcludeList.push_back( std::string("org.mitk.views.tensorreconstruction") );
+ viewExcludeList.push_back( std::string("org.mitk.views.perspectiveswitcher") );
+ viewExcludeList.push_back( std::string("org.mitk.views.basicimageprocessing") );
+ viewExcludeList.push_back( std::string("org.mitk.views.fiberbundleoperations") );
+ viewExcludeList.push_back( std::string("org.mitk.views.measurement") );
+ viewExcludeList.push_back( std::string("org.mitk.views.moviemaker") );
+ viewExcludeList.push_back( std::string("org.mitk.views.odfdetails") );
+ viewExcludeList.push_back( std::string("org.mitk.views.propertylistview") );
+ viewExcludeList.push_back( std::string("org.mitk.views.screenshotmaker") );
+ viewExcludeList.push_back( std::string("org.mitk.views.segmentation") );
+ viewExcludeList.push_back( std::string("org.mitk.views.imagestatistics") );
+ viewExcludeList.push_back( std::string("org.mitk.views.controlvisualizationpropertiesview") );
+ viewExcludeList.push_back( std::string("org.mitk.views.volumevisualization") );
+
+ configurer->SetShowPerspectiveBar(false);
+ configurer->SetInitialSize(berry::Point(1000,770));
+
+ QmitkExtWorkbenchWindowAdvisor* advisor = new QmitkExtWorkbenchWindowAdvisor(this, configurer);
+ advisor->SetPerspectiveExcludeList(perspExcludeList);
+ advisor->SetViewExcludeList(viewExcludeList);
+ advisor->ShowViewToolbar(false);
+ advisor->ShowVersionInfo(false);
+ advisor->SetProductName("MITK Diffusioin Imaging App");
+ advisor->SetWindowIcon(":/org.mitk.gui.qt.diffusionimagingapp/app-icon.png");
+ return advisor;
+}
+
+std::string QmitkDiffusionImagingAppWorkbenchAdvisor::GetInitialWindowPerspectiveId()
+{
+ return WELCOME_PERSPECTIVE_ID;
+}
diff --git a/Modules/Bundles/org.mitk.gui.qt.diffusionimagingapp/src/QmitkDiffusionImagingAppWorkbenchAdvisor.h b/Modules/Bundles/org.mitk.gui.qt.diffusionimagingapp/src/QmitkDiffusionImagingAppWorkbenchAdvisor.h
new file mode 100644
index 0000000000..a166b59cef
--- /dev/null
+++ b/Modules/Bundles/org.mitk.gui.qt.diffusionimagingapp/src/QmitkDiffusionImagingAppWorkbenchAdvisor.h
@@ -0,0 +1,40 @@
+/*=========================================================================
+
+ Program: BlueBerry Platform
+ Language: C++
+ Date: $Date$
+ Version: $Revision$
+
+ Copyright (c) German Cancer Research Center, Division of Medical and
+ Biological Informatics. All rights reserved.
+ See MITKCopyright.txt or http://www.mitk.org/copyright.html for details.
+
+ This software is distributed WITHOUT ANY WARRANTY; without even
+ the implied warranty of MERCHANTABILITY or FITNESS FOR A PARTICULAR
+ PURPOSE. See the above copyright notices for more information.
+
+ =========================================================================*/
+
+
+#ifndef QMITKDIFFUSIONIMAGINGAPPWORKBENCHADVISOR_H_
+#define QMITKDIFFUSIONIMAGINGAPPWORKBENCHADVISOR_H_
+
+#include <berryQtWorkbenchAdvisor.h>
+
+class QmitkDiffusionImagingAppWorkbenchAdvisor : public berry::QtWorkbenchAdvisor
+{
+
+public:
+
+ static const std::string WELCOME_PERSPECTIVE_ID; // = "org.mitk.qt.diffusionimagingapp.defaultperspective"
+
+ void Initialize(berry::IWorkbenchConfigurer::Pointer configurer);
+
+ berry::WorkbenchWindowAdvisor* CreateWorkbenchWindowAdvisor(
+ berry::IWorkbenchWindowConfigurer::Pointer configurer);
+
+ std::string GetInitialWindowPerspectiveId();
+
+};
+
+#endif /* QMITKDIFFUSIONIMAGINGAPPWORKBENCHADVISOR_H_ */
diff --git a/Core/Code/DataManagement/mitkLandmarkBasedCurvedGeometry.cpp b/Modules/Bundles/org.mitk.gui.qt.diffusionimagingapp/src/internal/QmitkDiffusionImagingAppApplication.h~bug-8511-DTI-atlas-app
similarity index 52%
copy from Core/Code/DataManagement/mitkLandmarkBasedCurvedGeometry.cpp
copy to Modules/Bundles/org.mitk.gui.qt.diffusionimagingapp/src/internal/QmitkDiffusionImagingAppApplication.h~bug-8511-DTI-atlas-app
index 3a785dc677..8debb63dad 100644
--- a/Core/Code/DataManagement/mitkLandmarkBasedCurvedGeometry.cpp
+++ b/Modules/Bundles/org.mitk.gui.qt.diffusionimagingapp/src/internal/QmitkDiffusionImagingAppApplication.h~bug-8511-DTI-atlas-app
@@ -1,36 +1,41 @@
/*=========================================================================
-
+
Program: Medical Imaging & Interaction Toolkit
Language: C++
Date: $Date$
Version: $Revision$
-
+
Copyright (c) German Cancer Research Center, Division of Medical and
Biological Informatics. All rights reserved.
See MITKCopyright.txt or http://www.mitk.org/copyright.html for details.
-
+
This software is distributed WITHOUT ANY WARRANTY; without even
the implied warranty of MERCHANTABILITY or FITNESS FOR A PARTICULAR
PURPOSE. See the above copyright notices for more information.
-
+
=========================================================================*/
+#ifndef QMITKDiffusionImagingAppAPPLICATION_H_
+#define QMITKDiffusionImagingAppAPPLICATION_H_
-#include "mitkLandmarkBasedCurvedGeometry.h"
-#include <vtkAbstractTransform.h>
-
-mitk::LandmarkBasedCurvedGeometry::LandmarkBasedCurvedGeometry()
- : m_TargetLandmarks(NULL)
-{
-}
-
-mitk::LandmarkBasedCurvedGeometry::~LandmarkBasedCurvedGeometry()
-{
-
-}
+#include <berryIApplication.h>
-void mitk::LandmarkBasedCurvedGeometry::InitializeGeometry(Self * newGeometry) const
+class QmitkDiffusionImagingAppApplication : public QObject, public berry::IApplication
{
- Superclass::InitializeGeometry(newGeometry);
- newGeometry->SetTargetLandmarks(m_TargetLandmarks);
-}
+ Q_OBJECT
+
+public:
+
+ QmitkDiffusionImagingAppApplication() {}
+ QmitkDiffusionImagingAppApplication(const QmitkDiffusionImagingAppApplication& other)
+ {
+ Q_UNUSED(other)
+ throw std::runtime_error("Copy constructor not implemented");
+ }
+ ~QmitkDiffusionImagingAppApplication() {}
+
+ int Start();
+ void Stop();
+};
+
+#endif /*QMITKDiffusionImagingAppAPPLICATION_H_*/
diff --git a/Modules/Bundles/org.mitk.gui.qt.diffusionimagingapp/src/internal/QmitkDiffusionImagingAppApplicationPlugin.cpp b/Modules/Bundles/org.mitk.gui.qt.diffusionimagingapp/src/internal/QmitkDiffusionImagingAppApplicationPlugin.cpp
new file mode 100644
index 0000000000..74fb68831a
--- /dev/null
+++ b/Modules/Bundles/org.mitk.gui.qt.diffusionimagingapp/src/internal/QmitkDiffusionImagingAppApplicationPlugin.cpp
@@ -0,0 +1,122 @@
+/*=========================================================================
+
+ Program: BlueBerry Platform
+ Language: C++
+ Date: $Date$
+ Version: $Revision$
+
+ Copyright (c) German Cancer Research Center, Division of Medical and
+ Biological Informatics. All rights reserved.
+ See MITKCopyright.txt or http://www.mitk.org/copyright.html for details.
+
+ This software is distributed WITHOUT ANY WARRANTY; without even
+ the implied warranty of MERCHANTABILITY or FITNESS FOR A PARTICULAR
+ PURPOSE. See the above copyright notices for more information.
+
+ =========================================================================*/
+
+#include "QmitkDiffusionImagingAppApplicationPlugin.h"
+#include <QtPlugin>
+#include <mitkVersion.h>
+#include <berryQtAssistantUtil.h>
+
+#include "src/QmitkDiffusionImagingAppApplication.h"
+
+#include "src/internal/QmitkDiffusionImagingAppIntroPart.h"
+#include "src/internal/QmitkDiffusionImagingAppPerspective.h"
+#include "src/internal/QmitkWelcomePerspective.h"
+
+#include <QFileInfo>
+#include <QDateTime>
+
+QmitkDiffusionImagingAppApplicationPlugin* QmitkDiffusionImagingAppApplicationPlugin::inst = 0;
+
+QmitkDiffusionImagingAppApplicationPlugin::QmitkDiffusionImagingAppApplicationPlugin()
+ : pluginListener(0)
+{
+ inst = this;
+}
+
+QmitkDiffusionImagingAppApplicationPlugin::~QmitkDiffusionImagingAppApplicationPlugin()
+{
+ delete pluginListener;
+}
+
+QmitkDiffusionImagingAppApplicationPlugin* QmitkDiffusionImagingAppApplicationPlugin::GetDefault()
+{
+ return inst;
+}
+
+void QmitkDiffusionImagingAppApplicationPlugin::start(ctkPluginContext* context)
+{
+ berry::AbstractUICTKPlugin::start(context);
+
+ this->context = context;
+
+ BERRY_REGISTER_EXTENSION_CLASS(QmitkDiffusionImagingAppApplication, context)
+ BERRY_REGISTER_EXTENSION_CLASS(QmitkDiffusionImagingAppIntroPart, context)
+ BERRY_REGISTER_EXTENSION_CLASS(QmitkDiffusionImagingAppPerspective, context)
+ BERRY_REGISTER_EXTENSION_CLASS(QmitkWelcomePerspective, context)
+
+// QString collectionFile = GetQtHelpCollectionFile();
+
+// berry::QtAssistantUtil::SetHelpCollectionFile(collectionFile);
+// berry::QtAssistantUtil::SetDefaultHelpUrl("qthelp://org.mitk.gui.qt.diffusionimagingapp/bundle/index.html");
+
+ delete pluginListener;
+ pluginListener = new berry::QCHPluginListener(context);
+ context->connectPluginListener(pluginListener, SLOT(pluginChanged(ctkPluginEvent)), Qt::DirectConnection);
+
+ // register all QCH files from all the currently installed plugins
+ pluginListener->processPlugins();
+
+
+}
+
+QString QmitkDiffusionImagingAppApplicationPlugin::GetQtHelpCollectionFile() const
+{
+
+ if (!helpCollectionFile.isEmpty())
+ {
+ return helpCollectionFile;
+ }
+
+ QString collectionFilename;
+ QString na("n/a");
+// if (na != MITK_REVISION)
+// collectionFilename = "MitkDiffusionImagingAppQtHelpCollection_" MITK_REVISION ".qhc";
+// else
+ collectionFilename = "MitkDiffusionImagingAppQtHelpCollection.qhc";
+
+ QFileInfo collectionFileInfo = context->getDataFile(collectionFilename);
+ QFileInfo pluginFileInfo = QFileInfo(QUrl(context->getPlugin()->getLocation()).toLocalFile());
+ if (!collectionFileInfo.exists() ||
+ pluginFileInfo.lastModified() > collectionFileInfo.lastModified())
+ {
+ // extract the qhc file from the plug-in
+ QByteArray content = context->getPlugin()->getResource(collectionFilename);
+ if (content.isEmpty())
+ {
+ BERRY_WARN << "Could not get plug-in resource: " << collectionFilename.toStdString();
+ }
+ else
+ {
+ QFile file(collectionFileInfo.absoluteFilePath());
+ file.open(QIODevice::WriteOnly);
+ file.write(content);
+ file.close();
+ }
+ }
+
+ if (QFile::exists(collectionFileInfo.absoluteFilePath()))
+ {
+ helpCollectionFile = collectionFileInfo.absoluteFilePath();
+ }
+
+ return helpCollectionFile;
+
+}
+
+Q_EXPORT_PLUGIN2(org_mitk_gui_qt_diffusionimagingapp, QmitkDiffusionImagingAppApplicationPlugin)
+
+
diff --git a/Modules/Bundles/org.mitk.gui.qt.diffusionimagingapp/src/internal/QmitkDiffusionImagingAppApplicationPlugin.h b/Modules/Bundles/org.mitk.gui.qt.diffusionimagingapp/src/internal/QmitkDiffusionImagingAppApplicationPlugin.h
new file mode 100644
index 0000000000..22babe8d7e
--- /dev/null
+++ b/Modules/Bundles/org.mitk.gui.qt.diffusionimagingapp/src/internal/QmitkDiffusionImagingAppApplicationPlugin.h
@@ -0,0 +1,58 @@
+/*=========================================================================
+
+ Program: BlueBerry Platform
+ Language: C++
+ Date: $Date$
+ Version: $Revision$
+
+ Copyright (c) German Cancer Research Center, Division of Medical and
+ Biological Informatics. All rights reserved.
+ See MITKCopyright.txt or http://www.mitk.org/copyright.html for details.
+
+ This software is distributed WITHOUT ANY WARRANTY; without even
+ the implied warranty of MERCHANTABILITY or FITNESS FOR A PARTICULAR
+ PURPOSE. See the above copyright notices for more information.
+
+ =========================================================================*/
+
+#ifndef QMITKDIFFUSIONIMAGINGAPPAPPLICATIONPLUGIN_H_
+#define QMITKDIFFUSIONIMAGINGAPPAPPLICATIONPLUGIN_H_
+
+#include <QString>
+#include <berryAbstractUICTKPlugin.h>
+#include <berryIBundleContext.h>
+
+#include <berryQCHPluginListener.h>
+
+class QmitkDiffusionImagingAppApplicationPlugin :
+ public QObject, public berry::AbstractUICTKPlugin
+{
+ Q_OBJECT
+ Q_INTERFACES(ctkPluginActivator)
+
+public:
+
+ QmitkDiffusionImagingAppApplicationPlugin();
+ ~QmitkDiffusionImagingAppApplicationPlugin();
+
+ static QmitkDiffusionImagingAppApplicationPlugin* GetDefault();
+
+ ctkPluginContext* GetPluginContext() const;
+
+ void start(ctkPluginContext*);
+
+ QString GetQtHelpCollectionFile() const;
+
+ private:
+
+ static QmitkDiffusionImagingAppApplicationPlugin* inst;
+
+ ctkPluginContext* context;
+ berry::QCHPluginListener* pluginListener;
+
+ mutable QString helpCollectionFile;
+
+
+}; // QmitkDiffusionImagingAppApplicationPlugin
+
+#endif // QMITKDIFFUSIONIMAGINGAPPAPPLICATIONPLUGIN_H_
diff --git a/Modules/Bundles/org.mitk.gui.qt.diffusionimagingapp/src/internal/QmitkDiffusionImagingAppIntroPart.cpp b/Modules/Bundles/org.mitk.gui.qt.diffusionimagingapp/src/internal/QmitkDiffusionImagingAppIntroPart.cpp
new file mode 100644
index 0000000000..8e13e9f1a1
--- /dev/null
+++ b/Modules/Bundles/org.mitk.gui.qt.diffusionimagingapp/src/internal/QmitkDiffusionImagingAppIntroPart.cpp
@@ -0,0 +1,283 @@
+/*=========================================================================
+
+ Program: BlueBerry Platform
+ Language: C++
+ Date: $Date$
+ Version: $Revision$
+
+ Copyright (c) German Cancer Research Center, Division of Medical and
+ Biological Informatics. All rights reserved.
+ See MITKCopyright.txt or http://www.mitk.org/copyright.html for details.
+
+ This software is distributed WITHOUT ANY WARRANTY; without even
+ the implied warranty of MERCHANTABILITY or FITNESS FOR A PARTICULAR
+ PURPOSE. See the above copyright notices for more information.
+
+ =========================================================================*/
+
+#include "QmitkDiffusionImagingAppIntroPart.h"
+
+#include "mitkNodePredicateDataType.h"
+#include <berryIWorkbenchWindow.h>
+#include <berryIWorkbench.h>
+#include <berryIWorkbenchPage.h>
+#include <berryIPerspectiveRegistry.h>
+#include <berryWorkbenchPreferenceConstants.h>
+#include <berryIPreferences.h>
+#include <berryIEditorReference.h>
+
+#include <mitkLogMacros.h>
+
+#include <QLabel>
+#include <QMessageBox>
+#include <QtCore/qconfig.h>
+#ifdef QT_WEBKIT
+#include <QWebView>
+#include <QWebPage>
+#endif
+#include <QString>
+#include <QStringList>
+#include <QRegExp>
+#include <QChar>
+#include <QByteArray>
+#include <QDesktopServices>
+
+
+#include "QmitkStdMultiWidgetEditor.h"
+#include "QmitkDiffusionImagingAppApplicationPlugin.h"
+#include "mitkDataStorageEditorInput.h"
+
+#include "mitkBaseDataIOFactory.h"
+#include "mitkSceneIO.h"
+#include "mitkProgressBar.h"
+#include "mitkDataNodeFactory.h"
+#include "mitkNodePredicateNot.h"
+#include "mitkNodePredicateProperty.h"
+
+QmitkDiffusionImagingAppIntroPart::QmitkDiffusionImagingAppIntroPart()
+ : m_Controls(NULL)
+{
+ berry::IPreferences::Pointer workbenchPrefs = QmitkDiffusionImagingAppApplicationPlugin::GetDefault()->GetPreferencesService()->GetSystemPreferences();
+ workbenchPrefs->PutBool(berry::WorkbenchPreferenceConstants::SHOW_INTRO, true);
+ workbenchPrefs->Flush();
+}
+
+QmitkDiffusionImagingAppIntroPart::~QmitkDiffusionImagingAppIntroPart()
+{
+ // if the workbench is not closing (that means, welcome screen was closed explicitly), set "Show_intro" false
+ if (!this->GetIntroSite()->GetPage()->GetWorkbenchWindow()->GetWorkbench()->IsClosing())
+ {
+ berry::IPreferences::Pointer workbenchPrefs = QmitkDiffusionImagingAppApplicationPlugin::GetDefault()->GetPreferencesService()->GetSystemPreferences();
+ workbenchPrefs->PutBool(berry::WorkbenchPreferenceConstants::SHOW_INTRO, false);
+ workbenchPrefs->Flush();
+ }
+ else
+ {
+ berry::IPreferences::Pointer workbenchPrefs = QmitkDiffusionImagingAppApplicationPlugin::GetDefault()->GetPreferencesService()->GetSystemPreferences();
+ workbenchPrefs->PutBool(berry::WorkbenchPreferenceConstants::SHOW_INTRO, true);
+ workbenchPrefs->Flush();
+ }
+
+ // if workbench is not closing (Just welcome screen closing), open last used perspective
+ if (this->GetIntroSite()->GetPage()->GetPerspective()->GetId()
+ == "org.mitk.diffusionimagingapp.perspectives.welcome" && !this->GetIntroSite()->GetPage()->GetWorkbenchWindow()->GetWorkbench()->IsClosing())
+ {
+ berry::IPerspectiveDescriptor::Pointer perspective = this->GetIntroSite()->GetWorkbenchWindow()->GetWorkbench()->GetPerspectiveRegistry()->FindPerspectiveWithId("org.mitk.diffusionimagingapp.perspectives.diffusionimagingapp");
+ if (perspective)
+ {
+ this->GetIntroSite()->GetPage()->SetPerspective(perspective);
+ }
+ }
+
+}
+
+
+void QmitkDiffusionImagingAppIntroPart::CreateQtPartControl(QWidget* parent)
+{
+ if (!m_Controls)
+ {
+ // create GUI widgets
+ m_Controls = new Ui::QmitkWelcomeScreenViewControls;
+ m_Controls->setupUi(parent);
+#ifdef QT_WEBKIT
+
+ // create a QWebView as well as a QWebPage and QWebFrame within the QWebview
+ m_view = new QWebView(parent);
+ m_view->page()->setLinkDelegationPolicy(QWebPage::DelegateAllLinks);
+
+ QUrl urlQtResource(QString("qrc:/org.mitk.gui.qt.welcomescreen/mitkdiffusionimagingappwelcomeview.html"), QUrl::TolerantMode );
+ m_view->load( urlQtResource );
+
+ // adds the webview as a widget
+ parent->layout()->addWidget(m_view);
+ this->CreateConnections();
+#else
+ parent->layout()->addWidget(new QLabel("<h1><center>Please install Qt with the WebKit option to see cool pictures!</center></h1>"));
+#endif
+ }
+}
+
+#ifdef QT_WEBKIT
+void QmitkDiffusionImagingAppIntroPart::CreateConnections()
+{
+ if ( m_Controls )
+ {
+ connect( (QObject*)(m_view->page()), SIGNAL(linkClicked(const QUrl& )), this, SLOT(DelegateMeTo(const QUrl& )) );
+ }
+}
+
+
+void QmitkDiffusionImagingAppIntroPart::DelegateMeTo(const QUrl& showMeNext)
+{
+ QString scheme = showMeNext.scheme();
+ QByteArray urlHostname = showMeNext.encodedHost();
+ QByteArray urlPath = showMeNext.encodedPath();
+ QByteArray dataset = showMeNext.encodedQueryItemValue("dataset");
+
+ if (scheme.isEmpty()) MITK_INFO << " empty scheme of the to be delegated link" ;
+
+ // if the scheme is set to mitk, it is to be tested which action should be applied
+ if (scheme.contains(QString("mitk")) )
+ {
+ if(urlPath.isEmpty() ) MITK_INFO << " mitk path is empty " ;
+
+ // searching for the perspective keyword within the host name
+ if(urlHostname.contains(QByteArray("perspectives")) )
+ {
+ // the simplified method removes every whitespace
+ // ( whitespace means any character for which the standard C++ isspace() method returns true)
+ urlPath = urlPath.simplified();
+ QString tmpPerspectiveId(urlPath.data());
+ tmpPerspectiveId.replace(QString("/"), QString("") );
+ std::string perspectiveId = tmpPerspectiveId.toStdString();
+
+ // is working fine as long as the perspective id is valid, if not the application crashes
+ GetIntroSite()->GetWorkbenchWindow()->GetWorkbench()->ShowPerspective(perspectiveId, GetIntroSite()->GetWorkbenchWindow() );
+
+ mitk::DataStorageEditorInput::Pointer editorInput;
+ editorInput = new mitk::DataStorageEditorInput();
+ berry::IEditorPart::Pointer editor = GetIntroSite()->GetPage()->OpenEditor(editorInput, QmitkStdMultiWidgetEditor::EDITOR_ID);
+
+
+ QmitkStdMultiWidgetEditor::Pointer multiWidgetEditor;
+ mitk::DataStorage::Pointer dataStorage;
+
+ if (editor.Cast<QmitkStdMultiWidgetEditor>().IsNull())
+ {
+ editorInput = new mitk::DataStorageEditorInput();
+ dataStorage = editorInput->GetDataStorageReference()->GetDataStorage();
+ }
+ else
+ {
+ multiWidgetEditor = editor.Cast<QmitkStdMultiWidgetEditor>();
+ multiWidgetEditor->GetStdMultiWidget()->RequestUpdate();
+ dataStorage = multiWidgetEditor->GetEditorInput().Cast<mitk::DataStorageEditorInput>()->GetDataStorageReference()->GetDataStorage();
+ }
+
+ bool dsmodified = false;
+
+ QString *fileName = new QString(dataset.data());
+
+ if ( fileName->right(5) == ".mitk" )
+ {
+ mitk::SceneIO::Pointer sceneIO = mitk::SceneIO::New();
+
+ bool clearDataStorageFirst(false);
+ mitk::ProgressBar::GetInstance()->AddStepsToDo(2);
+ dataStorage = sceneIO->LoadScene( fileName->toLocal8Bit().constData(), dataStorage, clearDataStorageFirst );
+ dsmodified = true;
+ mitk::ProgressBar::GetInstance()->Progress(2);
+ }
+ else
+ {
+ mitk::DataNodeFactory::Pointer nodeReader = mitk::DataNodeFactory::New();
+ try
+ {
+ nodeReader->SetFileName(fileName->toLocal8Bit().data());
+ nodeReader->Update();
+ for ( unsigned int i = 0 ; i < nodeReader->GetNumberOfOutputs( ); ++i )
+ {
+ mitk::DataNode::Pointer node;
+ node = nodeReader->GetOutput(i);
+ if ( node->GetData() != NULL )
+ {
+ dataStorage->Add(node);
+ dsmodified = true;
+ }
+ }
+ }
+ catch(...)
+ {
+
+ }
+ }
+
+
+
+ if(dsmodified)
+ {
+ // get all nodes that have not set "includeInBoundingBox" to false
+ mitk::NodePredicateNot::Pointer pred
+ = mitk::NodePredicateNot::New(mitk::NodePredicateProperty::New("includeInBoundingBox"
+ , mitk::BoolProperty::New(false)));
+
+ mitk::DataStorage::SetOfObjects::ConstPointer rs = dataStorage->GetSubset(pred);
+ // calculate bounding geometry of these nodes
+ mitk::TimeSlicedGeometry::Pointer bounds = dataStorage->ComputeBoundingGeometry3D(rs);
+ // initialize the views to the bounding geometry
+ mitk::RenderingManager::GetInstance()->InitializeViews(bounds);
+ }
+
+
+
+
+
+ }
+ // searching for the load
+ if(urlHostname.contains(QByteArray("perspectives")) )
+ {
+ // the simplified method removes every whitespace
+ // ( whitespace means any character for which the standard C++ isspace() method returns true)
+ urlPath = urlPath.simplified();
+ QString tmpPerspectiveId(urlPath.data());
+ tmpPerspectiveId.replace(QString("/"), QString("") );
+ std::string perspectiveId = tmpPerspectiveId.toStdString();
+
+ // is working fine as long as the perspective id is valid, if not the application crashes
+ GetIntroSite()->GetWorkbenchWindow()->GetWorkbench()->ShowPerspective(perspectiveId, GetIntroSite()->GetWorkbenchWindow() );
+
+ mitk::DataStorageEditorInput::Pointer editorInput;
+ editorInput = new mitk::DataStorageEditorInput();
+ GetIntroSite()->GetPage()->OpenEditor(editorInput, QmitkStdMultiWidgetEditor::EDITOR_ID);
+ }
+ else
+ {
+ MITK_INFO << "Unkown mitk action keyword (see documentation for mitk links)" ;
+ }
+ }
+ // if the scheme is set to http, by default no action is performed, if an external webpage needs to be
+ // shown it should be implemented below
+ else if (scheme.contains(QString("http")) )
+ {
+ QDesktopServices::openUrl(showMeNext);
+// m_view->load( ) ;
+ }
+ else if(scheme.contains("qrc"))
+ {
+ m_view->load(showMeNext);
+ }
+
+}
+
+#endif
+
+void QmitkDiffusionImagingAppIntroPart::StandbyStateChanged(bool standby)
+{
+
+}
+
+
+void QmitkDiffusionImagingAppIntroPart::SetFocus()
+{
+
+}
diff --git a/Modules/Bundles/org.mitk.gui.qt.diffusionimagingapp/src/internal/QmitkDiffusionImagingAppIntroPart.h b/Modules/Bundles/org.mitk.gui.qt.diffusionimagingapp/src/internal/QmitkDiffusionImagingAppIntroPart.h
new file mode 100644
index 0000000000..b49accd2c4
--- /dev/null
+++ b/Modules/Bundles/org.mitk.gui.qt.diffusionimagingapp/src/internal/QmitkDiffusionImagingAppIntroPart.h
@@ -0,0 +1,95 @@
+/*=========================================================================
+
+ Program: BlueBerry Platform
+ Language: C++
+ Date: $Date$
+ Version: $Revision$
+
+ Copyright (c) German Cancer Research Center, Division of Medical and
+ Biological Informatics. All rights reserved.
+ See MITKCopyright.txt or http://www.mitk.org/copyright.html for details.
+
+ This software is distributed WITHOUT ANY WARRANTY; without even
+ the implied warranty of MERCHANTABILITY or FITNESS FOR A PARTICULAR
+ PURPOSE. See the above copyright notices for more information.
+
+ =========================================================================*/
+
+
+#ifndef QMITKDIFFUSIONIMAGINGAPPINTROPART_H_
+#define QMITKDIFFUSIONIMAGINGAPPINTROPART_H_
+
+#include <QtCore/qconfig.h>
+
+#include <berryQtIntroPart.h>
+#include <ui_QmitkWelcomeScreenViewControls.h>
+
+
+/**
+ * \ingroup org_mitk_gui_qt_welcomescreen_internal
+ * \brief QmitkWelcomeScreenView
+ * The WelcomeView Module is an helpful feature to people new to MITK. The main idea is to provide first
+ * information about the particular working modes of the 3 M-3 application suited to specific medical working task.
+ * Links to external documentation or information pages such as the mitk.org homepage are thinkable but have
+ * not been implemented yet. The WelcomeView is realized by making use of the QTWebKit Module. The Qt WebKit module
+ * provides an HTML browser engine that makes it easy to embed web content into native applications, and to enhance
+ * web content with native controls.
+ * For the welcome view of the application the QWebView, QWebPage classes have been used. The shown WelcomeView
+ * html start page is styled by an external css stylesheet. The required resources as well as the html pages are integrated
+ * into the QtResource system. The QT resource system allows the storage of files like html pages, css pages, jpgs etc.
+ * as binaries within the executable.
+ * This minimizes the risk of loosing resource files as well as the risk of getting files deleted. In order to use the Qt
+ * resource system the resource files have to be added to the associated qrt resource file list.
+ * Due to time issues the html pages of the welcome view do make use of jpegs with hotspots to switch
+ * into the particular working modes. <
+ * Nevertheless the foundation is set to design more complex html pages. The Q::WebPage gives options to set a
+ * LinkDelegationPolicy. The used policy defines how links to external or internal resources are handled. To fit our needs
+ * the delegate all links policy is used. This requires all external as well as internal links of the html pages to be handle
+ * explicitly. In order to change mitk working modes (perspectives) a mitk url scheme has been designed. The url scheme
+ * is set to mitk. The url host provides information about what's next to do. In our case, the case of switching to a
+ * particular working mode the host is set to perspectives. The followed path provides information about the perspective id.
+ * (e.g. mitk//::mitk.perspectives/org.mitk.qt.defaultperspective) The the generic design of the mitk url scheme allows to * execute other task depending on the mitk url host.
+ * \sa QmitkWelcomePage Editor
+ */
+
+class QWebView ;
+
+class QmitkDiffusionImagingAppIntroPart : public berry::QtIntroPart
+{
+
+// this is needed for all Qt objects that should have a MOC object (everything that derives from QObject)
+ Q_OBJECT
+
+public:
+
+ QmitkDiffusionImagingAppIntroPart();
+ QmitkDiffusionImagingAppIntroPart(const QmitkDiffusionImagingAppIntroPart& other)
+ {
+ Q_UNUSED(other)
+ throw std::runtime_error("Copy constructor not implemented");
+ }
+ ~QmitkDiffusionImagingAppIntroPart();
+
+
+ virtual void CreateQtPartControl(QWidget *parent);
+
+ void StandbyStateChanged(bool standby);
+
+ void SetFocus();
+#ifdef QT_WEBKIT
+
+ virtual void CreateConnections();
+
+
+protected slots:
+
+
+ void DelegateMeTo(const QUrl& ShowMeNext);
+#endif
+protected:
+
+ Ui::QmitkWelcomeScreenViewControls* m_Controls;
+ QWebView* m_view;
+};
+
+#endif /* QMITKDIFFUSIONIMAGINGAPPINTROPART_H_ */
diff --git a/Modules/Bundles/org.mitk.gui.qt.diffusionimagingapp/src/internal/QmitkDiffusionImagingAppPerspective.cpp b/Modules/Bundles/org.mitk.gui.qt.diffusionimagingapp/src/internal/QmitkDiffusionImagingAppPerspective.cpp
new file mode 100644
index 0000000000..8c188400b5
--- /dev/null
+++ b/Modules/Bundles/org.mitk.gui.qt.diffusionimagingapp/src/internal/QmitkDiffusionImagingAppPerspective.cpp
@@ -0,0 +1,86 @@
+/*=========================================================================
+
+ Program: BlueBerry Platform
+ Language: C++
+ Date: $Date: 2009-10-23 02:59:36 +0200 (Fr, 23 Okt 2009) $
+ Version: $Revision: 19652 $
+
+ Copyright (c) German Cancer Research Center, Division of Medical and
+ Biological Informatics. All rights reserved.
+ See MITKCopyright.txt or http://www.mitk.org/copyright.html for details.
+
+ This software is distributed WITHOUT ANY WARRANTY; without even
+ the implied warranty of MERCHANTABILITY or FITNESS FOR A PARTICULAR
+ PURPOSE. See the above copyright notices for more information.
+
+ =========================================================================*/
+
+#include "QmitkDiffusionImagingAppPerspective.h"
+#include "berryIViewLayout.h"
+
+void QmitkDiffusionImagingAppPerspective::CreateInitialLayout(berry::IPageLayout::Pointer layout)
+{
+ std::string editorArea = layout->GetEditorArea();
+
+ layout->AddStandaloneView("org.mitk.views.datamanager",
+ false, berry::IPageLayout::LEFT, 0.3f, editorArea);
+
+ layout->AddStandaloneView("org.mitk.views.controlvisualizationpropertiesview",
+ false, berry::IPageLayout::BOTTOM, .5f, "org.mitk.views.datamanager");
+
+// berry::IFolderLayout::Pointer left =
+// layout->CreateFolder("org.mitk.diffusionimaginginternal.leftcontrols",
+// berry::IPageLayout::BOTTOM, 0.2f, "org.mitk.views.controlvisualizationpropertiesview");
+
+// layout->AddStandaloneView("org.mitk.views.perspectiveswitcher",
+// false, berry::IPageLayout::BOTTOM, 0.99f, "org.mitk.diffusionimaginginternal.leftcontrols");
+
+ ////////////////////////////////////////
+ // public views go here
+ ////////////////////////////////////////
+// left->AddView("org.mitk.views.fiberbundleoperations");
+// berry::IViewLayout::Pointer lo = layout->GetViewLayout("org.mitk.views.fiberbundleoperations");
+// lo->SetCloseable(false);
+
+// left->AddView("org.mitk.views.diffusionpreprocessing");
+// berry::IViewLayout::Pointer lo = layout->GetViewLayout("org.mitk.views.diffusionpreprocessing");
+// lo->SetCloseable(true);
+
+// left->AddView("org.mitk.views.tensorreconstruction");
+// lo = layout->GetViewLayout("org.mitk.views.tensorreconstruction");
+// lo->SetCloseable(true);
+
+// left->AddView("org.mitk.views.qballreconstruction");
+// lo = layout->GetViewLayout("org.mitk.views.qballreconstruction");
+// lo->SetCloseable(true);
+
+// left->AddView("org.mitk.views.diffusionquantification");
+// lo = layout->GetViewLayout("org.mitk.views.diffusionquantification");
+// lo->SetCloseable(true);
+
+// left->AddView("org.mitk.views.diffusiondicomimport");
+// lo = layout->GetViewLayout("org.mitk.views.diffusiondicomimport");
+// lo->SetCloseable(true);
+
+ ////////////////////////////////////////
+ // end public views
+ ////////////////////////////////////////
+
+
+// berry::IFolderLayout::Pointer right =
+// layout->CreateFolder("org.mitk.diffusionimaginginternal.rightcontrols", berry::IPageLayout::RIGHT, 0.5f, editorArea);
+
+ ////////////////////////////////////////
+ // internal views go here
+ ////////////////////////////////////////
+// right->AddView("org.mitk.views.globalfibertracking");
+// right->AddView("org.mitk.views.partialvolumeanalysis");
+// right->AddView("org.mitk.views.ivim");
+// right->AddView("org.mitk.views.tractbasedspatialstatistics");
+// right->AddView("org.mitk.views.fibertracking");
+
+ ////////////////////////////////////////
+ // end internal views
+ ////////////////////////////////////////
+
+}
diff --git a/Modules/Bundles/org.mitk.gui.qt.diffusionimagingapp/src/internal/QmitkDiffusionImagingAppPerspective.h b/Modules/Bundles/org.mitk.gui.qt.diffusionimagingapp/src/internal/QmitkDiffusionImagingAppPerspective.h
new file mode 100644
index 0000000000..0bbb807407
--- /dev/null
+++ b/Modules/Bundles/org.mitk.gui.qt.diffusionimagingapp/src/internal/QmitkDiffusionImagingAppPerspective.h
@@ -0,0 +1,42 @@
+/*=========================================================================
+
+ Program: BlueBerry Platform
+ Language: C++
+ Date: $Date: 2009-10-23 02:59:36 +0200 (Fr, 23 Okt 2009) $
+ Version: $Revision: 19652 $
+
+ Copyright (c) German Cancer Research Center, Division of Medical and
+ Biological Informatics. All rights reserved.
+ See MITKCopyright.txt or http://www.mitk.org/copyright.html for details.
+
+ This software is distributed WITHOUT ANY WARRANTY; without even
+ the implied warranty of MERCHANTABILITY or FITNESS FOR A PARTICULAR
+ PURPOSE. See the above copyright notices for more information.
+
+ =========================================================================*/
+
+
+#ifndef QMITKDIFFUSIONIMAGINGAPPPERSPECTIVE_H_
+#define QMITKDIFFUSIONIMAGINGAPPPERSPECTIVE_H_
+
+#include <berryIPerspectiveFactory.h>
+
+class QmitkDiffusionImagingAppPerspective : public QObject, public berry::IPerspectiveFactory
+{
+ Q_OBJECT
+ Q_INTERFACES(berry::IPerspectiveFactory)
+
+public:
+
+ QmitkDiffusionImagingAppPerspective() {}
+ QmitkDiffusionImagingAppPerspective(const QmitkDiffusionImagingAppPerspective& other)
+ {
+ Q_UNUSED(other)
+ throw std::runtime_error("Copy constructor not implemented");
+ }
+ ~QmitkDiffusionImagingAppPerspective() {}
+
+ void CreateInitialLayout(berry::IPageLayout::Pointer layout);
+};
+
+#endif /* QMITKDIFFUSIONIMAGINGAPPPERSPECTIVE_H_ */
diff --git a/BlueBerry/Bundles/org.blueberry.ui/src/internal/berryTweaklets.cpp b/Modules/Bundles/org.mitk.gui.qt.diffusionimagingapp/src/internal/QmitkWelcomePerspective.cpp
old mode 100755
new mode 100644
similarity index 71%
copy from BlueBerry/Bundles/org.blueberry.ui/src/internal/berryTweaklets.cpp
copy to Modules/Bundles/org.mitk.gui.qt.diffusionimagingapp/src/internal/QmitkWelcomePerspective.cpp
index 44b6d8851f..6a59624ce5
--- a/BlueBerry/Bundles/org.blueberry.ui/src/internal/berryTweaklets.cpp
+++ b/Modules/Bundles/org.mitk.gui.qt.diffusionimagingapp/src/internal/QmitkWelcomePerspective.cpp
@@ -1,26 +1,22 @@
/*=========================================================================
-
+
Program: BlueBerry Platform
Language: C++
- Date: $Date$
- Version: $Revision$
-
+ Date: $Date: 2009-10-23 02:59:36 +0200 (Fr, 23 Okt 2009) $
+ Version: $Revision: 19652 $
+
Copyright (c) German Cancer Research Center, Division of Medical and
Biological Informatics. All rights reserved.
See MITKCopyright.txt or http://www.mitk.org/copyright.html for details.
-
+
This software is distributed WITHOUT ANY WARRANTY; without even
the implied warranty of MERCHANTABILITY or FITNESS FOR A PARTICULAR
PURPOSE. See the above copyright notices for more information.
-
+
=========================================================================*/
-#include "berryTweaklets.h"
+#include "QmitkWelcomePerspective.h"
-namespace berry
+void QmitkWelcomePerspective::CreateInitialLayout(berry::IPageLayout::Pointer /*layout*/)
{
-
-std::map<Tweaklets::TweakKey_base, Object::Pointer> Tweaklets::defaults;
-std::map<Tweaklets::TweakKey_base, Object::Pointer> Tweaklets::tweaklets;
-
}
diff --git a/Modules/Bundles/org.mitk.gui.qt.diffusionimagingapp/src/internal/QmitkWelcomePerspective.h b/Modules/Bundles/org.mitk.gui.qt.diffusionimagingapp/src/internal/QmitkWelcomePerspective.h
new file mode 100644
index 0000000000..2239700630
--- /dev/null
+++ b/Modules/Bundles/org.mitk.gui.qt.diffusionimagingapp/src/internal/QmitkWelcomePerspective.h
@@ -0,0 +1,42 @@
+/*=========================================================================
+
+ Program: BlueBerry Platform
+ Language: C++
+ Date: $Date: 2009-10-23 02:59:36 +0200 (Fr, 23 Okt 2009) $
+ Version: $Revision: 19652 $
+
+ Copyright (c) German Cancer Research Center, Division of Medical and
+ Biological Informatics. All rights reserved.
+ See MITKCopyright.txt or http://www.mitk.org/copyright.html for details.
+
+ This software is distributed WITHOUT ANY WARRANTY; without even
+ the implied warranty of MERCHANTABILITY or FITNESS FOR A PARTICULAR
+ PURPOSE. See the above copyright notices for more information.
+
+ =========================================================================*/
+
+
+#ifndef QMITKWelcomePERSPECTIVE_H_
+#define QMITKWelcomePERSPECTIVE_H_
+
+#include <berryIPerspectiveFactory.h>
+
+class QmitkWelcomePerspective : public QObject, public berry::IPerspectiveFactory
+{
+ Q_OBJECT
+ Q_INTERFACES(berry::IPerspectiveFactory)
+
+public:
+
+ QmitkWelcomePerspective() {}
+ QmitkWelcomePerspective(const QmitkWelcomePerspective& other)
+ {
+ Q_UNUSED(other)
+ throw std::runtime_error("Copy constructor not implemented");
+ }
+ ~QmitkWelcomePerspective() {}
+
+ void CreateInitialLayout(berry::IPageLayout::Pointer /*layout*/);
+};
+
+#endif /* QMITKWelcomePERSPECTIVE_H_ */
diff --git a/Modules/Bundles/org.mitk.gui.qt.diffusionimagingapp/src/internal/QmitkWelcomeScreenViewControls.ui b/Modules/Bundles/org.mitk.gui.qt.diffusionimagingapp/src/internal/QmitkWelcomeScreenViewControls.ui
new file mode 100644
index 0000000000..4a7cda1314
--- /dev/null
+++ b/Modules/Bundles/org.mitk.gui.qt.diffusionimagingapp/src/internal/QmitkWelcomeScreenViewControls.ui
@@ -0,0 +1,34 @@
+<?xml version="1.0" encoding="UTF-8"?>
+<ui version="4.0">
+ <class>QmitkWelcomeScreenViewControls</class>
+ <widget class="QWidget" name="QmitkWelcomeScreenViewControls">
+ <property name="geometry">
+ <rect>
+ <x>0</x>
+ <y>0</y>
+ <width>458</width>
+ <height>398</height>
+ </rect>
+ </property>
+ <property name="minimumSize">
+ <size>
+ <width>0</width>
+ <height>0</height>
+ </size>
+ </property>
+ <property name="windowTitle">
+ <string>QmitkTemplate</string>
+ </property>
+ <layout class="QGridLayout" name="gridLayout">
+ <property name="margin">
+ <number>0</number>
+ </property>
+ <item row="0" column="0">
+ <layout class="QGridLayout" name="m_WebViewLayout"/>
+ </item>
+ </layout>
+ </widget>
+ <layoutdefault spacing="6" margin="11"/>
+ <resources/>
+ <connections/>
+</ui>
diff --git a/Modules/Bundles/org.mitk.gui.qt.ext/src/QmitkExtFileSaveProjectAction.cpp b/Modules/Bundles/org.mitk.gui.qt.ext/src/QmitkExtFileSaveProjectAction.cpp
index 9316799343..254db84be1 100644
--- a/Modules/Bundles/org.mitk.gui.qt.ext/src/QmitkExtFileSaveProjectAction.cpp
+++ b/Modules/Bundles/org.mitk.gui.qt.ext/src/QmitkExtFileSaveProjectAction.cpp
@@ -1,139 +1,147 @@
/*=========================================================================
Program: Medical Imaging & Interaction Toolkit
Language: C++
Date: $Date: 2009-10-07 16:14:59 +0200 (Mi, 07 Okt 2009) $
Version: $Revision: 19343 $
Copyright (c) German Cancer Research Center, Division of Medical and
Biological Informatics. All rights reserved.
See MITKCopyright.txt or http://www.mitk.org/copyright.html for details.
This software is distributed WITHOUT ANY WARRANTY; without even
the implied warranty of MERCHANTABILITY or FITNESS FOR A PARTICULAR
PURPOSE. See the above copyright notices for more information.
=========================================================================*/
#include "QmitkExtFileSaveProjectAction.h"
#include <QFileDialog>
#include <QMessageBox>
#include "mitkSceneIO.h"
#include "mitkProgressBar.h"
#include <mitkNodePredicateNot.h>
#include <mitkNodePredicateProperty.h>
#include <mitkProperties.h>
#include <mitkCoreObjectFactory.h>
#include <mitkDataStorageEditorInput.h>
#include <berryIEditorPart.h>
#include <berryIWorkbenchPage.h>
#include "QmitkStdMultiWidgetEditor.h"
QmitkExtFileSaveProjectAction::QmitkExtFileSaveProjectAction(berry::IWorkbenchWindow::Pointer window)
: QAction(0)
{
m_Window = window;
this->setParent(static_cast<QWidget*>(m_Window->GetShell()->GetControl()));
this->setText("&Save Project...");
this->setToolTip("Save content of Data Manager as a .mitk project file");
m_Window = window;
this->connect(this, SIGNAL(triggered(bool)), this, SLOT(Run()));
}
void QmitkExtFileSaveProjectAction::Run()
{
try
{
- QString fileName = QFileDialog::getSaveFileName(NULL, "Save MITK scene", QString::null, "MITK scene files (*.mitk)", NULL );
+ /**
+ * @brief stores the last path of last opened file
+ */
+ static QString m_LastPath;
+ QString fileName = QFileDialog::getSaveFileName(NULL, "Save MITK scene", m_LastPath, "MITK scene files (*.mitk)", NULL );
+
if (fileName.isEmpty() )
return;
+ m_LastPath = fileName;
+
+
if ( fileName.right(5) != ".mitk" )
fileName += ".mitk";
mitk::SceneIO::Pointer sceneIO = mitk::SceneIO::New();
mitk::DataStorageEditorInput::Pointer editorInput;
mitk::DataStorage::Pointer storage;
QmitkStdMultiWidgetEditor::Pointer multiWidgetEditor;
berry::IEditorPart::Pointer editor = m_Window->GetActivePage()->GetActiveEditor();
if (editor.Cast<QmitkStdMultiWidgetEditor>().IsNull())
{
editorInput = new mitk::DataStorageEditorInput();
storage = editorInput->GetDataStorageReference()->GetDataStorage();
}
else
{
multiWidgetEditor = editor.Cast<QmitkStdMultiWidgetEditor>();
storage = multiWidgetEditor->GetEditorInput().Cast<mitk::DataStorageEditorInput>()->GetDataStorageReference()->GetDataStorage();
}
mitk::ProgressBar::GetInstance()->AddStepsToDo(2);
/* Build list of nodes that should be saved */
mitk::NodePredicateNot::Pointer isNotHelperObject = mitk::NodePredicateNot::New(mitk::NodePredicateProperty::New("helper object", mitk::BoolProperty::New(true)));
mitk::DataStorage::SetOfObjects::ConstPointer nodesToBeSaved = storage->GetSubset(isNotHelperObject);
if ( !sceneIO->SaveScene( nodesToBeSaved, storage, fileName.toLocal8Bit().constData() ) )
{
QMessageBox::information(NULL,
"Scene saving",
"Scene could not be written completely. Please check the log.",
QMessageBox::Ok);
}
mitk::ProgressBar::GetInstance()->Progress(2);
mitk::SceneIO::FailedBaseDataListType::ConstPointer failedNodes = sceneIO->GetFailedNodes();
if (!failedNodes->empty())
{
std::stringstream ss;
ss << "The following nodes could not be serialized:" << std::endl;
for ( mitk::SceneIO::FailedBaseDataListType::const_iterator iter = failedNodes->begin();
iter != failedNodes->end();
++iter )
{
ss << " - ";
if ( mitk::BaseData* data =(*iter)->GetData() )
{
ss << data->GetNameOfClass();
}
else
{
ss << "(NULL)";
}
ss << " contained in node '" << (*iter)->GetName() << "'" << std::endl;
}
MITK_WARN << ss.str();
}
mitk::PropertyList::ConstPointer failedProperties = sceneIO->GetFailedProperties();
if (!failedProperties->GetMap()->empty())
{
std::stringstream ss;
ss << "The following properties could not be serialized:" << std::endl;
const mitk::PropertyList::PropertyMap* propmap = failedProperties->GetMap();
for ( mitk::PropertyList::PropertyMap::const_iterator iter = propmap->begin();
iter != propmap->end();
++iter )
{
- ss << " - " << iter->second.first->GetNameOfClass() << " associated to key '" << iter->first << "'" << std::endl;
+ ss << " - " << iter->second->GetNameOfClass() << " associated to key '" << iter->first << "'" << std::endl;
}
MITK_WARN << ss.str();
}
}
catch (std::exception& e)
{
MITK_ERROR << "Exception caught during scene saving: " << e.what();
}
}
diff --git a/Modules/Bundles/org.mitk.gui.qt.ext/src/QmitkExtWorkbenchWindowAdvisor.cpp b/Modules/Bundles/org.mitk.gui.qt.ext/src/QmitkExtWorkbenchWindowAdvisor.cpp
index 6668b77da5..ab705ef9de 100644
--- a/Modules/Bundles/org.mitk.gui.qt.ext/src/QmitkExtWorkbenchWindowAdvisor.cpp
+++ b/Modules/Bundles/org.mitk.gui.qt.ext/src/QmitkExtWorkbenchWindowAdvisor.cpp
@@ -1,967 +1,1006 @@
/*=========================================================================
Program: Medical Imaging & Interaction Toolkit
Language: C++
Date: $Date$
Version: $Revision$
Copyright (c) German Cancer Research Center, Division of Medical and
Biological Informatics. All rights reserved.
See MITKCopyright.txt or http://www.mitk.org/copyright.html for details.
This software is distributed WITHOUT ANY WARRANTY; without even
the implied warranty of MERCHANTABILITY or FITNESS FOR A PARTICULAR
PURPOSE. See the above copyright notices for more information.
=========================================================================*/
#include "QmitkExtWorkbenchWindowAdvisor.h"
#include "QmitkExtActionBarAdvisor.h"
#include <QMenu>
#include <QMenuBar>
#include <QMainWindow>
#include <QStatusBar>
#include <QString>
#include <QFile>
#include <QRegExp>
#include <QTextStream>
#include <QSettings>
#include <berryPlatform.h>
#include <berryPlatformUI.h>
#include <berryIWorkbenchWindow.h>
#include <berryIWorkbenchPage.h>
#include <berryIPreferencesService.h>
#include <berryIPerspectiveRegistry.h>
#include <berryIPerspectiveDescriptor.h>
#include <berryIWorkbenchPartConstants.h>
#include <berryQtAssistantUtil.h>
#include <internal/berryQtShowViewAction.h>
#include <internal/berryQtOpenPerspectiveAction.h>
#include <QmitkExtFileOpenAction.h>
#include <QmitkExtFileSaveProjectAction.h>
#include <QmitkFileExitAction.h>
#include <QmitkCloseProjectAction.h>
#include <QmitkStatusBar.h>
#include <QmitkProgressBar.h>
#include <QmitkMemoryUsageIndicatorView.h>
#include <QmitkPreferencesDialog.h>
#include <itkConfigure.h>
#include <vtkConfigure.h>
#include <mitkVersion.h>
// UGLYYY
#include "internal/QmitkExtWorkbenchWindowAdvisorHack.h"
#include "internal/QmitkCommonExtPlugin.h"
#include "mitkUndoController.h"
#include "mitkVerboseLimitedLinearUndo.h"
#include <QToolBar>
#include <QMessageBox>
#include <QLabel>
#include <QmitkAboutDialog/QmitkAboutDialog.h>
QmitkExtWorkbenchWindowAdvisorHack
* QmitkExtWorkbenchWindowAdvisorHack::undohack =
new QmitkExtWorkbenchWindowAdvisorHack();
QString QmitkExtWorkbenchWindowAdvisor::QT_SETTINGS_FILENAME = "QtSettings.ini";
class PartListenerForTitle: public berry::IPartListener
{
public:
PartListenerForTitle(QmitkExtWorkbenchWindowAdvisor* wa) :
windowAdvisor(wa)
{
}
Events::Types GetPartEventTypes() const
{
return Events::ACTIVATED | Events::BROUGHT_TO_TOP | Events::CLOSED
| Events::HIDDEN | Events::VISIBLE;
}
void PartActivated(berry::IWorkbenchPartReference::Pointer ref)
{
if (ref.Cast<berry::IEditorReference> ())
{
windowAdvisor->UpdateTitle(false);
}
}
void PartBroughtToTop(berry::IWorkbenchPartReference::Pointer ref)
{
if (ref.Cast<berry::IEditorReference> ())
{
windowAdvisor->UpdateTitle(false);
}
}
void PartClosed(berry::IWorkbenchPartReference::Pointer /*ref*/)
{
windowAdvisor->UpdateTitle(false);
}
void PartHidden(berry::IWorkbenchPartReference::Pointer ref)
{
if (!windowAdvisor->lastActiveEditor.Expired() &&
ref->GetPart(false) == windowAdvisor->lastActiveEditor.Lock())
{
windowAdvisor->UpdateTitle(true);
}
}
void PartVisible(berry::IWorkbenchPartReference::Pointer ref)
{
if (!windowAdvisor->lastActiveEditor.Expired() &&
ref->GetPart(false) == windowAdvisor->lastActiveEditor.Lock())
{
windowAdvisor->UpdateTitle(false);
}
}
private:
QmitkExtWorkbenchWindowAdvisor* windowAdvisor;
};
class PartListenerForImageNavigator: public berry::IPartListener
{
public:
PartListenerForImageNavigator(QAction* act) :
imageNavigatorAction(act)
{
}
Events::Types GetPartEventTypes() const
{
return Events::OPENED | Events::CLOSED | Events::HIDDEN |
Events::VISIBLE;
}
void PartOpened(berry::IWorkbenchPartReference::Pointer ref)
{
if (ref->GetId()=="org.mitk.views.imagenavigator")
{
imageNavigatorAction->setChecked(true);
}
}
void PartClosed(berry::IWorkbenchPartReference::Pointer ref)
{
if (ref->GetId()=="org.mitk.views.imagenavigator")
{
imageNavigatorAction->setChecked(false);
}
}
void PartVisible(berry::IWorkbenchPartReference::Pointer ref)
{
if (ref->GetId()=="org.mitk.views.imagenavigator")
{
imageNavigatorAction->setChecked(true);
}
}
void PartHidden(berry::IWorkbenchPartReference::Pointer ref)
{
if (ref->GetId()=="org.mitk.views.imagenavigator")
{
imageNavigatorAction->setChecked(false);
}
}
private:
QAction* imageNavigatorAction;
};
class PerspectiveListenerForTitle: public berry::IPerspectiveListener
{
public:
PerspectiveListenerForTitle(QmitkExtWorkbenchWindowAdvisor* wa) :
windowAdvisor(wa), perspectivesClosed(false)
{
}
Events::Types GetPerspectiveEventTypes() const
{
return Events::ACTIVATED | Events::SAVED_AS | Events::DEACTIVATED
// remove the following line when command framework is finished
| Events::CLOSED | Events::OPENED;
}
void PerspectiveActivated(berry::IWorkbenchPage::Pointer /*page*/,
berry::IPerspectiveDescriptor::Pointer /*perspective*/)
{
windowAdvisor->UpdateTitle(false);
}
void PerspectiveSavedAs(berry::IWorkbenchPage::Pointer /*page*/,
berry::IPerspectiveDescriptor::Pointer /*oldPerspective*/,
berry::IPerspectiveDescriptor::Pointer /*newPerspective*/)
{
windowAdvisor->UpdateTitle(false);
}
void PerspectiveDeactivated(berry::IWorkbenchPage::Pointer /*page*/,
berry::IPerspectiveDescriptor::Pointer /*perspective*/)
{
windowAdvisor->UpdateTitle(false);
}
void PerspectiveOpened(berry::IWorkbenchPage::Pointer /*page*/,
berry::IPerspectiveDescriptor::Pointer /*perspective*/)
{
if (perspectivesClosed)
{
QListIterator<QAction*> i(windowAdvisor->viewActions);
while (i.hasNext())
{
i.next()->setEnabled(true);
}
windowAdvisor->fileSaveProjectAction->setEnabled(true);
windowAdvisor->closeProjectAction->setEnabled(true);
windowAdvisor->undoAction->setEnabled(true);
windowAdvisor->redoAction->setEnabled(true);
windowAdvisor->imageNavigatorAction->setEnabled(true);
windowAdvisor->resetPerspAction->setEnabled(true);
windowAdvisor->closePerspAction->setEnabled(true);
}
perspectivesClosed = false;
}
void PerspectiveClosed(berry::IWorkbenchPage::Pointer /*page*/,
berry::IPerspectiveDescriptor::Pointer /*perspective*/)
{
berry::IWorkbenchWindow::Pointer wnd = windowAdvisor->GetWindowConfigurer()->GetWindow();
bool allClosed = true;
if (wnd->GetActivePage())
{
std::vector<berry::IPerspectiveDescriptor::Pointer> perspectives(wnd->GetActivePage()->GetOpenPerspectives());
allClosed = perspectives.empty();
}
if (allClosed)
{
perspectivesClosed = true;
QListIterator<QAction*> i(windowAdvisor->viewActions);
while (i.hasNext())
{
i.next()->setEnabled(false);
}
windowAdvisor->fileSaveProjectAction->setEnabled(false);
windowAdvisor->closeProjectAction->setEnabled(false);
windowAdvisor->undoAction->setEnabled(false);
windowAdvisor->redoAction->setEnabled(false);
windowAdvisor->imageNavigatorAction->setEnabled(false);
windowAdvisor->resetPerspAction->setEnabled(false);
windowAdvisor->closePerspAction->setEnabled(false);
}
}
private:
QmitkExtWorkbenchWindowAdvisor* windowAdvisor;
bool perspectivesClosed;
};
class PerspectiveListenerForMenu: public berry::IPerspectiveListener
{
public:
PerspectiveListenerForMenu(QmitkExtWorkbenchWindowAdvisor* wa) :
windowAdvisor(wa)
{
}
Events::Types GetPerspectiveEventTypes() const
{
return Events::ACTIVATED | Events::DEACTIVATED;
}
void PerspectiveActivated(berry::IWorkbenchPage::Pointer /*page*/,
berry::IPerspectiveDescriptor::Pointer perspective)
{
QAction* action = windowAdvisor->mapPerspIdToAction[perspective->GetId()];
if (action)
{
action->setChecked(true);
}
}
void PerspectiveDeactivated(berry::IWorkbenchPage::Pointer /*page*/,
berry::IPerspectiveDescriptor::Pointer perspective)
{
QAction* action = windowAdvisor->mapPerspIdToAction[perspective->GetId()];
if (action)
{
action->setChecked(false);
}
}
private:
QmitkExtWorkbenchWindowAdvisor* windowAdvisor;
};
QmitkExtWorkbenchWindowAdvisor::QmitkExtWorkbenchWindowAdvisor(berry::WorkbenchAdvisor* wbAdvisor,
berry::IWorkbenchWindowConfigurer::Pointer configurer) :
QmitkCommonWorkbenchWindowAdvisor(configurer),
lastInput(0),
wbAdvisor(wbAdvisor),
showViewToolbar(true),
showVersionInfo(true)
{
productName = berry::Platform::GetConfiguration().getString("application.baseName");
}
berry::ActionBarAdvisor::Pointer QmitkExtWorkbenchWindowAdvisor::CreateActionBarAdvisor(
berry::IActionBarConfigurer::Pointer configurer)
{
berry::ActionBarAdvisor::Pointer actionBarAdvisor(
new QmitkExtActionBarAdvisor(configurer));
return actionBarAdvisor;
}
void* QmitkExtWorkbenchWindowAdvisor::CreateEmptyWindowContents(void* parent)
{
QWidget* parentWidget = static_cast<QWidget*>(parent);
QLabel* label = new QLabel(parentWidget);
label->setText("<b>No perspectives are open. Open a perspective in the <i>Window->Open Perspective</i> menu.</b>");
label->setContentsMargins(10,10,10,10);
label->setAlignment(Qt::AlignTop);
label->setEnabled(false);
parentWidget->layout()->addWidget(label);
return label;
}
void QmitkExtWorkbenchWindowAdvisor::ShowViewToolbar(bool show)
{
showViewToolbar = show;
}
void QmitkExtWorkbenchWindowAdvisor::ShowVersionInfo(bool show)
{
showVersionInfo = show;
}
void QmitkExtWorkbenchWindowAdvisor::SetProductName(const std::string& product)
{
productName = product;
}
void QmitkExtWorkbenchWindowAdvisor::SetWindowIcon(const std::string& wndIcon)
{
windowIcon = wndIcon;
}
void QmitkExtWorkbenchWindowAdvisor::PostWindowCreate()
{
QmitkCommonWorkbenchWindowAdvisor::PostWindowCreate();
// very bad hack...
berry::IWorkbenchWindow::Pointer window =
this->GetWindowConfigurer()->GetWindow();
QMainWindow* mainWindow =
static_cast<QMainWindow*> (window->GetShell()->GetControl());
if (!windowIcon.empty())
{
mainWindow->setWindowIcon(QIcon(QString::fromStdString(windowIcon)));
}
mainWindow->setContextMenuPolicy(Qt::PreventContextMenu);
/*mainWindow->setStyleSheet("color: white;"
"background-color: #808080;"
"selection-color: #659EC7;"
"selection-background-color: #808080;"
" QMenuBar {"
"background-color: #808080; }");*/
// ==== Application menu ============================
QMenuBar* menuBar = mainWindow->menuBar();
menuBar->setContextMenuPolicy(Qt::PreventContextMenu);
QMenu* fileMenu = menuBar->addMenu("&File");
fileMenu->setObjectName("FileMenu");
QAction* fileOpenAction = new QmitkExtFileOpenAction(QIcon(":/org.mitk.gui.qt.ext/Load_48.png"), window);
fileMenu->addAction(fileOpenAction);
fileSaveProjectAction = new QmitkExtFileSaveProjectAction(window);
fileSaveProjectAction->setIcon(QIcon(":/org.mitk.gui.qt.ext/Save_48.png"));
fileMenu->addAction(fileSaveProjectAction);
closeProjectAction = new QmitkCloseProjectAction(window);
closeProjectAction->setIcon(QIcon(":/org.mitk.gui.qt.ext/Remove_48.png"));
fileMenu->addAction(closeProjectAction);
fileMenu->addSeparator();
QAction* fileExitAction = new QmitkFileExitAction(window);
fileExitAction->setObjectName("QmitkFileExitAction");
fileMenu->addAction(fileExitAction);
berry::IViewRegistry* viewRegistry =
berry::PlatformUI::GetWorkbench()->GetViewRegistry();
const std::vector<berry::IViewDescriptor::Pointer>& viewDescriptors =
viewRegistry->GetViews();
// another bad hack to get an edit/undo menu...
QMenu* editMenu = menuBar->addMenu("&Edit");
undoAction = editMenu->addAction(QIcon(":/org.mitk.gui.qt.ext/Undo_48.png"),
"&Undo",
QmitkExtWorkbenchWindowAdvisorHack::undohack, SLOT(onUndo()),
QKeySequence("CTRL+Z"));
undoAction->setToolTip("Undo the last action (not supported by all modules)");
redoAction = editMenu->addAction(QIcon(":/org.mitk.gui.qt.ext/Redo_48.png")
, "&Redo",
QmitkExtWorkbenchWindowAdvisorHack::undohack, SLOT(onRedo()),
QKeySequence("CTRL+Y"));
redoAction->setToolTip("execute the last action that was undone again (not supported by all modules)");
imageNavigatorAction = new QAction(QIcon(":/org.mitk.gui.qt.ext/Slider.png"), "&Image Navigator", NULL);
- QObject::connect(imageNavigatorAction, SIGNAL(triggered(bool)), QmitkExtWorkbenchWindowAdvisorHack::undohack, SLOT(onImageNavigator()));
- imageNavigatorAction->setCheckable(true);
-
- // add part listener for image navigator
- imageNavigatorPartListener = new PartListenerForImageNavigator(imageNavigatorAction);
- window->GetPartService()->AddPartListener(imageNavigatorPartListener);
- berry::IViewPart::Pointer imageNavigatorView =
- window->GetActivePage()->FindView("org.mitk.views.imagenavigator");
- imageNavigatorAction->setChecked(false);
- if (imageNavigatorView)
+ bool imageNavigatorViewFound = window->GetWorkbench()->GetViewRegistry()->Find("org.mitk.views.imagenavigator");
+ if (imageNavigatorViewFound)
{
- bool isImageNavigatorVisible = window->GetActivePage()->IsPartVisible(imageNavigatorView);
- if (isImageNavigatorVisible)
- imageNavigatorAction->setChecked(true);
+ QObject::connect(imageNavigatorAction, SIGNAL(triggered(bool)), QmitkExtWorkbenchWindowAdvisorHack::undohack, SLOT(onImageNavigator()));
+ imageNavigatorAction->setCheckable(true);
+
+ // add part listener for image navigator
+ imageNavigatorPartListener = new PartListenerForImageNavigator(imageNavigatorAction);
+ window->GetPartService()->AddPartListener(imageNavigatorPartListener);
+ berry::IViewPart::Pointer imageNavigatorView =
+ window->GetActivePage()->FindView("org.mitk.views.imagenavigator");
+ imageNavigatorAction->setChecked(false);
+ if (imageNavigatorView)
+ {
+ bool isImageNavigatorVisible = window->GetActivePage()->IsPartVisible(imageNavigatorView);
+ if (isImageNavigatorVisible)
+ imageNavigatorAction->setChecked(true);
+ }
+ imageNavigatorAction->setToolTip("Open image navigator for navigating through image");
}
- imageNavigatorAction->setToolTip("Open image navigator for navigating through image");
// toolbar for showing file open, undo, redo and other main actions
QToolBar* mainActionsToolBar = new QToolBar;
mainActionsToolBar->setContextMenuPolicy(Qt::PreventContextMenu);
#ifdef __APPLE__
mainActionsToolBar->setToolButtonStyle ( Qt::ToolButtonTextUnderIcon );
#else
mainActionsToolBar->setToolButtonStyle ( Qt::ToolButtonTextBesideIcon );
#endif
mainActionsToolBar->addAction(fileOpenAction);
mainActionsToolBar->addAction(fileSaveProjectAction);
mainActionsToolBar->addAction(closeProjectAction);
mainActionsToolBar->addAction(undoAction);
mainActionsToolBar->addAction(redoAction);
- mainActionsToolBar->addAction(imageNavigatorAction);
+ if (imageNavigatorViewFound)
+ {
+ mainActionsToolBar->addAction(imageNavigatorAction);
+ }
mainWindow->addToolBar(mainActionsToolBar);
#ifdef __APPLE__
mainWindow->setUnifiedTitleAndToolBarOnMac(true);
#endif
// ==== Window Menu ==========================
QMenu* windowMenu = menuBar->addMenu("Window");
windowMenu->addAction("&New Window",
QmitkExtWorkbenchWindowAdvisorHack::undohack, SLOT(onNewWindow()));
windowMenu->addSeparator();
QMenu* perspMenu = windowMenu->addMenu("&Open Perspective");
QMenu* viewMenu = windowMenu->addMenu("Show &View");
viewMenu->setObjectName("Show View");
windowMenu->addSeparator();
resetPerspAction = windowMenu->addAction("&Reset Perspective",
QmitkExtWorkbenchWindowAdvisorHack::undohack, SLOT(onResetPerspective()));
closePerspAction = windowMenu->addAction("&Close Perspective",
QmitkExtWorkbenchWindowAdvisorHack::undohack, SLOT(onClosePerspective()));
windowMenu->addSeparator();
windowMenu->addAction("&Preferences...",
QmitkExtWorkbenchWindowAdvisorHack::undohack, SLOT(onEditPreferences()),
QKeySequence("CTRL+P"));
// fill perspective menu
berry::IPerspectiveRegistry* perspRegistry =
window->GetWorkbench()->GetPerspectiveRegistry();
QActionGroup* perspGroup = new QActionGroup(menuBar);
std::vector<berry::IPerspectiveDescriptor::Pointer> perspectives(
perspRegistry->GetPerspectives());
bool skip = false;
for (std::vector<berry::IPerspectiveDescriptor::Pointer>::iterator perspIt =
perspectives.begin(); perspIt != perspectives.end(); ++perspIt)
{
// if perspectiveExcludeList is set, it contains the id-strings of perspectives, which
// should not appear as an menu-entry in the perspective menu
if (perspectiveExcludeList.size() > 0)
{
for (unsigned int i=0; i<perspectiveExcludeList.size(); i++)
{
if (perspectiveExcludeList.at(i) == (*perspIt)->GetId())
{
skip = true;
break;
}
}
if (skip)
{
skip = false;
continue;
}
}
QAction* perspAction = new berry::QtOpenPerspectiveAction(window,
*perspIt, perspGroup);
mapPerspIdToAction.insert(std::make_pair((*perspIt)->GetId(), perspAction));
}
perspMenu->addActions(perspGroup->actions());
// sort elements (converting vector to map...)
std::vector<berry::IViewDescriptor::Pointer>::const_iterator iter;
std::map<std::string, berry::IViewDescriptor::Pointer> VDMap;
+ skip = false;
for (iter = viewDescriptors.begin(); iter != viewDescriptors.end(); ++iter)
{
+
+ // if viewExcludeList is set, it contains the id-strings of view, which
+ // should not appear as an menu-entry in the menu
+ if (viewExcludeList.size() > 0)
+ {
+ for (unsigned int i=0; i<viewExcludeList.size(); i++)
+ {
+ if (viewExcludeList.at(i) == (*iter)->GetId())
+ {
+ skip = true;
+ break;
+ }
+ }
+ if (skip)
+ {
+ skip = false;
+ continue;
+ }
+ }
+
if ((*iter)->GetId() == "org.blueberry.ui.internal.introview")
continue;
if ((*iter)->GetId() == "org.mitk.views.imagenavigator")
continue;
+
std::pair<std::string, berry::IViewDescriptor::Pointer> p(
(*iter)->GetLabel(), (*iter));
VDMap.insert(p);
}
// ==================================================
// ==== View Toolbar ==================================
QToolBar* qToolbar = new QToolBar;
std::map<std::string, berry::IViewDescriptor::Pointer>::const_iterator
MapIter;
for (MapIter = VDMap.begin(); MapIter != VDMap.end(); ++MapIter)
{
berry::QtShowViewAction* viewAction = new berry::QtShowViewAction(window,
(*MapIter).second);
viewActions.push_back(viewAction);
viewMenu->addAction(viewAction);
if (showViewToolbar)
{
qToolbar->addAction(viewAction);
}
}
if (showViewToolbar)
{
mainWindow->addToolBar(qToolbar);
}
else
delete qToolbar;
QSettings settings(GetQSettingsFile(), QSettings::IniFormat);
mainWindow->restoreState(settings.value("ToolbarPosition").toByteArray());
// ====================================================
// ===== Help menu ====================================
QMenu* helpMenu = menuBar->addMenu("Help");
helpMenu->addAction("&Welcome",QmitkExtWorkbenchWindowAdvisorHack::undohack, SLOT(onIntro()));
helpMenu->addAction("&Help Contents",QmitkExtWorkbenchWindowAdvisorHack::undohack, SLOT(onHelp()), QKeySequence("F1"));
helpMenu->addAction("&About",QmitkExtWorkbenchWindowAdvisorHack::undohack, SLOT(onAbout()));
// =====================================================
QStatusBar* qStatusBar = new QStatusBar();
//creating a QmitkStatusBar for Output on the QStatusBar and connecting it with the MainStatusBar
QmitkStatusBar *statusBar = new QmitkStatusBar(qStatusBar);
//disabling the SizeGrip in the lower right corner
statusBar->SetSizeGripEnabled(false);
QmitkProgressBar *progBar = new QmitkProgressBar();
qStatusBar->addPermanentWidget(progBar, 0);
progBar->hide();
// progBar->AddStepsToDo(2);
// progBar->Progress(1);
mainWindow->setStatusBar(qStatusBar);
QmitkMemoryUsageIndicatorView* memoryIndicator =
new QmitkMemoryUsageIndicatorView();
qStatusBar->addPermanentWidget(memoryIndicator, 0);
}
void QmitkExtWorkbenchWindowAdvisor::PreWindowOpen()
{
berry::IWorkbenchWindowConfigurer::Pointer configurer = GetWindowConfigurer();
// show the shortcut bar and progress indicator, which are hidden by
// default
//configurer->SetShowPerspectiveBar(true);
//configurer->SetShowFastViewBars(true);
//configurer->SetShowProgressIndicator(true);
// // add the drag and drop support for the editor area
// configurer.addEditorAreaTransfer(EditorInputTransfer.getInstance());
// configurer.addEditorAreaTransfer(ResourceTransfer.getInstance());
// configurer.addEditorAreaTransfer(FileTransfer.getInstance());
// configurer.addEditorAreaTransfer(MarkerTransfer.getInstance());
// configurer.configureEditorAreaDropListener(new EditorAreaDropAdapter(
// configurer.getWindow()));
this->HookTitleUpdateListeners(configurer);
menuPerspectiveListener = new PerspectiveListenerForMenu(this);
configurer->GetWindow()->AddPerspectiveListener(menuPerspectiveListener);
}
//--------------------------------------------------------------------------------
// Ugly hack from here on. Feel free to delete when command framework
// and undo buttons are done.
//--------------------------------------------------------------------------------
QmitkExtWorkbenchWindowAdvisorHack::QmitkExtWorkbenchWindowAdvisorHack() : QObject()
{
}
QmitkExtWorkbenchWindowAdvisorHack::~QmitkExtWorkbenchWindowAdvisorHack()
{
}
void QmitkExtWorkbenchWindowAdvisorHack::onUndo()
{
mitk::UndoModel* model = mitk::UndoController::GetCurrentUndoModel();
if (model)
{
if (mitk::VerboseLimitedLinearUndo* verboseundo = dynamic_cast<mitk::VerboseLimitedLinearUndo*>( model ))
{
mitk::VerboseLimitedLinearUndo::StackDescription descriptions =
verboseundo->GetUndoDescriptions();
if (descriptions.size() >= 1)
{
MITK_INFO << "Undo " << descriptions.front().second;
}
}
model->Undo();
}
else
{
MITK_ERROR << "No undo model instantiated";
}
}
void QmitkExtWorkbenchWindowAdvisorHack::onRedo()
{
mitk::UndoModel* model = mitk::UndoController::GetCurrentUndoModel();
if (model)
{
if (mitk::VerboseLimitedLinearUndo* verboseundo = dynamic_cast<mitk::VerboseLimitedLinearUndo*>( model ))
{
mitk::VerboseLimitedLinearUndo::StackDescription descriptions =
verboseundo->GetRedoDescriptions();
if (descriptions.size() >= 1)
{
MITK_INFO << "Redo " << descriptions.front().second;
}
}
model->Redo();
}
else
{
MITK_ERROR << "No undo model instantiated";
}
}
void QmitkExtWorkbenchWindowAdvisorHack::onImageNavigator()
{
// get ImageNavigatorView
berry::IViewPart::Pointer imageNavigatorView =
berry::PlatformUI::GetWorkbench()->GetActiveWorkbenchWindow()->GetActivePage()->FindView("org.mitk.views.imagenavigator");
if (imageNavigatorView)
{
bool isImageNavigatorVisible = berry::PlatformUI::GetWorkbench()->GetActiveWorkbenchWindow()->GetActivePage()->IsPartVisible(imageNavigatorView);
if (isImageNavigatorVisible)
{
berry::PlatformUI::GetWorkbench()->GetActiveWorkbenchWindow()->GetActivePage()->HideView(imageNavigatorView);
return;
}
}
berry::PlatformUI::GetWorkbench()->GetActiveWorkbenchWindow()->GetActivePage()->ShowView("org.mitk.views.imagenavigator");
//berry::PlatformUI::GetWorkbench()->GetActiveWorkbenchWindow()->GetActivePage()->ResetPerspective();
}
void QmitkExtWorkbenchWindowAdvisorHack::onEditPreferences()
{
QmitkPreferencesDialog _PreferencesDialog(QApplication::activeWindow());
_PreferencesDialog.exec();
}
void QmitkExtWorkbenchWindowAdvisorHack::onQuit()
{
berry::PlatformUI::GetWorkbench()->Close();
}
void QmitkExtWorkbenchWindowAdvisorHack::onResetPerspective()
{
berry::PlatformUI::GetWorkbench()->GetActiveWorkbenchWindow()->GetActivePage()->ResetPerspective();
}
void QmitkExtWorkbenchWindowAdvisorHack::onClosePerspective()
{
berry::IWorkbenchPage::Pointer
page =
berry::PlatformUI::GetWorkbench()->GetActiveWorkbenchWindow()->GetActivePage();
page->ClosePerspective(page->GetPerspective(), true, true);
}
void QmitkExtWorkbenchWindowAdvisorHack::onNewWindow()
{
berry::PlatformUI::GetWorkbench()->OpenWorkbenchWindow(0);
}
void QmitkExtWorkbenchWindowAdvisorHack::onIntro()
{
bool hasIntro =
berry::PlatformUI::GetWorkbench()->GetIntroManager()->HasIntro();
if (!hasIntro)
{
QRegExp reg("(.*)<title>(\\n)*");
QRegExp reg2("(\\n)*</title>(.*)");
QFile file(":/org.mitk.gui.qt.ext/index.html");
file.open(QIODevice::ReadOnly | QIODevice::Text); // Als Text-Datei nur zum Lesen öffnen
QString text = QString(file.readAll());
file.close();
QString title = text;
title.replace(reg, "");
title.replace(reg2, "");
std::cout << title.toStdString() << std::endl;
QMessageBox::information(NULL, title,
text, "Close");
}
else
{
berry::PlatformUI::GetWorkbench()->GetIntroManager()->ShowIntro(
berry::PlatformUI::GetWorkbench()->GetActiveWorkbenchWindow(), false);
}
}
void QmitkExtWorkbenchWindowAdvisorHack::onHelp()
{
berry::QtAssistantUtil::OpenActivePartHelp();
}
void QmitkExtWorkbenchWindowAdvisorHack::onAbout()
{
QmitkAboutDialog* aboutDialog = new QmitkAboutDialog(QApplication::activeWindow(),NULL);
aboutDialog->open();
}
void QmitkExtWorkbenchWindowAdvisor::HookTitleUpdateListeners(
berry::IWorkbenchWindowConfigurer::Pointer configurer)
{
// hook up the listeners to update the window title
titlePartListener = new PartListenerForTitle(this);
titlePerspectiveListener = new PerspectiveListenerForTitle(this);
editorPropertyListener = new berry::PropertyChangeIntAdapter<
QmitkExtWorkbenchWindowAdvisor>(this,
&QmitkExtWorkbenchWindowAdvisor::PropertyChange);
// configurer.getWindow().addPageListener(new IPageListener() {
// public void pageActivated(IWorkbenchPage page) {
// updateTitle(false);
// }
//
// public void pageClosed(IWorkbenchPage page) {
// updateTitle(false);
// }
//
// public void pageOpened(IWorkbenchPage page) {
// // do nothing
// }
// });
configurer->GetWindow()->AddPerspectiveListener(titlePerspectiveListener);
configurer->GetWindow()->GetPartService()->AddPartListener(titlePartListener);
}
std::string QmitkExtWorkbenchWindowAdvisor::ComputeTitle()
{
berry::IWorkbenchWindowConfigurer::Pointer configurer =
GetWindowConfigurer();
berry::IWorkbenchPage::Pointer currentPage =
configurer->GetWindow()->GetActivePage();
berry::IEditorPart::Pointer activeEditor;
if (currentPage)
{
activeEditor = lastActiveEditor.Lock();
}
std::string title;
//TODO Product
// IProduct product = Platform.getProduct();
// if (product != null) {
// title = product.getName();
// }
// instead of the product name, we use a custom variable for now
title = productName + " " + MITK_VERSION_STRING;
if (showVersionInfo)
{
// add version informatioin
QString mitkRevision(MITK_REVISION);
mitkRevision = mitkRevision.left(6) + " (" MITK_REVISION_NAME ")";
QString versions = QString(" (ITK %1.%2.%3 VTK %4.%5.%6 Qt %7 MITK %8)")
.arg(ITK_VERSION_MAJOR).arg(ITK_VERSION_MINOR).arg(ITK_VERSION_PATCH)
.arg(VTK_MAJOR_VERSION).arg(VTK_MINOR_VERSION).arg(VTK_BUILD_VERSION)
.arg(QT_VERSION_STR)
.arg(mitkRevision);
title += versions.toStdString();
}
if (currentPage)
{
if (activeEditor)
{
lastEditorTitle = activeEditor->GetTitleToolTip();
if (!lastEditorTitle.empty())
title = lastEditorTitle + " - " + title;
}
berry::IPerspectiveDescriptor::Pointer persp =
currentPage->GetPerspective();
std::string label = "";
if (persp)
{
label = persp->GetLabel();
}
berry::IAdaptable* input = currentPage->GetInput();
if (input && input != wbAdvisor->GetDefaultPageInput())
{
label = currentPage->GetLabel();
}
if (!label.empty())
{
title = label + " - " + title;
}
}
title += " (Not for use in diagnosis or treatment of patients)";
return title;
}
void QmitkExtWorkbenchWindowAdvisor::RecomputeTitle()
{
berry::IWorkbenchWindowConfigurer::Pointer configurer =
GetWindowConfigurer();
std::string oldTitle = configurer->GetTitle();
std::string newTitle = ComputeTitle();
if (newTitle != oldTitle)
{
configurer->SetTitle(newTitle);
}
}
void QmitkExtWorkbenchWindowAdvisor::UpdateTitle(bool editorHidden)
{
berry::IWorkbenchWindowConfigurer::Pointer configurer =
GetWindowConfigurer();
berry::IWorkbenchWindow::Pointer window = configurer->GetWindow();
berry::IEditorPart::Pointer activeEditor;
berry::IWorkbenchPage::Pointer currentPage = window->GetActivePage();
berry::IPerspectiveDescriptor::Pointer persp;
berry::IAdaptable* input = 0;
if (currentPage)
{
activeEditor = currentPage->GetActiveEditor();
persp = currentPage->GetPerspective();
input = currentPage->GetInput();
}
if (editorHidden)
{
activeEditor = 0;
}
// Nothing to do if the editor hasn't changed
if (activeEditor == lastActiveEditor.Lock() && currentPage == lastActivePage.Lock()
&& persp == lastPerspective.Lock() && input == lastInput)
{
return;
}
if (!lastActiveEditor.Expired())
{
lastActiveEditor.Lock()->RemovePropertyListener(editorPropertyListener);
}
lastActiveEditor = activeEditor;
lastActivePage = currentPage;
lastPerspective = persp;
lastInput = input;
if (activeEditor)
{
activeEditor->AddPropertyListener(editorPropertyListener);
}
RecomputeTitle();
}
void QmitkExtWorkbenchWindowAdvisor::PropertyChange(berry::Object::Pointer /*source*/, int propId)
{
if (propId == berry::IWorkbenchPartConstants::PROP_TITLE)
{
if (!lastActiveEditor.Expired())
{
std::string newTitle = lastActiveEditor.Lock()->GetPartName();
if (lastEditorTitle != newTitle)
{
RecomputeTitle();
}
}
}
}
void QmitkExtWorkbenchWindowAdvisor::SetPerspectiveExcludeList(std::vector<std::string> v)
{
- this->perspectiveExcludeList = v;
+ this->perspectiveExcludeList = v;
}
std::vector<std::string> QmitkExtWorkbenchWindowAdvisor::GetPerspectiveExcludeList()
{
return this->perspectiveExcludeList;
}
+void QmitkExtWorkbenchWindowAdvisor::SetViewExcludeList(std::vector<std::string> v)
+{
+ this->viewExcludeList = v;
+}
+
+std::vector<std::string> QmitkExtWorkbenchWindowAdvisor::GetViewExcludeList()
+{
+ return this->viewExcludeList;
+}
+
void QmitkExtWorkbenchWindowAdvisor::PostWindowClose()
{
berry::IWorkbenchWindow::Pointer window = this->GetWindowConfigurer()->GetWindow();
QMainWindow* mainWindow = static_cast<QMainWindow*> (window->GetShell()->GetControl());
QSettings settings(GetQSettingsFile(), QSettings::IniFormat);
settings.setValue("ToolbarPosition", mainWindow->saveState());
}
QString QmitkExtWorkbenchWindowAdvisor::GetQSettingsFile() const
{
QFileInfo settingsInfo = QmitkCommonExtPlugin::getContext()->getDataFile(QT_SETTINGS_FILENAME);
return settingsInfo.canonicalFilePath();
}
diff --git a/Modules/Bundles/org.mitk.gui.qt.ext/src/QmitkExtWorkbenchWindowAdvisor.h b/Modules/Bundles/org.mitk.gui.qt.ext/src/QmitkExtWorkbenchWindowAdvisor.h
index 639ec8970d..837f80ee64 100644
--- a/Modules/Bundles/org.mitk.gui.qt.ext/src/QmitkExtWorkbenchWindowAdvisor.h
+++ b/Modules/Bundles/org.mitk.gui.qt.ext/src/QmitkExtWorkbenchWindowAdvisor.h
@@ -1,131 +1,135 @@
/*=========================================================================
Program: Medical Imaging & Interaction Toolkit
Language: C++
Date: $Date$
Version: $Revision$
Copyright (c) German Cancer Research Center, Division of Medical and
Biological Informatics. All rights reserved.
See MITKCopyright.txt or http://www.mitk.org/copyright.html for details.
This software is distributed WITHOUT ANY WARRANTY; without even
the implied warranty of MERCHANTABILITY or FITNESS FOR A PARTICULAR
PURPOSE. See the above copyright notices for more information.
=========================================================================*/
#ifndef QMITKEXTWORKBENCHWINDOWADVISOR_H_
#define QMITKEXTWORKBENCHWINDOWADVISOR_H_
#include <berryWorkbenchWindowAdvisor.h>
#include <berryIPartListener.h>
#include <berryIEditorPart.h>
#include <berryIWorkbenchPage.h>
#include <berryWorkbenchAdvisor.h>
#include <org_mitk_gui_qt_ext_Export.h>
#include "QmitkCommonWorkbenchWindowAdvisor.h"
#include <QList>
class QAction;
class QMenu;
class MITK_QT_COMMON_EXT_EXPORT QmitkExtWorkbenchWindowAdvisor : public QmitkCommonWorkbenchWindowAdvisor
{
public:
QmitkExtWorkbenchWindowAdvisor(berry::WorkbenchAdvisor* wbAdvisor,
berry::IWorkbenchWindowConfigurer::Pointer configurer);
berry::ActionBarAdvisor::Pointer CreateActionBarAdvisor(
berry::IActionBarConfigurer::Pointer configurer);
void* CreateEmptyWindowContents(void* parent);
void PostWindowCreate();
void PreWindowOpen();
void PostWindowClose();
void ShowViewToolbar(bool show);
void ShowVersionInfo(bool show);
//TODO should be removed when product support is here
void SetProductName(const std::string& product);
void SetWindowIcon(const std::string& wndIcon);
void SetPerspectiveExcludeList(std::vector<std::string> v);
std::vector<std::string> GetPerspectiveExcludeList();
-
+ void SetViewExcludeList(std::vector<std::string> v);
+ std::vector<std::string> GetViewExcludeList();
private:
/**
* Hooks the listeners needed on the window
*
* @param configurer
*/
void HookTitleUpdateListeners(berry::IWorkbenchWindowConfigurer::Pointer configurer);
std::string ComputeTitle();
void RecomputeTitle();
QString GetQSettingsFile() const;
/**
* Updates the window title. Format will be: [pageInput -]
* [currentPerspective -] [editorInput -] [workspaceLocation -] productName
* @param editorHidden TODO
*/
void UpdateTitle(bool editorHidden);
void PropertyChange(berry::Object::Pointer /*source*/, int propId);
static QString QT_SETTINGS_FILENAME;
berry::IPartListener::Pointer titlePartListener;
berry::IPerspectiveListener::Pointer titlePerspectiveListener;
berry::IPerspectiveListener::Pointer menuPerspectiveListener;
berry::IPartListener::Pointer imageNavigatorPartListener;
berry::IPropertyChangeListener::Pointer editorPropertyListener;
friend struct berry::PropertyChangeIntAdapter<QmitkExtWorkbenchWindowAdvisor>;
friend class PartListenerForTitle;
friend class PerspectiveListenerForTitle;
friend class PerspectiveListenerForMenu;
friend class PartListenerForImageNavigator;
berry::IEditorPart::WeakPtr lastActiveEditor;
berry::IPerspectiveDescriptor::WeakPtr lastPerspective;
berry::IWorkbenchPage::WeakPtr lastActivePage;
std::string lastEditorTitle;
berry::IAdaptable* lastInput;
berry::WorkbenchAdvisor* wbAdvisor;
bool showViewToolbar;
bool showVersionInfo;
std::string productName;
std::string windowIcon;
// stringlist for excluding perspectives from the perspective menu entry (e.g. Welcome Perspective)
std::vector<std::string> perspectiveExcludeList;
+ // stringlist for excluding views from the menu entry
+ std::vector<std::string> viewExcludeList;
+
// maps perspective ids to QAction objects
std::map<std::string, QAction*> mapPerspIdToAction;
// actions which will be enabled/disabled depending on the application state
QList<QAction*> viewActions;
QAction* fileSaveProjectAction;
QAction* closeProjectAction;
QAction* undoAction;
QAction* redoAction;
QAction* imageNavigatorAction;
QAction* resetPerspAction;
QAction* closePerspAction;
};
#endif /*QMITKEXTWORKBENCHWINDOWADVISOR_H_*/
diff --git a/Modules/Bundles/org.mitk.gui.qt.extapplication/files.cmake b/Modules/Bundles/org.mitk.gui.qt.extapplication/files.cmake
index 69f823e5e5..856fec09f8 100644
--- a/Modules/Bundles/org.mitk.gui.qt.extapplication/files.cmake
+++ b/Modules/Bundles/org.mitk.gui.qt.extapplication/files.cmake
@@ -1,52 +1,52 @@
SET(SRC_CPP_FILES
QmitkExtApplication.cpp
QmitkExtAppWorkbenchAdvisor.cpp
)
SET(INTERNAL_CPP_FILES
QmitkExtApplicationPlugin.cpp
QmitkExtDefaultPerspective.cpp
)
SET(MOC_H_FILES
src/QmitkExtApplication.h
src/internal/QmitkExtApplicationPlugin.h
src/internal/QmitkExtDefaultPerspective.h
)
SET(CACHED_RESOURCE_FILES
# 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
plugin.xml
resources/icon_research.xpm
)
SET(QRC_FILES
# uncomment the following line if you want to use Qt resources
resources/QmitkExtApplication.qrc
)
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})
#----------- Qt Help Collection Project -------------#
IF (BLUEBERRY_USE_QT_HELP)
SET(_plugin_qhcp_input "${CMAKE_CURRENT_SOURCE_DIR}/documentation/MitkExtQtHelpCollectionProject.qhcp")
- SET(_plugin_qhcp_output "${CMAKE_CURRENT_BINARY_DIR}/MitkExtQtHelpCollection_${MITK_WC_REVISION_HASH}.qhc")
+ SET(_plugin_qhcp_output "${CMAKE_CURRENT_BINARY_DIR}/MitkExtQtHelpCollection_${MITK_REVISION_ID}.qhc")
ADD_CUSTOM_COMMAND(OUTPUT ${_plugin_qhcp_output}
COMMAND ${QT_COLLECTIONGENERATOR_EXECUTABLE} ${_plugin_qhcp_input} -o ${_plugin_qhcp_output}
DEPENDS ${_plugin_qhcp_input}
)
LIST(APPEND CACHED_RESOURCE_FILES ${_plugin_qhcp_output})
ENDIF()
diff --git a/Modules/Bundles/org.mitk.gui.qt.igttrackingtoolbox/src/internal/QmitkMITKIGTTrackingToolboxView.cpp b/Modules/Bundles/org.mitk.gui.qt.igttrackingtoolbox/src/internal/QmitkMITKIGTTrackingToolboxView.cpp
index 8a56dc4936..38af98605f 100644
--- a/Modules/Bundles/org.mitk.gui.qt.igttrackingtoolbox/src/internal/QmitkMITKIGTTrackingToolboxView.cpp
+++ b/Modules/Bundles/org.mitk.gui.qt.igttrackingtoolbox/src/internal/QmitkMITKIGTTrackingToolboxView.cpp
@@ -1,389 +1,441 @@
/*=========================================================================
Program: Medical Imaging & Interaction Toolkit
Language: C++
Date: $Date$
-Version: $Revision$
-
+Version: $Revision$
+
Copyright (c) German Cancer Research Center, Division of Medical and
Biological Informatics. All rights reserved.
See MITKCopyright.txt or http://www.mitk.org/copyright.html for details.
This software is distributed WITHOUT ANY WARRANTY; without even
the implied warranty of MERCHANTABILITY or FITNESS FOR A PARTICULAR
PURPOSE. See the above copyright notices for more information.
=========================================================================*/
// Blueberry
#include <berryISelectionService.h>
#include <berryIWorkbenchWindow.h>
// Qmitk
#include "QmitkMITKIGTTrackingToolboxView.h"
#include "QmitkStdMultiWidget.h"
// Qt
#include <QMessageBox>
#include <qfiledialog.h>
// MITK
#include <mitkNavigationToolStorageDeserializer.h>
#include <mitkTrackingDeviceSourceConfigurator.h>
#include <mitkTrackingVolumeGenerator.h>
#include <mitkNDITrackingDevice.h>
#include <mitkEllipsoid.h>
#include <mitkNodePredicateNot.h>
#include <mitkNodePredicateProperty.h>
#include <mitkNavigationToolStorageSerializer.h>
// vtk
#include <vtkSphereSource.h>
const std::string QmitkMITKIGTTrackingToolboxView::VIEW_ID = "org.mitk.views.mitkigttrackingtoolbox";
QmitkMITKIGTTrackingToolboxView::QmitkMITKIGTTrackingToolboxView()
: QmitkFunctionality()
, m_Controls( 0 )
, m_MultiWidget( NULL )
{
- m_TrackingTimer = new QTimer(this);
+ m_TrackingTimer = new QTimer(this);
m_tracking = false;
m_logging = false;
m_loggedFrames = 0;
}
QmitkMITKIGTTrackingToolboxView::~QmitkMITKIGTTrackingToolboxView()
{
-
+
}
void QmitkMITKIGTTrackingToolboxView::CreateQtPartControl( QWidget *parent )
{
// build up qt view, unless already done
if ( !m_Controls )
{
// create GUI widgets from the Qt Designer's .ui file
m_Controls = new Ui::QmitkMITKIGTTrackingToolboxViewControls;
m_Controls->setupUi( parent );
-
+
//create connections
connect( m_Controls->m_LoadTools, SIGNAL(clicked()), this, SLOT(OnLoadTools()) );
connect( m_Controls->m_StartTracking, SIGNAL(clicked()), this, SLOT(OnStartTracking()) );
connect( m_Controls->m_StopTracking, SIGNAL(clicked()), this, SLOT(OnStopTracking()) );
connect( m_TrackingTimer, SIGNAL(timeout()), this, SLOT(UpdateTrackingTimer()));
connect( m_Controls->m_ChooseFile, SIGNAL(clicked()), this, SLOT(OnChooseFileClicked()));
connect( m_Controls->m_StartLogging, SIGNAL(clicked()), this, SLOT(StartLogging()));
connect( m_Controls->m_StopLogging, SIGNAL(clicked()), this, SLOT(StopLogging()));
connect( m_Controls->m_configurationWidget, SIGNAL(TrackingDeviceSelectionChanged()), this, SLOT(OnTrackingDeviceChanged()));
connect( m_Controls->m_AutoDetectTools, SIGNAL(clicked()), this, SLOT(OnAutoDetectTools()));
//initialize widgets
m_Controls->m_configurationWidget->EnableAdvancedUserControl(false);
m_Controls->m_TrackingToolsStatusWidget->SetShowPositions(true);
m_Controls->m_TrackingToolsStatusWidget->SetTextAlignment(Qt::AlignLeft);
//initialize tracking volume node
m_TrackingVolumeNode = mitk::DataNode::New();
m_TrackingVolumeNode->SetName("TrackingVolume");
this->GetDataStorage()->Add(m_TrackingVolumeNode);
//initialize buttons
m_Controls->m_StopTracking->setEnabled(false);
+ m_Controls->m_StopLogging->setEnabled(false);
m_Controls->m_AutoDetectTools->setVisible(false); //only visible if tracking device is Aurora
}
}
void QmitkMITKIGTTrackingToolboxView::StdMultiWidgetAvailable (QmitkStdMultiWidget &stdMultiWidget)
{
m_MultiWidget = &stdMultiWidget;
}
void QmitkMITKIGTTrackingToolboxView::StdMultiWidgetNotAvailable()
{
m_MultiWidget = NULL;
}
void QmitkMITKIGTTrackingToolboxView::OnLoadTools()
{
//read in filename
QString filename = QFileDialog::getOpenFileName(NULL,tr("Open Toolfile"), "/", tr("All Files (*.*)")); //later perhaps: tr("Toolfile (*.tfl)"
if (filename.isNull()) return;
-
+
//initialize tool storage
m_toolStorage = mitk::NavigationToolStorage::New();
-
+
//read tool storage from disk
mitk::NavigationToolStorageDeserializer::Pointer myDeserializer = mitk::NavigationToolStorageDeserializer::New(GetDataStorage());
m_toolStorage = myDeserializer->Deserialize(filename.toStdString());
- if (m_toolStorage.IsNull())
- {
- MessageBox(myDeserializer->GetErrorMessage());
- m_toolStorage = NULL;
- return;
+ if (m_toolStorage.IsNull())
+ {
+ MessageBox(myDeserializer->GetErrorMessage());
+ m_toolStorage = NULL;
+ return;
}
//update label
Poco::Path myPath = Poco::Path(filename.toStdString()); //use this to seperate filename from path
QString toolLabel = QString("Loaded Tools: ") + QString::number(m_toolStorage->GetToolCount()) + " Tools from " + myPath.getFileName().c_str();
m_Controls->m_toolLabel->setText(toolLabel);
//update tool preview
m_Controls->m_TrackingToolsStatusWidget->RemoveStatusLabels();
m_Controls->m_TrackingToolsStatusWidget->PreShowTools(m_toolStorage);
}
void QmitkMITKIGTTrackingToolboxView::OnStartTracking()
{
//check if everything is ready to start tracking
if (this->m_toolStorage.IsNull())
{
MessageBox("Error: No Tools Loaded Yet!");
return;
}
else if (this->m_toolStorage->GetToolCount() == 0)
{
MessageBox("Error: No Way To Track Without Tools!");
return;
}
//build the IGT pipeline
mitk::TrackingDeviceSourceConfigurator::Pointer myTrackingDeviceSourceFactory = mitk::TrackingDeviceSourceConfigurator::New(this->m_toolStorage,this->m_Controls->m_configurationWidget->GetTrackingDevice());
m_TrackingDeviceSource = myTrackingDeviceSourceFactory->CreateTrackingDeviceSource(this->m_ToolVisualizationFilter);
-if (m_TrackingDeviceSource.IsNull())
+if (m_TrackingDeviceSource.IsNull())
{
MessageBox(myTrackingDeviceSourceFactory->GetErrorMessage());
return;
}
//initialize tracking
-try
+try
{
m_TrackingDeviceSource->Connect();
m_TrackingDeviceSource->StartTracking();
}
catch (...)
{
MessageBox("Error while starting the tracking device!");
return;
}
m_TrackingTimer->start(1000/(m_Controls->m_UpdateRate->value()));
m_Controls->m_TrackingControlLabel->setText("Status: tracking");
//connect the tool visualization widget
-for(int i=0; i<m_TrackingDeviceSource->GetNumberOfOutputs(); i++)
+for(int i=0; i<m_TrackingDeviceSource->GetNumberOfOutputs(); i++)
{
m_Controls->m_TrackingToolsStatusWidget->AddNavigationData(m_TrackingDeviceSource->GetOutput(i));
}
m_Controls->m_TrackingToolsStatusWidget->ShowStatusLabels();
if (m_Controls->m_ShowToolQuaternions->isChecked()) {m_Controls->m_TrackingToolsStatusWidget->SetShowQuaternions(true);}
else {m_Controls->m_TrackingToolsStatusWidget->SetShowQuaternions(false);}
//disable loading new tools
this->m_Controls->m_LoadTools->setEnabled(false);
this->m_Controls->m_AutoDetectTools->setEnabled(false);
//set configuration finished
this->m_Controls->m_configurationWidget->ConfigurationFinished();
//show tracking volume
if (m_Controls->m_ShowTrackingVolume->isChecked())
{
mitk::TrackingVolumeGenerator::Pointer volumeGenerator = mitk::TrackingVolumeGenerator::New();
volumeGenerator->SetTrackingDeviceType(m_TrackingDeviceSource->GetTrackingDevice()->GetType());
volumeGenerator->Update();
mitk::Surface::Pointer volumeSurface = volumeGenerator->GetOutput();
m_TrackingVolumeNode->SetData(volumeSurface);
m_TrackingVolumeNode->SetOpacity(0.25);
mitk::Color red;
red.SetRed(1);
m_TrackingVolumeNode->SetColor(red);
}
m_tracking = true;
+
+//disable Buttons
m_Controls->m_StopTracking->setEnabled(true);
m_Controls->m_StartTracking->setEnabled(false);
+DisableOptionsButtons();
this->GlobalReinit();
}
void QmitkMITKIGTTrackingToolboxView::OnStopTracking()
{
if (!m_tracking) return;
m_TrackingTimer->stop();
m_TrackingDeviceSource->StopTracking();
m_TrackingDeviceSource->Disconnect();
this->m_Controls->m_configurationWidget->Reset();
m_Controls->m_TrackingControlLabel->setText("Status: stopped");
if (m_logging) StopLogging();
this->m_Controls->m_LoadTools->setEnabled(true);
this->m_Controls->m_AutoDetectTools->setEnabled(true);
m_Controls->m_TrackingToolsStatusWidget->RemoveStatusLabels();
m_Controls->m_TrackingToolsStatusWidget->PreShowTools(m_toolStorage);
m_TrackingVolumeNode->SetData(NULL);
m_tracking = false;
+
+//enable Buttons
m_Controls->m_StopTracking->setEnabled(false);
m_Controls->m_StartTracking->setEnabled(true);
+EnableOptionsButtons();
+
+this->GlobalReinit();
}
void QmitkMITKIGTTrackingToolboxView::OnTrackingDeviceChanged()
{
if (m_Controls->m_configurationWidget->GetTrackingDevice()->GetType() == mitk::NDIAurora)
{m_Controls->m_AutoDetectTools->setVisible(true);}
else
{m_Controls->m_AutoDetectTools->setVisible(false);}
}
void QmitkMITKIGTTrackingToolboxView::OnAutoDetectTools()
{
if (m_Controls->m_configurationWidget->GetTrackingDevice()->GetType() == mitk::NDIAurora)
{
- mitk::NDITrackingDevice::Pointer currentDevice = dynamic_cast<mitk::NDITrackingDevice*>(m_Controls->m_configurationWidget->GetTrackingDevice().GetPointer());
+ mitk::NDITrackingDevice::Pointer currentDevice = dynamic_cast<mitk::NDITrackingDevice*>(m_Controls->m_configurationWidget->GetTrackingDevice().GetPointer());
currentDevice->OpenConnection();
currentDevice->StartTracking();
mitk::NavigationToolStorage::Pointer autoDetectedStorage = mitk::NavigationToolStorage::New();
for (int i=0; i<currentDevice->GetToolCount(); i++)
{
//create a navigation tool with sphere as surface
std::stringstream toolname;
toolname << "AutoDetectedTool" << i;
mitk::NavigationTool::Pointer newTool = mitk::NavigationTool::New();
newTool->SetSerialNumber(dynamic_cast<mitk::NDIPassiveTool*>(currentDevice->GetTool(i))->GetSerialNumber());
newTool->SetIdentifier(toolname.str());
newTool->SetTrackingDeviceType(mitk::NDIAurora);
mitk::DataNode::Pointer newNode = mitk::DataNode::New();
mitk::Ellipsoid::Pointer mySphere = mitk::Ellipsoid::New();
vtkSphereSource *vtkData = vtkSphereSource::New();
vtkData->SetRadius(3.0f);
vtkData->SetCenter(0.0, 0.0, 0.0);
vtkData->Update();
mySphere->SetVtkPolyData(vtkData->GetOutput());
vtkData->Delete();
newNode->SetData(mySphere);
newNode->SetName(toolname.str());
newTool->SetDataNode(newNode);
this->GetDataStorage()->Add(newNode);
//add tool to navigation tool storage
autoDetectedStorage->AddTool(newTool);
}
//save detected tools
m_toolStorage = autoDetectedStorage;
//update label
QString toolLabel = QString("Loaded Tools: ") + QString::number(m_toolStorage->GetToolCount()) + " Tools (Auto Detected)";
m_Controls->m_toolLabel->setText(toolLabel);
//update tool preview
m_Controls->m_TrackingToolsStatusWidget->RemoveStatusLabels();
m_Controls->m_TrackingToolsStatusWidget->PreShowTools(m_toolStorage);
currentDevice->StopTracking();
currentDevice->CloseConnection();
if (m_toolStorage->GetToolCount()>0)
{
//ask the user if he wants to save the detected tools
QMessageBox msgBox;
msgBox.setText("Found " + QString::number(m_toolStorage->GetToolCount()) + " tools!");
msgBox.setInformativeText("Do you want to save this tools as tool storage, so you can load them again?");
msgBox.setStandardButtons(QMessageBox::Yes | QMessageBox::No);
msgBox.setDefaultButton(QMessageBox::No);
int ret = msgBox.exec();
if (ret == 16384) //yes
{
//ask the user for a filename
QString fileName = QFileDialog::getSaveFileName(NULL, tr("Save File"),"",tr("*.*"));
mitk::NavigationToolStorageSerializer::Pointer mySerializer = mitk::NavigationToolStorageSerializer::New();
if (!mySerializer->Serialize(fileName.toStdString(),m_toolStorage)) MessageBox(mySerializer->GetErrorMessage());
return;
}
else if (ret == 65536) //no
{
return;
}
}
- }
+ }
}
void QmitkMITKIGTTrackingToolboxView::MessageBox(std::string s)
{
QMessageBox msgBox;
msgBox.setText(s.c_str());
msgBox.exec();
}
void QmitkMITKIGTTrackingToolboxView::UpdateTrackingTimer()
{
m_ToolVisualizationFilter->Update();
mitk::RenderingManager::GetInstance()->RequestUpdateAll();
- if (m_logging)
+ if (m_logging)
{
this->m_loggingFilter->Update();
m_loggedFrames = this->m_loggingFilter->GetRecordCounter();
this->m_Controls->m_LoggedFramesLabel->setText("Logged Frames: "+QString::number(m_loggedFrames));
//check if logging stopped automatically
- if((m_loggedFrames>1)&&(!m_loggingFilter->GetRecording()))
- {
- m_Controls->m_LoggingLabel->setText("Logging OFF");
- m_logging = false;
- }
+ if((m_loggedFrames>1)&&(!m_loggingFilter->GetRecording())){StopLogging();}
}
m_Controls->m_TrackingToolsStatusWidget->Refresh();
}
void QmitkMITKIGTTrackingToolboxView::OnChooseFileClicked()
{
QString filename = QFileDialog::getSaveFileName(NULL,tr("Choose Logging File"), "/", "*.*");
this->m_Controls->m_LoggingFileName->setText(filename);
}
void QmitkMITKIGTTrackingToolboxView::StartLogging()
{
- //initialize logging filter
- m_loggingFilter = mitk::NavigationDataRecorder::New();
- m_loggingFilter->SetRecordingMode(mitk::NavigationDataRecorder::NormalFile);
- if (m_Controls->m_xmlFormat->isChecked()) m_loggingFilter->SetOutputFormat(mitk::NavigationDataRecorder::xml);
- else if (m_Controls->m_csvFormat->isChecked()) m_loggingFilter->SetOutputFormat(mitk::NavigationDataRecorder::csv);
- m_loggingFilter->SetFileName(m_Controls->m_LoggingFileName->text().toStdString().c_str());
- if (m_Controls->m_LoggingLimit->isChecked()){m_loggingFilter->SetRecordCountLimit(m_Controls->m_LoggedFramesLimit->value());}
-
- //connect filter
- for(int i=0; i<m_ToolVisualizationFilter->GetNumberOfOutputs(); i++){m_loggingFilter->AddNavigationData(m_ToolVisualizationFilter->GetOutput(i));}
-
- //start filter
- m_loggingFilter->StartRecording();
-
- //update labels / logging variables
- this->m_Controls->m_LoggingLabel->setText("Logging ON");
- this->m_Controls->m_LoggedFramesLabel->setText("Logged Frames: 0");
- m_loggedFrames = 0;
- m_logging = true;
+ if (!m_logging)
+ {
+ //initialize logging filter
+ m_loggingFilter = mitk::NavigationDataRecorder::New();
+ m_loggingFilter->SetRecordingMode(mitk::NavigationDataRecorder::NormalFile);
+ if (m_Controls->m_xmlFormat->isChecked()) m_loggingFilter->SetOutputFormat(mitk::NavigationDataRecorder::xml);
+ else if (m_Controls->m_csvFormat->isChecked()) m_loggingFilter->SetOutputFormat(mitk::NavigationDataRecorder::csv);
+ m_loggingFilter->SetFileName(m_Controls->m_LoggingFileName->text().toStdString().c_str());
+ if (m_Controls->m_LoggingLimit->isChecked()){m_loggingFilter->SetRecordCountLimit(m_Controls->m_LoggedFramesLimit->value());}
+
+ //connect filter
+ for(int i=0; i<m_ToolVisualizationFilter->GetNumberOfOutputs(); i++){m_loggingFilter->AddNavigationData(m_ToolVisualizationFilter->GetOutput(i));}
+
+ //start filter
+ m_loggingFilter->StartRecording();
+
+ //update labels / logging variables
+ this->m_Controls->m_LoggingLabel->setText("Logging ON");
+ this->m_Controls->m_LoggedFramesLabel->setText("Logged Frames: 0");
+ m_loggedFrames = 0;
+ m_logging = true;
+ DisableLoggingButtons();
+ }
}
void QmitkMITKIGTTrackingToolboxView::StopLogging()
{
- //update label
- this->m_Controls->m_LoggingLabel->setText("Logging OFF");
+ if (m_logging)
+ {
+ //update label
+ this->m_Controls->m_LoggingLabel->setText("Logging OFF");
- m_loggingFilter->StopRecording();
- m_logging = false;
+ m_loggingFilter->StopRecording();
+ m_logging = false;
+ EnableLoggingButtons();
+ }
}
void QmitkMITKIGTTrackingToolboxView::GlobalReinit()
{
// get all nodes that have not set "includeInBoundingBox" to false
mitk::NodePredicateNot::Pointer pred = mitk::NodePredicateNot::New(mitk::NodePredicateProperty::New("includeInBoundingBox", mitk::BoolProperty::New(false)));
mitk::DataStorage::SetOfObjects::ConstPointer rs = this->GetDataStorage()->GetSubset(pred);
// calculate bounding geometry of these nodes
mitk::TimeSlicedGeometry::Pointer bounds = this->GetDataStorage()->ComputeBoundingGeometry3D(rs, "visible");
// initialize the views to the bounding geometry
mitk::RenderingManager::GetInstance()->InitializeViews(bounds);
}
+void QmitkMITKIGTTrackingToolboxView::DisableLoggingButtons()
+{
+ m_Controls->m_StartLogging->setEnabled(false);
+ m_Controls->m_LoggingFileName->setEnabled(false);
+ m_Controls->m_ChooseFile->setEnabled(false);
+ m_Controls->m_LoggingLimit->setEnabled(false);
+ m_Controls->m_LoggedFramesLimit->setEnabled(false);
+ m_Controls->m_csvFormat->setEnabled(false);
+ m_Controls->m_xmlFormat->setEnabled(false);
+ m_Controls->m_StopLogging->setEnabled(true);
+}
+
+void QmitkMITKIGTTrackingToolboxView::EnableLoggingButtons()
+{
+ m_Controls->m_StartLogging->setEnabled(true);
+ m_Controls->m_LoggingFileName->setEnabled(true);
+ m_Controls->m_ChooseFile->setEnabled(true);
+ m_Controls->m_LoggingLimit->setEnabled(true);
+ m_Controls->m_LoggedFramesLimit->setEnabled(true);
+ m_Controls->m_csvFormat->setEnabled(true);
+ m_Controls->m_xmlFormat->setEnabled(true);
+ m_Controls->m_StopLogging->setEnabled(false);
+}
+
+void QmitkMITKIGTTrackingToolboxView::DisableOptionsButtons()
+{
+ m_Controls->m_ShowTrackingVolume->setEnabled(false);
+ m_Controls->m_UpdateRate->setEnabled(false);
+ m_Controls->m_ShowToolQuaternions->setEnabled(false);
+ m_Controls->m_OptionsUpdateRateLabel->setEnabled(false);
+}
+
+void QmitkMITKIGTTrackingToolboxView::EnableOptionsButtons()
+{
+ m_Controls->m_ShowTrackingVolume->setEnabled(true);
+ m_Controls->m_UpdateRate->setEnabled(true);
+ m_Controls->m_ShowToolQuaternions->setEnabled(true);
+ m_Controls->m_OptionsUpdateRateLabel->setEnabled(true);
+}
diff --git a/Modules/Bundles/org.mitk.gui.qt.igttrackingtoolbox/src/internal/QmitkMITKIGTTrackingToolboxView.h b/Modules/Bundles/org.mitk.gui.qt.igttrackingtoolbox/src/internal/QmitkMITKIGTTrackingToolboxView.h
index 3c704bc3f1..93b334563d 100644
--- a/Modules/Bundles/org.mitk.gui.qt.igttrackingtoolbox/src/internal/QmitkMITKIGTTrackingToolboxView.h
+++ b/Modules/Bundles/org.mitk.gui.qt.igttrackingtoolbox/src/internal/QmitkMITKIGTTrackingToolboxView.h
@@ -1,121 +1,127 @@
/*=========================================================================
Program: Medical Imaging & Interaction Toolkit
Language: C++
Date: $Date$
Version: $Revision$
Copyright (c) German Cancer Research Center, Division of Medical and
Biological Informatics. All rights reserved.
See MITKCopyright.txt or http://www.mitk.org/copyright.html for details.
This software is distributed WITHOUT ANY WARRANTY; without even
the implied warranty of MERCHANTABILITY or FITNESS FOR A PARTICULAR
PURPOSE. See the above copyright notices for more information.
=========================================================================*/
#ifndef QmitkMITKIGTTrackingToolboxView_h
#define QmitkMITKIGTTrackingToolboxView_h
#include <berryISelectionListener.h>
#include <QmitkFunctionality.h>
#include "ui_QmitkMITKIGTTrackingToolboxViewControls.h"
//mitk headers
#include <mitkNavigationToolStorage.h>
#include <mitkTrackingDeviceSource.h>
#include <mitkNavigationDataObjectVisualizationFilter.h>
#include <mitkNavigationDataRecorder.h>
//QT headers
#include <QTimer>
/*!
\brief QmitkMITKIGTTrackingToolboxView
\warning This application module is not yet documented. Use "svn blame/praise/annotate" and ask the author to provide basic documentation.
\sa QmitkFunctionality
\ingroup Functionalities
*/
class QmitkMITKIGTTrackingToolboxView : public QmitkFunctionality
{
// 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;
QmitkMITKIGTTrackingToolboxView();
QmitkMITKIGTTrackingToolboxView(const QmitkMITKIGTTrackingToolboxView& other)
- {
- Q_UNUSED(other)
- throw std::runtime_error("Copy constructor not implemented");
- }
+ {
+ Q_UNUSED(other)
+ throw std::runtime_error("Copy constructor not implemented");
+ }
virtual ~QmitkMITKIGTTrackingToolboxView();
virtual void CreateQtPartControl(QWidget *parent);
virtual void StdMultiWidgetAvailable (QmitkStdMultiWidget &stdMultiWidget);
virtual void StdMultiWidgetNotAvailable();
protected slots:
- void OnLoadTools();
+ void OnLoadTools();
- void OnStartTracking();
+ void OnStartTracking();
- void OnStopTracking();
+ void OnStopTracking();
void OnChooseFileClicked();
void StartLogging();
void StopLogging();
void OnTrackingDeviceChanged();
void OnAutoDetectTools();
/** @brief Slot for tracking timer */
void UpdateTrackingTimer();
protected:
Ui::QmitkMITKIGTTrackingToolboxViewControls* m_Controls;
QmitkStdMultiWidget* m_MultiWidget;
bool m_tracking;
- void MessageBox(std::string s);
+ void MessageBox(std::string s);
bool m_logging;
int m_loggedFrames;
mitk::DataNode::Pointer m_TrackingVolumeNode;
void GlobalReinit();
- //stores the loaded tools
- mitk::NavigationToolStorage::Pointer m_toolStorage;
+ //stores the loaded tools
+ mitk::NavigationToolStorage::Pointer m_toolStorage;
- //members for the filter pipeline
- mitk::TrackingDeviceSource::Pointer m_TrackingDeviceSource;
- mitk::NavigationDataObjectVisualizationFilter::Pointer m_ToolVisualizationFilter;
- mitk::NavigationDataRecorder::Pointer m_loggingFilter;
+ //members for the filter pipeline
+ mitk::TrackingDeviceSource::Pointer m_TrackingDeviceSource;
+ mitk::NavigationDataObjectVisualizationFilter::Pointer m_ToolVisualizationFilter;
+ mitk::NavigationDataRecorder::Pointer m_loggingFilter;
- QTimer* m_TrackingTimer;
+ QTimer* m_TrackingTimer;
+
+ //help methods for enable/disable buttons
+ void DisableLoggingButtons();
+ void EnableLoggingButtons();
+ void DisableOptionsButtons();
+ void EnableOptionsButtons();
};
-#endif // _QMITKMITKIGTTRACKINGTOOLBOXVIEW_H_INCLUDED
+#endif // _QMITKMITKIGTTRACKINGTOOLBOXVIEW_H_INCLUDED
\ No newline at end of file
diff --git a/Modules/Bundles/org.mitk.gui.qt.igttrackingtoolbox/src/internal/QmitkMITKIGTTrackingToolboxViewControls.ui b/Modules/Bundles/org.mitk.gui.qt.igttrackingtoolbox/src/internal/QmitkMITKIGTTrackingToolboxViewControls.ui
index d4228214f6..0637d36613 100644
--- a/Modules/Bundles/org.mitk.gui.qt.igttrackingtoolbox/src/internal/QmitkMITKIGTTrackingToolboxViewControls.ui
+++ b/Modules/Bundles/org.mitk.gui.qt.igttrackingtoolbox/src/internal/QmitkMITKIGTTrackingToolboxViewControls.ui
@@ -1,485 +1,485 @@
<?xml version="1.0" encoding="UTF-8"?>
<ui version="4.0">
<class>QmitkMITKIGTTrackingToolboxViewControls</class>
<widget class="QWidget" name="QmitkMITKIGTTrackingToolboxViewControls">
<property name="geometry">
<rect>
<x>0</x>
<y>0</y>
<width>335</width>
<height>685</height>
</rect>
</property>
<property name="minimumSize">
<size>
<width>0</width>
<height>0</height>
</size>
</property>
<property name="windowTitle">
<string>QmitkTemplate</string>
</property>
<layout class="QVBoxLayout" name="verticalLayout_3">
<item>
<widget class="QTabWidget" name="m_MainWidget">
<property name="currentIndex">
<number>0</number>
</property>
<widget class="QWidget" name="tab">
<attribute name="title">
<string>Tracking</string>
</attribute>
<layout class="QVBoxLayout" name="verticalLayout_5">
<item>
<widget class="QGroupBox" name="groupBox_3">
<property name="minimumSize">
<size>
<width>0</width>
<height>280</height>
</size>
</property>
<property name="maximumSize">
<size>
<width>16777215</width>
<height>280</height>
</size>
</property>
<property name="title">
<string/>
</property>
<layout class="QVBoxLayout" name="verticalLayout_4">
<item>
<widget class="QmitkTrackingDeviceConfigurationWidget" name="m_configurationWidget" native="true"/>
</item>
</layout>
</widget>
</item>
<item>
<widget class="QGroupBox" name="groupBox">
<property name="title">
<string/>
</property>
<layout class="QVBoxLayout" name="verticalLayout">
<item>
<widget class="QLabel" name="label_2">
<property name="text">
<string>&lt;!DOCTYPE HTML PUBLIC &quot;-//W3C//DTD HTML 4.0//EN&quot; &quot;http://www.w3.org/TR/REC-html40/strict.dtd&quot;&gt;
&lt;html&gt;&lt;head&gt;&lt;meta name=&quot;qrichtext&quot; content=&quot;1&quot; /&gt;&lt;style type=&quot;text/css&quot;&gt;
p, li { white-space: pre-wrap; }
&lt;/style&gt;&lt;/head&gt;&lt;body style=&quot; font-family:'MS Shell Dlg 2'; font-size:8.25pt; font-weight:400; font-style:normal;&quot;&gt;
&lt;p style=&quot; margin-top:0px; margin-bottom:0px; margin-left:0px; margin-right:0px; -qt-block-indent:0; text-indent:0px;&quot;&gt;&lt;span style=&quot; font-size:14pt; font-weight:600;&quot;&gt;Tracking Tools&lt;/span&gt;&lt;/p&gt;&lt;/body&gt;&lt;/html&gt;</string>
</property>
</widget>
</item>
<item>
<layout class="QHBoxLayout" name="horizontalLayout_8">
<item>
<widget class="QLabel" name="m_toolLabel">
<property name="text">
<string>Loaded Tools: &lt;none&gt;</string>
</property>
</widget>
</item>
<item>
<spacer name="horizontalSpacer_7">
<property name="orientation">
<enum>Qt::Horizontal</enum>
</property>
<property name="sizeHint" stdset="0">
<size>
<width>40</width>
<height>20</height>
</size>
</property>
</spacer>
</item>
<item>
<widget class="QPushButton" name="m_AutoDetectTools">
<property name="text">
<string>Auto Detection</string>
</property>
</widget>
</item>
</layout>
</item>
<item>
<widget class="QmitkToolTrackingStatusWidget" name="m_TrackingToolsStatusWidget" native="true"/>
</item>
<item>
<widget class="QLabel" name="label_4">
<property name="text">
<string>&lt;!DOCTYPE HTML PUBLIC &quot;-//W3C//DTD HTML 4.0//EN&quot; &quot;http://www.w3.org/TR/REC-html40/strict.dtd&quot;&gt;
&lt;html&gt;&lt;head&gt;&lt;meta name=&quot;qrichtext&quot; content=&quot;1&quot; /&gt;&lt;style type=&quot;text/css&quot;&gt;
p, li { white-space: pre-wrap; }
&lt;/style&gt;&lt;/head&gt;&lt;body style=&quot; font-family:'MS Shell Dlg 2'; font-size:8.25pt; font-weight:400; font-style:normal;&quot;&gt;
&lt;p align=&quot;center&quot; style=&quot; margin-top:0px; margin-bottom:0px; margin-left:0px; margin-right:0px; -qt-block-indent:0; text-indent:0px;&quot;&gt;&lt;span style=&quot; font-size:8pt; font-style:italic;&quot;&gt;(only load tool storage files which can be created &lt;/span&gt;&lt;/p&gt;
&lt;p align=&quot;center&quot; style=&quot; margin-top:0px; margin-bottom:0px; margin-left:0px; margin-right:0px; -qt-block-indent:0; text-indent:0px;&quot;&gt;&lt;span style=&quot; font-size:8pt; font-style:italic;&quot;&gt;with the bundle &amp;quot;NavigationToolManager&amp;quot;)&lt;/span&gt;&lt;/p&gt;&lt;/body&gt;&lt;/html&gt;</string>
</property>
<property name="alignment">
<set>Qt::AlignJustify|Qt::AlignVCenter</set>
</property>
</widget>
</item>
<item>
<layout class="QHBoxLayout" name="horizontalLayout">
<item>
<spacer name="horizontalSpacer">
<property name="orientation">
<enum>Qt::Horizontal</enum>
</property>
<property name="sizeHint" stdset="0">
<size>
<width>40</width>
<height>20</height>
</size>
</property>
</spacer>
</item>
<item>
<widget class="QPushButton" name="m_LoadTools">
<property name="text">
<string>Load Tools</string>
</property>
</widget>
</item>
</layout>
</item>
</layout>
</widget>
</item>
<item>
<widget class="QGroupBox" name="groupBox_2">
<property name="title">
<string/>
</property>
<layout class="QVBoxLayout" name="verticalLayout_2">
<item>
<widget class="QLabel" name="label_3">
<property name="text">
<string>&lt;!DOCTYPE HTML PUBLIC &quot;-//W3C//DTD HTML 4.0//EN&quot; &quot;http://www.w3.org/TR/REC-html40/strict.dtd&quot;&gt;
&lt;html&gt;&lt;head&gt;&lt;meta name=&quot;qrichtext&quot; content=&quot;1&quot; /&gt;&lt;style type=&quot;text/css&quot;&gt;
p, li { white-space: pre-wrap; }
&lt;/style&gt;&lt;/head&gt;&lt;body style=&quot; font-family:'MS Shell Dlg 2'; font-size:8.25pt; font-weight:400; font-style:normal;&quot;&gt;
&lt;p style=&quot; margin-top:0px; margin-bottom:0px; margin-left:0px; margin-right:0px; -qt-block-indent:0; text-indent:0px;&quot;&gt;&lt;span style=&quot; font-size:14pt; font-weight:600;&quot;&gt;Tracking Control&lt;/span&gt;&lt;/p&gt;&lt;/body&gt;&lt;/html&gt;</string>
</property>
</widget>
</item>
<item>
<widget class="QLabel" name="m_TrackingControlLabel">
<property name="text">
<string>Status: &lt;not configured&gt;</string>
</property>
</widget>
</item>
<item>
<layout class="QHBoxLayout" name="horizontalLayout_2">
<item>
<spacer name="horizontalSpacer_2">
<property name="orientation">
<enum>Qt::Horizontal</enum>
</property>
<property name="sizeHint" stdset="0">
<size>
<width>40</width>
<height>20</height>
</size>
</property>
</spacer>
</item>
<item>
<widget class="QPushButton" name="m_StartTracking">
<property name="text">
<string>Start Tracking</string>
</property>
</widget>
</item>
</layout>
</item>
<item>
<layout class="QHBoxLayout" name="horizontalLayout_3">
<item>
<spacer name="horizontalSpacer_3">
<property name="orientation">
<enum>Qt::Horizontal</enum>
</property>
<property name="sizeHint" stdset="0">
<size>
<width>40</width>
<height>20</height>
</size>
</property>
</spacer>
</item>
<item>
<widget class="QPushButton" name="m_StopTracking">
<property name="text">
<string>Stop Tracking</string>
</property>
</widget>
</item>
</layout>
</item>
</layout>
</widget>
</item>
<item>
<spacer name="verticalSpacer">
<property name="orientation">
<enum>Qt::Vertical</enum>
</property>
<property name="sizeHint" stdset="0">
<size>
<width>20</width>
<height>40</height>
</size>
</property>
</spacer>
</item>
</layout>
</widget>
<widget class="QWidget" name="tab_2">
<attribute name="title">
<string>Options</string>
</attribute>
<layout class="QVBoxLayout" name="verticalLayout_7">
<item>
<widget class="QCheckBox" name="m_ShowTrackingVolume">
<property name="text">
<string>Show Tracking Volume</string>
</property>
<property name="checked">
<bool>true</bool>
</property>
</widget>
</item>
<item>
<layout class="QHBoxLayout" name="horizontalLayout_6">
<item>
- <widget class="QLabel" name="label_5">
+ <widget class="QLabel" name="m_OptionsUpdateRateLabel">
<property name="text">
<string>Update Rate (Times Per Second)</string>
</property>
</widget>
</item>
<item>
<spacer name="horizontalSpacer_5">
<property name="orientation">
<enum>Qt::Horizontal</enum>
</property>
<property name="sizeHint" stdset="0">
<size>
<width>40</width>
<height>20</height>
</size>
</property>
</spacer>
</item>
<item>
<widget class="QSpinBox" name="m_UpdateRate">
<property name="maximum">
<number>999</number>
</property>
<property name="value">
<number>10</number>
</property>
</widget>
</item>
</layout>
</item>
<item>
<widget class="QCheckBox" name="m_ShowToolQuaternions">
<property name="text">
<string>Show Tool Quaternions</string>
</property>
</widget>
</item>
<item>
<spacer name="verticalSpacer_3">
<property name="orientation">
<enum>Qt::Vertical</enum>
</property>
<property name="sizeHint" stdset="0">
<size>
<width>20</width>
<height>597</height>
</size>
</property>
</spacer>
</item>
</layout>
</widget>
<widget class="QWidget" name="tab_3">
<attribute name="title">
<string>Logging</string>
</attribute>
<layout class="QVBoxLayout" name="verticalLayout_8">
<item>
<layout class="QHBoxLayout" name="horizontalLayout_4">
<item>
<widget class="QLabel" name="label">
<property name="text">
<string>Filename:</string>
</property>
</widget>
</item>
<item>
<widget class="QLineEdit" name="m_LoggingFileName">
<property name="text">
<string>C:/logfile.csv</string>
</property>
</widget>
</item>
<item>
<widget class="QPushButton" name="m_ChooseFile">
<property name="text">
<string>Choose File</string>
</property>
</widget>
</item>
</layout>
</item>
<item>
<layout class="QHBoxLayout" name="horizontalLayout_7">
<item>
<widget class="QCheckBox" name="m_LoggingLimit">
<property name="text">
<string>Limit Number Of Logged Frames:</string>
</property>
</widget>
</item>
<item>
<spacer name="horizontalSpacer_6">
<property name="orientation">
<enum>Qt::Horizontal</enum>
</property>
<property name="sizeHint" stdset="0">
<size>
<width>40</width>
<height>20</height>
</size>
</property>
</spacer>
</item>
<item>
<widget class="QSpinBox" name="m_LoggedFramesLimit">
<property name="minimum">
<number>1</number>
</property>
<property name="maximum">
<number>9999</number>
</property>
<property name="value">
<number>300</number>
</property>
</widget>
</item>
</layout>
</item>
<item>
<widget class="QRadioButton" name="m_csvFormat">
<property name="text">
<string>CSV format</string>
</property>
<property name="checked">
<bool>true</bool>
</property>
</widget>
</item>
<item>
<widget class="QRadioButton" name="m_xmlFormat">
<property name="text">
<string>XML format</string>
</property>
</widget>
</item>
<item>
<widget class="QGroupBox" name="groupBox_4">
<property name="title">
<string>Logging Status</string>
</property>
<layout class="QVBoxLayout" name="verticalLayout_6">
<item>
<widget class="QLabel" name="m_LoggingLabel">
<property name="text">
<string>Logging OFF</string>
</property>
</widget>
</item>
<item>
<widget class="QLabel" name="m_LoggedFramesLabel">
<property name="text">
<string>Logged Frames: 0</string>
</property>
</widget>
</item>
</layout>
</widget>
</item>
<item>
<layout class="QHBoxLayout" name="horizontalLayout_5">
<item>
<spacer name="horizontalSpacer_4">
<property name="orientation">
<enum>Qt::Horizontal</enum>
</property>
<property name="sizeHint" stdset="0">
<size>
<width>40</width>
<height>20</height>
</size>
</property>
</spacer>
</item>
<item>
<widget class="QPushButton" name="m_StartLogging">
<property name="text">
<string>Start Logging</string>
</property>
</widget>
</item>
<item>
<widget class="QPushButton" name="m_StopLogging">
<property name="text">
<string>Stop Logging</string>
</property>
</widget>
</item>
</layout>
</item>
<item>
<spacer name="verticalSpacer_2">
<property name="orientation">
<enum>Qt::Vertical</enum>
</property>
<property name="sizeHint" stdset="0">
<size>
<width>20</width>
<height>40</height>
</size>
</property>
</spacer>
</item>
</layout>
</widget>
</widget>
</item>
</layout>
</widget>
<layoutdefault spacing="6" margin="11"/>
<customwidgets>
<customwidget>
<class>QmitkTrackingDeviceConfigurationWidget</class>
<extends>QWidget</extends>
<header>QmitkTrackingDeviceConfigurationWidget.h</header>
<container>1</container>
</customwidget>
<customwidget>
<class>QmitkToolTrackingStatusWidget</class>
<extends>QWidget</extends>
<header>QmitkToolTrackingStatusWidget.h</header>
<container>1</container>
</customwidget>
</customwidgets>
<resources/>
<connections/>
</ui>
diff --git a/Modules/Bundles/org.mitk.gui.qt.igttutorial/CMakeLists.txt b/Modules/Bundles/org.mitk.gui.qt.igttutorial/CMakeLists.txt
index 7401239daf..7a7e70bc82 100644
--- a/Modules/Bundles/org.mitk.gui.qt.igttutorial/CMakeLists.txt
+++ b/Modules/Bundles/org.mitk.gui.qt.igttutorial/CMakeLists.txt
@@ -1 +1,9 @@
-MACRO_CREATE_MITK_PLUGIN(QmitkExt MitkIGT)
+# The project name must correspond to the directory name of your plug-in
+# and must not contain periods.
+PROJECT(org_mitk_gui_qt_igttutorial)
+
+MACRO_CREATE_MITK_CTK_PLUGIN(
+ EXPORT_DIRECTIVE IGTTUTORIAL_EXPORT
+ EXPORTED_INCLUDE_SUFFIXES src
+ MODULE_DEPENDENCIES QmitkExt MitkIGT
+)
\ No newline at end of file
diff --git a/Modules/Bundles/org.mitk.gui.qt.igttutorial/META-INF/MANIFEST.MF b/Modules/Bundles/org.mitk.gui.qt.igttutorial/META-INF/MANIFEST.MF
deleted file mode 100644
index 409b249241..0000000000
--- a/Modules/Bundles/org.mitk.gui.qt.igttutorial/META-INF/MANIFEST.MF
+++ /dev/null
@@ -1,7 +0,0 @@
-Manifest-Version: 1.0
-Bundle-Name: Image Guided Therapy Tutorial
-Bundle-SymbolicName: org.mitk.gui.qt.igttutorial
-Bundle-Version: 0.1
-Bundle-Vendor: DKFZ, Medical and Biological Informatics
-Require-Bundle: org.mitk.gui.qt.common
-Bundle-Activator:
diff --git a/Modules/Bundles/org.mitk.gui.qt.igttutorial/files.cmake b/Modules/Bundles/org.mitk.gui.qt.igttutorial/files.cmake
index 5de20f3dd5..c2f98cc6e0 100644
--- a/Modules/Bundles/org.mitk.gui.qt.igttutorial/files.cmake
+++ b/Modules/Bundles/org.mitk.gui.qt.igttutorial/files.cmake
@@ -1,35 +1,38 @@
SET(SRC_CPP_FILES
-
+
)
SET(INTERNAL_CPP_FILES
QmitkImageGuidedTherapyTutorialView.cpp
-
+ mitkPluginActivator.cpp
)
SET(UI_FILES
src/internal/QmitkImageGuidedTherapyTutorialViewControls.ui
)
SET(MOC_H_FILES
src/internal/QmitkImageGuidedTherapyTutorialView.h
+ src/internal/mitkPluginActivator.h
)
-SET(RES_FILES
+SET(QRC_FILES
#resources/QmitkImageGuidedTherapyTutorialView.qrc
)
-SET(RESOURCE_FILES
+SET(CACHED_RESOURCE_FILES
resources/ImageGuidedTherapyTutorial.png
+ plugin.xml
)
-SET(CPP_FILES manifest.cpp)
+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/Modules/Bundles/org.mitk.gui.qt.igttutorial/manifest.cpp b/Modules/Bundles/org.mitk.gui.qt.igttutorial/manifest.cpp
deleted file mode 100644
index f6ddfa89c2..0000000000
--- a/Modules/Bundles/org.mitk.gui.qt.igttutorial/manifest.cpp
+++ /dev/null
@@ -1,26 +0,0 @@
-/*=========================================================================
-
-Program: Medical Imaging & Interaction Toolkit
-Language: C++
-Date: $Date: 2009-03-21 19:27:37 +0100 (Sa, 21 Mrz 2009) $
-Version: $Revision: 16719 $
-
-Copyright (c) German Cancer Research Center, Division of Medical and
-Biological Informatics. All rights reserved.
-See MITKCopyright.txt or http://www.mitk.org/copyright.html for details.
-
-This software is distributed WITHOUT ANY WARRANTY; without even
-the implied warranty of MERCHANTABILITY or FITNESS FOR A PARTICULAR
-PURPOSE. See the above copyright notices for more information.
-
-=========================================================================*/
-
-#include <Poco/ClassLibrary.h>
-
-#include <berryIViewPart.h>
-#include "src/internal/QmitkImageGuidedTherapyTutorialView.h"
-
-
-POCO_BEGIN_NAMED_MANIFEST(berryIViewPart, berry::IViewPart)
- POCO_EXPORT_CLASS(::QmitkImageGuidedTherapyTutorialView)
-POCO_END_MANIFEST
diff --git a/Modules/Bundles/org.mitk.gui.qt.igttutorial/manifest_headers.cmake b/Modules/Bundles/org.mitk.gui.qt.igttutorial/manifest_headers.cmake
new file mode 100644
index 0000000000..fb0aae7bc3
--- /dev/null
+++ b/Modules/Bundles/org.mitk.gui.qt.igttutorial/manifest_headers.cmake
@@ -0,0 +1,5 @@
+set(Plugin-Name "MITK-IGT Tutorial")
+set(Plugin-Version "0.1")
+set(Plugin-Vendor "DKFZ, Medical and Biological Informatics")
+set(Plugin-ContactAddress "http://www.mitk.org")
+set(Require-Plugin org.mitk.gui.qt.common)
\ No newline at end of file
diff --git a/Modules/Bundles/org.mitk.gui.qt.igttutorial/plugin.xml b/Modules/Bundles/org.mitk.gui.qt.igttutorial/plugin.xml
index 23e331c17f..707dc4b8b6 100644
--- a/Modules/Bundles/org.mitk.gui.qt.igttutorial/plugin.xml
+++ b/Modules/Bundles/org.mitk.gui.qt.igttutorial/plugin.xml
@@ -1,11 +1,11 @@
<?xml version="1.0" encoding="UTF-8"?>
<plugin>
-
+
<extension point="org.blueberry.ui.views">
- <view id="org.mitk.views.imageguidedtherapytutorial"
+ <view id="org.mitk.views.igttutorial"
name="Image Guided Therapy Tutorial"
- class="::QmitkImageGuidedTherapyTutorialView"
+ class="QmitkImageGuidedTherapyTutorialView"
icon="resources/ImageGuidedTherapyTutorial.png"/>
</extension>
-</plugin>
+</plugin>
\ No newline at end of file
diff --git a/Modules/Bundles/org.mitk.gui.qt.igttutorial/src/IgttutorialDll.h b/Modules/Bundles/org.mitk.gui.qt.igttutorial/src/IgttutorialDll.h
deleted file mode 100644
index 1d07b09d52..0000000000
--- a/Modules/Bundles/org.mitk.gui.qt.igttutorial/src/IgttutorialDll.h
+++ /dev/null
@@ -1,43 +0,0 @@
-/*=========================================================================
-
-Program: Medical Imaging & Interaction Toolkit
-Language: C++
-Date: $Date: 2009-03-21 19:27:37 +0100 (Sa, 21 Mrz 2009) $
-Version: $Revision: 16719 $
-
-Copyright (c) German Cancer Research Center, Division of Medical and
-Biological Informatics. All rights reserved.
-See MITKCopyright.txt or http://www.mitk.org/copyright.html for details.
-
-This software is distributed WITHOUT ANY WARRANTY; without even
-the implied warranty of MERCHANTABILITY or FITNESS FOR A PARTICULAR
-PURPOSE. See the above copyright notices for more information.
-
-=========================================================================*/
-
-#ifndef _IGTTUTORIAL_EXPORT_DLL_H_
-#define _IGTTUTORIAL_EXPORT_DLL_H_
-
-
-//
-// The following block is the standard way of creating macros which make exporting
-// from a DLL simpler. All files within this DLL are compiled with the org_mitk_gui_qt_igttutorial_EXPORTS
-// symbol defined on the command line. this symbol should not be defined on any project
-// that uses this DLL. This way any other project whose source files include this file see
-// org_mitk_gui_qt_igttutorial_EXPORTS functions as being imported from a DLL, wheras this DLL sees symbols
-// defined with this macro as being exported.
-//
-#if defined(_WIN32) && !defined(MITK_STATIC)
- #if defined(org_mitk_gui_qt_igttutorial_EXPORTS)
- #define IGTTUTORIAL_EXPORT __declspec(dllexport)
- #else
- #define IGTTUTORIAL_EXPORT __declspec(dllimport)
- #endif
-#endif
-
-
-#if !defined(IGTTUTORIAL_EXPORT)
- #define IGTTUTORIAL_EXPORT
-#endif
-
-#endif /*_IGTTUTORIAL_EXPORT_DLL_H_*/
diff --git a/Modules/Bundles/org.mitk.gui.qt.igttutorial/src/internal/QmitkImageGuidedTherapyTutorialView.h b/Modules/Bundles/org.mitk.gui.qt.igttutorial/src/internal/QmitkImageGuidedTherapyTutorialView.h
index 916109cadd..edaf5a00c9 100644
--- a/Modules/Bundles/org.mitk.gui.qt.igttutorial/src/internal/QmitkImageGuidedTherapyTutorialView.h
+++ b/Modules/Bundles/org.mitk.gui.qt.igttutorial/src/internal/QmitkImageGuidedTherapyTutorialView.h
@@ -1,102 +1,106 @@
/*=========================================================================
Program: Medical Imaging & Interaction Toolkit
Language: C++
Date: $Date: 2009-03-21 19:27:37 +0100 (Sa, 21 Mrz 2009) $
-Version: $Revision: 16719 $
-
+Version: $Revision: 16719 $
+
Copyright (c) German Cancer Research Center, Division of Medical and
Biological Informatics. All rights reserved.
See MITKCopyright.txt or http://www.mitk.org/copyright.html for details.
This software is distributed WITHOUT ANY WARRANTY; without even
the implied warranty of MERCHANTABILITY or FITNESS FOR A PARTICULAR
PURPOSE. See the above copyright notices for more information.
=========================================================================*/
#ifndef _QMITKIMAGEGUIDEDTHERAPYTUTORIALVIEW_H_INCLUDED
#define _QMITKIMAGEGUIDEDTHERAPYTUTORIALVIEW_H_INCLUDED
#include <QmitkFunctionality.h>
#include <string>
#include "ui_QmitkImageGuidedTherapyTutorialViewControls.h"
-#include "../IgttutorialDll.h"
+//#include "../IgttutorialDll.h"
#include "mitkTrackingDeviceSource.h"
#include "mitkNavigationDataObjectVisualizationFilter.h"
/**
* \brief QmitkIGTTutorial shows a small typically navigation MITK functionality.
*
-* Any kind of navigation application will start with the connection to a tracking system
+* Any kind of navigation application will start with the connection to a tracking system
* and as we do image guided procedures we want to show something on the screen. In this
* tutorial we connect to the NDI Polaris tracking system (or alternatively use a virtual tracking device)
* and we will show the movement of a tool as cone in the StdMultiWidget editor.
-*
-* \sa also take a look at the CMakeLists.txt of this functionality to see how to
+*
+* \sa also take a look at the CMakeLists.txt of this functionality to see how to
* link to the mitkIGT library.
* \sa QmitkFunctionality
* \ingroup Functionalities
*/
-class IGTTUTORIAL_EXPORT QmitkImageGuidedTherapyTutorialView : public QmitkFunctionality
-{
+class QmitkImageGuidedTherapyTutorialView : public QmitkFunctionality
+{
// this is needed for all Qt objects that should have a MOC object (everything that derives from QObject)
Q_OBJECT
-
- public:
+
+ public:
static const std::string VIEW_ID;
QmitkImageGuidedTherapyTutorialView();
+ QmitkImageGuidedTherapyTutorialView(const QmitkImageGuidedTherapyTutorialView& other)
+ {
+ Q_UNUSED(other)
+ throw std::runtime_error("Copy constructor not implemented");
+ }
virtual ~QmitkImageGuidedTherapyTutorialView();
virtual void CreateQtPartControl(QWidget *parent);
- /// \brief Creation of the connections of main and control widget
+ /// \brief Creation of the connections of main and control widget
virtual void CreateConnections();
/// \brief Called when the functionality is activated
virtual void Activated();
-
+
virtual void Deactivated();
virtual void StdMultiWidgetAvailable (QmitkStdMultiWidget &stdMultiWidget);
virtual void StdMultiWidgetNotAvailable();
-protected slots:
-
+protected slots:
+
/**
* \brief Execute MITK-IGT Tutorial
*/
void OnStartIGT();
/**
* \brief stop IGT scene and clean up
*/
void OnStopIGT();
/**
* \brief timer based update of IGT scene
*/
void OnTimer();
-
-protected:
-
+
+protected:
+
Ui::QmitkImageGuidedTherapyTutorialViewControls* m_Controls;
QmitkStdMultiWidget* m_MultiWidget; ///< our display widget
mitk::TrackingDeviceSource::Pointer m_Source; ///< source filer that connects to the tracking device
mitk::NavigationDataObjectVisualizationFilter::Pointer m_Visualizer; ///< visualization filter uses output from m_Source
QTimer* m_Timer; ///< timer for continuous tracking update
};
#endif // _QMITKIMAGEGUIDEDTHERAPYTUTORIALVIEW_H_INCLUDED
-
diff --git a/Modules/Bundles/org.mitk.gui.qt.igttutorial/src/internal/mitkPluginActivator.cpp b/Modules/Bundles/org.mitk.gui.qt.igttutorial/src/internal/mitkPluginActivator.cpp
new file mode 100644
index 0000000000..be634101a5
--- /dev/null
+++ b/Modules/Bundles/org.mitk.gui.qt.igttutorial/src/internal/mitkPluginActivator.cpp
@@ -0,0 +1,20 @@
+#include "mitkPluginActivator.h"
+#include "QmitkImageGuidedTherapyTutorialView.h"
+
+#include <QtPlugin>
+
+namespace mitk {
+
+void PluginActivator::start(ctkPluginContext* context)
+{
+ BERRY_REGISTER_EXTENSION_CLASS(QmitkImageGuidedTherapyTutorialView, context)
+}
+
+void PluginActivator::stop(ctkPluginContext* context)
+{
+ Q_UNUSED(context)
+}
+
+}
+
+Q_EXPORT_PLUGIN2(org_mitk_gui_qt_igttutorial, mitk::PluginActivator)
\ No newline at end of file
diff --git a/Modules/Bundles/org.mitk.gui.qt.igttutorial/src/internal/mitkPluginActivator.h b/Modules/Bundles/org.mitk.gui.qt.igttutorial/src/internal/mitkPluginActivator.h
new file mode 100644
index 0000000000..70c968b98e
--- /dev/null
+++ b/Modules/Bundles/org.mitk.gui.qt.igttutorial/src/internal/mitkPluginActivator.h
@@ -0,0 +1,23 @@
+#ifndef MITKPLUGINACTIVATOR_H
+#define MITKPLUGINACTIVATOR_H
+
+#include <ctkPluginActivator.h>
+
+namespace mitk {
+
+class PluginActivator :
+ public QObject, public ctkPluginActivator
+{
+ Q_OBJECT
+ Q_INTERFACES(ctkPluginActivator)
+
+public:
+
+ void start(ctkPluginContext* context);
+ void stop(ctkPluginContext* context);
+
+}; // PluginActivator
+
+}
+
+#endif // MITKPLUGINACTIVATOR_H
\ No newline at end of file
diff --git a/Modules/Bundles/org.mitk.gui.qt.imagecropper/CMakeLists.txt b/Modules/Bundles/org.mitk.gui.qt.imagecropper/CMakeLists.txt
index d1fae30ab7..3116697747 100644
--- a/Modules/Bundles/org.mitk.gui.qt.imagecropper/CMakeLists.txt
+++ b/Modules/Bundles/org.mitk.gui.qt.imagecropper/CMakeLists.txt
@@ -1 +1,12 @@
-MACRO_CREATE_MITK_PLUGIN(QmitkExt)
+PROJECT(org_mitk_gui_qt_imagecropper)
+
+MACRO_CREATE_MITK_CTK_PLUGIN(
+ EXPORT_DIRECTIVE MITK_QT_IMAGECROPPER
+ EXPORTED_INCLUDE_SUFFIXES src
+ MODULE_DEPENDENCIES QmitkExt
+)
+
+
+
+
+#MACRO_CREATE_MITK_PLUGIN(QmitkExt)
diff --git a/Modules/Bundles/org.mitk.gui.qt.imagecropper/META-INF/MANIFEST.MF b/Modules/Bundles/org.mitk.gui.qt.imagecropper/META-INF/MANIFEST.MF
deleted file mode 100644
index 6948e2f65e..0000000000
--- a/Modules/Bundles/org.mitk.gui.qt.imagecropper/META-INF/MANIFEST.MF
+++ /dev/null
@@ -1,6 +0,0 @@
-Manifest-Version: 1.0
-Bundle-Name: The Image Cropper Module
-Bundle-SymbolicName: org.mitk.gui.qt.imagecropper
-Bundle-Version: 1.0.0
-Bundle-Vendor: DKFZ, Medical and Biological Informatics
-Require-Bundle: org.mitk.gui.qt.common
\ No newline at end of file
diff --git a/Modules/Bundles/org.mitk.gui.qt.imagecropper/files.cmake b/Modules/Bundles/org.mitk.gui.qt.imagecropper/files.cmake
index cdba01226e..8435af7118 100644
--- a/Modules/Bundles/org.mitk.gui.qt.imagecropper/files.cmake
+++ b/Modules/Bundles/org.mitk.gui.qt.imagecropper/files.cmake
@@ -1,34 +1,37 @@
SET(SRC_CPP_FILES
)
SET(INTERNAL_CPP_FILES
+ mitkImageCropperPluginActivator.cpp
QmitkImageCropper.cpp
mitkImageCropperEventInterface.cpp
)
SET(UI_FILES
src/internal/QmitkImageCropperControls.ui
)
SET(MOC_H_FILES
+ src/internal/mitkImageCropperPluginActivator.h
src/internal/QmitkImageCropper.h
)
-SET(RESOURCE_FILES
+SET(CACHED_RESOURCE_FILES
resources/icon.xpm
+ plugin.xml
)
-SET(RES_FILES
+SET(QRC_FILES
resources/imagecropper.qrc
)
-SET(CPP_FILES manifest.cpp)
+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/Modules/Bundles/org.mitk.gui.qt.imagecropper/manifest.cpp b/Modules/Bundles/org.mitk.gui.qt.imagecropper/manifest.cpp
deleted file mode 100644
index e89c48b593..0000000000
--- a/Modules/Bundles/org.mitk.gui.qt.imagecropper/manifest.cpp
+++ /dev/null
@@ -1,25 +0,0 @@
-/*=========================================================================
-
-Program: Medical Imaging & Interaction Toolkit
-Language: C++
-Date: $Date$
-Version: $Revision: 18127 $
-
-Copyright (c) German Cancer Research Center, Division of Medical and
-Biological Informatics. All rights reserved.
-See MITKCopyright.txt or http://www.mitk.org/copyright.html for details.
-
-This software is distributed WITHOUT ANY WARRANTY; without even
-the implied warranty of MERCHANTABILITY or FITNESS FOR A PARTICULAR
-PURPOSE. See the above copyright notices for more information.
-
-=========================================================================*/
-
-#include <Poco/ClassLibrary.h>
-
-#include <berryIViewPart.h>
-#include "src/internal/QmitkImageCropper.h"
-
-POCO_BEGIN_NAMED_MANIFEST(berryIViewPart, berry::IViewPart)
- POCO_EXPORT_CLASS(QmitkImageCropper)
-POCO_END_MANIFEST
diff --git a/Modules/Bundles/org.mitk.gui.qt.imagecropper/manifest_headers.cmake b/Modules/Bundles/org.mitk.gui.qt.imagecropper/manifest_headers.cmake
new file mode 100644
index 0000000000..d84781834d
--- /dev/null
+++ b/Modules/Bundles/org.mitk.gui.qt.imagecropper/manifest_headers.cmake
@@ -0,0 +1,5 @@
+set(Plugin-Name "The Image Cropper Module")
+set(Plugin-Version "1.0.0")
+set(Plugin-Vendor "DKFZ, Medical and Biological Informatics")
+set(Plugin-ContactAddress "http://www.mitk.org")
+set(Require-Plugin org.mitk.gui.qt.common)
\ No newline at end of file
diff --git a/Modules/Bundles/org.mitk.gui.qt.imagecropper/plugin.xml b/Modules/Bundles/org.mitk.gui.qt.imagecropper/plugin.xml
index 7db6fcd6a5..38c0158df5 100644
--- a/Modules/Bundles/org.mitk.gui.qt.imagecropper/plugin.xml
+++ b/Modules/Bundles/org.mitk.gui.qt.imagecropper/plugin.xml
@@ -1,17 +1,18 @@
<?xml version="1.0" encoding="UTF-8"?>
<?eclipse version="3.0"?>
+
<plugin>
<extension point="org.blueberry.ui.views">
<category
id="org.mitk.views.general"
name="MITK General"/>
<view
id="org.mitk.views.imagecropper"
name="Image Cropper"
category="org.mitk.views.general"
icon="resources/icon.xpm"
class="QmitkImageCropper" />
</extension>
</plugin>
diff --git a/Modules/Bundles/org.mitk.gui.qt.imagecropper/src/QmitkImageCropperDll.h b/Modules/Bundles/org.mitk.gui.qt.imagecropper/src/QmitkImageCropperDll.h
deleted file mode 100644
index 1ae6e3ee67..0000000000
--- a/Modules/Bundles/org.mitk.gui.qt.imagecropper/src/QmitkImageCropperDll.h
+++ /dev/null
@@ -1,41 +0,0 @@
-/*=========================================================================
-
-Program: Medical Imaging & Interaction Toolkit
-Language: C++
-Date: $Date$
-Version: $Revision: 18127 $
-
-Copyright (c) German Cancer Research Center, Division of Medical and
-Biological Informatics. All rights reserved.
-See MITKCopyright.txt or http://www.mitk.org/copyright.html for details.
-
-This software is distributed WITHOUT ANY WARRANTY; without even
-the implied warranty of MERCHANTABILITY or FITNESS FOR A PARTICULAR
-PURPOSE. See the above copyright notices for more information.
-
-=========================================================================*/
-
-#ifndef QMITKIMAGECROPPERDLL_H_
-#define QMITKIMAGECROPPERDLL_H_
-
-//
-// The following block is the standard way of creating macros which make exporting
-// from a DLL simpler. All files within this DLL are compiled with the org_mitk_gui_qt_application_EXPORTS
-// symbol defined on the command line. this symbol should not be defined on any project
-// that uses this DLL. This way any other project whose source files include this file see
-// MITK_QT_APP functions as being imported from a DLL, wheras this DLL sees symbols
-// defined with this macro as being exported.
-//
-#if defined(_WIN32) && !defined(BERRY_STATIC)
- #if defined(org_mitk_gui_qt_imagecropper_EXPORTS)
- #define MITK_QT_IMAGECROPPER __declspec(dllexport)
- #else
- #define MITK_QT_IMAGECROPPER __declspec(dllimport)
- #endif
-#endif
-
-#if !defined(MITK_QT_IMAGECROPPER)
- #define MITK_QT_IMAGECROPPER
-#endif
-
-#endif /*QMITKIMAGECROPPERDLL_H_*/
diff --git a/Modules/Bundles/org.mitk.gui.qt.imagecropper/src/internal/mitkImageCropperPluginActivator.cpp b/Modules/Bundles/org.mitk.gui.qt.imagecropper/src/internal/mitkImageCropperPluginActivator.cpp
new file mode 100644
index 0000000000..b880d903f1
--- /dev/null
+++ b/Modules/Bundles/org.mitk.gui.qt.imagecropper/src/internal/mitkImageCropperPluginActivator.cpp
@@ -0,0 +1,20 @@
+#include "mitkImageCropperPluginActivator.h"
+#include "QmitkImageCropper.h"
+
+#include <QtPlugin>
+
+namespace mitk {
+
+void ImageCropperPluginActivator::start(ctkPluginContext* context)
+{
+ BERRY_REGISTER_EXTENSION_CLASS( QmitkImageCropper, context )
+}
+
+void ImageCropperPluginActivator::stop(ctkPluginContext* context)
+{
+ Q_UNUSED(context)
+}
+
+}
+
+Q_EXPORT_PLUGIN2(org_mitk_gui_qt_imagecropper, mitk::ImageCropperPluginActivator)
\ No newline at end of file
diff --git a/Modules/Bundles/org.mitk.gui.qt.imagecropper/src/internal/mitkImageCropperPluginActivator.h b/Modules/Bundles/org.mitk.gui.qt.imagecropper/src/internal/mitkImageCropperPluginActivator.h
new file mode 100644
index 0000000000..d1b1bc334f
--- /dev/null
+++ b/Modules/Bundles/org.mitk.gui.qt.imagecropper/src/internal/mitkImageCropperPluginActivator.h
@@ -0,0 +1,23 @@
+#ifndef MITKPLUGINACTIVATOR_H
+#define MITKPLUGINACTIVATOR_H
+
+#include <ctkPluginActivator.h>
+
+namespace mitk {
+
+class ImageCropperPluginActivator :
+ public QObject, public ctkPluginActivator
+{
+ Q_OBJECT
+ Q_INTERFACES(ctkPluginActivator)
+
+public:
+
+ void start(ctkPluginContext* context);
+ void stop(ctkPluginContext* context);
+
+}; // PluginActivator
+
+}
+
+#endif // MITKPLUGINACTIVATOR_H
\ No newline at end of file
diff --git a/Modules/Bundles/org.mitk.gui.qt.imagenavigator/src/internal/QmitkImageNavigatorView.cpp b/Modules/Bundles/org.mitk.gui.qt.imagenavigator/src/internal/QmitkImageNavigatorView.cpp
index 288715b689..5eba27d2f0 100644
--- a/Modules/Bundles/org.mitk.gui.qt.imagenavigator/src/internal/QmitkImageNavigatorView.cpp
+++ b/Modules/Bundles/org.mitk.gui.qt.imagenavigator/src/internal/QmitkImageNavigatorView.cpp
@@ -1,181 +1,176 @@
/*=========================================================================
-
-Program: Medical Imaging & Interaction Toolkit
-Language: C++
-Date: $Date$
-Version: $Revision: 17495 $
-
Copyright (c) German Cancer Research Center, Division of Medical and
Biological Informatics. All rights reserved.
See MITKCopyright.txt or http://www.mitk.org/copyright.html for details.
This software is distributed WITHOUT ANY WARRANTY; without even
the implied warranty of MERCHANTABILITY or FITNESS FOR A PARTICULAR
PURPOSE. See the above copyright notices for more information.
=========================================================================*/
#include "QmitkImageNavigatorView.h"
#include "mitkNodePredicateDataType.h"
#include "QmitkDataStorageComboBox.h"
#include "QmitkStdMultiWidget.h"
#include "mitkDataStorageEditorInput.h"
// berry Includes
#include <berryPlatform.h>
#include <berryIWorkbenchPage.h>
#include <berryConstants.h>
#include <QMessageBox>
const std::string QmitkImageNavigatorView::VIEW_ID = "org.mitk.views.imagenavigator";
class ImageNavigatorPartListener : public berry::IPartListener
{
public:
ImageNavigatorPartListener(QmitkImageNavigatorView* view)
: m_View(view)
{}
berry::IPartListener::Events::Types GetPartEventTypes() const
{
return berry::IPartListener::Events::OPENED |
berry::IPartListener::Events::CLOSED;
}
void PartClosed(berry::IWorkbenchPartReference::Pointer partRef)
{
- m_View->SetMultiWidget(0);
+ if((partRef->GetId() == QmitkImageNavigatorView::VIEW_ID) || (partRef->GetId() == QmitkStdMultiWidgetEditor::EDITOR_ID))
+ {
+ m_View->SetMultiWidget(0);
+ }
}
void PartOpened(berry::IWorkbenchPartReference::Pointer partRef)
{
if (partRef->GetId() == QmitkStdMultiWidgetEditor::EDITOR_ID)
{
- if (partRef->GetId() == QmitkStdMultiWidgetEditor::EDITOR_ID)
+ if (QmitkStdMultiWidgetEditor::Pointer multiWidgetPart =
+ partRef->GetPart(false).Cast<QmitkStdMultiWidgetEditor>())
+ {
+ m_View->SetMultiWidget(multiWidgetPart->GetStdMultiWidget());
+ }
+ else
{
- if (QmitkStdMultiWidgetEditor::Pointer multiWidgetPart =
- partRef->GetPart(false).Cast<QmitkStdMultiWidgetEditor>())
- {
- m_View->SetMultiWidget(multiWidgetPart->GetStdMultiWidget());
- }
- else
- {
- m_View->SetMultiWidget(0);
- }
+ m_View->SetMultiWidget(0);
}
}
}
private:
QmitkImageNavigatorView* m_View;
};
QmitkImageNavigatorView::QmitkImageNavigatorView()
-: m_MultiWidget(NULL)
+ : m_MultiWidget(NULL)
{
multiWidgetListener = new ImageNavigatorPartListener(this);
}
QmitkImageNavigatorView::~QmitkImageNavigatorView()
{
this->GetSite()->GetPage()->RemovePartListener(multiWidgetListener);
- //delete m_TransversalStepper;
- //delete m_SagittalStepper;
- //delete m_FrontalStepper;
- //delete m_TimeStepper;
}
void QmitkImageNavigatorView::CreateQtPartControl(QWidget *parent)
{
// create GUI widgets
m_Controls.setupUi(parent);
m_MultiWidget = this->GetActiveStdMultiWidget();
m_Controls.m_SliceNavigatorTransversal->SetInverseDirection(true);
m_TransversalStepper = new QmitkStepperAdapter(m_Controls.m_SliceNavigatorTransversal, m_MultiWidget->mitkWidget1->GetSliceNavigationController()->GetSlice() , "sliceNavigatorTransversalFromSimpleExample");
m_SagittalStepper = new QmitkStepperAdapter(m_Controls.m_SliceNavigatorSagittal, m_MultiWidget->mitkWidget2->GetSliceNavigationController()->GetSlice(), "sliceNavigatorSagittalFromSimpleExample");
m_FrontalStepper = new QmitkStepperAdapter(m_Controls.m_SliceNavigatorFrontal, m_MultiWidget->mitkWidget3->GetSliceNavigationController()->GetSlice(), "sliceNavigatorFrontalFromSimpleExample");
m_TimeStepper = new QmitkStepperAdapter(m_Controls.m_SliceNavigatorTime, m_MultiWidget->GetTimeNavigationController()->GetTime(), "sliceNavigatorTimeFromSimpleExample");
this->GetSite()->GetPage()->AddPartListener(multiWidgetListener);
}
void QmitkImageNavigatorView::SetFocus ()
{
}
void QmitkImageNavigatorView::SetMultiWidget(QmitkStdMultiWidget* multiWidget)
{
m_MultiWidget = multiWidget;
if (m_MultiWidget)
{
- m_TransversalStepper->SetStepper(m_MultiWidget->mitkWidget1->GetSliceNavigationController()->GetSlice());
- m_SagittalStepper->SetStepper(m_MultiWidget->mitkWidget2->GetSliceNavigationController()->GetSlice());
- m_FrontalStepper->SetStepper(m_MultiWidget->mitkWidget3->GetSliceNavigationController()->GetSlice());
- m_TimeStepper->SetStepper(m_MultiWidget->GetTimeNavigationController()->GetTime());
+ m_TransversalStepper->deleteLater();
+ m_SagittalStepper->deleteLater();
+ m_FrontalStepper->deleteLater();
+ m_TimeStepper->deleteLater();
+
+ m_TransversalStepper = new QmitkStepperAdapter(m_Controls.m_SliceNavigatorTransversal, m_MultiWidget->mitkWidget1->GetSliceNavigationController()->GetSlice() , "sliceNavigatorTransversalFromSimpleExample");
+ m_SagittalStepper = new QmitkStepperAdapter(m_Controls.m_SliceNavigatorSagittal, m_MultiWidget->mitkWidget2->GetSliceNavigationController()->GetSlice(), "sliceNavigatorSagittalFromSimpleExample");
+ m_FrontalStepper = new QmitkStepperAdapter(m_Controls.m_SliceNavigatorFrontal, m_MultiWidget->mitkWidget3->GetSliceNavigationController()->GetSlice(), "sliceNavigatorFrontalFromSimpleExample");
+ m_TimeStepper = new QmitkStepperAdapter(m_Controls.m_SliceNavigatorTime, m_MultiWidget->GetTimeNavigationController()->GetTime(), "sliceNavigatorTimeFromSimpleExample");
}
else
{
m_TransversalStepper->SetStepper(0);
m_SagittalStepper->SetStepper(0);
m_FrontalStepper->SetStepper(0);
m_TimeStepper->SetStepper(0);
}
}
QmitkStdMultiWidget* QmitkImageNavigatorView::GetActiveStdMultiWidget()
{
QmitkStdMultiWidget* activeStdMultiWidget = 0;
berry::IEditorPart::Pointer editor =
- this->GetSite()->GetPage()->GetActiveEditor();
+ this->GetSite()->GetPage()->GetActiveEditor();
if (editor.Cast<QmitkStdMultiWidgetEditor>().IsNotNull())
{
activeStdMultiWidget = editor.Cast<QmitkStdMultiWidgetEditor>()->GetStdMultiWidget();
}
else
{
mitk::DataStorageEditorInput::Pointer editorInput;
editorInput = new mitk::DataStorageEditorInput();
berry::IEditorPart::Pointer editor = this->GetSite()->GetPage()->OpenEditor(editorInput, QmitkStdMultiWidgetEditor::EDITOR_ID, false);
activeStdMultiWidget = editor.Cast<QmitkStdMultiWidgetEditor>()->GetStdMultiWidget();
}
return activeStdMultiWidget;
}
int QmitkImageNavigatorView::GetSizeFlags(bool width)
{
if(!width)
{
return berry::Constants::MIN | berry::Constants::MAX | berry::Constants::FILL;
}
else
{
return 0;
}
}
int QmitkImageNavigatorView::ComputePreferredSize(bool width, int /*availableParallel*/, int /*availablePerpendicular*/, int preferredResult)
{
if(width==false)
{
return 160;
}
else
{
return preferredResult;
}
}
diff --git a/Modules/Bundles/org.mitk.gui.qt.imagestatistics/CMakeLists.txt b/Modules/Bundles/org.mitk.gui.qt.imagestatistics/CMakeLists.txt
index 8b366ec0a6..88a3aa635c 100644
--- a/Modules/Bundles/org.mitk.gui.qt.imagestatistics/CMakeLists.txt
+++ b/Modules/Bundles/org.mitk.gui.qt.imagestatistics/CMakeLists.txt
@@ -1,2 +1,9 @@
+# The project name must correspond to the directory name of your plug-in
+# and must not contain periods.
+PROJECT(org_mitk_gui_qt_imagestatistics)
-MACRO_CREATE_MITK_PLUGIN(QmitkExt PlanarFigure)
+MACRO_CREATE_MITK_CTK_PLUGIN(
+ EXPORT_DIRECTIVE IMAGESTATISTICS_EXPORT
+ EXPORTED_INCLUDE_SUFFIXES src
+ MODULE_DEPENDENCIES QmitkExt PlanarFigure
+)
\ No newline at end of file
diff --git a/Modules/Bundles/org.mitk.gui.qt.imagestatistics/META-INF/MANIFEST.MF b/Modules/Bundles/org.mitk.gui.qt.imagestatistics/META-INF/MANIFEST.MF
deleted file mode 100644
index 37c1f96e34..0000000000
--- a/Modules/Bundles/org.mitk.gui.qt.imagestatistics/META-INF/MANIFEST.MF
+++ /dev/null
@@ -1,7 +0,0 @@
-Manifest-Version: 1.0
-Bundle-Name: Image Statistics
-Bundle-SymbolicName: org.mitk.gui.qt.imagestatistics
-Bundle-Version: 0.1
-Bundle-Vendor: DKFZ, Medical and Biological Informatics
-Require-Bundle: org.mitk.gui.qt.common
-Bundle-Activator:
diff --git a/Modules/Bundles/org.mitk.gui.qt.imagestatistics/files.cmake b/Modules/Bundles/org.mitk.gui.qt.imagestatistics/files.cmake
index 5866196472..435c14747d 100644
--- a/Modules/Bundles/org.mitk.gui.qt.imagestatistics/files.cmake
+++ b/Modules/Bundles/org.mitk.gui.qt.imagestatistics/files.cmake
@@ -1,37 +1,37 @@
SET(SRC_CPP_FILES
)
SET(INTERNAL_CPP_FILES
QmitkImageStatisticsView.cpp
-
+ mitkImageStatisticsPluginActivator.cpp
)
SET(UI_FILES
src/internal/QmitkImageStatisticsViewControls.ui
)
SET(MOC_H_FILES
+ src/internal/mitkImageStatisticsPluginActivator.h
src/internal/QmitkImageStatisticsView.h
)
-SET(RESOURCE_FILES
+SET(CACHED_RESOURCE_FILES
resources/stats.png
resources/ImageStatistic_24.png
+ plugin.xml
)
-SET(RES_FILES
+SET(QRC_FILES
# uncomment the following line if you want to use Qt resources
resources/QmitkImageStatisticsView.qrc
)
-SET(CPP_FILES manifest.cpp)
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})
-
+endforeach(file ${INTERNAL_CPP_FILES})
\ No newline at end of file
diff --git a/Modules/Bundles/org.mitk.gui.qt.imagestatistics/manifest.cpp b/Modules/Bundles/org.mitk.gui.qt.imagestatistics/manifest.cpp
deleted file mode 100644
index 4df00a915a..0000000000
--- a/Modules/Bundles/org.mitk.gui.qt.imagestatistics/manifest.cpp
+++ /dev/null
@@ -1,26 +0,0 @@
-/*=========================================================================
-
-Program: Medical Imaging & Interaction Toolkit
-Language: C++
-Date: $Date: 2009-05-05 11:31:02 +0200 (Di, 05 Mai 2009) $
-Version: $Revision: 16719 $
-
-Copyright (c) German Cancer Research Center, Division of Medical and
-Biological Informatics. All rights reserved.
-See MITKCopyright.txt or http://www.mitk.org/copyright.html for details.
-
-This software is distributed WITHOUT ANY WARRANTY; without even
-the implied warranty of MERCHANTABILITY or FITNESS FOR A PARTICULAR
-PURPOSE. See the above copyright notices for more information.
-
-=========================================================================*/
-
-#include <Poco/ClassLibrary.h>
-
-#include <berryIViewPart.h>
-#include "src/internal/QmitkImageStatisticsView.h"
-
-
-POCO_BEGIN_NAMED_MANIFEST(berryIViewPart, berry::IViewPart)
- POCO_EXPORT_CLASS(::QmitkImageStatistics)
-POCO_END_MANIFEST
diff --git a/Modules/Bundles/org.mitk.gui.qt.imagestatistics/manifest_headers.cmake b/Modules/Bundles/org.mitk.gui.qt.imagestatistics/manifest_headers.cmake
new file mode 100644
index 0000000000..d6a1b99509
--- /dev/null
+++ b/Modules/Bundles/org.mitk.gui.qt.imagestatistics/manifest_headers.cmake
@@ -0,0 +1,5 @@
+set(Plugin-Name "MITK Image Statistics")
+set(Plugin-Version "0.9")
+set(Plugin-Vendor "DKFZ, Medical and Biological Informatics")
+set(Plugin-ContactAddress "http://www.mitk.org")
+set(Require-Plugin org.mitk.gui.qt.common)
\ No newline at end of file
diff --git a/Modules/Bundles/org.mitk.gui.qt.imagestatistics/plugin.xml b/Modules/Bundles/org.mitk.gui.qt.imagestatistics/plugin.xml
index 43046ef0c7..4ec77645d7 100644
--- a/Modules/Bundles/org.mitk.gui.qt.imagestatistics/plugin.xml
+++ b/Modules/Bundles/org.mitk.gui.qt.imagestatistics/plugin.xml
@@ -1,11 +1,11 @@
<?xml version="1.0" encoding="UTF-8"?>
<plugin>
<extension point="org.blueberry.ui.views">
<view id="org.mitk.views.imagestatistics"
name="Statistics"
- class="::QmitkImageStatistics"
+ class="QmitkImageStatistics"
icon="resources/ImageStatistic_24.png" />
</extension>
</plugin>
diff --git a/Modules/Bundles/org.mitk.gui.qt.imagestatistics/src/ImageStatisticsDll.h b/Modules/Bundles/org.mitk.gui.qt.imagestatistics/src/ImageStatisticsDll.h
deleted file mode 100644
index f2f0e39614..0000000000
--- a/Modules/Bundles/org.mitk.gui.qt.imagestatistics/src/ImageStatisticsDll.h
+++ /dev/null
@@ -1,43 +0,0 @@
-/*=========================================================================
-
-Program: Medical Imaging & Interaction Toolkit
-Language: C++
-Date: $Date: 2009-05-28 20:08:26 +0200 (Do, 28 Mai 2009) $
-Version: $Revision: 16719 $
-
-Copyright (c) German Cancer Research Center, Division of Medical and
-Biological Informatics. All rights reserved.
-See MITKCopyright.txt or http://www.mitk.org/copyright.html for details.
-
-This software is distributed WITHOUT ANY WARRANTY; without even
-the implied warranty of MERCHANTABILITY or FITNESS FOR A PARTICULAR
-PURPOSE. See the above copyright notices for more information.
-
-=========================================================================*/
-
-#ifndef _IMAGESTATISTICS_EXPORT_DLL_H_
-#define _IMAGESTATISTICS_EXPORT_DLL_H_
-
-
-//
-// The following block is the standard way of creating macros which make exporting
-// from a DLL simpler. All files within this DLL are compiled with the org_mitk_gui_qt_imagestatistics_EXPORTS
-// symbol defined on the command line. this symbol should not be defined on any project
-// that uses this DLL. This way any other project whose source files include this file see
-// org_mitk_gui_qt_imagestatistics_EXPORTS functions as being imported from a DLL, wheras this DLL sees symbols
-// defined with this macro as being exported.
-//
-#if defined(_WIN32) && !defined(MITK_STATIC)
- #if defined(org_mitk_gui_qt_imagestatistics_EXPORTS)
- #define IMAGESTATISTICS_EXPORT __declspec(dllexport)
- #else
- #define IMAGESTATISTICS_EXPORT __declspec(dllimport)
- #endif
-#endif
-
-
-#if !defined(IMAGESTATISTICS_EXPORT)
- #define IMAGESTATISTICS_EXPORT
-#endif
-
-#endif /*_IMAGESTATISTICS_EXPORT_DLL_H_*/
diff --git a/Modules/Bundles/org.mitk.gui.qt.imagestatistics/src/internal/QmitkImageStatisticsView.cpp b/Modules/Bundles/org.mitk.gui.qt.imagestatistics/src/internal/QmitkImageStatisticsView.cpp
index 9bf1479f67..4e523ee26a 100644
--- a/Modules/Bundles/org.mitk.gui.qt.imagestatistics/src/internal/QmitkImageStatisticsView.cpp
+++ b/Modules/Bundles/org.mitk.gui.qt.imagestatistics/src/internal/QmitkImageStatisticsView.cpp
@@ -1,779 +1,780 @@
/*=========================================================================
Program: Medical Imaging & Interaction Toolkit
Language: C++
Date: $Date: 2009-05-22 11:00:35 +0200 (Fr, 22 Mai 2009) $
Version: $Revision: 10185 $
Copyright (c) German Cancer Research Center, Division of Medical and
Biological Informatics. All rights reserved.
See MITKCopyright.txt or http://www.mitk.org/copyright.html for details.
This software is distributed WITHOUT ANY WARRANTY; without even
the implied warranty of MERCHANTABILITY or FITNESS FOR A PARTICULAR
PURPOSE. See the above copyright notices for more information.
=========================================================================*/
#include "QmitkImageStatisticsView.h"
#include <limits>
#include <qlabel.h>
#include <qspinbox.h>
#include <qpushbutton.h>
#include <qcheckbox.h>
#include <qgroupbox.h>
#include <qradiobutton.h>
#include <qlineedit.h>
#include <qclipboard.h>
#include <qfiledialog.h>
#include <berryIEditorPart.h>
#include <berryIWorkbenchPage.h>
#include <berryPlatform.h>
#include "QmitkStdMultiWidget.h"
#include "QmitkSliderNavigatorWidget.h"
#include "mitkNodePredicateDataType.h"
#include "mitkImageTimeSelector.h"
#include "mitkProperties.h"
#include "mitkProgressBar.h"
// Includes for image processing
#include "mitkImageCast.h"
#include "mitkITKImageImport.h"
#include "mitkDataNodeObject.h"
#include "mitkNodePredicateData.h"
#include "mitkPlanarFigureInteractor.h"
#include <itkVectorImage.h>
class QmitkRequestStatisticsUpdateEvent : public QEvent
{
public:
enum Type
{
StatisticsUpdateRequest = QEvent::MaxUser - 1025
};
QmitkRequestStatisticsUpdateEvent()
: QEvent( (QEvent::Type) StatisticsUpdateRequest ) {};
};
typedef itk::Image<short, 3> ImageType;
typedef itk::Image<float, 3> FloatImageType;
typedef itk::Image<itk::Vector<float,3>, 3> VectorImageType;
inline bool my_isnan(float x)
{
volatile float d = x;
if(d!=d)
return true;
if(d==d)
return false;
return d != d;
}
QmitkImageStatistics::QmitkImageStatistics(QObject* /*parent*/, const char* /*name*/)
: QmitkFunctionality(),
m_Controls( NULL ),
m_TimeStepperAdapter( NULL ),
m_SelectedImageNode( NULL ),
m_SelectedImage( NULL ),
m_SelectedMaskNode( NULL ),
m_SelectedImageMask( NULL ),
m_SelectedPlanarFigure( NULL ),
m_ImageObserverTag( -1 ),
m_ImageMaskObserverTag( -1 ),
m_PlanarFigureObserverTag( -1 ),
m_CurrentStatisticsValid( false ),
m_StatisticsUpdatePending( false )
{
}
QmitkImageStatistics::~QmitkImageStatistics()
{
if ( m_SelectedImage != NULL )
m_SelectedImage->RemoveObserver( m_ImageObserverTag );
if ( m_SelectedImageMask != NULL )
m_SelectedImageMask->RemoveObserver( m_ImageMaskObserverTag );
if ( m_SelectedPlanarFigure != NULL )
m_SelectedPlanarFigure->RemoveObserver( m_PlanarFigureObserverTag );
}
void QmitkImageStatistics::CreateQtPartControl(QWidget *parent)
{
if (m_Controls == NULL)
{
m_Controls = new Ui::QmitkImageStatisticsViewControls;
m_Controls->setupUi(parent);
this->CreateConnections();
m_Controls->m_ErrorMessageLabel->hide();
m_Controls->m_StatisticsWidgetStack->setCurrentIndex( 0 );
m_Controls->m_LineProfileWidget->SetPathModeToPlanarFigure();
}
}
void QmitkImageStatistics::CreateConnections()
{
if ( m_Controls )
{
connect( (QObject*)(m_Controls->m_ButtonCopyHistogramToClipboard), SIGNAL(clicked()),(QObject*) this, SLOT(ClipboardHistogramButtonClicked()));
connect( (QObject*)(m_Controls->m_ButtonCopyStatisticsToClipboard), SIGNAL(clicked()),(QObject*) this, SLOT(ClipboardStatisticsButtonClicked()));
connect( (QObject*)(m_Controls->m_IgnoreZerosCheckbox), SIGNAL(clicked()),(QObject*) this, SLOT(IgnoreZerosCheckboxClicked()));
}
}
void QmitkImageStatistics::IgnoreZerosCheckboxClicked( )
{
UpdateStatistics();
}
void QmitkImageStatistics::StdMultiWidgetAvailable( QmitkStdMultiWidget& stdMultiWidget )
{
QmitkFunctionality::StdMultiWidgetAvailable(stdMultiWidget);
}
void QmitkImageStatistics::ClipboardHistogramButtonClicked()
{
if ( m_CurrentStatisticsValid && (m_CurrentStatisticsCalculator.IsNotNull()) )
{
typedef mitk::ImageStatisticsCalculator::HistogramType HistogramType;
const HistogramType *histogram = m_CurrentStatisticsCalculator->GetHistogram();
QString clipboard( "Measurement \t Frequency\n" );
for ( HistogramType::ConstIterator it = histogram->Begin();
it != histogram->End();
++it )
{
clipboard = clipboard.append( "%L1 \t %L2\n" )
.arg( it.GetMeasurementVector()[0], 0, 'f', 2 )
.arg( it.GetFrequency() );
}
QApplication::clipboard()->setText(
clipboard, QClipboard::Clipboard );
}
else
{
QApplication::clipboard()->clear();
}
}
void QmitkImageStatistics::ClipboardStatisticsButtonClicked()
{
if ( m_CurrentStatisticsValid && (m_CurrentStatisticsCalculator.IsNotNull()) )
{
const mitk::ImageStatisticsCalculator::Statistics &statistics =
m_CurrentStatisticsCalculator->GetStatistics();
// Copy statistics to clipboard ("%Ln" will use the default locale for
// number formatting)
- QString clipboard( "Mean \t StdDev \t RMS \t Max \t Min \t N\n" );
- clipboard = clipboard.append( "%L1 \t %L2 \t %L3 \t %L4 \t %L5 \t %L6" )
+ QString clipboard( "Mean \t StdDev \t RMS \t Max \t Min \t N \t V (mm³)\n" );
+ clipboard = clipboard.append( "%L1 \t %L2 \t %L3 \t %L4 \t %L5 \t %L6 \t %L7" )
.arg( statistics.Mean, 0, 'f', 10 )
.arg( statistics.Sigma, 0, 'f', 10 )
.arg( statistics.RMS, 0, 'f', 10 )
.arg( statistics.Max, 0, 'f', 10 )
.arg( statistics.Min, 0, 'f', 10 )
- .arg( statistics.N );
+ .arg( statistics.N )
+ .arg( m_Controls->m_StatisticsTable->item( 0, 6 )->text() );
QApplication::clipboard()->setText(
clipboard, QClipboard::Clipboard );
}
else
{
QApplication::clipboard()->clear();
}
}
void QmitkImageStatistics::FillStatisticsTableView(
const mitk::ImageStatisticsCalculator::Statistics &s,
const mitk::Image *image )
{
m_Controls->m_StatisticsTable->setItem( 0, 0, new QTableWidgetItem(
QString("%1").arg(s.Mean, 0, 'f', 2) ) );
m_Controls->m_StatisticsTable->setItem( 0, 1, new QTableWidgetItem(
QString("%1").arg(s.Sigma, 0, 'f', 2) ) );
m_Controls->m_StatisticsTable->setItem( 0, 2, new QTableWidgetItem(
QString("%1").arg(s.RMS, 0, 'f', 2) ) );
m_Controls->m_StatisticsTable->setItem( 0, 3, new QTableWidgetItem(
QString("%1").arg(s.Max, 0, 'f', 2) ) );
m_Controls->m_StatisticsTable->setItem( 0, 4, new QTableWidgetItem(
QString("%1").arg(s.Min, 0, 'f', 2) ) );
m_Controls->m_StatisticsTable->setItem( 0, 5, new QTableWidgetItem(
QString("%1").arg(s.N) ) );
const mitk::Geometry3D *geometry = image->GetGeometry();
if ( geometry != NULL )
{
const mitk::Vector3D &spacing = image->GetGeometry()->GetSpacing();
double volume = spacing[0] * spacing[1] * spacing[2] * (double) s.N;
m_Controls->m_StatisticsTable->setItem( 0, 6, new QTableWidgetItem(
QString("%1").arg(volume, 0, 'f', 2) ) );
}
else
{
m_Controls->m_StatisticsTable->setItem( 0, 6, new QTableWidgetItem(
"NA" ) );
}
}
void QmitkImageStatistics::InvalidateStatisticsTableView()
{
for ( unsigned int i = 0; i < 7; ++i )
{
m_Controls->m_StatisticsTable->setItem( 0, i, new QTableWidgetItem( "NA" ) );
}
}
void QmitkImageStatistics::OnSelectionChanged( std::vector<mitk::DataNode*> nodes )
{
// Clear any unreferenced images
this->RemoveOrphanImages();
if ( !this->IsVisible() )
{
return;
}
// Check if selection makeup consists only of valid nodes:
// One image, segmentation or planarFigure
// One image and one of the other two
bool tooManyNodes( true );
bool invalidNodes( true );
if ( nodes.size() < 3 )
{
tooManyNodes = false;
}
if( !tooManyNodes )
{
unsigned int numberImages = 0;
unsigned int numberSegmentations = 0;
unsigned int numberPlanarFigures = 0;
for ( unsigned int index = 0; index < nodes.size(); index++ )
{
m_SelectedImageMask = dynamic_cast< mitk::Image * >( nodes[ index ]->GetData() );
m_SelectedPlanarFigure = dynamic_cast< mitk::PlanarFigure * >( nodes[ index ]->GetData() );
if ( m_SelectedImageMask != NULL )
{
bool isMask( false );
nodes[ index ]->GetPropertyValue("binary", isMask);
if ( !isMask )
{
numberImages++;
}
else
{
numberSegmentations++;
if ( numberImages != 0 ) // image should be last element
{
std::swap( nodes[ index ], nodes[ index - 1 ] );
}
}
}
else if ( m_SelectedPlanarFigure != NULL )
{
numberPlanarFigures++;
if ( numberImages != 0 ) // image should be last element
{
std::swap( nodes[ index ], nodes[ index - 1 ] );
}
}
}
if ( ( numberPlanarFigures + numberSegmentations + numberImages ) == nodes.size() && //No invalid nodes
( numberPlanarFigures + numberSegmentations ) < 2 && numberImages < 2
// maximum of one image and/or one of either planar figure or segmentation
)
{
invalidNodes = false;
}
}
if ( nodes.empty() || tooManyNodes || invalidNodes )
{
// Nothing to do: invalidate image, clear statistics, histogram, and GUI
m_SelectedImage = NULL;
this->InvalidateStatisticsTableView() ;
m_Controls->m_HistogramWidget->ClearItemModel();
m_Controls->m_LineProfileWidget->ClearItemModel();
m_CurrentStatisticsValid = false;
m_Controls->m_ErrorMessageLabel->hide();
m_Controls->m_SelectedMaskLabel->setText( "None" );
return;
}
// Get selected element
mitk::DataNode *selectedNode = nodes.front();
mitk::Image *selectedImage = dynamic_cast< mitk::Image * >( selectedNode->GetData() );
// Find the next parent/grand-parent node containing an image, if any
mitk::DataStorage::SetOfObjects::ConstPointer parentObjects;
mitk::DataNode *parentNode = NULL;
mitk::Image *parentImage = NULL;
// Possibly previous change listeners
if ( (m_SelectedPlanarFigure != NULL) && (m_PlanarFigureObserverTag >= 0) )
{
m_SelectedPlanarFigure->RemoveObserver( m_PlanarFigureObserverTag );
m_PlanarFigureObserverTag = -1;
}
if ( (m_SelectedImage != NULL) && (m_ImageObserverTag >= 0) )
{
m_SelectedImage->RemoveObserver( m_ImageObserverTag );
m_ImageObserverTag = -1;
}
if ( (m_SelectedImageMask != NULL) && (m_ImageMaskObserverTag >= 0) )
{
m_SelectedImageMask->RemoveObserver( m_ImageMaskObserverTag );
m_ImageMaskObserverTag = -1;
}
// Deselect all images and masks by default
m_SelectedImageNode = NULL;
m_SelectedImage = NULL;
m_SelectedMaskNode = NULL;
m_SelectedImageMask = NULL;
m_SelectedPlanarFigure = NULL;
{
unsigned int parentObjectIndex = 0;
parentObjects = this->GetDefaultDataStorage()->GetSources( selectedNode );
while( parentObjectIndex < parentObjects->Size() )
{
// Use first parent object (if multiple parents are present)
parentNode = parentObjects->ElementAt( parentObjectIndex );
parentImage = dynamic_cast< mitk::Image * >( parentNode->GetData() );
if( parentImage != NULL )
{
break;
}
parentObjectIndex++;
}
}
if ( nodes.size() == 2 )
{
parentNode = nodes.back();
parentImage = dynamic_cast< mitk::Image * >( parentNode->GetData() );
}
if ( parentImage != NULL )
{
m_SelectedImageNode = parentNode;
m_SelectedImage = parentImage;
// Check if a valid mask has been selected (Image or PlanarFigure)
m_SelectedImageMask = dynamic_cast< mitk::Image * >( selectedNode->GetData() );
m_SelectedPlanarFigure = dynamic_cast< mitk::PlanarFigure * >( selectedNode->GetData() );
// Check whether ImageMask is a binary segmentation
if ( (m_SelectedImageMask != NULL) )
{
bool isMask( false );
selectedNode->GetPropertyValue("binary", isMask);
if ( !isMask )
{
m_SelectedImageNode = selectedNode;
m_SelectedImage = selectedImage;
m_SelectedImageMask = NULL;
}
else
{
m_SelectedMaskNode = selectedNode;
}
}
else if ( (m_SelectedPlanarFigure != NULL) )
{
m_SelectedMaskNode = selectedNode;
}
}
else if ( selectedImage != NULL )
{
m_SelectedImageNode = selectedNode;
m_SelectedImage = selectedImage;
}
typedef itk::SimpleMemberCommand< QmitkImageStatistics > ITKCommandType;
ITKCommandType::Pointer changeListener;
changeListener = ITKCommandType::New();
changeListener->SetCallbackFunction( this, &QmitkImageStatistics::RequestStatisticsUpdate );
// Add change listeners to selected objects
if ( m_SelectedImage != NULL )
{
m_ImageObserverTag = m_SelectedImage->AddObserver(
itk::ModifiedEvent(), changeListener );
}
if ( m_SelectedImageMask != NULL )
{
m_ImageMaskObserverTag = m_SelectedImageMask->AddObserver(
itk::ModifiedEvent(), changeListener );
}
if ( m_SelectedPlanarFigure != NULL )
{
m_PlanarFigureObserverTag = m_SelectedPlanarFigure->AddObserver(
mitk::EndInteractionPlanarFigureEvent(), changeListener );
}
// Clear statistics / histogram GUI if nothing is selected
if ( m_SelectedImage == NULL )
{
// Clear statistics, histogram, and GUI
this->InvalidateStatisticsTableView();
m_Controls->m_HistogramWidget->ClearItemModel();
m_Controls->m_LineProfileWidget->ClearItemModel();
m_CurrentStatisticsValid = false;
m_Controls->m_ErrorMessageLabel->hide();
m_Controls->m_SelectedMaskLabel->setText( "None" );
}
else
{
// Else, request statistics and GUI update
this->RequestStatisticsUpdate();
}
}
void QmitkImageStatistics::UpdateStatistics()
{
// Remove any cached images that are no longer referenced elsewhere
this->RemoveOrphanImages();
QmitkStdMultiWidget *multiWidget = this->GetActiveStdMultiWidget();
if ( multiWidget == NULL )
{
return;
}
unsigned int timeStep = multiWidget->GetTimeNavigationController()->GetTime()->GetPos();
if ( m_SelectedImage != NULL )
{
// Check if a the selected image is a multi-channel image. If yes, statistics
// cannot be calculated currently.
if ( m_SelectedImage->GetPixelType().GetNumberOfComponents() > 1 )
{
std::stringstream message;
message << "<font color='red'>Multi-component images not supported.</font>";
m_Controls->m_ErrorMessageLabel->setText( message.str().c_str() );
m_Controls->m_ErrorMessageLabel->show();
this->InvalidateStatisticsTableView();
m_Controls->m_StatisticsWidgetStack->setCurrentIndex( 0 );
m_Controls->m_HistogramWidget->ClearItemModel();
m_CurrentStatisticsValid = false;
return;
}
// Retrieve ImageStatisticsCalculator from has map (or create a new one
// for this image if non-existant)
ImageStatisticsMapType::iterator it =
m_ImageStatisticsMap.find( m_SelectedImage );
if ( it != m_ImageStatisticsMap.end() )
{
m_CurrentStatisticsCalculator = it->second;
MITK_INFO << "Retrieving StatisticsCalculator";
}
else
{
m_CurrentStatisticsCalculator = mitk::ImageStatisticsCalculator::New();
m_CurrentStatisticsCalculator->SetImage( m_SelectedImage );
m_ImageStatisticsMap[m_SelectedImage] = m_CurrentStatisticsCalculator;
MITK_INFO << "Creating StatisticsCalculator";
}
std::string maskName;
std::string maskType;
unsigned int maskDimension;
if ( m_SelectedImageMask != NULL )
{
m_CurrentStatisticsCalculator->SetImageMask( m_SelectedImageMask );
m_CurrentStatisticsCalculator->SetMaskingModeToImage();
maskName = m_SelectedMaskNode->GetName();
maskType = m_SelectedImageMask->GetNameOfClass();
maskDimension = 3;
}
else if ( m_SelectedPlanarFigure != NULL )
{
m_CurrentStatisticsCalculator->SetPlanarFigure( m_SelectedPlanarFigure );
m_CurrentStatisticsCalculator->SetMaskingModeToPlanarFigure();
maskName = m_SelectedMaskNode->GetName();
maskType = m_SelectedPlanarFigure->GetNameOfClass();
maskDimension = 2;
}
else
{
m_CurrentStatisticsCalculator->SetMaskingModeToNone();
maskName = "None";
maskType = "";
maskDimension = 0;
}
if(m_Controls->m_IgnoreZerosCheckbox->isChecked())
{
m_CurrentStatisticsCalculator->SetIgnorePixelValue(0);
m_CurrentStatisticsCalculator->SetDoIgnorePixelValue(true);
}
else
{
m_CurrentStatisticsCalculator->SetDoIgnorePixelValue(false);
}
std::stringstream maskLabel;
maskLabel << maskName;
if ( maskDimension > 0 )
{
maskLabel << " [" << maskDimension << "D " << maskType << "]";
}
m_Controls->m_SelectedMaskLabel->setText( maskLabel.str().c_str() );
bool statisticsChanged = false;
bool statisticsCalculationSuccessful = false;
// Initialize progress bar
mitk::ProgressBar::GetInstance()->AddStepsToDo( 100 );
// Install listener for progress events and initialize progress bar
typedef itk::SimpleMemberCommand< QmitkImageStatistics > ITKCommandType;
ITKCommandType::Pointer progressListener;
progressListener = ITKCommandType::New();
progressListener->SetCallbackFunction( this, &QmitkImageStatistics::UpdateProgressBar );
unsigned long progressObserverTag = m_CurrentStatisticsCalculator
->AddObserver( itk::ProgressEvent(), progressListener );
// show wait cursor
this->WaitCursorOn();
try
{
// Compute statistics
statisticsChanged =
m_CurrentStatisticsCalculator->ComputeStatistics( timeStep );
statisticsCalculationSuccessful = true;
}
catch ( const std::runtime_error &e )
{
// In case of exception, print error message on GUI
std::stringstream message;
message << "<font color='red'>" << e.what() << "</font>";
m_Controls->m_ErrorMessageLabel->setText( message.str().c_str() );
m_Controls->m_ErrorMessageLabel->show();
}
catch ( const std::exception &e )
{
MITK_ERROR << "Caught exception: " << e.what();
// In case of exception, print error message on GUI
std::stringstream message;
message << "<font color='red'>Error! Unequal Dimensions of Image and Segmentation. No recompute possible </font>";
m_Controls->m_ErrorMessageLabel->setText( message.str().c_str() );
m_Controls->m_ErrorMessageLabel->show();
}
m_CurrentStatisticsCalculator->RemoveObserver( progressObserverTag );
// Make sure that progress bar closes
mitk::ProgressBar::GetInstance()->Progress( 100 );
// remove wait cursor
this->WaitCursorOff();
if ( statisticsCalculationSuccessful )
{
if ( statisticsChanged )
{
// Do not show any error messages
m_Controls->m_ErrorMessageLabel->hide();
m_CurrentStatisticsValid = true;
}
m_Controls->m_StatisticsWidgetStack->setCurrentIndex( 0 );
m_Controls->m_HistogramWidget->SetHistogramModeToDirectHistogram();
m_Controls->m_HistogramWidget->SetHistogram(
m_CurrentStatisticsCalculator->GetHistogram( timeStep ) );
m_Controls->m_HistogramWidget->UpdateItemModelFromHistogram();
MITK_INFO << "UpdateItemModelFromHistogram()";
this->FillStatisticsTableView(
m_CurrentStatisticsCalculator->GetStatistics( timeStep ),
m_SelectedImage );
}
else
{
m_Controls->m_SelectedMaskLabel->setText( "None" );
// Clear statistics and histogram
this->InvalidateStatisticsTableView();
m_Controls->m_HistogramWidget->ClearItemModel();
m_CurrentStatisticsValid = false;
// If a (non-closed) PlanarFigure is selected, display a line profile widget
if ( m_SelectedPlanarFigure != NULL )
{
// check whether PlanarFigure is initialized
const mitk::Geometry2D *planarFigureGeometry2D = m_SelectedPlanarFigure->GetGeometry2D();
if ( planarFigureGeometry2D == NULL )
{
// Clear statistics, histogram, and GUI
this->InvalidateStatisticsTableView();
m_Controls->m_HistogramWidget->ClearItemModel();
m_Controls->m_LineProfileWidget->ClearItemModel();
m_CurrentStatisticsValid = false;
m_Controls->m_ErrorMessageLabel->hide();
m_Controls->m_SelectedMaskLabel->setText( "None" );
return;
}
// TODO: enable line profile widget
m_Controls->m_StatisticsWidgetStack->setCurrentIndex( 1 );
m_Controls->m_LineProfileWidget->SetImage( m_SelectedImage );
m_Controls->m_LineProfileWidget->SetPlanarFigure( m_SelectedPlanarFigure );
m_Controls->m_LineProfileWidget->UpdateItemModelFromPath();
}
}
}
}
void QmitkImageStatistics::UpdateProgressBar()
{
mitk::ProgressBar::GetInstance()->Progress();
}
void QmitkImageStatistics::RequestStatisticsUpdate()
{
if ( !m_StatisticsUpdatePending )
{
QApplication::postEvent( this, new QmitkRequestStatisticsUpdateEvent );
m_StatisticsUpdatePending = true;
}
}
void QmitkImageStatistics::RemoveOrphanImages()
{
ImageStatisticsMapType::iterator it = m_ImageStatisticsMap.begin();
while ( it != m_ImageStatisticsMap.end() )
{
mitk::Image *image = it->first;
mitk::ImageStatisticsCalculator *calculator = it->second;
++it;
mitk::NodePredicateData::Pointer hasImage = mitk::NodePredicateData::New( image );
if ( this->GetDefaultDataStorage()->GetNode( hasImage ) == NULL )
{
if ( m_SelectedImage == image )
{
m_SelectedImage = NULL;
m_SelectedImageNode = NULL;
}
if ( m_CurrentStatisticsCalculator == calculator )
{
m_CurrentStatisticsCalculator = NULL;
}
m_ImageStatisticsMap.erase( image );
it = m_ImageStatisticsMap.begin();
}
}
}
bool QmitkImageStatistics::event( QEvent *event )
{
if ( event->type() == (QEvent::Type) QmitkRequestStatisticsUpdateEvent::StatisticsUpdateRequest )
{
// Update statistics
m_StatisticsUpdatePending = false;
this->UpdateStatistics();
return true;
}
return false;
}
void QmitkImageStatistics::ComputeIntensityProfile( mitk::PlanarLine* line )
{
double sampling = 300;
QmitkVtkHistogramWidget::HistogramType::Pointer histogram = QmitkVtkHistogramWidget::HistogramType::New();
itk::Size<1> siz;
siz[0] = sampling;
itk::FixedArray<double,1> lower, higher;
lower.Fill(0);
mitk::Point3D begin = line->GetWorldControlPoint(0);
mitk::Point3D end = line->GetWorldControlPoint(1);
itk::Vector<double,3> direction = (end - begin);
higher.Fill(direction.GetNorm());
histogram->Initialize(siz, lower, higher);
for(int i = 0; i < sampling; i++)
{
mitk::Point3D location = begin + double(i)/sampling * direction;
double d = m_SelectedImage->GetPixelValueByWorldCoordinate(begin + double(i)/sampling * direction);
histogram->SetFrequency(i,d);
}
m_Controls->m_HistogramWidget->SetHistogramModeToDirectHistogram();
m_Controls->m_HistogramWidget->SetHistogram( histogram );
m_Controls->m_HistogramWidget->UpdateItemModelFromHistogram();
}
bool QmitkImageStatistics::IsExclusiveFunctionality() const
{
return false;
}
void QmitkImageStatistics::Visible()
{
this->OnSelectionChanged( this->GetDataManagerSelection() );
}
diff --git a/Modules/Bundles/org.mitk.gui.qt.imagestatistics/src/internal/QmitkImageStatisticsView.h b/Modules/Bundles/org.mitk.gui.qt.imagestatistics/src/internal/QmitkImageStatisticsView.h
index e52fc837a4..b82a1ad799 100644
--- a/Modules/Bundles/org.mitk.gui.qt.imagestatistics/src/internal/QmitkImageStatisticsView.h
+++ b/Modules/Bundles/org.mitk.gui.qt.imagestatistics/src/internal/QmitkImageStatisticsView.h
@@ -1,163 +1,168 @@
/*=========================================================================
Program: Medical Imaging & Interaction Toolkit
Language: C++
Date: $Date: 2009-05-28 20:08:26 +0200 (Do, 28 Mai 2009) $
Version: $Revision: 10185 $
Copyright (c) German Cancer Research Center, Division of Medical and
Biological Informatics. All rights reserved.
See MITKCopyright.txt or http://www.mitk.org/copyright.html for details.
This software is distributed WITHOUT ANY WARRANTY; without even
the implied warranty of MERCHANTABILITY or FITNESS FOR A PARTICULAR
PURPOSE. See the above copyright notices for more information.
=========================================================================*/
#if !defined(QmitkImageStatisticsView_H__INCLUDED)
#define QmitkImageStatisticsView_H__INCLUDED
#include "QmitkFunctionality.h"
-#include "../ImageStatisticsDll.h"
+#include <org_mitk_gui_qt_imagestatistics_Export.h>
#include "ui_QmitkImageStatisticsViewControls.h"
#include "QmitkStepperAdapter.h"
#include "mitkImageStatisticsCalculator.h"
#include <berryISelectionListener.h>
#include <berryIStructuredSelection.h>
#include <itkTimeStamp.h>
#include "mitkPlanarLine.h"
/*!
\brief QmitkImageStatistics
\sa QmitkFunctionality
\ingroup Functionalities
*/
class IMAGESTATISTICS_EXPORT QmitkImageStatistics : public QmitkFunctionality
{
Q_OBJECT
public:
/*!
\ Convenient typedefs
*/
typedef mitk::DataStorage::SetOfObjects ConstVector;
typedef ConstVector::ConstPointer ConstVectorPointer;
typedef ConstVector::ConstIterator ConstVectorIterator;
/*!
\brief default constructor
*/
QmitkImageStatistics(QObject *parent=0, const char *name=0);
+ QmitkImageStatistics(const QmitkImageStatistics& other)
+ {
+ Q_UNUSED(other)
+ throw std::runtime_error("Copy constructor not implemented");
+ }
/*!
\brief default destructor
*/
virtual ~QmitkImageStatistics();
/*!
\brief method for creating the widget containing the application controls, like sliders, buttons etc.
*/
virtual void CreateQtPartControl(QWidget *parent);
/*!
\brief method for creating the connections of main and control widget
*/
virtual void CreateConnections();
bool IsExclusiveFunctionality() const;
virtual bool event( QEvent *event );
void OnSelectionChanged( std::vector<mitk::DataNode*> nodes );
protected slots:
void ClipboardHistogramButtonClicked();
void ClipboardStatisticsButtonClicked();
void IgnoreZerosCheckboxClicked( );
protected:
void StdMultiWidgetAvailable( QmitkStdMultiWidget& stdMultiWidget );
void FillStatisticsTableView( const mitk::ImageStatisticsCalculator::Statistics &s,
const mitk::Image *image );
void InvalidateStatisticsTableView();
/** \brief Issues a request to update statistics by sending an event to the
* Qt event processing queue.
*
* Statistics update should only be executed after program execution returns
* to the Qt main loop. This mechanism also prevents multiple execution of
* updates where only one is required.*/
void RequestStatisticsUpdate();
/** \brief Recalculate statistics for currently selected image and mask and
* update the GUI. */
void UpdateStatistics();
/** \brief Listener for progress events to update progress bar. */
void UpdateProgressBar();
/** \brief Removes any cached images which are no longer referenced elsewhere. */
void RemoveOrphanImages();
/** \brief Computes an Intensity Profile along line and updates the histogram widget with it. */
void ComputeIntensityProfile( mitk::PlanarLine* line );
void Visible( );
typedef std::map< mitk::Image *, mitk::ImageStatisticsCalculator::Pointer >
ImageStatisticsMapType;
/*!
* controls containing sliders for scrolling through the slices
*/
Ui::QmitkImageStatisticsViewControls *m_Controls;
QmitkStepperAdapter* m_TimeStepperAdapter;
unsigned int m_CurrentTime;
QString m_Clipboard;
// Image and mask data
mitk::DataNode *m_SelectedImageNode;
mitk::Image *m_SelectedImage;
mitk::DataNode *m_SelectedMaskNode;
mitk::Image *m_SelectedImageMask;
mitk::PlanarFigure *m_SelectedPlanarFigure;
long m_ImageObserverTag;
long m_ImageMaskObserverTag;
long m_PlanarFigureObserverTag;
// Hash map for associating one image statistics calculator with each iamge
// (so that previously calculated histograms / statistics can be recovered
// if a recalculation is not required)
ImageStatisticsMapType m_ImageStatisticsMap;
mitk::ImageStatisticsCalculator::Pointer m_CurrentStatisticsCalculator;
bool m_CurrentStatisticsValid;
bool m_StatisticsUpdatePending;
};
#endif // !defined(QmitkImageStatistics_H__INCLUDED)
diff --git a/Modules/Bundles/org.mitk.gui.qt.imagestatistics/src/internal/mitkImageStatisticsPluginActivator.cpp b/Modules/Bundles/org.mitk.gui.qt.imagestatistics/src/internal/mitkImageStatisticsPluginActivator.cpp
new file mode 100644
index 0000000000..9981228026
--- /dev/null
+++ b/Modules/Bundles/org.mitk.gui.qt.imagestatistics/src/internal/mitkImageStatisticsPluginActivator.cpp
@@ -0,0 +1,21 @@
+#include "mitkImageStatisticsPluginActivator.h"
+
+#include <QtPlugin>
+
+#include "QmitkImageStatisticsView.h"
+
+namespace mitk {
+
+ void ImageStatisticsPluginActivator::start(ctkPluginContext* context)
+ {
+ BERRY_REGISTER_EXTENSION_CLASS(QmitkImageStatistics, context)
+ }
+
+ void ImageStatisticsPluginActivator::stop(ctkPluginContext* context)
+ {
+ Q_UNUSED(context)
+ }
+
+}
+
+Q_EXPORT_PLUGIN2(org_mitk_gui_qt_imagestatistics, mitk::ImageStatisticsPluginActivator)
\ No newline at end of file
diff --git a/Modules/Bundles/org.mitk.gui.qt.imagestatistics/src/internal/mitkImageStatisticsPluginActivator.h b/Modules/Bundles/org.mitk.gui.qt.imagestatistics/src/internal/mitkImageStatisticsPluginActivator.h
new file mode 100644
index 0000000000..28e7af7c44
--- /dev/null
+++ b/Modules/Bundles/org.mitk.gui.qt.imagestatistics/src/internal/mitkImageStatisticsPluginActivator.h
@@ -0,0 +1,23 @@
+#ifndef MITKIMAGESTATISTICSPLUGINACTIVATOR_H
+#define MITKIMAGESTATISTICSPLUGINACTIVATOR_H
+
+#include <ctkPluginActivator.h>
+
+namespace mitk {
+
+ class ImageStatisticsPluginActivator :
+ public QObject, public ctkPluginActivator
+ {
+ Q_OBJECT
+ Q_INTERFACES(ctkPluginActivator)
+
+ public:
+
+ void start(ctkPluginContext* context);
+ void stop(ctkPluginContext* context);
+
+ }; // ImageStatisticsPluginActivator
+
+}
+
+#endif // MITKIMAGESTATISTICSPLUGINACTIVATOR_H
\ No newline at end of file
diff --git a/Modules/Bundles/org.mitk.gui.qt.materialeditor/CMakeLists.txt b/Modules/Bundles/org.mitk.gui.qt.materialeditor/CMakeLists.txt
index 64bffecf36..d1cdb61faf 100644
--- a/Modules/Bundles/org.mitk.gui.qt.materialeditor/CMakeLists.txt
+++ b/Modules/Bundles/org.mitk.gui.qt.materialeditor/CMakeLists.txt
@@ -1,2 +1,9 @@
+# The project name must correspond to the directory name of your plug-in
+# and must not contain periods.
+PROJECT(org_mitk_gui_qt_materialeditor)
-MACRO_CREATE_MITK_PLUGIN(Qmitk)
+MACRO_CREATE_MITK_CTK_PLUGIN(
+ EXPORT_DIRECTIVE MATERIALEDITOR_EXPORTS
+ EXPORTED_INCLUDE_SUFFIXES src
+ MODULE_DEPENDENCIES Qmitk
+)
diff --git a/Modules/Bundles/org.mitk.gui.qt.materialeditor/META-INF/MANIFEST.MF b/Modules/Bundles/org.mitk.gui.qt.materialeditor/META-INF/MANIFEST.MF
deleted file mode 100644
index ea8811b4f0..0000000000
--- a/Modules/Bundles/org.mitk.gui.qt.materialeditor/META-INF/MANIFEST.MF
+++ /dev/null
@@ -1,7 +0,0 @@
-Manifest-Version: 1.0
-Bundle-Name: Surface Material Editor
-Bundle-SymbolicName: org.mitk.gui.qt.materialeditor
-Bundle-Version: 0.1
-Bundle-Vendor: DKFZ, Medical and Biological Informatics
-Require-Bundle: org.mitk.gui.qt.common
-Bundle-Activator:
diff --git a/Modules/Bundles/org.mitk.gui.qt.materialeditor/files.cmake b/Modules/Bundles/org.mitk.gui.qt.materialeditor/files.cmake
index 36ac7c3643..5ff2c78cd7 100644
--- a/Modules/Bundles/org.mitk.gui.qt.materialeditor/files.cmake
+++ b/Modules/Bundles/org.mitk.gui.qt.materialeditor/files.cmake
@@ -1,35 +1,34 @@
SET(SRC_CPP_FILES
)
SET(INTERNAL_CPP_FILES
QmitkMITKSurfaceMaterialEditorView.cpp
-
+ mitkMaterialEditorPluginActivator.cpp
)
SET(UI_FILES
src/internal/QmitkMITKSurfaceMaterialEditorViewControls.ui
)
SET(MOC_H_FILES
src/internal/QmitkMITKSurfaceMaterialEditorView.h
+ src/internal/mitkMaterialEditorPluginActivator.h
)
-SET(RESOURCE_FILES
+SET(CACHED_RESOURCE_FILES
resources/SurfaceMaterialEditor.png
+ plugin.xml
)
-SET(RES_FILES
+SET(QRC_FILES
resources/QmitkMITKSurfaceMaterialEditorView.qrc
)
-SET(CPP_FILES manifest.cpp)
-
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})
-
+endforeach(file ${INTERNAL_CPP_FILES})
\ No newline at end of file
diff --git a/Modules/Bundles/org.mitk.gui.qt.materialeditor/manifest.cpp b/Modules/Bundles/org.mitk.gui.qt.materialeditor/manifest.cpp
deleted file mode 100644
index 795e24d6cd..0000000000
--- a/Modules/Bundles/org.mitk.gui.qt.materialeditor/manifest.cpp
+++ /dev/null
@@ -1,26 +0,0 @@
-/*=========================================================================
-
-Program: Medical Imaging & Interaction Toolkit
-Language: C++
-Date: $Date: 2009-03-21 19:27:37 +0100 (Sa, 21 Mrz 2009) $
-Version: $Revision: 16719 $
-
-Copyright (c) German Cancer Research Center, Division of Medical and
-Biological Informatics. All rights reserved.
-See MITKCopyright.txt or http://www.mitk.org/copyright.html for details.
-
-This software is distributed WITHOUT ANY WARRANTY; without even
-the implied warranty of MERCHANTABILITY or FITNESS FOR A PARTICULAR
-PURPOSE. See the above copyright notices for more information.
-
-=========================================================================*/
-
-#include <Poco/ClassLibrary.h>
-
-#include <berryIViewPart.h>
-#include "src/internal/QmitkMITKSurfaceMaterialEditorView.h"
-
-
-POCO_BEGIN_NAMED_MANIFEST(berryIViewPart, berry::IViewPart)
- POCO_EXPORT_CLASS(::QmitkMITKSurfaceMaterialEditorView)
-POCO_END_MANIFEST
diff --git a/Modules/Bundles/org.mitk.gui.qt.materialeditor/manifest_headers.cmake b/Modules/Bundles/org.mitk.gui.qt.materialeditor/manifest_headers.cmake
new file mode 100644
index 0000000000..8f72fc2fe3
--- /dev/null
+++ b/Modules/Bundles/org.mitk.gui.qt.materialeditor/manifest_headers.cmake
@@ -0,0 +1,5 @@
+set(Plugin-Name "MITK Material Editor")
+set(Plugin-Version "0.9")
+set(Plugin-Vendor "DKFZ, Medical and Biological Informatics")
+set(Plugin-ContactAddress "http://www.mitk.org")
+set(Require-Plugin org.mitk.gui.qt.common)
\ No newline at end of file
diff --git a/Modules/Bundles/org.mitk.gui.qt.materialeditor/plugin.xml b/Modules/Bundles/org.mitk.gui.qt.materialeditor/plugin.xml
index afb7807725..2046abdd81 100644
--- a/Modules/Bundles/org.mitk.gui.qt.materialeditor/plugin.xml
+++ b/Modules/Bundles/org.mitk.gui.qt.materialeditor/plugin.xml
@@ -1,11 +1,11 @@
<?xml version="1.0" encoding="UTF-8"?>
<plugin>
<extension point="org.blueberry.ui.views">
<view id="org.mitk.views.mitksurfacematerialeditor"
name="Surface Material Editor"
- class="::QmitkMITKSurfaceMaterialEditorView"
+ class="QmitkMITKSurfaceMaterialEditorView"
icon="resources/SurfaceMaterialEditor.png" />
</extension>
</plugin>
diff --git a/Modules/Bundles/org.mitk.gui.qt.materialeditor/src/MaterialeditorDll.h b/Modules/Bundles/org.mitk.gui.qt.materialeditor/src/MaterialeditorDll.h
deleted file mode 100644
index d0685e818a..0000000000
--- a/Modules/Bundles/org.mitk.gui.qt.materialeditor/src/MaterialeditorDll.h
+++ /dev/null
@@ -1,43 +0,0 @@
-/*=========================================================================
-
-Program: Medical Imaging & Interaction Toolkit
-Language: C++
-Date: $Date: 2009-03-21 19:27:37 +0100 (Sa, 21 Mrz 2009) $
-Version: $Revision: 16719 $
-
-Copyright (c) German Cancer Research Center, Division of Medical and
-Biological Informatics. All rights reserved.
-See MITKCopyright.txt or http://www.mitk.org/copyright.html for details.
-
-This software is distributed WITHOUT ANY WARRANTY; without even
-the implied warranty of MERCHANTABILITY or FITNESS FOR A PARTICULAR
-PURPOSE. See the above copyright notices for more information.
-
-=========================================================================*/
-
-#ifndef _MATERIALEDITOR_EXPORTS_DLL_H_
-#define _MATERIALEDITOR_EXPORTS_DLL_H_
-
-
-//
-// The following block is the standard way of creating macros which make exporting
-// from a DLL simpler. All files within this DLL are compiled with the org_mitk_gui_qt_materialeditor_EXPORTS
-// symbol defined on the command line. this symbol should not be defined on any project
-// that uses this DLL. This way any other project whose source files include this file see
-// org_mitk_gui_qt_materialeditor_EXPORTS functions as being imported from a DLL, wheras this DLL sees symbols
-// defined with this macro as being exported.
-//
-#if defined(_WIN32) && !defined(MITK_STATIC)
- #if defined(org_mitk_gui_qt_materialeditor_EXPORTS)
- #define MATERIALEDITOR_EXPORTS __declspec(dllexport)
- #else
- #define MATERIALEDITOR_EXPORTS __declspec(dllimport)
- #endif
-#endif
-
-
-#if !defined(MATERIALEDITOR_EXPORTS)
- #define MATERIALEDITOR_EXPORTS
-#endif
-
-#endif /*_MATERIALEDITOR_EXPORTS_DLL_H_*/
diff --git a/Modules/Bundles/org.mitk.gui.qt.materialeditor/src/internal/QmitkMITKSurfaceMaterialEditorView.cpp b/Modules/Bundles/org.mitk.gui.qt.materialeditor/src/internal/QmitkMITKSurfaceMaterialEditorView.cpp
index 88c69e4d5c..46162ce248 100644
--- a/Modules/Bundles/org.mitk.gui.qt.materialeditor/src/internal/QmitkMITKSurfaceMaterialEditorView.cpp
+++ b/Modules/Bundles/org.mitk.gui.qt.materialeditor/src/internal/QmitkMITKSurfaceMaterialEditorView.cpp
@@ -1,320 +1,320 @@
/*=========================================================================
Program: Medical Imaging & Interaction Toolkit
Language: C++
Date: $Date: 2009-03-21 19:27:37 +0100 (Sa, 21 Mrz 2009) $
Version: $Revision: 16719 $
Copyright (c) German Cancer Research Center, Division of Medical and
Biological Informatics. All rights reserved.
See MITKCopyright.txt or http://www.mitk.org/copyright.html for details.
This software is distributed WITHOUT ANY WARRANTY; without even
the implied warranty of MERCHANTABILITY or FITNESS FOR A PARTICULAR
PURPOSE. See the above copyright notices for more information.
=========================================================================*/
#include "QmitkMITKSurfaceMaterialEditorView.h"
#include "mitkBaseRenderer.h"
#include "mitkNodePredicateDataType.h"
#include "mitkProperties.h"
#include "mitkIDataStorageService.h"
#include "mitkDataNodeObject.h"
#include "berryIEditorPart.h"
#include "berryIWorkbenchPage.h"
#include "mitkShaderProperty.h"
#include "mitkShaderRepository.h"
#include "QmitkDataStorageComboBox.h"
#include "QmitkStdMultiWidget.h"
#include <vtkSphereSource.h>
#include <vtkPolyData.h>
#include <vtkCamera.h>
#include <vtkRenderer.h>
#include <vtkTextActor.h>
#include <vtkRenderer.h>
#include <vtkTextProperty.h>
#include <vtkCoordinate.h>
#include <vtkActor.h>
#include <vtkProperty.h>
#include <vtkXMLMaterial.h>
#include <vtkXMLShader.h>
#include <vtkXMLDataElement.h>
#include <mitkVtkPropRenderer.h>
#include <mitkVtkLayerController.h>
#include <qmessagebox.h>
#include "mitkStandaloneDataStorage.h"
const std::string QmitkMITKSurfaceMaterialEditorView::VIEW_ID = "org.mitk.views.mitksurfacematerialeditor";
QmitkMITKSurfaceMaterialEditorView::QmitkMITKSurfaceMaterialEditorView()
: QmitkFunctionality(),
m_Controls(NULL),
m_MultiWidget(NULL)
{
fixedProperties.push_back( "shader" );
fixedProperties.push_back( "material.representation" );
fixedProperties.push_back( "color" );
fixedProperties.push_back( "opacity" );
fixedProperties.push_back( "material.wireframeLineWidth" );
fixedProperties.push_back( "material.ambientCoefficient" );
fixedProperties.push_back( "material.diffuseCoefficient" );
fixedProperties.push_back( "material.ambientColor" );
fixedProperties.push_back( "material.diffuseColor" );
fixedProperties.push_back( "material.specularColor" );
fixedProperties.push_back( "material.specularCoefficient" );
fixedProperties.push_back( "material.specularPower" );
fixedProperties.push_back( "material.interpolation" );
shaderProperties.push_back( "shader" );
shaderProperties.push_back( "material.representation" );
shaderProperties.push_back( "color" );
shaderProperties.push_back( "opacity" );
shaderProperties.push_back( "material.wireframeLineWidth" );
observerAllocated = false;
mitk::ShaderRepository::GetGlobalShaderRepository();
}
QmitkMITKSurfaceMaterialEditorView::~QmitkMITKSurfaceMaterialEditorView()
{
}
void QmitkMITKSurfaceMaterialEditorView::InitPreviewWindow()
{
usedTimer=0;
vtkSphereSource* sphereSource = vtkSphereSource::New();
sphereSource->SetThetaResolution(25);
sphereSource->SetPhiResolution(25);
sphereSource->Update();
vtkPolyData* sphere = sphereSource->GetOutput();
m_Surface = mitk::Surface::New();
m_Surface->SetVtkPolyData( sphere );
m_DataNode = mitk::DataNode::New();
m_DataNode->SetData( m_Surface );
m_DataTree = mitk::StandaloneDataStorage::New();
m_DataTree->Add( m_DataNode , (mitk::DataNode *)0 );
m_Controls->m_PreviewRenderWindow->GetRenderer()->SetDataStorage( m_DataTree );
m_Controls->m_PreviewRenderWindow->GetRenderer()->SetMapperID( mitk::BaseRenderer::Standard3D );
sphereSource->Delete();
}
void QmitkMITKSurfaceMaterialEditorView::RefreshPropertiesList()
{
mitk::DataNode* SrcND = m_SelectedDataNode;
mitk::DataNode* DstND = m_DataNode;
mitk::PropertyList* DstPL = DstND->GetPropertyList();
m_Controls->m_ShaderPropertyList->SetPropertyList( 0 );
DstPL->Clear();
if(observerAllocated)
{
observedProperty->RemoveObserver( observerIndex );
observerAllocated=false;
}
if(SrcND)
{
mitk::PropertyList* SrcPL = SrcND->GetPropertyList();
mitk::ShaderProperty::Pointer shaderEnum = dynamic_cast<mitk::ShaderProperty*>(SrcPL->GetProperty("shader"));
std::string shaderState = "fixed";
if(shaderEnum.IsNotNull())
{
shaderState = shaderEnum->GetValueAsString();
itk::MemberCommand<QmitkMITKSurfaceMaterialEditorView>::Pointer propertyModifiedCommand = itk::MemberCommand<QmitkMITKSurfaceMaterialEditorView>::New();
propertyModifiedCommand->SetCallbackFunction(this, &QmitkMITKSurfaceMaterialEditorView::shaderEnumChange);
observerIndex = shaderEnum->AddObserver(itk::ModifiedEvent(), propertyModifiedCommand);
observedProperty = shaderEnum;
observerAllocated=true;
}
MITK_INFO << "PROPERTIES SCAN BEGIN";
for(mitk::PropertyList::PropertyMap::const_iterator it=SrcPL->GetMap()->begin(); it!=SrcPL->GetMap()->end(); it++)
{
std::string name=it->first;
- mitk::BaseProperty *p=it->second.first;
+ mitk::BaseProperty *p=it->second;
// MITK_INFO << "property '" << name << "' found";
if(shaderState.compare("fixed")==0)
{
if(std::find(fixedProperties.begin(), fixedProperties.end(), name) != fixedProperties.end())
{
DstPL->SetProperty(name,p);
}
}
else
{
//if(std::find(shaderProperties.begin(), shaderProperties.end(), name) != shaderProperties.end())
{
DstPL->SetProperty(name,p);
}
}
}
MITK_INFO << "PROPERTIES SCAN END";
}
m_Controls->m_ShaderPropertyList->SetPropertyList( DstPL );
//m_Controls->m_PreviewRenderWindow->GetRenderer()->GetVtkRenderer()->ResetCameraClippingRange();
}
/*
// subscribe for property change events
itk::MemberCommand<QmitkPropertiesTableModel>::Pointer propertyModifiedCommand =
itk::MemberCommand<QmitkPropertiesTableModel>::New();
propertyModifiedCommand->SetCallbackFunction(this, &QmitkPropertiesTableModel::PropertyModified);
m_PropertyModifiedObserverTags[it->first] = it->second.first->AddObserver(itk::ModifiedEvent(), propertyModifiedCommand);
itk::MemberCommand<QmitkDataStorageTableModel>::Pointer propertyModifiedCommand = itk::MemberCommand<QmitkDataStorageTableModel>::New();
propertyModifiedCommand->SetCallbackFunction(this, &QmitkDataStorageTableModel::PropertyModified);
mitk::BaseProperty* visibilityProperty = (*it)->GetProperty("visible");
if(visibilityProperty)
m_PropertyModifiedObserverTags[visibilityProperty]
= visibilityProperty->AddObserver(itk::ModifiedEvent(), propertyModifiedCommand);
mitk::BaseProperty* nameProperty = (*it)->GetProperty("name");
if(nameProperty)
m_PropertyModifiedObserverTags[nameProperty]
= nameProperty->AddObserver(itk::ModifiedEvent(), propertyModifiedCommand);
for(mitk::PropertyList::PropertyMap::const_iterator it=m_PropertyList->GetMap()->begin()
; it!=m_PropertyList->GetMap()->end()
; it++)
{
// add relevant property column values
m_PropertyListElements.push_back((*it));
// subscribe for property change events
itk::MemberCommand<QmitkPropertiesTableModel>::Pointer propertyModifiedCommand =
itk::MemberCommand<QmitkPropertiesTableModel>::New();
propertyModifiedCommand->SetCallbackFunction(this, &QmitkPropertiesTableModel::PropertyModified);
m_PropertyModifiedObserverTags[it->first] = it->second.first->AddObserver(itk::ModifiedEvent(), propertyModifiedCommand);*/
void QmitkMITKSurfaceMaterialEditorView::CreateQtPartControl(QWidget *parent)
{
if (!m_Controls)
{
// create GUI widgets
m_Controls = new Ui::QmitkMITKSurfaceMaterialEditorViewControls;
m_Controls->setupUi(parent);
this->CreateConnections();
InitPreviewWindow();
RefreshPropertiesList();
}
}
void QmitkMITKSurfaceMaterialEditorView::StdMultiWidgetAvailable (QmitkStdMultiWidget &stdMultiWidget)
{
m_MultiWidget = &stdMultiWidget;
}
void QmitkMITKSurfaceMaterialEditorView::StdMultiWidgetNotAvailable()
{
m_MultiWidget = NULL;
}
void QmitkMITKSurfaceMaterialEditorView::CreateConnections()
{
}
void QmitkMITKSurfaceMaterialEditorView::Activated()
{
QmitkFunctionality::Activated();
}
void QmitkMITKSurfaceMaterialEditorView::Deactivated()
{
QmitkFunctionality::Deactivated();
}
void QmitkMITKSurfaceMaterialEditorView::OnSelectionChanged(std::vector<mitk::DataNode*> nodes)
{
if(!nodes.empty())
{
m_SelectedDataNode = nodes.at(0);
MITK_INFO << "Node '" << m_SelectedDataNode->GetName() << "' selected";
SurfaceSelected();
}
}
void QmitkMITKSurfaceMaterialEditorView::SurfaceSelected()
{
postRefresh();
}
void QmitkMITKSurfaceMaterialEditorView::shaderEnumChange(const itk::Object * /*caller*/, const itk::EventObject & /*event*/)
{
postRefresh();
}
void QmitkMITKSurfaceMaterialEditorView::postRefresh()
{
if(usedTimer)
return;
usedTimer=startTimer(0);
}
void QmitkMITKSurfaceMaterialEditorView::timerEvent( QTimerEvent *e )
{
if(usedTimer!=e->timerId())
{
MITK_ERROR << "INTERNAL ERROR: usedTimer[" << usedTimer << "] != timerId[" << e->timerId() << "]";
}
if(usedTimer)
{
killTimer(usedTimer);
usedTimer=0;
}
RefreshPropertiesList();
}
\ No newline at end of file
diff --git a/Modules/Bundles/org.mitk.gui.qt.materialeditor/src/internal/QmitkMITKSurfaceMaterialEditorView.h b/Modules/Bundles/org.mitk.gui.qt.materialeditor/src/internal/QmitkMITKSurfaceMaterialEditorView.h
index 0b16d668b0..07f5f6dc6a 100644
--- a/Modules/Bundles/org.mitk.gui.qt.materialeditor/src/internal/QmitkMITKSurfaceMaterialEditorView.h
+++ b/Modules/Bundles/org.mitk.gui.qt.materialeditor/src/internal/QmitkMITKSurfaceMaterialEditorView.h
@@ -1,125 +1,131 @@
/*=========================================================================
Program: Medical Imaging & Interaction Toolkit
Language: C++
Date: $Date: 2009-03-21 19:27:37 +0100 (Sa, 21 Mrz 2009) $
Version: $Revision: 16719 $
Copyright (c) German Cancer Research Center, Division of Medical and
Biological Informatics. All rights reserved.
See MITKCopyright.txt or http://www.mitk.org/copyright.html for details.
This software is distributed WITHOUT ANY WARRANTY; without even
the implied warranty of MERCHANTABILITY or FITNESS FOR A PARTICULAR
PURPOSE. See the above copyright notices for more information.
=========================================================================*/
#ifndef _QMITKMITKSURFACEMATERIALEDITORVIEW_H_INCLUDED
#define _QMITKMITKSURFACEMATERIALEDITORVIEW_H_INCLUDED
#include <QmitkFunctionality.h>
#include <berryISelectionListener.h>
#include <berryIStructuredSelection.h>
#include <string>
#include "ui_QmitkMITKSurfaceMaterialEditorViewControls.h"
/*
#include <QtCore/QVariant>
#include <QtGui/QAction>
#include <QtGui/QApplication>
#include <QtGui/QButtonGroup>
#include <QtGui/QVBoxLayout>
#include <QtGui/QWidget>
#include "QtGui/QMenubarUpdatedEvent"
*/
#include "QmitkRenderWindow.h"
#include "mitkCommon.h"
#include "mitkDataStorage.h"
#include "mitkDataNode.h"
#include "mitkShaderProperty.h"
#include "mitkSurface.h"
#include "vtkRenderer.h"
#include "vtkTextActor.h"
/*!
\brief QmitkMITKSurfaceMaterialEditorView
\sa QmitkFunctionality
\ingroup Functionalities
*/
class QmitkMITKSurfaceMaterialEditorView : public QmitkFunctionality
{
// this is needed for all Qt objects that should have a MOC object (everything that derives from QObject)
Q_OBJECT
public:
static const std::string VIEW_ID;
QmitkMITKSurfaceMaterialEditorView();
+ QmitkMITKSurfaceMaterialEditorView(const QmitkMITKSurfaceMaterialEditorView& other)
+ {
+ Q_UNUSED(other)
+ throw std::runtime_error("Copy constructor not implemented");
+ }
+
virtual ~QmitkMITKSurfaceMaterialEditorView();
virtual void CreateQtPartControl(QWidget *parent);
/// \brief Creation of the connections of main and control widget
virtual void CreateConnections();
/// \brief Called when the functionality is activated
virtual void Activated();
virtual void Deactivated();
virtual void StdMultiWidgetAvailable (QmitkStdMultiWidget &stdMultiWidget);
virtual void StdMultiWidgetNotAvailable();
virtual void OnSelectionChanged(std::vector<mitk::DataNode*> nodes);
protected slots:
void SurfaceSelected();
protected:
Ui::QmitkMITKSurfaceMaterialEditorViewControls* m_Controls;
QmitkStdMultiWidget* m_MultiWidget;
private:
mitk::Surface::Pointer m_Surface;
mitk::DataStorage::Pointer m_DataTree;
mitk::DataNode::Pointer m_DataNode;
mitk::DataNode::Pointer m_SelectedDataNode;
std::list<std::string> fixedProperties;
std::list<std::string> shaderProperties;
unsigned long observerIndex;
bool observerAllocated;
mitk::ShaderProperty::Pointer observedProperty;
void InitPreviewWindow();
int usedTimer;
void timerEvent( QTimerEvent *e );
void RefreshPropertiesList();
void postRefresh();
void shaderEnumChange(const itk::Object *caller, const itk::EventObject &event);
berry::IStructuredSelection::ConstPointer m_CurrentSelection;
berry::ISelectionListener::Pointer m_SelectionListener;
};
#endif // _QMITKMITKSURFACEMATERIALEDITORVIEW_H_INCLUDED
diff --git a/Modules/Bundles/org.mitk.gui.qt.materialeditor/src/internal/mitkMaterialEditorPluginActivator.cpp b/Modules/Bundles/org.mitk.gui.qt.materialeditor/src/internal/mitkMaterialEditorPluginActivator.cpp
new file mode 100644
index 0000000000..4b302006d9
--- /dev/null
+++ b/Modules/Bundles/org.mitk.gui.qt.materialeditor/src/internal/mitkMaterialEditorPluginActivator.cpp
@@ -0,0 +1,21 @@
+#include "mitkMaterialEditorPluginActivator.h"
+
+#include "QmitkMITKSurfaceMaterialEditorView.h"
+
+#include <QtPlugin>
+
+namespace mitk {
+
+ void MaterialEditorPluginActivator::start(ctkPluginContext* context)
+ {
+ BERRY_REGISTER_EXTENSION_CLASS(QmitkMITKSurfaceMaterialEditorView, context)
+ }
+
+ void MaterialEditorPluginActivator::stop(ctkPluginContext* context)
+ {
+ Q_UNUSED(context)
+ }
+
+}
+
+Q_EXPORT_PLUGIN2(org_mitk_gui_qt_materialeditor, mitk::MaterialEditorPluginActivator)
\ No newline at end of file
diff --git a/Modules/Bundles/org.mitk.gui.qt.materialeditor/src/internal/mitkMaterialEditorPluginActivator.h b/Modules/Bundles/org.mitk.gui.qt.materialeditor/src/internal/mitkMaterialEditorPluginActivator.h
new file mode 100644
index 0000000000..fa8dfef736
--- /dev/null
+++ b/Modules/Bundles/org.mitk.gui.qt.materialeditor/src/internal/mitkMaterialEditorPluginActivator.h
@@ -0,0 +1,23 @@
+#ifndef MITKMATERIALEDITORPLUGINACTIVATOR_H
+#define MITKMATERIALEDITORPLUGINACTIVATOR_H
+
+#include <ctkPluginActivator.h>
+
+namespace mitk {
+
+ class MaterialEditorPluginActivator :
+ public QObject, public ctkPluginActivator
+ {
+ Q_OBJECT
+ Q_INTERFACES(ctkPluginActivator)
+
+ public:
+
+ void start(ctkPluginContext* context);
+ void stop(ctkPluginContext* context);
+
+ }; // MaterialEditorPluginActivator
+
+}
+
+#endif // MITKMATERIALEDITORPLUGINACTIVATOR_H
\ No newline at end of file
diff --git a/Modules/Bundles/org.mitk.gui.qt.measurement/CMakeLists.txt b/Modules/Bundles/org.mitk.gui.qt.measurement/CMakeLists.txt
index 32a071389f..3d755b18bc 100644
--- a/Modules/Bundles/org.mitk.gui.qt.measurement/CMakeLists.txt
+++ b/Modules/Bundles/org.mitk.gui.qt.measurement/CMakeLists.txt
@@ -1 +1,9 @@
-MACRO_CREATE_MITK_PLUGIN(QmitkExt PlanarFigure)
+# The project name must correspond to the directory name of your plug-in
+# and must not contain periods.
+PROJECT(org_mitk_gui_qt_measurement)
+
+MACRO_CREATE_MITK_CTK_PLUGIN(
+ EXPORT_DIRECTIVE MITK_QT_MEASUREMENT
+ EXPORTED_INCLUDE_SUFFIXES src
+ MODULE_DEPENDENCIES QmitkExt PlanarFigure
+)
\ No newline at end of file
diff --git a/Modules/Bundles/org.mitk.gui.qt.measurement/META-INF/MANIFEST.MF b/Modules/Bundles/org.mitk.gui.qt.measurement/META-INF/MANIFEST.MF
deleted file mode 100644
index 592a6a5202..0000000000
--- a/Modules/Bundles/org.mitk.gui.qt.measurement/META-INF/MANIFEST.MF
+++ /dev/null
@@ -1,6 +0,0 @@
-Manifest-Version: 1.0
-Bundle-Name: Measurement
-Bundle-SymbolicName: org.mitk.gui.qt.measurement
-Bundle-Version: 1.0.0
-Bundle-Vendor: DKFZ, Medical and Biological Informatics
-Require-Bundle: org.mitk.gui.qt.common
\ No newline at end of file
diff --git a/Modules/Bundles/org.mitk.gui.qt.measurement/files.cmake b/Modules/Bundles/org.mitk.gui.qt.measurement/files.cmake
index 1d71c262ce..6037404b16 100644
--- a/Modules/Bundles/org.mitk.gui.qt.measurement/files.cmake
+++ b/Modules/Bundles/org.mitk.gui.qt.measurement/files.cmake
@@ -1,45 +1,48 @@
SET(SRC_CPP_FILES
)
SET(INTERNAL_CPP_FILES
QmitkMeasurement.cpp
QmitkPlanarFiguresTableModel.cpp
+ mitkPluginActivator.cpp
)
SET(UI_FILES
)
SET(MOC_H_FILES
src/internal/QmitkMeasurement.h
src/internal/QmitkPlanarFiguresTableModel.h
+ src/internal/mitkPluginActivator.h
)
-SET(RESOURCE_FILES
+SET(CACHED_RESOURCE_FILES
resources/measurement.png
resources/angle.png
resources/arrow.png
resources/circle.png
resources/four-point-angle.png
resources/line.png
resources/measurement.png
resources/path.png
resources/polygon.png
resources/rectangle.png
resources/text.png
+ plugin.xml
)
-SET(RES_FILES
+SET(QRC_FILES
resources/measurement.qrc
)
-SET(CPP_FILES manifest.cpp)
+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/Modules/Bundles/org.mitk.gui.qt.measurement/manifest.cpp b/Modules/Bundles/org.mitk.gui.qt.measurement/manifest.cpp
deleted file mode 100644
index 98796306a7..0000000000
--- a/Modules/Bundles/org.mitk.gui.qt.measurement/manifest.cpp
+++ /dev/null
@@ -1,26 +0,0 @@
-/*=========================================================================
-
-Program: Medical Imaging & Interaction Toolkit
-Language: C++
-Date: $Date$
-Version: $Revision: 14645 $
-
-Copyright (c) German Cancer Research Center, Division of Medical and
-Biological Informatics. All rights reserved.
-See MITKCopyright.txt or http://www.mitk.org/copyright.html for details.
-
-This software is distributed WITHOUT ANY WARRANTY; without even
-the implied warranty of MERCHANTABILITY or FITNESS FOR A PARTICULAR
-PURPOSE. See the above copyright notices for more information.
-
-=========================================================================*/
-
-#include <Poco/ClassLibrary.h>
-
-#include <berryIViewPart.h>
-#include "src/internal/QmitkMeasurement.h"
-
-
-POCO_BEGIN_NAMED_MANIFEST(berryIViewPart, berry::IViewPart)
- POCO_EXPORT_CLASS(QmitkMeasurement)
-POCO_END_MANIFEST
diff --git a/Modules/Bundles/org.mitk.gui.qt.measurement/manifest_headers.cmake b/Modules/Bundles/org.mitk.gui.qt.measurement/manifest_headers.cmake
new file mode 100644
index 0000000000..476b73c99f
--- /dev/null
+++ b/Modules/Bundles/org.mitk.gui.qt.measurement/manifest_headers.cmake
@@ -0,0 +1,5 @@
+set(Plugin-Name "Measurement")
+set(Plugin-Version "1.0.0")
+set(Plugin-Vendor "DKFZ, Medical and Biological Informatics")
+set(Plugin-ContactAddress "http://www.mitk.org")
+set(Require-Plugin org.mitk.gui.qt.common)
\ No newline at end of file
diff --git a/Modules/Bundles/org.mitk.gui.qt.measurement/src/internal/QmitkMeasurement.h b/Modules/Bundles/org.mitk.gui.qt.measurement/src/internal/QmitkMeasurement.h
index 8f861b0e20..623235e862 100644
--- a/Modules/Bundles/org.mitk.gui.qt.measurement/src/internal/QmitkMeasurement.h
+++ b/Modules/Bundles/org.mitk.gui.qt.measurement/src/internal/QmitkMeasurement.h
@@ -1,201 +1,208 @@
/*=========================================================================
Program: Medical Imaging & Interaction Toolkit
Language: C++
Date: $Date$
Version: $Revision: 15412 $
Copyright (c) German Cancer Research Center, Division of Medical and
Biological Informatics. All rights reserved.
See MITKCopyright.txt or http://www.mitk.org/copyright.html for details.
This software is distributed WITHOUT ANY WARRANTY; without even
the implied warranty of MERCHANTABILITY or FITNESS FOR A PARTICULAR
PURPOSE. See the above copyright notices for more information.
=========================================================================*/
#if !defined(QMITK_MEASUREMENT_H__INCLUDED)
#define QMITK_MEASUREMENT_H__INCLUDED
#include <berryIPartListener.h>
#include <berryISelection.h>
#include <berryISelectionProvider.h>
#include <berryIPreferencesService.h>
#include <berryIBerryPreferences.h>
#include <berryISelectionListener.h>
#include <berryIStructuredSelection.h>
#include <mitkWeakPointer.h>
#include <mitkPlanarFigure.h>
#include <mitkDataStorageSelection.h>
#include <QmitkFunctionality.h>
#include <QmitkStandardViews.h>
#include <QmitkStdMultiWidgetEditor.h>
class QmitkPlanarFiguresTableModel;
class QGridLayout;
class QMainWindow;
class QToolBar;
class QLabel;
class QTableView;
class QTextBrowser;
class vtkRenderer;
class vtkCornerAnnotation;
///
/// A view for doing measurements in digital images by means of
/// mitk::Planarfigures which can represent drawing primitives (Lines, circles, ...).
/// The view consists of only three main elements:
/// 1. A toolbar for activating PlanarFigure drawing
/// 2. A textbrowser which shows details for the selected PlanarFigures
/// 3. A button for copying all details to the clipboard
///
class QmitkMeasurement : public QmitkFunctionality
{
Q_OBJECT
public:
///
/// Just a shortcut
///
typedef std::vector<mitk::DataNode::Pointer> DataNodes;
///
/// Initialize pointers to 0. The rest is done in CreateQtPartControl()
///
QmitkMeasurement();
+
+ QmitkMeasurement(const QmitkMeasurement& other)
+ {
+ Q_UNUSED(other)
+ throw std::runtime_error("Copy constructor not implemented");
+ }
+
///
/// Remove all event listener from DataStorage, DataStorageSelection, Selection Service
///
virtual ~QmitkMeasurement();
public:
///
/// Initializes all variables.
/// Builds up GUI.
///
void CreateQtPartControl(QWidget* parent);
///
/// Set widget planes visibility to false.
/// Show only transversal view.
/// Add an interactor to all PlanarFigures in the DataStorage (if they dont have one yet).
/// Add their interactor to the global interaction.
///
virtual void Activated();
///
/// Show widget planes and all renderwindows again.
/// Remove all planar figure interactors from the global interaction.
///
virtual void Deactivated();
///
/// Invoked from a DataStorage selection
///
virtual void NodeChanged(const mitk::DataNode* node);
virtual void PropertyChanged(const mitk::DataNode* node, const mitk::BaseProperty* prop);
virtual void NodeRemoved(const mitk::DataNode* node);
virtual void NodeAddedInDataStorage(const mitk::DataNode* node);
virtual void PlanarFigureInitialized();
virtual void PlanarFigureSelected( itk::Object* object, const itk::EventObject& event );
virtual void AddFigureToDataStorage(mitk::PlanarFigure* figure, const QString& name,
const char *propertyKey = NULL, mitk::BaseProperty *property = NULL );
///
/// Invoked when the DataManager selection changed.
/// If an image is in the selection it will be set as the selected one for measurement,
/// If a planarfigure is in the selection its parent image will be set as the selected one for measurement.
/// All selected planarfigures will be added to m_SelectedPlanarFigures.
/// Then PlanarFigureSelectionChanged is called
///
virtual void OnSelectionChanged(std::vector<mitk::DataNode*> nodes);
public slots:
///
/// Called when the renderwindow gets deleted
///
void OnRenderWindowDelete(QObject * obj = 0);
protected:
///
/// Prints all features of the selected PlanarFigures into the TextBrowser.
/// For the last figure in the selection list:
/// - Go to the corresponding slice and show figure
/// - Draw info text on the bottom right side of the corresponding renderwindow
///
void PlanarFigureSelectionChanged();
/// Draws a string on the bottom left side of the render window
///
void SetMeasurementInfoToRenderWindow(const QString& text, QmitkRenderWindow* _RenderWindow);
bool AssertDrawingIsPossible(bool checked);
protected slots:
///# draw actions
void ActionDrawLineTriggered( bool checked = false );
void ActionDrawPathTriggered( bool checked = false );
void ActionDrawAngleTriggered( bool checked = false );
void ActionDrawFourPointAngleTriggered( bool checked = false );
void ActionDrawEllipseTriggered( bool checked = false );
void ActionDrawRectangleTriggered( bool checked = false );
void ActionDrawPolygonTriggered( bool checked = false );
void ActionDrawArrowTriggered( bool checked = false );
void ActionDrawTextTriggered( bool checked = false );
void CopyToClipboard( bool checked = false );
// fields
// widgets
protected:
QGridLayout* m_Layout;
QLabel* m_SelectedImage;
QAction* m_DrawLine;
QAction* m_DrawPath;
QAction* m_DrawAngle;
QAction* m_DrawFourPointAngle;
QAction* m_DrawEllipse;
QAction* m_DrawRectangle;
QAction* m_DrawPolygon;
QToolBar* m_DrawActionsToolBar;
QActionGroup* m_DrawActionsGroup;
QTextBrowser* m_SelectedPlanarFiguresText;
QPushButton* m_CopyToClipboard;
vtkRenderer * m_MeasurementInfoRenderer;
vtkCornerAnnotation *m_MeasurementInfoAnnotation;
// Selection service
/// berry::SelectionChangedAdapter<QmitkPropertyListView> must be a friend to call
friend struct berry::SelectionChangedAdapter<QmitkMeasurement>;
berry::ISelectionListener::Pointer m_SelectionListener;
mitk::DataStorageSelection::Pointer m_SelectedPlanarFigures;
/// Selected image on which measurements will be performed
///
mitk::DataStorageSelection::Pointer m_SelectedImageNode;
mitk::WeakPointer<mitk::DataNode> m_CurrentFigureNode;
/// Counter variables to give a newly created Figure a unique name.
///
unsigned int m_LineCounter;
unsigned int m_PathCounter;
unsigned int m_AngleCounter;
unsigned int m_FourPointAngleCounter;
unsigned int m_EllipseCounter;
unsigned int m_RectangleCounter;
unsigned int m_PolygonCounter;
unsigned int m_EndPlacementObserverTag;
unsigned int m_SelectObserverTag;
bool m_Visible;
bool m_CurrentFigureNodeInitialized;
///
/// Saves the last renderwindow any info data was inserted
///
QmitkRenderWindow* m_LastRenderWindow;
private:
mitk::DataNode::Pointer DetectTopMostVisibleImage();
};
#endif // !defined(QMITK_MEASUREMENT_H__INCLUDED)
diff --git a/Modules/Bundles/org.mitk.gui.qt.measurement/src/internal/mitkPluginActivator.cpp b/Modules/Bundles/org.mitk.gui.qt.measurement/src/internal/mitkPluginActivator.cpp
new file mode 100644
index 0000000000..d69d14e585
--- /dev/null
+++ b/Modules/Bundles/org.mitk.gui.qt.measurement/src/internal/mitkPluginActivator.cpp
@@ -0,0 +1,20 @@
+#include "mitkPluginActivator.h"
+#include "QmitkMeasurement.h"
+
+#include <QtPlugin>
+
+namespace mitk {
+
+void PluginActivator::start(ctkPluginContext* context)
+{
+ BERRY_REGISTER_EXTENSION_CLASS(QmitkMeasurement, context)
+}
+
+void PluginActivator::stop(ctkPluginContext* context)
+{
+ Q_UNUSED(context)
+}
+
+}
+
+Q_EXPORT_PLUGIN2(org.mitk.gui.qt.measurement, mitk::PluginActivator)
\ No newline at end of file
diff --git a/Modules/Bundles/org.mitk.gui.qt.measurement/src/internal/mitkPluginActivator.h b/Modules/Bundles/org.mitk.gui.qt.measurement/src/internal/mitkPluginActivator.h
new file mode 100644
index 0000000000..70c968b98e
--- /dev/null
+++ b/Modules/Bundles/org.mitk.gui.qt.measurement/src/internal/mitkPluginActivator.h
@@ -0,0 +1,23 @@
+#ifndef MITKPLUGINACTIVATOR_H
+#define MITKPLUGINACTIVATOR_H
+
+#include <ctkPluginActivator.h>
+
+namespace mitk {
+
+class PluginActivator :
+ public QObject, public ctkPluginActivator
+{
+ Q_OBJECT
+ Q_INTERFACES(ctkPluginActivator)
+
+public:
+
+ void start(ctkPluginContext* context);
+ void stop(ctkPluginContext* context);
+
+}; // PluginActivator
+
+}
+
+#endif // MITKPLUGINACTIVATOR_H
\ No newline at end of file
diff --git a/Modules/Bundles/org.mitk.gui.qt.measurement/src/mitkQmitkMeasurementDll.h b/Modules/Bundles/org.mitk.gui.qt.measurement/src/mitkQmitkMeasurementDll.h
deleted file mode 100644
index 4a1c7c8390..0000000000
--- a/Modules/Bundles/org.mitk.gui.qt.measurement/src/mitkQmitkMeasurementDll.h
+++ /dev/null
@@ -1,41 +0,0 @@
-/*=========================================================================
-
-Program: Medical Imaging & Interaction Toolkit
-Language: C++
-Date: $Date$
-Version: $Revision: 14620 $
-
-Copyright (c) German Cancer Research Center, Division of Medical and
-Biological Informatics. All rights reserved.
-See MITKCopyright.txt or http://www.mitk.org/copyright.html for details.
-
-This software is distributed WITHOUT ANY WARRANTY; without even
-the implied warranty of MERCHANTABILITY or FITNESS FOR A PARTICULAR
-PURPOSE. See the above copyright notices for more information.
-
-=========================================================================*/
-
-#ifndef MITKQTMEASUREMENTDLL_H_
-#define MITKQTMEASUREMENTDLL_H_
-
-//
-// The following block is the standard way of creating macros which make exporting
-// from a DLL simpler. All files within this DLL are compiled with the org_mitk_gui_qt_application_EXPORTS
-// symbol defined on the command line. this symbol should not be defined on any project
-// that uses this DLL. This way any other project whose source files include this file see
-// MITK_QT_APP functions as being imported from a DLL, wheras this DLL sees symbols
-// defined with this macro as being exported.
-//
-#if defined(_WIN32) && !defined(BERRY_STATIC)
- #if defined(org_mitk_gui_qt_measurement_EXPORTS)
- #define MITK_QT_MEASUREMENT __declspec(dllexport)
- #else
- #define MITK_QT_MEASUREMENT __declspec(dllimport)
- #endif
-#endif
-
-#if !defined(MITK_QT_MEASUREMENT)
- #define MITK_QT_MEASUREMENT
-#endif
-
-#endif /*MITKQTMEASUREMENTDLL_H_*/
diff --git a/Modules/Bundles/org.mitk.gui.qt.moviemaker/src/internal/QmitkMovieMaker.cpp b/Modules/Bundles/org.mitk.gui.qt.moviemaker/src/internal/QmitkMovieMaker.cpp
index f59f354554..8dc7ead4a4 100644
--- a/Modules/Bundles/org.mitk.gui.qt.moviemaker/src/internal/QmitkMovieMaker.cpp
+++ b/Modules/Bundles/org.mitk.gui.qt.moviemaker/src/internal/QmitkMovieMaker.cpp
@@ -1,753 +1,763 @@
/*=========================================================================
Program: Medical Imaging & Interaction Toolkit
Language: C++
Date: $Date$
Version: $Revision: 16947 $
Copyright (c) German Cancer Research Center, Division of Medical and
Biological Informatics. All rights reserved.
See MITKCopyright.txt or http://www.mitk.org/copyright.html for details.
This software is distributed WITHOUT ANY WARRANTY; without even
the implied warranty of MERCHANTABILITY or FITNESS FOR A PARTICULAR
PURPOSE. See the above copyright notices for more information.
=========================================================================*/
#include "QmitkMovieMaker.h"
//#include "QmitkMovieMakerControls.h"
#include "QmitkStepperAdapter.h"
#include "QmitkStdMultiWidget.h"
#include "QmitkCommonFunctionality.h"
/*=========================================================================
Program: Medical Imaging & Interaction Toolkit
Language: C++
Date: $Date$
Version: $Revision: 16947 $
Copyright (c) German Cancer Research Center, Division of Medical and
Biological Informatics. All rights reserved.
See MITKCopyright.txt or http://www.mitk.org/copyright.html for details.
This software is distributed WITHOUT ANY WARRANTY; without even
the implied warranty of MERCHANTABILITY or FITNESS FOR A PARTICULAR
PURPOSE. See the above copyright notices for more information.
=========================================================================*/
#include "QmitkMovieMaker.h"
//#include "QmitkMovieMakerControls.h"
#include "QmitkStepperAdapter.h"
#include "QmitkStdMultiWidget.h"
#include "QmitkCommonFunctionality.h"
#include "mitkVtkPropRenderer.h"
#include "mitkGlobalInteraction.h"
#include <iostream>
#include <vtkRenderer.h>
#include <vtkCamera.h>
#include <qaction.h>
#include <qfiledialog.h>
#include <qtimer.h>
#include <qdatetime.h>
#include <qspinbox.h>
#include <qcombobox.h>
#include "qapplication.h"
#include "vtkImageWriter.h"
#include "vtkJPEGWriter.h"
#include "vtkPNGWriter.h"
#include "vtkRenderLargeImage.h"
#include "vtkRenderWindowInteractor.h"
#include "vtkRenderer.h"
#include "vtkTestUtilities.h"
#include <vtkActor.h>
#include "vtkMitkRenderProp.h"
#include <vtkRenderer.h>
#include <vtkRenderWindow.h>
#include "vtkRenderWindowInteractor.h"
#include <qradiobutton.h>
QmitkMovieMaker::QmitkMovieMaker(QObject *parent, const char * /*name*/)
:
QmitkFunctionality(), m_Controls(NULL),
m_StepperAdapter(NULL),
m_FocusManagerCallback(0), m_Looping(true), m_Direction(0), m_Aspect(0)
{
parentWidget = parent;
m_Timer = new QTimer(this);
m_Time = new QTime();
m_FocusManagerCallback = MemberCommand::New();
m_FocusManagerCallback->SetCallbackFunction(this, &QmitkMovieMaker::FocusChange);
m_movieGenerator = mitk::MovieGenerator::New();
if (m_movieGenerator.IsNull())
{
MITK_ERROR << "Either mitk::MovieGenerator is not implemented for your";
MITK_ERROR << " platform or an error occurred during";
MITK_ERROR << " mitk::MovieGenerator::New()" ;
}
}
QmitkMovieMaker::~QmitkMovieMaker()
{
delete m_StepperAdapter;
delete m_Timer;
delete m_Time;
//delete m_RecordingRenderer;
}
mitk::BaseController* QmitkMovieMaker::GetSpatialController()
{
mitk::BaseRenderer* focusedRenderer = mitk::GlobalInteraction::GetInstance()->GetFocus();
if (mitk::BaseRenderer::GetInstance(GetActiveStdMultiWidget()->mitkWidget1->GetRenderWindow())
== focusedRenderer)
{
return GetActiveStdMultiWidget()->mitkWidget1->GetController();
}
else if (mitk::BaseRenderer::GetInstance(
GetActiveStdMultiWidget()->mitkWidget2->GetRenderWindow()) == focusedRenderer)
{
return GetActiveStdMultiWidget()->mitkWidget2->GetController();
}
else if (mitk::BaseRenderer::GetInstance(
GetActiveStdMultiWidget()->mitkWidget3->GetRenderWindow()) == focusedRenderer)
{
return GetActiveStdMultiWidget()->mitkWidget3->GetController();
}
else if (mitk::BaseRenderer::GetInstance(
GetActiveStdMultiWidget()->mitkWidget4->GetRenderWindow()) == focusedRenderer)
{
return GetActiveStdMultiWidget()->mitkWidget4->GetController();
}
return GetActiveStdMultiWidget()->mitkWidget4->GetController();
}
mitk::BaseController* QmitkMovieMaker::GetTemporalController()
{
return GetActiveStdMultiWidget()->GetTimeNavigationController();
}
void QmitkMovieMaker::CreateConnections()
{
if (m_Controls)
{
// start / pause / stop playing
connect((QObject*) m_Controls->btnPlay, SIGNAL(clicked()), (QObject*) this,
SLOT(StartPlaying()));
connect((QObject*) m_Controls->btnPause, SIGNAL(clicked()), this, SLOT(PausePlaying()));
connect((QObject*) m_Controls->btnStop, SIGNAL(clicked()), this, SLOT(StopPlaying()));
connect((QObject*) m_Controls->rbtnForward, SIGNAL(clicked()), this, SLOT(RBTNForward()));
connect((QObject*) m_Controls->rbtnBackward, SIGNAL(clicked()), this, SLOT(RBTNBackward()));
connect((QObject*) m_Controls->rbtnPingPong, SIGNAL(clicked()), this, SLOT(RBTNPingPong()));
// radio button group: forward, backward, ping-pong
connect( this, SIGNAL(SwitchDirection(int)), this, SLOT(SetDirection(int)) );
// radio button group: spatial, temporal
connect((QObject*) m_Controls->rbtnSpatial, SIGNAL(clicked()), this, SLOT(RBTNSpatial()));
connect((QObject*) m_Controls->rbtnTemporal, SIGNAL(clicked()), this, SLOT(RBTNTemporal()));
connect((QObject*) m_Controls->rbtnCombined, SIGNAL(clicked()), this, SLOT(RBTNCombined()));
connect( this, SIGNAL(SwitchAspect(int)), this, SLOT(SetAspect(int)) );
// stepper window selection
connect((QObject*) (m_Controls->cmbSelectedStepperWindow), SIGNAL ( activated ( int) ), (QObject*) this, SLOT ( SetStepperWindow (int) ) );
// recording window selection
connect((QObject*) (m_Controls->cmbSelectedRecordingWindow), SIGNAL ( activated ( int) ), (QObject*) this, SLOT ( SetRecordingWindow (int) ) );
// advance the animation
// every timer tick
connect((QObject*) m_Timer, SIGNAL(timeout()), this, SLOT(AdvanceAnimation()));
// movie generation
// when the movie button is clicked
connect((QObject*) m_Controls->btnMovie, SIGNAL(clicked()), this, SLOT(GenerateMovie()));
connect((QObject*) m_Controls->btnScreenshot, SIGNAL(clicked()), this, SLOT(
GenerateScreenshot()));
connect((QObject*) m_Controls->m_HRScreenshot, SIGNAL(clicked()), this, SLOT(
GenerateHR3DScreenshot()));
// blocking of ui elements during movie generation
connect((QObject*) this, SIGNAL(StartBlockControls()), (QObject*) this, SLOT(BlockControls()));
connect((QObject*) this, SIGNAL(EndBlockControls()), (QObject*) this, SLOT(UnBlockControls()));
connect((QObject*) this, SIGNAL(EndBlockControlsMovieDeactive()), (QObject*) this, SLOT(
UnBlockControlsMovieDeactive()));
// allow for change of spatialtime relation
connect((QObject*) m_Controls->spatialTimeRelation, SIGNAL(valueChanged ( int ) ), this, SLOT( DeleteMStepper() ) );
}
}
void QmitkMovieMaker::Activated()
{
QmitkFunctionality::Activated();
// create a member command that will be executed from the observer
itk::SimpleMemberCommand<QmitkMovieMaker>::Pointer stepperChangedCommand;
stepperChangedCommand = itk::SimpleMemberCommand<QmitkMovieMaker>::New();
// set the callback function of the member command
stepperChangedCommand->SetCallbackFunction(this, &QmitkMovieMaker::UpdateGUI);
// add an observer to the data tree node pointer connected to the above member command
MITK_INFO << "Add observer on insertion point node in NavigationPathController::AddObservers";
m_StepperObserverTag = this->GetTemporalController()->GetTime()->AddObserver(
itk::ModifiedEvent(), stepperChangedCommand);
m_FocusManagerObserverTag
= mitk::GlobalInteraction::GetInstance()->GetFocusManager()->AddObserver(mitk::FocusEvent(),
m_FocusManagerCallback);
this->UpdateGUI();
// Initialize steppers etc.
this->FocusChange();
}
void QmitkMovieMaker::Deactivated()
{
QmitkFunctionality::Deactivated();
this->GetTemporalController()->GetTime()->RemoveObserver(m_StepperObserverTag);
mitk::GlobalInteraction::GetInstance()->GetFocusManager()->RemoveObserver(
m_FocusManagerObserverTag); // remove (if tag is invalid, nothing is removed)
}
void QmitkMovieMaker::FocusChange()
{
mitk::Stepper *stepper = this->GetAspectStepper();
m_StepperAdapter->SetStepper(stepper);
// Make the stepper movement non-inverted
stepper->InverseDirectionOff();
// Set stepping direction and aspect (spatial / temporal) for new stepper
this->UpdateLooping();
this->UpdateDirection();
// Set newly focused window as active in "Selected Window" combo box
const mitk::RenderingManager::RenderWindowVector rwv =
mitk::RenderingManager::GetInstance()->GetAllRegisteredRenderWindows();
int i;
mitk::RenderingManager::RenderWindowVector::const_iterator iter;
for (iter = rwv.begin(), i = 0; iter != rwv.end(); ++iter, ++i)
{
mitk::BaseRenderer* focusedRenderer =
mitk::GlobalInteraction::GetInstance()->GetFocusManager()->GetFocused();
if (focusedRenderer == mitk::BaseRenderer::GetInstance((*iter)))
{
m_Controls->cmbSelectedStepperWindow->setCurrentIndex(i);
// this->cmbSelectedStepperWindow_activated(i);
this->SetStepperWindow(i);
m_Controls->cmbSelectedRecordingWindow->setCurrentIndex(i);
// this->cmbSelectedRecordWindow_activated(i);
this->SetRecordingWindow(i);
break;
}
}
}
void QmitkMovieMaker::AdvanceAnimation()
{
// This method is called when a timer timeout occurs. It increases the
// stepper value according to the elapsed time and the stepper interval.
// Note that a screen refresh is not forced, but merely requested, and may
// occur only after more calls to AdvanceAnimation().
mitk::Stepper* stepper = this->GetAspectStepper();
m_StepperAdapter->SetStepper(stepper);
int elapsedTime = m_Time->elapsed();
m_Time->restart();
static double increment = 0.0;
increment = increment - static_cast<int> (increment);
increment += elapsedTime * stepper->GetSteps() / (m_Controls->spnDuration->value() * 1000.0);
int i, n = static_cast<int> (increment);
for (i = 0; i < n; ++i)
{
stepper->Next();
}
}
void QmitkMovieMaker::RenderSlot()
{
int *i = widget->GetRenderWindow()->GetSize();
m_PropRenderer->Resize(i[0], i[1]);
widget->GetRenderWindow()->Render();
}
void QmitkMovieMaker::PausePlaying()
{
m_Controls->slidAngle->setDisabled(false);
m_Controls->btnMovie->setEnabled(true);
m_Controls->btnPlay->setEnabled(true);
m_Controls->btnScreenshot->setEnabled(true);
m_Timer->stop();
m_Controls->btnPlay->setHidden(false);
m_Controls->btnPause->setHidden(true);
if (m_movieGenerator.IsNull())
m_Controls->btnMovie->setEnabled(false);
}
void QmitkMovieMaker::StopPlaying()
{
m_Controls->slidAngle->setDisabled(false);
m_Controls->btnMovie->setEnabled(true);
m_Controls->btnPlay->setEnabled(true);
m_Controls->btnScreenshot->setEnabled(true);
m_Controls->btnPlay->setHidden(false);
m_Controls->btnPause->setHidden(true);
m_Timer->stop();
switch (m_Direction)
{
case 0:
case 2:
this->GetAspectStepper()->First();
break;
case 1:
this->GetAspectStepper()->Last();
break;
}
// Reposition slider GUI element
m_StepperAdapter->SetStepper(this->GetAspectStepper());
if (m_movieGenerator.IsNull())
m_Controls->btnMovie->setEnabled(false);
}
void QmitkMovieMaker::SetLooping(bool looping)
{
m_Looping = looping;
this->UpdateLooping();
}
void QmitkMovieMaker::SetDirection(int direction)
{
m_Direction = direction;
this->UpdateDirection();
}
void QmitkMovieMaker::SetAspect(int aspect)
{
m_Aspect = aspect;
m_StepperAdapter->SetStepper(this->GetAspectStepper());
this->UpdateLooping();
this->UpdateDirection();
}
void QmitkMovieMaker::SetStepperWindow(int window)
{
// Set newly selected window / renderer as focused
const mitk::RenderingManager::RenderWindowVector rwv =
mitk::RenderingManager::GetInstance()->GetAllRegisteredRenderWindows();
//Delete MultiStepper
DeleteMStepper();
int i;
mitk::RenderingManager::RenderWindowVector::const_iterator iter;
for (iter = rwv.begin(), i = 0; iter != rwv.end(); ++iter, ++i)
{
if (i == window)
{
mitk::GlobalInteraction::GetInstance()->GetFocusManager() ->SetFocused(
mitk::BaseRenderer::GetInstance((*iter)));
break;
}
}
}
void QmitkMovieMaker::SetRecordingWindow(int window)
{
// Set newly selected window for recording
const mitk::RenderingManager::RenderWindowVector rwv =
mitk::RenderingManager::GetInstance()->GetAllRegisteredRenderWindows();
//Delete MultiStepper
DeleteMStepper();
int i;
mitk::RenderingManager::RenderWindowVector::const_iterator iter;
for (iter = rwv.begin(), i = 0; iter != rwv.end(); ++iter, ++i)
{
if (i == window)
{
m_RecordingRenderer = mitk::BaseRenderer::GetInstance((*iter));
break;
}
}
}
void QmitkMovieMaker::UpdateLooping()
{
this->GetAspectStepper()->SetAutoRepeat(m_Looping);
}
void QmitkMovieMaker::UpdateDirection()
{
mitk::Stepper* stepper = this->GetAspectStepper();
switch (m_Direction)
{
case 0:
stepper->InverseDirectionOff();
stepper->PingPongOff();
break;
case 1:
stepper->InverseDirectionOn();
stepper->PingPongOff();
break;
case 2:
stepper->PingPongOn();
break;
}
}
mitk::Stepper* QmitkMovieMaker::GetAspectStepper()
{
if (m_Aspect == 0)
{
m_Stepper = NULL;
return this->GetSpatialController()->GetSlice();
}
else if (m_Aspect == 1)
{
m_Stepper = NULL;
return this->GetTemporalController()->GetTime();
}
else if (m_Aspect == 2)
{
if (m_Stepper.IsNull())
{
int rel = m_Controls->spatialTimeRelation->value();
int timeRepeat = 1;
int sliceRepeat = 1;
if (rel < 0)
{
sliceRepeat = -rel;
}
else if (rel > 0)
{
timeRepeat = rel;
}
m_Stepper = mitk::MultiStepper::New();
m_Stepper->AddStepper(this->GetSpatialController()->GetSlice(), sliceRepeat);
m_Stepper->AddStepper(this->GetTemporalController()->GetTime(), timeRepeat);
}
return m_Stepper.GetPointer();
}
else
{
// should never get here
return 0;
}
}
void QmitkMovieMaker::GenerateMovie()
{
emit StartBlockControls();
// provide the movie generator with the stepper and rotate the camera each step
if (m_movieGenerator.IsNotNull())
{
m_movieGenerator->SetStepper(this->GetAspectStepper());
m_movieGenerator->SetRenderer(m_RecordingRenderer);
m_movieGenerator->SetFrameRate(static_cast<unsigned int> (360
/ (m_Controls->spnDuration->value())));
// QString movieFileName = QFileDialog::getSaveFileName( QString::null, "Movie (*.avi)", 0, "movie file dialog", "Choose a file name" );
QString movieFileName = QFileDialog::getSaveFileName(0, "Choose a file name", QString::null,
"Movie (*.avi)", 0, 0);
if (movieFileName.isEmpty() == false)
{
mitk::RenderingManager::GetInstance()->RequestUpdateAll();
m_movieGenerator->SetFileName(movieFileName.toAscii());
m_movieGenerator->WriteMovie();
}
emit EndBlockControls();
}
else
{
MITK_ERROR << "Either mitk::MovieGenerator is not implemented for your";
MITK_ERROR << " platform or an error occurred during";
MITK_ERROR << " mitk::MovieGenerator::New()";
emit EndBlockControlsMovieDeactive();
}
}
void QmitkMovieMaker::GenerateScreenshot()
{
emit StartBlockControls();
QString fileName = QFileDialog::getSaveFileName(NULL, "Save screenshot to...", QDir::currentPath(), "JPEG file (*.jpg);;PNG file (*.png)");
vtkRenderer* renderer = mitk::GlobalInteraction::GetInstance()->GetFocus()->GetVtkRenderer();
if (renderer == NULL)
return;
this->TakeScreenshot(renderer, 1, fileName);
if (m_movieGenerator.IsNotNull())
emit EndBlockControls();
else
emit EndBlockControlsMovieDeactive();
}
void QmitkMovieMaker::GenerateHR3DScreenshot()
{
emit StartBlockControls();
QString fileName = QFileDialog::getSaveFileName(NULL, "Save screenshot to...", QDir::currentPath(), "JPEG file (*.jpg);;PNG file (*.png)");
// only works correctly for 3D RenderWindow
vtkRenderer* renderer = m_MultiWidget->mitkWidget4->GetRenderer()->GetVtkRenderer();
if (renderer == NULL)
return;
this->TakeScreenshot(renderer, 4, fileName);
if (m_movieGenerator.IsNotNull())
emit EndBlockControls();
else
emit EndBlockControlsMovieDeactive();
}
void QmitkMovieMaker::UpdateGUI()
{
int bla = this->GetTemporalController()->GetTime()->GetSteps();
if (bla < 2)
{
m_Controls->rbtnTemporal->setEnabled(false);
m_Controls->rbtnCombined->setEnabled(false);
m_Controls->spatialTimeRelation->setEnabled(false);
}
else
{
m_Controls->rbtnTemporal->setEnabled(true);
m_Controls->rbtnCombined->setEnabled(true);
m_Controls->spatialTimeRelation->setEnabled(true);
}
}
void QmitkMovieMaker::DataStorageChanged()
{
// UpdateGUI();
}
void QmitkMovieMaker::CreateQtPartControl(QWidget *parent)
{
if (!m_Controls)
{
m_Controls = new Ui::QmitkMovieMakerControls;
m_Controls->setupUi(parent);
m_StepperAdapter = new QmitkStepperAdapter((QObject*) m_Controls->slidAngle,
this->GetSpatialController()->GetSlice(), "AngleStepperToMovieMakerFunctionality");
// Initialize "Selected Window" combo box
const mitk::RenderingManager::RenderWindowVector rwv =
mitk::RenderingManager::GetInstance()->GetAllRegisteredRenderWindows();
mitk::RenderingManager::RenderWindowVector::const_iterator iter;
unsigned int i = 0;
for (iter = rwv.begin(); iter != rwv.end(); ++iter)
{
m_Controls->cmbSelectedStepperWindow->insertItem(i,
mitk::BaseRenderer::GetInstance((*iter))->GetName());
m_Controls->cmbSelectedRecordingWindow->insertItem(i++, mitk::BaseRenderer::GetInstance(
(*iter))->GetName());
}
m_Controls->btnPause->setHidden(true);
if (m_movieGenerator.IsNull())
m_Controls->btnMovie->setEnabled(false);
}
this->CreateConnections();
}
void QmitkMovieMaker::StartPlaying()
{
m_Controls->slidAngle->setDisabled(true);
m_Controls->btnMovie->setEnabled(false);
m_Controls->btnPlay->setEnabled(false);
m_Controls->btnScreenshot->setEnabled(false);
// Restart timer with 5 msec interval - this should be fine-grained enough
// even for high display refresh frequencies
m_Timer->start(5);
m_Time->restart();
m_Controls->btnPlay->setHidden(true);
m_Controls->btnPause->setHidden(false);
if (m_movieGenerator.IsNull())
m_Controls->btnMovie->setEnabled(false);
}
void QmitkMovieMaker::RBTNForward()
{
emit SwitchDirection(0);
}
void QmitkMovieMaker::RBTNBackward()
{
emit SwitchDirection(1);
}
void QmitkMovieMaker::RBTNPingPong()
{
emit SwitchDirection(2);
}
void QmitkMovieMaker::RBTNSpatial()
{
emit SwitchAspect(0);
}
void QmitkMovieMaker::RBTNTemporal()
{
emit SwitchAspect(1);
}
void QmitkMovieMaker::RBTNCombined()
{
emit SwitchAspect(2);
}
void QmitkMovieMaker::BlockControls()
{
BlockControls(true);
}
void QmitkMovieMaker::UnBlockControls()
{
BlockControls(false);
}
void QmitkMovieMaker::UnBlockControlsMovieDeactive()
{
BlockControls(false);
m_Controls->btnMovie->setEnabled(false);
}
void QmitkMovieMaker::BlockControls(bool blocked)
{
m_Controls->slidAngle->setDisabled(blocked);
m_Controls->spnDuration->setEnabled(!blocked);
m_Controls->btnPlay->setEnabled(!blocked);
m_Controls->btnMovie->setEnabled(!blocked);
m_Controls->btnScreenshot->setEnabled(!blocked);
}
void QmitkMovieMaker::StdMultiWidgetAvailable(QmitkStdMultiWidget& stdMultiWidget)
{
m_MultiWidget = &stdMultiWidget;
m_Parent->setEnabled(true);
}
void QmitkMovieMaker::StdMultiWidgetNotAvailable()
{
m_MultiWidget = NULL;
m_Parent->setEnabled(false);
}
void QmitkMovieMaker::TakeScreenshot(vtkRenderer* renderer, unsigned int magnificationFactor, QString fileName)
{
if ((renderer == NULL) ||(magnificationFactor < 1) || fileName.isEmpty())
return;
bool doubleBuffering( renderer->GetRenderWindow()->GetDoubleBuffer() );
renderer->GetRenderWindow()->DoubleBufferOff();
vtkImageWriter* fileWriter;
QFileInfo fi(fileName);
QString suffix = fi.suffix();
if (suffix.compare("png", Qt::CaseInsensitive) == 0)
{
fileWriter = vtkPNGWriter::New();
}
else // default is jpeg
{
vtkJPEGWriter* w = vtkJPEGWriter::New();
w->SetQuality(100);
w->ProgressiveOff();
fileWriter = w;
}
vtkRenderLargeImage* magnifier = vtkRenderLargeImage::New();
magnifier->SetInput(renderer);
magnifier->SetMagnification(magnificationFactor);
//magnifier->Update();
fileWriter->SetInput(magnifier->GetOutput());
fileWriter->SetFileName(fileName.toLatin1());
// vtkRenderLargeImage has problems with different layers, therefore we have to
// temporarily deactivate all other layers.
// we set the background to white, because it is nicer than black...
double oldBackground[3];
renderer->GetBackground(oldBackground);
double white[] = {1.0, 1.0, 1.0};
renderer->SetBackground(white);
m_MultiWidget->DisableColoredRectangles();
m_MultiWidget->DisableDepartmentLogo();
m_MultiWidget->DisableGradientBackground();
- fileWriter->Write();
- fileWriter->Delete();
+ m_MultiWidget->mitkWidget1->ActivateMenuWidget( false );
+ m_MultiWidget->mitkWidget2->ActivateMenuWidget( false );
+ m_MultiWidget->mitkWidget3->ActivateMenuWidget( false );
+ m_MultiWidget->mitkWidget4->ActivateMenuWidget( false );
+
+ fileWriter->Write();
+ fileWriter->Delete();
+
+ m_MultiWidget->mitkWidget1->ActivateMenuWidget( true );
+ m_MultiWidget->mitkWidget2->ActivateMenuWidget( true );
+ m_MultiWidget->mitkWidget3->ActivateMenuWidget( true );
+ m_MultiWidget->mitkWidget4->ActivateMenuWidget( true );
m_MultiWidget->EnableColoredRectangles();
m_MultiWidget->EnableDepartmentLogo();
m_MultiWidget->EnableGradientBackground();
renderer->SetBackground(oldBackground);
renderer->GetRenderWindow()->SetDoubleBuffer(doubleBuffering);
}
void QmitkMovieMaker::DeleteMStepper()
{
m_Stepper = NULL;
UpdateLooping();
-}
\ No newline at end of file
+}
diff --git a/Modules/Bundles/org.mitk.gui.qt.pointbasedregistration/CMakeLists.txt b/Modules/Bundles/org.mitk.gui.qt.pointbasedregistration/CMakeLists.txt
index fba82a3726..a7244040a5 100644
--- a/Modules/Bundles/org.mitk.gui.qt.pointbasedregistration/CMakeLists.txt
+++ b/Modules/Bundles/org.mitk.gui.qt.pointbasedregistration/CMakeLists.txt
@@ -1,2 +1,10 @@
+# The project name must correspond to the directory name of your plug-in
+# and must not contain periods.
+PROJECT(org_mitk_gui_qt_pointbasedregistration)
+
+MACRO_CREATE_MITK_CTK_PLUGIN(
+ EXPORT_DIRECTIVE POINTBASEDREGISTRATION_EXPORT
+ EXPORTED_INCLUDE_SUFFIXES src
+ MODULE_DEPENDENCIES QmitkExt
+)
-MACRO_CREATE_MITK_PLUGIN(QmitkExt)
diff --git a/Modules/Bundles/org.mitk.gui.qt.pointbasedregistration/META-INF/MANIFEST.MF b/Modules/Bundles/org.mitk.gui.qt.pointbasedregistration/META-INF/MANIFEST.MF
deleted file mode 100644
index f89391a2b0..0000000000
--- a/Modules/Bundles/org.mitk.gui.qt.pointbasedregistration/META-INF/MANIFEST.MF
+++ /dev/null
@@ -1,7 +0,0 @@
-Manifest-Version: 1.0
-Bundle-Name: Point Based Registration
-Bundle-SymbolicName: org.mitk.gui.qt.pointbasedregistration
-Bundle-Version: 0.1
-Bundle-Vendor: DKFZ, Medical and Biological Informatics
-Require-Bundle: org.mitk.gui.qt.common
-Bundle-Activator:
diff --git a/Modules/Bundles/org.mitk.gui.qt.pointbasedregistration/files.cmake b/Modules/Bundles/org.mitk.gui.qt.pointbasedregistration/files.cmake
index 5577487a57..af916bdefd 100644
--- a/Modules/Bundles/org.mitk.gui.qt.pointbasedregistration/files.cmake
+++ b/Modules/Bundles/org.mitk.gui.qt.pointbasedregistration/files.cmake
@@ -1,40 +1,45 @@
SET(SRC_CPP_FILES
)
SET(INTERNAL_CPP_FILES
QmitkPointBasedRegistrationView.cpp
QmitkPointBasedRegistrationTesting.cpp
mitkLandmarkWarping.cpp
+ mitkPluginActivator.cpp
)
SET(UI_FILES
src/internal/QmitkPointBasedRegistrationViewControls.ui
)
SET(MOC_H_FILES
src/internal/QmitkPointBasedRegistrationView.h
+src/internal/mitkPluginActivator.h
)
-SET(RESOURCE_FILES
+SET(CACHED_RESOURCE_FILES
# 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
resources/PointBasedRegistration.xpm
+ plugin.xml
)
-SET(RES_FILES
+SET(QRC_FILES
resources/QmitkPointBasedRegistrationView.qrc
)
-SET(CPP_FILES manifest.cpp)
+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/Modules/Bundles/org.mitk.gui.qt.pointbasedregistration/manifest.cpp b/Modules/Bundles/org.mitk.gui.qt.pointbasedregistration/manifest.cpp
deleted file mode 100644
index d8c306c9f5..0000000000
--- a/Modules/Bundles/org.mitk.gui.qt.pointbasedregistration/manifest.cpp
+++ /dev/null
@@ -1,26 +0,0 @@
-/*=========================================================================
-
-Program: Medical Imaging & Interaction Toolkit
-Language: C++
-Date: $Date$
-Version: $Revision: 16719 $
-
-Copyright (c) German Cancer Research Center, Division of Medical and
-Biological Informatics. All rights reserved.
-See MITKCopyright.txt or http://www.mitk.org/copyright.html for details.
-
-This software is distributed WITHOUT ANY WARRANTY; without even
-the implied warranty of MERCHANTABILITY or FITNESS FOR A PARTICULAR
-PURPOSE. See the above copyright notices for more information.
-
-=========================================================================*/
-
-#include <Poco/ClassLibrary.h>
-
-#include <berryIViewPart.h>
-#include "src/internal/QmitkPointBasedRegistrationView.h"
-
-
-POCO_BEGIN_NAMED_MANIFEST(berryIViewPart, berry::IViewPart)
- POCO_EXPORT_CLASS(::QmitkPointBasedRegistrationView)
-POCO_END_MANIFEST
diff --git a/Modules/Bundles/org.mitk.gui.qt.pointbasedregistration/manifest_headers.cmake b/Modules/Bundles/org.mitk.gui.qt.pointbasedregistration/manifest_headers.cmake
new file mode 100644
index 0000000000..d55a35ea63
--- /dev/null
+++ b/Modules/Bundles/org.mitk.gui.qt.pointbasedregistration/manifest_headers.cmake
@@ -0,0 +1,5 @@
+set(Plugin-Name "Point Based Registration")
+set(Plugin-Version "1.0")
+set(Plugin-Vendor "DKFZ, Medical and Biological Informatics")
+set(Plugin-ContactAddress "www.mitk.org")
+set(Require-Plugin org.mitk.gui.qt.common)
diff --git a/Modules/Bundles/org.mitk.gui.qt.pointbasedregistration/plugin.xml b/Modules/Bundles/org.mitk.gui.qt.pointbasedregistration/plugin.xml
index caf6ed81db..1f5ccddff7 100644
--- a/Modules/Bundles/org.mitk.gui.qt.pointbasedregistration/plugin.xml
+++ b/Modules/Bundles/org.mitk.gui.qt.pointbasedregistration/plugin.xml
@@ -1,11 +1,11 @@
<?xml version="1.0" encoding="UTF-8"?>
<plugin>
<extension point="org.blueberry.ui.views">
<view id="org.mitk.views.pointbasedregistration"
name="PointBasedRegistration"
- class="::QmitkPointBasedRegistrationView"
+ class="QmitkPointBasedRegistrationView"
icon="resources/PointBasedRegistration.xpm"/>
</extension>
</plugin>
diff --git a/Modules/Bundles/org.mitk.gui.qt.pointbasedregistration/src/PointbasedregistrationDll.h b/Modules/Bundles/org.mitk.gui.qt.pointbasedregistration/src/PointbasedregistrationDll.h
deleted file mode 100644
index ac3f3c5bfd..0000000000
--- a/Modules/Bundles/org.mitk.gui.qt.pointbasedregistration/src/PointbasedregistrationDll.h
+++ /dev/null
@@ -1,43 +0,0 @@
-/*=========================================================================
-
-Program: Medical Imaging & Interaction Toolkit
-Language: C++
-Date: $Date$
-Version: $Revision: 16719 $
-
-Copyright (c) German Cancer Research Center, Division of Medical and
-Biological Informatics. All rights reserved.
-See MITKCopyright.txt or http://www.mitk.org/copyright.html for details.
-
-This software is distributed WITHOUT ANY WARRANTY; without even
-the implied warranty of MERCHANTABILITY or FITNESS FOR A PARTICULAR
-PURPOSE. See the above copyright notices for more information.
-
-=========================================================================*/
-
-#ifndef _POINTBASEDREGISTRATION_EXPORT_DLL_H_
-#define _POINTBASEDREGISTRATION_EXPORT_DLL_H_
-
-
-//
-// The following block is the standard way of creating macros which make exporting
-// from a DLL simpler. All files within this DLL are compiled with the org_mitk_gui_qt_pointbasedregistration_EXPORTS
-// symbol defined on the command line. this symbol should not be defined on any project
-// that uses this DLL. This way any other project whose source files include this file see
-// org_mitk_gui_qt_pointbasedregistration_EXPORTS functions as being imported from a DLL, wheras this DLL sees symbols
-// defined with this macro as being exported.
-//
-#if defined(_WIN32) && !defined(MITK_STATIC)
- #if defined(org_mitk_gui_qt_pointbasedregistration_EXPORTS)
- #define POINTBASEDREGISTRATION_EXPORT __declspec(dllexport)
- #else
- #define POINTBASEDREGISTRATION_EXPORT __declspec(dllimport)
- #endif
-#endif
-
-
-#if !defined(POINTBASEDREGISTRATION_EXPORT)
- #define POINTBASEDREGISTRATION_EXPORT
-#endif
-
-#endif /*_POINTBASEDREGISTRATION_EXPORT_DLL_H_*/
diff --git a/Modules/Bundles/org.mitk.gui.qt.pointbasedregistration/src/internal/QmitkPointBasedRegistrationView.h b/Modules/Bundles/org.mitk.gui.qt.pointbasedregistration/src/internal/QmitkPointBasedRegistrationView.h
index a3fb81d40c..42cb945653 100644
--- a/Modules/Bundles/org.mitk.gui.qt.pointbasedregistration/src/internal/QmitkPointBasedRegistrationView.h
+++ b/Modules/Bundles/org.mitk.gui.qt.pointbasedregistration/src/internal/QmitkPointBasedRegistrationView.h
@@ -1,298 +1,305 @@
/*=========================================================================
Program: Medical Imaging & Interaction Toolkit
Language: C++
Date: $Date$
Version: $Revision$
Copyright (c) German Cancer Research Center, Division of Medical and
Biological Informatics. All rights reserved.
See MITKCopyright.txt or http://www.mitk.org/copyright.html for details.
This software is distributed WITHOUT ANY WARRANTY; without even
the implied warranty of MERCHANTABILITY or FITNESS FOR A PARTICULAR
PURPOSE. See the above copyright notices for more information.
=========================================================================*/
#if !defined(QMITK_POINTBASEDREGISTRATION_H__INCLUDED)
#define QMITK_POINTBASEDREGISTRATION_H__INCLUDED
#include "QmitkFunctionality.h"
#include "berryISelectionListener.h"
#include "berryIStructuredSelection.h"
//#include "mitkTestingConfig.h" // IMPORTANT: this defines or undefines BUILD_TESTING !
#include <mitkPointSetInteractor.h>
#include <mitkGlobalInteraction.h>
#include <mitkAffineInteractor.h>
#include <mitkPointSet.h>
#include <vtkCellArray.h>
#include <vtkLandmarkTransform.h>
//#include "QmitkMessageBoxHelper.h"
#include "ui_QmitkPointBasedRegistrationViewControls.h"
-#include "../PointbasedregistrationDll.h"
+#include <org_mitk_gui_qt_pointbasedregistration_Export.h>
/*!
\brief The PointBasedRegistration functionality is used to perform point based registration.
This functionality allows you to register 2D as well as 3D images in a rigid and deformable manner via corresponding
PointSets. Register means to align two images, so that they become as similar as possible.
Therefore you have to set corresponding points in both images, which will be matched. The movement, which has to be
performed on the points to align them will be performed on the moving image as well. The result is shown in the multi-widget.
For more informations see: \ref QmitkPointBasedRegistrationUserManual
\sa QmitkFunctionality
\ingroup Functionalities
\ingroup PointBasedRegistration
*/
class POINTBASEDREGISTRATION_EXPORT QmitkPointBasedRegistrationView : public QmitkFunctionality
{
friend struct SelListenerPointBasedRegistration;
Q_OBJECT
public:
static const std::string VIEW_ID;
/*!
\brief Default constructor
*/
QmitkPointBasedRegistrationView(QObject *parent=0, const char *name=0);
+ QmitkPointBasedRegistrationView(const QmitkPointBasedRegistrationView& other)
+ {
+ Q_UNUSED(other)
+ throw std::runtime_error("Copy constructor not implemented");
+ }
+
+
/*!
\brief Default destructor
*/
virtual ~QmitkPointBasedRegistrationView();
/*!
\brief method for creating the applications main widget
*/
virtual void CreateQtPartControl(QWidget *parent);
/*!
\brief Sets the StdMultiWidget and connects it to the functionality.
*/
virtual void StdMultiWidgetAvailable (QmitkStdMultiWidget &stdMultiWidget);
/*!
\brief Removes the StdMultiWidget and disconnects it from the functionality.
*/
virtual void StdMultiWidgetNotAvailable();
/*!
\brief Method for creating the connections of main and control widget
*/
virtual void CreateConnections();
virtual void Activated();
virtual void Deactivated();
virtual void Visible();
virtual void Hidden();
//
// #ifdef BUILD_TESTING
// / **
// \brief Testing entry point
// * /
// virtual int TestYourself();
//
// / **
// \brief Helper method for testing
// * /
// bool TestAllTools();
//
//
// protected slots:
// /**
// \brief Helper method for testing
// */
// void RegistrationErrorDialogFound( QWidget* widget );
//
// /**
// \brief Helper method for testing
// */
// void ClearPointSetDialogFound( QWidget* widget );
//
// private:
// bool m_MessageBox;
//
//
// public:
// #else
// // slot function is needed, because moc ignores our #ifdefs
// void RegistrationErrorDialogFound( QWidget* widget ) {}
// // slot function is needed, because moc ignores our #ifdefs
// void ClearPointSetDialogFound(QWidget* widget){}
// #endif
void DataNodeHasBeenRemoved(const mitk::DataNode* node);
protected slots:
/*!
\brief Sets the fixed Image according to TreeNodeSelector widget
*/
void FixedSelected(mitk::DataNode::Pointer fixedImage);
/*!
\brief Sets the moving Image according to TreeNodeSelector widget
*/
void MovingSelected(mitk::DataNode::Pointer movingImage);
/*!
\brief Calculates registration with vtkLandmarkTransform
*/
void calculateLandmarkbased();
/*!
\brief Calculates registration with itkLandmarkWarping
*/
void calculateLandmarkWarping();
/*!
\brief Calculates registration with ICP and vtkLandmarkTransform
*/
void calculateLandmarkbasedWithICP();
/*!
\brief lets the fixed image become invisible and the moving image visible
*/
void HideMovingImage(bool hide);
/*!
\brief lets the moving image become invisible and the fixed image visible
*/
void HideFixedImage(bool hide);
/*!
\brief Checks if registration is possible
*/
bool CheckCalculate();
/*!
\brief Performs an undo for the last transform.
*/
void UndoTransformation();
/*!
\brief Performs a redo for the last undo transform.
*/
void RedoTransformation();
/*!
\brief Stores whether the image will be shown in grayvalues or in red for fixed image and green for moving image
@param show if true, then images will be shown in red and green
*/
void showRedGreen(bool show);
/*!
\brief Sets the selected opacity for moving image
@param opacity the selected opacity
*/
void OpacityUpdate(float opacity);
/*!
\brief Sets the selected opacity for moving image
@param opacity the selected opacity
*/
void OpacityUpdate(int opacity);
/*!
\brief Updates the moving landmarks
*/
void updateMovingLandmarksList();
/*!
\brief Updates the fixed landmarks
*/
void updateFixedLandmarksList();
/*!
\brief Sets the images to gray values or fixed image to red and moving image to green
@param redGreen if true, then images will be shown in red and green
*/
void setImageColor(bool redGreen);
/*!
\brief Clears the undo and redo transformation lists.
*/
void clearTransformationLists();
/*!
\brief Calculates the landmark error for the selected transformation.
*/
void checkLandmarkError();
/*!
\brief Changes the transformation type and calls checkLandmarkError().
*/
void transformationChanged(int transform);
/*!
\brief Checks whether the registration can be performed.
*/
bool checkCalculateEnabled();
/*!
\brief Performs the registration.
*/
void calculate();
void SetImagesVisible(berry::ISelection::ConstPointer /*selection*/);
void SwitchImages();
protected:
berry::ISelectionListener::Pointer m_SelListener;
berry::IStructuredSelection::ConstPointer m_CurrentSelection;
/*!
* default main widget containing 4 windows showing 3
* orthogonal slices of the volume and a 3d render window
*/
QmitkStdMultiWidget * m_MultiWidget;
/*!
* control widget to make all changes for point based registration
*/
Ui::QmitkPointBasedRegistrationControls m_Controls;
mitk::PointSet::Pointer m_FixedLandmarks;
mitk::PointSet::Pointer m_MovingLandmarks;
mitk::DataNode::Pointer m_MovingPointSetNode;
mitk::DataNode::Pointer m_FixedPointSetNode;
mitk::DataNode::Pointer m_MovingNode;
mitk::DataNode::Pointer m_FixedNode;
std::list<mitk::Geometry3D::Pointer> m_UndoGeometryList;
std::list<mitk::Geometry3D::Pointer> m_UndoPointsGeometryList;
std::list<mitk::Geometry3D::Pointer> m_RedoGeometryList;
std::list<mitk::Geometry3D::Pointer> m_RedoPointsGeometryList;
bool m_ShowRedGreen;
float m_Opacity;
float m_OriginalOpacity;
mitk::Color m_FixedColor;
mitk::Color m_MovingColor;
int m_Transformation;
bool m_HideFixedImage;
bool m_HideMovingImage;
std::string m_OldFixedLabel;
std::string m_OldMovingLabel;
bool m_Deactivated;
int m_CurrentFixedLandmarksObserverID;
int m_CurrentMovingLandmarksObserverID;
itk::SimpleMemberCommand<QmitkPointBasedRegistrationView>::Pointer m_FixedLandmarksChangedCommand;
itk::SimpleMemberCommand<QmitkPointBasedRegistrationView>::Pointer m_MovingLandmarksChangedCommand;
};
#endif // !defined(QMITK_POINTBASEDREGISTRATION_H__INCLUDED)
diff --git a/Modules/Bundles/org.mitk.gui.qt.pointbasedregistration/src/internal/mitkPluginActivator.cpp b/Modules/Bundles/org.mitk.gui.qt.pointbasedregistration/src/internal/mitkPluginActivator.cpp
new file mode 100644
index 0000000000..7639967bc8
--- /dev/null
+++ b/Modules/Bundles/org.mitk.gui.qt.pointbasedregistration/src/internal/mitkPluginActivator.cpp
@@ -0,0 +1,22 @@
+#include "mitkPluginActivator.h"
+
+#include "QmitkPointBasedRegistrationView.h"
+
+#include <QtPlugin>
+
+namespace mitk {
+
+void PluginActivator::start(ctkPluginContext* context)
+{
+ BERRY_REGISTER_EXTENSION_CLASS(QmitkPointBasedRegistrationView, context)
+ Q_UNUSED(context)
+}
+
+void PluginActivator::stop(ctkPluginContext* context)
+{
+ Q_UNUSED(context)
+}
+
+}
+
+Q_EXPORT_PLUGIN2(org_mitk_gui_qt_pointbasedregistration, mitk::PluginActivator)
diff --git a/Modules/Bundles/org.mitk.gui.qt.pointbasedregistration/src/internal/mitkPluginActivator.h b/Modules/Bundles/org.mitk.gui.qt.pointbasedregistration/src/internal/mitkPluginActivator.h
new file mode 100644
index 0000000000..a34be34be4
--- /dev/null
+++ b/Modules/Bundles/org.mitk.gui.qt.pointbasedregistration/src/internal/mitkPluginActivator.h
@@ -0,0 +1,23 @@
+#ifndef MITKPLUGINACTIVATOR_H
+#define MITKPLUGINACTIVATOR_H
+
+#include <ctkPluginActivator.h>
+
+namespace mitk {
+
+class PluginActivator :
+ public QObject, public ctkPluginActivator
+{
+ Q_OBJECT
+ Q_INTERFACES(ctkPluginActivator)
+
+public:
+
+ void start(ctkPluginContext* context);
+ void stop(ctkPluginContext* context);
+
+}; // PluginActivator
+
+}
+
+#endif // MITKPLUGINACTIVATOR_H
diff --git a/Modules/Bundles/org.mitk.gui.qt.segmentation/src/QmitkSegmentationPreferencePage.h b/Modules/Bundles/org.mitk.gui.qt.segmentation/src/QmitkSegmentationPreferencePage.h
index c5c68f8aa5..ad3443be2b 100644
--- a/Modules/Bundles/org.mitk.gui.qt.segmentation/src/QmitkSegmentationPreferencePage.h
+++ b/Modules/Bundles/org.mitk.gui.qt.segmentation/src/QmitkSegmentationPreferencePage.h
@@ -1,82 +1,83 @@
/*=========================================================================
Program: Medical Imaging & Interaction Toolkit
Language: C++
Date: $Date$
Version: $Revision: 16224 $
Copyright (c) German Cancer Research Center, Division of Medical and
Biological Informatics. All rights reserved.
See MITKCopyright.txt or http://www.mitk.org/copyright.html for details.
This software is distributed WITHOUT ANY WARRANTY; without even
the implied warranty of MERCHANTABILITY or FITNESS FOR A PARTICULAR
PURPOSE. See the above copyright notices for more information.
=========================================================================*/
#ifndef QmitkSegmentationPreferencePage_h_included
#define QmitkSegmentationPreferencePage_h_included
#include "berryIQtPreferencePage.h"
#include "org_mitk_gui_qt_segmentation_Export.h"
#include <berryIPreferences.h>
class QWidget;
class QCheckBox;
class QRadioButton;
class MITK_QT_SEGMENTATION QmitkSegmentationPreferencePage : public QObject, public berry::IQtPreferencePage
{
Q_OBJECT
+ Q_INTERFACES(berry::IPreferencePage)
public:
QmitkSegmentationPreferencePage();
QmitkSegmentationPreferencePage(const QmitkSegmentationPreferencePage& other)
{
Q_UNUSED(other)
throw std::runtime_error("Copy constructor not implemented");
}
~QmitkSegmentationPreferencePage();
void Init(berry::IWorkbench::Pointer workbench);
void CreateQtControl(QWidget* widget);
QWidget* GetQtControl() const;
///
/// \see IPreferencePage::PerformOk()
///
virtual bool PerformOk();
///
/// \see IPreferencePage::PerformCancel()
///
virtual void PerformCancel();
///
/// \see IPreferencePage::Update()
///
virtual void Update();
protected slots:
void OnVolumeRenderingCheckboxChecked(int);
protected:
QWidget* m_MainControl;
QRadioButton* m_RadioOutline;
QRadioButton* m_RadioOverlay;
QCheckBox* m_VolumeRenderingCheckBox;
bool m_Initializing;
berry::IPreferences::Pointer m_SegmentationPreferencesNode;
};
#endif /* QMITKDATAMANAGERPREFERENCEPAGE_H_ */
diff --git a/Modules/Bundles/org.mitk.gui.qt.segmentation/src/internal/QmitkAutocropAction.h b/Modules/Bundles/org.mitk.gui.qt.segmentation/src/internal/QmitkAutocropAction.h
index b8908ce9ed..33b2c1a42e 100644
--- a/Modules/Bundles/org.mitk.gui.qt.segmentation/src/internal/QmitkAutocropAction.h
+++ b/Modules/Bundles/org.mitk.gui.qt.segmentation/src/internal/QmitkAutocropAction.h
@@ -1,43 +1,44 @@
#ifndef QMITK_AUTOCROPACTION_H
#define QMITK_AUTOCROPACTION_H
#include "mitkIContextMenuAction.h"
#include "org_mitk_gui_qt_segmentation_Export.h"
#include "vector"
#include "mitkDataNode.h"
#include "mitkImage.h"
class MITK_QT_SEGMENTATION QmitkAutocropAction : public QObject, public mitk::IContextMenuAction
{
Q_OBJECT
+ Q_INTERFACES(mitk::IContextMenuAction)
public:
QmitkAutocropAction();
QmitkAutocropAction(const QmitkAutocropAction& other)
{
Q_UNUSED(other)
throw std::runtime_error("Copy constructor not implemented");
}
virtual ~QmitkAutocropAction();
//interface methods
void Run( const std::vector<mitk::DataNode*>& selectedNodes );
void SetDataStorage(mitk::DataStorage* dataStorage);
void SetSmoothed(bool smoothed);
void SetDecimated(bool decimated);
void SetFunctionality(berry::QtViewPart* functionality);
protected:
mitk::Image::Pointer IncreaseCroppedImageSize( mitk::Image::Pointer image );
private:
typedef std::vector<mitk::DataNode*> NodeList;
};
#endif // QMITK_AUTOCROPACTION_H
diff --git a/Modules/Bundles/org.mitk.gui.qt.segmentation/src/internal/QmitkCreatePolygonModelAction.h b/Modules/Bundles/org.mitk.gui.qt.segmentation/src/internal/QmitkCreatePolygonModelAction.h
index fd18f8b83b..d345998db7 100644
--- a/Modules/Bundles/org.mitk.gui.qt.segmentation/src/internal/QmitkCreatePolygonModelAction.h
+++ b/Modules/Bundles/org.mitk.gui.qt.segmentation/src/internal/QmitkCreatePolygonModelAction.h
@@ -1,44 +1,45 @@
#ifndef QMITK_CREATEPOLYGONMODELACTION_H
#define QMITK_CREATEPOLYGONMODELACTION_H
#include "berryQtViewPart.h"
#include "mitkIContextMenuAction.h"
#include "org_mitk_gui_qt_segmentation_Export.h"
#include "mitkDataNode.h"
class MITK_QT_SEGMENTATION QmitkCreatePolygonModelAction: public QObject, public mitk::IContextMenuAction
{
Q_OBJECT
+ Q_INTERFACES(mitk::IContextMenuAction)
public:
QmitkCreatePolygonModelAction();
QmitkCreatePolygonModelAction(const QmitkCreatePolygonModelAction& other)
{
Q_UNUSED(other)
throw std::runtime_error("Copy constructor not implemented");
}
virtual ~QmitkCreatePolygonModelAction();
//interface methods
void Run( const std::vector<mitk::DataNode*>& selectedNodes );
void SetDataStorage(mitk::DataStorage* dataStorage);
void SetSmoothed(bool smoothed);
void SetDecimated(bool decimated);
void SetFunctionality(berry::QtViewPart* functionality);
// for receiving messages
void OnSurfaceCalculationDone();
protected:
typedef std::vector<mitk::DataNode*> NodeList;
mitk::DataStorage::Pointer m_DataStorage;
bool m_IsSmoothed;
bool m_IsDecimated;
};
#endif // QMITK_CREATEPOLYGONMODELACTION_H
diff --git a/Modules/Bundles/org.mitk.gui.qt.segmentation/src/internal/QmitkStatisticsAction.h b/Modules/Bundles/org.mitk.gui.qt.segmentation/src/internal/QmitkStatisticsAction.h
index a88c637718..1b334079e9 100644
--- a/Modules/Bundles/org.mitk.gui.qt.segmentation/src/internal/QmitkStatisticsAction.h
+++ b/Modules/Bundles/org.mitk.gui.qt.segmentation/src/internal/QmitkStatisticsAction.h
@@ -1,37 +1,38 @@
#ifndef QMITK_STATISTICSACTION_H
#define QMITK_STATISTICSACTION_H
#include <berryIWorkbenchPage.h>
#include "berryQtViewPart.h"
#include "mitkIContextMenuAction.h"
#include "org_mitk_gui_qt_segmentation_Export.h"
class MITK_QT_SEGMENTATION QmitkStatisticsAction: public QObject, public mitk::IContextMenuAction
{
Q_OBJECT
+ Q_INTERFACES(mitk::IContextMenuAction)
public:
QmitkStatisticsAction();
QmitkStatisticsAction(const QmitkStatisticsAction& other)
{
Q_UNUSED(other)
throw std::runtime_error("Copy constructor not implemented");
}
virtual ~QmitkStatisticsAction();
//interface methods
void Run( const std::vector<mitk::DataNode*>& selectedNodes );
void SetDataStorage(mitk::DataStorage* dataStorage);
void SetSmoothed(bool smoothed);
void SetDecimated(bool decimated);
void SetFunctionality(berry::QtViewPart* functionality);
protected:
//needs to be set over the IContextMenuAction (with this - QmitkDataManagerView - as parameter)
berry::QtViewPart* m_BlueBerryView;
};
#endif // QMITK_STATISTICSACTION_H
diff --git a/Modules/Bundles/org.mitk.gui.qt.segmentation/src/internal/QmitkThresholdAction.h b/Modules/Bundles/org.mitk.gui.qt.segmentation/src/internal/QmitkThresholdAction.h
index c9d4190ea6..692ccfd7f4 100644
--- a/Modules/Bundles/org.mitk.gui.qt.segmentation/src/internal/QmitkThresholdAction.h
+++ b/Modules/Bundles/org.mitk.gui.qt.segmentation/src/internal/QmitkThresholdAction.h
@@ -1,56 +1,57 @@
#ifndef QMITK_THRESHOLDACTION_H
#define QMITK_THRESHOLDACTION_H
#include <berryISelectionListener.h>
#include "berryQtViewPart.h"
#include "mitkIContextMenuAction.h"
#include "mitkDataStorage.h"
#include "mitkToolManager.h"
#include "org_mitk_gui_qt_segmentation_Export.h"
#include <QObject>
#include <QDialog>
class MITK_QT_SEGMENTATION QmitkThresholdAction: public QObject, public mitk::IContextMenuAction
{
Q_OBJECT
+ Q_INTERFACES(mitk::IContextMenuAction)
public:
QmitkThresholdAction();
QmitkThresholdAction(const QmitkThresholdAction& other)
{
Q_UNUSED(other)
throw std::runtime_error("Copy constructor not implemented");
}
virtual ~QmitkThresholdAction();
//interface methods
void Run( const std::vector<mitk::DataNode*>& selectedNodes );
void SetDataStorage(mitk::DataStorage* dataStorage);
void SetSmoothed(bool smoothed);
void SetDecimated(bool decimated);
void SetFunctionality(berry::QtViewPart* functionality);
// for receiving messages
void OnThresholdingToolManagerToolModified();
protected:
typedef std::vector<mitk::DataNode*> NodeList;
mitk::DataStorage::Pointer m_DataStorage;
mitk::ToolManager::Pointer m_ThresholdingToolManager;
QDialog* m_ThresholdingDialog;
protected slots:
// class internal slot
void ThresholdingDone(int);
};
#endif // QMITK_THRESHOLDACTION_H
diff --git a/Modules/Bundles/org.mitk.gui.qt.simpleexample/CMakeLists.txt b/Modules/Bundles/org.mitk.gui.qt.simpleexample/CMakeLists.txt
index d1fae30ab7..90d9ffdce6 100644
--- a/Modules/Bundles/org.mitk.gui.qt.simpleexample/CMakeLists.txt
+++ b/Modules/Bundles/org.mitk.gui.qt.simpleexample/CMakeLists.txt
@@ -1 +1,7 @@
-MACRO_CREATE_MITK_PLUGIN(QmitkExt)
+PROJECT(org_mitk_gui_qt_simpleexample)
+
+MACRO_CREATE_MITK_CTK_PLUGIN(
+ EXPORT_DIRECTIVE SIMPLEEXAMPLE_EXPORTS
+ EXPORTED_INCLUDE_SUFFIXES src
+ MODULE_DEPENDENCIES QmitkExt
+)
diff --git a/Modules/Bundles/org.mitk.gui.qt.simpleexample/META-INF/MANIFEST.MF b/Modules/Bundles/org.mitk.gui.qt.simpleexample/META-INF/MANIFEST.MF
deleted file mode 100644
index 18c26c25ae..0000000000
--- a/Modules/Bundles/org.mitk.gui.qt.simpleexample/META-INF/MANIFEST.MF
+++ /dev/null
@@ -1,7 +0,0 @@
-Manifest-Version: 1.0
-Bundle-Name: Simple Example
-Bundle-SymbolicName: org.mitk.gui.qt.simpleexample
-Bundle-Version: 0.1
-Bundle-Vendor: DKFZ, Medical and Biological Informatics
-Require-Bundle: org.mitk.gui.qt.common
-Bundle-Activator:
diff --git a/Modules/Bundles/org.mitk.gui.qt.simpleexample/files.cmake b/Modules/Bundles/org.mitk.gui.qt.simpleexample/files.cmake
index 26b999bfd2..b680fd4356 100644
--- a/Modules/Bundles/org.mitk.gui.qt.simpleexample/files.cmake
+++ b/Modules/Bundles/org.mitk.gui.qt.simpleexample/files.cmake
@@ -1,40 +1,42 @@
SET(SRC_CPP_FILES
)
SET(INTERNAL_CPP_FILES
QmitkSimpleExampleView.cpp
-
+ mitkPluginActivator.cpp
)
SET(UI_FILES
src/internal/QmitkSimpleExampleViewControls.ui
)
SET(MOC_H_FILES
src/internal/QmitkSimpleExampleView.h
+ src/internal/mitkPluginActivator.h
)
-SET(RESOURCE_FILES
+SET(CACHED_RESOURCE_FILES
resources/SimpleExample.png
+ plugin.xml
# 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(RES_FILES
+SET(QRC_FILES
# uncomment the following line if you want to use Qt resources
# resources/QmitkSimpleExampleView.qrc
)
-SET(CPP_FILES manifest.cpp)
+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/Modules/Bundles/org.mitk.gui.qt.simpleexample/manifest.cpp b/Modules/Bundles/org.mitk.gui.qt.simpleexample/manifest.cpp
deleted file mode 100644
index 547b94f479..0000000000
--- a/Modules/Bundles/org.mitk.gui.qt.simpleexample/manifest.cpp
+++ /dev/null
@@ -1,26 +0,0 @@
-/*=========================================================================
-
-Program: Medical Imaging & Interaction Toolkit
-Language: C++
-Date: $Date$
-Version: $Revision: 17332 $
-
-Copyright (c) German Cancer Research Center, Division of Medical and
-Biological Informatics. All rights reserved.
-See MITKCopyright.txt or http://www.mitk.org/copyright.html for details.
-
-This software is distributed WITHOUT ANY WARRANTY; without even
-the implied warranty of MERCHANTABILITY or FITNESS FOR A PARTICULAR
-PURPOSE. See the above copyright notices for more information.
-
-=========================================================================*/
-
-#include <Poco/ClassLibrary.h>
-
-#include <berryIViewPart.h>
-#include "src/internal/QmitkSimpleExampleView.h"
-
-
-POCO_BEGIN_NAMED_MANIFEST(berryIViewPart, berry::IViewPart)
- POCO_EXPORT_CLASS(::QmitkSimpleExampleView)
-POCO_END_MANIFEST
diff --git a/Modules/Bundles/org.mitk.gui.qt.simpleexample/manifest_headers.cmake b/Modules/Bundles/org.mitk.gui.qt.simpleexample/manifest_headers.cmake
new file mode 100644
index 0000000000..35e72f60ca
--- /dev/null
+++ b/Modules/Bundles/org.mitk.gui.qt.simpleexample/manifest_headers.cmake
@@ -0,0 +1,5 @@
+set(Plugin-Name "Simple Example")
+set(Plugin-Version "0.1")
+set(Plugin-Vendor "DKFZ, Medical and Biological Informatics")
+set(Plugin-ContactAddress "http://www.mitk.org")
+set(Require-Plugin org.mitk.gui.qt.common)
diff --git a/Modules/Bundles/org.mitk.gui.qt.simpleexample/plugin.xml b/Modules/Bundles/org.mitk.gui.qt.simpleexample/plugin.xml
index d0cce005c9..f32255274e 100644
--- a/Modules/Bundles/org.mitk.gui.qt.simpleexample/plugin.xml
+++ b/Modules/Bundles/org.mitk.gui.qt.simpleexample/plugin.xml
@@ -1,11 +1,11 @@
<?xml version="1.0" encoding="UTF-8"?>
<plugin>
<extension point="org.blueberry.ui.views">
<view id="org.mitk.views.simpleexample"
name="Simple Example"
- class="::QmitkSimpleExampleView"
- icon="resources/SimpleExample.png" />
+ class="QmitkSimpleExampleView"
+ icon="resources/SimpleExample.png" />
</extension>
</plugin>
diff --git a/Modules/Bundles/org.mitk.gui.qt.simpleexample/src/SimpleexampleDll.h b/Modules/Bundles/org.mitk.gui.qt.simpleexample/src/SimpleexampleDll.h
deleted file mode 100644
index 64184b3ec4..0000000000
--- a/Modules/Bundles/org.mitk.gui.qt.simpleexample/src/SimpleexampleDll.h
+++ /dev/null
@@ -1,43 +0,0 @@
-/*=========================================================================
-
-Program: Medical Imaging & Interaction Toolkit
-Language: C++
-Date: $Date$
-Version: $Revision: 17332 $
-
-Copyright (c) German Cancer Research Center, Division of Medical and
-Biological Informatics. All rights reserved.
-See MITKCopyright.txt or http://www.mitk.org/copyright.html for details.
-
-This software is distributed WITHOUT ANY WARRANTY; without even
-the implied warranty of MERCHANTABILITY or FITNESS FOR A PARTICULAR
-PURPOSE. See the above copyright notices for more information.
-
-=========================================================================*/
-
-#ifndef _SIMPLEEXAMPLE_EXPORTS_DLL_H_
-#define _SIMPLEEXAMPLE_EXPORTS_DLL_H_
-
-
-//
-// The following block is the standard way of creating macros which make exporting
-// from a DLL simpler. All files within this DLL are compiled with the org_mitk_gui_qt_simpleexample_EXPORTS
-// symbol defined on the command line. this symbol should not be defined on any project
-// that uses this DLL. This way any other project whose source files include this file see
-// org_mitk_gui_qt_simpleexample_EXPORTS functions as being imported from a DLL, wheras this DLL sees symbols
-// defined with this macro as being exported.
-//
-#if defined(_WIN32) && !defined(MITK_STATIC)
- #if defined(org_mitk_gui_qt_simpleexample_EXPORTS)
- #define SIMPLEEXAMPLE_EXPORTS __declspec(dllexport)
- #else
- #define SIMPLEEXAMPLE_EXPORTS __declspec(dllimport)
- #endif
-#endif
-
-
-#if !defined(SIMPLEEXAMPLE_EXPORTS)
- #define SIMPLEEXAMPLE_EXPORTS
-#endif
-
-#endif /*_SIMPLEEXAMPLE_EXPORTS_DLL_H_*/
diff --git a/Modules/Bundles/org.mitk.gui.qt.simpleexample/src/internal/QmitkSimpleExampleView.cpp b/Modules/Bundles/org.mitk.gui.qt.simpleexample/src/internal/QmitkSimpleExampleView.cpp
index f257a04a55..27b1653034 100644
--- a/Modules/Bundles/org.mitk.gui.qt.simpleexample/src/internal/QmitkSimpleExampleView.cpp
+++ b/Modules/Bundles/org.mitk.gui.qt.simpleexample/src/internal/QmitkSimpleExampleView.cpp
@@ -1,300 +1,306 @@
/*=========================================================================
Program: Medical Imaging & Interaction Toolkit
Language: C++
Date: $Date$
Version: $Revision: 17332 $
Copyright (c) German Cancer Research Center, Division of Medical and
Biological Informatics. All rights reserved.
See MITKCopyright.txt or http://www.mitk.org/copyright.html for details.
This software is distributed WITHOUT ANY WARRANTY; without even
the implied warranty of MERCHANTABILITY or FITNESS FOR A PARTICULAR
PURPOSE. See the above copyright notices for more information.
=========================================================================*/
#include "QmitkSimpleExampleView.h"
#include "mitkNodePredicateDataType.h"
#include "QmitkDataStorageComboBox.h"
#include "QmitkStdMultiWidget.h"
#include <QMessageBox>
#include <mitkMovieGenerator.h>
#include "mitkNodePredicateProperty.h"
#include "mitkNodePredicateNot.h"
#include "mitkProperties.h"
#include <QmitkStepperAdapter.h>
#include <QFileDialog>
#include <QFileInfo>
#include <QDir>
#include <vtkRenderWindow.h>
#include "vtkImageWriter.h"
#include "vtkPNGWriter.h"
#include "vtkJPEGWriter.h"
#include "vtkRenderLargeImage.h"
const std::string QmitkSimpleExampleView::VIEW_ID = "org.mitk.views.simpleexample";
QmitkSimpleExampleView::QmitkSimpleExampleView()
: QmitkFunctionality(),
m_Controls(NULL),
m_MultiWidget(NULL),
m_NavigatorsInitialized(false)
{
}
+QmitkSimpleExampleView::QmitkSimpleExampleView(const QmitkSimpleExampleView& other)
+{
+ Q_UNUSED(other)
+ throw std::runtime_error("Copy constructor not implemented");
+}
+
QmitkSimpleExampleView::~QmitkSimpleExampleView()
{
}
void QmitkSimpleExampleView::CreateQtPartControl(QWidget *parent)
{
if (!m_Controls)
{
// create GUI widgets
m_Controls = new Ui::QmitkSimpleExampleViewControls;
m_Controls->setupUi(parent);
this->CreateConnections();
}
}
void QmitkSimpleExampleView::StdMultiWidgetAvailable (QmitkStdMultiWidget &stdMultiWidget)
{
m_MultiWidget = &stdMultiWidget;
new QmitkStepperAdapter(m_Controls->sliceNavigatorTransversal, m_MultiWidget->mitkWidget1->GetSliceNavigationController()->GetSlice(), "sliceNavigatorTransversalFromSimpleExample");
new QmitkStepperAdapter(m_Controls->sliceNavigatorSagittal, m_MultiWidget->mitkWidget2->GetSliceNavigationController()->GetSlice(), "sliceNavigatorSagittalFromSimpleExample");
new QmitkStepperAdapter(m_Controls->sliceNavigatorFrontal, m_MultiWidget->mitkWidget3->GetSliceNavigationController()->GetSlice(), "sliceNavigatorFrontalFromSimpleExample");
new QmitkStepperAdapter(m_Controls->sliceNavigatorTime, m_MultiWidget->GetTimeNavigationController()->GetTime(), "sliceNavigatorTimeFromSimpleExample");
new QmitkStepperAdapter(m_Controls->movieNavigatorTime, m_MultiWidget->GetTimeNavigationController()->GetTime(), "movieNavigatorTimeFromSimpleExample");
}
void QmitkSimpleExampleView::StdMultiWidgetNotAvailable()
{
m_MultiWidget = NULL;
}
void QmitkSimpleExampleView::CreateConnections()
{
if ( m_Controls )
{
connect(m_Controls->stereoSelect, SIGNAL(activated(int)), this, SLOT(stereoSelectionChanged(int)) );
connect(m_Controls->reInitializeNavigatorsButton, SIGNAL(clicked()), this, SLOT(initNavigators()) );
connect(m_Controls->genMovieButton, SIGNAL(clicked()), this, SLOT(generateMovie()) );
connect(m_Controls->m_RenderWindow1Button, SIGNAL(clicked()), this, SLOT(OnRenderWindow1Clicked()) );
connect(m_Controls->m_RenderWindow2Button, SIGNAL(clicked()), this, SLOT(OnRenderWindow2Clicked()) );
connect(m_Controls->m_RenderWindow3Button, SIGNAL(clicked()), this, SLOT(OnRenderWindow3Clicked()) );
connect(m_Controls->m_RenderWindow4Button, SIGNAL(clicked()), this, SLOT(OnRenderWindow4Clicked()) );
connect(m_Controls->m_TakeScreenshotBtn, SIGNAL(clicked()), this, SLOT(OnTakeScreenshot()) );
connect(m_Controls->m_TakeHighResScreenShotBtn, SIGNAL(clicked()), this, SLOT(OnTakeHighResolutionScreenshot()) );
}
}
void QmitkSimpleExampleView::Activated()
{
QmitkFunctionality::Activated();
}
void QmitkSimpleExampleView::Deactivated()
{
QmitkFunctionality::Deactivated();
}
void QmitkSimpleExampleView::initNavigators()
{
/* get all nodes that have not set "includeInBoundingBox" to false */
mitk::NodePredicateNot::Pointer pred = mitk::NodePredicateNot::New(mitk::NodePredicateProperty::New("includeInBoundingBox", mitk::BoolProperty::New(false)));
mitk::DataStorage::SetOfObjects::ConstPointer rs = this->GetDataStorage()->GetSubset(pred);
/* calculate bounding geometry of these nodes */
mitk::TimeSlicedGeometry::Pointer bounds = this->GetDataStorage()->ComputeBoundingGeometry3D(rs);
/* initialize the views to the bounding geometry */
m_NavigatorsInitialized = mitk::RenderingManager::GetInstance()->InitializeViews(bounds);
//m_NavigatorsInitialized = mitk::RenderingManager::GetInstance()->InitializeViews(GetDefaultDataStorage());
}
void QmitkSimpleExampleView::generateMovie()
{
QmitkRenderWindow* movieRenderWindow = GetMovieRenderWindow();
//mitk::Stepper::Pointer stepper = multiWidget->mitkWidget1->GetSliceNavigationController()->GetSlice();
mitk::Stepper::Pointer stepper = movieRenderWindow->GetSliceNavigationController()->GetSlice();
mitk::MovieGenerator::Pointer movieGenerator = mitk::MovieGenerator::New();
if (movieGenerator.IsNotNull()) {
movieGenerator->SetStepper( stepper );
movieGenerator->SetRenderer( mitk::BaseRenderer::GetInstance(movieRenderWindow->GetRenderWindow()) );
QString movieFileName = QFileDialog::getSaveFileName(0, "Choose a file name", QString(), "Movie (*.avi)");
if (!movieFileName.isEmpty()) {
movieGenerator->SetFileName( movieFileName.toStdString().c_str() );
movieGenerator->WriteMovie();
}
}
}
void QmitkSimpleExampleView::stereoSelectionChanged( int id )
{
/* From vtkRenderWindow.h tells us about stereo rendering:
Set/Get what type of stereo rendering to use. CrystalEyes mode uses frame-sequential capabilities available in OpenGL to drive LCD shutter glasses and stereo projectors. RedBlue mode is a simple type of stereo for use with red-blue glasses. Anaglyph mode is a superset of RedBlue mode, but the color output channels can be configured using the AnaglyphColorMask and the color of the original image can be (somewhat maintained using AnaglyphColorSaturation; the default colors for Anaglyph mode is red-cyan. Interlaced stereo mode produces a composite image where horizontal lines alternate between left and right views. StereoLeft and StereoRight modes choose one or the other stereo view. Dresden mode is yet another stereoscopic interleaving.
*/
vtkRenderWindow * vtkrenderwindow = m_MultiWidget->mitkWidget4->GetRenderWindow();
// note: foreground vtkRenderers (at least the department logo renderer) produce errors in stereoscopic visualization.
// Therefore, we disable the logo visualization during stereo rendering.
switch(id)
{
case 0:
vtkrenderwindow->StereoRenderOff();
break;
case 1:
vtkrenderwindow->SetStereoTypeToRedBlue();
vtkrenderwindow->StereoRenderOn();
m_MultiWidget->DisableDepartmentLogo();
break;
case 2:
vtkrenderwindow->SetStereoTypeToDresden();
vtkrenderwindow->StereoRenderOn();
m_MultiWidget->DisableDepartmentLogo();
break;
}
mitk::BaseRenderer::GetInstance(m_MultiWidget->mitkWidget4->GetRenderWindow())->SetMapperID(2);
m_MultiWidget->RequestUpdate();
}
QmitkRenderWindow* QmitkSimpleExampleView::GetMovieRenderWindow()
{
//check which RenderWindow should be used to generate the movie, e.g. which button is toggled
if(m_Controls->m_RenderWindow1Button->isChecked())
{
return m_MultiWidget->mitkWidget1;
}
else if(m_Controls->m_RenderWindow2Button->isChecked())
{
return m_MultiWidget->mitkWidget2;
}
else if(m_Controls->m_RenderWindow3Button->isChecked())
{
return m_MultiWidget->mitkWidget3;
}
else if(m_Controls->m_RenderWindow4Button->isChecked())
{
return m_MultiWidget->mitkWidget4;
}
else //as default take widget1
{
return m_MultiWidget->mitkWidget1;
}
}
void QmitkSimpleExampleView::OnRenderWindow1Clicked()
{
m_Controls->m_RenderWindow2Button->setChecked(false);
m_Controls->m_RenderWindow3Button->setChecked(false);
m_Controls->m_RenderWindow4Button->setChecked(false);
}
void QmitkSimpleExampleView::OnRenderWindow2Clicked()
{
m_Controls->m_RenderWindow1Button->setChecked(false);
m_Controls->m_RenderWindow3Button->setChecked(false);
m_Controls->m_RenderWindow4Button->setChecked(false);
}
void QmitkSimpleExampleView::OnRenderWindow3Clicked()
{
m_Controls->m_RenderWindow2Button->setChecked(false);
m_Controls->m_RenderWindow1Button->setChecked(false);
m_Controls->m_RenderWindow4Button->setChecked(false);
}
void QmitkSimpleExampleView::OnRenderWindow4Clicked()
{
m_Controls->m_RenderWindow2Button->setChecked(false);
m_Controls->m_RenderWindow3Button->setChecked(false);
m_Controls->m_RenderWindow1Button->setChecked(false);
}
void QmitkSimpleExampleView::OnTakeHighResolutionScreenshot()
{
QString fileName = QFileDialog::getSaveFileName(NULL, "Save screenshot to...", QDir::currentPath(), "JPEG file (*.jpg);;PNG file (*.png)");
// only works correctly for 3D RenderWindow
vtkRenderer* renderer = m_MultiWidget->mitkWidget4->GetRenderer()->GetVtkRenderer();
if (renderer == NULL)
return;
this->TakeScreenshot(renderer, 4, fileName);
}
void QmitkSimpleExampleView::OnTakeScreenshot()
{
QString fileName = QFileDialog::getSaveFileName(NULL, "Save screenshot to...", QDir::currentPath(), "JPEG file (*.jpg);;PNG file (*.png)");
QmitkRenderWindow* renWin = this->GetMovieRenderWindow();
if (renWin == NULL)
return;
vtkRenderer* renderer = renWin->GetRenderer()->GetVtkRenderer();
if (renderer == NULL)
return;
this->TakeScreenshot(renderer, 1, fileName);
}
void QmitkSimpleExampleView::TakeScreenshot(vtkRenderer* renderer, unsigned int magnificationFactor, QString fileName)
{
if ((renderer == NULL) ||(magnificationFactor < 1) || fileName.isEmpty())
return;
bool doubleBuffering( renderer->GetRenderWindow()->GetDoubleBuffer() );
renderer->GetRenderWindow()->DoubleBufferOff();
vtkImageWriter* fileWriter;
QFileInfo fi(fileName);
QString suffix = fi.suffix();
if (suffix.compare("png", Qt::CaseInsensitive) == 0)
{
fileWriter = vtkPNGWriter::New();
}
else // default is jpeg
{
vtkJPEGWriter* w = vtkJPEGWriter::New();
w->SetQuality(100);
w->ProgressiveOff();
fileWriter = w;
}
vtkRenderLargeImage* magnifier = vtkRenderLargeImage::New();
magnifier->SetInput(renderer);
magnifier->SetMagnification(magnificationFactor);
//magnifier->Update();
fileWriter->SetInput(magnifier->GetOutput());
fileWriter->SetFileName(fileName.toLatin1());
// vtkRenderLargeImage has problems with different layers, therefore we have to
// temporarily deactivate all other layers.
// we set the background to white, because it is nicer than black...
double oldBackground[3];
renderer->GetBackground(oldBackground);
double white[] = {1.0, 1.0, 1.0};
renderer->SetBackground(white);
m_MultiWidget->DisableColoredRectangles();
m_MultiWidget->DisableDepartmentLogo();
m_MultiWidget->DisableGradientBackground();
fileWriter->Write();
fileWriter->Delete();
m_MultiWidget->EnableColoredRectangles();
m_MultiWidget->EnableDepartmentLogo();
m_MultiWidget->EnableGradientBackground();
renderer->SetBackground(oldBackground);
renderer->GetRenderWindow()->SetDoubleBuffer(doubleBuffering);
}
diff --git a/Modules/Bundles/org.mitk.gui.qt.simpleexample/src/internal/QmitkSimpleExampleView.h b/Modules/Bundles/org.mitk.gui.qt.simpleexample/src/internal/QmitkSimpleExampleView.h
index 638a4e96db..d1ac1a164c 100644
--- a/Modules/Bundles/org.mitk.gui.qt.simpleexample/src/internal/QmitkSimpleExampleView.h
+++ b/Modules/Bundles/org.mitk.gui.qt.simpleexample/src/internal/QmitkSimpleExampleView.h
@@ -1,103 +1,104 @@
/*=========================================================================
Program: Medical Imaging & Interaction Toolkit
Language: C++
Date: $Date$
Version: $Revision: 17332 $
Copyright (c) German Cancer Research Center, Division of Medical and
Biological Informatics. All rights reserved.
See MITKCopyright.txt or http://www.mitk.org/copyright.html for details.
This software is distributed WITHOUT ANY WARRANTY; without even
the implied warranty of MERCHANTABILITY or FITNESS FOR A PARTICULAR
PURPOSE. See the above copyright notices for more information.
=========================================================================*/
#ifndef _QMITKSIMPLEEXAMPLEVIEW_H_INCLUDED
#define _QMITKSIMPLEEXAMPLEVIEW_H_INCLUDED
#include <QmitkFunctionality.h>
#include <string>
#include "ui_QmitkSimpleExampleViewControls.h"
#include <QmitkRenderWindow.h>
/*!
* \ingroup org_mitk_gui_qt_simpleexample_internal
*
* \brief QmitkSimpleExampleView
*
* Document your class here.
*
* \sa QmitkFunctionality
*/
class QmitkSimpleExampleView : public QmitkFunctionality
{
// this is needed for all Qt objects that should have a MOC object (everything that derives from QObject)
Q_OBJECT
public:
static const std::string VIEW_ID;
QmitkSimpleExampleView();
+ QmitkSimpleExampleView(const QmitkSimpleExampleView& other);
virtual ~QmitkSimpleExampleView();
virtual void CreateQtPartControl(QWidget *parent);
/// \brief Creation of the connections of main and control widget
virtual void CreateConnections();
/// \brief Called when the functionality is activated
virtual void Activated();
virtual void Deactivated();
virtual void StdMultiWidgetAvailable (QmitkStdMultiWidget &stdMultiWidget);
virtual void StdMultiWidgetNotAvailable();
protected slots:
/*!
qt slot for event processing from a qt widget defining the stereo mode of widget 4
*/
void stereoSelectionChanged(int id);
/*!
initialize the transversal, sagittal, coronal and temporal slider according to the image dimensions
*/
void initNavigators();
/*!
generate a movie as *.avi from the active render window
*/
void generateMovie();
/*!
return the renderwindow of which the movie shall be created, what depends on the toggled button
*/
QmitkRenderWindow* GetMovieRenderWindow();
void OnRenderWindow1Clicked();
void OnRenderWindow2Clicked();
void OnRenderWindow3Clicked();
void OnRenderWindow4Clicked();
void OnTakeHighResolutionScreenshot(); ///< takes screenshot of the 3D window in 4x resolution of the render window
void OnTakeScreenshot(); ///< takes screenshot of the selected render window
protected:
Ui::QmitkSimpleExampleViewControls* m_Controls;
QmitkStdMultiWidget* m_MultiWidget;
void TakeScreenshot(vtkRenderer* renderer, unsigned int magnificationFactor, QString fileName); ///< writes a screenshot in JPEG or PNG format to the file fileName
bool m_NavigatorsInitialized;
};
#endif // _QMITKSIMPLEEXAMPLEVIEW_H_INCLUDED
diff --git a/Modules/Bundles/org.mitk.gui.qt.simpleexample/src/internal/mitkPluginActivator.cpp b/Modules/Bundles/org.mitk.gui.qt.simpleexample/src/internal/mitkPluginActivator.cpp
new file mode 100644
index 0000000000..b6400eebf6
--- /dev/null
+++ b/Modules/Bundles/org.mitk.gui.qt.simpleexample/src/internal/mitkPluginActivator.cpp
@@ -0,0 +1,21 @@
+#include "mitkPluginActivator.h"
+
+#include <QtPlugin>
+
+#include "QmitkSimpleExampleView.h"
+
+namespace mitk {
+
+void PluginActivator::start(ctkPluginContext* context)
+{
+ BERRY_REGISTER_EXTENSION_CLASS(QmitkSimpleExampleView, context)
+}
+
+void PluginActivator::stop(ctkPluginContext* context)
+{
+ Q_UNUSED(context)
+}
+
+}
+
+Q_EXPORT_PLUGIN2(org_mitk_gui_qt_simpleexample, mitk::PluginActivator)
diff --git a/Modules/Bundles/org.mitk.gui.qt.simpleexample/src/internal/mitkPluginActivator.h b/Modules/Bundles/org.mitk.gui.qt.simpleexample/src/internal/mitkPluginActivator.h
new file mode 100644
index 0000000000..a34be34be4
--- /dev/null
+++ b/Modules/Bundles/org.mitk.gui.qt.simpleexample/src/internal/mitkPluginActivator.h
@@ -0,0 +1,23 @@
+#ifndef MITKPLUGINACTIVATOR_H
+#define MITKPLUGINACTIVATOR_H
+
+#include <ctkPluginActivator.h>
+
+namespace mitk {
+
+class PluginActivator :
+ public QObject, public ctkPluginActivator
+{
+ Q_OBJECT
+ Q_INTERFACES(ctkPluginActivator)
+
+public:
+
+ void start(ctkPluginContext* context);
+ void stop(ctkPluginContext* context);
+
+}; // PluginActivator
+
+}
+
+#endif // MITKPLUGINACTIVATOR_H
diff --git a/Modules/Bundles/org.mitk.gui.qt.simplemeasurement/CMakeLists.txt b/Modules/Bundles/org.mitk.gui.qt.simplemeasurement/CMakeLists.txt
index d1fae30ab7..9337709b4a 100644
--- a/Modules/Bundles/org.mitk.gui.qt.simplemeasurement/CMakeLists.txt
+++ b/Modules/Bundles/org.mitk.gui.qt.simplemeasurement/CMakeLists.txt
@@ -1 +1,9 @@
-MACRO_CREATE_MITK_PLUGIN(QmitkExt)
+# The project name must correspond to the directory name of your plug-in
+# and must not contain periods.
+PROJECT(org_mitk_gui_qt_simplemeasurement)
+
+MACRO_CREATE_MITK_CTK_PLUGIN(
+ EXPORT_DIRECTIVE MITK_QT_SIMPLEMEASUREMENT
+ EXPORTED_INCLUDE_SUFFIXES src
+ MODULE_DEPENDENCIES QmitkExt
+)
\ No newline at end of file
diff --git a/Modules/Bundles/org.mitk.gui.qt.simplemeasurement/META-INF/MANIFEST.MF b/Modules/Bundles/org.mitk.gui.qt.simplemeasurement/META-INF/MANIFEST.MF
deleted file mode 100644
index 6f54f29cd2..0000000000
--- a/Modules/Bundles/org.mitk.gui.qt.simplemeasurement/META-INF/MANIFEST.MF
+++ /dev/null
@@ -1,6 +0,0 @@
-Manifest-Version: 1.0
-Bundle-Name: Simple Measurement
-Bundle-SymbolicName: org.mitk.gui.qt.simplemeasurement
-Bundle-Version: 1.0.0
-Bundle-Vendor: DKFZ, Medical and Biological Informatics
-Require-Bundle: org.mitk.gui.qt.common
\ No newline at end of file
diff --git a/Modules/Bundles/org.mitk.gui.qt.simplemeasurement/files.cmake b/Modules/Bundles/org.mitk.gui.qt.simplemeasurement/files.cmake
index 3a082e69d6..67ae772f7c 100644
--- a/Modules/Bundles/org.mitk.gui.qt.simplemeasurement/files.cmake
+++ b/Modules/Bundles/org.mitk.gui.qt.simplemeasurement/files.cmake
@@ -1,33 +1,36 @@
SET(SRC_CPP_FILES
)
SET(INTERNAL_CPP_FILES
QmitkSimpleMeasurement.cpp
+ mitkPluginActivator.cpp
)
SET(UI_FILES
src/internal/QmitkSimpleMeasurementControls.ui
)
SET(MOC_H_FILES
src/internal/QmitkSimpleMeasurement.h
+ src/internal/mitkPluginActivator.h
)
-SET(RESOURCE_FILES
+SET(CACHED_RESOURCE_FILES
resources/SimpleMeasurement.png
+ plugin.xml
)
-SET(RES_FILES
+SET(QRC_FILES
)
-SET(CPP_FILES manifest.cpp)
+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/Modules/Bundles/org.mitk.gui.qt.simplemeasurement/manifest.cpp b/Modules/Bundles/org.mitk.gui.qt.simplemeasurement/manifest.cpp
deleted file mode 100644
index 219e107880..0000000000
--- a/Modules/Bundles/org.mitk.gui.qt.simplemeasurement/manifest.cpp
+++ /dev/null
@@ -1,26 +0,0 @@
-/*=========================================================================
-
-Program: Medical Imaging & Interaction Toolkit
-Language: C++
-Date: $Date: 2009-02-17 20:07:18 +0100 (Tue, 17 Feb 2009) $
-Version: $Revision: 14645 $
-
-Copyright (c) German Cancer Research Center, Division of Medical and
-Biological Informatics. All rights reserved.
-See MITKCopyright.txt or http://www.mitk.org/copyright.html for details.
-
-This software is distributed WITHOUT ANY WARRANTY; without even
-the implied warranty of MERCHANTABILITY or FITNESS FOR A PARTICULAR
-PURPOSE. See the above copyright notices for more information.
-
-=========================================================================*/
-
-#include <Poco/ClassLibrary.h>
-
-#include <berryIViewPart.h>
-#include "src/internal/QmitkSimpleMeasurement.h"
-
-
-POCO_BEGIN_NAMED_MANIFEST(berryIViewPart, berry::IViewPart)
- POCO_EXPORT_CLASS(QmitkSimpleMeasurement)
-POCO_END_MANIFEST
diff --git a/Modules/Bundles/org.mitk.gui.qt.simplemeasurement/manifest_headers.cmake b/Modules/Bundles/org.mitk.gui.qt.simplemeasurement/manifest_headers.cmake
new file mode 100644
index 0000000000..30334f8bab
--- /dev/null
+++ b/Modules/Bundles/org.mitk.gui.qt.simplemeasurement/manifest_headers.cmake
@@ -0,0 +1,5 @@
+set(Plugin-Name "Simple Measurement")
+set(Plugin-Version "1.0.0")
+set(Plugin-Vendor "DKFZ, Medical and Biological Informatics")
+set(Plugin-ContactAddress "http://www.mitk.org")
+set(Require-Plugin org.mitk.gui.qt.common)
\ No newline at end of file
diff --git a/Modules/Bundles/org.mitk.gui.qt.simplemeasurement/src/internal/QmitkSimpleMeasurement.h b/Modules/Bundles/org.mitk.gui.qt.simplemeasurement/src/internal/QmitkSimpleMeasurement.h
index bdb6df1bb3..0e0858c963 100644
--- a/Modules/Bundles/org.mitk.gui.qt.simplemeasurement/src/internal/QmitkSimpleMeasurement.h
+++ b/Modules/Bundles/org.mitk.gui.qt.simplemeasurement/src/internal/QmitkSimpleMeasurement.h
@@ -1,96 +1,102 @@
/*=========================================================================
Program: Medical Imaging & Interaction Toolkit
Language: C++
Date: $Date: 2009-03-21 14:46:24 +0100 (Sat, 21 Mar 2009) $
Version: $Revision: 15412 $
Copyright (c) German Cancer Research Center, Division of Medical and
Biological Informatics. All rights reserved.
See MITKCopyright.txt or http://www.mitk.org/copyright.html for details.
This software is distributed WITHOUT ANY WARRANTY; without even
the implied warranty of MERCHANTABILITY or FITNESS FOR A PARTICULAR
PURPOSE. See the above copyright notices for more information.
=========================================================================*/
#if !defined(QMITK_MEASUREMENT_H__INCLUDED)
#define QMITK_MEASUREMENT_H__INCLUDED
//#include "QmitkFunctionality.h"
#include <QmitkFunctionality.h>
#include <QmitkStandardViews.h>
#include <QmitkStdMultiWidgetEditor.h>
#include <mitkWeakPointer.h>
#include <mitkPointSetInteractor.h>
#include "ui_QmitkSimpleMeasurementControls.h"
class QmitkStdMultiWidget;
//!mm
//class QmitkSimpleMeasurementControls;
//!
/*!
\brief SimpleMeasurement
Allows to measure distances, angles, etc.
\sa QmitkFunctionality
\ingroup org_mitk_gui_qt_simplemeasurement_internal
*/
class QmitkSimpleMeasurement : public QmitkFunctionality
{
Q_OBJECT
public:
+ QmitkSimpleMeasurement() {}
+ QmitkSimpleMeasurement(const QmitkSimpleMeasurement& other)
+ {
+ Q_UNUSED(other)
+ throw std::runtime_error("Copy constructor not implemented");
+ }
virtual ~QmitkSimpleMeasurement();
virtual void Activated();
virtual void Deactivated();
virtual bool IsExclusiveFunctionality() const;
///
/// Called when the selection in the workbench changed
///
virtual void OnSelectionChanged(std::vector<mitk::DataNode*> nodes);
virtual void NodeRemoved(const mitk::DataNode* node);
protected:
// Pseudo Ctor
void CreateQtPartControl(QWidget* parent);
protected slots:
void AddDistanceSimpleMeasurement();
void AddAngleSimpleMeasurement();
void AddPathSimpleMeasurement();
protected:
/*!
* controls containing sliders for scrolling through the slices
*/
Ui::QmitkSimpleMeasurementControls * m_Controls;
/*
* Interactor for performing the simplemeasurements.
*/
mitk::WeakPointer<mitk::PointSetInteractor> m_PointSetInteractor;
/*
* Interactor for performing the simplemeasurements.
*/
mitk::WeakPointer<mitk::DataNode> m_SelectedPointSetNode;
/*
* Node representing the PointSet last created. It is used to delete empty point sets.
*/
std::vector<mitk::DataNode*> m_CreatedPointSetNodes;
};
#endif // !defined(QMITK_MEASUREMENT_H__INCLUDED)
diff --git a/Modules/Bundles/org.mitk.gui.qt.simplemeasurement/src/internal/mitkPluginActivator.cpp b/Modules/Bundles/org.mitk.gui.qt.simplemeasurement/src/internal/mitkPluginActivator.cpp
new file mode 100644
index 0000000000..5a5a94721c
--- /dev/null
+++ b/Modules/Bundles/org.mitk.gui.qt.simplemeasurement/src/internal/mitkPluginActivator.cpp
@@ -0,0 +1,20 @@
+#include "mitkPluginActivator.h"
+#include "QmitkSimpleMeasurement.h"
+
+#include <QtPlugin>
+
+namespace mitk {
+
+void PluginActivator::start(ctkPluginContext* context)
+{
+ BERRY_REGISTER_EXTENSION_CLASS(QmitkSimpleMeasurement, context)
+}
+
+void PluginActivator::stop(ctkPluginContext* context)
+{
+ Q_UNUSED(context)
+}
+
+}
+
+Q_EXPORT_PLUGIN2(org.mitk.gui.qt.simplemeasurement, mitk::PluginActivator)
\ No newline at end of file
diff --git a/Modules/Bundles/org.mitk.gui.qt.simplemeasurement/src/internal/mitkPluginActivator.h b/Modules/Bundles/org.mitk.gui.qt.simplemeasurement/src/internal/mitkPluginActivator.h
new file mode 100644
index 0000000000..70c968b98e
--- /dev/null
+++ b/Modules/Bundles/org.mitk.gui.qt.simplemeasurement/src/internal/mitkPluginActivator.h
@@ -0,0 +1,23 @@
+#ifndef MITKPLUGINACTIVATOR_H
+#define MITKPLUGINACTIVATOR_H
+
+#include <ctkPluginActivator.h>
+
+namespace mitk {
+
+class PluginActivator :
+ public QObject, public ctkPluginActivator
+{
+ Q_OBJECT
+ Q_INTERFACES(ctkPluginActivator)
+
+public:
+
+ void start(ctkPluginContext* context);
+ void stop(ctkPluginContext* context);
+
+}; // PluginActivator
+
+}
+
+#endif // MITKPLUGINACTIVATOR_H
\ No newline at end of file
diff --git a/Modules/Bundles/org.mitk.gui.qt.simplemeasurement/src/mitkQmitkSimpleMeasurementDll.h b/Modules/Bundles/org.mitk.gui.qt.simplemeasurement/src/mitkQmitkSimpleMeasurementDll.h
deleted file mode 100644
index 7b95a17bfb..0000000000
--- a/Modules/Bundles/org.mitk.gui.qt.simplemeasurement/src/mitkQmitkSimpleMeasurementDll.h
+++ /dev/null
@@ -1,41 +0,0 @@
-/*=========================================================================
-
-Program: Medical Imaging & Interaction Toolkit
-Language: C++
-Date: $Date: 2009-02-10 14:14:32 +0100 (Tue, 10 Feb 2009) $
-Version: $Revision: 14620 $
-
-Copyright (c) German Cancer Research Center, Division of Medical and
-Biological Informatics. All rights reserved.
-See MITKCopyright.txt or http://www.mitk.org/copyright.html for details.
-
-This software is distributed WITHOUT ANY WARRANTY; without even
-the implied warranty of MERCHANTABILITY or FITNESS FOR A PARTICULAR
-PURPOSE. See the above copyright notices for more information.
-
-=========================================================================*/
-
-#ifndef MITKQTMEASUREMENTDLL_H_
-#define MITKQTMEASUREMENTDLL_H_
-
-//
-// The following block is the standard way of creating macros which make exporting
-// from a DLL simpler. All files within this DLL are compiled with the org_mitk_gui_qt_application_EXPORTS
-// symbol defined on the command line. this symbol should not be defined on any project
-// that uses this DLL. This way any other project whose source files include this file see
-// MITK_QT_APP functions as being imported from a DLL, wheras this DLL sees symbols
-// defined with this macro as being exported.
-//
-#if defined(_WIN32) && !defined(BERRY_STATIC)
- #if defined(org_mitk_gui_qt_simplemeasurement_EXPORTS)
- #define MITK_QT_MEASUREMENT __declspec(dllexport)
- #else
- #define MITK_QT_MEASUREMENT __declspec(dllimport)
- #endif
-#endif
-
-#if !defined(MITK_QT_MEASUREMENT)
- #define MITK_QT_MEASUREMENT
-#endif
-
-#endif /*MITKQTMEASUREMENTDLL_H_*/
diff --git a/Modules/Bundles/org.mitk.gui.qt.toftutorial/CMakeLists.txt b/Modules/Bundles/org.mitk.gui.qt.toftutorial/CMakeLists.txt
index 219c8cd734..8bf27d4bc3 100644
--- a/Modules/Bundles/org.mitk.gui.qt.toftutorial/CMakeLists.txt
+++ b/Modules/Bundles/org.mitk.gui.qt.toftutorial/CMakeLists.txt
@@ -1,2 +1,9 @@
+# The project name must correspond to the directory name of your plug-in
+# and must not contain periods.
+PROJECT(org_mitk_gui_qt_toftutorial)
-MACRO_CREATE_MITK_PLUGIN(QmitkExt mitkToFHardware mitkToFProcessing)
+MACRO_CREATE_MITK_CTK_PLUGIN(
+ EXPORT_DIRECTIVE TOFTUTORIAL_EXPORT
+ EXPORTED_INCLUDE_SUFFIXES src
+ MODULE_DEPENDENCIES QmitkExt mitkToFHardware mitkToFProcessing
+)
\ No newline at end of file
diff --git a/Modules/Bundles/org.mitk.gui.qt.toftutorial/META-INF/MANIFEST.MF b/Modules/Bundles/org.mitk.gui.qt.toftutorial/META-INF/MANIFEST.MF
deleted file mode 100644
index 4d06c5b2e8..0000000000
--- a/Modules/Bundles/org.mitk.gui.qt.toftutorial/META-INF/MANIFEST.MF
+++ /dev/null
@@ -1,7 +0,0 @@
-Manifest-Version: 1.0
-Bundle-Name: ToFTutorial
-Bundle-SymbolicName: org.mitk.gui.qt.toftutorial
-Bundle-Version: 0.1
-Bundle-Vendor: DKFZ, Medical and Biological Informatics
-Require-Bundle: org.mitk.gui.qt.common
-Bundle-Activator:
diff --git a/Modules/Bundles/org.mitk.gui.qt.toftutorial/files.cmake b/Modules/Bundles/org.mitk.gui.qt.toftutorial/files.cmake
index cb8a9ddf11..aa5533022d 100644
--- a/Modules/Bundles/org.mitk.gui.qt.toftutorial/files.cmake
+++ b/Modules/Bundles/org.mitk.gui.qt.toftutorial/files.cmake
@@ -1,35 +1,37 @@
SET(SRC_CPP_FILES
)
SET(INTERNAL_CPP_FILES
QmitkToFTutorialView.cpp
-
+ mitkPluginActivator.cpp
)
SET(UI_FILES
src/internal/QmitkToFTutorialViewControls.ui
)
SET(MOC_H_FILES
src/internal/QmitkToFTutorialView.h
+ src/internal/mitkPluginActivator.h
)
-SET(RESOURCE_FILES
+SET(CACHED_RESOURCE_FILES
+ plugin.xml
resources/icon.xpm
)
-SET(RES_FILES
+SET(QRC_FILES
resources/QmitkToFTutorialView.qrc
)
-SET(CPP_FILES manifest.cpp)
+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/Modules/Bundles/org.mitk.gui.qt.toftutorial/manifest.cpp b/Modules/Bundles/org.mitk.gui.qt.toftutorial/manifest.cpp
deleted file mode 100644
index 21bae0fdf4..0000000000
--- a/Modules/Bundles/org.mitk.gui.qt.toftutorial/manifest.cpp
+++ /dev/null
@@ -1,26 +0,0 @@
-/*=========================================================================
-
-Program: Medical Imaging & Interaction Toolkit
-Language: C++
-Date: $Date$
-Version: $Revision$
-
-Copyright (c) German Cancer Research Center, Division of Medical and
-Biological Informatics. All rights reserved.
-See MITKCopyright.txt or http://www.mitk.org/copyright.html for details.
-
-This software is distributed WITHOUT ANY WARRANTY; without even
-the implied warranty of MERCHANTABILITY or FITNESS FOR A PARTICULAR
-PURPOSE. See the above copyright notices for more information.
-
-=========================================================================*/
-
-#include <Poco/ClassLibrary.h>
-
-
-
-#include "src/internal/QmitkToFTutorialView.h"
-
-POCO_BEGIN_NAMED_MANIFEST(berryIViewPart, berry::IViewPart)
- POCO_EXPORT_CLASS(::QmitkToFTutorialView)
-POCO_END_MANIFEST
diff --git a/Modules/Bundles/org.mitk.gui.qt.toftutorial/manifest_headers.cmake b/Modules/Bundles/org.mitk.gui.qt.toftutorial/manifest_headers.cmake
new file mode 100644
index 0000000000..9575f0b08e
--- /dev/null
+++ b/Modules/Bundles/org.mitk.gui.qt.toftutorial/manifest_headers.cmake
@@ -0,0 +1,5 @@
+set(Plugin-Name "ToFTutorial")
+set(Plugin-Version "0.1")
+set(Plugin-Vendor "DKFZ, Medical and Biological Informatics")
+set(Plugin-ContactAddress "www.mitk.org/wiki/MITK-ToF")
+set(Require-Plugin org.mitk.gui.qt.common)
\ No newline at end of file
diff --git a/Modules/Bundles/org.mitk.gui.qt.toftutorial/plugin.xml b/Modules/Bundles/org.mitk.gui.qt.toftutorial/plugin.xml
index 95cbd234de..c5cbee4781 100644
--- a/Modules/Bundles/org.mitk.gui.qt.toftutorial/plugin.xml
+++ b/Modules/Bundles/org.mitk.gui.qt.toftutorial/plugin.xml
@@ -1,12 +1,12 @@
<?xml version="1.0" encoding="UTF-8"?>
<?BlueBerry version="0.1"?>
<plugin>
<extension point="org.blueberry.ui.views">
<view id="org.mitk.views.toftutorial"
name="ToFTutorial"
- class="::QmitkToFTutorialView"
+ class="QmitkToFTutorialView"
icon="resources/icon.xpm" />
</extension>
</plugin>
diff --git a/Modules/Bundles/org.mitk.gui.qt.toftutorial/src/ToftutorialDll.h b/Modules/Bundles/org.mitk.gui.qt.toftutorial/src/ToftutorialDll.h
deleted file mode 100644
index 6559202be2..0000000000
--- a/Modules/Bundles/org.mitk.gui.qt.toftutorial/src/ToftutorialDll.h
+++ /dev/null
@@ -1,43 +0,0 @@
-/*=========================================================================
-
-Program: Medical Imaging & Interaction Toolkit
-Language: C++
-Date: $Date$
-Version: $Revision$
-
-Copyright (c) German Cancer Research Center, Division of Medical and
-Biological Informatics. All rights reserved.
-See MITKCopyright.txt or http://www.mitk.org/copyright.html for details.
-
-This software is distributed WITHOUT ANY WARRANTY; without even
-the implied warranty of MERCHANTABILITY or FITNESS FOR A PARTICULAR
-PURPOSE. See the above copyright notices for more information.
-
-=========================================================================*/
-
-#ifndef _TOFTUTORIAL_EXPORT_DLL_H_
-#define _TOFTUTORIAL_EXPORT_DLL_H_
-
-
-//
-// The following block is the standard way of creating macros which make exporting
-// from a DLL simpler. All files within this DLL are compiled with the org_mitk_gui_qt_toftutorial_EXPORTS
-// symbol defined on the command line. this symbol should not be defined on any project
-// that uses this DLL. This way any other project whose source files include this file see
-// org_mitk_gui_qt_toftutorial_EXPORTS functions as being imported from a DLL, wheras this DLL sees symbols
-// defined with this macro as being exported.
-//
-#if defined(_WIN32) && !defined(MITK_STATIC)
- #if defined(org_mitk_gui_qt_toftutorial_EXPORTS)
- #define TOFTUTORIAL_EXPORT __declspec(dllexport)
- #else
- #define TOFTUTORIAL_EXPORT __declspec(dllimport)
- #endif
-#endif
-
-
-#if !defined(TOFTUTORIAL_EXPORT)
- #define TOFTUTORIAL_EXPORT
-#endif
-
-#endif /*_TOFTUTORIAL_EXPORT_DLL_H_*/
diff --git a/Modules/Bundles/org.mitk.gui.qt.toftutorial/src/internal/QmitkToFTutorialView.cpp b/Modules/Bundles/org.mitk.gui.qt.toftutorial/src/internal/QmitkToFTutorialView.cpp
index b7db784681..53003d3d27 100644
--- a/Modules/Bundles/org.mitk.gui.qt.toftutorial/src/internal/QmitkToFTutorialView.cpp
+++ b/Modules/Bundles/org.mitk.gui.qt.toftutorial/src/internal/QmitkToFTutorialView.cpp
@@ -1,193 +1,200 @@
/*=========================================================================
Program: Medical Imaging & Interaction Toolkit
Language: C++
Date: $Date$
Version: $Revision$
Copyright (c) German Cancer Research Center, Division of Medical and
Biological Informatics. All rights reserved.
See MITKCopyright.txt or http://www.mitk.org/copyright.html for details.
This software is distributed WITHOUT ANY WARRANTY; without even
the implied warranty of MERCHANTABILITY or FITNESS FOR A PARTICULAR
PURPOSE. See the above copyright notices for more information.
=========================================================================*/
// Blueberry
#include <berryISelectionService.h>
#include <berryIWorkbenchWindow.h>
// Qmitk
#include "QmitkToFTutorialView.h"
#include "QmitkStdMultiWidget.h"
// Qt
#include <QMessageBox>
// mitk includes
#include <mitkCameraIntrinsics.h> // class holding the intrinsic parameters of the according camera
#include <mitkSurface.h>
// MITK-ToF related includes
#include <mitkToFConfig.h> // configuration file holding e.g. plugin paths or path to test file directory
#include <mitkToFDistanceImageToSurfaceFilter.h> // filter from module ToFProcessing that calculates a surface from the given range image
#include <mitkToFImageGrabberCreator.h> // creator class that provides pre-configured ToFCameraDevices
#include <mitkToFImageGrabber.h> // allows access to images provided by the ToF camera
const std::string QmitkToFTutorialView::VIEW_ID = "org.mitk.views.toftutorial";
QmitkToFTutorialView::QmitkToFTutorialView()
: QmitkFunctionality()
, m_Controls( 0 )
, m_MultiWidget( NULL )
{
}
QmitkToFTutorialView::~QmitkToFTutorialView()
{
}
void QmitkToFTutorialView::CreateQtPartControl( QWidget *parent )
{
// build up qt view, unless already done
if ( !m_Controls )
{
// create GUI widgets from the Qt Designer's .ui file
m_Controls = new Ui::QmitkToFTutorialViewControls;
m_Controls->setupUi( parent );
connect( m_Controls->step1Button, SIGNAL(clicked()), this, SLOT(OnStep1()) );
connect( m_Controls->step2Button, SIGNAL(clicked()), this, SLOT(OnStep2()) );
}
}
void QmitkToFTutorialView::StdMultiWidgetAvailable (QmitkStdMultiWidget &stdMultiWidget)
{
m_MultiWidget = &stdMultiWidget;
}
void QmitkToFTutorialView::StdMultiWidgetNotAvailable()
{
m_MultiWidget = NULL;
}
void QmitkToFTutorialView::OnStep1()
{
// clean up data storage
RemoveAllNodesFromDataStorage();
// use ToFImageGrabber to create instance of ToFImageGrabber that holds a ToFCameraMITKPlayerDevice for playing ToF data
mitk::ToFImageGrabber::Pointer tofImageGrabber = mitk::ToFImageGrabberCreator::GetInstance()->GetMITKPlayerImageGrabber();
// set paths to test data
std::string distanceFileName = MITK_TOF_DATA_DIR;
distanceFileName.append("/PMDCamCube2_MF0_IT0_20Images_DistanceImage.pic");
std::string amplitudeFileName = MITK_TOF_DATA_DIR;
amplitudeFileName.append("/PMDCamCube2_MF0_IT0_20Images_AmplitudeImage.pic");
std::string intensityFileName = MITK_TOF_DATA_DIR;
intensityFileName.append("/PMDCamCube2_MF0_IT0_20Images_IntensityImage.pic");
// set file name property in image grabber. This will be propagated to the corresponding device and controller class
tofImageGrabber->SetProperty("DistanceImageFileName",mitk::StringProperty::New(distanceFileName));
tofImageGrabber->SetProperty("AmplitudeImageFileName",mitk::StringProperty::New(amplitudeFileName));
tofImageGrabber->SetProperty("IntensityImageFileName",mitk::StringProperty::New(intensityFileName));
// connect to device
if (tofImageGrabber->ConnectCamera())
{
//// start camera (internally starts thread that continuously grabs images from the camera)
tofImageGrabber->StartCamera();
// update image grabber which itself represents the source of a MITK filter pipeline
tofImageGrabber->Update();
// grab distance image
mitk::Image::Pointer distanceImage = tofImageGrabber->GetOutput(0);
// grab amplitude image
mitk::Image::Pointer amplitudeImage = tofImageGrabber->GetOutput(1);
// grab intensity image
mitk::Image::Pointer intensityImage = tofImageGrabber->GetOutput(2);
//add distance image to data storage
mitk::DataNode::Pointer distanceNode = mitk::DataNode::New();
distanceNode->SetName("Distance Image");
distanceNode->SetData(distanceImage);
this->GetDefaultDataStorage()->Add(distanceNode);
//add amplitude image to data storage
mitk::DataNode::Pointer amplitudeNode = mitk::DataNode::New();
amplitudeNode->SetName("Amplitude Image");
amplitudeNode->SetData(amplitudeImage);
this->GetDefaultDataStorage()->Add(amplitudeNode);
//add intensity image to data storage
mitk::DataNode::Pointer intensityNode = mitk::DataNode::New();
intensityNode->SetName("Intensity Image");
intensityNode->SetData(intensityImage);
this->GetDefaultDataStorage()->Add(intensityNode);
// stop camera (terminate internally used thread)
tofImageGrabber->StopCamera();
- // disconnect from camera
+ //// disconnect from camera
tofImageGrabber->DisconnectCamera();
// adjust views to new data in DataStorage
mitk::RenderingManager::GetInstance()->InitializeViews(distanceImage->GetGeometry());
}
else
{
MITK_ERROR<<"Connection to ToF camera could not be established";
}
}
void QmitkToFTutorialView::OnStep2()
{
// Check if distance image is available
mitk::DataNode::Pointer distanceNode = this->GetDefaultDataStorage()->GetNamedNode("Distance Image");
if (distanceNode.IsNotNull())
{
// get distance image from node and check if node contains image
mitk::Image::Pointer distanceImage = dynamic_cast<mitk::Image*>(distanceNode->GetData());
if (distanceImage.IsNotNull())
{
// create object of CameraIntrinsics that holds intrinsic parameters of the ToF camera
mitk::CameraIntrinsics::Pointer cameraIntrinsics = mitk::CameraIntrinsics::New();
- // change focal length and use defaults for other parameters such as inter pixel distance or principal point
- cameraIntrinsics->SetFocalLength(13.3,13.3);
+ // set focal length in pixel
+ cameraIntrinsics->SetFocalLength(295.8,296.1);
+ // set principal point in pixel
+ cameraIntrinsics->SetPrincipalPoint(113.2,97.1);
// set up filter for surface calculation
mitk::ToFDistanceImageToSurfaceFilter::Pointer surfaceFilter = mitk::ToFDistanceImageToSurfaceFilter::New();
// apply intrinsic parameters to filter
surfaceFilter->SetCameraIntrinsics(cameraIntrinsics);
+ // set distance between pixels on chip in mm (in this example squared pixel)
+ mitk::ToFProcessingCommon::ToFPoint2D interPixelDistance;
+ interPixelDistance[0] = 0.045;
+ interPixelDistance[1] = 0.045;
+ surfaceFilter->SetInterPixelDistance(interPixelDistance);
// set distance image as input
surfaceFilter->SetInput(distanceImage);
// update the filter
surfaceFilter->Update();
// get surface from filter
mitk::Surface::Pointer surface = surfaceFilter->GetOutput();
// add surface to data storage
mitk::DataNode::Pointer surfaceNode = mitk::DataNode::New();
surfaceNode->SetName("ToF surface");
surfaceNode->SetData(surface);
this->GetDefaultDataStorage()->Add(surfaceNode);
// adjust views to new data in DataStorage
mitk::RenderingManager::GetInstance()->InitializeViews(surface->GetGeometry());
mitk::RenderingManager::GetInstance()->InitializeViews(surface->GetGeometry());
}
else
{
QMessageBox::warning(NULL,"ToF Tutorial","Node 'Distance Image' contains no image");
}
}
else
{
QMessageBox::warning(NULL,"ToF Tutorial","Perform Step 1 first to acquire a distance image");
}
}
void QmitkToFTutorialView::RemoveAllNodesFromDataStorage()
{
mitk::DataStorage::SetOfObjects::ConstPointer allNodes = this->GetDefaultDataStorage()->GetAll();
this->GetDefaultDataStorage()->Remove(allNodes);
}
diff --git a/Modules/Bundles/org.mitk.gui.qt.toftutorial/src/internal/mitkPluginActivator.cpp b/Modules/Bundles/org.mitk.gui.qt.toftutorial/src/internal/mitkPluginActivator.cpp
new file mode 100644
index 0000000000..eccdae58c3
--- /dev/null
+++ b/Modules/Bundles/org.mitk.gui.qt.toftutorial/src/internal/mitkPluginActivator.cpp
@@ -0,0 +1,20 @@
+#include "mitkPluginActivator.h"
+
+#include <QtPlugin>
+#include "QmitkToFTutorialView.h"
+
+namespace mitk {
+
+void PluginActivator::start(ctkPluginContext* context)
+{
+ BERRY_REGISTER_EXTENSION_CLASS(QmitkToFTutorialView, context)
+}
+
+void PluginActivator::stop(ctkPluginContext* context)
+{
+ Q_UNUSED(context)
+}
+
+}
+
+Q_EXPORT_PLUGIN2(org_mitk_gui_qt_toftutorial, mitk::PluginActivator)
\ No newline at end of file
diff --git a/Modules/Bundles/org.mitk.gui.qt.toftutorial/src/internal/mitkPluginActivator.h b/Modules/Bundles/org.mitk.gui.qt.toftutorial/src/internal/mitkPluginActivator.h
new file mode 100644
index 0000000000..70c968b98e
--- /dev/null
+++ b/Modules/Bundles/org.mitk.gui.qt.toftutorial/src/internal/mitkPluginActivator.h
@@ -0,0 +1,23 @@
+#ifndef MITKPLUGINACTIVATOR_H
+#define MITKPLUGINACTIVATOR_H
+
+#include <ctkPluginActivator.h>
+
+namespace mitk {
+
+class PluginActivator :
+ public QObject, public ctkPluginActivator
+{
+ Q_OBJECT
+ Q_INTERFACES(ctkPluginActivator)
+
+public:
+
+ void start(ctkPluginContext* context);
+ void stop(ctkPluginContext* context);
+
+}; // PluginActivator
+
+}
+
+#endif // MITKPLUGINACTIVATOR_H
\ No newline at end of file
diff --git a/Modules/Bundles/org.mitk.gui.qt.ugvisualization/CMakeLists.txt b/Modules/Bundles/org.mitk.gui.qt.ugvisualization/CMakeLists.txt
index fba82a3726..429419ef9a 100644
--- a/Modules/Bundles/org.mitk.gui.qt.ugvisualization/CMakeLists.txt
+++ b/Modules/Bundles/org.mitk.gui.qt.ugvisualization/CMakeLists.txt
@@ -1,2 +1,7 @@
+PROJECT(org_mitk_gui_qt_ugvisualization)
-MACRO_CREATE_MITK_PLUGIN(QmitkExt)
+MACRO_CREATE_MITK_CTK_PLUGIN(
+ EXPORT_DIRECTIVE UGVISUALIZATION_EXPORT
+ EXPORTED_INCLUDE_SUFFIXES src
+ MODULE_DEPENDENCIES QmitkExt
+)
diff --git a/Modules/Bundles/org.mitk.gui.qt.ugvisualization/META-INF/MANIFEST.MF b/Modules/Bundles/org.mitk.gui.qt.ugvisualization/META-INF/MANIFEST.MF
deleted file mode 100644
index 25b86fcdbb..0000000000
--- a/Modules/Bundles/org.mitk.gui.qt.ugvisualization/META-INF/MANIFEST.MF
+++ /dev/null
@@ -1,7 +0,0 @@
-Manifest-Version: 1.0
-Bundle-Name: UG Visualization
-Bundle-SymbolicName: org.mitk.gui.qt.ugvisualization
-Bundle-Version: 0.1
-Bundle-Vendor: DKFZ, Medical and Biological Informatics
-Require-Bundle: org.mitk.gui.qt.common
-Bundle-Activator:
diff --git a/Modules/Bundles/org.mitk.gui.qt.ugvisualization/files.cmake b/Modules/Bundles/org.mitk.gui.qt.ugvisualization/files.cmake
index fb1d90ad3b..e666250cd1 100644
--- a/Modules/Bundles/org.mitk.gui.qt.ugvisualization/files.cmake
+++ b/Modules/Bundles/org.mitk.gui.qt.ugvisualization/files.cmake
@@ -1,35 +1,37 @@
SET(SRC_CPP_FILES
)
SET(INTERNAL_CPP_FILES
QmitkUGVisualizationView.cpp
-
+ mitkPluginActivator.cpp
)
SET(UI_FILES
src/internal/QmitkUGVisualizationViewControls.ui
)
SET(MOC_H_FILES
src/internal/QmitkUGVisualizationView.h
+ src/internal/mitkPluginActivator.h
)
-SET(RESOURCE_FILES
+SET(CACHED_RESOURCE_FILES
resources/icon.png
+ plugin.xml
)
-SET(RES_FILES
+SET(QRC_FILES
)
-SET(CPP_FILES manifest.cpp)
+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/Modules/Bundles/org.mitk.gui.qt.ugvisualization/manifest.cpp b/Modules/Bundles/org.mitk.gui.qt.ugvisualization/manifest.cpp
deleted file mode 100644
index 4540f48909..0000000000
--- a/Modules/Bundles/org.mitk.gui.qt.ugvisualization/manifest.cpp
+++ /dev/null
@@ -1,26 +0,0 @@
-/*=========================================================================
-
-Program: Medical Imaging & Interaction Toolkit
-Language: C++
-Date: $Date$
-Version: $Revision$
-
-Copyright (c) German Cancer Research Center, Division of Medical and
-Biological Informatics. All rights reserved.
-See MITKCopyright.txt or http://www.mitk.org/copyright.html for details.
-
-This software is distributed WITHOUT ANY WARRANTY; without even
-the implied warranty of MERCHANTABILITY or FITNESS FOR A PARTICULAR
-PURPOSE. See the above copyright notices for more information.
-
-=========================================================================*/
-
-#include <Poco/ClassLibrary.h>
-
-
-
-#include "src/internal/QmitkUGVisualizationView.h"
-
-POCO_BEGIN_NAMED_MANIFEST(berryIViewPart, berry::IViewPart)
- POCO_EXPORT_CLASS(::QmitkUGVisualizationView)
-POCO_END_MANIFEST
diff --git a/Modules/Bundles/org.mitk.gui.qt.ugvisualization/manifest_headers.cmake b/Modules/Bundles/org.mitk.gui.qt.ugvisualization/manifest_headers.cmake
new file mode 100644
index 0000000000..071bc25705
--- /dev/null
+++ b/Modules/Bundles/org.mitk.gui.qt.ugvisualization/manifest_headers.cmake
@@ -0,0 +1,5 @@
+set(Plugin-Name "UG Visualization")
+set(Plugin-Version "0.1")
+set(Plugin-Vendor "DKFZ, Medical and Biological Informatics")
+set(Plugin-ContactAddress "http://www.mitk.org")
+set(Require-Plugin org.mitk.gui.qt.common)
diff --git a/Modules/Bundles/org.mitk.gui.qt.ugvisualization/plugin.xml b/Modules/Bundles/org.mitk.gui.qt.ugvisualization/plugin.xml
index 19d03ede9a..068fe5adbf 100644
--- a/Modules/Bundles/org.mitk.gui.qt.ugvisualization/plugin.xml
+++ b/Modules/Bundles/org.mitk.gui.qt.ugvisualization/plugin.xml
@@ -1,12 +1,12 @@
<?xml version="1.0" encoding="UTF-8"?>
<?BlueBerry version="0.1"?>
<plugin>
<extension point="org.blueberry.ui.views">
<view id="org.mitk.views.ugvisualization"
name="UG Visualization"
- class="::QmitkUGVisualizationView"
+ class="QmitkUGVisualizationView"
icon="resources/icon.png" />
</extension>
</plugin>
diff --git a/Modules/Bundles/org.mitk.gui.qt.ugvisualization/src/UGVisualizationDll.h b/Modules/Bundles/org.mitk.gui.qt.ugvisualization/src/UGVisualizationDll.h
deleted file mode 100644
index 71bada7bdd..0000000000
--- a/Modules/Bundles/org.mitk.gui.qt.ugvisualization/src/UGVisualizationDll.h
+++ /dev/null
@@ -1,43 +0,0 @@
-/*=========================================================================
-
-Program: Medical Imaging & Interaction Toolkit
-Language: C++
-Date: $Date$
-Version: $Revision$
-
-Copyright (c) German Cancer Research Center, Division of Medical and
-Biological Informatics. All rights reserved.
-See MITKCopyright.txt or http://www.mitk.org/copyright.html for details.
-
-This software is distributed WITHOUT ANY WARRANTY; without even
-the implied warranty of MERCHANTABILITY or FITNESS FOR A PARTICULAR
-PURPOSE. See the above copyright notices for more information.
-
-=========================================================================*/
-
-#ifndef _UGVISUALIZATION_EXPORT_DLL_H_
-#define _UGVISUALIZATION_EXPORT_DLL_H_
-
-
-//
-// The following block is the standard way of creating macros which make exporting
-// from a DLL simpler. All files within this DLL are compiled with the org_mitk_gui_qt_ugvisualization_EXPORTS
-// symbol defined on the command line. this symbol should not be defined on any project
-// that uses this DLL. This way any other project whose source files include this file see
-// org_mitk_gui_qt_ugvisualization_EXPORTS functions as being imported from a DLL, wheras this DLL sees symbols
-// defined with this macro as being exported.
-//
-#if defined(_WIN32) && !defined(MITK_STATIC)
- #if defined(org_mitk_gui_qt_ugvisualization_EXPORTS)
- #define UGVISUALIZATION_EXPORT __declspec(dllexport)
- #else
- #define UGVISUALIZATION_EXPORT __declspec(dllimport)
- #endif
-#endif
-
-
-#if !defined(UGVISUALIZATION_EXPORT)
- #define UGVISUALIZATION_EXPORT
-#endif
-
-#endif /*_UGVISUALIZATION_EXPORT_DLL_H_*/
diff --git a/Modules/Bundles/org.mitk.gui.qt.ugvisualization/src/internal/QmitkUGVisualizationView.cpp b/Modules/Bundles/org.mitk.gui.qt.ugvisualization/src/internal/QmitkUGVisualizationView.cpp
index a58cfb00d4..53ae45a723 100644
--- a/Modules/Bundles/org.mitk.gui.qt.ugvisualization/src/internal/QmitkUGVisualizationView.cpp
+++ b/Modules/Bundles/org.mitk.gui.qt.ugvisualization/src/internal/QmitkUGVisualizationView.cpp
@@ -1,296 +1,302 @@
/*=========================================================================
Program: Medical Imaging & Interaction Toolkit
Language: C++
Date: $Date$
Version: $Revision$
Copyright (c) German Cancer Research Center, Division of Medical and
Biological Informatics. All rights reserved.
See MITKCopyright.txt or http://www.mitk.org/copyright.html for details.
This software is distributed WITHOUT ANY WARRANTY; without even
the implied warranty of MERCHANTABILITY or FITNESS FOR A PARTICULAR
PURPOSE. See the above copyright notices for more information.
=========================================================================*/
// Blueberry
#include <berryISelectionService.h>
#include <berryIWorkbenchWindow.h>
// Qmitk
#include "QmitkUGVisualizationView.h"
#include "QmitkStdMultiWidget.h"
#include <mitkUnstructuredGrid.h>
#include <mitkGridRepresentationProperty.h>
#include <mitkGridVolumeMapperProperty.h>
#include <mitkVtkScalarModeProperty.h>
#include <mitkPropertyObserver.h>
#include <QmitkUGCombinedRepresentationPropertyWidget.h>
#include <QmitkBoolPropertyWidget.h>
#include <QWidgetAction>
class UGVisVolumeObserver : public mitk::PropertyView
{
public:
UGVisVolumeObserver(mitk::BoolProperty* property, QmitkUGVisualizationView* view)
: PropertyView(property), m_View(view), m_BoolProperty(property)
{
}
protected:
virtual void PropertyChanged()
{
m_View->m_VolumeMode = m_BoolProperty->GetValue();
m_View->UpdateEnablement();
}
virtual void PropertyRemoved()
{
m_View->m_VolumeMode = false;
m_Property = 0;
m_BoolProperty = 0;
}
QmitkUGVisualizationView* m_View;
mitk::BoolProperty* m_BoolProperty;
};
const std::string QmitkUGVisualizationView::VIEW_ID = "org.mitk.views.ugvisualization";
QmitkUGVisualizationView::QmitkUGVisualizationView()
: QmitkFunctionality(), m_MultiWidget(0), m_Outline2DAction(0), m_Outline2DWidget(0),
m_LODAction(0), m_ScalarVisibilityAction(0), m_ScalarVisibilityWidget(0),
m_FirstVolumeRepId(-1), m_ShowTFGeneratorWidget(true), m_ShowScalarOpacityWidget(false),
m_ShowColorWidget(true), m_ShowGradientOpacityWidget(false), m_ShowTFGeneratorAction(0),
m_ShowScalarOpacityAction(0), m_ShowColorAction(0), m_ShowGradientOpacityAction(0),
m_VolumeModeObserver(0)
{
}
+QmitkUGVisualizationView::QmitkUGVisualizationView(const QmitkUGVisualizationView& other)
+{
+ Q_UNUSED(other)
+ throw std::runtime_error("Copy constructor not implemented");
+}
+
QmitkUGVisualizationView::~QmitkUGVisualizationView()
{
delete m_VolumeModeObserver;
}
void QmitkUGVisualizationView::CreateQtPartControl( QWidget *parent )
{
m_Controls.setupUi( parent );
m_Outline2DWidget = new QmitkBoolPropertyWidget("Outline 2D polygons", parent);
m_Outline2DAction = new QWidgetAction(this);
m_Outline2DAction->setDefaultWidget(m_Outline2DWidget);
m_LODAction = new QAction("Enable LOD (Level Of Detail)", this);
m_LODAction->setCheckable(true);
m_ScalarVisibilityWidget = new QmitkBoolPropertyWidget("Visualize scalars", parent);
m_ScalarVisibilityAction = new QWidgetAction(this);
m_ScalarVisibilityAction->setDefaultWidget(m_ScalarVisibilityWidget);
m_ShowColorAction = new QAction("Show color transfer function", this);
m_ShowColorAction->setCheckable(true);
m_ShowColorAction->setChecked(m_ShowColorWidget);
m_ShowGradientOpacityAction = new QAction("Show gradient opacity function", this);
m_ShowGradientOpacityAction->setCheckable(true);
m_ShowGradientOpacityAction->setChecked(m_ShowGradientOpacityWidget);
m_ShowScalarOpacityAction = new QAction("Show scalar opacity function", this);
m_ShowScalarOpacityAction->setCheckable(true);
m_ShowScalarOpacityAction->setChecked(m_ShowScalarOpacityWidget);
m_ShowTFGeneratorAction = new QAction("Show transfer function generator", this);
m_ShowTFGeneratorAction->setCheckable(true);
m_ShowTFGeneratorAction->setChecked(m_ShowTFGeneratorWidget);
QMenu* menu = new QMenu(parent);
menu->addAction(m_ScalarVisibilityAction);
menu->addAction(m_Outline2DAction);
//menu->addAction(m_LODAction);
menu->addSeparator();
menu->addAction(m_ShowTFGeneratorAction);
menu->addAction(m_ShowScalarOpacityAction);
menu->addAction(m_ShowColorAction);
menu->addAction(m_ShowGradientOpacityAction);
m_Controls.m_OptionsButton->setMenu(menu);
m_Controls.m_TransferFunctionWidget->SetScalarLabel("Scalar value");
// const mitk::EnumerationProperty::EnumStringsContainerType& scalarStrings = scalarProp->GetEnumStrings();
// for (mitk::EnumerationProperty::EnumStringsContainerType::const_iterator it = scalarStrings.begin();
// it != scalarStrings.end(); ++it)
// {
// MITK_INFO << "ADding: " << it->first;
// m_Controls.m_ScalarModeComboBox->addItem(QString::fromStdString(it->first), it->second);
// }
this->UpdateGUI();
CreateConnections();
}
void QmitkUGVisualizationView::CreateConnections()
{
connect(m_Controls.m_ScalarModeComboBox, SIGNAL(currentIndexChanged(int)), this, SLOT(UpdateRenderWindow()));
connect(m_Controls.m_RepresentationComboBox, SIGNAL(activated(int)), this, SLOT(UpdateRenderWindow()));
connect(m_Outline2DWidget, SIGNAL(toggled(bool)), this, SLOT(UpdateRenderWindow()));
connect(m_ScalarVisibilityWidget, SIGNAL(toggled(bool)), this, SLOT(UpdateRenderWindow()));
connect(m_Controls.m_TransferFunctionGeneratorWidget, SIGNAL(SignalUpdateCanvas()), m_Controls.m_TransferFunctionWidget, SLOT(OnUpdateCanvas()));
connect(m_ShowColorAction, SIGNAL(triggered(bool)), this, SLOT(ShowColorWidget(bool)));
connect(m_ShowGradientOpacityAction, SIGNAL(triggered(bool)), this, SLOT(ShowGradientOpacityWidget(bool)));
connect(m_ShowScalarOpacityAction, SIGNAL(triggered(bool)), this, SLOT(ShowScalarOpacityWidget(bool)));
connect(m_ShowTFGeneratorAction, SIGNAL(triggered(bool)), this, SLOT(ShowTFGeneratorWidget(bool)));
}
void QmitkUGVisualizationView::UpdateRenderWindow()
{
mitk::RenderingManager::GetInstance()->RequestUpdateAll();
}
void QmitkUGVisualizationView::ShowTFGeneratorWidget(bool show)
{
m_ShowTFGeneratorWidget = show;
UpdateEnablement();
}
void QmitkUGVisualizationView::ShowScalarOpacityWidget(bool show)
{
m_ShowScalarOpacityWidget = show;
UpdateEnablement();
}
void QmitkUGVisualizationView::ShowColorWidget(bool show)
{
m_ShowColorWidget = show;
UpdateEnablement();
}
void QmitkUGVisualizationView::ShowGradientOpacityWidget(bool show)
{
m_ShowGradientOpacityWidget = show;
UpdateEnablement();
}
void QmitkUGVisualizationView::UpdateEnablement()
{
m_Controls.m_TransferFunctionGeneratorWidget->setVisible(m_ShowTFGeneratorWidget);
m_Controls.m_TransferFunctionWidget->ShowScalarOpacityFunction(m_ShowScalarOpacityWidget);
m_Controls.m_TransferFunctionWidget->ShowColorFunction(m_ShowColorWidget);
m_Controls.m_TransferFunctionWidget->ShowGradientOpacityFunction(m_ShowGradientOpacityWidget);
m_Controls.m_TransferFunctionGeneratorWidget->SetThresholdTabEnabled(m_VolumeMode);
m_Controls.m_TransferFunctionGeneratorWidget->SetBellTabEnabled(m_VolumeMode);
m_Controls.m_TransferFunctionWidget->SetScalarOpacityFunctionEnabled(m_VolumeMode);
m_Controls.m_TransferFunctionWidget->SetGradientOpacityFunctionEnabled(m_VolumeMode);
}
void QmitkUGVisualizationView::UpdateGUI()
{
bool enable = false;
mitk::DataNode* node = 0;
std::vector<mitk::DataNode*> nodes = this->GetDataManagerSelection();
if (!nodes.empty())
{
node = nodes.front();
if (node)
{
// here we have a valid mitk::DataNode
// a node itself is not very useful, we need its data item
mitk::BaseData* data = node->GetData();
if (data)
{
// test if this data item is an unstructured grid
enable = dynamic_cast<mitk::UnstructuredGrid*>( data );
}
}
}
m_Controls.m_SelectedLabel->setVisible(enable);
m_Controls.m_ErrorLabel->setVisible(!enable);
m_Controls.m_ContainerWidget->setEnabled(enable);
m_Controls.m_OptionsButton->setEnabled(enable);
if (enable)
{
m_VolumeMode = false;
node->GetBoolProperty("volumerendering", m_VolumeMode);
m_Controls.m_SelectedLabel->setText(QString("Selected UG: ") + node->GetName().c_str());
m_Controls.m_TransferFunctionGeneratorWidget->SetDataNode(node);
m_Controls.m_TransferFunctionWidget->SetDataNode(node);
mitk::BoolProperty* outlineProp = 0;
node->GetProperty(outlineProp, "outline polygons");
m_Outline2DWidget->SetProperty(outlineProp);
mitk::BoolProperty* scalarVisProp = 0;
node->GetProperty(scalarVisProp, "scalar visibility");
m_ScalarVisibilityWidget->SetProperty(scalarVisProp);
mitk::VtkScalarModeProperty* scalarProp = 0;
if (node->GetProperty(scalarProp, "scalar mode"))
{
m_Controls.m_ScalarModeComboBox->SetProperty(scalarProp);
}
mitk::GridRepresentationProperty* gridRepProp = 0;
mitk::GridVolumeMapperProperty* gridVolumeProp = 0;
mitk::BoolProperty* volumeProp = 0;
node->GetProperty(gridRepProp, "grid representation");
node->GetProperty(gridVolumeProp, "volumerendering.mapper");
node->GetProperty(volumeProp, "volumerendering");
m_Controls.m_RepresentationComboBox->SetProperty(gridRepProp, gridVolumeProp, volumeProp);
if (m_VolumeModeObserver)
{
delete m_VolumeModeObserver;
m_VolumeModeObserver = 0;
}
if (volumeProp)
{
m_VolumeModeObserver = new UGVisVolumeObserver(volumeProp, this);
}
}
UpdateEnablement();
}
void QmitkUGVisualizationView::StdMultiWidgetAvailable (QmitkStdMultiWidget &stdMultiWidget)
{
m_MultiWidget = &stdMultiWidget;
}
void QmitkUGVisualizationView::StdMultiWidgetNotAvailable()
{
m_MultiWidget = 0;
}
void QmitkUGVisualizationView::OnSelectionChanged( std::vector<mitk::DataNode*> nodes )
{
UpdateGUI();
}
diff --git a/Modules/Bundles/org.mitk.gui.qt.ugvisualization/src/internal/QmitkUGVisualizationView.h b/Modules/Bundles/org.mitk.gui.qt.ugvisualization/src/internal/QmitkUGVisualizationView.h
index ff85b1b4b6..7992a88e2a 100644
--- a/Modules/Bundles/org.mitk.gui.qt.ugvisualization/src/internal/QmitkUGVisualizationView.h
+++ b/Modules/Bundles/org.mitk.gui.qt.ugvisualization/src/internal/QmitkUGVisualizationView.h
@@ -1,117 +1,118 @@
/*=========================================================================
Program: Medical Imaging & Interaction Toolkit
Language: C++
Date: $Date$
Version: $Revision$
Copyright (c) German Cancer Research Center, Division of Medical and
Biological Informatics. All rights reserved.
See MITKCopyright.txt or http://www.mitk.org/copyright.html for details.
This software is distributed WITHOUT ANY WARRANTY; without even
the implied warranty of MERCHANTABILITY or FITNESS FOR A PARTICULAR
PURPOSE. See the above copyright notices for more information.
=========================================================================*/
#ifndef QmitkUGVisualizationView_h
#define QmitkUGVisualizationView_h
#include <berryISelectionListener.h>
#include <QmitkFunctionality.h>
#include "ui_QmitkUGVisualizationViewControls.h"
class QWidgetAction;
class QmitkBoolPropertyWidget;
namespace mitk {
class PropertyObserver;
}
/*!
\brief QmitkUGVisualizationView
\warning This application module is not yet documented. Use "svn blame/praise/annotate" and ask the author to provide basic documentation.
\sa QmitkFunctionality
\ingroup Functionalities
*/
class QmitkUGVisualizationView : public QmitkFunctionality
{
// 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;
QmitkUGVisualizationView();
+ QmitkUGVisualizationView(const QmitkUGVisualizationView& other);
virtual ~QmitkUGVisualizationView();
virtual void CreateQtPartControl(QWidget *parent);
virtual void StdMultiWidgetAvailable (QmitkStdMultiWidget &stdMultiWidget);
virtual void StdMultiWidgetNotAvailable();
protected slots:
void UpdateRenderWindow();
void ShowTFGeneratorWidget(bool show);
void ShowScalarOpacityWidget(bool show);
void ShowColorWidget(bool show);
void ShowGradientOpacityWidget(bool show);
protected:
/// \brief called by QmitkFunctionality when DataManager's selection has changed
virtual void OnSelectionChanged( std::vector<mitk::DataNode*> nodes );
void CreateConnections();
private:
friend class UGVisVolumeObserver;
void UpdateGUI();
void UpdateEnablement();
Ui::QmitkUGVisualizationViewControls m_Controls;
QmitkStdMultiWidget* m_MultiWidget;
QWidgetAction* m_Outline2DAction;
QmitkBoolPropertyWidget* m_Outline2DWidget;
QAction* m_LODAction;
QWidgetAction* m_ScalarVisibilityAction;
QmitkBoolPropertyWidget* m_ScalarVisibilityWidget;
int m_FirstVolumeRepId;
QHash<int, int> m_MapRepComboToEnumId;
bool m_VolumeMode;
bool m_ShowTFGeneratorWidget;
bool m_ShowScalarOpacityWidget;
bool m_ShowColorWidget;
bool m_ShowGradientOpacityWidget;
QAction* m_ShowTFGeneratorAction;
QAction* m_ShowScalarOpacityAction;
QAction* m_ShowColorAction;
QAction* m_ShowGradientOpacityAction;
mitk::PropertyObserver* m_VolumeModeObserver;
};
#endif // _QMITKUGVISUALIZATIONVIEW_H_INCLUDED
diff --git a/Modules/Bundles/org.mitk.gui.qt.ugvisualization/src/internal/mitkPluginActivator.cpp b/Modules/Bundles/org.mitk.gui.qt.ugvisualization/src/internal/mitkPluginActivator.cpp
new file mode 100644
index 0000000000..921aface47
--- /dev/null
+++ b/Modules/Bundles/org.mitk.gui.qt.ugvisualization/src/internal/mitkPluginActivator.cpp
@@ -0,0 +1,21 @@
+#include "mitkPluginActivator.h"
+
+#include <QtPlugin>
+
+#include "QmitkUGVisualizationView.h"
+
+namespace mitk {
+
+void PluginActivator::start(ctkPluginContext* context)
+{
+ BERRY_REGISTER_EXTENSION_CLASS(QmitkUGVisualizationView, context)
+}
+
+void PluginActivator::stop(ctkPluginContext* context)
+{
+ Q_UNUSED(context)
+}
+
+}
+
+Q_EXPORT_PLUGIN2(org_mitk_gui_qt_ugvisualization, mitk::PluginActivator)
diff --git a/Modules/Bundles/org.mitk.gui.qt.ugvisualization/src/internal/mitkPluginActivator.h b/Modules/Bundles/org.mitk.gui.qt.ugvisualization/src/internal/mitkPluginActivator.h
new file mode 100644
index 0000000000..a34be34be4
--- /dev/null
+++ b/Modules/Bundles/org.mitk.gui.qt.ugvisualization/src/internal/mitkPluginActivator.h
@@ -0,0 +1,23 @@
+#ifndef MITKPLUGINACTIVATOR_H
+#define MITKPLUGINACTIVATOR_H
+
+#include <ctkPluginActivator.h>
+
+namespace mitk {
+
+class PluginActivator :
+ public QObject, public ctkPluginActivator
+{
+ Q_OBJECT
+ Q_INTERFACES(ctkPluginActivator)
+
+public:
+
+ void start(ctkPluginContext* context);
+ void stop(ctkPluginContext* context);
+
+}; // PluginActivator
+
+}
+
+#endif // MITKPLUGINACTIVATOR_H
diff --git a/Modules/Bundles/org.mitk.gui.qt.viewinitialization/CMakeLists.txt b/Modules/Bundles/org.mitk.gui.qt.viewinitialization/CMakeLists.txt
index fba82a3726..e4dca6478a 100644
--- a/Modules/Bundles/org.mitk.gui.qt.viewinitialization/CMakeLists.txt
+++ b/Modules/Bundles/org.mitk.gui.qt.viewinitialization/CMakeLists.txt
@@ -1,2 +1,7 @@
+PROJECT(org_mitk_gui_qt_viewinitialization)
-MACRO_CREATE_MITK_PLUGIN(QmitkExt)
+MACRO_CREATE_MITK_CTK_PLUGIN(
+ EXPORT_DIRECTIVE VIEWINITIALIZATION_EXPORT
+ EXPORTED_INCLUDE_SUFFIXES src
+ MODULE_DEPENDENCIES QmitkExt
+)
diff --git a/Modules/Bundles/org.mitk.gui.qt.viewinitialization/META-INF/MANIFEST.MF b/Modules/Bundles/org.mitk.gui.qt.viewinitialization/META-INF/MANIFEST.MF
deleted file mode 100644
index 916c5f333c..0000000000
--- a/Modules/Bundles/org.mitk.gui.qt.viewinitialization/META-INF/MANIFEST.MF
+++ /dev/null
@@ -1,7 +0,0 @@
-Manifest-Version: 1.0
-Bundle-Name: View Initialization
-Bundle-SymbolicName: org.mitk.gui.qt.viewinitialization
-Bundle-Version: 0.1
-Bundle-Vendor: DKFZ, Medical and Biological Informatics
-Require-Bundle: org.mitk.gui.qt.common
-Bundle-Activator:
diff --git a/Modules/Bundles/org.mitk.gui.qt.viewinitialization/files.cmake b/Modules/Bundles/org.mitk.gui.qt.viewinitialization/files.cmake
index 5e67afae29..00dfc15ee1 100644
--- a/Modules/Bundles/org.mitk.gui.qt.viewinitialization/files.cmake
+++ b/Modules/Bundles/org.mitk.gui.qt.viewinitialization/files.cmake
@@ -1,35 +1,37 @@
SET(SRC_CPP_FILES
)
SET(INTERNAL_CPP_FILES
+ mitkPluginActivator.cpp
QmitkViewInitializationView.cpp
-
)
SET(UI_FILES
src/internal/QmitkViewInitializationViewControls.ui
)
SET(MOC_H_FILES
+ src/internal/mitkPluginActivator.h
src/internal/QmitkViewInitializationView.h
)
-SET(RESOURCE_FILES
+SET(CACHED_RESOURCE_FILES
+ plugin.xml
resources/viewInitializationIcon.xpm
)
-SET(RES_FILES
- resources/QmitkViewInitializationView.qrc
+SET(QRC_FILES
+
)
-SET(CPP_FILES manifest.cpp)
+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/Modules/Bundles/org.mitk.gui.qt.viewinitialization/manifest.cpp b/Modules/Bundles/org.mitk.gui.qt.viewinitialization/manifest.cpp
deleted file mode 100644
index 45bd182e0d..0000000000
--- a/Modules/Bundles/org.mitk.gui.qt.viewinitialization/manifest.cpp
+++ /dev/null
@@ -1,26 +0,0 @@
-/*=========================================================================
-
-Program: Medical Imaging & Interaction Toolkit
-Language: C++
-Date: $Date: 2009-05-28 17:19:30 +0200 (Do, 28 Mai 2009) $
-Version: $Revision: 17495 $
-
-Copyright (c) German Cancer Research Center, Division of Medical and
-Biological Informatics. All rights reserved.
-See MITKCopyright.txt or http://www.mitk.org/copyright.html for details.
-
-This software is distributed WITHOUT ANY WARRANTY; without even
-the implied warranty of MERCHANTABILITY or FITNESS FOR A PARTICULAR
-PURPOSE. See the above copyright notices for more information.
-
-=========================================================================*/
-
-#include <Poco/ClassLibrary.h>
-
-#include <berryIViewPart.h>
-#include "src/internal/QmitkViewInitializationView.h"
-
-
-POCO_BEGIN_NAMED_MANIFEST(berryIViewPart, berry::IViewPart)
- POCO_EXPORT_CLASS(::QmitkViewInitializationView)
-POCO_END_MANIFEST
diff --git a/Modules/Bundles/org.mitk.gui.qt.viewinitialization/manifest_headers.cmake b/Modules/Bundles/org.mitk.gui.qt.viewinitialization/manifest_headers.cmake
new file mode 100644
index 0000000000..d92f2e88bc
--- /dev/null
+++ b/Modules/Bundles/org.mitk.gui.qt.viewinitialization/manifest_headers.cmake
@@ -0,0 +1,5 @@
+set(Plugin-Name "View Initialization")
+set(Plugin-Version "0.1")
+set(Plugin-Vendor "DKFZ, Medical and Biological Informatics")
+set(Plugin-ContactAddress "http://www.mitk.org")
+set(Require-Plugin org.mitk.gui.qt.common)
diff --git a/Modules/Bundles/org.mitk.gui.qt.viewinitialization/plugin.xml b/Modules/Bundles/org.mitk.gui.qt.viewinitialization/plugin.xml
index 67f7dfb23e..dc0d401d10 100644
--- a/Modules/Bundles/org.mitk.gui.qt.viewinitialization/plugin.xml
+++ b/Modules/Bundles/org.mitk.gui.qt.viewinitialization/plugin.xml
@@ -1,12 +1,12 @@
<?xml version="1.0" encoding="UTF-8"?>
<?BlueBerry version="0.1"?>
<plugin>
<extension point="org.blueberry.ui.views">
<view id="org.mitk.views.viewinitialization"
name="ViewInitialization"
- class="::QmitkViewInitializationView"
+ class="QmitkViewInitializationView"
icon="resources/viewInitializationIcon.xpm"/>
</extension>
</plugin>
diff --git a/Modules/Bundles/org.mitk.gui.qt.viewinitialization/resources/QmitkViewInitializationView.qrc b/Modules/Bundles/org.mitk.gui.qt.viewinitialization/resources/QmitkViewInitializationView.qrc
deleted file mode 100644
index 0e83e38af6..0000000000
--- a/Modules/Bundles/org.mitk.gui.qt.viewinitialization/resources/QmitkViewInitializationView.qrc
+++ /dev/null
@@ -1,5 +0,0 @@
-<!DOCTYPE RCC><RCC version="1.0">
- <qresource prefix="/QmitkViewInitializationView">
- <file>viewInitializationIcon.xpm</file>
- </qresource>
- </RCC>
diff --git a/Modules/Bundles/org.mitk.gui.qt.viewinitialization/src/ViewinitializationDll.h b/Modules/Bundles/org.mitk.gui.qt.viewinitialization/src/ViewinitializationDll.h
deleted file mode 100644
index 425757ef30..0000000000
--- a/Modules/Bundles/org.mitk.gui.qt.viewinitialization/src/ViewinitializationDll.h
+++ /dev/null
@@ -1,43 +0,0 @@
-/*=========================================================================
-
-Program: Medical Imaging & Interaction Toolkit
-Language: C++
-Date: $Date: 2009-05-28 17:19:30 +0200 (Do, 28 Mai 2009) $
-Version: $Revision: 17495 $
-
-Copyright (c) German Cancer Research Center, Division of Medical and
-Biological Informatics. All rights reserved.
-See MITKCopyright.txt or http://www.mitk.org/copyright.html for details.
-
-This software is distributed WITHOUT ANY WARRANTY; without even
-the implied warranty of MERCHANTABILITY or FITNESS FOR A PARTICULAR
-PURPOSE. See the above copyright notices for more information.
-
-=========================================================================*/
-
-#ifndef _VIEWINITIALIZATION_EXPORT_DLL_H_
-#define _VIEWINITIALIZATION_EXPORT_DLL_H_
-
-
-//
-// The following block is the standard way of creating macros which make exporting
-// from a DLL simpler. All files within this DLL are compiled with the org_mitk_gui_qt_viewinitialization_EXPORTS
-// symbol defined on the command line. this symbol should not be defined on any project
-// that uses this DLL. This way any other project whose source files include this file see
-// org_mitk_gui_qt_viewinitialization_EXPORTS functions as being imported from a DLL, wheras this DLL sees symbols
-// defined with this macro as being exported.
-//
-#if defined(_WIN32) && !defined(MITK_STATIC)
- #if defined(org_mitk_gui_qt_viewinitialization_EXPORTS)
- #define VIEWINITIALIZATION_EXPORT __declspec(dllexport)
- #else
- #define VIEWINITIALIZATION_EXPORT __declspec(dllimport)
- #endif
-#endif
-
-
-#if !defined(VIEWINITIALIZATION_EXPORT)
- #define VIEWINITIALIZATION_EXPORT
-#endif
-
-#endif /*_VIEWINITIALIZATION_EXPORT_DLL_H_*/
diff --git a/Modules/Bundles/org.mitk.gui.qt.viewinitialization/src/internal/mitkPluginActivator.cpp b/Modules/Bundles/org.mitk.gui.qt.viewinitialization/src/internal/mitkPluginActivator.cpp
new file mode 100644
index 0000000000..da7081f965
--- /dev/null
+++ b/Modules/Bundles/org.mitk.gui.qt.viewinitialization/src/internal/mitkPluginActivator.cpp
@@ -0,0 +1,21 @@
+#include "mitkPluginActivator.h"
+
+#include <QtPlugin>
+
+#include "QmitkViewInitializationView.h"
+
+namespace mitk {
+
+void PluginActivator::start(ctkPluginContext* context)
+{
+ BERRY_REGISTER_EXTENSION_CLASS(QmitkViewInitializationView, context)
+}
+
+void PluginActivator::stop(ctkPluginContext* context)
+{
+ Q_UNUSED(context)
+}
+
+}
+
+Q_EXPORT_PLUGIN2(org_mitk_gui_qt_viewinitialization, mitk::PluginActivator)
diff --git a/Modules/Bundles/org.mitk.gui.qt.viewinitialization/src/internal/mitkPluginActivator.h b/Modules/Bundles/org.mitk.gui.qt.viewinitialization/src/internal/mitkPluginActivator.h
new file mode 100644
index 0000000000..a34be34be4
--- /dev/null
+++ b/Modules/Bundles/org.mitk.gui.qt.viewinitialization/src/internal/mitkPluginActivator.h
@@ -0,0 +1,23 @@
+#ifndef MITKPLUGINACTIVATOR_H
+#define MITKPLUGINACTIVATOR_H
+
+#include <ctkPluginActivator.h>
+
+namespace mitk {
+
+class PluginActivator :
+ public QObject, public ctkPluginActivator
+{
+ Q_OBJECT
+ Q_INTERFACES(ctkPluginActivator)
+
+public:
+
+ void start(ctkPluginContext* context);
+ void stop(ctkPluginContext* context);
+
+}; // PluginActivator
+
+}
+
+#endif // MITKPLUGINACTIVATOR_H
diff --git a/Modules/Bundles/org.mitk.gui.qt.volumetry/CMakeLists.txt b/Modules/Bundles/org.mitk.gui.qt.volumetry/CMakeLists.txt
index fba82a3726..cb8a81d45f 100644
--- a/Modules/Bundles/org.mitk.gui.qt.volumetry/CMakeLists.txt
+++ b/Modules/Bundles/org.mitk.gui.qt.volumetry/CMakeLists.txt
@@ -1,2 +1,9 @@
+# The project name must correspond to the directory name of your plug-in
+# and must not contain periods.
+PROJECT(org_mitk_gui_qt_volumetry)
-MACRO_CREATE_MITK_PLUGIN(QmitkExt)
+MACRO_CREATE_MITK_CTK_PLUGIN(
+ EXPORT_DIRECTIVE VOLUMETRY_EXPORT
+ EXPORTED_INCLUDE_SUFFIXES src
+ MODULE_DEPENDENCIES QmitkExt
+)
\ No newline at end of file
diff --git a/Modules/Bundles/org.mitk.gui.qt.volumetry/META-INF/MANIFEST.MF b/Modules/Bundles/org.mitk.gui.qt.volumetry/META-INF/MANIFEST.MF
deleted file mode 100644
index 5dcd5fc0dd..0000000000
--- a/Modules/Bundles/org.mitk.gui.qt.volumetry/META-INF/MANIFEST.MF
+++ /dev/null
@@ -1,7 +0,0 @@
-Manifest-Version: 1.0
-Bundle-Name: Volumetry
-Bundle-SymbolicName: org.mitk.gui.qt.volumetry
-Bundle-Version: 0.1
-Bundle-Vendor: DKFZ, Medical and Biological Informatics
-Require-Bundle: org.mitk.gui.qt.common
-Bundle-Activator:
diff --git a/Modules/Bundles/org.mitk.gui.qt.volumetry/files.cmake b/Modules/Bundles/org.mitk.gui.qt.volumetry/files.cmake
index 0282a1a315..63cb79f877 100644
--- a/Modules/Bundles/org.mitk.gui.qt.volumetry/files.cmake
+++ b/Modules/Bundles/org.mitk.gui.qt.volumetry/files.cmake
@@ -1,35 +1,34 @@
SET(SRC_CPP_FILES
)
SET(INTERNAL_CPP_FILES
QmitkVolumetryView.cpp
-
+ mitkVolumetryPluginActivator.cpp
)
SET(UI_FILES
src/internal/QmitkVolumetryViewControls.ui
)
SET(MOC_H_FILES
src/internal/QmitkVolumetryView.h
+ src/internal/mitkVolumetryPluginActivator.h
)
-SET(RESOURCE_FILES
+SET(CACHED_RESOURCE_FILES
resources/volumetryIcon.xpm
+ plugin.xml
)
-SET(RES_FILES
+SET(QRC_FILES
resources/QmitkVolumetryView.qrc
)
-SET(CPP_FILES manifest.cpp)
-
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})
-
+endforeach(file ${INTERNAL_CPP_FILES})
\ No newline at end of file
diff --git a/Modules/Bundles/org.mitk.gui.qt.volumetry/manifest.cpp b/Modules/Bundles/org.mitk.gui.qt.volumetry/manifest.cpp
deleted file mode 100644
index 5220c43d43..0000000000
--- a/Modules/Bundles/org.mitk.gui.qt.volumetry/manifest.cpp
+++ /dev/null
@@ -1,26 +0,0 @@
-/*=========================================================================
-
-Program: Medical Imaging & Interaction Toolkit
-Language: C++
-Date: $Date: 2009-05-28 17:19:30 +0200 (Do, 28 Mai 2009) $
-Version: $Revision: 17495 $
-
-Copyright (c) German Cancer Research Center, Division of Medical and
-Biological Informatics. All rights reserved.
-See MITKCopyright.txt or http://www.mitk.org/copyright.html for details.
-
-This software is distributed WITHOUT ANY WARRANTY; without even
-the implied warranty of MERCHANTABILITY or FITNESS FOR A PARTICULAR
-PURPOSE. See the above copyright notices for more information.
-
-=========================================================================*/
-
-#include <Poco/ClassLibrary.h>
-
-#include <berryIViewPart.h>
-#include "src/internal/QmitkVolumetryView.h"
-
-
-POCO_BEGIN_NAMED_MANIFEST(berryIViewPart, berry::IViewPart)
- POCO_EXPORT_CLASS(::QmitkVolumetryView)
-POCO_END_MANIFEST
diff --git a/Modules/Bundles/org.mitk.gui.qt.volumetry/manifest_headers.cmake b/Modules/Bundles/org.mitk.gui.qt.volumetry/manifest_headers.cmake
new file mode 100644
index 0000000000..c1c1421988
--- /dev/null
+++ b/Modules/Bundles/org.mitk.gui.qt.volumetry/manifest_headers.cmake
@@ -0,0 +1,5 @@
+set(Plugin-Name "MITK Volumetry")
+set(Plugin-Version "0.9")
+set(Plugin-Vendor "DKFZ, Medical and Biological Informatics")
+set(Plugin-ContactAddress "http://www.mitk.org")
+set(Require-Plugin org.mitk.gui.qt.common)
\ No newline at end of file
diff --git a/Modules/Bundles/org.mitk.gui.qt.volumetry/plugin.xml b/Modules/Bundles/org.mitk.gui.qt.volumetry/plugin.xml
index 2179244e56..7f155a86f6 100644
--- a/Modules/Bundles/org.mitk.gui.qt.volumetry/plugin.xml
+++ b/Modules/Bundles/org.mitk.gui.qt.volumetry/plugin.xml
@@ -1,12 +1,12 @@
<?xml version="1.0" encoding="UTF-8"?>
<?BlueBerry version="0.1"?>
<plugin>
<extension point="org.blueberry.ui.views">
<view id="org.mitk.views.volumetry"
name="Volumetry"
- class="::QmitkVolumetryView"
+ class="QmitkVolumetryView"
icon="resources/volumetryIcon.xpm" />
</extension>
</plugin>
diff --git a/Modules/Bundles/org.mitk.gui.qt.volumetry/src/VolumetryDll.h b/Modules/Bundles/org.mitk.gui.qt.volumetry/src/VolumetryDll.h
deleted file mode 100644
index d54b8b3430..0000000000
--- a/Modules/Bundles/org.mitk.gui.qt.volumetry/src/VolumetryDll.h
+++ /dev/null
@@ -1,43 +0,0 @@
-/*=========================================================================
-
-Program: Medical Imaging & Interaction Toolkit
-Language: C++
-Date: $Date: 2009-05-28 17:19:30 +0200 (Do, 28 Mai 2009) $
-Version: $Revision: 17495 $
-
-Copyright (c) German Cancer Research Center, Division of Medical and
-Biological Informatics. All rights reserved.
-See MITKCopyright.txt or http://www.mitk.org/copyright.html for details.
-
-This software is distributed WITHOUT ANY WARRANTY; without even
-the implied warranty of MERCHANTABILITY or FITNESS FOR A PARTICULAR
-PURPOSE. See the above copyright notices for more information.
-
-=========================================================================*/
-
-#ifndef _VOLUMETRY_EXPORT_DLL_H_
-#define _VOLUMETRY_EXPORT_DLL_H_
-
-
-//
-// The following block is the standard way of creating macros which make exporting
-// from a DLL simpler. All files within this DLL are compiled with the org_mitk_gui_qt_volumetry_EXPORTS
-// symbol defined on the command line. this symbol should not be defined on any project
-// that uses this DLL. This way any other project whose source files include this file see
-// org_mitk_gui_qt_volumetry_EXPORTS functions as being imported from a DLL, wheras this DLL sees symbols
-// defined with this macro as being exported.
-//
-#if defined(_WIN32) && !defined(MITK_STATIC)
- #if defined(org_mitk_gui_qt_volumetry_EXPORTS)
- #define VOLUMETRY_EXPORT __declspec(dllexport)
- #else
- #define VOLUMETRY_EXPORT __declspec(dllimport)
- #endif
-#endif
-
-
-#if !defined(VOLUMETRY_EXPORT)
- #define VOLUMETRY_EXPORT
-#endif
-
-#endif /*_VOLUMETRY_EXPORT_DLL_H_*/
diff --git a/Modules/Bundles/org.mitk.gui.qt.volumetry/src/internal/QmitkVolumetryView.h b/Modules/Bundles/org.mitk.gui.qt.volumetry/src/internal/QmitkVolumetryView.h
index be4334e4df..e090d2d82e 100644
--- a/Modules/Bundles/org.mitk.gui.qt.volumetry/src/internal/QmitkVolumetryView.h
+++ b/Modules/Bundles/org.mitk.gui.qt.volumetry/src/internal/QmitkVolumetryView.h
@@ -1,114 +1,121 @@
/*=========================================================================
Program: Medical Imaging & Interaction Toolkit
Language: C++
Date: $Date: 2009-05-28 17:19:30 +0200 (Do, 28 Mai 2009) $
Version: $Revision: 17495 $
Copyright (c) German Cancer Research Center, Division of Medical and
Biological Informatics. All rights reserved.
See MITKCopyright.txt or http://www.mitk.org/copyright.html for details.
This software is distributed WITHOUT ANY WARRANTY; without even
the implied warranty of MERCHANTABILITY or FITNESS FOR A PARTICULAR
PURPOSE. See the above copyright notices for more information.
=========================================================================*/
#ifndef _QMITKVOLUMETRYVIEW_H_INCLUDED
#define _QMITKVOLUMETRYVIEW_H_INCLUDED
#include <QmitkFunctionality.h>
#include <string>
#include "ui_QmitkVolumetryViewControls.h"
/*!
* \ingroup org_mitk_gui_qt_volumetry_internal
*
* \brief QmitkVolumetryView
*
* Document your class here.
*
* \sa QmitkFunctionality
*/
class QmitkVolumetryView : public QmitkFunctionality
{
// this is needed for all Qt objects that should have a MOC object (everything that derives from QObject)
Q_OBJECT
public:
static const std::string VIEW_ID;
QmitkVolumetryView();
+ QmitkVolumetryView(const QmitkVolumetryView& other)
+ {
+ Q_UNUSED(other)
+ throw std::runtime_error("Copy constructor not implemented");
+ }
+
+
virtual ~QmitkVolumetryView();
virtual void CreateQtPartControl(QWidget *parent);
/// \brief Creation of the connections of main and control widget
virtual void CreateConnections();
/// \brief Called when the functionality is activated
virtual void Activated();
virtual void Deactivated();
virtual void StdMultiWidgetAvailable (QmitkStdMultiWidget &stdMultiWidget);
virtual void StdMultiWidgetNotAvailable();
protected:
mitk::Image* GetImage();
mitk::DataNode* GetOverlayNode();
void CreateOverlayChild();
void UpdateSliderLabel();
void UpdateSlider();
const mitk::DataNode* GetImageNode();
protected slots:
void OnCalculateVolume();
void OnTimeSeriesButtonClicked();
void OnThresholdSliderChanged( int value );
void OnSaveCsvButtonClicked();
void OnImageSelected(const mitk::DataNode* item);
protected:
Ui::QmitkVolumetryViewControls* m_Controls;
QmitkStdMultiWidget* m_MultiWidget;
/// store weak pointer of the DataNode
mitk::WeakPointer<mitk::DataNode> m_SelectedDataNode;
mitk::DataNode::Pointer m_OverlayNode;
mitk::DataStorage::Pointer m_DataStorage;
};
#endif // _QMITKVOLUMETRYVIEW_H_INCLUDED
diff --git a/Modules/Bundles/org.mitk.gui.qt.volumetry/src/internal/mitkVolumetryPluginActivator.cpp b/Modules/Bundles/org.mitk.gui.qt.volumetry/src/internal/mitkVolumetryPluginActivator.cpp
new file mode 100644
index 0000000000..10d12c7a49
--- /dev/null
+++ b/Modules/Bundles/org.mitk.gui.qt.volumetry/src/internal/mitkVolumetryPluginActivator.cpp
@@ -0,0 +1,21 @@
+#include "mitkVolumetryPluginActivator.h"
+
+#include "QmitkVolumetryView.h"
+
+#include <QtPlugin>
+
+namespace mitk {
+
+ void VolumetryPluginActivator::start(ctkPluginContext* context)
+ {
+ BERRY_REGISTER_EXTENSION_CLASS(QmitkVolumetryView, context)
+ }
+
+ void VolumetryPluginActivator::stop(ctkPluginContext* context)
+ {
+ Q_UNUSED(context)
+ }
+
+}
+
+Q_EXPORT_PLUGIN2(org_mitk_gui_qt_volumetry, mitk::VolumetryPluginActivator)
\ No newline at end of file
diff --git a/Modules/Bundles/org.mitk.gui.qt.volumetry/src/internal/mitkVolumetryPluginActivator.h b/Modules/Bundles/org.mitk.gui.qt.volumetry/src/internal/mitkVolumetryPluginActivator.h
new file mode 100644
index 0000000000..d37a4557f7
--- /dev/null
+++ b/Modules/Bundles/org.mitk.gui.qt.volumetry/src/internal/mitkVolumetryPluginActivator.h
@@ -0,0 +1,23 @@
+#ifndef MITKVOLUMETRYPLUGINACTIVATOR_H
+#define MITKVOLUMETRYPLUGINACTIVATOR_H
+
+#include <ctkPluginActivator.h>
+
+namespace mitk {
+
+ class VolumetryPluginActivator :
+ public QObject, public ctkPluginActivator
+ {
+ Q_OBJECT
+ Q_INTERFACES(ctkPluginActivator)
+
+ public:
+
+ void start(ctkPluginContext* context);
+ void stop(ctkPluginContext* context);
+
+ }; // VolumetryPluginActivator
+
+}
+
+#endif // MITKVOLUMETRYPLUGINACTIVATOR_H
\ No newline at end of file
diff --git a/Modules/Bundles/org.mitk.gui.qt.volumevisualization/CMakeLists.txt b/Modules/Bundles/org.mitk.gui.qt.volumevisualization/CMakeLists.txt
index 081240ef56..c2302f3977 100755
--- a/Modules/Bundles/org.mitk.gui.qt.volumevisualization/CMakeLists.txt
+++ b/Modules/Bundles/org.mitk.gui.qt.volumevisualization/CMakeLists.txt
@@ -1 +1,7 @@
-MACRO_CREATE_MITK_PLUGIN(QmitkExt qxt)
+PROJECT(org_mitk_gui_qt_volumevisualization)
+
+MACRO_CREATE_MITK_CTK_PLUGIN(
+ EXPORT_DIRECTIVE MITK_QT_VOLUMEVISUALIZATION
+ EXPORTED_INCLUDE_SUFFIXES src
+ MODULE_DEPENDENCIES QmitkExt qxt
+)
diff --git a/Modules/Bundles/org.mitk.gui.qt.volumevisualization/META-INF/MANIFEST.MF b/Modules/Bundles/org.mitk.gui.qt.volumevisualization/META-INF/MANIFEST.MF
deleted file mode 100644
index c6584bae9a..0000000000
--- a/Modules/Bundles/org.mitk.gui.qt.volumevisualization/META-INF/MANIFEST.MF
+++ /dev/null
@@ -1,6 +0,0 @@
-Manifest-Version: 1.0
-Bundle-Name: Volume Visualization
-Bundle-SymbolicName: org.mitk.gui.qt.volumevisualization
-Bundle-Version: 1.0.0
-Bundle-Vendor: DKFZ, Medical and Biological Informatics
-Require-Bundle: org.mitk.gui.qt.common
\ No newline at end of file
diff --git a/Modules/Bundles/org.mitk.gui.qt.volumevisualization/files.cmake b/Modules/Bundles/org.mitk.gui.qt.volumevisualization/files.cmake
index e61b0a6181..911ee183d2 100755
--- a/Modules/Bundles/org.mitk.gui.qt.volumevisualization/files.cmake
+++ b/Modules/Bundles/org.mitk.gui.qt.volumevisualization/files.cmake
@@ -1,35 +1,37 @@
SET(SRC_CPP_FILES
)
SET(INTERNAL_CPP_FILES
+ mitkPluginActivator.cpp
QmitkVolumeVisualizationView.cpp
-
)
SET(UI_FILES
src/internal/QmitkVolumeVisualizationViewControls.ui
)
SET(MOC_H_FILES
+ src/internal/mitkPluginActivator.h
src/internal/QmitkVolumeVisualizationView.h
)
-SET(RESOURCE_FILES
+SET(CACHED_RESOURCE_FILES
+ plugin.xml
resources/icon.xpm
)
-SET(RES_FILES
- resources/QmitkVolumeVisualizationView.qrc
+SET(QRC_FILES
+
)
-SET(CPP_FILES manifest.cpp)
+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/Modules/Bundles/org.mitk.gui.qt.volumevisualization/manifest.cpp b/Modules/Bundles/org.mitk.gui.qt.volumevisualization/manifest.cpp
deleted file mode 100755
index 5298b2a491..0000000000
--- a/Modules/Bundles/org.mitk.gui.qt.volumevisualization/manifest.cpp
+++ /dev/null
@@ -1,25 +0,0 @@
-/*=========================================================================
-
-Program: Medical Imaging & Interaction Toolkit
-Language: C++
-Date: $Date$
-Version: $Revision$
-
-Copyright (c) German Cancer Research Center, Division of Medical and
-Biological Informatics. All rights reserved.
-See MITKCopyright.txt or http://www.mitk.org/copyright.html for details.
-
-This software is distributed WITHOUT ANY WARRANTY; without even
-the implied warranty of MERCHANTABILITY or FITNESS FOR A PARTICULAR
-PURPOSE. See the above copyright notices for more information.
-
-=========================================================================*/
-
-#include <Poco/ClassLibrary.h>
-
-#include <berryIViewPart.h>
-#include "src/internal/QmitkVolumeVisualizationView.h"
-
-POCO_BEGIN_NAMED_MANIFEST(berryIViewPart, berry::IViewPart)
- POCO_EXPORT_CLASS(QmitkVolumeVisualizationView)
-POCO_END_MANIFEST
diff --git a/Modules/Bundles/org.mitk.gui.qt.volumevisualization/manifest_headers.cmake b/Modules/Bundles/org.mitk.gui.qt.volumevisualization/manifest_headers.cmake
new file mode 100644
index 0000000000..192cea57af
--- /dev/null
+++ b/Modules/Bundles/org.mitk.gui.qt.volumevisualization/manifest_headers.cmake
@@ -0,0 +1,5 @@
+set(Plugin-Name "Volume Initialization")
+set(Plugin-Version "1.0.0")
+set(Plugin-Vendor "DKFZ, Medical and Biological Informatics")
+set(Plugin-ContactAddress "http://www.mitk.org")
+set(Require-Plugin org.mitk.gui.qt.common)
diff --git a/Modules/Bundles/org.mitk.gui.qt.volumevisualization/resources/QmitkVolumeVisualizationView.qrc b/Modules/Bundles/org.mitk.gui.qt.volumevisualization/resources/QmitkVolumeVisualizationView.qrc
deleted file mode 100644
index 6ab7d80cf6..0000000000
--- a/Modules/Bundles/org.mitk.gui.qt.volumevisualization/resources/QmitkVolumeVisualizationView.qrc
+++ /dev/null
@@ -1,5 +0,0 @@
-<!DOCTYPE RCC><RCC version="1.0">
- <qresource prefix="/QmitkVolumeVisualizationView">
- <file>icon.xpm</file>
- </qresource>
- </RCC>
diff --git a/Modules/Bundles/org.mitk.gui.qt.volumevisualization/src/internal/mitkPluginActivator.cpp b/Modules/Bundles/org.mitk.gui.qt.volumevisualization/src/internal/mitkPluginActivator.cpp
new file mode 100644
index 0000000000..4797896e23
--- /dev/null
+++ b/Modules/Bundles/org.mitk.gui.qt.volumevisualization/src/internal/mitkPluginActivator.cpp
@@ -0,0 +1,21 @@
+#include "mitkPluginActivator.h"
+
+#include <QtPlugin>
+
+#include "QmitkVolumeVisualizationView.h"
+
+namespace mitk {
+
+void PluginActivator::start(ctkPluginContext* context)
+{
+ BERRY_REGISTER_EXTENSION_CLASS(QmitkVolumeVisualizationView, context)
+}
+
+void PluginActivator::stop(ctkPluginContext* context)
+{
+ Q_UNUSED(context)
+}
+
+}
+
+Q_EXPORT_PLUGIN2(org_mitk_gui_qt_volumevisualization, mitk::PluginActivator)
diff --git a/Modules/Bundles/org.mitk.gui.qt.volumevisualization/src/internal/mitkPluginActivator.h b/Modules/Bundles/org.mitk.gui.qt.volumevisualization/src/internal/mitkPluginActivator.h
new file mode 100644
index 0000000000..a34be34be4
--- /dev/null
+++ b/Modules/Bundles/org.mitk.gui.qt.volumevisualization/src/internal/mitkPluginActivator.h
@@ -0,0 +1,23 @@
+#ifndef MITKPLUGINACTIVATOR_H
+#define MITKPLUGINACTIVATOR_H
+
+#include <ctkPluginActivator.h>
+
+namespace mitk {
+
+class PluginActivator :
+ public QObject, public ctkPluginActivator
+{
+ Q_OBJECT
+ Q_INTERFACES(ctkPluginActivator)
+
+public:
+
+ void start(ctkPluginContext* context);
+ void stop(ctkPluginContext* context);
+
+}; // PluginActivator
+
+}
+
+#endif // MITKPLUGINACTIVATOR_H
diff --git a/Modules/Bundles/org.mitk.gui.qt.volumevisualization/src/mitkQtVolumeVisualizationDll.h b/Modules/Bundles/org.mitk.gui.qt.volumevisualization/src/mitkQtVolumeVisualizationDll.h
deleted file mode 100755
index 79a20dc48e..0000000000
--- a/Modules/Bundles/org.mitk.gui.qt.volumevisualization/src/mitkQtVolumeVisualizationDll.h
+++ /dev/null
@@ -1,41 +0,0 @@
-/*=========================================================================
-
-Program: Medical Imaging & Interaction Toolkit
-Language: C++
-Date: $Date$
-Version: $Revision: 15646 $
-
-Copyright (c) German Cancer Research Center, Division of Medical and
-Biological Informatics. All rights reserved.
-See MITKCopyright.txt or http://www.mitk.org/copyright.html for details.
-
-This software is distributed WITHOUT ANY WARRANTY; without even
-the implied warranty of MERCHANTABILITY or FITNESS FOR A PARTICULAR
-PURPOSE. See the above copyright notices for more information.
-
-=========================================================================*/
-
-#ifndef MITK_QT_VOLUME_VISUALIZATION_DLL_H_
-#define MITK_QT_VOLUME_VISUALIZATION_DLL_H_
-
-//
-// The following block is the standard way of creating macros which make exporting
-// from a DLL simpler. All files within this DLL are compiled with the org_mitk_gui_qt_volumevisualization_EXPORTS
-// symbol defined on the command line. this symbol should not be defined on any project
-// that uses this DLL. This way any other project whose source files include this file see
-// MITK_QT_VOLUMEVISUALIZATION functions as being imported from a DLL, wheras this DLL sees symbols
-// defined with this macro as being exported.
-//
-#if defined(_WIN32) && !defined(BERRY_STATIC)
- #if defined(org_mitk_gui_qt_volumevisualization_EXPORTS)
- #define MITK_QT_VOLUMEVISUALIZATION __declspec(dllexport)
- #else
- #define MITK_QT_VOLUMEVISUALIZATION __declspec(dllimport)
- #endif
-#endif
-
-#if !defined(MITK_QT_VOLUMEVISUALIZATION)
- #define MITK_QT_VOLUMEVISUALIZATION
-#endif
-
-#endif /*MITK_QT_VOLUME_VISUALIZATION_DLL_H_*/
diff --git a/Modules/CameraCalibration/CMakeLists.txt b/Modules/CameraCalibration/CMakeLists.txt
index 825c7cbcc7..660bc72afb 100644
--- a/Modules/CameraCalibration/CMakeLists.txt
+++ b/Modules/CameraCalibration/CMakeLists.txt
@@ -1,5 +1,8 @@
MITK_CREATE_MODULE(mitkCameraCalibration
DEPENDS MitkIGT
PACKAGE_DEPENDS OpenCV
PROVIDES mitkCameraCalibration
)
+
+# add testing dir
+ADD_SUBDIRECTORY(Testing)
\ No newline at end of file
diff --git a/Modules/CameraCalibration/Testing/CMakeLists.txt b/Modules/CameraCalibration/Testing/CMakeLists.txt
new file mode 100644
index 0000000000..d45daf111d
--- /dev/null
+++ b/Modules/CameraCalibration/Testing/CMakeLists.txt
@@ -0,0 +1 @@
+MITK_CREATE_MODULE_TESTS()
\ No newline at end of file
diff --git a/Modules/CameraCalibration/Testing/files.cmake b/Modules/CameraCalibration/Testing/files.cmake
new file mode 100644
index 0000000000..f41bedbac5
--- /dev/null
+++ b/Modules/CameraCalibration/Testing/files.cmake
@@ -0,0 +1,4 @@
+SET(MODULE_TESTS
+ mitkCameraIntrinsicsTest.cpp
+ mitkTransformTest.cpp
+)
\ No newline at end of file
diff --git a/Modules/CameraCalibration/Testing/mitkCameraIntrinsicsTest.cpp b/Modules/CameraCalibration/Testing/mitkCameraIntrinsicsTest.cpp
new file mode 100644
index 0000000000..82f4439492
--- /dev/null
+++ b/Modules/CameraCalibration/Testing/mitkCameraIntrinsicsTest.cpp
@@ -0,0 +1,129 @@
+/*=========================================================================
+
+Program: Medical Imaging & Interaction Toolkit
+Language: C++
+Date: $Date$
+Version: $Revision: 16010 $
+
+Copyright (c) German Cancer Research Center, Division of Medical and
+Biological Informatics. All rights reserved.
+See MITKCopyright.txt or http://www.mitk.org/copyright.html for details.
+
+This software is distributed WITHOUT ANY WARRANTY; without even
+the implied warranty of MERCHANTABILITY or FITNESS FOR A PARTICULAR
+PURPOSE. See the above copyright notices for more information.
+
+=========================================================================*/
+
+#include <mitkCameraIntrinsics.h>
+#include <mitkTestingMacros.h>
+#include <mitkCvMatCompare.h>
+#include <itksys/SystemTools.hxx>
+
+/**Documentation
+ * test for the class "CameraIntrinsics".
+ */
+int mitkCameraIntrinsicsTest(int argc, char* argv[])
+{
+ MITK_TEST_BEGIN("CameraIntrinsics")
+
+ cv::Mat _CameraMatrix = cv::Mat::zeros(3, 3, cv::DataType<double>::type);
+ _CameraMatrix.at<double>(2,2) = 1.0;
+ _CameraMatrix.at<double>(0,0) = 1662.54;
+ _CameraMatrix.at<double>(1,1) = 1678.23;
+ _CameraMatrix.at<double>(0,2) = 1030.23;
+ _CameraMatrix.at<double>(1,2) = 632.32;
+
+ cv::Mat _DistorsionCoeffs = cv::Mat::zeros(1, 5, cv::DataType<double>::type);
+ _DistorsionCoeffs.at<double>(0,0) = -0.443212;
+ _DistorsionCoeffs.at<double>(0,1) = 0.231012;
+ _DistorsionCoeffs.at<double>(0,2) = -0.013612;
+ _DistorsionCoeffs.at<double>(0,3) = -0.005312;
+ _DistorsionCoeffs.at<double>(0,4) = 0;
+
+ mitk::CameraIntrinsics::Pointer intrinsics
+ = mitk::CameraIntrinsics::New();
+
+ intrinsics->SetIntrinsics(_CameraMatrix, _DistorsionCoeffs);
+
+ double epsilon = 0.001;
+ bool equals = false;
+ mitk::CvMatCompare _CvMatCompare( &epsilon, &equals );
+
+ {
+ cv::Mat _CameraMatrixResult = intrinsics->GetCameraMatrix();
+ _CvMatCompare.SetMatrices( &_CameraMatrix, &_CameraMatrixResult );
+ _CvMatCompare.Update();
+ MITK_TEST_CONDITION_REQUIRED( equals,
+ "Testing CameraIntrinsics::GetCameraMatrix()");
+ }
+
+ {
+ cv::Mat _DistorsionCoeffsResult = intrinsics->GetDistorsionCoeffs();
+ _CvMatCompare.SetMatrices( &_DistorsionCoeffs, &_DistorsionCoeffsResult );
+ _CvMatCompare.Update();
+ MITK_TEST_CONDITION_REQUIRED( equals,
+ "Testing CameraIntrinsics::GetDistorsionCoeffs()");
+ }
+
+
+ {
+ mitk::CameraIntrinsics::Pointer copy
+ = intrinsics->Clone();
+
+ cv::Mat _CameraMatrixResult = copy->GetCameraMatrix();
+ cv::Mat _DistorsionCoeffsResult = copy->GetDistorsionCoeffs();
+
+ bool distCoeffsEquals = false;
+ _CvMatCompare.SetMatrices( &_DistorsionCoeffs, &_DistorsionCoeffsResult );
+ _CvMatCompare.Update();
+ distCoeffsEquals = equals;
+ _CvMatCompare.SetMatrices( &_CameraMatrix, &_CameraMatrixResult );
+ _CvMatCompare.Update();
+ MITK_TEST_CONDITION( distCoeffsEquals && equals,
+ "Testing CameraIntrinsics::Clone()");
+ }
+
+
+ {
+ std::string filename = "mitkCameraIntrinsicsTest.xml";
+ intrinsics->ToXMLFile(filename);
+ intrinsics->SetValid(true);
+
+ mitk::CameraIntrinsics::Pointer copy
+ = mitk::CameraIntrinsics::New();
+ copy->FromXMLFile(filename);
+
+ cv::Mat _CameraMatrixResult = copy->GetCameraMatrix();
+ cv::Mat _DistorsionCoeffsResult = copy->GetDistorsionCoeffs();
+
+// MITK_INFO << "_CameraMatrix:" << std::endl
+// << mitk::ToString(_CameraMatrix);
+// MITK_INFO << "_CameraMatrixResult:" << std::endl
+// << mitk::ToString(_CameraMatrixResult);
+// MITK_INFO << "_DistorsionCoeffs:" << std::endl
+// << mitk::ToString(_DistorsionCoeffs);
+// MITK_INFO << "_DistorsionCoeffsResult:" << std::endl
+// << mitk::ToString(_DistorsionCoeffsResult);
+
+ bool distCoeffsEquals = false;
+ _CvMatCompare.SetMatrices( &_DistorsionCoeffs, &_DistorsionCoeffsResult );
+ _CvMatCompare.Update();
+ distCoeffsEquals = equals;
+ _CvMatCompare.SetMatrices( &_CameraMatrix, &_CameraMatrixResult );
+ _CvMatCompare.Update();
+ MITK_TEST_CONDITION( distCoeffsEquals && equals
+ && copy->IsValid(),
+ "Testing CameraIntrinsics::ToXMLFile() and"
+ " CameraIntrinsics::FromXMLFile()");
+
+ if(itksys::SystemTools::FileExists(filename.c_str() , true))
+ itksys::SystemTools::RemoveFile(filename.c_str());
+ }
+
+
+ // TODO
+
+ // always end with this!
+ MITK_TEST_END();
+}
diff --git a/Modules/CameraCalibration/Testing/mitkTransformTest.cpp b/Modules/CameraCalibration/Testing/mitkTransformTest.cpp
new file mode 100644
index 0000000000..a4482e5894
--- /dev/null
+++ b/Modules/CameraCalibration/Testing/mitkTransformTest.cpp
@@ -0,0 +1,107 @@
+/*=========================================================================
+
+Program: Medical Imaging & Interaction Toolkit
+Language: C++
+Date: $Date$
+Version: $Revision: 16010 $
+
+Copyright (c) German Cancer Research Center, Division of Medical and
+Biological Informatics. All rights reserved.
+See MITKCopyright.txt or http://www.mitk.org/copyright.html for details.
+
+This software is distributed WITHOUT ANY WARRANTY; without even
+the implied warranty of MERCHANTABILITY or FITNESS FOR A PARTICULAR
+PURPOSE. See the above copyright notices for more information.
+
+=========================================================================*/
+
+#include <mitkTransform.h>
+#include <mitkTestingMacros.h>
+#include <mitkStringFromCvMat.h>
+#include <mitkCvMatCompare.h>
+#include <mitkCvMatFromVnlMatrix.h>
+
+/**Documentation
+ * test for the class "Transform".
+ */
+int mitkTransformTest(int argc, char* argv[])
+{
+ MITK_TEST_BEGIN("Transform")
+
+ mitk::Transform::Pointer transform = mitk::Transform::New();
+ mitk::Transform* t = transform;
+
+ // test with homogeneous matrixes
+ vnl_matrix_fixed<mitk::ScalarType, 4, 4> I;
+ I.set_identity();
+
+ std::cout << "vnl I: " << std::endl << I << std::endl;
+ t->SetMatrix( I );
+
+ cv::Mat cvI = t->GetCvMatrix();
+ std::string matAsString;
+ mitk::StringFromCvMat _StringFromCvMat( &cvI, &matAsString );
+ _StringFromCvMat.Update();
+ std::cout << "cv identity matrix: " << matAsString << std::endl;
+
+ MITK_TEST_CONDITION_REQUIRED( trace(cvI)
+ == cv::Scalar(4)
+ , "trace(t->GetCvMatrix()) == cv::Scalar(4)" );
+ MITK_TEST_CONDITION_REQUIRED( countNonZero(t->GetCvMatrix()) == 4
+ , "countNonZero(t->GetCvMatrix()) == 4" );
+
+ // test 2: 1. create a rotation matrix,convert to quaternion
+ // set as rotation vector
+ // get it back as vnl rotation matrix
+ // convert to cv matrix
+ // convert to quaternion (cv::Rodrigues)
+ // compare received quaternion with original one (created from rotation matrix)
+ cv::Mat cvRotMat = cv::Mat::ones( 3, 3, cv::DataType<mitk::ScalarType>::type );
+ cvRotMat.at<mitk::ScalarType>(0,1) = 2;
+ cvRotMat.at<mitk::ScalarType>(0,2) = 3;
+
+ cv::Mat cvRotVec;
+ cv::Rodrigues( cvRotMat, cvRotVec );
+ t->SetRotationVector( cvRotVec );
+
+ vnl_matrix_fixed<mitk::ScalarType, 3, 3> vnlRotMat
+ = t->GetVnlRotationMatrix();
+ std::cout << "vnl rotation matrix: "
+ << vnlRotMat << std::endl;
+
+ vnl_matrix<mitk::ScalarType> rotMat = vnlRotMat.as_matrix();
+ cv::Mat cvRotMatReturned;
+ mitk::CvMatFromVnlMatrix<mitk::ScalarType>
+ _CvMatFromVnlMatrix( &rotMat, &cvRotMatReturned );
+ _CvMatFromVnlMatrix.Update();
+
+ _StringFromCvMat.SetMatrix( &cvRotMatReturned );
+ _StringFromCvMat.Update();
+ std::cout << "cvRotMatReturned: " << matAsString << std::endl;
+
+ cv::Mat cvRotVecReturned;
+ cv::Rodrigues( cvRotMatReturned, cvRotVecReturned );
+
+ _StringFromCvMat.SetMatrix( &cvRotVec );
+ _StringFromCvMat.Update();
+ std::cout << "cvRotVec: " << matAsString << std::endl;
+ _StringFromCvMat.SetMatrix( &cvRotVecReturned );
+ _StringFromCvMat.Update();
+ std::cout << "cvRotVecReturned: " << matAsString << std::endl;
+
+ double epsilon = 0.001;
+ bool equals = false;
+ mitk::CvMatCompare _CvMatCompare( &cvRotVec, &cvRotVecReturned, &epsilon, &equals );
+ _CvMatCompare.Update();
+ MITK_TEST_CONDITION( equals,
+ "testing returned rotation vector");
+
+ std::cout << "Transform as string: " << transform << std::endl;
+
+ // always end with this!
+ MITK_TEST_END();
+}
+
+
+
+
diff --git a/Modules/CameraCalibration/mitkCvMatCompare.h b/Modules/CameraCalibration/mitkCvMatCompare.h
new file mode 100644
index 0000000000..e6cf602574
--- /dev/null
+++ b/Modules/CameraCalibration/mitkCvMatCompare.h
@@ -0,0 +1,95 @@
+#ifndef mitkCvMatCompare_h
+#define mitkCvMatCompare_h
+
+#include <mitkEpsilon.h>
+#include <mitkObservable.h>
+#include <mitkAlgorithm.h>
+#include <mitkEndoDebug.h>
+
+namespace mitk
+{
+ ///
+ /// compare two matrices with a given epsilon
+ ///
+ class CvMatCompare:
+ virtual public Algorithm
+ {
+ public:
+ ///
+ /// init default values and save references
+ ///
+ CvMatCompare(
+ const Epsilon* _Epsilon,
+ bool* _Equals):
+ m_CvMat1(0),
+ m_CvMat2(0),
+ m_Epsilon(_Epsilon),
+ m_Equals(_Equals)
+ {
+ }
+ ///
+ /// init default values and save references
+ ///
+ CvMatCompare(
+ const cv::Mat* _CvMat1,
+ const cv::Mat* _CvMat2,
+ const Epsilon* _Epsilon,
+ bool* _Equals):
+ m_CvMat1(_CvMat1),
+ m_CvMat2(_CvMat2),
+ m_Epsilon(_Epsilon),
+ m_Equals(_Equals)
+ {
+ }
+
+ void SetMatrices( const cv::Mat* _CvMat1, const cv::Mat* _CvMat2 )
+ {
+ m_CvMat1 = _CvMat1;
+ m_CvMat2 = _CvMat2;
+ }
+
+ void SetMatrix1( const cv::Mat* _CvMat1 )
+ {
+ m_CvMat1 = _CvMat1;
+ }
+ void SetMatrix2( const cv::Mat* _CvMat2 )
+ {
+ m_CvMat2 = _CvMat2;
+ }
+
+ ///
+ /// executes the Algorithm
+ ///
+ void Update()
+ {
+ assert( m_CvMat1 && m_CvMat2 );
+ cv::Mat dst;
+ cv::absdiff( (*m_CvMat1), (*m_CvMat2), dst);
+ double max = 0;
+ cv::minMaxLoc( dst, 0, &max );
+
+ endodebugvar( max )
+
+ (*m_Equals) = max <= *m_Epsilon;
+ }
+ private:
+ ///
+ /// CvMatCompare input member variable
+ ///
+ const cv::Mat* m_CvMat1;
+ ///
+ /// CvMatCompare input member variable
+ ///
+ const cv::Mat* m_CvMat2;
+ ///
+ /// CvMatCompare input member variable
+ ///
+ const Epsilon* m_Epsilon;
+ ///
+ /// CvMatCompare output member variable
+ ///
+ bool* m_Equals;
+ };
+} // namespace mitk
+
+#endif // mitkCvMatCompare_h
diff --git a/Modules/CameraCalibration/mitkEpsilon.h b/Modules/CameraCalibration/mitkEpsilon.h
new file mode 100644
index 0000000000..e8012b19e0
--- /dev/null
+++ b/Modules/CameraCalibration/mitkEpsilon.h
@@ -0,0 +1,13 @@
+#ifndef mitkEpsilon_h
+#define mitkEpsilon_h
+
+namespace mitk
+{
+ ///
+ /// typdef for Epsilon
+ ///
+ typedef double Epsilon;
+
+} // namespace mitk
+
+#endif // mitkEpsilon_h
diff --git a/Modules/CameraCalibration/mitkStringFromCvMat.h b/Modules/CameraCalibration/mitkStringFromCvMat.h
new file mode 100644
index 0000000000..53959f694c
--- /dev/null
+++ b/Modules/CameraCalibration/mitkStringFromCvMat.h
@@ -0,0 +1,77 @@
+#ifndef mitkStringFromCvMat_h
+#define mitkStringFromCvMat_h
+
+#include <cv.h>
+#include <string>
+#include <mitkObservable.h>
+#include <mitkAlgorithm.h>
+#include <mitkEndoMacros.h>
+#include <sstream>
+
+namespace mitk
+{
+ ///
+ /// create a vnl_matrix from a cv mat
+ ///
+ class StringFromCvMat:
+ virtual public Algorithm
+ {
+ public:
+ ///
+ /// init default values and save references
+ ///
+ StringFromCvMat(
+ const cv::Mat* _CvMat,
+ std::string* _String):
+ m_CvMat(_CvMat),
+ m_String(_String)
+ {
+ }
+
+
+ ///
+ /// cv mat to vnl matrix with known cv type
+ ///
+ template <typename TCvMat, char T_Delim>
+ void ToString( std::string& string, const cv::Mat& mat )
+ {
+ std::ostringstream s;
+
+
+ for(int i=0; i<mat.rows; ++i)
+ {
+ for(int j=0; j<mat.cols; ++j)
+ {
+ s << mat.at<TCvMat>(i,j) << " ";
+ }
+ s << T_Delim;
+ }
+ string = s.str();
+ }
+
+ void SetMatrix(
+ const cv::Mat* _CvMat )
+ {
+ m_CvMat = _CvMat;
+ }
+
+ ///
+ /// executes the Algorithm
+ ///
+ void Update()
+ {
+ endoAccessCvMat( ToString, '\n', (*m_String), (*m_CvMat) );
+ }
+ private:
+ ///
+ /// StringFromCvMat input member variable
+ ///
+ const cv::Mat* m_CvMat;
+ ///
+ /// StringFromCvMat output member variable
+ ///
+ std::string* m_String;
+ };
+} // namespace mitk
+
+#endif // mitkStringFromCvMat_h
diff --git a/Modules/CameraCalibration/mitkTransform.cpp b/Modules/CameraCalibration/mitkTransform.cpp
index e3a8e9ffad..856e58d2c9 100644
--- a/Modules/CameraCalibration/mitkTransform.cpp
+++ b/Modules/CameraCalibration/mitkTransform.cpp
@@ -1,688 +1,688 @@
#include "mitkTransform.h"
#include <fstream>
#include <vnl/vnl_inverse.h>
-#include <mitkVnlVectorCaster.h>
+#include <mitkVnlVectorFixedCaster.h>
#include <mitkVnlVectorFromCvMat.h>
#include <mitkVnlMatrixFromCvMat.h>
#include <mitkCvMatFromVnlVector.h>
namespace mitk
{
Transform::Transform()
: m_NavData(mitk::NavigationData::New())
{
vnl_matrix_fixed<mitk::ScalarType, 3, 3> rot;
rot.set_identity();
this->SetRotation( rot );
}
Transform::Transform(const mitk::NavigationData* nd)
: m_NavData(mitk::NavigationData::New())
{
m_NavData->Graft(nd);
}
void Transform::Copy(const mitk::NavigationData* nd)
{
(const_cast<mitk::NavigationData*>(m_NavData.GetPointer()))->Graft(nd);
}
void Transform::Concatenate( mitk::Transform* transform )
{
vnl_matrix_fixed<mitk::ScalarType, 4, 4> mat = transform->GetMatrix();
mat = mat * this->GetMatrix(); //
this->SetMatrix( mat );
}
void Transform::Concatenate( const vnl_matrix_fixed<mitk::ScalarType, 4, 4>&
transform )
{
Transform::Pointer t = Transform::New();
t->SetMatrix( transform );
this->Concatenate( t );
}
void Transform::Concatenate( const vtkMatrix4x4* transform )
{
Transform::Pointer t = Transform::New();
t->SetMatrix( transform );
this->Concatenate( t );
}
void Transform::SetOrientation(
const vnl_quaternion<mitk::ScalarType>& orientation)
{
m_NavData->SetOrientation(orientation);
this->Modified();
}
void Transform::SetTranslation( const vnl_vector_fixed<mitk::ScalarType, 3>&
transl)
{
mitk::Point3D p;
for(unsigned int i=0; i<3; ++i)
p[i] = transl[i];
m_NavData->SetPosition(p);
this->Modified();
}
void Transform::SetTranslation( float* array )
{
vnl_vector_fixed<mitk::ScalarType, 3> vec;
for(unsigned int i=0; i<vec.size(); i++)
vec(i) = array[i];
this->SetTranslation( vec );
}
void Transform::SetRotation( float* array )
{
vnl_matrix_fixed<mitk::ScalarType, 3, 3> mat;
unsigned int row = 0;
unsigned int col = 0;
for(unsigned int i=0; i<mat.rows()*mat.cols(); i++)
{
if( i > 0 && i % 3 == 0 )
{
++row;
col = 0;
}
mat(row,col) = array[i];
++col;
}
this->SetRotation( mat );
}
void Transform::SetOrientation( const vnl_quaternion<double>& orientation)
{
vnl_vector_fixed<mitk::ScalarType, 4> qvec;
- VnlVectorCaster<double, mitk::ScalarType, 4> caster( &orientation, &qvec );
+ VnlVectorFixedCaster<double, mitk::ScalarType, 4> caster( &orientation, &qvec );
caster.Update();
mitk::Quaternion p( qvec );
this->SetOrientation( p );
}
vnl_vector_fixed<double, 3> Transform::GetVnlDoubleTranslation() const
{
vnl_vector_fixed<mitk::ScalarType, 3> vecFloat = this->GetVnlTranslation();
vnl_vector_fixed<double, 3> vecDouble;
- VnlVectorCaster<mitk::ScalarType, double, 3> caster( &vecFloat, &vecDouble );
+ VnlVectorFixedCaster<mitk::ScalarType, double, 3> caster( &vecFloat, &vecDouble );
caster.Update();
return vecDouble;
}
void Transform::SetTranslation( const vnl_vector<double>& transl)
{
vnl_vector_fixed<double, 3> dTransl(transl);
vnl_vector_fixed<mitk::ScalarType, 3> fTransl;
- VnlVectorCaster<double, mitk::ScalarType, 3> caster( &dTransl, &fTransl );
+ VnlVectorFixedCaster<double, mitk::ScalarType, 3> caster( &dTransl, &fTransl );
caster.Update();
this->SetTranslation( fTransl );
}
vnl_quaternion<double> Transform::GetVnlDoubleQuaternion() const
{
mitk::Quaternion fOrientation = this->GetOrientation();
vnl_quaternion<double> dOrientation;
- VnlVectorCaster<mitk::ScalarType, double, 4> caster( &fOrientation, &dOrientation );
+ VnlVectorFixedCaster<mitk::ScalarType, double, 4> caster( &fOrientation, &dOrientation );
caster.Update();
return dOrientation;
}
void Transform::FromCSVFile(const std::string& file)
{
std::ifstream csvFile (file.c_str());
endoAssert ( csvFile.fail() == false );
mitk::Transform::Pointer transform = mitk::Transform::New();
vnl_matrix_fixed<mitk::ScalarType, 4, 4> mat;
std::string line;
mitk::ScalarType d = 0.0f;
int row=0,column = 0;
while (std::getline (csvFile, line))
{
std::istringstream linestream(line);
std::string item;
column = 0;
while (std::getline (linestream, item, ','))
{
std::istringstream number;
number.str(item);
number >> d;
mat(row, column) = d;
++column;
}
++row;
}
endoAssert( row == 4 && column == 4 );
transform->SetMatrix( mat );
this->SetNavigationData( transform->GetNavigationData() );
// modified is called in SetNavigationData
}
std::string Transform::ToCSVString() const
{
std::ostringstream s; s.precision(12);
vnl_matrix_fixed<mitk::ScalarType, 4, 4> mat
= this->GetMatrix();
for( unsigned int j=0; j<mat.rows(); ++j )
{
for( unsigned int k=0; k<mat.cols(); ++k )
{
s << mat(j,k);
if(k+1<mat.cols())
s << ",";
}
if(j+1<mat.rows())
s << std::endl;
}
return s.str();
}
std::string Transform::ToMatlabString(const std::string& varname
, bool printLastRow) const
{
std::ostringstream s; s.precision(12);
vnl_matrix_fixed<mitk::ScalarType, 4, 4> mat
= this->GetMatrix();
s << varname << " = [";
for( unsigned int j=0; j<mat.rows(); ++j )
{
if( !printLastRow && j+1 == mat.rows() )
break;
for( unsigned int k=0; k<mat.cols(); ++k )
{
s << mat(j,k) << " ";
}
s << ";";
}
s << "];" << std::endl;
return s.str();
}
void Transform::Copy( const mitk::Transform* transform )
{
m_NavData->Graft(transform->GetNavigationData());
}
mitk::Transform::Pointer Transform::Clone() const
{
Transform::Pointer copy = Transform::New();
copy->Copy( this );
return copy;
}
void Transform::SetMatrix( const vtkMatrix4x4* mat)
{
vnl_matrix_fixed<mitk::ScalarType, 4, 4> vnlMat;
for(unsigned int i=0; i<4; ++i)
for(unsigned int j=0; j<4; ++j)
vnlMat(i,j) = mat->GetElement(i, j);
this->SetMatrix( vnlMat );
}
void Transform::ToCSVFile(const std::string& file) const
{
std::ofstream csvFile;
csvFile.open(file.c_str());
endoAssert ( csvFile.fail() == false );
csvFile << this->ToCSVString();
csvFile.close();
}
void Transform::ToMatlabFile(const std::string& file
, const std::string& varname) const
{
std::ofstream csvFile;
csvFile.open(file.c_str());
endoAssert ( csvFile.fail() == false );
csvFile << this->ToMatlabString(varname);
csvFile.close();
}
void Transform::SetNavigationData( const mitk::NavigationData* naviData )
{
endoAssert( naviData != 0 );
m_NavData->Graft( naviData );
this->Modified();
}
void Transform::SetRotation( vnl_matrix_fixed<mitk::ScalarType, 3, 3>& mat)
{
this->m_NavData->SetOrientation( mitk::Quaternion(mat) );
this->Modified();
}
void Transform::SetRotation( vnl_matrix<mitk::ScalarType>& mat)
{
vnl_matrix_fixed<mitk::ScalarType, 3, 3> tmp(mat);
this->SetRotation( tmp );
}
void Transform::SetPosition( const mitk::Point3D& transl)
{
this->SetTranslation( transl.GetVnlVector() );
}
void Transform::SetTranslation( double array[3] )
{
mitk::Point3D p;
for(unsigned int i = 0; i < 3; ++i)
p.SetElement(i, array[i]);
this->SetTranslation( p.GetVnlVector() );
}
void Transform::SetRotation( double array[3][3] )
{
vnl_matrix_fixed<mitk::ScalarType, 3, 3> mat;
for(unsigned int i = 0; i < 3; ++i)
for(unsigned int j = 0; j < 3; ++j)
mat(i, j) = array[i][j];
this->SetRotation( mat );
}
void Transform::Invert()
{
vnl_matrix_fixed<mitk::ScalarType, 4, 4> tmp(this->GetMatrix());
this->SetMatrix( vnl_inverse( tmp ) );
}
void Transform::SetMatrix(
const vnl_matrix_fixed<mitk::ScalarType, 4, 4>& mat)
{
// set translation first
vnl_vector<mitk::ScalarType> transl = mat.get_column(3);
mitk::Point3D p;
for(unsigned int i=0; i<3; ++i)
p[i] = transl[i];
m_NavData->SetPosition(p);
// set rotation
vnl_matrix_fixed<mitk::ScalarType, 3, 3> rotMatFixed(
mat.extract(3,3));
this->SetRotation(rotMatFixed);
}
bool Transform::IsValid() const
{
return m_NavData->IsDataValid();
}
void Transform::SetTranslation( const cv::Mat& transl)
{
vnl_vector<mitk::ScalarType> vec(3);
VnlVectorFromCvMat<mitk::ScalarType> _VnlVectorFromCvMat( &transl, &vec );
_VnlVectorFromCvMat.Update();
this->SetTranslation( vnl_vector_fixed<mitk::ScalarType, 3>( vec ) );
}
void Transform::SetRotation( const cv::Mat& mat )
{
vnl_matrix<mitk::ScalarType> vnlMat(3, 3);
VnlMatrixFromCvMat<mitk::ScalarType> _VnlMatrixFromCvMat( &mat, &vnlMat );
_VnlMatrixFromCvMat.Update();
vnl_matrix_fixed<mitk::ScalarType, 3, 3> vnlMatFixed(vnlMat);
this->SetRotation(vnlMatFixed);
}
void Transform::SetRotationVector( const cv::Mat& rotVec )
{
cv::Mat rotMat;
cv::Rodrigues( rotVec, rotMat );
vnl_matrix<mitk::ScalarType> vnlMat(3, 3);
VnlMatrixFromCvMat<mitk::ScalarType> _VnlMatrixFromCvMat( &rotMat, &vnlMat );
_VnlMatrixFromCvMat.Update();
vnl_matrix_fixed<mitk::ScalarType, 3, 3> vnlMatFixed(vnlMat);
this->SetRotation( vnlMatFixed );
}
//# getter
mitk::NavigationData::Pointer Transform::GetNavigationData() const
{
return m_NavData;
}
mitk::Point3D Transform::GetTranslation() const
{
return m_NavData->GetPosition();
}
mitk::Point3D Transform::GetPosition() const
{
return m_NavData->GetPosition();
}
mitk::Quaternion Transform::GetOrientation() const
{
return m_NavData->GetOrientation();
}
void Transform::GetMatrix(vtkMatrix4x4* matrix) const
{
vnl_matrix_fixed<mitk::ScalarType, 4, 4> vnlMat = this->GetMatrix();
for(unsigned int i=0; i<vnlMat.rows(); ++i)
for(unsigned int j=0; j<vnlMat.cols(); ++j)
matrix->SetElement(i,j, vnlMat(i,j));
}
void Transform::GetVtkOpenGlMatrix(vtkMatrix4x4* matrix) const
{
vnl_matrix<mitk::ScalarType> vnlRotation
= this->GetVnlRotationMatrix().as_matrix();
// normalize rows of rotation matrix
vnlRotation.normalize_rows();
vnl_matrix<mitk::ScalarType> vnlInverseRotation(3,3);
// invert rotation
vnlInverseRotation = vnl_matrix_inverse<mitk::ScalarType>(vnlRotation);
vnl_vector<mitk::ScalarType> vnlTranslation
= this->GetPosition().GetVnlVector();
// rotate translation vector by inverse rotation P = P'
vnlTranslation = vnlInverseRotation * vnlTranslation;
vnlTranslation *= -1; // save -P'
// set position
mitk::Transform::Pointer tmp = mitk::Transform::New();
tmp->SetTranslation( vnlTranslation );
tmp->SetRotation( vnlRotation );
tmp->GetMatrix(matrix);
}
//# cv getter
cv::Mat Transform::GetCvTranslation() const
{
cv::Mat mat;
vnl_vector<mitk::ScalarType> vec = this->GetVnlTranslation().as_vector();
endodebugvar( vec )
CvMatFromVnlVector<mitk::ScalarType> _CvMatFromVnlVector(&vec, &mat);
_CvMatFromVnlVector.Update();
return mat;
}
cv::Mat Transform::GetCvRotationMatrix() const
{
cv::Mat mat;
vnl_matrix<mitk::ScalarType> vec = this->GetVnlRotationMatrix().as_matrix();
endodebugvar( vec )
CvMatFromVnlMatrix<mitk::ScalarType> _CvMatFromVnlMatrix(&vec, &mat);
_CvMatFromVnlMatrix.Update();
return mat;
}
cv::Mat Transform::GetCvMatrix() const
{
cv::Mat mat;
- vnl_matrix<mitk::ScalarType> vec = this->GetVnlRotationMatrix().as_matrix();
+ vnl_matrix<mitk::ScalarType> vec = this->GetMatrix().as_matrix();
CvMatFromVnlMatrix<mitk::ScalarType> _CvMatFromVnlMatrix(&vec, &mat);
_CvMatFromVnlMatrix.Update();
return mat;
}
cv::Mat Transform::GetCvRotationVector() const
{
cv::Mat rotVec(3,1,cv::DataType<mitk::ScalarType>::type);
cv::Rodrigues( this->GetCvRotationMatrix(), rotVec );
return rotVec;
}
//# vnl getter
vnl_vector_fixed<mitk::ScalarType, 3> Transform::GetVnlTranslation() const
{
vnl_vector_fixed<mitk::ScalarType, 3> vec(m_NavData->GetPosition()
.GetVnlVector());
return vec;
}
vnl_matrix_fixed<mitk::ScalarType, 3, 3> Transform::GetVnlRotationMatrix() const
{
return m_NavData->GetOrientation().rotation_matrix_transpose();
}
vnl_matrix_fixed<double, 4, 4> Transform::GetVnlDoubleMatrix() const
{
vnl_matrix_fixed<mitk::ScalarType, 4, 4> mat = this->GetMatrix();
vnl_matrix_fixed<double, 4, 4> doubleMat;
for(unsigned int i=0; i<mat.rows(); ++i)
for(unsigned int j=0; j<mat.cols(); ++j)
doubleMat(i,j) = static_cast<double>( mat(i,j) );
return doubleMat;
}
vnl_matrix_fixed<mitk::ScalarType, 4, 4> Transform::GetMatrix()
const
{
vnl_vector_fixed<mitk::ScalarType, 3> transl = this->GetVnlTranslation();
vnl_matrix_fixed<mitk::ScalarType, 3, 3> rot = this->GetVnlRotationMatrix();
vnl_matrix_fixed<mitk::ScalarType, 4, 4> homMat;
homMat.set_identity();
//std::cout << homMat << std::endl;
for(unsigned int i=0; i<rot.rows(); ++i)
for(unsigned int j=0; j<rot.cols(); ++j)
homMat(i,j) = rot(i,j);
for(unsigned int i=0; i<transl.size(); ++i)
homMat(i,3) = transl[i];
return homMat;
}
void Transform::TransposeRotation()
{
vnl_matrix_fixed<mitk::ScalarType, 3, 3> rotMat = this->GetVnlRotationMatrix().transpose();
this->SetRotation( rotMat );
}
void Transform::SetValid( bool valid )
{
if( m_NavData->IsDataValid() == valid )
return;
m_NavData->SetDataValid( valid );
this->Modified();
}
std::string mitk::Transform::ToString() const
{
std::ostringstream s; s.precision(12);
mitk::NavigationData::PositionType position;
position.Fill(0.0);
position = m_NavData->GetPosition();
mitk::NavigationData::OrientationType orientation(0.0, 0.0, 0.0, 0.0);
orientation = m_NavData->GetOrientation();
s << "Translation: [" << position[0] << ", " << position[1] << ", "
<< position[2] << "]";
s << ", orientation: [" << orientation[0] << ", " << orientation[1] << ", "
<< orientation[2] << ", " << orientation[3] << "]";
s << ", valid: [" << (this->IsValid()? "true": "false") << "]";
return s.str();
}
void mitk::Transform::ToXML(TiXmlElement* elem) const
{
std::string value = elem->ValueStr();
if(value.empty())
elem->SetValue(this->GetNameOfClass());
mitk::NavigationData::PositionType position;
position.Fill(0.0);
position = m_NavData->GetPosition();
mitk::NavigationData::OrientationType orientation(0.0, 0.0, 0.0, 0.0);
orientation = m_NavData->GetOrientation();
mitk::NavigationData::CovarianceMatrixType matrix;
matrix.SetIdentity();
matrix = m_NavData->GetCovErrorMatrix();
bool hasPosition = true;
hasPosition = m_NavData->GetHasPosition();
bool hasOrientation = true;
hasOrientation = m_NavData->GetHasOrientation();
bool dataValid = false;
dataValid = m_NavData->IsDataValid();
mitk::NavigationData::TimeStampType timestamp=0.0;
elem->SetDoubleAttribute("Time", timestamp);
elem->SetDoubleAttribute("X", position[0]);
elem->SetDoubleAttribute("Y", position[1]);
elem->SetDoubleAttribute("Z", position[2]);
elem->SetDoubleAttribute("QX", orientation[0]);
elem->SetDoubleAttribute("QY", orientation[1]);
elem->SetDoubleAttribute("QZ", orientation[2]);
elem->SetDoubleAttribute("QR", orientation[3]);
elem->SetDoubleAttribute("C00", matrix[0][0]);
elem->SetDoubleAttribute("C01", matrix[0][1]);
elem->SetDoubleAttribute("C02", matrix[0][2]);
elem->SetDoubleAttribute("C03", matrix[0][3]);
elem->SetDoubleAttribute("C04", matrix[0][4]);
elem->SetDoubleAttribute("C05", matrix[0][5]);
elem->SetDoubleAttribute("C10", matrix[1][0]);
elem->SetDoubleAttribute("C11", matrix[1][1]);
elem->SetDoubleAttribute("C12", matrix[1][2]);
elem->SetDoubleAttribute("C13", matrix[1][3]);
elem->SetDoubleAttribute("C14", matrix[1][4]);
elem->SetDoubleAttribute("C15", matrix[1][5]);
if (dataValid)
elem->SetAttribute("Valid",1);
else
elem->SetAttribute("Valid",0);
if (hasOrientation)
elem->SetAttribute("hO",1);
else
elem->SetAttribute("hO",0);
if (hasPosition)
elem->SetAttribute("hP",1);
else
elem->SetAttribute("hP",0);
}
void mitk::Transform::FromXML(TiXmlElement* elem)
{
assert(elem);
mitk::NavigationData::Pointer nd = mitk::NavigationData::New();
mitk::NavigationData::PositionType position;
mitk::NavigationData::OrientationType orientation(0.0,0.0,0.0,0.0);
mitk::NavigationData::TimeStampType timestamp = -1;
mitk::NavigationData::CovarianceMatrixType matrix;
bool hasPosition = true;
bool hasOrientation = true;
bool dataValid = false;
position.Fill(0.0);
matrix.SetIdentity();
elem->QueryDoubleAttribute("Time",&timestamp);
// position and orientation is mandatory!
if(elem->QueryFloatAttribute("X", &position[0]) != TIXML_SUCCESS)
throw std::invalid_argument("No X position found in xml");
if(elem->QueryFloatAttribute("Y", &position[1]) != TIXML_SUCCESS)
throw std::invalid_argument("No Y position found in xml");
if(elem->QueryFloatAttribute("Z", &position[2]) != TIXML_SUCCESS)
throw std::invalid_argument("No Z position found in xml");
if(elem->QueryFloatAttribute("QX", &orientation[0]) != TIXML_SUCCESS)
throw std::invalid_argument("No QX orientation found in xml");
if(elem->QueryFloatAttribute("QY", &orientation[1]) != TIXML_SUCCESS)
throw std::invalid_argument("No QY orientation found in xml");
if(elem->QueryFloatAttribute("QZ", &orientation[2]) != TIXML_SUCCESS)
throw std::invalid_argument("No QZ orientation found in xml");
if(elem->QueryFloatAttribute("QR", &orientation[3]) != TIXML_SUCCESS)
throw std::invalid_argument("No QR orientation found in xml");
elem->QueryFloatAttribute("C00", &matrix[0][0]);
elem->QueryFloatAttribute("C01", &matrix[0][1]);
elem->QueryFloatAttribute("C02", &matrix[0][2]);
elem->QueryFloatAttribute("C03", &matrix[0][3]);
elem->QueryFloatAttribute("C04", &matrix[0][4]);
elem->QueryFloatAttribute("C05", &matrix[0][5]);
elem->QueryFloatAttribute("C10", &matrix[1][0]);
elem->QueryFloatAttribute("C11", &matrix[1][1]);
elem->QueryFloatAttribute("C12", &matrix[1][2]);
elem->QueryFloatAttribute("C13", &matrix[1][3]);
elem->QueryFloatAttribute("C14", &matrix[1][4]);
elem->QueryFloatAttribute("C15", &matrix[1][5]);
int tmpval = 0;
elem->QueryIntAttribute("Valid", &tmpval);
if (tmpval == 0)
dataValid = false;
else
dataValid = true;
tmpval = 0;
elem->QueryIntAttribute("hO", &tmpval);
if (tmpval == 0)
hasOrientation = false;
else
hasOrientation = true;
tmpval = 0;
elem->QueryIntAttribute("hP", &tmpval);
if (tmpval == 0)
hasPosition = false;
else
hasPosition = true;
nd->SetTimeStamp(timestamp);
nd->SetPosition(position);
nd->SetOrientation(orientation);
nd->SetCovErrorMatrix(matrix);
nd->SetDataValid(dataValid);
nd->SetHasOrientation(hasOrientation);
nd->SetHasPosition(hasPosition);
m_NavData = nd;
this->Modified();
}
} // namespace mitk
std::ostream& operator<< (std::ostream& os, mitk::Transform::Pointer p)
{
os << p->ToString();
return os;
}
diff --git a/Modules/CameraCalibration/mitkVnlVectorCaster.h b/Modules/CameraCalibration/mitkVnlVectorCaster.h
index 2e620ec000..39849334c0 100644
--- a/Modules/CameraCalibration/mitkVnlVectorCaster.h
+++ b/Modules/CameraCalibration/mitkVnlVectorCaster.h
@@ -1,50 +1,60 @@
#ifndef mitkVnlVectorCaster_h
#define mitkVnlVectorCaster_h
-#include <vnl/vnl_vector_fixed.h>
+#include <vnl/vnl_vector.h>
#include <mitkObservable.h>
#include <mitkAlgorithm.h>
namespace mitk
{
///
/// class for casting vnl vectors to another basic type
/// by means of static cast
///
- template <class T, class R, unsigned int n>
+ template <class T, class R>
class VnlVectorCaster:
virtual public Algorithm
{
public:
///
/// init default values and save references
///
VnlVectorCaster(
- const vnl_vector_fixed<T, n>* _InputVector,
- vnl_vector_fixed<R, n>* _OutputVector):
+ const vnl_vector<T>* _InputVector,
+ vnl_vector<R>* _OutputVector):
m_InputVector(_InputVector),
m_OutputVector(_OutputVector)
{
}
+
+ ///
+ /// static update
+ ///
+ static void Update(
+ const vnl_vector<T>& _InputVector,
+ vnl_vector<R>& _OutputVector)
+ {
+ for( size_t i=0; i<_InputVector.size(); ++i )
+ _OutputVector[i] = static_cast<R>( _InputVector[i] );
+ }
+
///
/// executes the Algorithm
///
void Update()
{
- for( size_t i=0; i<m_InputVector->size(); ++i )
- (*m_OutputVector)[i] = static_cast<R>( (*m_InputVector)[i] );
-
+ Update( *m_InputVector, *m_OutputVector );
}
private:
///
/// VnlVectorCaster input member variable
///
- const vnl_vector_fixed<T, n>* m_InputVector;
+ const vnl_vector<T>* m_InputVector;
///
/// VnlVectorCaster output member variable
///
- vnl_vector_fixed<R, n>* m_OutputVector;
+ vnl_vector<R>* m_OutputVector;
};
} // namespace mitk
#endif // mitkVnlVectorCaster_h
diff --git a/Modules/CameraCalibration/mitkVnlVectorCaster.h b/Modules/CameraCalibration/mitkVnlVectorFixedCaster.h
similarity index 77%
copy from Modules/CameraCalibration/mitkVnlVectorCaster.h
copy to Modules/CameraCalibration/mitkVnlVectorFixedCaster.h
index 2e620ec000..514afd6dd6 100644
--- a/Modules/CameraCalibration/mitkVnlVectorCaster.h
+++ b/Modules/CameraCalibration/mitkVnlVectorFixedCaster.h
@@ -1,50 +1,50 @@
-#ifndef mitkVnlVectorCaster_h
-#define mitkVnlVectorCaster_h
+#ifndef mitkVnlVectorFixedCaster_h
+#define mitkVnlVectorFixedCaster_h
#include <vnl/vnl_vector_fixed.h>
#include <mitkObservable.h>
#include <mitkAlgorithm.h>
namespace mitk
{
///
/// class for casting vnl vectors to another basic type
/// by means of static cast
///
template <class T, class R, unsigned int n>
- class VnlVectorCaster:
+ class VnlVectorFixedCaster:
virtual public Algorithm
{
public:
///
/// init default values and save references
///
- VnlVectorCaster(
+ VnlVectorFixedCaster(
const vnl_vector_fixed<T, n>* _InputVector,
vnl_vector_fixed<R, n>* _OutputVector):
m_InputVector(_InputVector),
m_OutputVector(_OutputVector)
{
}
///
/// executes the Algorithm
///
void Update()
{
for( size_t i=0; i<m_InputVector->size(); ++i )
(*m_OutputVector)[i] = static_cast<R>( (*m_InputVector)[i] );
}
private:
///
- /// VnlVectorCaster input member variable
+ /// VnlVectorFixedCaster input member variable
///
const vnl_vector_fixed<T, n>* m_InputVector;
///
- /// VnlVectorCaster output member variable
+ /// VnlVectorFixedCaster output member variable
///
vnl_vector_fixed<R, n>* m_OutputVector;
};
} // namespace mitk
-#endif // mitkVnlVectorCaster_h
+#endif // mitkVnlVectorFixedCaster_h
diff --git a/Modules/DeformableRegistration/mitkBSplineRegistration.cpp b/Modules/DeformableRegistration/mitkBSplineRegistration.cpp
index 5b3761e1cd..7fef213719 100644
--- a/Modules/DeformableRegistration/mitkBSplineRegistration.cpp
+++ b/Modules/DeformableRegistration/mitkBSplineRegistration.cpp
@@ -1,369 +1,371 @@
/*=========================================================================
Program: Medical Imaging & Interaction Toolkit
Language: C++
Date: $Date: 2009-05-05 19:02:32 +0200 (Tue, 05 May 2009) $
Version: $Revision: 17105 $
Copyright (c) German Cancer Research Center, Division of Medical and
Biological Informatics. All rights reserved.
See MITKCopyright.txt or http://www.mitk.org/copyright.html for details.
This software is distributed WITHOUT ANY WARRANTY; without even
the implied warranty of MERCHANTABILITY or FITNESS FOR A PARTICULAR
PURPOSE. See the above copyright notices for more information.
=========================================================================*/
+#include <mitkImageCast.h>
+
#include "itkImageFileWriter.h"
#include "itkWarpImageFilter.h"
#include "itkImageRegionIterator.h"
#include "mitkBSplineRegistration.h"
#include "itkBSplineDeformableTransform.h"
//#include "itkLBFGSOptimizer.h"
#include "itkMeanSquaresImageToImageMetric.h"
#include "itkMattesMutualInformationImageToImageMetric.h"
#include "itkResampleImageFilter.h"
#include "itkImageRegistrationMethod.h"
#include "itkBSplineDeformableTransformInitializer.h"
#include "mitkOptimizerFactory.h"
#include "mitkMetricFactory.h"
#include <itkRescaleIntensityImageFilter.h>
#include <itkHistogramMatchingImageFilter.h>
namespace mitk {
BSplineRegistration::BSplineRegistration():
m_Iterations(50),
m_ResultName("deformedImage.mhd"),
m_SaveResult(true),
m_SaveDeformationField(false),
m_UpdateInputImage(false),
m_MatchHistograms(true),
m_Metric(0)
{
m_Observer = mitk::RigidRegistrationObserver::New();
}
BSplineRegistration::~BSplineRegistration()
{
}
void BSplineRegistration::SetNumberOfIterations(int iterations)
{
m_Iterations = iterations;
}
void BSplineRegistration::SetSaveResult(bool saveResult)
{
m_SaveResult = saveResult;
}
void BSplineRegistration::SetResultFileName(const char* resultName)
{
m_ResultName = resultName;
}
template < typename TPixel, unsigned int VImageDimension >
void BSplineRegistration::GenerateData2( itk::Image<TPixel, VImageDimension>* itkImage1)
{
std::cout << "start bspline registration" << std::endl;
// Typedefs
typedef typename itk::Image< TPixel, VImageDimension > InternalImageType;
typedef typename itk::Vector< float, VImageDimension > VectorPixelType;
typedef typename itk::Image< VectorPixelType, VImageDimension > DeformationFieldType;
typedef itk::BSplineDeformableTransform<
double,
VImageDimension,
3 > TransformType;
typedef typename TransformType::ParametersType ParametersType;
//typedef itk::LBFGSOptimizer OptimizerType;
typedef itk::SingleValuedNonLinearOptimizer OptimizerType;
//typedef itk::SingleValuedCostFunction MetricType;
typedef itk::MattesMutualInformationImageToImageMetric<
InternalImageType,
InternalImageType > MetricType;
typedef itk::MeanSquaresImageToImageMetric<
InternalImageType,
InternalImageType > MetricTypeMS;
typedef itk::LinearInterpolateImageFunction<
InternalImageType,
double > InterpolatorType;
typedef itk::ImageRegistrationMethod<
InternalImageType,
InternalImageType > RegistrationType;
typedef typename itk::WarpImageFilter<
InternalImageType,
InternalImageType,
DeformationFieldType > WarperType;
typedef typename TransformType::SpacingType SpacingType;
typedef typename TransformType::OriginType OriginType;
typedef itk::ResampleImageFilter<
InternalImageType,
InternalImageType > ResampleFilterType;
typedef itk::Image< TPixel, VImageDimension > OutputImageType;
// Sample new image with the same image type as the fixed image
typedef itk::CastImageFilter<
InternalImageType,
InternalImageType > CastFilterType;
typedef itk::Vector< float, VImageDimension > VectorType;
typedef itk::Image< VectorType, VImageDimension > DeformationFieldType;
typedef itk::BSplineDeformableTransformInitializer <
TransformType,
InternalImageType > InitializerType;
typename InterpolatorType::Pointer interpolator = InterpolatorType::New();
typename RegistrationType::Pointer registration = RegistrationType::New();
typename InitializerType::Pointer initializer = InitializerType::New();
typename TransformType::Pointer transform = TransformType::New();
if(m_Metric==0 || m_Metric==1)
{
typename MetricType::Pointer metric = MetricType::New();
metric->SetNumberOfHistogramBins( 32);
metric->SetNumberOfSpatialSamples(90000);
registration->SetMetric( metric );
}
else{
typename MetricTypeMS::Pointer metric = MetricTypeMS::New();
registration->SetMetric( metric );
}
typename OptimizerFactory::Pointer optFac = OptimizerFactory::New();
optFac->SetOptimizerParameters(m_OptimizerParameters);
optFac->SetNumberOfTransformParameters(transform->GetNumberOfParameters());
OptimizerType::Pointer optimizer = optFac->GetOptimizer();
optimizer->AddObserver(itk::AnyEvent(), m_Observer);
//typedef mitk::MetricFactory <TPixel, VImageDimension> MetricFactoryType;
//typename MetricFactoryType::Pointer metricFac = MetricFactoryType::New();
//metricFac->SetMetricParameters(m_MetricParameters);
////MetricType::Pointer metric = metricFac->GetMetric();
typename InternalImageType::Pointer fixedImage = InternalImageType::New();
mitk::CastToItkImage(m_ReferenceImage, fixedImage);
typename InternalImageType::Pointer movingImage = itkImage1;
typename InternalImageType::RegionType fixedRegion = fixedImage->GetBufferedRegion();
typename InternalImageType::RegionType movingRegion = movingImage->GetBufferedRegion();
if(m_MatchHistograms)
{
typedef itk::RescaleIntensityImageFilter<InternalImageType,InternalImageType> FilterType;
typedef itk::HistogramMatchingImageFilter<InternalImageType,InternalImageType> HEFilterType;
typename FilterType::Pointer inputRescaleFilter = FilterType::New();
typename FilterType::Pointer referenceRescaleFilter = FilterType::New();
referenceRescaleFilter->SetInput(fixedImage);
inputRescaleFilter->SetInput(movingImage);
TPixel desiredMinimum = 0;
TPixel desiredMaximum = 255;
referenceRescaleFilter->SetOutputMinimum( desiredMinimum );
referenceRescaleFilter->SetOutputMaximum( desiredMaximum );
referenceRescaleFilter->UpdateLargestPossibleRegion();
inputRescaleFilter->SetOutputMinimum( desiredMinimum );
inputRescaleFilter->SetOutputMaximum( desiredMaximum );
inputRescaleFilter->UpdateLargestPossibleRegion();
// Histogram match the images
typename HEFilterType::Pointer intensityEqualizeFilter = HEFilterType::New();
intensityEqualizeFilter->SetReferenceImage( inputRescaleFilter->GetOutput() );
intensityEqualizeFilter->SetInput( referenceRescaleFilter->GetOutput() );
intensityEqualizeFilter->SetNumberOfHistogramLevels( 64 );
intensityEqualizeFilter->SetNumberOfMatchPoints( 12 );
intensityEqualizeFilter->ThresholdAtMeanIntensityOn();
intensityEqualizeFilter->Update();
//fixedImage = referenceRescaleFilter->GetOutput();
//movingImage = IntensityEqualizeFilter->GetOutput();
fixedImage = intensityEqualizeFilter->GetOutput();
movingImage = inputRescaleFilter->GetOutput();
}
//
registration->SetOptimizer( optimizer );
registration->SetInterpolator( interpolator );
registration->SetFixedImage( fixedImage );
registration->SetMovingImage( movingImage );
registration->SetFixedImageRegion(fixedRegion );
initializer->SetTransform(transform);
initializer->SetImage(fixedImage);
initializer->SetNumberOfGridNodesInsideTheImage( m_NumberOfGridPoints );
initializer->InitializeTransform();
registration->SetTransform( transform );
const unsigned int numberOfParameters = transform->GetNumberOfParameters();
typename itk::BSplineDeformableTransform<
double,
VImageDimension,
3 >::ParametersType parameters;
parameters.set_size(numberOfParameters);
parameters.Fill( 0.0 );
transform->SetParameters( parameters );
// We now pass the parameters of the current transform as the initial
// parameters to be used when the registration process starts.
registration->SetInitialTransformParameters( transform->GetParameters() );
std::cout << "Intial Parameters = " << std::endl;
std::cout << transform->GetParameters() << std::endl;
std::cout << std::endl << "Starting Registration" << std::endl;
try
{
double tstart(clock());
registration->StartRegistration();
double time = clock() - tstart;
time = time / CLOCKS_PER_SEC;
MITK_INFO << "Registration time: " << time;
}
catch( itk::ExceptionObject & err )
{
std::cerr << "ExceptionObject caught !" << std::endl;
std::cerr << err << std::endl;
}
typename OptimizerType::ParametersType finalParameters =
registration->GetLastTransformParameters();
std::cout << "Last Transform Parameters" << std::endl;
std::cout << finalParameters << std::endl;
transform->SetParameters( finalParameters );
/*
ResampleFilterType::Pointer resampler = ResampleFilterType::New();
resampler->SetTransform( transform );
resampler->SetInput( movingImage );
resampler->SetSize( fixedImage->GetLargestPossibleRegion().GetSize() );
resampler->SetOutputOrigin( fixedImage->GetOrigin() );
resampler->SetOutputSpacing( fixedImage->GetSpacing() );
resampler->SetOutputDirection( fixedImage->GetDirection() );
resampler->SetDefaultPixelValue( 100 );
resampler->SetInterpolator( interpolator);
resampler->Update();*/
// Generate deformation field
typename DeformationFieldType::Pointer field = DeformationFieldType::New();
field->SetRegions( movingRegion );
field->SetOrigin( movingImage->GetOrigin() );
field->SetSpacing( movingImage->GetSpacing() );
field->SetDirection( movingImage->GetDirection() );
field->Allocate();
typedef itk::ImageRegionIterator< DeformationFieldType > FieldIterator;
FieldIterator fi( field, movingRegion );
fi.GoToBegin();
typename TransformType::InputPointType fixedPoint;
typename TransformType::OutputPointType movingPoint;
typename DeformationFieldType::IndexType index;
VectorType displacement;
while( ! fi.IsAtEnd() )
{
index = fi.GetIndex();
field->TransformIndexToPhysicalPoint( index, fixedPoint );
movingPoint = transform->TransformPoint( fixedPoint );
displacement = movingPoint - fixedPoint;
fi.Set( displacement );
++fi;
}
// Use the deformation field to warp the moving image
typename WarperType::Pointer warper = WarperType::New();
warper->SetInput( movingImage );
warper->SetInterpolator( interpolator );
warper->SetOutputSpacing( movingImage->GetSpacing() );
warper->SetOutputOrigin( movingImage->GetOrigin() );
warper->SetOutputDirection( movingImage->GetDirection() );
warper->SetDeformationField( field );
warper->Update();
typename InternalImageType::Pointer result = warper->GetOutput();
if(m_UpdateInputImage)
{
Image::Pointer outputImage = this->GetOutput();
mitk::CastToMitkImage( result, outputImage );
}
// Save the deformationfield resulting from the registration
if(m_SaveDeformationField)
{
typedef itk::ImageFileWriter< DeformationFieldType > FieldWriterType;
typename FieldWriterType::Pointer fieldWriter = FieldWriterType::New();
fieldWriter->SetInput( field );
fieldWriter->SetFileName( m_DeformationFileName );
try
{
fieldWriter->Update();
}
catch( itk::ExceptionObject & excp )
{
std::cerr << "Exception thrown " << std::endl;
std::cerr << excp << std::endl;
//return EXIT_FAILURE;
}
}
}
} // end namespace
diff --git a/Modules/DeformableRegistration/mitkDemonsRegistration.cpp b/Modules/DeformableRegistration/mitkDemonsRegistration.cpp
index fbee3cbcea..0ac8e1312f 100644
--- a/Modules/DeformableRegistration/mitkDemonsRegistration.cpp
+++ b/Modules/DeformableRegistration/mitkDemonsRegistration.cpp
@@ -1,265 +1,267 @@
/*=========================================================================
Program: Medical Imaging & Interaction Toolkit
Language: C++
Date: $Date$
Version: $Revision$
Copyright (c) German Cancer Research Center, Division of Medical and
Biological Informatics. All rights reserved.
See MITKCopyright.txt or http://www.mitk.org/copyright.html for details.
This software is distributed WITHOUT ANY WARRANTY; without even
the implied warranty of MERCHANTABILITY or FITNESS FOR A PARTICULAR
PURPOSE. See the above copyright notices for more information.
=========================================================================*/
+#include <mitkImageCast.h>
+
#include "itkImageFileWriter.h"
#include "itkWarpImageFilter.h"
#include "itkImageRegionIterator.h"
#include "mitkDemonsRegistration.h"
namespace mitk {
DemonsRegistration::DemonsRegistration():
m_Iterations(50),
m_StandardDeviation(1.0),
m_FieldName("newField.mhd"),
m_ResultName("deformedImage.mhd"),
m_SaveField(true),
m_SaveResult(true),
m_DeformationField(NULL)
{
}
DemonsRegistration::~DemonsRegistration()
{
}
void DemonsRegistration::SetNumberOfIterations(int iterations)
{
m_Iterations = iterations;
}
void DemonsRegistration::SetStandardDeviation(float deviation)
{
m_StandardDeviation = deviation;
}
void DemonsRegistration::SetSaveDeformationField(bool saveField)
{
m_SaveField = saveField;
}
void DemonsRegistration::SetDeformationFieldFileName(const char* fieldName)
{
m_FieldName = fieldName;
}
void DemonsRegistration::SetSaveResult(bool saveResult)
{
m_SaveResult = saveResult;
}
void DemonsRegistration::SetResultFileName(const char* resultName)
{
m_ResultName = resultName;
}
itk::Image<itk::Vector<float, 3>,3>::Pointer DemonsRegistration::GetDeformationField()
{
return m_DeformationField;
}
template < typename TPixel, unsigned int VImageDimension >
void DemonsRegistration::GenerateData2( itk::Image<TPixel, VImageDimension>* itkImage1)
{
typedef typename itk::Image< TPixel, VImageDimension > FixedImageType;
typedef typename itk::Image< TPixel, VImageDimension > MovingImageType;
typedef float InternalPixelType;
typedef typename itk::Image< InternalPixelType, VImageDimension > InternalImageType;
typedef typename itk::CastImageFilter< FixedImageType,
InternalImageType > FixedImageCasterType;
typedef typename itk::CastImageFilter< MovingImageType,
InternalImageType > MovingImageCasterType;
typedef typename itk::Image< InternalPixelType, VImageDimension > InternalImageType;
typedef typename itk::Vector< float, VImageDimension > VectorPixelType;
typedef typename itk::Image< VectorPixelType, VImageDimension > DeformationFieldType;
typedef typename itk::DemonsRegistrationFilter<
InternalImageType,
InternalImageType,
DeformationFieldType> RegistrationFilterType;
typedef typename itk::WarpImageFilter<
MovingImageType,
MovingImageType,
DeformationFieldType > WarperType;
typedef typename itk::LinearInterpolateImageFunction<
MovingImageType,
double > InterpolatorType;
typedef TPixel OutputPixelType;
typedef typename itk::Image< OutputPixelType, VImageDimension > OutputImageType;
typedef typename itk::CastImageFilter<
MovingImageType,
OutputImageType > CastFilterType;
typedef typename itk::ImageFileWriter< OutputImageType > WriterType;
typedef typename itk::ImageFileWriter< DeformationFieldType > FieldWriterType;
typename FixedImageType::Pointer fixedImage = FixedImageType::New();
mitk::CastToItkImage(m_ReferenceImage, fixedImage);
typename MovingImageType::Pointer movingImage = itkImage1;
if (fixedImage.IsNotNull() && movingImage.IsNotNull())
{
typename RegistrationFilterType::Pointer filter = RegistrationFilterType::New();
this->AddStepsToDo(4);
typename itk::ReceptorMemberCommand<DemonsRegistration>::Pointer command = itk::ReceptorMemberCommand<DemonsRegistration>::New();
command->SetCallbackFunction(this, &DemonsRegistration::SetProgress);
filter->AddObserver( itk::IterationEvent(), command );
typename FixedImageCasterType::Pointer fixedImageCaster = FixedImageCasterType::New();
fixedImageCaster->SetInput(fixedImage);
filter->SetFixedImage( fixedImageCaster->GetOutput() );
typename MovingImageCasterType::Pointer movingImageCaster = MovingImageCasterType::New();
movingImageCaster->SetInput(movingImage);
filter->SetMovingImage(movingImageCaster->GetOutput());
filter->SetNumberOfIterations( m_Iterations );
filter->SetStandardDeviations( m_StandardDeviation );
filter->Update();
typename WarperType::Pointer warper = WarperType::New();
typename InterpolatorType::Pointer interpolator = InterpolatorType::New();
warper->SetInput( movingImage );
warper->SetInterpolator( interpolator );
warper->SetOutputSpacing( fixedImage->GetSpacing() );
warper->SetOutputOrigin( fixedImage->GetOrigin() );
warper->SetOutputDirection( fixedImage->GetDirection());
warper->SetDeformationField( filter->GetOutput() );
warper->Update();
Image::Pointer outputImage = this->GetOutput();
mitk::CastToMitkImage( warper->GetOutput(), outputImage );
typename WriterType::Pointer writer = WriterType::New();
typename CastFilterType::Pointer caster = CastFilterType::New();
writer->SetFileName( m_ResultName );
caster->SetInput( warper->GetOutput() );
writer->SetInput( caster->GetOutput() );
if(m_SaveResult)
{
writer->Update();
}
if (VImageDimension == 2)
{
typedef DeformationFieldType VectorImage2DType;
typedef typename DeformationFieldType::PixelType Vector2DType;
typename VectorImage2DType::ConstPointer vectorImage2D = filter->GetOutput();
typename VectorImage2DType::RegionType region2D = vectorImage2D->GetBufferedRegion();
typename VectorImage2DType::IndexType index2D = region2D.GetIndex();
typename VectorImage2DType::SizeType size2D = region2D.GetSize();
typedef typename itk::Vector< float, 3 > Vector3DType;
typedef typename itk::Image< Vector3DType, 3 > VectorImage3DType;
typedef typename itk::ImageFileWriter< VectorImage3DType > WriterType;
typename WriterType::Pointer writer3D = WriterType::New();
typename VectorImage3DType::Pointer vectorImage3D = VectorImage3DType::New();
typename VectorImage3DType::RegionType region3D;
typename VectorImage3DType::IndexType index3D;
typename VectorImage3DType::SizeType size3D;
index3D[0] = index2D[0];
index3D[1] = index2D[1];
index3D[2] = 0;
size3D[0] = size2D[0];
size3D[1] = size2D[1];
size3D[2] = 1;
region3D.SetSize( size3D );
region3D.SetIndex( index3D );
typename VectorImage2DType::SpacingType spacing2D = vectorImage2D->GetSpacing();
typename VectorImage3DType::SpacingType spacing3D;
spacing3D[0] = spacing2D[0];
spacing3D[1] = spacing2D[1];
spacing3D[2] = 1.0;
vectorImage3D->SetSpacing( spacing3D );
vectorImage3D->SetRegions( region3D );
vectorImage3D->Allocate();
typedef typename itk::ImageRegionConstIterator< VectorImage2DType > Iterator2DType;
typedef typename itk::ImageRegionIterator< VectorImage3DType > Iterator3DType;
Iterator2DType it2( vectorImage2D, region2D );
Iterator3DType it3( vectorImage3D, region3D );
it2.GoToBegin();
it3.GoToBegin();
Vector2DType vector2D;
Vector3DType vector3D;
vector3D[2] = 0; // set Z component to zero.
while( !it2.IsAtEnd() )
{
vector2D = it2.Get();
vector3D[0] = vector2D[0];
vector3D[1] = vector2D[1];
it3.Set( vector3D );
++it2;
++it3;
}
writer3D->SetInput( vectorImage3D );
m_DeformationField = vectorImage3D;
writer3D->SetFileName( m_FieldName );
try
{
if(m_SaveField)
{
writer3D->Update();
}
}
catch( itk::ExceptionObject & excp )
{
MITK_ERROR << excp << std::endl;
}
}
else
{
typename FieldWriterType::Pointer fieldwriter = FieldWriterType::New();
fieldwriter->SetFileName(m_FieldName);
fieldwriter->SetInput( filter->GetOutput() );
m_DeformationField = (itk::Image<itk::Vector<float, 3>,3> *)(filter->GetOutput());
if(m_SaveField)
{
fieldwriter->Update();
}
}
this->SetRemainingProgress(4);
}
}
} // end namespace
diff --git a/Modules/DeformableRegistration/mitkHistogramMatching.cpp b/Modules/DeformableRegistration/mitkHistogramMatching.cpp
index 81f976981c..81ab99d1b0 100644
--- a/Modules/DeformableRegistration/mitkHistogramMatching.cpp
+++ b/Modules/DeformableRegistration/mitkHistogramMatching.cpp
@@ -1,84 +1,86 @@
/*=========================================================================
Program: Medical Imaging & Interaction Toolkit
Language: C++
Date: $Date$
Version: $Revision$
Copyright (c) German Cancer Research Center, Division of Medical and
Biological Informatics. All rights reserved.
See MITKCopyright.txt or http://www.mitk.org/copyright.html for details.
This software is distributed WITHOUT ANY WARRANTY; without even
the implied warranty of MERCHANTABILITY or FITNESS FOR A PARTICULAR
PURPOSE. See the above copyright notices for more information.
=========================================================================*/
#include "mitkHistogramMatching.h"
+#include <mitkImageCast.h>
+
namespace mitk {
HistogramMatching::HistogramMatching()
{
m_ThresholdAtMeanIntensity = true;
m_NumberOfHistogramLevels = 1024;
m_NumberOfMatchPoints = 7;
}
HistogramMatching::~HistogramMatching()
{
}
void HistogramMatching::SetNumberOfHistogramLevels(int histogrammLevels)
{
m_NumberOfHistogramLevels = histogrammLevels;
}
void HistogramMatching::SetNumberOfMatchPoints(int matchPoints)
{
m_NumberOfMatchPoints = matchPoints;
}
void HistogramMatching::SetThresholdAtMeanIntensity(bool on)
{
m_ThresholdAtMeanIntensity = on;
}
template < typename TPixel, unsigned int VImageDimension >
void HistogramMatching::GenerateData2( itk::Image<TPixel, VImageDimension>* itkImage1)
{
typedef typename itk::Image< TPixel, VImageDimension > FixedImageType;
typedef typename itk::Image< TPixel, VImageDimension > MovingImageType;
typedef float InternalPixelType;
typedef typename itk::Image< InternalPixelType, VImageDimension > InternalImageType;
typedef typename itk::CastImageFilter< FixedImageType,
InternalImageType > FixedImageCasterType;
typedef typename itk::CastImageFilter< MovingImageType,
InternalImageType > MovingImageCasterType;
typedef typename itk::HistogramMatchingImageFilter<
InternalImageType,
InternalImageType > MatchingFilterType;
typename FixedImageType::Pointer fixedImage = FixedImageType::New();
mitk::CastToItkImage(m_ReferenceImage, fixedImage);
typename MovingImageType::Pointer movingImage = itkImage1;
if (fixedImage.IsNotNull() && movingImage.IsNotNull())
{
typename FixedImageCasterType::Pointer fixedImageCaster = FixedImageCasterType::New();
fixedImageCaster->SetInput(fixedImage);
typename MovingImageCasterType::Pointer movingImageCaster = MovingImageCasterType::New();
movingImageCaster->SetInput(movingImage);
typename MatchingFilterType::Pointer matcher = MatchingFilterType::New();
matcher->SetInput( movingImageCaster->GetOutput() );
matcher->SetReferenceImage( fixedImageCaster->GetOutput() );
matcher->SetNumberOfHistogramLevels( m_NumberOfHistogramLevels );
matcher->SetNumberOfMatchPoints( m_NumberOfMatchPoints );
matcher->SetThresholdAtMeanIntensity(m_ThresholdAtMeanIntensity);
matcher->Update();
Image::Pointer outputImage = this->GetOutput();
mitk::CastToMitkImage( matcher->GetOutput(), outputImage );
}
}
} // end namespace
diff --git a/Modules/DeformableRegistration/mitkSymmetricForcesDemonsRegistration.cpp b/Modules/DeformableRegistration/mitkSymmetricForcesDemonsRegistration.cpp
index 017134af20..e1a4f01523 100644
--- a/Modules/DeformableRegistration/mitkSymmetricForcesDemonsRegistration.cpp
+++ b/Modules/DeformableRegistration/mitkSymmetricForcesDemonsRegistration.cpp
@@ -1,265 +1,267 @@
/*=========================================================================
Program: Medical Imaging & Interaction Toolkit
Language: C++
Date: $Date$
Version: $Revision$
Copyright (c) German Cancer Research Center, Division of Medical and
Biological Informatics. All rights reserved.
See MITKCopyright.txt or http://www.mitk.org/copyright.html for details.
This software is distributed WITHOUT ANY WARRANTY; without even
the implied warranty of MERCHANTABILITY or FITNESS FOR A PARTICULAR
PURPOSE. See the above copyright notices for more information.
=========================================================================*/
+#include <mitkImageCast.h>
+
#include "itkImageFileWriter.h"
#include "itkWarpImageFilter.h"
#include "itkInverseDeformationFieldImageFilter.h"
#include "mitkSymmetricForcesDemonsRegistration.h"
namespace mitk {
SymmetricForcesDemonsRegistration::SymmetricForcesDemonsRegistration():
m_Iterations(50),
m_StandardDeviation(1.0),
m_FieldName("newField.mhd"),
m_ResultName("deformedImage.mhd"),
m_SaveField(true),
m_SaveResult(true),
m_DeformationField(NULL)
{
}
SymmetricForcesDemonsRegistration::~SymmetricForcesDemonsRegistration()
{
}
void SymmetricForcesDemonsRegistration::SetNumberOfIterations(int iterations)
{
m_Iterations = iterations;
}
void SymmetricForcesDemonsRegistration::SetStandardDeviation(float deviation)
{
m_StandardDeviation = deviation;
}
void SymmetricForcesDemonsRegistration::SetSaveDeformationField(bool saveField)
{
m_SaveField = saveField;
}
void SymmetricForcesDemonsRegistration::SetDeformationFieldFileName(const char* fieldName)
{
m_FieldName = fieldName;
}
void SymmetricForcesDemonsRegistration::SetSaveResult(bool saveResult)
{
m_SaveResult = saveResult;
}
void SymmetricForcesDemonsRegistration::SetResultFileName(const char* resultName)
{
m_ResultName = resultName;
}
itk::Image<class itk::Vector<float, 3>,3>::Pointer SymmetricForcesDemonsRegistration::GetDeformationField()
{
return m_DeformationField;
}
template < typename TPixel, unsigned int VImageDimension >
void SymmetricForcesDemonsRegistration::GenerateData2( itk::Image<TPixel, VImageDimension>* itkImage1)
{
typedef typename itk::Image< TPixel, VImageDimension > FixedImageType;
typedef typename itk::Image< TPixel, VImageDimension > MovingImageType;
typedef float InternalPixelType;
typedef typename itk::Image< InternalPixelType, VImageDimension > InternalImageType;
typedef typename itk::CastImageFilter< FixedImageType,
InternalImageType > FixedImageCasterType;
typedef typename itk::CastImageFilter< MovingImageType,
InternalImageType > MovingImageCasterType;
typedef typename itk::Vector< float, VImageDimension > VectorPixelType;
typedef typename itk::Image< VectorPixelType, VImageDimension > DeformationFieldType;
typedef typename itk::SymmetricForcesDemonsRegistrationFilter<
InternalImageType,
InternalImageType,
DeformationFieldType> RegistrationFilterType;
typedef typename itk::WarpImageFilter<
MovingImageType,
MovingImageType,
DeformationFieldType > WarperType;
typedef typename itk::LinearInterpolateImageFunction<
MovingImageType,
double > InterpolatorType;
typedef TPixel OutputPixelType;
typedef typename itk::Image< OutputPixelType, VImageDimension > OutputImageType;
typedef typename itk::CastImageFilter<
MovingImageType,
OutputImageType > CastFilterType;
typedef typename itk::ImageFileWriter< OutputImageType > WriterType;
typedef typename itk::ImageFileWriter< DeformationFieldType > FieldWriterType;
typedef typename itk::InverseDeformationFieldImageFilter<DeformationFieldType, DeformationFieldType> InverseFilterType;
typename FixedImageType::Pointer fixedImage = FixedImageType::New();
mitk::CastToItkImage(m_ReferenceImage, fixedImage);
typename MovingImageType::Pointer movingImage = itkImage1;
if (fixedImage.IsNotNull() && movingImage.IsNotNull())
{
typename RegistrationFilterType::Pointer filter = RegistrationFilterType::New();
this->AddStepsToDo(4);
itk::ReceptorMemberCommand<SymmetricForcesDemonsRegistration>::Pointer command = itk::ReceptorMemberCommand<SymmetricForcesDemonsRegistration>::New();
command->SetCallbackFunction(this, &SymmetricForcesDemonsRegistration::SetProgress);
filter->AddObserver( itk::IterationEvent(), command );
typename FixedImageCasterType::Pointer fixedImageCaster = FixedImageCasterType::New();
fixedImageCaster->SetInput(fixedImage);
filter->SetFixedImage( fixedImageCaster->GetOutput() );
typename MovingImageCasterType::Pointer movingImageCaster = MovingImageCasterType::New();
movingImageCaster->SetInput(movingImage);
filter->SetMovingImage(movingImageCaster->GetOutput());
filter->SetNumberOfIterations( m_Iterations );
filter->SetStandardDeviations( m_StandardDeviation );
filter->Update();
typename WarperType::Pointer warper = WarperType::New();
typename InterpolatorType::Pointer interpolator = InterpolatorType::New();
warper->SetInput( movingImage );
warper->SetInterpolator( interpolator );
warper->SetOutputSpacing( fixedImage->GetSpacing() );
warper->SetOutputOrigin( fixedImage->GetOrigin() );
warper->SetDeformationField( filter->GetOutput() );
warper->Update();
typename WriterType::Pointer writer = WriterType::New();
typename CastFilterType::Pointer caster = CastFilterType::New();
writer->SetFileName( m_ResultName );
caster->SetInput( warper->GetOutput() );
writer->SetInput( caster->GetOutput() );
if(m_SaveResult)
{
writer->Update();
}
Image::Pointer outputImage = this->GetOutput();
mitk::CastToMitkImage( warper->GetOutput(), outputImage );
if (VImageDimension == 2)
{
typedef DeformationFieldType VectorImage2DType;
typedef typename DeformationFieldType::PixelType Vector2DType;
typename VectorImage2DType::ConstPointer vectorImage2D = filter->GetOutput();
typename VectorImage2DType::RegionType region2D = vectorImage2D->GetBufferedRegion();
typename VectorImage2DType::IndexType index2D = region2D.GetIndex();
typename VectorImage2DType::SizeType size2D = region2D.GetSize();
typedef typename itk::Vector< float, 3 > Vector3DType;
typedef typename itk::Image< Vector3DType, 3 > VectorImage3DType;
typedef typename itk::ImageFileWriter< VectorImage3DType > WriterType;
WriterType::Pointer writer3D = WriterType::New();
VectorImage3DType::Pointer vectorImage3D = VectorImage3DType::New();
VectorImage3DType::RegionType region3D;
VectorImage3DType::IndexType index3D;
VectorImage3DType::SizeType size3D;
index3D[0] = index2D[0];
index3D[1] = index2D[1];
index3D[2] = 0;
size3D[0] = size2D[0];
size3D[1] = size2D[1];
size3D[2] = 1;
region3D.SetSize( size3D );
region3D.SetIndex( index3D );
typename VectorImage2DType::SpacingType spacing2D = vectorImage2D->GetSpacing();
VectorImage3DType::SpacingType spacing3D;
spacing3D[0] = spacing2D[0];
spacing3D[1] = spacing2D[1];
spacing3D[2] = 1.0;
vectorImage3D->SetSpacing( spacing3D );
vectorImage3D->SetRegions( region3D );
vectorImage3D->Allocate();
typedef typename itk::ImageRegionConstIterator< VectorImage2DType > Iterator2DType;
typedef typename itk::ImageRegionIterator< VectorImage3DType > Iterator3DType;
Iterator2DType it2( vectorImage2D, region2D );
Iterator3DType it3( vectorImage3D, region3D );
it2.GoToBegin();
it3.GoToBegin();
Vector2DType vector2D;
Vector3DType vector3D;
vector3D[2] = 0; // set Z component to zero.
while( !it2.IsAtEnd() )
{
vector2D = it2.Get();
vector3D[0] = vector2D[0];
vector3D[1] = vector2D[1];
it3.Set( vector3D );
++it2;
++it3;
}
writer3D->SetInput( vectorImage3D );
m_DeformationField = vectorImage3D;
writer3D->SetFileName( m_FieldName );
try
{
if(m_SaveField)
{
writer3D->Update();
}
}
catch( itk::ExceptionObject & excp )
{
MITK_ERROR << excp << std::endl;
}
}
else
{
typename FieldWriterType::Pointer fieldwriter = FieldWriterType::New();
fieldwriter->SetFileName( m_FieldName );
fieldwriter->SetInput( filter->GetOutput() );
//m_DeformationField = filter->GetOutput();
m_DeformationField = (itk::Image<itk::Vector<float, 3>,3> *)(filter->GetOutput()); //see BUG #3732
if(m_SaveField)
{
fieldwriter->Update();
}
}
this->SetRemainingProgress(4);
}
}
} // end namespace
diff --git a/Modules/DiffusionImaging/Algorithms/itkDiffusionQballPrepareVisualizationImageFilter.h b/Modules/DiffusionImaging/Algorithms/itkDiffusionQballPrepareVisualizationImageFilter.h
index fcb68786ba..f7d059086a 100644
--- a/Modules/DiffusionImaging/Algorithms/itkDiffusionQballPrepareVisualizationImageFilter.h
+++ b/Modules/DiffusionImaging/Algorithms/itkDiffusionQballPrepareVisualizationImageFilter.h
@@ -1,136 +1,136 @@
/*=========================================================================
Program: Insight Segmentation & Registration Toolkit
Module: $RCSfile: itkDiffusionTensor3DReconstructionImageFilter.h,v $
Language: C++
Date: $Date: 2006-03-27 17:01:06 $
Version: $Revision: 1.12 $
Copyright (c) Insight Software Consortium. All rights reserved.
See ITKCopyright.txt or http://www.itk.org/HTML/Copyright.htm for details.
This software is distributed WITHOUT ANY WARRANTY; without even
the implied warranty of MERCHANTABILITY or FITNESS FOR A PARTICULAR
PURPOSE. See the above copyright notices for more information.
=========================================================================*/
#ifndef __itkDiffusionQballPrepareVisualizationImageFilter_h_
#define __itkDiffusionQballPrepareVisualizationImageFilter_h_
-#include "MitkDiffusionImagingMBIExports.h"
+#include "MitkDiffusionImagingExports.h"
#include "itkImageToImageFilter.h"
//#include "vnl/vnl_matrix.h"
#include "vnl/vnl_vector_fixed.h"
#include "vnl/vnl_matrix.h"
#include "vnl/algo/vnl_svd.h"
#include "itkVectorContainer.h"
#include "itkVectorImage.h"
#include "itkDiffusionQballGeneralizedFaImageFilter.h"
namespace itk{
/** \class DiffusionQballPrepareVisualizationImageFilter
*/
template< class TOdfPixelType,
int NrOdfDirections>
-class MitkDiffusionImagingMBI_EXPORT DiffusionQballPrepareVisualizationImageFilter :
+class MitkDiffusionImaging_EXPORT DiffusionQballPrepareVisualizationImageFilter :
public ImageToImageFilter< Image< Vector< TOdfPixelType, NrOdfDirections >, 3 >,
Image< Vector< TOdfPixelType, NrOdfDirections >, 3 > >
{
public:
enum NormalizationMethods
{
PV_NONE,
PV_MAX,
PV_MIN_MAX,
PV_GLOBAL_MAX,
PV_MIN_MAX_INVERT
};
typedef DiffusionQballPrepareVisualizationImageFilter Self;
typedef SmartPointer<Self> Pointer;
typedef SmartPointer<const Self> ConstPointer;
typedef ImageToImageFilter< Image< Vector< TOdfPixelType, NrOdfDirections >, 3 >,
Image< Vector< TOdfPixelType, NrOdfDirections >, 3 > >
Superclass;
typedef DiffusionQballGeneralizedFaImageFilter<TOdfPixelType,TOdfPixelType,NrOdfDirections>
GfaFilterType;
typedef typename GfaFilterType::OutputImageType GfaImageType;
typedef typename GfaFilterType::GfaComputationMethod GfaComputationMethod;
/** Method for creation through the object factory. */
itkNewMacro(Self);
/** Runtime information support. */
itkTypeMacro(DiffusionQballPrepareVisualizationImageFilter,
ImageToImageFilter);
typedef TOdfPixelType OdfComponentType;
typedef typename Superclass::InputImageType InputImageType;
typedef typename Superclass::OutputImageType OutputImageType;
typedef typename Superclass::OutputImageRegionType
OutputImageRegionType;
itkStaticConstMacro(NOdfDirections,int,NrOdfDirections);
itkSetMacro( Threshold, OdfComponentType );
itkGetMacro( Threshold, OdfComponentType );
itkSetMacro( NormalizationMethod, NormalizationMethods );
itkGetMacro( NormalizationMethod, NormalizationMethods );
itkSetMacro( ScaleByGfaType, GfaComputationMethod );
itkGetMacro( ScaleByGfaType, GfaComputationMethod );
itkSetMacro( DoScaleGfa, bool );
itkGetMacro( DoScaleGfa, bool );
itkSetMacro( GfaParam1, double );
itkGetMacro( GfaParam1, double );
itkSetMacro( GfaParam2, double );
itkGetMacro( GfaParam2, double );
protected:
DiffusionQballPrepareVisualizationImageFilter();
~DiffusionQballPrepareVisualizationImageFilter() {};
void PrintSelf(std::ostream& os, Indent indent) const;
void BeforeThreadedGenerateData();
void ThreadedGenerateData( const
OutputImageRegionType &outputRegionForThread, int);
private:
/** Threshold on the reference image data */
OdfComponentType m_Threshold;
NormalizationMethods m_NormalizationMethod;
OdfComponentType m_GlobalInputMaximum;
GfaComputationMethod m_ScaleByGfaType;
bool m_DoScaleGfa;
typename GfaImageType::Pointer m_GfaImage;
double m_GfaParam1;
double m_GfaParam2;
};
}
#ifndef ITK_MANUAL_INSTANTIATION
#include "itkDiffusionQballPrepareVisualizationImageFilter.cpp"
#endif
#endif //__itkDiffusionQballPrepareVisualizationImageFilter_h_
diff --git a/Modules/DiffusionImaging/Algorithms/itkTractsToProbabilityImageFilter.cpp b/Modules/DiffusionImaging/Algorithms/itkTractsToProbabilityImageFilter.cpp
new file mode 100644
index 0000000000..ea27142da4
--- /dev/null
+++ b/Modules/DiffusionImaging/Algorithms/itkTractsToProbabilityImageFilter.cpp
@@ -0,0 +1,359 @@
+#include "itkTractsToProbabilityImageFilter.h"
+
+#include "itkBSplineUpsampleImageFilter.h"
+
+#define __CEIL_UCHAR__(val) (val) = \
+( (val) < 0 ) ? ( 0 ) : ( ( (val)>255 ) ? ( 255 ) : ( (val) ) );
+
+namespace itk{
+
+ template< class TInputImage, class TOutputPixelType >
+ TractsToProbabilityImageFilter< TInputImage, TOutputPixelType >
+ ::TractsToProbabilityImageFilter():
+ m_BinaryEnvelope(false)
+ {
+ this->SetNumberOfRequiredInputs(0);
+ }
+
+ template< class TInputImage, class TOutputPixelType >
+ TractsToProbabilityImageFilter< TInputImage, TOutputPixelType >
+ ::~TractsToProbabilityImageFilter()
+ {
+ }
+
+ template< class TInputImage, class TOutputPixelType >
+ void TractsToProbabilityImageFilter< TInputImage, TOutputPixelType >
+ ::GenerateData()
+ {
+ bool isRgba = false;
+ if(&typeid(TOutputPixelType) == &typeid(itk::RGBAPixel<unsigned char>))
+ {
+ isRgba = true;
+ }
+ else if(&typeid(TOutputPixelType) != &typeid(unsigned char))
+ {
+ MITK_INFO << "Only 'unsigned char' and 'itk::RGBAPixel<unsigned char> supported as OutputPixelType";
+ return;
+ }
+
+ mitk::Geometry3D::Pointer geometry = m_FiberBundle->GetGeometry();
+
+ typename OutputImageType::Pointer outImage =
+ static_cast< OutputImageType * >(this->ProcessObject::GetOutput(0));
+
+ outImage->SetSpacing( geometry->GetSpacing()/m_UpsamplingFactor ); // Set the image spacing
+
+ mitk::Point3D origin = geometry->GetOrigin();
+ mitk::Point3D indexOrigin;
+ geometry->WorldToIndex(origin, indexOrigin);
+ indexOrigin[0] = indexOrigin[0] - .5 * (1.0-1.0/m_UpsamplingFactor);
+ indexOrigin[1] = indexOrigin[1] - .5 * (1.0-1.0/m_UpsamplingFactor);
+ indexOrigin[2] = indexOrigin[2] - .5 * (1.0-1.0/m_UpsamplingFactor);
+ mitk::Point3D newOrigin;
+ geometry->IndexToWorld(indexOrigin, newOrigin);
+
+ outImage->SetOrigin( newOrigin ); // Set the image origin
+ itk::Matrix<double, 3, 3> matrix;
+ for (int i=0; i<3; i++)
+ for (int j=0; j<3; j++)
+ matrix[j][i] = geometry->GetMatrixColumn(i)[j];
+ outImage->SetDirection( matrix ); // Set the image direction
+
+ float* bounds = m_FiberBundle->GetBounds();
+ ImageRegion<3> upsampledRegion;
+ upsampledRegion.SetSize(0, bounds[0]);
+ upsampledRegion.SetSize(1, bounds[1]);
+ upsampledRegion.SetSize(2, bounds[2]);
+
+ typename InputImageType::RegionType::SizeType upsampledSize = upsampledRegion.GetSize();
+ for (unsigned int n = 0; n < 3; n++)
+ {
+ upsampledSize[n] = upsampledSize[n] * m_UpsamplingFactor;
+ }
+ upsampledRegion.SetSize( upsampledSize );
+ outImage->SetRegions( upsampledRegion );
+
+ outImage->Allocate();
+ // itk::RGBAPixel<unsigned char> pix;
+ // pix.Set(0,0,0,0);
+ // outImage->FillBuffer(pix);
+
+ int w = upsampledSize[0];
+ int h = upsampledSize[1];
+ int d = upsampledSize[2];
+
+
+ unsigned char* accuout;
+ float* accu;
+
+ accuout = reinterpret_cast<unsigned char*>(outImage->GetBufferPointer());
+
+ if(isRgba)
+ {
+// accuout = static_cast<unsigned char*>( outImage->GetBufferPointer()[0].GetDataPointer());
+ accu = new float[w*h*d*4];
+ for (int i=0; i<w*h*d*4; i++) accu[i] = 0;
+ }
+ else
+ {
+ accu = new float[w*h*d];
+ for (int i=0; i<w*h*d; i++) accu[i] = 0;
+ }
+
+ // for each tract
+ int numTracts = m_FiberBundle->GetNumTracts();
+ for( int i=0; i<numTracts; i++ )
+ {
+ ////////////////////
+ // upsampling
+ std::vector< itk::Point<float, 3> > vertices;
+
+ // for each vertex
+ int numVertices = m_FiberBundle->GetNumPoints(i);
+ for( int j=0; j<numVertices-1; j++)
+ {
+ itk::Point<float, 3> point = m_FiberBundle->GetPoint(i,j);
+ itk::Point<float, 3> nextPoint = m_FiberBundle->GetPoint(i,j+1);
+ point[0] += 0.5 - 0.5/m_UpsamplingFactor;
+ point[1] += 0.5 - 0.5/m_UpsamplingFactor;
+ point[2] += 0.5 - 0.5/m_UpsamplingFactor;
+ nextPoint[0] += 0.5 - 0.5/m_UpsamplingFactor;
+ nextPoint[1] += 0.5 - 0.5/m_UpsamplingFactor;
+ nextPoint[2] += 0.5 - 0.5/m_UpsamplingFactor;
+
+ for(int k=1; k<=m_UpsamplingFactor; k++)
+ {
+ itk::Point<float, 3> newPoint;
+ newPoint[0] = point[0] + ((double)k/(double)m_UpsamplingFactor)*(nextPoint[0]-point[0]);
+ newPoint[1] = point[1] + ((double)k/(double)m_UpsamplingFactor)*(nextPoint[1]-point[1]);
+ newPoint[2] = point[2] + ((double)k/(double)m_UpsamplingFactor)*(nextPoint[2]-point[2]);
+ vertices.push_back(newPoint);
+ }
+ }
+
+ ////////////////////
+ // calc directions (which are used as weights)
+ std::list< itk::Point<float, 3> > rgbweights;
+ std::list<float> intensities;
+
+ // for each vertex
+ numVertices = vertices.size();
+ for( int j=0; j<numVertices-1; j++)
+ {
+
+ itk::Point<float, 3> vertex = vertices.at(j);
+ itk::Point<float, 3> vertexPost = vertices.at(j+1);
+
+ itk::Point<float, 3> dir;
+ dir[0] = fabs((vertexPost[0] - vertex[0]) * outImage->GetSpacing()[0]);
+ dir[1] = fabs((vertexPost[1] - vertex[1]) * outImage->GetSpacing()[1]);
+ dir[2] = fabs((vertexPost[2] - vertex[2]) * outImage->GetSpacing()[2]);
+
+ if(isRgba)
+ {
+ rgbweights.push_back(dir);
+ }
+
+ float intensity = sqrt(dir[0]*dir[0]+dir[1]*dir[1]+dir[2]*dir[2]);
+ intensities.push_back(intensity);
+
+ // last point gets same as previous one
+ if(j==numVertices-2)
+ {
+ if(isRgba)
+ {
+ rgbweights.push_back(dir);
+ }
+ intensities.push_back(intensity);
+ }
+ }
+
+
+ ////////////////////
+ // fill output image
+
+ // for each vertex
+ for( int j=0; j<numVertices; j++)
+ {
+ itk::Point<float, 3> vertex = vertices.at(j);
+ itk::Point<float, 3> rgbweight;
+ if(isRgba)
+ {
+ rgbweight = rgbweights.front();
+ rgbweights.pop_front();
+ }
+ float intweight = intensities.front();
+ intensities.pop_front();
+
+ // scaling coordinates (index coords scale with upsampling)
+ vertex[0] = vertex[0] * m_UpsamplingFactor;
+ vertex[1] = vertex[1] * m_UpsamplingFactor;
+ vertex[2] = vertex[2] * m_UpsamplingFactor;
+
+ // int coordinates inside image?
+ int px = (int) (vertex[0]);
+ if (px < 0 || px >= w-1)
+ continue;
+ int py = (int) (vertex[1]);
+ if (py < 0 || py >= h-1)
+ continue;
+ int pz = (int) (vertex[2]);
+ if (pz < 0 || pz >= d-1)
+ continue;
+
+ // float fraction of coordinates
+ float frac_x = vertex[0] - px;
+ float frac_y = vertex[1] - py;
+ float frac_z = vertex[2] - pz;
+
+ float scale = 100 * pow((float)m_UpsamplingFactor,3);
+
+ if(isRgba)
+ {
+ // add to r-channel in output image
+ accu[0+4*( px + w*(py + h*pz ))] += (1-frac_x)*(1-frac_y)*(1-frac_z) * rgbweight[0] * scale;
+ accu[0+4*( px + w*(py+1+ h*pz ))] += (1-frac_x)*( frac_y)*(1-frac_z) * rgbweight[0] * scale;
+ accu[0+4*( px + w*(py + h*pz+h))] += (1-frac_x)*(1-frac_y)*( frac_z) * rgbweight[0] * scale;
+ accu[0+4*( px + w*(py+1+ h*pz+h))] += (1-frac_x)*( frac_y)*( frac_z) * rgbweight[0] * scale;
+ accu[0+4*( px+1 + w*(py + h*pz ))] += ( frac_x)*(1-frac_y)*(1-frac_z) * rgbweight[0] * scale;
+ accu[0+4*( px+1 + w*(py + h*pz+h))] += ( frac_x)*(1-frac_y)*( frac_z) * rgbweight[0] * scale;
+ accu[0+4*( px+1 + w*(py+1+ h*pz ))] += ( frac_x)*( frac_y)*(1-frac_z) * rgbweight[0] * scale;
+ accu[0+4*( px+1 + w*(py+1+ h*pz+h))] += ( frac_x)*( frac_y)*( frac_z) * rgbweight[0] * scale;
+
+ // add to g-channel in output image
+ accu[1+4*( px + w*(py + h*pz ))] += (1-frac_x)*(1-frac_y)*(1-frac_z) * rgbweight[1] * scale;
+ accu[1+4*( px + w*(py+1+ h*pz ))] += (1-frac_x)*( frac_y)*(1-frac_z) * rgbweight[1] * scale;
+ accu[1+4*( px + w*(py + h*pz+h))] += (1-frac_x)*(1-frac_y)*( frac_z) * rgbweight[1] * scale;
+ accu[1+4*( px + w*(py+1+ h*pz+h))] += (1-frac_x)*( frac_y)*( frac_z) * rgbweight[1] * scale;
+ accu[1+4*( px+1 + w*(py + h*pz ))] += ( frac_x)*(1-frac_y)*(1-frac_z) * rgbweight[1] * scale;
+ accu[1+4*( px+1 + w*(py + h*pz+h))] += ( frac_x)*(1-frac_y)*( frac_z) * rgbweight[1] * scale;
+ accu[1+4*( px+1 + w*(py+1+ h*pz ))] += ( frac_x)*( frac_y)*(1-frac_z) * rgbweight[1] * scale;
+ accu[1+4*( px+1 + w*(py+1+ h*pz+h))] += ( frac_x)*( frac_y)*( frac_z) * rgbweight[1] * scale;
+
+ // add to b-channel in output image
+ accu[2+4*( px + w*(py + h*pz ))] += (1-frac_x)*(1-frac_y)*(1-frac_z) * rgbweight[2] * scale;
+ accu[2+4*( px + w*(py+1+ h*pz ))] += (1-frac_x)*( frac_y)*(1-frac_z) * rgbweight[2] * scale;
+ accu[2+4*( px + w*(py + h*pz+h))] += (1-frac_x)*(1-frac_y)*( frac_z) * rgbweight[2] * scale;
+ accu[2+4*( px + w*(py+1+ h*pz+h))] += (1-frac_x)*( frac_y)*( frac_z) * rgbweight[2] * scale;
+ accu[2+4*( px+1 + w*(py + h*pz ))] += ( frac_x)*(1-frac_y)*(1-frac_z) * rgbweight[2] * scale;
+ accu[2+4*( px+1 + w*(py + h*pz+h))] += ( frac_x)*(1-frac_y)*( frac_z) * rgbweight[2] * scale;
+ accu[2+4*( px+1 + w*(py+1+ h*pz ))] += ( frac_x)*( frac_y)*(1-frac_z) * rgbweight[2] * scale;
+ accu[2+4*( px+1 + w*(py+1+ h*pz+h))] += ( frac_x)*( frac_y)*( frac_z) * rgbweight[2] * scale;
+
+ // add to a-channel in output image
+ accu[3+4*( px + w*(py + h*pz ))] += (1-frac_x)*(1-frac_y)*(1-frac_z) * intweight * scale;
+ accu[3+4*( px + w*(py+1+ h*pz ))] += (1-frac_x)*( frac_y)*(1-frac_z) * intweight * scale;
+ accu[3+4*( px + w*(py + h*pz+h))] += (1-frac_x)*(1-frac_y)*( frac_z) * intweight * scale;
+ accu[3+4*( px + w*(py+1+ h*pz+h))] += (1-frac_x)*( frac_y)*( frac_z) * intweight * scale;
+ accu[3+4*( px+1 + w*(py + h*pz ))] += ( frac_x)*(1-frac_y)*(1-frac_z) * intweight * scale;
+ accu[3+4*( px+1 + w*(py + h*pz+h))] += ( frac_x)*(1-frac_y)*( frac_z) * intweight * scale;
+ accu[3+4*( px+1 + w*(py+1+ h*pz ))] += ( frac_x)*( frac_y)*(1-frac_z) * intweight * scale;
+ accu[3+4*( px+1 + w*(py+1+ h*pz+h))] += ( frac_x)*( frac_y)*( frac_z) * intweight * scale;
+ }
+ else if (m_BinaryEnvelope)
+ {
+ accu[( px + w*(py + h*pz ))] = 1;
+ accu[( px + w*(py+1+ h*pz ))] = 1;
+ accu[( px + w*(py + h*pz+h))] = 1;
+ accu[( px + w*(py+1+ h*pz+h))] = 1;
+ accu[( px+1 + w*(py + h*pz ))] = 1;
+ accu[( px+1 + w*(py + h*pz+h))] = 1;
+ accu[( px+1 + w*(py+1+ h*pz ))] = 1;
+ accu[( px+1 + w*(py+1+ h*pz+h))] = 1;
+ }
+ else
+ {
+ accu[( px + w*(py + h*pz ))] += (1-frac_x)*(1-frac_y)*(1-frac_z) * intweight * scale;
+ accu[( px + w*(py+1+ h*pz ))] += (1-frac_x)*( frac_y)*(1-frac_z) * intweight * scale;
+ accu[( px + w*(py + h*pz+h))] += (1-frac_x)*(1-frac_y)*( frac_z) * intweight * scale;
+ accu[( px + w*(py+1+ h*pz+h))] += (1-frac_x)*( frac_y)*( frac_z) * intweight * scale;
+ accu[( px+1 + w*(py + h*pz ))] += ( frac_x)*(1-frac_y)*(1-frac_z) * intweight * scale;
+ accu[( px+1 + w*(py + h*pz+h))] += ( frac_x)*(1-frac_y)*( frac_z) * intweight * scale;
+ accu[( px+1 + w*(py+1+ h*pz ))] += ( frac_x)*( frac_y)*(1-frac_z) * intweight * scale;
+ accu[( px+1 + w*(py+1+ h*pz+h))] += ( frac_x)*( frac_y)*( frac_z) * intweight * scale;
+ }
+
+ }
+ }
+
+ float maxRgb = 0.000000001;
+ float maxInt = 0.000000001;
+ int numPix;
+
+ if(isRgba)
+ {
+ numPix = w*h*d*4;
+
+ // calc maxima
+ for(int i=0; i<numPix; i++)
+ {
+ if((i-3)%4 != 0)
+ {
+ if(accu[i] > maxRgb)
+ {
+ maxRgb = accu[i];
+ }
+ }
+ else
+ {
+ if(accu[i] > maxInt)
+ {
+ maxInt = accu[i];
+ }
+ }
+ }
+
+ // write output, normalized uchar 0..255
+ for(int i=0; i<numPix; i++)
+ {
+ if((i-3)%4 != 0)
+ {
+ accuout[i] = (unsigned char) (255.0 * accu[i] / maxRgb);
+ }
+ else
+ {
+ accuout[i] = (unsigned char) (255.0 * accu[i] / maxInt);
+ }
+ }
+ }
+ else if (m_BinaryEnvelope)
+ {
+ numPix = w*h*d;
+
+ // write output, normalized uchar 0..255
+ for(int i=0; i<numPix; i++)
+ {
+ if(m_InvertImage)
+ {
+ accuout[i] = (unsigned char) ((int)(accu[i]+1)%2);
+ }
+ else
+ {
+ accuout[i] = (unsigned char) accu[i];
+ }
+ }
+ }
+ else
+ {
+ numPix = w*h*d;
+
+ // calc maxima
+ for(int i=0; i<numPix; i++)
+ {
+ if(accu[i] > maxInt)
+ {
+ maxInt = accu[i];
+ }
+ }
+
+ // write output, normalized uchar 0..255
+ for(int i=0; i<numPix; i++)
+ {
+ accuout[i] = (unsigned char) (255.0 * accu[i] / maxInt);
+ }
+ }
+
+ delete[] accu;
+ }
+
+}
diff --git a/Modules/DiffusionImaging/Algorithms/itkTractsToProbabilityImageFilter.h b/Modules/DiffusionImaging/Algorithms/itkTractsToProbabilityImageFilter.h
new file mode 100644
index 0000000000..9f315ff5e7
--- /dev/null
+++ b/Modules/DiffusionImaging/Algorithms/itkTractsToProbabilityImageFilter.h
@@ -0,0 +1,76 @@
+#ifndef __itkTractsToProbabilityImageFilter_h__
+#define __itkTractsToProbabilityImageFilter_h__
+
+#include "itkImageToImageFilter.h"
+#include "itkVectorContainer.h"
+#include "itkRGBAPixel.h"
+#include "mitkFiberBundle.h"
+
+namespace itk{
+
+template< class TInputImage, class TOutputPixelType >
+class TractsToProbabilityImageFilter :
+ public ImageToImageFilter<TInputImage, itk::Image<TOutputPixelType,3> >
+//huhu public ImageToImageFilter<TInputImage, itk::Image<float,3> >
+{
+
+public:
+ typedef TractsToProbabilityImageFilter Self;
+ typedef ImageToImageFilter<TInputImage, itk::Image<TOutputPixelType,3> > Superclass;
+//huhu typedef ImageToImageFilter<TInputImage, itk::Image<float,3> > Superclass;
+ typedef SmartPointer< Self > Pointer;
+ typedef SmartPointer< const Self > ConstPointer;
+
+ itkNewMacro(Self);
+ itkTypeMacro( TractsToProbabilityImageFilter,
+ ImageToImageFilter );
+
+ /** Types for the Output Image**/
+ typedef TInputImage InputImageType;
+
+ /** Types for the Output Image**/
+ typedef itk::Image<TOutputPixelType,3> OutputImageType;
+
+ /** Type for the directions **/
+ typedef VectorContainer< unsigned int, vnl_vector_fixed< double, 3 > >
+ TractOrientationsType;
+
+ /** Type for the directions container **/
+ typedef VectorContainer< unsigned int, TractOrientationsType >
+ TractOrientationsContainerType;
+
+ /** Upsampling factor **/
+ itkSetMacro( UpsamplingFactor, unsigned int);
+ itkGetMacro( UpsamplingFactor, unsigned int);
+
+ /** Upsampling factor **/
+ itkSetMacro( InvertImage, bool);
+ itkGetMacro( InvertImage, bool);
+
+ itkSetMacro(FiberBundle, mitk::FiberBundle::Pointer);
+ itkGetMacro(FiberBundle, mitk::FiberBundle::Pointer);
+
+ itkSetMacro( BinaryEnvelope, bool);
+ itkGetMacro( BinaryEnvelope, bool);
+
+ void GenerateData();
+
+protected:
+
+ TractsToProbabilityImageFilter();
+ virtual ~TractsToProbabilityImageFilter();
+
+ unsigned int m_UpsamplingFactor;
+ mitk::FiberBundle::Pointer m_FiberBundle;
+
+ bool m_InvertImage;
+ bool m_BinaryEnvelope;
+};
+
+}
+
+#ifndef ITK_MANUAL_INSTANTIATION
+#include "itkTractsToProbabilityImageFilter.cpp"
+#endif
+
+#endif // __itkTractsToProbabilityImageFilter_h__
diff --git a/Modules/DiffusionImaging/CMakeLists.txt b/Modules/DiffusionImaging/CMakeLists.txt
index 3eda59963a..7766735ede 100644
--- a/Modules/DiffusionImaging/CMakeLists.txt
+++ b/Modules/DiffusionImaging/CMakeLists.txt
@@ -1,20 +1,26 @@
FIND_PACKAGE(ITK)
IF(ITK_GDCM_DIR)
INCLUDE(${ITK_GDCM_DIR}/GDCMConfig.cmake)
IF(GDCM_MAJOR_VERSION EQUAL 2)
ADD_DEFINITIONS(-DGDCM2)
SET(ITK_USES_GDCM2 1)
ENDIF(GDCM_MAJOR_VERSION EQUAL 2)
ENDIF(ITK_GDCM_DIR)
MITK_CREATE_MODULE( MitkDiffusionImaging
SUBPROJECTS MITK-DTI
- INCLUDE_DIRS Algorithms DicomImport IODataStructures/DiffusionWeightedImages IODataStructures/QBallImages IODataStructures/TensorImages IODataStructures Reconstruction Tractography Rendering ${CMAKE_CURRENT_BINARY_DIR}
- DEPENDS MitkExt
+ INCLUDE_DIRS Algorithms DicomImport Interactions IODataStructures/DiffusionWeightedImages IODataStructures/QBallImages IODataStructures/TensorImages IODataStructures/FiberBundle IODataStructures/PlanarFigureComposite IODataStructures Reconstruction Tractography Rendering ${CMAKE_CURRENT_BINARY_DIR}
+ DEPENDS MitkExt SceneSerializationBase QmitkExt
PACKAGE_DEPENDS Boost
)
+MITK_USE_MODULE(MitkDiffusionImaging)
+if(MitkDiffusionImaging_IS_ENABLED)
+ file(DOWNLOAD http://mitk.org/download/data/FibertrackingLUT.tar.gz ${CMAKE_RUNTIME_OUTPUT_DIRECTORY}/FibertrackingLUT.tar.gz TIMEOUT 10)
+ execute_process(COMMAND cmake -E chdir ${CMAKE_RUNTIME_OUTPUT_DIRECTORY} tar xzf FibertrackingLUT.tar.gz)
+endif()
+
ADD_SUBDIRECTORY(Testing)
-
+
CONFIGURE_FILE(${CMAKE_CURRENT_SOURCE_DIR}/mitkDiffusionImagingConfigure.h.in ${CMAKE_CURRENT_BINARY_DIR}/mitkDiffusionImagingConfigure.h)
diff --git a/Modules/DiffusionImaging/IODataStructures/DiffusionWeightedImages/mitkDiffusionImage.h b/Modules/DiffusionImaging/IODataStructures/DiffusionWeightedImages/mitkDiffusionImage.h
index c1df31d4fb..5fed8f34cd 100644
--- a/Modules/DiffusionImaging/IODataStructures/DiffusionWeightedImages/mitkDiffusionImage.h
+++ b/Modules/DiffusionImaging/IODataStructures/DiffusionWeightedImages/mitkDiffusionImage.h
@@ -1,122 +1,138 @@
/*=========================================================================
Program: Medical Imaging & Interaction Toolkit
Language: C++
Date: $Date: 2008-02-07 17:17:57 +0100 (Do, 07 Feb 2008) $
Version: $Revision: 11989 $
Copyright (c) German Cancer Research Center, Division of Medical and
Biological Informatics. All rights reserved.
See MITKCopyright.txt or http://www.mitk.org/copyright.html for details.
This software is distributed WITHOUT ANY WARRANTY; without even
the implied warranty of MERCHANTABILITY or FITNESS FOR A PARTICULAR
PURPOSE. See the above copyright notices for more information.
=========================================================================*/
#ifndef __mitkDiffusionImage__h
#define __mitkDiffusionImage__h
#include "mitkImage.h"
#include "itkVectorImage.h"
#include "itkVectorImageToImageAdaptor.h"
namespace mitk
{
/**
* \brief this class encapsulates diffusion volumes (vectorimages not
* yet supported by mitkImage)
*/
template<class TPixelType>
class DiffusionImage : public Image
{
public:
typedef TPixelType PixelType;
typedef typename itk::VectorImage<TPixelType, 3>
ImageType;
typedef vnl_vector_fixed< double, 3 > GradientDirectionType;
typedef itk::VectorContainer< unsigned int,
GradientDirectionType > GradientDirectionContainerType;
typedef itk::VectorImageToImageAdaptor< TPixelType, 3 >
AdaptorType;
typedef vnl_matrix_fixed< double, 3, 3 > MeasurementFrameType;
mitkClassMacro( DiffusionImage, Image );
itkNewMacro(Self);
//void SetRequestedRegionToLargestPossibleRegion();
//bool RequestedRegionIsOutsideOfTheBufferedRegion();
//virtual bool VerifyRequestedRegion();
//void SetRequestedRegion(itk::DataObject *data);
void AverageRedundantGradients(double precision);
GradientDirectionContainerType::Pointer CalcAveragedDirectionSet(double precision, GradientDirectionContainerType::Pointer directions);
void CorrectDKFZBrokenGradientScheme(double precision);
typename ImageType::Pointer GetVectorImage()
{ return m_VectorImage; }
void SetVectorImage(typename ImageType::Pointer image )
{ this->m_VectorImage = image; }
void InitializeFromVectorImage();
void SetDisplayIndexForRendering(int displayIndex);
GradientDirectionContainerType::Pointer GetDirections()
{ return m_Directions; }
void SetDirections( GradientDirectionContainerType::Pointer directions )
{ this->m_Directions = directions; }
void SetDirections(const std::vector<itk::Vector<double,3> > directions)
{
m_Directions = GradientDirectionContainerType::New();
for(unsigned int i=0; i<directions.size(); i++)
{
m_Directions->InsertElement( i, directions[i].Get_vnl_vector() );
}
}
GradientDirectionContainerType::Pointer GetOriginalDirections()
{ return m_OriginalDirections; }
void SetOriginalDirections( GradientDirectionContainerType::Pointer directions )
{ this->m_OriginalDirections = directions; }
void SetOriginalDirections(const std::vector<itk::Vector<double,3> > directions)
{
m_OriginalDirections = GradientDirectionContainerType::New();
for(unsigned int i=0; i<directions.size(); i++)
{
m_OriginalDirections->InsertElement( i, directions[i].Get_vnl_vector() );
}
}
MeasurementFrameType GetMeasurementFrame()
{ return m_MeasurementFrame; }
void SetMeasurementFrame( MeasurementFrameType mFrame )
{ this->m_MeasurementFrame = mFrame; }
itkGetMacro(B_Value, float);
itkSetMacro(B_Value, float);
+ float GetB_Value(int i)
+ {
+ if(i > m_Directions->Size()-1)
+ return -1;
+
+ if(m_Directions->ElementAt(i).one_norm() <= 0.0)
+ {
+ return 0;
+ }
+ else
+ {
+ double twonorm = m_Directions->ElementAt(i).two_norm();
+ return m_B_Value*twonorm*twonorm ;
+ }
+ }
+
bool AreAlike(GradientDirectionType g1, GradientDirectionType g2, double precision);
protected:
DiffusionImage();
virtual ~DiffusionImage();
typename ImageType::Pointer m_VectorImage;
GradientDirectionContainerType::Pointer m_Directions;
GradientDirectionContainerType::Pointer m_OriginalDirections;
float m_B_Value;
typename AdaptorType::Pointer m_VectorImageAdaptor;
int m_DisplayIndex;
MeasurementFrameType m_MeasurementFrame;
};
} // namespace mitk
#include "mitkDiffusionImage.txx"
#endif /* __mitkDiffusionImage__h */
diff --git a/Modules/DiffusionImaging/IODataStructures/DiffusionWeightedImages/mitkDiffusionImageSerializer.cpp b/Modules/DiffusionImaging/IODataStructures/DiffusionWeightedImages/mitkDiffusionImageSerializer.cpp
new file mode 100644
index 0000000000..c7c16d1606
--- /dev/null
+++ b/Modules/DiffusionImaging/IODataStructures/DiffusionWeightedImages/mitkDiffusionImageSerializer.cpp
@@ -0,0 +1,75 @@
+/*=========================================================================
+
+Program: Medical Imaging & Interaction Toolkit
+Language: C++
+Date: $Date$
+Version: $Revision: 1.12 $
+
+Copyright (c) German Cancer Research Center, Division of Medical and
+Biological Informatics. All rights reserved.
+See MITKCopyright.txt or http://www.mitk.org/copyright.html for details.
+
+This software is distributed WITHOUT ANY WARRANTY; without even
+the implied warranty of MERCHANTABILITY or FITNESS FOR A PARTICULAR
+PURPOSE. See the above copyright notices for more information.
+
+=========================================================================*/
+
+#include "mitkDiffusionImageSerializer.h"
+#include "mitkDiffusionImage.h"
+#include "mitkNrrdDiffusionImageWriter.h"
+
+#include <itksys/SystemTools.hxx>
+
+
+MITK_REGISTER_SERIALIZER(DiffusionImageSerializer)
+
+
+mitk::DiffusionImageSerializer::DiffusionImageSerializer()
+{
+}
+
+
+mitk::DiffusionImageSerializer::~DiffusionImageSerializer()
+{
+}
+
+
+std::string mitk::DiffusionImageSerializer::Serialize()
+{
+ const DiffusionImage<short>* image = dynamic_cast<const DiffusionImage<short>*>( m_Data.GetPointer() );
+ if (image == NULL)
+ {
+ MITK_ERROR << " Object at " << (const void*) this->m_Data
+ << " is not an mitk::DiffusionImage. Cannot serialize as DiffusionImage.";
+ return "";
+ }
+
+ std::string filename( this->GetUniqueFilenameInWorkingDirectory() );
+ filename += "_";
+ filename += m_FilenameHint;
+ filename += ".dwi";
+
+ std::string fullname(m_WorkingDirectory);
+ fullname += "/";
+ fullname += itksys::SystemTools::ConvertToOutputPath(filename.c_str());
+
+ try
+ {
+ NrrdDiffusionImageWriter<short>::Pointer writer = NrrdDiffusionImageWriter<short>::New();
+ writer->SetFileName(fullname);
+ writer->SetInput(const_cast<DiffusionImage<short>*>(image));
+ writer->Write();
+ }
+ catch (std::exception& e)
+ {
+ MITK_ERROR << " Error serializing object at " << (const void*) this->m_Data
+ << " to "
+ << fullname
+ << ": "
+ << e.what();
+ return "";
+ }
+ return filename;
+}
+
diff --git a/Modules/SceneSerializationBase/mitkBasePropertyDeserializer.cpp b/Modules/DiffusionImaging/IODataStructures/DiffusionWeightedImages/mitkDiffusionImageSerializer.h
similarity index 53%
copy from Modules/SceneSerializationBase/mitkBasePropertyDeserializer.cpp
copy to Modules/DiffusionImaging/IODataStructures/DiffusionWeightedImages/mitkDiffusionImageSerializer.h
index 0940080d22..9ff389ec7b 100644
--- a/Modules/SceneSerializationBase/mitkBasePropertyDeserializer.cpp
+++ b/Modules/DiffusionImaging/IODataStructures/DiffusionWeightedImages/mitkDiffusionImageSerializer.h
@@ -1,33 +1,40 @@
/*=========================================================================
Program: Medical Imaging & Interaction Toolkit
Language: C++
Date: $Date$
Version: $Revision: 1.12 $
Copyright (c) German Cancer Research Center, Division of Medical and
Biological Informatics. All rights reserved.
See MITKCopyright.txt or http://www.mitk.org/copyright.html for details.
This software is distributed WITHOUT ANY WARRANTY; without even
the implied warranty of MERCHANTABILITY or FITNESS FOR A PARTICULAR
PURPOSE. See the above copyright notices for more information.
=========================================================================*/
-#include "mitkBasePropertyDeserializer.h"
+#ifndef mitkDiffusionImageSerializer_h_included
+#define mitkDiffusionImageSerializer_h_included
-mitk::BasePropertyDeserializer::BasePropertyDeserializer()
-{
-}
+#include "MitkDiffusionImagingExports.h"
+#include "mitkBaseDataSerializer.h"
-mitk::BasePropertyDeserializer::~BasePropertyDeserializer()
+namespace mitk
{
-}
-
-mitk::BaseProperty::Pointer mitk::BasePropertyDeserializer::Deserialize(TiXmlElement* /*element*/)
+/**
+ \brief Serializes mitk::Surface for mitk::SceneIO
+*/
+class MitkDiffusionImaging_EXPORT DiffusionImageSerializer : public BaseDataSerializer
{
- MITK_ERROR << this->GetNameOfClass() << " is asked to deserialize an object but has no implementation. This is bad.";
- return NULL;
-}
-
+ public:
+ mitkClassMacro( DiffusionImageSerializer, BaseDataSerializer );
+ itkNewMacro(Self);
+ virtual std::string Serialize();
+ protected:
+ DiffusionImageSerializer();
+ virtual ~DiffusionImageSerializer();
+};
+} // namespace
+#endif
diff --git a/Modules/DiffusionImaging/IODataStructures/DiffusionWeightedImages/mitkNrrdDiffusionImageWriter.h b/Modules/DiffusionImaging/IODataStructures/DiffusionWeightedImages/mitkNrrdDiffusionImageWriter.h
index fb14341f75..55a12cbf1f 100644
--- a/Modules/DiffusionImaging/IODataStructures/DiffusionWeightedImages/mitkNrrdDiffusionImageWriter.h
+++ b/Modules/DiffusionImaging/IODataStructures/DiffusionWeightedImages/mitkNrrdDiffusionImageWriter.h
@@ -1,133 +1,133 @@
/*=========================================================================
Program: Medical Imaging & Interaction Toolkit
Language: C++
Date: $Date: 2008-08-27 17:18:46 +0200 (Mi, 27 Aug 2008) $
Version: $Revision: 15096 $
Copyright (c) German Cancer Research Center, Division of Medical and
Biological Informatics. All rights reserved.
See MITKCopyright.txt or http://www.mitk.org/copyright.html for details.
This software is distributed WITHOUT ANY WARRANTY; without even
the implied warranty of MERCHANTABILITY or FITNESS FOR A PARTICULAR
PURPOSE. See the above copyright notices for more information.
=========================================================================*/
#ifndef _MITK_NRRDDIFFVOL_WRITER__H_
#define _MITK_NRRDDIFFVOL_WRITER__H_
#include <itkProcessObject.h>
#include <mitkFileWriterWithInformation.h>
#include <mitkDiffusionImage.h>
namespace mitk
{
/**
* Writes diffusion volumes to a file
* @ingroup Process
*/
template < class TPixelType >
class NrrdDiffusionImageWriter : public mitk::FileWriterWithInformation
{
public:
mitkClassMacro( NrrdDiffusionImageWriter, mitk::FileWriterWithInformation );
mitkWriterMacro;
itkNewMacro( Self );
typedef mitk::DiffusionImage<TPixelType> InputType;
/**
* Sets the filename of the file to write.
* @param FileName the name of the file to write.
*/
itkSetStringMacro( FileName );
/**
* @returns the name of the file to be written to disk.
*/
itkGetStringMacro( FileName );
/**
* @warning multiple write not (yet) supported
*/
itkSetStringMacro( FilePrefix );
/**
* @warning multiple write not (yet) supported
*/
itkGetStringMacro( FilePrefix );
/**
* @warning multiple write not (yet) supported
*/
itkSetStringMacro( FilePattern );
/**
* @warning multiple write not (yet) supported
*/
itkGetStringMacro( FilePattern );
/**
* Sets the input object for the filter.
* @param input the diffusion volumes to write to file.
*/
void SetInput( InputType* input );
/**
* @returns the 0'th input object of the filter.
*/
InputType* GetInput();
/**
* Returns false if an error happened during writing
*/
itkGetMacro( Success, bool );
/**
* @return possible file extensions for the data type associated with the writer
*/
virtual std::vector<std::string> GetPossibleFileExtensions();
// FileWriterWithInformation methods
virtual const char * GetDefaultFilename() { return "DiffusionWeightedImages.dwi"; }
virtual const char * GetFileDialogPattern() { return "Diffusion Weighted Images (*.dwi *.hdwi *.fsl)"; }
virtual const char * GetDefaultExtension() { return ".dwi"; }
- virtual bool CanWriteDataType(BaseData::Pointer data) { return (dynamic_cast<mitk::DiffusionImage<TPixelType>*>(data.GetPointer()) != NULL); };
+ virtual bool CanWriteBaseDataType(BaseData::Pointer data) { return (dynamic_cast<mitk::DiffusionImage<TPixelType>*>(data.GetPointer()) != NULL); };
virtual void DoWrite(BaseData::Pointer data) {
- if (CanWriteDataType(data)) {
+ if (CanWriteBaseDataType(data)) {
this->SetInput(dynamic_cast<mitk::DiffusionImage<TPixelType>*>(data.GetPointer()));
this->Update();
}
};
protected:
NrrdDiffusionImageWriter();
virtual ~NrrdDiffusionImageWriter();
virtual void GenerateData();
std::string m_FileName;
std::string m_FilePrefix;
std::string m_FilePattern;
bool m_Success;
};
} // end of namespace mitk
#include "mitkNrrdDiffusionImageWriter.cpp"
#endif
diff --git a/Modules/DiffusionImaging/IODataStructures/FiberBundle/itkSlowPolyLineParametricPath.h b/Modules/DiffusionImaging/IODataStructures/FiberBundle/itkSlowPolyLineParametricPath.h
new file mode 100644
index 0000000000..e4b0f53d37
--- /dev/null
+++ b/Modules/DiffusionImaging/IODataStructures/FiberBundle/itkSlowPolyLineParametricPath.h
@@ -0,0 +1,112 @@
+#ifndef _itkSlowPolyLineParametricPathPath_h
+#define _itkSlowPolyLineParametricPathPath_h
+
+#include "itkPolyLineParametricPath.h"
+#include "itkVectorContainer.h"
+#include "itkContinuousIndex.h"
+#include "itkIndex.h"
+#include "itkOffset.h"
+#include "itkVector.h"
+
+namespace itk
+{
+
+
+/** \class SlowPolyLineParametricPath
+ * \brief Represent a path of line segments through ND Space
+ *
+ * This class is intended to represent parametric paths through an image, where
+ * the paths are composed of line segments. Each line segment traverses one
+ * unit of input. A classic application of this class is the representation of
+ * contours in 2D images, especially when the contours only need to be
+ * approximately correct. Another use of a path is to guide the movement of an
+ * iterator through an image.
+ *
+ * \sa EllipseParametricPath
+ * \sa FourierSeriesPath
+ * \sa OrthogonallyCorrectedParametricPath
+ * \sa ParametricPath
+ * \sa ChainCodePath
+ * \sa Path
+ * \sa ContinuousIndex
+ * \sa Index
+ * \sa Offset
+ * \sa Vector
+ *
+ * \ingroup PathObjects
+ */
+template <unsigned int VDimension>
+class ITK_EXPORT SlowPolyLineParametricPath : public
+PolyLineParametricPath< VDimension >
+{
+public:
+ /** Standard class typedefs. */
+ typedef SlowPolyLineParametricPath Self;
+ typedef PolyLineParametricPath<VDimension> Superclass;
+ typedef SmartPointer<Self> Pointer;
+ typedef SmartPointer<const Self> ConstPointer;
+
+ /** Run-time type information (and related methods). */
+ itkTypeMacro(SlowPolyLineParametricPath, PolyLineParametricPath);
+
+ /** Input type */
+ typedef typename Superclass::InputType InputType;
+
+ /** Output type */
+ typedef typename Superclass::OutputType OutputType;
+
+
+ /** Basic data-structure types used */
+ typedef typename Superclass::ContinuousIndexType ContinuousIndexType;
+ typedef typename Superclass::IndexType IndexType;
+ typedef typename Superclass::OffsetType OffsetType;
+ typedef typename Superclass::PointType PointType;
+ typedef typename Superclass::VectorType VectorType;
+ typedef typename Superclass::VertexType VertexType;
+ typedef typename Superclass::VertexListType VertexListType;
+ typedef typename Superclass::VertexListPointer VertexListPointer;
+
+ /** Increment the input variable passed by reference such that the ND index of
+ * the path moves to its next vertex-connected (8-connected in 2D) neighbor.
+ * Return the Index-space offset of the path from its prior input to its new
+ * input. If the path is unable to increment, input is not changed and an
+ * offset of Zero is returned. Children are not required to implement bounds
+ * checking.
+ *
+ * This is a fairly slow, iterative algorithm that numerically converges to
+ * the next index along the path, in a vertex-connected (8-connected in 2D)
+ * fashion. When possible, children of this class should overload this
+ * function with something more efficient.
+ *
+ * WARNING: This default implementation REQUIRES that the ND endpoint of
+ * the path be either unique or coincident only with the startpoint, since it
+ * uses the endpoint as a stopping condition. */
+ virtual OffsetType IncrementInput(InputType & input) const;
+
+
+ ///** Evaluate the first derivative of the ND output with respect to the 1D
+ // * input. This is an exact, algebraic function. */
+ //virtual VectorType EvaluateDerivative(const InputType & input) const;
+
+
+ /** New() method for dynamic construction */
+ itkNewMacro( Self );
+
+
+protected:
+ SlowPolyLineParametricPath();
+ ~SlowPolyLineParametricPath(){}
+ void PrintSelf(std::ostream& os, Indent indent) const;
+
+private:
+ SlowPolyLineParametricPath(const Self&); //purposely not implemented
+ void operator=(const Self&); //purposely not implemented
+};
+
+} // namespace itk
+
+#ifndef ITK_MANUAL_INSTANTIATION
+#include "itkSlowPolyLineParametricPath.txx"
+#endif
+
+#endif
diff --git a/Modules/DiffusionImaging/IODataStructures/FiberBundle/itkSlowPolyLineParametricPath.txx b/Modules/DiffusionImaging/IODataStructures/FiberBundle/itkSlowPolyLineParametricPath.txx
new file mode 100644
index 0000000000..e0852d1614
--- /dev/null
+++ b/Modules/DiffusionImaging/IODataStructures/FiberBundle/itkSlowPolyLineParametricPath.txx
@@ -0,0 +1,115 @@
+#ifndef _itkSlowPolyLineParametricPath_txx
+#define _itkSlowPolyLineParametricPath_txx
+
+#include "itkSlowPolyLineParametricPath.h"
+#include <math.h>
+
+
+
+namespace itk
+{
+
+//template<unsigned int VDimension>
+//typename SlowPolyLineParametricPath<VDimension>::VectorType
+//SlowPolyLineParametricPath<VDimension>
+//::EvaluateDerivative(const InputType & input) const
+//{
+//}
+
+
+
+/**
+ * Constructor
+ */
+template <unsigned int VDimension>
+SlowPolyLineParametricPath<VDimension>
+::SlowPolyLineParametricPath()
+{
+ this->SetDefaultInputStepSize( 0.3 );
+}
+
+
+template<unsigned int VDimension>
+typename SlowPolyLineParametricPath<VDimension>::OffsetType
+SlowPolyLineParametricPath<VDimension>
+::IncrementInput(InputType & input) const
+{
+ int iterationCount;
+ bool tooSmall;
+ bool tooBig;
+ InputType inputStepSize;
+ InputType finalInputValue;
+ OffsetType offset;
+ IndexType currentImageIndex;
+ IndexType nextImageIndex;
+ IndexType finalImageIndex;
+
+ iterationCount = 0;
+ inputStepSize = this->GetDefaultInputStepSize();
+
+ // Are we already at (or past) the end of the input?
+ finalInputValue = this->EndOfInput();
+ currentImageIndex = this->EvaluateToIndex( input );
+ finalImageIndex = this->EvaluateToIndex( finalInputValue );
+ offset = finalImageIndex - currentImageIndex;
+ if( ( offset == this->GetZeroOffset() && input != this->StartOfInput() ) ||
+ ( input >=finalInputValue ) )
+ {
+ return this->GetZeroOffset();
+ }
+
+ do
+ {
+ if( iterationCount++ > 10000 ) {itkExceptionMacro(<<"Too many iterations");}
+
+ nextImageIndex = this->EvaluateToIndex( input + inputStepSize );
+ offset = nextImageIndex - currentImageIndex;
+
+ tooBig = false;
+ tooSmall = ( offset == this->GetZeroOffset() );
+ if( tooSmall )
+ {
+ // increase the input step size, but don't go past the end of the input
+ inputStepSize *= 2;
+ if( (input + inputStepSize) >= finalInputValue ){
+ //inputStepSize = finalInputValue - input;
+ inputStepSize += this->GetDefaultInputStepSize();
+ }
+ }
+ else
+ {
+ // Search for an offset dimension that is too big
+ for( unsigned int i=0; i<VDimension && !tooBig; i++ )
+ {
+ tooBig = ( offset[i] >= 2 || offset[i] <= -2 );
+ }
+
+ if( tooBig ){
+ //inputStepSize /= 1.5;
+ inputStepSize -= (this->GetDefaultInputStepSize()/0.5);
+ }
+ }
+ }
+ while( tooSmall || tooBig );
+
+ input += inputStepSize;
+ return offset;
+}
+
+
+/**
+ * Standard "PrintSelf" method
+ */
+template <unsigned int VDimension>
+void
+SlowPolyLineParametricPath<VDimension>
+::PrintSelf( std::ostream& os, Indent indent) const
+{
+ Superclass::PrintSelf( os, indent );
+}
+
+
+
+} // end namespaceitk
+
+#endif
diff --git a/Modules/DiffusionImaging/IODataStructures/FiberBundle/mitkFiberBundle.cpp b/Modules/DiffusionImaging/IODataStructures/FiberBundle/mitkFiberBundle.cpp
new file mode 100644
index 0000000000..a8fb21dcc4
--- /dev/null
+++ b/Modules/DiffusionImaging/IODataStructures/FiberBundle/mitkFiberBundle.cpp
@@ -0,0 +1,1863 @@
+/*=========================================================================
+
+ Program: Medical Imaging & Interaction Toolkit
+ Language: C++
+ Date: $Date: 2010-03-31 16:40:27 +0200 (Mi, 31 Mrz 2010) $
+ Version: $Revision: 21975 $
+
+ Copyright (c) German Cancer Research Center, Division of Medical and
+ Biological Informatics. All rights reserved.
+ See MITKCopyright.txt or http://www.mitk.org/copyright.html for details.
+
+ This software is distributed WITHOUT ANY WARRANTY; without even
+ the implied warranty of MERCHANTABILITY or FITNESS FOR A PARTICULAR
+ PURPOSE. See the above copyright notices for more information.
+
+ =========================================================================*/
+
+
+#include "mitkFiberBundle.h"
+#include "mitkGeometry2D.h"
+#include "mitkVector.h"
+#include "mitkPlaneGeometry.h"
+#include <mitkLine.h>
+
+#include "mitkPlanarFigure.h"
+#include "mitkPlanarCircle.h"
+#include "mitkPlanarRectangle.h"
+#include "mitkPlanarPolygon.h"
+#include "mitkPlanarFigureComposite.h"
+
+#include <vtkPolygon.h>
+#include <vtkPoints.h>
+
+
+/* statics values to define the position of a fiberTractPoint
+ * related to the plane of a ROI
+ */
+const int mitk::FiberBundle::TRACTPOINT_BACKFACE = 0;
+const int mitk::FiberBundle::TRACTPOINT_ON_PLANE = 1;
+const int mitk::FiberBundle::TRACTPOINT_FRNTFACE = 2;
+
+// implementation of all essential methods from superclass
+
+mitk::FiberBundle::FiberBundle()
+{
+ m_GroupFiberBundle = FiberGroupType::New();
+
+ m_TractContainer = ContainerType::New();
+
+ //by default set a standard geometry, usually geometry is set by the user on initializing
+ //a mitkFiberBundle Object
+ mitk::Geometry3D::Pointer fbgeometry = mitk::Geometry3D::New();
+ fbgeometry->SetIdentity();
+ this->SetGeometry(fbgeometry);
+
+ /* for debugging only */
+ m_debugITKContainer = itkStochTractContainerType::New();
+
+
+}
+
+mitk::FiberBundle::~FiberBundle()
+{
+
+}
+
+void mitk::FiberBundle::SetBounds(float* b)
+{
+ m_boundsFB[0] = b[0];
+ m_boundsFB[1] = b[1];
+ m_boundsFB[2] = b[2];
+}
+
+void mitk::FiberBundle::SetBounds(double* b)
+{
+ m_boundsFB[0] = b[0];
+ m_boundsFB[1] = b[1];
+ m_boundsFB[2] = b[2];
+}
+
+float* mitk::FiberBundle::GetBounds()
+{
+ return m_boundsFB;
+}
+
+void mitk::FiberBundle::PushPoint(int fiberIndex, ContainerPointType point)
+{
+ if( (unsigned)fiberIndex >= m_TractContainer->Size() )
+ {
+ fiberIndex = m_TractContainer->Size();
+ ContainerTractType::Pointer tract = ContainerTractType::New();
+ tract->InsertElement(tract->Size(),point);
+ m_TractContainer->InsertElement(fiberIndex, tract);
+ }
+ else if(fiberIndex>=0)
+ {
+ m_TractContainer->ElementAt(fiberIndex)->InsertElement(m_TractContainer->ElementAt(fiberIndex)->Size(), point);
+ }
+}
+
+void mitk::FiberBundle::PushTract(ContainerTractType::Pointer tract)
+{
+ m_TractContainer->InsertElement(m_TractContainer->Size(), tract);
+}
+
+mitk::FiberBundle::Pointer mitk::FiberBundle::JoinBundle(mitk::FiberBundle::Pointer bundle)
+{
+ mitk::FiberBundle::Pointer retval = mitk::FiberBundle::New();
+ retval->SetGeometry(this->GetGeometry());
+ retval->SetBounds(this->m_boundsFB);
+
+ retval->InsertBundle(this);
+ retval->InsertBundle(bundle);
+ return retval;
+}
+
+void mitk::FiberBundle::InsertBundle(mitk::FiberBundle::Pointer bundle)
+{
+
+ // INCOMPLETE, SHOULD CHECK FOR DIFFERENT GEOMETRIES IN THIS+BUNDLE
+ // DO INDEX1 -> WORLD -> INDEX2 TRANSFORMATION, IF THEY ARE DIFFERENT.
+
+ int num = this->GetNumTracts();
+
+ FiberGroupType::Pointer groupFiberBundle = bundle->GetGroupFiberBundle();
+ ChildrenListType *fiberList = groupFiberBundle->GetChildren();
+ for(ChildrenListType::iterator itLst = fiberList->begin();
+ itLst != fiberList->end();
+ ++itLst)
+ {
+
+ itk::SpatialObject<3>::Pointer tmp_fbr;
+ tmp_fbr = *itLst;
+ mitk::FiberBundle::DTITubeType::Pointer dtiTract = dynamic_cast< mitk::FiberBundle::DTITubeType * > (tmp_fbr.GetPointer());
+
+ if (dtiTract.IsNull())
+ {
+ MITK_INFO << "DTI Tract is NULL!!!!! omg";
+ continue;
+ }
+
+ dtiTract->SetId(num++);
+ this->addSingleDTITract(dtiTract);
+ }
+
+ ContainerType::Pointer container = bundle->GetTractContainer();
+ for(int i=0; i<container->Size();i++)
+ {
+ this->PushTract(container->ElementAt(i));
+ }
+
+}
+
+int mitk::FiberBundle::FindTractByEndpoints(mitk::FiberBundle::DTITubeType::Pointer searchTract)
+{
+ int searchNrPnts = searchTract->GetNumberOfPoints();
+ mitk::FiberBundle::DTITubeType::PointListType searchPntList = searchTract->GetPoints();
+
+ typedef mitk::FiberBundle::DTITubeType::PointType PointType;
+
+ DTITubePointType searchPointFirst = searchPntList.at(0);
+ PointType searchPos1 = searchPointFirst.GetPosition();
+ DTITubePointType searchPointLast = searchPntList.at(searchNrPnts-1);
+ PointType searchPos2 = searchPointLast.GetPosition();
+
+ FiberGroupType::Pointer groupFiberBundle = this->GetGroupFiberBundle();
+ ChildrenListType *fiberList = groupFiberBundle->GetChildren();
+ for(ChildrenListType::iterator itLst = fiberList->begin();
+ itLst != fiberList->end();
+ ++itLst)
+ {
+
+ itk::SpatialObject<3>::Pointer tmp_fbr;
+ tmp_fbr = *itLst;
+ mitk::FiberBundle::DTITubeType::Pointer dtiTract = dynamic_cast< mitk::FiberBundle::DTITubeType * > (tmp_fbr.GetPointer());
+
+ if (dtiTract.IsNull())
+ {
+ MITK_INFO << "DTI Tract is NULL!!!!! omg";
+ continue;
+ }
+
+ mitk::FiberBundle::DTITubeType::PointListType dtiPntList = dtiTract->GetPoints();
+ int fibrNrPnts = dtiTract->GetNumberOfPoints();
+
+ DTITubePointType point_first = dtiPntList.at(0);
+ PointType pos1 = point_first.GetPosition();
+ DTITubePointType point_last = dtiPntList.at(fibrNrPnts-1);
+ PointType pos2 = point_last.GetPosition();
+
+ if( (pos1 == searchPos1 && pos2 == searchPos2) ||
+ (pos2 == searchPos1 && pos1 == searchPos2) )
+ {
+ return dtiTract->GetId();
+ }
+ }
+
+ return -1;
+}
+
+mitk::FiberBundle::Pointer mitk::FiberBundle::SubstractBundle(mitk::FiberBundle::Pointer bundle)
+{
+
+ mitk::FiberBundle::Pointer retval = mitk::FiberBundle::New();
+ retval->SetGeometry(this->GetGeometry());
+
+ mitk::FiberBundle::Pointer largeBundle = bundle;
+ mitk::FiberBundle::Pointer smallBundle = this;
+
+ MITK_INFO << "large children " << largeBundle->GetGroupFiberBundle()->GetNumberOfChildren() << "!="<<largeBundle->GetNumTracts();
+ MITK_INFO << "small children " << smallBundle->GetGroupFiberBundle()->GetNumberOfChildren() << "!="<<smallBundle->GetNumTracts();
+
+ if(this->GetGroupFiberBundle()->GetNumberOfChildren() > bundle->GetGroupFiberBundle()->GetNumberOfChildren())
+ {
+ MITK_INFO << "this is large (" << this->GetNumTracts() << ">" << bundle->GetNumTracts() << ")";
+ largeBundle = this;
+ smallBundle = bundle;
+ }
+
+
+ ContainerType::Pointer container = largeBundle->GetTractContainer();
+ int counter = 0;
+
+ FiberGroupType::Pointer groupFiberBundle = largeBundle->GetGroupFiberBundle();
+ ChildrenListType *fiberList = groupFiberBundle->GetChildren();
+ MITK_INFO << "large number children " << groupFiberBundle->GetNumberOfChildren();
+ for(ChildrenListType::iterator itLst = fiberList->begin();
+ itLst != fiberList->end();
+ ++itLst)
+ {
+
+ itk::SpatialObject<3>::Pointer tmp_fbr;
+ tmp_fbr = *itLst;
+ mitk::FiberBundle::DTITubeType::Pointer dtiTract = dynamic_cast< mitk::FiberBundle::DTITubeType * > (tmp_fbr.GetPointer());
+
+ if (dtiTract.IsNull())
+ {
+ MITK_INFO << "DTI Tract is NULL!!!!! omg";
+ continue;
+ }
+
+ int delId = smallBundle->FindTractByEndpoints(dtiTract);
+ if( delId == -1 )
+ {
+ retval->addSingleDTITract(dtiTract);
+ retval->PushTract(container->ElementAt(counter));
+ }
+
+ MITK_INFO << "Counter " << counter++;
+ }
+
+ return retval;
+}
+
+mitk::FiberBundle::ContainerPointType mitk::FiberBundle::GetPoint(int tractIndex, int pointIndex)
+{
+ if (tractIndex>=0 && tractIndex<GetNumTracts() && pointIndex>=0 && pointIndex<GetNumPoints(tractIndex))
+ {
+ return m_TractContainer->GetElement(tractIndex)->GetElement(pointIndex);
+ }
+ return NULL;
+}
+
+int mitk::FiberBundle::GetNumTracts()
+{
+ return m_TractContainer->Size();
+}
+
+int mitk::FiberBundle::GetNumPoints(int tractIndex)
+{
+ if ((unsigned)tractIndex>=0 && (unsigned)tractIndex<m_TractContainer->Size())
+ {
+ return m_TractContainer->GetElement(tractIndex)->Size();
+
+ } else {
+ //added by igi
+ return NULL;
+ }
+
+}
+
+mitk::FiberBundle::ContainerTractType::Pointer mitk::FiberBundle::GetTract(int tractIndex)
+{
+ ContainerTractType::Pointer out;
+ if ((unsigned)tractIndex>0 && (unsigned)tractIndex<m_TractContainer->Size())
+ return m_TractContainer->GetElement(tractIndex);
+ return out;
+}
+
+void mitk::FiberBundle::additkStochTractContainer(itkStochTractContainerType::Pointer itkStochCont)
+{
+ //for debugging only
+ m_debugITKContainer = itkStochCont;
+ //********************
+
+
+ /* transform itkStochContainer to standardized TractContainer */
+
+ for (itkStochTractContainerType::ConstIterator itCont = itkStochCont->Begin();
+ itCont != itkStochCont->End();
+ ++itCont)
+ {
+
+ // get fiber of itkContainer
+ itkStochTractType::Pointer tract = itCont->Value();
+ itkStochTractType::VertexListType::ConstPointer vertexlist = tract->GetVertexList();
+
+ //init a desired containerFiber
+ ContainerTractType::Pointer contTract = ContainerTractType::New();
+
+ //get points of fiber
+ for( int j=0; j<(int)vertexlist->Size(); ++j)
+ {
+
+ // put the point of vertex pointList in itkContainer
+ itkStochTractType::VertexType vertex = vertexlist->GetElement(j);
+
+ //prepare for dtiPoint
+ ContainerPointType contPnt;
+ contPnt[0] = (float) vertex[0];
+ contPnt[1] = (float) vertex[1];
+ contPnt[2] = (float) vertex[2];
+
+ contTract->InsertElement(contTract->Size(), contPnt);
+
+ /* coordinate testing*/
+ /*if ((float)vertex[0] == contPnt[0]) {
+ MITK_INFO << " [OK] ... X ";
+ }else {
+ MITK_INFO << "[FAIL] ... itkX: " << vertex[0] << " " << contPnt[0] << "\n" ;
+ }
+
+ if ((float)vertex[1] == contPnt[1]) {
+ MITK_INFO << " [OK] ... Y ";
+ }else {
+ MITK_INFO << "[FAIL] ... itkY: " << vertex[1] << " " << contPnt[1] << "\n" ;
+ }
+ if ((float)vertex[2] == contPnt[2]) {
+ MITK_INFO << " [OK] ... Z " << "\n" ;
+ MITK_INFO << " Values X Y Z: " << contPnt[0] << " " << contPnt[1] << " " << contPnt[2] << "\n";
+ }else {
+ MITK_INFO << "[FAIL] ... itkZ: " << vertex[2] << " " << contPnt[2] << "\n" ;
+ }
+ */
+
+
+
+ }
+
+ // add filled fiber to container
+ m_TractContainer->InsertElement(m_TractContainer->Size(), contTract);
+
+ }
+
+
+}
+
+void mitk::FiberBundle::addTractContainer( ContainerType::Pointer tractContainer )
+{
+ m_TractContainer = tractContainer;
+}
+
+
+void mitk::FiberBundle::initFiberGroup()
+{
+ /* iterate through the tractContainer and store fibers in DTISpatialObjects */
+ for (ContainerType::ConstIterator itCont = m_TractContainer->Begin();
+ itCont != m_TractContainer->End();
+ ++itCont)
+ {
+ // init new dtiTube and
+ DTITubeType::Pointer dtiTube = DTITubeType::New();
+ DTITubeType::PointListType list;
+
+ // get current tract of container
+ ContainerTractType::Pointer contTract = itCont->Value();
+
+ // iterate through the number of points ... use iterator, no index-output is needed anyway
+ for(ContainerTractType::Iterator itContTrct = contTract->Begin();
+ itContTrct != contTract->End();
+ ++itContTrct)
+ {
+ // init DTITube point
+ DTITubePointType p;
+ ContainerPointType cntp = itContTrct->Value();
+ p.SetPosition(cntp[0], cntp[1], cntp[2]);
+ p.SetRadius(1);
+
+ mitk::FiberBundle::fiberPostprocessing_setTensorMatrix( &p );
+
+
+ mitk::FiberBundle::fiberPostprocessing_FA( &p );
+ //mitk::FiberBundle::fiberPostprocessing_setTensorMatrix( &p );
+
+ p.AddField(DTITubePointType::GA, 3);
+
+ p.SetColor(1,0,0,1);
+ list.push_back(p);
+ }
+ // dtiTubes
+ dtiTube->GetProperty()->SetName("dtiTube");
+ dtiTube->SetId(itCont->Index());
+ dtiTube->SetPoints(list);
+ m_GroupFiberBundle->AddSpatialObject(dtiTube);
+ }
+}
+
+void mitk::FiberBundle::fiberPostprocessing_setTensorMatrix(DTITubePointType *dtiP)
+{
+ float tMatrix[6];
+ tMatrix[0]=0.0f;
+ tMatrix[1]=1.0f;
+ tMatrix[2]=2.0f;
+ tMatrix[3]=3.0f;
+ tMatrix[4]=4.0f;
+ tMatrix[5]=5.0f;
+
+ dtiP->SetTensorMatrix(tMatrix);
+
+
+}
+
+/* this method is a HowTo method, used for debugging only */
+void mitk::FiberBundle::fiberPostprocessing_setPoint(DTITubePointType *dtiP, ContainerPointType vrtx)
+{
+ /* get values of variable referenced by a ponter
+ double vtxIdx1, vtxIdx2, vtxIdx3;
+ vtxIdx1 = * (double*) &vrtx[0];
+ vtxIdx2 = * (double*) &vrtx[1];
+ vtxIdx3 = * (double*) &vrtx[2];
+
+ dtiP->SetPosition(vtxIdx1, vtxIdx2, vtxIdx3);
+ */
+
+ dtiP->SetPosition(vrtx[0], vrtx[1], vrtx[2]);
+}
+
+void mitk::FiberBundle::fiberPostprocessing_FA(DTITubePointType *dtiP)
+{
+ debug_PrototypeCounter ++;
+ float valFA;
+
+ if (debug_PrototypeCounter % 10 < 5) {
+ valFA = 1.0;
+ } else if (debug_PrototypeCounter % 10 == 7) {
+ valFA = 0.3;
+ } else if (debug_PrototypeCounter % 10 == 8) {
+ valFA = 0;
+ } else {
+ valFA = 0.5;
+ }
+
+ dtiP->AddField(DTITubePointType::FA, valFA);
+
+}
+
+
+/* methods for high speed perfoermance dispay or live-monitoring of fiber results */
+void mitk::FiberBundle::addContainer4speedDisplay(ContainerType::Pointer speedTractContainer)
+{
+
+}
+
+
+
+
+void mitk::FiberBundle::addSingleDTITract(mitk::FiberBundle::DTITubeType::Pointer dtiFbrTrct)
+{
+
+ //MITK_INFO << " start addSingleDTITract(): " << m_GroupFiberBundle->GetNumberOfChildren();
+ m_GroupFiberBundle->AddSpatialObject(dtiFbrTrct);
+ //MITK_INFO << "end addSingleDTITract(): " << m_GroupFiberBundle->GetNumberOfChildren();
+
+
+}
+
+mitk::FiberBundle::FiberGroupType::Pointer mitk::FiberBundle::getGroupFiberBundle()
+{
+ return m_GroupFiberBundle;
+}
+
+std::vector<int> mitk::FiberBundle::getAllIDsInFiberBundle()
+{
+ std::vector<int> allFBIds;
+
+ FiberGroupType::Pointer fiberGroup = this->getGroupFiberBundle();
+ ChildrenListType *FiberList;
+ FiberList = fiberGroup->GetChildren();
+
+ for(ChildrenListType::iterator itLst = FiberList->begin();
+ itLst != FiberList->end();
+ ++itLst)
+ {
+
+ itk::SpatialObject<3>::Pointer tmp_fbr;
+ tmp_fbr = *itLst;
+ mitk::FiberBundle::DTITubeType::Pointer dtiTract = dynamic_cast< mitk::FiberBundle::DTITubeType * > (tmp_fbr.GetPointer());
+ if (dtiTract.IsNull()) {
+ MITK_INFO << "DTI Tract is NULL!!!!! omg";
+ continue; }
+
+ allFBIds.push_back(dtiTract->GetId());
+
+ }
+
+ return allFBIds;
+
+
+}
+
+
+mitk::FiberBundle::Pointer mitk::FiberBundle::extractFibersById(std::vector<int> idSet)
+{
+
+
+ mitk::FiberBundle::Pointer resultingFibers = mitk::FiberBundle::New();
+ resultingFibers->SetGeometry(this->GetGeometry());
+ resultingFibers->SetBounds(this->GetBounds());
+
+ //get Fiber by ID
+ //get childrenList
+ //compare if current FiberID is in idSet
+
+ FiberGroupType::Pointer fiberGroup = this->getGroupFiberBundle();
+ ChildrenListType *FiberList;
+ FiberList = fiberGroup->GetChildren();
+ MITK_INFO << "writing fibers into datastructure:....";
+
+ for (int cg=0; cg<idSet.size(); ++cg) {
+
+ if(cg % 200 == 0){
+ MITK_INFO << "stored: " << cg << " of " << idSet.size();
+ }
+
+ int trctId = idSet.at(cg);
+ resultingFibers->PushTract( m_TractContainer->GetElement(trctId) );
+
+ }
+ MITK_INFO << "init new fiberBundle...";
+ resultingFibers->initFiberGroup();
+ MITK_INFO << "init new fiberBundle [DONE]";
+
+ /*
+ for(ChildrenListType::iterator itLst = FiberList->begin();
+ itLst != FiberList->end();
+ ++itLst)
+ {
+
+ itk::SpatialObject<3>::Pointer tmp_fbr;
+ tmp_fbr = *itLst;
+ mitk::FiberBundle::DTITubeType::Pointer dtiTract = dynamic_cast< mitk::FiberBundle::DTITubeType * > (tmp_fbr.GetPointer());
+ if (dtiTract.IsNull()) {
+ MITK_INFO << "DTI Tract is NULL!!!!! omg";
+ continue; }
+
+ // MITK_INFO << "current DTI tract id: " << dtiTract->GetId();
+
+ std::vector<int>::iterator retFibers = find(idSet.begin(), idSet.end(), dtiTract->GetId());
+
+
+ if (retFibers != idSet.end()) {
+ //MITK_INFO << "Fiber and ID equal: ";
+
+
+ DTITubeType::Pointer copyDTITract = this->copySingleDTITract(dtiTract);
+
+ MITK_INFO << "fibercontainer before adding new tract" << resultingFibers->GetNumTracts();
+ resultingFibers->addSingleDTITract(copyDTITract);
+ MITK_INFO << "fibercontainer after adding new tract" << resultingFibers->GetNumTracts();
+
+
+ }
+ //else {
+ // MITK_INFO << "Fiber and ID not ident!";
+ //}
+
+ //std::set<int>::iterator retFibers
+ //retFibers = idSet.find(dtiTract->GetId());
+
+ } */
+
+ return resultingFibers;
+
+}
+
+
+/* extract fibers using planar Figures */
+//mitk::FiberBundle::Pointer mitk::FiberBundle::extractFibersPF(mitk::PlanarFigure::Pointer pf)
+std::vector<int> mitk::FiberBundle::extractFibersByPF(mitk::PlanarFigure::Pointer pf, std::vector<int>* smaller_set)
+{
+
+ // if incoming pf is a pfc
+ mitk::PlanarFigureComposite::Pointer pfcomp= dynamic_cast<mitk::PlanarFigureComposite*>(pf.GetPointer());
+ if (!pfcomp.IsNull()) {
+ //PFC
+
+
+ switch (pfcomp->getOperationType()) {
+ case 0:
+ {
+ //AND
+ std::vector<int> childResults = this->extractFibersByPF(pfcomp->getChildAt(0), smaller_set);
+ std::vector<int> tmpChild = childResults;
+ for (int i=1; i<pfcomp->getNumberOfChildren(); ++i)
+ {
+ tmpChild = extractFibersByPF(pfcomp->getChildAt(i),&tmpChild);
+ }
+ std::vector<int> AND_Assamblage(tmpChild.begin(), tmpChild.end());
+ return AND_Assamblage;
+ }
+ case 1:
+ {
+ //OR
+ std::vector<int> childResults = this->extractFibersByPF(pfcomp->getChildAt(0), smaller_set);
+ std::sort(childResults.begin(), childResults.end());
+ std::vector<int> tmp_container(m_TractContainer->Size());
+ std::vector<int>::iterator end;
+ for (int i=1; i<pfcomp->getNumberOfChildren(); ++i)
+ {
+ std::vector<int> tmpChild = extractFibersByPF(pfcomp->getChildAt(i), smaller_set);
+ sort(tmpChild.begin(), tmpChild.end());
+
+ end = std::set_union(childResults.begin(), childResults.end(),
+ tmpChild.begin(), tmpChild.end(),
+ tmp_container.begin() );
+
+ childResults.assign(tmp_container.begin(), end);
+
+ }
+
+ std::vector<int> OR_Assamblage(childResults.begin(), childResults.end());
+ return OR_Assamblage;
+ }
+ case 2:
+ {
+ //NOT
+
+ // FIRST AN AND OPERATION
+ std::vector<int> childResults = this->extractFibersByPF(pfcomp->getChildAt(0), smaller_set);
+ std::sort(childResults.begin(), childResults.end());
+ std::vector<int> tmpChild = childResults;
+ for (int i=1; i<pfcomp->getNumberOfChildren(); ++i)
+ {
+ tmpChild = extractFibersByPF(pfcomp->getChildAt(i),&tmpChild);
+ }
+ std::vector<int> AND_Assamblage(tmpChild.begin(), tmpChild.end());
+
+ // get IDs of interesting fibers
+ std::vector<int> interesting_fibers;
+ if(!smaller_set)
+ interesting_fibers = this->getAllIDsInFiberBundle();
+ else
+ interesting_fibers.assign(smaller_set->begin(), smaller_set->end());
+ std::sort(interesting_fibers.begin(), interesting_fibers.end());
+
+ // all interesting fibers that are not in the AND assemblage
+ std::vector<int> tmp_not(interesting_fibers.size());
+ std::vector<int>::iterator end;
+ end = std::set_difference(interesting_fibers.begin(), interesting_fibers.end(),
+ AND_Assamblage.begin(), AND_Assamblage.end(),
+ tmp_not.begin() );
+ std::vector<int> NOT_Assamblage(tmp_not.begin(),end);
+ return NOT_Assamblage;
+
+ }
+ default:
+ MITK_INFO << "we have an UNDEFINED composition... ERROR" ;
+ break;
+
+
+ }
+
+ } else {
+
+ mitk::PlanarCircle::Pointer circleName = mitk::PlanarCircle::New();
+ mitk::PlanarRectangle::Pointer rectName = mitk::PlanarRectangle::New();
+ mitk::PlanarPolygon::Pointer polyName = mitk::PlanarPolygon::New();
+
+ if (pf->GetNameOfClass() == circleName->GetNameOfClass() )
+ {
+ //MITK_INFO << "We have a circle :-) " ;
+
+
+ int cntGaps = 0;
+ //init output FiberBundle
+ mitk::FiberBundle::Pointer FB_Clipped = mitk::FiberBundle::New();
+ FB_Clipped->SetGeometry(this->GetGeometry());
+
+ //get geometry containing the plane which we need to calculate the xrossingPoints
+ mitk::Geometry2D::ConstPointer pfgeometry = pf->GetGeometry2D();
+ const mitk::PlaneGeometry* planeGeometry = dynamic_cast<const mitk::PlaneGeometry*> (pfgeometry.GetPointer());
+ std::vector<mitk::Point3D> XingPoints;
+ std::vector<int> fiberIDs;
+
+
+ //#################################################################
+ //############### Find Gap, FrontFace BackFace ####################
+ //#################################################################
+
+ //get fibercontainer and iterate through the fibers
+ FiberGroupType::Pointer fiberGroup = this->getGroupFiberBundle();
+
+ //extract single fibers
+ ChildrenListType *FiberList;
+ FiberList = fiberGroup->GetChildren();
+
+
+
+ // iterate through each single tract
+ //int cntFibId = -1;
+ for(ChildrenListType::iterator itLst = FiberList->begin();
+ itLst != FiberList->end();
+ ++itLst)
+ {
+
+ //MITK_INFO << "***************** NEW FIBER *********************";
+ //cntFibId++;
+ itk::SpatialObject<3>::Pointer tmp_fbr;
+ tmp_fbr = *itLst;
+ mitk::FiberBundle::DTITubeType::Pointer dtiTract = dynamic_cast< mitk::FiberBundle::DTITubeType * > (tmp_fbr.GetPointer());
+ if (dtiTract.IsNull()) {
+ MITK_INFO << " could not cast groupFiberBundle child into dtiTract!... LEVEL 4 ERROR";
+ continue; }
+
+ if (smaller_set && std::find(smaller_set->begin(), smaller_set->end(), dtiTract->GetId())==smaller_set->end())
+ continue;
+
+ //get list of points
+ int fibrNrPnts = dtiTract->GetNumberOfPoints();
+ mitk::FiberBundle::DTITubeType::PointListType dtiPntList = dtiTract->GetPoints();
+
+ // if one fiber is represented by just one point....
+ // check if this point is on the plane
+ if (fibrNrPnts <= 0)
+ {
+ MITK_INFO << "HyperERROR in mitkFiberBundle.cpp, No point in fiber....check ur algorithm:";
+ continue;
+ }
+
+
+ /* for finding a gap we need to have knowledge of the previous normal
+ * be aware that there can be more than 1 gaps!
+ */
+
+ int prevPntFacing = -999999;
+ int currPntFacing = -999999;
+ //double prevFacing = -99999999099;
+ mitk::Point3D prevFiberPntmm;
+
+ for(int i=0; i<fibrNrPnts; ++i)
+ {
+
+ DTITubePointType tmpFiberPntLst = dtiPntList.at(i);
+ DTITubePointType::PointType tmpFiberPnt = tmpFiberPntLst.GetPosition();
+
+ mitk::Point3D tmpFiberVec;
+ tmpFiberVec[0] = (float)tmpFiberPnt[0];
+ tmpFiberVec[1] = (float)tmpFiberPnt[1];
+ tmpFiberVec[2] = (float)tmpFiberPnt[2];
+
+
+ //calculation has to be done always
+ mitk::Point3D currentFiberPntmm;
+ this->GetGeometry()->IndexToWorld(tmpFiberVec, currentFiberPntmm);
+ double faceing = pfgeometry->SignedDistance(currentFiberPntmm);
+
+ //MITK_INFO << "FacingOutput: " << faceing;
+
+ ///////////////////////////////////////
+
+ if (faceing < 0) {
+ //backface
+ currPntFacing = TRACTPOINT_BACKFACE;
+ //MITK_INFO << "is BACKFACE" << currentFiberPntmm ;
+
+ } else if (faceing > 0) {
+ //frontface
+ currPntFacing = TRACTPOINT_FRNTFACE;
+ // MITK_INFO << "is FRONTFACE" << currentFiberPntmm ;
+
+ } else if (faceing == 0) {
+ //onplane
+ currPntFacing = TRACTPOINT_ON_PLANE;
+ //MITK_INFO << "is on PLANE" << currentFiberPntmm ;
+ }
+
+
+ ////////////////////////////////////////
+
+
+ if (currPntFacing == TRACTPOINT_ON_PLANE)
+ { //strike,
+ //calculate distance
+ //TODO SOURCE THIS CONTROLSTRUCTURE OUT
+ if(isPointInSelection(tmpFiberVec,pf))
+ {
+ DTITubeType::Pointer copyDTITract = copySingleDTITract(dtiTract);
+ //MITK_INFO << "GroupFB extract after copy of Children: " << fiberGroup->GetNumberOfChildren();
+
+ FB_Clipped->addSingleDTITract(copyDTITract);
+ }
+
+
+ } else {
+ // Point is BACKFACE or FRONTFACE
+ if (i > 0)
+ {
+ //check if there is a gap between previous and current
+ bool isGap = checkForGap(currPntFacing, prevPntFacing);
+
+ if (isGap == true) {
+ ++cntGaps;
+
+ //
+ mitk::Vector3D LineDirection;
+ LineDirection[0] = currentFiberPntmm[0] - prevFiberPntmm[0];
+ LineDirection[1] = currentFiberPntmm[1] - prevFiberPntmm[1];
+ LineDirection[2] = currentFiberPntmm[2] - prevFiberPntmm[2];
+
+
+ mitk::Line3D Xingline( prevFiberPntmm, LineDirection );
+
+ mitk::Point3D intersectionPoint;
+
+ Vector3D planeNormal = planeGeometry->GetNormal();
+ planeNormal.Normalize();
+
+ Vector3D lineDirection = Xingline.GetDirection();
+ lineDirection.Normalize();
+
+ double t = planeNormal * lineDirection;
+ if ( fabs( t ) < eps )
+ {
+
+ }
+
+ Vector3D diff;
+ diff = planeGeometry->GetOrigin() - Xingline.GetPoint();
+ t = ( planeNormal * diff ) / t;
+
+ intersectionPoint = Xingline.GetPoint() + lineDirection * t;
+ // bool successXing = planeGeometry->IntersectionPoint( Xingline, intersectionPoint );
+ //mitk::Point3D intersectionPointmm;
+ //planeGeometry->IndexToWorld(intersectionPoint,intersectionPointmm );
+
+ // MITK_INFO << "PlaneIntersectionPoint: " << intersectionPoint;
+
+ if (false) {
+ MITK_INFO << " ERROR CALCULATING INTERSECTION POINT.....should not happen!! ";
+ }
+ //TODO more nice if this if is outside...
+ bool pntInROI = isPointInSelection(intersectionPoint,pf);
+ if(pntInROI)
+ {
+ // MITK_INFO << "POINT ALSO in ROI";
+
+ // MITK_INFO << "GroupFB extract before copy new object. of Children: " << fiberGroup->GetNumberOfChildren();
+ /* dtiTubeSpatial::Pointer can not occur in 2 GroupSpatialObjects, therefore we have to copy the whole dtiTract of current List and add the copy to the desired FiberBundle */
+
+ // DTITubeType::Pointer copyDTITract = copySingleDTITract(dtiTract);
+ // MITK_INFO << "GroupFB extract after copy of Children: " << fiberGroup->GetNumberOfChildren();
+
+ //FB_Clipped->addSingleDTITract(copyDTITract);
+
+ //MITK_INFO << "GroupFB extract after adding dtiTract to now FB NR. of Children: " << fiberGroup->GetNumberOfChildren();
+ //MITK_INFO << "DTI Tract ID: " << dtiTract->GetId();
+ // MITK_INFO << "size of Vector before pushing: " << fiberIDs.size();
+ fiberIDs.push_back(dtiTract->GetId());
+ // MITK_INFO << "size of Vector after pushing: " << fiberIDs.size();
+ //MITK_INFO << "GroupFB extract after adding dtiTract to now FB NR. of Children: " << fiberGroup->GetNumberOfChildren();
+ break;
+
+
+ }
+
+ }
+
+ // MITK_INFO << "---no gap---";
+
+ } //endif i>0
+
+
+ } //endif Facing
+ // MITK_INFO << "GroupFB extract end Facing, NR. of Children: " << fiberGroup->GetNumberOfChildren();
+
+
+ //update point flag
+ prevPntFacing = currPntFacing;
+ prevFiberPntmm = currentFiberPntmm;
+ } //end for fiberPoints
+ //MITK_INFO ;<< "GroupFB extract end of single tract, NR. of Children: " << fiberGroup->GetNumberOfChildren();
+
+ } //end for fiberTracts
+ // MITK_INFO << "GroupFB extract end of iterating through fiberBundle, NR. of Children: " << fiberGroup->GetNumberOfChildren();
+
+ // MITK_INFO << "selected " << fiberIDs.size() << " fibers " << " | counted gaps: " << cntGaps;
+ return fiberIDs;
+
+
+
+
+
+
+ } else if (pf->GetNameOfClass() == rectName->GetNameOfClass() ){
+
+ MITK_INFO << "We have a rectangle :-) " ;
+
+ } else if (pf->GetNameOfClass() == polyName->GetNameOfClass() ) {
+
+ //MITK_INFO << "We have a polygon :-) " ;
+ int cntGaps = 0;
+ //init output FiberBundle
+ mitk::FiberBundle::Pointer FB_Clipped = mitk::FiberBundle::New();
+ FB_Clipped->SetGeometry(this->GetGeometry());
+
+ //get geometry containing the plane which we need to calculate the xrossingPoints
+ mitk::Geometry2D::ConstPointer pfgeometry = pf->GetGeometry2D();
+ const mitk::PlaneGeometry* planeGeometry = dynamic_cast<const mitk::PlaneGeometry*> (pfgeometry.GetPointer());
+ std::vector<mitk::Point3D> XingPoints;
+ std::vector<int> fiberIDs;
+
+
+ //#################################################################
+ //############### Find Gap, FrontFace BackFace ####################
+ //#################################################################
+
+ //get fibercontainer and iterate through the fibers
+ FiberGroupType::Pointer fiberGroup = this->getGroupFiberBundle();
+
+ //extract single fibers
+ ChildrenListType *FiberList;
+ FiberList = fiberGroup->GetChildren();
+ int nrFibrs = fiberGroup->GetNumberOfChildren();
+
+
+
+ // iterate through each single tract
+ int cntFib = 1;
+ for(ChildrenListType::iterator itLst = FiberList->begin();
+ itLst != FiberList->end();
+ ++itLst)
+ {
+ if (cntFib % 500 == 0) {
+ MITK_INFO << "================\n prosessed fibers: " << cntFib << " of " << nrFibrs;;
+ }
+ ++cntFib;
+
+
+
+ //MITK_INFO << "***************** NEW FIBER *********************";
+ //cntFibId++;
+ itk::SpatialObject<3>::Pointer tmp_fbr;
+ tmp_fbr = *itLst;
+ mitk::FiberBundle::DTITubeType::Pointer dtiTract = dynamic_cast< mitk::FiberBundle::DTITubeType * > (tmp_fbr.GetPointer());
+ if (dtiTract.IsNull()) {
+ MITK_INFO << " could not cast groupFiberBundle child into dtiTract!... LEVEL 4 ERROR";
+ continue; }
+
+ if (smaller_set && std::find(smaller_set->begin(), smaller_set->end(), dtiTract->GetId())==smaller_set->end())
+ continue;
+
+
+
+ //get list of points
+ int fibrNrPnts = dtiTract->GetNumberOfPoints();
+ mitk::FiberBundle::DTITubeType::PointListType dtiPntList = dtiTract->GetPoints();
+
+ // if one fiber is represented by just one point....
+ // check if this point is on the plane
+ if (fibrNrPnts <= 0)
+ {
+ MITK_INFO << "HyperERROR in mitkFiberBundle.cpp, No point in fiber....check ur algorithm:";
+ continue;
+ }
+
+
+ /* for finding a gap we need to have knowledge of the previous normal
+ * be aware that there can be more than 1 gaps!
+ */
+
+ int prevPntFacing = -999999;
+ int currPntFacing = -999999;
+ //double prevFacing = -99999999099;
+ mitk::Point3D prevFiberPntmm;
+
+
+
+ for(int i=0; i<fibrNrPnts; ++i)
+ {
+
+ DTITubePointType tmpFiberPntLst = dtiPntList.at(i);
+ DTITubePointType::PointType tmpFiberPnt = tmpFiberPntLst.GetPosition();
+
+ mitk::Point3D tmpFiberVec;
+ tmpFiberVec[0] = (float)tmpFiberPnt[0];
+ tmpFiberVec[1] = (float)tmpFiberPnt[1];
+ tmpFiberVec[2] = (float)tmpFiberPnt[2];
+
+
+ //calculation has to be done always
+ mitk::Point3D currentFiberPntmm;
+ this->GetGeometry()->IndexToWorld(tmpFiberVec, currentFiberPntmm);
+ double faceing = pfgeometry->SignedDistance(currentFiberPntmm);
+
+ //MITK_INFO << "FacingOutput: " << faceing;
+
+ ///////////////////////////////////////
+
+ if (faceing < 0) {
+ //backface
+ currPntFacing = TRACTPOINT_BACKFACE;
+ //MITK_INFO << "is BACKFACE" << currentFiberPntmm ;
+
+ } else if (faceing > 0) {
+ //frontface
+ currPntFacing = TRACTPOINT_FRNTFACE;
+ // MITK_INFO << "is FRONTFACE" << currentFiberPntmm ;
+
+ } else if (faceing == 0) {
+ //onplane
+ currPntFacing = TRACTPOINT_ON_PLANE;
+ //MITK_INFO << "is on PLANE" << currentFiberPntmm ;
+ }
+
+
+ ////////////////////////////////////////
+
+
+ if (currPntFacing == TRACTPOINT_ON_PLANE)
+ { //strike,
+ //calculate distance
+ //TODO SOURCE THIS CONTROLSTRUCTURE OUT
+ if(isPointInSelection(tmpFiberVec,pf))
+ {
+ DTITubeType::Pointer copyDTITract = copySingleDTITract(dtiTract);
+ //MITK_INFO << "GroupFB extract after copy of Children: " << fiberGroup->GetNumberOfChildren();
+
+ FB_Clipped->addSingleDTITract(copyDTITract);
+ }
+
+
+ } else {
+ // Point is BACKFACE or FRONTFACE
+ if (i > 0)
+ {
+ //check if there is a gap between previous and current
+ bool isGap = checkForGap(currPntFacing, prevPntFacing);
+
+ if (isGap == true) {
+ ++cntGaps;
+
+ //
+ mitk::Vector3D LineDirection;
+ LineDirection[0] = currentFiberPntmm[0] - prevFiberPntmm[0];
+ LineDirection[1] = currentFiberPntmm[1] - prevFiberPntmm[1];
+ LineDirection[2] = currentFiberPntmm[2] - prevFiberPntmm[2];
+
+
+ mitk::Line3D Xingline( prevFiberPntmm, LineDirection );
+
+ mitk::Point3D intersectionPoint;
+
+ Vector3D planeNormal = planeGeometry->GetNormal();
+ planeNormal.Normalize();
+
+ Vector3D lineDirection = Xingline.GetDirection();
+ lineDirection.Normalize();
+
+ double t = planeNormal * lineDirection;
+ if ( fabs( t ) < eps )
+ {
+
+ }
+
+ Vector3D diff;
+ diff = planeGeometry->GetOrigin() - Xingline.GetPoint();
+ t = ( planeNormal * diff ) / t;
+
+ intersectionPoint = Xingline.GetPoint() + lineDirection * t;
+ // bool successXing = planeGeometry->IntersectionPoint( Xingline, intersectionPoint );
+ //mitk::Point3D intersectionPointmm;
+ //planeGeometry->IndexToWorld(intersectionPoint,intersectionPointmm );
+
+ // MITK_INFO << "PlaneIntersectionPoint: " << intersectionPoint;
+
+ if (false) {
+ MITK_INFO << " ERROR CALCULATING INTERSECTION POINT.....should not happen!! ";
+ }
+ //TODO more nice if this if is outside...
+ bool pntInROI = isPointInSelection(intersectionPoint,pf);
+ if(pntInROI)
+ {
+ // MITK_INFO << "POINT ALSO in ROI";
+
+ // MITK_INFO << "GroupFB extract before copy new object. of Children: " << fiberGroup->GetNumberOfChildren();
+ /* dtiTubeSpatial::Pointer can not occur in 2 GroupSpatialObjects, therefore we have to copy the whole dtiTract of current List and add the copy to the desired FiberBundle */
+
+ // DTITubeType::Pointer copyDTITract = copySingleDTITract(dtiTract);
+ // MITK_INFO << "GroupFB extract after copy of Children: " << fiberGroup->GetNumberOfChildren();
+
+ //FB_Clipped->addSingleDTITract(copyDTITract);
+
+ //MITK_INFO << "GroupFB extract after adding dtiTract to now FB NR. of Children: " << fiberGroup->GetNumberOfChildren();
+ //MITK_INFO << "DTI Tract ID: " << dtiTract->GetId();
+ // MITK_INFO << "size of Vector before pushing: " << fiberIDs.size();
+ fiberIDs.push_back(dtiTract->GetId());
+ // MITK_INFO << "size of Vector after pushing: " << fiberIDs.size();
+ //MITK_INFO << "GroupFB extract after adding dtiTract to now FB NR. of Children: " << fiberGroup->GetNumberOfChildren();
+ break;
+
+
+ }
+
+ }
+
+ // MITK_INFO << "---no gap---";
+
+ } //endif i>0
+
+
+ } //endif Facing
+ // MITK_INFO << "GroupFB extract end Facing, NR. of Children: " << fiberGroup->GetNumberOfChildren();
+
+
+ //update point flag
+ prevPntFacing = currPntFacing;
+ prevFiberPntmm = currentFiberPntmm;
+ } //end for fiberPoints
+ //MITK_INFO ;<< "GroupFB extract end of single tract, NR. of Children: " << fiberGroup->GetNumberOfChildren();
+
+ } //end for fiberTracts
+ // MITK_INFO << "GroupFB extract end of iterating through fiberBundle, NR. of Children: " << fiberGroup->GetNumberOfChildren();
+
+ // MITK_INFO << "selected " << fiberIDs.size() << " fibers " << " | counted gaps: " << cntGaps;
+ return fiberIDs;
+
+
+ } else {
+
+ MITK_INFO << "[ERROR] unhandled PlanarFigureType found!";
+ }
+
+ }
+
+
+
+
+
+
+
+
+
+
+}
+
+
+mitk::FiberBundle::DTITubeType::Pointer mitk::FiberBundle::copySingleDTITract(mitk::FiberBundle::DTITubeType::Pointer currentDtiFiber)
+{
+
+ DTITubeType::Pointer newCopyDtiFiber = DTITubeType::New();
+ //*** get ID
+ newCopyDtiFiber->SetId( currentDtiFiber->GetId() );
+
+ //*** get points
+ DTITubeType::PointListType list;
+
+
+ //get list of dtiPoints
+ int fibrNrPnts = currentDtiFiber->GetNumberOfPoints();
+ mitk::FiberBundle::DTITubeType::PointListType dtiPntList = currentDtiFiber->GetPoints();
+
+ for(int i=0; i<fibrNrPnts; ++i)
+ {
+
+ DTITubePointType tmpFiberPntLst = dtiPntList.at(i);
+ //coordinate Point
+ //DTITubePointType::PointType tmpFiberPnt = tmpFiberPntLst.GetPosition();
+
+ DTITubePointType p;
+ //p.SetPosition(tmpFiberPnt[0], tmpFiberPnt[1], tmpFiberPnt[2]);
+ p.SetPosition(tmpFiberPntLst.GetPosition());
+ p.SetRadius(tmpFiberPntLst.GetRadius());
+ p.AddField(DTITubePointType::GA, tmpFiberPntLst.GetField(DTITubePointType::GA));
+ p.AddField(DTITubePointType::FA, tmpFiberPntLst.GetField(DTITubePointType::FA));
+ p.AddField(DTITubePointType::ADC, tmpFiberPntLst.GetField(DTITubePointType::ADC));
+ p.SetTensorMatrix(tmpFiberPntLst.GetTensorMatrix());
+ p.SetColor(tmpFiberPntLst.GetColor());
+ list.push_back(p);
+
+ }
+
+ newCopyDtiFiber->SetPoints(list);
+ std::string dtiname = currentDtiFiber->GetProperty()->GetName();
+ newCopyDtiFiber->GetProperty()->SetName(dtiname.c_str());
+
+
+
+ return newCopyDtiFiber;
+
+
+}
+
+
+
+
+/* This Method checks
+ * To recognize a gap between the 2 points, the previous must differ from the current
+ * but if the previous is on the plane and the current one not, then mark this situation as no gap
+ * if both, previous and current are on plane, you'll never jump into this Method
+ */
+bool mitk::FiberBundle::checkForGap(int crntPntFacing, int prevPntFacing)
+{
+
+ bool isGap = false;
+ if (prevPntFacing != TRACTPOINT_ON_PLANE && crntPntFacing != prevPntFacing)
+ {
+ isGap = true;
+
+ } else if (prevPntFacing == TRACTPOINT_ON_PLANE && crntPntFacing == TRACTPOINT_ON_PLANE) {
+ MITK_INFO << "###########################################";
+ MITK_INFO << "$$$ HYPER ERROR, LOGIC MALFUNCTION!! previous point and current point in a fiber are recognized as a potential GAP! THIS IS NOT ALLOWED $$$";
+ MITK_INFO << "###########################################";
+ }
+
+ return isGap;
+
+}
+
+mitk::Point3D mitk::FiberBundle::calculateCrossingPoint(mitk::Point3D pntFrnt, mitk::Point3D pntbck, mitk::PlanarFigure::Pointer pf)
+{
+
+ mitk::Point3D pntXing;
+
+ //#################################################################
+ //######### Calculate intersection of plane and fiber #############
+ //#################################################################
+
+ // transform in space :-)
+
+ // y = k*x +d
+ // k = (y1 - y0)/(x1 - x0)
+ // d = ok
+
+ // z adoption, take xy ratio to plane intersection and adopt it to z coordinate
+ // z_intersx = (x1 - intersX)/(x1 - x0) * (z1 - z0) + z1
+
+ double y;
+ double k; //slope
+ double d;
+
+ double x0 = pntFrnt[0];
+ double y0 = pntFrnt[1];
+ double z0 = pntFrnt[2];
+ double x1 = pntbck[0];
+ double y1 = pntbck[1];
+ double z1 = pntbck[2];
+
+ k = (y1 - y0) / (x1 - x0);
+
+ // if slope == 0 then leave y as it is, change x
+
+ // if slope == 1 then leave x as it is, change y
+
+ // if z of p0 and p1 is the same, just take z
+
+
+ /*
+
+ mitk::PlanarCircle::Pointer circleName = mitk::PlanarCircle::New();
+ mitk::PlanarRectangle::Pointer rectName = mitk::PlanarRectangle::New();
+ mitk::PlanarPolygon::Pointer polyName = mitk::PlanarPolygon::New();
+
+ if (pf->GetNameOfClass() == circleName->GetNameOfClass() )
+ {
+ MITK_INFO << "We have a circle :-) " ;
+ //controlpoint 1 is middlepoint
+ //controlpoint 2 is radiuspoint
+ mitk::Vector3D V1w = pf->GetWorldControlPoint(0); //centerPoint
+ mitk::Vector3D V2w = pf->GetWorldControlPoint(1); //radiusPoint
+ mitk::Vector3D V1;
+ mitk::Vector3D V2;
+ this->GetGeometry()->WorldToIndex(V1w, V1);
+ this->GetGeometry()->WorldToIndex(V2w, V2);
+
+ //calculate distance between those 2 and
+ mitk::Point3D distV;
+ distV = V2 - V1;
+ distV[0] = sqrt( pow(distV[0], 2.0) );
+ distV[1] = sqrt( pow(distV[1], 2.0) );
+ distV[2] = sqrt( pow(distV[2], 2.0) );
+
+ mitk::Point3D distPnt;
+ distPnt = pnt3D - V1;
+ distPnt[0] = sqrt( pow(distPnt[0], 2.0) );
+ distPnt[1] = sqrt( pow(distPnt[1], 2.0) );
+ distPnt[2] = sqrt( pow(distPnt[2], 2.0) );
+
+ if ( (distPnt <= distV) ) {
+ pntIsInside = true;
+
+
+ }
+
+ return pntIsInside;
+
+ //compare the result to the distance of all points an a fiber
+
+
+
+
+
+ } else if (pf->GetNameOfClass() == rectName->GetNameOfClass() ){
+
+ MITK_INFO << "We have a rectangle :-) " ;
+
+ } else if (pf->GetNameOfClass() == polyName->GetNameOfClass() ) {
+
+ MITK_INFO << "We have a polygon :-) " ;
+ }
+
+ */
+
+ return pntXing;
+
+
+}
+
+
+bool mitk::FiberBundle::isPointInSelection(mitk::Point3D pnt3D, mitk::PlanarFigure::Pointer pf)
+{
+ /* TODO needs to be redesigned.... each time because in planarPolygonsection VTK object will be initialized for each point!...PERFORMANCE LACK!!!!!!! */
+
+
+ //calculate distances
+ mitk::PlanarCircle::Pointer circleName = mitk::PlanarCircle::New();
+ mitk::PlanarRectangle::Pointer rectName = mitk::PlanarRectangle::New();
+ mitk::PlanarPolygon::Pointer polyName = mitk::PlanarPolygon::New();
+
+ if (pf->GetNameOfClass() == circleName->GetNameOfClass() )
+ {
+ //MITK_INFO << "We have a circle :-) " ;
+ //controlpoint 1 is middlepoint
+ //controlpoint 2 is radiuspoint
+ mitk::Point3D V1w = pf->GetWorldControlPoint(0); //centerPoint
+ mitk::Point3D V2w = pf->GetWorldControlPoint(1); //radiusPoint
+ mitk::Vector3D V1;
+ mitk::Vector3D V2;
+ // this->GetGeometry()->WorldToIndex(V1w, V1);
+ // this->GetGeometry()->WorldToIndex(V2w, V2);
+
+ //calculate distance between those 2 and
+ double distPF;
+ distPF = sqrt((double) (V2w[0] - V1w[0]) * (V2w[0] - V1w[0]) +
+ (V2w[1] - V1w[1]) * (V2w[1] - V1w[1]) +
+ (V2w[2] - V1w[2]) * (V2w[2] - V1w[2]));
+
+ double XdistPnt = sqrt((double) (pnt3D[0] - V1w[0]) * (pnt3D[0] - V1w[0]) +
+ (pnt3D[1] - V1w[1]) * (pnt3D[1] - V1w[1]) +
+ (pnt3D[2] - V1w[2]) * (pnt3D[2] - V1w[2])) ;
+
+
+
+ if ( (distPF > XdistPnt) ) {
+ return true;
+
+ }
+
+ return false;
+
+ //compare the result to the distance of all points an a fiber
+
+
+ }
+
+
+
+ else if (pf->GetNameOfClass() == rectName->GetNameOfClass() ){
+
+ MITK_INFO << "We have a rectangle :-) " ;
+
+
+ } else if (pf->GetNameOfClass() == polyName->GetNameOfClass() ) {
+
+
+ //create vtkPolygon using controlpoints from planarFigure polygon
+ vtkPolygon* polygonVtk = vtkPolygon::New();
+
+
+ //get the control points from pf and insert them to vtkPolygon
+ unsigned int nrCtrlPnts = pf->GetNumberOfControlPoints();
+ // MITK_INFO << "We have a polygon with " << nrCtrlPnts << " controlpoints: " ;
+
+ for (int i=0; i<nrCtrlPnts; ++i)
+ {
+ polygonVtk->GetPoints()->InsertNextPoint((double)pf->GetWorldControlPoint(i)[0], (double)pf->GetWorldControlPoint(i)[1], (double)pf->GetWorldControlPoint(i)[2] );
+
+
+ }
+
+ //prepare everything for using pointInPolygon function
+ double n[3];
+ polygonVtk->ComputeNormal(polygonVtk->GetPoints()->GetNumberOfPoints(),
+ static_cast<double*>(polygonVtk->GetPoints()->GetData()->GetVoidPointer(0)), n);
+
+ double bounds[6];
+ polygonVtk->GetPoints()->GetBounds(bounds);
+
+ double checkIn[3] = {pnt3D[0], pnt3D[1], pnt3D[2]};
+
+ int isInPolygon = polygonVtk->PointInPolygon(checkIn, polygonVtk->GetPoints()->GetNumberOfPoints()
+ , static_cast<double*>(polygonVtk->GetPoints()->GetData()->GetVoidPointer(0)), bounds, n);
+
+ // MITK_INFO << "======IsPointOnPolygon:========\n" << isInPolygon << "\n ======================== ";
+
+ polygonVtk->Delete();
+
+ if (isInPolygon == 1)
+ {
+ // MITK_INFO << "return true";
+ return true;
+
+
+ } else if (isInPolygon == 0)
+ {
+ // MITK_INFO << "return false";
+ return false;
+
+ } else {
+
+ MITK_INFO << "&*&*&*&*&*&*&*&*&*&*&*&*&*&*&*&*&*& \n YOUR DRAWN POLYGON DOES IS DEGENERATED AND NOT ACCEPTED \n DRAW A NEW ONE!! HAI CAPITO \n &*&*&*&*&*&*&*&*&*&*&*&*&*&*&*&*&*&";
+ }
+
+
+
+
+
+ }
+
+
+}
+
+
+void mitk::FiberBundle::debug_members()
+{
+ /* Debug Workflow description
+ * Test1: check if both, groupSpatialObject and Tract container have the same amount of fiberTracts
+ * Test2: check if points in tracts contain the same coordinates
+ * next... to be continued
+ */
+
+
+ /* ######### TEST 1 START ######### */
+ //*************************************
+ MITK_INFO << " ############### \n *** TEST Equal Amount of Fibers *** \n ";
+
+ unsigned int groupEls = m_GroupFiberBundle->GetNumberOfChildren();
+ unsigned int contEls = m_TractContainer->Size();
+ unsigned int itkcontEls = m_debugITKContainer->Size();
+
+ if (groupEls == contEls && contEls == itkcontEls)
+ {
+ MITK_INFO << "[OK] .... Test1 passed. # of Fibers: " << groupEls << " \n ******************** ";
+ } else {
+
+ MITK_INFO << "[FAIL]: Container and FiberGroup do not contain same amount of fibers! \n ";
+ // MITK_INFO << " Container # of Fibers: " << contEls << " | FiberBundle # of Fibers: " << groupEls << "\n";
+ MITK_INFO << " # of Fibers m_Cont: " << contEls << " | GroupFibers: " << groupEls << " | ITKCont: " << itkcontEls << "\n";
+ }
+ /* ######### TEST 1 END ######### */
+ //***********************************
+
+
+
+ /* ######### TEST 2 START ######### */
+ //*************************************
+
+ /* iterate through itkcontainer*/
+ itkStochTractContainerType::ConstIterator itITKCnt;
+ itITKCnt = m_debugITKContainer->Begin();
+
+ /* extract DTIFiberTracts of the GroupFiberBundle Object */
+ // all smartPointers to fibers stored in in a ChildrenList
+ ChildrenListType * FiberList;
+ FiberList = m_GroupFiberBundle->GetChildren();
+ /* iterate through container, itkcontainer groupFiberBundle in one iteration step */
+ ChildrenListType::iterator itLst; //STL "list" itself provides no index output of current iteration step.
+ itLst = FiberList->begin();
+
+
+ ContainerType::ConstIterator vecIter;
+ for ( vecIter = m_TractContainer->Begin();
+ vecIter != m_TractContainer->End();
+ vecIter++ )
+ {
+
+ unsigned int itIdx = vecIter->Index();
+ MITK_INFO << "FiberIteration: " << itIdx << "\n" ;
+
+ //get single tract of container
+ ContainerTractType::Pointer contTract = vecIter->Value();
+ int contNrPnts = contTract->Size();
+
+ //get singel tract of itkContainer
+ itkStochTractType::Pointer itkcontTract = itITKCnt->Value();
+ itkStochTractType::VertexListType::ConstPointer itkcontVrtx = itkcontTract->GetVertexList();
+ int itkcontNrPnts = itkcontVrtx->Size();
+
+ /* lists output is SpatialObject, we know we have DTITubeSpacialObjects
+ dynamic cast only likes pointers, no smartpointers, so each dsmartpointer has membermethod .GetPointer() */
+ itk::SpatialObject<3>::Pointer tmp_fbr;
+ tmp_fbr = *itLst;
+ DTITubeType::Pointer dtiTract = dynamic_cast<DTITubeType * > (tmp_fbr.GetPointer());
+ if (dtiTract.IsNull()) {
+ MITK_INFO << " ############### *** ERRROR *** ############### \n ############### *** ERRROR *** ############### \n ############### *** ERRROR *** ############### \n ";
+ return; }
+
+ //get points of tract
+ int fibrNrPnts = dtiTract->GetNumberOfPoints();
+ DTITubeType::PointListType dtiPntList = dtiTract->GetPoints();
+
+ MITK_INFO << " ############### \n *** TEST Equal Amount of Points in Tract *** \n ";
+
+ if (contNrPnts == itkcontNrPnts && itkcontNrPnts == fibrNrPnts) {
+ MITK_INFO << "[OK] .... Test2 passed. # of Points in fiber: " << fibrNrPnts << " \n ******************** ";
+
+ } else {
+ MITK_INFO << "[FAIL]: Tracts do not contain same amount of points! \n ";
+ MITK_INFO << " # of Points m_Cont: " << contNrPnts << " | GroupFibers: " << fibrNrPnts << " | ITKCont: " << itkcontNrPnts << "\n";
+ }
+
+
+
+
+ //use for()loop with index instead of iterator cuz of accessing more elements, std vectors provide no index output
+ for(int ip=0; ip<contNrPnts; ++ip)
+ {
+
+ //get point from container
+ ContainerPointType tmpcontPnt = contTract->GetElement(ip);
+
+ //get point from itkStochContainer
+ itkStochTractType::VertexType itkPnt = itkcontVrtx->GetElement(ip);
+
+ //get point from dtiGroup
+ DTITubePointType tmpDtiPnt = dtiPntList.at(ip);
+ DTITubePointType::PointType dtiPoint = tmpDtiPnt.GetPosition();
+
+
+ if (tmpcontPnt[0] == (float)itkPnt[0] && (float)itkPnt[0] == (float)dtiPoint[0]) {
+ MITK_INFO << "TractCont | ITKCont | DTIGroup X: " << tmpcontPnt[0] << "...TEST [OK] " << "\n";
+ }else{
+ MITK_INFO << "TractCont | ITKCont | DTIGroup X: " << tmpcontPnt[0] << " " << itkPnt[0] << " " << dtiPoint[0] << "...TEST ##### [FAIL] \n";
+ }
+
+ if (tmpcontPnt[1] == (float)itkPnt[1] && (float)itkPnt[1] == (float)dtiPoint[1]) {
+ MITK_INFO << "TractCont | ITKCont | DTIGroup Y: " << tmpcontPnt[1] << "...TEST [OK] " << "\n";
+ }else{
+ MITK_INFO << "TractCont | ITKCont | DTIGroup Y: " << tmpcontPnt[1] << " " << itkPnt[1] << " " << dtiPoint[1] << "\n";
+ }
+
+ if (tmpcontPnt[2] == (float)itkPnt[2] && (float)itkPnt[2] == (float)dtiPoint[2]) {
+ MITK_INFO << "TractCont | ITKCont | DTIGroup Z: " << tmpcontPnt[2] << "...TEST [OK] " << "\n";
+ }else{
+ MITK_INFO << "TractCont | ITKCont | DTIGroup Z: " << tmpcontPnt[2] << " " << itkPnt[2] << " " << dtiPoint[2] << "\n";
+ }
+
+ }
+ ++itITKCnt;
+ ++itLst;
+ }
+
+}
+
+vtkPolyData* mitk::FiberBundle::GeneratePolydata()
+{
+ MITK_INFO << "writing polydata";
+ //extractn single fibers
+ //in the groupFiberBundle all smartPointers to single fibers are stored in in a ChildrenList
+ mitk::FiberBundle::ChildrenListType * FiberList;
+ FiberList = this->m_GroupFiberBundle->GetChildren();
+
+ /* ######## FIBER PREPARATION END ######### */
+
+ /* ######## VTK FIBER REPRESENTATION ######## */
+ //create a vtkPoints object and store the all the brainFiber points in it
+ vtkPoints *vtkpoints = vtkPoints::New();
+
+ //in vtkcells all polylines are stored, actually all id's of them are stored
+ vtkCellArray *vtkcells = vtkCellArray::New();
+
+ //in some cases a fiber includes just 1 point, so put it in here
+ vtkCellArray *vtkVrtxs = vtkCellArray::New();
+
+ //colors and alpha value for each single point, RGBA = 4 components
+ vtkUnsignedCharArray *colorsT = vtkUnsignedCharArray::New();
+ colorsT->SetNumberOfComponents(4);
+ colorsT->SetName("ColorValues");
+
+ vtkDoubleArray *faColors = vtkDoubleArray::New();
+ faColors->SetName("FaColors");
+
+ //vtkDoubleArray *tubeRadius = vtkDoubleArray::New();
+ //tubeRadius->SetName("TubeRadius");
+
+
+ // iterate through FiberList
+ for(mitk::FiberBundle::ChildrenListType::iterator itLst = FiberList->begin();
+ itLst != FiberList->end();
+ ++itLst)
+ {
+ //all points are stored in one vtkpoints list, soooooooo that the lines find their point id to start and end we need some kind of helper index who monitors the current ids for a polyline
+ unsigned long pntIdxHelper = vtkpoints->GetNumberOfPoints();
+
+ // lists output is SpatialObject, we know we have DTITubeSpacialObjects
+ // dynamic cast only likes pointers, no smartpointers, so each dsmartpointer has membermethod .GetPointer()
+ itk::SpatialObject<3>::Pointer tmp_fbr;
+ tmp_fbr = *itLst;
+ mitk::FiberBundle::DTITubeType::Pointer dtiTract = dynamic_cast< mitk::FiberBundle::DTITubeType * > (tmp_fbr.GetPointer());
+ if (dtiTract.IsNull()) {
+ return NULL; }
+
+ //get list of points
+ int fibrNrPnts = dtiTract->GetNumberOfPoints();
+ mitk::FiberBundle::DTITubeType::PointListType dtiPntList = dtiTract->GetPoints();
+
+ //create a new polyline for a dtiTract
+ //smartpointer
+ vtkPolyLine *polyLine = vtkPolyLine::New();
+ polyLine->GetPointIds()->SetNumberOfIds(fibrNrPnts);
+ unsigned char rgba[4] = {255,255,255,255};
+
+ //tubeRadius->SetNumberOfTuples(fibrNrPnts);
+ //double tbradius = 1;//default value for radius
+
+ if (fibrNrPnts <= 0) { //this should never occour! but who knows
+ MITK_INFO << "HyperERROR in fiberBundleMapper3D.cpp ...no point in fiberBundle!!! .. check ur trackingAlgorithm";
+ continue;
+ }
+
+
+ for (int i=0; i<fibrNrPnts; ++i)
+ {
+ mitk::FiberBundle::DTITubePointType tmpFiberPntLst = dtiPntList.at(i);
+ mitk::FiberBundle::DTITubePointType::PointType tmpFiberPnt = tmpFiberPntLst.GetPosition();
+
+ float tmpvtkPnt[3] = {(float)tmpFiberPnt[0], (float)tmpFiberPnt[1], (float)tmpFiberPnt[2]};
+
+ mitk::Point3D indexPnt(tmpvtkPnt);
+ mitk::Point3D worldPnt;
+
+ // MITK_INFO << tmpFiberPnt[0] << " " << tmpFiberPnt[1] << " " << tmpFiberPnt[2];
+ // MITK_INFO << worldPnt[0] << " " << worldPnt[1] << " " << worldPnt[2];
+
+ this->GetGeometry()->IndexToWorld(indexPnt, worldPnt);
+ double worldFbrPnt[3] = {worldPnt[0], worldPnt[1], worldPnt[2]};
+ vtkpoints->InsertNextPoint(worldFbrPnt);
+
+ // tubeRadius->SetTuple1(i,tbradius); //tuple with 1 argument
+
+
+ if (fibrNrPnts == 1) {
+ // if there ist just 1 point in a fiber...wtf, but however represent it as a point
+ vtkVertex *vrtx = vtkVertex::New();
+ vrtx->GetPointIds()->SetNumberOfIds(1);
+ vrtx->GetPointIds()->SetId(i,i+pntIdxHelper);
+ colorsT->InsertNextTupleValue(rgba);
+ vtkVrtxs->InsertNextCell(vrtx);
+
+ } else {
+
+ polyLine->GetPointIds()->SetId(i,i+pntIdxHelper);
+
+ //colorcoding orientation based
+ if (i<fibrNrPnts-1 && i>0)
+ {
+ //nimm nur diff1
+ mitk::FiberBundle::DTITubePointType nxttmpFiberPntLst = dtiPntList.at(i+1);
+ mitk::FiberBundle::DTITubePointType::PointType nxttmpFiberPnt = nxttmpFiberPntLst.GetPosition();
+ //double nxttmpvtkPnt[3] = {nxttmpFiberPnt[0], nxttmpFiberPnt[1], nxttmpFiberPnt[2]};
+
+ vnl_vector_fixed< double, 3 > tmpPntvtk((double)tmpvtkPnt[0], (double)tmpvtkPnt[1],(double)tmpvtkPnt[2]);
+ vnl_vector_fixed< double, 3 > nxttmpPntvtk(nxttmpFiberPnt[0], nxttmpFiberPnt[1], nxttmpFiberPnt[2]);
+
+ vnl_vector_fixed< double, 3 > diff;
+ diff = tmpPntvtk - nxttmpPntvtk;
+ diff.normalize();
+
+ rgba[0] = (unsigned char) (255.0 * std::abs(diff[0]));
+ rgba[1] = (unsigned char) (255.0 * std::abs(diff[1]));
+ rgba[2] = (unsigned char) (255.0 * std::abs(diff[2]));
+ rgba[3] = (unsigned char) (255.0);
+
+
+
+ } else if(i==0) {
+ //explicit handling of startpoint of line
+
+ //nimm nur diff1
+ mitk::FiberBundle::DTITubePointType nxttmpFiberPntLst = dtiPntList.at(i+1);
+ mitk::FiberBundle::DTITubePointType::PointType nxttmpFiberPnt = nxttmpFiberPntLst.GetPosition();
+ //double nxttmpvtkPnt[3] = {nxttmpFiberPnt[0], nxttmpFiberPnt[1], nxttmpFiberPnt[2]};
+
+ vnl_vector_fixed< double, 3 > tmpPntvtk((double)tmpvtkPnt[0], (double)tmpvtkPnt[1],(double)tmpvtkPnt[2]);
+ vnl_vector_fixed< double, 3 > nxttmpPntvtk(nxttmpFiberPnt[0], nxttmpFiberPnt[1], nxttmpFiberPnt[2]);
+
+ vnl_vector_fixed< double, 3 > diff;
+ diff = tmpPntvtk - nxttmpPntvtk;
+ diff.normalize();
+
+ rgba[0] = (unsigned char) (255.0 * std::abs(diff[0]));
+ rgba[1] = (unsigned char) (255.0 * std::abs(diff[1]));
+ rgba[2] = (unsigned char) (255.0 * std::abs(diff[2]));
+ rgba[3] = (unsigned char) (255.0);
+
+
+
+
+ } else if(i==fibrNrPnts) {
+ // nimm nur diff2
+ mitk::FiberBundle::DTITubePointType nxttmpFiberPntLst = dtiPntList.at(i-1);
+ mitk::FiberBundle::DTITubePointType::PointType nxttmpFiberPnt = nxttmpFiberPntLst.GetPosition();
+
+ vnl_vector_fixed< double, 3 > tmpPntvtk((double)tmpvtkPnt[0], (double)tmpvtkPnt[1],(double)tmpvtkPnt[2]);
+ vnl_vector_fixed< double, 3 > nxttmpPntvtk(nxttmpFiberPnt[0], nxttmpFiberPnt[1], nxttmpFiberPnt[2]);
+
+ vnl_vector_fixed< double, 3 > diff;
+ diff = tmpPntvtk - nxttmpPntvtk;
+ diff.normalize();
+
+ rgba[0] = (unsigned char) (255.0 * std::abs(diff[0]));
+ rgba[1] = (unsigned char) (255.0 * std::abs(diff[1]));
+ rgba[2] = (unsigned char) (255.0 * std::abs(diff[2]));
+ rgba[3] = (unsigned char) (255.0);
+
+
+
+
+ }
+
+ colorsT->InsertNextTupleValue(rgba);
+
+ //get FA value
+ float faVal = tmpFiberPntLst.GetField(mitk::FiberBundle::DTITubePointType::FA);
+ //use insertNextValue cuz FA Values are reperesented as a single number (1 Tuple containing 1 parameter)
+ faColors->InsertNextValue((double) faVal);
+
+
+ }
+ }
+ vtkcells->InsertNextCell(polyLine);
+
+ }
+
+ //vtkcells->InitTraversal();
+
+ // Put points and lines together in one polyData structure
+ m_PolyData = vtkPolyData::New();
+ m_PolyData->SetPoints(vtkpoints);
+ m_PolyData->SetLines(vtkcells);
+ if (vtkVrtxs->GetSize() > 0) {
+ m_PolyData->SetVerts(vtkVrtxs);
+ }
+ m_PolyData->GetPointData()->AddArray(colorsT);
+ m_PolyData->GetPointData()->AddArray(faColors);
+ return m_PolyData;
+}
+
+/* NECESSARY IMPLEMENTATION OF SUPERCLASS METHODS */
+void mitk::FiberBundle::UpdateOutputInformation()
+{
+
+}
+void mitk::FiberBundle::SetRequestedRegionToLargestPossibleRegion()
+{
+
+}
+bool mitk::FiberBundle::RequestedRegionIsOutsideOfTheBufferedRegion()
+{
+ return false;
+}
+bool mitk::FiberBundle::VerifyRequestedRegion()
+{
+ return true;
+}
+void mitk::FiberBundle::SetRequestedRegion( itk::DataObject *data )
+{
+
+}
+
+
+/* TUTORIAL INSERT POINTS / FIBERS to TRACTCONTAINER */
+// points and vectors do not need to be initiated but itkVectorContainer
+/*ContainerPointType pnt1;
+ pnt1[0] = 1.0;
+ pnt1[1] = 2.0;
+ pnt1[2] = 3.0;
+
+ ContainerPointType pnt2;
+ pnt2[0] = 4.0;
+ pnt2[1] = 5.0;
+ pnt2[2] = 6.0;
+
+ ContainerTractType tract1;
+ tract1.push_back(pnt1);
+ tract1.push_back(pnt2);
+
+ ContainerType::Pointer testContainer = ContainerType::New();
+ unsigned int freeIdx = testContainer->Size();
+ MITK_INFO << freeIdx << "\n";
+ testContainer->InsertElement(freeIdx, tract1);
+
+ //iterate through all fibers stored in container
+ for(ContainerType::ConstIterator itCont = testContainer->Begin();
+ itCont != testContainer->End();
+ itCont++)
+ {
+ //get single tract
+ ContainerTractType tmp_fiber = itCont->Value();
+ // MITK_INFO << tmp_fiber << "\n";
+
+ //iterate through all points within a fibertract
+ for(ContainerTractType::iterator itPnt = tmp_fiber.begin();
+ itPnt != tmp_fiber.end();
+ ++itPnt)
+ {
+ // get single point with its coordinates
+ ContainerPointType tmp_pntEx = *itPnt;
+ MITK_INFO << tmp_pntEx[0] << "\n";
+ MITK_INFO << tmp_pntEx[1] << "\n";
+ MITK_INFO << tmp_pntEx[2] << "\n";
+ }
+
+ }
+ ################### DTI FIBERs TUTORIAL ###########################
+ TUTORIAL HOW TO READ POINTS / FIBERS from DTIGroupSpatialObjectContainer
+ assume our dti fibers are stored in m_GroupFiberBundle
+
+ // all smartPointers to fibers stored in in a ChildrenList
+ ChildrenListType * FiberList;
+ FiberList = m_GroupFiberBundle->GetChildren();
+
+ // iterate through container, itkcontainer groupFiberBundle in one iteration step
+ for(ChildrenListType::iterator itLst = FiberList->begin();
+ itLst != FiberList->end();
+ ++FiberList)
+ {
+ // lists output is SpatialObject, we know we have DTITubeSpacialObjects
+ // dynamic cast only likes pointers, no smartpointers, so each dsmartpointer has membermethod .GetPointer()
+ itk::SpatialObject<3>::Pointer tmp_fbr;
+ tmp_fbr = *itLst;
+ DTITubeType::Pointer dtiTract = dynamic_cast<DTITubeType * > (tmp_fbr.GetPointer());
+ if (dtiTract.IsNull()) {
+ return; }
+
+ //get list of points
+ int fibrNrPnts = dtiTract->GetNumberOfPoints();
+ DTITubeType::PointListType dtiPntList = dtiTract->GetPoints();
+
+ }
+
+
+ */
+
diff --git a/Modules/DiffusionImaging/IODataStructures/FiberBundle/mitkFiberBundle.h b/Modules/DiffusionImaging/IODataStructures/FiberBundle/mitkFiberBundle.h
new file mode 100644
index 0000000000..b0478f9eed
--- /dev/null
+++ b/Modules/DiffusionImaging/IODataStructures/FiberBundle/mitkFiberBundle.h
@@ -0,0 +1,174 @@
+
+/*=========================================================================
+
+ Program: Medical Imaging & Interaction Toolkit
+ Module: $RCSfile$
+ Language: C++
+ Date: $Date$
+ Version: $Revision: 11989 $
+
+ Copyright (c) German Cancer Research Center, Division of Medical and
+ Biological Informatics. All rights reserved.
+ See MITKCopyright.txt or http://www.mitk.org/copyright.html for details.
+
+ This software is distributed WITHOUT ANY WARRANTY; without even
+ the implied warranty of MERCHANTABILITY or FITNESS FOR A PARTICULAR
+ PURPOSE. See the above copyright notices for more information.
+
+ =========================================================================*/
+
+
+#ifndef _MITK_FiberBundle_H
+#define _MITK_FiberBundle_H
+
+#include "mitkBaseData.h"
+#include "MitkDiffusionImagingExports.h"
+#include "mitkPlanarFigure.h"
+
+/* This Class represents a bunch of FiberTracts as a Bundle.
+ A Bundle is represented by a GroupSpatialObject */
+
+#include "itkDTITubeSpatialObject.h"
+#include "itkDTITubeSpatialObjectPoint.h"
+#include "itkGroupSpatialObject.h"
+#include "itkPolyLineParametricPath.h"
+#include "itkSlowPolyLineParametricPath.h"
+#include "itkVectorContainer.h"
+#include "itkPointSet.h"
+#include "itkVector.h"
+#include <vtkCell.h>
+#include <vtkPolyData.h>
+#include <vtkCellArray.h>
+#include <vtkDoubleArray.h>
+#include <vtkPolyLine.h>
+#include <vtkVertex.h>
+#include <vtkPointData.h>
+#include <vtkSmartPointer.h>
+
+namespace mitk {
+
+ /**
+ * \brief Base Class for Fiber Bundles; */
+ class MitkDiffusionImaging_EXPORT FiberBundle : public BaseData
+ {
+
+ /* friend classes wanna access typedefs
+ ContainerPointType, ContainerTractType, ContainerType */
+ friend class FiberBundleWriter;
+ friend class FiberBundleReader;
+// friend class itkTractsToDWIImageFilter;
+
+ /** Types for the standardized TractContainer **/
+ typedef itk::Point<float,3> ContainerPointType; //no need to init, is no smartpointer
+ typedef itk::VectorContainer<unsigned int, ContainerPointType> ContainerTractType;
+ typedef itk::VectorContainer< unsigned int, ContainerTractType::Pointer > ContainerType; //init via smartpointer
+
+
+
+ /** Types for the ITK Stochastic TractContainer **/
+ typedef itk::SlowPolyLineParametricPath< 3 > itkStochTractType;
+ typedef itk::VectorContainer< unsigned int, itkStochTractType::Pointer > itkStochTractContainerType;
+
+
+ // virtual methods that need to be implemented
+ virtual void UpdateOutputInformation();
+ virtual void SetRequestedRegionToLargestPossibleRegion();
+ virtual bool RequestedRegionIsOutsideOfTheBufferedRegion();
+ virtual bool VerifyRequestedRegion();
+ virtual void SetRequestedRegion( itk::DataObject *data );
+
+
+ public:
+
+ static const int TRACTPOINT_BACKFACE;
+ static const int TRACTPOINT_ON_PLANE;
+ static const int TRACTPOINT_FRNTFACE;
+
+
+ /* DTITubeSpatialObject Definitions */
+ typedef itk::GroupSpatialObject<3> FiberGroupType;
+ typedef FiberGroupType::ChildrenListType ChildrenListType;
+
+ typedef itk::DTITubeSpatialObject<3> DTITubeType;
+ typedef itk::DTITubeSpatialObjectPoint<3> DTITubePointType;
+
+ mitkClassMacro( FiberBundle, BaseData );
+ itkNewMacro( Self );
+
+
+ /* Handle Output Type of ITK Stochastic Tractography Fiber Tracking */
+ void addTractContainer( ContainerType::Pointer );
+ void additkStochTractContainer(itkStochTractContainerType::Pointer);
+ void initFiberGroup();
+ void addSingleDTITract(mitk::FiberBundle::DTITubeType::Pointer);
+ DTITubeType::Pointer copySingleDTITract(DTITubeType::Pointer);
+
+ /* Methods for PlanarFigure ROIs */
+ //mitk::FiberBundle::Pointer extractFibersPF(mitk::PlanarFigure::Pointer);
+ std::vector<int> extractFibersByPF(mitk::PlanarFigure::Pointer, std::vector<int>* set=0);
+ mitk::FiberBundle::Pointer extractFibersById(std::vector<int> );
+ std::vector<int> getAllIDsInFiberBundle();
+
+
+ mitk::Point3D calculateCrossingPoint(mitk::Point3D , mitk::Point3D , mitk::PlanarFigure::Pointer ); //depricated
+ bool checkForGap(int, int); //depricated
+ /*********************************/
+
+
+ void debug_members();
+
+ void SetBounds(float* b);
+ void SetBounds(double* b);
+ float* GetBounds();
+
+
+
+//**** REALTIME MONITOR CONTAINER METHOD ****//
+ //flag overwrite existing bundle
+ void addContainer4speedDisplay( ContainerType::Pointer );
+
+ itkGetMacro(GroupFiberBundle, FiberGroupType::Pointer);
+ itkGetMacro(TractContainer, ContainerType::Pointer);
+
+ //** explicit handling of FiberBundleDataStructure contents *//
+ void PushPoint(int fiberIndex, ContainerPointType point);
+ void PushTract(ContainerTractType::Pointer tract);
+ ContainerPointType GetPoint(int tractIndex, int pointIndex);
+ ContainerTractType::Pointer GetTract(int tractIndex);
+ int GetNumTracts();
+ int GetNumPoints(int tractIndex);
+ FiberGroupType::Pointer getGroupFiberBundle();
+
+ mitk::FiberBundle::Pointer JoinBundle(mitk::FiberBundle::Pointer bundle);
+ int FindTractByEndpoints(mitk::FiberBundle::DTITubeType::Pointer searchTract);
+ mitk::FiberBundle::Pointer SubstractBundle(mitk::FiberBundle::Pointer bundle);
+ void InsertBundle(mitk::FiberBundle::Pointer bundle);
+ vtkPolyData* GeneratePolydata();
+
+// int SearchFiber(worldPoint, tolerance, resultDistance);
+
+ protected:
+ FiberBundle();
+ virtual ~FiberBundle();
+
+ private:
+ FiberGroupType::Pointer m_GroupFiberBundle;
+ ContainerType::Pointer m_TractContainer;
+ itkStochTractContainerType::Pointer m_debugITKContainer;
+
+ void fiberPostprocessing_FA( DTITubePointType* );
+ void fiberPostprocessing_setPoint(DTITubePointType* , ContainerPointType );
+ void fiberPostprocessing_setTensorMatrix(DTITubePointType*);
+
+ int debug_PrototypeCounter;
+ float m_boundsFB[3];
+
+ /* Methods for PlanarFigure ROIs */
+ bool isPointInSelection(mitk::Point3D, mitk::PlanarFigure::Pointer);
+ vtkPolyData* m_PolyData;
+
+ };
+
+} // namespace mitk
+
+#endif /* _MITK_FiberBundle_H */
diff --git a/Modules/DiffusionImaging/IODataStructures/FiberBundle/mitkFiberBundleIOFactory.cpp b/Modules/DiffusionImaging/IODataStructures/FiberBundle/mitkFiberBundleIOFactory.cpp
new file mode 100644
index 0000000000..c4134a9c20
--- /dev/null
+++ b/Modules/DiffusionImaging/IODataStructures/FiberBundle/mitkFiberBundleIOFactory.cpp
@@ -0,0 +1,54 @@
+/*=========================================================================
+
+Program: Medical Imaging & Interaction Toolkit
+Language: C++
+Date: $Date: 2007-12-11 14:46:19 +0100 (Di, 11 Dez 2007) $
+Version: $Revision: 6607 $
+
+Copyright (c) German Cancer Research Center, Division of Medical and
+Biological Informatics. All rights reserved.
+See MITKCopyright.txt or http://www.mitk.org/copyright.html for details.
+
+This software is distributed WITHOUT ANY WARRANTY; without even
+the implied warranty of MERCHANTABILITY or FITNESS FOR A PARTICULAR
+PURPOSE. See the above copyright notices for more information.
+
+=========================================================================*/
+
+#include "mitkFiberBundleIOFactory.h"
+#include "mitkIOAdapter.h"
+#include "mitkFiberBundleReader.h"
+
+#include "itkVersion.h"
+
+//NOTE>umbenennen in FBReaderType
+
+
+namespace mitk
+{
+
+FiberBundleIOFactory::FiberBundleIOFactory()
+{
+ typedef FiberBundleReader FiberBundleReaderType;
+ this->RegisterOverride("mitkIOAdapter", //beibehalten
+ "mitkFiberBundleReader", //umbenennen
+ "Fiber Bundle IO", //angezeigter name
+ 1,
+ itk::CreateObjectFunction<IOAdapter<FiberBundleReaderType> >::New());
+}
+
+FiberBundleIOFactory::~FiberBundleIOFactory()
+{
+}
+
+const char* FiberBundleIOFactory::GetITKSourceVersion() const
+{
+ return ITK_SOURCE_VERSION;
+}
+
+const char* FiberBundleIOFactory::GetDescription() const
+{
+ return "FibreBundleIOFactory, allows the loading of FibreBundles";
+}
+
+} // end namespace mitk
diff --git a/Modules/DiffusionImaging/IODataStructures/FiberBundle/mitkFiberBundleIOFactory.h b/Modules/DiffusionImaging/IODataStructures/FiberBundle/mitkFiberBundleIOFactory.h
new file mode 100644
index 0000000000..6fb8a2f5a7
--- /dev/null
+++ b/Modules/DiffusionImaging/IODataStructures/FiberBundle/mitkFiberBundleIOFactory.h
@@ -0,0 +1,76 @@
+/*=========================================================================
+
+Program: Medical Imaging & Interaction Toolkit
+Language: C++
+Date: $Date: 2009-05-13 18:06:46 +0200 (Mi, 13 Mai 2009) $
+Version: $Revision: 6590 $
+
+Copyright (c) German Cancer Research Center, Division of Medical and
+Biological Informatics. All rights reserved.
+See MITKCopyright.txt or http://www.mitk.org/copyright.html for details.
+
+This software is distributed WITHOUT ANY WARRANTY; without even
+the implied warranty of MERCHANTABILITY or FITNESS FOR A PARTICULAR
+PURPOSE. See the above copyright notices for more information.
+
+=========================================================================*/
+#ifndef __MITK_FIBER_BUNDLE_IO_FACTORY_H_HEADER__
+#define __MITK_FIBER_BUNDLE_IO_FACTORY_H_HEADER__
+
+#ifdef _MSC_VER
+#pragma warning ( disable : 4786 )
+#endif
+
+#include "itkObjectFactoryBase.h"
+#include "mitkBaseData.h"
+#include "MitkDiffusionImagingExports.h"
+
+//NOTE>umbenennen in internal FiberBundleIOFactory
+
+
+namespace mitk
+{
+//##Documentation
+//## @brief Create instances of NrrdQBallImageReader objects using an object factory.
+//##
+//## @ingroup IO
+class MitkDiffusionImaging_EXPORT FiberBundleIOFactory : public itk::ObjectFactoryBase
+{
+public:
+ /** Standard class typedefs. */
+ typedef FiberBundleIOFactory Self;
+ typedef itk::ObjectFactoryBase Superclass;
+ typedef itk::SmartPointer<Self> Pointer;
+ typedef itk::SmartPointer<const Self> ConstPointer;
+
+ /** Class methods used to interface with the registered factories. */
+ virtual const char* GetITKSourceVersion(void) const;
+ virtual const char* GetDescription(void) const;
+
+ /** Method for class instantiation. */
+ itkFactorylessNewMacro(Self);
+ static FiberBundleIOFactory* FactoryNew() { return new FiberBundleIOFactory;}
+ /** Run-time type information (and related methods). */
+ itkTypeMacro(FiberBundleIOFactory, ObjectFactoryBase);
+
+ /** Register one factory of this type */
+ static void RegisterOneFactory(void)
+ {
+ FiberBundleIOFactory::Pointer FiberBundleIOFactory = FiberBundleIOFactory::New();
+ ObjectFactoryBase::RegisterFactory(FiberBundleIOFactory);
+ }
+
+protected:
+ FiberBundleIOFactory();
+ ~FiberBundleIOFactory();
+
+private:
+ FiberBundleIOFactory(const Self&); //purposely not implemented
+ void operator=(const Self&); //purposely not implemented
+
+};
+
+
+} // end namespace mitk
+
+#endif // __MITK_FIBER_BUNDLE_IO_FACTORY_H_HEADER__
diff --git a/Modules/DiffusionImaging/IODataStructures/FiberBundle/mitkFiberBundleReader.cpp b/Modules/DiffusionImaging/IODataStructures/FiberBundle/mitkFiberBundleReader.cpp
new file mode 100644
index 0000000000..0f807829e6
--- /dev/null
+++ b/Modules/DiffusionImaging/IODataStructures/FiberBundle/mitkFiberBundleReader.cpp
@@ -0,0 +1,389 @@
+/*=========================================================================
+
+Program: Medical Imaging & Interaction Toolkit
+Language: C++
+Date: $Date: 2009-07-14 19:11:20 +0200 (Tue, 14 Jul 2009) $
+Version: $Revision: 18127 $
+
+Copyright (c) German Cancer Research Center, Division of Medical and
+Biological Informatics. All rights reserved.
+See MITKCopyright.txt or http://www.mitk.org/copyright.html for details.
+
+This software is distributed WITHOUT ANY WARRANTY; without even
+the implied warranty of MERCHANTABILITY or FITNESS FOR A PARTICULAR
+PURPOSE. See the above copyright notices for more information.
+
+=========================================================================*/
+
+#include "mitkFiberBundleReader.h"
+#include <itkMetaDataObject.h>
+#include <vtkMatrix4x4.h>
+#include <tinyxml.h>
+#include <itkAffineGeometryFrame.h>
+#include <mitkSlicedGeometry3D.h>
+#include <mitkPlaneGeometry.h>
+#include <mitkGeometry2D.h>
+#include <vtkPolyData.h>
+#include <vtkDataReader.h>
+#include <vtkPolyDataReader.h>
+#include <vtkCellArray.h>
+#include <mitkSurface.h>
+
+const char* mitk::FiberBundleReader::XML_GEOMETRY = "geometry";
+
+const char* mitk::FiberBundleReader::XML_MATRIX_XX = "xx";
+
+const char* mitk::FiberBundleReader::XML_MATRIX_XY = "xy";
+
+const char* mitk::FiberBundleReader::XML_MATRIX_XZ = "xz";
+
+const char* mitk::FiberBundleReader::XML_MATRIX_YX = "yx";
+
+const char* mitk::FiberBundleReader::XML_MATRIX_YY = "yy";
+
+const char* mitk::FiberBundleReader::XML_MATRIX_YZ = "yz";
+
+const char* mitk::FiberBundleReader::XML_MATRIX_ZX = "zx";
+
+const char* mitk::FiberBundleReader::XML_MATRIX_ZY = "zy";
+
+const char* mitk::FiberBundleReader::XML_MATRIX_ZZ = "zz";
+
+const char* mitk::FiberBundleReader::XML_ORIGIN_X = "origin_x";
+
+const char* mitk::FiberBundleReader::XML_ORIGIN_Y = "origin_y";
+
+const char* mitk::FiberBundleReader::XML_ORIGIN_Z = "origin_z";
+
+const char* mitk::FiberBundleReader::XML_SPACING_X = "spacing_x";
+
+const char* mitk::FiberBundleReader::XML_SPACING_Y = "spacing_y";
+
+const char* mitk::FiberBundleReader::XML_SPACING_Z = "spacing_z";
+
+const char* mitk::FiberBundleReader::XML_SIZE_X = "size_x";
+
+const char* mitk::FiberBundleReader::XML_SIZE_Y = "size_y";
+
+const char* mitk::FiberBundleReader::XML_SIZE_Z = "size_z";
+
+const char* mitk::FiberBundleReader::XML_FIBER_BUNDLE = "fiber_bundle";
+
+const char* mitk::FiberBundleReader::XML_FIBER = "fiber";
+
+const char* mitk::FiberBundleReader::XML_PARTICLE = "particle";
+
+const char* mitk::FiberBundleReader::XML_ID = "id";
+
+const char* mitk::FiberBundleReader::XML_POS_X = "pos_x";
+
+const char* mitk::FiberBundleReader::XML_POS_Y = "pos_y";
+
+const char* mitk::FiberBundleReader::XML_POS_Z = "pos_z";
+
+const char* mitk::FiberBundleReader::XML_NUM_FIBERS = "num_fibers";
+
+const char* mitk::FiberBundleReader::XML_NUM_PARTICLES = "num_particles";
+
+const char* mitk::FiberBundleReader::XML_FIBER_BUNDLE_FILE = "fiber_bundle_file" ;
+
+const char* mitk::FiberBundleReader::XML_FILE_VERSION = "file_version" ;
+
+const char* mitk::FiberBundleReader::VERSION_STRING = "0.1" ;
+
+namespace mitk
+{
+
+ void FiberBundleReader
+ ::GenerateData()
+ {
+ MITK_INFO << "Reading fiber bundle";
+ if ( ( ! m_OutputCache ) )
+ {
+ Superclass::SetNumberOfRequiredOutputs(0);
+ this->GenerateOutputInformation();
+ }
+
+ if (!m_OutputCache)
+ {
+ itkWarningMacro("Tree cache is empty!");
+ }
+
+
+ Superclass::SetNumberOfRequiredOutputs(1);
+ Superclass::SetNthOutput(0, m_OutputCache.GetPointer());
+ }
+
+ void FiberBundleReader::GenerateOutputInformation()
+ {
+ m_OutputCache = OutputType::New();
+
+ std::string ext = itksys::SystemTools::GetFilenameLastExtension(m_FileName);
+ ext = itksys::SystemTools::LowerCase(ext);
+
+ if ( m_FileName == "")
+ {
+
+ }
+ else if (ext == ".fib")
+ {
+ try
+ {
+ TiXmlDocument doc( m_FileName );
+ doc.LoadFile();
+
+ TiXmlHandle hDoc(&doc);
+ TiXmlElement* pElem;
+ TiXmlHandle hRoot(0);
+
+ pElem = hDoc.FirstChildElement().Element();
+
+ // save this for later
+ hRoot = TiXmlHandle(pElem);
+
+ pElem = hRoot.FirstChildElement(FiberBundleReader::XML_GEOMETRY).Element();
+
+ // read geometry
+ mitk::Geometry3D::Pointer geometry = mitk::Geometry3D::New();
+
+ // read origin
+ mitk::Point3D origin;
+ double temp = 0;
+ pElem->Attribute(FiberBundleReader::XML_ORIGIN_X, &temp);
+ origin[0] = temp;
+ pElem->Attribute(FiberBundleReader::XML_ORIGIN_Y, &temp);
+ origin[1] = temp;
+ pElem->Attribute(FiberBundleReader::XML_ORIGIN_Z, &temp);
+ origin[2] = temp;
+ geometry->SetOrigin(origin);
+
+ // read spacing
+ float spacing[3];
+ pElem->Attribute(FiberBundleReader::XML_SPACING_X, &temp);
+ spacing[0] = temp;
+ pElem->Attribute(FiberBundleReader::XML_SPACING_Y, &temp);
+ spacing[1] = temp;
+ pElem->Attribute(FiberBundleReader::XML_SPACING_Z, &temp);
+ spacing[2] = temp;
+ geometry->SetSpacing(spacing);
+
+ // read transform
+ vtkMatrix4x4* m = vtkMatrix4x4::New();
+ pElem->Attribute(FiberBundleReader::XML_MATRIX_XX, &temp);
+ m->SetElement(0,0,temp);
+ pElem->Attribute(FiberBundleReader::XML_MATRIX_XY, &temp);
+ m->SetElement(1,0,temp);
+ pElem->Attribute(FiberBundleReader::XML_MATRIX_XZ, &temp);
+ m->SetElement(2,0,temp);
+ pElem->Attribute(FiberBundleReader::XML_MATRIX_YX, &temp);
+ m->SetElement(0,1,temp);
+ pElem->Attribute(FiberBundleReader::XML_MATRIX_YY, &temp);
+ m->SetElement(1,1,temp);
+ pElem->Attribute(FiberBundleReader::XML_MATRIX_YZ, &temp);
+ m->SetElement(2,1,temp);
+ pElem->Attribute(FiberBundleReader::XML_MATRIX_ZX, &temp);
+ m->SetElement(0,2,temp);
+ pElem->Attribute(FiberBundleReader::XML_MATRIX_ZY, &temp);
+ m->SetElement(1,2,temp);
+ pElem->Attribute(FiberBundleReader::XML_MATRIX_ZZ, &temp);
+ m->SetElement(2,2,temp);
+
+ m->SetElement(0,3,origin[0]);
+ m->SetElement(1,3,origin[1]);
+ m->SetElement(2,3,origin[2]);
+ m->SetElement(3,3,1);
+ geometry->SetIndexToWorldTransformByVtkMatrix(m);
+
+ // read bounds
+ float bounds[] = {0, 0, 0, 0, 0, 0};
+ pElem->Attribute(FiberBundleReader::XML_SIZE_X, &temp);
+ bounds[1] = temp;
+ pElem->Attribute(FiberBundleReader::XML_SIZE_Y, &temp);
+ bounds[3] = temp;
+ pElem->Attribute(FiberBundleReader::XML_SIZE_Z, &temp);
+ bounds[5] = temp;
+ geometry->SetFloatBounds(bounds);
+
+ // read bounds
+ float bounds2[] = {0, 0, 0};
+ bounds2[0] = bounds[1];
+ bounds2[1] = bounds[3];
+ bounds2[2] = bounds[5];
+ m_OutputCache->SetBounds(bounds2);
+
+ geometry->SetImageGeometry(true);
+ m_OutputCache->SetGeometry(geometry);
+
+ // generate tract container
+ ContainerType::Pointer tractContainer = ContainerType::New();
+
+ int fiberID = 0;
+ pElem = hRoot.FirstChildElement(FiberBundleReader::XML_FIBER_BUNDLE).FirstChild().Element();
+ for( pElem; pElem; pElem=pElem->NextSiblingElement())
+ {
+ TiXmlElement* pElem2 = pElem->FirstChildElement();
+ ContainerTractType::Pointer tract = ContainerTractType::New();
+ for( pElem2; pElem2; pElem2=pElem2->NextSiblingElement())
+ {
+ ContainerPointType point;
+ pElem2->Attribute(FiberBundleReader::XML_POS_X, &temp);
+ point[0] = temp;
+ pElem2->Attribute(FiberBundleReader::XML_POS_Y, &temp);
+ point[1] = temp;
+ pElem2->Attribute(FiberBundleReader::XML_POS_Z, &temp);
+ point[2] = temp;
+
+ tract->InsertElement(tract->Size(), point);
+
+ }
+ pElem->Attribute(FiberBundleReader::XML_ID, &fiberID);
+ tractContainer->CreateIndex(fiberID);
+ tractContainer->SetElement(fiberID, tract);
+
+ }
+ m_OutputCache->addTractContainer(tractContainer);
+ m_OutputCache->initFiberGroup();
+
+ MITK_INFO << "Fiber bundle read";
+ }
+ catch(...)
+ {
+ MITK_INFO << "Could not read file ";
+ }
+ }
+ else if (ext == ".afib")
+ {
+ // generate tract container
+ ContainerType::Pointer tractContainer = ContainerType::New();
+ mitk::Geometry3D::Pointer geometry = mitk::Geometry3D::New();
+
+ ///We create a Generic Reader to test de .vtk/
+ vtkDataReader *chooser=vtkDataReader::New();
+ chooser->SetFileName(m_FileName.c_str() );
+ if( chooser->IsFilePolyData())
+ {
+ vtkPolyDataReader *reader = vtkPolyDataReader::New();
+ reader->SetFileName( m_FileName.c_str() );
+ reader->Update();
+
+ if ( reader->GetOutput() != NULL )
+ {
+ vtkPolyData* output = reader->GetOutput();
+ output->ComputeBounds();
+ double bounds[3];
+ output->GetBounds(bounds);
+ double center[3];
+ output->GetCenter(center);
+ Point3D origin;
+ origin.SetElement(0, -center[0]);
+ origin.SetElement(1, -center[1]);
+ origin.SetElement(2, -center[2]);
+ MITK_INFO << origin;
+
+ mitk::Surface::Pointer surf = mitk::Surface::New();
+ surf->SetVtkPolyData(output);
+ mitk::Geometry3D* geom = surf->GetGeometry();
+ //geom->SetOrigin(origin);
+ geom->SetImageGeometry(true);
+ m_OutputCache->SetBounds(bounds);
+ m_OutputCache->SetGeometry(geom);
+ vtkCellArray* cells = output->GetLines();
+
+ cells->InitTraversal();
+
+ for (int i=0; i<output->GetNumberOfCells(); i++)
+ {
+ ContainerTractType::Pointer tract = ContainerTractType::New();
+ vtkCell* cell = output->GetCell(i);
+ int p = cell->GetNumberOfPoints();
+ vtkPoints* points = cell->GetPoints();
+ for (int j=0; j<p; j++)
+ {
+ double p[3];
+ points->GetPoint(j, p);
+ ContainerPointType point;
+ point[0] = p[0];
+ point[1] = p[1];
+ point[2] = p[2];
+ tract->InsertElement(tract->Size(), point);
+ }
+ tractContainer->InsertElement(i, tract);
+ }
+ }
+ reader->Delete();
+ }
+ chooser->Delete();
+
+ m_OutputCache->addTractContainer(tractContainer);
+ m_OutputCache->initFiberGroup();
+ MITK_INFO << "Fiber bundle read";
+ }
+ }
+
+ void FiberBundleReader::Update()
+ {
+ this->GenerateData();
+ }
+
+ const char* FiberBundleReader
+ ::GetFileName() const
+ {
+ return m_FileName.c_str();
+ }
+
+
+ void FiberBundleReader
+ ::SetFileName(const char* aFileName)
+ {
+ m_FileName = aFileName;
+ }
+
+
+ const char* FiberBundleReader
+ ::GetFilePrefix() const
+ {
+ return m_FilePrefix.c_str();
+ }
+
+
+ void FiberBundleReader
+ ::SetFilePrefix(const char* aFilePrefix)
+ {
+ m_FilePrefix = aFilePrefix;
+ }
+
+
+ const char* FiberBundleReader
+ ::GetFilePattern() const
+ {
+ return m_FilePattern.c_str();
+ }
+
+
+ void FiberBundleReader
+ ::SetFilePattern(const char* aFilePattern)
+ {
+ m_FilePattern = aFilePattern;
+ }
+
+
+ bool FiberBundleReader
+ ::CanReadFile(const std::string filename, const std::string /*filePrefix*/, const std::string /*filePattern*/)
+ {
+ // First check the extension
+ if( filename == "" )
+ {
+ return false;
+ }
+ std::string ext = itksys::SystemTools::GetFilenameLastExtension(filename);
+ ext = itksys::SystemTools::LowerCase(ext);
+
+ if (ext == ".fib" || ext == ".afib")
+ {
+ return true;
+ }
+
+ return false;
+ }
+
+} //namespace MITK
diff --git a/Modules/DiffusionImaging/IODataStructures/FiberBundle/mitkFiberBundleReader.h b/Modules/DiffusionImaging/IODataStructures/FiberBundle/mitkFiberBundleReader.h
new file mode 100644
index 0000000000..09b32561a9
--- /dev/null
+++ b/Modules/DiffusionImaging/IODataStructures/FiberBundle/mitkFiberBundleReader.h
@@ -0,0 +1,147 @@
+/*=========================================================================
+
+Program: Medical Imaging & Interaction Toolkit
+Language: C++
+Date: $Date: 2009-07-14 19:11:20 +0200 (Tue, 14 Jul 2009) $
+Version: $Revision: 18127 $
+
+Copyright (c) German Cancer Research Center, Division of Medical and
+Biological Informatics. All rights reserved.
+See MITKCopyright.txt or http://www.mitk.org/copyright.html for details.
+
+This software is distributed WITHOUT ANY WARRANTY; without even
+the implied warranty of MERCHANTABILITY or FITNESS FOR A PARTICULAR
+PURPOSE. See the above copyright notices for more information.
+
+=========================================================================*/
+
+#ifndef __mitkFiberBundleReader_h
+#define __mitkFiberBundleReader_h
+
+#include "mitkCommon.h"
+#include "itkVectorContainer.h"
+#include "mitkFileReader.h"
+#include "mitkFiberBundle.h"
+#include "itkSlowPolyLineParametricPath.h"
+
+//NOTE>umbenennen in FiberBundleSource
+
+namespace mitk
+{
+
+ /** \brief
+ */
+
+ class FiberBundleReader : public FileReader, public BaseProcess
+ {
+ public:
+
+ /** Types for the standardized TractContainer **/
+ /* direct linked includes of mitkFiberBundle DataStructure */
+ typedef mitk::FiberBundle::ContainerPointType ContainerPointType;
+ typedef mitk::FiberBundle::ContainerTractType ContainerTractType;
+ typedef mitk::FiberBundle::ContainerType ContainerType;
+
+
+ typedef mitk::FiberBundle OutputType;
+
+ mitkClassMacro( FiberBundleReader, BaseProcess );
+ itkNewMacro(Self);
+
+ const char* GetFileName() const;
+ void SetFileName(const char* aFileName);
+ const char* GetFilePrefix() const;
+ void SetFilePrefix(const char* aFilePrefix);
+ const char* GetFilePattern() const;
+ void SetFilePattern(const char* aFilePattern);
+
+ static bool CanReadFile(const std::string filename, const std::string filePrefix, const std::string filePattern);
+
+// itkGetMacro(GroupFiberBundle, FiberGroupType::Pointer);
+// itkGetMacro(TractContainer, ContainerType::Pointer);
+
+ virtual void Update();
+
+
+ static const char* XML_GEOMETRY;
+
+ static const char* XML_MATRIX_XX;
+
+ static const char* XML_MATRIX_XY;
+
+ static const char* XML_MATRIX_XZ;
+
+ static const char* XML_MATRIX_YX;
+
+ static const char* XML_MATRIX_YY;
+
+ static const char* XML_MATRIX_YZ;
+
+ static const char* XML_MATRIX_ZX;
+
+ static const char* XML_MATRIX_ZY;
+
+ static const char* XML_MATRIX_ZZ;
+
+ static const char* XML_ORIGIN_X;
+
+ static const char* XML_ORIGIN_Y;
+
+ static const char* XML_ORIGIN_Z;
+
+ static const char* XML_SPACING_X;
+
+ static const char* XML_SPACING_Y;
+
+ static const char* XML_SPACING_Z;
+
+ static const char* XML_SIZE_X;
+
+ static const char* XML_SIZE_Y;
+
+ static const char* XML_SIZE_Z;
+
+ static const char* XML_FIBER_BUNDLE;
+
+ static const char* XML_FIBER;
+
+ static const char* XML_PARTICLE;
+
+ static const char* XML_ID;
+
+ static const char* XML_POS_X;
+
+ static const char* XML_POS_Y;
+
+ static const char* XML_POS_Z;
+
+ static const char* VERSION_STRING;
+
+ static const char* XML_FIBER_BUNDLE_FILE;
+
+ static const char* XML_FILE_VERSION;
+
+ static const char* XML_NUM_FIBERS;
+
+ static const char* XML_NUM_PARTICLES;
+
+ protected:
+
+ /** Does the real work. */
+ virtual void GenerateData();
+ virtual void GenerateOutputInformation();
+
+ OutputType::Pointer m_OutputCache;
+
+ std::string m_FileName;
+ std::string m_FilePrefix;
+ std::string m_FilePattern;
+ ContainerType::Pointer m_TractContainer;
+
+ private:
+ void operator=(const Self&); //purposely not implemented
+ };
+
+} //namespace MITK
+
+#endif // __mitkFiberBundleReader_h
diff --git a/Modules/DiffusionImaging/IODataStructures/FiberBundle/mitkFiberBundleSerializer.cpp b/Modules/DiffusionImaging/IODataStructures/FiberBundle/mitkFiberBundleSerializer.cpp
new file mode 100644
index 0000000000..d78fe3b912
--- /dev/null
+++ b/Modules/DiffusionImaging/IODataStructures/FiberBundle/mitkFiberBundleSerializer.cpp
@@ -0,0 +1,75 @@
+/*=========================================================================
+
+Program: Medical Imaging & Interaction Toolkit
+Language: C++
+Date: $Date$
+Version: $Revision: 1.12 $
+
+Copyright (c) German Cancer Research Center, Division of Medical and
+Biological Informatics. All rights reserved.
+See MITKCopyright.txt or http://www.mitk.org/copyright.html for details.
+
+This software is distributed WITHOUT ANY WARRANTY; without even
+the implied warranty of MERCHANTABILITY or FITNESS FOR A PARTICULAR
+PURPOSE. See the above copyright notices for more information.
+
+=========================================================================*/
+
+#include "mitkFiberBundleSerializer.h"
+#include "mitkFiberBundle.h"
+#include "mitkFiberBundleWriter.h"
+
+#include <itksys/SystemTools.hxx>
+
+
+MITK_REGISTER_SERIALIZER(FiberBundleSerializer)
+
+
+mitk::FiberBundleSerializer::FiberBundleSerializer()
+{
+}
+
+
+mitk::FiberBundleSerializer::~FiberBundleSerializer()
+{
+}
+
+
+std::string mitk::FiberBundleSerializer::Serialize()
+{
+ const FiberBundle* fb = dynamic_cast<const FiberBundle*>( m_Data.GetPointer() );
+ if (fb == NULL)
+ {
+ MITK_ERROR << " Object at " << (const void*) this->m_Data
+ << " is not an mitk::FiberBundle. Cannot serialize as FiberBundle.";
+ return "";
+ }
+
+ std::string filename( this->GetUniqueFilenameInWorkingDirectory() );
+ filename += "_";
+ filename += m_FilenameHint;
+ filename += ".fib";
+
+ std::string fullname(m_WorkingDirectory);
+ fullname += "/";
+ fullname += itksys::SystemTools::ConvertToOutputPath(filename.c_str());
+
+ try
+ {
+ FiberBundleWriter::Pointer writer = FiberBundleWriter::New();
+ writer->SetFileName(fullname);
+ writer->SetInputFiberBundle(const_cast<FiberBundle*>(fb));
+ writer->Write();
+ }
+ catch (std::exception& e)
+ {
+ MITK_ERROR << " Error serializing object at " << (const void*) this->m_Data
+ << " to "
+ << fullname
+ << ": "
+ << e.what();
+ return "";
+ }
+ return filename;
+}
+
diff --git a/Modules/SceneSerializationBase/mitkBasePropertySerializer.cpp b/Modules/DiffusionImaging/IODataStructures/FiberBundle/mitkFiberBundleSerializer.h
similarity index 53%
copy from Modules/SceneSerializationBase/mitkBasePropertySerializer.cpp
copy to Modules/DiffusionImaging/IODataStructures/FiberBundle/mitkFiberBundleSerializer.h
index 0e34921ff9..820aef2fb7 100644
--- a/Modules/SceneSerializationBase/mitkBasePropertySerializer.cpp
+++ b/Modules/DiffusionImaging/IODataStructures/FiberBundle/mitkFiberBundleSerializer.h
@@ -1,35 +1,40 @@
/*=========================================================================
Program: Medical Imaging & Interaction Toolkit
Language: C++
Date: $Date$
Version: $Revision: 1.12 $
Copyright (c) German Cancer Research Center, Division of Medical and
Biological Informatics. All rights reserved.
See MITKCopyright.txt or http://www.mitk.org/copyright.html for details.
This software is distributed WITHOUT ANY WARRANTY; without even
the implied warranty of MERCHANTABILITY or FITNESS FOR A PARTICULAR
PURPOSE. See the above copyright notices for more information.
=========================================================================*/
-#include "mitkBasePropertySerializer.h"
+#ifndef mitkFiberBundleSerializer_h_included
+#define mitkFiberBundleSerializer_h_included
-mitk::BasePropertySerializer::BasePropertySerializer()
-{
-}
+#include "MitkDiffusionImagingExports.h"
+#include "mitkBaseDataSerializer.h"
-mitk::BasePropertySerializer::~BasePropertySerializer()
+namespace mitk
{
-}
-
-TiXmlElement* mitk::BasePropertySerializer::Serialize()
+/**
+ \brief Serializes mitk::Surface for mitk::SceneIO
+*/
+class MitkDiffusionImaging_EXPORT FiberBundleSerializer : public BaseDataSerializer
{
- MITK_INFO << this->GetNameOfClass()
- << " is asked to serialize an object " << (const void*) this->m_Property;
-
- return NULL;
-}
-
+ public:
+ mitkClassMacro( FiberBundleSerializer, BaseDataSerializer );
+ itkNewMacro(Self);
+ virtual std::string Serialize();
+ protected:
+ FiberBundleSerializer();
+ virtual ~FiberBundleSerializer();
+};
+} // namespace
+#endif
diff --git a/Modules/DiffusionImaging/IODataStructures/FiberBundle/mitkFiberBundleSource.cpp b/Modules/DiffusionImaging/IODataStructures/FiberBundle/mitkFiberBundleSource.cpp
new file mode 100644
index 0000000000..0c780e249f
--- /dev/null
+++ b/Modules/DiffusionImaging/IODataStructures/FiberBundle/mitkFiberBundleSource.cpp
@@ -0,0 +1,35 @@
+/*=========================================================================
+
+Program: Medical Imaging & Interaction Toolkit
+Language: C++
+Date: $Date: 2009-05-12 19:56:03 +0200 (Di, 12 Mai 2009) $
+Version: $Revision: 17179 $
+
+Copyright (c) German Cancer Research Center, Division of Medical and
+Biological Informatics. All rights reserved.
+See MITKCopyright.txt or http://www.mitk.org/copyright.html for details.
+
+This software is distributed WITHOUT ANY WARRANTY; without even
+the implied warranty of MERCHANTABILITY or FITNESS FOR A PARTICULAR
+PURPOSE. See the above copyright notices for more information.
+
+=========================================================================*/
+
+
+#include "mitkQBallImageSource.h"
+
+
+mitk::QBallImageSource::QBallImageSource()
+{
+ // Create the output. We use static_cast<> here because we know the default
+ // output must be of type TOutputImage
+ OutputImageType::Pointer output
+ = static_cast<OutputImageType*>(this->MakeOutput(0).GetPointer());
+ Superclass::SetNumberOfRequiredOutputs(1);
+ Superclass::SetNthOutput(0, output.GetPointer());
+}
+
+mitk::QBallImageSource::DataObjectPointer mitk::QBallImageSource::MakeOutput( unsigned int /*idx*/ )
+{
+ return static_cast<itk::DataObject*>(OutputImageType::New().GetPointer());
+}
diff --git a/Modules/DiffusionImaging/Rendering/mitkDiffusionImageMapper.h b/Modules/DiffusionImaging/IODataStructures/FiberBundle/mitkFiberBundleSource.h
similarity index 50%
copy from Modules/DiffusionImaging/Rendering/mitkDiffusionImageMapper.h
copy to Modules/DiffusionImaging/IODataStructures/FiberBundle/mitkFiberBundleSource.h
index c4e3432f20..ce50970b88 100644
--- a/Modules/DiffusionImaging/Rendering/mitkDiffusionImageMapper.h
+++ b/Modules/DiffusionImaging/IODataStructures/FiberBundle/mitkFiberBundleSource.h
@@ -1,54 +1,52 @@
/*=========================================================================
Program: Medical Imaging & Interaction Toolkit
Language: C++
Date: $Date: 2009-05-12 19:56:03 +0200 (Di, 12 Mai 2009) $
Version: $Revision: 17179 $
Copyright (c) German Cancer Research Center, Division of Medical and
Biological Informatics. All rights reserved.
See MITKCopyright.txt or http://www.mitk.org/copyright.html for details.
This software is distributed WITHOUT ANY WARRANTY; without even
the implied warranty of MERCHANTABILITY or FITNESS FOR A PARTICULAR
PURPOSE. See the above copyright notices for more information.
=========================================================================*/
-#ifndef DiffusionImageMapper_H_HEADER_INCLUDED
-#define DiffusionImageMapper_H_HEADER_INCLUDED
+#ifndef QBallImageSource_H_HEADER_INCLUDED_C1E7D6EC
+#define QBallImageSource_H_HEADER_INCLUDED_C1E7D6EC
-#include "mitkImageMapperGL2D.h"
+#include "mitkImageSource.h"
+#include "mitkQBallImage.h"
-namespace mitk {
+//NOTE>umbenennen .. ableiten von DataSource
- //##Documentation
- //## @brief Mapper for raw diffusion weighted images
- //## @ingroup Mapper
- template<class TPixelType>
- class DiffusionImageMapper : public ImageMapperGL2D
- {
- public:
- mitkClassMacro(DiffusionImageMapper,ImageMapperGL2D);
- itkNewMacro(Self);
+namespace mitk {
- void GenerateData( mitk::BaseRenderer *renderer );
+class QBallImageSource : public ImageSource
+{
+public:
- static void SetDefaultProperties(DataNode* node, BaseRenderer* renderer = NULL, bool overwrite = false );
-
- protected:
+ typedef mitk::QBallImage OutputImageType;
+ typedef OutputImageType::Pointer OutputImagePointer;
+ typedef SlicedData::RegionType OutputImageRegionType;
+ typedef itk::DataObject::Pointer DataObjectPointer;
+
+ mitkClassMacro(QBallImageSource,ImageSource);
+ itkNewMacro(Self);
- DiffusionImageMapper();
- virtual ~DiffusionImageMapper();
+ virtual DataObjectPointer MakeOutput(unsigned int idx);
- };
+protected:
+ QBallImageSource();
+ virtual ~QBallImageSource() {}
+
+};
} // namespace mitk
-#include "mitkDiffusionImageMapper.cpp"
-
-
-#endif /* COMPOSITEMAPPER_H_HEADER_INCLUDED */
-
+#endif /* QBallImageSource_H_HEADER_INCLUDED_C1E7D6EC */
diff --git a/Modules/DiffusionImaging/IODataStructures/FiberBundle/mitkFiberBundleWriter.cpp b/Modules/DiffusionImaging/IODataStructures/FiberBundle/mitkFiberBundleWriter.cpp
new file mode 100644
index 0000000000..1a9019a926
--- /dev/null
+++ b/Modules/DiffusionImaging/IODataStructures/FiberBundle/mitkFiberBundleWriter.cpp
@@ -0,0 +1,231 @@
+/*=========================================================================
+
+Program: Medical Imaging & Interaction Toolkit
+Language: C++
+Date: $Date: 2008-12-10 18:05:13 +0100 (Mi, 10 Dez 2008) $
+Version: $Revision: 15922 $
+
+Copyright (c) German Cancer Research Center, Division of Medical and
+Biological Informatics. All rights reserved.
+See MITKCopyright.txt or http://www.mitk.org/copyright.html for details.
+
+This software is distributed WITHOUT ANY WARRANTY; without even
+the implied warranty of MERCHANTABILITY or FITNESS FOR A PARTICULAR
+PURPOSE. See the above copyright notices for more information.
+
+=========================================================================*/
+
+#include "mitkFiberBundleWriter.h"
+#include <tinyxml.h>
+
+const char* mitk::FiberBundleWriter::XML_GEOMETRY = "geometry";
+
+const char* mitk::FiberBundleWriter::XML_MATRIX_XX = "xx";
+
+const char* mitk::FiberBundleWriter::XML_MATRIX_XY = "xy";
+
+const char* mitk::FiberBundleWriter::XML_MATRIX_XZ = "xz";
+
+const char* mitk::FiberBundleWriter::XML_MATRIX_YX = "yx";
+
+const char* mitk::FiberBundleWriter::XML_MATRIX_YY = "yy";
+
+const char* mitk::FiberBundleWriter::XML_MATRIX_YZ = "yz";
+
+const char* mitk::FiberBundleWriter::XML_MATRIX_ZX = "zx";
+
+const char* mitk::FiberBundleWriter::XML_MATRIX_ZY = "zy";
+
+const char* mitk::FiberBundleWriter::XML_MATRIX_ZZ = "zz";
+
+const char* mitk::FiberBundleWriter::XML_ORIGIN_X = "origin_x";
+
+const char* mitk::FiberBundleWriter::XML_ORIGIN_Y = "origin_y";
+
+const char* mitk::FiberBundleWriter::XML_ORIGIN_Z = "origin_z";
+
+const char* mitk::FiberBundleWriter::XML_SPACING_X = "spacing_x";
+
+const char* mitk::FiberBundleWriter::XML_SPACING_Y = "spacing_y";
+
+const char* mitk::FiberBundleWriter::XML_SPACING_Z = "spacing_z";
+
+const char* mitk::FiberBundleWriter::XML_SIZE_X = "size_x";
+
+const char* mitk::FiberBundleWriter::XML_SIZE_Y = "size_y";
+
+const char* mitk::FiberBundleWriter::XML_SIZE_Z = "size_z";
+
+const char* mitk::FiberBundleWriter::XML_FIBER_BUNDLE = "fiber_bundle";
+
+const char* mitk::FiberBundleWriter::XML_FIBER = "fiber";
+
+const char* mitk::FiberBundleWriter::XML_PARTICLE = "particle";
+
+const char* mitk::FiberBundleWriter::XML_ID = "id";
+
+const char* mitk::FiberBundleWriter::XML_POS_X = "pos_x";
+
+const char* mitk::FiberBundleWriter::XML_POS_Y = "pos_y";
+
+const char* mitk::FiberBundleWriter::XML_POS_Z = "pos_z";
+
+const char* mitk::FiberBundleWriter::XML_NUM_FIBERS = "num_fibers";
+
+const char* mitk::FiberBundleWriter::XML_NUM_PARTICLES = "num_particles";
+
+const char* mitk::FiberBundleWriter::XML_FIBER_BUNDLE_FILE = "fiber_bundle_file" ;
+
+const char* mitk::FiberBundleWriter::XML_FILE_VERSION = "file_version" ;
+
+const char* mitk::FiberBundleWriter::VERSION_STRING = "0.1" ;
+
+const char* mitk::FiberBundleWriter::ASCII_FILE = "ascii_file" ;
+
+const char* mitk::FiberBundleWriter::FILE_NAME = "file_name" ;
+
+mitk::FiberBundleWriter::FiberBundleWriter()
+ : m_FileName(""), m_FilePrefix(""), m_FilePattern(""), m_Success(false)
+{
+ this->SetNumberOfRequiredInputs( 1 );
+}
+
+
+mitk::FiberBundleWriter::~FiberBundleWriter()
+{}
+
+
+void mitk::FiberBundleWriter::GenerateData()
+{
+ MITK_INFO << "Writing fiber bundle";
+ m_Success = false;
+ InputType* input = this->GetInput();
+ if (input == NULL)
+ {
+ itkWarningMacro(<<"Sorry, input to FiberBundleWriter is NULL!");
+ return;
+ }
+ if ( m_FileName == "" )
+ {
+ itkWarningMacro( << "Sorry, filename has not been set!" );
+ return ;
+ }
+
+ std::string ext = itksys::SystemTools::GetFilenameLastExtension(m_FileName);
+ ext = itksys::SystemTools::LowerCase(ext);
+
+ if (ext == ".fib")
+ {
+ /* direct linked includes of mitkFiberBundle DataStructure */
+ typedef mitk::FiberBundle::ContainerPointType ContainerPointType;
+ typedef mitk::FiberBundle::ContainerTractType ContainerTractType;
+ typedef mitk::FiberBundle::ContainerType ContainerType;
+
+ ContainerType::Pointer tractContainer = input->GetTractContainer();
+ mitk::Geometry3D* geometry = input->GetGeometry();
+
+ TiXmlDocument documentXML;
+ TiXmlDeclaration* declXML = new TiXmlDeclaration( "1.0", "", "" ); // TODO what to write here? encoding? etc....
+ documentXML.LinkEndChild( declXML );
+
+ TiXmlElement* mainXML = new TiXmlElement(mitk::FiberBundleWriter::XML_FIBER_BUNDLE_FILE);
+ mainXML->SetAttribute(mitk::FiberBundleWriter::XML_FILE_VERSION, mitk::FiberBundleWriter::VERSION_STRING);
+ documentXML.LinkEndChild(mainXML);
+
+ TiXmlElement* geometryXML = new TiXmlElement(mitk::FiberBundleWriter::XML_GEOMETRY);
+ geometryXML->SetDoubleAttribute(mitk::FiberBundleWriter::XML_MATRIX_XX, geometry->GetMatrixColumn(0)[0]);
+ geometryXML->SetDoubleAttribute(mitk::FiberBundleWriter::XML_MATRIX_XY, geometry->GetMatrixColumn(0)[1]);
+ geometryXML->SetDoubleAttribute(mitk::FiberBundleWriter::XML_MATRIX_XZ, geometry->GetMatrixColumn(0)[2]);
+ geometryXML->SetDoubleAttribute(mitk::FiberBundleWriter::XML_MATRIX_YX, geometry->GetMatrixColumn(1)[0]);
+ geometryXML->SetDoubleAttribute(mitk::FiberBundleWriter::XML_MATRIX_YY, geometry->GetMatrixColumn(1)[1]);
+ geometryXML->SetDoubleAttribute(mitk::FiberBundleWriter::XML_MATRIX_YZ, geometry->GetMatrixColumn(1)[2]);
+ geometryXML->SetDoubleAttribute(mitk::FiberBundleWriter::XML_MATRIX_ZX, geometry->GetMatrixColumn(2)[0]);
+ geometryXML->SetDoubleAttribute(mitk::FiberBundleWriter::XML_MATRIX_ZY, geometry->GetMatrixColumn(2)[1]);
+ geometryXML->SetDoubleAttribute(mitk::FiberBundleWriter::XML_MATRIX_ZZ, geometry->GetMatrixColumn(2)[2]);
+
+ geometryXML->SetDoubleAttribute(mitk::FiberBundleWriter::XML_ORIGIN_X, geometry->GetOrigin()[0]);
+ geometryXML->SetDoubleAttribute(mitk::FiberBundleWriter::XML_ORIGIN_Y, geometry->GetOrigin()[1]);
+ geometryXML->SetDoubleAttribute(mitk::FiberBundleWriter::XML_ORIGIN_Z, geometry->GetOrigin()[2]);
+
+ geometryXML->SetDoubleAttribute(mitk::FiberBundleWriter::XML_SPACING_X, geometry->GetSpacing()[0]);
+ geometryXML->SetDoubleAttribute(mitk::FiberBundleWriter::XML_SPACING_Y, geometry->GetSpacing()[1]);
+ geometryXML->SetDoubleAttribute(mitk::FiberBundleWriter::XML_SPACING_Z, geometry->GetSpacing()[2]);
+
+ geometryXML->SetDoubleAttribute(mitk::FiberBundleWriter::XML_SIZE_X, input->GetBounds()[0]);
+ geometryXML->SetDoubleAttribute(mitk::FiberBundleWriter::XML_SIZE_Y, input->GetBounds()[1]);
+ geometryXML->SetDoubleAttribute(mitk::FiberBundleWriter::XML_SIZE_Z, input->GetBounds()[2]);
+
+ mainXML->LinkEndChild(geometryXML);
+
+ TiXmlElement* fiberBundleXML = new TiXmlElement(mitk::FiberBundleWriter::XML_FIBER_BUNDLE);
+ fiberBundleXML->SetAttribute(mitk::FiberBundleWriter::XML_NUM_FIBERS, tractContainer->size());
+ int numParticles = 0;
+ for (int i=0; i<tractContainer->Size(); i++)
+ {
+ ContainerTractType::Pointer tract = tractContainer->GetElement(i);
+ TiXmlElement* fiberXML = new TiXmlElement(mitk::FiberBundleWriter::XML_FIBER);
+ fiberXML->SetAttribute(mitk::FiberBundleWriter::XML_ID, i);
+ fiberXML->SetAttribute(mitk::FiberBundleWriter::XML_NUM_PARTICLES, tract->Size());
+ numParticles += tract->Size();
+ for (int j=0; j<tract->Size(); j++)
+ {
+ TiXmlElement* particleXML = new TiXmlElement(mitk::FiberBundleWriter::XML_PARTICLE);
+ ContainerPointType p = tract->GetElement(j);
+ particleXML->SetAttribute(mitk::FiberBundleWriter::XML_ID, j);
+ particleXML->SetDoubleAttribute(mitk::FiberBundleWriter::XML_POS_X, p[0]);
+ particleXML->SetDoubleAttribute(mitk::FiberBundleWriter::XML_POS_Y, p[1]);
+ particleXML->SetDoubleAttribute(mitk::FiberBundleWriter::XML_POS_Z, p[2]);
+ fiberXML->LinkEndChild(particleXML);
+ }
+ fiberBundleXML->LinkEndChild(fiberXML);
+ }
+ fiberBundleXML->SetAttribute(mitk::FiberBundleWriter::XML_NUM_PARTICLES, numParticles);
+ mainXML->LinkEndChild(fiberBundleXML);
+
+ documentXML.SaveFile( m_FileName );
+
+ m_Success = true;
+
+ MITK_INFO << "Fiber bundle written";
+
+ }else if (ext == ".afib" || ext == ".vtk") {
+ vtkPolyDataWriter* writer = vtkPolyDataWriter::New();
+ writer->SetInput(input->GeneratePolydata());
+ writer->SetFileName(m_FileName.c_str());
+ writer->SetFileTypeToASCII();
+ writer->Write();
+
+ m_Success = true;
+ MITK_INFO << "Fiber bundle written as polydata";
+ }
+
+}
+
+
+void mitk::FiberBundleWriter::SetInputFiberBundle( InputType* diffVolumes )
+{
+ this->ProcessObject::SetNthInput( 0, diffVolumes );
+}
+
+
+mitk::FiberBundle* mitk::FiberBundleWriter::GetInput()
+{
+ if ( this->GetNumberOfInputs() < 1 )
+ {
+ return NULL;
+ }
+ else
+ {
+ return dynamic_cast<InputType*> ( this->ProcessObject::GetInput( 0 ) );
+ }
+}
+
+
+std::vector<std::string> mitk::FiberBundleWriter::GetPossibleFileExtensions()
+{
+ std::vector<std::string> possibleFileExtensions;
+ possibleFileExtensions.push_back(".fib");
+ possibleFileExtensions.push_back(".afib");
+ possibleFileExtensions.push_back(".vtk");
+ return possibleFileExtensions;
+}
diff --git a/Modules/DiffusionImaging/IODataStructures/FiberBundle/mitkFiberBundleWriter.h b/Modules/DiffusionImaging/IODataStructures/FiberBundle/mitkFiberBundleWriter.h
new file mode 100644
index 0000000000..a62a55601d
--- /dev/null
+++ b/Modules/DiffusionImaging/IODataStructures/FiberBundle/mitkFiberBundleWriter.h
@@ -0,0 +1,216 @@
+/*=========================================================================
+
+Program: Medical Imaging & Interaction Toolkit
+Language: C++
+Date: $Date: 2008-08-27 17:18:46 +0200 (Mi, 27 Aug 2008) $
+Version: $Revision: 15096 $
+
+Copyright (c) German Cancer Research Center, Division of Medical and
+Biological Informatics. All rights reserved.
+See MITKCopyright.txt or http://www.mitk.org/copyright.html for details.
+
+This software is distributed WITHOUT ANY WARRANTY; without even
+the implied warranty of MERCHANTABILITY or FITNESS FOR A PARTICULAR
+PURPOSE. See the above copyright notices for more information.
+
+=========================================================================*/
+
+#ifndef __mitkFiberBundleWriter_h
+#define __mitkFiberBundleWriter_h
+
+#include <itkProcessObject.h>
+#include <mitkFileWriterWithInformation.h>
+#include "mitkFiberBundle.h"
+#include <vtkPolyDataWriter.h>
+
+
+namespace mitk
+{
+
+/**
+ * Writes fiber bundles to a file
+ * @ingroup Process
+ */
+class FiberBundleWriter : public mitk::FileWriterWithInformation
+{
+public:
+
+ mitkClassMacro( FiberBundleWriter, mitk::FileWriterWithInformation );
+
+ //mitkWriterMacro;
+
+ virtual void Write()
+ {
+ if ( this->GetInput() == NULL )
+ {
+ itkExceptionMacro(<<"Write:Please specify an input!");
+ return;
+ }
+ /* Fill in image information.*/
+ this->UpdateOutputInformation();
+ (*(this->GetInputs().begin()))->SetRequestedRegionToLargestPossibleRegion();
+ this->PropagateRequestedRegion(NULL);
+ this->UpdateOutputData(NULL);
+ }
+
+ virtual void Update()
+ {
+ Write();
+ }
+
+ itkNewMacro( Self );
+
+ typedef mitk::FiberBundle InputType;
+
+ /**
+ * Sets the filename of the file to write.
+ * @param FileName the name of the file to write.
+ */
+ itkSetStringMacro( FileName );
+
+ /**
+ * @returns the name of the file to be written to disk.
+ */
+ itkGetStringMacro( FileName );
+
+ /**
+ * @warning multiple write not (yet) supported
+ */
+ itkSetStringMacro( FilePrefix );
+
+ /**
+ * @warning multiple write not (yet) supported
+ */
+ itkGetStringMacro( FilePrefix );
+
+ /**
+ * @warning multiple write not (yet) supported
+ */
+ itkSetStringMacro( FilePattern );
+
+ /**
+ * @warning multiple write not (yet) supported
+ */
+ itkGetStringMacro( FilePattern );
+
+ /**
+ * Sets the input object for the filter.
+ * @param input the diffusion volumes to write to file.
+ */
+ void SetInputFiberBundle( InputType* input );
+
+ /**
+ * @returns the 0'th input object of the filter.
+ */
+ InputType* GetInput();
+
+ /**
+ * Returns false if an error happened during writing
+ */
+ itkGetMacro( Success, bool );
+
+ /**
+ * @return possible file extensions for the data type associated with the writer
+ */
+ virtual std::vector<std::string> GetPossibleFileExtensions();
+
+ // FileWriterWithInformation methods
+ virtual const char * GetDefaultFilename() { return "FiberBundle.fib"; }
+ virtual const char * GetFileDialogPattern() { return "Fiber Bundle (*.fib *.afib *.vtk)"; }
+ virtual const char * GetDefaultExtension() { return ".fib"; }
+ virtual bool CanWriteBaseDataType(BaseData::Pointer data) { return (dynamic_cast<mitk::FiberBundle*>(data.GetPointer()) != NULL); };
+ virtual void DoWrite(BaseData::Pointer data) {
+ if (CanWriteBaseDataType(data)) {
+ this->SetInputFiberBundle(dynamic_cast<mitk::FiberBundle*>(data.GetPointer()));
+ this->Update();
+ }
+ };
+
+ static const char* XML_GEOMETRY;
+
+ static const char* XML_MATRIX_XX;
+
+ static const char* XML_MATRIX_XY;
+
+ static const char* XML_MATRIX_XZ;
+
+ static const char* XML_MATRIX_YX;
+
+ static const char* XML_MATRIX_YY;
+
+ static const char* XML_MATRIX_YZ;
+
+ static const char* XML_MATRIX_ZX;
+
+ static const char* XML_MATRIX_ZY;
+
+ static const char* XML_MATRIX_ZZ;
+
+ static const char* XML_ORIGIN_X;
+
+ static const char* XML_ORIGIN_Y;
+
+ static const char* XML_ORIGIN_Z;
+
+ static const char* XML_SPACING_X;
+
+ static const char* XML_SPACING_Y;
+
+ static const char* XML_SPACING_Z;
+
+ static const char* XML_SIZE_X;
+
+ static const char* XML_SIZE_Y;
+
+ static const char* XML_SIZE_Z;
+
+ static const char* XML_FIBER_BUNDLE;
+
+ static const char* XML_FIBER;
+
+ static const char* XML_PARTICLE;
+
+ static const char* XML_ID;
+
+ static const char* XML_POS_X;
+
+ static const char* XML_POS_Y;
+
+ static const char* XML_POS_Z;
+
+ static const char* VERSION_STRING;
+
+ static const char* XML_FIBER_BUNDLE_FILE;
+
+ static const char* XML_FILE_VERSION;
+
+ static const char* XML_NUM_FIBERS;
+
+ static const char* XML_NUM_PARTICLES;
+
+ static const char* ASCII_FILE;
+
+ static const char* FILE_NAME;
+
+protected:
+
+ FiberBundleWriter();
+
+ virtual ~FiberBundleWriter();
+
+ virtual void GenerateData();
+
+ std::string m_FileName;
+
+ std::string m_FilePrefix;
+
+ std::string m_FilePattern;
+
+ bool m_Success;
+
+};
+
+
+} // end of namespace mitk
+
+#endif //__mitkFiberBundleWriter_h
diff --git a/Modules/DiffusionImaging/IODataStructures/FiberBundle/mitkFiberBundleWriterFactory.cpp b/Modules/DiffusionImaging/IODataStructures/FiberBundle/mitkFiberBundleWriterFactory.cpp
new file mode 100644
index 0000000000..0b4bc55c37
--- /dev/null
+++ b/Modules/DiffusionImaging/IODataStructures/FiberBundle/mitkFiberBundleWriterFactory.cpp
@@ -0,0 +1,76 @@
+/*=========================================================================
+
+Program: Medical Imaging & Interaction Toolkit
+Language: C++
+Date: $Date: 2007-12-11 14:46:19 +0100 (Di, 11 Dez 2007) $
+Version: $Revision: 11215 $
+
+Copyright (c) German Cancer Research Center, Division of Medical and
+Biological Informatics. All rights reserved.
+See MITKCopyright.txt or http://www.mitk.org/copyright.html for details.
+
+This software is distributed WITHOUT ANY WARRANTY; without even
+the implied warranty of MERCHANTABILITY or FITNESS FOR A PARTICULAR
+PURPOSE. See the above copyright notices for more information.
+
+=========================================================================*/
+
+#include "mitkFiberBundleWriterFactory.h"
+
+#include "itkCreateObjectFunction.h"
+#include "itkVersion.h"
+
+#include "mitkFiberBundleWriter.h"
+
+namespace mitk
+{
+
+template <class T>
+class CreateFiberBundleWriter : public itk::CreateObjectFunctionBase
+{
+public:
+
+ /** Standard class typedefs. */
+ typedef CreateFiberBundleWriter Self;
+ typedef itk::SmartPointer<Self> Pointer;
+
+ /** Methods from itk:LightObject. */
+ itkFactorylessNewMacro(Self);
+ LightObject::Pointer CreateObject() { typename T::Pointer p = T::New();
+ p->Register();
+ return p.GetPointer();
+ }
+
+protected:
+ CreateFiberBundleWriter() {}
+ ~CreateFiberBundleWriter() {}
+
+private:
+ CreateFiberBundleWriter(const Self&); //purposely not implemented
+ void operator=(const Self&); //purposely not implemented
+};
+
+FiberBundleWriterFactory::FiberBundleWriterFactory()
+{
+ this->RegisterOverride("IOWriter",
+ "FiberBundleWriter",
+ "FiberBundle Writer",
+ 1,
+ mitk::CreateFiberBundleWriter< mitk::FiberBundleWriter >::New());
+}
+
+FiberBundleWriterFactory::~FiberBundleWriterFactory()
+{
+}
+
+const char* FiberBundleWriterFactory::GetITKSourceVersion() const
+{
+ return ITK_SOURCE_VERSION;
+}
+
+const char* FiberBundleWriterFactory::GetDescription() const
+{
+ return "FiberBundleWriterFactory";
+}
+
+} // end namespace mitk
diff --git a/Modules/DiffusionImaging/IODataStructures/FiberBundle/mitkFiberBundleWriterFactory.h b/Modules/DiffusionImaging/IODataStructures/FiberBundle/mitkFiberBundleWriterFactory.h
new file mode 100644
index 0000000000..15459f7ef1
--- /dev/null
+++ b/Modules/DiffusionImaging/IODataStructures/FiberBundle/mitkFiberBundleWriterFactory.h
@@ -0,0 +1,68 @@
+/*=========================================================================
+
+Program: Medical Imaging & Interaction Toolkit
+Language: C++
+Date: $Date: 2009-05-13 18:06:46 +0200 (Mi, 13 Mai 2009) $
+Version: $Revision: 11215 $
+
+Copyright (c) German Cancer Research Center, Division of Medical and
+Biological Informatics. All rights reserved.
+See MITKCopyright.txt or http://www.mitk.org/copyright.html for details.
+
+This software is distributed WITHOUT ANY WARRANTY; without even
+the implied warranty of MERCHANTABILITY or FITNESS FOR A PARTICULAR
+PURPOSE. See the above copyright notices for more information.
+
+=========================================================================*/
+
+#ifndef FIBERBUNDLE_WRITERFACTORY_H_HEADER_INCLUDED
+#define FIBERBUNDLE_WRITERFACTORY_H_HEADER_INCLUDED
+
+#include "itkObjectFactoryBase.h"
+#include "mitkBaseData.h"
+#include "MitkDiffusionImagingExports.h"
+
+namespace mitk
+{
+
+class MitkDiffusionImaging_EXPORT FiberBundleWriterFactory : public itk::ObjectFactoryBase
+{
+public:
+
+ mitkClassMacro( mitk::FiberBundleWriterFactory, itk::ObjectFactoryBase )
+
+ /** Class methods used to interface with the registered factories. */
+ virtual const char* GetITKSourceVersion(void) const;
+ virtual const char* GetDescription(void) const;
+
+ /** Method for class instantiation. */
+ itkFactorylessNewMacro(Self);
+
+ /** Register one factory of this type */
+ static void RegisterOneFactory(void)
+ {
+ static bool IsRegistered = false;
+ if ( !IsRegistered )
+ {
+ FiberBundleWriterFactory::Pointer ugVtkWriterFactory = FiberBundleWriterFactory::New();
+ ObjectFactoryBase::RegisterFactory( ugVtkWriterFactory );
+ IsRegistered = true;
+ }
+ }
+
+protected:
+ FiberBundleWriterFactory();
+ ~FiberBundleWriterFactory();
+
+private:
+ FiberBundleWriterFactory(const Self&); //purposely not implemented
+ void operator=(const Self&); //purposely not implemented
+
+};
+
+} // end namespace mitk
+
+#endif // FIBERBUNDLE_WRITERFACTORY_H_HEADER_INCLUDED
+
+
+
diff --git a/BlueBerry/Bundles/org.blueberry.ui/src/internal/berryTweaklets.cpp b/Modules/DiffusionImaging/IODataStructures/FiberBundle/mitkParticle.cpp
old mode 100755
new mode 100644
similarity index 55%
copy from BlueBerry/Bundles/org.blueberry.ui/src/internal/berryTweaklets.cpp
copy to Modules/DiffusionImaging/IODataStructures/FiberBundle/mitkParticle.cpp
index 44b6d8851f..d2da8870ee
--- a/BlueBerry/Bundles/org.blueberry.ui/src/internal/berryTweaklets.cpp
+++ b/Modules/DiffusionImaging/IODataStructures/FiberBundle/mitkParticle.cpp
@@ -1,26 +1,45 @@
/*=========================================================================
-
- Program: BlueBerry Platform
- Language: C++
- Date: $Date$
- Version: $Revision$
-
Copyright (c) German Cancer Research Center, Division of Medical and
Biological Informatics. All rights reserved.
See MITKCopyright.txt or http://www.mitk.org/copyright.html for details.
-
+
This software is distributed WITHOUT ANY WARRANTY; without even
the implied warranty of MERCHANTABILITY or FITNESS FOR A PARTICULAR
PURPOSE. See the above copyright notices for more information.
-
+
=========================================================================*/
-#include "berryTweaklets.h"
+#include "mitkParticle.h"
-namespace berry
+namespace mitk
{
+ Particle::Particle()
+ {
+
+ }
+
+ Particle::~Particle()
+ {
+
+ }
+
+ void Particle::SetDirection(VectorType dir)
+ {
+ this->m_Direction = dir;
+ }
+
+ void Particle::SetPosition(VectorType pos)
+ {
+ this->m_Position = pos;
+ }
-std::map<Tweaklets::TweakKey_base, Object::Pointer> Tweaklets::defaults;
-std::map<Tweaklets::TweakKey_base, Object::Pointer> Tweaklets::tweaklets;
+ Particle::VectorType Particle::GetDirection()
+ {
+ return this->m_Direction;
+ }
+ Particle::VectorType Particle::GetPosition()
+ {
+ return this->m_Position;
+ }
}
diff --git a/Modules/DiffusionImaging/IODataStructures/FiberBundle/mitkParticle.h b/Modules/DiffusionImaging/IODataStructures/FiberBundle/mitkParticle.h
new file mode 100644
index 0000000000..d8f5237138
--- /dev/null
+++ b/Modules/DiffusionImaging/IODataStructures/FiberBundle/mitkParticle.h
@@ -0,0 +1,51 @@
+
+/*=========================================================================
+ Program: Medical Imaging & Interaction Toolkit
+ Module: $RCSfile$
+ Language: C++
+ Date: $Date$
+ Version: $Revision: 11989 $
+
+ Copyright (c) German Cancer Research Center, Division of Medical and
+ Biological Informatics. All rights reserved.
+ See MITKCopyright.txt or http://www.mitk.org/copyright.html for details.
+
+ This software is distributed WITHOUT ANY WARRANTY; without even
+ the implied warranty of MERCHANTABILITY or FITNESS FOR A PARTICULAR
+ PURPOSE. See the above copyright notices for more information.
+
+ =========================================================================*/
+
+
+#ifndef _MITK_Particle_H
+#define _MITK_Particle_H
+
+#include "mitkBaseData.h"
+#include "MitkDiffusionImagingExports.h"
+
+namespace mitk {
+
+ /**
+ * \brief Base Class for Fiber Segments; */
+ class MitkDiffusionImaging_EXPORT Particle
+ {
+ public:
+ Particle();
+ virtual ~Particle();
+
+ typedef vnl_vector_fixed<float, 3> VectorType;
+
+ void SetDirection(VectorType dir);
+ void SetPosition(VectorType pos);
+
+ VectorType GetPosition();
+ VectorType GetDirection();
+
+ protected:
+ VectorType m_Position; // position
+ VectorType m_Direction; // direction
+ };
+
+} // namespace mitk
+
+#endif /* _MITK_Particle_H */
diff --git a/Modules/DiffusionImaging/IODataStructures/PlanarFigureComposite/mitkPlanarFigureComposite.cpp b/Modules/DiffusionImaging/IODataStructures/PlanarFigureComposite/mitkPlanarFigureComposite.cpp
new file mode 100644
index 0000000000..a59aaefbf0
--- /dev/null
+++ b/Modules/DiffusionImaging/IODataStructures/PlanarFigureComposite/mitkPlanarFigureComposite.cpp
@@ -0,0 +1,132 @@
+/*
+ * mitkPlanarFigureComposite.cpp
+ * mitk-all
+ *
+ * Created by HAL9000 on 2/4/11.
+ * Copyright 2011 __MyCompanyName__. All rights reserved.
+ *
+ */
+
+#include "mitkPlanarFigureComposite.h"
+
+
+mitk::PlanarFigureComposite::PlanarFigureComposite()
+
+{
+ m_PFVector = CompositionContainer::New();
+ m_DNVector = DataNodeContainer::New();
+
+}
+
+mitk::PlanarFigureComposite::~PlanarFigureComposite()
+{
+
+}
+
+void mitk::PlanarFigureComposite::addDataNode(mitk::DataNode::Pointer dnode)
+{
+
+ m_DNVector->InsertElement(m_DNVector->Size(), dnode);
+
+}
+
+
+void mitk::PlanarFigureComposite::addPlanarFigure(PlanarFigure::Pointer pf)
+{
+
+ MITK_INFO << "addPlanarFigure: size before: " << this->getNumberOfChildren();
+ m_PFVector->InsertElement(m_PFVector->Size(), pf);
+ MITK_INFO << "addPlanarFigure: size after: " << this->getNumberOfChildren();
+
+
+
+
+}
+
+void mitk::PlanarFigureComposite::replaceDataNodeAt(int idx, mitk::DataNode::Pointer dn)
+{
+ MITK_INFO << "replace: size before: " << this->getNumberOfChildren();
+ m_DNVector->SetElement( idx, dn );
+ MITK_INFO << "replace: size after: " << this->getNumberOfChildren();
+
+}
+
+void mitk::PlanarFigureComposite::setOperationType(PFCompositionOperation pfcOp)
+{
+ this->m_compOperation = pfcOp;
+ MITK_INFO << "Composition set to: " << this->getOperationType();
+
+}
+
+
+mitk::PFCompositionOperation mitk::PlanarFigureComposite::getOperationType()
+{
+ return this->m_compOperation;
+
+
+}
+
+void mitk::PlanarFigureComposite::setDisplayName(std::string displName)
+{
+
+ m_name = displName;
+
+}
+
+
+std::string mitk::PlanarFigureComposite::getDisplayName()
+{
+ return m_name;
+}
+
+
+int mitk::PlanarFigureComposite::getNumberOfChildren()
+{
+ return m_PFVector->Size();
+
+}
+
+mitk::PlanarFigure::Pointer mitk::PlanarFigureComposite::getChildAt(int idx)
+{
+
+ return m_PFVector->ElementAt(idx);
+}
+
+
+mitk::DataNode::Pointer mitk::PlanarFigureComposite::getDataNodeAt(int idx)
+{
+
+ return m_DNVector->ElementAt(idx);
+
+}
+
+
+
+
+
+
+//musthave implementations from superclass.... not sure if return true makes sense
+bool mitk::PlanarFigureComposite::SetControlPoint( unsigned int index, const Point2D &point, bool createIfDoesNotExist )
+{
+ return true;
+}
+
+void mitk::PlanarFigureComposite::GeneratePolyLine()
+{
+
+}
+
+void mitk::PlanarFigureComposite::GenerateHelperPolyLine(double /*mmPerDisplayUnit*/, unsigned int /*displayHeight*/)
+{
+ // A circle does not require a helper object
+}
+
+void mitk::PlanarFigureComposite::EvaluateFeaturesInternal()
+{
+
+}
+
+void mitk::PlanarFigureComposite::PrintSelf( std::ostream& os, itk::Indent indent) const
+{
+
+}
diff --git a/Modules/DiffusionImaging/IODataStructures/PlanarFigureComposite/mitkPlanarFigureComposite.h b/Modules/DiffusionImaging/IODataStructures/PlanarFigureComposite/mitkPlanarFigureComposite.h
new file mode 100644
index 0000000000..09212e2065
--- /dev/null
+++ b/Modules/DiffusionImaging/IODataStructures/PlanarFigureComposite/mitkPlanarFigureComposite.h
@@ -0,0 +1,110 @@
+/*
+ * mitkPlanarFigureComposite.h
+ * mitk-all
+ *
+ * Created by HAL9000 on 2/4/11.
+ * Copyright 2011 __MyCompanyName__. All rights reserved.
+ *
+ */
+
+#ifndef _MITK_PLANARFIGURECOMPOSITE_H
+#define _MITK_PLANARFIGURECOMPOSITE_H
+
+#include "mitkCommon.h"
+#include "mitkBaseData.h"
+#include "MitkDiffusionImagingExports.h"
+#include "mitkPlanarFigure.h"
+#include "itkVectorContainer.h"
+#include "mitkDataNode.h"
+
+
+namespace mitk {
+
+ enum PFCompositionOperation {
+ PFCOMPOSITION_AND_OPERATION,
+ PFCOMPOSITION_OR_OPERATION,
+ PFCOMPOSITION_NOT_OPERATION,
+ };
+
+
+
+
+ class MitkDiffusionImaging_EXPORT PlanarFigureComposite : public PlanarFigure
+ {
+
+ typedef itk::VectorContainer<unsigned int, PlanarFigure::Pointer> CompositionContainer;
+ typedef itk::VectorContainer<unsigned int, mitk::DataNode::Pointer> DataNodeContainer;
+
+
+ public:
+ mitkClassMacro(PlanarFigureComposite, PlanarFigure);
+ itkNewMacro( Self );
+
+ // ///MUST HAVE IMPLEMENTATION//////
+ bool SetControlPoint( unsigned int index, const Point2D &point, bool createIfDoesNotExist );
+ unsigned int GetMinimumNumberOfControlPoints() const
+ {
+ return 0;
+ }
+ /** \brief Circle has 2 control points per definition. */
+ unsigned int GetMaximumNumberOfControlPoints() const
+ {
+ return 0;
+ }
+ // /////////////////////////
+
+
+
+ int getNumberOfChildren();
+ mitk::PlanarFigure::Pointer getChildAt(int);
+ void addPlanarFigure(PlanarFigure::Pointer);
+
+
+ mitk::DataNode::Pointer getDataNodeAt(int);
+ void addDataNode(mitk::DataNode::Pointer);
+ void replaceDataNodeAt(int, mitk::DataNode::Pointer);
+
+ // set if this compsition is AND, OR, NOT
+ void setOperationType(PFCompositionOperation);
+ PFCompositionOperation getOperationType();
+
+ void setDisplayName(std::string);
+ std::string getDisplayName();
+
+ protected:
+ PlanarFigureComposite();
+ virtual ~PlanarFigureComposite();
+
+
+
+ // ///MUST HAVE IMPLEMENTATION//////
+ /** \brief Generates the poly-line representation of the planar figure. */
+ virtual void GeneratePolyLine();
+
+ /** \brief Generates the poly-lines that should be drawn the same size regardless of zoom.*/
+ virtual void GenerateHelperPolyLine(double mmPerDisplayUnit, unsigned int displayHeight);
+
+ /** \brief Calculates feature quantities of the planar figure. */
+ virtual void EvaluateFeaturesInternal();
+
+ virtual void PrintSelf( std::ostream &os, itk::Indent indent ) const;
+ // ////////////////////
+
+
+
+
+ private:
+ //this vector takes planarfigures and planarfigureComosite types
+ CompositionContainer::Pointer m_PFVector;
+ PFCompositionOperation m_compOperation;
+
+ DataNodeContainer::Pointer m_DNVector;
+ std::string m_name;
+
+
+
+ };
+
+}
+
+#endif
diff --git a/Modules/DiffusionImaging/IODataStructures/QBallImages/mitkNrrdQBallImageWriter.h b/Modules/DiffusionImaging/IODataStructures/QBallImages/mitkNrrdQBallImageWriter.h
index bdcded426b..b35ed38398 100644
--- a/Modules/DiffusionImaging/IODataStructures/QBallImages/mitkNrrdQBallImageWriter.h
+++ b/Modules/DiffusionImaging/IODataStructures/QBallImages/mitkNrrdQBallImageWriter.h
@@ -1,130 +1,130 @@
/*=========================================================================
Program: Medical Imaging & Interaction Toolkit
Language: C++
Date: $Date: 2008-08-27 17:18:46 +0200 (Mi, 27 Aug 2008) $
Version: $Revision: 15096 $
Copyright (c) German Cancer Research Center, Division of Medical and
Biological Informatics. All rights reserved.
See MITKCopyright.txt or http://www.mitk.org/copyright.html for details.
This software is distributed WITHOUT ANY WARRANTY; without even
the implied warranty of MERCHANTABILITY or FITNESS FOR A PARTICULAR
PURPOSE. See the above copyright notices for more information.
=========================================================================*/
#ifndef _MITK_NRRDQBI_WRITER__H_
#define _MITK_NRRDQBI_WRITER__H_
#include <itkProcessObject.h>
#include <mitkFileWriterWithInformation.h>
#include <mitkQBallImage.h>
namespace mitk
{
/**
* Writes diffusion volumes to a file
* @ingroup Process
*/
class NrrdQBallImageWriter : public mitk::FileWriterWithInformation
{
public:
mitkClassMacro( NrrdQBallImageWriter, mitk::FileWriterWithInformation );
mitkWriterMacro;
itkNewMacro( Self );
typedef mitk::QBallImage InputType;
/**
* Sets the filename of the file to write.
* @param FileName the name of the file to write.
*/
itkSetStringMacro( FileName );
/**
* @returns the name of the file to be written to disk.
*/
itkGetStringMacro( FileName );
/**
* @warning multiple write not (yet) supported
*/
itkSetStringMacro( FilePrefix );
/**
* @warning multiple write not (yet) supported
*/
itkGetStringMacro( FilePrefix );
/**
* @warning multiple write not (yet) supported
*/
itkSetStringMacro( FilePattern );
/**
* @warning multiple write not (yet) supported
*/
itkGetStringMacro( FilePattern );
/**
* Sets the input object for the filter.
* @param input the diffusion volumes to write to file.
*/
void SetInput( InputType* input );
/**
* @returns the 0'th input object of the filter.
*/
InputType* GetInput();
/**
* Returns false if an error happened during writing
*/
itkGetMacro( Success, bool );
/**
* @return possible file extensions for the data type associated with the writer
*/
virtual std::vector<std::string> GetPossibleFileExtensions();
// FileWriterWithInformation methods
virtual const char * GetDefaultFilename() { return "QBalls.qbi"; }
virtual const char * GetFileDialogPattern() { return "Q-Ball Images (*.qbi *.hqbi"; }
virtual const char * GetDefaultExtension() { return ".qbi"; }
- virtual bool CanWriteDataType(BaseData::Pointer data) { return (dynamic_cast<mitk::QBallImage*>(data.GetPointer()) != NULL); };
+ virtual bool CanWriteBaseDataType(BaseData::Pointer data) { return (dynamic_cast<mitk::QBallImage*>(data.GetPointer()) != NULL); };
virtual void DoWrite(BaseData::Pointer data) {
- if (CanWriteDataType(data)) {
+ if (CanWriteBaseDataType(data)) {
this->SetInput(dynamic_cast<mitk::QBallImage*>(data.GetPointer()));
this->Update();
}
};
protected:
NrrdQBallImageWriter();
virtual ~NrrdQBallImageWriter();
virtual void GenerateData();
std::string m_FileName;
std::string m_FilePrefix;
std::string m_FilePattern;
bool m_Success;
};
} // end of namespace mitk
#endif //_MITK_NRRDQBI_WRITER__H_
diff --git a/Modules/DiffusionImaging/IODataStructures/QBallImages/mitkQBallImageSerializer.cpp b/Modules/DiffusionImaging/IODataStructures/QBallImages/mitkQBallImageSerializer.cpp
new file mode 100644
index 0000000000..ead0295511
--- /dev/null
+++ b/Modules/DiffusionImaging/IODataStructures/QBallImages/mitkQBallImageSerializer.cpp
@@ -0,0 +1,75 @@
+/*=========================================================================
+
+Program: Medical Imaging & Interaction Toolkit
+Language: C++
+Date: $Date$
+Version: $Revision: 1.12 $
+
+Copyright (c) German Cancer Research Center, Division of Medical and
+Biological Informatics. All rights reserved.
+See MITKCopyright.txt or http://www.mitk.org/copyright.html for details.
+
+This software is distributed WITHOUT ANY WARRANTY; without even
+the implied warranty of MERCHANTABILITY or FITNESS FOR A PARTICULAR
+PURPOSE. See the above copyright notices for more information.
+
+=========================================================================*/
+
+#include "mitkQBallImageSerializer.h"
+#include "mitkQBallImage.h"
+#include "mitkNrrdQBallImageWriter.h"
+
+#include <itksys/SystemTools.hxx>
+
+
+MITK_REGISTER_SERIALIZER(QBallImageSerializer)
+
+
+mitk::QBallImageSerializer::QBallImageSerializer()
+{
+}
+
+
+mitk::QBallImageSerializer::~QBallImageSerializer()
+{
+}
+
+
+std::string mitk::QBallImageSerializer::Serialize()
+{
+ const QBallImage* image = dynamic_cast<const QBallImage*>( m_Data.GetPointer() );
+ if (image == NULL)
+ {
+ MITK_ERROR << " Object at " << (const void*) this->m_Data
+ << " is not an mitk::NrrdQBallImage. Cannot serialize as NrrdQBallImage.";
+ return "";
+ }
+
+ std::string filename( this->GetUniqueFilenameInWorkingDirectory() );
+ filename += "_";
+ filename += m_FilenameHint;
+ filename += ".qbi";
+
+ std::string fullname(m_WorkingDirectory);
+ fullname += "/";
+ fullname += itksys::SystemTools::ConvertToOutputPath(filename.c_str());
+
+ try
+ {
+ NrrdQBallImageWriter::Pointer writer = NrrdQBallImageWriter::New();
+ writer->SetFileName(fullname);
+ writer->SetInput(const_cast<QBallImage*>(image));
+ writer->Write();
+ }
+ catch (std::exception& e)
+ {
+ MITK_ERROR << " Error serializing object at " << (const void*) this->m_Data
+ << " to "
+ << fullname
+ << ": "
+ << e.what();
+ return "";
+ }
+ return filename;
+}
+
diff --git a/Modules/SceneSerializationBase/mitkBasePropertyDeserializer.cpp b/Modules/DiffusionImaging/IODataStructures/QBallImages/mitkQBallImageSerializer.h
similarity index 54%
rename from Modules/SceneSerializationBase/mitkBasePropertyDeserializer.cpp
rename to Modules/DiffusionImaging/IODataStructures/QBallImages/mitkQBallImageSerializer.h
index 0940080d22..9745e79c17 100644
--- a/Modules/SceneSerializationBase/mitkBasePropertyDeserializer.cpp
+++ b/Modules/DiffusionImaging/IODataStructures/QBallImages/mitkQBallImageSerializer.h
@@ -1,33 +1,40 @@
/*=========================================================================
Program: Medical Imaging & Interaction Toolkit
Language: C++
Date: $Date$
Version: $Revision: 1.12 $
Copyright (c) German Cancer Research Center, Division of Medical and
Biological Informatics. All rights reserved.
See MITKCopyright.txt or http://www.mitk.org/copyright.html for details.
This software is distributed WITHOUT ANY WARRANTY; without even
the implied warranty of MERCHANTABILITY or FITNESS FOR A PARTICULAR
PURPOSE. See the above copyright notices for more information.
=========================================================================*/
-#include "mitkBasePropertyDeserializer.h"
+#ifndef mitkQBallImageSerializer_h_included
+#define mitkQBallImageSerializer_h_included
-mitk::BasePropertyDeserializer::BasePropertyDeserializer()
-{
-}
+#include "MitkDiffusionImagingExports.h"
+#include "mitkBaseDataSerializer.h"
-mitk::BasePropertyDeserializer::~BasePropertyDeserializer()
+namespace mitk
{
-}
-
-mitk::BaseProperty::Pointer mitk::BasePropertyDeserializer::Deserialize(TiXmlElement* /*element*/)
+/**
+ \brief Serializes mitk::Surface for mitk::SceneIO
+*/
+class MitkDiffusionImaging_EXPORT QBallImageSerializer : public BaseDataSerializer
{
- MITK_ERROR << this->GetNameOfClass() << " is asked to deserialize an object but has no implementation. This is bad.";
- return NULL;
-}
-
+ public:
+ mitkClassMacro( QBallImageSerializer, BaseDataSerializer );
+ itkNewMacro(Self);
+ virtual std::string Serialize();
+ protected:
+ QBallImageSerializer();
+ virtual ~QBallImageSerializer();
+};
+} // namespace
+#endif
diff --git a/Modules/DiffusionImaging/IODataStructures/TensorImages/mitkNrrdTensorImageWriter.cpp b/Modules/DiffusionImaging/IODataStructures/TensorImages/mitkNrrdTensorImageWriter.cpp
index 60d96532e3..ae034449f0 100644
--- a/Modules/DiffusionImaging/IODataStructures/TensorImages/mitkNrrdTensorImageWriter.cpp
+++ b/Modules/DiffusionImaging/IODataStructures/TensorImages/mitkNrrdTensorImageWriter.cpp
@@ -1,106 +1,107 @@
/*=========================================================================
Program: Medical Imaging & Interaction Toolkit
Language: C++
Date: $Date: 2008-12-10 18:05:13 +0100 (Mi, 10 Dez 2008) $
Version: $Revision: 15922 $
Copyright (c) German Cancer Research Center, Division of Medical and
Biological Informatics. All rights reserved.
See MITKCopyright.txt or http://www.mitk.org/copyright.html for details.
This software is distributed WITHOUT ANY WARRANTY; without even
the implied warranty of MERCHANTABILITY or FITNESS FOR A PARTICULAR
PURPOSE. See the above copyright notices for more information.
=========================================================================*/
#include "mitkNrrdTensorImageWriter.h"
#include "itkMetaDataDictionary.h"
#include "itkMetaDataObject.h"
#include "itkNrrdImageIO.h"
#include "itkImageFileWriter.h"
+#include "itkDiffusionTensor3D.h"
#include "mitkImageCast.h"
mitk::NrrdTensorImageWriter::NrrdTensorImageWriter()
: m_FileName(""), m_FilePrefix(""), m_FilePattern(""), m_Success(false)
{
this->SetNumberOfRequiredInputs( 1 );
}
mitk::NrrdTensorImageWriter::~NrrdTensorImageWriter()
{}
void mitk::NrrdTensorImageWriter::GenerateData()
{
m_Success = false;
InputType* input = this->GetInput();
if (input == NULL)
{
itkWarningMacro(<<"Sorry, input to NrrdTensorImageWriter is NULL!");
return;
}
if ( m_FileName == "" )
{
itkWarningMacro( << "Sorry, filename has not been set!" );
return ;
}
itk::NrrdImageIO::Pointer io = itk::NrrdImageIO::New();
io->SetFileType( itk::ImageIOBase::Binary );
io->UseCompressionOn();
typedef itk::Image<itk::DiffusionTensor3D<float>,3> ImageType;
typedef itk::ImageFileWriter<ImageType> WriterType;
WriterType::Pointer nrrdWriter = WriterType::New();
ImageType::Pointer outimage = ImageType::New();
CastToItkImage(input, outimage);
nrrdWriter->SetInput( outimage );
nrrdWriter->SetImageIO(io);
nrrdWriter->SetFileName(m_FileName);
nrrdWriter->UseCompressionOn();
try
{
nrrdWriter->Update();
}
catch (itk::ExceptionObject e)
{
std::cout << e << std::endl;
}
m_Success = true;
}
void mitk::NrrdTensorImageWriter::SetInput( InputType* diffVolumes )
{
this->ProcessObject::SetNthInput( 0, diffVolumes );
}
mitk::TensorImage* mitk::NrrdTensorImageWriter::GetInput()
{
if ( this->GetNumberOfInputs() < 1 )
{
return NULL;
}
else
{
return dynamic_cast<InputType*> ( this->ProcessObject::GetInput( 0 ) );
}
}
std::vector<std::string> mitk::NrrdTensorImageWriter::GetPossibleFileExtensions()
{
std::vector<std::string> possibleFileExtensions;
possibleFileExtensions.push_back(".dti");
possibleFileExtensions.push_back(".hdti");
return possibleFileExtensions;
}
diff --git a/Modules/DiffusionImaging/IODataStructures/TensorImages/mitkNrrdTensorImageWriter.h b/Modules/DiffusionImaging/IODataStructures/TensorImages/mitkNrrdTensorImageWriter.h
index 67d5a22286..654f265409 100644
--- a/Modules/DiffusionImaging/IODataStructures/TensorImages/mitkNrrdTensorImageWriter.h
+++ b/Modules/DiffusionImaging/IODataStructures/TensorImages/mitkNrrdTensorImageWriter.h
@@ -1,130 +1,130 @@
/*=========================================================================
Program: Medical Imaging & Interaction Toolkit
Language: C++
Date: $Date: 2008-08-27 17:18:46 +0200 (Mi, 27 Aug 2008) $
Version: $Revision: 15096 $
Copyright (c) German Cancer Research Center, Division of Medical and
Biological Informatics. All rights reserved.
See MITKCopyright.txt or http://www.mitk.org/copyright.html for details.
This software is distributed WITHOUT ANY WARRANTY; without even
the implied warranty of MERCHANTABILITY or FITNESS FOR A PARTICULAR
PURPOSE. See the above copyright notices for more information.
=========================================================================*/
#ifndef _MITK_NRRDDTI_WRITER__H_
#define _MITK_NRRDDTI_WRITER__H_
#include <itkProcessObject.h>
#include <mitkFileWriterWithInformation.h>
#include <mitkTensorImage.h>
namespace mitk
{
/**
* Writes diffusion volumes to a file
* @ingroup Process
*/
class NrrdTensorImageWriter : public mitk::FileWriterWithInformation
{
public:
mitkClassMacro( NrrdTensorImageWriter, mitk::FileWriterWithInformation );
mitkWriterMacro;
itkNewMacro( Self );
typedef mitk::TensorImage InputType;
/**
* Sets the filename of the file to write.
* @param FileName the name of the file to write.
*/
itkSetStringMacro( FileName );
/**
* @returns the name of the file to be written to disk.
*/
itkGetStringMacro( FileName );
/**
* @warning multiple write not (yet) supported
*/
itkSetStringMacro( FilePrefix );
/**
* @warning multiple write not (yet) supported
*/
itkGetStringMacro( FilePrefix );
/**
* @warning multiple write not (yet) supported
*/
itkSetStringMacro( FilePattern );
/**
* @warning multiple write not (yet) supported
*/
itkGetStringMacro( FilePattern );
/**
* Sets the input object for the filter.
* @param input the diffusion volumes to write to file.
*/
void SetInput( InputType* input );
/**
* @returns the 0'th input object of the filter.
*/
InputType* GetInput();
/**
* Returns false if an error happened during writing
*/
itkGetMacro( Success, bool );
/**
* @return possible file extensions for the data type associated with the writer
*/
virtual std::vector<std::string> GetPossibleFileExtensions();
// FileWriterWithInformation methods
virtual const char * GetDefaultFilename() { return "Tensors.dti"; }
virtual const char * GetFileDialogPattern() { return "Tensor Images (*.dti *.hdti)"; }
virtual const char * GetDefaultExtension() { return ".dti"; }
- virtual bool CanWriteDataType(BaseData::Pointer data) { return (dynamic_cast<mitk::TensorImage*>(data.GetPointer()) != NULL); };
+ virtual bool CanWriteBaseDataType(BaseData::Pointer data) { return (dynamic_cast<mitk::TensorImage*>(data.GetPointer()) != NULL); };
virtual void DoWrite(BaseData::Pointer data) {
- if (CanWriteDataType(data)) {
+ if (CanWriteBaseDataType(data)) {
this->SetInput(dynamic_cast<mitk::TensorImage*>(data.GetPointer()));
this->Update();
}
};
protected:
NrrdTensorImageWriter();
virtual ~NrrdTensorImageWriter();
virtual void GenerateData();
std::string m_FileName;
std::string m_FilePrefix;
std::string m_FilePattern;
bool m_Success;
};
} // end of namespace mitk
#endif //_MITK_NRRDDTI_WRITER__H_
diff --git a/Modules/DiffusionImaging/IODataStructures/TensorImages/mitkTensorImageSerializer.cpp b/Modules/DiffusionImaging/IODataStructures/TensorImages/mitkTensorImageSerializer.cpp
new file mode 100644
index 0000000000..56c505cf94
--- /dev/null
+++ b/Modules/DiffusionImaging/IODataStructures/TensorImages/mitkTensorImageSerializer.cpp
@@ -0,0 +1,75 @@
+/*=========================================================================
+
+Program: Medical Imaging & Interaction Toolkit
+Language: C++
+Date: $Date$
+Version: $Revision: 1.12 $
+
+Copyright (c) German Cancer Research Center, Division of Medical and
+Biological Informatics. All rights reserved.
+See MITKCopyright.txt or http://www.mitk.org/copyright.html for details.
+
+This software is distributed WITHOUT ANY WARRANTY; without even
+the implied warranty of MERCHANTABILITY or FITNESS FOR A PARTICULAR
+PURPOSE. See the above copyright notices for more information.
+
+=========================================================================*/
+
+#include "mitkTensorImageSerializer.h"
+#include "mitkTensorImage.h"
+#include "mitkNrrdTensorImageWriter.h"
+
+#include <itksys/SystemTools.hxx>
+
+
+MITK_REGISTER_SERIALIZER(TensorImageSerializer)
+
+
+mitk::TensorImageSerializer::TensorImageSerializer()
+{
+}
+
+
+mitk::TensorImageSerializer::~TensorImageSerializer()
+{
+}
+
+
+std::string mitk::TensorImageSerializer::Serialize()
+{
+ const TensorImage* image = dynamic_cast<const TensorImage*>( m_Data.GetPointer() );
+ if (image == NULL)
+ {
+ MITK_ERROR << " Object at " << (const void*) this->m_Data
+ << " is not an mitk::NrrdTensorImage. Cannot serialize as NrrdTensorImage.";
+ return "";
+ }
+
+ std::string filename( this->GetUniqueFilenameInWorkingDirectory() );
+ filename += "_";
+ filename += m_FilenameHint;
+ filename += ".dti";
+
+ std::string fullname(m_WorkingDirectory);
+ fullname += "/";
+ fullname += itksys::SystemTools::ConvertToOutputPath(filename.c_str());
+
+ try
+ {
+ NrrdTensorImageWriter::Pointer writer = NrrdTensorImageWriter::New();
+ writer->SetFileName(fullname);
+ writer->SetInput(const_cast<TensorImage*>(image));
+ writer->Write();
+ }
+ catch (std::exception& e)
+ {
+ MITK_ERROR << " Error serializing object at " << (const void*) this->m_Data
+ << " to "
+ << fullname
+ << ": "
+ << e.what();
+ return "";
+ }
+ return filename;
+}
+
diff --git a/Modules/SceneSerializationBase/mitkBasePropertySerializer.cpp b/Modules/DiffusionImaging/IODataStructures/TensorImages/mitkTensorImageSerializer.h
similarity index 53%
copy from Modules/SceneSerializationBase/mitkBasePropertySerializer.cpp
copy to Modules/DiffusionImaging/IODataStructures/TensorImages/mitkTensorImageSerializer.h
index 0e34921ff9..61cd9b90cb 100644
--- a/Modules/SceneSerializationBase/mitkBasePropertySerializer.cpp
+++ b/Modules/DiffusionImaging/IODataStructures/TensorImages/mitkTensorImageSerializer.h
@@ -1,35 +1,40 @@
/*=========================================================================
Program: Medical Imaging & Interaction Toolkit
Language: C++
Date: $Date$
Version: $Revision: 1.12 $
Copyright (c) German Cancer Research Center, Division of Medical and
Biological Informatics. All rights reserved.
See MITKCopyright.txt or http://www.mitk.org/copyright.html for details.
This software is distributed WITHOUT ANY WARRANTY; without even
the implied warranty of MERCHANTABILITY or FITNESS FOR A PARTICULAR
PURPOSE. See the above copyright notices for more information.
=========================================================================*/
-#include "mitkBasePropertySerializer.h"
+#ifndef mitkTensorImageSerializer_h_included
+#define mitkTensorImageSerializer_h_included
-mitk::BasePropertySerializer::BasePropertySerializer()
-{
-}
+#include "MitkDiffusionImagingExports.h"
+#include "mitkBaseDataSerializer.h"
-mitk::BasePropertySerializer::~BasePropertySerializer()
+namespace mitk
{
-}
-
-TiXmlElement* mitk::BasePropertySerializer::Serialize()
+/**
+ \brief Serializes mitk::Surface for mitk::SceneIO
+*/
+class MitkDiffusionImaging_EXPORT TensorImageSerializer : public BaseDataSerializer
{
- MITK_INFO << this->GetNameOfClass()
- << " is asked to serialize an object " << (const void*) this->m_Property;
-
- return NULL;
-}
-
+ public:
+ mitkClassMacro( TensorImageSerializer, BaseDataSerializer );
+ itkNewMacro(Self);
+ virtual std::string Serialize();
+ protected:
+ TensorImageSerializer();
+ virtual ~TensorImageSerializer();
+};
+} // namespace
+#endif
diff --git a/Modules/DiffusionImaging/IODataStructures/mitkDiffusionImagingObjectFactory.cpp b/Modules/DiffusionImaging/IODataStructures/mitkDiffusionImagingObjectFactory.cpp
index 57a93e78ea..5452438247 100644
--- a/Modules/DiffusionImaging/IODataStructures/mitkDiffusionImagingObjectFactory.cpp
+++ b/Modules/DiffusionImaging/IODataStructures/mitkDiffusionImagingObjectFactory.cpp
@@ -1,213 +1,239 @@
/*=========================================================================
-
+
Program: Medical Imaging & Interaction Toolkit
Language: C++
Date: $Date: 2009-06-18 15:59:04 +0200 (Do, 18 Jun 2009) $
Version: $Revision: 16916 $
-
+
Copyright (c) German Cancer Research Center, Division of Medical and
Biological Informatics. All rights reserved.
See MITKCopyright.txt or http://www.mitk.org/copyright.html for details.
-
+
This software is distributed WITHOUT ANY WARRANTY; without even
the implied warranty of MERCHANTABILITY or FITNESS FOR A PARTICULAR
PURPOSE. See the above copyright notices for more information.
-
+
=========================================================================*/
#include "mitkDiffusionImagingObjectFactory.h"
#include "mitkProperties.h"
#include "mitkBaseRenderer.h"
#include "mitkDataNode.h"
#include "mitkNrrdDiffusionImageIOFactory.h"
#include "mitkNrrdDiffusionImageWriterFactory.h"
#include "mitkNrrdDiffusionImageWriter.h"
#include "mitkDiffusionImage.h"
#include "mitkNrrdQBallImageIOFactory.h"
#include "mitkNrrdQBallImageWriterFactory.h"
#include "mitkNrrdQBallImageWriter.h"
#include "mitkNrrdTensorImageIOFactory.h"
#include "mitkNrrdTensorImageWriterFactory.h"
#include "mitkNrrdTensorImageWriter.h"
#include "mitkCompositeMapper.h"
#include "mitkDiffusionImageMapper.h"
#include "mitkGPUVolumeMapper3D.h"
+#include "mitkFiberBundle.h"
+#include "mitkFiberBundleMapper3D.h"
+
+#include "mitkFiberBundleIOFactory.h"
+#include "mitkFiberBundleWriterFactory.h"
+#include "mitkFiberBundleWriter.h"
+
typedef short DiffusionPixelType;
typedef mitk::DiffusionImage<DiffusionPixelType> DiffusionImageShort;
typedef std::multimap<std::string, std::string> MultimapType;
mitk::DiffusionImagingObjectFactory::DiffusionImagingObjectFactory(bool /*registerSelf*/)
:CoreObjectFactoryBase()
{
static bool alreadyDone = false;
if (!alreadyDone)
{
MITK_INFO << "DiffusionImagingObjectFactory c'tor" << std::endl;
RegisterIOFactories();
mitk::NrrdDiffusionImageIOFactory::RegisterOneFactory();
mitk::NrrdQBallImageIOFactory::RegisterOneFactory();
mitk::NrrdTensorImageIOFactory::RegisterOneFactory();
+ mitk::FiberBundleIOFactory::RegisterOneFactory();
mitk::NrrdDiffusionImageWriterFactory::RegisterOneFactory();
mitk::NrrdQBallImageWriterFactory::RegisterOneFactory();
mitk::NrrdTensorImageWriterFactory::RegisterOneFactory();
+ mitk::FiberBundleWriterFactory::RegisterOneFactory();
m_FileWriters.push_back( NrrdDiffusionImageWriter<DiffusionPixelType>::New().GetPointer() );
m_FileWriters.push_back( NrrdQBallImageWriter::New().GetPointer() );
m_FileWriters.push_back( NrrdTensorImageWriter::New().GetPointer() );
+ m_FileWriters.push_back( mitk::FiberBundleWriter::New().GetPointer() );
mitk::CoreObjectFactory::GetInstance()->RegisterExtraFactory(this);
-
CreateFileExtensionsMap();
alreadyDone = true;
}
}
-mitk::Mapper::Pointer mitk::DiffusionImagingObjectFactory::CreateMapper(mitk::DataNode* node, MapperSlotId id)
+mitk::Mapper::Pointer mitk::DiffusionImagingObjectFactory::CreateMapper(mitk::DataNode* node, MapperSlotId id)
{
mitk::Mapper::Pointer newMapper=NULL;
if ( id == mitk::BaseRenderer::Standard2D )
{
std::string classname("QBallImage");
if(node->GetData() && classname.compare(node->GetData()->GetNameOfClass())==0)
{
newMapper = mitk::CompositeMapper::New();
newMapper->SetDataNode(node);
node->SetMapper(3, ((CompositeMapper*)newMapper.GetPointer())->GetImageMapper());
}
classname = "TensorImage";
if(node->GetData() && classname.compare(node->GetData()->GetNameOfClass())==0)
{
newMapper = mitk::CompositeMapper::New();
newMapper->SetDataNode(node);
node->SetMapper(3, ((CompositeMapper*)newMapper.GetPointer())->GetImageMapper());
}
classname = "DiffusionImage";
if(node->GetData() && classname.compare(node->GetData()->GetNameOfClass())==0)
{
newMapper = mitk::DiffusionImageMapper<short>::New();
newMapper->SetDataNode(node);
}
}
else if ( id == mitk::BaseRenderer::Standard3D )
{
std::string classname("QBallImage");
if(node->GetData() && classname.compare(node->GetData()->GetNameOfClass())==0)
{
newMapper = mitk::GPUVolumeMapper3D::New();
newMapper->SetDataNode(node);
}
classname = "TensorImage";
if(node->GetData() && classname.compare(node->GetData()->GetNameOfClass())==0)
{
newMapper = mitk::GPUVolumeMapper3D::New();
newMapper->SetDataNode(node);
}
classname = "DiffusionImage";
if(node->GetData() && classname.compare(node->GetData()->GetNameOfClass())==0)
{
newMapper = mitk::GPUVolumeMapper3D::New();
newMapper->SetDataNode(node);
}
+ classname = "FiberBundle";
+ if(node->GetData() && classname.compare(node->GetData()->GetNameOfClass())==0)
+ {
+ newMapper = mitk::FiberBundleMapper3D::New();
+ newMapper->SetDataNode(node);
+ }
}
return newMapper;
}
void mitk::DiffusionImagingObjectFactory::SetDefaultProperties(mitk::DataNode* node)
{
std::string classname = "QBallImage";
if(node->GetData() && classname.compare(node->GetData()->GetNameOfClass())==0)
{
mitk::CompositeMapper::SetDefaultProperties(node);
mitk::GPUVolumeMapper3D::SetDefaultProperties(node);
}
classname = "TensorImage";
if(node->GetData() && classname.compare(node->GetData()->GetNameOfClass())==0)
{
mitk::CompositeMapper::SetDefaultProperties(node);
mitk::GPUVolumeMapper3D::SetDefaultProperties(node);
}
classname = "DiffusionImage";
if(node->GetData() && classname.compare(node->GetData()->GetNameOfClass())==0)
{
mitk::DiffusionImageMapper<short>::SetDefaultProperties(node);
mitk::GPUVolumeMapper3D::SetDefaultProperties(node);
}
+
+ classname = "FiberBundle";
+ if(node->GetData() && classname.compare(node->GetData()->GetNameOfClass())==0)
+ {
+ mitk::FiberBundleMapper3D::SetDefaultProperties(node);
+ }
}
-const char* mitk::DiffusionImagingObjectFactory::GetFileExtensions()
+const char* mitk::DiffusionImagingObjectFactory::GetFileExtensions()
{
std::string fileExtension;
this->CreateFileExtensions(m_FileExtensionsMap, fileExtension);
return fileExtension.c_str();
};
mitk::CoreObjectFactoryBase::MultimapType mitk::DiffusionImagingObjectFactory::GetFileExtensionsMap()
{
return m_FileExtensionsMap;
}
-const char* mitk::DiffusionImagingObjectFactory::GetSaveFileExtensions()
-{
+const char* mitk::DiffusionImagingObjectFactory::GetSaveFileExtensions()
+{
std::string fileExtension;
this->CreateFileExtensions(m_SaveFileExtensionsMap, fileExtension);
return fileExtension.c_str();
};
mitk::CoreObjectFactoryBase::MultimapType mitk::DiffusionImagingObjectFactory::GetSaveFileExtensionsMap()
{
return m_SaveFileExtensionsMap;
}
void mitk::DiffusionImagingObjectFactory::CreateFileExtensionsMap()
{
m_FileExtensionsMap.insert(std::pair<std::string, std::string>("*.dwi", "Diffusion Weighted Images"));
m_FileExtensionsMap.insert(std::pair<std::string, std::string>("*.hdwi", "Diffusion Weighted Images"));
m_FileExtensionsMap.insert(std::pair<std::string, std::string>("*.nii", "Diffusion Weighted Images for FSL"));
m_FileExtensionsMap.insert(std::pair<std::string, std::string>("*.fsl", "Diffusion Weighted Images for FSL"));
m_FileExtensionsMap.insert(std::pair<std::string, std::string>("*.fslgz", "Diffusion Weighted Images for FSL"));
m_FileExtensionsMap.insert(std::pair<std::string, std::string>("*.qbi", "Q-Ball Images"));
m_FileExtensionsMap.insert(std::pair<std::string, std::string>("*.hqbi", "Q-Ball Images"));
m_FileExtensionsMap.insert(std::pair<std::string, std::string>("*.dti", "Tensor Images"));
m_FileExtensionsMap.insert(std::pair<std::string, std::string>("*.hdti", "Tensor Images"));
+ m_FileExtensionsMap.insert(std::pair<std::string, std::string>("*.fib", "Fiber Bundle"));
+ m_FileExtensionsMap.insert(std::pair<std::string, std::string>("*.afib", "Fiber Bundle Polydata"));
+ m_FileExtensionsMap.insert(std::pair<std::string, std::string>("*.vtk", "Fiber Bundle Polydata"));
m_SaveFileExtensionsMap.insert(std::pair<std::string, std::string>("*.dwi", "Diffusion Weighted Images"));
m_SaveFileExtensionsMap.insert(std::pair<std::string, std::string>("*.hdwi", "Diffusion Weighted Images"));
m_SaveFileExtensionsMap.insert(std::pair<std::string, std::string>("*.nii", "Diffusion Weighted Images for FSL"));
m_SaveFileExtensionsMap.insert(std::pair<std::string, std::string>("*.fsl", "Diffusion Weighted Images for FSL"));
m_SaveFileExtensionsMap.insert(std::pair<std::string, std::string>("*.fslgz", "Diffusion Weighted Images for FSL"));
m_SaveFileExtensionsMap.insert(std::pair<std::string, std::string>("*.qbi", "Q-Ball Images"));
m_SaveFileExtensionsMap.insert(std::pair<std::string, std::string>("*.hqbi", "Q-Ball Images"));
m_SaveFileExtensionsMap.insert(std::pair<std::string, std::string>("*.dti", "Tensor Images"));
m_SaveFileExtensionsMap.insert(std::pair<std::string, std::string>("*.hdti", "Tensor Images"));
+ m_SaveFileExtensionsMap.insert(std::pair<std::string, std::string>("*.fib", "Fiber Bundle"));
+ m_SaveFileExtensionsMap.insert(std::pair<std::string, std::string>("*.vtk", "Fiber Bundle Polydata"));
}
-void mitk::DiffusionImagingObjectFactory::RegisterIOFactories()
+void mitk::DiffusionImagingObjectFactory::RegisterIOFactories()
{
}
void RegisterDiffusionImagingObjectFactory()
{
static bool oneDiffusionImagingObjectFactoryRegistered = false;
if ( ! oneDiffusionImagingObjectFactoryRegistered ) {
MITK_INFO << "Registering DiffusionImagingObjectFactory..." << std::endl;
mitk::CoreObjectFactory::GetInstance()->RegisterExtraFactory(mitk::DiffusionImagingObjectFactory::New());
oneDiffusionImagingObjectFactoryRegistered = true;
}
}
diff --git a/Modules/DiffusionImaging/Interactions/mitkFiberBundleInteractor.cpp b/Modules/DiffusionImaging/Interactions/mitkFiberBundleInteractor.cpp
new file mode 100644
index 0000000000..d138099598
--- /dev/null
+++ b/Modules/DiffusionImaging/Interactions/mitkFiberBundleInteractor.cpp
@@ -0,0 +1,275 @@
+/*=========================================================================
+
+Program: Medical Imaging & Interaction Toolkit
+Language: C++
+Date: $Date: 2007-12-11 14:46:19 +0100 (Di, 11 Dez 2007) $
+Version: $Revision: 13129 $
+
+Copyright (c) German Cancer Research Center, Division of Medical and
+Biological Informatics. All rights reserved.
+See MITKCopyright.txt or http://www.mitk.org/copyright.html for details.
+
+This software is distributed WITHOUT ANY WARRANTY; without even
+the implied warranty of MERCHANTABILITY or FITNESS FOR A PARTICULAR
+PURPOSE. See the above copyright notices for more information.
+
+=========================================================================*/
+
+
+#include "mitkFiberBundleInteractor.h"
+#include <mitkPointOperation.h>
+#include <mitkPositionEvent.h>
+#include <mitkOperationEvent.h>
+#include <mitkDataNode.h>
+#include <mitkPointSet.h>
+#include <mitkInteractionConst.h>
+#include <mitkAction.h>
+#include <mitkProperties.h>
+#include <mitkUndoController.h>
+#include <mitkStateEvent.h>
+#include <mitkState.h>
+#include <mitkFiberBundle.h>
+#include "mitkBaseRenderer.h"
+
+#include <vtkLinearTransform.h>
+#include <vtkRenderWindow.h>
+#include <vtkRenderWindowInteractor.h>
+#include <vtkRenderer.h>
+#include <vtkCamera.h>
+#include <vtkInteractorObserver.h>
+
+#include <qapplication.h>
+
+mitk::FiberBundleInteractor::FiberBundleInteractor(const char * type, DataNode* dataNode)
+ : Interactor(type, dataNode), m_LastPosition(0)
+{
+ m_LastPoint.Fill(0);
+}
+
+mitk::FiberBundleInteractor::~FiberBundleInteractor()
+{}
+
+void mitk::FiberBundleInteractor::SelectFiber(int position)
+{
+ MITK_INFO << "mitk::FiberBundleInteractor::SelectFiber " << position;
+
+ mitk::PointSet* pointSet = dynamic_cast<mitk::PointSet*>(m_DataNode->GetData());
+ if (pointSet == NULL)
+ return;
+ if (pointSet->GetSize()<=0)//if List is empty, then no select of a point can be done!
+ return;
+
+ mitk::Point3D noPoint;//dummyPoint... not needed anyway
+ noPoint.Fill(0);
+ mitk::PointOperation* doOp = new mitk::PointOperation(OpSELECTPOINT, noPoint, position);
+ if (m_UndoEnabled)
+ {
+ mitk::PointOperation* undoOp = new mitk::PointOperation(OpDESELECTPOINT, noPoint, position);
+ OperationEvent *operationEvent = new OperationEvent(pointSet, doOp, undoOp);
+ m_UndoController->SetOperationEvent(operationEvent);
+ }
+ pointSet->ExecuteOperation(doOp);
+}
+
+void mitk::FiberBundleInteractor::DeselectAllFibers()
+{
+ MITK_INFO << "mitk::FiberBundleInteractor::DeselectAllFibers ";
+
+ mitk::PointSet* pointSet = dynamic_cast<mitk::PointSet*>(m_DataNode->GetData());
+ if (pointSet == NULL)
+ return;
+
+ mitk::PointSet::DataType *itkPointSet = pointSet->GetPointSet();
+ mitk::PointSet::PointsContainer::Iterator it, end;
+ end = itkPointSet->GetPoints()->End();
+
+ for (it = itkPointSet->GetPoints()->Begin(); it != end; it++)
+ {
+ int position = it->Index();
+ PointSet::PointDataType pointData = {0, false, PTUNDEFINED};
+ itkPointSet->GetPointData(position, &pointData);
+ if ( pointData.selected )//then declare an operation which unselects this point; UndoOperation as well!
+ {
+ mitk::Point3D noPoint;
+ noPoint.Fill(0);
+
+ mitk::PointOperation* doOp = new mitk::PointOperation(OpDESELECTPOINT, noPoint, position);
+ if (m_UndoEnabled)
+ {
+ mitk::PointOperation* undoOp = new mitk::PointOperation(OpSELECTPOINT, noPoint, position);
+ OperationEvent *operationEvent = new OperationEvent(pointSet, doOp, undoOp);
+ m_UndoController->SetOperationEvent(operationEvent);
+ }
+ pointSet->ExecuteOperation(doOp);
+ }
+ }
+}
+
+float mitk::FiberBundleInteractor::CanHandleEvent(StateEvent const* stateEvent) const
+ //go through all points and check, if the given Point lies near a line
+{
+ float returnValue = 0;
+
+ mitk::PositionEvent const *posEvent = dynamic_cast <const mitk::PositionEvent *> (stateEvent->GetEvent());
+ //checking if a keyevent can be handled:
+ if (posEvent == NULL)
+ {
+ //check, if the current state has a transition waiting for that key event.
+ if (this->GetCurrentState()->GetTransition(stateEvent->GetId())!=NULL)
+ {
+ return 0.5;
+ }
+ else
+ {
+ return 0;
+ }
+ }
+
+ //Mouse event handling:
+ //on MouseMove do nothing! reimplement if needed differently
+ if (stateEvent->GetEvent()->GetType() == mitk::Type_MouseMove)
+ {
+ return 0;
+ }
+
+ //if the event can be understood and if there is a transition waiting for that event
+ if (this->GetCurrentState()->GetTransition(stateEvent->GetId())!=NULL)
+ {
+ returnValue = 0.5;//it can be understood
+ }
+
+ //check on the right data-type
+ mitk::FiberBundle* bundle = dynamic_cast<mitk::FiberBundle*>(m_DataNode->GetData());
+ if (bundle == NULL)
+ return 0;
+
+ return 0.5;
+
+}
+
+
+bool mitk::FiberBundleInteractor::ExecuteAction( Action* action, mitk::StateEvent const* stateEvent )
+{
+ bool ok = false;//for return type bool
+
+ //checking corresponding Data; has to be a PointSet or a subclass
+ mitk::FiberBundle* bundle = dynamic_cast<mitk::FiberBundle*>(m_DataNode->GetData());
+ if (bundle == NULL)
+ return false;
+
+ // Get Event and extract renderer
+ const Event *event = stateEvent->GetEvent();
+ BaseRenderer *renderer = NULL;
+ vtkRenderWindow *renderWindow = NULL;
+ vtkRenderWindowInteractor *renderWindowInteractor = NULL;
+ vtkRenderer *currentVtkRenderer = NULL;
+ vtkCamera *camera = NULL;
+
+ if ( event != NULL )
+ {
+ renderer = event->GetSender();
+ if ( renderer != NULL )
+ {
+ renderWindow = renderer->GetRenderWindow();
+ if ( renderWindow != NULL )
+ {
+ renderWindowInteractor = renderWindow->GetInteractor();
+ if ( renderWindowInteractor != NULL )
+ {
+ currentVtkRenderer = renderWindowInteractor
+ ->GetInteractorStyle()->GetCurrentRenderer();
+ if ( currentVtkRenderer != NULL )
+ {
+ camera = currentVtkRenderer->GetActiveCamera();
+ }
+ }
+ }
+ }
+ }
+
+ /*Each case must watch the type of the event!*/
+ switch (action->GetActionId())
+ {
+ case AcCHECKHOVERING:
+ {
+
+ QApplication::restoreOverrideCursor();
+
+ // Re-enable VTK interactor (may have been disabled previously)
+ if ( renderWindowInteractor != NULL )
+ {
+ renderWindowInteractor->Enable();
+ }
+
+ const DisplayPositionEvent *dpe =
+ dynamic_cast< const DisplayPositionEvent * >( stateEvent->GetEvent() );
+
+ // Check if we have a DisplayPositionEvent
+ if ( dpe != NULL )
+ {
+
+ // Check if an object is present at the current mouse position
+ DataNode *pickedNode = dpe->GetPickedObjectNode();
+ if ( pickedNode != m_DataNode )
+ {
+// if(pickedNode == 0)
+// MITK_INFO << "picked node is NULL, no hovering";
+// else
+// MITK_INFO << "wrong node: " << pickedNode;
+
+ this->HandleEvent( new StateEvent( EIDNOFIGUREHOVER ) );
+
+ ok = true;
+ break;
+ }
+
+ m_CurrentPickedPoint = dpe->GetWorldPosition();
+ m_CurrentPickedDisplayPoint = dpe->GetDisplayPosition();
+
+ QApplication::setOverrideCursor(Qt::UpArrowCursor);
+ this->HandleEvent( new StateEvent( EIDFIGUREHOVER ) );
+
+ }
+
+ ok = true;
+ break;
+ }
+ break;
+ // case AcSELECTPICKEDOBJECT:
+ // MITK_INFO << "FiberBundleInteractor AcSELECTPICKEDOBJECT";
+
+ // break;
+ // case AcDESELECTALL:
+ // MITK_INFO << "FiberBundleInteractor AcDESELECTALL";
+ // break;
+ case AcREMOVE:
+ {
+ MITK_INFO << "picking fiber at " << m_CurrentPickedPoint;
+
+// QmitkStdMultiWidgetEditor::Pointer multiWidgetEditor;
+// multiWidgetEditor->GetStdMultiWidget()->GetRenderWindow1()->GetRenderer()->GetSliceNavigationController()->SelectSliceByPoint(
+// m_CurrentPickedPoint);
+
+ BaseRenderer* renderer = mitk::BaseRenderer::GetByName("stdmulti.widget1");
+ renderer->GetSliceNavigationController()->SelectSliceByPoint(
+ m_CurrentPickedPoint);
+
+ renderer = mitk::BaseRenderer::GetByName("stdmulti.widget2");
+ renderer->GetSliceNavigationController()->SelectSliceByPoint(
+ m_CurrentPickedPoint);
+
+ renderer = mitk::BaseRenderer::GetByName("stdmulti.widget3");
+ renderer->GetSliceNavigationController()->SelectSliceByPoint(
+ m_CurrentPickedPoint);
+// mitk::RenderingManager::GetInstance()->RequestUpdateAll();
+ }
+ break;
+ default:
+ return Superclass::ExecuteAction( action, stateEvent );
+ }
+
+ return ok;
+
+}
+
+
diff --git a/Modules/DiffusionImaging/Interactions/mitkFiberBundleInteractor.h b/Modules/DiffusionImaging/Interactions/mitkFiberBundleInteractor.h
new file mode 100644
index 0000000000..3f5025914e
--- /dev/null
+++ b/Modules/DiffusionImaging/Interactions/mitkFiberBundleInteractor.h
@@ -0,0 +1,100 @@
+/*=========================================================================
+
+Program: Medical Imaging & Interaction Toolkit
+Language: C++
+Date: $Date: 2008-02-08 13:23:19 +0100 (Fr, 08 Feb 2008) $
+Version: $Revision: 13561 $
+
+Copyright (c) German Cancer Research Center, Division of Medical and
+Biological Informatics. All rights reserved.
+See MITKCopyright.txt or http://www.mitk.org/copyright.html for details.
+
+This software is distributed WITHOUT ANY WARRANTY; without even
+the implied warranty of MERCHANTABILITY or FITNESS FOR A PARTICULAR
+PURPOSE. See the above copyright notices for more information.
+
+=========================================================================*/
+
+
+#ifndef MITKFiberBundleINTERACTOR_H_HEADER_INCLUDED
+#define MITKFiberBundleINTERACTOR_H_HEADER_INCLUDED
+
+#include "mitkCommon.h"
+#include "MitkExtExports.h"
+#include <mitkInteractor.h>
+#include <mitkVector.h>
+#include "MitkDiffusionImagingExports.h"
+
+#include <vtkType.h>
+
+namespace mitk
+{
+ class DataNode;
+
+ //##Documentation
+ //## @brief Just select a point, that's the only way to interact with the point
+ //##
+ //## Interact with a point: Select the point without moving to get parameters that does not change
+ //## All Set-operations would be done through the method "ExecuteAction", if there would be anyone.
+ //## the identificationnumber of this point is set by this points and evalued from an empty place in the DataStructure
+ //## @ingroup Interaction
+ class MitkDiffusionImaging_EXPORT FiberBundleInteractor : public Interactor
+ {
+ public:
+ mitkClassMacro(FiberBundleInteractor, Interactor);
+ mitkNewMacro2Param(Self, const char*, DataNode*);
+
+ //##Documentation
+ //## @brief Sets the amount of precision
+ void SetPrecision(unsigned int precision);
+
+ //##Documentation
+ //## @brief derived from mitk::Interactor; calculates Jurisdiction according to points
+ //##
+ //## standard method can not be used, since it doesn't calculate in points, only in BoundingBox of Points
+ virtual float CanHandleEvent(StateEvent const* stateEvent) const;
+
+
+ protected:
+ //##Documentation
+ //##@brief Constructor
+ FiberBundleInteractor(const char * type, DataNode* dataNode);
+
+ //##Documentation
+ //##@brief Destructor
+ virtual ~FiberBundleInteractor();
+
+ //##Documentation
+ //## @brief select the point on the given position
+ virtual void SelectFiber(int position);
+
+ //##Documentation
+ //## @brief unselect all points that exist in mesh
+ virtual void DeselectAllFibers();
+
+ //##Documentation
+ //## @brief Executes Actions
+ virtual bool ExecuteAction(Action* action, mitk::StateEvent const* stateEvent);
+
+
+ private:
+
+ //##Documentation
+ //## @brief to calculate a direction vector from last point and actual point
+ Point3D m_LastPoint;
+
+ //##Documentation
+ //## @brief to store a position
+ unsigned int m_LastPosition;
+
+// Point3D m_InitialPickedPoint;
+// Point2D m_InitialPickedDisplayPoint;
+// vtkFloatingPointType m_InitialPickedPointWorld[4];
+
+ Point3D m_CurrentPickedPoint;
+ Point2D m_CurrentPickedDisplayPoint;
+ vtkFloatingPointType m_CurrentPickedPointWorld[4];
+
+ };
+}
+#endif /* MITKFiberBundleInteractor_H_HEADER_INCLUDED */
diff --git a/Modules/DiffusionImaging/Rendering/mitkCompositeMapper.h b/Modules/DiffusionImaging/Rendering/mitkCompositeMapper.h
index 1ce4aae15b..e0d74b77f6 100644
--- a/Modules/DiffusionImaging/Rendering/mitkCompositeMapper.h
+++ b/Modules/DiffusionImaging/Rendering/mitkCompositeMapper.h
@@ -1,180 +1,180 @@
/*=========================================================================
Program: Medical Imaging & Interaction Toolkit
Language: C++
Date: $Date: 2009-05-12 19:56:03 +0200 (Di, 12 Mai 2009) $
Version: $Revision: 17179 $
Copyright (c) German Cancer Research Center, Division of Medical and
Biological Informatics. All rights reserved.
See MITKCopyright.txt or http://www.mitk.org/copyright.html for details.
This software is distributed WITHOUT ANY WARRANTY; without even
the implied warranty of MERCHANTABILITY or FITNESS FOR A PARTICULAR
PURPOSE. See the above copyright notices for more information.
=========================================================================*/
#ifndef COMPOSITEMAPPER_H_HEADER_INCLUDED
#define COMPOSITEMAPPER_H_HEADER_INCLUDED
#include "mitkGLMapper2D.h"
#include "mitkVtkMapper2D.h"
#include "mitkQBallImage.h"
#include "mitkImageMapperGL2D.h"
#include "mitkOdfVtkMapper2D.h"
#include "mitkLevelWindowProperty.h"
namespace mitk {
class CopyImageMapper2D : public ImageMapperGL2D
{
public:
mitkClassMacro(CopyImageMapper2D,ImageMapperGL2D);
itkNewMacro(Self);
friend class CompositeMapper;
};
//##Documentation
//## @brief Composite pattern for combination of different mappers
//## @ingroup Mapper
class CompositeMapper : public VtkMapper2D
{
public:
mitkClassMacro(CompositeMapper,VtkMapper2D);
itkNewMacro(Self);
virtual void MitkRenderOverlay(BaseRenderer* renderer)
{
Enable2DOpenGL();
m_ImgMapper->MitkRenderOverlay(renderer);
Disable2DOpenGL();
m_OdfMapper->MitkRenderOverlay(renderer);
}
virtual void MitkRenderOpaqueGeometry(BaseRenderer* renderer)
{
Enable2DOpenGL();
m_ImgMapper->MitkRenderOpaqueGeometry(renderer);
Disable2DOpenGL();
m_OdfMapper->MitkRenderOpaqueGeometry(renderer);
if( mitk::RenderingManager::GetInstance()->GetNextLOD( renderer ) == 0 )
{
renderer->Modified();
}
}
virtual void MitkRenderTranslucentGeometry(BaseRenderer* renderer)
{
Enable2DOpenGL();
m_ImgMapper->MitkRenderTranslucentGeometry(renderer);
Disable2DOpenGL();
m_OdfMapper->MitkRenderTranslucentGeometry(renderer);
}
#if ( ( VTK_MAJOR_VERSION >= 5 ) && ( VTK_MINOR_VERSION>=2) )
virtual void MitkRenderVolumetricGeometry(BaseRenderer* renderer)
{
Enable2DOpenGL();
m_ImgMapper->MitkRenderVolumetricGeometry(renderer);
Disable2DOpenGL();
m_OdfMapper->MitkRenderVolumetricGeometry(renderer);
}
#endif
void SetDataNode(DataNode* node)
{
m_DataNode = node;
m_ImgMapper->SetDataNode(node);
m_OdfMapper->SetDataNode(node);
}
mitk::ImageMapperGL2D::Pointer GetImageMapper()
{
ImageMapperGL2D* retval = m_ImgMapper;
return retval;
}
bool IsVtkBased() const
{
return m_OdfMapper->IsVtkBased();
}
bool HasVtkProp( const vtkProp* prop, BaseRenderer* renderer )
{
return m_OdfMapper->HasVtkProp(prop, renderer);
}
void ReleaseGraphicsResources(vtkWindow* window)
{
m_ImgMapper->ReleaseGraphicsResources(window);
m_OdfMapper->ReleaseGraphicsResources(window);
}
static void SetDefaultProperties(DataNode* node, BaseRenderer* renderer = NULL, bool overwrite = false )
{
mitk::OdfVtkMapper2D<float,QBALL_ODFSIZE>::SetDefaultProperties(node, renderer, overwrite);
mitk::CopyImageMapper2D::SetDefaultProperties(node, renderer, overwrite);
mitk::LevelWindow opaclevwin;
opaclevwin.SetRangeMinMax(0,255);
opaclevwin.SetWindowBounds(0,0);
mitk::LevelWindowProperty::Pointer prop = mitk::LevelWindowProperty::New(opaclevwin);
node->AddProperty( "opaclevelwindow", prop );
}
bool IsLODEnabled( BaseRenderer * renderer ) const
{
return m_ImgMapper->IsLODEnabled(renderer) || m_OdfMapper->IsLODEnabled(renderer);
}
vtkProp* GetProp(mitk::BaseRenderer* renderer)
{
return m_OdfMapper->GetProp(renderer);
}
void SetGeometry3D(const mitk::Geometry3D* aGeometry3D)
{
m_ImgMapper->SetGeometry3D(aGeometry3D);
m_OdfMapper->SetGeometry3D(aGeometry3D);
}
void Enable2DOpenGL();
void Disable2DOpenGL();
protected:
virtual void GenerateData()
{
m_OdfMapper->GenerateData();
}
- virtual void GenerateData(mitk::BaseRenderer* renderer)
+ virtual void GenerateDataForRenderer(mitk::BaseRenderer* renderer)
{
- m_ImgMapper->GenerateData(renderer);
+ m_ImgMapper->GenerateDataForRenderer(renderer);
if( mitk::RenderingManager::GetInstance()->GetNextLOD( renderer ) > 0 )
{
- m_OdfMapper->GenerateData(renderer);
+ m_OdfMapper->GenerateDataForRenderer(renderer);
}
}
CompositeMapper();
virtual ~CompositeMapper();
private:
mitk::OdfVtkMapper2D<float,QBALL_ODFSIZE>::Pointer m_OdfMapper;
mitk::CopyImageMapper2D::Pointer m_ImgMapper;
};
} // namespace mitk
#endif /* COMPOSITEMAPPER_H_HEADER_INCLUDED */
diff --git a/Modules/DiffusionImaging/Rendering/mitkDiffusionImageMapper.cpp b/Modules/DiffusionImaging/Rendering/mitkDiffusionImageMapper.cpp
index cd6d531588..ecc4568fbd 100644
--- a/Modules/DiffusionImaging/Rendering/mitkDiffusionImageMapper.cpp
+++ b/Modules/DiffusionImaging/Rendering/mitkDiffusionImageMapper.cpp
@@ -1,58 +1,58 @@
/*=========================================================================
Program: Medical Imaging & Interaction Toolkit
Language: C++
Date: $Date: 2009-05-12 19:56:03 +0200 (Di, 12 Mai 2009) $
Version: $Revision: 17179 $
Copyright (c) German Cancer Research Center, Division of Medical and
Biological Informatics. All rights reserved.
See MITKCopyright.txt or http://www.mitk.org/copyright.html for details.
This software is distributed WITHOUT ANY WARRANTY; without even
the implied warranty of MERCHANTABILITY or FITNESS FOR A PARTICULAR
PURPOSE. See the above copyright notices for more information.
=========================================================================*/
#ifndef DiffusionImageMapper_txx_HEADER_INCLUDED
#define DiffusionImageMapper_txx_HEADER_INCLUDED
#include "mitkProperties.h"
#include "mitkDiffusionImage.h"
template<class TPixelType>
mitk::DiffusionImageMapper<TPixelType>::DiffusionImageMapper()
{
}
template<class TPixelType>
mitk::DiffusionImageMapper<TPixelType>::~DiffusionImageMapper()
{
}
template<class TPixelType>
void
-mitk::DiffusionImageMapper<TPixelType>::GenerateData( mitk::BaseRenderer *renderer )
+mitk::DiffusionImageMapper<TPixelType>::GenerateDataForRenderer( mitk::BaseRenderer *renderer )
{
int displayIndex(0);
this->GetDataNode()->GetIntProperty( "DisplayChannel", displayIndex, renderer );
InputImageType *input = const_cast< InputImageType* >(
this->GetInput()
);
mitk::DiffusionImage<TPixelType> *input2 = dynamic_cast< mitk::DiffusionImage<TPixelType>* >(
input
);
input2->SetDisplayIndexForRendering(displayIndex);
- Superclass::GenerateData(renderer);
+ Superclass::GenerateDataForRenderer(renderer);
}
template<class TPixelType>
void mitk::DiffusionImageMapper<TPixelType>::SetDefaultProperties(mitk::DataNode* node, mitk::BaseRenderer* renderer, bool overwrite)
{
node->AddProperty( "DisplayChannel", mitk::IntProperty::New( 0 ), renderer, overwrite );
Superclass::SetDefaultProperties(node, renderer, overwrite);
}
#endif
diff --git a/Modules/DiffusionImaging/Rendering/mitkDiffusionImageMapper.h b/Modules/DiffusionImaging/Rendering/mitkDiffusionImageMapper.h
index c4e3432f20..63922b82bf 100644
--- a/Modules/DiffusionImaging/Rendering/mitkDiffusionImageMapper.h
+++ b/Modules/DiffusionImaging/Rendering/mitkDiffusionImageMapper.h
@@ -1,54 +1,54 @@
/*=========================================================================
Program: Medical Imaging & Interaction Toolkit
Language: C++
Date: $Date: 2009-05-12 19:56:03 +0200 (Di, 12 Mai 2009) $
Version: $Revision: 17179 $
Copyright (c) German Cancer Research Center, Division of Medical and
Biological Informatics. All rights reserved.
See MITKCopyright.txt or http://www.mitk.org/copyright.html for details.
This software is distributed WITHOUT ANY WARRANTY; without even
the implied warranty of MERCHANTABILITY or FITNESS FOR A PARTICULAR
PURPOSE. See the above copyright notices for more information.
=========================================================================*/
#ifndef DiffusionImageMapper_H_HEADER_INCLUDED
#define DiffusionImageMapper_H_HEADER_INCLUDED
#include "mitkImageMapperGL2D.h"
namespace mitk {
//##Documentation
//## @brief Mapper for raw diffusion weighted images
//## @ingroup Mapper
template<class TPixelType>
class DiffusionImageMapper : public ImageMapperGL2D
{
public:
mitkClassMacro(DiffusionImageMapper,ImageMapperGL2D);
itkNewMacro(Self);
- void GenerateData( mitk::BaseRenderer *renderer );
+ void GenerateDataForRenderer( mitk::BaseRenderer *renderer );
static void SetDefaultProperties(DataNode* node, BaseRenderer* renderer = NULL, bool overwrite = false );
protected:
DiffusionImageMapper();
virtual ~DiffusionImageMapper();
};
} // namespace mitk
#include "mitkDiffusionImageMapper.cpp"
#endif /* COMPOSITEMAPPER_H_HEADER_INCLUDED */
diff --git a/Modules/DiffusionImaging/Rendering/mitkFiberBundleMapper3D.cpp b/Modules/DiffusionImaging/Rendering/mitkFiberBundleMapper3D.cpp
new file mode 100644
index 0000000000..6f1a12fa0d
--- /dev/null
+++ b/Modules/DiffusionImaging/Rendering/mitkFiberBundleMapper3D.cpp
@@ -0,0 +1,1140 @@
+/*=========================================================================
+
+ Program: Medical Imaging & Interaction Toolkit
+ Language: C++
+ Date: $Date: 2009-05-12 19:56:03 +0200 (Di, 12 Mai 2009) $
+ Version: $Revision: 17179 $
+
+ Copyright (c) German Cancer Research Center, Division of Medical and
+ Biological Informatics. All rights reserved.
+ See MITKCopyright.txt or http://www.mitk.org/copyright.html for details.
+
+ This software is distributed WITHOUT ANY WARRANTY; without even
+ the implied warranty of MERCHANTABILITY or FITNESS FOR A PARTICULAR
+ PURPOSE. See the above copyright notices for more information.
+
+ =========================================================================*/
+
+
+#include "mitkProperties.h"
+#include "mitkFiberBundleMapper3D.h"
+
+
+#include <vtkCellArray.h>
+#include <vtkCellData.h>
+#include <vtkDoubleArray.h>
+#include <vtkPoints.h>
+#include <vtkPolyLine.h>
+#include <vtkPolyData.h>
+#include <vtkPointData.h>
+#include <vtkTubeFilter.h>
+#include <vtkCamera.h>
+#include <vtkRenderWindowInteractor.h>
+#include <vtkInteractorStyleTrackballCamera.h>
+#include "vtkVertex.h"
+
+#include <vtkOpenGLRenderer.h>
+#include <vtkLookupTable.h>
+#include <vtkKochanekSpline.h>
+#include <vtkParametricSpline.h>
+#include <vtkParametricFunctionSource.h>
+
+#include "mitkFiberBundleInteractor.h"
+#include "mitkGlobalInteraction.h"
+
+//template<class TPixelType>
+mitk::FiberBundleMapper3D::FiberBundleMapper3D()
+: m_vtkFiberList(NULL),
+m_VtkFiberDataMapperGL(NULL),
+m_vtkTubeMapper(NULL)
+
+{
+ //MITK_INFO << "FiberBundleMapper3D()";
+ m_FiberAssembly = vtkPropAssembly::New();
+ m_FiberActor = vtkOpenGLActor::New();
+ m_TubeActor = vtkOpenGLActor::New();
+
+
+ /*
+ vtkUnsignedCharArray *colorsT = vtkUnsignedCharArray::New();
+ colorsT->SetName("Colors");
+ colorsT->SetNumberOfComponents(4);
+
+ unsigned char red1[4] = {255, 0, 0 , 10};
+ colorsT->InsertNextTupleValue(red1);
+
+ unsigned char red2[4] = {255,0, 0 , 255};
+ colorsT->InsertNextTupleValue(red2);
+
+ colorsT->SetValue(3, (unsigned char)(255));
+ colorsT->SetValue(7, (unsigned char)(255));
+
+
+
+
+
+
+
+ //Create points for polyline1.
+ double origin[3] = {100.0, 400.0, 0.0};
+ double p0[3] = {300.0, 400.0, 0.0};
+ double p1[3] = {300.0, 200.0, 0.0};
+ double p2[3] = {100.0, 300.0, 0.0};
+ double p3[3] = {130.0, 250.0, 0.0};
+
+ //create points for polyline2
+ //double p01[3] = {50.0, 50.0, 13.0};
+ //double p11[3] = {200.0, 100.0, 13.0};
+
+ //insert points to vtkPointarray
+ vtkPoints *pnts = vtkPoints::New();
+ pnts->InsertPoint(0,origin);
+ pnts->InsertPoint(1,p0);
+ pnts->InsertPoint(2,p1);
+ pnts->InsertPoint(3,p2);
+ //pnts->InsertPoint(4,p01);
+ //pnts->InsertPoint(5,p11);
+ pnts->InsertPoint(4,p3);
+
+ //generate and define polyline1
+ vtkPolyLine *polyLine = vtkPolyLine::New();
+ polyLine->GetPointIds()->SetNumberOfIds(4);
+ polyLine->GetPointIds()->SetId(0,0);
+ polyLine->GetPointIds()->SetId(1,1);
+ polyLine->GetPointIds()->SetId(2,2);
+ polyLine->GetPointIds()->SetId(3,3);
+
+ /*generate and define polyline2
+ vtkPolyLine *polyLine2 = vtkPolyLine::New();
+ polyLine2->GetPointIds()->SetNumberOfIds(2);
+ polyLine2->GetPointIds()->SetId(0,4);
+ polyLine2->GetPointIds()->SetId(1,5);
+ */
+
+ /*
+ vtkVertex *vtx = vtkVertex::New();
+ vtx->GetPointIds()->SetNumberOfIds(1);
+ vtx->GetPointIds()->SetId(0,4);
+
+ vtkCellArray *lines = vtkCellArray::New();
+ lines->InsertNextCell(polyLine);
+ //lines->InsertNextCell(vtx);
+ //lines->InsertNextCell(polyLine2);
+
+
+ vtkCellArray *vertx = vtkCellArray::New();
+ vertx->InsertNextCell(vtx);
+
+ vtkPolyData *polyDataT = vtkPolyData::New();
+ polyDataT->SetPoints(pnts);
+ polyDataT->SetLines(lines);
+ polyDataT->SetVerts(vertx);
+
+ //color and opacity handling
+ vtkUnsignedCharArray *colorT = vtkUnsignedCharArray::New();
+ colorT->SetName("Colors");
+
+ colorT->SetNumberOfComponents(4); //4 components cuz of RGBA
+ unsigned char rgba[4] = {255,0,0,255};
+ unsigned char rgba2[4] = {0,255,0,255};
+
+ //if just 1 point in there
+ colorT->InsertNextTupleValue(rgba);
+ colorT->InsertNextTupleValue(rgba2);
+ colorT->InsertNextTupleValue(rgba);
+ colorT->InsertNextTupleValue(rgba2);
+ colorT->InsertNextTupleValue(rgba);
+
+ /*for(int i=0; i<6; i++)
+ {
+
+
+ double vtkPntTmp[3];
+ pnts->GetPoint(i, vtkPntTmp);
+ double vtkPntTmpNxt[3];
+ pnts->GetPoint(i+1, vtkPntTmpNxt);
+
+ vnl_vector_fixed< double, 3 > tmpPntvtk( vtkPntTmp[0], vtkPntTmp[1],vtkPntTmp[2]);
+ vnl_vector_fixed< double, 3 > nxttmpPntvtk(vtkPntTmpNxt[0], vtkPntTmpNxt[1], vtkPntTmpNxt[2]);
+
+ vnl_vector_fixed< double, 3 > diff;
+ diff = tmpPntvtk - nxttmpPntvtk;
+ diff.normalize();
+
+ rgba[0] = (unsigned char) (255.0 * std::abs(diff[0]));
+ rgba[1] = (unsigned char) (255.0 * std::abs(diff[1]));
+ rgba[2] = (unsigned char) (255.0 * std::abs(diff[2]));
+ rgba[3] = (unsigned char) (255.0);
+
+
+ if(i==3)
+ {
+ colorT->InsertNextTupleValue(rgba);
+ colorT->InsertNextTupleValue(rgba);
+ }else if(i==4)
+ {
+ //do nothing
+ }else{
+ colorT->InsertNextTupleValue(rgba);
+ }
+
+
+
+ }
+
+ /*
+ unsigned char red[4] = {255, 0, 0 , 20};
+ unsigned char green[4] = {0, 255, 0 , 190};
+ unsigned char blue[4] = {0, 0, 255, 255};
+ unsigned char white[4] = {255, 255, 255, 255};
+
+ colorT->InsertNextTupleValue(red); //color for point0
+ colorT->InsertNextTupleValue(green); //color for point1
+ colorT->InsertNextTupleValue(blue);
+ colorT->InsertNextTupleValue(white);
+ colorT->InsertNextTupleValue(white);
+ colorT->InsertNextTupleValue(white); //color for point5
+
+ polyDataT->GetPointData()->AddArray(colorT);
+
+
+ vtkTubeFilter *tube = vtkTubeFilter::New();
+ tube->SetInput(polyDataT);
+ tube->SetNumberOfSides(8);
+ tube->SetRadius(5);
+
+ vtkSmartPointer<vtkOpenGLPolyDataMapper> mapper =
+ vtkSmartPointer<vtkOpenGLPolyDataMapper>::New();
+ mapper->SetInput(polyDataT);
+ //mapper->SetInputConnection(tube->GetOutputPort());
+ mapper->ScalarVisibilityOn();
+ mapper->SetScalarModeToUsePointFieldData();
+ //mapper->SetColorModeToMapScalars();
+ mapper->SelectColorArray("Colors");
+
+ vtkSmartPointer<vtkOpenGLActor> actor =
+ vtkSmartPointer<vtkOpenGLActor>::New();
+ actor->SetMapper(mapper);
+ actor->GetProperty()->SetOpacity(1.0);
+ //actor->GetProperty()->SetLineWidth(20);
+ actor->GetProperty()->SetPointSize(5.0);
+
+
+ vtkSmartPointer<vtkOpenGLRenderer> renderer =
+ vtkSmartPointer<vtkOpenGLRenderer>::New();
+ renderer->AddActor(actor);
+ //renderer->SetBackground(.2, .3, .4);
+
+ // Make an oblique view
+ renderer->GetActiveCamera()->Azimuth(30);
+ renderer->GetActiveCamera()->Elevation(30);
+ renderer->ResetCamera();
+
+ vtkSmartPointer<vtkRenderWindow> renWin =
+ vtkSmartPointer<vtkRenderWindow>::New();
+ vtkSmartPointer<vtkRenderWindowInteractor>
+ iren = vtkSmartPointer<vtkRenderWindowInteractor>::New();
+
+ iren->SetRenderWindow(renWin);
+ renWin->AddRenderer(renderer);
+ //renWin->LineSmoothingOff();
+ renWin->SetSize(500, 500);
+ renWin->Render();
+
+ vtkSmartPointer<vtkInteractorStyleTrackballCamera> style =
+ vtkSmartPointer<vtkInteractorStyleTrackballCamera>::New();
+ iren->SetInteractorStyle(style);
+
+ iren->Start();
+ MITK_INFO << "swerwas";
+
+ /*
+
+
+ // Spiral tube
+ double vX, vY, vZ;
+ unsigned int nV = 256; // No. of vertices
+ unsigned int nCyc = 5; // No. of spiral cycles
+ double rT1 = 0.1, rT2 = 0.5;// Start/end tube radii
+ double rS = 2; // Spiral radius
+ double h = 10; // Height
+ unsigned int nTv = 8; // No. of surface elements for each tube vertex
+
+ unsigned int i;
+
+ // Create points and cells for the spiral
+ vtkSmartPointer<vtkPoints> points = vtkSmartPointer<vtkPoints>::New();
+ for(i = 0; i < nV; i++)
+ {
+ // Spiral coordinates
+ vX = rS * cos(2 * 3 * nCyc * i / (nV - 1));
+ vY = rS * sin(2 * 3 * nCyc * i / (nV - 1));
+ vZ = h * i / nV;
+ points->InsertPoint(i, vX, vY, vZ);
+ }
+
+ vtkSmartPointer<vtkCellArray> lines =
+ vtkSmartPointer<vtkCellArray>::New();
+ lines->InsertNextCell(nV);
+ for (i = 0; i < nV; i++)
+ {
+ lines->InsertCellPoint(i);
+ }
+
+
+ vtkSmartPointer<vtkPolyData> polyData =
+ vtkSmartPointer<vtkPolyData>::New();
+ polyData->SetPoints(points);
+ polyData->SetLines(lines);
+
+
+ // RBG array (could add Alpha channel too I guess...)
+ // Varying from blue to red
+ vtkSmartPointer<vtkUnsignedCharArray> colors =
+ vtkSmartPointer<vtkUnsignedCharArray>::New();
+ colors->SetName("Colors");
+ colors->SetNumberOfComponents(3);
+ colors->SetNumberOfTuples(nV);
+ for (i = 0; i < nV ;i++)
+ {
+
+ unsigned char red[3] = {char(255 * i/ (nV - 1)),0,char(255 * (nV - 1 - i)/(nV - 1))};
+
+ colors->InsertNextTupleValue( red);
+ }
+ polyData->GetPointData()->AddArray(colors);
+
+
+
+ vtkSmartPointer<vtkPolyDataMapper> mapper =
+ vtkSmartPointer<vtkPolyDataMapper>::New();
+ mapper->SetInput(polyData);
+ mapper->ScalarVisibilityOn();
+ mapper->SetScalarModeToUsePointFieldData();
+ mapper->SelectColorArray("Colors");
+
+ vtkSmartPointer<vtkActor> actor =
+ vtkSmartPointer<vtkActor>::New();
+ actor->SetMapper(mapper);
+
+ vtkSmartPointer<vtkRenderer> renderer =
+ vtkSmartPointer<vtkRenderer>::New();
+ renderer->AddActor(actor);
+ renderer->SetBackground(.2, .3, .4);
+
+ // Make an oblique view
+ renderer->GetActiveCamera()->Azimuth(30);
+ renderer->GetActiveCamera()->Elevation(30);
+ renderer->ResetCamera();
+
+ vtkSmartPointer<vtkRenderWindow> renWin =
+ vtkSmartPointer<vtkRenderWindow>::New();
+ vtkSmartPointer<vtkRenderWindowInteractor>
+ iren = vtkSmartPointer<vtkRenderWindowInteractor>::New();
+
+ iren->SetRenderWindow(renWin);
+ renWin->AddRenderer(renderer);
+ renWin->SetSize(500, 500);
+ renWin->Render();
+
+ vtkSmartPointer<vtkInteractorStyleTrackballCamera> style =
+ vtkSmartPointer<vtkInteractorStyleTrackballCamera>::New();
+ iren->SetInteractorStyle(style);
+
+ iren->Start();
+
+
+
+
+ /*
+
+ double origin[3] = {0.0, 0.0, 0.0};
+ double p0[3] = {10.0, 0.0, 0.0};
+ double p1[3] = {10.0, 10.0, 0.0};
+ double p2[3] = {0.0, 10.0, 0.0};
+ double p3[3] = {10.0, 10.0, 0.0};
+ double p4[3] = {10.0, 20.0, 0.0};
+ double p5[3] = {0.0, 20.0, 0.0};
+
+ //create a vtkPoints object and store the points in it
+ vtkSmartPointer<vtkPoints> points =
+ vtkSmartPointer<vtkPoints>::New();
+ points->InsertNextPoint(origin);
+ points->InsertNextPoint(p0);
+ points->InsertNextPoint(p1);
+ points->InsertNextPoint(p2);
+ points->InsertNextPoint(p3);
+ points->InsertNextPoint(p4);
+ points->InsertNextPoint(p5);
+
+ vtkSmartPointer<vtkPolyLine> polyLine =
+ vtkSmartPointer<vtkPolyLine>::New();
+ polyLine->GetPointIds()->SetNumberOfIds(7);
+ for(unsigned int i = 0; i < 7; i++)
+ {
+ polyLine->GetPointIds()->SetId(i,i);
+ }
+
+ double origin2[3] = {30.0, 0.0, 0.0};
+ double p02[3] = {40.0, 0.0, 0.0};
+ double p12[3] = {40.0, 20.0, 0.0};
+ double p22[3] = {30.0, 20.0, 0.0};
+ double p23[3] = {30.0, 0.0, 0.0};
+
+
+ points->InsertNextPoint(origin2);
+ points->InsertNextPoint(p02);
+ points->InsertNextPoint(p12);
+ points->InsertNextPoint(p22);
+ points->InsertNextPoint(p23);
+
+ vtkSmartPointer<vtkPolyLine> polyLine2 =
+ vtkSmartPointer<vtkPolyLine>::New();
+ polyLine2->GetPointIds()->SetNumberOfIds(5);
+ for(unsigned int i = 0; i < 5; i++)
+ {
+ polyLine2->GetPointIds()->SetId(i,i+7);
+ }
+
+ //Create a cell array to store the lines in and add the lines to it
+ vtkSmartPointer<vtkCellArray> cells =
+ vtkSmartPointer<vtkCellArray>::New();
+ cells->InsertNextCell(polyLine);
+ cells->InsertNextCell(polyLine2);
+
+
+ //Create a polydata to store everything in
+ vtkSmartPointer<vtkPolyData> polyData =
+ vtkSmartPointer<vtkPolyData>::New();
+
+ //add the points to the dataset
+ polyData->SetPoints(points);
+
+ //add the lines to the dataset
+ polyData->SetLines(cells);
+ //setup actor and mapper
+ vtkSmartPointer<vtkPolyDataMapper> mapper =
+ vtkSmartPointer<vtkPolyDataMapper>::New();
+ mapper->SetInput(polyData);
+
+ vtkSmartPointer<vtkActor> actor =
+ vtkSmartPointer<vtkActor>::New();
+ actor->SetMapper(mapper);
+
+ m_FiberAssembly->AddPart(actor);
+ */
+
+
+
+}
+
+//template<class TPixelType>
+mitk::FiberBundleMapper3D::~FiberBundleMapper3D()
+{
+ //MITK_INFO << "FiberBundleMapper3D(destructor)";
+ m_FiberActor->Delete();
+ m_FiberAssembly->Delete();
+ //m_vtkFiberList->Delete();
+ //m_VtkFiberDataMapperGL->Delete();
+ //m_VtkFiberDataMapper->Delete();
+
+}
+
+
+const mitk::FiberBundle* mitk::FiberBundleMapper3D::GetInput()
+{
+ //MITK_INFO << "FiberBundleMapper3D GetInput()" ;
+
+ return static_cast<const mitk::FiberBundle * > ( GetData() );
+}
+
+/*
+ This method is called once the mapper gets new input,
+ for UI rotation or changes in colorcoding this method is NOT called
+ */
+void mitk::FiberBundleMapper3D::GenerateData()
+{
+ /* ######## FIBER PREPARATION START ######### */
+ //get fiberbundle
+ mitk::FiberBundle::Pointer PFiberBundle = dynamic_cast< mitk::FiberBundle* > (this->GetData());
+
+ //get groupFiberBundle, which is a datastructure containing single fibers
+ mitk::FiberBundle::FiberGroupType::Pointer groupFiberBundle = PFiberBundle->GetGroupFiberBundle();
+
+ //extractn single fibers
+ //in the groupFiberBundle all smartPointers to single fibers are stored in in a ChildrenList
+ mitk::FiberBundle::ChildrenListType * FiberList;
+ FiberList = groupFiberBundle->GetChildren();
+
+ /* ######## FIBER PREPARATION END ######### */
+
+ /* ######## VTK FIBER REPRESENTATION ######## */
+ //create a vtkPoints object and store the all the brainFiber points in it
+
+ vtkPoints* vtkSmoothPoints = vtkPoints::New(); //in smoothpoints the interpolated points representing a fiber are stored.
+
+ //in vtkcells all polylines are stored, actually all id's of them are stored
+ vtkCellArray *vtkSmoothCells = vtkCellArray::New(); //cellcontainer for smoothed lines
+
+ //in some cases a fiber includes just 1 point, so put it in here
+ vtkCellArray *vtkVrtxs = vtkCellArray::New();
+
+ //colors and alpha value for each single point, RGBA = 4 components
+ vtkUnsignedCharArray *colorsT = vtkUnsignedCharArray::New();
+ colorsT->SetNumberOfComponents(4);
+ colorsT->SetName("ColorValues");
+
+ vtkDoubleArray *faColors = vtkDoubleArray::New();
+ faColors->SetName("FaColors");
+
+ vtkDoubleArray *tubeRadius = vtkDoubleArray::New();
+ tubeRadius->SetName("TubeRadius");
+
+
+ // iterate through FiberList
+ for(mitk::FiberBundle::ChildrenListType::iterator itLst = FiberList->begin();
+ itLst != FiberList->end();
+ ++itLst)
+ {
+ //all points are stored in one vtkpoints list, soooooooo that the lines find their point id to start and end we need some kind of helper index who monitors the current ids for a polyline
+ //unsigned long pntIdxHelper = vtkpointsDTI->GetNumberOfPoints();
+
+ // lists output is SpatialObject, we know we have DTITubeSpacialObjects
+ // dynamic cast only likes pointers, no smartpointers, so each dsmartpointer has membermethod .GetPointer()
+ itk::SpatialObject<3>::Pointer tmp_fbr;
+ tmp_fbr = *itLst;
+ mitk::FiberBundle::DTITubeType::Pointer dtiTract = dynamic_cast< mitk::FiberBundle::DTITubeType * > (tmp_fbr.GetPointer());
+ if (dtiTract.IsNull()) {
+ return; }
+
+ //get list of points
+ int fibrNrPnts = dtiTract->GetNumberOfPoints();
+ mitk::FiberBundle::DTITubeType::PointListType dtiPntList = dtiTract->GetPoints();
+
+ //MITK_INFO << "REAL AMOUNT OF FIBERS: " << fibrNrPnts;
+
+ vtkPoints *vtkpointsDTI = vtkPoints::New();
+
+ if (fibrNrPnts <= 0) { //this should never occour! but who knows
+ MITK_INFO << "HyperERROR in fiberBundleMapper3D.cpp ...no point in fiberBundle!!! .. check ur trackingAlgorithm";
+ continue;
+ }
+
+
+ ///////PROCESS ON FIBERS////////
+ for (int i=0; i<fibrNrPnts; ++i)
+ {
+ mitk::FiberBundle::DTITubePointType tmpFiberPntLst = dtiPntList.at(i);
+ mitk::FiberBundle::DTITubePointType::PointType tmpFiberPnt = tmpFiberPntLst.GetPosition();
+
+ float tmpvtkPnt[3] = {(float)tmpFiberPnt[0], (float)tmpFiberPnt[1], (float)tmpFiberPnt[2]};
+
+ mitk::Point3D indexPnt(tmpvtkPnt);
+ mitk::Point3D worldPnt;
+
+ // MITK_INFO << tmpFiberPnt[0] << " " << tmpFiberPnt[1] << " " << tmpFiberPnt[2];
+ // MITK_INFO << worldPnt[0] << " " << worldPnt[1] << " " << worldPnt[2];
+
+ /////POINT MANAGEMENT///////
+ if (i%1==0) { //if u want to take not each point of bundle, alter modulo to >1
+ PFiberBundle->GetGeometry()->IndexToWorld(indexPnt, worldPnt);
+ double worldFbrPnt[3] = {worldPnt[0], worldPnt[1], worldPnt[2]};
+ vtkpointsDTI->InsertNextPoint(worldFbrPnt);
+ }
+
+ //MITK_INFO << "REDUCED AMOUNT OF FIBERS: " << vtkpointsDTI->GetNumberOfPoints();
+
+ ////POINTS OF DTI ARE READY FOR FUTHER VTK PROCESSING////
+ }
+
+
+ /////PROCESS POLYLINE SMOOTHING/////
+ vtkKochanekSpline* xSpline = vtkKochanekSpline::New();
+ vtkKochanekSpline* ySpline = vtkKochanekSpline::New();
+ vtkKochanekSpline* zSpline = vtkKochanekSpline::New();
+
+ vtkParametricSpline* spline = vtkParametricSpline::New();
+ spline->SetXSpline(xSpline);
+ spline->SetYSpline(ySpline);
+ spline->SetZSpline(zSpline);
+ spline->SetPoints(vtkpointsDTI);
+
+
+ vtkParametricFunctionSource* functionSource = vtkParametricFunctionSource::New();
+ functionSource->SetParametricFunction(spline);
+ functionSource->SetUResolution(200);
+ functionSource->SetVResolution(200);
+ functionSource->SetWResolution(200);
+ functionSource->Update();
+
+
+
+ vtkPolyData* outputFunction = functionSource->GetOutput();
+ vtkPoints* tmpSmoothPnts = outputFunction->GetPoints(); //smoothPoints of current fiber
+
+ vtkPolyLine* smoothLine = vtkPolyLine::New();
+ smoothLine->GetPointIds()->SetNumberOfIds(tmpSmoothPnts->GetNumberOfPoints());
+// MITK_INFO << "SMOOTHED AMOUNT OF POINTS:" << tmpSmoothPnts->GetNumberOfPoints();
+
+
+ /////CREATE SMOOTH POLYLINE OBJECT////
+ /////MANAGE LINE AND CORRELATED POINTS/////
+ int pointHelperCnt = vtkSmoothPoints->GetNumberOfPoints(); //also put current points into global smooth pointcontainer
+ int nrSmPnts = tmpSmoothPnts->GetNumberOfPoints();
+ tubeRadius->SetNumberOfTuples(nrSmPnts);
+ double tbradius = 1;//default value for radius
+
+ for(int ism=0; ism<nrSmPnts; ism++)
+ {
+ // MITK_INFO << "ism: " << ism << " of " << nrSmPnts;
+ smoothLine->GetPointIds()->SetId(ism, ism+pointHelperCnt);
+ vtkSmoothPoints->InsertNextPoint(tmpSmoothPnts->GetPoint(ism));
+
+ // MITK_INFO << "LinePntID: " << ism << " linked to: " << ism+pointHelperCnt << " val: " << tmpSmoothPnts->GetPoint(ism)[0] << " " << tmpSmoothPnts->GetPoint(ism)[1] << " " << tmpSmoothPnts->GetPoint(ism)[2];
+ tubeRadius->SetTuple1(ism,tbradius); //tuple with 1 argument
+
+
+ //colorcoding orientation based
+ unsigned char rgba[4] = {0,0,0,0};
+ if (ism < nrSmPnts-1 && ism>0)
+ {
+
+ // MITK_INFO << "inbetween fiber, at position:" << ism;
+// //nimm nur diff1
+ vnl_vector_fixed< double, 3 > tmpPntvtk(tmpSmoothPnts->GetPoint(ism)[0], tmpSmoothPnts->GetPoint(ism)[1],tmpSmoothPnts->GetPoint(ism)[2]);
+ vnl_vector_fixed< double, 3 > nxttmpPntvtk(tmpSmoothPnts->GetPoint(ism+1)[0], tmpSmoothPnts->GetPoint(ism+1)[1], tmpSmoothPnts->GetPoint(ism+1)[2]);
+ vnl_vector_fixed< double, 3 > prevtmpPntvtk(tmpSmoothPnts->GetPoint(ism-1)[0], tmpSmoothPnts->GetPoint(ism-1)[1], tmpSmoothPnts->GetPoint(ism-1)[2]);
+
+ vnl_vector_fixed< double, 3 > diff1;
+ diff1 = tmpPntvtk - nxttmpPntvtk;
+ diff1.normalize();
+
+ vnl_vector_fixed< double, 3 > diff2;
+ diff2 = tmpPntvtk - prevtmpPntvtk;
+ diff2.normalize();
+
+ vnl_vector_fixed< double, 3 > diff;
+ diff = (diff1 - diff2)/2.0;
+
+
+ rgba[0] = (unsigned char) (255.0 * std::abs(diff[0]));
+ rgba[1] = (unsigned char) (255.0 * std::abs(diff[1]));
+ rgba[2] = (unsigned char) (255.0 * std::abs(diff[2]));
+ rgba[3] = (unsigned char) (255.0);
+
+
+
+ } else if(ism==0) {
+ //explicit handling of startpoint of line
+
+ //nimm nur diff1
+ vnl_vector_fixed< double, 3 > tmpPntvtk(tmpSmoothPnts->GetPoint(ism)[0], tmpSmoothPnts->GetPoint(ism)[1],tmpSmoothPnts->GetPoint(ism)[2]);
+ vnl_vector_fixed< double, 3 > nxttmpPntvtk(tmpSmoothPnts->GetPoint(ism+1)[0], tmpSmoothPnts->GetPoint(ism+1)[1], tmpSmoothPnts->GetPoint(ism+1)[2]);
+
+
+ vnl_vector_fixed< double, 3 > diff1;
+ diff1 = tmpPntvtk - nxttmpPntvtk;
+ diff1.normalize();
+
+ rgba[0] = (unsigned char) (255.0 * std::abs(diff1[0]));
+ rgba[1] = (unsigned char) (255.0 * std::abs(diff1[1]));
+ rgba[2] = (unsigned char) (255.0 * std::abs(diff1[2]));
+ rgba[3] = (unsigned char) (255.0);
+
+// MITK_INFO << "first point color: " << rgba[0] << " " << rgba[1] << " " << rgba[2];
+
+
+ } else if(ism==nrSmPnts-1) {
+// last point in fiber
+
+ // nimm nur diff2
+ vnl_vector_fixed< double, 3 > tmpPntvtk(tmpSmoothPnts->GetPoint(ism)[0], tmpSmoothPnts->GetPoint(ism)[1],tmpSmoothPnts->GetPoint(ism)[2]);
+ vnl_vector_fixed< double, 3 > prevtmpPntvtk(tmpSmoothPnts->GetPoint(ism-1)[0], tmpSmoothPnts->GetPoint(ism-1)[1], tmpSmoothPnts->GetPoint(ism-1)[2]);
+
+ vnl_vector_fixed< double, 3 > diff2;
+ diff2 = tmpPntvtk - prevtmpPntvtk;
+ diff2.normalize();
+
+ rgba[0] = (unsigned char) (255.0 * std::abs(diff2[0]));
+ rgba[1] = (unsigned char) (255.0 * std::abs(diff2[1]));
+ rgba[2] = (unsigned char) (255.0 * std::abs(diff2[2]));
+ rgba[3] = (unsigned char) (255.0);
+//
+// MITK_INFO << "last point color: " << rgba[0] << " " << rgba[1] << " " << rgba[2];
+ } //end colorcoding
+//
+ colorsT->InsertNextTupleValue(rgba);
+
+ }//end of smoothline
+
+ ///////smooth Fiber ready////////
+ vtkSmoothCells->InsertNextCell(smoothLine);
+ }
+
+ //vtkpointsDTI->Delete();//points are not needed anymore TODO uncomment!
+
+
+ /*
+
+ //get FA value ... for that FA has to be interpolated as well as DTItracktLine
+ float faVal = tmpFiberPntLst.GetField(mitk::FiberBundle::DTITubePointType::FA);
+ //use insertNextValue cuz FA Values are reperesented as a single number (1 Tuple containing 1 parameter)
+ faColors->InsertNextValue((double) faVal);
+
+ */
+ //vtkcells->InitTraversal();
+
+ // Put points and lines together in one polyData structure
+ vtkPolyData *polyData = vtkPolyData::New();
+ polyData->SetPoints(vtkSmoothPoints);
+ polyData->SetLines(vtkSmoothCells);
+
+ if (vtkVrtxs->GetSize() > 0) {
+ polyData->SetVerts(vtkVrtxs);
+ }
+ polyData->GetPointData()->AddArray(colorsT);
+ //polyData->GetPointData()->AddArray(faColors);
+ //polyData->GetPointData()->AddArray(tubeRadius);
+
+
+ vtkLookupTable *lut = vtkLookupTable::New();
+ lut->Build();
+
+
+ m_VtkFiberDataMapperGL = vtkOpenGLPolyDataMapper::New();
+ m_VtkFiberDataMapperGL->SetInput(polyData);
+ m_VtkFiberDataMapperGL->ScalarVisibilityOn();
+
+ m_VtkFiberDataMapperGL->SetScalarModeToUsePointFieldData();
+ //m_VtkFiberDataMapperGL->SelectColorArray("FaColors");
+ m_VtkFiberDataMapperGL->SelectColorArray("ColorValues");
+ m_VtkFiberDataMapperGL->SetLookupTable(lut);
+
+ m_vtkTubeMapper = vtkOpenGLPolyDataMapper::New();
+
+ //m_FiberActor = vtkOpenGLActor::New();
+ m_FiberActor->SetMapper(m_VtkFiberDataMapperGL);
+ m_FiberActor->GetProperty()->SetOpacity(1.0);
+ m_FiberActor->GetProperty()->SetPointSize(4.0f);
+ // m_FiberActor->GetProperty()->SetColor(255.0, 0.0, 0.0);
+
+
+
+ m_FiberAssembly->AddPart(m_FiberActor);
+
+ //setting color and opacity in the fiberActor itself is not recommended
+ //here cuz color and opacity of dataNode will be considered in GetData(baserenderer*) anyway
+ this->GetDataNode()->SetColor(255.0,0,0);
+ this->GetDataNode()->SetOpacity(1.0);
+
+
+}
+
+
+
+
+//template<class TPixelType>
+void mitk::FiberBundleMapper3D::GenerateDataForRenderer( mitk::BaseRenderer *renderer )
+{
+
+
+ //MITK_INFO << "FiberBundleMapper3D GenerateData(BaseRenderer)" ;
+
+ // nodeCC = 1 ... ROI colorcoding
+ // 2 ... orientation colorcoding
+ // 3 ... FA colorcoding
+
+
+ int nodeCC;
+ bool isCCd = this->GetDataNode()->GetPropertyValue("ColorCoding", nodeCC);
+ if ( isCCd && nodeCC == 1 ) {
+
+
+ //get color and opacity from DataNode
+ int tmpline;
+
+ bool isLineProp = this->GetDataNode()->GetPropertyValue("LineWidth",tmpline);
+
+ bool isPointRep;
+ bool successPointProp = this->GetDataNode()->GetPropertyValue("RepPoints", isPointRep);
+ float pointSize;
+ bool successPointSize = this->GetDataNode()->GetPropertyValue("pointSize", pointSize);
+
+ if (isLineProp) {
+ m_FiberActor->GetProperty()->SetLineWidth(tmpline);
+ }
+
+ if(isPointRep) {
+ m_FiberActor->GetProperty()->SetRepresentationToPoints();
+ m_FiberActor->GetProperty()->SetPointSize(pointSize);
+ }
+
+ } else if (isCCd && nodeCC == 2) {
+ float tmpopa;
+ this->GetDataNode()->GetOpacity(tmpopa, NULL);
+ m_FiberActor->GetProperty()->SetOpacity((double) tmpopa);
+
+ } else if (isCCd && nodeCC == 3) {
+
+ float temprgb[3];
+ this->GetDataNode()->GetColor( temprgb, NULL );
+ double trgb[3] = { (double) temprgb[0], (double) temprgb[1], (double) temprgb[2] };
+ m_FiberActor->GetProperty()->SetColor(trgb);
+
+ if(m_VtkFiberDataMapperGL->GetScalarVisibility()) //can be 0 or 1, for scalarVis On or Off
+ {
+ m_VtkFiberDataMapperGL->ScalarVisibilityOff();
+ }
+
+
+
+ } else if (isCCd && nodeCC == 4) {
+
+ if(!m_VtkFiberDataMapperGL->GetScalarVisibility()) //can be 0 or 1, for scalarVis On or Off
+ {
+ m_VtkFiberDataMapperGL->ScalarVisibilityOn();
+ }
+ m_VtkFiberDataMapperGL->SelectColorArray("ColorValues");
+
+ } else if (isCCd && nodeCC == 5){
+
+ if(!m_VtkFiberDataMapperGL->GetScalarVisibility()) //if visibility is off, switch it on
+ {
+ m_VtkFiberDataMapperGL->ScalarVisibilityOn();
+ }
+ m_VtkFiberDataMapperGL->SelectColorArray("FaColors");
+
+ } else if (isCCd && nodeCC == 6){
+ //orientationbased colorcoding + FA as opacity
+ //get FA out of polydata, which is saved in faColor vtkDoubleArray
+
+ vtkPolyData *tmpPolyData = m_VtkFiberDataMapperGL->GetInput();
+ vtkPointData *tmpPointData = tmpPolyData->GetPointData();
+
+
+
+ int hasAr = tmpPointData->HasArray("FaColors");
+ if(!hasAr)
+ return;
+
+ vtkDoubleArray *tmpFAarray = (vtkDoubleArray*)(tmpPointData->GetArray("FaColors")) ;
+
+ /*for(int i=0; i<tmpFAarray->GetNumberOfTuples(); i++)
+ {
+
+ double *tmpTuple;
+ tmpFAarray->GetTuple(i, tmpTuple);
+
+ for(int j=0; j<tmpFAarray->GetNumberOfComponents(); j++)
+ {
+ MITK_INFO << "FA Value: at index " << i << ": " << tmpTuple[j];
+ }
+
+
+ }
+ */
+
+ //since we have our FA values, lets replace the alpha values in colorT
+ //we know each 4th entry is a A value of RGBA
+ int hasArCV = tmpPointData->HasArray("ColorValues");
+ if(!hasArCV)
+ return;
+
+ vtkUnsignedCharArray *colorsTtmp = dynamic_cast<vtkUnsignedCharArray*> (tmpPointData->GetArray("ColorValues"));
+
+ for(int i=0; i<colorsTtmp->GetNumberOfTuples(); i++)
+ {
+
+ //double *tmpTupleCV = colorsTtmp->GetTuple4(i);
+ double tmpTupleFA = tmpFAarray->GetTuple1(i);
+ tmpTupleFA = tmpTupleFA * 255.0;
+
+ colorsTtmp->SetComponent(i,3, tmpTupleFA );
+
+ // MITK_INFO << "----" << i;
+ //MITK_INFO << tmpTupleCV[0];
+ //MITK_INFO << tmpTupleCV[1];
+ //MITK_INFO << tmpTupleCV[2];
+ //MITK_INFO << tmpTupleCV[3];
+ //double *test = m_VtkFiberDataMapperGL->GetInput()->GetPointData()->GetArray("ColorValues")->GetTuple4(i);
+ //MITK_INFO << test[0];
+ //MITK_INFO << test[1];
+ //MITK_INFO << test[2];
+ //MITK_INFO << test[3];
+
+
+ }
+
+ m_VtkFiberDataMapperGL->SelectColorArray("");
+ m_VtkFiberDataMapperGL->SelectColorArray("ColorValues");
+
+
+ } else if (isCCd && nodeCC == 7){
+
+ vtkPolyData *tmpPolyData = m_VtkFiberDataMapperGL->GetInput();
+ vtkPointData *tmpPointData = tmpPolyData->GetPointData();
+ int hasArCV = tmpPointData->HasArray("ColorValues");
+ if(!hasArCV)
+ return;
+
+ vtkUnsignedCharArray *colorsTtmp = dynamic_cast<vtkUnsignedCharArray*> (tmpPointData->GetArray("ColorValues"));
+
+ for(int i=0; i<colorsTtmp->GetNumberOfTuples(); i++)
+ {
+
+ double tmpTupleFA = 255.0;
+ colorsTtmp->SetComponent(i,3, tmpTupleFA );
+ }
+ m_VtkFiberDataMapperGL->SelectColorArray("");
+ m_VtkFiberDataMapperGL->SelectColorArray("ColorValues");
+
+
+ } else if (isCCd && nodeCC == 8) {
+ /* something is still missing to activate smoothing or make it work.... */
+ if (!renderer->GetRenderWindow()->GetLineSmoothing()) {
+ renderer->GetRenderWindow()->SetLineSmoothing(1);
+ renderer->GetRenderWindow()->Modified();
+ }
+ if (!renderer->GetRenderWindow()->GetPointSmoothing()) {
+ renderer->GetRenderWindow()->SetPointSmoothing(1);
+ renderer->GetRenderWindow()->Modified();
+ }
+ if (!renderer->GetRenderWindow()->GetPolygonSmoothing()) {
+ renderer->GetRenderWindow()->SetPolygonSmoothing(1);
+ renderer->GetRenderWindow()->Modified();
+ }
+
+
+ } else if (isCCd && nodeCC == 9) {
+ if (renderer->GetRenderWindow()->GetLineSmoothing()) {
+ renderer->GetRenderWindow()->SetLineSmoothing(0);
+ renderer->GetRenderWindow()->Modified();
+ }
+ if (renderer->GetRenderWindow()->GetPointSmoothing()) {
+ renderer->GetRenderWindow()->SetPointSmoothing(0);
+ renderer->GetRenderWindow()->Modified();
+ }
+ if (renderer->GetRenderWindow()->GetPolygonSmoothing()) {
+ renderer->GetRenderWindow()->SetPolygonSmoothing(0);
+ renderer->GetRenderWindow()->Modified();
+ }
+
+ } else if (isCCd && nodeCC == 10) {
+ // manipulate X Coordinates of selected FiberBundle
+ int tmpXmove;
+
+ bool isXmove = this->GetDataNode()->GetPropertyValue("Xmove",tmpXmove);
+
+ if (!isXmove)
+ return;
+
+ vtkPolyData *tmpPolyData = m_VtkFiberDataMapperGL->GetInput();
+ vtkPoints* tmpVtkPnts = tmpPolyData->GetPoints();
+ double PtmpPntVal[3];
+
+ for (int i=0; i<tmpVtkPnts->GetNumberOfPoints(); ++i )
+ {
+ tmpVtkPnts->GetPoint(i,PtmpPntVal);
+
+ PtmpPntVal[0] = PtmpPntVal[0] + (double) tmpXmove;
+ tmpVtkPnts->SetPoint(i, PtmpPntVal);
+
+ tmpPolyData->Modified();
+
+ }
+
+ } else if (isCCd && nodeCC == 11) {
+ // manipulate Y Coordinates of selected FiberBundle
+ int tmpYmove;
+
+ bool isYmove = this->GetDataNode()->GetPropertyValue("Ymove",tmpYmove);
+
+ if (!isYmove)
+ return;
+
+ vtkPolyData *tmpPolyData = m_VtkFiberDataMapperGL->GetInput();
+ vtkPoints* tmpVtkPnts = tmpPolyData->GetPoints();
+ double PtmpPntVal[3];
+
+ for (int i=0; i<tmpVtkPnts->GetNumberOfPoints(); ++i )
+ {
+ tmpVtkPnts->GetPoint(i,PtmpPntVal);
+
+ PtmpPntVal[1] = PtmpPntVal[1] + (double) tmpYmove;
+ tmpVtkPnts->SetPoint(i, PtmpPntVal);
+
+ tmpPolyData->Modified();
+
+ }
+
+ } else if (isCCd && nodeCC == 12) {
+ // manipulate Z Coordinates of selected FiberBundle
+ int tmpZmove;
+
+ bool isZmove = this->GetDataNode()->GetPropertyValue("Zmove",tmpZmove);
+ if (!isZmove)
+ return;
+
+ vtkPolyData *tmpPolyData = m_VtkFiberDataMapperGL->GetInput();
+ vtkPoints* tmpVtkPnts = tmpPolyData->GetPoints();
+ double PtmpPntVal[3];
+
+ for (int i=0; i<tmpVtkPnts->GetNumberOfPoints(); ++i )
+ {
+ tmpVtkPnts->GetPoint(i,PtmpPntVal);
+
+ PtmpPntVal[2] = PtmpPntVal[2] + (double) tmpZmove;
+ //PtmpPntVal[2] = PtmpPntVal[2] + 1;
+ tmpVtkPnts->SetPoint(i, PtmpPntVal);
+
+ tmpPolyData->Modified();
+
+ }
+
+ } else if (isCCd && nodeCC == 13) {
+ int tmpTubeSides;
+ bool isTubeSides = this->GetDataNode()->GetPropertyValue("TubeSides",tmpTubeSides);
+
+ float tmpRadius;
+ bool isRadius = this->GetDataNode()->GetPropertyValue("TubeRadius",tmpRadius);
+
+ if (!isTubeSides)
+ return;
+
+ vtkPolyData *tmpPolyData = m_VtkFiberDataMapperGL->GetInput();
+
+
+ m_tubes = vtkTubeFilter::New();
+ m_tubes->SetInput(tmpPolyData);
+ m_tubes->SidesShareVerticesOn();
+ m_tubes->SetRadius((double)(tmpRadius));
+ m_tubes->SetNumberOfSides(tmpTubeSides);
+ m_tubes->Modified();
+ // m_tubes->Update();
+
+
+ m_vtkTubeMapper->SetInputConnection(m_tubes->GetOutputPort());
+ m_vtkTubeMapper->ScalarVisibilityOn();
+ m_vtkTubeMapper->SetScalarModeToUsePointFieldData();
+ m_vtkTubeMapper->SelectColorArray("");
+ m_vtkTubeMapper->SelectColorArray("ColorValues");
+
+
+
+ m_TubeActor->SetMapper(m_vtkTubeMapper);
+ m_TubeActor->GetProperty()->SetOpacity(1);
+ m_TubeActor->GetProperty()->BackfaceCullingOn();
+
+ m_FiberAssembly->AddPart(m_TubeActor);
+ m_FiberAssembly->Modified();
+
+ } else if (isCCd && nodeCC == 14) {
+
+ float temprgb[3];
+ this->GetDataNode()->GetColor( temprgb, NULL );
+ double trgb[3] = { (double) temprgb[0], (double) temprgb[1], (double) temprgb[2] };
+ m_TubeActor->GetProperty()->SetColor(trgb);
+
+ if(m_vtkTubeMapper->GetScalarVisibility()) //can be 0 or 1, for scalarVis On or Off
+ {
+ m_vtkTubeMapper->ScalarVisibilityOff();
+ }
+
+ } else if (isCCd && nodeCC == 15) {
+ m_TubeActor->GetProperty()->SetOpacity(0);
+ m_FiberAssembly->RemovePart(m_TubeActor);
+ m_FiberAssembly->Modified();
+
+ }else if (isCCd && nodeCC == 16) {
+ float tmpTubeOpacity;
+ bool isTubeOpacity = this->GetDataNode()->GetPropertyValue("TubeOpacity",tmpTubeOpacity);
+
+ m_TubeActor->GetProperty()->SetOpacity((double) tmpTubeOpacity);
+ m_TubeActor->Modified();
+
+ } else if (isCCd && nodeCC == 17) {
+ m_FiberActor->GetProperty()->SetOpacity(0);
+ m_FiberAssembly->RemovePart(m_FiberActor);
+ m_FiberAssembly->Modified();
+
+ }else if (isCCd && nodeCC == 18) {
+ m_FiberActor->GetProperty()->SetOpacity(0);
+ m_FiberAssembly->AddPart(m_FiberActor);
+ m_FiberAssembly->Modified();
+
+ }
+
+
+
+ //MITK_INFO << m_VtkFiberDataMapperGL->GetArrayName();
+
+
+ /* int displayIndex(0);
+ this->GetDataNode()->GetIntProperty( "DisplayChannel", displayIndex, renderer );
+ InputImageType *input = const_cast< InputImageType* >(
+ this->GetInput()
+ );
+ mitk::DiffusionImage<TPixelType> *input2 = dynamic_cast< mitk::DiffusionImage<TPixelType>* >(
+ input
+ );
+ input2->SetDisplayIndexForRendering(displayIndex);
+ Superclass::GenerateDataForRenderer(renderer);
+ */
+}
+
+//template<class TPixelType>
+void mitk::FiberBundleMapper3D::SetDefaultProperties(mitk::DataNode* node, mitk::BaseRenderer* renderer, bool overwrite)
+{
+ //MITK_INFO << "FiberBundleMapper3D SetDefault Properties(...)";
+ node->AddProperty( "DisplayChannel", mitk::IntProperty::New( true ), renderer, overwrite );
+ node->AddProperty( "LineWidth", mitk::IntProperty::New( true ), renderer, overwrite );
+ node->AddProperty( "ColorCoding", mitk::IntProperty::New( 0 ), renderer, overwrite);
+ node->AddProperty( "VertexOpacity_1", mitk::BoolProperty::New( false ), renderer, overwrite);
+ node->AddProperty( "Set_FA_VertexAlpha", mitk::BoolProperty::New( false ), renderer, overwrite);
+ node->AddProperty( "pointSize", mitk::FloatProperty::New(0.5), renderer, overwrite);
+ node->AddProperty( "setShading", mitk::IntProperty::New(1), renderer, overwrite);
+ node->AddProperty( "Xmove", mitk::IntProperty::New( 0 ), renderer, overwrite);
+ node->AddProperty( "Ymove", mitk::IntProperty::New( 0 ), renderer, overwrite);
+ node->AddProperty( "Zmove", mitk::IntProperty::New( 0 ), renderer, overwrite);
+ node->AddProperty( "RepPoints", mitk::BoolProperty::New( false ), renderer, overwrite);
+ node->AddProperty( "TubeSides", mitk::IntProperty::New( 8 ), renderer, overwrite);
+ node->AddProperty( "TubeRadius", mitk::FloatProperty::New( 0.15 ), renderer, overwrite);
+ node->AddProperty( "TubeOpacity", mitk::FloatProperty::New( 1.0 ), renderer, overwrite);
+
+ node->AddProperty( "pickable", mitk::BoolProperty::New( true ), renderer, overwrite);
+
+ Superclass::SetDefaultProperties(node, renderer, overwrite);
+
+
+
+}
+
+vtkProp* mitk::FiberBundleMapper3D::GetVtkProp(mitk::BaseRenderer *renderer)
+{
+
+ //MITK_INFO << "FiberBundleMapper3D GetVtkProp(renderer)";
+ return m_FiberAssembly;
+
+}
+
+void mitk::FiberBundleMapper3D::ApplyProperties(mitk::BaseRenderer* renderer)
+{
+ // MITK_INFO << "FiberBundleMapper3D ApplyProperties(renderer)";
+}
+
+void mitk::FiberBundleMapper3D::UpdateVtkObjects()
+{
+ // MITK_INFO << "FiberBundleMapper3D UpdateVtkObjects()";
+
+
+}
+
+void mitk::FiberBundleMapper3D::SetVtkMapperImmediateModeRendering(vtkMapper *)
+{
+
+
+
+}
+
+
+
diff --git a/Modules/DiffusionImaging/Rendering/mitkFiberBundleMapper3D.h b/Modules/DiffusionImaging/Rendering/mitkFiberBundleMapper3D.h
new file mode 100644
index 0000000000..bc5be955c5
--- /dev/null
+++ b/Modules/DiffusionImaging/Rendering/mitkFiberBundleMapper3D.h
@@ -0,0 +1,103 @@
+/*=========================================================================
+
+Program: Medical Imaging & Interaction Toolkit
+Language: C++
+Date: $Date: 2009-05-12 19:56:03 +0200 (Di, 12 Mai 2009) $
+Version: $Revision: 17179 $
+
+Copyright (c) German Cancer Research Center, Division of Medical and
+Biological Informatics. All rights reserved.
+See MITKCopyright.txt or http://www.mitk.org/copyright.html for details.
+
+This software is distributed WITHOUT ANY WARRANTY; without even
+the implied warranty of MERCHANTABILITY or FITNESS FOR A PARTICULAR
+PURPOSE. See the above copyright notices for more information.
+
+=========================================================================*/
+
+
+#ifndef FiberBundleMapper3D_H_HEADER_INCLUDED
+#define FiberBundleMapper3D_H_HEADER_INCLUDED
+
+//#include "mitkCommon.h"
+//#include "mitkBaseRenderer.h"
+
+#include "mitkFiberBundle.h"
+#include <vtkSmartPointer.h>
+#include "mitkVtkMapper3D.h"
+#include "MitkDiffusionImagingExports.h"
+#include "mitkBaseData.h"
+#include "vtkAppendPolyData.h"
+#include "vtkOpenGLPolyDataMapper.h"
+#include "vtkOpenGLActor.h"
+#include "vtkPropAssembly.h"
+#include "vtkProperty.h"
+#include "vtkUnsignedCharArray.h"
+#include "vtkTubeFilter.h"
+
+
+namespace mitk {
+
+ //##Documentation
+ //## @brief Mapper for FiberBundles
+ //## @ingroup Mapper
+// template<class TPixelType>
+ class MitkDiffusionImaging_EXPORT FiberBundleMapper3D : public VtkMapper3D
+ {
+ public:
+
+ mitkClassMacro(FiberBundleMapper3D, VtkMapper3D);
+ itkNewMacro(Self);
+
+
+ const mitk::FiberBundle* GetInput();
+
+ virtual vtkProp *GetVtkProp(mitk::BaseRenderer *renderer); //looks like depricated.. should be replaced bz GetViewProp()
+ static void SetDefaultProperties(DataNode* node, BaseRenderer* renderer = NULL, bool overwrite = false );
+
+ virtual void ApplyProperties(mitk::BaseRenderer* renderer);
+ static void SetVtkMapperImmediateModeRendering(vtkMapper *mapper);
+
+ virtual void GenerateDataForRenderer(mitk::BaseRenderer* renderer);
+ virtual void GenerateData();
+
+
+ protected:
+
+ FiberBundleMapper3D();
+ virtual ~FiberBundleMapper3D();
+
+ void UpdateVtkObjects();
+
+
+ vtkAppendPolyData *m_vtkFiberList;
+ //vtkSmartPointer<vtkAppendPolyData> m_vtkFiberList;
+
+ vtkOpenGLPolyDataMapper *m_VtkFiberDataMapperGL;
+ //vtkPainterPolyDataMapper *m_VtkFiberDataMapperGL;
+ //vtkSmartPointer<vtkOpenGLPolyDataMapper> m_VtkFiberDataMapperGL;
+
+ //vtkOpenGLPolyDataMapper *m_VtkFiberDataMapper;
+ //vtkSmartPointer<vtkPolyDataMapper> m_VtkFiberDataMapper;
+
+ vtkOpenGLActor *m_FiberActor;
+ //vtkSmartPointer<vtkActor> m_FiberActor;
+
+ vtkTubeFilter *m_tubes;
+ vtkOpenGLActor *m_TubeActor;
+ vtkOpenGLPolyDataMapper *m_vtkTubeMapper;
+
+
+ vtkPropAssembly *m_FiberAssembly;
+
+
+
+ };
+
+} // namespace mitk
+
+
+
+
+#endif /* FiberBundleMapper3D_H_HEADER_INCLUDED */
+
diff --git a/Modules/DiffusionImaging/Rendering/mitkOdfNormalizationMethodProperty.cpp b/Modules/DiffusionImaging/Rendering/mitkOdfNormalizationMethodProperty.cpp
index e3f924dd41..ab0c53167e 100644
--- a/Modules/DiffusionImaging/Rendering/mitkOdfNormalizationMethodProperty.cpp
+++ b/Modules/DiffusionImaging/Rendering/mitkOdfNormalizationMethodProperty.cpp
@@ -1,98 +1,100 @@
/*=========================================================================
Program: Medical Imaging & Interaction Toolkit
Language: C++
Date: $Date: 2009-05-12 19:31:16 +0200 (Di, 12 Mai 2009) $
Version: $Revision: $
Copyright (c) German Cancer Research Center, Division of Medical and
Biological Informatics. All rights reserved.
See MITKCopyright.txt or http://www.mitk.org/copyright.html for details.
This software is distributed WITHOUT ANY WARRANTY; without even
the implied warranty of MERCHANTABILITY or FITNESS FOR A PARTICULAR
PURPOSE. See the above copyright notices for more information.
=========================================================================*/
#include "mitkOdfNormalizationMethodProperty.h"
// ODFN_MINMAX, ODFN_MAX, ODFN_NONE ODFN_GLOBAL_MAX
mitk::OdfNormalizationMethodProperty::OdfNormalizationMethodProperty( )
{
this->AddInterpolationTypes();
this->SetValue( static_cast<IdType>( ODFN_MINMAX ) );
}
mitk::OdfNormalizationMethodProperty::OdfNormalizationMethodProperty( const IdType& value )
{
this->AddInterpolationTypes();
if ( IsValidEnumerationValue( value ) )
{
this->SetValue( value ) ;
}
else
{
this->SetValue( static_cast<IdType>( ODFN_MINMAX ) );
}
}
mitk::OdfNormalizationMethodProperty::OdfNormalizationMethodProperty( const std::string& value )
{
this->AddInterpolationTypes();
if ( IsValidEnumerationValue( value ) )
{
this->SetValue( value );
}
else
{
this->SetValue( static_cast<IdType>( ODFN_MINMAX ) );
}
}
int mitk::OdfNormalizationMethodProperty::GetNormalization()
{
return static_cast<int>( this->GetValueAsId() );
}
void mitk::OdfNormalizationMethodProperty::SetNormalizationToMinMax()
{
this->SetValue( static_cast<IdType>( ODFN_MINMAX ) );
}
void mitk::OdfNormalizationMethodProperty::SetNormalizationToMax()
{
this->SetValue( static_cast<IdType>( ODFN_MAX ) );
}
void mitk::OdfNormalizationMethodProperty::SetNormalizationToNone()
{
this->SetValue( static_cast<IdType>( ODFN_NONE ) );
}
void mitk::OdfNormalizationMethodProperty::SetNormalizationToGlobalMax()
{
this->SetValue( static_cast<IdType>( ODFN_GLOBAL_MAX ) );
}
void mitk::OdfNormalizationMethodProperty::AddInterpolationTypes()
{
AddEnum( "Min-Max", static_cast<IdType>( ODFN_MINMAX ) );
AddEnum( "Maximum", static_cast<IdType>( ODFN_MAX ) );
AddEnum( "None", static_cast<IdType>( ODFN_NONE ) );
AddEnum( "Global Maximum", static_cast<IdType>( ODFN_GLOBAL_MAX ) );
}
bool mitk::OdfNormalizationMethodProperty::AddEnum( const std::string& name, const IdType& id )
{
return Superclass::AddEnum( name, id );
}
+
+MITK_REGISTER_SERIALIZER( OdfNormalizationMethodPropertySerializer )
diff --git a/Modules/DiffusionImaging/Rendering/mitkOdfNormalizationMethodProperty.h b/Modules/DiffusionImaging/Rendering/mitkOdfNormalizationMethodProperty.h
index b9a58bb10e..aa3eae0b93 100644
--- a/Modules/DiffusionImaging/Rendering/mitkOdfNormalizationMethodProperty.h
+++ b/Modules/DiffusionImaging/Rendering/mitkOdfNormalizationMethodProperty.h
@@ -1,109 +1,136 @@
/*=========================================================================
Program: Medical Imaging & Interaction Toolkit
Language: C++
Date: $Date: 2009-05-12 19:31:16 +0200 (Di, 12 Mai 2009) $
Version: $Revision: $
Copyright (c) German Cancer Research Center, Division of Medical and
Biological Informatics. All rights reserved.
See MITKCopyright.txt or http://www.mitk.org/copyright.html for details.
This software is distributed WITHOUT ANY WARRANTY; without even
the implied warranty of MERCHANTABILITY or FITNESS FOR A PARTICULAR
PURPOSE. See the above copyright notices for more information.
=========================================================================*/
#ifndef _MITK_OdfNormalizationMethodProperty__H_
#define _MITK_OdfNormalizationMethodProperty__H_
#include "mitkEnumerationProperty.h"
+#include "mitkEnumerationPropertySerializer.h"
#include "MitkDiffusionImagingExports.h"
+#include "mitkSerializerMacros.h"
+
namespace mitk
{
enum OdfNormalizationMethod
{
ODFN_MINMAX,
ODFN_MAX,
ODFN_NONE,
ODFN_GLOBAL_MAX
};
/**
* Encapsulates the enumeration for ODF normalization. Valid values are
* ODFN_MINMAX, ODFN_MAX, ODFN_NONE ODFN_GLOBAL_MAX
* Default is ODFN_MINMAX
*/
class MitkDiffusionImaging_EXPORT OdfNormalizationMethodProperty : public EnumerationProperty
{
public:
mitkClassMacro( OdfNormalizationMethodProperty, EnumerationProperty );
itkNewMacro(OdfNormalizationMethodProperty);
mitkNewMacro1Param(OdfNormalizationMethodProperty, const IdType&);
mitkNewMacro1Param(OdfNormalizationMethodProperty, const std::string&);
/**
* Returns the current interpolation value as defined by VTK constants.
*/
virtual int GetNormalization();
/**
* Sets the interpolation type to ODFN_MINMAX.
*/
virtual void SetNormalizationToMinMax();
/**
* Sets the interpolation type to ODFN_MAX.
*/
virtual void SetNormalizationToMax();
/**
* Sets the interpolation type to ODFN_NONE.
*/
virtual void SetNormalizationToNone();
/**
* Sets the interpolation type to ODFN_GLOBAL_MAX.
*/
virtual void SetNormalizationToGlobalMax();
protected:
/** Sets reslice interpolation mode to default (VTK_RESLICE_NEAREST).
*/
OdfNormalizationMethodProperty( );
/**
* Constructor. Sets reslice interpolation to the given value.
*/
OdfNormalizationMethodProperty( const IdType& value );
/**
* Constructor. Sets reslice interpolation to the given value.
*/
OdfNormalizationMethodProperty( const std::string& value );
/**
* this function is overridden as protected, so that the user may not add
* additional invalid interpolation types.
*/
virtual bool AddEnum( const std::string& name, const IdType& id );
/**
* Adds the enumeration types as defined by vtk to the list of known
* enumeration values.
*/
virtual void AddInterpolationTypes();
};
+class MitkDiffusionImaging_EXPORT OdfNormalizationMethodPropertySerializer : public EnumerationPropertySerializer
+{
+ public:
+
+ mitkClassMacro( OdfNormalizationMethodPropertySerializer, EnumerationPropertySerializer );
+ itkNewMacro(Self);
+
+ virtual BaseProperty::Pointer Deserialize(TiXmlElement* element)
+ {
+ if (!element) return NULL;
+ const char* sa( element->Attribute("value") );
+ std::string s(sa?sa:"");
+ OdfNormalizationMethodProperty::Pointer property = OdfNormalizationMethodProperty::New();
+ property->SetValue( s );
+ return property.GetPointer();
+ }
+
+ protected:
+
+ OdfNormalizationMethodPropertySerializer () {}
+ virtual ~OdfNormalizationMethodPropertySerializer () {}
+};
+
+
} // end of namespace mitk
#endif
diff --git a/Modules/DiffusionImaging/Rendering/mitkOdfScaleByProperty.cpp b/Modules/DiffusionImaging/Rendering/mitkOdfScaleByProperty.cpp
index 564fe6e9a9..b117b9134f 100644
--- a/Modules/DiffusionImaging/Rendering/mitkOdfScaleByProperty.cpp
+++ b/Modules/DiffusionImaging/Rendering/mitkOdfScaleByProperty.cpp
@@ -1,86 +1,88 @@
/*=========================================================================
Program: Medical Imaging & Interaction Toolkit
Language: C++
Date: $Date: 2009-05-12 19:31:16 +0200 (Di, 12 Mai 2009) $
Version: $Revision: $
Copyright (c) German Cancer Research Center, Division of Medical and
Biological Informatics. All rights reserved.
See MITKCopyright.txt or http://www.mitk.org/copyright.html for details.
This software is distributed WITHOUT ANY WARRANTY; without even
the implied warranty of MERCHANTABILITY or FITNESS FOR A PARTICULAR
PURPOSE. See the above copyright notices for more information.
=========================================================================*/
#include "mitkOdfScaleByProperty.h"
// ODFN_NONE, ODFN_GFA, ODFN_PC
mitk::OdfScaleByProperty::OdfScaleByProperty( )
{
this->AddInterpolationTypes();
this->SetValue( static_cast<IdType>( ODFSB_NONE ) );
}
mitk::OdfScaleByProperty::OdfScaleByProperty( const IdType& value )
{
this->AddInterpolationTypes();
if ( IsValidEnumerationValue( value ) )
{
this->SetValue( value ) ;
}
else
{
this->SetValue( static_cast<IdType>( ODFSB_NONE ) );
}
}
mitk::OdfScaleByProperty::OdfScaleByProperty( const std::string& value )
{
this->AddInterpolationTypes();
if ( IsValidEnumerationValue( value ) )
{
this->SetValue( value );
}
else
{
this->SetValue( static_cast<IdType>( ODFSB_NONE ) );
}
}
int mitk::OdfScaleByProperty::GetScaleBy()
{
return static_cast<int>( this->GetValueAsId() );
}
void mitk::OdfScaleByProperty::AddInterpolationTypes()
{
AddEnum( "None", static_cast<IdType>( ODFSB_NONE ) );
AddEnum( "GFA", static_cast<IdType>( ODFSB_GFA ) );
AddEnum( "Principal Curvature", static_cast<IdType>( ODFSB_PC ) );
}
void mitk::OdfScaleByProperty::SetScaleByNothing()
{
SetValue(ODFSB_NONE);
}
void mitk::OdfScaleByProperty::SetScaleByGFA()
{
SetValue(ODFSB_GFA);
}
void mitk::OdfScaleByProperty::SetScaleByPrincipalCurvature()
{
SetValue(ODFSB_PC);
}
bool mitk::OdfScaleByProperty::AddEnum( const std::string& name, const IdType& id )
{
return Superclass::AddEnum( name, id );
}
+
+MITK_REGISTER_SERIALIZER( OdfScaleByPropertySerializer )
diff --git a/Modules/DiffusionImaging/Rendering/mitkOdfScaleByProperty.h b/Modules/DiffusionImaging/Rendering/mitkOdfScaleByProperty.h
index 017f353ac7..f49211cf6d 100644
--- a/Modules/DiffusionImaging/Rendering/mitkOdfScaleByProperty.h
+++ b/Modules/DiffusionImaging/Rendering/mitkOdfScaleByProperty.h
@@ -1,92 +1,116 @@
/*=========================================================================
Program: Medical Imaging & Interaction Toolkit
Language: C++
Date: $Date: 2009-05-12 19:31:16 +0200 (Di, 12 Mai 2009) $
Version: $Revision: $
Copyright (c) German Cancer Research Center, Division of Medical and
Biological Informatics. All rights reserved.
See MITKCopyright.txt or http://www.mitk.org/copyright.html for details.
This software is distributed WITHOUT ANY WARRANTY; without even
the implied warranty of MERCHANTABILITY or FITNESS FOR A PARTICULAR
PURPOSE. See the above copyright notices for more information.
=========================================================================*/
#ifndef _MITK_OdfScaleByProperty__H_
#define _MITK_OdfScaleByProperty__H_
#include "MitkDiffusionImagingExports.h"
#include "mitkEnumerationProperty.h"
+#include "mitkEnumerationPropertySerializer.h"
namespace mitk
{
enum OdfScaleBy
{
ODFSB_NONE,
ODFSB_GFA,
ODFSB_PC
};
/**
* Encapsulates the enumeration for ODF normalization. Valid values are
* ODFSB_NONE, ODFSB_GFA, ODFSB_PC
* Default is ODFSB_NONE
*/
class MitkDiffusionImaging_EXPORT OdfScaleByProperty : public EnumerationProperty
{
public:
mitkClassMacro( OdfScaleByProperty, EnumerationProperty );
itkNewMacro(OdfScaleByProperty);
mitkNewMacro1Param(OdfScaleByProperty, const IdType&);
mitkNewMacro1Param(OdfScaleByProperty, const std::string&);
/**
* Returns the current interpolation value as defined by VTK constants.
*/
virtual int GetScaleBy();
virtual void SetScaleByNothing();
virtual void SetScaleByGFA();
virtual void SetScaleByPrincipalCurvature();
protected:
/** Sets reslice interpolation mode to default (ODFSB_NONE).
*/
OdfScaleByProperty( );
/**
* Constructor. Sets reslice interpolation to the given value.
*/
OdfScaleByProperty( const IdType& value );
/**
* Constructor. Sets reslice interpolation to the given value.
*/
OdfScaleByProperty( const std::string& value );
/**
* this function is overridden as protected, so that the user may not add
* additional invalid interpolation types.
*/
virtual bool AddEnum( const std::string& name, const IdType& id );
/**
* Adds the enumeration types as defined by vtk to the list of known
* enumeration values.
*/
virtual void AddInterpolationTypes();
};
+class MitkDiffusionImaging_EXPORT OdfScaleByPropertySerializer : public EnumerationPropertySerializer
+{
+ public:
+
+ mitkClassMacro( OdfScaleByPropertySerializer, EnumerationPropertySerializer );
+ itkNewMacro(Self);
+
+ virtual BaseProperty::Pointer Deserialize(TiXmlElement* element)
+ {
+ if (!element) return NULL;
+ const char* sa( element->Attribute("value") );
+ std::string s(sa?sa:"");
+ OdfScaleByProperty::Pointer property = OdfScaleByProperty::New();
+ property->SetValue( s );
+ return property.GetPointer();
+ }
+
+ protected:
+
+ OdfScaleByPropertySerializer () {}
+ virtual ~OdfScaleByPropertySerializer () {}
+};
+
} // end of namespace mitk
#endif
diff --git a/Modules/DiffusionImaging/Rendering/mitkOdfVtkMapper2D.h b/Modules/DiffusionImaging/Rendering/mitkOdfVtkMapper2D.h
index e4ceb2170b..1b689b41a8 100644
--- a/Modules/DiffusionImaging/Rendering/mitkOdfVtkMapper2D.h
+++ b/Modules/DiffusionImaging/Rendering/mitkOdfVtkMapper2D.h
@@ -1,156 +1,156 @@
/*=========================================================================
Program: Medical Imaging & Interaction Toolkit
Language: C++
Date: $Date: 2008-02-08 13:23:19 +0100 (Fr, 08 Feb 2008) $
Version: $Revision: 13561 $
Copyright (c) German Cancer Research Center, Division of Medical and
Biological Informatics. All rights reserved.
See MITKCopyright.txt or http://www.mitk.org/copyright.html for details.
This software is distributed WITHOUT ANY WARRANTY; without even
the implied warranty of MERCHANTABILITY or FITNESS FOR A PARTICULAR
PURPOSE. See the above copyright notices for more information.
=========================================================================*/
#ifndef ODFVTKMAPPER2D_H_HEADER_INCLUDED
#define ODFVTKMAPPER2D_H_HEADER_INCLUDED
#include "mitkVtkMapper2D.h"
#include "vtkPropAssembly.h"
#include "vtkAppendPolyData.h"
#include "vtkActor.h"
#include "vtkPolyDataMapper.h"
#include "vtkPlane.h"
#include "vtkCutter.h"
#include "vtkClipPolyData.h"
#include "vtkTransform.h"
#include "vtkDataArrayTemplate.h"
#include "vtkSmartPointer.h"
#include "vtkOdfSource.h"
#include "vtkThickPlane.h"
//#include "mitkTrackingCameraController.h"
namespace mitk {
//##Documentation
//## @brief Base class of all vtk-based 2D-Mappers
//##
//## Those must implement the abstract
//## method vtkProp* GetProp().
//## @ingroup Mapper
template<class TPixelType, int NrOdfDirections>
class OdfVtkMapper2D : public VtkMapper2D
{
struct OdfDisplayGeometry {
vtkFloatingPointType vp[ 3 ], vnormal[ 3 ];
Vector3D normal;
double d, d1, d2;
mitk::Point3D M3D, L3D, O3D;
vtkFloatingPointType vp_original[ 3 ], vnormal_original[ 3 ];
mitk::Vector2D size, origin;
bool Equals(OdfDisplayGeometry* other)
{
return other->vp_original[0] == vp[0] &&
other->vp_original[1] == vp[1] &&
other->vp_original[2] == vp[2] &&
other->vnormal_original[0] == vnormal[0] &&
other->vnormal_original[1] == vnormal[1] &&
other->vnormal_original[2] == vnormal[2] &&
other->size[0] == size[0] &&
other->size[1] == size[1] &&
other->origin[0] == origin[0] &&
other->origin[1] == origin[1];
}
};
public:
mitkClassMacro(OdfVtkMapper2D,VtkMapper2D);
itkNewMacro(Self);
virtual vtkProp* GetProp(mitk::BaseRenderer* renderer);
bool IsVisibleOdfs(mitk::BaseRenderer* renderer);
virtual void MitkRenderOverlay(mitk::BaseRenderer* renderer);
virtual void MitkRenderOpaqueGeometry(mitk::BaseRenderer* renderer);
virtual void MitkRenderTranslucentGeometry(mitk::BaseRenderer* renderer);
#if ( ( VTK_MAJOR_VERSION >= 5 ) && ( VTK_MINOR_VERSION>=2) )
virtual void MitkRenderVolumetricGeometry(mitk::BaseRenderer* /*renderer*/){};
#endif
OdfDisplayGeometry* MeasureDisplayedGeometry(mitk::BaseRenderer* renderer);
void AdaptCameraPosition(mitk::BaseRenderer* renderer, OdfDisplayGeometry* dispGeo );
void AdaptOdfScalingToImageSpacing( int index );
void SetRendererLightSources( mitk::BaseRenderer *renderer );
void ApplyPropertySettings();
virtual void Slice(mitk::BaseRenderer* renderer,
OdfDisplayGeometry* dispGeo);
virtual int GetIndex(mitk::BaseRenderer* renderer);
static void SetDefaultProperties(DataNode* node, BaseRenderer* renderer = NULL, bool overwrite = false);
virtual void GenerateData();
- virtual void GenerateData(mitk::BaseRenderer* renderer);
+ virtual void GenerateDataForRenderer(mitk::BaseRenderer* renderer);
virtual bool IsLODEnabled( BaseRenderer * /*renderer*/ ) const { return true; }
protected:
OdfVtkMapper2D();
virtual ~OdfVtkMapper2D();
static void GlyphMethod(void *arg);
bool IsPlaneRotated(mitk::BaseRenderer* renderer);
private:
std::vector<vtkPropAssembly*> m_PropAssemblies;
std::vector<vtkAppendPolyData*> m_OdfsPlanes;
std::vector<vtkActor*> m_OdfsActors;
std::vector<vtkPolyDataMapper*> m_OdfsMappers;
vtkPolyData* m_TemplateOdf;
static vtkSmartPointer<vtkTransform> m_OdfTransform;
static vtkSmartPointer<vtkDoubleArray> m_OdfVals;
static vtkSmartPointer<vtkOdfSource> m_OdfSource;
static float m_Scaling;
static int m_Normalization;
static int m_ScaleBy;
static float m_IndexParam1;
static float m_IndexParam2;
int m_ShowMaxNumber;
//std::vector<mitk::TrackingCameraController::Pointer> m_TrackingCameraControllers;
std::vector<vtkPlane*> m_Planes;
std::vector<vtkCutter*> m_Cutters;
std::vector<vtkThickPlane*> m_ThickPlanes1;
std::vector<vtkClipPolyData *> m_Clippers1;
std::vector<vtkThickPlane*> m_ThickPlanes2;
std::vector<vtkClipPolyData *> m_Clippers2;
vtkImageData* m_VtkImage ;
mitk::Image* GetInput();
OdfDisplayGeometry* m_LastDisplayGeometry;
};
} // namespace mitk
#include "mitkOdfVtkMapper2D.txx"
#endif /* ODFVTKMAPPER2D_H_HEADER_INCLUDED */
diff --git a/Modules/DiffusionImaging/Rendering/mitkOdfVtkMapper2D.txx b/Modules/DiffusionImaging/Rendering/mitkOdfVtkMapper2D.txx
index cb754873ab..36a1f35559 100644
--- a/Modules/DiffusionImaging/Rendering/mitkOdfVtkMapper2D.txx
+++ b/Modules/DiffusionImaging/Rendering/mitkOdfVtkMapper2D.txx
@@ -1,1166 +1,1166 @@
/*=========================================================================
Program: Medical Imaging & Interaction Toolkit
Language: C++
Date: $Date: 2008-08-25 18:10:57 +0200 (Mo, 25 Aug 2008) $
Version: $Revision: 15062 $
Copyright (c) German Cancer Research Center, Division of Medical and
Biological Informatics. All rights reserved.
See MITKCopyright.txt or http://www.mitk.org/copyright.html for details.
This software is distributed WITHOUT ANY WARRANTY; without even
the implied warranty of MERCHANTABILITY or FITNESS FOR A PARTICULAR
PURPOSE. See the above copyright notices for more information.
=========================================================================*/
#ifndef __mitkOdfVtkMapper2D_txx__
#define __mitkOdfVtkMapper2D_txx__
#include "mitkOdfVtkMapper2D.h"
#include "mitkDataNode.h"
#include "mitkBaseRenderer.h"
#include "mitkMatrixConvert.h"
#include "mitkGeometry3D.h"
#include "mitkOdfNormalizationMethodProperty.h"
#include "mitkOdfScaleByProperty.h"
#include "mitkProperties.h"
#include "mitkTensorImage.h"
#include "vtkSphereSource.h"
#include "vtkPropCollection.h"
#include "vtkMaskedGlyph3D.h"
#include "vtkGlyph2D.h"
#include "vtkGlyph3D.h"
#include "vtkMaskedProgrammableGlyphFilter.h"
#include "vtkImageData.h"
#include "vtkLinearTransform.h"
#include "vtkCamera.h"
#include "vtkPointData.h"
#include "vtkTransformPolyDataFilter.h"
#include "vtkTransform.h"
#include "vtkOdfSource.h"
#include "vtkDoubleArray.h"
#include "vtkLookupTable.h"
#include "vtkProperty.h"
#include "vtkPolyDataNormals.h"
#include "vtkLight.h"
#include "vtkLightCollection.h"
#include "vtkMath.h"
#include "vtkFloatArray.h"
#include "vtkDelaunay2D.h"
#include "vtkMapper.h"
#include "vtkRenderer.h"
#include "vtkCamera.h"
#include "itkOrientationDistributionFunction.h"
#include "itkFixedArray.h"
#include <mitkGL.h>
#include "vtkOpenGLRenderer.h"
template<class T, int N>
vtkSmartPointer<vtkTransform> mitk::OdfVtkMapper2D<T,N>::m_OdfTransform = vtkSmartPointer<vtkTransform>::New();
template<class T, int N>
vtkSmartPointer<vtkDoubleArray> mitk::OdfVtkMapper2D<T,N>::m_OdfVals = vtkSmartPointer<vtkDoubleArray>::New();
template<class T, int N>
vtkSmartPointer<vtkOdfSource> mitk::OdfVtkMapper2D<T,N>::m_OdfSource = vtkSmartPointer<vtkOdfSource>::New();
template<class T, int N>
float mitk::OdfVtkMapper2D<T,N>::m_Scaling;
template<class T, int N>
int mitk::OdfVtkMapper2D<T,N>::m_Normalization;
template<class T, int N>
int mitk::OdfVtkMapper2D<T,N>::m_ScaleBy;
template<class T, int N>
float mitk::OdfVtkMapper2D<T,N>::m_IndexParam1;
template<class T, int N>
float mitk::OdfVtkMapper2D<T,N>::m_IndexParam2;
#define ODF_MAPPER_PI 3.1415926535897932384626433832795
//#include "vtkSphereSource.h"
//#include "vtkPolyDataMapper.h"
//#include "vtkActor.h"
//#include "vtkRenderWindow.h"
//#include "vtkRenderer.h"
//#include "vtkRenderWindowInteractor.h"
//#include "vtkProperty.h"
//
//void bla(vtkPolyData* poly)
//{
//
// // map to graphics library
// vtkPolyDataMapper *map = vtkPolyDataMapper::New();
// map->SetInput(poly);
//
// // actor coordinates geometry, properties, transformation
// vtkActor *aSphere = vtkActor::New();
// aSphere->SetMapper(map);
// aSphere->GetProperty()->SetColor(0,0,1); // sphere color blue
//
// // a renderer and render window
// vtkRenderer *ren1 = vtkRenderer::New();
// vtkRenderWindow *renWin = vtkRenderWindow::New();
// renWin->AddRenderer(ren1);
//
// // an interactor
// vtkRenderWindowInteractor *iren = vtkRenderWindowInteractor::New();
// iren->SetRenderWindow(renWin);
//
// // add the actor to the scene
// ren1->AddActor(aSphere);
// ren1->SetBackground(1,1,1); // Background color white
//
// // render an image (lights and cameras are created automatically)
// renWin->Render();
//
// // begin mouse interaction
// iren->Start();
//}
template<class T, int N>
mitk::OdfVtkMapper2D<T,N>
::OdfVtkMapper2D()
{
m_VtkBased = true;
m_LastDisplayGeometry = 0;
m_PropAssemblies.push_back(vtkPropAssembly::New());
m_PropAssemblies.push_back(vtkPropAssembly::New());
m_PropAssemblies.push_back(vtkPropAssembly::New());
m_OdfsPlanes.push_back(vtkAppendPolyData::New());
m_OdfsPlanes.push_back(vtkAppendPolyData::New());
m_OdfsPlanes.push_back(vtkAppendPolyData::New());
m_OdfsPlanes[0]->AddInput(vtkPolyData::New());
m_OdfsPlanes[1]->AddInput(vtkPolyData::New());
m_OdfsPlanes[2]->AddInput(vtkPolyData::New());
m_OdfsActors.push_back(vtkActor::New());
m_OdfsActors.push_back(vtkActor::New());
m_OdfsActors.push_back(vtkActor::New());
m_OdfsActors[0]->GetProperty()->SetInterpolationToGouraud();
m_OdfsActors[1]->GetProperty()->SetInterpolationToGouraud();
m_OdfsActors[2]->GetProperty()->SetInterpolationToGouraud();
m_OdfsMappers.push_back(vtkPolyDataMapper::New());
m_OdfsMappers.push_back(vtkPolyDataMapper::New());
m_OdfsMappers.push_back(vtkPolyDataMapper::New());
vtkLookupTable *lut = vtkLookupTable::New();
//lut->SetMinimumTableValue(0,0,1,1);
//lut->SetMaximumTableValue(1,0,0,1);
//lut->SetWindow(0.1);
//lut->SetLevel(0.05); <== not recognized or reset by mapper ??
//lut->Build();
m_OdfsMappers[0]->SetLookupTable(lut);
m_OdfsMappers[1]->SetLookupTable(lut);
m_OdfsMappers[2]->SetLookupTable(lut);
m_OdfsActors[0]->SetMapper(m_OdfsMappers[0]);
m_OdfsActors[1]->SetMapper(m_OdfsMappers[1]);
m_OdfsActors[2]->SetMapper(m_OdfsMappers[2]);
m_Planes.push_back(vtkPlane::New());
m_Planes.push_back(vtkPlane::New());
m_Planes.push_back(vtkPlane::New());
m_Cutters.push_back(vtkCutter::New());
m_Cutters.push_back(vtkCutter::New());
m_Cutters.push_back(vtkCutter::New());
m_Cutters[0]->SetCutFunction( m_Planes[0] );
m_Cutters[0]->GenerateValues( 1, 0, 1 );
m_Cutters[1]->SetCutFunction( m_Planes[1] );
m_Cutters[1]->GenerateValues( 1, 0, 1 );
m_Cutters[2]->SetCutFunction( m_Planes[2] );
m_Cutters[2]->GenerateValues( 1, 0, 1 );
// Windowing the cutted planes in direction 1
m_ThickPlanes1.push_back(vtkThickPlane::New());
m_ThickPlanes1.push_back(vtkThickPlane::New());
m_ThickPlanes1.push_back(vtkThickPlane::New());
m_Clippers1.push_back(vtkClipPolyData::New());
m_Clippers1.push_back(vtkClipPolyData::New());
m_Clippers1.push_back(vtkClipPolyData::New());
m_Clippers1[0]->SetClipFunction( m_ThickPlanes1[0] );
m_Clippers1[1]->SetClipFunction( m_ThickPlanes1[1] );
m_Clippers1[2]->SetClipFunction( m_ThickPlanes1[2] );
// Windowing the cutted planes in direction 2
m_ThickPlanes2.push_back(vtkThickPlane::New());
m_ThickPlanes2.push_back(vtkThickPlane::New());
m_ThickPlanes2.push_back(vtkThickPlane::New());
m_Clippers2.push_back(vtkClipPolyData::New());
m_Clippers2.push_back(vtkClipPolyData::New());
m_Clippers2.push_back(vtkClipPolyData::New());
m_Clippers2[0]->SetClipFunction( m_ThickPlanes2[0] );
m_Clippers2[1]->SetClipFunction( m_ThickPlanes2[1] );
m_Clippers2[2]->SetClipFunction( m_ThickPlanes2[2] );
m_TemplateOdf = itk::OrientationDistributionFunction<T,N>::GetBaseMesh();
//vtkPoints* points = m_TemplateOdf->GetPoints();
m_OdfVals->Allocate(N);
m_OdfSource->SetTemplateOdf(m_TemplateOdf);
m_OdfSource->SetOdfVals(m_OdfVals);
m_ShowMaxNumber = 500;
//vtkMapper::GlobalImmediateModeRenderingOn();
}
template<class T, int N>
mitk::OdfVtkMapper2D<T,N>
::~OdfVtkMapper2D()
{
m_PropAssemblies[0]->Delete();
m_PropAssemblies[1]->Delete();
m_PropAssemblies[2]->Delete();
m_OdfsPlanes[0]->Delete();
m_OdfsPlanes[1]->Delete();
m_OdfsPlanes[2]->Delete();
m_OdfsActors[0]->Delete();
m_OdfsActors[1]->Delete();
m_OdfsActors[2]->Delete();
m_OdfsMappers[0]->Delete();
m_OdfsMappers[1]->Delete();
m_OdfsMappers[2]->Delete();
m_Planes[0]->Delete();
m_Planes[1]->Delete();
m_Planes[2]->Delete();
m_Cutters[0]->Delete();
m_Cutters[1]->Delete();
m_Cutters[2]->Delete();
m_ThickPlanes1[0]->Delete();
m_ThickPlanes1[1]->Delete();
m_ThickPlanes1[2]->Delete();
m_ThickPlanes2[0]->Delete();
m_ThickPlanes2[1]->Delete();
m_ThickPlanes2[2]->Delete();
m_Clippers1[0]->Delete();
m_Clippers1[1]->Delete();
m_Clippers1[2]->Delete();
m_Clippers2[0]->Delete();
m_Clippers2[1]->Delete();
m_Clippers2[2]->Delete();
}
template<class T, int N>
mitk::Image* mitk::OdfVtkMapper2D<T,N>
::GetInput()
{
return static_cast<mitk::Image * > ( m_DataNode->GetData() );
}
template<class T, int N>
vtkProp* mitk::OdfVtkMapper2D<T,N>
::GetProp(mitk::BaseRenderer* renderer)
{
return m_PropAssemblies[GetIndex(renderer)];
}
template<class T, int N>
int mitk::OdfVtkMapper2D<T,N>
::GetIndex(mitk::BaseRenderer* renderer)
{
if(!strcmp(renderer->GetName(),"stdmulti.widget1"))
return 0;
if(!strcmp(renderer->GetName(),"stdmulti.widget2"))
return 1;
if(!strcmp(renderer->GetName(),"stdmulti.widget3"))
return 2;
return 0;
}
template<class T, int N>
void mitk::OdfVtkMapper2D<T,N>
::GlyphMethod(void *arg)
{
vtkMaskedProgrammableGlyphFilter
*pfilter=(vtkMaskedProgrammableGlyphFilter*)arg;
double point[3];
double debugpoint[3];
pfilter->GetPoint(point);
pfilter->GetPoint(debugpoint);
itk::Point<double,3> p(point);
Vector3D spacing = pfilter->GetGeometry()->GetSpacing();
p[0] /= spacing[0];
p[1] /= spacing[1];
p[2] /= spacing[2];
mitk::Point3D p2;
pfilter->GetGeometry()->IndexToWorld( p, p2 );
point[0] = p2[0];
point[1] = p2[1];
point[2] = p2[2];
vtkPointData* data = pfilter->GetPointData();
vtkDataArray* odfvals = data->GetArray("vector");
vtkIdType id = pfilter->GetPointId();
m_OdfTransform->Identity();
m_OdfTransform->Translate(point[0],point[1],point[2]);
typedef itk::OrientationDistributionFunction<float,N> OdfType;
OdfType odf;
if(odfvals->GetNumberOfComponents()==6)
{
float tensorelems[6] = {
(float)odfvals->GetComponent(id,0),
(float)odfvals->GetComponent(id,1),
(float)odfvals->GetComponent(id,2),
(float)odfvals->GetComponent(id,3),
(float)odfvals->GetComponent(id,4),
(float)odfvals->GetComponent(id,5),
};
itk::DiffusionTensor3D<float> tensor(tensorelems);
odf.InitFromTensor(tensor);
}
else
{
for(int i=0; i<N; i++)
odf[i] = (double)odfvals->GetComponent(id,i);
}
switch(m_Normalization)
{
case ODFN_MINMAX:
odf = odf.MinMaxNormalize();
break;
case ODFN_MAX:
odf = odf.MaxNormalize();
break;
case ODFN_NONE:
// nothing
break;
case ODFN_GLOBAL_MAX:
// global max not implemented yet
break;
default:
odf = odf.MinMaxNormalize();
}
switch(m_ScaleBy)
{
case ODFSB_NONE:
break;
case ODFSB_GFA:
odf = odf * odf.GetGeneralizedGFA(m_IndexParam1, m_IndexParam2);
break;
case ODFSB_PC:
odf = odf * odf.GetPrincipleCurvature(m_IndexParam1, m_IndexParam2, 0);
break;
}
for(int i=0; i<N; i++)
m_OdfVals->SetComponent(0,i,0.5*odf[i]*m_Scaling);
//double max = -100000;
//double min = 100000;
//for( unsigned int i=0; i<N; i++)
//{
// max = odf[i] > max ? odf[i] : max;
// min = odf[i] < min ? odf[i] : min;
//}
m_OdfSource->Modified();
}
template<class T, int N>
void mitk::OdfVtkMapper2D<T,N>
::AdaptCameraPosition(mitk::BaseRenderer* renderer, OdfDisplayGeometry* dispGeo )
{
double viewAngle = renderer->GetVtkRenderer()->GetActiveCamera()->GetViewAngle();
viewAngle = viewAngle * (ODF_MAPPER_PI/180.0);
viewAngle /= 2;
double dist = dispGeo->d/tan(viewAngle);
mitk::Point3D mfoc;
mfoc[0]=dispGeo->M3D[0];
mfoc[1]=dispGeo->M3D[1];
mfoc[2]=dispGeo->M3D[2];
mitk::Point3D mpos;
mpos[0]=mfoc[0]+dist*dispGeo->normal[0];
mpos[1]=mfoc[1]+dist*dispGeo->normal[1];
mpos[2]=mfoc[2]+dist*dispGeo->normal[2];
mitk::Point3D mup;
mup[0]=dispGeo->O3D[0]-dispGeo->M3D[0];
mup[1]=dispGeo->O3D[1]-dispGeo->M3D[1];
mup[2]=dispGeo->O3D[2]-dispGeo->M3D[2];
renderer->GetVtkRenderer()->GetActiveCamera()->SetParallelProjection(true);
renderer->GetVtkRenderer()->GetActiveCamera()->SetParallelScale(dist/3.74);
vtkCamera* camera = renderer->GetVtkRenderer()->GetActiveCamera();
if (camera)
{
camera->SetPosition(mpos[0],mpos[1],mpos[2]);
camera->SetFocalPoint(mfoc[0], mfoc[1],mfoc[2]);
camera->SetViewUp(mup[0],mup[1],mup[2]);
}
renderer->GetVtkRenderer()->ResetCameraClippingRange();
}
template<class T, int N>
typename mitk::OdfVtkMapper2D<T,N>::OdfDisplayGeometry* mitk::OdfVtkMapper2D<T,N>
::MeasureDisplayedGeometry(mitk::BaseRenderer* renderer)
{
//vtkLinearTransform * vtktransform = this->GetDataNode()->GetVtkTransform(this->GetTimestep());
Geometry2D::ConstPointer worldGeometry =
renderer->GetCurrentWorldGeometry2D();
PlaneGeometry::ConstPointer worldPlaneGeometry =
dynamic_cast<const PlaneGeometry*>( worldGeometry.GetPointer() );
// set up the cutter orientation according to the current geometry of
// the renderers plane
vtkFloatingPointType vp[ 3 ], vnormal[ 3 ];
Point3D point = worldPlaneGeometry->GetOrigin();
Vector3D normal = worldPlaneGeometry->GetNormal(); normal.Normalize();
vnl2vtk( point.Get_vnl_vector(), vp );
vnl2vtk( normal.Get_vnl_vector(), vnormal );
mitk::DisplayGeometry::Pointer dispGeometry = renderer->GetDisplayGeometry();
mitk::Vector2D size = dispGeometry->GetSizeInMM();
mitk::Vector2D origin = dispGeometry->GetOriginInMM();
//
// |------O------|
// | d2 |
// L d1 M |
// | |
// |-------------|
//
mitk::Vector2D M;
mitk::Vector2D L;
mitk::Vector2D O;
M[0] = origin[0] + size[0]/2;
M[1] = origin[1] + size[1]/2;
L[0] = origin[0];
L[1] = origin[1] + size[1]/2;
O[0] = origin[0] + size[0]/2;
O[1] = origin[1] + size[1];
mitk::Point2D point1;
point1[0] = M[0]; point1[1] = M[1]; point1[2] = M[2];
mitk::Point3D M3D;
dispGeometry->Map(point1, M3D);
point1[0] = L[0]; point1[1] = L[1]; point1[2] = L[2];
mitk::Point3D L3D;
dispGeometry->Map(point1, L3D);
point1[0] = O[0]; point1[1] = O[1]; point1[2] = O[2];
mitk::Point3D O3D;
dispGeometry->Map(point1, O3D);
double d1 = sqrt((M3D[0]-L3D[0])*(M3D[0]-L3D[0])
+ (M3D[1]-L3D[1])*(M3D[1]-L3D[1])
+ (M3D[2]-L3D[2])*(M3D[2]-L3D[2]));
double d2 = sqrt((M3D[0]-O3D[0])*(M3D[0]-O3D[0])
+ (M3D[1]-O3D[1])*(M3D[1]-O3D[1])
+ (M3D[2]-O3D[2])*(M3D[2]-O3D[2]));
double d = d1>d2 ? d1 : d2;
d = d2;
OdfDisplayGeometry* retval = new OdfDisplayGeometry();
retval->vp[0] = vp[0];
retval->vp[1] = vp[1];
retval->vp[2] = vp[2];
retval->vnormal[0] = vnormal[0];
retval->vnormal[1] = vnormal[1];
retval->vnormal[2] = vnormal[2];
retval->normal[0] = normal[0];
retval->normal[1] = normal[1];
retval->normal[2] = normal[2];
retval->d = d;
retval->d1 = d1;
retval->d2 = d2;
retval->M3D[0] = M3D[0];
retval->M3D[1] = M3D[1];
retval->M3D[2] = M3D[2];
retval->L3D[0] = L3D[0];
retval->L3D[1] = L3D[1];
retval->L3D[2] = L3D[2];
retval->O3D[0] = O3D[0];
retval->O3D[1] = O3D[1];
retval->O3D[2] = O3D[2];
retval->vp_original[0] = vp[0];
retval->vp_original[1] = vp[1];
retval->vp_original[2] = vp[2];
retval->vnormal_original[0] = vnormal[0];
retval->vnormal_original[1] = vnormal[1];
retval->vnormal_original[2] = vnormal[2];
retval->size[0] = size[0];
retval->size[1] = size[1];
retval->origin[0] = origin[0];
retval->origin[1] = origin[1];
return retval;
}
template<class T, int N>
void mitk::OdfVtkMapper2D<T,N>
::Slice(mitk::BaseRenderer* renderer, OdfDisplayGeometry* dispGeo)
{
vtkLinearTransform * vtktransform =
this->GetDataNode()->GetVtkTransform(this->GetTimestep());
int index = GetIndex(renderer);
vtkTransform* inversetransform = vtkTransform::New();
inversetransform->Identity();
inversetransform->Concatenate(vtktransform->GetLinearInverse());
double myscale[3];
((vtkTransform*)vtktransform)->GetScale(myscale);
inversetransform->PostMultiply();
inversetransform->Scale(1*myscale[0],1*myscale[1],1*myscale[2]);
inversetransform->TransformPoint( dispGeo->vp, dispGeo->vp );
inversetransform->TransformNormalAtPoint( dispGeo->vp, dispGeo->vnormal, dispGeo->vnormal );
// vtk works in axis align coords
// thus the normal also must be axis align, since
// we do not allow arbitrary cutting through volume
//
// vnormal should already be axis align, but in order
// to get rid of precision effects, we set the two smaller
// components to zero here
int dims[3];
m_VtkImage->GetDimensions(dims);
double spac[3];
m_VtkImage->GetSpacing(spac);
if(fabs(dispGeo->vnormal[0]) > fabs(dispGeo->vnormal[1])
&& fabs(dispGeo->vnormal[0]) > fabs(dispGeo->vnormal[2]) )
{
if(fabs(dispGeo->vp[0]/spac[0]) < 0.4)
dispGeo->vp[0] = 0.4*spac[0];
if(fabs(dispGeo->vp[0]/spac[0]) > (dims[0]-1)-0.4)
dispGeo->vp[0] = ((dims[0]-1)-0.4)*spac[0];
dispGeo->vnormal[1] = 0;
dispGeo->vnormal[2] = 0;
}
if(fabs(dispGeo->vnormal[1]) > fabs(dispGeo->vnormal[0]) && fabs(dispGeo->vnormal[1]) > fabs(dispGeo->vnormal[2]) )
{
if(fabs(dispGeo->vp[1]/spac[1]) < 0.4)
dispGeo->vp[1] = 0.4*spac[1];
if(fabs(dispGeo->vp[1]/spac[1]) > (dims[1]-1)-0.4)
dispGeo->vp[1] = ((dims[1]-1)-0.4)*spac[1];
dispGeo->vnormal[0] = 0;
dispGeo->vnormal[2] = 0;
}
if(fabs(dispGeo->vnormal[2]) > fabs(dispGeo->vnormal[1]) && fabs(dispGeo->vnormal[2]) > fabs(dispGeo->vnormal[0]) )
{
if(fabs(dispGeo->vp[2]/spac[2]) < 0.4)
dispGeo->vp[2] = 0.4*spac[2];
if(fabs(dispGeo->vp[2]/spac[2]) > (dims[2]-1)-0.4)
dispGeo->vp[2] = ((dims[2]-1)-0.4)*spac[2];
dispGeo->vnormal[0] = 0;
dispGeo->vnormal[1] = 0;
}
m_Planes[index]->SetTransform( (vtkAbstractTransform*)NULL );
m_Planes[index]->SetOrigin( dispGeo->vp );
m_Planes[index]->SetNormal( dispGeo->vnormal );
vtkPoints* points = NULL;
vtkPoints* tmppoints = NULL;
vtkPolyData* polydata = NULL;
vtkFloatArray* pointdata = NULL;
vtkDelaunay2D *delaunay = NULL;
vtkPolyData* cuttedPlane = NULL;
if(!( (dims[0] == 1 && dispGeo->vnormal[0] != 0) ||
(dims[1] == 1 && dispGeo->vnormal[1] != 0) ||
(dims[2] == 1 && dispGeo->vnormal[2] != 0) ))
{
m_Cutters[index]->SetCutFunction( m_Planes[index] );
m_Cutters[index]->SetInput( m_VtkImage );
m_Cutters[index]->Update();
cuttedPlane = m_Cutters[index]->GetOutput();
}
else
{
// cutting of a 2D-Volume does not work,
// so we have to build up our own polydata object
cuttedPlane = vtkPolyData::New();
points = vtkPoints::New();
points->SetNumberOfPoints(m_VtkImage->GetNumberOfPoints());
for(int i=0; i<m_VtkImage->GetNumberOfPoints(); i++)
{
points->SetPoint(i, m_VtkImage->GetPoint(i));
}
cuttedPlane->SetPoints(points);
pointdata = vtkFloatArray::New();
int comps = m_VtkImage->GetPointData()->GetScalars()->GetNumberOfComponents();
pointdata->SetNumberOfComponents(comps);
int tuples = m_VtkImage->GetPointData()->GetScalars()->GetNumberOfTuples();
pointdata->SetNumberOfTuples(tuples);
for(int i=0; i<tuples; i++)
pointdata->SetTuple(i,m_VtkImage->GetPointData()->GetScalars()->GetTuple(i));
pointdata->SetName( "vector" );
cuttedPlane->GetPointData()->AddArray(pointdata);
int nZero1, nZero2;
if(dims[0]==1)
{
nZero1 = 1; nZero2 = 2;
}
else if(dims[1]==1)
{
nZero1 = 0; nZero2 = 2;
}
else
{
nZero1 = 0; nZero2 = 1;
}
tmppoints = vtkPoints::New();
for(int j=0; j<m_VtkImage->GetNumberOfPoints(); j++){
double pt[3];
m_VtkImage->GetPoint(j,pt);
tmppoints->InsertNextPoint(pt[nZero1],pt[nZero2],0);
}
polydata = vtkPolyData::New();
polydata->SetPoints( tmppoints );
delaunay = vtkDelaunay2D::New();
delaunay->SetInput( polydata );
delaunay->Update();
vtkCellArray* polys = delaunay->GetOutput()->GetPolys();
cuttedPlane->SetPolys(polys);
}
if(cuttedPlane->GetNumberOfPoints())
{
// WINDOWING HERE
inversetransform = vtkTransform::New();
inversetransform->Identity();
inversetransform->Concatenate(vtktransform->GetLinearInverse());
double myscale[3];
((vtkTransform*)vtktransform)->GetScale(myscale);
inversetransform->PostMultiply();
inversetransform->Scale(1*myscale[0],1*myscale[1],1*myscale[2]);
dispGeo->vnormal[0] = dispGeo->M3D[0]-dispGeo->O3D[0];
dispGeo->vnormal[1] = dispGeo->M3D[1]-dispGeo->O3D[1];
dispGeo->vnormal[2] = dispGeo->M3D[2]-dispGeo->O3D[2];
vtkMath::Normalize(dispGeo->vnormal);
dispGeo->vp[0] = dispGeo->M3D[0];
dispGeo->vp[1] = dispGeo->M3D[1];
dispGeo->vp[2] = dispGeo->M3D[2];
inversetransform->TransformPoint( dispGeo->vp, dispGeo->vp );
inversetransform->TransformNormalAtPoint( dispGeo->vp, dispGeo->vnormal, dispGeo->vnormal );
m_ThickPlanes1[index]->count = 0;
m_ThickPlanes1[index]->SetTransform((vtkAbstractTransform*)NULL );
m_ThickPlanes1[index]->SetPose( dispGeo->vnormal, dispGeo->vp );
m_ThickPlanes1[index]->SetThickness(dispGeo->d2);
m_Clippers1[index]->SetClipFunction( m_ThickPlanes1[index] );
m_Clippers1[index]->SetInput( cuttedPlane );
m_Clippers1[index]->SetInsideOut(1);
m_Clippers1[index]->Update();
dispGeo->vnormal[0] = dispGeo->M3D[0]-dispGeo->L3D[0];
dispGeo->vnormal[1] = dispGeo->M3D[1]-dispGeo->L3D[1];
dispGeo->vnormal[2] = dispGeo->M3D[2]-dispGeo->L3D[2];
vtkMath::Normalize(dispGeo->vnormal);
dispGeo->vp[0] = dispGeo->M3D[0];
dispGeo->vp[1] = dispGeo->M3D[1];
dispGeo->vp[2] = dispGeo->M3D[2];
inversetransform->TransformPoint( dispGeo->vp, dispGeo->vp );
inversetransform->TransformNormalAtPoint( dispGeo->vp, dispGeo->vnormal, dispGeo->vnormal );
m_ThickPlanes2[index]->count = 0;
m_ThickPlanes2[index]->SetTransform((vtkAbstractTransform*)NULL );
m_ThickPlanes2[index]->SetPose( dispGeo->vnormal, dispGeo->vp );
m_ThickPlanes2[index]->SetThickness(dispGeo->d1);
m_Clippers2[index]->SetClipFunction( m_ThickPlanes2[index] );
m_Clippers2[index]->SetInput( m_Clippers1[index]->GetOutput() );
m_Clippers2[index]->SetInsideOut(1);
m_Clippers2[index]->Update();
cuttedPlane = m_Clippers2[index]->GetOutput ();
if(cuttedPlane->GetNumberOfPoints())
{
m_OdfsPlanes[index]->RemoveAllInputs();
vtkPolyDataNormals* normals = vtkPolyDataNormals::New();
normals->SetInputConnection( m_OdfSource->GetOutputPort() );
normals->SplittingOff();
normals->ConsistencyOff();
normals->AutoOrientNormalsOff();
normals->ComputePointNormalsOn();
normals->ComputeCellNormalsOff();
normals->FlipNormalsOff();
normals->NonManifoldTraversalOff();
vtkTransformPolyDataFilter* trans = vtkTransformPolyDataFilter::New();
trans->SetInputConnection( normals->GetOutputPort() );
trans->SetTransform(m_OdfTransform);
vtkMaskedProgrammableGlyphFilter* glyphGenerator = vtkMaskedProgrammableGlyphFilter::New();
glyphGenerator->SetMaximumNumberOfPoints(m_ShowMaxNumber);
glyphGenerator->SetRandomMode(1);
glyphGenerator->SetUseMaskPoints(1);
glyphGenerator->SetSource( trans->GetOutput() );
glyphGenerator->SetInput(cuttedPlane);
glyphGenerator->SetColorModeToColorBySource();
glyphGenerator->SetInputArrayToProcess(0,0,0, vtkDataObject::FIELD_ASSOCIATION_POINTS , "vector");
glyphGenerator->SetGeometry(this->GetDataNode()->GetData()->GetGeometry());
glyphGenerator->SetGlyphMethod(&(GlyphMethod),(void *)glyphGenerator);
try
{
glyphGenerator->Update();
}
catch( itk::ExceptionObject& err )
{
std::cout << err << std::endl;
}
m_OdfsPlanes[index]->AddInput(glyphGenerator->GetOutput());
trans->Delete();
glyphGenerator->Delete();
normals->Delete();
m_OdfsPlanes[index]->Update();
}
}
m_PropAssemblies[index]->VisibilityOn();
if(m_PropAssemblies[index]->GetParts()->IsItemPresent(m_OdfsActors[index]))
m_PropAssemblies[index]->RemovePart(m_OdfsActors[index]);
m_OdfsMappers[index]->SetInput(m_OdfsPlanes[index]->GetOutput());
m_PropAssemblies[index]->AddPart(m_OdfsActors[index]);
if(inversetransform) inversetransform->Delete();
if(points) points->Delete();
if(pointdata) pointdata->Delete();
if(tmppoints) tmppoints->Delete();
if(polydata) polydata->Delete();
if(delaunay) delaunay->Delete();
}
template<class T, int N>
bool mitk::OdfVtkMapper2D<T,N>
::IsVisibleOdfs(mitk::BaseRenderer* renderer)
{
if(this->IsPlaneRotated(renderer))
return false;
bool retval = false;
switch(GetIndex(renderer))
{
case 0:
retval = this->IsVisible(renderer, "VisibleOdfs_T");
break;
case 1:
retval = this->IsVisible(renderer, "VisibleOdfs_S");
break;
case 2:
retval = this->IsVisible(renderer, "VisibleOdfs_C");
break;
}
return retval;
}
template<class T, int N>
void mitk::OdfVtkMapper2D<T,N>
::MitkRenderOverlay(mitk::BaseRenderer* renderer)
{
//std::cout << "MitkRenderOverlay(" << renderer->GetName() << ")" << std::endl;
if ( this->IsVisibleOdfs(renderer)==false )
return;
if ( this->GetProp(renderer)->GetVisibility() )
{
this->GetProp(renderer)->RenderOverlay(renderer->GetVtkRenderer());
}
}
template<class T, int N>
void mitk::OdfVtkMapper2D<T,N>
::MitkRenderOpaqueGeometry(mitk::BaseRenderer* renderer)
{
//std::cout << "MitkRenderOpaqueGeometry(" << renderer->GetName() << ")" << std::endl;
if ( this->IsVisibleOdfs( renderer )==false )
return;
if ( this->GetProp(renderer)->GetVisibility() )
{
// adapt cam pos
OdfDisplayGeometry* dispGeo = MeasureDisplayedGeometry( renderer);
AdaptCameraPosition(renderer, dispGeo);
if(this->GetDataNode()->IsOn("DoRefresh",NULL))
{
glMatrixMode( GL_PROJECTION );
glPushMatrix();
glLoadIdentity();
glMatrixMode( GL_MODELVIEW );
glPushMatrix();
glLoadIdentity();
renderer->GetVtkRenderer()->SetErase(false);
renderer->GetVtkRenderer()->GetActiveCamera()->Render(renderer->GetVtkRenderer());
renderer->GetVtkRenderer()->SetErase(true);
//GLfloat matrix[16];
//glGetFloatv(GL_MODELVIEW_MATRIX, matrix);
float LightPos[4] = {0,0,0,0};
int index = GetIndex(renderer);
if(index==0)
{
LightPos[2] = -1000;
}
if(index==1)
{
LightPos[0] = 1000;
}
if(index==2)
{
LightPos[1] = -1000;
}
glLightfv(GL_LIGHT0,GL_POSITION,LightPos);
glLightfv(GL_LIGHT1,GL_POSITION,LightPos);
glLightfv(GL_LIGHT2,GL_POSITION,LightPos);
glLightfv(GL_LIGHT3,GL_POSITION,LightPos);
glLightfv(GL_LIGHT4,GL_POSITION,LightPos);
glLightfv(GL_LIGHT5,GL_POSITION,LightPos);
glLightfv(GL_LIGHT6,GL_POSITION,LightPos);
glLightfv(GL_LIGHT7,GL_POSITION,LightPos);
}
this->GetProp(renderer)->RenderOpaqueGeometry( renderer->GetVtkRenderer() );
if(this->GetDataNode()->IsOn("DoRefresh",NULL))
{
glMatrixMode( GL_PROJECTION );
glPopMatrix();
glMatrixMode( GL_MODELVIEW );
glPopMatrix();
}
}
}
template<class T, int N>
void mitk::OdfVtkMapper2D<T,N>
::MitkRenderTranslucentGeometry(mitk::BaseRenderer* renderer)
{
//std::cout << "MitkRenderTranslucentGeometry(" << renderer->GetName() << ")" << std::endl;
if ( this->IsVisibleOdfs(renderer)==false )
return;
if ( this->GetProp(renderer)->GetVisibility() )
//BUG (#1551) changed VTK_MINOR_VERSION FROM 3 to 2 cause RenderTranslucentGeometry was changed in minor version 2
#if ( ( VTK_MAJOR_VERSION >= 5 ) && ( VTK_MINOR_VERSION>=2) )
this->GetProp(renderer)->RenderTranslucentPolygonalGeometry(renderer->GetVtkRenderer());
#else
this->GetProp(renderer)->RenderTranslucentGeometry(renderer->GetVtkRenderer());
#endif
}
template<class T, int N>
void mitk::OdfVtkMapper2D<T,N>
::GenerateData()
{
mitk::Image::Pointer input = const_cast<mitk::Image*>( this->GetInput() );
if ( input.IsNull() ) return ;
std::string classname("TensorImage");
if(classname.compare(input->GetNameOfClass())==0)
{
m_VtkImage = dynamic_cast<mitk::TensorImage*>( this->GetInput() )->GetNonRgbVtkImageData();
}
std::string qclassname("QBallImage");
if(qclassname.compare(input->GetNameOfClass())==0)
{
m_VtkImage = dynamic_cast<mitk::QBallImage*>( this->GetInput() )->GetNonRgbVtkImageData();
}
if( m_VtkImage )
{
// make sure, that we have point data with more than 1 component (as vectors)
vtkPointData* pointData = m_VtkImage->GetPointData();
if ( pointData == NULL )
{
itkWarningMacro( << "m_VtkImage->GetPointData() returns NULL!" );
return ;
}
if ( pointData->GetNumberOfArrays() == 0 )
{
itkWarningMacro( << "m_VtkImage->GetPointData()->GetNumberOfArrays() is 0!" );
return ;
}
else if ( pointData->GetArray(0)->GetNumberOfComponents() != N
&& pointData->GetArray(0)->GetNumberOfComponents() != 6 /*for tensor visualization*/)
{
itkWarningMacro( << "number of components != number of directions in ODF!" );
return;
}
else if ( pointData->GetArrayName( 0 ) == NULL )
{
m_VtkImage->GetPointData()->GetArray(0)->SetName("vector");
}
}
else
{
itkWarningMacro( << "m_VtkImage is NULL!" );
return ;
}
}
template<class T, int N>
void mitk::OdfVtkMapper2D<T,N>
::AdaptOdfScalingToImageSpacing( int index )
{
// Spacing adapted scaling
double spacing[3];
m_VtkImage->GetSpacing(spacing);
double min;
if(index==0)
{
min = spacing[0];
min = min > spacing[1] ? spacing[1] : min;
}
if(index==1)
{
min = spacing[1];
min = min > spacing[2] ? spacing[2] : min;
}
if(index==2)
{
min = spacing[0];
min = min > spacing[2] ? spacing[2] : min;
}
m_OdfSource->SetScale(min);
}
template<class T, int N>
void mitk::OdfVtkMapper2D<T,N>
::SetRendererLightSources( mitk::BaseRenderer *renderer )
{
// Light Sources
vtkCollectionSimpleIterator sit;
vtkLight* light;
for(renderer->GetVtkRenderer()->GetLights()->InitTraversal(sit);
(light = renderer->GetVtkRenderer()->GetLights()->GetNextLight(sit)); )
{
renderer->GetVtkRenderer()->RemoveLight(light);
}
light = vtkLight::New();
light->SetFocalPoint(0,0,0);
light->SetLightTypeToSceneLight();
light->SwitchOn();
light->SetIntensity(1.0);
light->PositionalOff();
itk::Point<float> p;
int index = GetIndex(renderer);
if(index==0)
{
p[0] = 0; p[1] = 0; p[2] = 10000;
}
if(index==1)
{
p[0] = 0; p[1] = 10000; p[2] = 0;
}
if(index==2)
{
p[0] = 10000; p[1] = 0; p[2] = 0;
}
mitk::Point3D p2;
this->GetInput()->GetGeometry()->IndexToWorld(p,p2);
light->SetPosition(p2[0],p2[1],p2[2]);
renderer->GetVtkRenderer()->AddLight(light);
}
template<class T, int N>
void mitk::OdfVtkMapper2D<T,N>
::ApplyPropertySettings()
{
this->GetDataNode()->GetFloatProperty( "Scaling", m_Scaling );
this->GetDataNode()->GetIntProperty( "ShowMaxNumber", m_ShowMaxNumber );
OdfNormalizationMethodProperty* nmp = dynamic_cast
<OdfNormalizationMethodProperty*>(
this->GetDataNode()->GetProperty( "Normalization" ));
if(nmp)
{
m_Normalization = nmp->GetNormalization();
}
OdfScaleByProperty* sbp = dynamic_cast
<OdfScaleByProperty*>(
this->GetDataNode()->GetProperty( "ScaleBy" ));
if(sbp)
{
m_ScaleBy = sbp->GetScaleBy();
}
this->GetDataNode()->GetFloatProperty( "IndexParam1", m_IndexParam1);
this->GetDataNode()->GetFloatProperty( "IndexParam2", m_IndexParam2);
}
template <class T, int N>
bool mitk::OdfVtkMapper2D<T,N>
::IsPlaneRotated(mitk::BaseRenderer* renderer)
{
Geometry2D::ConstPointer worldGeometry =
renderer->GetCurrentWorldGeometry2D();
PlaneGeometry::ConstPointer worldPlaneGeometry =
dynamic_cast<const PlaneGeometry*>( worldGeometry.GetPointer() );
vtkFloatingPointType vnormal[ 3 ];
Vector3D normal = worldPlaneGeometry->GetNormal(); normal.Normalize();
vnl2vtk( normal.Get_vnl_vector(), vnormal );
vtkLinearTransform * vtktransform =
this->GetDataNode()->GetVtkTransform(this->GetTimestep());
vtkTransform* inversetransform = vtkTransform::New();
inversetransform->Identity();
inversetransform->Concatenate(vtktransform->GetLinearInverse());
double* n = inversetransform->TransformNormal(vnormal);
int nonZeros = 0;
for (int j=0; j<3; j++)
{
if (fabs(n[j])>1e-7){
nonZeros++;
}
}
if(nonZeros>1)
return true;
return false;
}
template<class T, int N>
void mitk::OdfVtkMapper2D<T,N>
-::GenerateData( mitk::BaseRenderer *renderer )
+::GenerateDataForRenderer( mitk::BaseRenderer *renderer )
{
if(!m_VtkImage)
{
itkWarningMacro( << "m_VtkImage is NULL!" );
return ;
}
int index = GetIndex(renderer);
if(IsVisibleOdfs(renderer)==false)
{
m_OdfsActors[0]->VisibilityOff();
m_OdfsActors[1]->VisibilityOff();
m_OdfsActors[2]->VisibilityOff();
return;
}
else
{
m_OdfsActors[0]->VisibilityOn();
m_OdfsActors[1]->VisibilityOn();
m_OdfsActors[2]->VisibilityOn();
OdfDisplayGeometry* dispGeo =
MeasureDisplayedGeometry( renderer);
if(!m_LastDisplayGeometry || !dispGeo->Equals(m_LastDisplayGeometry))
{
AdaptOdfScalingToImageSpacing(index);
SetRendererLightSources(renderer);
ApplyPropertySettings();
AdaptCameraPosition(renderer, dispGeo);
Slice(renderer, dispGeo);
m_LastDisplayGeometry = dispGeo;
}
}
// Get the TimeSlicedGeometry of the input object
mitk::Image::Pointer input = const_cast<mitk::Image*>(this->GetInput());
const TimeSlicedGeometry *inputTimeGeometry = input->GetTimeSlicedGeometry();
if (( inputTimeGeometry == NULL ) || ( inputTimeGeometry->GetTimeSteps() == 0 ))
{
m_PropAssemblies[0]->VisibilityOff();
m_PropAssemblies[1]->VisibilityOff();
m_PropAssemblies[2]->VisibilityOff();
return;
}
if( inputTimeGeometry->IsValidTime( this->GetTimestep() ) == false )
{
m_PropAssemblies[0]->VisibilityOff();
m_PropAssemblies[1]->VisibilityOff();
m_PropAssemblies[2]->VisibilityOff();
return;
}
}
template<class T, int N>
void mitk::OdfVtkMapper2D<T,N>
::SetDefaultProperties(mitk::DataNode* node, mitk::BaseRenderer* /*renderer*/, bool /*overwrite*/)
{
node->SetProperty( "ShowMaxNumber", mitk::IntProperty::New( 150 ) );
node->SetProperty( "Scaling", mitk::FloatProperty::New( 1.0 ) );
node->SetProperty( "Normalization", mitk::OdfNormalizationMethodProperty::New());
node->SetProperty( "ScaleBy", mitk::OdfScaleByProperty::New());
node->SetProperty( "IndexParam1", mitk::FloatProperty::New(2));
node->SetProperty( "IndexParam2", mitk::FloatProperty::New(1));
node->SetProperty( "visible", mitk::BoolProperty::New( true ) );
node->SetProperty( "VisibleOdfs_T", mitk::BoolProperty::New( false ) );
node->SetProperty( "VisibleOdfs_C", mitk::BoolProperty::New( false ) );
node->SetProperty( "VisibleOdfs_S", mitk::BoolProperty::New( false ) );
node->SetProperty ("layer", mitk::IntProperty::New(100));
node->SetProperty( "DoRefresh", mitk::BoolProperty::New( true ) );
//node->SetProperty( "opacity", mitk::FloatProperty::New(1.0f) );
}
#endif // __mitkOdfVtkMapper2D_txx__
diff --git a/Modules/DiffusionImaging/Rendering/mitkVectorImageVtkGlyphMapper3D.cpp b/Modules/DiffusionImaging/Rendering/mitkVectorImageVtkGlyphMapper3D.cpp
index 8a448bc2fc..db72601a04 100644
--- a/Modules/DiffusionImaging/Rendering/mitkVectorImageVtkGlyphMapper3D.cpp
+++ b/Modules/DiffusionImaging/Rendering/mitkVectorImageVtkGlyphMapper3D.cpp
@@ -1,212 +1,212 @@
/*=========================================================================
Program: Medical Imaging & Interaction Toolkit
Language: C++
Date: $Date$
Version: $Revision$
Copyright (c) German Cancer Research Center, Division of Medical and
Biological Informatics. All rights reserved.
See MITKCopyright.txt or http://www.mitk.org/copyright.html for details.
This software is distributed WITHOUT ANY WARRANTY; without even
the implied warranty of MERCHANTABILITY or FITNESS FOR A PARTICULAR
PURPOSE. See the above copyright notices for more information.
=========================================================================*/
#include "mitkVectorImageVtkGlyphMapper3D.h"
#include <vtkMaskedGlyph3D.h>
#include <vtkActor.h>
#include <vtkPolyDataMapper.h>
#include <vtkArrowSource.h>
#include <vtkLineSource.h>
#include <vtkImageData.h>
#include <vtkPolyData.h>
#include <vtkPointData.h>
#include <vtkLookupTable.h>
#include <mitkLookupTable.h>
#include <mitkLookupTableProperty.h>
/*
* Constructor. Doesn't do anything...
*/
mitk::VectorImageVtkGlyphMapper3D::VectorImageVtkGlyphMapper3D()
{
m_RandomMode = true;
m_UseMaskPoints = true;
m_MaximumNumberOfPoints = 5000;
m_GlyphType = ArrowGlyph;
m_Glyph3DGenerator = vtkMaskedGlyph3D::New();
m_Glyph3DMapper = vtkPolyDataMapper::New();
m_Glyph3DActor = vtkActor::New();
}
vtkProp* mitk::VectorImageVtkGlyphMapper3D::GetVtkProp(mitk::BaseRenderer* /*renderer*/)
{
return m_Glyph3DActor;
}
/*
* Destructor
*/
mitk::VectorImageVtkGlyphMapper3D::~VectorImageVtkGlyphMapper3D()
{
if ( m_Glyph3DMapper != NULL )
m_Glyph3DMapper->Delete();
if ( m_Glyph3DGenerator != NULL )
m_Glyph3DGenerator->Delete();
}
/*
* Generate a vtkPolyData by creating vectors as glyphs
*/
void mitk::VectorImageVtkGlyphMapper3D::GenerateData()
{
//
// get the input image...
//
mitk::Image::Pointer mitkImage = this->GetInput();
if ( mitkImage.GetPointer() == NULL )
{
itkWarningMacro( << "VectorImage is null !" );
return ;
}
//
// make sure, that the input image is an vector image
//
if ( mitkImage->GetPixelType().GetNumberOfComponents() <= 1 )
{
itkWarningMacro( << "VectorImage has only one scalar component!" );
return ;
}
vtkImageData* vtkImage = mitkImage->GetVtkImageData();
//
// make sure, that we have point data with more than 1 component (as vectors)
//
vtkPointData* pointData = vtkImage->GetPointData();
if ( pointData == NULL )
{
itkWarningMacro( << "vtkImage->GetPointData() returns NULL!" );
return ;
}
if ( pointData->GetNumberOfArrays() == 0 )
{
itkWarningMacro( << "vtkImage->GetPointData()->GetNumberOfArrays() is 0!" );
return ;
}
else if ( pointData->GetArrayName( 0 ) == NULL )
{
vtkImage->GetPointData() ->GetArray( 0 ) ->SetName( "vector" );
}
if ( vtkImage->GetNumberOfPoints() != 0 )
{
//
// create the glyph, which has to be shown at each point
// of the masked image
//
vtkPolyData* glyph;
if ( m_GlyphType == LineGlyph )
{
vtkLineSource * lineSource = vtkLineSource::New();
lineSource->Update();
glyph = lineSource->GetOutput();
}
else if ( m_GlyphType == ArrowGlyph )
{
vtkArrowSource * arrowSource = vtkArrowSource::New();
arrowSource->Update();
glyph = arrowSource->GetOutput();
}
else
{
// Use a vtkLineSource as default, if the GlyphType is
// unknown
itkWarningMacro( << "unknown glyph type!" );
vtkLineSource * lineSource = vtkLineSource::New();
lineSource->Update();
glyph = lineSource->GetOutput();
}
m_RandomMode = false;
m_UseMaskPoints = false;
m_MaximumNumberOfPoints = 80*80*80;
//
// set up the actual glyphing filter
//
m_Glyph3DGenerator->SetSource( glyph );
m_Glyph3DGenerator->SetInput( vtkImage );
//m_Glyph3DGenerator->SetInputConnection(m_Cutter->GetOutputPort());
m_Glyph3DGenerator->SetInputArrayToProcess (1, 0,0, vtkDataObject::FIELD_ASSOCIATION_POINTS , "vector");
//m_Glyph3DGenerator->SelectInputVectors( vtkImage->GetPointData() ->GetArray( 0 ) ->GetName() );
m_Glyph3DGenerator->OrientOn();
m_Glyph3DGenerator->SetVectorModeToUseVector();
m_Glyph3DGenerator->SetScaleFactor( 0.00392156862745 );
m_Glyph3DGenerator->SetScaleModeToScaleByVector();
m_Glyph3DGenerator->SetUseMaskPoints( m_UseMaskPoints );
m_Glyph3DGenerator->SetRandomMode( m_RandomMode );
m_Glyph3DGenerator->SetMaximumNumberOfPoints( m_MaximumNumberOfPoints );
m_Glyph3DGenerator->Update();
m_Glyph3DMapper->SetInput( m_Glyph3DGenerator->GetOutput() );
m_Glyph3DActor->SetMapper( m_Glyph3DMapper );
if (GetDataNode()->GetProperty("LookupTable"))
{
mitk::LookupTable::Pointer mitkLookupTable = mitk::LookupTable::New();
m_Glyph3DMapper->Update();
mitkLookupTable->SetVtkLookupTable(dynamic_cast<vtkLookupTable*>(m_Glyph3DMapper->GetLookupTable()));
mitk::LookupTableProperty::Pointer LookupTableProp = mitk::LookupTableProperty::New( mitkLookupTable );
GetDataNode()->SetProperty( "LookupTable", LookupTableProp );
}
else
{
mitk::LookupTableProperty::Pointer mitkLutProp = dynamic_cast<mitk::LookupTableProperty*>(GetDataNode()->GetProperty("LookupTable"));
if (mitkLutProp.IsNotNull())
m_Glyph3DMapper->SetLookupTable( mitkLutProp->GetLookupTable()->GetVtkLookupTable() );
}
//vtkDataSetWriter* writer = vtkDataSetWriter::New();
//writer->SetInput( vtkImage );
//writer->SetFileName( "out.vtk" );
//writer->Update();
}
}
/*
* This method is called, each time a specific renderer is updated.
*/
-void mitk::VectorImageVtkGlyphMapper3D::GenerateData( mitk::BaseRenderer* renderer )
+void mitk::VectorImageVtkGlyphMapper3D::GenerateDataForRenderer( mitk::BaseRenderer* renderer )
{
if ( IsVisible( renderer ) == false )
{
if ( m_Glyph3DActor != NULL )
m_Glyph3DActor->VisibilityOff();
return ;
}
else
{
if ( m_Glyph3DActor != NULL )
m_Glyph3DActor->VisibilityOn();
}
}
/*
* Returns the input data object of the given filter. In this
* case, a mitk::Image is returned.
*/
mitk::Image* mitk::VectorImageVtkGlyphMapper3D::GetInput()
{
return const_cast<mitk::Image*>( dynamic_cast<mitk::Image*>( this->GetData() ) );
}
diff --git a/Modules/DiffusionImaging/Rendering/mitkVectorImageVtkGlyphMapper3D.h b/Modules/DiffusionImaging/Rendering/mitkVectorImageVtkGlyphMapper3D.h
index 08b27e6645..2391152850 100644
--- a/Modules/DiffusionImaging/Rendering/mitkVectorImageVtkGlyphMapper3D.h
+++ b/Modules/DiffusionImaging/Rendering/mitkVectorImageVtkGlyphMapper3D.h
@@ -1,101 +1,101 @@
/*=========================================================================
Program: Medical Imaging & Interaction Toolkit
Language: C++
Date: $Date$
Version: $Revision$
Copyright (c) German Cancer Research Center, Division of Medical and
Biological Informatics. All rights reserved.
See MITKCopyright.txt or http://www.mitk.org/copyright.html for details.
This software is distributed WITHOUT ANY WARRANTY; without even
the implied warranty of MERCHANTABILITY or FITNESS FOR A PARTICULAR
PURPOSE. See the above copyright notices for more information.
=========================================================================*/
#ifndef _MITK_VECTOR_IMAGE_VTK_MAPPER_3D__H
#define _MITK_VECTOR_IMAGE_VTK_MAPPER_3D__H
#include "MitkDiffusionImagingExports.h"
#include "mitkVtkMapper3D.h"
#include "mitkImage.h"
class vtkMaskedGlyph3D;
class vtkActor;
class vtkPolyDataMapper;
class vtkMaskPoints;
namespace mitk
{
class MitkDiffusionImaging_EXPORT VectorImageVtkGlyphMapper3D : public VtkMapper3D
{
public:
mitkClassMacro( VectorImageVtkGlyphMapper3D, VtkMapper3D );
itkNewMacro( Self );
enum GlyphType {LineGlyph, ArrowGlyph};
itkSetMacro(MaximumNumberOfPoints, unsigned int);
itkGetMacro(MaximumNumberOfPoints, unsigned int);
itkSetMacro(UseMaskPoints, bool);
itkGetMacro(UseMaskPoints, bool);
itkBooleanMacro(UseMaskPoints);
itkSetMacro(RandomMode, bool);
itkGetMacro(RandomMode, bool);
itkBooleanMacro(RandomMode);
virtual vtkProp* GetVtkProp(mitk::BaseRenderer* renderer);
protected:
/**
* Constructor. Doesn't do anything...
*/
VectorImageVtkGlyphMapper3D();
/**
* Destructor
*/
virtual ~VectorImageVtkGlyphMapper3D();
/**
* Generate a vtkPolyData by creating vectors as glyphs
*/
virtual void GenerateData();
/**
* This method is called, each time a specific renderer is updated.
*/
- virtual void GenerateData( mitk::BaseRenderer* renderer );
+ virtual void GenerateDataForRenderer( mitk::BaseRenderer* renderer );
/**
* Returns the input data object of the given filter. In this
* case, a mitk::Image is returned.
*/
Image* GetInput();
vtkMaskedGlyph3D* m_Glyph3DGenerator;
vtkActor* m_Glyph3DActor;
vtkPolyDataMapper* m_Glyph3DMapper;
GlyphType m_GlyphType;
unsigned int m_MaximumNumberOfPoints;
bool m_UseMaskPoints;
bool m_RandomMode;
};
} //end of namespace mitk
#endif
diff --git a/Modules/DiffusionImaging/Testing/mitkFactoryRegistrationTest.cpp b/Modules/DiffusionImaging/Testing/mitkFactoryRegistrationTest.cpp
index 77843cf2f2..95aa1b27e2 100644
--- a/Modules/DiffusionImaging/Testing/mitkFactoryRegistrationTest.cpp
+++ b/Modules/DiffusionImaging/Testing/mitkFactoryRegistrationTest.cpp
@@ -1,49 +1,49 @@
/*=========================================================================
Program: Medical Imaging & Interaction Toolkit
Language: C++
Date: $Date: 2009-08-05 17:32:40 +0200 (Mi, 05 Aug 2009) $
Version: $Revision: 7837 $
Copyright (c) German Cancer Research Center, Division of Medical and
Biological Informatics. All rights reserved.
See MITKCopyright.txt or http://www.mitk.org/copyright.html for details.
This software is distributed WITHOUT ANY WARRANTY; without even
the implied warranty of MERCHANTABILITY or FITNESS FOR A PARTICULAR
PURPOSE. See the above copyright notices for more information.
=========================================================================*/
#include "mitkTestingMacros.h"
#include "mitkDiffusionImagingObjectFactory.h"
#include "mitkCoreObjectFactory.h"
#include "mitkDiffusionImage.h"
/**Documentation
* Test for factory registration
*/
int mitkFactoryRegistrationTest(int /* argc */, char* /*argv*/[])
{
// always start with this!
MITK_TEST_BEGIN("FactoryRegistrationTest");
RegisterDiffusionImagingObjectFactory();
bool canWrite = false;
mitk::DiffusionImage<short>::Pointer img = mitk::DiffusionImage<short>::New();
mitk::CoreObjectFactory::FileWriterList fileWriters = mitk::CoreObjectFactory::GetInstance()->GetFileWriters();
for (mitk::CoreObjectFactory::FileWriterList::iterator it = fileWriters.begin() ; it != fileWriters.end() ; ++it)
{
- if ( (*it)->CanWriteDataType(img.GetPointer()) ) {
+ if ( (*it)->CanWriteBaseDataType(img.GetPointer()) ) {
canWrite = true;
break;
}
}
MITK_TEST_CONDITION_REQUIRED(canWrite,"Testing factory registration");
// always end with this!
MITK_TEST_END();
}
diff --git a/Modules/DiffusionImaging/Tractography/GlobalTracking/AccumulateBilin.cpp b/Modules/DiffusionImaging/Tractography/GlobalTracking/AccumulateBilin.cpp
new file mode 100644
index 0000000000..1f78d15d7b
--- /dev/null
+++ b/Modules/DiffusionImaging/Tractography/GlobalTracking/AccumulateBilin.cpp
@@ -0,0 +1,87 @@
+#include <math.h>
+#include "mex.h"
+#include "matrix.h"
+#define REAL float
+
+
+
+
+
+
+
+
+void mexFunction( int nlhs, mxArray *plhs[], int nrhs, const mxArray *prhs[] )
+{
+
+ if(nrhs!=2) {
+ mexPrintf("wrong usage!!\n",nrhs);
+ return;
+ } else if(nlhs>4) {
+ printf("Too many output arguments\n");
+ return;
+ }
+
+ int pcnt = 0;
+ const mxArray *Dim;
+ Dim = prhs[pcnt++];
+ REAL *dim = (REAL*) mxGetData(Dim);
+ int w = (int) dim[0];
+ int h = (int) dim[1];
+ int d = (int) dim[2];
+
+ const mxArray *Pts;
+ Pts = prhs[pcnt++];
+ const int numdim = mxGetNumberOfDimensions(Pts);
+ const int *pdims = mxGetDimensions(Pts);
+ int numPts = pdims[1];
+ REAL *pts = (REAL*) mxGetData(Pts);
+
+
+ int dims[3];
+ dims[0] = w;
+ dims[1] = h;
+ dims[2] = d;
+ plhs[0] = mxCreateNumericArray(3,dims,mxGetClassID(Dim),mxREAL);
+ REAL *accu = (REAL*) mxGetData(plhs[0]);
+
+
+ for (int i = 0; i < numPts; i++)
+ {
+ int idx = 3*i;
+
+ int px = (int) (pts[idx]);
+ if (px < 0 || px >= w-1)
+ continue;
+ int py = (int) (pts[idx+1]);
+ if (py < 0 || py >= h-1)
+ continue;
+ int pz = (int) (pts[idx+2]);
+ if (pz < 0 || pz >= d-1)
+ continue;
+ float frac_x = pts[idx ] - px;
+ float frac_y = pts[idx+1] - py;
+ float frac_z = pts[idx+2] - pz;
+
+
+ accu[px + w*(py+h*pz)] += (1-frac_x)*(1-frac_y)*(1-frac_z);
+
+ accu[px+1 + w*(py+h*pz)] += (frac_x)*(1-frac_y)*(1-frac_z);
+ accu[px + w*(py+1+h*pz)] += (1-frac_x)*(frac_y)*(1-frac_z);
+ accu[px + w*(py+h*pz+h)] += (1-frac_x)*(1-frac_y)*(frac_z);
+
+ accu[px + w*(py+1+h*pz+h)] += (1-frac_x)*(frac_y)*(frac_z);
+ accu[px+1 + w*(py+h*pz+h)] += (frac_x)*(1-frac_y)*(frac_z);
+ accu[px+1 + w*(py+1+h*pz)] += (frac_x)*(frac_y)*(1-frac_z);
+
+ accu[px+1 + w*(py+1+h*pz+h)] += (frac_x)*(frac_y)*(frac_z);
+
+ }
+
+
+}
+
+
+
+
+
+
diff --git a/Modules/DiffusionImaging/Tractography/GlobalTracking/AccumulateBilinWeighted.cpp b/Modules/DiffusionImaging/Tractography/GlobalTracking/AccumulateBilinWeighted.cpp
new file mode 100644
index 0000000000..c60c7c9f6c
--- /dev/null
+++ b/Modules/DiffusionImaging/Tractography/GlobalTracking/AccumulateBilinWeighted.cpp
@@ -0,0 +1,94 @@
+#include <math.h>
+#include "mex.h"
+#include "matrix.h"
+#define REAL float
+
+
+
+
+
+
+
+
+void mexFunction( int nlhs, mxArray *plhs[], int nrhs, const mxArray *prhs[] )
+{
+
+ if(nrhs!=3) {
+ mexPrintf("wrong usage!!\n",nrhs);
+ return;
+ } else if(nlhs>4) {
+ printf("Too many output arguments\n");
+ return;
+ }
+
+ int pcnt = 0;
+ const mxArray *Dim;
+ Dim = prhs[pcnt++];
+ REAL *dim = (REAL*) mxGetData(Dim);
+ int w = (int) dim[0];
+ int h = (int) dim[1];
+ int d = (int) dim[2];
+
+ const mxArray *Pts;
+ Pts = prhs[pcnt++];
+ const int numdim = mxGetNumberOfDimensions(Pts);
+ const int *pdims = mxGetDimensions(Pts);
+ int numPts = pdims[1];
+ REAL *pts = (REAL*) mxGetData(Pts);
+
+ const mxArray *Weights;
+ Weights = prhs[pcnt++];
+ const int wnumdim = mxGetNumberOfDimensions(Weights);
+ const int *wpdims = mxGetDimensions(Weights);
+ int numW = wpdims[0];
+ REAL *weights = (REAL*) mxGetData(Weights);
+
+
+ int dims[3];
+ dims[0] = w;
+ dims[1] = h;
+ dims[2] = d;
+ plhs[0] = mxCreateNumericArray(3,dims,mxGetClassID(Dim),mxREAL);
+ REAL *accu = (REAL*) mxGetData(plhs[0]);
+
+
+ for (int i = 0; i < numPts; i++)
+ {
+ int idx = 3*i;
+
+ int px = (int) (pts[idx]);
+ if (px < 0 || px >= w-1)
+ continue;
+ int py = (int) (pts[idx+1]);
+ if (py < 0 || py >= h-1)
+ continue;
+ int pz = (int) (pts[idx+2]);
+ if (pz < 0 || pz >= d-1)
+ continue;
+ float frac_x = pts[idx ] - px;
+ float frac_y = pts[idx+1] - py;
+ float frac_z = pts[idx+2] - pz;
+
+
+ accu[px + w*(py+h*pz)] += (1-frac_x)*(1-frac_y)*(1-frac_z) * weights[i];
+
+ accu[px+1 + w*(py+h*pz)] += (frac_x)*(1-frac_y)*(1-frac_z) * weights[i];
+ accu[px + w*(py+1+h*pz)] += (1-frac_x)*(frac_y)*(1-frac_z) * weights[i];
+ accu[px + w*(py+h*pz+h)] += (1-frac_x)*(1-frac_y)*(frac_z) * weights[i];
+
+ accu[px + w*(py+1+h*pz+h)] += (1-frac_x)*(frac_y)*(frac_z) * weights[i];
+ accu[px+1 + w*(py+h*pz+h)] += (frac_x)*(1-frac_y)*(frac_z) * weights[i];
+ accu[px+1 + w*(py+1+h*pz)] += (frac_x)*(frac_y)*(1-frac_z) * weights[i];
+
+ accu[px+1 + w*(py+1+h*pz+h)] += (frac_x)*(frac_y)*(frac_z) * weights[i];
+
+ }
+
+
+}
+
+
+
+
+
+
diff --git a/Modules/DiffusionImaging/Tractography/GlobalTracking/BuildFibres.cpp b/Modules/DiffusionImaging/Tractography/GlobalTracking/BuildFibres.cpp
new file mode 100644
index 0000000000..ebe5243717
--- /dev/null
+++ b/Modules/DiffusionImaging/Tractography/GlobalTracking/BuildFibres.cpp
@@ -0,0 +1,364 @@
+#ifndef _BUILDFIBRES
+#define _BUILDFIBRES
+
+//#include "matrix.h"
+#include <math.h>
+#include <map>
+#include <vector>
+#include <string.h>
+
+using namespace std;
+
+#define PI 3.1415926536
+
+
+
+#ifdef TIMING
+
+static struct timeval timeS;
+
+class PropStats
+{
+ int N;
+ int accept;
+public:
+ void clear() { N = 0; accept = 0;}
+ void propose() {N++;}
+ void accepted() {accept++;}
+
+ void report(const char *s)
+ {
+ mexPrintf("%s #proposals: %8.2fk acceptratio: %.2f \% \n",s,1.0*N/1000.0,100.0*accept/N);
+ }
+};
+
+
+class Timing
+{
+public:
+ Timing() { time = 0; ncalls = 0;}
+ void clear() {time = 0; ncalls=0;}
+
+
+ long time;
+ int ncalls;
+
+ void report(const char *s)
+ {
+ mexPrintf("%s total: %10.2fms calls: %10.1fk t/call: %10.3fms \n",s,time/1000.0,1.0*ncalls/1000.0,1.0*time/ncalls);
+ }
+
+ void report_time(const char *s)
+ {
+ mexPrintf("%s: %.2fms \n",s,time/1000.0);
+ }
+
+};
+
+inline void tic(Timing *t)
+{
+ gettimeofday( &timeS, NULL);
+ t->time -= (timeS.tv_sec*1000000 + timeS.tv_usec);
+ t->ncalls++;
+}
+inline void toc(Timing *t)
+{
+ gettimeofday( &timeS, NULL);
+ t->time += (timeS.tv_sec*1000000 + timeS.tv_usec);
+}
+
+
+#endif
+
+#include "ParticleGrid.cpp"
+
+class CCAnalysis
+{
+public:
+ Particle *particles;
+ int pcnt;
+ int attrcnt;
+ typedef vector< Particle* > ParticleContainerType;
+ typedef vector< ParticleContainerType* > FiberContainerType;
+
+ FiberContainerType* m_FiberContainer;
+
+ CCAnalysis(float *points, int numPoints, double spacing[])
+ {
+ m_FiberContainer = new FiberContainerType();
+ particles = (Particle*) malloc(sizeof(Particle)*numPoints);
+ pcnt = numPoints;
+ attrcnt = 10;
+ for (int k = 0; k < numPoints; k++)
+ {
+ Particle *p = &(particles[k]);
+ p->R = pVector(points[attrcnt*k]/spacing[0], points[attrcnt*k+1]/spacing[1],points[attrcnt*k+2]/spacing[2]);
+ p->N = pVector(points[attrcnt*k+3],points[attrcnt*k+4],points[attrcnt*k+5]);
+ p->cap = points[attrcnt*k+6];
+ p->len = points[attrcnt*k+7];
+ p->mID = (int) points[attrcnt*k+8];
+ p->pID = (int) points[attrcnt*k+9];
+ p->ID = k;
+ p->label = 0;
+ }
+ }
+
+ ~CCAnalysis()
+ {
+ for (int i=0; i<m_FiberContainer->size(); i++)
+ delete(m_FiberContainer->at(i));
+ delete(m_FiberContainer);
+ free(particles);
+ }
+
+ int iterate(int minSize)
+ {
+ int cur_label = 1;
+ int numFibers = 0;
+ for (int k = 0; k < pcnt;k++)
+ {
+ Particle *dp = &(particles[k]);
+ if (dp->label == 0)
+ {
+ ParticleContainerType* container = new ParticleContainerType();
+ dp->label = cur_label;
+ dp->numerator = 0;
+ labelPredecessors(dp, container);
+ labelSuccessors(dp, container);
+ //labelrecursivly(dp, 0);
+ cur_label++;
+ if(container->size()>minSize){
+ m_FiberContainer->push_back(container);
+ numFibers++;
+ }
+ }
+ }
+ return numFibers;
+ }
+
+ void labelPredecessors(Particle *dp, ParticleContainerType* container)
+ {
+ if (dp->mID != -1 && dp->mID!=dp->ID)
+ {
+ if (dp->ID!=particles[dp->mID].pID)
+ {
+ if (dp->ID==particles[dp->mID].mID)
+ {
+ int tmp = particles[dp->mID].pID;
+ particles[dp->mID].pID = particles[dp->mID].mID;
+ particles[dp->mID].mID = tmp;
+ }
+ }
+ if (particles[dp->mID].label == 0)
+ {
+ particles[dp->mID].label = dp->label;
+ particles[dp->mID].numerator = dp->numerator-1;
+ labelPredecessors(&(particles[dp->mID]), container);
+ }
+ }
+
+ container->push_back(dp);
+ }
+ void labelSuccessors(Particle *dp, ParticleContainerType* container)
+ {
+ if(container->back()->ID!=dp->ID)
+ container->push_back(dp);
+
+ if (dp->pID != -1 && dp->pID!=dp->ID)
+ {
+ if (dp->ID!=particles[dp->pID].mID)
+ {
+ if (dp->ID==particles[dp->pID].pID)
+ {
+ int tmp = particles[dp->pID].pID;
+ particles[dp->pID].pID = particles[dp->pID].mID;
+ particles[dp->pID].mID = tmp;
+ }
+ }
+ if (particles[dp->pID].label == 0)
+ {
+ particles[dp->pID].label = dp->label;
+ particles[dp->pID].numerator = dp->numerator+1;
+ labelSuccessors(&(particles[dp->pID]), container);
+ }
+ }
+ }
+
+ void labelrecursivly(Particle *dp, int depth)
+ {
+ int label = dp->label;
+
+ if (dp->mID != -1)
+ {
+ if (particles[dp->mID].label == 0)
+ {
+ particles[dp->mID].label = label;
+ labelrecursivly(&(particles[dp->mID]),depth+1);
+ }
+ }
+ if (dp->pID != -1)
+ {
+ if (particles[dp->pID].label == 0)
+ {
+ particles[dp->pID].label = label;
+ labelrecursivly(&(particles[dp->pID]),depth+1);
+ }
+ }
+ }
+};
+
+
+
+
+
+//klaus static int cmpfloat2(const void *p1,const void *p2)
+//klaus {
+//klaus if (((REAL*)p1)[1] > ((REAL*)p2)[1])
+//klaus return 1;
+//klaus else
+//klaus return -1;
+//klaus }
+
+
+
+typedef std::vector<int> vecint;
+
+
+
+//void mexFunction( int nlhs, mxArray *plhs[], int nrhs, const mxArray *prhs[] )
+//{
+//
+// if(nrhs != 2) {
+// printf("\nUsage: Df = STderivative(f)\n\n",nrhs);
+// printf(" Computes xxx\n");
+// printf(" Parameters:\n");
+// printf(" f - 2D input image of type REAL \n");
+// printf(" Return value Df contains xxx.\n\n");
+// return;
+// } else if(nlhs>2) {
+// printf("Too many output arguments\n");
+// return;
+// }
+//
+// fprintf(stderr,"building fibers "); fflush(stderr);
+//
+// int pcnt = 0;
+// const mxArray *Points;
+// Points = prhs[pcnt++];
+// int numPoints = mxGetN(Points);
+// REAL *points = (REAL*) mxGetData(Points);
+//
+//
+// const mxArray *Params;
+// Params = prhs[pcnt++];
+// double *params = (double*) mxGetPr(Params);
+//
+//
+// int minnumelements = (int) params[0];
+//
+//
+// CCAnalysis ccana(points,numPoints);
+//
+// #ifdef TIMING
+//
+// #endif
+//
+// int numc = ccana.iterate();
+//
+// fprintf(stderr,"."); fflush(stderr);
+//
+// vector<vecint> components(numc);
+//
+// int i;
+//
+// for (i = 0;i < ccana.pcnt;i++)
+// {
+// components[ccana.particles[i].label-1].push_back(i);
+// }
+//
+// fprintf(stderr,"."); fflush(stderr);
+//
+// for (i = 0; i < numc; i++)
+// {
+// Particle *last = &(ccana.particles[components[i][0]]);
+// last->numerator = 0;
+// Particle *next = (last->pID == -1)? 0 : &(ccana.particles[last->pID]);
+// for (;;)
+// {
+// if (next == 0)
+// break;
+// next->numerator = last->numerator+1;
+// int nextID = -1;
+// if (next->pID != last->ID)
+// nextID = next->pID;
+// if (next->mID != last->ID)
+// nextID = next->mID;
+// last = next;
+// next = (nextID == -1)? 0: &(ccana.particles[nextID]);
+// if (last->numerator > components[i].size()) // circular
+// break;
+// }
+//
+// last = &(ccana.particles[components[i][0]]);
+// next = (last->mID == -1)? 0 : &(ccana.particles[last->mID]);
+// for (;;)
+// {
+// if (next == 0)
+// break;
+// next->numerator = last->numerator-1;
+// int nextID = -1;
+// if (next->pID != last->ID)
+// nextID = next->pID;
+// if (next->mID != last->ID)
+// nextID = next->mID;
+// last = next;
+// next = (nextID == -1)? 0: &(ccana.particles[nextID]);
+// if (last->numerator < -components[i].size()) // circular
+// break;
+// }
+//
+// }
+//
+// fprintf(stderr,"."); fflush(stderr);
+//
+//
+// #ifdef TIMING
+//
+// #endif
+//
+// int index = 0;
+// for (i = 0; i < numc; i++)
+// {
+// if (components[i].size() >= minnumelements)
+// {
+// index++;
+// }
+// }
+//
+// int cdims[] = {index};
+// plhs[0] = mxCreateCellArray(1,cdims);
+//
+// index = 0;
+// for (i = 0; i < numc; i++)
+// {
+// mxArray *ll = 0;
+// if (components[i].size() >= minnumelements)
+// {
+// ll = mxCreateNumericMatrix(2,components[i].size(),mxGetClassID(Points),mxREAL);
+// REAL *dat = (REAL*) mxGetData(ll);
+// for (int k = 0; k < components[i].size(); k++)
+// {
+// dat[2*k] = components[i][k];
+// dat[2*k+1] = ccana.particles[components[i][k]].numerator;
+// }
+// qsort(dat,components[i].size(),sizeof(REAL)*2,cmpfloat2);
+// mxSetCell(plhs[0],index++,ll);
+// }
+// }
+//
+// fprintf(stderr,".\n"); fflush(stderr);
+//
+//}
+//
+
+#endif
diff --git a/Modules/DiffusionImaging/Tractography/GlobalTracking/EnergyComputerBase.cpp b/Modules/DiffusionImaging/Tractography/GlobalTracking/EnergyComputerBase.cpp
new file mode 100644
index 0000000000..9a2f4c5711
--- /dev/null
+++ b/Modules/DiffusionImaging/Tractography/GlobalTracking/EnergyComputerBase.cpp
@@ -0,0 +1,368 @@
+#ifndef _ENCOMPINTERFACE
+#define _ENCOMPINTERFACE
+
+
+#include "SphereInterpolator.cpp"
+#include "ParticleGrid.cpp"
+#include <vnl/vnl_vector_fixed.h>
+#include <vnl/vnl_matrix_fixed.h>
+
+inline float myATAN2(float y,float x)
+{
+ float phi = acos(x);
+ // float phi = ((x>=1.0) ? ((0.0000*x+-0.0000)) : ((x>=1.0) ? ((-10.0167*x+10.0167)) : ((x>=0.9) ? ((-3.1336*x+3.2713)) : ((x>=0.8) ? ((-1.9247*x+2.1833)) : ((x>=0.5) ? ((-1.3457*x+1.7200)) : ((x>=0.0) ? ((-1.0472*x+1.5708)) : ((x>=-0.5) ? ((-1.0472*x+1.5708)) : ((x>=-0.8) ? ((-1.3457*x+1.4216)) : ((x>=-0.9) ? ((-1.9247*x+0.9583)) : ((x>=-1.0) ? ((-3.1336*x+-0.1297)) : ((x>=-1.0) ? ((-10.0167*x+-6.8751)) : 1 )))))))))));
+ if (y < 0) phi = 2*PI - phi;
+ if (phi<0) phi = phi + PI;
+ return phi;
+
+}
+
+
+class EnergyComputerBase
+{
+
+public:
+
+ float *m_QBallImageData;
+ const int *m_QBallImageSize;
+ SphereInterpolator *m_SphereInterpolator;
+ ParticleGrid<Particle> *m_ParticleGrid;
+
+ int w,h,d;
+ float voxsize_w;
+ float voxsize_h;
+ float voxsize_d;
+
+ int w_sp,h_sp,d_sp;
+ float voxsize_sp_w;
+ float voxsize_sp_h;
+ float voxsize_sp_d;
+
+
+ int nip; // number of data vertices on sphere
+
+
+ float *m_MaskImageData;
+ float *cumulspatprob;
+ int *spatidx;
+ int scnt;
+
+
+
+ float eigen_energy;
+ vnl_matrix_fixed<double, 3, 3> m_RotationMatrix;
+
+ EnergyComputerBase(float *qBallImageData, const int *qBallImageSize, double *voxsize, SphereInterpolator *sp, ParticleGrid<Particle> *pcon, float *maskImageData, int spmult, vnl_matrix_fixed<double, 3, 3> rotMatrix)
+ {
+ m_RotationMatrix = rotMatrix;
+ m_QBallImageData = qBallImageData;
+ m_QBallImageSize = qBallImageSize;
+ m_SphereInterpolator = sp;
+
+ m_MaskImageData = maskImageData;
+
+ nip = m_QBallImageSize[0];
+
+
+ w = m_QBallImageSize[1];
+ h = m_QBallImageSize[2];
+ d = m_QBallImageSize[3];
+
+ voxsize_w = voxsize[0];
+ voxsize_h = voxsize[1];
+ voxsize_d = voxsize[2];
+
+
+ w_sp = m_QBallImageSize[1]*spmult;
+ h_sp = m_QBallImageSize[2]*spmult;
+ d_sp = m_QBallImageSize[3]*spmult;
+
+ voxsize_sp_w = voxsize[0]/spmult;
+ voxsize_sp_h = voxsize[1]/spmult;
+ voxsize_sp_d = voxsize[2]/spmult;
+
+
+ fprintf(stderr,"Data size (voxels) : %i x %i x %i\n",w,h,d);
+ fprintf(stderr,"voxel size: %f x %f x %f\n",voxsize_w,voxsize_h,voxsize_d);
+ fprintf(stderr,"mask_oversamp_mult: %i\n",spmult);
+
+ if (nip != sp->nverts)
+ {
+ fprintf(stderr,"EnergyComputer: error during init: data does not match with interpolation scheme\n");
+ }
+
+ m_ParticleGrid = pcon;
+
+
+ int totsz = w_sp*h_sp*d_sp;
+ cumulspatprob = (float*) malloc(sizeof(float) * totsz);
+ spatidx = (int*) malloc(sizeof(int) * totsz);
+ if (cumulspatprob == 0 || spatidx == 0)
+ {
+ fprintf(stderr,"EnergyCOmputerBase: out of memory!\n");
+ return ;
+ }
+
+
+ scnt = 0;
+ cumulspatprob[0] = 0;
+ for (int x = 1; x < w_sp;x++)
+ for (int y = 1; y < h_sp;y++)
+ for (int z = 1; z < d_sp;z++)
+ {
+ int idx = x+(y+z*h_sp)*w_sp;
+ if (m_MaskImageData[idx] > 0.5)
+ {
+ cumulspatprob[scnt+1] = cumulspatprob[scnt] + m_MaskImageData[idx];
+ spatidx[scnt] = idx;
+ scnt++;
+ }
+ }
+
+ for (int k = 0; k < scnt; k++)
+ {
+ cumulspatprob[k] /= cumulspatprob[scnt];
+ }
+
+ fprintf(stderr,"#active voxels: %i (in mask units) \n",scnt);
+
+
+
+ }
+
+ ~EnergyComputerBase()
+ {
+ free(cumulspatprob);
+ free(spatidx);
+ }
+
+ virtual void setParameters()
+ {
+
+ }
+
+
+
+ void drawSpatPosition(pVector *R)
+ {
+ float r = mtrand.frand();
+ int j;
+ int rl = 1;
+ int rh = scnt;
+ while(rh != rl)
+ {
+ j = rl + (rh-rl)/2;
+ if (r < cumulspatprob[j])
+ {
+ rh = j;
+ continue;
+ }
+ if (r > cumulspatprob[j])
+ {
+ rl = j+1;
+ continue;
+ }
+ break;
+ }
+ R->SetXYZ(voxsize_sp_w*((float)(spatidx[rh-1] % w_sp) + mtrand.frand()),
+ voxsize_sp_h*((float)((spatidx[rh-1]/w_sp) % h_sp) + mtrand.frand()),
+ voxsize_sp_d*((float)(spatidx[rh-1]/(w_sp*h_sp)) + mtrand.frand()));
+ }
+
+ float SpatProb(pVector R)
+ {
+ int rx = int(R.GetX()/voxsize_sp_w);
+ int ry = int(R.GetY()/voxsize_sp_h);
+ int rz = int(R.GetZ()/voxsize_sp_d);
+ if (rx >= 0 && rx < w_sp && ry >= 0 && ry < h_sp && rz >= 0 && rz < d_sp){
+ return m_MaskImageData[rx + w_sp* (ry + h_sp*rz)];
+ }
+ else
+ return 0;
+ }
+
+ /*
+ inline float evaluateODF(pVector &R, pVector &N, float &len)
+ {
+ const int CU = 10;
+ pVector Rs;
+ float Dn = 0;
+ int xint,yint,zint,spatindex;
+
+ sinterp->getInterpolation(N);
+ for (int i=-CU; i < CU;i++)
+ {
+ Rs = R + (N * len) * ((float)i/CU);
+ xint = int(Rs.x);
+ yint = int(Rs.y);
+ zint = int(Rs.z);
+ if (xint > 0 && xint < w-1 && yint > 0 && yint < h-1 && zint > 0 && zint < d-1)
+ {
+ spatindex = (xint + w*(yint+h*zint)) *nip;
+ Dn += (dataimg[spatindex + sinterp->idx[0]]*sinterp->interpw[0] + dataimg[spatindex + sinterp->idx[1]]*sinterp->interpw[1] + dataimg[spatindex + sinterp->idx[2]]* sinterp->interpw[2]);
+ }
+ }
+
+ Dn /= (float)(2*CU+1);
+ return Dn;
+ }
+*/
+
+
+ inline float evaluateODF(pVector &R, pVector &N, float &len)
+ {
+ const int CU = 10;
+ pVector Rs;
+ float Dn = 0;
+ int xint,yint,zint,spatindex;
+
+ vnl_vector_fixed<double, 3> n;
+ n[0] = N[0];
+ n[1] = N[1];
+ n[2] = N[2];
+ n = m_RotationMatrix*n;
+ m_SphereInterpolator->getInterpolation(n);
+
+ for (int i=-CU; i <= CU;i++)
+ {
+ Rs = R + (N * len) * ((float)i/CU);
+
+ float Rx = Rs[0]/voxsize_w-0.5;
+ float Ry = Rs[1]/voxsize_h-0.5;
+ float Rz = Rs[2]/voxsize_d-0.5;
+
+
+ xint = int(floor(Rx));
+ yint = int(floor(Ry));
+ zint = int(floor(Rz));
+
+
+ if (xint >= 0 && xint < w-1 && yint >= 0 && yint < h-1 && zint >= 0 && zint < d-1)
+ {
+ float xfrac = Rx-xint;
+ float yfrac = Ry-yint;
+ float zfrac = Rz-zint;
+
+ float weight;
+
+ weight = (1-xfrac)*(1-yfrac)*(1-zfrac);
+ spatindex = (xint + w*(yint+h*zint)) *nip;
+ Dn += (m_QBallImageData[spatindex + m_SphereInterpolator->idx[0]-1]*m_SphereInterpolator->interpw[0] + m_QBallImageData[spatindex + m_SphereInterpolator->idx[1]-1]*m_SphereInterpolator->interpw[1] + m_QBallImageData[spatindex + m_SphereInterpolator->idx[2]-1]* m_SphereInterpolator->interpw[2])*weight;
+
+ weight = (xfrac)*(1-yfrac)*(1-zfrac);
+ spatindex = (xint+1 + w*(yint+h*zint)) *nip;
+ Dn += (m_QBallImageData[spatindex + m_SphereInterpolator->idx[0]-1]*m_SphereInterpolator->interpw[0] + m_QBallImageData[spatindex + m_SphereInterpolator->idx[1]-1]*m_SphereInterpolator->interpw[1] + m_QBallImageData[spatindex + m_SphereInterpolator->idx[2]-1]* m_SphereInterpolator->interpw[2])*weight;
+
+ weight = (1-xfrac)*(yfrac)*(1-zfrac);
+ spatindex = (xint + w*(yint+1+h*zint)) *nip;
+ Dn += (m_QBallImageData[spatindex + m_SphereInterpolator->idx[0]-1]*m_SphereInterpolator->interpw[0] + m_QBallImageData[spatindex + m_SphereInterpolator->idx[1]-1]*m_SphereInterpolator->interpw[1] + m_QBallImageData[spatindex + m_SphereInterpolator->idx[2]-1]* m_SphereInterpolator->interpw[2])*weight;
+
+ weight = (1-xfrac)*(1-yfrac)*(zfrac);
+ spatindex = (xint + w*(yint+h*(zint+1))) *nip;
+ Dn += (m_QBallImageData[spatindex + m_SphereInterpolator->idx[0]-1]*m_SphereInterpolator->interpw[0] + m_QBallImageData[spatindex + m_SphereInterpolator->idx[1]-1]*m_SphereInterpolator->interpw[1] + m_QBallImageData[spatindex + m_SphereInterpolator->idx[2]-1]* m_SphereInterpolator->interpw[2])*weight;
+
+ weight = (xfrac)*(yfrac)*(1-zfrac);
+ spatindex = (xint+1 + w*(yint+1+h*zint)) *nip;
+ Dn += (m_QBallImageData[spatindex + m_SphereInterpolator->idx[0]-1]*m_SphereInterpolator->interpw[0] + m_QBallImageData[spatindex + m_SphereInterpolator->idx[1]-1]*m_SphereInterpolator->interpw[1] + m_QBallImageData[spatindex + m_SphereInterpolator->idx[2]-1]* m_SphereInterpolator->interpw[2])*weight;
+
+ weight = (1-xfrac)*(yfrac)*(zfrac);
+ spatindex = (xint + w*(yint+1+h*(zint+1))) *nip;
+ Dn += (m_QBallImageData[spatindex + m_SphereInterpolator->idx[0]-1]*m_SphereInterpolator->interpw[0] + m_QBallImageData[spatindex + m_SphereInterpolator->idx[1]-1]*m_SphereInterpolator->interpw[1] + m_QBallImageData[spatindex + m_SphereInterpolator->idx[2]-1]* m_SphereInterpolator->interpw[2])*weight;
+
+ weight = (xfrac)*(1-yfrac)*(zfrac);
+ spatindex = (xint+1 + w*(yint+h*(zint+1))) *nip;
+ Dn += (m_QBallImageData[spatindex + m_SphereInterpolator->idx[0]-1]*m_SphereInterpolator->interpw[0] + m_QBallImageData[spatindex + m_SphereInterpolator->idx[1]-1]*m_SphereInterpolator->interpw[1] + m_QBallImageData[spatindex + m_SphereInterpolator->idx[2]-1]* m_SphereInterpolator->interpw[2])*weight;
+
+ weight = (xfrac)*(yfrac)*(zfrac);
+ spatindex = (xint+1 + w*(yint+1+h*(zint+1))) *nip;
+ Dn += (m_QBallImageData[spatindex + m_SphereInterpolator->idx[0]-1]*m_SphereInterpolator->interpw[0] + m_QBallImageData[spatindex + m_SphereInterpolator->idx[1]-1]*m_SphereInterpolator->interpw[1] + m_QBallImageData[spatindex + m_SphereInterpolator->idx[2]-1]* m_SphereInterpolator->interpw[2])*weight;
+
+
+ }
+
+
+ }
+
+ Dn *= 1.0/(2*CU+1);
+ return Dn;
+ }
+
+
+ /*
+ inline float evaluateODF(pVector &R, pVector &N, float &len)
+ {
+
+ R.storeXYZ();
+
+ float Rx = pVector::store[0]/voxsize_w;
+ float Ry = pVector::store[1]/voxsize_h;
+ float Rz = pVector::store[2]/voxsize_d;
+
+
+ int xint = int(Rx);
+ int yint = int(Ry);
+ int zint = int(Rz);
+
+ if (xint >= 0 && xint < w-1 && yint >= 0 && yint < h-1 && zint >= 0 && zint < d-1)
+ {
+ float xfrac = Rx-xint;
+ float yfrac = Ry-yint;
+ float zfrac = Rz-zint;
+ sinterp->getInterpolation(N);
+
+ float weight;
+ int spatindex;
+ float Dn = 0;
+
+ weight = (1-xfrac)*(1-yfrac)*(1-zfrac);
+ spatindex = (xint + w*(yint+h*zint)) *nip;
+ Dn += (dataimg[spatindex + sinterp->idx[0]]*sinterp->interpw[0] + dataimg[spatindex + sinterp->idx[1]]*sinterp->interpw[1] + dataimg[spatindex + sinterp->idx[2]]* sinterp->interpw[2])*weight;
+
+ weight = (xfrac)*(1-yfrac)*(1-zfrac);
+ spatindex = (xint+1 + w*(yint+h*zint)) *nip;
+ Dn += (dataimg[spatindex + sinterp->idx[0]]*sinterp->interpw[0] + dataimg[spatindex + sinterp->idx[1]]*sinterp->interpw[1] + dataimg[spatindex + sinterp->idx[2]]* sinterp->interpw[2])*weight;
+
+ weight = (1-xfrac)*(yfrac)*(1-zfrac);
+ spatindex = (xint + w*(yint+1+h*zint)) *nip;
+ Dn += (dataimg[spatindex + sinterp->idx[0]]*sinterp->interpw[0] + dataimg[spatindex + sinterp->idx[1]]*sinterp->interpw[1] + dataimg[spatindex + sinterp->idx[2]]* sinterp->interpw[2])*weight;
+
+ weight = (1-xfrac)*(1-yfrac)*(zfrac);
+ spatindex = (xint + w*(yint+h*(zint+1))) *nip;
+ Dn += (dataimg[spatindex + sinterp->idx[0]]*sinterp->interpw[0] + dataimg[spatindex + sinterp->idx[1]]*sinterp->interpw[1] + dataimg[spatindex + sinterp->idx[2]]* sinterp->interpw[2])*weight;
+
+ weight = (xfrac)*(yfrac)*(1-zfrac);
+ spatindex = (xint+1 + w*(yint+1+h*zint)) *nip;
+ Dn += (dataimg[spatindex + sinterp->idx[0]]*sinterp->interpw[0] + dataimg[spatindex + sinterp->idx[1]]*sinterp->interpw[1] + dataimg[spatindex + sinterp->idx[2]]* sinterp->interpw[2])*weight;
+
+ weight = (1-xfrac)*(yfrac)*(zfrac);
+ spatindex = (xint + w*(yint+1+h*(zint+1))) *nip;
+ Dn += (dataimg[spatindex + sinterp->idx[0]]*sinterp->interpw[0] + dataimg[spatindex + sinterp->idx[1]]*sinterp->interpw[1] + dataimg[spatindex + sinterp->idx[2]]* sinterp->interpw[2])*weight;
+
+ weight = (xfrac)*(1-yfrac)*(zfrac);
+ spatindex = (xint+1 + w*(yint+h*(zint+1))) *nip;
+ Dn += (dataimg[spatindex + sinterp->idx[0]]*sinterp->interpw[0] + dataimg[spatindex + sinterp->idx[1]]*sinterp->interpw[1] + dataimg[spatindex + sinterp->idx[2]]* sinterp->interpw[2])*weight;
+
+ weight = (xfrac)*(yfrac)*(zfrac);
+ spatindex = (xint+1 + w*(yint+1+h*(zint+1))) *nip;
+ Dn += (dataimg[spatindex + sinterp->idx[0]]*sinterp->interpw[0] + dataimg[spatindex + sinterp->idx[1]]*sinterp->interpw[1] + dataimg[spatindex + sinterp->idx[2]]* sinterp->interpw[2])*weight;
+
+ return Dn;
+
+ }
+ return 0;
+ }
+
+*/
+
+ virtual inline float computeExternalEnergy(pVector &R, pVector &N, float &cap, float &len, Particle *dp) { return 0;}
+ virtual inline float computeInternalEnergy(Particle *p1) {return 0;}
+ virtual inline float computeInternalEnergyConnection(Particle *p1,int ep1) {return 0;}
+ virtual inline float computeInternalEnergyConnection(Particle *p1,int ep1, Particle *p2, int ep2) {return 0;}
+
+
+
+};
+
+#endif
+
+
diff --git a/Modules/DiffusionImaging/Tractography/GlobalTracking/EnergyComputer_connec.cpp b/Modules/DiffusionImaging/Tractography/GlobalTracking/EnergyComputer_connec.cpp
new file mode 100644
index 0000000000..8c40d4dd43
--- /dev/null
+++ b/Modules/DiffusionImaging/Tractography/GlobalTracking/EnergyComputer_connec.cpp
@@ -0,0 +1,226 @@
+
+
+
+/// bessel for wid = 1
+
+//#define mbesseli0(x) ((x>=1.0) ? ((-0.2578*x+0.7236)*exp(x)) : ((x>=0.9) ? ((-0.2740*x+0.7398)*exp(x)) : ((x>=0.8) ? ((-0.3099*x+0.7720)*exp(x)) : ((x>=0.7) ? ((-0.3634*x+0.8149)*exp(x)) : ((x>=0.5) ? ((-0.4425*x+0.8663)*exp(x)) : ((x>=0.3) ? ((-0.5627*x+0.9264)*exp(x)) : ((x>=0.2) ? ((-0.6936*x+0.9657)*exp(x)) : ((x>=0.1) ? ((-0.8016*x+0.9873)*exp(x)) : ((x>=0.0) ? ((-0.9290*x+1.0000)*exp(x)) : 1 )))))))))
+//#define mbesseli0(x) ((x>=1.0) ? ((0.5652*x+0.7009)) : ((x>=0.8) ? ((0.4978*x+0.7683)) : ((x>=0.6) ? ((0.3723*x+0.8686)) : ((x>=0.4) ? ((0.2582*x+0.9371)) : ((x>=0.2) ? ((0.1519*x+0.9796)) : ((x>=0.0) ? ((0.0501*x+1.0000)) : 1 ))))))
+
+
+inline float mbesseli0(float x)
+{
+ float y = x*x;
+ float erg = BESSEL_APPROXCOEFF[0];
+ erg += y*BESSEL_APPROXCOEFF[1];
+ erg += y*y*BESSEL_APPROXCOEFF[2];
+ erg += y*y*y*BESSEL_APPROXCOEFF[3];
+ return erg;
+}
+
+//
+//
+// inline REAL mbesseli0(REAL x)
+// {
+// REAL y = x*x;
+// REAL erg = BESSEL_APPROXCOEFF[0];
+// erg += y*BESSEL_APPROXCOEFF[1];
+// erg += y*x*BESSEL_APPROXCOEFF[2];
+// erg += x*x*BESSEL_APPROXCOEFF[3];
+// return erg;
+// }
+
+inline float mexp(float x)
+{
+
+ return((x>=7.0) ? 0 : ((x>=5.0) ? (-0.0029*x+0.0213) : ((x>=3.0) ? (-0.0215*x+0.1144) : ((x>=2.0) ? (-0.0855*x+0.3064) : ((x>=1.0) ? (-0.2325*x+0.6004) : ((x>=0.5) ? (-0.4773*x+0.8452) : ((x>=0.0) ? (-0.7869*x+1.0000) : 1 )))))));
+ // return exp(-x);
+
+}
+
+
+#include "ParticleGrid.cpp"
+
+#include "EnergyComputerBase.cpp"
+#include <fstream>
+
+
+class EnergyComputer : public EnergyComputerBase
+{
+
+public:
+
+
+ float eigencon_energy;
+
+ float chempot2;
+ float meanval_sq;
+
+ float gamma_s;
+ float gamma_reg_s;
+
+ float particle_weight;
+ float ex_strength;
+ float in_strength;
+
+ float particle_length_sq;
+ float curv_hard;
+ ofstream ee_file, ie_file;
+
+
+ EnergyComputer(float *data, const int *dsz, double *cellsize, SphereInterpolator *sp, ParticleGrid<Particle> *pcon, float *spimg, int spmult, vnl_matrix_fixed<double, 3, 3> rotMatrix) : EnergyComputerBase(data,dsz,cellsize,sp,pcon,spimg,spmult,rotMatrix)
+ {
+// ee_file.open("eeFile.txt");
+// ie_file.open("ieFile.txt");
+ }
+
+// ~EnergyComputer(){
+// ee_file.close();
+// ie_file.close();
+// }
+
+ void setParameters(float pwei,float pwid,float chempot_connection, float length,float curv_hardthres, float inex_balance, float chempot2)
+ {
+ this->chempot2 = chempot2;
+
+ eigencon_energy = chempot_connection;
+ eigen_energy = 0;
+ particle_weight = pwei;
+
+ float bal = 1/(1+exp(-inex_balance));
+ ex_strength = 2*bal; // cleanup (todo)
+ in_strength = 2*(1-bal)/length/length; // cleanup (todo)
+ // in_strength = 0.64/length/length; // cleanup (todo)
+
+ particle_length_sq = length*length;
+ curv_hard = curv_hardthres;
+
+ float sigma_s = pwid;
+ gamma_s = 1/(sigma_s*sigma_s);
+ gamma_reg_s =1/(length*length/4);
+ }
+
+
+
+ ////////////////////////////////////////////////////////////////////////////
+ ////// External Energy
+ ////////////////////////////////////////////////////////////////////////////
+ inline float computeExternalEnergy(pVector &R, pVector &N, float &cap, float &len, Particle *dp)
+ {
+ float m = SpatProb(R);
+ if (m == 0)
+ {
+ return -INFINITY;
+ }
+
+ float Dn = evaluateODF(R,N,len);
+
+ float Sn = 0;
+ float Pn = 0;
+
+ m_ParticleGrid->computeNeighbors(R);
+ for (;;)
+ {
+ Particle *p = m_ParticleGrid->getNextNeighbor();
+ if (p == 0) break;
+ if (dp != p)
+ {
+ float dot = fabs(N*p->N);
+ float bw = mbesseli0(dot);
+ float dpos = (p->R-R).norm_square();
+ float w = mexp(dpos*gamma_s);
+ Sn += w*(bw+chempot2)*p->cap ;
+ w = mexp(dpos*gamma_reg_s);
+ Pn += w*bw;
+ }
+ }
+
+ float energy = 0;
+ energy += (2*(Dn/particle_weight-Sn) - (mbesseli0(1.0)+chempot2)*cap)*cap;
+
+ return energy*ex_strength;
+ }
+
+
+ ////////////////////////////////////////////////////////////////////////////
+ ////// Internal Energy
+ ////////////////////////////////////////////////////////////////////////////
+
+ inline float computeInternalEnergy(Particle *dp)
+ {
+ float energy = eigen_energy;
+
+ if (dp->pID != -1)
+ energy += computeInternalEnergyConnection(dp,+1);
+
+ if (dp->mID != -1)
+ energy += computeInternalEnergyConnection(dp,-1);
+
+ //ie_file << energy << "\n";
+
+ return energy;
+ }
+
+ inline float computeInternalEnergyConnection(Particle *p1,int ep1)
+ {
+ Particle *p2 = 0;
+ int ep2;
+ if (ep1 == 1)
+ p2 = m_ParticleGrid->ID_2_address[p1->pID];
+ else
+ p2 = m_ParticleGrid->ID_2_address[p1->mID];
+ if (p2->mID == p1->ID)
+ ep2 = -1;
+ else if (p2->pID == p1->ID)
+ ep2 = 1;
+ else
+ fprintf(stderr,"EnergyComputer_connec: Connections are inconsistent!\n");
+
+ if (p2 == 0)
+ fprintf(stderr,"bug2");
+
+ return computeInternalEnergyConnection(p1,ep1,p2,ep2);
+ }
+
+ inline float computeInternalEnergyConnection(Particle *p1,int ep1, Particle *p2, int ep2)
+ {
+#ifdef TIMING
+ tic(&internalenergy_time);
+#endif
+
+ if ((p1->N*p2->N)*ep1*ep2 > -curv_hard)
+ return -INFINITY;
+
+ pVector R1 = p1->R + (p1->N * (p1->len * ep1));
+ pVector R2 = p2->R + (p2->N * (p2->len * ep2));
+
+ if ((R1-R2).norm_square() > particle_length_sq)
+ return -INFINITY;
+
+ pVector R = (p2->R + p1->R)*0.5;
+
+ if (SpatProb(R) == 0)
+ return -INFINITY;
+
+ float norm1 = (R1-R).norm_square();
+ float norm2 = (R2-R).norm_square();
+
+
+ float energy = (eigencon_energy-norm1-norm2)*in_strength;
+
+#ifdef TIMING
+ toc(&internalenergy_time);
+#endif
+
+ return energy;
+ }
+
+
+
+
+
+
+
+
+
+};
+
diff --git a/Modules/DiffusionImaging/Tractography/GlobalTracking/MersenneTwister.h b/Modules/DiffusionImaging/Tractography/GlobalTracking/MersenneTwister.h
new file mode 100644
index 0000000000..d039f24113
--- /dev/null
+++ b/Modules/DiffusionImaging/Tractography/GlobalTracking/MersenneTwister.h
@@ -0,0 +1,594 @@
+// MersenneTwister.h
+// Mersenne Twister random number generator -- a C++ class MTRand
+// Based on code by Makoto Matsumoto, Takuji Nishimura, and Shawn Cokus
+// Richard J. Wagner v1.0 15 May 2003 rjwagner@writeme.com
+
+// The Mersenne Twister is an algorithm for generating random numbers. It
+// was designed with consideration of the flaws in various other generators.
+// The period, 2^19937-1, and the order of equidistribution, 623 dimensions,
+// are far greater. The generator is also fast; it avoids multiplication and
+// division, and it benefits from caches and pipelines. For more information
+// see the inventors' web page at http://www.math.keio.ac.jp/~matumoto/emt.html
+
+// Reference
+// M. Matsumoto and T. Nishimura, "Mersenne Twister: A 623-Dimensionally
+// Equidistributed Uniform Pseudo-Random Number Generator", ACM Transactions on
+// Modeling and Computer Simulation, Vol. 8, No. 1, January 1998, pp 3-30.
+
+// Copyright (C) 1997 - 2002, Makoto Matsumoto and Takuji Nishimura,
+// Copyright (C) 2000 - 2003, Richard J. Wagner
+// All rights reserved.
+//
+// Redistribution and use in source and binary forms, with or without
+// modification, are permitted provided that the following conditions
+// are met:
+//
+// 1. Redistributions of source code must retain the above copyright
+// notice, this list of conditions and the following disclaimer.
+//
+// 2. Redistributions in binary form must reproduce the above copyright
+// notice, this list of conditions and the following disclaimer in the
+// documentation and/or other materials provided with the distribution.
+//
+// 3. The names of its contributors may not be used to endorse or promote
+// products derived from this software without specific prior written
+// permission.
+//
+// THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS
+// "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT
+// LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR
+// A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT OWNER OR
+// CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL,
+// EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO,
+// PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR
+// PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF
+// LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING
+// NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS
+// SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
+
+// The original code included the following notice:
+//
+// When you use this, send an email to: matumoto@math.keio.ac.jp
+// with an appropriate reference to your work.
+//
+// It would be nice to CC: rjwagner@writeme.com and Cokus@math.washington.edu
+// when you write.
+
+#ifndef MERSENNETWISTER_H
+#define MERSENNETWISTER_H
+
+// Not thread safe (unless auto-initialization is avoided and each thread has
+// its own MTRand object)
+
+#include <iostream>
+#include <limits.h>
+#include <stdio.h>
+#include <time.h>
+#include <math.h>
+
+class MTRand {
+// Data
+public:
+ typedef unsigned long uint32; // unsigned integer type, at least 32 bits
+
+ enum { N = 624 }; // length of state vector
+ enum { SAVE = N + 1 }; // length of array for save()
+
+// protected:
+ enum { M = 397 }; // period parameter
+
+ uint32 state[N]; // internal state
+ uint32 *pNext; // next value to get from state
+ int left; // number of values left before reload needed
+
+
+//Methods
+public:
+ MTRand( const uint32& oneSeed ); // initialize with a simple uint32
+ MTRand( uint32 *const bigSeed, uint32 const seedLength = N ); // or an array
+ MTRand(); // auto-initialize with /dev/urandom or time() and clock()
+ ~MTRand();
+
+ // Do NOT use for CRYPTOGRAPHY without securely hashing several returned
+ // values together, otherwise the generator state can be learned after
+ // reading 624 consecutive values.
+
+ // Access to 32-bit random numbers
+ double rand(); // real number in [0,1]
+ float frand(); // real number in [0,1]
+ double rand( const double& n ); // real number in [0,n]
+ double randExc(); // real number in [0,1)
+ double randExc( const double& n ); // real number in [0,n)
+ double randDblExc(); // real number in (0,1)
+ double randDblExc( const double& n ); // real number in (0,n)
+ uint32 randInt(); // integer in [0,2^32-1]
+ uint32 randInt( const uint32& n ); // integer in [0,n] for n < 2^32
+ double operator()() { return rand(); } // same as rand()
+
+ // Access to 53-bit random numbers (capacity of IEEE double precision)
+ double rand53(); // real number in [0,1)
+
+ // Access to nonuniform random number distributions
+ double randNorm( const double& mean = 0.0, const double& variance = 0.0 );
+ float frandn();
+
+ // Re-seeding functions with same behavior as initializers
+ void seed( const uint32 oneSeed );
+ void seed( uint32 *const bigSeed, const uint32 seedLength = N );
+ void seed();
+
+
+ //////
+ int Poisson();
+ void initPoisson(float mean, int accuracy);
+ float *cumulPoisson;
+ int accuracyPoisson;
+
+ int drawGamma();
+ void initGamma(float theta, int shape);
+ float *cumulGamma;
+ int accuracyGamma;
+
+
+
+ // Saving and loading generator state
+ void save( uint32* saveArray ) const; // to array of size SAVE
+ void load( uint32 *const loadArray ); // from such array
+ friend std::ostream& operator<<( std::ostream& os, const MTRand& mtrand );
+ friend std::istream& operator>>( std::istream& is, MTRand& mtrand );
+
+protected:
+ void initialize( const uint32 oneSeed );
+ void reload();
+ uint32 hiBit( const uint32& u ) const { return u & 0x80000000UL; }
+ uint32 loBit( const uint32& u ) const { return u & 0x00000001UL; }
+ uint32 loBits( const uint32& u ) const { return u & 0x7fffffffUL; }
+ uint32 mixBits( const uint32& u, const uint32& v ) const
+ { return hiBit(u) | loBits(v); }
+ uint32 twist( const uint32& m, const uint32& s0, const uint32& s1 ) const
+ { return m ^ (mixBits(s0,s1)>>1) ^ (-loBit(s1) & 0x9908b0dfUL); }
+ static uint32 hash( time_t t, clock_t c );
+};
+
+
+inline MTRand::MTRand( const uint32& oneSeed )
+ { seed(oneSeed);
+ cumulPoisson = 0;
+ cumulGamma = 0;
+ }
+
+inline MTRand::MTRand( uint32 *const bigSeed, const uint32 seedLength )
+ { seed(bigSeed,seedLength);
+ cumulPoisson = 0;
+ cumulGamma = 0;
+
+ }
+
+inline MTRand::MTRand()
+ { seed();
+ cumulPoisson = 0;
+ cumulGamma = 0;
+ }
+
+inline MTRand::~MTRand()
+{
+ if (cumulPoisson != 0)
+ free(cumulPoisson);
+ if (cumulGamma != 0)
+ free(cumulGamma);
+}
+inline double MTRand::rand()
+ { return double(randInt()) * (1.0/4294967295.0); }
+
+inline float MTRand::frand()
+ {
+ return float(randInt()) * (1.0/4294967295.0);
+ }
+
+
+inline double MTRand::rand( const double& n )
+ { return rand() * n; }
+
+inline double MTRand::randExc()
+ { return double(randInt()) * (1.0/4294967296.0); }
+
+inline double MTRand::randExc( const double& n )
+ { return randExc() * n; }
+
+inline double MTRand::randDblExc()
+ { return ( double(randInt()) + 0.5 ) * (1.0/4294967296.0); }
+
+inline double MTRand::randDblExc( const double& n )
+ { return randDblExc() * n; }
+
+inline double MTRand::rand53()
+{
+ uint32 a = randInt() >> 5, b = randInt() >> 6;
+ return ( a * 67108864.0 + b ) * (1.0/9007199254740992.0); // by Isaku Wada
+}
+
+inline double MTRand::randNorm( const double& mean, const double& variance )
+{
+ // Return a real number from a normal (Gaussian) distribution with given
+ // mean and variance by Box-Muller method
+ double r = sqrt( -2.0 * log( 1.0-randDblExc()) ) * variance;
+ double phi = 2.0 * 3.14159265358979323846264338328 * randExc();
+ return mean + r * cos(phi);
+}
+
+inline float MTRand::frandn()
+{
+ // Return a real number from a normal (Gaussian) distribution with given
+ // mean and variance by Box-Muller method
+ float r = sqrt( -2.0 * log( 1.0-randDblExc()) );
+ double phi = 2.0 * 3.14159265358979323846264338328 * randExc();
+ return r * cos(phi);
+}
+
+inline int MTRand::Poisson()
+{
+ int j;
+
+ float r = frand();
+
+ int rl = 0;
+ int rh = accuracyPoisson-1;
+ while(rh != rl)
+ {
+ j = rl + (rh-rl)/2;
+ if (r < cumulPoisson[j])
+ {
+ rh = j;
+ continue;
+ }
+ if (r > cumulPoisson[j])
+ {
+ rl = j+1;
+ continue;
+ }
+ break;
+ }
+ j = rh;
+
+ return j;
+}
+
+
+inline int MTRand::drawGamma()
+{
+ int j;
+
+ float r = frand();
+
+ int rl = 0;
+ int rh = accuracyGamma-1;
+ while(rh != rl)
+ {
+ j = rl + (rh-rl)/2;
+ if (r < cumulGamma[j])
+ {
+ rh = j;
+ continue;
+ }
+ if (r > cumulGamma[j])
+ {
+ rl = j+1;
+ continue;
+ }
+ break;
+ }
+ j = rh;
+
+ return j;
+}
+
+
+/*
+inline void MTRand::initPoisson(float mean,int accuracy)
+{
+ float p[accuracy];
+ float Z = exp(-mean);
+ p[0] = 1;
+ for (int i = 1; i < accuracy;i++)
+ p[i] = p[i-1]*mean/i;
+ for (int i = 0; i < accuracy;i++)
+ p[i] *= Z;
+
+ if (cumulPoisson != 0)
+ free(cumulPoisson);
+
+ cumulPoisson = (float*) malloc(sizeof(float)*accuracy);
+ cumulPoisson[0] = p[0];
+ for (int i = 1; i < accuracy;i++)
+ cumulPoisson[i] = cumulPoisson[i-1]+p[i];
+ for (int i = 0; i < accuracy;i++)
+ cumulPoisson[i] = cumulPoisson[i]/cumulPoisson[accuracy-1];
+
+ accuracyPoisson = accuracy;
+
+
+}
+
+
+
+
+
+inline void MTRand::initGamma(float theta,int k)
+{
+ int accuracy = int(k*theta*5);
+
+ float p[accuracy];
+ int fac = 1;
+ for (int i = 1; i < k-1;i++)
+ fac *= i;
+
+ for (int i = 0; i < accuracy;i++)
+ {
+ p[i] = pow(i/theta,k-1)/fac * exp(i/theta);
+ }
+ if (cumulGamma != 0)
+ free(cumulGamma);
+
+ cumulGamma = (float*) malloc(sizeof(float)*accuracy);
+ cumulGamma[0] = p[0];
+ for (int i = 1; i < accuracy;i++)
+ cumulGamma[i] = cumulGamma[i-1]+p[i];
+ for (int i = 0; i < accuracy;i++)
+ cumulGamma[i] = cumulGamma[i]/cumulGamma[accuracy-1];
+
+ accuracyGamma = accuracy;
+
+
+}
+
+
+*/
+
+
+
+
+inline MTRand::uint32 MTRand::randInt()
+{
+ // Pull a 32-bit integer from the generator state
+ // Every other access function simply transforms the numbers extracted here
+
+ if( left == 0 ) reload();
+ --left;
+
+ register uint32 s1;
+ s1 = *pNext++;
+ s1 ^= (s1 >> 11);
+ s1 ^= (s1 << 7) & 0x9d2c5680UL;
+ s1 ^= (s1 << 15) & 0xefc60000UL;
+ return ( s1 ^ (s1 >> 18) );
+}
+
+inline MTRand::uint32 MTRand::randInt( const uint32& n )
+{
+ // Find which bits are used in n
+ // Optimized by Magnus Jonsson (magnus@smartelectronix.com)
+ uint32 used = n;
+ used |= used >> 1;
+ used |= used >> 2;
+ used |= used >> 4;
+ used |= used >> 8;
+ used |= used >> 16;
+
+ // Draw numbers until one is found in [0,n]
+ uint32 i;
+ do
+ i = randInt() & used; // toss unused bits to shorten search
+ while( i > n );
+ return i;
+}
+
+
+inline void MTRand::seed( const uint32 oneSeed )
+{
+ // Seed the generator with a simple uint32
+ initialize(oneSeed);
+ reload();
+}
+
+
+inline void MTRand::seed( uint32 *const bigSeed, const uint32 seedLength )
+{
+ // Seed the generator with an array of uint32's
+ // There are 2^19937-1 possible initial states. This function allows
+ // all of those to be accessed by providing at least 19937 bits (with a
+ // default seed length of N = 624 uint32's). Any bits above the lower 32
+ // in each element are discarded.
+ // Just call seed() if you want to get array from /dev/urandom
+ initialize(19650218UL);
+ register int i = 1;
+ register uint32 j = 0;
+ register int k = ( N > seedLength ? N : seedLength );
+ for( ; k; --k )
+ {
+ state[i] =
+ state[i] ^ ( (state[i-1] ^ (state[i-1] >> 30)) * 1664525UL );
+ state[i] += ( bigSeed[j] & 0xffffffffUL ) + j;
+ state[i] &= 0xffffffffUL;
+ ++i; ++j;
+ if( i >= N ) { state[0] = state[N-1]; i = 1; }
+ if( j >= seedLength ) j = 0;
+ }
+ for( k = N - 1; k; --k )
+ {
+ state[i] =
+ state[i] ^ ( (state[i-1] ^ (state[i-1] >> 30)) * 1566083941UL );
+ state[i] -= i;
+ state[i] &= 0xffffffffUL;
+ ++i;
+ if( i >= N ) { state[0] = state[N-1]; i = 1; }
+ }
+ state[0] = 0x80000000UL; // MSB is 1, assuring non-zero initial array
+ reload();
+}
+
+
+inline void MTRand::seed()
+{
+ // Seed the generator with an array from /dev/urandom if available
+ // Otherwise use a hash of time() and clock() values
+
+ // First try getting an array from /dev/urandom
+ FILE* urandom = fopen( "/dev/urandom", "rb" );
+ if( urandom )
+ {
+ uint32 bigSeed[N];
+ register uint32 *s = bigSeed;
+ register int i = N;
+ register bool success = true;
+ while( success && i-- )
+ success = fread( s++, sizeof(uint32), 1, urandom );
+ fclose(urandom);
+ if( success ) { seed( bigSeed, N ); return; }
+ }
+
+ // Was not successful, so use time() and clock() instead
+ seed( hash( time(NULL), clock() ) );
+}
+
+
+inline void MTRand::initialize( const uint32 seed )
+{
+ // Initialize generator state with seed
+ // See Knuth TAOCP Vol 2, 3rd Ed, p.106 for multiplier.
+ // In previous versions, most significant bits (MSBs) of the seed affect
+ // only MSBs of the state array. Modified 9 Jan 2002 by Makoto Matsumoto.
+ register uint32 *s = state;
+ register uint32 *r = state;
+ register int i = 1;
+ *s++ = seed & 0xffffffffUL;
+ for( ; i < N; ++i )
+ {
+ *s++ = ( 1812433253UL * ( *r ^ (*r >> 30) ) + i ) & 0xffffffffUL;
+ r++;
+ }
+}
+
+
+inline void MTRand::reload()
+{
+ // Generate N new values in state
+ // Made clearer and faster by Matthew Bellew (matthew.bellew@home.com)
+ register uint32 *p = state;
+ register int i;
+ for( i = N - M; i--; ++p )
+ *p = twist( p[M], p[0], p[1] );
+ for( i = M; --i; ++p )
+ *p = twist( p[M-N], p[0], p[1] );
+ *p = twist( p[M-N], p[0], state[0] );
+
+ left = N, pNext = state;
+}
+
+
+inline MTRand::uint32 MTRand::hash( time_t t, clock_t c )
+{
+ // Get a uint32 from t and c
+ // Better than uint32(x) in case x is floating point in [0,1]
+ // Based on code by Lawrence Kirby (fred@genesis.demon.co.uk)
+
+ static uint32 differ = 0; // guarantee time-based seeds will change
+
+ uint32 h1 = 0;
+ unsigned char *p = (unsigned char *) &t;
+ for( size_t i = 0; i < sizeof(t); ++i )
+ {
+ h1 *= UCHAR_MAX + 2U;
+ h1 += p[i];
+ }
+ uint32 h2 = 0;
+ p = (unsigned char *) &c;
+ for( size_t j = 0; j < sizeof(c); ++j )
+ {
+ h2 *= UCHAR_MAX + 2U;
+ h2 += p[j];
+ }
+ return ( h1 + differ++ ) ^ h2;
+}
+
+
+inline void MTRand::save( uint32* saveArray ) const
+{
+ register uint32 *sa = saveArray;
+ register const uint32 *s = state;
+ register int i = N;
+ for( ; i--; *sa++ = *s++ ) {}
+ *sa = left;
+}
+
+
+inline void MTRand::load( uint32 *const loadArray )
+{
+ register uint32 *s = state;
+ register uint32 *la = loadArray;
+ register int i = N;
+ for( ; i--; *s++ = *la++ ) {}
+ left = *la;
+ pNext = &state[N-left];
+}
+
+
+inline std::ostream& operator<<( std::ostream& os, const MTRand& mtrand )
+{
+ register const MTRand::uint32 *s = mtrand.state;
+ register int i = mtrand.N;
+ for( ; i--; os << *s++ << "\t" ) {}
+ return os << mtrand.left;
+}
+
+
+inline std::istream& operator>>( std::istream& is, MTRand& mtrand )
+{
+ register MTRand::uint32 *s = mtrand.state;
+ register int i = mtrand.N;
+ for( ; i--; is >> *s++ ) {}
+ is >> mtrand.left;
+ mtrand.pNext = &mtrand.state[mtrand.N-mtrand.left];
+ return is;
+}
+
+#endif // MERSENNETWISTER_H
+
+// Change log:
+//
+// v0.1 - First release on 15 May 2000
+// - Based on code by Makoto Matsumoto, Takuji Nishimura, and Shawn Cokus
+// - Translated from C to C++
+// - Made completely ANSI compliant
+// - Designed convenient interface for initialization, seeding, and
+// obtaining numbers in default or user-defined ranges
+// - Added automatic seeding from /dev/urandom or time() and clock()
+// - Provided functions for saving and loading generator state
+//
+// v0.2 - Fixed bug which reloaded generator one step too late
+//
+// v0.3 - Switched to clearer, faster reload() code from Matthew Bellew
+//
+// v0.4 - Removed trailing newline in saved generator format to be consistent
+// with output format of built-in types
+//
+// v0.5 - Improved portability by replacing static const int's with enum's and
+// clarifying return values in seed(); suggested by Eric Heimburg
+// - Removed MAXINT constant; use 0xffffffffUL instead
+//
+// v0.6 - Eliminated seed overflow when uint32 is larger than 32 bits
+// - Changed integer [0,n] generator to give better uniformity
+//
+// v0.7 - Fixed operator precedence ambiguity in reload()
+// - Added access for real numbers in (0,1) and (0,n)
+//
+// v0.8 - Included time.h header to properly support time_t and clock_t
+//
+// v1.0 - Revised seeding to match 26 Jan 2002 update of Nishimura and Matsumoto
+// - Allowed for seeding with arrays of any length
+// - Added access for real numbers in [0,1) with 53-bit resolution
+// - Added access for real numbers from normal (Gaussian) distributions
+// - Increased overall speed by optimizing twist()
+// - Doubled speed of integer [0,n] generation
+// - Fixed out-of-range number generation on 64-bit machines
+// - Improved portability by substituting literal constants for long enum's
+// - Changed license from GNU LGPL to BSD
diff --git a/Modules/DiffusionImaging/Tractography/GlobalTracking/ParticleGrid.cpp b/Modules/DiffusionImaging/Tractography/GlobalTracking/ParticleGrid.cpp
new file mode 100644
index 0000000000..babd7b47fd
--- /dev/null
+++ b/Modules/DiffusionImaging/Tractography/GlobalTracking/ParticleGrid.cpp
@@ -0,0 +1,611 @@
+
+
+
+#ifndef _PARTICLEGRID
+#define _PARTICLEGRID
+
+
+#include "auxilary_classes.cpp"
+
+
+template <class T>
+ class ParticleGrid
+{
+
+ //////////////// Container
+public:
+ T *particles; // particles in linear array
+ int pcnt; // actual number of particles
+ int concnt; // number of connections
+ int celloverflows;
+
+ T **ID_2_address;
+
+private:
+
+ int capacity; // maximal number of particles
+ int increase_step;
+
+ /////////////////// Grid
+
+ T **grid; // the grid
+
+ // grid size
+ int nx;
+ int ny;
+ int nz;
+
+ // scaling factor for grid
+ float mulx;
+ float muly;
+ float mulz;
+
+ int csize; // particle capacity of single cell in grid
+ int *occnt; // occupation count of grid cells
+ int gridsize; // total number of cells
+ float m_Memory;
+
+ struct NeighborTracker // to run over the neighbors
+ {
+ int cellidx[8];
+ int cellidx_c[8];
+
+ int cellcnt;
+ int pcnt;
+
+ } nbtrack;
+
+
+
+public:
+
+
+ ParticleGrid()
+ {
+
+ //// involving the container
+ capacity = 0;
+ particles = 0;
+ ID_2_address = 0;
+ pcnt = 0;
+ concnt = 0;
+ celloverflows = 0;
+
+ ////// involvin the grid
+ nx = 0; ny = 0; nz = 0; csize = 0;
+ gridsize = 0;
+ grid = (T**) 0;
+ occnt = (int*) 0;
+
+ increase_step = 100000;
+ m_Memory = 0;
+ }
+
+ float GetMemoryUsage()
+ {
+ return m_Memory;
+ }
+
+ int allocate(int _capacity,
+ int _nx, int _ny, int _nz, float cellsize, int cellcapacity)
+ {
+ //// involving the container
+ capacity = _capacity;
+ particles = (T*) malloc(sizeof(T)*capacity);
+ ID_2_address = (T**) malloc(sizeof(T*)*capacity);
+
+ if (particles == 0 || ID_2_address == 0)
+ {
+ fprintf(stderr,"error: Out of Memory\n");
+ capacity = 0;
+ return -1;
+ }
+ else
+ {
+ fprintf(stderr,"Allocated Memory for %i particles \n",capacity);
+ }
+
+ pcnt = 0;
+ int i;
+ for (i = 0;i < capacity;i++)
+ {
+ ID_2_address[i] = &(particles[i]); // initialize pointer in LUT
+ particles[i].ID = i; // initialize unique IDs
+ }
+
+ ////// involvin the grid
+ nx = _nx; ny = _ny; nz = _nz; csize = cellcapacity;
+ gridsize = nx*ny*nz;
+
+ m_Memory = (float)(sizeof(T*)*gridsize*csize)/1000000;
+
+ grid = (T**) malloc(sizeof(T*)*gridsize*csize);
+ occnt = (int*) malloc(sizeof(int)*gridsize);
+
+ if (grid == 0 || occnt == 0)
+ {
+ fprintf(stderr,"error: Out of Memory\n");
+ capacity = 0;
+ return -1;
+ }
+
+ for (i = 0;i < gridsize;i++)
+ occnt[i] = 0;
+
+ mulx = 1/cellsize;
+ muly = 1/cellsize;
+ mulz = 1/cellsize;
+
+ return 1;
+ }
+
+
+
+ int reallocate()
+ {
+ int new_capacity = capacity + increase_step;
+ T* new_particles = (T*) realloc(particles,sizeof(T)*new_capacity);
+ T** new_ID_2_address = (T**) realloc(ID_2_address,sizeof(T*)*new_capacity);
+ if (new_particles == 0 || new_ID_2_address == 0)
+ {
+ fprintf(stderr,"ParticleGird:reallocate: out of memory!\n");
+ return -1;
+ }
+ fprintf(stderr," now %i particles are allocated \n",new_capacity);
+ m_Memory = (float)(sizeof(T*)*new_capacity)/1000000;
+
+ int i;
+ for (i = 0; i < capacity; i++)
+ {
+ new_ID_2_address[i] = new_ID_2_address[i] - particles + new_particles; // shift address
+ }
+ for (i = capacity; i < new_capacity; i++)
+ {
+ new_particles[i].ID = i; // initialize unique IDs
+ new_ID_2_address[i] = &(new_particles[i]) ; // initliaze pointer in LUT
+ }
+ for (i = 0; i < nx*ny*nz*csize; i++)
+ {
+ grid[i] = grid[i] - particles + new_particles;
+ }
+ particles = new_particles;
+ ID_2_address = new_ID_2_address;
+ capacity = new_capacity;
+
+ return 1;
+ }
+
+
+
+ ~ParticleGrid()
+ {
+ if (particles != 0)
+ free(particles);
+ if (grid != 0)
+ free(grid);
+ if (occnt != 0)
+ free(occnt);
+ if (ID_2_address != 0)
+ free(ID_2_address);
+ }
+
+
+
+ int ID_2_index(int ID)
+ {
+ if (ID == -1)
+ return -1;
+ else
+ return (ID_2_address[ID] - particles);
+
+ }
+
+
+ T* newParticle(pVector R)
+ {
+ /////// get free place in container;
+ if (pcnt >= capacity)
+ {
+ fprintf(stderr,"capacity overflow , reallocating ...\n");
+ if (reallocate() == -1)
+ {
+ fprintf(stderr,"out of Memory!!\n");
+ return 0;
+ }
+ }
+
+ int xint = int(R[0]*mulx);
+ if (xint < 0) { //fprintf(stderr,"error: out of grid\n");
+ return 0;}
+ if (xint >= nx) { // fprintf(stderr,"error: out of grid\n");
+ return 0;}
+ int yint = int(R[1]*muly);
+ if (yint < 0) { //fprintf(stderr,"error: out of grid\n");
+ return 0;}
+ if (yint >= ny) {// fprintf(stderr,"error: out of grid\n");
+ return 0;}
+ int zint = int(R[2]*mulz);
+ if (zint < 0) {// fprintf(stderr,"error: out of grid\n");
+ return 0;}
+ if (zint >= nz) { //fprintf(stderr,"error: out of grid\n");
+ return 0;}
+
+ int idx = xint + nx*(yint + ny*zint);
+ if (occnt[idx] < csize)
+ {
+ T *p = &(particles[pcnt]);
+ p->R = R;
+ p->mID = -1;
+ p->pID = -1;
+ pcnt++;
+ p->gridindex = csize*idx + occnt[idx];
+ grid[p->gridindex] = p;
+ occnt[idx]++;
+ return p;
+ }
+ else
+ {
+ celloverflows++;
+ //fprintf(stderr,"error: cell overflow \n");
+ return 0;
+ }
+ }
+
+
+ inline void updateGrid(int k)
+ {
+ T* p = &(particles[k]);
+
+ /////// find new grid cell
+ int xint = int(p->R[0]*mulx);
+ if (xint < 0) { remove(k); return; }
+ if (xint >= nx) { remove(k); return; }
+ int yint = int(p->R[1]*muly);
+ if (yint < 0) { remove(k); return; }
+ if (yint >= ny) { remove(k); return; }
+ int zint = int(p->R[2]*mulz);
+ if (zint < 0) { remove(k); return; }
+ if (zint >= nz) { remove(k); return; }
+
+
+ int idx = xint + nx*(yint+ zint*ny);
+ int cellidx = p->gridindex/csize;
+ if (idx != cellidx) // cell has changed
+ {
+
+ if (occnt[idx] < csize)
+ {
+ // remove from old position in grid;
+ int grdindex = p->gridindex;
+ grid[grdindex] = grid[cellidx*csize + occnt[cellidx]-1];
+ grid[grdindex]->gridindex = grdindex;
+ occnt[cellidx]--;
+
+ // insert at new position in grid
+ p->gridindex = idx*csize + occnt[idx];
+ grid[p->gridindex] = p;
+ occnt[idx]++;
+ }
+ else
+ remove(k);
+
+ }
+ }
+
+
+ inline bool tryUpdateGrid(int k)
+ {
+ T* p = &(particles[k]);
+
+ /////// find new grid cell
+ int xint = int(p->R[0]*mulx);
+ if (xint < 0) { return false; }
+ if (xint >= nx) { return false; }
+ int yint = int(p->R[1]*muly);
+ if (yint < 0) { return false; }
+ if (yint >= ny) { return false; }
+ int zint = int(p->R[2]*mulz);
+ if (zint < 0) { return false; }
+ if (zint >= nz) { return false; }
+
+
+ int idx = xint + nx*(yint+ zint*ny);
+ int cellidx = p->gridindex/csize;
+ if (idx != cellidx) // cell has changed
+ {
+
+ if (occnt[idx] < csize)
+ {
+ // remove from old position in grid;
+ int grdindex = p->gridindex;
+ grid[grdindex] = grid[cellidx*csize + occnt[cellidx]-1];
+ grid[grdindex]->gridindex = grdindex;
+ occnt[cellidx]--;
+
+ // insert at new position in grid
+ p->gridindex = idx*csize + occnt[idx];
+ grid[p->gridindex] = p;
+ occnt[idx]++;
+ return true;
+ }
+ else
+ return false;
+
+ }
+ return true;
+ }
+
+
+
+ inline void remove(int k)
+ {
+ T* p = &(particles[k]);
+ int grdindex = p->gridindex;
+ int cellidx = grdindex/csize;
+ int idx = grdindex%csize;
+
+ // remove pending connections
+ if (p->mID != -1)
+ destroyConnection(p,-1);
+ if (p->pID != -1)
+ destroyConnection(p,+1);
+
+ // remove from grid
+ if (idx < occnt[cellidx]-1)
+ {
+ grid[grdindex] = grid[cellidx*csize + occnt[cellidx]-1];
+ grid[grdindex]->gridindex = grdindex;
+ }
+ occnt[cellidx]--;
+
+
+
+ // remove from container
+ if (k<pcnt-1)
+ {
+ int todel_ID = p->ID;
+ int move_ID = particles[pcnt-1].ID;
+
+ *p = particles[pcnt-1]; // move very last particle to empty slot
+ particles[pcnt-1].ID = todel_ID; // keep IDs unique
+ grid[p->gridindex] = p; // keep gridindex consistent
+
+ // permute address table
+ ID_2_address[todel_ID] = &(particles[pcnt-1]);
+ ID_2_address[move_ID] = p;
+
+ }
+ pcnt--;
+
+
+
+ }
+
+ inline void computeNeighbors(pVector &R)
+ {
+ float xfrac = R.GetX()*mulx;
+ float yfrac = R.GetY()*muly;
+ float zfrac = R.GetZ()*mulz;
+ int xint = int(xfrac);
+ int yint = int(yfrac);
+ int zint = int(zfrac);
+
+ int dx = -1;
+ if (xfrac-xint > 0.5) dx = 1;
+ if (xint <= 0) { xint = 0; dx = 1; }
+ if (xint >= nx-1) { xint = nx-1; dx = -1; }
+
+ int dy = -1;
+ if (yfrac-yint > 0.5) dy = 1;
+ if (yint <= 0) {yint = 0; dy = 1; }
+ if (yint >= ny-1) {yint = ny-1; dy = -1;}
+
+ int dz = -1;
+ if (zfrac-zint > 0.5) dz = 1;
+ if (zint <= 0) {zint = 0; dz = 1; }
+ if (zint >= nz-1) {zint = nz-1; dz = -1;}
+
+
+ nbtrack.cellidx[0] = xint + nx*(yint+zint*ny);
+ nbtrack.cellidx[1] = nbtrack.cellidx[0] + dx;
+ nbtrack.cellidx[2] = nbtrack.cellidx[1] + dy*nx;
+ nbtrack.cellidx[3] = nbtrack.cellidx[2] - dx;
+ nbtrack.cellidx[4] = nbtrack.cellidx[0] + dz*nx*ny;
+ nbtrack.cellidx[5] = nbtrack.cellidx[4] + dx;
+ nbtrack.cellidx[6] = nbtrack.cellidx[5] + dy*nx;
+ nbtrack.cellidx[7] = nbtrack.cellidx[6] - dx;
+
+
+ nbtrack.cellidx_c[0] = csize*nbtrack.cellidx[0];
+ nbtrack.cellidx_c[1] = csize*nbtrack.cellidx[1];
+ nbtrack.cellidx_c[2] = csize*nbtrack.cellidx[2];
+ nbtrack.cellidx_c[3] = csize*nbtrack.cellidx[3];
+ nbtrack.cellidx_c[4] = csize*nbtrack.cellidx[4];
+ nbtrack.cellidx_c[5] = csize*nbtrack.cellidx[5];
+ nbtrack.cellidx_c[6] = csize*nbtrack.cellidx[6];
+ nbtrack.cellidx_c[7] = csize*nbtrack.cellidx[7];
+
+
+
+ nbtrack.cellcnt = 0;
+ nbtrack.pcnt = 0;
+
+ }
+
+
+
+ inline T *getNextNeighbor()
+ {
+
+ if (nbtrack.pcnt < occnt[nbtrack.cellidx[nbtrack.cellcnt]])
+ {
+
+ return grid[nbtrack.cellidx_c[nbtrack.cellcnt] + (nbtrack.pcnt++)];
+
+ }
+ else
+ {
+
+ for(;;)
+ {
+ nbtrack.cellcnt++;
+ if (nbtrack.cellcnt >= 8)
+ return 0;
+ if (occnt[nbtrack.cellidx[nbtrack.cellcnt]] > 0)
+ break;
+ }
+
+ nbtrack.pcnt = 1;
+ return grid[nbtrack.cellidx_c[nbtrack.cellcnt]];
+ }
+ }
+
+
+ inline void createConnection(T *P1,int ep1, T *P2, int ep2)
+ {
+ if (ep1 == -1)
+ P1->mID = P2->ID;
+ else
+ P1->pID = P2->ID;
+
+ if (ep2 == -1)
+ P2->mID = P1->ID;
+ else
+ P2->pID = P1->ID;
+
+ concnt++;
+ }
+
+ inline void destroyConnection(T *P1,int ep1, T *P2, int ep2)
+ {
+ if (ep1 == -1)
+ P1->mID = -1;
+ else
+ P1->pID = -1;
+
+ if (ep2 == -1)
+ P2->mID = -1;
+ else
+ P2->pID = -1;
+ concnt--;
+ }
+
+ inline void destroyConnection(T *P1,int ep1)
+ {
+
+ T *P2 = 0;
+ int ep2;
+ if (ep1 == 1)
+ {
+ P2 = ID_2_address[P1->pID];
+ P1->pID = -1;
+ }
+ else
+ {
+ P2 = ID_2_address[P1->mID];
+ P1->mID = -1;
+ }
+ if (P2->mID == P1->ID)
+ {
+ P2->mID = -1;
+ }
+ else
+ {
+ P2->pID = -1;
+ }
+ concnt--;
+
+ }
+};
+
+
+
+
+/*
+
+
+struct Connection
+{
+ int lID;
+ int rID;
+};
+
+
+class ConnectionContainer
+{
+
+ //////////////// Container
+public:
+ Connection *cons; // cons in linear array
+ int ccnt; // actual number of cons
+
+private:
+
+ int capacity; // maximal number of particles
+
+
+
+public:
+
+
+ ConnectionContainer()
+ {
+
+ //// involving the container
+ capacity = 0;
+ cons = 0;
+ ccnt = 0;
+
+ }
+
+
+
+ void allocate(int _capacity)
+ {
+
+ //// involving the container
+ capacity = _capacity;
+ cons = (Connection*) malloc(sizeof(Connection)*capacity);
+ ccnt = 0;
+
+ }
+
+ ~ConnectionContainer()
+ {
+ if (cons != 0)
+ free(cons);
+ }
+
+
+ Connection* newConnection(int lid,int rid)
+ {
+ /////// get free place in container;
+ if (ccnt < capacity)
+ {
+ Connection *c = &(cons[ccnt]);
+ c->lID = lid;
+ c->rID = rid;
+ ccnt++;
+ return c;
+ }
+ return 0;
+ }
+
+ inline void remove(int k)
+ {
+ Connection* c = &(cons[k]);
+
+ // remove from container
+ if (k<ccnt-1)
+ {
+ *c = cons[ccnt-1];
+ }
+ ccnt--;
+
+ }
+};
+
+
+*/
+
+#endif
diff --git a/Modules/DiffusionImaging/Tractography/GlobalTracking/RJMCMCBase.cpp b/Modules/DiffusionImaging/Tractography/GlobalTracking/RJMCMCBase.cpp
new file mode 100644
index 0000000000..238bc6c6cf
--- /dev/null
+++ b/Modules/DiffusionImaging/Tractography/GlobalTracking/RJMCMCBase.cpp
@@ -0,0 +1,136 @@
+
+#include "ParticleGrid.cpp"
+#include <vector>
+#include "MersenneTwister.h"
+
+class RJMCMCBase
+{
+public:
+
+ ParticleGrid<Particle> m_ParticleGrid;
+ float *m_QBallImageData;
+ const int *datasz;
+ EnergyComputerBase *enc;
+ int m_Iterations;
+ float width;
+ float height;
+ float depth;
+ double *voxsize;
+ int m_NumAttributes;
+ int m_AcceptedProposals;
+
+ RJMCMCBase(float *points,int numPoints, float *dimg, const int *dsz, double *voxsize, double cellsize)
+ : m_QBallImageData(dimg)
+ , datasz(dsz)
+ , enc(0)
+ , width(dsz[0]*voxsize[0])
+ , height(dsz[1]*voxsize[1])
+ , depth(dsz[2]*voxsize[2])
+ , voxsize(voxsize)
+ , m_NumAttributes(0)
+ , m_AcceptedProposals(0)
+ {
+ fprintf(stderr,"Data dimensions (mm) : %f x %f x %f\n",width,height,depth);
+ fprintf(stderr,"Data dimensions (voxel) : %i x %i x %i\n",datasz[0],datasz[1],datasz[2]);
+ fprintf(stderr,"voxel size (mm) : %lf x %lf x %lf\n",voxsize[0],voxsize[1],voxsize[2]);
+
+ float cellcnt_x = (int)((float)width/cellsize) +1;
+ float cellcnt_y = (int)((float)height/cellsize) +1;
+ float cellcnt_z = (int)((float)depth/cellsize) +1;
+ //int cell_capacity = 2048;
+ int cell_capacity = 64;
+
+ fprintf(stderr,"grid dimensions : %f x %f x %f\n",cellcnt_x,cellcnt_y,cellcnt_z);
+ fprintf(stderr,"grid cell size (mm) : %f^3\n",cellsize);
+ fprintf(stderr,"cell capacity : %i\n",cell_capacity);
+ fprintf(stderr,"#cells*cellcap : %.1f K\n",cell_capacity*cellcnt_x*cellcnt_y*cellcnt_z/1000);
+
+ int minsize = 1000000;
+ int err = m_ParticleGrid.allocate(((numPoints>minsize)? (numPoints+100000) : minsize), cellcnt_x, cellcnt_y, cellcnt_z, cellsize, cell_capacity);
+
+ if (err == -1)
+ {
+ fprintf(stderr,"RJMCMCBase: out of Memory!\n");
+ return;
+ }
+
+ m_NumAttributes = 10;
+ for (int k = 0; k < numPoints; k++)
+ {
+ Particle *p = m_ParticleGrid.newParticle(pVector(points[m_NumAttributes*k], points[m_NumAttributes*k+1],points[m_NumAttributes*k+2]));
+ if (p!=0)
+ {
+ p->N = pVector(points[m_NumAttributes*k+3],points[m_NumAttributes*k+4],points[m_NumAttributes*k+5]);
+ p->cap = points[m_NumAttributes*k+6];
+ p->len = points[m_NumAttributes*k+7];
+ p->mID = (int) points[m_NumAttributes*k+8];
+ p->pID = (int) points[m_NumAttributes*k+9];
+ if (p->mID != -1)
+ m_ParticleGrid.concnt++;
+ if (p->pID != -1)
+ m_ParticleGrid.concnt++;
+ p->label = 0;
+ }
+ else
+ {
+ fprintf(stderr,"error: cannot allocate particle, con. indices will be wrong! \n");
+ }
+ }
+ m_ParticleGrid.concnt /= 2;
+
+ m_Iterations = 0;
+ m_AcceptedProposals = 0;
+ }
+
+ ~RJMCMCBase()
+ {
+
+ }
+
+ void WriteOutParticles(float *npoints)
+ {
+ for (int k = 0; k < m_ParticleGrid.pcnt; k++)
+ {
+ Particle *p = &(m_ParticleGrid.particles[k]);
+ npoints[m_NumAttributes*k] = p->R.GetX();
+ npoints[m_NumAttributes*k+1] = p->R.GetY();
+ npoints[m_NumAttributes*k+2] = p->R.GetZ();
+ npoints[m_NumAttributes*k+3] = p->N.GetX();
+ npoints[m_NumAttributes*k+4] = p->N.GetY();
+ npoints[m_NumAttributes*k+5] = p->N.GetZ();
+ npoints[m_NumAttributes*k+6] = p->cap;
+ npoints[m_NumAttributes*k+7] = p->len;
+ npoints[m_NumAttributes*k+8] = m_ParticleGrid.ID_2_index(p->mID);
+ npoints[m_NumAttributes*k+9] = m_ParticleGrid.ID_2_index(p->pID);
+ }
+ }
+
+ void SetEnergyComputer(EnergyComputerBase *e)
+ {
+ enc = e;
+ }
+
+ void Iterate(float* acceptance, unsigned long* numCon, unsigned long* numPart, bool *abort)
+ {
+ m_AcceptedProposals = 0;
+ for (int it = 0; it < m_Iterations;it++)
+ {
+ if (*abort)
+ break;
+
+ IterateOneStep();
+
+ *numCon = m_ParticleGrid.concnt;
+ *numPart = m_ParticleGrid.pcnt;
+ }
+ *acceptance = (float)m_AcceptedProposals/m_Iterations;
+ }
+
+ virtual void IterateOneStep()
+ {
+
+ }
+};
+
+
+
diff --git a/Modules/DiffusionImaging/Tractography/GlobalTracking/RJMCMC_randshift.cpp b/Modules/DiffusionImaging/Tractography/GlobalTracking/RJMCMC_randshift.cpp
new file mode 100644
index 0000000000..0b83f23287
--- /dev/null
+++ b/Modules/DiffusionImaging/Tractography/GlobalTracking/RJMCMC_randshift.cpp
@@ -0,0 +1,618 @@
+
+#include "ParticleGrid.cpp"
+#include "RJMCMCBase.cpp"
+#include <fstream>
+
+class RJMCMC : public RJMCMCBase
+{
+public:
+
+ float T_in ;
+ float T_ex ;
+ float dens;
+
+
+ float p_birth;
+ float p_death;
+ float p_shift;
+ float p_shiftopt;
+ float p_cap;
+ float p_con;
+
+
+
+ float sigma_g;
+ float gamma_g;
+ float Z_g;
+
+ float dthres;
+ float nthres;
+ float T_prop;
+ float stopprobability;
+ float del_prob;
+
+
+
+ float len_def;
+ float len_sig;
+
+ float cap_def;
+ float cap_sig;
+
+ float externalEnergy;
+ float internalEnergy;
+
+ float m_ChempotParticle;
+
+
+ Track TrackProposal, TrackBackup;
+
+
+ SimpSamp<EndPoint> simpsamp;
+
+
+ RJMCMC(float *points,int numPoints, float *dimg, const int *dsz, double *voxsz, double cellsz) : RJMCMCBase(points,numPoints,dimg,dsz,voxsz,cellsz)
+ {
+ externalEnergy = 0;
+ internalEnergy = 0;
+ }
+
+ void SetParameters(float Temp, int numit, float plen, float curv_hardthres, float chempot_particle)
+ {
+ m_Iterations = numit;
+
+ p_birth = 0.25;
+ p_death = 0.05;
+ p_shift = 0.15;
+ p_shiftopt = 0.1;
+ p_con = 0.45;
+ p_cap = 0.0;
+
+ m_ChempotParticle = chempot_particle;
+
+ float sum = p_birth+p_death+p_shift+p_shiftopt+p_con;
+ p_birth /= sum; p_death /= sum; p_shift /= sum; p_shiftopt /= sum;
+
+ T_in = Temp;
+ T_ex = 0.01;
+ dens = exp(-chempot_particle/T_in);
+
+ len_def = plen;
+ len_sig = 0.0;
+ cap_def = 1.0;
+ cap_sig = 0.0;
+
+ // shift proposal
+ sigma_g = len_def/8.0;
+ gamma_g = 1/(sigma_g*sigma_g*2);
+ Z_g = pow(2*PI*sigma_g,3.0/2.0)*(PI*sigma_g/len_def);
+
+ // conn proposal
+ dthres = len_def;
+ nthres = curv_hardthres;
+ T_prop = 0.5;
+ dthres *= dthres;
+ stopprobability = exp(-1/T_prop);
+ del_prob = 0.1;
+ }
+
+ void SetTemperature(float temp)
+ {
+ T_in = temp;
+ dens = exp(-m_ChempotParticle/T_in);
+ }
+
+ void IterateOneStep()
+ {
+ float randnum = mtrand.frand();
+ //randnum = 0;
+
+ ///////////////////////////////////////////////////////////////
+ //////// Birth Proposal
+ ///////////////////////////////////////////////////////////////
+ if (randnum < p_birth)
+ {
+
+#ifdef TIMING
+ tic(&birthproposal_time);
+ birthstats.propose();
+#endif
+
+ pVector R;
+ enc->drawSpatPosition(&R);
+ //R.setXYZ(20.5*3, 35.5*3, 1.5*3);
+
+ pVector N; N.rand_sphere();
+ //N.setXYZ(1,0,0);
+ float cap = cap_def - cap_sig*mtrand.frand();
+ float len = len_def;// + len_sig*(mtrand.frand()-0.5);
+ Particle prop;
+ prop.R = R;
+ prop.N = N;
+ prop.cap = cap;
+ prop.len = len;
+
+
+ float prob = dens * p_death /((p_birth)*(m_ParticleGrid.pcnt+1));
+
+ float ex_energy = enc->computeExternalEnergy(R,N,cap,len,0);
+ float in_energy = enc->computeInternalEnergy(&prop);
+
+ prob *= exp((in_energy/T_in+ex_energy/T_ex)) ;
+
+ if (prob > 1 || mtrand.frand() < prob)
+ {
+ Particle *p = m_ParticleGrid.newParticle(R);
+ if (p!=0)
+ {
+ p->R = R;
+ p->N = N;
+ p->cap = cap;
+ p->len = len;
+#ifdef TIMING
+ birthstats.accepted();
+#endif
+ m_AcceptedProposals++;
+ }
+ }
+
+#ifdef TIMING
+ toc(&birthproposal_time);
+#endif
+ }
+ ///////////////////////////////////////////////////////////////
+ //////// Death Proposal
+ ///////////////////////////////////////////////////////////////
+ else if (randnum < p_birth+p_death)
+ {
+ if (m_ParticleGrid.pcnt > 0)
+ {
+#ifdef TIMING
+ tic(&deathproposal_time);
+ deathstats.propose();
+#endif
+
+ int pnum = rand()%m_ParticleGrid.pcnt;
+ Particle *dp = &(m_ParticleGrid.particles[pnum]);
+ if (dp->pID == -1 && dp->mID == -1)
+ {
+
+ float ex_energy = enc->computeExternalEnergy(dp->R,dp->N,dp->cap,dp->len,dp);
+ float in_energy = enc->computeInternalEnergy(dp);
+
+ float prob = m_ParticleGrid.pcnt * (p_birth) /(dens*p_death); //*SpatProb(dp->R);
+ prob *= exp(-(in_energy/T_in+ex_energy/T_ex)) ;
+ if (prob > 1 || mtrand.frand() < prob)
+ {
+ m_ParticleGrid.remove(pnum);
+#ifdef TIMING
+ deathstats.accepted();
+#endif
+ m_AcceptedProposals++;
+ }
+ }
+#ifdef TIMING
+ toc(&deathproposal_time);
+#endif
+ }
+
+ }
+ ///////////////////////////////////////////////////////////////
+ //////// Cap change Proposal
+ ///////////////////////////////////////////////////////////////
+ else if (randnum < p_birth+p_death+p_cap)
+ {
+ if (m_ParticleGrid.pcnt > 0)
+ {
+
+ int pnum = rand()%m_ParticleGrid.pcnt;
+ Particle *p = &(m_ParticleGrid.particles[pnum]);
+ Particle prop_p = *p;
+
+ prop_p.cap = cap_def - cap_sig*mtrand.frand();
+
+ float ex_energy = enc->computeExternalEnergy(prop_p.R,prop_p.N,prop_p.cap,p->len,p)
+ - enc->computeExternalEnergy(p->R,p->N,p->cap,p->len,p);
+ //float in_energy = enc->computeExternalEnergy(prop_p.R,prop_p.N,p->cap,p->len,p)
+ // - enc->computeExternalEnergy(p->R,p->N,p->cap,p->len,p);
+ float prob = exp(ex_energy/T_ex);
+ // * SpatProb(p->R) / SpatProb(prop_p.R);
+ if (mtrand.frand() < prob)
+ {
+ p->cap = prop_p.cap;
+ m_AcceptedProposals++;
+ }
+
+ }
+
+ }
+
+ ///////////////////////////////////////////////////////////////
+ //////// Shift Proposal
+ ///////////////////////////////////////////////////////////////
+ else if (randnum < p_birth+p_death+p_shift+p_cap)
+ {
+ float energy = 0;
+ if (m_ParticleGrid.pcnt > 0)
+ {
+#ifdef TIMING
+ tic(&shiftproposal_time);
+ shiftstats.propose();
+#endif
+
+ int pnum = rand()%m_ParticleGrid.pcnt;
+ Particle *p = &(m_ParticleGrid.particles[pnum]);
+ Particle prop_p = *p;
+
+ prop_p.R.distortn(sigma_g);
+ prop_p.N.distortn(sigma_g/(2*p->len));
+ prop_p.N.normalize();
+
+
+ float ex_energy = enc->computeExternalEnergy(prop_p.R,prop_p.N,p->cap,p->len,p)
+ - enc->computeExternalEnergy(p->R,p->N,p->cap,p->len,p);
+ float in_energy = enc->computeInternalEnergy(&prop_p) - enc->computeInternalEnergy(p);
+
+ float prob = exp(ex_energy/T_ex+in_energy/T_in);
+ // * SpatProb(p->R) / SpatProb(prop_p.R);
+ if (mtrand.frand() < prob)
+ {
+ pVector Rtmp = p->R;
+ pVector Ntmp = p->N;
+ p->R = prop_p.R;
+ p->N = prop_p.N;
+ if (!m_ParticleGrid.tryUpdateGrid(pnum))
+ {
+ p->R = Rtmp;
+ p->N = Ntmp;
+ }
+#ifdef TIMING
+ shiftstats.accepted();
+#endif
+ m_AcceptedProposals++;
+ }
+
+#ifdef TIMING
+ toc(&shiftproposal_time);
+#endif
+
+ }
+
+ }
+ else if (randnum < p_birth+p_death+p_shift+p_shiftopt+p_cap)
+ {
+ float energy = 0;
+ if (m_ParticleGrid.pcnt > 0)
+ {
+
+ int pnum = rand()%m_ParticleGrid.pcnt;
+ Particle *p = &(m_ParticleGrid.particles[pnum]);
+
+ bool no_proposal = false;
+ Particle prop_p = *p;
+ if (p->pID != -1 && p->mID != -1)
+ {
+ Particle *plus = m_ParticleGrid.ID_2_address[p->pID];
+ int ep_plus = (plus->pID == p->ID)? 1 : -1;
+ Particle *minus = m_ParticleGrid.ID_2_address[p->mID];
+ int ep_minus = (minus->pID == p->ID)? 1 : -1;
+ prop_p.R = (plus->R + plus->N * (plus->len * ep_plus) + minus->R + minus->N * (minus->len * ep_minus))*0.5;
+ prop_p.N = plus->R - minus->R;
+ prop_p.N.normalize();
+ }
+ else if (p->pID != -1)
+ {
+ Particle *plus = m_ParticleGrid.ID_2_address[p->pID];
+ int ep_plus = (plus->pID == p->ID)? 1 : -1;
+ prop_p.R = plus->R + plus->N * (plus->len * ep_plus * 2);
+ prop_p.N = plus->N;
+ }
+ else if (p->mID != -1)
+ {
+ Particle *minus = m_ParticleGrid.ID_2_address[p->mID];
+ int ep_minus = (minus->pID == p->ID)? 1 : -1;
+ prop_p.R = minus->R + minus->N * (minus->len * ep_minus * 2);
+ prop_p.N = minus->N;
+ }
+ else
+ no_proposal = true;
+
+ if (!no_proposal)
+ {
+ float cos = prop_p.N*p->N;
+ float p_rev = exp(-((prop_p.R-p->R).norm_square() + (1-cos*cos))*gamma_g)/Z_g;
+
+ float ex_energy = enc->computeExternalEnergy(prop_p.R,prop_p.N,p->cap,p->len,p)
+ - enc->computeExternalEnergy(p->R,p->N,p->cap,p->len,p);
+ float in_energy = enc->computeInternalEnergy(&prop_p) - enc->computeInternalEnergy(p);
+
+ float prob = exp(ex_energy/T_ex+in_energy/T_in)*p_shift*p_rev/(p_shiftopt+p_shift*p_rev);
+ //* SpatProb(p->R) / SpatProb(prop_p.R);
+
+ if (mtrand.frand() < prob)
+ {
+ pVector Rtmp = p->R;
+ pVector Ntmp = p->N;
+ p->R = prop_p.R;
+ p->N = prop_p.N;
+ if (!m_ParticleGrid.tryUpdateGrid(pnum))
+ {
+ p->R = Rtmp;
+ p->N = Ntmp;
+ }
+ m_AcceptedProposals++;
+ }
+ }
+ }
+
+ }
+ else
+ {
+
+
+ if (m_ParticleGrid.pcnt > 0)
+ {
+
+#ifdef TIMING
+ tic(&connproposal_time);
+ connstats.propose();
+#endif
+
+ int pnum = rand()%m_ParticleGrid.pcnt;
+ Particle *p = &(m_ParticleGrid.particles[pnum]);
+
+ EndPoint P;
+ P.p = p;
+ P.ep = (mtrand.frand() > 0.5)? 1 : -1;
+
+ RemoveAndSaveTrack(P);
+ if (TrackBackup.proposal_probability != 0)
+ {
+ MakeTrackProposal(P);
+
+ float prob = (TrackProposal.energy-TrackBackup.energy)/T_in ;
+
+ // prob = exp(prob)*(TrackBackup.proposal_probability)
+ // /(TrackProposal.proposal_probability);
+ prob = exp(prob)*(TrackBackup.proposal_probability * pow(del_prob,TrackProposal.length))
+ /(TrackProposal.proposal_probability * pow(del_prob,TrackBackup.length));
+ if (mtrand.frand() < prob)
+ {
+ ImplementTrack(TrackProposal);
+#ifdef TIMING
+ connstats.accepted();
+#endif
+ m_AcceptedProposals++;
+ }
+ else
+ {
+ ImplementTrack(TrackBackup);
+ }
+ }
+ else
+ ImplementTrack(TrackBackup);
+
+#ifdef TIMING
+ toc(&connproposal_time);
+#endif
+ }
+ }
+ }
+
+
+ void ImplementTrack(Track &T)
+ {
+ for (int k = 1; k < T.length;k++)
+ {
+ m_ParticleGrid.createConnection(T.track[k-1].p,T.track[k-1].ep,T.track[k].p,-T.track[k].ep);
+ }
+ }
+
+
+
+ void RemoveAndSaveTrack(EndPoint P)
+ {
+ EndPoint Current = P;
+
+ int cnt = 0;
+ float energy = 0;
+ float AccumProb = 1.0;
+ TrackBackup.track[cnt] = Current;
+
+ EndPoint Next;
+
+
+
+ for (;;)
+ {
+ Next.p = 0;
+ if (Current.ep == 1)
+ {
+ if (Current.p->pID != -1)
+ {
+ Next.p = m_ParticleGrid.ID_2_address[Current.p->pID];
+ Current.p->pID = -1;
+ m_ParticleGrid.concnt--;
+ }
+ }
+ else if (Current.ep == -1)
+ {
+ if (Current.p->mID != -1)
+ {
+ Next.p = m_ParticleGrid.ID_2_address[Current.p->mID];
+ Current.p->mID = -1;
+ m_ParticleGrid.concnt--;
+ }
+ }
+ else
+ { fprintf(stderr,"RJMCMC_randshift: Connection inconsistent 3\n"); break; }
+
+ if (Next.p == 0) // no successor
+ {
+ Next.ep = 0; // mark as empty successor
+ break;
+ }
+ else
+ {
+ if (Next.p->pID == Current.p->ID)
+ {
+ Next.p->pID = -1;
+ Next.ep = 1;
+ }
+ else if (Next.p->mID == Current.p->ID)
+ {
+ Next.p->mID = -1;
+ Next.ep = -1;
+ }
+ else
+ { fprintf(stderr,"RJMCMC_randshift: Connection inconsistent 4\n"); break; }
+ }
+
+
+ ComputeEndPointProposalDistribution(Current);
+
+ AccumProb *= (simpsamp.probFor(Next));
+
+ if (Next.p == 0) // no successor -> break
+ break;
+
+ energy += enc->computeInternalEnergyConnection(Current.p,Current.ep,Next.p,Next.ep);
+
+ Current = Next;
+ Current.ep *= -1;
+ cnt++;
+ TrackBackup.track[cnt] = Current;
+
+
+ if (mtrand.rand() > del_prob)
+ {
+ break;
+ }
+
+ }
+ TrackBackup.energy = energy;
+ TrackBackup.proposal_probability = AccumProb;
+ TrackBackup.length = cnt+1;
+
+ }
+
+
+
+ void MakeTrackProposal(EndPoint P)
+ {
+ EndPoint Current = P;
+ int cnt = 0;
+ float energy = 0;
+ float AccumProb = 1.0;
+ TrackProposal.track[cnt++] = Current;
+ Current.p->label = 1;
+
+ for (;;)
+ {
+
+ // next candidate is already connected
+ if ((Current.ep == 1 && Current.p->pID != -1) || (Current.ep == -1 && Current.p->mID != -1))
+ break;
+
+ // track too long
+ if (cnt > 250)
+ break;
+
+ ComputeEndPointProposalDistribution(Current);
+
+ // // no candidates anymore
+ // if (simpsamp.isempty())
+ // break;
+
+ int k = simpsamp.draw();
+
+ // stop tracking proposed
+ if (k==0)
+ break;
+
+ EndPoint Next = simpsamp.objs[k];
+ float probability = simpsamp.probFor(k);
+
+ // accumulate energy and proposal distribution
+ energy += enc->computeInternalEnergyConnection(Current.p,Current.ep,Next.p,Next.ep);
+ AccumProb *= probability;
+
+ // track to next endpoint
+ Current = Next;
+ Current.ep *= -1;
+
+ Current.p->label = 1; // put label to avoid loops
+ TrackProposal.track[cnt++] = Current;
+
+
+
+ }
+
+ TrackProposal.energy = energy;
+ TrackProposal.proposal_probability = AccumProb;
+ TrackProposal.length = cnt;
+
+ // clear labels
+ for (int j = 0; j < TrackProposal.length;j++)
+ {
+ TrackProposal.track[j].p->label = 0;
+ }
+
+ }
+
+
+
+
+ void ComputeEndPointProposalDistribution(EndPoint P)
+ {
+ Particle *p = P.p;
+ int ep = P.ep;
+
+ float dist,dot;
+ pVector R = p->R + (p->N * ep*p->len);
+ m_ParticleGrid.computeNeighbors(R);
+ simpsamp.clear();
+
+ simpsamp.add(stopprobability,EndPoint(0,0));
+
+ for (;;)
+ {
+ Particle *p2 = m_ParticleGrid.getNextNeighbor();
+ if (p2 == 0) break;
+ if (p!=p2 && p2->label == 0)
+ {
+ if (p2->mID == -1)
+ {
+ dist = (p2->R - p2->N * p2->len - R).norm_square();
+ if (dist < dthres)
+ {
+ dot = p2->N*p->N * ep;
+ if (dot > nthres)
+ {
+ float en = enc->computeInternalEnergyConnection(p,ep,p2,-1);
+ simpsamp.add(exp(en/T_prop),EndPoint(p2,-1));
+ }
+ }
+ }
+ if (p2->pID == -1)
+ {
+ dist = (p2->R + p2->N * p2->len - R).norm_square();
+ if (dist < dthres)
+ {
+ dot = p2->N*p->N * (-ep);
+ if (dot > nthres)
+ {
+ float en = enc->computeInternalEnergyConnection(p,ep,p2,+1);
+ simpsamp.add(exp(en/T_prop),EndPoint(p2,+1));
+ }
+ }
+ }
+ }
+ }
+ }
+
+
+};
+
+
+
diff --git a/Modules/DiffusionImaging/Tractography/GlobalTracking/SphereInterpolator.cpp b/Modules/DiffusionImaging/Tractography/GlobalTracking/SphereInterpolator.cpp
new file mode 100644
index 0000000000..0f37dd624d
--- /dev/null
+++ b/Modules/DiffusionImaging/Tractography/GlobalTracking/SphereInterpolator.cpp
@@ -0,0 +1,122 @@
+
+
+#include "auxilary_classes.cpp"
+
+
+class SphereInterpolator
+{
+public:
+ float *barycoords;
+ int *indices;
+ int size; // size of LUT
+ int sN; // (sizeofLUT-1)/2
+ int nverts; // number of data vertices
+
+
+ float beta;
+ float inva;
+ float b;
+
+
+ int *idx;
+ float *interpw;
+
+ SphereInterpolator(float *barycoords, int *indices, int numverts, int sizeLUT, float beta)
+ {
+ this->barycoords = barycoords;
+ this->indices = indices;
+ this->size = sizeLUT;
+ this->sN = (sizeLUT-1)/2;
+ this->nverts = numverts;
+ this->beta = beta;
+
+ inva = (sqrt(1+beta)-sqrt(beta));
+ b = 1/(1-sqrt(1/beta + 1));
+
+ }
+
+
+ inline void getInterpolation(vnl_vector_fixed<double, 3> N)
+ {
+ float nx = N[0];
+ float ny = N[1];
+ float nz = N[2];
+
+ if (nz > 0.5)
+ {
+ int x = float2int(nx);
+ int y = float2int(ny);
+ int i = 3*6*(x+y*size); // (:,1,x,y)
+ idx = indices+i;
+ interpw = barycoords +i;
+ return;
+ }
+ if (nz < -0.5)
+ {
+ int x = float2int(nx);
+ int y = float2int(ny);
+ int i = 3*(1+6*(x+y*size)); // (:,2,x,y)
+ idx = indices+i;
+ interpw = barycoords +i;
+ return;
+ }
+ if (nx > 0.5)
+ {
+ int z = float2int(nz);
+ int y = float2int(ny);
+ int i = 3*(2+6*(z+y*size)); // (:,2,x,y)
+ idx = indices+i;
+ interpw = barycoords +i;
+ return;
+ }
+ if (nx < -0.5)
+ {
+ int z = float2int(nz);
+ int y = float2int(ny);
+ int i = 3*(3+6*(z+y*size)); // (:,2,x,y)
+ idx = indices+i;
+ interpw = barycoords +i;
+ return;
+ }
+ if (ny > 0)
+ {
+ int x = float2int(nx);
+ int z = float2int(nz);
+ int i = 3*(4+6*(x+z*size)); // (:,1,x,y)
+ idx = indices+i;
+ interpw = barycoords +i;
+ return;
+ }
+ else
+ {
+ int x = float2int(nx);
+ int z = float2int(nz);
+ int i = 3*(5+6*(x+z*size)); // (:,1,x,y)
+ idx = indices+i;
+ interpw = barycoords +i;
+ return;
+ }
+
+ }
+
+
+ inline float invrescale(float f)
+ {
+ float x = (fabs(f)-b)*inva;
+ if (f>0)
+ return (x*x-beta);
+ else
+ return beta - x*x;
+ }
+
+ inline int float2int(float x)
+ {
+ return int((invrescale(x)+1)*sN-0.5);
+
+ }
+
+
+};
+
+
+
diff --git a/Modules/DiffusionImaging/Tractography/GlobalTracking/anisoDiffusion.cpp b/Modules/DiffusionImaging/Tractography/GlobalTracking/anisoDiffusion.cpp
new file mode 100644
index 0000000000..93e593ab51
--- /dev/null
+++ b/Modules/DiffusionImaging/Tractography/GlobalTracking/anisoDiffusion.cpp
@@ -0,0 +1,134 @@
+
+#include "mex.h"
+#include "matrix.h"
+#include <math.h>
+#include <string.h>
+#define REAL float
+
+void mexFunction( int nlhs, mxArray *plhs[], int nrhs, const mxArray *prhs[] )
+{
+
+ if(nrhs != 3) {
+ printf("\nUsage: res = aniosDiffusion(img,Dcoeff,[alpha it])\n\n",nrhs);
+ printf(" Propagates Heat equation with position dependedd conductivity Dcoeff\n\n");
+ printf(" img - inital state\n");
+ printf(" Dcoeff - contains Dtensor of size [ 6 size(img)] with compnents xx yy zz xz yz xz \n");
+ printf(" alpha - timestep \n");
+ printf(" it - number of iterations \n");
+
+ return;
+ } else if(nlhs>1) {
+ printf("Too many output arguments\n");
+ return;
+ }
+
+ int pcnt = 0;
+ const mxArray *Img;
+ Img = prhs[pcnt++];
+ const int numdim = mxGetNumberOfDimensions(Img);
+ const int *dims = mxGetDimensions(Img);
+ REAL *img = (REAL*) mxGetData(Img);
+ if (numdim != 3)
+ {
+ mexPrintf("input has to be 3dim\n");
+ return;
+ }
+ int w = dims[0];
+ int h = dims[1];
+ int d = dims[2];
+
+ const mxArray *BG;
+ BG = prhs[pcnt++];
+ const int *dimsbg = mxGetDimensions(BG);
+ if (dimsbg[0] != 6)
+ {
+ mexPrintf("blurrguide has to be rank 2\n");
+ return;
+ }
+ REAL *blurrg = (REAL*) mxGetData(BG);
+
+
+ const mxArray *Factors;
+ Factors = prhs[pcnt++];
+ REAL *factors = (REAL*) mxGetData(Factors);
+ REAL alpha = factors[0];
+ int itmax = (int) factors[1];
+
+ plhs[0] = mxCreateNumericArray(3,dims,mxGetClassID(Img),mxREAL);
+ REAL *result = (REAL*) mxGetData(plhs[0]);
+ memcpy(result,img,sizeof(REAL)*w*h*d);
+
+
+
+ int ndims[4];
+ ndims[0] = 3; ndims[1] = dims[0]; ndims[2] = dims[1]; ndims[3] = dims[2];
+ const mxArray *Tmp1 = mxCreateNumericArray(4,ndims,mxGetClassID(Img),mxREAL);
+ REAL *tmp1 = (REAL*) mxGetData(Tmp1);
+
+
+
+ int wh = w*h;
+
+
+ for (int k = 0; k < itmax ; k++)
+ {
+
+ for (int z = 1; z < d-1; z++)
+ for (int y = 1; y < h-1; y++)
+ for (int x = 1; x < w-1; x++)
+ {
+ int idx = z*wh + y*w + x;
+ REAL gx = result[idx-1] - result[idx];
+ REAL gy = result[idx-w] - result[idx];
+ REAL gz = result[idx-wh] - result[idx];
+ REAL *D = &(blurrg[6*idx]);
+ REAL *tmp = &(tmp1[3*idx]);
+ tmp[0] = gx*D[0] + gy*D[3] + gz*D[4];
+ tmp[1] = gx*D[3] + gy*D[1] + gz*D[5];
+ tmp[2] = gx*D[4] + gy*D[5] + gz*D[2];
+ }
+
+ for (int z = 1; z < d-1; z++)
+ for (int y = 1; y < h-1; y++)
+ for (int x = 1; x < w-1; x++)
+ {
+ int idx = (z*wh + y*w + x);
+ REAL *tmp = &(tmp1[3*idx]);
+ result[idx] = result[idx] - alpha*(tmp[3]-tmp[0] + tmp[1+3*w]-tmp[1] + tmp[2+3*wh]-tmp[2]);
+ }
+ /*
+
+
+ for (int z = 1; z < d-1; z++)
+ for (int y = 1; y < h-1; y++)
+ for (int x = 1; x < w-1; x++)
+ {
+ int idx = z*wh + y*w + x;
+ REAL gxx = result[idx+1] + result[idx-1] - 2*result[idx];
+ REAL gyy = result[idx+w] + result[idx-w] - 2*result[idx];
+ REAL gzz = result[idx+wh] + result[idx-wh] - 2*result[idx];
+ REAL gxy = (result[idx+1+w] - result[idx-1+w] - (result[idx+1-w] - result[idx-1-w]))/4;
+ REAL gxz = (result[idx+1+wh] - result[idx-1+wh] - (result[idx+1-wh] - result[idx-1-wh]))/4;
+ REAL gyz = (result[idx+w+wh] - result[idx-w+wh] - (result[idx+w-wh] - result[idx-w-wh]))/4;
+
+ REAL *D = &(blurrg[6*idx]);
+ //tmp[0] = gxx*D[0] + gxy*D[3] + gxz*D[4];
+ //tmp[1] = gxy*D[3] + gyy*D[1] + gyz*D[5];
+ //tmp[2] = gxz*D[4] + gyz*D[5] + gzz*D[2];
+
+ result[idx] = result[idx] - alpha*( gxx*D[0] + gxy*D[3] + gxz*D[4] + gxy*D[3] + gyy*D[1] + gyz*D[5] + gxz*D[4] + gyz*D[5] + gzz*D[2]);
+ }
+ */
+ }
+
+
+
+
+
+
+}
+
+
+
+
+
diff --git a/Modules/DiffusionImaging/Tractography/GlobalTracking/anisoDiffusionHomogenous.cpp b/Modules/DiffusionImaging/Tractography/GlobalTracking/anisoDiffusionHomogenous.cpp
new file mode 100644
index 0000000000..d5a666b138
--- /dev/null
+++ b/Modules/DiffusionImaging/Tractography/GlobalTracking/anisoDiffusionHomogenous.cpp
@@ -0,0 +1,134 @@
+
+#include "mex.h"
+#include "matrix.h"
+#include <math.h>
+#include <string.h>
+#define REAL float
+
+void mexFunction( int nlhs, mxArray *plhs[], int nrhs, const mxArray *prhs[] )
+{
+
+ if(nrhs != 3) {
+ printf("\nUsage: res = aniosDiffusion(img,Dcoeff,[alpha it])\n\n",nrhs);
+ printf(" Propagates Heat equation with position dependedd conductivity Dcoeff\n\n");
+ printf(" img - inital state\n");
+ printf(" Dcoeff - contains Dtensor of size [ 6 size(img)] with compnents xx yy zz xz yz xz \n");
+ printf(" alpha - timestep \n");
+ printf(" it - number of iterations \n");
+
+ return;
+ } else if(nlhs>1) {
+ printf("Too many output arguments\n");
+ return;
+ }
+
+ int pcnt = 0;
+ const mxArray *Img;
+ Img = prhs[pcnt++];
+ const int numdim = mxGetNumberOfDimensions(Img);
+ const int *dims = mxGetDimensions(Img);
+ REAL *img = (REAL*) mxGetData(Img);
+ if (numdim != 3)
+ {
+ mexPrintf("input has to be 3dim\n");
+ return;
+ }
+ int w = dims[0];
+ int h = dims[1];
+ int d = dims[2];
+
+ const mxArray *BG;
+ BG = prhs[pcnt++];
+ const int *dimsbg = mxGetDimensions(BG);
+ if (dimsbg[0] != 6)
+ {
+ mexPrintf("blurrguide has to be rank 2\n");
+ return;
+ }
+ REAL *blurrg = (REAL*) mxGetData(BG);
+
+
+ const mxArray *Factors;
+ Factors = prhs[pcnt++];
+ REAL *factors = (REAL*) mxGetData(Factors);
+ REAL alpha = factors[0];
+ int itmax = (int) factors[1];
+
+ plhs[0] = mxCreateNumericArray(3,dims,mxGetClassID(Img),mxREAL);
+ REAL *result = (REAL*) mxGetData(plhs[0]);
+ memcpy(result,img,sizeof(REAL)*w*h*d);
+
+
+
+ int ndims[4];
+ ndims[0] = 3; ndims[1] = dims[0]; ndims[2] = dims[1]; ndims[3] = dims[2];
+ const mxArray *Tmp1 = mxCreateNumericArray(4,ndims,mxGetClassID(Img),mxREAL);
+ REAL *tmp1 = (REAL*) mxGetData(Tmp1);
+
+
+
+ int wh = w*h;
+
+ REAL *D = blurrg;
+ for (int k = 0; k < itmax ; k++)
+ {
+
+ for (int z = 1; z < d-1; z++)
+ for (int y = 1; y < h-1; y++)
+ for (int x = 1; x < w-1; x++)
+ {
+ int idx = z*wh + y*w + x;
+ REAL gx = result[idx-1] - result[idx];
+ REAL gy = result[idx-w] - result[idx];
+ REAL gz = result[idx-wh] - result[idx];
+
+ REAL *tmp = &(tmp1[3*idx]);
+ tmp[0] = gx*D[0] + gy*D[3] + gz*D[4];
+ tmp[1] = gx*D[3] + gy*D[1] + gz*D[5];
+ tmp[2] = gx*D[4] + gy*D[5] + gz*D[2];
+ }
+
+ for (int z = 1; z < d-1; z++)
+ for (int y = 1; y < h-1; y++)
+ for (int x = 1; x < w-1; x++)
+ {
+ int idx = (z*wh + y*w + x);
+ REAL *tmp = &(tmp1[3*idx]);
+ result[idx] = result[idx] - alpha*(tmp[3]-tmp[0] + tmp[1+3*w]-tmp[1] + tmp[2+3*wh]-tmp[2]);
+ }
+ /*
+
+
+ for (int z = 1; z < d-1; z++)
+ for (int y = 1; y < h-1; y++)
+ for (int x = 1; x < w-1; x++)
+ {
+ int idx = z*wh + y*w + x;
+ REAL gxx = result[idx+1] + result[idx-1] - 2*result[idx];
+ REAL gyy = result[idx+w] + result[idx-w] - 2*result[idx];
+ REAL gzz = result[idx+wh] + result[idx-wh] - 2*result[idx];
+ REAL gxy = (result[idx+1+w] - result[idx-1+w] - (result[idx+1-w] - result[idx-1-w]))/4;
+ REAL gxz = (result[idx+1+wh] - result[idx-1+wh] - (result[idx+1-wh] - result[idx-1-wh]))/4;
+ REAL gyz = (result[idx+w+wh] - result[idx-w+wh] - (result[idx+w-wh] - result[idx-w-wh]))/4;
+
+ REAL *D = &(blurrg[6*idx]);
+ //tmp[0] = gxx*D[0] + gxy*D[3] + gxz*D[4];
+ //tmp[1] = gxy*D[3] + gyy*D[1] + gyz*D[5];
+ //tmp[2] = gxz*D[4] + gyz*D[5] + gzz*D[2];
+
+ result[idx] = result[idx] - alpha*( gxx*D[0] + gxy*D[3] + gxz*D[4] + gxy*D[3] + gyy*D[1] + gyz*D[5] + gxz*D[4] + gyz*D[5] + gzz*D[2]);
+ }
+ */
+ }
+
+
+
+
+
+
+}
+
+
+
+
+
diff --git a/Modules/DiffusionImaging/Tractography/GlobalTracking/auxilary_classes.cpp b/Modules/DiffusionImaging/Tractography/GlobalTracking/auxilary_classes.cpp
new file mode 100644
index 0000000000..a159e35324
--- /dev/null
+++ b/Modules/DiffusionImaging/Tractography/GlobalTracking/auxilary_classes.cpp
@@ -0,0 +1,638 @@
+
+#ifndef _AUXCLASS
+#define _AUXCLASS
+
+#ifndef INFINITY
+#define INFINITY 1000000000
+#endif
+
+//#define INLINE __attribute__ ((always_inline))
+#define INLINE inline
+
+//#define __SSE2
+
+
+
+#ifdef __SSE2
+#include <xmmintrin.h>
+
+class pVector
+{
+
+private:
+ __m128 r;
+
+public:
+
+ static float store[4];
+
+ pVector()
+ {
+
+ }
+
+ pVector(__m128 q)
+ {
+ r = q;
+ }
+
+
+ pVector(float x,float y,float z)
+ {
+ r = _mm_set_ps(0,z,y,x);
+ }
+
+
+ INLINE void storeXYZ()
+ {
+ _mm_store_ps(store,r);
+ }
+
+ INLINE void setXYZ(float sx,float sy,float sz)
+ {
+ r = _mm_set_ps(0,sz,sy,sx);
+ }
+
+
+
+
+ INLINE void rand(float w,float h,float d)
+ {
+ float x = mtrand.frand()*w;
+ float y = mtrand.frand()*h;
+ float z = mtrand.frand()*d;
+ r = _mm_set_ps(0,z,y,x);
+
+ }
+
+ INLINE void rand_sphere()
+ {
+ r = _mm_set_ps(0,mtrand.frandn(),mtrand.frandn(),mtrand.frandn());
+ normalize();
+ }
+
+ INLINE void normalize()
+ {
+ __m128 q = _mm_mul_ps(r,r);
+ _mm_store_ps(store,q);
+ float norm = sqrt(store[0]+store[1]+store[2]) + 0.00000001;
+ q = _mm_set_ps1(1/norm);
+ r = _mm_mul_ps(r,q);
+
+ }
+
+ INLINE float norm_square()
+ {
+ __m128 q = _mm_mul_ps(r,r);
+ _mm_store_ps(store,q);
+ return store[0]+store[1]+store[2];
+ }
+
+ INLINE void distortn(float sigma)
+ {
+ __m128 s = _mm_set_ps(0,mtrand.frandn(),mtrand.frandn(),mtrand.frandn());
+ __m128 q = _mm_set_ps1(sigma);
+ r = _mm_add_ps(r,_mm_mul_ps(q,s));
+ }
+
+ INLINE pVector operator*(float s)
+ {
+ __m128 q = _mm_set_ps1(s);
+ return pVector(_mm_mul_ps(q,r));
+ }
+
+ INLINE void operator*=(float &s)
+ {
+ __m128 q = _mm_set_ps1(s);
+ r = _mm_mul_ps(q,r);
+ }
+
+ INLINE pVector operator+(pVector R)
+ {
+ return pVector(_mm_add_ps(R.r,r));
+ }
+
+ INLINE void operator+=(pVector R)
+ {
+ r = _mm_add_ps(r,R.r);
+ }
+
+ INLINE pVector operator-(pVector R)
+ {
+ return pVector(_mm_sub_ps(r,R.r));
+ }
+
+ INLINE void operator-=(pVector R)
+ {
+ r = _mm_sub_ps(r,R.r);
+ }
+
+ INLINE pVector operator/(float &s)
+ {
+ __m128 q = _mm_set_ps1(s);
+ return pVector(_mm_div_ps(q,r));
+ }
+
+ INLINE void operator/=(float &s)
+ {
+ __m128 q = _mm_set_ps1(s);
+ r = _mm_div_ps(r,q);
+ }
+
+ INLINE float operator*(pVector R)
+ {
+ __m128 q = _mm_mul_ps(r,R.r);
+ _mm_store_ps(store,q);
+ return store[0]+store[1]+store[2];
+ }
+
+
+};
+
+float pVector::store[4];
+
+#else
+
+class pVector
+{
+private:
+ float x;
+ float y;
+ float z;
+
+public:
+
+ pVector()
+ {
+
+ }
+
+ pVector(float x,float y,float z)
+ {
+ this->x = x;
+ this->y = y;
+ this->z = z;
+ }
+
+ INLINE void SetXYZ(float sx,float sy, float sz)
+ {
+ x = sx;
+ y = sy;
+ z = sz;
+ }
+
+ INLINE float* GetXYZ()
+ {
+ float xyz[3] = {x,y,z};
+ return xyz;
+ }
+
+ INLINE float GetX()
+ {
+ return x;
+ }
+
+ INLINE float GetY()
+ {
+ return y;
+ }
+
+ INLINE float GetZ()
+ {
+ return z;
+ }
+
+ INLINE void rand(float w, float h, float d)
+ {
+ this->x = mtrand.frand()*w;
+ this->y = mtrand.frand()*h;
+ this->z = mtrand.frand()*d;
+ }
+
+ INLINE void rand_sphere()
+ {
+ this->x = mtrand.frandn();
+ this->y = mtrand.frandn();
+ this->z = mtrand.frandn();
+ normalize();
+ }
+
+ INLINE void normalize()
+ {
+ float norm = sqrt(x*x+y*y+z*z)+ 0.00000001;
+ *this /= norm;
+ }
+
+ INLINE float norm_square()
+ {
+ return x*x + y*y + z*z;
+ }
+
+ INLINE void distortn(float sigma)
+ {
+ x += sigma*mtrand.frandn();
+ y += sigma*mtrand.frandn();
+ z += sigma*mtrand.frandn();
+ }
+
+ INLINE float operator[](int index)
+ {
+ switch(index)
+ {
+ case 0:
+ return x;
+ case 1:
+ return y;
+ case 2:
+ return z;
+ }
+ }
+
+ INLINE pVector operator*(float s)
+ {
+ return pVector(s*x,s*y,s*z);
+ }
+
+ INLINE void operator*=(float &s)
+ {
+ x *= s;
+ y *= s;
+ z *= s;
+ }
+
+ INLINE pVector operator+(pVector R)
+ {
+ return pVector(x+R.x,y+R.y,z+R.z);
+ }
+
+ INLINE void operator+=(pVector R)
+ {
+ x += R.x;
+ y += R.y;
+ z += R.z;
+ }
+
+ INLINE pVector operator-(pVector R)
+ {
+ return pVector(x-R.x,y-R.y,z-R.z);
+ }
+
+ INLINE void operator-=(pVector R)
+ {
+ x -= R.x;
+ y -= R.y;
+ z -= R.z;
+ }
+
+ INLINE pVector operator/(float &s)
+ {
+ return pVector(x/s,y/s,z/s);
+ }
+
+ INLINE void operator/=(float &s)
+ {
+ x /= s;
+ y /= s;
+ z /= s;
+ }
+
+
+ INLINE float operator*(pVector R)
+ {
+ return x*R.x+y*R.y+z*R.z;
+ }
+};
+
+#endif
+
+
+class Particle
+{
+public:
+
+ Particle()
+ {
+ label = 0;
+ pID = -1;
+ mID = -1;
+ }
+
+ ~Particle()
+ {
+ }
+
+ pVector R;
+ pVector N;
+ float cap;
+ float len;
+
+ int gridindex; // index in the grid where it is living
+ int ID;
+ int pID;
+ int mID;
+
+ int label;
+ int numerator;
+};
+
+
+class EnergyGradient
+{
+public:
+ pVector gR;
+ pVector gN;
+
+ INLINE float norm2()
+ {
+ return gR.norm_square() + gN.norm_square();
+ }
+} ;
+
+
+template <class T>
+class SimpSamp
+{
+
+ float *P;
+ int cnt;
+
+public:
+ T *objs;
+
+
+ SimpSamp()
+ {
+ P = (float*) malloc(sizeof(float)*1000);
+ objs = (T*) malloc(sizeof(T)*1000);
+ }
+ ~SimpSamp()
+ {
+ free(P);
+ free(objs);
+ }
+
+ INLINE void clear()
+ {
+ cnt = 1;
+ P[0] = 0;
+ }
+
+ INLINE void add(float p, T obj)
+ {
+ P[cnt] = P[cnt-1] + p;
+ objs[cnt-1] = obj;
+ cnt++;
+ }
+
+ // INLINE int draw()
+ // {
+ // float r = mtrand.frand()*P[cnt-1];
+ // for (int i = 1; i < cnt; i++)
+ // {
+ // if (r <= P[i])
+ // return i-1;
+ // }
+ // return cnt-2;
+ // }
+
+ INLINE int draw()
+ {
+ float r = mtrand.frand()*P[cnt-1];
+ int j;
+ int rl = 1;
+ int rh = cnt-1;
+ while(rh != rl)
+ {
+ j = rl + (rh-rl)/2;
+ if (r < P[j])
+ {
+ rh = j;
+ continue;
+ }
+ if (r > P[j])
+ {
+ rl = j+1;
+ continue;
+ }
+ break;
+ }
+ return rh-1;
+ }
+
+
+
+
+
+ INLINE T drawObj()
+ {
+ return objs[draw()];
+ }
+
+ INLINE bool isempty()
+ {
+ if (cnt == 1)
+ return true;
+ else
+ return false;
+ }
+
+
+ float probFor(int idx)
+ {
+ return (P[idx+1]-P[idx])/P[cnt-1];
+ }
+
+ float probFor(T &t)
+ {
+ for (int i = 1; i< cnt;i++)
+ {
+ if (t == objs[i-1])
+ return probFor(i-1);
+ }
+ return 0;
+ }
+
+
+
+};
+
+
+class EndPoint
+{
+public:
+ EndPoint()
+ {}
+
+ EndPoint(Particle *p,int ep)
+ {
+ this->p = p;
+ this->ep = ep;
+ }
+ Particle *p;
+ int ep;
+
+ inline bool operator==(EndPoint P)
+ {
+ return (P.p == p) && (P.ep == ep);
+ }
+};
+
+class Track
+{
+public:
+ EndPoint track[1000];
+ float energy;
+ float proposal_probability;
+ int length;
+
+ void clear()
+ {
+ length = 0;
+ energy = 0;
+ proposal_probability = 1;
+ }
+
+
+ bool isequal(Track &t)
+ {
+ for (int i = 0; i < length;i++)
+ {
+ if (track[i].p != t.track[i].p || track[i].ep != t.track[i].ep)
+ return false;
+ }
+ return true;
+ }
+
+};
+
+float getMax(float *arr, int cnt)
+{
+ float max = arr[0];
+ for (int i = 1; i < cnt; i++)
+ {
+ if (arr[i] > max)
+ max = arr[i];
+ }
+ return max;
+}
+
+
+
+float getMin(float *arr, int cnt)
+{
+ float min = arr[0];
+ for (int i = 1; i < cnt; i++)
+ {
+ if (arr[i] < min)
+ min = arr[i];
+ }
+ return min;
+}
+
+
+int getArgMin(float *arr, int cnt)
+{
+ float min = arr[0];
+ int idx = 0;
+ for (int i = 1; i < cnt; i++)
+ {
+ if (arr[i] < min)
+ {
+ min = arr[i];
+ idx = i;
+ }
+ }
+ return idx;
+}
+
+
+
+
+inline float distLseg(pVector &R1,pVector &N1,pVector &R2,pVector &N2,float &len)
+{
+
+ pVector D = R1-R2;
+ float beta = N1*N2;
+ float divisor = 1.001-beta*beta;
+ float gamma1 = N1*D;
+ float gamma2 = N2*D;
+ float t,u;
+ float EPdist[4];
+
+ pVector Q;
+ float dist = 102400000.0;
+
+ while(true)
+ {
+
+ t = -(gamma1+beta*gamma2) / divisor;
+ u = (gamma1*beta+gamma2) / divisor;
+ if (fabs(t) < len && fabs(u) < len)
+ {
+ Q = D + N1*t - N2*u;
+ dist = Q*Q;
+ break;
+ }
+
+ beta = len*beta;
+
+ t = beta - gamma1;
+ if (fabs(t) < len)
+ {
+ Q = D + N1*t - N2*len;
+ float d = Q*Q;
+ if (d < dist) dist = d;
+ }
+
+ t = -beta - gamma1;
+ if (fabs(t) < len)
+ {
+ Q = D + N1*t + N2*len;
+ float d = Q*Q;
+ if (d < dist) dist = d;
+ }
+
+ u = beta + gamma2;
+ if (fabs(u) < len)
+ {
+ Q = D + N1*len - N2*u;
+ float d = Q*Q;
+ if (d < dist) dist = d;
+ }
+
+ u = -beta + gamma2;
+ if (fabs(u) < len)
+ {
+ Q = D - N1*len - N2*u;
+ float d = Q*Q;
+ if (d < dist) dist = d;
+ }
+
+ if (dist != 102400000.0)
+ break;
+
+
+ EPdist[0] = beta + gamma1 - gamma2;
+ EPdist[1] = -beta + gamma1 + gamma2;
+ EPdist[2] = -beta - gamma1 - gamma2;
+ EPdist[3] = beta - gamma1 + gamma2;
+ int c = getArgMin(EPdist,4);
+ if (c==0) {t = +len; u = +len; }
+ if (c==1) {t = +len; u = -len; }
+ if (c==2) {t = -len; u = +len; }
+ if (c==3) {t = -len; u = -len; }
+ Q = D + N1*t - N2*u;
+ dist = Q*Q;
+ break;
+
+ }
+
+
+ return dist;
+
+}
+
+
+#endif
+
+
diff --git a/Modules/DiffusionImaging/Tractography/GlobalTracking/pcRJMCMC.cpp b/Modules/DiffusionImaging/Tractography/GlobalTracking/pcRJMCMC.cpp
new file mode 100644
index 0000000000..f44e29260b
--- /dev/null
+++ b/Modules/DiffusionImaging/Tractography/GlobalTracking/pcRJMCMC.cpp
@@ -0,0 +1,279 @@
+#ifndef __pcRJMCMC_cpp__
+#define __pcRJMCMC_cpp__
+
+//#include "mex.h"
+//#include "matrix.h"
+#include <math.h>
+#include <map>
+#include <string.h>
+#include <time.h>
+
+using namespace std;
+
+#define float float
+#define PI 3.1415926536
+//#define INFINITY 99999999999.0
+
+//#define TIMING
+
+#ifdef TIMING
+
+static struct timeval timeS;
+
+class PropStats
+{
+ int N;
+ int accept;
+public:
+ void clear() { N = 0; accept = 0;}
+ void propose() {N++;}
+ void accepted() {accept++;}
+
+ void report(const char *s)
+ {
+ //mexPrintf("%s #proposals: %8.2fk acceptratio: %.2f \% \n",s,1.0*N/1000.0,100.0*accept/N);
+ }
+};
+
+
+class Timing
+{
+public:
+ Timing() { time = 0; ncalls = 0;}
+ void clear() {time = 0; ncalls=0;}
+
+
+ long time;
+ int ncalls;
+
+ void report(const char *s)
+ {
+ //mexPrintf("%s total: %10.2fms calls: %10.1fk t/call: %10.3fms \n",s,time/1000.0,1.0*ncalls/1000.0,1.0*time/ncalls);
+ }
+
+ void report_time(const char *s)
+ {
+ //mexPrintf("%s: %.2fms \n",s,time/1000.0);
+ }
+
+};
+
+inline void tic(Timing *t)
+{
+ gettimeofday( &timeS, NULL);
+ t->time -= (timeS.tv_sec*1000000 + timeS.tv_usec);
+ t->ncalls++;
+}
+inline void toc(Timing *t)
+{
+ gettimeofday( &timeS, NULL);
+ t->time += (timeS.tv_sec*1000000 + timeS.tv_usec);
+}
+
+Timing externalenergy_time;
+Timing internalenergy_time;
+Timing odfeval_time;
+Timing total_time;
+
+Timing shiftproposal_time;
+Timing birthproposal_time;
+Timing deathproposal_time;
+Timing capproposal_time;
+Timing lenproposal_time;
+Timing connproposal_time;
+
+PropStats deathstats;
+PropStats birthstats;
+PropStats connstats;
+PropStats shiftstats;
+PropStats capstats;
+PropStats lenstats;
+
+
+#endif
+
+
+
+#include "MersenneTwister.h"
+MTRand mtrand;
+float *BESSEL_APPROXCOEFF;
+
+
+#include "EnergyComputer_connec.cpp"
+//#include "EnergyComputer_center.cpp"
+//#include "RJMCMC_singlegradprop.cpp"
+#include "RJMCMC_randshift.cpp"
+
+
+//void mexFunction( int nlhs, mxArray *plhs[], int nrhs, const mxArray *prhs[] )
+//{
+
+// if(nrhs != 7 && nrhs != 8) {
+
+// printf(" wrong usage!!!.\n\n");
+// return;
+// } else if(nlhs>3) {
+// printf("Too many output arguments\n");
+// return;
+// }
+
+// int pcnt = 0;
+// const mxArray *Points;
+// Points = prhs[pcnt++];
+// int numPoints = mxGetN(Points);
+// float *points = (float*) mxGetData(Points);
+
+// const mxArray *DataImg;
+// DataImg = prhs[pcnt++];
+// float *dimg = (float*) mxGetData(DataImg);
+// const int *dsize = mxGetDimensions(DataImg);
+
+// const mxArray *Mask;
+// Mask = prhs[pcnt++];
+// float *mask = (float*) mxGetData(Mask);
+// const int *dmsize = mxGetDimensions(Mask);
+// int mask_oversamp_mult = dmsize[0]/dsize[1];
+
+
+
+// const mxArray *VoxSize;
+// VoxSize = prhs[pcnt++];
+// double *voxsize = (double*) mxGetPr(VoxSize);
+
+
+
+// const mxArray *Params;
+// Params = prhs[pcnt++];
+// double *params = (double*) mxGetPr(Params);
+
+// float Temp = (float) params[0];
+// int numit = (int) params[1];
+// float conprob = (float) params[2];
+// float particle_weight = (float) params[3];
+// float particle_width = (float) params[4];
+// float particle_len = (float) params[5];
+// float chempot_connection = (float) params[6];
+// float chempot_particle = (float) params[7];
+// float inex_balance = (float) params[8];
+// float chempot2 = (float) params[9];
+// float meanval_sq = (float) params[10];
+
+// const mxArray *BesselExpansion;
+// BesselExpansion = prhs[pcnt++];
+// BESSEL_APPROXCOEFF = (float*) mxGetData(BesselExpansion);
+
+
+
+// // read spherical-interpolator data
+
+// const mxArray *sinterpstruct = prhs[pcnt++];
+// mxArray *Indices = mxGetField(sinterpstruct,0,"indices");
+// mxArray *BaryCoords = mxGetField(sinterpstruct,0,"barycoords");
+// mxArray *Beta = mxGetField(sinterpstruct,0,"beta");
+// mxArray *NumInterpPoints = mxGetField(sinterpstruct,0,"numpoints");
+
+// float *indimg = (float*) mxGetData(Indices);
+// const int *isize = mxGetDimensions(Indices);
+// int totsz = isize[0]*isize[1]*isize[2]*isize[3];
+// int *indeximg = (int*) malloc(sizeof(int)*totsz);
+// for (int k =0;k < totsz;k++)
+// indeximg[k] = int(indimg[k])-1;
+// float *barycoords = (float*) mxGetData(BaryCoords);
+// float *beta = (float*) mxGetData(Beta);
+// int nip = int(*((float*)mxGetData(NumInterpPoints)));
+
+// SphereInterpolator *sinterp = new SphereInterpolator(barycoords,indeximg,nip,isize[2],beta[0]);
+
+// double breakhandle = 0;
+// const mxArray *BreakHandle;
+// if (nrhs == 8)
+// {
+// BreakHandle = prhs[pcnt++];
+// breakhandle = *mxGetPr(BreakHandle);
+// }
+
+// #ifdef TIMING
+// externalenergy_time.clear();
+// internalenergy_time.clear();
+// odfeval_time.clear();
+// total_time.clear();
+
+// shiftproposal_time.clear();
+// birthproposal_time.clear();
+// deathproposal_time.clear();
+// capproposal_time.clear();
+// lenproposal_time.clear();
+// connproposal_time.clear();
+
+// deathstats.clear();
+// birthstats.clear();
+// connstats.clear();
+// shiftstats.clear();
+// capstats.clear();
+// lenstats.clear();
+// #endif
+
+
+
+// float cellsize = 2*particle_len;
+// float curv_hardthres = 0.7;
+
+// fprintf(stderr,"setting up MH-sampler \n"); fflush(stderr);
+// RJMCMC sampler(points,numPoints, dimg, dsize, voxsize, cellsize);
+// fprintf(stderr,"setting up Energy-computer \n"); fflush(stderr);
+// EnergyComputer encomp(dimg,dsize,voxsize,sinterp,&(sampler.pcontainer),mask,mask_oversamp_mult);
+
+// fprintf(stderr,"setting up parameters\n"); fflush(stderr);
+// sampler.setParameters(Temp,numit,conprob,particle_len,curv_hardthres,chempot_particle);
+// sampler.setEnergyComputer(&encomp);
+// encomp.setParameters(particle_weight,particle_width,chempot_connection*particle_len*particle_len,particle_len,curv_hardthres,inex_balance,chempot2,meanval_sq);
+
+// fprintf(stderr,"starting to iterate\n"); fflush(stderr);
+// sampler.iterate(breakhandle);
+
+// int cnt = sampler.pcontainer.pcnt;
+// #ifdef TIMING
+// mexPrintf("\nEnergy\n------------------------\n");
+// externalenergy_time.report("external ");
+// odfeval_time.report("odfeval ");
+// internalenergy_time.report("internal ");
+// total_time.report_time("total energy comp. ");
+
+// mexPrintf("overhead for proposals und stuff:%.1fms\n",
+// (total_time.time-(externalenergy_time.time+odfeval_time.time+internalenergy_time.time))/1000.0);
+
+// mexPrintf("\nProposals\n------------------------\n");
+// birthproposal_time.report("birth ");
+// deathproposal_time.report("death ");
+// shiftproposal_time.report("shift ");
+// connproposal_time.report("conne ");
+//// capproposal_time.report("capch ");
+//// lenproposal_time.report("length ");
+// mexPrintf("\n");
+// birthstats.report("birth ");
+// deathstats.report("death ");
+// shiftstats.report("shift ");
+// connstats.report("conne ");
+//// lenstats.report("length ");
+//// capstats.report("capch ");
+// mexPrintf("\n");
+
+
+
+// #endif
+
+
+// int dims[] = {sampler.attrcnt, sampler.pcontainer.pcnt};
+// plhs[0] = mxCreateNumericArray(2,dims,mxGetClassID(Points),mxfloat);
+// float *npoints = (float*) mxGetData(plhs[0]);
+// sampler.writeout(npoints);
+
+
+// delete sinterp;
+// free(indeximg);
+
+
+//}
+
+#endif
+
diff --git a/Modules/DiffusionImaging/Tractography/GlobalTracking/reparametrize_arclen.cpp b/Modules/DiffusionImaging/Tractography/GlobalTracking/reparametrize_arclen.cpp
new file mode 100644
index 0000000000..aaa49f676a
--- /dev/null
+++ b/Modules/DiffusionImaging/Tractography/GlobalTracking/reparametrize_arclen.cpp
@@ -0,0 +1,124 @@
+
+#include "mex.h"
+#include "matrix.h"
+#include <math.h>
+#include <map>
+#include <string.h>
+#include <time.h>
+
+using namespace std;
+
+#define REAL float
+#define PI 3.1415926536
+
+
+
+#include "MersenneTwister.h"
+//MTRand mtrand;
+#include "auxilary_classes.cpp"
+
+
+void mexFunction( int nlhs, mxArray *plhs[], int nrhs, const mxArray *prhs[] )
+{
+
+ if(nrhs != 2 ) {
+ printf("\nUsage: Df = STderivative(f)\n\n",nrhs);
+ printf(" Computes xxx\n");
+ printf(" Parameters:\n");
+ printf(" f - 2D input image of type REAL \n");
+ printf(" Return value Df contains xxx.\n\n");
+ return;
+ } else if(nlhs>2) {
+ printf("Too many output arguments\n");
+ return;
+ }
+
+ int ppcnt = 0;
+ const mxArray *Points;
+ Points = prhs[ppcnt++];
+ int numPoints = mxGetN(Points);
+ REAL *points = (REAL*) mxGetData(Points);
+
+ const mxArray *Param;
+ Param = prhs[ppcnt++];
+ double *param = mxGetPr(Param);
+
+
+ Particle* particles = (Particle*) malloc(sizeof(Particle)*numPoints);
+ Particle particles_proposal[10000];
+
+ int i;
+ for (i = 0; i < numPoints; i++)
+ {
+ particles[i].R.setXYZ(points[3*i],points[3*i+1],points[3*i+2]);
+ }
+ pVector source = particles[0].R;
+ pVector sink = particles[numPoints-1].R;
+
+
+ int pcnt = numPoints;
+ REAL len = param[0]; // 0.9*minSpacing
+ REAL Leng = 0;
+
+ particles_proposal[0].R = source;
+ REAL dtau = 0;
+ int cur_p = 1;
+ int cur_i = 1;
+ pVector dR;
+ REAL normdR;
+ for (;;)
+ {
+ while (dtau <= len && cur_p < pcnt)
+ {
+ dR = particles[cur_p].R - particles[cur_p-1].R;
+ normdR = sqrt(dR.norm_square());
+ dtau += normdR;
+ Leng += normdR;
+ cur_p++;
+ }
+
+ if (dtau >= len)
+ {
+ // proposal = current particle position - (current p - last p)*(current fibre length - len???)/(norm current p-last p)
+ particles_proposal[cur_i].R = particles[cur_p-1].R - dR*( (dtau-len)/normdR );
+ }
+ else
+ {
+ particles_proposal[cur_i].R = sink;
+ break;
+ }
+
+ dtau = dtau-len;
+
+ cur_i++;
+ if (cur_i >= 10000)
+ {
+ mexPrintf("bugy");
+ break;
+ }
+
+ }
+
+
+
+
+ const int sz[] = {3, cur_i+1};
+
+ plhs[0] = mxCreateNumericArray(2,sz,mxGetClassID(Points),mxREAL);
+ REAL *pk = (REAL*) mxGetData(plhs[0]);
+ for (i = 0; i < cur_i+1 ; i++)
+ {
+ particles_proposal[i].R.storeXYZ();
+ pk[3*i] = pVector::store[0];
+ pk[3*i+1] = pVector::store[1];
+ pk[3*i+2] = pVector::store[2];
+ }
+
+
+ plhs[1] = mxCreateDoubleMatrix(1,1,mxREAL);
+ double *plen = mxGetPr(plhs[1]);
+ plen[0] = Leng;
+
+ free(particles);
+}
+
diff --git a/Modules/DiffusionImaging/Tractography/GlobalTracking/reparametrize_arclen2.cpp b/Modules/DiffusionImaging/Tractography/GlobalTracking/reparametrize_arclen2.cpp
new file mode 100644
index 0000000000..657f72491b
--- /dev/null
+++ b/Modules/DiffusionImaging/Tractography/GlobalTracking/reparametrize_arclen2.cpp
@@ -0,0 +1,97 @@
+#include "mitkParticle.h"
+#include "auxilary_classes.cpp"
+
+using namespace std;
+
+#define PI 3.1415926536
+
+float squareNorm( vnl_vector_fixed<float, 3> v )
+{
+ return v[0]*v[0]+v[1]*v[1]+v[2]*v[2];
+}
+
+mitk::Particle* createMitkParticle(Particle* p)
+{
+ mitk::Particle* particle = new mitk::Particle();
+ pVector R = p->R;
+ vnl_vector_fixed<float,3> pos;
+ pos[0] = R[0]-0.5;
+ pos[1] = R[1]-0.5;
+ pos[2] = R[2]-0.5;
+ particle->SetPosition(pos);
+ //MITK_INFO << "mitk: " << particle->GetPosition();
+ pVector N = p->N;
+ vnl_vector_fixed<float,3> dir;
+ dir[0] = N[0];
+ dir[1] = N[1];
+ dir[2] = N[2];
+ particle->SetDirection(dir);
+ return particle;
+}
+
+Particle* createParticle(Particle* particle){
+ Particle* p = new Particle();
+ p->R = pVector(particle->R);
+ p->N = pVector(particle->N);
+ return p;
+}
+
+vector<Particle*>* ResampleFibers(vector<Particle*>* particleContainer, float len)
+{
+ //vector< mitk::Particle::Pointer >* outContainer = new::vector< mitk::Particle::Pointer >();
+ vector< Particle* >* container =
+ new vector< Particle* >();
+
+ int numPoints = particleContainer->size();
+ if(numPoints<2)
+ return container;
+
+ Particle* source = createParticle(particleContainer->at(0));
+ Particle* sink = createParticle(particleContainer->at(numPoints-1));
+
+ float Leng = 0;
+
+ container->push_back(source);
+ // source->R.storeXYZ();
+ // MITK_INFO << source->R.store[0] << ", " << source->R.store[1] << ", " << source->R.store[2];
+
+ float dtau = 0;
+ int cur_p = 1;
+ int cur_i = 1;
+ pVector dR;
+ float normdR;
+
+ for (;;)
+ {
+ while (dtau <= len && cur_p < numPoints)
+ {
+ dR = particleContainer->at(cur_p)->R - particleContainer->at(cur_p-1)->R;
+ normdR = sqrt(dR.norm_square());
+ dtau += normdR;
+ Leng += normdR;
+ cur_p++;
+ }
+
+ if (dtau >= len) // if particles reach next voxel
+ {
+ // proposal = current particle position - (current p - last p)*(current fibre length - len???)/(norm current p-last p)
+ Particle* p = new Particle();
+ p->R = particleContainer->at(cur_p-1)->R - dR*( (dtau-len)/normdR );
+ p->N = dR;
+ // p->R.storeXYZ();
+ // MITK_INFO << p->R.store[0] << ", " << p->R.store[1] << ", " << p->R.store[2];
+ container->push_back(p);
+ }
+ else
+ {
+ container->push_back(sink);
+ break;
+ }
+
+ dtau = dtau-len;
+
+ cur_i++;
+ }
+ return container;
+}
+
diff --git a/Modules/DiffusionImaging/Tractography/GlobalTracking/reparametrize_arclen_new.cpp b/Modules/DiffusionImaging/Tractography/GlobalTracking/reparametrize_arclen_new.cpp
new file mode 100644
index 0000000000..3e98361a39
--- /dev/null
+++ b/Modules/DiffusionImaging/Tractography/GlobalTracking/reparametrize_arclen_new.cpp
@@ -0,0 +1,69 @@
+#include <mitkParticle.h>
+
+using namespace std;
+
+#define PI 3.1415926536
+
+float squareNorm( vnl_vector_fixed<float, 3> v )
+{
+ return v[0]*v[0]+v[1]*v[1]+v[2]*v[2];
+}
+
+itk::VectorContainer<unsigned int, mitk::Particle::Pointer>::Pointer mexFunction(vector< mitk::Particle::Pointer >* particleContainer, float len)
+{
+ //vector< mitk::Particle::Pointer >* outContainer = new::vector< mitk::Particle::Pointer >();
+ itk::VectorContainer<unsigned int, mitk::Particle::Pointer>::Pointer container =
+ itk::VectorContainer<unsigned int, mitk::Particle::Pointer>::New();
+
+ int numPoints = particleContainer->size();
+ if(numPoints<2)
+ return container;
+
+ mitk::Particle::Pointer source = particleContainer->at(0);
+ mitk::Particle::Pointer sink = particleContainer->at(numPoints-1);
+
+ float Leng = 0;
+
+ container->InsertElement(container->Size(), source);
+
+ float dtau = 0;
+ int cur_p = 1;
+ int cur_i = 1;
+ vnl_vector_fixed<float, 3> dR;
+ float normdR;
+
+ for (;;)
+ {
+ while (dtau <= len && cur_p < numPoints)
+ {
+ dR = particleContainer->at(cur_p)->GetPosition() - particleContainer->at(cur_p-1)->GetPosition(); // vector between two particle centers
+ normdR = squareNorm(dR); // square length of above vector
+ dtau += normdR;
+ Leng += normdR;
+ cur_p++;
+ }
+
+ if (dtau >= len) // if particles reach next voxel
+ {
+ // proposal = current particle position - (current p - last p)*(current fibre length - len???)/(norm current p-last p)
+ //particles_proposal[cur_i].R = particles[cur_p-1].R - dR*( (dtau-len)/normdR );
+ mitk::Particle::Pointer newSegment = mitk::Particle::New();
+ newSegment->SetPosition(particleContainer->at(cur_p-1)->GetPosition() - dR*( (dtau-len)/normdR ));
+ dR.normalize();
+ newSegment->SetDirection(dR);
+ newSegment->SetWidth(particleContainer->at(cur_p-1)->GetWidth());
+ container->InsertElement(container->Size(), newSegment);
+ }
+ else
+ {
+ container->InsertElement(container->Size(), sink);
+ break;
+ }
+
+ dtau = dtau-len;
+
+ cur_i++;
+ }
+ return container;
+}
+
diff --git a/Modules/DiffusionImaging/Tractography/itkGlobalTractographyFilter.cpp b/Modules/DiffusionImaging/Tractography/itkGlobalTractographyFilter.cpp
new file mode 100644
index 0000000000..ec4877cc62
--- /dev/null
+++ b/Modules/DiffusionImaging/Tractography/itkGlobalTractographyFilter.cpp
@@ -0,0 +1,472 @@
+#include "itkGlobalTractographyFilter.h"
+
+#include <itkProgressReporter.h>
+
+#include <mitkQBallImage.h>
+#include "itkPointShell.h"
+
+#include "GlobalTracking/BuildFibres.cpp"
+
+#include <itkEventObject.h>
+
+#include <QMutexLocker>
+#include <itkHistogram.h>
+#include <itkListSampleToHistogramGenerator.h>
+#include <vnl/vnl_matrix_fixed.h>
+#include <vnl/vnl_vector_fixed.h>
+#include <itkzlib/zlib.h>
+
+#include "GlobalTracking/reparametrize_arclen2.cpp"
+#include <fstream>
+
+struct LessDereference {
+ template <class T>
+ bool operator()(const T * lhs, const T * rhs) const {
+ return *lhs < *rhs;
+ }
+};
+
+namespace itk{
+
+ template< class TInputOdfImage, class TInputROIImage >
+ GlobalTractographyFilter< TInputOdfImage, TInputROIImage >
+ ::GlobalTractographyFilter():
+ m_TempStart(0.1),
+ m_TempEnd(0.001),
+ m_NumIt(500000),
+ m_ParticleWeight(0),
+ m_ParticleWidth(0),
+ m_ParticleLength(0),
+ m_ChempotConnection(10),
+ m_ChempotParticle(0),
+ m_InexBalance(0),
+ m_Chempot2(0.2),
+ m_FiberLength(10),
+ m_AbortTracking(false),
+ m_NumConnections(0),
+ m_NumParticles(0),
+ m_NumAcceptedFibers(0),
+ m_CurrentStep(0),
+ m_SubtractMean(true),
+ m_BuildFibers(false),
+ m_Sampler(NULL),
+ m_Steps(10),
+ m_Memory(0),
+ m_ProposalAcceptance(0)
+ {
+ //this->m_MeasurementFrame.set_identity();
+ this->SetNumberOfRequiredInputs(2); //Filter needs a DWI image + a Mask Image
+ }
+
+ template< class TInputOdfImage, class TInputROIImage >
+ GlobalTractographyFilter< TInputOdfImage, TInputROIImage >
+ ::~GlobalTractographyFilter(){
+ delete BESSEL_APPROXCOEFF;
+ if (m_Sampler!=NULL)
+ delete m_Sampler;
+ }
+
+ template< class TInputOdfImage, class TInputROIImage >
+ void
+ GlobalTractographyFilter< TInputOdfImage, TInputROIImage >
+ ::ComputeFiberCorrelation(){
+
+// float bD = 15;
+
+// vnl_matrix_fixed<double, 3, QBALL_ODFSIZE> bDir =
+// *itk::PointShell<QBALL_ODFSIZE, vnl_matrix_fixed<double, 3, QBALL_ODFSIZE> >::DistributePointShell();
+
+// const int N = QBALL_ODFSIZE;
+
+// vnl_matrix_fixed<double, QBALL_ODFSIZE, 3> temp = bDir.transpose();
+// vnl_matrix_fixed<double, N, N> C = temp*bDir;
+// vnl_matrix_fixed<double, N, N> Q = C;
+// vnl_vector_fixed<double, N> mean;
+// for(int i=0; i<N; i++)
+// {
+// double tempMean = 0;
+// for(int j=0; j<N; j++)
+// {
+// C(i,j) = abs(C(i,j));
+// Q(i,j) = exp(-bD * C(i,j) * C(i,j));
+// tempMean += Q(i,j);
+// }
+// mean[i] = tempMean/N;
+// }
+
+// vnl_matrix_fixed<double, N, N> repMean;
+// for (int i=0; i<N; i++)
+// repMean.set_row(i, mean);
+// Q -= repMean;
+
+// vnl_matrix_fixed<double, N, N> P = Q*Q;
+
+// std::vector<const double *> pointer;
+// pointer.reserve(N*N);
+// double * start = C.data_block();
+// double * end = start + N*N;
+// for (double * iter = start; iter != end; ++iter)
+// {
+// pointer.push_back(iter);
+// }
+// std::sort(pointer.begin(), pointer.end(), LessDereference());
+
+// vnl_vector_fixed<double,N*N> alpha;
+// vnl_vector_fixed<double,N*N> beta;
+// for (int i=0; i<N*N; i++) {
+// alpha(i) = *pointer[i];
+// beta(i) = *(P.data_block()+(pointer[i]-start));
+// }
+
+// double nfac = sqrt(beta(N*N-1));
+// beta = beta / (nfac*nfac);
+// Q = Q / nfac;
+
+// double sum = 0;
+// for(int i=0; i<N; i++)
+// {
+// sum += Q(0,i);
+// }
+// // if left to default 0
+// // then mean is not substracted in order to correct odf integral
+// // this->m_Meanval_sq = (sum*sum)/N;
+
+// vnl_vector_fixed<double,N*N> alpha_0;
+// vnl_vector_fixed<double,N*N> alpha_2;
+// vnl_vector_fixed<double,N*N> alpha_4;
+// vnl_vector_fixed<double,N*N> alpha_6;
+// for(int i=0; i<N*N; i++)
+// {
+// alpha_0(i) = 1;
+// alpha_2(i) = alpha(i)*alpha(i);
+// alpha_4(i) = alpha_2(i)*alpha_2(i);
+// alpha_6(i) = alpha_4(i)*alpha_2(i);
+// }
+
+// vnl_matrix_fixed<double, N*N, 4> T;
+// T.set_column(0,alpha_0);
+// T.set_column(1,alpha_2);
+// T.set_column(2,alpha_4);
+// T.set_column(3,alpha_6);
+
+// vnl_vector_fixed<double,4> coeff = vnl_matrix_inverse<double>(T).pinverse()*beta;
+
+// MITK_INFO << "Bessel oefficients: " << coeff;
+
+ BESSEL_APPROXCOEFF = new float[4];
+
+// BESSEL_APPROXCOEFF[0] = coeff(0);
+// BESSEL_APPROXCOEFF[1] = coeff(1);
+// BESSEL_APPROXCOEFF[2] = coeff(2);
+// BESSEL_APPROXCOEFF[3] = coeff(3);
+ BESSEL_APPROXCOEFF[0] = -0.1714;
+ BESSEL_APPROXCOEFF[1] = 0.5332;
+ BESSEL_APPROXCOEFF[2] = -1.4889;
+ BESSEL_APPROXCOEFF[3] = 2.0389;
+ }
+
+ // build fibers from tracking result
+ template< class TInputOdfImage, class TInputROIImage >
+ void
+ GlobalTractographyFilter< TInputOdfImage, TInputROIImage >
+ ::BuildFibers(float* points, int numPoints)
+ {
+ MITK_INFO << "Building fibers ...";
+
+ typename InputQBallImageType::Pointer odfImage
+ = dynamic_cast<InputQBallImageType*>(this->GetInput(0));
+ double spacing[3];
+ spacing[0] = odfImage->GetSpacing().GetElement(0);
+ spacing[1] = odfImage->GetSpacing().GetElement(1);
+ spacing[2] = odfImage->GetSpacing().GetElement(2);
+
+ // initialize array of particles
+ CCAnalysis ccana(points, numPoints, spacing);
+
+ // label the particles according to fiber affiliation and return number of fibers
+ int numFibers = ccana.iterate(m_FiberLength);
+
+ if (numFibers<=0){
+ MITK_INFO << "0 fibers accepted";
+ return;
+ }
+
+ // fill output datastructure
+ m_FiberBundle.clear();
+ for (int i = 0; i < numFibers; i++)
+ {
+ vector< Particle* >* particleContainer = ccana.m_FiberContainer->at(i);
+
+ // resample fibers
+ std::vector< Particle* >* pCon = ResampleFibers(particleContainer, 0.9*spacing[0]);
+
+ FiberTractType tract;
+ for (int j=0; j<pCon->size(); j++)
+ {
+ Particle* particle = pCon->at(j);
+ pVector p = particle->R;
+
+ itk::Point<float, 3> point;
+ point[0] = p[0]-0.5;
+ point[1] = p[1]-0.5;
+ point[2] = p[2]-0.5;
+ tract.push_back(point);
+ delete(particle);
+ }
+ m_FiberBundle.push_back(tract);
+ delete(pCon);
+ }
+ m_NumAcceptedFibers = numFibers;
+ MITK_INFO << "itkGlobalTractographyFilter: " << numFibers << " fibers accepted";
+ }
+
+ // fill output fiber bundle datastructure
+ template< class TInputOdfImage, class TInputROIImage >
+ typename GlobalTractographyFilter< TInputOdfImage, TInputROIImage >::FiberBundleType*
+ GlobalTractographyFilter< TInputOdfImage, TInputROIImage >
+ ::GetFiberBundle()
+ {
+ if (!m_AbortTracking)
+ {
+ m_BuildFibers = true;
+ while (m_BuildFibers){}
+ }
+
+ return &m_FiberBundle;
+ }
+
+ // get memory allocated for particle grid
+ template< class TInputOdfImage, class TInputROIImage >
+ float
+ GlobalTractographyFilter< TInputOdfImage, TInputROIImage >
+ ::GetMemoryUsage()
+ {
+ if (m_Sampler!=NULL)
+ return m_Sampler->m_ParticleGrid.GetMemoryUsage();
+ return 0;
+ }
+
+ // perform global tracking
+ template< class TInputOdfImage, class TInputROIImage >
+ void
+ GlobalTractographyFilter< TInputOdfImage, TInputROIImage >
+ ::GenerateData(){
+
+ // input qball image
+ m_ItkQBallImage = dynamic_cast<InputQBallImageType*>(this->GetInput(0));
+
+ // approximationscoeffizienten der
+ // teilchenkorrelationen im orientierungsraum
+ // 4er vektor
+ ComputeFiberCorrelation();
+
+ // image sizes and spacing
+ int qBallImageSize[4] = {QBALL_ODFSIZE,
+ m_ItkQBallImage->GetLargestPossibleRegion().GetSize().GetElement(0),
+ m_ItkQBallImage->GetLargestPossibleRegion().GetSize().GetElement(1),
+ m_ItkQBallImage->GetLargestPossibleRegion().GetSize().GetElement(2)};
+ double qBallImageSpacing[3] = {m_ItkQBallImage->GetSpacing().GetElement(0),m_ItkQBallImage->GetSpacing().GetElement(1),m_ItkQBallImage->GetSpacing().GetElement(2)};
+
+ // make sure image has enough slices
+ if (qBallImageSize[1]<3 || qBallImageSize[2]<3 || qBallImageSize[3]<3)
+ {
+ MITK_INFO << "image size < 3 not supported";
+ return;
+ }
+
+ // calculate rotation matrix
+ vnl_matrix_fixed<double, 3, 3> directionMatrix = m_ItkQBallImage->GetDirection().GetVnlMatrix();
+ vnl_vector_fixed<double, 3> d0 = directionMatrix.get_column(0); d0.normalize();
+ vnl_vector_fixed<double, 3> d1 = directionMatrix.get_column(1); d1.normalize();
+ vnl_vector_fixed<double, 3> d2 = directionMatrix.get_column(2); d2.normalize();
+ directionMatrix.set_column(0, d0);
+ directionMatrix.set_column(1, d1);
+ directionMatrix.set_column(2, d2);
+ vnl_matrix_fixed<double, 3, 3> I = directionMatrix*directionMatrix.transpose();
+ if(!I.is_identity(mitk::eps)){
+ MITK_INFO << "Image direction is not a rotation matrix. Tracking not possible!";
+ return;
+ }
+
+ // generate local working copy of image buffer
+ int bufferSize = qBallImageSize[0]*qBallImageSize[1]*qBallImageSize[2]*qBallImageSize[3];
+ float* qBallImageBuffer = (float*) m_ItkQBallImage->GetBufferPointer();
+ float* workingQballImage = new float[bufferSize];
+ for (int i=0; i<bufferSize; i++)
+ workingQballImage[i] = qBallImageBuffer[i];
+
+ // perform mean subtraction on odfs
+ if (m_SubtractMean)
+ {
+ float sum = 0;
+ for (int i=0; i<bufferSize; i++)
+ {
+ if (qBallImageSize[0]>0 && i%qBallImageSize[0] == 0 && i>0)
+ {
+ sum /= qBallImageSize[0];
+ for (int j=i-qBallImageSize[0]; j<i; j++){
+ workingQballImage[j] -= sum;
+ }
+ sum = 0;
+ }
+ sum += workingQballImage[i];
+ }
+ }
+
+ // mask image
+ int maskImageSize[3];
+ float *mask;
+ if(m_MaskImage.IsNotNull())
+ {
+ mask = (float*) m_MaskImage->GetBufferPointer();
+ maskImageSize[0] = m_MaskImage->GetLargestPossibleRegion().GetSize().GetElement(0);
+ maskImageSize[1] = m_MaskImage->GetLargestPossibleRegion().GetSize().GetElement(1);
+ maskImageSize[2] = m_MaskImage->GetLargestPossibleRegion().GetSize().GetElement(2);
+ }
+ else
+ {
+ mask = 0;
+ maskImageSize[0] = qBallImageSize[1];
+ maskImageSize[1] = qBallImageSize[2];
+ maskImageSize[2] = qBallImageSize[3];
+ }
+ int mask_oversamp_mult = maskImageSize[0]/qBallImageSize[1];
+
+ // load lookuptable
+ ifstream BaryCoords;
+ BaryCoords.open("FiberTrackingLUTBaryCoords.bin", ios::in | ios::binary);
+ float* coords;
+ if (BaryCoords.is_open())
+ {
+ float tmp;
+ coords = new float [1630818];
+ BaryCoords.seekg (0, ios::beg);
+ for (int i=0; i<1630818; i++)
+ {
+ BaryCoords.read((char *)&tmp, sizeof(tmp));
+ coords[i] = tmp;
+ }
+ BaryCoords.close();
+ }
+ else
+ {
+ MITK_INFO << "Unable to open barycoords file";
+ return;
+ }
+
+ ifstream Indices;
+ Indices.open("FiberTrackingLUTIndices.bin", ios::in | ios::binary);
+ int* ind;
+ if (Indices.is_open())
+ {
+ int tmp;
+ ind = new int [1630818];
+ Indices.seekg (0, ios::beg);
+ for (int i=0; i<1630818; i++)
+ {
+ Indices.read((char *)&tmp, 4);
+ ind[i] = tmp;
+ }
+ Indices.close();
+ }
+ else
+ {
+ MITK_INFO << "Unable to open indices file";
+ return;
+ }
+
+ // initialize sphere interpolator with lookuptables
+ SphereInterpolator *sinterp = new SphereInterpolator(coords, ind, QBALL_ODFSIZE, 301, 0.5);
+
+ // get paramters
+ float minSpacing;
+ if(qBallImageSpacing[0]<qBallImageSpacing[1] && qBallImageSpacing[0]<qBallImageSpacing[2])
+ minSpacing = qBallImageSpacing[0];
+ else if (qBallImageSpacing[1] < qBallImageSpacing[2])
+ minSpacing = qBallImageSpacing[1];
+ else
+ minSpacing = qBallImageSpacing[2];
+
+ if(m_ParticleLength == 0)
+ m_ParticleLength = 1.5*minSpacing;
+ if(m_ParticleWidth == 0)
+ m_ParticleWidth = 0.5*minSpacing;
+ if(m_ParticleWeight == 0)
+ m_ParticleWeight = 0.01;
+ m_CurrentStep = 0;
+ m_Memory = 0;
+
+ float cellsize = 2*m_ParticleLength;
+ float curvatureHardThreshold = 0.7;
+ float alpha = log(m_TempEnd/m_TempStart);
+ m_Steps = m_NumIt/10000;
+ if (m_Steps<10)
+ m_Steps = 10;
+ if (m_Steps>m_NumIt)
+ {
+ MITK_INFO << "not enough iterations!";
+ return;
+ }
+ unsigned long singleIts = (unsigned long)((1.0*m_NumIt) / (1.0*m_Steps));
+
+ // setup metropolis hastings sampler
+ MITK_INFO << "itkGlobalTractographyFilter: setting up MH-sampler";
+ if (m_Sampler!=NULL)
+ delete m_Sampler;
+ m_Sampler = new RJMCMC(NULL, 0, workingQballImage, qBallImageSize, qBallImageSpacing, cellsize);
+
+ // setup energy computer
+ MITK_INFO << "itkGlobalTractographyFilter: setting up Energy-computer";
+ EnergyComputer encomp(workingQballImage,qBallImageSize,qBallImageSpacing,sinterp,&(m_Sampler->m_ParticleGrid),mask,mask_oversamp_mult, directionMatrix);
+ encomp.setParameters(m_ParticleWeight,m_ParticleWidth,m_ChempotConnection*m_ParticleLength*m_ParticleLength,m_ParticleLength,curvatureHardThreshold,m_InexBalance,m_Chempot2);
+ m_Sampler->SetEnergyComputer(&encomp);
+ m_Sampler->SetParameters(m_TempStart,singleIts,m_ParticleLength,curvatureHardThreshold,m_ChempotParticle);
+
+ // main loop
+ for( int step = 0; step < m_Steps; step++ )
+ {
+ if (m_AbortTracking)
+ break;
+
+ m_CurrentStep = step+1;
+ float temperature = m_TempStart * exp(alpha*(((1.0)*step)/((1.0)*m_Steps)));
+ MITK_INFO << "iterating step " << m_CurrentStep;
+
+ m_Sampler->SetTemperature(temperature);
+ m_Sampler->Iterate(&m_ProposalAcceptance, &m_NumConnections, &m_NumParticles, &m_AbortTracking);
+
+ MITK_INFO << "proposal acceptance: " << 100*m_ProposalAcceptance << "%";
+ MITK_INFO << "particles: " << m_NumParticles;
+ MITK_INFO << "connections: " << m_NumConnections;
+
+ if (m_BuildFibers)
+ {
+ int numPoints = m_Sampler->m_ParticleGrid.pcnt;
+ float* points = new float[numPoints*m_Sampler->m_NumAttributes];
+ m_Sampler->WriteOutParticles(points);
+ BuildFibers(points, numPoints);
+ delete points;
+ m_BuildFibers = false;
+ }
+ }
+
+ int numPoints = m_Sampler->m_ParticleGrid.pcnt;
+ float* points = new float[numPoints*m_Sampler->m_NumAttributes];
+ m_Sampler->WriteOutParticles(points);
+ BuildFibers(points, numPoints);
+ delete points;
+
+ delete sinterp;
+ delete coords;
+ delete ind;
+ delete workingQballImage;
+ m_AbortTracking = true;
+ m_BuildFibers = false;
+
+ MITK_INFO << "done generate data";
+ }
+}
+
+
+
+
diff --git a/Modules/DiffusionImaging/Tractography/itkGlobalTractographyFilter.h b/Modules/DiffusionImaging/Tractography/itkGlobalTractographyFilter.h
new file mode 100644
index 0000000000..45c31a9f09
--- /dev/null
+++ b/Modules/DiffusionImaging/Tractography/itkGlobalTractographyFilter.h
@@ -0,0 +1,164 @@
+#ifndef itkGlobalTractographyFilter_h
+#define itkGlobalTractographyFilter_h
+
+#include "itkProcessObject.h"
+#include "itkVectorContainer.h"
+#include "itkImage.h"
+
+#include "GlobalTracking/pcRJMCMC.cpp"
+#include "GlobalTracking/auxilary_classes.cpp"
+
+#include <fstream>
+
+namespace itk{
+
+ template< class TInputQBallImage, class TInputROIImage >
+ class GlobalTractographyFilter :
+ public ProcessObject{
+ public:
+ typedef GlobalTractographyFilter Self;
+ typedef ProcessObject Superclass;
+ typedef SmartPointer< Self > Pointer;
+ typedef SmartPointer< const Self > ConstPointer;
+
+ itkNewMacro(Self);
+ itkTypeMacro( GlobalTractographyFilter, ProcessObject );
+
+ /** Types for the DWI Input Image **/
+ typedef TInputQBallImage InputQBallImageType;
+
+ /** Types for the Mask Image **/
+ typedef TInputROIImage MaskImageType;
+ typedef typename MaskImageType::Pointer MaskImageTypePointer;
+
+ typedef std::vector< itk::Point<float, 3> > FiberTractType;
+ typedef std::vector< FiberTractType > FiberBundleType;
+
+ itkSetMacro( TempStart, float );
+ itkGetMacro( TempStart, float );
+
+ itkSetMacro( TempEnd, float );
+ itkGetMacro( TempEnd, float );
+
+ itkSetMacro( NumIt, int );
+ itkGetMacro( NumIt, int );
+
+ itkSetMacro( ParticleWeight, float );
+ itkGetMacro( ParticleWeight, float );
+
+ /** width of particle sigma (std-dev of gaussian around center) **/
+ itkSetMacro( ParticleWidth, float );
+ itkGetMacro( ParticleWidth, float );
+
+ /** length of particle from midpoint to ends **/
+ itkSetMacro( ParticleLength, float );
+ itkGetMacro( ParticleLength, float );
+
+ itkSetMacro( ChempotConnection, float );
+ itkGetMacro( ChempotConnection, float );
+
+ itkSetMacro( ChempotParticle, float );
+ itkGetMacro( ChempotParticle, float );
+
+ itkSetMacro( InexBalance, float );
+ itkGetMacro( InexBalance, float );
+
+ itkSetMacro( Chempot2, float );
+ itkGetMacro( Chempot2, float );
+
+ itkSetMacro( FiberLength, int );
+ itkGetMacro( FiberLength, int );
+
+ itkGetMacro( Steps, int );
+
+ itkSetMacro( AbortTracking, bool );
+ itkGetMacro( AbortTracking, bool );
+
+ itkSetMacro( CurrentStep, unsigned long );
+ itkGetMacro( CurrentStep, unsigned long );
+
+ itkSetMacro( SubtractMean, bool);
+ itkGetMacro( SubtractMean, bool);
+
+ /** Set/Get the Odf Input Image **/
+ itkSetInputMacro(OdfImage, InputQBallImageType, 0);
+ itkGetInputMacro(OdfImage, InputQBallImageType, 0);
+
+ /** Set/Get the Input mask image **/
+ itkSetMacro(MaskImage, MaskImageTypePointer);
+ itkGetMacro(MaskImage, MaskImageTypePointer);
+
+ itkGetMacro(NumParticles, unsigned long);
+ itkGetMacro(NumConnections, unsigned long);
+ itkGetMacro(NumAcceptedFibers, int);
+ itkGetMacro(ProposalAcceptance, float);
+
+ /** Entry Point For the Algorithm: Is invoked when Update() is called
+ either directly or through itk pipeline propagation
+ **/
+ void GenerateData();
+
+ /** override the Process Object Update because we don't have a
+ dataobject as an outpgnome themeut. We can change this later by wrapping the
+ tractcontainer in a dataobject decorator and letting the Superclass
+ know about it.
+ **/
+ struct StochasticTractGenerationCallbackStruct{
+ Pointer Filter;
+ };
+
+ virtual void Update(){
+ this->GenerateData();
+ }
+
+ FiberBundleType* GetFiberBundle();
+ float GetMemoryUsage();
+
+ protected:
+
+ GlobalTractographyFilter();
+ virtual ~GlobalTractographyFilter();
+
+ void ComputeFiberCorrelation();
+
+ void BuildFibers(float* points, int numPoints);
+
+ // Input Images
+ typename InputQBallImageType::Pointer m_ItkQBallImage;
+ typename MaskImageType::Pointer m_MaskImage;
+
+ // Tracking parameters
+ float m_TempStart; // Start temperature
+ float m_TempEnd; // End temperature
+ unsigned long m_NumIt; // Total number of iterations
+ unsigned long m_CurrentStep; // current tracking step
+ float m_ParticleWeight; //w (unitless)
+ float m_ParticleWidth; //sigma (mm)
+ float m_ParticleLength; // ell (mm)
+ float m_ChempotConnection; // gross L (chemisches potential)
+ float m_ChempotParticle;// unbenutzt (immer null, wenn groesser dann insgesamt weniger teilchen)
+ float m_InexBalance; // gewichtung zwischen den lambdas
+ // -5 ... 5 -> nur intern ... nur extern,default 0
+ float m_Chempot2; // typischerweise 0,
+ // korrektur fuer das geschaetzte integral
+ int m_FiberLength;
+ bool m_AbortTracking;
+ bool m_SubtractMean;
+ int m_NumAcceptedFibers;
+ bool m_BuildFibers;
+ int m_Steps;
+ float m_Memory;
+ float m_ProposalAcceptance;
+
+ RJMCMC* m_Sampler;
+ FiberBundleType m_FiberBundle;
+ unsigned long m_NumParticles;
+ unsigned long m_NumConnections;
+ };
+}
+
+#ifndef ITK_MANUAL_INSTANTIATION
+#include "itkGlobalTractographyFilter.cpp"
+#endif
+
+#endif
diff --git a/Modules/DiffusionImaging/files.cmake b/Modules/DiffusionImaging/files.cmake
index 9884e4acef..59c190f5cc 100644
--- a/Modules/DiffusionImaging/files.cmake
+++ b/Modules/DiffusionImaging/files.cmake
@@ -1,75 +1,104 @@
-SET(CPP_FILES
+SET(CPP_FILES
- # Algorithms
- Algorithms/itkDiffusionQballGeneralizedFaImageFilter.h
- Algorithms/itkDiffusionQballPrepareVisualizationImageFilter.h
- Algorithms/itkTensorDerivedMeasurementsFilter.h
- Algorithms/itkBrainMaskExtractionImageFilter.h
- Algorithms/itkB0ImageExtractionImageFilter.h
- Algorithms/itkTensorImageToDiffusionImageFilter.h
- Algorithms/itkTensorToL2NormImageFilter.h
-
# DicomImport
DicomImport/mitkDicomDiffusionImageReader.cpp
DicomImport/mitkGroupDiffusionHeadersFilter.cpp
DicomImport/mitkDicomDiffusionImageHeaderReader.cpp
DicomImport/mitkGEDicomDiffusionImageHeaderReader.cpp
DicomImport/mitkPhilipsDicomDiffusionImageHeaderReader.cpp
DicomImport/mitkSiemensDicomDiffusionImageHeaderReader.cpp
DicomImport/mitkSiemensMosaicDicomDiffusionImageHeaderReader.cpp
# DataStructures
IODataStructures/mitkDiffusionImagingObjectFactory.cpp
# DataStructures -> DWI
IODataStructures/DiffusionWeightedImages/mitkDiffusionImageHeaderInformation.cpp
IODataStructures/DiffusionWeightedImages/mitkDiffusionImageSource.cpp
IODataStructures/DiffusionWeightedImages/mitkNrrdDiffusionImageReader.cpp
IODataStructures/DiffusionWeightedImages/mitkNrrdDiffusionImageWriter.cpp
IODataStructures/DiffusionWeightedImages/mitkNrrdDiffusionImageIOFactory.cpp
IODataStructures/DiffusionWeightedImages/mitkNrrdDiffusionImageWriterFactory.cpp
+ IODataStructures/DiffusionWeightedImages/mitkDiffusionImageSerializer.cpp
# DataStructures -> QBall
IODataStructures/QBallImages/mitkQBallImageSource.cpp
IODataStructures/QBallImages/mitkNrrdQBallImageReader.cpp
IODataStructures/QBallImages/mitkNrrdQBallImageWriter.cpp
IODataStructures/QBallImages/mitkNrrdQBallImageIOFactory.cpp
IODataStructures/QBallImages/mitkNrrdQBallImageWriterFactory.cpp
IODataStructures/QBallImages/mitkQBallImage.cpp
+ IODataStructures/QBallImages/mitkQBallImageSerializer.cpp
# DataStructures -> Tensor
IODataStructures/TensorImages/mitkTensorImageSource.cpp
IODataStructures/TensorImages/mitkNrrdTensorImageReader.cpp
IODataStructures/TensorImages/mitkNrrdTensorImageWriter.cpp
IODataStructures/TensorImages/mitkNrrdTensorImageIOFactory.cpp
IODataStructures/TensorImages/mitkNrrdTensorImageWriterFactory.cpp
IODataStructures/TensorImages/mitkTensorImage.cpp
+ IODataStructures/TensorImages/mitkTensorImageSerializer.cpp
+
+ # DataStructures -> FiberBundle
+ IODataStructures/FiberBundle/mitkFiberBundle.cpp
+ IODataStructures/FiberBundle/mitkFiberBundleWriter.cpp
+ IODataStructures/FiberBundle/mitkFiberBundleReader.cpp
+ IODataStructures/FiberBundle/mitkFiberBundleIOFactory.cpp
+ IODataStructures/FiberBundle/mitkFiberBundleWriterFactory.cpp
+ IODataStructures/FiberBundle/mitkFiberBundleSerializer.cpp
+ IODataStructures/FiberBundle/mitkParticle.cpp
+
+ # DataStructures -> PlanarFigureComposite
+ IODataStructures/PlanarFigureComposite/mitkPlanarFigureComposite.cpp
# Rendering
Rendering/vtkMaskedProgrammableGlyphFilter.cpp
Rendering/mitkCompositeMapper.cpp
Rendering/mitkVectorImageVtkGlyphMapper3D.cpp
Rendering/vtkOdfSource.cxx
Rendering/vtkThickPlane.cxx
Rendering/mitkOdfNormalizationMethodProperty.cpp
Rendering/mitkOdfScaleByProperty.cpp
+ Rendering/mitkFiberBundleMapper3D.cpp
+
+ # Interactions
+ Interactions/mitkFiberBundleInteractor.cpp
)
-SET(H_FILES
+SET(H_FILES
+ # Rendering
Rendering/mitkDiffusionImageMapper.h
+ Rendering/mitkOdfVtkMapper2D.h
+
+ # Reconstruction
Reconstruction/itkDiffusionQballReconstructionImageFilter.h
Reconstruction/mitkTeemDiffusionTensor3DReconstructionImageFilter.h
Reconstruction/itkAnalyticalDiffusionQballReconstructionImageFilter.h
Reconstruction/itkPointShell.h
Reconstruction/itkOrientationDistributionFunction.h
- IODataStructures/DiffusionWeightedImages/mitkDiffusionImage.h
- Rendering/mitkOdfVtkMapper2D.h
+
+ # IO Datastructures
+ IODataStructures/DiffusionWeightedImages/mitkDiffusionImage.h
+ IODataStructures/FiberBundle/itkSlowPolyLineParametricPath.h
+
+ # Tractography
+ Tractography/itkGlobalTractographyFilter.h
+
+ # Algorithms
+ Algorithms/itkDiffusionQballGeneralizedFaImageFilter.h
+ Algorithms/itkDiffusionQballPrepareVisualizationImageFilter.h
+ Algorithms/itkTensorDerivedMeasurementsFilter.h
+ Algorithms/itkBrainMaskExtractionImageFilter.h
+ Algorithms/itkB0ImageExtractionImageFilter.h
+ Algorithms/itkTensorImageToDiffusionImageFilter.h
+ Algorithms/itkTensorToL2NormImageFilter.h
+ Algorithms/itkTractsToProbabilityImageFilter.h
)
SET( TOOL_FILES
)
IF(WIN32)
ENDIF(WIN32)
-#MITK_MULTIPLEX_PICTYPE( Algorithms/mitkImageRegistrationMethod-TYPE.cpp )
+#MITK_MULTIPLEX_PICTYPE( Algorithms/mitkImageRegistrationMethod-TYPE.cpp )
diff --git a/Modules/IGT/CMakeLists.txt b/Modules/IGT/CMakeLists.txt
index 86c067a85e..f01dd52f60 100644
--- a/Modules/IGT/CMakeLists.txt
+++ b/Modules/IGT/CMakeLists.txt
@@ -1,30 +1,37 @@
INCLUDE(MITKIGTHardware.cmake)
IF(MITK_USE_MICRON_TRACKER)
SET(INCLUDE_DIRS_INTERNAL ${INCLUDE_DIRS_INTERNAL} ${MITK_MICRON_TRACKER_INCLUDE_DIR})
SET(ADDITIONAL_LIBS ${ADDITIONAL_LIBS} ${MITK_MICRON_TRACKER_LIB})
ENDIF(MITK_USE_MICRON_TRACKER)
IF(MITK_USE_MICROBIRD_TRACKER)
SET(INCLUDE_DIRS_INTERNAL ${INCLUDE_DIRS_INTERNAL} ${MITK_USE_MICROBIRD_TRACKER_INCLUDE_DIR})
SET(ADDITIONAL_LIBS ${ADDITIONAL_LIBS} ${MITK_USE_MICROBIRD_TRACKER_LIB})
ENDIF(MITK_USE_MICROBIRD_TRACKER)
MITK_CREATE_MODULE(MitkIGT
SUBPROJECTS MITK-IGT
INCLUDE_DIRS IGTFilters IGTTrackingDevices IGTToolManagement
INTERNAL_INCLUDE_DIRS ${INCLUDE_DIRS_INTERNAL}
DEPENDS Mitk tinyxml SceneSerialization
PROVIDES mitkIGT
ADDITIONAL_LIBS "${ADDITIONAL_LIBS}"
)
+
+MITK_CHECK_MODULE(_RESULT MitkIGT)
+IF(_RESULT)
+ MESSAGE(STATUS "IGTTutorialStep1 won't be built. Missing: ${_RESULT}")
+ELSE(_RESULT)
## create IGT config
CONFIGURE_FILE(mitkIGTConfig.h.in ${PROJECT_BINARY_DIR}/mitkIGTConfig.h @ONLY)
# add test programm for serial communication classADD_EXECUTABLE(SerialCommunicationTest IGTTrackingDevices/mitkSerialCommunicationTest.cpp)TARGET_LINK_LIBRARIES(SerialCommunicationTest mitkIGT mitkCore tinyxml PocoXML)
ADD_EXECUTABLE (IGTTutorialStep1 IGTTutorial/IGTTutorialStep1.cpp)
TARGET_LINK_LIBRARIES(IGTTutorialStep1 mitkIGT mitkCore tinyxml PocoXML)
ADD_SUBDIRECTORY(Testing)
+ENDIF(_RESULT)
+
diff --git a/Modules/IGT/IGTFilters/mitkNavigationDataRecorder.cpp b/Modules/IGT/IGTFilters/mitkNavigationDataRecorder.cpp
index 79379b396a..816471362e 100644
--- a/Modules/IGT/IGTFilters/mitkNavigationDataRecorder.cpp
+++ b/Modules/IGT/IGTFilters/mitkNavigationDataRecorder.cpp
@@ -1,309 +1,325 @@
/*=========================================================================
Program: Medical Imaging & Interaction Toolkit
Language: C++
Date: $Date: 2007-12-11 14:46:19 +0100 (Di, 11 Dez 2007) $
Version: $Revision: 13129 $
Copyright (c) German Cancer Research Center, Division of Medical and
Biological Informatics. All rights reserved.
See MITKCopyright.txt or http://www.mitk.org/copyright.html for details.
This software is distributed WITHOUT ANY WARRANTY; without even
the implied warranty of MERCHANTABILITY or FITNESS FOR A PARTICULAR
PURPOSE. See the above copyright notices for more information.
=========================================================================*/
#include "mitkNavigationDataRecorder.h"
#include <fstream>
#include <mitkTimeStamp.h>
#include <tinyxml.h>
#include <itksys/SystemTools.hxx>
mitk::NavigationDataRecorder::NavigationDataRecorder()
{
//set default values
m_NumberOfInputs = 0;
m_RecordingMode = NormalFile;
m_Recording = false;
m_NumberOfRecordedFiles = 0;
m_Stream = NULL;
m_FileName = "";
m_SystemTimeClock = RealTimeClock::New();
m_OutputFormat = mitk::NavigationDataRecorder::xml;
m_RecordCounter = 0;
m_RecordCountLimit = -1;
+ m_DoNotOverwriteFiles = false;
//To get a start time
mitk::TimeStamp::GetInstance()->Start(this);
}
mitk::NavigationDataRecorder::~NavigationDataRecorder()
{
}
void mitk::NavigationDataRecorder::GenerateData()
{
}
void mitk::NavigationDataRecorder::AddNavigationData( const NavigationData* nd )
{
// Process object is not const-correct so the const_cast is required here
this->SetNthInput(m_NumberOfInputs,
const_cast< mitk::NavigationData * >( nd ) );
m_NumberOfInputs++;
this->Modified();
}
void mitk::NavigationDataRecorder::SetRecordingMode( RecordingMode mode )
{
m_RecordingMode = mode;
this->Modified();
}
void mitk::NavigationDataRecorder::Update()
{
if (m_Recording)
{
DataObjectPointerArray inputs = this->GetInputs(); //get all inputs
mitk::NavigationData::TimeStampType timestamp=0.0; // timestamp for mitk time
timestamp = mitk::TimeStamp::GetInstance()->GetElapsed();
mitk::NavigationData::TimeStampType sysTimestamp = 0.0; // timestamp for system time
sysTimestamp = m_SystemTimeClock->GetCurrentStamp();
// cast system time double value to stringstream to avoid low precision rounding
std::ostringstream strs;
strs.precision(15); // rounding precision for system time double value
strs << sysTimestamp;
std::string sysTimeStr = strs.str();
//if csv-mode: write csv header and timpstamp at beginning
if (m_OutputFormat == mitk::NavigationDataRecorder::csv)
{
//write header only when it's the first line
if (m_firstLine)
{
m_firstLine = false;
*m_Stream << "TimeStamp";
for (unsigned int index = 0; index < inputs.size(); index++){ *m_Stream << ";Valid_Tool" << index <<
";X_Tool" << index <<
";Y_Tool" << index <<
";Z_Tool" << index <<
";QX_Tool" << index <<
";QY_Tool" << index <<
";QZ_Tool" << index <<
";QR_Tool" << index;}
*m_Stream << "\n";
}
//write timestamp (always)
*m_Stream << timestamp;
}
//write tool data for every tool
for (unsigned int index = 0; index < inputs.size(); index++)
{
mitk::NavigationData* nd = dynamic_cast<mitk::NavigationData*>(inputs[index].GetPointer());
nd->Update(); // call update to propagate update to previous filters
mitk::NavigationData::PositionType position;
mitk::NavigationData::OrientationType orientation(0.0, 0.0, 0.0, 0.0);
mitk::NavigationData::CovarianceMatrixType matrix;
bool hasPosition = true;
bool hasOrientation = true;
bool dataValid = false;
position.Fill(0.0);
matrix.SetIdentity();
position = nd->GetPosition();
orientation = nd->GetOrientation();
matrix = nd->GetCovErrorMatrix();
hasPosition = nd->GetHasPosition();
hasOrientation = nd->GetHasOrientation();
dataValid = nd->IsDataValid();
//use this one if you want the timestamps of the source
//timestamp = nd->GetTimeStamp();
//a timestamp is never < 0! this case happens only if you are using the timestamp of the nd object instead of getting a new one
if (timestamp >= 0)
{
if (this->m_OutputFormat == mitk::NavigationDataRecorder::xml)
{
TiXmlElement* elem = new TiXmlElement("NavigationData");
elem->SetDoubleAttribute("Time", timestamp);
elem->SetAttribute("SystemTime", sysTimeStr); // tag for system time
elem->SetDoubleAttribute("Tool", index);
elem->SetDoubleAttribute("X", position[0]);
elem->SetDoubleAttribute("Y", position[1]);
elem->SetDoubleAttribute("Z", position[2]);
elem->SetDoubleAttribute("QX", orientation[0]);
elem->SetDoubleAttribute("QY", orientation[1]);
elem->SetDoubleAttribute("QZ", orientation[2]);
elem->SetDoubleAttribute("QR", orientation[3]);
elem->SetDoubleAttribute("C00", matrix[0][0]);
elem->SetDoubleAttribute("C01", matrix[0][1]);
elem->SetDoubleAttribute("C02", matrix[0][2]);
elem->SetDoubleAttribute("C03", matrix[0][3]);
elem->SetDoubleAttribute("C04", matrix[0][4]);
elem->SetDoubleAttribute("C05", matrix[0][5]);
elem->SetDoubleAttribute("C10", matrix[1][0]);
elem->SetDoubleAttribute("C11", matrix[1][1]);
elem->SetDoubleAttribute("C12", matrix[1][2]);
elem->SetDoubleAttribute("C13", matrix[1][3]);
elem->SetDoubleAttribute("C14", matrix[1][4]);
elem->SetDoubleAttribute("C15", matrix[1][5]);
if (dataValid)
elem->SetAttribute("Valid",1);
else
elem->SetAttribute("Valid",0);
if (hasOrientation)
elem->SetAttribute("hO",1);
else
elem->SetAttribute("hO",0);
if (hasPosition)
elem->SetAttribute("hP",1);
else
elem->SetAttribute("hP",0);
*m_Stream << " " << *elem << std::endl;
delete elem;
}
else if (this->m_OutputFormat == mitk::NavigationDataRecorder::csv)
{
*m_Stream << ";" << dataValid << ";" << position[0] << ";" << position[1] << ";" << position[2] << ";" << orientation[0] << ";" << orientation[1] << ";" << orientation[2] << ";" << orientation[3];
}
}
}
if (this->m_OutputFormat == mitk::NavigationDataRecorder::csv)
{
*m_Stream << "\n";
}
}
m_RecordCounter++;
if ((m_RecordCountLimit<=m_RecordCounter)&&(m_RecordCountLimit != -1)) {StopRecording();}
}
void mitk::NavigationDataRecorder::StartRecording()
{
if (m_Recording)
{
std::cout << "Already recording please stop before start new recording session" << std::endl;
return;
}
if (m_Stream == NULL)
{
std::stringstream ss;
std::ostream* stream;
//An existing extension will be cut and replaced with .xml
std::string tmpPath = itksys::SystemTools::GetFilenamePath(m_FileName);
m_FileName = itksys::SystemTools::GetFilenameWithoutExtension(m_FileName);
- if (m_OutputFormat == mitk::NavigationDataRecorder::csv) ss << tmpPath << "/" << m_FileName << "-" << m_NumberOfRecordedFiles << ".csv";
- else ss << tmpPath << "/" << m_FileName << "-" << m_NumberOfRecordedFiles << ".xml";
+ std::string extension = ".xml";
+ if (m_OutputFormat == mitk::NavigationDataRecorder::csv)
+ extension = ".csv";
+
+ ss << tmpPath << "/" << m_FileName << "-" << m_NumberOfRecordedFiles << extension;
+
+ if( m_DoNotOverwriteFiles )
+ {
+ unsigned int index = m_NumberOfRecordedFiles+1;
+ while( itksys::SystemTools::FileExists( ss.str().c_str() ) )
+ {
+ ss.str("");
+ ss << tmpPath << "/" << m_FileName << "-" << index << extension;
+ index++;
+ }
+ }
+
switch(m_RecordingMode)
{
case Console:
stream = &std::cout;
break;
case NormalFile:
//Check if there is a file name and path
if (m_FileName == "")
{
stream = &std::cout;
std::cout << "No file name or file path set the output is redirected to the console";
}
else
{
stream = new std::ofstream(ss.str().c_str());
}
break;
case ZipFile:
stream = &std::cout;
std::cout << "Sorry no ZipFile support yet";
break;
default:
stream = &std::cout;
break;
}
m_firstLine = true;
m_RecordCounter = 0;
StartRecording(stream);
}
}
void mitk::NavigationDataRecorder::StartRecording(std::ostream* stream)
{
if (m_Recording)
{
std::cout << "Already recording please stop before start new recording session" << std::endl;
return;
}
m_Stream = stream;
m_Stream->precision(10);
//TODO store date and GMT time
if (m_Stream)
{
if (m_OutputFormat == mitk::NavigationDataRecorder::xml)
{
*m_Stream << "<?xml version=\"1.0\" encoding=\"UTF-8\" standalone=\"yes\"?>" << std::endl;
/**m_Stream << "<Version Ver=\"1\" />" << std::endl;*/
// should be a generic version, meaning a member variable, which has the actual version
*m_Stream << " " << "<Data ToolCount=\"" << (m_NumberOfInputs) << "\" version=\"1.0\">" << std::endl;
}
m_Recording = true;
}
}
void mitk::NavigationDataRecorder::StopRecording()
{
if (!m_Recording)
{
std::cout << "You have to start a recording first" << std::endl;
return;
}
if ((m_Stream) && (m_OutputFormat == mitk::NavigationDataRecorder::xml))
{
*m_Stream << "</Data>" << std::endl;
}
m_NumberOfRecordedFiles++;
m_Recording = false;
m_Stream->flush();
m_Stream = NULL;
}
\ No newline at end of file
diff --git a/Modules/IGT/IGTFilters/mitkNavigationDataRecorder.h b/Modules/IGT/IGTFilters/mitkNavigationDataRecorder.h
index a7801a076c..f0f22a4ff7 100644
--- a/Modules/IGT/IGTFilters/mitkNavigationDataRecorder.h
+++ b/Modules/IGT/IGTFilters/mitkNavigationDataRecorder.h
@@ -1,186 +1,193 @@
/*=========================================================================
Program: Medical Imaging & Interaction Toolkit
Language: C++
Date: $Date: 2008-02-08 13:23:19 +0100 (Fr, 08 Feb 2008) $
Version: $Revision: 13561 $
Copyright (c) German Cancer Research Center, Division of Medical and
Biological Informatics. All rights reserved.
See MITKCopyright.txt or http://www.mitk.org/copyright.html for details.
This software is distributed WITHOUT ANY WARRANTY; without even
the implied warranty of MERCHANTABILITY or FITNESS FOR A PARTICULAR
PURPOSE. See the above copyright notices for more information.
=========================================================================*/
#ifndef _MITK_NavigationDataRecorder_H
#define _MITK_NavigationDataRecorder_H
#include <itkProcessObject.h>
#include "mitkNavigationData.h"
#include <iostream>
#include <mitkRealTimeClock.h>
namespace mitk
{
/**Documentation
* \brief This class records NavigationData objects.
*
* The output of this class is formated as a XML document.
*
* Internal this class uses streams for recording NavigationData objects. Therefore different types of output are possible
* and can be set with the SetOutputMode() method. The default output is directed to the console. If you want to save into a
* file you have to set a file name and the path. The recording is started with the call of the method StartRecording(). Now
* every Update() stores the current state of the added NavigationDatas. With StopRecording() the stream is stopped. With
* another call of StartRecording() the output is written to a new file with incremented filename counter.
*
* \warning At the moment there is no check if the file is already existing and this class will override existing files.
* \ingroup IGT
*/
class MitkIGT_EXPORT NavigationDataRecorder : public itk::ProcessObject
{
public:
mitkClassMacro( NavigationDataRecorder, itk::ProcessObject );
itkNewMacro( Self );
/**
* \brief sets the file name for the OutputMode NormalFile and ZipFile
*
* Any extensions will be cut
* \warning existing files will be overridden
* \warning do not use "." in file names at the end
*/
itkSetStringMacro(FileName);
/**
* \brief Returns the file name of the recording file (in OutputMode NormalFile and ZipFile)
*/
itkGetStringMacro(FileName);
+ /**
+ * \brief If true the recorder will never overwrite a file
+ */
+ itkSetMacro(DoNotOverwriteFiles,bool);
+
/**
* \brief Returns whether the NavigationDataRecorder is recording or not
*/
itkGetMacro(Recording,bool);
/**
* \brief Returns the number of data sets / frames which were recorded by the NavigationDataRecorder since start
*/
itkGetMacro(RecordCounter,int);
/**
* \brief Sets a limit of recorded data sets / frames. Recording will be stopped if the number is reached. -1 disables the limit, -1 is default value as well.
*/
itkSetMacro(RecordCountLimit,int);
/**
* \brief Adds the input NavigationDatas
*/
virtual void AddNavigationData(const NavigationData* nd);
/**Documentation
* \brief Starts the recording with the presetted OutputMode
* this method calls StartRecording(std::ostream*)
*/
void StartRecording();
/**Documentation
* \brief Starts the recording with an own preinitialized stream
*/
void StartRecording(std::ostream* stream);
/**Documentation
* \brief Stops the recording and closes the stream
*/
void StopRecording();
/**Documentation
* \brief Every call of update causes one line for each added NavigationData in the output if the recording was started
*/
virtual void Update();
/**Documentation
* \brief Determines where the output is directed to
*
* Console: std::cout
* NormalFile: std::ofstream
* ZipFile: Not supported yet -> std::cout
*/
enum RecordingMode
{
Console,
NormalFile,
ZipFile
};
/**Documentation
* \brief Determines the output format
*
* xml: XML format, also default, can be read by NavigationDataPlayer
* csv: use to export in excel, matlab, etc.
*/
enum OutputFormatEnum
{
xml,
csv
};
/**Documentation
* \brief Sets the recording mode which causes different types of output streams
* see enum RecordingMode
*/
void SetRecordingMode(RecordingMode mode);
/**Documentation
* \brief Sets the output format which causes different formats of output streams. The XML format is default.
* Also see enum OutputFormat for more information.
*/
itkSetMacro(OutputFormat,mitk::NavigationDataRecorder::OutputFormatEnum);
protected:
/**Documentation
* \brief filter execute method here it is not used
*
*/
virtual void GenerateData();
NavigationDataRecorder();
virtual ~NavigationDataRecorder();
std::string m_FileName; ///< stores the file name and path
unsigned int m_NumberOfInputs; ///< counts the numbers of added input NavigationDatas
std::ostream* m_Stream; ///< the output stream
RecordingMode m_RecordingMode; ///< stores the mode see enum RecordingMode
OutputFormatEnum m_OutputFormat; ///< stores the output format; see enum OutputFormat
bool m_Recording; ///< indicates whether the recording is started or not
int m_RecordCounter; ///< counts the number of frames which are recorded since StartRecording
int m_RecordCountLimit; ///< limits the number of frames, recording will be stopped if the limit is reached. -1 disables the limit
bool m_firstLine; //for the csv writer to detect wether the header must be written
unsigned int m_NumberOfRecordedFiles; ///< necessary for the naming of the file if there is more than one start-stop cycle
mitk::RealTimeClock::Pointer m_SystemTimeClock; ///< system time clock for system time tag in output xml file
+ bool m_DoNotOverwriteFiles; ///< do not overwrite any files if true
+
};
}
#endif // #define _MITK_POINT_SET_SOURCE_H
diff --git a/Modules/IGT/IGTFilters/mitkTrackingDeviceSourceConfigurator.cpp b/Modules/IGT/IGTFilters/mitkTrackingDeviceSourceConfigurator.cpp
index bf43af8333..f4426461e6 100644
--- a/Modules/IGT/IGTFilters/mitkTrackingDeviceSourceConfigurator.cpp
+++ b/Modules/IGT/IGTFilters/mitkTrackingDeviceSourceConfigurator.cpp
@@ -1,250 +1,251 @@
/*=========================================================================
Program: Medical Imaging & Interaction Toolkit
Language: C++
Date: $Date: 2011-01-18 13:22:38 +0100 (Di, 18 Jan 2011) $
Version: $Revision: 28959 $
Copyright (c) German Cancer Research Center, Division of Medical and
Biological Informatics. All rights reserved.
See MITKCopyright.txt or http://www.mitk.org/copyright.html for details.
This software is distributed WITHOUT ANY WARRANTY; without even
the implied warranty of MERCHANTABILITY or FITNESS FOR A PARTICULAR
PURPOSE. See the above copyright notices for more information.
=========================================================================*/
#include "mitkTrackingDeviceSourceConfigurator.h"
#include "mitkNDITrackingDevice.h"
#include "mitkClaronTrackingDevice.h"
mitk::TrackingDeviceSourceConfigurator::TrackingDeviceSourceConfigurator(mitk::NavigationToolStorage::Pointer NavigationTools, mitk::TrackingDevice::Pointer TrackingDevice)
{
//make a copy of the navigation tool storage because we will modify the storage
if (NavigationTools.IsNotNull())
{
m_NavigationTools = mitk::NavigationToolStorage::New();
for (int i=0; i<NavigationTools->GetToolCount(); i++)
{
m_NavigationTools->AddTool(NavigationTools->GetTool(i));
}
}
m_TrackingDevice = TrackingDevice;
m_ToolCorrespondencesInToolStorage = std::vector<int>();
m_ErrorMessage = "";
}
mitk::NavigationToolStorage::Pointer mitk::TrackingDeviceSourceConfigurator::GetUpdatedNavigationToolStorage()
{
return m_NavigationTools;
}
mitk::TrackingDeviceSourceConfigurator::~TrackingDeviceSourceConfigurator()
{
}
bool mitk::TrackingDeviceSourceConfigurator::IsCreateTrackingDeviceSourcePossible()
{
if (m_NavigationTools.IsNull())
{
m_ErrorMessage = "NavigationToolStorage is NULL!";
return false;
}
else if (m_TrackingDevice.IsNull())
{
m_ErrorMessage = "TrackingDevice is NULL!";
return false;
}
else
{
for (int i=0; i<m_NavigationTools->GetToolCount(); i++)
{
if (m_NavigationTools->GetTool(i)->GetTrackingDeviceType() != m_TrackingDevice->GetType())
{
m_ErrorMessage = "At least one tool is not of the same type like the tracking device.";
return false;
}
}
//TODO in case of Aurora: check if the tools are automatically detected by comparing the serial number
return true;
}
}
mitk::TrackingDeviceSource::Pointer mitk::TrackingDeviceSourceConfigurator::CreateTrackingDeviceSource()
{
mitk::NavigationDataObjectVisualizationFilter::Pointer dummy;
return this->CreateTrackingDeviceSource(dummy);
}
mitk::TrackingDeviceSource::Pointer mitk::TrackingDeviceSourceConfigurator::CreateTrackingDeviceSource(mitk::NavigationDataObjectVisualizationFilter::Pointer &visualizationFilter)
{
if (!this->IsCreateTrackingDeviceSourcePossible()) return NULL;
mitk::TrackingDeviceSource::Pointer returnValue;
//create tracking device source
if (m_TrackingDevice->GetType()==mitk::NDIAurora) {returnValue = CreateNDIAuroraTrackingDeviceSource(m_TrackingDevice,m_NavigationTools);}
else if (m_TrackingDevice->GetType()==mitk::NDIPolaris) {returnValue = CreateNDIPolarisTrackingDeviceSource(m_TrackingDevice,m_NavigationTools);}
else if (m_TrackingDevice->GetType()==mitk::ClaronMicron) {returnValue = CreateMicronTrackerTrackingDeviceSource(m_TrackingDevice,m_NavigationTools);}
//TODO: insert other tracking systems?
if (returnValue.IsNull()) return NULL;
//create visualization filter
visualizationFilter = CreateNavigationDataObjectVisualizationFilter(returnValue,m_NavigationTools);
if (visualizationFilter.IsNull()) return NULL;
return returnValue;
}
std::string mitk::TrackingDeviceSourceConfigurator::GetErrorMessage()
{
return this->m_ErrorMessage;
}
//############################ internal help methods ########################################
mitk::TrackingDeviceSource::Pointer mitk::TrackingDeviceSourceConfigurator::CreateNDIPolarisTrackingDeviceSource(mitk::TrackingDevice::Pointer trackingDevice, mitk::NavigationToolStorage::Pointer navigationTools)
{
mitk::TrackingDeviceSource::Pointer returnValue = mitk::TrackingDeviceSource::New();
mitk::NDITrackingDevice::Pointer thisDevice = dynamic_cast<mitk::NDITrackingDevice*>(trackingDevice.GetPointer());
m_ToolCorrespondencesInToolStorage = std::vector<int>();
//add the tools to the tracking device
for (int i=0; i<navigationTools->GetToolCount(); i++)
{
mitk::NavigationTool::Pointer thisNavigationTool = m_NavigationTools->GetTool(i);
m_ToolCorrespondencesInToolStorage.push_back(i);
bool toolAddSuccess = thisDevice->AddTool(thisNavigationTool->GetToolName().c_str(),thisNavigationTool->GetCalibrationFile().c_str());
if (!toolAddSuccess)
{
this->m_ErrorMessage = "Can't add tool, is the SROM-file valid?";
return NULL;
}
}
returnValue->SetTrackingDevice(thisDevice);
return returnValue;
}
mitk::TrackingDeviceSource::Pointer mitk::TrackingDeviceSourceConfigurator::CreateNDIAuroraTrackingDeviceSource(mitk::TrackingDevice::Pointer trackingDevice, mitk::NavigationToolStorage::Pointer navigationTools)
{
mitk::TrackingDeviceSource::Pointer returnValue = mitk::TrackingDeviceSource::New();
mitk::NDITrackingDevice::Pointer thisDevice = dynamic_cast<mitk::NDITrackingDevice*>(trackingDevice.GetPointer());
//connect to aurora to dectect tools automatically
thisDevice->OpenConnection();
thisDevice->StartTracking();
//now search for automatically detected tools in the tool storage and save them
mitk::NavigationToolStorage::Pointer newToolStorageInRightOrder = mitk::NavigationToolStorage::New();
std::vector<int> alreadyFoundTools = std::vector<int>();
m_ToolCorrespondencesInToolStorage = std::vector<int>();
for (int i=0; i<thisDevice->GetToolCount(); i++)
{
bool toolFound = false;
for (int j=0; j<navigationTools->GetToolCount(); j++)
{
//check if the serial number is the same to identify the tool
if ((dynamic_cast<mitk::NDIPassiveTool*>(thisDevice->GetTool(i)))->GetSerialNumber() == navigationTools->GetTool(j)->GetSerialNumber())
{
//check if this tool was already added to make sure that every tool is only added once (in case of same serial numbers)
bool toolAlreadyAdded = false;
for(int k=0; k<alreadyFoundTools.size(); k++) if (alreadyFoundTools.at(k) == j) toolAlreadyAdded = true;
if(!toolAlreadyAdded)
{
//add tool in right order
newToolStorageInRightOrder->AddTool(navigationTools->GetTool(j));
+ m_ToolCorrespondencesInToolStorage.push_back(j);
//adapt name of tool
dynamic_cast<mitk::NDIPassiveTool*>(thisDevice->GetTool(i))->SetToolName(navigationTools->GetTool(j)->GetToolName());
//rember that this tool was already found
alreadyFoundTools.push_back(j);
toolFound = true;
break;
}
}
}
if (!toolFound)
{
this->m_ErrorMessage = "Error: did not find every automatically detected tool in the loaded tool storage: aborting initialization.";
return NULL;
}
}
//delete all tools from the tool storage
navigationTools->DeleteAllTools();
//and add only the detected tools in the right order
for (int i=0; i<newToolStorageInRightOrder->GetToolCount(); i++)
{
navigationTools->AddTool(newToolStorageInRightOrder->GetTool(i));
}
returnValue->SetTrackingDevice(thisDevice);
return returnValue;
}
mitk::TrackingDeviceSource::Pointer mitk::TrackingDeviceSourceConfigurator::CreateMicronTrackerTrackingDeviceSource(mitk::TrackingDevice::Pointer trackingDevice, mitk::NavigationToolStorage::Pointer navigationTools)
{
mitk::TrackingDeviceSource::Pointer returnValue = mitk::TrackingDeviceSource::New();
mitk::ClaronTrackingDevice::Pointer thisDevice = dynamic_cast<mitk::ClaronTrackingDevice*>(trackingDevice.GetPointer());
m_ToolCorrespondencesInToolStorage = std::vector<int>();
//add the tools to the tracking device
for (int i=0; i<navigationTools->GetToolCount(); i++)
{
mitk::NavigationTool::Pointer thisNavigationTool = m_NavigationTools->GetTool(i);
m_ToolCorrespondencesInToolStorage.push_back(i);
bool toolAddSuccess = thisDevice->AddTool(thisNavigationTool->GetToolName().c_str(),thisNavigationTool->GetCalibrationFile().c_str());
if (!toolAddSuccess)
{
this->m_ErrorMessage = "Can't add tool, is the toolfile valid?";
return NULL;
}
}
returnValue->SetTrackingDevice(thisDevice);
return returnValue;
}
mitk::NavigationDataObjectVisualizationFilter::Pointer mitk::TrackingDeviceSourceConfigurator::CreateNavigationDataObjectVisualizationFilter(mitk::TrackingDeviceSource::Pointer trackingDeviceSource, mitk::NavigationToolStorage::Pointer navigationTools)
{
mitk::NavigationDataObjectVisualizationFilter::Pointer returnValue = mitk::NavigationDataObjectVisualizationFilter::New();
for (int i=0; i<trackingDeviceSource->GetNumberOfOutputs(); i++)
{
mitk::NavigationTool::Pointer currentTool = navigationTools->GetToolByName(trackingDeviceSource->GetOutput(i)->GetName());
if (currentTool.IsNull())
{
this->m_ErrorMessage = "Error: did not find correspondig tool in tracking device after initialization.";
return NULL;
}
returnValue->SetInput(i,trackingDeviceSource->GetOutput(i));
returnValue->SetRepresentationObject(i,currentTool->GetDataNode()->GetData());
}
return returnValue;
}
int mitk::TrackingDeviceSourceConfigurator::GetToolNumberInToolStorage(int outputID)
{
if (outputID < m_ToolCorrespondencesInToolStorage.size()) return m_ToolCorrespondencesInToolStorage.at(outputID);
else return -1;
}
std::string mitk::TrackingDeviceSourceConfigurator::GetToolIdentifierInToolStorage(int outputID)
{
if (outputID < m_ToolCorrespondencesInToolStorage.size()) return m_NavigationTools->GetTool(m_ToolCorrespondencesInToolStorage.at(outputID))->GetIdentifier();
else return "";
}
std::vector<int> mitk::TrackingDeviceSourceConfigurator::GetToolNumbersInToolStorage()
{
return m_ToolCorrespondencesInToolStorage;
}
std::vector<std::string> mitk::TrackingDeviceSourceConfigurator::GetToolIdentifiersInToolStorage()
{
std::vector<std::string> returnValue = std::vector<std::string>();
for (int i=0; i<m_ToolCorrespondencesInToolStorage.size(); i++)
{returnValue.push_back(m_NavigationTools->GetTool(m_ToolCorrespondencesInToolStorage.at(i))->GetIdentifier());}
return returnValue;
}
\ No newline at end of file
diff --git a/Modules/IGT/IGTToolManagement/mitkNavigationToolStorageDeserializer.h b/Modules/IGT/IGTToolManagement/mitkNavigationToolStorageDeserializer.h
index 2b43439239..a980382633 100644
--- a/Modules/IGT/IGTToolManagement/mitkNavigationToolStorageDeserializer.h
+++ b/Modules/IGT/IGTToolManagement/mitkNavigationToolStorageDeserializer.h
@@ -1,69 +1,69 @@
/*=========================================================================
Program: Medical Imaging & Interaction Toolkit
Language: C++
Date: $Date: 2009-08-11 15:15:02 +0200 (Di, 11 Aug 2009) $
Version: $Revision $
Copyright (c) German Cancer Research Center, Division of Medical and
Biological Informatics. All rights reserved.
See MITKCopyright.txt or http://www.mitk.org/copyright.html for details.
This software is distributed WITHOUT ANY WARRANTY; without even
the implied warranty of MERCHANTABILITY or FITNESS FOR A PARTICULAR
PURPOSE. See the above copyright notices for more information.
=========================================================================*/
#ifndef NAVIGATIONTOOLSTORAGEDESERIALIZER_H_INCLUDED
#define NAVIGATIONTOOLSTORAGEDESERIALIZER_H_INCLUDED
//itk headers
#include <itkObjectFactory.h>
//mitk headers
#include <mitkCommon.h>
#include <mitkDataStorage.h>
#include "mitkNavigationToolStorage.h"
#include <MitkIGTExports.h>
namespace mitk {
/**Documentation
* \brief This class offers methods to load an object of the class NavigationToolStorage
* from the harddisc.
*
* \ingroup IGT
*/
class MitkIGT_EXPORT NavigationToolStorageDeserializer : public itk::Object
{
public:
mitkClassMacro(NavigationToolStorageDeserializer,itk::Object);
mitkNewMacro1Param(Self,mitk::DataStorage::Pointer);
/**
* @brief Loads a collection of navigation tools represented by a mitk::NavigationToolStorage
* from a file.
- * @return Returns the storage which was loaded or NULL if there was an error in the loading process.
+ * @return Returns the storage which was loaded or an empty storage if there was an error in the loading process.
*
*/
mitk::NavigationToolStorage::Pointer Deserialize(std::string filename);
itkGetMacro(ErrorMessage,std::string);
protected:
NavigationToolStorageDeserializer(mitk::DataStorage::Pointer dataStorage);
~NavigationToolStorageDeserializer();
std::string m_ErrorMessage;
mitk::DataStorage::Pointer m_DataStorage;
std::string m_tempDirectory;
std::string convertIntToString(int i);
bool decomressFiles(std::string file,std::string path);
};
} // namespace mitk
#endif //NAVIGATIONTOOLSTORAGEDESERIALIZER
\ No newline at end of file
diff --git a/Modules/IGT/IGTTrackingDevices/mitkSerialCommunication.cpp b/Modules/IGT/IGTTrackingDevices/mitkSerialCommunication.cpp
index b6712f834c..c36d25015d 100644
--- a/Modules/IGT/IGTTrackingDevices/mitkSerialCommunication.cpp
+++ b/Modules/IGT/IGTTrackingDevices/mitkSerialCommunication.cpp
@@ -1,442 +1,442 @@
/*=========================================================================
Program: Medical Imaging & Interaction Toolkit
Language: C++
Date: $Date$
Version: $Revision$
Copyright (c) German Cancer Research Center, Division of Medical and
Biological Informatics. All rights reserved.
See MITKCopyright.txt or http://www.mitk.org/copyright.html for details.
This software is distributed WITHOUT ANY WARRANTY; without even
the implied warranty of MERCHANTABILITY or FITNESS FOR A PARTICULAR
PURPOSE. See the above copyright notices for more information.
=========================================================================*/
#include "mitkSerialCommunication.h"
#ifdef WIN32
//#include <atlstr.h>
#include <itksys/SystemTools.hxx>
#else // Posix
#include <sys/types.h>
#include <sys/stat.h>
#include <sys/time.h>
#include <sys/ioctl.h>
#include <fcntl.h>
#include <unistd.h>
#include <termios.h>
#include <errno.h>
#define INVALID_HANDLE_VALUE -1
#endif
#define OK 1
#define ERROR_VALUE 0
mitk::SerialCommunication::SerialCommunication() : itk::Object(),
m_DeviceName(""), m_PortNumber(COM1), m_BaudRate(BaudRate9600),
m_DataBits(DataBits8), m_Parity(None), m_StopBits(StopBits1),
m_HardwareHandshake(HardwareHandshakeOff),
m_ReceiveTimeout(500), m_SendTimeout(500), m_Connected(false)
{
#ifdef WIN32 // Windows
m_ComPortHandle = INVALID_HANDLE_VALUE;
#else // Posix
m_FileDescriptor = INVALID_HANDLE_VALUE;
#endif
}
mitk::SerialCommunication::~SerialCommunication()
{
CloseConnection();
}
int mitk::SerialCommunication::OpenConnection()
{
if (m_Connected)
return ERROR_VALUE;
#ifdef WIN32
std::stringstream ss;
if (m_DeviceName.empty())
- ss << "COM" << static_cast<unsigned int>(m_PortNumber); // use m_PortNumber
+ ss << "\\\\.\\COM" << static_cast<unsigned int>(m_PortNumber); // use m_PortNumber
else
- ss << m_DeviceName; // use m_DeviceName
+ ss << "\\\\.\\" << m_DeviceName; // use m_DeviceName
m_ComPortHandle = CreateFile(ss.str().c_str(), GENERIC_READ | GENERIC_WRITE,
NULL, /* no sharing */
NULL, /* no security flags */
OPEN_EXISTING, /* open com port, don't create it */
NULL, /* no flags */
NULL); /* no template */
if (m_ComPortHandle == INVALID_HANDLE_VALUE)
return ERROR_VALUE;
GetCommState(m_ComPortHandle, &m_PreviousDeviceControlBlock);
GetCommTimeouts(m_ComPortHandle, &m_PreviousTimeout);
GetCommMask(m_ComPortHandle, &m_PreviousMask);
if (this->ApplyConfiguration() != OK) // set interface parameters
{
CloseHandle(m_ComPortHandle);
m_ComPortHandle = INVALID_HANDLE_VALUE;
return ERROR_VALUE;
}
m_Connected = true;
return OK;
#else // Posix
std::stringstream ss;
if (m_DeviceName.empty())
ss << "/dev/ttyS" << static_cast<unsigned int>(m_PortNumber) - 1; // use m_PortNumber, COM1 = ttyS0
else
ss << m_DeviceName; // use m_DeviceName
//m_FileDescriptor = open(ss.str().c_str(), O_RDWR | O_NONBLOCK | O_NDELAY | O_NOCTTY | O_EXCL); // open device file
m_FileDescriptor = open(ss.str().c_str(), O_RDWR|O_NONBLOCK|O_EXCL); // open device file
if (m_FileDescriptor < 0)
return ERROR_VALUE;
fcntl(m_FileDescriptor, F_SETFL, 0); // change to blocking mode
tcflush(m_FileDescriptor, TCIOFLUSH); // flush buffers
if (this->ApplyConfiguration() != OK) // set interface parameters
{
close(m_FileDescriptor);
m_FileDescriptor = INVALID_HANDLE_VALUE;
return ERROR_VALUE;
}
m_Connected = true;
return OK;
#endif
}
void mitk::SerialCommunication::CloseConnection()
{
#ifdef WIN32
if (m_ComPortHandle == INVALID_HANDLE_VALUE)
return;
ClearReceiveBuffer();
ClearSendBuffer();
SetCommState(m_ComPortHandle, &m_PreviousDeviceControlBlock); // restore previous settings
SetCommTimeouts(m_ComPortHandle, &m_PreviousTimeout); // restore previous timeout values
SetCommMask(m_ComPortHandle, m_PreviousMask); // restore previous mask value
PurgeComm(m_ComPortHandle, PURGE_TXCLEAR | PURGE_RXCLEAR); // empty buffers
CloseHandle(m_ComPortHandle); // close handle
m_ComPortHandle = INVALID_HANDLE_VALUE;
m_Connected = false;
return;
#else // Posix
if (m_FileDescriptor == INVALID_HANDLE_VALUE)
return;
ClearReceiveBuffer();
ClearSendBuffer();
close(m_FileDescriptor);
m_FileDescriptor = INVALID_HANDLE_VALUE;
m_Connected = false;
return;
#endif
}
int mitk::SerialCommunication::Receive(std::string& answer, unsigned int numberOfBytes)
{
if (numberOfBytes == 0)
return OK;
if (m_Connected == false)
return ERROR_VALUE;
#ifdef WIN32
if (m_ComPortHandle == INVALID_HANDLE_VALUE)
return ERROR_VALUE;
DWORD numberOfBytesRead = 0;
char* buffer = new char[numberOfBytes];
if (ReadFile(m_ComPortHandle, buffer, numberOfBytes, &numberOfBytesRead, NULL) != 0)
{
if (numberOfBytesRead > 0) // data read
{
answer.assign(buffer, numberOfBytesRead); // copy buffer to answer
delete buffer;
if (numberOfBytesRead == numberOfBytes)
{
return OK; // everything was received
}
else
{
return ERROR_VALUE; // some data was received, but not as much as expected
}
}
else // error
{
answer = "";
delete buffer;
return ERROR_VALUE;
}
}
delete buffer;
return OK;
#else // Posix
if (m_FileDescriptor == INVALID_HANDLE_VALUE)
return ERROR_VALUE;
unsigned long bytesRead = 0;
unsigned long bytesLeft = numberOfBytes;
char* buffer = new char[numberOfBytes];
while ((bytesLeft > 0) && (bytesRead < numberOfBytes))
{
int num = read(m_FileDescriptor, &buffer[bytesRead], 1); // read one byte
if (num == -1) // ERROR_VALUE
{
if (errno == EAGAIN) // nonblocking, no byte there right now, but maybe next time
continue;
else
break; // ERROR_VALUE, stop trying to read
}
if (num == 0) // timeout or eof(?)
break;
bytesLeft -= num; // n is number of chars left to read
bytesRead += num; // i is the number of chars read
}
if (bytesRead > 0)
answer.assign(buffer, bytesRead); // copy buffer to answer
delete buffer;
if (bytesRead == numberOfBytes)
return OK; // everything was received
else
return ERROR_VALUE; // some data was received, but not as much as expected
#endif
}
int mitk::SerialCommunication::Send(const std::string& input)
{
//long retval = E2ERR_OPENFAILED;
if (input.empty())
return OK;
if (m_Connected == false)
return ERROR_VALUE;
#ifdef WIN32
if (m_ComPortHandle == INVALID_HANDLE_VALUE)
return ERROR_VALUE;
DWORD bytesWritten = 0;
if (WriteFile(m_ComPortHandle, input.data(), static_cast<DWORD>(input.size()), &bytesWritten, NULL) == TRUE)
return OK;
else
return GetLastError();
#else // Posix
if (m_FileDescriptor == INVALID_HANDLE_VALUE)
return ERROR_VALUE;
long bytesWritten = 0;
long bytesLeft = input.size();
while (bytesLeft > 0)
{
bytesWritten = write(m_FileDescriptor, input.data() + bytesWritten, bytesLeft);
if (bytesWritten <= 0)
return ERROR_VALUE; //return ERROR_VALUE
bytesLeft -= bytesWritten;
}
return OK;
#endif
}
int mitk::SerialCommunication::ApplyConfiguration()
{
#ifdef WIN32 // Windows implementation
if (m_ComPortHandle == INVALID_HANDLE_VALUE)
return ERROR_VALUE;
DCB controlSettings;
if (GetCommState(m_ComPortHandle, &controlSettings) == 0)
{
return ERROR_VALUE;
}
std::ostringstream o;
o << "baud=" << m_BaudRate << " parity=" << static_cast<char>(m_Parity) << " data=" << m_DataBits << " stop=" << m_StopBits;
if (BuildCommDCBA(o.str().c_str(), &controlSettings) == 0) // Build device-control block
return ERROR_VALUE;
if (m_HardwareHandshake == HardwareHandshakeOn) // Modify hardware handshake values
{
controlSettings.fDtrControl = DTR_CONTROL_ENABLE;
controlSettings.fRtsControl = RTS_CONTROL_ENABLE;
controlSettings.fOutxCtsFlow = TRUE;
controlSettings.fRtsControl = RTS_CONTROL_HANDSHAKE;
}
else
{
controlSettings.fDtrControl = DTR_CONTROL_DISABLE;
controlSettings.fRtsControl = RTS_CONTROL_DISABLE;
controlSettings.fOutxCtsFlow = FALSE;
controlSettings.fRtsControl = RTS_CONTROL_DISABLE;
}
if (SetCommState(m_ComPortHandle, &controlSettings) == FALSE) // Configure com port
return GetLastError();
COMMTIMEOUTS timeouts;
timeouts.ReadIntervalTimeout = m_ReceiveTimeout;
timeouts.ReadTotalTimeoutMultiplier = 0;
timeouts.ReadTotalTimeoutConstant = m_ReceiveTimeout;
timeouts.WriteTotalTimeoutMultiplier = 0;
timeouts.WriteTotalTimeoutConstant = m_SendTimeout;
if (SetCommTimeouts(m_ComPortHandle, &timeouts) == FALSE) // set timeout values
return GetLastError();
PurgeComm(m_ComPortHandle, PURGE_TXCLEAR | PURGE_RXCLEAR); // clear read and write buffers
return OK;
#else // Posix
if ( m_FileDescriptor == INVALID_HANDLE_VALUE )
return ERROR_VALUE;
struct termios termIOStructure;
if ( tcgetattr(m_FileDescriptor, &termIOStructure) != 0 ) // retrieve parameters from com port
return ERROR_VALUE;
cfmakeraw(&termIOStructure); // set flags to raw mode
termIOStructure.c_cflag |= CLOCAL;
if (m_HardwareHandshake == HardwareHandshakeOn)
{ // enable
termIOStructure.c_cflag |= CRTSCTS;
termIOStructure.c_iflag &= ~(IXON|IXOFF);
}
else
{ // disable
termIOStructure.c_cflag &= ~CRTSCTS;
termIOStructure.c_iflag &= ~(IXON|IXOFF);
}
termIOStructure.c_cflag &= ~CSIZE; // set number of data bits
switch (m_DataBits)
{
case DataBits7:
termIOStructure.c_cflag |= CS7;
break;
case DataBits8:
default:
termIOStructure.c_cflag |= CS8;
}
switch (m_StopBits) // set number of stop bits
{
case StopBits2:
termIOStructure.c_cflag |= CSTOPB;
break;
case StopBits1:
default:
termIOStructure.c_cflag &= ~CSTOPB;
}
switch (m_Parity) // set parity
{
case Odd:
termIOStructure.c_cflag |= (PARENB|PARODD);
break;
case Even:
termIOStructure.c_cflag |= PARENB;
termIOStructure.c_cflag &= ~PARODD;
case None:
default:
termIOStructure.c_cflag &= ~PARENB;
break;
}
speed_t baudrate; // set baudrate
switch (m_BaudRate)
{
case BaudRate9600:
baudrate = B9600;
break;
case BaudRate14400:
baudrate = B9600; //14400 is not defined for posix, use 9600 instead
break;
case BaudRate19200:
baudrate = B19200;
break;
case BaudRate38400:
baudrate = B38400;
break;
case BaudRate57600:
baudrate = B57600;
break;
case BaudRate115200:
baudrate = B115200;
break;
default:
baudrate = B9600;
break;
}
cfsetispeed(&termIOStructure, baudrate);
cfsetospeed(&termIOStructure, baudrate);
termIOStructure.c_cc[VMIN] = 0;
termIOStructure.c_cc[VTIME] = m_ReceiveTimeout / 100; // timeout in 1/10 sec, not in ms. Rounded down.
if (tcsetattr(m_FileDescriptor, TCSANOW, &termIOStructure) == 0)
return OK;
else
return ERROR_VALUE;
#endif
}
void mitk::SerialCommunication::SendBreak(unsigned int ms)
{
#ifdef WIN32
if (m_ComPortHandle == INVALID_HANDLE_VALUE)
return;
SetCommBreak(m_ComPortHandle);
itksys::SystemTools::Delay(ms);
ClearCommBreak(m_ComPortHandle);
return;
#else // Posix
if (m_FileDescriptor == INVALID_HANDLE_VALUE)
return;
tcsendbreak(m_FileDescriptor, ms);
return;
#endif
}
void mitk::SerialCommunication::ClearReceiveBuffer()
{
#ifdef WIN32
if (m_ComPortHandle != INVALID_HANDLE_VALUE)
PurgeComm(m_ComPortHandle, PURGE_RXCLEAR);
#else // Posix
if (m_FileDescriptor != INVALID_HANDLE_VALUE)
tcflush(m_FileDescriptor, TCIFLUSH);
#endif
}
void mitk::SerialCommunication::ClearSendBuffer()
{
#ifdef WIN32
if ( m_ComPortHandle != INVALID_HANDLE_VALUE )
PurgeComm(m_ComPortHandle, PURGE_TXCLEAR);
#else // Posix
if ( m_FileDescriptor != INVALID_HANDLE_VALUE )
tcflush(m_FileDescriptor, TCOFLUSH);
#endif
}
diff --git a/Modules/IGT/IGTTrackingDevices/mitkSerialCommunication.h b/Modules/IGT/IGTTrackingDevices/mitkSerialCommunication.h
index 7f579e26b0..baf035ceb0 100644
--- a/Modules/IGT/IGTTrackingDevices/mitkSerialCommunication.h
+++ b/Modules/IGT/IGTTrackingDevices/mitkSerialCommunication.h
@@ -1,298 +1,302 @@
/*=========================================================================
Program: Medical Imaging & Interaction Toolkit
Language: C++
Date: $Date$
Version: $Revision$
Copyright (c) German Cancer Research Center, Division of Medical and
Biological Informatics. All rights reserved.
See MITKCopyright.txt or http://www.mitk.org/copyright.html for details.
This software is distributed WITHOUT ANY WARRANTY; without even
the implied warranty of MERCHANTABILITY or FITNESS FOR A PARTICULAR
PURPOSE. See the above copyright notices for more information.
=========================================================================*/
#ifndef MITKSERIALCOMMUNICATION_H_HEADER_INCLUDED_
#define MITKSERIALCOMMUNICATION_H_HEADER_INCLUDED_
#include <MitkIGTExports.h>
#include "mitkCommon.h"
#include <itkObject.h>
#include <itkObjectFactory.h>
#ifdef WIN32
#include <windows.h>
#else // Posix
#include <termios.h>
#endif
namespace mitk
{
/**Documentation
* \brief serial communication interface
*
* This class allows to send and receive data over a serial communication interface (COM Port).
* Define the serial interface that should be used either with SetPortNumber() or SetDeviceName()
* Next, define communication parameters: baud rate, number of data bits, number of stop bits,
* parity mode, usage of hardware handshake and timeout values (in ms).
* Use OpenConnection() to establish a connection on the serial interface with the selected
* parameters. While the connection is established, changes to the parameters will not take
* effect. You have to close the connection using CloseConnection() and then reopen it with
* the new parameters with OpenConnection().
*
* \ingroup IGT
*/
class MitkIGT_EXPORT SerialCommunication : public itk::Object
{
public:
mitkClassMacro(SerialCommunication, itk::Object);
itkNewMacro(Self);
enum PortNumber
{
COM1 = 1,
COM2 = 2,
COM3 = 3,
COM4 = 4,
COM5 = 5,
COM6 = 6,
COM7 = 7,
COM8 = 8,
- COM9 = 9
+ COM9 = 9,
+ COM10 = 10,
+ COM11 = 11,
+ COM12 = 12,
+ COM13 = 13
};
enum BaudRate
{
BaudRate9600 = 9600,
BaudRate14400 = 14400,
BaudRate19200 = 19200,
BaudRate38400 = 38400,
BaudRate57600 = 57600,
BaudRate115200 = 115200
};
enum DataBits
{
DataBits8 = 8,
DataBits7 = 7
};
enum Parity
{
None = 'N',
Odd = 'O',
Even = 'E'
};
enum StopBits
{
StopBits1 = 1,
StopBits2 = 2
};
enum HardwareHandshake
{
HardwareHandshakeOn = 1,
HardwareHandshakeOff = 0
};
/**
* \brief Opens connection to the COM port with port number m_PortNumber
* or the device name m_DeviceName and all port settings.
*
*/
int OpenConnection();
/**
* \brief Closes the connection
*
*/
void CloseConnection();
/**
* \brief Read numberOfBytes characters from the serial interface
*
* This method tries to read numberOfBytes characters from the serial
* interface. If The ReceiveTimeout is set to 0, the Receive() method will
* wait indefinetly until all characters are received. If the ReceiveTimeout
* is set to another value, it will return after m_ReceiveTimeout milliseconds
* (or after all characters are read).
* The received characters are stored in the string answer. Note that this will
* overwrite the content of answer!
*/
int Receive(std::string& answer, unsigned int numberOfBytes);
/**
* \brief Send the string input
*
* This method will send the string input to the serial interface.
* It does not send the string termination character \\0.
*/
int Send(const std::string& input);
/**
* \brief Send the break signal for ms milliseconds
*/
void SendBreak(unsigned int ms = 400);
/**
* \brief erase the receive buffer of the serial interface
*/
void ClearReceiveBuffer();
/**
* \brief erase the send buffer of the serial interface
*/
void ClearSendBuffer();
/**
* \brief Get the port number of the serial interface
*
* Returns the port number that will be used in the connection.
* The port number is only used if the m_DeviceName is empty ("").
*/
itkGetConstMacro(PortNumber, PortNumber);
/**
* \brief Set the port number of the serial interface
*
* SerialCommunication can either use PortNumber to create serial interface device names
* COM1 to COM9 for windows and /dev/ttyS0 to /dev/ttyS8 on linux
* (SetPortNumber(COM1) is mapped to /dev/ttyS0 and so on). Alternatively, use SetDeviceName()
* to set the device name directly (e.g. "CNCA0" for a com0com virtual com port or
* "/dev/ttyUSB0" for a USB to serial adapter on linux. If a device name is set (m_DeviceName != "")
* then OpenConnection() will try to open that device. Otherwise, it will build the device
* name using the port number
*/
itkSetMacro(PortNumber, PortNumber);
/**
* \brief Get the device name
*
* SerialCommunication can either use m_PortNumber to create serial interface device names
* or use m_DeviceName directly. This method allows to set an arbitrary device name
* that will be used to connect to the device. Common names are COM1, CNCA0, CNCB9
* on windows and /dev/ttyS0 or /dev/ttyUSB0 on linux.
*/
itkGetStringMacro(DeviceName);
/**
* \brief Set the device name
*
* if the device name is set (!=""), OpenConnection() will try to open the
* serial device on that device name. Normally, the serial interfaces are named COM1-COM9
* on windows and /dev/ttyS0 to /dev/ttyS9 on linux, but other names are possible too
* (e.g. /dev/ttyUSB0).
*/
itkSetStringMacro(DeviceName);
/**
* \brief Get the baud rate of the serial interface
*/
itkGetConstMacro(BaudRate, BaudRate);
/**
* \brief Set the baud rate of the serial interface
*/
itkSetMacro(BaudRate, BaudRate);
/**
* \brief Get the number of data bits of the serial interface
*/
itkGetConstMacro(DataBits, DataBits);
/**
* \brief Set the number of data bits of the serial interface
*/
itkSetMacro(DataBits, DataBits);
/**
* \brief Get the parity mode of the serial interface
*/
itkGetConstMacro(Parity, Parity);
/**
* \brief Set the parity mode of the serial interface
*/
itkSetMacro(Parity, Parity);
/**
* \brief Get number of stop bits of the serial interface
*/
itkGetConstMacro(StopBits, StopBits);
/**
* \brief Set number of stop bits of the serial interface
*/
itkSetMacro(StopBits, StopBits);
/**
* \brief returns true if hardware handshake should is used
*/
itkGetConstMacro(HardwareHandshake, HardwareHandshake);
/**
* \brief Set if hardware handshake should be used
*/
itkSetMacro(HardwareHandshake, HardwareHandshake);
/**
* \brief returns the send timeout in milliseconds
*/
itkGetConstMacro(SendTimeout, unsigned int);
/**
* \brief set the send timeout in milliseconds
*/
itkSetMacro(SendTimeout, unsigned int);
/**
* \brief returns the receive timeout in milliseconds
*/
itkGetConstMacro(ReceiveTimeout, unsigned int);
/**
* \brief set the send timeout in milliseconds
*
* Specify the receive timeout in milliseconds.
* Setting this value to 0 will cause the Receive()
* method to wait until all expected characters are received.
*/
itkSetMacro(ReceiveTimeout, unsigned int);
protected:
SerialCommunication();
virtual ~SerialCommunication();
/**
* \brief configures the serial interface with all parameters
*/
int ApplyConfiguration();
std::string m_DeviceName; ///< device name that is used to connect to the serial interface (will be used if != "")
PortNumber m_PortNumber; ///< port number of the device
BaudRate m_BaudRate; ///< baud rate of the serial interface connection
DataBits m_DataBits; ///< number of data bits per symbol
Parity m_Parity; ///< parity mode
StopBits m_StopBits; ///< number of stop bits per symbol
HardwareHandshake m_HardwareHandshake; ///< whether to use hardware handshake for the connection
unsigned int m_ReceiveTimeout; ///< timeout for receiving data from the serial interface in milliseconds
unsigned int m_SendTimeout; ///< timeout for sending data to the serial interface in milliseconds
bool m_Connected; ///< is set to true if a connection currently established
#ifdef WIN32
HANDLE m_ComPortHandle;
DWORD m_PreviousMask;
COMMTIMEOUTS m_PreviousTimeout;
DCB m_PreviousDeviceControlBlock;
#else
int m_FileDescriptor;
#endif
};
} // namespace mitk
#endif /* MITKSERIALCOMMUNICATION_H_HEADER_INCLUDED_ */
diff --git a/Modules/IGT/Testing/mitkClaronToolTest.cpp b/Modules/IGT/Testing/mitkClaronToolTest.cpp
index b8038b44db..7c0615ed88 100644
--- a/Modules/IGT/Testing/mitkClaronToolTest.cpp
+++ b/Modules/IGT/Testing/mitkClaronToolTest.cpp
@@ -1,89 +1,94 @@
/*=========================================================================
Program: Medical Imaging & Interaction Toolkit
Language: C++
Date: $Date: 2008-02-25 17:27:17 +0100 (Mo, 25 Feb 2008) $
Version: $Revision: 7837 $
Copyright (c) German Cancer Research Center, Division of Medical and
Biological Informatics. All rights reserved.
See MITKCopyright.txt or http://www.mitk.org/copyright.html for details.
This software is distributed WITHOUT ANY WARRANTY; without even
the implied warranty of MERCHANTABILITY or FITNESS FOR A PARTICULAR
PURPOSE. See the above copyright notices for more information.
=========================================================================*/
#include "mitkClaronTool.h"
#include "mitkTestingMacros.h"
/**Documentation
* ClaronTool has a protected constructor and a protected itkNewMacro
* so that only it's friend class ClaronTrackingDevice is able to instantiate
* tool objects. Therefore, we derive from ClaronTool and add a
* public itkNewMacro, so that we can instantiate and test the class
*/
class ClaronToolTestClass : public mitk::ClaronTool
{
public:
mitkClassMacro(ClaronToolTestClass, ClaronTool);
/** make a public constructor, so that the test is able
* to instantiate NDIPassiveTool
*/
itkNewMacro(Self);
protected:
ClaronToolTestClass() : mitk::ClaronTool()
{
}
};
/**
* This function tests the ClaronTool class.
*/
int mitkClaronToolTest(int /* argc */, char* /*argv*/[])
{
// always start with this!
MITK_TEST_BEGIN("ClaronTool")
{
// let's create an object of our class
mitk::ClaronTool::Pointer myClaronTool = ClaronToolTestClass::New().GetPointer();
// first test: did this work?
// using MITK_TEST_CONDITION_REQUIRED makes the test stop after failure, since
// it makes no sense to continue without an object.
MITK_TEST_CONDITION_REQUIRED(myClaronTool.IsNotNull(),"Testing instantiation:")
mitk::Point3D pos;
pos[0] = 10;
pos[1] = 20;
pos[2] = 30;
myClaronTool->SetPosition(pos);
mitk::Point3D testPos;
myClaronTool->GetPosition(testPos);
MITK_TEST_CONDITION((testPos==pos),"Testing position update:")
mitk::Quaternion orientation(10,20,30,40);
myClaronTool->SetOrientation(orientation);
mitk::Quaternion testOri;
myClaronTool->GetOrientation(testOri);
MITK_TEST_CONDITION((testOri==orientation),"Testing orientation update:")
std::string name = "//testfilename";
std::string name1 = "/testfilename";
std::string name2 = "testfilename";
MITK_TEST_CONDITION(myClaronTool->LoadFile(name) == true ,"Test LoadFile() with valid windows file name")
MITK_TEST_CONDITION(myClaronTool->LoadFile(name1) == true ,"Test LoadFile() with valid Linux file name")
MITK_TEST_CONDITION(myClaronTool->LoadFile(name2) == false, "Test LoadFile() with invalid file name")
MITK_TEST_CONDITION(myClaronTool->GetCalibrationName() == name2 ,"Test GetCalibrationName() after setting with LoadFile()")
myClaronTool->SetCalibrationName(name);
MITK_TEST_CONDITION(myClaronTool->GetCalibrationName() == name ,"Test GetCalibrationName() after setting with SetCalibrationName()")
myClaronTool->LoadFile(name);
- MITK_TEST_CONDITION(myClaronTool->GetFile() == name ,"Testing GetFile() after setting file name with LoadFile()")
+ MITK_TEST_CONDITION(myClaronTool->GetFile() == name ,"Testing GetFile() after setting file name with LoadFile()");
+ MITK_TEST_CONDITION(myClaronTool->LoadFile(NULL) == false ,"Test LoadFile() with NULL as parameter.")
+ MITK_TEST_CONDITION(myClaronTool->LoadFile(std::string("")) == false ,"Test LoadFile() with empty string as parameter.")
+
+ myClaronTool->SetToolHandle(011022);
+ MITK_TEST_CONDITION(myClaronTool->GetToolHandle() == 011022 ,"Test SetToolHandle() and GetToolHandle().")
}
// always end with this!
MITK_TEST_END()
}
diff --git a/Modules/IGT/Testing/mitkNavigationDataObjectVisualizationFilterTest.cpp b/Modules/IGT/Testing/mitkNavigationDataObjectVisualizationFilterTest.cpp
index 8cf926aea2..f41e29bf3b 100644
--- a/Modules/IGT/Testing/mitkNavigationDataObjectVisualizationFilterTest.cpp
+++ b/Modules/IGT/Testing/mitkNavigationDataObjectVisualizationFilterTest.cpp
@@ -1,304 +1,306 @@
/*=========================================================================
Program: Medical Imaging & Interaction Toolkit
Language: C++
Date: $Date: 2009-02-02 18:48:48 +0100 (Mo, 02 Feb 2009) $
Version: $Revision: 16010 $
Copyright (c) German Cancer Research Center, Division of Medical and
Biological Informatics. All rights reserved.
See MITKCopyright.txt or http://www.mitk.org/copyright.html for details.
This software is distributed WITHOUT ANY WARRANTY; without even
the implied warranty of MERCHANTABILITY or FITNESS FOR A PARTICULAR
PURPOSE. See the above copyright notices for more information.
=========================================================================*/
#include "mitkNavigationDataObjectVisualizationFilter.h"
#include "mitkNavigationData.h"
#include "mitkTestingMacros.h"
#include <vtkTransform.h>
#include <iostream>
#include "mitkSurface.h"
/**Documentation
* test for the class "NavigationDataObjectVisualizationFilter".
*/
int mitkNavigationDataObjectVisualizationFilterTest(int /* argc */, char* /*argv*/[])
{
MITK_TEST_BEGIN("NavigationDataObjectVisualizationFilter")
// let's create an object of our class
mitk::NavigationDataObjectVisualizationFilter::Pointer myFilter = mitk::NavigationDataObjectVisualizationFilter::New();
// first test: did this work?
// using MITK_TEST_CONDITION_REQUIRED makes the test stop after failure, since
// it makes no sense to continue without an object.
MITK_TEST_CONDITION_REQUIRED(myFilter.IsNotNull(),"Testing instantiation");
/* create helper objects: navigation data with position as origin, zero quaternion, zero error and data valid */
mitk::NavigationData::PositionType initialPos1, initialPos2;
mitk::FillVector3D(initialPos1, 1.1, 2.2, 3.3);
mitk::FillVector3D(initialPos2, 5.0, 6.0, 7.0);
mitk::NavigationData::OrientationType initialOri1(0.1, 0.2, 0.3, 0.4);
mitk::NavigationData::OrientationType initialOri2(0.5, 0.6, 0.7, 0.8);
mitk::ScalarType initialError1(0.0);
mitk::ScalarType initialError2(5.0);
bool initialValid1(true);
bool initialValid2(true);
mitk::NavigationData::Pointer nd1 = mitk::NavigationData::New();
nd1->SetPosition(initialPos1);
nd1->SetOrientation(initialOri1);
nd1->SetPositionAccuracy(initialError1);
nd1->SetDataValid(initialValid1);
mitk::NavigationData::Pointer nd2 = mitk::NavigationData::New();
nd2->SetPosition(initialPos2);
nd2->SetOrientation(initialOri2);
nd2->SetPositionAccuracy(initialError2);
nd2->SetDataValid(initialValid2);
myFilter->SetInput(nd1);
myFilter->SetInput(1, nd2);
//testing the input
MITK_TEST_CONDITION(myFilter->GetInput() == nd1, "Testing Set-/GetInput() input 1 without index");
MITK_TEST_CONDITION(myFilter->GetInput(0) == nd1, "Testing Set-/GetInput() input 1");
MITK_TEST_CONDITION(myFilter->GetInput(1) == nd2, "Testing Set-/GetInput() input 2");
MITK_TEST_CONDITION(myFilter->GetNumberOfToolRepresentations() == 0, "Testing GetNumberOfToolRepresentations()");
//testing getting the output
mitk::NavigationData* output = myFilter->GetOutput();
MITK_TEST_CONDITION_REQUIRED(output != NULL, "Testing GetOutput()");
MITK_TEST_CONDITION_REQUIRED(output == myFilter->GetOutput(0), "Testing GetOutput() == GetOutput(0)");
MITK_TEST_CONDITION_REQUIRED(output != myFilter->GetOutput(1), "Testing GetOutput() != GetOutput(1)");
// Test setting BaseData
mitk::Surface::Pointer mitkToolData1 = mitk::Surface::New();
mitk::Surface::Pointer mitkToolData2 = mitk::Surface::New();
//dummy for test; will not be set but used to test find
mitk::Surface::Pointer mitkToolDataDummy = mitk::Surface::New();
//and the Dummy NavigationData for this
mitk::NavigationData::PositionType initialPosDummy;
mitk::FillVector3D(initialPosDummy, 8.8, 9.9, 10.10);
mitk::NavigationData::OrientationType initialOriDummy(1.1, 2.2, 3.3, 4.4);
mitk::ScalarType initialErrorDummy(10.0);
bool initialValidDummy(true);
mitk::NavigationData::Pointer ndDummy = mitk::NavigationData::New();
ndDummy->SetPosition(initialPosDummy);
ndDummy->SetOrientation(initialOriDummy);
ndDummy->SetPositionAccuracy(initialErrorDummy);
ndDummy->SetDataValid(initialValidDummy);
//now we have ndDummy and mitkToolDataDummy to test with
//setting nodes
myFilter->SetRepresentationObject(0, mitkToolData1);
MITK_TEST_CONDITION(myFilter->GetRepresentationObject(0) == mitkToolData1, "Testing SetRepresentationObject()/GetRepresentationObject() node 1");
MITK_TEST_CONDITION(myFilter->GetNumberOfToolRepresentations() == 1, "Testing GetNumberOfToolRepresentations() after adding first tool");
myFilter->SetRepresentationObject(1, mitkToolData2);
MITK_TEST_CONDITION(myFilter->GetRepresentationObject(1) == mitkToolData2, "Testing SetRepresentationObject() node 2");
MITK_TEST_CONDITION(myFilter->GetNumberOfToolRepresentations() == 2, "Testing GetNumberOfToolRepresentations() after adding second tool");
//getting nodes
MITK_TEST_CONDITION(myFilter->GetRepresentationObject(0) == mitkToolData1, "Testing GetRepresentationObject() node 1");
MITK_TEST_CONDITION(myFilter->GetRepresentationObject(0) != mitkToolDataDummy, "Testing GetRepresentationObject() != Dummy node");
MITK_TEST_CONDITION(myFilter->GetRepresentationObject(1) == mitkToolData2, "Testing GetRepresentationObject() node 2");
MITK_TEST_CONDITION(myFilter->GetRepresentationObject(1) != mitkToolDataDummy, "Testing GetRepresentationObject() != Dummy node");
MITK_TEST_CONDITION(myFilter->GetRepresentationObject(111) == NULL, "Testing GetRepresentationObject() with out of range parameter");
//Process
myFilter->Update();
//now check it there are data connected to the nodes with the according orientation and offsets
mitk::AffineTransform3D::Pointer affineTransform1 = mitkToolData1->GetGeometry()->GetIndexToWorldTransform();
mitk::AffineTransform3D::OutputVectorType offset1 = affineTransform1->GetOffset();
MITK_TEST_CONDITION(offset1.Get_vnl_vector()==initialPos1.Get_vnl_vector(), "Testing Offset position 1");
mitk::AffineTransform3D::Pointer affineTransform2 = mitkToolData2->GetGeometry()->GetIndexToWorldTransform();
mitk::AffineTransform3D::OutputVectorType offset2 = affineTransform2->GetOffset();
MITK_TEST_CONDITION(offset2.Get_vnl_vector()==initialPos2.Get_vnl_vector(), "Testing Offset position 2");
mitk::AffineTransform3D::MatrixType::InternalMatrixType m1 = affineTransform1->GetMatrix().GetVnlMatrix();
MITK_TEST_OUTPUT( << "\n initOrient1="<<initialOri1<<" affineTransform1->GetVnlMatrix():\n "<< m1);
mitk::AffineTransform3D::MatrixType::InternalMatrixType m2 = affineTransform2->GetMatrix().GetVnlMatrix();
MITK_TEST_OUTPUT( << "\n initOrient2=" << initialOri2 << " affineTransform2->GetVnlMatrix():\n " << m2);
//messing with SetRepresentationObject
//setting nodes
myFilter->SetRepresentationObject(0, mitkToolData2);
MITK_TEST_CONDITION(myFilter->GetRepresentationObject(0) == mitkToolData2, "Twisting mitkToolData by using SetRepresentationObject() NavigationData 1 with ToolData 2");
MITK_TEST_CONDITION(myFilter->GetNumberOfToolRepresentations() == 2, "Testing GetNumberOfToolRepresentations() == 1");
myFilter->SetRepresentationObject(1, mitkToolData1);
MITK_TEST_CONDITION(myFilter->GetRepresentationObject(1) == mitkToolData1, "Twisting mitkToolData by using SetRepresentationObject() NavigationData 2 with ToolData 1");
MITK_TEST_CONDITION(myFilter->GetNumberOfToolRepresentations() == 2, "Testing GetNumberOfToolRepresentations() == 2");
//getting nodes
MITK_TEST_CONDITION(myFilter->GetRepresentationObject(0) == mitkToolData2, "Testing switched BaseData of NavigationData 1 ");
MITK_TEST_CONDITION(myFilter->GetRepresentationObject(0) != mitkToolDataDummy, "Testing GetRepresentationObject() != Dummy node");
MITK_TEST_CONDITION(myFilter->GetRepresentationObject(1) == mitkToolData1, "Testing switched BaseData NavigationData 2");
MITK_TEST_CONDITION(myFilter->GetRepresentationObject(1) != mitkToolDataDummy, "Testing GetRepresentationObject() != Dummy node");
//processing update through pipeline
myFilter->Update();
//now check it there are data connected to the nodes with the according orientation and offsets
mitk::AffineTransform3D::Pointer affineTransform1Second = mitkToolData1->GetGeometry()->GetIndexToWorldTransform();
MITK_TEST_CONDITION(affineTransform1 == affineTransform1Second, "Testing affineTransform1 after second update");
mitk::AffineTransform3D::OutputVectorType offset1Second = affineTransform1->GetOffset();
MITK_TEST_CONDITION(offset1 == offset1Second, "Testing offset1 after second update");
MITK_TEST_CONDITION(offset1Second.Get_vnl_vector()==offset1.Get_vnl_vector(), "Testing offset1 equals first update");
mitk::AffineTransform3D::Pointer affineTransform2Second = mitkToolData2->GetGeometry()->GetIndexToWorldTransform();
MITK_TEST_CONDITION(affineTransform2 == affineTransform2Second, "Testing affineTransform2 after second update");
mitk::AffineTransform3D::OutputVectorType offset2Second = affineTransform2->GetOffset();
MITK_TEST_CONDITION(offset2 == offset2Second, "Testing offset2 after second update");
MITK_TEST_CONDITION(offset2Second.Get_vnl_vector()==offset2.Get_vnl_vector(), "Testing offset2 equals first update");
mitk::AffineTransform3D::MatrixType::InternalMatrixType m1Second= affineTransform1Second->GetMatrix().GetVnlMatrix();
MITK_TEST_OUTPUT( <<"\n after second update initOrient1="<<initialOri1<<" affineTransform1->GetVnlMatrix():\n "<< m1Second);
mitk::AffineTransform3D::MatrixType::InternalMatrixType m2Second= affineTransform2Second->GetMatrix().GetVnlMatrix();
MITK_TEST_OUTPUT( << "\n after second update initOrient2="<<initialOri2<<" affineTransform2->GetVnlMatrix():\n "<< m2Second);
//testing adding a third input
myFilter->SetInput(2,ndDummy);
MITK_TEST_CONDITION(myFilter->GetNumberOfInputs() == 3, "Adding new input and testing GetNumberOfInputs == 3");
MITK_TEST_CONDITION(myFilter->GetNumberOfOutputs() == 3, "testing GetNumberOfOutputs == 3");
MITK_TEST_CONDITION(myFilter->GetInput(2) == ndDummy, "Testing Input == newly added input");
MITK_TEST_CONDITION_REQUIRED(myFilter->GetOutput(2) != NULL, "Testing GetOutput(2) != NULL");
MITK_TEST_CONDITION_REQUIRED(myFilter->GetOutput(2) != myFilter->GetOutput(1), "Testing GetOutput(2) != GetOutput(1)");
myFilter->SetRepresentationObject(2, mitkToolDataDummy);
MITK_TEST_CONDITION(myFilter->GetNumberOfToolRepresentations() == 3, "Testing GetNumberOfToolRepresentations() after adding latest tool");
MITK_TEST_CONDITION(myFilter->GetRepresentationObject(2) == mitkToolDataDummy, "Testing Set-/GetRepresentationObject() equals was set");
//last time processing update through pipeline
myFilter->Update();
//now check for the new values
mitk::AffineTransform3D::Pointer affineTransformDummy = mitkToolDataDummy->GetGeometry()->GetIndexToWorldTransform();
mitk::AffineTransform3D::OutputVectorType offsetDummy = affineTransformDummy->GetOffset();
MITK_TEST_CONDITION(offsetDummy.Get_vnl_vector()==initialPosDummy.Get_vnl_vector(), "Testing Offset latest added tool");
mitk::AffineTransform3D::MatrixType::InternalMatrixType m1Latest= affineTransformDummy->GetMatrix().GetVnlMatrix();
MITK_TEST_OUTPUT( << "\n latest initOrient="<<initialOriDummy<<" latest affineTransform->GetVnlMatrix():\n "<< m1Latest);
mitk::Surface::Pointer anotherSurface = mitk::Surface::New();
myFilter->SetRepresentationObject(0, anotherSurface);
MITK_TEST_CONDITION(myFilter->GetRepresentationObject(0) == anotherSurface, "Overwriting BaseData index 0");
// test Set/GetTransformPosition()
myFilter->SetTransformPosition(0,true);
MITK_TEST_CONDITION(myFilter->GetTransformPosition(0)==true,"test Set/GetTransformPosition(0,true)");
myFilter->SetTransformPosition(1,true);
MITK_TEST_CONDITION(myFilter->GetTransformPosition(1)==true,"test Set/GetTransformPosition(1,true)");
myFilter->SetTransformPosition(2,true);
MITK_TEST_CONDITION(myFilter->GetTransformPosition(2)==true,"test Set/GetTransformPosition(2,true)");
myFilter->SetTransformPosition(3,true);
MITK_TEST_CONDITION(myFilter->GetTransformPosition(3)==true,"test Set/GetTransformPosition(3,true)");
myFilter->SetTransformPosition(0,false);
MITK_TEST_CONDITION(myFilter->GetTransformPosition(0)==false,"test Set/GetTransformPosition(0,false)");
myFilter->SetTransformPosition(1,false);
MITK_TEST_CONDITION(myFilter->GetTransformPosition(1)==false,"test Set/GetTransformPosition(1,false)");
myFilter->SetTransformPosition(2,false);
MITK_TEST_CONDITION(myFilter->GetTransformPosition(2)==false,"test Set/GetTransformPosition(2,false)");
myFilter->SetTransformPosition(3,false);
MITK_TEST_CONDITION(myFilter->GetTransformPosition(3)==false,"test Set/GetTransformPosition(3,false)");
// test Set/GetTransformOrientation()
myFilter->SetTransformOrientation(0,true);
MITK_TEST_CONDITION(myFilter->GetTransformOrientation(0)==true,"test Set/GetTransformOrientation(0,true)");
myFilter->SetTransformOrientation(1,true);
MITK_TEST_CONDITION(myFilter->GetTransformOrientation(1)==true,"test Set/GetTransformOrientation(1,true)");
myFilter->SetTransformOrientation(2,true);
MITK_TEST_CONDITION(myFilter->GetTransformOrientation(2)==true,"test Set/GetTransformOrientation(2,true)");
myFilter->SetTransformOrientation(3,true);
MITK_TEST_CONDITION(myFilter->GetTransformOrientation(3)==true,"test Set/GetTransformOrientation(3,true)");
myFilter->SetTransformOrientation(0,false);
MITK_TEST_CONDITION(myFilter->GetTransformOrientation(0)==false,"test Set/GetTransformOrientation(0,false)");
myFilter->SetTransformOrientation(1,false);
MITK_TEST_CONDITION(myFilter->GetTransformOrientation(1)==false,"test Set/GetTransformOrientation(1,false)");
myFilter->SetTransformOrientation(2,false);
MITK_TEST_CONDITION(myFilter->GetTransformOrientation(2)==false,"test Set/GetTransformOrientation(2,false)");
myFilter->SetTransformOrientation(3,false);
MITK_TEST_CONDITION(myFilter->GetTransformOrientation(3)==false,"test Set/GetTransformOrientation(3,false)");
// test the convenience methods to set/getTransformOrientation/Position
myFilter->TransformOrientationOn(0);
MITK_TEST_CONDITION(myFilter->GetTransformOrientation(0)==true,"test TransformOrientationOn()");
myFilter->TransformOrientationOff(0);
MITK_TEST_CONDITION(myFilter->GetTransformOrientation(0)==false,"test TransformOrientationOff()");
myFilter->TransformOrientationOff(1);
MITK_TEST_CONDITION(myFilter->GetTransformOrientation(1)==false,"test TransformOrientationOff()");
myFilter->TransformOrientationOn(1);
MITK_TEST_CONDITION(myFilter->GetTransformOrientation(1)==true,"test TransformOrientationOn()");
myFilter->TransformOrientationOn(2);
MITK_TEST_CONDITION(myFilter->GetTransformOrientation(2)==true,"test TransformOrientationOn()");
myFilter->TransformOrientationOff(2);
MITK_TEST_CONDITION(myFilter->GetTransformOrientation(2)==false,"test TransformOrientationOff()");
myFilter->TransformOrientationOn(3);
MITK_TEST_CONDITION(myFilter->GetTransformOrientation(3)==true,"test TransformOrientationOn()");
myFilter->TransformOrientationOff(3);
MITK_TEST_CONDITION(myFilter->GetTransformOrientation(3)==false,"test TransformOrientationOff()");
myFilter->TransformPositionOn(0);
MITK_TEST_CONDITION(myFilter->GetTransformPosition(0)==true,"test TransformPositionOn()");
myFilter->TransformPositionOff(0);
MITK_TEST_CONDITION(myFilter->GetTransformPosition(0)==false,"test TransformPositionOff()");
myFilter->TransformPositionOff(1);
MITK_TEST_CONDITION(myFilter->GetTransformPosition(1)==false,"test TransformPositionOff()");
myFilter->TransformPositionOn(1);
MITK_TEST_CONDITION(myFilter->GetTransformPosition(1)==true,"test TransformPositionOn()");
myFilter->TransformPositionOn(2);
MITK_TEST_CONDITION(myFilter->GetTransformPosition(2)==true,"test TransformPositionOn()");
myFilter->TransformPositionOff(2);
MITK_TEST_CONDITION(myFilter->GetTransformPosition(2)==false,"test TransformPositionOff()");
myFilter->TransformPositionOn(3);
MITK_TEST_CONDITION(myFilter->GetTransformPosition(3)==true,"test TransformPositionOn()");
myFilter->TransformPositionOff(3);
MITK_TEST_CONDITION(myFilter->GetTransformPosition(3)==false,"test TransformPositionOff()");
// update position and orientation
mitk::NavigationData::PositionType updatedPos1, updatedPos2, zero;
mitk::FillVector3D(updatedPos1, 3.2, 1.5, 2.8);
mitk::FillVector3D(updatedPos2, 4.3, 5.2, 6.0);
mitk::FillVector3D(zero, 0.0, 0.0, 0.0);
mitk::NavigationData::OrientationType updatedOri1(0.7, 0.5, 0.1, 0.4);
mitk::NavigationData::OrientationType updatedOri2(0.2, 0.7, 0.6, 0.1);
nd1->SetPosition(updatedPos1);
nd1->SetOrientation(updatedOri1);
nd2->SetPosition(updatedPos2);
nd2->SetOrientation(updatedOri2);
myFilter->SetRepresentationObject(0,mitkToolData1);
myFilter->SetRepresentationObject(1,mitkToolData2);
myFilter->TransformPositionOn(0);
myFilter->TransformOrientationOff(0);
myFilter->TransformPositionOff(1);
myFilter->TransformOrientationOn(1);
myFilter->Update();
// test positions and orientations
mitk::AffineTransform3D::Pointer updatedAffineTransform1 = mitkToolData1->GetGeometry()->GetIndexToWorldTransform();
mitk::AffineTransform3D::OutputVectorType updatedOffset1 = updatedAffineTransform1->GetOffset();
MITK_TEST_CONDITION(mitk::Equal(updatedOffset1.Get_vnl_vector(),updatedPos1.Get_vnl_vector()), "Testing updated position 1");
mitk::AffineTransform3D::Pointer updatedAffineTransform2 = mitkToolData2->GetGeometry()->GetIndexToWorldTransform();
mitk::AffineTransform3D::OutputVectorType updatedOffset2 = updatedAffineTransform2->GetOffset();
MITK_TEST_CONDITION(mitk::Equal(updatedOffset2.Get_vnl_vector(),zero.Get_vnl_vector()), "Testing updated position 2");
- //mitk::AffineTransform3D::Pointer identityTransform = mitk::AffineTransform3D::New();
- //identityTransform->SetIdentity();
- //mitk::AffineTransform3D::MatrixType::InternalMatrixType identityMatrix = identityTransform->GetMatrix().GetVnlMatrix();
- //mitk::AffineTransform3D::MatrixType::InternalMatrixType uM1 = updatedAffineTransform1->GetMatrix().GetVnlMatrix();
- //MITK_TEST_CONDITION(mitk::Equal(uM1,identityMatrix), "Testing updated orientation 1");
+ mitk::AffineTransform3D::Pointer identityTransform = mitk::AffineTransform3D::New();
+ identityTransform->SetIdentity();
+ mitk::AffineTransform3D::MatrixType identityMatrix = identityTransform->GetMatrix();
+ mitk::AffineTransform3D::MatrixType uM1 = updatedAffineTransform1->GetMatrix();
+ MITK_TEST_CONDITION(mitk::MatrixEqualElementWise(uM1,identityMatrix), "Testing updated orientation 1");
+ mitk::AffineTransform3D::MatrixType::InternalMatrixType uM2 = updatedAffineTransform2->GetMatrix().GetVnlMatrix();
+ MITK_TEST_CONDITION(mitk::MatrixEqualElementWise(uM2,updatedOri2.rotation_matrix_transpose().transpose()), "Testing updated orientation 2");
// always end with this!
MITK_TEST_END();
}
diff --git a/Modules/IGT/Testing/mitkNavigationDataPlayerTest.cpp b/Modules/IGT/Testing/mitkNavigationDataPlayerTest.cpp
index 8c4a36ff19..6e745bbb72 100644
--- a/Modules/IGT/Testing/mitkNavigationDataPlayerTest.cpp
+++ b/Modules/IGT/Testing/mitkNavigationDataPlayerTest.cpp
@@ -1,118 +1,118 @@
/*=========================================================================
Program: Medical Imaging & Interaction Toolkit
Language: C++
Date: $Date: 2009-05-13 14:52:01 +0200 (Mi, 13. Mai 2009) $
Version: $Revision: 17230 $
Copyright (c) German Cancer Research Center, Division of Medical and
Biological Informatics. All rights reserved.
See MITKCopyright.txt or http://www.mitk.org/copyright.html for details.
This software is distributed WITHOUT ANY WARRANTY; without even
the implied warranty of MERCHANTABILITY or FITNESS FOR A PARTICULAR
PURPOSE. See the above copyright notices for more information.
=========================================================================*/
#include "mitkNavigationDataPlayer.h"
#include "mitkNavigationData.h"
#include "mitkTestingMacros.h"
#include "mitkStandardFileLocations.h"
#include "mitkTimeStamp.h"
#include <iostream>
#include <sstream>
/**Documentation
* test for the class "NavigationDataPlayer".
*/
int mitkNavigationDataPlayerTest(int /* argc */, char* /*argv*/[])
{
MITK_TEST_BEGIN("NavigationDataPlayer");
std::string tmp = "";
// let's create an object of our class
mitk::NavigationDataPlayer::Pointer player = mitk::NavigationDataPlayer::New();
// first test: did this work?
// using MITK_TEST_CONDITION_REQUIRED makes the test stop after failure, since
// it makes no sense to continue without an object.
MITK_TEST_CONDITION_REQUIRED(player.IsNotNull(), "Testing instantiation");
std::string file = mitk::StandardFileLocations::GetInstance()->FindFile("NavigationDataTestData.xml", "Modules/IGT/Testing/Data");
player->SetFileName( file );
MITK_TEST_CONDITION_REQUIRED( strcmp(player->GetFileName(), file.c_str()) == 0, "Testing SetFileName and GetFileName");
player->SetStream( mitk::NavigationDataPlayer::NormalFile );
player->StartPlaying();
player->Update();
player->StopPlaying();
mitk::NavigationData::Pointer nd = player->GetOutput();
mitk::Point3D pnt;
pnt[0] = 1;
pnt[1] = 0;
pnt[2] = 3;
MITK_TEST_CONDITION_REQUIRED( nd->GetPosition() == pnt, "Testing position of replayed NavigaionData" );
player = mitk::NavigationDataPlayer::New();
player->SetFileName( file );
player->SetStream( mitk::NavigationDataPlayer::NormalFile );
std::vector<double> times, refTimes;
refTimes.resize(5);
refTimes[0] = 3.9;
refTimes[1] = 83.6;
refTimes[2] = 174.4;
refTimes[3] = 275.0;
refTimes[4] = 385.39;
std::vector<mitk::Point3D> points, refPoints;
refPoints.resize(5);
refPoints[0][0] = 1; refPoints[0][1] = 0; refPoints[0][2] = 3;
refPoints[1][0] = 2; refPoints[1][1] = 1; refPoints[1][2] = 4;
refPoints[2][0] = 3; refPoints[2][1] = 2; refPoints[2][2] = 5;
refPoints[3][0] = 4; refPoints[3][1] = 3; refPoints[3][2] = 6;
refPoints[4][0] = 5; refPoints[4][1] = 4; refPoints[4][2] = 7;
mitk::TimeStamp::Pointer timer = mitk::TimeStamp::GetInstance();
timer->Initialize();
itk::Object::Pointer obj = itk::Object::New();
mitk::Point3D oldPos;
oldPos[0] = 1;
oldPos[1] = 0;
oldPos[2] = 3;
timer->Start( obj );
player->StartPlaying();
while( times.size()<5 )
{
player->Update();
pnt = player->GetOutput()->GetPosition();
if ( pnt != oldPos )
{
times.push_back( timer->GetElapsed(obj) );
points.push_back(oldPos);
oldPos = pnt;
}
}
player->StopPlaying();
// if this test fails, it may be because the dartclient runs on a virtual machine.
// Under these circumstances, it may be impossible to achieve a time-accuracy of 10ms
for ( int i=0;i<5;i++ )
{
- if ((times[i]>refTimes[i]-50 && times[i]<refTimes[i]+50)) {MITK_TEST_OUTPUT(<< "ref: " << refTimes[i] << " / time elapsed: " << times[i]);}
- MITK_TEST_CONDITION_REQUIRED( (times[i]>refTimes[i]-50 && times[i]<refTimes[i]+50), "checking for more or less correct time-line" );
+ if ((times[i]>refTimes[i]-150 && times[i]<refTimes[i]+150)) {MITK_TEST_OUTPUT(<< "ref: " << refTimes[i] << " / time elapsed: " << times[i]);}
+ MITK_TEST_CONDITION_REQUIRED( (times[i]>refTimes[i]-150 && times[i]<refTimes[i]+150), "checking for more or less correct time-line" );
MITK_TEST_CONDITION_REQUIRED(points[i] == refPoints[i], "checking if the point coordinates are correct")
}
// always end with this!
MITK_TEST_END();
}
diff --git a/Modules/IGT/Testing/mitkNavigationToolReaderAndWriterTest.cpp b/Modules/IGT/Testing/mitkNavigationToolReaderAndWriterTest.cpp
index 075dd94e3a..5e1bf0eb5f 100644
--- a/Modules/IGT/Testing/mitkNavigationToolReaderAndWriterTest.cpp
+++ b/Modules/IGT/Testing/mitkNavigationToolReaderAndWriterTest.cpp
@@ -1,223 +1,254 @@
/*=========================================================================
Program: Medical Imaging & Interaction Toolkit
Language: C++
Date: $Date: 2008-02-25 17:27:17 +0100 (Mo, 25 Feb 2008) $
Version: $Revision: 7837 $
Copyright (c) German Cancer Research Center, Division of Medical and
Biological Informatics. All rights reserved.
See MITKCopyright.txt or http://www.mitk.org/copyright.html for details.
This software is distributed WITHOUT ANY WARRANTY; without even
the implied warranty of MERCHANTABILITY or FITNESS FOR A PARTICULAR
PURPOSE. See the above copyright notices for more information.
=========================================================================*/
//Poco headers
#include "Poco/Path.h"
//mitk headers
#include "mitkNavigationToolWriter.h"
#include "mitkCommon.h"
#include "mitkTestingMacros.h"
#include "mitkStandardFileLocations.h"
#include "mitkNavigationTool.h"
#include "mitkSTLFileReader.h"
#include "mitkBaseData.h"
#include "mitkDataNode.h"
#include "mitkSurface.h"
#include "mitkStandaloneDataStorage.h"
#include "mitkDataStorage.h"
#include "mitkNavigationToolReader.h"
#include <sstream>
#include <fstream>
class mitkNavigationToolReaderAndWriterTestClass
{
private:
static mitk::Surface::Pointer testSurface;
public:
static void TestInstantiation()
{
// let's create an object of our class
mitk::NavigationToolWriter::Pointer myWriter = mitk::NavigationToolWriter::New();
MITK_TEST_CONDITION_REQUIRED(myWriter.IsNotNull(),"Testing instantiation")
}
static void TestWrite()
{
//testcase with first test tool: a claron tool
//create a NavigationTool which we can write on the harddisc
std::string toolFileName = mitk::StandardFileLocations::GetInstance()->FindFile("ClaronTool", "Modules/IGT/Testing/Data");
MITK_TEST_CONDITION(toolFileName.empty() == false, "Check if tool calibration of claron tool file exists");
mitk::NavigationTool::Pointer myNavigationTool = mitk::NavigationTool::New();
myNavigationTool->SetCalibrationFile(toolFileName);
mitk::DataNode::Pointer myNode = mitk::DataNode::New();
myNode->SetName("ClaronTool");
//load an stl File
mitk::STLFileReader::Pointer stlReader = mitk::STLFileReader::New();
try
{
stlReader->SetFileName( mitk::StandardFileLocations::GetInstance()->FindFile("ClaronTool.stl", "Testing/Data/").c_str() );
stlReader->Update();
}
catch (...)
{
MITK_TEST_FAILED_MSG(<<"Cannot read stl file.");
}
if ( stlReader->GetOutput() == NULL )
{
MITK_TEST_FAILED_MSG(<<"Cannot read stl file.");
}
else
{
testSurface = stlReader->GetOutput();
myNode->SetData(testSurface);
}
myNavigationTool->SetDataNode(myNode);
myNavigationTool->SetIdentifier("ClaronTool#1");
myNavigationTool->SetSerialNumber("0815");
myNavigationTool->SetTrackingDeviceType(mitk::ClaronMicron);
myNavigationTool->SetType(mitk::NavigationTool::Fiducial);
//now create a writer and write it to the harddisc
mitk::NavigationToolWriter::Pointer myWriter = mitk::NavigationToolWriter::New();
std::string filename = mitk::StandardFileLocations::GetInstance()->GetOptionDirectory()+Poco::Path::separator()+".."+Poco::Path::separator()+"TestTool.tool";
MITK_TEST_OUTPUT(<<"---- Testing navigation tool writer with first test tool (claron tool) ----");
bool test = myWriter->DoWrite(filename,myNavigationTool);
MITK_TEST_CONDITION_REQUIRED(test,"OK");
}
static void TestRead()
{
mitk::DataStorage::Pointer testStorage = dynamic_cast<mitk::DataStorage*>(mitk::StandaloneDataStorage::New().GetPointer());
mitk::NavigationToolReader::Pointer myReader = mitk::NavigationToolReader::New(testStorage);
mitk::NavigationTool::Pointer readTool = myReader->DoRead(mitk::StandardFileLocations::GetInstance()->GetOptionDirectory()+Poco::Path::separator()+".."+Poco::Path::separator()+"TestTool.tool");
MITK_TEST_OUTPUT(<<"---- Testing navigation tool reader with first test tool (claron tool) ----");
//Test if there was created a new tool
MITK_TEST_CONDITION_REQUIRED(readTool->GetDataNode() == testStorage->GetNamedNode(readTool->GetDataNode()->GetName()),"Test if tool was added to storage...");
//Test if the surfaces do have the same number of vertexes (it would be better to test for real equality of the surfaces!)
MITK_TEST_CONDITION_REQUIRED(dynamic_cast<mitk::Surface*>(readTool->GetDataNode()->GetData())->GetSizeOfPolyDataSeries()==testSurface->GetSizeOfPolyDataSeries(),"Test if surface was restored correctly ...");
MITK_TEST_CONDITION_REQUIRED(readTool->GetType()==mitk::NavigationTool::Fiducial,"Testing Tool Type");
MITK_TEST_CONDITION_REQUIRED(readTool->GetTrackingDeviceType()==mitk::ClaronMicron,"Testing Tracking Device Type");
MITK_TEST_CONDITION_REQUIRED(readTool->GetSerialNumber()=="0815","Testing Serial Number");
std::ifstream TestFile(readTool->GetCalibrationFile().c_str());
MITK_TEST_CONDITION_REQUIRED(TestFile,"Testing If Calibration File Exists");
}
static void TestWrite2()
{
//testcase with second test tool: an aurora tool
//create a NavigationTool which we can write on the harddisc
mitk::NavigationTool::Pointer myNavigationTool = mitk::NavigationTool::New();
mitk::DataNode::Pointer myNode = mitk::DataNode::New();
myNode->SetName("AuroraTool");
//load an stl File
mitk::STLFileReader::Pointer stlReader = mitk::STLFileReader::New();
try
{
stlReader->SetFileName( mitk::StandardFileLocations::GetInstance()->FindFile("EMTool.stl", "Testing/Data/").c_str() );
stlReader->Update();
}
catch (...)
{
MITK_TEST_FAILED_MSG(<<"Cannot read stl file.");
}
if ( stlReader->GetOutput() == NULL )
{
MITK_TEST_FAILED_MSG(<<"Cannot read stl file.");
}
else
{
testSurface = stlReader->GetOutput();
myNode->SetData(testSurface);
}
myNavigationTool->SetDataNode(myNode);
myNavigationTool->SetIdentifier("AuroraTool#1");
myNavigationTool->SetSerialNumber("0816");
myNavigationTool->SetTrackingDeviceType(mitk::NDIAurora);
myNavigationTool->SetType(mitk::NavigationTool::Instrument);
//now create a writer and write it to the harddisc
mitk::NavigationToolWriter::Pointer myWriter = mitk::NavigationToolWriter::New();
std::string filename = mitk::StandardFileLocations::GetInstance()->GetOptionDirectory()+Poco::Path::separator()+".."+Poco::Path::separator()+"TestTool2.tool";
MITK_TEST_OUTPUT(<<"---- Testing navigation tool writer with second tool (aurora tool) ----");
bool test = myWriter->DoWrite(filename,myNavigationTool);
MITK_TEST_CONDITION_REQUIRED(test,"OK");
}
static void TestRead2()
{
mitk::DataStorage::Pointer testStorage = dynamic_cast<mitk::DataStorage*>(mitk::StandaloneDataStorage::New().GetPointer());
mitk::NavigationToolReader::Pointer myReader = mitk::NavigationToolReader::New(testStorage);
mitk::NavigationTool::Pointer readTool = myReader->DoRead(mitk::StandardFileLocations::GetInstance()->GetOptionDirectory()+Poco::Path::separator()+".."+Poco::Path::separator()+"TestTool2.tool");
MITK_TEST_OUTPUT(<<"---- Testing navigation tool reader with second tool (aurora tool) ----");
//Test if there was created a new tool
MITK_TEST_CONDITION_REQUIRED(readTool->GetDataNode() == testStorage->GetNamedNode(readTool->GetDataNode()->GetName()),"Test if tool was added to storage...");
//Test if the surfaces do have the same number of vertexes (it would be better to test for real equality of the surfaces!)
MITK_TEST_CONDITION_REQUIRED(dynamic_cast<mitk::Surface*>(readTool->GetDataNode()->GetData())->GetSizeOfPolyDataSeries()==testSurface->GetSizeOfPolyDataSeries(),"Test if surface was restored correctly ...");
//Test if the tool type is the same
MITK_TEST_CONDITION_REQUIRED(readTool->GetType()==mitk::NavigationTool::Instrument,"Testing Tool Type");
MITK_TEST_CONDITION_REQUIRED(readTool->GetTrackingDeviceType()==mitk::NDIAurora,"Testing Tracking Device Type");
MITK_TEST_CONDITION_REQUIRED(readTool->GetSerialNumber()=="0816","Testing Serial Number");
MITK_TEST_CONDITION_REQUIRED(readTool->GetCalibrationFile()=="none","Testing Calibration File");
}
static void CleanUp()
{
std::remove((mitk::StandardFileLocations::GetInstance()->GetOptionDirectory()+Poco::Path::separator()+".."+Poco::Path::separator()+"TestTool.tool").c_str());
std::remove((mitk::StandardFileLocations::GetInstance()->GetOptionDirectory()+Poco::Path::separator()+".."+Poco::Path::separator()+"TestTool2.tool").c_str());
}
+ static void TestReadInvalidData()
+ {
+ mitk::DataStorage::Pointer testStorage = dynamic_cast<mitk::DataStorage*>(mitk::StandaloneDataStorage::New().GetPointer());
+ mitk::NavigationToolReader::Pointer myReader = mitk::NavigationToolReader::New(testStorage);
+ mitk::NavigationTool::Pointer readTool = myReader->DoRead("invalidTool");
+
+ MITK_TEST_CONDITION_REQUIRED(readTool.IsNull(), "Testing return value if filename is invalid");
+ MITK_TEST_CONDITION_REQUIRED(myReader->GetErrorMessage() == "Cannot open 'invalidTool' for reading", "Testing error message in this case");
+ }
+
+ static void TestWriteInvalidData()
+ {
+ mitk::NavigationTool::Pointer myNavigationTool = mitk::NavigationTool::New();
+ myNavigationTool->SetIdentifier("ClaronTool#1");
+ myNavigationTool->SetSerialNumber("0815");
+ myNavigationTool->SetTrackingDeviceType(mitk::ClaronMicron);
+ myNavigationTool->SetType(mitk::NavigationTool::Fiducial);
+
+ //now create a writer and write it to the harddisc
+ mitk::NavigationToolWriter::Pointer myWriter = mitk::NavigationToolWriter::New();
+ std::string filename = "NH:/sfdsfsdsf.&%%%";
+
+ MITK_TEST_OUTPUT(<<"---- Testing write invalid file ----");
+ bool test = myWriter->DoWrite(filename,myNavigationTool);
+ MITK_TEST_CONDITION_REQUIRED(!test,"testing write");
+ MITK_TEST_CONDITION_REQUIRED(myWriter->GetErrorMessage() == "Could not open a zip file for writing: 'NH:/sfdsfsdsf.&%%%'","testing error message");
+ }
+
};
mitk::Surface::Pointer mitkNavigationToolReaderAndWriterTestClass::testSurface = NULL;
/** This function is testing the TrackingVolume class. */
int mitkNavigationToolReaderAndWriterTest(int /* argc */, char* /*argv*/[])
{
MITK_TEST_BEGIN("NavigationToolWriter")
mitkNavigationToolReaderAndWriterTestClass::TestInstantiation();
mitkNavigationToolReaderAndWriterTestClass::TestWrite();
mitkNavigationToolReaderAndWriterTestClass::TestRead();
mitkNavigationToolReaderAndWriterTestClass::TestWrite2();
mitkNavigationToolReaderAndWriterTestClass::TestRead2();
+ mitkNavigationToolReaderAndWriterTestClass::TestReadInvalidData();
+ mitkNavigationToolReaderAndWriterTestClass::TestWriteInvalidData();
mitkNavigationToolReaderAndWriterTestClass::CleanUp();
+
MITK_TEST_END()
}
diff --git a/Modules/IGT/Testing/mitkNavigationToolStorageSerializerAndDeserializerTest.cpp b/Modules/IGT/Testing/mitkNavigationToolStorageSerializerAndDeserializerTest.cpp
index 578b8b911b..458e22faae 100644
--- a/Modules/IGT/Testing/mitkNavigationToolStorageSerializerAndDeserializerTest.cpp
+++ b/Modules/IGT/Testing/mitkNavigationToolStorageSerializerAndDeserializerTest.cpp
@@ -1,220 +1,231 @@
/*=========================================================================
Program: Medical Imaging & Interaction Toolkit
Language: C++
Date: $Date: 2008-02-25 17:27:17 +0100 (Mo, 25 Feb 2008) $
Version: $Revision: 7837 $
Copyright (c) German Cancer Research Center, Division of Medical and
Biological Informatics. All rights reserved.
See MITKCopyright.txt or http://www.mitk.org/copyright.html for details.
This software is distributed WITHOUT ANY WARRANTY; without even
the implied warranty of MERCHANTABILITY or FITNESS FOR A PARTICULAR
PURPOSE. See the above copyright notices for more information.
=========================================================================*/
//Poco headers
#include "Poco/Path.h"
#include <mitkNavigationToolStorageSerializer.h>
#include <mitkNavigationToolStorageDeserializer.h>
#include <mitkCommon.h>
#include <mitkTestingMacros.h>
#include <mitkStandaloneDataStorage.h>
#include <mitkStandardFileLocations.h>
#include <mitkSTLFileReader.h>
#include "mitkNavigationToolStorage.h"
class NavigationToolStorageSerializerAndDeserializerTestClass
{
public:
static void TestInstantiationSerializer()
{
// let's create objects of our classes
mitk::NavigationToolStorageSerializer::Pointer testSerializer = mitk::NavigationToolStorageSerializer::New();
MITK_TEST_CONDITION_REQUIRED(testSerializer.IsNotNull(),"Testing instantiation of NavigationToolStorageSerializer");
}
static void TestInstantiationDeserializer()
{
mitk::DataStorage::Pointer tempStorage = dynamic_cast<mitk::DataStorage*>(mitk::StandaloneDataStorage::New().GetPointer()); //needed for deserializer!
mitk::NavigationToolStorageDeserializer::Pointer testDeserializer = mitk::NavigationToolStorageDeserializer::New(tempStorage);
MITK_TEST_CONDITION_REQUIRED(testDeserializer.IsNotNull(),"Testing instantiation of NavigationToolStorageDeserializer")
}
static void TestWriteSimpleToolStorage()
{
//create Tool Storage
mitk::NavigationToolStorage::Pointer myStorage = mitk::NavigationToolStorage::New();
//first tool
mitk::NavigationTool::Pointer myTool1 = mitk::NavigationTool::New();
myTool1->SetIdentifier("001");
myStorage->AddTool(myTool1);
//second tool
mitk::NavigationTool::Pointer myTool2 = mitk::NavigationTool::New();
myTool2->SetIdentifier("002");
myStorage->AddTool(myTool2);
//third tool
mitk::NavigationTool::Pointer myTool3 = mitk::NavigationTool::New();
myTool3->SetIdentifier("003");
myStorage->AddTool(myTool3);
//create Serializer
mitk::NavigationToolStorageSerializer::Pointer mySerializer = mitk::NavigationToolStorageSerializer::New();
//create filename
std::string filename = mitk::StandardFileLocations::GetInstance()->GetOptionDirectory()+Poco::Path::separator()+".."+Poco::Path::separator()+"TestStorage.storage";
//test serialization
bool success = mySerializer->Serialize(filename,myStorage);
MITK_TEST_CONDITION_REQUIRED(success,"Testing serialization of simple tool storage");
}
static void TestReadSimpleToolStorage()
{
mitk::DataStorage::Pointer tempStorage = dynamic_cast<mitk::DataStorage*>(mitk::StandaloneDataStorage::New().GetPointer()); //needed for deserializer!
mitk::NavigationToolStorageDeserializer::Pointer myDeserializer = mitk::NavigationToolStorageDeserializer::New(tempStorage);
mitk::NavigationToolStorage::Pointer readStorage = myDeserializer->Deserialize(mitk::StandardFileLocations::GetInstance()->GetOptionDirectory()+Poco::Path::separator()+".."+Poco::Path::separator()+"TestStorage.storage");
MITK_TEST_CONDITION_REQUIRED(readStorage.IsNotNull(),"Testing deserialization of simple tool storage");
MITK_TEST_CONDITION_REQUIRED(readStorage->GetToolCount()==3," ..Testing number of tools in storage");
//TODO: why is the order of tools changed is save/load process??
bool foundtool1 = false;
bool foundtool2 = false;
bool foundtool3 = false;
for(int i=0; i<3; i++)
{
if ((readStorage->GetTool(i)->GetIdentifier()=="001")) foundtool1 = true;
else if ((readStorage->GetTool(i)->GetIdentifier()=="002")) foundtool2 = true;
else if ((readStorage->GetTool(i)->GetIdentifier()=="003")) foundtool3 = true;
}
MITK_TEST_CONDITION_REQUIRED(foundtool1&&foundtool2&&foundtool3," ..Testing if identifiers of tools where saved / loaded successfully");
}
static void CleanUp()
{
std::remove((mitk::StandardFileLocations::GetInstance()->GetOptionDirectory()+Poco::Path::separator()+".."+Poco::Path::separator()+"TestStorage.storage").c_str());
std::remove((mitk::StandardFileLocations::GetInstance()->GetOptionDirectory()+Poco::Path::separator()+".."+Poco::Path::separator()+"TestStorage2.storage").c_str());
}
static void TestWriteComplexToolStorage()
{
//create first tool
mitk::Surface::Pointer testSurface;
std::string toolFileName = mitk::StandardFileLocations::GetInstance()->FindFile("ClaronTool", "Modules/IGT/Testing/Data");
MITK_TEST_CONDITION(toolFileName.empty() == false, "Check if tool calibration of claron tool file exists");
mitk::NavigationTool::Pointer myNavigationTool = mitk::NavigationTool::New();
myNavigationTool->SetCalibrationFile(toolFileName);
mitk::DataNode::Pointer myNode = mitk::DataNode::New();
myNode->SetName("ClaronTool");
//load an stl File
mitk::STLFileReader::Pointer stlReader = mitk::STLFileReader::New();
try
{
stlReader->SetFileName( mitk::StandardFileLocations::GetInstance()->FindFile("ClaronTool.stl", "Testing/Data/").c_str() );
stlReader->Update();
}
catch (...)
{
MITK_TEST_FAILED_MSG(<<"Cannot read stl file.");
}
if ( stlReader->GetOutput() == NULL )
{
MITK_TEST_FAILED_MSG(<<"Cannot read stl file.");
}
else
{
testSurface = stlReader->GetOutput();
myNode->SetData(testSurface);
}
myNavigationTool->SetDataNode(myNode);
myNavigationTool->SetIdentifier("ClaronTool#1");
myNavigationTool->SetSerialNumber("0815");
myNavigationTool->SetTrackingDeviceType(mitk::ClaronMicron);
myNavigationTool->SetType(mitk::NavigationTool::Fiducial);
//create second tool
mitk::NavigationTool::Pointer myNavigationTool2 = mitk::NavigationTool::New();
mitk::Surface::Pointer testSurface2;
mitk::DataNode::Pointer myNode2 = mitk::DataNode::New();
myNode2->SetName("AuroraTool");
//load an stl File
try
{
stlReader->SetFileName( mitk::StandardFileLocations::GetInstance()->FindFile("EMTool.stl", "Testing/Data/").c_str() );
stlReader->Update();
}
catch (...)
{
MITK_TEST_FAILED_MSG(<<"Cannot read stl file.");
}
if ( stlReader->GetOutput() == NULL )
{
MITK_TEST_FAILED_MSG(<<"Cannot read stl file.");
}
else
{
testSurface2 = stlReader->GetOutput();
myNode2->SetData(testSurface2);
}
myNavigationTool2->SetDataNode(myNode2);
myNavigationTool2->SetIdentifier("AuroraTool#1");
myNavigationTool2->SetSerialNumber("0816");
myNavigationTool2->SetTrackingDeviceType(mitk::NDIAurora);
myNavigationTool2->SetType(mitk::NavigationTool::Instrument);
//create navigation tool storage
mitk::NavigationToolStorage::Pointer myStorage = mitk::NavigationToolStorage::New();
myStorage->AddTool(myNavigationTool);
myStorage->AddTool(myNavigationTool2);
//create Serializer
mitk::NavigationToolStorageSerializer::Pointer mySerializer = mitk::NavigationToolStorageSerializer::New();
//create filename
std::string filename = mitk::StandardFileLocations::GetInstance()->GetOptionDirectory()+Poco::Path::separator()+".."+Poco::Path::separator()+"TestStorage2.storage";
//test serialization
bool success = mySerializer->Serialize(filename,myStorage);
MITK_TEST_CONDITION_REQUIRED(success,"Testing serialization of complex tool storage");
}
static void TestReadComplexToolStorage()
{
mitk::DataStorage::Pointer tempStorage = dynamic_cast<mitk::DataStorage*>(mitk::StandaloneDataStorage::New().GetPointer()); //needed for deserializer!
mitk::NavigationToolStorageDeserializer::Pointer myDeserializer = mitk::NavigationToolStorageDeserializer::New(tempStorage);
mitk::NavigationToolStorage::Pointer readStorage = myDeserializer->Deserialize(mitk::StandardFileLocations::GetInstance()->GetOptionDirectory()+Poco::Path::separator()+".."+Poco::Path::separator()+"TestStorage2.storage");
MITK_TEST_CONDITION_REQUIRED(readStorage.IsNotNull(),"Testing deserialization of complex tool storage");
MITK_TEST_CONDITION_REQUIRED(readStorage->GetToolCount()==2," ..Testing number of tools in storage");
}
+
+ static void TestReadInvalidStorage()
+ {
+ mitk::DataStorage::Pointer tempStorage = dynamic_cast<mitk::DataStorage*>(mitk::StandaloneDataStorage::New().GetPointer()); //needed for deserializer!
+ mitk::NavigationToolStorageDeserializer::Pointer myDeserializer = mitk::NavigationToolStorageDeserializer::New(tempStorage);
+ mitk::NavigationToolStorage::Pointer readStorage = myDeserializer->Deserialize("noStorage.tfl");
+ MITK_TEST_CONDITION_REQUIRED(readStorage->isEmpty(),"Testing deserialization of invalid data storage.");
+ MITK_TEST_CONDITION_REQUIRED(myDeserializer->GetErrorMessage() == "Cannot open 'noStorage.tfl' for reading", "Checking Error Message");
+ }
+
};
/** This function is testing the TrackingVolume class. */
int mitkNavigationToolStorageSerializerAndDeserializerTest(int /* argc */, char* /*argv*/[])
{
MITK_TEST_BEGIN("NavigationToolStorageSerializerAndDeserializer");
//NavigationToolStorageSerializerAndDeserializerTestClass::TestInstantiationSerializer();
//NavigationToolStorageSerializerAndDeserializerTestClass::TestInstantiationDeserializer();
NavigationToolStorageSerializerAndDeserializerTestClass::TestWriteSimpleToolStorage();
NavigationToolStorageSerializerAndDeserializerTestClass::TestReadSimpleToolStorage();
NavigationToolStorageSerializerAndDeserializerTestClass::TestWriteComplexToolStorage();
NavigationToolStorageSerializerAndDeserializerTestClass::TestReadComplexToolStorage();
+ NavigationToolStorageSerializerAndDeserializerTestClass::TestReadInvalidStorage();
NavigationToolStorageSerializerAndDeserializerTestClass::CleanUp();
MITK_TEST_END();
}
diff --git a/Modules/IGT/Testing/mitkNavigationToolStorageTest.cpp b/Modules/IGT/Testing/mitkNavigationToolStorageTest.cpp
index 310c309266..6574644e07 100644
--- a/Modules/IGT/Testing/mitkNavigationToolStorageTest.cpp
+++ b/Modules/IGT/Testing/mitkNavigationToolStorageTest.cpp
@@ -1,126 +1,155 @@
/*=========================================================================
Program: Medical Imaging & Interaction Toolkit
Language: C++
Date: $Date: 2008-02-25 17:27:17 +0100 (Mo, 25 Feb 2008) $
Version: $Revision: 7837 $
Copyright (c) German Cancer Research Center, Division of Medical and
Biological Informatics. All rights reserved.
See MITKCopyright.txt or http://www.mitk.org/copyright.html for details.
This software is distributed WITHOUT ANY WARRANTY; without even
the implied warranty of MERCHANTABILITY or FITNESS FOR A PARTICULAR
PURPOSE. See the above copyright notices for more information.
=========================================================================*/
#include "mitkNavigationToolStorage.h"
#include "mitkNavigationTool.h"
#include "mitkCommon.h"
#include "mitkTestingMacros.h"
class mitkNavigationToolStorageTestClass
{
public:
static void TestInstantiation()
{
// let's create an object of our class
mitk::NavigationToolStorage::Pointer myStorage = mitk::NavigationToolStorage::New();
MITK_TEST_CONDITION_REQUIRED(myStorage.IsNotNull(),"Testing instantiation")
}
static void TestAddAndDelete()
{
mitk::NavigationToolStorage::Pointer myStorage = mitk::NavigationToolStorage::New();
//first tool
mitk::NavigationTool::Pointer myTool1 = mitk::NavigationTool::New();
myTool1->SetIdentifier("001");
MITK_TEST_CONDITION_REQUIRED(myStorage->AddTool(myTool1),"Testing: Add 1st tool.");
MITK_TEST_CONDITION_REQUIRED(myStorage->GetToolCount()==1,"Testing: Is first tool in storage?");
//second tool
mitk::NavigationTool::Pointer myTool2 = mitk::NavigationTool::New();
myTool2->SetIdentifier("002");
MITK_TEST_CONDITION_REQUIRED(myStorage->AddTool(myTool2),"Testing: Add 2nd tool.");
MITK_TEST_CONDITION_REQUIRED(myStorage->GetToolCount()==2,"Testing: Is second tool in storage?");
//third tool (same identifier => not valid!)
mitk::NavigationTool::Pointer myTool3 = mitk::NavigationTool::New();
myTool3->SetIdentifier("002");
MITK_TEST_CONDITION_REQUIRED(!myStorage->AddTool(myTool3),"Testing: Add 3rd tool, which is not valid.");
MITK_TEST_CONDITION_REQUIRED(myStorage->GetToolCount()==2,"Testing: 3rd tool should NOT be in the storage!");
//delete second tool
myStorage->DeleteTool(1);
MITK_TEST_CONDITION_REQUIRED(myStorage->GetToolCount()==1,"Testing: Delete 2nd tool.");
//delete first tool
myStorage->DeleteTool(0);
MITK_TEST_CONDITION_REQUIRED(myStorage->GetToolCount()==0,"Testing: Delete 1st tool.");
//delete tool with wrong tool number
MITK_TEST_CONDITION_REQUIRED(!myStorage->DeleteTool(412),"Testing: Delete non-existing tool. No error should occur!");
}
static void TestAddAndDelete100Tools()
{
mitk::NavigationToolStorage::Pointer myStorage = mitk::NavigationToolStorage::New();
for(int i=0; i<100; i++)
{
mitk::NavigationTool::Pointer myTool = mitk::NavigationTool::New();
std::stringstream str;
str << i;
myTool->SetIdentifier(str.str());
myStorage->AddTool(myTool);
}
MITK_TEST_CONDITION_REQUIRED(myStorage->GetToolCount()==100,"Testing: Adding 100 tools.");
for(int i=99; i>-1; i--)
{
myStorage->DeleteTool(i);
}
MITK_TEST_CONDITION_REQUIRED(myStorage->GetToolCount()==0,"Testing: Delete 100 tools.");
}
+ static void TestAddAndDelete100ToolsAtOnce()
+ {
+ mitk::NavigationToolStorage::Pointer myStorage = mitk::NavigationToolStorage::New();
+ for(int i=0; i<100; i++)
+ {
+ mitk::NavigationTool::Pointer myTool = mitk::NavigationTool::New();
+ std::stringstream str;
+ str << i;
+ myTool->SetIdentifier(str.str());
+ myStorage->AddTool(myTool);
+ }
+ MITK_TEST_CONDITION_REQUIRED(myStorage->GetToolCount()==100,"Testing: Adding 100 tools.");
+ MITK_TEST_CONDITION_REQUIRED(!myStorage->isEmpty(),"Testing: method isEmpty() with non empty storage.");
+ MITK_TEST_CONDITION_REQUIRED(myStorage->DeleteAllTools(),"Testing: Delete method.");
+ MITK_TEST_CONDITION_REQUIRED(myStorage->isEmpty(),"Testing: method isEmpty() with empty storage.");
+
+ MITK_TEST_CONDITION_REQUIRED(myStorage->GetToolCount()==0,"Testing: Delete 100 tools at once.");
+ }
+
static void TestGetTool()
{
//let's create an object of our class
mitk::NavigationToolStorage::Pointer myStorage = mitk::NavigationToolStorage::New();
//let's add two different tools
//first tool
mitk::NavigationTool::Pointer myTool1 = mitk::NavigationTool::New();
myTool1->SetSerialNumber("0815");
myTool1->SetIdentifier("001");
+ mitk::DataNode::Pointer toolNode = mitk::DataNode::New();
+ toolNode->SetName("Tool1");
+ myTool1->SetDataNode(toolNode);
myStorage->AddTool(myTool1);
//second tool
mitk::NavigationTool::Pointer myTool2 = mitk::NavigationTool::New();
myTool2->SetSerialNumber("0816");
myTool2->SetIdentifier("002");
myStorage->AddTool(myTool2);
//let's try to get the first tool in different ways.
mitk::NavigationTool::Pointer myToolGet = myStorage->GetTool(0);
MITK_TEST_CONDITION_REQUIRED(myToolGet==myTool1,"Testing GetTool() by number.");
myToolGet = myStorage->GetTool("001");
MITK_TEST_CONDITION_REQUIRED(myToolGet==myTool1,"Testing GetTool() by identifier.");
+ myToolGet = myStorage->GetToolByName("Tool1");
+ MITK_TEST_CONDITION_REQUIRED(myToolGet==myTool1,"Testing GetTool() by name.");
+
+ //let's try to get a tool which doesn't exist
+ myToolGet = myStorage->GetToolByName("quatsch");
+ MITK_TEST_CONDITION_REQUIRED(myToolGet.IsNull(),"Testing GetTool() with wrong name.");
}
};
/** This function is testing the TrackingVolume class. */
int mitkNavigationToolStorageTest(int /* argc */, char* /*argv*/[])
{
MITK_TEST_BEGIN("NavigationToolStorage")
mitkNavigationToolStorageTestClass::TestInstantiation();
mitkNavigationToolStorageTestClass::TestAddAndDelete();
mitkNavigationToolStorageTestClass::TestAddAndDelete100Tools();
+ mitkNavigationToolStorageTestClass::TestAddAndDelete100ToolsAtOnce();
mitkNavigationToolStorageTestClass::TestGetTool();
MITK_TEST_END()
}
diff --git a/Modules/IGT/Testing/mitkTrackingVolumeGeneratorTest.cpp b/Modules/IGT/Testing/mitkTrackingVolumeGeneratorTest.cpp
index 9d16c2e230..d4680ad1d9 100644
--- a/Modules/IGT/Testing/mitkTrackingVolumeGeneratorTest.cpp
+++ b/Modules/IGT/Testing/mitkTrackingVolumeGeneratorTest.cpp
@@ -1,142 +1,142 @@
/*====================================================================
Copyright (c) German Cancer Research Center, Division of Medical and
Biological Informatics. All rights reserved.
See MITKCopyright.txt or http://www.mitk.org/copyright.html for details.
This software is distributed WITHOUT ANY WARRANTY; without even
the implied warranty of MERCHANTABILITY or FITNESS FOR A PARTICULAR
PURPOSE. See the above copyright notices for more information.
=========================================================================*/
#include <mitkTrackingVolumeGenerator.h>
#include <mitkClaronTrackingDevice.h>
#include "mitkCommon.h"
#include "mitkTestingMacros.h"
#include "vtkPolyData.h"
#include <iostream>
#include <mitkSurface.h>
class mitkTrackingVolumeGeneratorTestClass
{
public:
static void TestInstantiation()
{
// let's create an object of our class
mitk::TrackingVolumeGenerator::Pointer myTVGenerator = mitk::TrackingVolumeGenerator::New();
MITK_TEST_CONDITION_REQUIRED(myTVGenerator.IsNotNull(),"Testing instantiation");
}
static void TestTrackingSystemNotSpecified()
{
MITK_TEST_OUTPUT(<<"---- Testing Trackingsystem not specified ----");
mitk::TrackingVolumeGenerator::Pointer myTVGenerator = mitk::TrackingVolumeGenerator::New();
MITK_TEST_CONDITION((myTVGenerator->GetTrackingDeviceType() == mitk::TrackingSystemNotSpecified), "Tracking System not specified:");
myTVGenerator->Update();
mitk::Surface::Pointer volume = myTVGenerator->GetOutput();
- MITK_TEST_CONDITION((volume->IsEmpty(0) == false),"Output contains data");
+ MITK_TEST_CONDITION((volume->IsEmptyTimeStep(0) == false),"Output contains data");
}
static void TestClaronTrackingVolume()
{
MITK_TEST_OUTPUT(<< "---- Testing MicronTracker 2 Tracking Volume ----");
mitk::TrackingVolumeGenerator::Pointer myTVGenerator = mitk::TrackingVolumeGenerator::New ();
myTVGenerator->SetTrackingDeviceType(mitk::ClaronMicron);
MITK_TEST_CONDITION((myTVGenerator->GetTrackingDeviceType() == mitk::ClaronMicron),"loading MicronTracker Volume data:");
myTVGenerator->Update();
mitk::Surface::Pointer volume = myTVGenerator->GetOutput();
- MITK_TEST_CONDITION((volume->IsEmpty(0) == false),"Output contains data");
+ MITK_TEST_CONDITION((volume->IsEmptyTimeStep(0) == false),"Output contains data");
}
static void TestNDIAuroraTrackingVolume()
{
MITK_TEST_OUTPUT(<< "---- Testing NDI Aurora Tracking Volume ----");
mitk::TrackingVolumeGenerator::Pointer myTVGenerator = mitk::TrackingVolumeGenerator::New ();
myTVGenerator->SetTrackingDeviceType(mitk::NDIAurora);
MITK_TEST_CONDITION((myTVGenerator->GetTrackingDeviceType() == mitk::NDIAurora),"loading Aurora Volume data:");
myTVGenerator->Update();
mitk::Surface::Pointer volume = myTVGenerator->GetOutput();
- MITK_TEST_CONDITION((volume->IsEmpty(0) == false),"Output contains data");
+ MITK_TEST_CONDITION((volume->IsEmptyTimeStep(0) == false),"Output contains data");
}
static void TestNDIPolarisTrackingVolume()
{
MITK_TEST_OUTPUT(<< "---- Testing NDI Polaris Tracking Volume ----");
mitk::TrackingVolumeGenerator::Pointer myTVGenerator = mitk::TrackingVolumeGenerator::New ();
myTVGenerator->SetTrackingDeviceType(mitk::NDIPolaris);
MITK_TEST_CONDITION((myTVGenerator->GetTrackingDeviceType() == mitk::NDIPolaris),"loading Polaris Volume data:");
myTVGenerator->Update();
mitk::Surface::Pointer volume = myTVGenerator->GetOutput();
- MITK_TEST_CONDITION((volume->IsEmpty(0) == false),"Output contains data");
+ MITK_TEST_CONDITION((volume->IsEmptyTimeStep(0) == false),"Output contains data");
}
static void TestIntuitiveDaVinciTrackingVolume()
{
MITK_TEST_OUTPUT(<< "---- Testing Intuitive Da Vinci Tracking Volume ----");
mitk::TrackingVolumeGenerator::Pointer myTVGenerator = mitk::TrackingVolumeGenerator::New ();
myTVGenerator->SetTrackingDeviceType(mitk::IntuitiveDaVinci);
MITK_TEST_CONDITION((myTVGenerator->GetTrackingDeviceType() == mitk::IntuitiveDaVinci),"loading Da Vinci Volume data:");
myTVGenerator->Update();
mitk::Surface::Pointer volume = myTVGenerator->GetOutput();
- MITK_TEST_CONDITION((volume->IsEmpty(0) == false),"Output contains data");
+ MITK_TEST_CONDITION((volume->IsEmptyTimeStep(0) == false),"Output contains data");
}
static void TestInvalidInputBehaviour()
{
MITK_TEST_OUTPUT(<< "---- Testing Invalid Inputs (errors should occure) ----");
mitk::TrackingVolumeGenerator::Pointer myTVGenerator = mitk::TrackingVolumeGenerator::New ();
myTVGenerator->SetTrackingDeviceType(mitk::TrackingSystemInvalid); //MicroBird not implemented yet, so using as test dummy
MITK_TEST_CONDITION((myTVGenerator->GetTrackingDeviceType() == mitk::TrackingSystemInvalid),"testing device type");
myTVGenerator->Update();
MITK_TEST_CONDITION(myTVGenerator->GetOutput()->GetVtkPolyData()->GetNumberOfVerts()==0,"testing (invalid) output");
}
static void TestSetTrackingDevice()
{
MITK_TEST_OUTPUT(<< "---- Testing method SetTrackingDevice() ----");
mitk::ClaronTrackingDevice::Pointer testTrackingDevice = mitk::ClaronTrackingDevice::New();
mitk::TrackingVolumeGenerator::Pointer myTVGenerator = mitk::TrackingVolumeGenerator::New ();
myTVGenerator->SetTrackingDevice(dynamic_cast<mitk::TrackingDevice*>(testTrackingDevice.GetPointer()));
MITK_TEST_CONDITION((myTVGenerator->GetTrackingDeviceType() == mitk::ClaronMicron),"testing SetTrackingDevice()");
}
/* The isInside() method is not implemented so far. So please activate is as soon as this is done. Then we could load
* the different Trackingvolumens (Polaris, MicronTracker, etc) and test different points inside and outside in this method.
static void TestIsInside()
{
MITK_TEST_OUTPUT(<< "---- Testing IsInside-Method ----")
mitk::TrackingVolume::Pointer myTrackingVolume = mitk::TrackingVolume::New();
mitk::Point3D p1;
mitk::FillVector3D(p1,(float)0,(float)0,(float)0);
MITK_TEST_CONDITION(myTrackingVolume->IsInside(p1)==false,"... successfull")
}
*/
};
/** This function is testing the TrackingVolume class. */
int mitkTrackingVolumeGeneratorTest(int /* argc */, char* /*argv*/[])
{
MITK_TEST_BEGIN("TrackingVolumeGenerator");
mitkTrackingVolumeGeneratorTestClass::TestInstantiation();
mitkTrackingVolumeGeneratorTestClass::TestTrackingSystemNotSpecified ();
mitkTrackingVolumeGeneratorTestClass::TestClaronTrackingVolume();
mitkTrackingVolumeGeneratorTestClass::TestNDIAuroraTrackingVolume();
mitkTrackingVolumeGeneratorTestClass::TestNDIPolarisTrackingVolume();
mitkTrackingVolumeGeneratorTestClass::TestIntuitiveDaVinciTrackingVolume();
mitkTrackingVolumeGeneratorTestClass::TestInvalidInputBehaviour();
mitkTrackingVolumeGeneratorTestClass::TestSetTrackingDevice();
//mitkTrackingVolumeTestClass::TestIsInside(); Activate this code when method isInside() is implemented!
MITK_TEST_END() ;
}
diff --git a/Modules/IGT/Testing/mitkVirtualTrackingDeviceTest.cpp b/Modules/IGT/Testing/mitkVirtualTrackingDeviceTest.cpp
index f88fa2d8ac..188e6f348f 100644
--- a/Modules/IGT/Testing/mitkVirtualTrackingDeviceTest.cpp
+++ b/Modules/IGT/Testing/mitkVirtualTrackingDeviceTest.cpp
@@ -1,125 +1,130 @@
/*=========================================================================
Program: Medical Imaging & Interaction Toolkit
Language: C++
Date: $Date: 2010-02-21 19:30:44 +0100 (So, 21 Feb 2010) $
Version: $Revision: 7837 $
Copyright (c) German Cancer Research Center, Division of Medical and
Biological Informatics. All rights reserved.
See MITKCopyright.txt or http://www.mitk.org/copyright.html for details.
This software is distributed WITHOUT ANY WARRANTY; without even
the implied warranty of MERCHANTABILITY or FITNESS FOR A PARTICULAR
PURPOSE. See the above copyright notices for more information.
=========================================================================*/
#include "mitkVirtualTrackingDevice.h"
#include "itksys/SystemTools.hxx"
#include "mitkTestingMacros.h"
#include "mitkTrackingTool.h"
#include <iomanip>
int mitkVirtualTrackingDeviceTest(int /* argc */, char* /*argv*/[])
{
// always start with this!
MITK_TEST_BEGIN("VirtualTrackingDevice");
// let's create an object of our class
mitk::VirtualTrackingDevice::Pointer tracker = mitk::VirtualTrackingDevice::New();
// first test: did this work?
// using MITK_TEST_CONDITION_REQUIRED makes the test stop after failure, since
// it makes no sense to continue without an object.
MITK_TEST_CONDITION_REQUIRED(tracker.IsNotNull(),"Testing instantiation\n");
MITK_TEST_CONDITION_REQUIRED(tracker->GetState() == mitk::TrackingDevice::Setup ,"Checking tracking device state == setup.\n");
//CloseConnection
MITK_TEST_CONDITION( (tracker->CloseConnection()), "Testing behavior of method CloseConnection().");
//StartTracking
MITK_TEST_CONDITION( tracker->StartTracking() == false, "Testing behavior of method StartTracking().");
tracker->SetRefreshRate(43);
MITK_TEST_CONDITION( tracker->GetRefreshRate() == 43, "Testing Set-/GetRefreshRate()");
MITK_TEST_CONDITION( tracker->GetToolCount() == 0, "Testing GetToolCount() before AddTool()");
MITK_TEST_CONDITION( tracker->AddTool("Tool0"), "Testing AddTool() for tool 0.");
MITK_TEST_CONDITION( tracker->GetToolCount() == 1, "Testing GetToolCount() after AddTool()");
mitk::TrackingTool::Pointer tool = tracker->GetTool(0);
MITK_TEST_CONDITION_REQUIRED( tool.IsNotNull(), "Testing GetTool() for tool 0.");
MITK_TEST_CONDITION( tracker->GetToolByName("Tool0") == tool.GetPointer(), "Testing GetTool() equals GetToolByName() for tool 0.");
mitk::ScalarType bounds[6] = {0.0, 10.0, 1.0, 20.0, 3.0, 30.0};
tracker->SetBounds(bounds);
MITK_TEST_CONDITION( tracker->GetBounds()[0] == bounds[0]
&& tracker->GetBounds()[1] == bounds[1]
&& tracker->GetBounds()[2] == bounds[2]
&& tracker->GetBounds()[3] == bounds[3]
&& tracker->GetBounds()[4] == bounds[4]
&& tracker->GetBounds()[5] == bounds[5]
, "Testing Set-/GetBounds()");
MITK_TEST_CONDITION( tracker->AddTool("Tool1"), "Testing AddTool() for tool 1.");
MITK_TEST_CONDITION( tracker->GetToolCount() == 2, "Testing GetToolCount() after AddTool()");
tracker->SetToolSpeed(0, 0.1); // no exception expected
tracker->SetToolSpeed(1, 0.1); // no exception expected
MITK_TEST_FOR_EXCEPTION(std::invalid_argument, tracker->SetToolSpeed(2, 0.1)); // exception expected
mitk::ScalarType lengthBefore = tracker->GetSplineChordLength(0); // no exception expected
MITK_TEST_FOR_EXCEPTION(std::invalid_argument, tracker->GetSplineChordLength(2)); // exception expected
MITK_TEST_CONDITION( tracker->OpenConnection() == true, "Testing OpenConnection().");
MITK_TEST_CONDITION( tracker->GetSplineChordLength(0) == lengthBefore, "Testing GetSplineChordLength() after initalization");
//StartTracking
mitk::Point3D posBefore0;
tool->GetPosition(posBefore0);
mitk::Point3D posBefore1;
tracker->GetToolByName("Tool1")->GetPosition(posBefore1);
mitk::Point3D posAfter0;
tool->GetPosition(posAfter0);
MITK_TEST_CONDITION( mitk::Equal(posBefore0, posAfter0) == true, "Testing if position value is constant before StartTracking()");
MITK_TEST_CONDITION( tracker->StartTracking() == true, "Testing behavior of method StartTracking().");
itksys::SystemTools::Delay(500); // wait for tracking thread to start generating positions
tool->GetPosition(posAfter0);
MITK_TEST_CONDITION( mitk::Equal(posBefore0, posAfter0) == false, "Testing if tracking is producing new position values in tool 0.");
mitk::Point3D posAfter1;
tracker->GetToolByName("Tool1")->GetPosition(posAfter1);
MITK_TEST_CONDITION( mitk::Equal(posBefore1, posAfter1) == false, "Testing if tracking is producing new position values in tool 1.");
// add tool while tracking is in progress
tracker->AddTool("while Running");
itksys::SystemTools::Delay(100); // wait for tracking thread to start generating positions
tracker->GetToolByName("while Running")->GetPosition(posBefore0);
unsigned long tmpMTime = tracker->GetToolByName("while Running")->GetMTime();
itksys::SystemTools::Delay(100); // wait for tracking thread to start generating positions
tracker->GetToolByName("while Running")->GetPosition(posAfter0);
+ MITK_INFO << "If this test fails, please reopen bug 8033 and commit this output: ";
+ MITK_INFO << std::setprecision(16) << "Value of posBefore0 " << posBefore0;
+ MITK_INFO << std::setprecision(16) << "Value of posAfter0 " << posAfter0;
+ MITK_INFO << std::setprecision(16) << "tmpTime " << tmpMTime;
+ MITK_INFO << std::setprecision(16) << "current time " << tracker->GetToolByName("while Running")->GetMTime();
if(tracker->GetToolByName("while Running")->GetMTime() == tmpMTime) //tool not modified yet
{
//hence the tool was not modified, the position has to be equal
- MITK_TEST_CONDITION( mitk::Equal(posBefore0, posAfter0) == true, "Testing if the position values for the 'while running' tool remain the same.");
+ MITK_TEST_CONDITION( mitk::Equal(posBefore0, posAfter0) == true, "Testing if the position values for the 'while running' tool remain the same.");
}
- else //tool was modified => position should be changed
+ else //tool was modified => position should have changed
{
- MITK_TEST_CONDITION( mitk::Equal(posBefore0, posAfter0) == false, "Testing if tracking is producing new position values for 'while running' tool.");
+ MITK_TEST_CONDITION( mitk::Equal(posBefore0, posAfter0) == false, "Testing if tracking is producing new position values for 'while running' tool.");
}
// always end with this!
MITK_TEST_END();
}
diff --git a/Modules/IGTUI/Qmitk/QmitkNDIConfigurationWidget.cpp b/Modules/IGTUI/Qmitk/QmitkNDIConfigurationWidget.cpp
index a934520df1..870a077602 100644
--- a/Modules/IGTUI/Qmitk/QmitkNDIConfigurationWidget.cpp
+++ b/Modules/IGTUI/Qmitk/QmitkNDIConfigurationWidget.cpp
@@ -1,651 +1,653 @@
/*=========================================================================
Program: Medical Imaging & Interaction Toolkit
Language: C++
Date: $Date: 2009-03-21 19:27:37 +0100 (Sa, 21 Mrz 2009) $
Version: $Revision: 16719 $
Copyright (c) German Cancer Research Center, Division of Medical and
Biological Informatics. All rights reserved.
See MITKCopyright.txt or http://www.mitk.org/copyright.html for details.
This software is distributed WITHOUT ANY WARRANTY; without even
the implied warranty of MERCHANTABILITY or FITNESS FOR A PARTICULAR
PURPOSE. See the above copyright notices for more information.
=========================================================================*/
#include "QmitkNDIConfigurationWidget.h"
#include <QTableWidget>
#include <QMessageBox>
#include <QFileDialog>
#include <QInputDialog>
#include <QDir>
#include <QFileInfo>
#include "QmitkCustomVariants.h"
//#include <QtConcurrentMap>
#include "QmitkNDIToolDelegate.h"
/* VIEW MANAGEMENT */
QmitkNDIConfigurationWidget::QmitkNDIConfigurationWidget(QWidget* parent)
: QWidget(parent), m_Controls(NULL), m_Tracker(NULL), m_Source(NULL),
m_Delegate(NULL)
{
this->CreateQtPartControl(this);
}
QmitkNDIConfigurationWidget::~QmitkNDIConfigurationWidget()
{
m_Controls = NULL;
m_Tracker = NULL;
m_Source = NULL;
}
void QmitkNDIConfigurationWidget::CreateQtPartControl(QWidget *parent)
{
if (!m_Controls)
{
// create GUI widgets
m_Controls = new Ui::QmitkNDIConfigurationWidget;
m_Controls->setupUi(parent);
QStringList comPorts;
#ifdef WIN32
comPorts << "COM1" << "COM2" << "COM3" << "COM4" << "COM5" << "COM6" << "COM7" << "COM8" << "COM9";
#else
comPorts << "/dev/ttyS1" << "/dev/ttyS2" << "/dev/ttyS3" << "/dev/ttyS4" << "/dev/ttyS5" << "/dev/ttyUSB0" << "/dev/ttyUSB1" << "/dev/ttyUSB2" << "/dev/ttyUSB3";
#endif
m_Controls->m_ComPortSelector->addItems(comPorts);
m_Delegate = new QmitkNDIToolDelegate(m_Controls->m_ToolTable);
m_Delegate->SetDataStorage(NULL); //needs to be set later using the setter methods
m_Delegate->SetPredicate(NULL);
m_Delegate->SetTypes(QStringList());
m_Controls->m_ToolTable->setItemDelegate(m_Delegate);
this->CreateConnections();
this->HidePolarisOptionsGroupbox(true);
this->HideAuroraOptionsGroupbox(true);
}
}
void QmitkNDIConfigurationWidget::CreateConnections()
{
connect(m_Controls->m_Connect, SIGNAL(clicked()), this, SLOT(OnConnect()));
connect(m_Controls->m_DiscoverToolsBtn, SIGNAL(clicked()), this, SLOT(OnDiscoverTools()));
connect(m_Controls->m_AddToolBtn, SIGNAL(clicked()), this, SLOT(OnAddPassiveTool()));
connect(m_Controls->m_DisoverDevicesBtn, SIGNAL(clicked()), this, SLOT(OnDiscoverDevices()));
connect(m_Controls->m_ToolTable->model(), SIGNAL(dataChanged(const QModelIndex &, const QModelIndex &)), this, SLOT(UpdateTrackerFromToolTable(const QModelIndex &, const QModelIndex &)));
connect(m_Controls->m_DisoverDevicesBtnInfo, SIGNAL(clicked()), this, SLOT(OnDisoverDevicesBtnInfo()));
}
void QmitkNDIConfigurationWidget::OnConnect()
{
if (m_Tracker.IsNotNull())
{
m_Tracker->CloseConnection();
m_Tracker = NULL;
}
this->CreateTracker();
this->SetupTracker();
bool okay = m_Tracker->OpenConnection();
if (okay)
{
// show/hide options according to connected device
if(m_Tracker->GetType() == mitk::NDIPolaris)
{
this->HideAuroraOptionsGroupbox(true);
this->HidePolarisOptionsGroupbox(false);
}
else if(m_Tracker->GetType() == mitk::NDIAurora)
{
this->HidePolarisOptionsGroupbox(true);
this->HideAuroraOptionsGroupbox(false);
}
this->UpdateWidgets();
this->UpdateToolTable();
emit ToolsAdded(this->GetToolNamesList());
emit Connected();
}
else
{
QMessageBox::warning(NULL, "Error", QString("Connection failed. Tracking device error message is '%1'").arg(m_Tracker->GetErrorMessage()));
m_Tracker->CloseConnection();
this->m_Tracker = NULL;
}
}
void QmitkNDIConfigurationWidget::OnDisconnect()
{
if (m_Tracker.IsNull())
return;
m_Tracker->CloseConnection();
m_Tracker = NULL;
this->UpdateToolTable();
this->UpdateWidgets();
emit ToolsAdded(this->GetToolNamesList());
emit Disconnected();
this->HidePolarisOptionsGroupbox(true);
this->HideAuroraOptionsGroupbox(true);
}
void QmitkNDIConfigurationWidget::UpdateWidgets()
{
m_Controls->m_DeviceStatus->setText(this->GetStatusText());
if (m_Tracker.IsNull()) // not connected to tracker
{
m_Controls->m_Connect->setText("Connect");
m_Controls->m_lConnection->setText("III. Enable connection to device ");
disconnect(m_Controls->m_Connect, SIGNAL(clicked()), this, SLOT(OnDisconnect()));
connect(m_Controls->m_Connect, SIGNAL(clicked()), this, SLOT(OnConnect()));
m_Controls->m_DiscoverToolsBtn->setDisabled(true);
m_Controls->m_AddToolBtn->setDisabled(true);
return;
}
if (m_Tracker->GetState() == mitk::TrackingDevice::Setup)
{
m_Controls->m_Connect->setText("Connect");
m_Controls->m_lConnection->setText("III. Enable connection to device ");
disconnect(m_Controls->m_Connect, SIGNAL(clicked()), this, SLOT(OnDisconnect()));
connect(m_Controls->m_Connect, SIGNAL(clicked()), this, SLOT(OnConnect()));
m_Controls->m_DiscoverToolsBtn->setDisabled(true);
m_Controls->m_AddToolBtn->setDisabled(true);
return;
}
if ((m_Tracker->GetState() == mitk::TrackingDevice::Ready) || (m_Tracker->GetState() == mitk::TrackingDevice::Tracking))
{
m_Controls->m_Connect->setText("Disconnect");
m_Controls->m_lConnection->setText("III. Disable connection to device ");
disconnect(m_Controls->m_Connect, SIGNAL(clicked()), this, SLOT(OnConnect()));
connect(m_Controls->m_Connect, SIGNAL(clicked()), this, SLOT(OnDisconnect()));
m_Controls->m_DiscoverToolsBtn->setEnabled(true);
m_Controls->m_AddToolBtn->setEnabled(true);
}
}
QString QmitkNDIConfigurationWidget::GetStatusText()
{
if (m_Tracker.IsNull())
return QString("Not connected");
QString devName;
switch (m_Tracker->GetType())
{
case mitk::NDIAurora:
devName = "NDI Aurora";
break;
case mitk::NDIPolaris:
devName = "NDI Polaris";
break;
case mitk::TrackingSystemNotSpecified:
default:
devName = "unknown tracking device";
break;
}
if (m_Tracker->GetState() == mitk::TrackingDevice::Ready)
return QString("Connected to %1 on %2. Device is ready.").arg(devName).arg(m_Tracker->GetDeviceName());
if (m_Tracker->GetState() == mitk::TrackingDevice::Tracking)
return QString("%1 is tracking.").arg(devName);
return QString("");
}
void QmitkNDIConfigurationWidget::OnDiscoverTools()
{
if (m_Tracker.IsNull())
{
QMessageBox::warning(NULL, "Error", QString("Connection failed. No tracking device found."));
return;
}
m_Tracker->DiscoverWiredTools();
this->UpdateToolTable();
emit ToolsAdded(this->GetToolNamesList());
}
void QmitkNDIConfigurationWidget::OnAddPassiveTool()
{
if (m_Tracker.IsNull())
this->CreateTracker();
QStringList filenames = QFileDialog::getOpenFileNames(this, "Select NDI SROM file", QDir::currentPath(),"NDI SROM files (*.rom)");
if (filenames.isEmpty())
{
this->m_Tracker = NULL;
return;
}
foreach(QString fileName, filenames)
{
//QString toolName = QInputDialog::getText(this, "Enter a name for the tool", "Name of the tool: ", QLineEdit::Normal, QFileInfo(filename).baseName(), &ok);
//if (ok == false || toolName.isEmpty())
// return;
m_Tracker->AddTool(QFileInfo(fileName).baseName().toLatin1(), fileName.toLatin1());
}
emit ToolsAdded(this->GetToolNamesList());
this->UpdateToolTable();
}
void QmitkNDIConfigurationWidget::CreateTracker()
{
m_Tracker = mitk::NDITrackingDevice::New();
}
void QmitkNDIConfigurationWidget::SetupTracker()
{
if (m_Tracker.IsNull())
return;
m_Tracker->SetDeviceName(this->GetDeviceName());
m_Tracker->SetBaudRate(mitk::SerialCommunication::BaudRate115200);
}
std::string QmitkNDIConfigurationWidget::GetDeviceName() const
{
if (m_Controls == NULL)
return NULL;
QString deviceName = m_Controls->m_ComPortSelector->currentText();
+#if WIN32
deviceName.prepend("\\\\.\\"); // always prepend "\\.\ to all COM ports, to be able to connect to ports > 9"
+#endif
return deviceName.toStdString();
}
void QmitkNDIConfigurationWidget::SetDeviceName( const char* dev )
{
if (m_Controls == NULL)
return;
m_Controls->m_ComPortSelector->setCurrentIndex(m_Controls->m_ComPortSelector->findText(dev));
}
void QmitkNDIConfigurationWidget::UpdateToolTable()
{
disconnect(m_Controls->m_ToolTable, SIGNAL(itemChanged(QTableWidgetItem*)), this, SLOT(OnTableItemChanged(QTableWidgetItem*))); // stop listening to table changes
disconnect(m_Controls->m_ToolTable->model(), SIGNAL(dataChanged(const QModelIndex &, const QModelIndex &)), this, SLOT(UpdateTrackerFromToolTable(const QModelIndex &, const QModelIndex &)));
m_Controls->m_ToolTable->clearContents();
m_Controls->m_ToolTable->setRowCount(0);
if (m_Tracker.IsNull() || (m_Controls == NULL))
return;
m_Controls->m_ToolTable->setRowCount(m_Tracker->GetToolCount());
for (unsigned int i = 0; i < m_Tracker->GetToolCount(); ++i)
{
mitk::TrackingTool* t = m_Tracker->GetTool(i);
if (t == NULL)
{
m_Controls->m_ToolTable->setItem(i, QmitkNDIToolDelegate::IndexCol, new QTableWidgetItem("INVALID")); // Index
continue;
}
m_Controls->m_ToolTable->setItem(i, QmitkNDIToolDelegate::IndexCol, new QTableWidgetItem(QString::number(i))); // Index
m_Controls->m_ToolTable->setItem(i, QmitkNDIToolDelegate::NameCol, new QTableWidgetItem(t->GetToolName())); // Name
if (dynamic_cast<mitk::NDIPassiveTool*>(t)->GetSROMDataLength() > 0)
m_Controls->m_ToolTable->setItem(i, QmitkNDIToolDelegate::SROMCol, new QTableWidgetItem("SROM file loaded")); // SROM file
else
m_Controls->m_ToolTable->setItem(i, QmitkNDIToolDelegate::SROMCol, new QTableWidgetItem("<click to load SROM file>")); // SROM file
m_Controls->m_ToolTable->setItem(i, QmitkNDIToolDelegate::TypeCol, new QTableWidgetItem("<click to set type>")); // Type
if (t->IsEnabled())
m_Controls->m_ToolTable->setItem(i, QmitkNDIToolDelegate::StatusCol, new QTableWidgetItem("Enabled")); // Status
else
m_Controls->m_ToolTable->setItem(i, QmitkNDIToolDelegate::StatusCol, new QTableWidgetItem("Disabled")); // Status
m_Controls->m_ToolTable->setItem(i, QmitkNDIToolDelegate::NodeCol, new QTableWidgetItem("<click to select node>")); // Node
/* set read-only/editable flags */
m_Controls->m_ToolTable->item(i, QmitkNDIToolDelegate::IndexCol)->setFlags(Qt::ItemIsEnabled | Qt::ItemIsSelectable | Qt::ItemIsDragEnabled); // Index
m_Controls->m_ToolTable->item(i, QmitkNDIToolDelegate::NodeCol)->setFlags(Qt::ItemIsEnabled | Qt::ItemIsEditable | Qt::ItemIsSelectable | Qt::ItemIsDragEnabled); // Name
m_Controls->m_ToolTable->item(i, QmitkNDIToolDelegate::SROMCol)->setFlags(Qt::ItemIsEnabled | Qt::ItemIsEditable | Qt::ItemIsSelectable | Qt::ItemIsDragEnabled); // SROM file
m_Controls->m_ToolTable->item(i, QmitkNDIToolDelegate::TypeCol)->setFlags(Qt::ItemIsEnabled | Qt::ItemIsEditable | Qt::ItemIsSelectable | Qt::ItemIsDragEnabled); // Type
m_Controls->m_ToolTable->item(i, QmitkNDIToolDelegate::StatusCol)->setFlags(Qt::ItemIsEnabled | Qt::ItemIsSelectable | Qt::ItemIsDragEnabled); // Status
m_Controls->m_ToolTable->item(i, QmitkNDIToolDelegate::NodeCol)->setFlags(Qt::ItemIsEnabled | Qt::ItemIsEditable | Qt::ItemIsSelectable | Qt::ItemIsDragEnabled); // Node
}
m_Controls->m_ToolTable->resizeColumnsToContents();
connect(m_Controls->m_ToolTable, SIGNAL(itemChanged(QTableWidgetItem*)), this, SLOT(OnTableItemChanged(QTableWidgetItem*))); // listen to table changes again
connect(m_Controls->m_ToolTable->model(), SIGNAL(dataChanged(const QModelIndex &, const QModelIndex &)), this, SLOT(UpdateTrackerFromToolTable(const QModelIndex &, const QModelIndex &)));
}
void QmitkNDIConfigurationWidget::OnDiscoverDevices()
{
PortDeviceMap portsAndDevices;
QString status = "Scanning ";
#ifdef WIN32
QString devName;
for (unsigned int i = 1; i < 20; ++i)
{
if (i<10)
devName = QString("COM%1").arg(i);
else
devName = QString("\\\\.\\COM%1").arg(i); // prepend "\\.\ to COM ports >9, to be able to allow connection"
portsAndDevices[devName];
status += QString("COM%1").arg(i) + ", ";
}
#else //linux/posix systems
for(unsigned int i = 1; i < 6; ++i)
{
QString devName = QString("/dev/ttyS%1").arg(i);
portsAndDevices[devName];
status += devName + ", ";
}
for(unsigned int i = 0; i <7; ++i)
{
QString devName = QString("/dev/ttyUSB%1").arg(i);
portsAndDevices[devName];
status += devName + ", ";
}
#endif
status.chop(2); // remove last ", "
status += " for NDI tracking devices...";
m_Controls->m_DeviceStatus->setText(status);
ScanPortsForNDITrackingDevices(portsAndDevices);
m_Controls->m_ComPortSelector->clear();
QString result = "The following tracking devices were found:<BR/>\n";
for (PortDeviceMap::const_iterator it = portsAndDevices.begin(); it != portsAndDevices.end(); ++it)
{
QString tmpComPort = it.key();
if (tmpComPort.startsWith("\\"))
{
tmpComPort.remove(0,4); // remove "\\.\" for nice ui visualisation
}
result += tmpComPort + ": ";
switch (it.value())
{
case mitk::NDIPolaris:
result += "NDI Polaris<BR/>\n";
m_Controls->m_ComPortSelector->addItem(tmpComPort);
break;
case mitk::NDIAurora:
result += "NDI Aurora<BR/>\n";
m_Controls->m_ComPortSelector->addItem(tmpComPort);
break;
default:
result += "No NDI tracking device found<BR/>\n";
}
}
//QMessageBox::information(NULL, "Tracking Device Discovery", result);
m_Controls->m_DeviceStatus->setText(result);
}
mitk::TrackingDeviceType QmitkNDIConfigurationWidget::ScanPort(QString port)
{
mitk::NDITrackingDevice::Pointer tracker = mitk::NDITrackingDevice::New();
tracker->SetDeviceName(port.toStdString());
return tracker->TestConnection();
}
void QmitkNDIConfigurationWidget::ScanPortsForNDITrackingDevices( PortDeviceMap& portsAndDevices )
{
// Iterative scanning:
for (PortDeviceMap::iterator it = portsAndDevices.begin(); it != portsAndDevices.end(); ++it)
it.value() = this->ScanPort(it.key());
// \Todo: use parallel scanning
//QtConcurrent::blockingMap( portsAndDevices.begin(), portsAndDevices.end(), ScanPort );
//MITK_INFO << portsAndDevices;
}
QStringList QmitkNDIConfigurationWidget::GetToolNamesList()
{
QStringList toolNames;
if (m_Tracker.IsNull())
return toolNames;
for (unsigned int i = 0; i < m_Tracker->GetToolCount(); ++i)
{
mitk::TrackingTool* t = m_Tracker->GetTool(i);
if (t == NULL)
continue;
toolNames << t->GetToolName();
}
return toolNames;
}
mitk::NDITrackingDevice* QmitkNDIConfigurationWidget::GetTracker() const
{
return m_Tracker.GetPointer();
}
void QmitkNDIConfigurationWidget::SetToolTypes(const QStringList& types)
{
m_Delegate->SetTypes(types);
}
void QmitkNDIConfigurationWidget::SetDataStorage(mitk::DataStorage* ds)
{
m_Delegate->SetDataStorage(ds);
}
void QmitkNDIConfigurationWidget::SetPredicate(mitk::NodePredicateBase::Pointer p)
{
m_Delegate->SetPredicate(p);
}
void QmitkNDIConfigurationWidget::SetTagPropertyName( const std::string& name )
{
m_Delegate->SetTagPropertyName(name);
}
void QmitkNDIConfigurationWidget::SetTagProperty( mitk::BaseProperty::Pointer prop )
{
m_Delegate->SetTagProperty(prop);
}
void QmitkNDIConfigurationWidget::OnTableItemClicked(const QModelIndex & topLeft )
{
QString filename;
QTableWidgetItem* filenameItem;
switch (topLeft.column())
{
case QmitkNDIToolDelegate::RepCol:
filename = QFileDialog::getOpenFileName(this, "Select Surface File", QDir::currentPath(),"STL files (*.stl)");
filenameItem = new QTableWidgetItem(filename);
m_Controls->m_ToolTable->setItem( topLeft.row(), topLeft.column(), filenameItem );
if(QFileInfo(filename).exists())
emit RepresentationChanged( topLeft.row(), filename.toStdString() );
break;
default:
break;
}
}
void QmitkNDIConfigurationWidget::UpdateTrackerFromToolTable(const QModelIndex & topLeft, const QModelIndex & /*bottomRight*/)
{
//Colums ID doesn't have to be processed.
if (topLeft.column()<1)
return;
if (m_Tracker.IsNull())
return;
if (topLeft.row() >= (int) m_Tracker->GetToolCount())
return;
QAbstractItemModel* model = m_Controls->m_ToolTable->model();
//define topleft contains row and column; row 0 is tool 0; column is index =0, Name =1, SROMFileName = 2; Type = 3; Status = 4; Node (?) = 5
//only update the changed item
mitk::NDIPassiveTool* tool = dynamic_cast<mitk::NDIPassiveTool*> (m_Tracker->GetTool(topLeft.row()));
if (tool == NULL)
return;
switch (topLeft.column())
{
case 0: //index
break;
case 1: //name
tool->SetToolName(model->data(model->index(topLeft.row(), 1)).toString().toLatin1());
emit ToolsChanged();
break;
case QmitkNDIToolDelegate::SROMCol: //SROM File Name
{
QString romfile = model->data(model->index(topLeft.row(), QmitkNDIToolDelegate::SROMCol)).toString();
if (QFileInfo(romfile).exists())
tool->LoadSROMFile(romfile.toLatin1());
m_Tracker->UpdateTool(tool);
break;
}
//TODO: Add Node Status and Type here as well
default:
break;
}
}
const QString QmitkNDIConfigurationWidget::GetToolType( unsigned int index ) const
{
if (m_Controls == NULL)
return QString("");
QAbstractItemModel* model = m_Controls->m_ToolTable->model();
QModelIndex modelIndex = model->index(index, QmitkNDIToolDelegate::TypeCol);
if (modelIndex.isValid() == false)
return QString("");
return model->data(modelIndex).toString();
}
const QString QmitkNDIConfigurationWidget::GetToolName( unsigned int index ) const
{
if (m_Controls == NULL)
return QString("");
QAbstractItemModel* model = m_Controls->m_ToolTable->model();
QModelIndex modelIndex = model->index(index, QmitkNDIToolDelegate::NameCol);
if (modelIndex.isValid() == false)
return QString("");
return model->data(modelIndex).toString();
}
QMap<QString, unsigned int> QmitkNDIConfigurationWidget::GetToolAndTypes() const
{
QMap<QString, unsigned int> map;
if (m_Controls == NULL)
return map;
QAbstractItemModel* model = m_Controls->m_ToolTable->model();
for (int i = 0; i < model->rowCount(); ++i)
{
QModelIndex indexIndex = model->index(i, QmitkNDIToolDelegate::IndexCol);
QModelIndex typeIndex = model->index(i, QmitkNDIToolDelegate::TypeCol);
if ((indexIndex.isValid() == false) || (typeIndex.isValid() == false))
continue;
map.insert(model->data(typeIndex).toString(), model->data(indexIndex).toUInt());
}
return map;
}
QList<unsigned int> QmitkNDIConfigurationWidget::GetToolsByToolType( QString toolType ) const
{
QList<unsigned int> list;
if (m_Controls == NULL)
return list;
QAbstractItemModel* model = m_Controls->m_ToolTable->model();
for (int i = 0; i < model->rowCount(); ++i)
{
QModelIndex indexIndex = model->index(i, QmitkNDIToolDelegate::IndexCol);
QModelIndex typeIndex = model->index(i, QmitkNDIToolDelegate::TypeCol);
if ((indexIndex.isValid() == false) || (typeIndex.isValid() == false))
continue;
if (model->data(typeIndex).toString() == toolType)
list.append(model->data(indexIndex).toUInt());
}
return list;
}
mitk::DataNode* QmitkNDIConfigurationWidget::GetNode( unsigned int index ) const
{
if (m_Controls == NULL)
return NULL;
QAbstractItemModel* model = m_Controls->m_ToolTable->model();
QVariant data = model->data(model->index(index, QmitkNDIToolDelegate::NodeCol), QmitkNDIToolDelegate::OrganNodeRole);
return data.value<mitk::DataNode*>();
}
void QmitkNDIConfigurationWidget::HidePolarisOptionsGroupbox( bool on )
{
m_Controls->m_gbPolarisOptions->setHidden(on);
}
void QmitkNDIConfigurationWidget::HideAuroraOptionsGroupbox( bool on )
{
m_Controls->m_gbAuroraOptions->setHidden(on);
}
void QmitkNDIConfigurationWidget::ShowToolRepresentationColumn()
{
int cols = m_Controls->m_ToolTable->columnCount();
//checking if representation column is inserted at right index
if(cols != QmitkNDIToolDelegate::RepCol)
{
//throw std::exception("Representation Column is not inserted at it's designated index!");
return;
}
m_Controls->m_ToolTable->insertColumn(cols); // insert new column at end of table
m_Controls->m_ToolTable->setHorizontalHeaderItem(QmitkNDIToolDelegate::RepCol, new QTableWidgetItem(QString("Representation"))); // inser column header for new colum
//m_Controls->m_ToolTable->setEditTriggers(QAbstractItemView::EditTrigger::NoEditTriggers);
int rows = m_Controls->m_ToolTable->rowCount();
// make all representation colum items not editable
for(int i=0; i < rows; ++i)
{
m_Controls->m_ToolTable->setItem(i, QmitkNDIToolDelegate::RepCol, new QTableWidgetItem("<click to select representation>")); // Representation
m_Controls->m_ToolTable->item(i,QmitkNDIToolDelegate::RepCol)->setFlags(Qt::NoItemFlags);
}
// connect tool table to click slot
connect(m_Controls->m_ToolTable, SIGNAL( clicked ( const QModelIndex & )), this, SLOT ( OnTableItemClicked( const QModelIndex & )));
}
void QmitkNDIConfigurationWidget::OnDisoverDevicesBtnInfo()
{
QMessageBox *infoBox = new QMessageBox(this);
infoBox->setText("Click \"Scan Ports\" to get a list of all connected NDI tracking devices. This will clear the selection menu below and add the ports for discovered NDI tracking devices. Use this function, if a port is not listed.");
infoBox->exec();
delete infoBox;
}
diff --git a/Modules/IGTUI/Qmitk/QmitkTrackingDeviceConfigurationWidget.cpp b/Modules/IGTUI/Qmitk/QmitkTrackingDeviceConfigurationWidget.cpp
index 9299a40080..ac27ef7387 100644
--- a/Modules/IGTUI/Qmitk/QmitkTrackingDeviceConfigurationWidget.cpp
+++ b/Modules/IGTUI/Qmitk/QmitkTrackingDeviceConfigurationWidget.cpp
@@ -1,343 +1,346 @@
/*=========================================================================
Program: Medical Imaging & Interaction Toolkit
Language: C++
Date: $Date: 2009-05-12 19:14:45 +0200 (Di, 12 Mai 2009) $
Version: $Revision: 1.12 $
Copyright (c) German Cancer Research Center, Division of Medical and
Biological Informatics. All rights reserved.
See MITKCopyright.txt or http://www.mitk.org/copyright.html for details.
This software is distributed WITHOUT ANY WARRANTY; without even
the implied warranty of MERCHANTABILITY or FITNESS FOR A PARTICULAR
PURPOSE. See the above copyright notices for more information.
=========================================================================*/
#include "QmitkTrackingDeviceConfigurationWidget.h"
#include "mitkClaronTrackingDevice.h"
#include "mitkNDITrackingDevice.h"
#include "mitkSerialCommunication.h"
#include "qscrollbar.h"
const std::string QmitkTrackingDeviceConfigurationWidget::VIEW_ID = "org.mitk.views.trackingdeviceconfigurationwidget";
QmitkTrackingDeviceConfigurationWidget::QmitkTrackingDeviceConfigurationWidget(QWidget* parent, Qt::WindowFlags f)
: QWidget(parent, f)
{
m_Controls = NULL;
CreateQtPartControl(this);
CreateConnections();
//reset a few things
ResetOutput();
AddOutput("<br>NDI Polaris selected");
this->m_TrackingDeviceConfigurated = false;
m_AdvancedUserControl = true;
}
void QmitkTrackingDeviceConfigurationWidget::SetGUIStyle(QmitkTrackingDeviceConfigurationWidget::Style style)
{
switch(style)
{
case QmitkTrackingDeviceConfigurationWidget::SIMPLE:
//move all UI elements to an empty dummy layout
//m_Controls->dummyLayout->addItem(m_Controls->mainLayout);
m_Controls->dummyLayout->addWidget(m_Controls->widget_title_label);
m_Controls->dummyLayout->addWidget(m_Controls->choose_tracking_device_label);
m_Controls->dummyLayout->addWidget(m_Controls->polaris_label);
m_Controls->dummyLayout->addWidget( m_Controls->aurora_label);
m_Controls->dummyLayout->addWidget(m_Controls->aurora_label);
m_Controls->dummyLayout->addWidget(m_Controls->microntracker_label);
m_Controls->dummyLayout->addWidget(m_Controls->m_testConnectionMicronTracker);
m_Controls->dummyLayout->addWidget(m_Controls->m_outputTextMicronTracker);
m_Controls->dummyLayout->addWidget(m_Controls->m_outputTextAurora);
m_Controls->dummyLayout->addWidget(m_Controls->m_testConnectionAurora);
m_Controls->dummyLayout->addWidget(m_Controls->m_outputTextPolaris);
m_Controls->dummyLayout->addWidget(m_Controls->m_testConnectionPolaris);
m_Controls->dummyLayout->addWidget(m_Controls->m_polarisTrackingModeBox);
m_Controls->dummyLayout->addWidget(m_Controls->m_finishedLine);
m_Controls->dummyLayout->addWidget(m_Controls->line);
m_Controls->dummyLayout->addWidget(m_Controls->configuration_finished_label);
m_Controls->dummyLayout->addItem(m_Controls->horizontalLayout_4);
m_Controls->mainLayout->removeItem(m_Controls->horizontalLayout_4);
m_Controls->dummyLayout->addWidget(m_Controls->configuration_finished_label);
m_Controls->dummyLayout->addItem(m_Controls->verticalSpacer_2);
m_Controls->verticalLayout_3->removeItem(m_Controls->verticalSpacer_2);
m_Controls->dummyLayout->addItem(m_Controls->horizontalSpacer_9);
m_Controls->horizontalLayout_9->removeItem(m_Controls->horizontalSpacer_9);
m_Controls->dummyLayout->addItem(m_Controls->horizontalSpacer_3);
m_Controls->horizontalLayout_11->removeItem(m_Controls->horizontalSpacer_3);
m_Controls->dummyLayout->addItem(m_Controls->verticalSpacer_3);
m_Controls->verticalLayout_7->removeItem(m_Controls->verticalSpacer_3);
m_Controls->dummyLayout->addItem(m_Controls->verticalSpacer_4);
m_Controls->verticalLayout_10->removeItem(m_Controls->verticalSpacer_4);
m_Controls->dummyLayout->addItem(m_Controls->horizontalSpacer_10);
m_Controls->verticalLayout_10->removeItem(m_Controls->horizontalSpacer_10);
//set height to min
m_Controls->m_outputTextPolaris->setMinimumHeight(0);
m_Controls->m_outputTextPolaris->setMaximumHeight(0);
m_Controls->m_outputTextMicronTracker->setMinimumHeight(0);
m_Controls->m_outputTextMicronTracker->setMaximumHeight(0);
m_Controls->m_outputTextAurora->setMinimumHeight(0);
m_Controls->m_outputTextAurora->setMaximumHeight(0);
m_Controls->m_finishedButton->setMinimumHeight(0);
m_Controls->m_finishedButton->setMaximumHeight(0);
m_Controls->m_resetButton->setMinimumHeight(0);
m_Controls->m_resetButton->setMaximumHeight(0);
//set the height of the tracking device combo box
m_Controls->m_trackingDeviceChooser->setMinimumHeight(50);
//move back the used elemets to the main layout
m_Controls->simpleLayout->addWidget(m_Controls->m_trackingDeviceChooser);
m_Controls->simpleLayout->addWidget(m_Controls->m_TrackingSystemWidget);
m_Controls->mainWidget->setCurrentIndex(1);
this->setMaximumHeight(150);
this->EnableAdvancedUserControl(false);
break;
case QmitkTrackingDeviceConfigurationWidget::ADVANCED:
//default at the moment => start settings are advanced
break;
}
}
QmitkTrackingDeviceConfigurationWidget::~QmitkTrackingDeviceConfigurationWidget()
{
}
void QmitkTrackingDeviceConfigurationWidget::CreateQtPartControl(QWidget *parent)
{
if (!m_Controls)
{
// create GUI widgets
m_Controls = new Ui::QmitkTrackingDeviceConfigurationWidgetControls;
m_Controls->setupUi(parent);
}
}
void QmitkTrackingDeviceConfigurationWidget::CreateConnections()
{
if ( m_Controls )
{
connect( (QObject*)(m_Controls->m_trackingDeviceChooser), SIGNAL(currentIndexChanged(int)), this, SLOT(TrackingDeviceChanged()) );
connect( (QObject*)(m_Controls->m_testConnectionPolaris), SIGNAL(clicked()), this, SLOT(TestConnection()) );
connect( (QObject*)(m_Controls->m_testConnectionAurora), SIGNAL(clicked()), this, SLOT(TestConnection()) );
connect( (QObject*)(m_Controls->m_testConnectionMicronTracker), SIGNAL(clicked()), this, SLOT(TestConnection()) );
connect( (QObject*)(m_Controls->m_resetButton), SIGNAL(clicked()), this, SLOT(ResetByUser()) );
connect( (QObject*)(m_Controls->m_finishedButton), SIGNAL(clicked()), this, SLOT(Finished()) );
//set a few UI components depending on Windows / Linux
#ifdef WIN32
m_Controls->portTypeLabelPolaris->setVisible(false);
m_Controls->portTypePolaris->setVisible(false);
m_Controls->portTypeLabelAurora->setVisible(false);
m_Controls->portTypeAurora->setVisible(false);
#else
m_Controls->comPortLabelAurora->setText("Port Nr:");
m_Controls->m_comPortLabelPolaris->setText("Port Nr:");
m_Controls->m_portSpinBoxAurora->setPrefix("");
m_Controls->m_portSpinBoxPolaris->setPrefix("");
#endif
//disable unused UI component
m_Controls->m_polarisTrackingModeBox->setVisible(false); //don't delete this component, because it is used in the MBI part of MITK
}
}
void QmitkTrackingDeviceConfigurationWidget::TrackingDeviceChanged()
{
//show the correspondig widget
m_Controls->m_TrackingSystemWidget->setCurrentIndex(m_Controls->m_trackingDeviceChooser->currentIndex());
//the new trackingdevice is not configurated yet
m_TrackingDeviceConfigurated = false;
//reset output
ResetOutput();
//print output
if (m_Controls->m_trackingDeviceChooser->currentIndex()==0) AddOutput("<br>NDI Polaris selected"); //NDI Polaris
else if (m_Controls->m_trackingDeviceChooser->currentIndex()==1) AddOutput("<br>NDI Aurora selected"); //NDI Aurora
else if (m_Controls->m_trackingDeviceChooser->currentIndex()==2) AddOutput("<br>Microntracker selected"); //ClaronTechnology MicronTracker 2
emit TrackingDeviceSelectionChanged();
}
void QmitkTrackingDeviceConfigurationWidget::EnableUserReset(bool enable)
{
if (enable) m_Controls->m_resetButton->setVisible(true);
else m_Controls->m_resetButton->setVisible(false);
}
void QmitkTrackingDeviceConfigurationWidget::TestConnection()
{
//#### Step 1: construct a tracking device:
mitk::TrackingDevice::Pointer testTrackingDevice = ConstructTrackingDevice();
//#### Step 2: test connection and start tracking, generate output
AddOutput("<br>testing connection <br> ...");
if (testTrackingDevice->OpenConnection())
{
AddOutput(" OK");
AddOutput("<br>testing tracking <br> ...");
if (testTrackingDevice->StartTracking())
{
AddOutput(" OK");
if (!testTrackingDevice->StopTracking())AddOutput("<br>ERROR while stop tracking<br>");
}
else AddOutput(" ERROR!");
if (!testTrackingDevice->CloseConnection())AddOutput("<br>ERROR while closing connection<br>");
}
else AddOutput(" ERROR!");
}
void QmitkTrackingDeviceConfigurationWidget::Finished()
{
m_TrackingDevice = ConstructTrackingDevice();
m_Controls->m_TrackingSystemWidget->setEnabled(false);
m_Controls->m_trackingDeviceChooser->setEnabled(false);
m_Controls->choose_tracking_device_label->setEnabled(false);
m_Controls->configuration_finished_label->setText("<!DOCTYPE HTML PUBLIC \"-//W3C//DTD HTML 4.0//EN\" \"http://www.w3.org/TR/REC-html40/strict.dtd\">\n<html><head><meta name=\"qrichtext\" content=\"1\" /><style type=\"text/css\">\np, li { white-space: pre-wrap; }\n</style></head><body style=\" font-family:\'MS Shell Dlg 2\'; font-size:8.25pt; font-weight:400; font-style:normal;\">\n<p align=\"right\" style=\" margin-top:0px; margin-bottom:0px; margin-left:0px; margin-right:0px; -qt-block-indent:0; text-indent:0px; font-size:8pt;\"><span style=\" font-weight:600;\">Configuration finished</span></p></body></html>");
this->m_TrackingDeviceConfigurated = true;
emit TrackingDeviceConfigurationFinished();
}
void QmitkTrackingDeviceConfigurationWidget::Reset()
{
m_TrackingDevice = NULL;
m_Controls->m_TrackingSystemWidget->setEnabled(true);
m_Controls->m_trackingDeviceChooser->setEnabled(true);
m_Controls->choose_tracking_device_label->setEnabled(true);
m_Controls->configuration_finished_label->setText("<!DOCTYPE HTML PUBLIC \"-//W3C//DTD HTML 4.0//EN\" \"http://www.w3.org/TR/REC-html40/strict.dtd\">\n<html><head><meta name=\"qrichtext\" content=\"1\" /><style type=\"text/css\">\np, li { white-space: pre-wrap; }\n</style></head><body style=\" font-family:\'MS Shell Dlg 2\'; font-size:8.25pt; font-weight:400; font-style:normal;\">\n<p align=\"right\" style=\" margin-top:0px; margin-bottom:0px; margin-left:0px; margin-right:0px; -qt-block-indent:0; text-indent:0px; font-size:8pt;\"><span style=\" font-weight:600;\">Press \"Finished\" to confirm configuration</span></p></body></html>");
this->m_TrackingDeviceConfigurated = false;
emit TrackingDeviceConfigurationReseted();
}
void QmitkTrackingDeviceConfigurationWidget::ResetByUser()
{
Reset();
}
//######################### internal help methods #######################################
void QmitkTrackingDeviceConfigurationWidget::ResetOutput()
{
m_output.str("");
m_output <<"<body style=\" font-family:\'MS Shell Dlg 2\'; font-size:7pt; font-weight:400; font-style:normal;\" bgcolor=black><span style=\"color:#ffffff;\"><u>output:</u>";
m_Controls->m_outputTextAurora->setHtml(QString(m_output.str().c_str()));
m_Controls->m_outputTextPolaris->setHtml(QString(m_output.str().c_str()));
m_Controls->m_outputTextMicronTracker->setHtml(QString(m_output.str().c_str()));
}
void QmitkTrackingDeviceConfigurationWidget::AddOutput(std::string s)
{
//print output
m_output << s;
m_Controls->m_outputTextAurora->setHtml(QString(m_output.str().c_str()));
m_Controls->m_outputTextPolaris->setHtml(QString(m_output.str().c_str()));
m_Controls->m_outputTextMicronTracker->setHtml(QString(m_output.str().c_str()));
m_Controls->m_outputTextPolaris->verticalScrollBar()->setValue(m_Controls->m_outputTextPolaris->verticalScrollBar()->maximum());
m_Controls->m_outputTextAurora->verticalScrollBar()->setValue(m_Controls->m_outputTextAurora->verticalScrollBar()->maximum());
m_Controls->m_outputTextMicronTracker->verticalScrollBar()->setValue(m_Controls->m_outputTextMicronTracker->verticalScrollBar()->maximum());
repaint();
}
mitk::TrackingDevice::Pointer QmitkTrackingDeviceConfigurationWidget::ConstructTrackingDevice()
{
mitk::TrackingDevice::Pointer returnValue;
//#### Step 1: configure tracking device:
if (m_Controls->m_trackingDeviceChooser->currentIndex()==0)//NDI Polaris
{
if(m_Controls->m_radioPolaris5D->isChecked()) //5D Tracking
{
//not yet in the open source part so we'll only get NULL here.
returnValue = ConfigureNDI5DTrackingDevice();
}
else //6D Tracking
{
returnValue = ConfigureNDI6DTrackingDevice();
returnValue->SetType(mitk::NDIPolaris);
}
}
else if (m_Controls->m_trackingDeviceChooser->currentIndex()==1)//NDI Aurora
{
returnValue = ConfigureNDI6DTrackingDevice();
returnValue->SetType(mitk::NDIAurora);
}
else if (m_Controls->m_trackingDeviceChooser->currentIndex()==2)//ClaronTechnology MicronTracker 2
{
returnValue = mitk::ClaronTrackingDevice::New();
}
return returnValue;
}
mitk::TrackingDevice::Pointer QmitkTrackingDeviceConfigurationWidget::ConfigureNDI5DTrackingDevice()
{
return NULL;
}
mitk::TrackingDevice::Pointer QmitkTrackingDeviceConfigurationWidget::ConfigureNDI6DTrackingDevice()
{
mitk::NDITrackingDevice::Pointer tempTrackingDevice = mitk::NDITrackingDevice::New();
-
+
+ //get port
+ int port = 0;
+ if (m_Controls->m_trackingDeviceChooser->currentIndex()==1) port = m_Controls->m_portSpinBoxAurora->value();
+ else port = m_Controls->m_portSpinBoxPolaris->value();
+
//build prefix (depends on linux/win)
QString prefix = "";
#ifdef WIN32
prefix ="COM";
+ tempTrackingDevice->SetPortNumber(static_cast<mitk::SerialCommunication::PortNumber>(port)); //also set the com port for compatibility
#else
if (m_Controls->m_trackingDeviceChooser->currentIndex()==1) //Aurora
- prefix = m_Controls->portTypeAurora->currentText();
+ prefix = m_Controls->portTypeAurora->currentText();
else //Polaris
prefix = m_Controls->portTypePolaris->currentText();
#endif
- //get port
- int port = 0;
- if (m_Controls->m_trackingDeviceChooser->currentIndex()==1) port = m_Controls->m_portSpinBoxAurora->value();
- else port = m_Controls->m_portSpinBoxPolaris->value();
+
//build port name string
QString portName = prefix + QString::number(port);
tempTrackingDevice->SetDeviceName(portName.toStdString()); //set the port name
mitk::TrackingDevice::Pointer returnValue = static_cast<mitk::TrackingDevice*>(tempTrackingDevice);
return returnValue;
}
mitk::TrackingDevice::Pointer QmitkTrackingDeviceConfigurationWidget::GetTrackingDevice()
{
if (!m_AdvancedUserControl) m_TrackingDevice = ConstructTrackingDevice();
return this->m_TrackingDevice;
}
bool QmitkTrackingDeviceConfigurationWidget::GetTrackingDeviceConfigured()
{
return this->m_TrackingDeviceConfigurated;
}
void QmitkTrackingDeviceConfigurationWidget::ConfigurationFinished()
{
Finished();
}
void QmitkTrackingDeviceConfigurationWidget::EnableAdvancedUserControl(bool enable)
{
m_AdvancedUserControl = enable;
m_Controls->configuration_finished_label->setVisible(enable);
m_Controls->m_finishedLine->setVisible(enable);
m_Controls->m_resetButton->setVisible(enable);
m_Controls->m_finishedButton->setVisible(enable);
}
diff --git a/Modules/IGTUI/Qmitk/QmitkUpdateTimerWidget.cpp b/Modules/IGTUI/Qmitk/QmitkUpdateTimerWidget.cpp
index d48301fde6..41ecfad52d 100644
--- a/Modules/IGTUI/Qmitk/QmitkUpdateTimerWidget.cpp
+++ b/Modules/IGTUI/Qmitk/QmitkUpdateTimerWidget.cpp
@@ -1,171 +1,183 @@
/*=========================================================================
Program: Medical Imaging & Interaction Toolkit
Language: C++
Date: $Date: 2009-03-21 19:27:37 +0100 (Sa, 21 Mrz 2009) $
Version: $Revision: 16719 $
Copyright (c) German Cancer Research Center, Division of Medical and
Biological Informatics. All rights reserved.
See MITKCopyright.txt or http://www.mitk.org/copyright.html for details.
This software is distributed WITHOUT ANY WARRANTY; without even
the implied warranty of MERCHANTABILITY or FITNESS FOR A PARTICULAR
PURPOSE. See the above copyright notices for more information.
=========================================================================*/
#include "QmitkUpdateTimerWidget.h"
#include <QTimer>
#include <math.h>
static unsigned int DEFAULTUPDATEVALUE = 50; // default update value (in msec) for the timer
static unsigned int MINIMUMUPDATEVALUE = 10; // smallest value for the update rate spinbox
static unsigned int MAXIMUMUPDATEVALUE = 1000; // greatest value for the update rate spinbox
static unsigned int UPDATEVALUESTEP = 10; // step size for the update rate spinbox
QmitkUpdateTimerWidget::QmitkUpdateTimerWidget(QWidget* parent)
: QWidget(parent), m_Controls(NULL)
{
this->m_UpdateTimer = new QTimer( this );
this->CreateQtPartControl( this );
this->m_Controls->m_StopNavigationBtn->setEnabled( false );
this->SetupUpdateRateSB( MINIMUMUPDATEVALUE, MAXIMUMUPDATEVALUE, UPDATEVALUESTEP );
this->m_UpdateTimer->setInterval( DEFAULTUPDATEVALUE );
this->m_Controls->m_UpdateRateSB->setValue( DEFAULTUPDATEVALUE );
this->DisableWidget();
}
QmitkUpdateTimerWidget::~QmitkUpdateTimerWidget()
{
m_UpdateTimer->stop();
m_UpdateTimer = NULL;
m_Controls = NULL;
}
void QmitkUpdateTimerWidget::CreateQtPartControl(QWidget *parent)
{
if (!m_Controls)
{
// create GUI widgets
m_Controls = new Ui::QmitkUpdateTimerWidgetControls;
m_Controls->setupUi(parent);
this->CreateConnections();
}
}
void QmitkUpdateTimerWidget::CreateConnections()
{
connect( (QObject*)(m_Controls->m_StartNavigationBtn), SIGNAL(clicked()), this, SLOT(OnStartTimer()) );
connect( (QObject*)(m_Controls->m_StopNavigationBtn), SIGNAL(clicked()), this, SLOT(OnStopTimer()) );
connect( m_Controls->m_UpdateRateSB, SIGNAL(valueChanged(int)), this, SLOT(OnChangeTimerInterval(int)) );
}
unsigned int QmitkUpdateTimerWidget::GetTimerInterval()
{
return this->m_UpdateTimer->interval();
}
void QmitkUpdateTimerWidget::OnChangeTimerInterval( int interval )
{
this->SetTimerInterval(interval);
this->SetFrameRateLabel();
}
void QmitkUpdateTimerWidget::SetTimerInterval( unsigned int msec )
{
this->m_UpdateTimer->setInterval( msec );
this->m_Controls->m_UpdateRateSB->setValue( msec );
}
void QmitkUpdateTimerWidget::StartTimer()
{
if(!m_UpdateTimer->isActive())
{
this->m_UpdateTimer->start();
this->m_Controls->m_StartNavigationBtn->setEnabled( false );
this->m_Controls->m_StopNavigationBtn->setEnabled( true );
this->m_Controls->m_NavigationStateLbl->setStyleSheet( "QLabel{background-color: #96e066 }" );
this->m_Controls->m_NavigationStateLbl->setText( "Started ... " );
emit Started();
}
}
void QmitkUpdateTimerWidget::StopTimer()
{
if(m_UpdateTimer->isActive())
{
m_UpdateTimer->stop();
this->m_Controls->m_StopNavigationBtn->setEnabled( false );
this->m_Controls->m_StartNavigationBtn->setEnabled( true );
this->m_Controls->m_NavigationStateLbl->setStyleSheet( "QLabel{background-color: #ffcccc }" );
this->m_Controls->m_NavigationStateLbl->setText( "Stopped ... " );
emit Stopped();
}
}
QTimer* QmitkUpdateTimerWidget::GetUpdateTimer()
{
return this->m_UpdateTimer;
}
void QmitkUpdateTimerWidget::OnStartTimer()
{
this->StartTimer();
}
void QmitkUpdateTimerWidget::OnStopTimer()
{
this->StopTimer();
}
void QmitkUpdateTimerWidget::SetPurposeLabelText( QString text )
{
m_Controls->m_StartNavigationBtn->setText( " Start " + text );
m_Controls->m_StopNavigationBtn->setText( " Stop " + text );
}
void QmitkUpdateTimerWidget::SetupUpdateRateSB( int min, int max, int step )
{
this->m_Controls->m_UpdateRateSB->setRange( min , max );
this->m_Controls->m_UpdateRateSB->setSingleStep( step );
}
void QmitkUpdateTimerWidget::SetFrameRateLabel()
{
float frameRate = floor(1000 / (float) this->GetTimerInterval() + 0.5); // floor rounding can be used because there are no negative values
QString frameRateString = QString::number( frameRate, 'g', 4 );
this->m_Controls->m_FrameRateLbl->setText("msec (" + frameRateString + " Hz)");
}
void QmitkUpdateTimerWidget::HideFramerateSettings( bool hidden )
{
this->m_Controls->m_UpdatesInMsecLbl->setVisible( !hidden );
this->m_Controls->m_UpdateRateSB->setVisible ( !hidden );
this->m_Controls->m_FrameRateLbl->setVisible ( !hidden );
}
void QmitkUpdateTimerWidget::EnableWidget()
{
this->setEnabled( true );
}
void QmitkUpdateTimerWidget::DisableWidget()
{
this->StopTimer();
this->setEnabled( false );
-}
\ No newline at end of file
+}
+
+
+
+void QmitkUpdateTimerWidget::SetIcon( WidgetButtons button, const QIcon& icon )
+{
+ switch( button )
+ {
+ case StartButton: m_Controls->m_StartNavigationBtn->setIcon(icon);
+
+ case StopButton: m_Controls->m_StartNavigationBtn->setIcon(icon);
+ }
+}
diff --git a/Modules/IGTUI/Qmitk/QmitkUpdateTimerWidget.h b/Modules/IGTUI/Qmitk/QmitkUpdateTimerWidget.h
index 9317d02b18..e8442060f0 100644
--- a/Modules/IGTUI/Qmitk/QmitkUpdateTimerWidget.h
+++ b/Modules/IGTUI/Qmitk/QmitkUpdateTimerWidget.h
@@ -1,130 +1,146 @@
/*=========================================================================
Program: Medical Imaging & Interaction Toolkit
Language: C++
Date: $Date: 2009-03-21 19:27:37 +0100 (Sa, 21 Mrz 2009) $
Version: $Revision: 16719 $
Copyright (c) German Cancer Research Center, Division of Medical and
Biological Informatics. All rights reserved.
See MITKCopyright.txt or http://www.mitk.org/copyright.html for details.
This software is distributed WITHOUT ANY WARRANTY; without even
the implied warranty of MERCHANTABILITY or FITNESS FOR A PARTICULAR
PURPOSE. See the above copyright notices for more information.
=========================================================================*/
#ifndef _QmitkUpdateTimerWidget_H_INCLUDED
#define _QmitkUpdateTimerWidget_H_INCLUDED
#include "ui_QmitkUpdateTimerWidgetControls.h"
#include "MitkIGTUIExports.h"
/*!
\brief QmitkUpdateTimerWidget
Widget for setting up and controlling an update timer in an IGT-Pipeline.
*/
class MitkIGTUI_EXPORT QmitkUpdateTimerWidget : public QWidget
{
Q_OBJECT // this is needed for all Qt objects that should have a MOC object (everything that derives from QObject)
public:
+
+ enum WidgetButtons {
+
+ StartButton,
+ StopButton
+ };
+
/*!
\brief default constructor
*/
QmitkUpdateTimerWidget( QWidget* parent );
/*!
\brief default destructor
*/
virtual ~QmitkUpdateTimerWidget();
/*!
\brief This method returns the timer's timeout interval in msec.
*/
unsigned int GetTimerInterval();
/*!
\brief This method sets the timer's timeout interval in msec.
*/
void SetTimerInterval( unsigned int msec );
/*!
\brief This method starts the timer if it is not already active.
*/
void StartTimer();
/*!
\brief This method stops the timer if it is active at the moment.
*/
void StopTimer();
/*!
\brief This method returns this object's timer.
*/
QTimer* GetUpdateTimer();
/*!
\brief This method sets the given QString for the purpose of this update timer e.g. if "Navigation" is given, the start and stop button will be labeled "Start Navigation" and "Stop Navigation". Furthermore the purpose description is used for the timer status label: "Navigation started ... " in this case.
*/
void SetPurposeLabelText( QString text );
- /*
+ /*!
\brief This method hides the framerate settings spinbox and her labels in the view.
*/
void HideFramerateSettings( bool hidden );
+ /*!
+ \brief This method sets the icon for a specific button of the widget.
+ */
+ void SetIcon( WidgetButtons button, const QIcon& icon );
+
+
+
+
signals:
void Started();
void Stopped();
public slots:
void EnableWidget();
void DisableWidget();
-private:
- /*!
- \brief This object's update timer realized by a QTimer
- */
- QTimer* m_UpdateTimer;
-
- /*!
- \brief This method is used to set up the update rate spinbox, min and max range are set and also the step size
- */
- void SetupUpdateRateSB( int min, int max, int step );
-
- /*!
- \brief This method is used to set the actual framerate (in Hz) as the framerate label text
- */
- void SetFrameRateLabel();
-
protected slots:
/*!
\brief This method is called when the start button is pressed. It starts the timer using StartTimer().
*/
void OnStartTimer();
/*!
\brief This method is called when the stop button is pressed. It stops the timer using StopTimer().
*/
void OnStopTimer();
/*!
\brief This method is called when the value in the spinbox is changed. It updates the timer interval using SetTimerInterval( ).
*/
void OnChangeTimerInterval( int interval );
protected:
void CreateConnections();
void CreateQtPartControl( QWidget *parent );
Ui::QmitkUpdateTimerWidgetControls* m_Controls; ///< gui widgets
+
+
+private:
+ /*!
+ \brief This object's update timer realized by a QTimer
+ */
+ QTimer* m_UpdateTimer;
+
+ /*!
+ \brief This method is used to set up the update rate spinbox, min and max range are set and also the step size
+ */
+ void SetupUpdateRateSB( int min, int max, int step );
+
+ /*!
+ \brief This method is used to set the actual framerate (in Hz) as the framerate label text
+ */
+ void SetFrameRateLabel();
};
#endif // _QmitkUpdateTimerWidget_H_INCLUDED
diff --git a/Modules/ImageExtraction/Testing/mitkCompareImageSliceTestHelper.h b/Modules/ImageExtraction/Testing/mitkCompareImageSliceTestHelper.h
index 4762e50a45..b462288c43 100644
--- a/Modules/ImageExtraction/Testing/mitkCompareImageSliceTestHelper.h
+++ b/Modules/ImageExtraction/Testing/mitkCompareImageSliceTestHelper.h
@@ -1,161 +1,163 @@
/*=========================================================================
Program: Medical Imaging & Interaction Toolkit
Language: C++
Date: $Date$
Version: $Revision$
Copyright (c) German Cancer Research Center, Division of Medical and
Biological Informatics. All rights reserved.
See MITKCopyright.txt or http://www.mitk.org/copyright.html for details.
This software is distributed WITHOUT ANY WARRANTY; without even
the implied warranty of MERCHANTABILITY or FITNESS FOR A PARTICULAR
PURPOSE. See the above copyright notices for more information.
=========================================================================*/
#ifndef mitkCompareImageSliceTestHelperhincluded
#define mitkCompareImageSliceTestHelperhincluded
#include "mitkImageCast.h"
+#include <mitkImageAccessByItk.h>
#include <itkImageSliceConstIteratorWithIndex.h>
#include <itkImageRegionConstIterator.h>
// copied from mitk/Core/Algorithms/mitkOverwriteSliceImageFilter.cpp
// basically copied from mitk/Core/Algorithms/mitkImageAccessByItk.h
#define myMITKOverwriteSliceImageFilterAccessByItk(mitkImage, itkImageTypeFunction, pixeltype, dimension, itkimage2) \
if ( typeId == typeid(pixeltype) ) \
{ \
typedef itk::Image<pixeltype, dimension> ImageType; \
typedef mitk::ImageToItk<ImageType> ImageToItkType; \
itk::SmartPointer<ImageToItkType> imagetoitk = ImageToItkType::New(); \
imagetoitk->SetInput(mitkImage); \
imagetoitk->Update(); \
itkImageTypeFunction(imagetoitk->GetOutput(), itkimage2); \
}
#define myMITKOverwriteSliceImageFilterAccessAllTypesByItk(mitkImage, itkImageTypeFunction, dimension, itkimage2) \
{ \
myMITKOverwriteSliceImageFilterAccessByItk(mitkImage, itkImageTypeFunction, double, dimension, itkimage2) else \
myMITKOverwriteSliceImageFilterAccessByItk(mitkImage, itkImageTypeFunction, float, dimension, itkimage2) else \
myMITKOverwriteSliceImageFilterAccessByItk(mitkImage, itkImageTypeFunction, int, dimension, itkimage2) else \
myMITKOverwriteSliceImageFilterAccessByItk(mitkImage, itkImageTypeFunction, unsigned int, dimension, itkimage2) else \
myMITKOverwriteSliceImageFilterAccessByItk(mitkImage, itkImageTypeFunction, short, dimension, itkimage2) else \
myMITKOverwriteSliceImageFilterAccessByItk(mitkImage, itkImageTypeFunction, unsigned short, dimension, itkimage2) else \
myMITKOverwriteSliceImageFilterAccessByItk(mitkImage, itkImageTypeFunction, char, dimension, itkimage2) else \
myMITKOverwriteSliceImageFilterAccessByItk(mitkImage, itkImageTypeFunction, unsigned char, dimension, itkimage2) \
}
class CompareImageSliceTestHelper
{
private:
/* variables to be used by CompareSlice only */
static unsigned int m_Dimension0;
static unsigned int m_Dimension1;
static unsigned int m_SliceDimension;
static unsigned int m_SliceIndex;
static bool m_ComparisonResult;
static mitk::Image* m_SliceImage;
public:
template<typename TPixel1, unsigned int VImageDimension1, typename TPixel2, unsigned int VImageDimension2>
static void ItkImageCompare( itk::Image<TPixel1,VImageDimension1>* inputImage, itk::Image<TPixel2,VImageDimension2>* outputImage )
{
m_ComparisonResult = false;
typedef itk::Image<TPixel1, VImageDimension1> SliceImageType;
typedef itk::Image<TPixel2, VImageDimension2> VolumeImageType;
typedef itk::ImageSliceConstIteratorWithIndex< VolumeImageType > OutputSliceIteratorType;
typedef itk::ImageRegionConstIterator< SliceImageType > InputSliceIteratorType;
typename VolumeImageType::RegionType sliceInVolumeRegion;
sliceInVolumeRegion = outputImage->GetLargestPossibleRegion();
sliceInVolumeRegion.SetSize( m_SliceDimension, 1 ); // just one slice
sliceInVolumeRegion.SetIndex( m_SliceDimension, m_SliceIndex ); // exactly this slice, please
OutputSliceIteratorType outputIterator( outputImage, sliceInVolumeRegion );
outputIterator.SetFirstDirection(m_Dimension0);
outputIterator.SetSecondDirection(m_Dimension1);
InputSliceIteratorType inputIterator( inputImage, inputImage->GetLargestPossibleRegion() );
// iterate over output slice (and over input slice simultaneously)
outputIterator.GoToBegin();
inputIterator.GoToBegin();
while ( !outputIterator.IsAtEnd() )
{
while ( !outputIterator.IsAtEndOfSlice() )
{
while ( !outputIterator.IsAtEndOfLine() )
{
m_ComparisonResult = outputIterator.Get() == (TPixel2) inputIterator.Get();
if (!m_ComparisonResult) return; // return on first mismatch
++outputIterator;
++inputIterator;
}
outputIterator.NextLine();
}
outputIterator.NextSlice();
}
}
template<typename TPixel, unsigned int VImageDimension>
static void ItkImageSwitch( itk::Image<TPixel,VImageDimension>* itkImage )
{
const std::type_info& typeId=*(m_SliceImage->GetPixelType().GetTypeId());
- myMITKOverwriteSliceImageFilterAccessAllTypesByItk( m_SliceImage, ItkImageCompare, 2, itkImage );
+ AccessFixedDimensionByItk_1( m_SliceImage, ItkImageCompare, 2, itkImage )
+ //myMITKOverwriteSliceImageFilterAccessAllTypesByItk( m_SliceImage, ItkImageCompare, 2, itkImage );
}
static bool CompareSlice( mitk::Image* image, unsigned int sliceDimension, unsigned int sliceIndex, mitk::Image* slice )
{
if ( !image || ! slice ) return false;
switch (sliceDimension)
{
default:
case 2:
m_Dimension0 = 0;
m_Dimension1 = 1;
break;
case 1:
m_Dimension0 = 0;
m_Dimension1 = 2;
break;
case 0:
m_Dimension0 = 1;
m_Dimension1 = 2;
break;
}
if ( slice->GetDimension() != 2 || image->GetDimension() != 3 ||
slice->GetDimension(0) != image->GetDimension(m_Dimension0) ||
slice->GetDimension(1) != image->GetDimension(m_Dimension1) )
{
std::cerr << "Slice and image dimensions differ. Sorry, cannot work like this." << std::endl;
return false;
}
// this will do a long long if/else to find out both pixel typesA
m_SliceImage = slice;
m_SliceIndex = sliceIndex;
m_SliceDimension = sliceDimension;
m_ComparisonResult = false;
AccessFixedDimensionByItk( image, ItkImageSwitch, 3 );
return m_ComparisonResult;
}
}; // end class
#endif
diff --git a/Modules/ImageExtraction/mitkExtractDirectedPlaneImageFilterNew.cpp b/Modules/ImageExtraction/mitkExtractDirectedPlaneImageFilterNew.cpp
index bc71cc4e55..fa65f08e95 100644
--- a/Modules/ImageExtraction/mitkExtractDirectedPlaneImageFilterNew.cpp
+++ b/Modules/ImageExtraction/mitkExtractDirectedPlaneImageFilterNew.cpp
@@ -1,294 +1,296 @@
/*=========================================================================
Program: Medical Imaging & Interaction Toolkit
Language: C++
Date: $Date: 2010-12-02 14:54:03 +0100 (Do, 2 Dec 2010) $
Version: $Revision: 21147 $
Copyright (c) German Cancer Research Center, Division of Medical and
Biological Informatics. All rights reserved.
See MITKCopyright.txt or http://www.mitk.org/copyright.html for details.
This software is distributed WITHOUT ANY WARRANTY; without even
the implied warranty of MERCHANTABILITY or FITNESS FOR A PARTICULAR
PURPOSE. See the above copyright notices for more information.
=========================================================================*/
#include "mitkExtractDirectedPlaneImageFilterNew.h"
#include "mitkImageCast.h"
#include "mitkImageTimeSelector.h"
#include "itkImageRegionIterator.h"
+#include <mitkImageAccessByItk.h>
+
mitk::ExtractDirectedPlaneImageFilterNew::ExtractDirectedPlaneImageFilterNew()
:m_CurrentWorldGeometry2D(NULL)
{
}
mitk::ExtractDirectedPlaneImageFilterNew::~ExtractDirectedPlaneImageFilterNew()
{
}
void mitk::ExtractDirectedPlaneImageFilterNew::GenerateData(){
mitk::Image::ConstPointer inputImage = ImageToImageFilter::GetInput(0);
if ( !inputImage )
{
MITK_ERROR << "mitk::ExtractDirectedPlaneImageFilterNew: No input available. Please set the input!" << std::endl;
itkExceptionMacro("mitk::ExtractDirectedPlaneImageFilterNew: No input available. Please set the input!");
return;
}
m_ImageGeometry = inputImage->GetGeometry();
//If no timestep is set, the lowest given will be selected
const mitk::TimeSlicedGeometry* inputTimeGeometry = this->GetInput()->GetTimeSlicedGeometry();
if ( !m_ActualInputTimestep )
{
ScalarType time = m_CurrentWorldGeometry2D->GetTimeBounds()[0];
if ( time > ScalarTypeNumericTraits::NonpositiveMin() )
{
m_ActualInputTimestep = inputTimeGeometry->MSToTimeStep( time );
}
}
if ( inputImage->GetDimension() > 4 || inputImage->GetDimension() < 2)
{
MITK_ERROR << "mitk::ExtractDirectedPlaneImageFilterNew:GenerateData works only with 3D and 3D+t images, sorry." << std::endl;
itkExceptionMacro("mitk::ExtractDirectedPlaneImageFilterNew works only with 3D and 3D+t images, sorry.");
return;
}
else if ( inputImage->GetDimension() == 4 )
{
mitk::ImageTimeSelector::Pointer timeselector = mitk::ImageTimeSelector::New();
timeselector->SetInput( inputImage );
timeselector->SetTimeNr( m_ActualInputTimestep );
timeselector->UpdateLargestPossibleRegion();
inputImage = timeselector->GetOutput();
}
else if ( inputImage->GetDimension() == 2)
{
mitk::Image::Pointer resultImage = ImageToImageFilter::GetOutput();
resultImage = const_cast<mitk::Image*>( inputImage.GetPointer() );
ImageToImageFilter::SetNthOutput( 0, resultImage);
return;
}
if ( !m_CurrentWorldGeometry2D )
{
MITK_ERROR<< "mitk::ExtractDirectedPlaneImageFilterNew::GenerateData has no CurrentWorldGeometry2D set" << std::endl;
return;
}
AccessFixedDimensionByItk( inputImage, ItkSliceExtraction, 3 );
}//Generate Data
void mitk::ExtractDirectedPlaneImageFilterNew::GenerateOutputInformation ()
{
Superclass::GenerateOutputInformation();
}
/*
* The desired slice is extracted by filling the image`s corresponding pixel values in an empty 2 dimensional itk::Image
* Therefor the itk image`s extent in pixel (in each direction) is doubled and its spacing (also in each direction) is divided by two
* (similar to the shannon theorem).
*/
template<typename TPixel, unsigned int VImageDimension>
void mitk::ExtractDirectedPlaneImageFilterNew::ItkSliceExtraction (itk::Image<TPixel, VImageDimension>* inputImage)
{
typedef itk::Image<TPixel, VImageDimension> InputImageType;
typedef itk::Image<TPixel, VImageDimension-1> SliceImageType;
typedef itk::ImageRegionConstIterator< SliceImageType > SliceIterator;
//Creating an itk::Image that represents the sampled slice
typename SliceImageType::Pointer resultSlice = SliceImageType::New();
typename SliceImageType::IndexType start;
start[0] = 0;
start[1] = 0;
Point3D origin = m_CurrentWorldGeometry2D->GetOrigin();
Vector3D right = m_CurrentWorldGeometry2D->GetAxisVector(0);
Vector3D bottom = m_CurrentWorldGeometry2D->GetAxisVector(1);
//Calculation the sample-spacing, i.e the half of the smallest spacing existing in the original image
Vector3D newPixelSpacing = m_ImageGeometry->GetSpacing();
float minSpacing = newPixelSpacing[0];
for (unsigned int i = 1; i < newPixelSpacing.Size(); i++)
{
if (newPixelSpacing[i] < minSpacing )
{
minSpacing = newPixelSpacing[i];
}
}
newPixelSpacing[0] = 0.5*minSpacing;
newPixelSpacing[1] = 0.5*minSpacing;
newPixelSpacing[2] = 0.5*minSpacing;
float pixelSpacing[2];
pixelSpacing[0] = newPixelSpacing[0];
pixelSpacing[1] = newPixelSpacing[1];
//Calculating the size of the sampled slice
typename SliceImageType::SizeType size;
Vector2D extentInMM;
extentInMM[0] = m_CurrentWorldGeometry2D->GetExtentInMM(0);
extentInMM[1] = m_CurrentWorldGeometry2D->GetExtentInMM(1);
//The maximum extent is the lenght of the diagonal of the considered plane
double maxExtent = sqrt(extentInMM[0]*extentInMM[0]+extentInMM[1]*extentInMM[1]);
unsigned int xTranlation = (maxExtent-extentInMM[0]);
unsigned int yTranlation = (maxExtent-extentInMM[1]);
size[0] = (maxExtent+xTranlation)/newPixelSpacing[0];
size[1] = (maxExtent+yTranlation)/newPixelSpacing[1];
//Creating an ImageRegion Object
typename SliceImageType::RegionType region;
region.SetSize( size );
region.SetIndex( start );
//Defining the image`s extent and origin by passing the region to it and allocating memory for it
resultSlice->SetRegions( region );
resultSlice->SetSpacing( pixelSpacing );
resultSlice->Allocate();
/*
* Here we create an new geometry so that the transformations are calculated correctly (our resulting slice has a different bounding box and spacing)
* The original current worldgeometry must be cloned because we have to keep the directions of the axis vector which represents the rotation
*/
right.Normalize();
bottom.Normalize();
//Here we translate the origin to adapt the new geometry to the previous calculated extent
origin[0] -= xTranlation*right[0]+yTranlation*bottom[0];
origin[1] -= xTranlation*right[1]+yTranlation*bottom[1];
origin[2] -= xTranlation*right[2]+yTranlation*bottom[2];
//Putting it together for the new geometry
mitk::Geometry3D::Pointer newSliceGeometryTest = dynamic_cast<Geometry3D*>(m_CurrentWorldGeometry2D->Clone().GetPointer());
newSliceGeometryTest->ChangeImageGeometryConsideringOriginOffset(true);
//Workaround because of BUG (#6505)
newSliceGeometryTest->GetIndexToWorldTransform()->SetMatrix(m_CurrentWorldGeometry2D->GetIndexToWorldTransform()->GetMatrix());
//Workaround end
newSliceGeometryTest->SetOrigin(origin);
ScalarType bounds[6]={0, size[0], 0, size[1], 0, 1};
newSliceGeometryTest->SetBounds(bounds);
newSliceGeometryTest->SetSpacing(newPixelSpacing);
newSliceGeometryTest->Modified();
//Workaround because of BUG (#6505)
itk::MatrixOffsetTransformBase<mitk::ScalarType,3,3>::MatrixType tempTransform = newSliceGeometryTest->GetIndexToWorldTransform()->GetMatrix();
//Workaround end
/*
* Now we iterate over the recently created slice.
* For each slice - pixel we check whether there is an according
* pixel in the input - image which can be set in the slice.
* In this way a slice is sampled out of the input - image regrading to the given PlaneGeometry
*/
Point3D currentSliceIndexPointIn2D;
Point3D currentImageWorldPointIn3D;
typename InputImageType::IndexType inputIndex;
SliceIterator sliceIterator ( resultSlice, resultSlice->GetLargestPossibleRegion() );
sliceIterator.GoToBegin();
while ( !sliceIterator.IsAtEnd() )
{
/*
* Here we add 0.5 to to assure that the indices are correctly transformed.
* (Because of the 0.5er Bug)
*/
currentSliceIndexPointIn2D[0] = sliceIterator.GetIndex()[0]+0.5;
currentSliceIndexPointIn2D[1] = sliceIterator.GetIndex()[1]+0.5;
currentSliceIndexPointIn2D[2] = 0;
newSliceGeometryTest->IndexToWorld( currentSliceIndexPointIn2D, currentImageWorldPointIn3D );
m_ImageGeometry->WorldToIndex( currentImageWorldPointIn3D, inputIndex);
if ( m_ImageGeometry->IsIndexInside( inputIndex ))
{
resultSlice->SetPixel( sliceIterator.GetIndex(), inputImage->GetPixel(inputIndex) );
}
else
{
resultSlice->SetPixel( sliceIterator.GetIndex(), 0);
}
++sliceIterator;
}
Image::Pointer resultImage = ImageToImageFilter::GetOutput();
GrabItkImageMemory(resultSlice, resultImage, NULL, false);
resultImage->SetClonedGeometry(newSliceGeometryTest);
//Workaround because of BUG (#6505)
resultImage->GetGeometry()->GetIndexToWorldTransform()->SetMatrix(tempTransform);
//Workaround end
}
///**TEST** May ba a little bit more efficient but doesn`t already work/
//right.Normalize();
//bottom.Normalize();
//Point3D currentImagePointIn3D = origin /*+ bottom*newPixelSpacing*/;
//unsigned int columns ( 0 );
/**ENDE**/
/****TEST***/
//SliceImageType::IndexType index = sliceIterator.GetIndex();
//if ( columns == (extentInPixel[0]) )
//{
//If we are at the end of a row, then we have to go to the beginning of the next row
//currentImagePointIn3D = origin;
//currentImagePointIn3D += newPixelSpacing[1]*bottom*index[1];
//columns = 0;
//m_ImageGeometry->WorldToIndex(currentImagePointIn3D, inputIndex);
//}
//else
//{
////
//if ( columns != 0 )
//{
//currentImagePointIn3D += newPixelSpacing[0]*right;
//}
//m_ImageGeometry->WorldToIndex(currentImagePointIn3D, inputIndex);
//}
//if ( m_ImageGeometry->IsIndexInside( inputIndex ))
//{
//resultSlice->SetPixel( sliceIterator.GetIndex(), inputImage->GetPixel(inputIndex) );
//}
//else if (currentImagePointIn3D == origin)
//{
//Point3D temp;
//temp[0] = bottom[0]*newPixelSpacing[0]*0.5;
//temp[1] = bottom[1]*newPixelSpacing[1]*0.5;
//temp[2] = bottom[2]*newPixelSpacing[2]*0.5;
//origin[0] += temp[0];
//origin[1] += temp[1];
//origin[2] += temp[2];
//currentImagePointIn3D = origin;
//m_ImageGeometry->WorldToIndex(currentImagePointIn3D, inputIndex);
//if ( m_ImageGeometry->IsIndexInside( inputIndex ))
//{
//resultSlice->SetPixel( sliceIterator.GetIndex(), inputImage->GetPixel(inputIndex) );
//}
//}
/****TEST ENDE****/
diff --git a/Modules/ImageExtraction/mitkExtractImageFilter.cpp b/Modules/ImageExtraction/mitkExtractImageFilter.cpp
index 0957ed70fd..94047a738e 100644
--- a/Modules/ImageExtraction/mitkExtractImageFilter.cpp
+++ b/Modules/ImageExtraction/mitkExtractImageFilter.cpp
@@ -1,252 +1,254 @@
/*=========================================================================
Program: Medical Imaging & Interaction Toolkit
Language: C++
Date: $Date$
Version: $Revision$
Copyright (c) German Cancer Research Center, Division of Medical and
Biological Informatics. All rights reserved.
See MITKCopyright.txt or http://www.mitk.org/copyright.html for details.
This software is distributed WITHOUT ANY WARRANTY; without even
the implied warranty of MERCHANTABILITY or FITNESS FOR A PARTICULAR
PURPOSE. See the above copyright notices for more information.
=========================================================================*/
#include "mitkExtractImageFilter.h"
#include "mitkImageCast.h"
#include "mitkPlaneGeometry.h"
#include "mitkITKImageImport.h"
#include "mitkImageTimeSelector.h"
+#include <mitkImageAccessByItk.h>
+
#include <itkExtractImageFilter.h>
mitk::ExtractImageFilter::ExtractImageFilter()
:m_SliceIndex(0),
m_SliceDimension(0),
m_TimeStep(0)
{
}
mitk::ExtractImageFilter::~ExtractImageFilter()
{
}
void mitk::ExtractImageFilter::GenerateData()
{
Image::ConstPointer input = ImageToImageFilter::GetInput(0);
if ( (input->GetDimension() > 4) || (input->GetDimension() < 2) )
{
MITK_ERROR << "mitk::ExtractImageFilter:GenerateData works only with 3D and 3D+t images, sorry." << std::endl;
itkExceptionMacro("mitk::ExtractImageFilter works only with 3D and 3D+t images, sorry.");
return;
}
else if (input->GetDimension() == 4)
{
ImageTimeSelector::Pointer timeSelector = ImageTimeSelector::New();
timeSelector->SetInput( input );
timeSelector->SetTimeNr( m_TimeStep );
timeSelector->UpdateLargestPossibleRegion();
input = timeSelector->GetOutput();
}
else if (input->GetDimension() == 2)
{
Image::Pointer resultImage = ImageToImageFilter::GetOutput();
resultImage = const_cast<Image*>(input.GetPointer());
ImageToImageFilter::SetNthOutput( 0, resultImage );
return;
}
if ( m_SliceDimension >= input->GetDimension() )
{
MITK_ERROR << "mitk::ExtractImageFilter:GenerateData m_SliceDimension == " << m_SliceDimension << " makes no sense with an " << input->GetDimension() << "D image." << std::endl;
itkExceptionMacro("This is not a sensible value for m_SliceDimension.");
return;
}
AccessFixedDimensionByItk( input, ItkImageProcessing, 3 );
// set a nice geometry for display and point transformations
Geometry3D* inputImageGeometry = ImageToImageFilter::GetInput(0)->GetGeometry();
if (!inputImageGeometry)
{
MITK_ERROR << "In ExtractImageFilter::ItkImageProcessing: Input image has no geometry!" << std::endl;
return;
}
PlaneGeometry::PlaneOrientation orientation = PlaneGeometry::Transversal;
switch ( m_SliceDimension )
{
default:
case 2:
orientation = PlaneGeometry::Transversal;
break;
case 1:
orientation = PlaneGeometry::Frontal;
break;
case 0:
orientation = PlaneGeometry::Sagittal;
break;
}
PlaneGeometry::Pointer planeGeometry = PlaneGeometry::New();
planeGeometry->InitializeStandardPlane( inputImageGeometry, orientation, (ScalarType)m_SliceIndex, true, false );
Image::Pointer resultImage = ImageToImageFilter::GetOutput();
planeGeometry->ChangeImageGeometryConsideringOriginOffset(true);
resultImage->SetGeometry( planeGeometry );
}
template<typename TPixel, unsigned int VImageDimension>
void mitk::ExtractImageFilter::ItkImageProcessing( itk::Image<TPixel,VImageDimension>* itkImage )
{
// use the itk::ExtractImageFilter to get a 2D image
typedef itk::Image< TPixel, VImageDimension > ImageType3D;
typedef itk::Image< TPixel, VImageDimension-1 > ImageType2D;
typename ImageType3D::RegionType inSliceRegion = itkImage->GetLargestPossibleRegion();
inSliceRegion.SetSize( m_SliceDimension, 0 );
typedef itk::ExtractImageFilter<ImageType3D, ImageType2D> ExtractImageFilterType;
typename ExtractImageFilterType::Pointer sliceExtractor = ExtractImageFilterType::New();
sliceExtractor->SetInput( itkImage );
inSliceRegion.SetIndex( m_SliceDimension, m_SliceIndex );
sliceExtractor->SetExtractionRegion( inSliceRegion );
// calculate the output
sliceExtractor->UpdateLargestPossibleRegion();
typename ImageType2D::Pointer slice = sliceExtractor->GetOutput();
// possible bug in itk::ExtractImageFilter: or in CastToItkImage ?
// direction maxtrix is wrong/broken/not working with mitk::Image::InitializeByItkImage
// solution here: we overwrite it with an unity matrix
// correct image direction only if ITK version < 3.10
#if (ITK_VERSION_MAJOR == 3 && ITK_VERSION_MINOR < 10) || ITK_VERSION_MAJOR < 3
typename ImageType2D::DirectionType imageDirection;
imageDirection.SetIdentity();
slice->SetDirection(imageDirection);
#endif
// re-import to MITK
Image::Pointer resultImage = ImageToImageFilter::GetOutput();
GrabItkImageMemory(slice, resultImage, NULL, false);
}
/*
* What is the input requested region that is required to produce the output
* requested region? By default, the largest possible region is always
* required but this is overridden in many subclasses. For instance, for an
* image processing filter where an output pixel is a simple function of an
* input pixel, the input requested region will be set to the output
* requested region. For an image processing filter where an output pixel is
* a function of the pixels in a neighborhood of an input pixel, then the
* input requested region will need to be larger than the output requested
* region (to avoid introducing artificial boundary conditions). This
* function should never request an input region that is outside the the
* input largest possible region (i.e. implementations of this method should
* crop the input requested region at the boundaries of the input largest
* possible region).
*/
void mitk::ExtractImageFilter::GenerateInputRequestedRegion()
{
Superclass::GenerateInputRequestedRegion();
ImageToImageFilter::InputImagePointer input = const_cast< ImageToImageFilter::InputImageType* > ( this->GetInput() );
Image::Pointer output = this->GetOutput();
if (input->GetDimension() == 2)
{
input->SetRequestedRegionToLargestPossibleRegion();
return;
}
Image::RegionType requestedRegion;
requestedRegion = output->GetRequestedRegion();
requestedRegion.SetIndex(0, 0);
requestedRegion.SetIndex(1, 0);
requestedRegion.SetIndex(2, 0);
requestedRegion.SetSize(0, input->GetDimension(0));
requestedRegion.SetSize(1, input->GetDimension(1));
requestedRegion.SetSize(2, input->GetDimension(2));
requestedRegion.SetIndex( m_SliceDimension, m_SliceIndex ); // only one slice needed
requestedRegion.SetSize( m_SliceDimension, 1 );
input->SetRequestedRegion( &requestedRegion );
}
/*
* Generate the information decribing the output data. The default
* implementation of this method will copy information from the input to the
* output. A filter may override this method if its output will have different
* information than its input. For instance, a filter that shrinks an image will
* need to provide an implementation for this method that changes the spacing of
* the pixels. Such filters should call their superclass' implementation of this
* method prior to changing the information values they need (i.e.
* GenerateOutputInformation() should call
* Superclass::GenerateOutputInformation() prior to changing the information.
*/
void mitk::ExtractImageFilter::GenerateOutputInformation()
{
Image::Pointer output = this->GetOutput();
Image::ConstPointer input = this->GetInput();
if (input.IsNull()) return;
if ( m_SliceDimension >= input->GetDimension() && input->GetDimension() != 2 )
{
MITK_ERROR << "mitk::ExtractImageFilter:GenerateOutputInformation m_SliceDimension == " << m_SliceDimension << " makes no sense with an " << input->GetDimension() << "D image." << std::endl;
itkExceptionMacro("This is not a sensible value for m_SliceDimension.");
return;
}
unsigned int sliceDimension( m_SliceDimension );
if ( input->GetDimension() == 2)
{
sliceDimension = 2;
}
unsigned int tmpDimensions[2];
switch ( sliceDimension )
{
default:
case 2:
// orientation = PlaneGeometry::Transversal;
tmpDimensions[0] = input->GetDimension(0);
tmpDimensions[1] = input->GetDimension(1);
break;
case 1:
// orientation = PlaneGeometry::Frontal;
tmpDimensions[0] = input->GetDimension(0);
tmpDimensions[1] = input->GetDimension(2);
break;
case 0:
// orientation = PlaneGeometry::Sagittal;
tmpDimensions[0] = input->GetDimension(1);
tmpDimensions[1] = input->GetDimension(2);
break;
}
output->Initialize(input->GetPixelType(), 2, tmpDimensions, 1 /*input->GetNumberOfChannels()*/);
// initialize the spacing of the output
/*
Vector3D spacing = input->GetSlicedGeometry()->GetSpacing();
if(input->GetDimension()>=2)
spacing[2]=spacing[1];
else
spacing[2] = 1.0;
output->GetSlicedGeometry()->SetSpacing(spacing);
*/
output->SetPropertyList(input->GetPropertyList()->Clone());
}
diff --git a/Modules/ImageStatistics/mitkImageStatisticsCalculator.cpp b/Modules/ImageStatistics/mitkImageStatisticsCalculator.cpp
index 9a33945c9c..24941ef244 100644
--- a/Modules/ImageStatistics/mitkImageStatisticsCalculator.cpp
+++ b/Modules/ImageStatistics/mitkImageStatisticsCalculator.cpp
@@ -1,1028 +1,1036 @@
/*=========================================================================
Program: Medical Imaging & Interaction Toolkit
Language: C++
Date: $Date: 2009-05-12 19:56:03 +0200 (Di, 12 Mai 2009) $
Version: $Revision: 17179 $
Copyright (c) German Cancer Research Center, Division of Medical and
Biological Informatics. All rights reserved.
See MITKCopyright.txt or http://www.mitk.org/copyright.html for details.
This software is distributed WITHOUT ANY WARRANTY; without even
the implied warranty of MERCHANTABILITY or FITNESS FOR A PARTICULAR
PURPOSE. See the above copyright notices for more information.
=========================================================================*/
#include "mitkImageStatisticsCalculator.h"
#include "mitkImageAccessByItk.h"
+#include "mitkImageCast.h"
#include "mitkExtractImageFilter.h"
#include <itkScalarImageToHistogramGenerator.h>
#include <itkChangeInformationImageFilter.h>
#include <itkExtractImageFilter.h>
#include <itkStatisticsImageFilter.h>
#include <itkLabelStatisticsImageFilter.h>
#include <itkCastImageFilter.h>
#include <itkImageFileWriter.h>
#include <itkVTKImageImport.h>
#include <itkVTKImageExport.h>
#include <vtkPoints.h>
#include <vtkCellArray.h>
#include <vtkPolyData.h>
#include <vtkLinearExtrusionFilter.h>
#include <vtkPolyDataToImageStencil.h>
#include <vtkImageStencil.h>
#include <vtkImageImport.h>
#include <vtkImageExport.h>
#include <vtkImageData.h>
#if ( ( VTK_MAJOR_VERSION <= 5 ) && ( VTK_MINOR_VERSION<=8) )
#include "mitkvtkLassoStencilSource.h"
#else
#include "vtkLassoStencilSource.h"
#endif
#include <vtkMetaImageWriter.h>
#include <exception>
namespace mitk
{
ImageStatisticsCalculator::ImageStatisticsCalculator()
: m_MaskingMode( MASKING_MODE_NONE ),
m_MaskingModeChanged( false ),
m_DoIgnorePixelValue(false),
m_IgnorePixelValue(0.0),
m_IgnorePixelValueChanged(false)
{
m_EmptyHistogram = HistogramType::New();
HistogramType::SizeType histogramSize;
histogramSize.Fill( 256 );
m_EmptyHistogram->Initialize( histogramSize );
m_EmptyStatistics.Reset();
}
ImageStatisticsCalculator::~ImageStatisticsCalculator()
{
}
void ImageStatisticsCalculator::SetImage( const mitk::Image *image )
{
if ( m_Image != image )
{
m_Image = image;
this->Modified();
unsigned int numberOfTimeSteps = image->GetTimeSteps();
// Initialize vectors to time-size of this image
m_ImageHistogramVector.resize( numberOfTimeSteps );
m_MaskedImageHistogramVector.resize( numberOfTimeSteps );
m_PlanarFigureHistogramVector.resize( numberOfTimeSteps );
m_ImageStatisticsVector.resize( numberOfTimeSteps );
m_MaskedImageStatisticsVector.resize( numberOfTimeSteps );
m_PlanarFigureStatisticsVector.resize( numberOfTimeSteps );
m_ImageStatisticsTimeStampVector.resize( numberOfTimeSteps );
m_MaskedImageStatisticsTimeStampVector.resize( numberOfTimeSteps );
m_PlanarFigureStatisticsTimeStampVector.resize( numberOfTimeSteps );
m_ImageStatisticsCalculationTriggerVector.resize( numberOfTimeSteps );
m_MaskedImageStatisticsCalculationTriggerVector.resize( numberOfTimeSteps );
m_PlanarFigureStatisticsCalculationTriggerVector.resize( numberOfTimeSteps );
for ( unsigned int t = 0; t < image->GetTimeSteps(); ++t )
{
m_ImageStatisticsTimeStampVector[t].Modified();
m_ImageStatisticsCalculationTriggerVector[t] = true;
}
}
}
void ImageStatisticsCalculator::SetImageMask( const mitk::Image *imageMask )
{
if ( m_Image.IsNull() )
{
itkExceptionMacro( << "Image needs to be set first!" );
}
if ( m_Image->GetTimeSteps() != imageMask->GetTimeSteps() )
{
itkExceptionMacro( << "Image and image mask need to have equal number of time steps!" );
}
if ( m_ImageMask != imageMask )
{
m_ImageMask = imageMask;
this->Modified();
for ( unsigned int t = 0; t < m_Image->GetTimeSteps(); ++t )
{
m_MaskedImageStatisticsTimeStampVector[t].Modified();
m_MaskedImageStatisticsCalculationTriggerVector[t] = true;
}
}
}
-void ImageStatisticsCalculator::SetPlanarFigure( const mitk::PlanarFigure *planarFigure )
+void ImageStatisticsCalculator::SetPlanarFigure( mitk::PlanarFigure *planarFigure )
{
if ( m_Image.IsNull() )
{
itkExceptionMacro( << "Image needs to be set first!" );
}
if ( m_PlanarFigure != planarFigure )
{
m_PlanarFigure = planarFigure;
this->Modified();
for ( unsigned int t = 0; t < m_Image->GetTimeSteps(); ++t )
{
m_PlanarFigureStatisticsTimeStampVector[t].Modified();
m_PlanarFigureStatisticsCalculationTriggerVector[t] = true;
}
}
}
void ImageStatisticsCalculator::SetMaskingMode( unsigned int mode )
{
if ( m_MaskingMode != mode )
{
m_MaskingMode = mode;
m_MaskingModeChanged = true;
this->Modified();
}
}
void ImageStatisticsCalculator::SetMaskingModeToNone()
{
if ( m_MaskingMode != MASKING_MODE_NONE )
{
m_MaskingMode = MASKING_MODE_NONE;
m_MaskingModeChanged = true;
this->Modified();
}
}
void ImageStatisticsCalculator::SetMaskingModeToImage()
{
if ( m_MaskingMode != MASKING_MODE_IMAGE )
{
m_MaskingMode = MASKING_MODE_IMAGE;
m_MaskingModeChanged = true;
this->Modified();
}
}
void ImageStatisticsCalculator::SetMaskingModeToPlanarFigure()
{
if ( m_MaskingMode != MASKING_MODE_PLANARFIGURE )
{
m_MaskingMode = MASKING_MODE_PLANARFIGURE;
m_MaskingModeChanged = true;
this->Modified();
}
}
void ImageStatisticsCalculator::SetIgnorePixelValue(double value)
{
if ( m_IgnorePixelValue != value )
{
m_IgnorePixelValue = value;
if(m_DoIgnorePixelValue)
{
m_IgnorePixelValueChanged = true;
}
this->Modified();
}
}
double ImageStatisticsCalculator::GetIgnorePixelValue()
{
return m_IgnorePixelValue;
}
void ImageStatisticsCalculator::SetDoIgnorePixelValue(bool value)
{
if ( m_DoIgnorePixelValue != value )
{
m_DoIgnorePixelValue = value;
m_IgnorePixelValueChanged = true;
this->Modified();
}
}
bool ImageStatisticsCalculator::GetDoIgnorePixelValue()
{
return m_DoIgnorePixelValue;
}
bool ImageStatisticsCalculator::ComputeStatistics( unsigned int timeStep )
{
if ( m_Image.IsNull() )
{
itkExceptionMacro( << "Image not set!" );
}
if ( m_Image->GetReferenceCount() == 1 )
{
// Image no longer valid; we are the only ones to still hold a reference on it
return false;
}
if ( timeStep >= m_Image->GetTimeSteps() )
{
throw std::runtime_error( "Error: invalid time step!" );
}
// If a mask was set but we are the only ones to still hold a reference on
// it, delete it.
if ( m_ImageMask.IsNotNull() && (m_ImageMask->GetReferenceCount() == 1) )
{
m_ImageMask = NULL;
}
// Check if statistics is already up-to-date
unsigned long imageMTime = m_ImageStatisticsTimeStampVector[timeStep].GetMTime();
unsigned long maskedImageMTime = m_MaskedImageStatisticsTimeStampVector[timeStep].GetMTime();
unsigned long planarFigureMTime = m_PlanarFigureStatisticsTimeStampVector[timeStep].GetMTime();
bool imageStatisticsCalculationTrigger = m_ImageStatisticsCalculationTriggerVector[timeStep];
bool maskedImageStatisticsCalculationTrigger = m_MaskedImageStatisticsCalculationTriggerVector[timeStep];
bool planarFigureStatisticsCalculationTrigger = m_PlanarFigureStatisticsCalculationTriggerVector[timeStep];
if ( !m_IgnorePixelValueChanged
&& ((m_MaskingMode != MASKING_MODE_NONE) || (imageMTime > m_Image->GetMTime() && !imageStatisticsCalculationTrigger))
&& ((m_MaskingMode != MASKING_MODE_IMAGE) || (maskedImageMTime > m_ImageMask->GetMTime() && !maskedImageStatisticsCalculationTrigger))
&& ((m_MaskingMode != MASKING_MODE_PLANARFIGURE) || (planarFigureMTime > m_PlanarFigure->GetMTime() && !planarFigureStatisticsCalculationTrigger)) )
{
// Statistics is up to date!
if ( m_MaskingModeChanged )
{
m_MaskingModeChanged = false;
return true;
}
else
{
return false;
}
}
// Reset state changed flag
m_MaskingModeChanged = false;
m_IgnorePixelValueChanged = false;
// Depending on masking mode, extract and/or generate the required image
// and mask data from the user input
this->ExtractImageAndMask( timeStep );
Statistics *statistics;
HistogramType::ConstPointer *histogram;
switch ( m_MaskingMode )
{
case MASKING_MODE_NONE:
default:
{
if(!m_DoIgnorePixelValue)
{
statistics = &m_ImageStatisticsVector[timeStep];
histogram = &m_ImageHistogramVector[timeStep];
m_ImageStatisticsTimeStampVector[timeStep].Modified();
m_ImageStatisticsCalculationTriggerVector[timeStep] = false;
}
else
{
statistics = &m_MaskedImageStatisticsVector[timeStep];
histogram = &m_MaskedImageHistogramVector[timeStep];
m_MaskedImageStatisticsTimeStampVector[timeStep].Modified();
m_MaskedImageStatisticsCalculationTriggerVector[timeStep] = false;
}
break;
}
case MASKING_MODE_IMAGE:
statistics = &m_MaskedImageStatisticsVector[timeStep];
histogram = &m_MaskedImageHistogramVector[timeStep];
m_MaskedImageStatisticsTimeStampVector[timeStep].Modified();
m_MaskedImageStatisticsCalculationTriggerVector[timeStep] = false;
break;
case MASKING_MODE_PLANARFIGURE:
statistics = &m_PlanarFigureStatisticsVector[timeStep];
histogram = &m_PlanarFigureHistogramVector[timeStep];
m_PlanarFigureStatisticsTimeStampVector[timeStep].Modified();
m_PlanarFigureStatisticsCalculationTriggerVector[timeStep] = false;
break;
}
// Calculate statistics and histogram(s)
if ( m_InternalImage->GetDimension() == 3 )
{
if ( m_MaskingMode == MASKING_MODE_NONE && !m_DoIgnorePixelValue )
{
AccessFixedDimensionByItk_2(
m_InternalImage,
InternalCalculateStatisticsUnmasked,
3,
*statistics,
histogram );
}
else
{
AccessFixedDimensionByItk_3(
m_InternalImage,
InternalCalculateStatisticsMasked,
3,
m_InternalImageMask3D.GetPointer(),
*statistics,
histogram );
}
}
else if ( m_InternalImage->GetDimension() == 2 )
{
if ( m_MaskingMode == MASKING_MODE_NONE && !m_DoIgnorePixelValue )
{
AccessFixedDimensionByItk_2(
m_InternalImage,
InternalCalculateStatisticsUnmasked,
2,
*statistics,
histogram );
}
else
{
AccessFixedDimensionByItk_3(
m_InternalImage,
InternalCalculateStatisticsMasked,
2,
m_InternalImageMask2D.GetPointer(),
*statistics,
histogram );
}
}
else
{
MITK_ERROR << "ImageStatistics: Image dimension not supported!";
}
// Release unused image smart pointers to free memory
m_InternalImage = mitk::Image::ConstPointer();
m_InternalImageMask3D = MaskImage3DType::Pointer();
m_InternalImageMask2D = MaskImage2DType::Pointer();
return true;
}
const ImageStatisticsCalculator::HistogramType *
ImageStatisticsCalculator::GetHistogram( unsigned int timeStep ) const
{
if ( m_Image.IsNull() || (timeStep >= m_Image->GetTimeSteps()) )
{
return NULL;
}
switch ( m_MaskingMode )
{
case MASKING_MODE_NONE:
default:
{
if(m_DoIgnorePixelValue)
return m_MaskedImageHistogramVector[timeStep];
return m_ImageHistogramVector[timeStep];
}
case MASKING_MODE_IMAGE:
return m_MaskedImageHistogramVector[timeStep];
case MASKING_MODE_PLANARFIGURE:
return m_PlanarFigureHistogramVector[timeStep];
}
}
const ImageStatisticsCalculator::Statistics &
ImageStatisticsCalculator::GetStatistics( unsigned int timeStep ) const
{
if ( m_Image.IsNull() || (timeStep >= m_Image->GetTimeSteps()) )
{
return m_EmptyStatistics;
}
switch ( m_MaskingMode )
{
case MASKING_MODE_NONE:
default:
{
if(m_DoIgnorePixelValue)
return m_MaskedImageStatisticsVector[timeStep];
return m_ImageStatisticsVector[timeStep];
}
case MASKING_MODE_IMAGE:
return m_MaskedImageStatisticsVector[timeStep];
case MASKING_MODE_PLANARFIGURE:
return m_PlanarFigureStatisticsVector[timeStep];
}
}
void ImageStatisticsCalculator::ExtractImageAndMask( unsigned int timeStep )
{
if ( m_Image.IsNull() )
{
throw std::runtime_error( "Error: image empty!" );
}
if ( timeStep >= m_Image->GetTimeSteps() )
{
throw std::runtime_error( "Error: invalid time step!" );
}
ImageTimeSelector::Pointer imageTimeSelector = ImageTimeSelector::New();
imageTimeSelector->SetInput( m_Image );
imageTimeSelector->SetTimeNr( timeStep );
imageTimeSelector->UpdateLargestPossibleRegion();
mitk::Image *timeSliceImage = imageTimeSelector->GetOutput();
switch ( m_MaskingMode )
{
case MASKING_MODE_NONE:
{
m_InternalImage = timeSliceImage;
m_InternalImageMask2D = NULL;
m_InternalImageMask3D = NULL;
if(m_DoIgnorePixelValue)
{
- CastToItkImage( timeSliceImage, m_InternalImageMask3D );
- m_InternalImageMask3D->FillBuffer(1);
+ if( m_InternalImage->GetDimension() == 3 )
+ {
+ CastToItkImage( timeSliceImage, m_InternalImageMask3D );
+ m_InternalImageMask3D->FillBuffer(1);
+ }
+ if( m_InternalImage->GetDimension() == 2 )
+ {
+ CastToItkImage( timeSliceImage, m_InternalImageMask2D );
+ m_InternalImageMask2D->FillBuffer(1);
+ }
}
-
break;
}
case MASKING_MODE_IMAGE:
{
if ( m_ImageMask.IsNotNull() && (m_ImageMask->GetReferenceCount() > 1) )
{
if ( timeStep < m_ImageMask->GetTimeSteps() )
{
ImageTimeSelector::Pointer maskedImageTimeSelector = ImageTimeSelector::New();
maskedImageTimeSelector->SetInput( m_ImageMask );
maskedImageTimeSelector->SetTimeNr( timeStep );
maskedImageTimeSelector->UpdateLargestPossibleRegion();
mitk::Image *timeSliceMaskedImage = maskedImageTimeSelector->GetOutput();
m_InternalImage = timeSliceImage;
CastToItkImage( timeSliceMaskedImage, m_InternalImageMask3D );
}
else
{
throw std::runtime_error( "Error: image mask has not enough time steps!" );
}
}
else
{
throw std::runtime_error( "Error: image mask empty!" );
}
break;
}
case MASKING_MODE_PLANARFIGURE:
{
m_InternalImageMask2D = NULL;
if ( m_PlanarFigure.IsNull() )
{
throw std::runtime_error( "Error: planar figure empty!" );
}
if ( !m_PlanarFigure->IsClosed() )
{
throw std::runtime_error( "Masking not possible for non-closed figures" );
}
const Geometry3D *imageGeometry = timeSliceImage->GetGeometry();
if ( imageGeometry == NULL )
{
throw std::runtime_error( "Image geometry invalid!" );
}
const Geometry2D *planarFigureGeometry2D = m_PlanarFigure->GetGeometry2D();
if ( planarFigureGeometry2D == NULL )
{
throw std::runtime_error( "Planar-Figure not yet initialized!" );
}
const PlaneGeometry *planarFigureGeometry =
dynamic_cast< const PlaneGeometry * >( planarFigureGeometry2D );
if ( planarFigureGeometry == NULL )
{
throw std::runtime_error( "Non-planar planar figures not supported!" );
}
// Find principal direction of PlanarFigure in input image
unsigned int axis;
if ( !this->GetPrincipalAxis( imageGeometry,
planarFigureGeometry->GetNormal(), axis ) )
{
throw std::runtime_error( "Non-aligned planar figures not supported!" );
}
// Find slice number corresponding to PlanarFigure in input image
MaskImage3DType::IndexType index;
imageGeometry->WorldToIndex( planarFigureGeometry->GetOrigin(), index );
unsigned int slice = index[axis];
// Extract slice with given position and direction from image
ExtractImageFilter::Pointer imageExtractor = ExtractImageFilter::New();
imageExtractor->SetInput( timeSliceImage );
imageExtractor->SetSliceDimension( axis );
imageExtractor->SetSliceIndex( slice );
imageExtractor->Update();
m_InternalImage = imageExtractor->GetOutput();
// Compute mask from PlanarFigure
AccessFixedDimensionByItk_1(
m_InternalImage,
InternalCalculateMaskFromPlanarFigure,
2, axis );
}
}
if(m_DoIgnorePixelValue)
{
if ( m_InternalImage->GetDimension() == 3 )
{
AccessFixedDimensionByItk_1(
m_InternalImage,
InternalMaskIgnoredPixels,
3,
m_InternalImageMask3D.GetPointer() );
}
else if ( m_InternalImage->GetDimension() == 2 )
{
AccessFixedDimensionByItk_1(
m_InternalImage,
InternalMaskIgnoredPixels,
2,
m_InternalImageMask2D.GetPointer() );
}
}
}
bool ImageStatisticsCalculator::GetPrincipalAxis(
const Geometry3D *geometry, Vector3D vector,
unsigned int &axis )
{
vector.Normalize();
for ( unsigned int i = 0; i < 3; ++i )
{
Vector3D axisVector = geometry->GetAxisVector( i );
axisVector.Normalize();
if ( fabs( fabs( axisVector * vector ) - 1.0) < mitk::eps )
{
axis = i;
return true;
}
}
return false;
}
template < typename TPixel, unsigned int VImageDimension >
void ImageStatisticsCalculator::InternalCalculateStatisticsUnmasked(
const itk::Image< TPixel, VImageDimension > *image,
Statistics &statistics,
typename HistogramType::ConstPointer *histogram )
{
typedef itk::Image< TPixel, VImageDimension > ImageType;
typedef itk::Image< unsigned short, VImageDimension > MaskImageType;
typedef typename ImageType::IndexType IndexType;
typedef itk::Statistics::ScalarImageToHistogramGenerator< ImageType >
HistogramGeneratorType;
// Progress listening...
typedef itk::SimpleMemberCommand< ImageStatisticsCalculator > ITKCommandType;
ITKCommandType::Pointer progressListener;
progressListener = ITKCommandType::New();
progressListener->SetCallbackFunction( this,
&ImageStatisticsCalculator::UnmaskedStatisticsProgressUpdate );
// Issue 100 artificial progress events since ScalarIMageToHistogramGenerator
// does not (yet?) support progress reporting
this->InvokeEvent( itk::StartEvent() );
for ( unsigned int i = 0; i < 100; ++i )
{
this->UnmaskedStatisticsProgressUpdate();
}
// Calculate histogram
typename HistogramGeneratorType::Pointer histogramGenerator = HistogramGeneratorType::New();
histogramGenerator->SetInput( image );
histogramGenerator->SetMarginalScale( 100 ); // Defines y-margin width of histogram
histogramGenerator->SetNumberOfBins( 768 ); // CT range [-1024, +2048] --> bin size 4 values
histogramGenerator->SetHistogramMin( -1024.0 );
histogramGenerator->SetHistogramMax( 2048.0 );
histogramGenerator->Compute();
*histogram = histogramGenerator->GetOutput();
// Calculate statistics (separate filter)
typedef itk::StatisticsImageFilter< ImageType > StatisticsFilterType;
typename StatisticsFilterType::Pointer statisticsFilter = StatisticsFilterType::New();
statisticsFilter->SetInput( image );
unsigned long observerTag = statisticsFilter->AddObserver(
itk::ProgressEvent(), progressListener );
statisticsFilter->Update();
statisticsFilter->RemoveObserver( observerTag );
this->InvokeEvent( itk::EndEvent() );
statistics.N = image->GetBufferedRegion().GetNumberOfPixels();
statistics.Min = statisticsFilter->GetMinimum();
statistics.Max = statisticsFilter->GetMaximum();
statistics.Mean = statisticsFilter->GetMean();
statistics.Median = 0.0;
statistics.Sigma = statisticsFilter->GetSigma();
statistics.RMS = sqrt( statistics.Mean * statistics.Mean
+ statistics.Sigma * statistics.Sigma );
}
template < typename TPixel, unsigned int VImageDimension >
void ImageStatisticsCalculator::InternalMaskIgnoredPixels(
const itk::Image< TPixel, VImageDimension > *image,
itk::Image< unsigned short, VImageDimension > *maskImage )
{
typedef itk::Image< TPixel, VImageDimension > ImageType;
typedef itk::Image< unsigned short, VImageDimension > MaskImageType;
itk::ImageRegionIterator<MaskImageType>
itmask(maskImage, maskImage->GetLargestPossibleRegion());
itk::ImageRegionConstIterator<ImageType>
itimage(image, image->GetLargestPossibleRegion());
itmask = itmask.Begin();
itimage = itimage.Begin();
while( !itmask.IsAtEnd() )
{
if(m_IgnorePixelValue == itimage.Get())
{
itmask.Set(0);
}
++itmask;
++itimage;
}
}
template < typename TPixel, unsigned int VImageDimension >
void ImageStatisticsCalculator::InternalCalculateStatisticsMasked(
const itk::Image< TPixel, VImageDimension > *image,
itk::Image< unsigned short, VImageDimension > *maskImage,
Statistics &statistics,
typename HistogramType::ConstPointer *histogram )
{
typedef itk::Image< TPixel, VImageDimension > ImageType;
typedef itk::Image< unsigned short, VImageDimension > MaskImageType;
typedef typename ImageType::IndexType IndexType;
typedef typename ImageType::PointType PointType;
typedef typename ImageType::SpacingType SpacingType;
typedef itk::LabelStatisticsImageFilter< ImageType, MaskImageType > LabelStatisticsFilterType;
typedef itk::ChangeInformationImageFilter< MaskImageType > ChangeInformationFilterType;
typedef itk::ExtractImageFilter< ImageType, ImageType > ExtractImageFilterType;
// Make sure that mask is set
if ( maskImage == NULL )
{
itkExceptionMacro( << "Mask image needs to be set!" );
}
// Make sure that spacing of mask and image are the same
SpacingType imageSpacing = image->GetSpacing();
SpacingType maskSpacing = maskImage->GetSpacing();
PointType zeroPoint; zeroPoint.Fill( 0.0 );
if ( (zeroPoint + imageSpacing).SquaredEuclideanDistanceTo( (zeroPoint + maskSpacing) ) > mitk::eps )
{
itkExceptionMacro( << "Mask needs to have same spacing as image! (Image spacing: " << imageSpacing << "; Mask spacing: " << maskSpacing << ")" );
}
// Make sure that the voxels of mask and image are correctly "aligned", i.e., voxel boundaries are the same in both images
PointType imageOrigin = image->GetOrigin();
PointType maskOrigin = maskImage->GetOrigin();
long offset[ImageType::ImageDimension];
for ( unsigned int i = 0; i < ImageType::ImageDimension; ++i )
{
double indexCoordDistance = (maskOrigin[i] - imageOrigin[i]) / imageSpacing[i];
double misalignment = indexCoordDistance - floor( indexCoordDistance + 0.5 );
if ( fabs( misalignment ) > imageSpacing[i] / 20.0 )
{
itkExceptionMacro( << "Pixels/voxels of mask and image are not sufficiently aligned! (Misalignment: " << misalignment << ")" );
}
offset[i] = (int) indexCoordDistance + image->GetBufferedRegion().GetIndex()[i];
}
// Adapt the origin and region (index/size) of the mask so that the origin of both are the same
typename ChangeInformationFilterType::Pointer adaptMaskFilter;
adaptMaskFilter = ChangeInformationFilterType::New();
adaptMaskFilter->ChangeOriginOn();
adaptMaskFilter->ChangeRegionOn();
adaptMaskFilter->SetInput( maskImage );
adaptMaskFilter->SetOutputOrigin( image->GetOrigin() );
adaptMaskFilter->SetOutputOffset( offset );
adaptMaskFilter->Update();
typename MaskImageType::Pointer adaptedMaskImage = adaptMaskFilter->GetOutput();
// Make sure that mask region is contained within image region
if ( !image->GetLargestPossibleRegion().IsInside( adaptedMaskImage->GetLargestPossibleRegion() ) )
{
itkExceptionMacro( << "Mask region needs to be inside of image region! (Image region: "
<< image->GetLargestPossibleRegion() << "; Mask region: " << adaptedMaskImage->GetLargestPossibleRegion() << ")" );
}
// If mask region is smaller than image region, extract the sub-sampled region from the original image
typename ImageType::SizeType imageSize = image->GetBufferedRegion().GetSize();
typename ImageType::SizeType maskSize = maskImage->GetBufferedRegion().GetSize();
bool maskSmallerImage = false;
for ( unsigned int i = 0; i < ImageType::ImageDimension; ++i )
{
if ( maskSize[i] < imageSize[i] )
{
maskSmallerImage = true;
}
}
typename ImageType::ConstPointer adaptedImage;
if ( maskSmallerImage )
{
typename ExtractImageFilterType::Pointer extractImageFilter = ExtractImageFilterType::New();
extractImageFilter->SetInput( image );
extractImageFilter->SetExtractionRegion( adaptedMaskImage->GetBufferedRegion() );
extractImageFilter->Update();
adaptedImage = extractImageFilter->GetOutput();
}
else
{
adaptedImage = image;
}
// Initialize Filter
typename LabelStatisticsFilterType::Pointer labelStatisticsFilter;
labelStatisticsFilter = LabelStatisticsFilterType::New();
labelStatisticsFilter->SetInput( adaptedImage );
labelStatisticsFilter->SetLabelInput( adaptedMaskImage );
labelStatisticsFilter->UseHistogramsOn();
labelStatisticsFilter->SetHistogramParameters( 384, -1024.0, 2048.0);
// Add progress listening
typedef itk::SimpleMemberCommand< ImageStatisticsCalculator > ITKCommandType;
ITKCommandType::Pointer progressListener;
progressListener = ITKCommandType::New();
progressListener->SetCallbackFunction( this,
&ImageStatisticsCalculator::MaskedStatisticsProgressUpdate );
unsigned long observerTag = labelStatisticsFilter->AddObserver(
itk::ProgressEvent(), progressListener );
// Execute filter
this->InvokeEvent( itk::StartEvent() );
// Make sure that only the mask region is considered (otherwise, if the mask region is smaller
// than the image region, the Update() would result in an exception).
labelStatisticsFilter->GetOutput()->SetRequestedRegion( adaptedMaskImage->GetLargestPossibleRegion() );
// Execute the filter
labelStatisticsFilter->Update();
this->InvokeEvent( itk::EndEvent() );
labelStatisticsFilter->RemoveObserver( observerTag );
// Find label of mask (other than 0)
bool maskNonEmpty = false;
unsigned int i;
for ( i = 1; i < 4096; ++i )
{
if ( labelStatisticsFilter->HasLabel( i ) )
{
maskNonEmpty = true;
break;
}
}
if ( maskNonEmpty )
{
*histogram = labelStatisticsFilter->GetHistogram( i );
statistics.N = labelStatisticsFilter->GetCount( i );
statistics.Min = labelStatisticsFilter->GetMinimum( i );
statistics.Max = labelStatisticsFilter->GetMaximum( i );
statistics.Mean = labelStatisticsFilter->GetMean( i );
statistics.Median = labelStatisticsFilter->GetMedian( i );
statistics.Sigma = labelStatisticsFilter->GetSigma( i );
statistics.RMS = sqrt( statistics.Mean * statistics.Mean
+ statistics.Sigma * statistics.Sigma );
}
else
{
*histogram = m_EmptyHistogram;
statistics.Reset();
}
}
template < typename TPixel, unsigned int VImageDimension >
void ImageStatisticsCalculator::InternalCalculateMaskFromPlanarFigure(
const itk::Image< TPixel, VImageDimension > *image, unsigned int axis )
{
typedef itk::Image< TPixel, VImageDimension > ImageType;
typedef itk::CastImageFilter< ImageType, MaskImage2DType > CastFilterType;
// Generate mask image as new image with same header as input image and
// initialize with "1".
typename CastFilterType::Pointer castFilter = CastFilterType::New();
castFilter->SetInput( image );
castFilter->Update();
castFilter->GetOutput()->FillBuffer( 1 );
// all PolylinePoints of the PlanarFigure are stored in a vtkPoints object.
// These points are used by the vtkLassoStencilSource to create
// a vtkImageStencil.
const mitk::Geometry2D *planarFigureGeometry2D = m_PlanarFigure->GetGeometry2D();
const typename PlanarFigure::PolyLineType planarFigurePolyline = m_PlanarFigure->GetPolyLine( 0 );
const mitk::Geometry3D *imageGeometry3D = m_Image->GetGeometry( 0 );
// Determine x- and y-dimensions depending on principal axis
int i0, i1;
switch ( axis )
{
case 0:
i0 = 1;
i1 = 2;
break;
case 1:
i0 = 0;
i1 = 2;
break;
case 2:
default:
i0 = 0;
i1 = 1;
break;
}
// store the polyline contour as vtkPoints object
bool outOfBounds = false;
vtkSmartPointer<vtkPoints> points = vtkPoints::New();
typename PlanarFigure::PolyLineType::const_iterator it;
const Vector3D& imageSpacing3D = imageGeometry3D->GetSpacing();
for ( it = planarFigurePolyline.begin();
it != planarFigurePolyline.end();
++it )
{
Point3D point3D;
// Convert 2D point back to the local index coordinates of the selected
// image
planarFigureGeometry2D->Map( it->Point, point3D );
// Polygons (partially) outside of the image bounds can not be processed
// further due to a bug in vtkPolyDataToImageStencil
if ( !imageGeometry3D->IsInside( point3D ) )
{
outOfBounds = true;
}
imageGeometry3D->WorldToIndex( point3D, point3D );
points->InsertNextPoint( point3D[i0], point3D[i1], 0 );
}
if ( outOfBounds )
{
throw std::runtime_error( "Figure at least partially outside of image bounds!" );
}
// create a vtkLassoStencilSource and set the points of the Polygon
vtkSmartPointer<vtkLassoStencilSource> lassoStencil = vtkLassoStencilSource::New();
lassoStencil->SetShapeToPolygon();
lassoStencil->SetPoints( points );
// Export from ITK to VTK (to use a VTK filter)
typedef itk::VTKImageImport< MaskImage2DType > ImageImportType;
typedef itk::VTKImageExport< MaskImage2DType > ImageExportType;
typename ImageExportType::Pointer itkExporter = ImageExportType::New();
itkExporter->SetInput( castFilter->GetOutput() );
vtkSmartPointer<vtkImageImport> vtkImporter = vtkImageImport::New();
this->ConnectPipelines( itkExporter, vtkImporter );
// Apply the generated image stencil to the input image
vtkSmartPointer<vtkImageStencil> imageStencilFilter = vtkImageStencil::New();
imageStencilFilter->SetInputConnection( vtkImporter->GetOutputPort() );
imageStencilFilter->SetStencil( lassoStencil->GetOutput() );
imageStencilFilter->ReverseStencilOff();
imageStencilFilter->SetBackgroundValue( 0 );
imageStencilFilter->Update();
// Export from VTK back to ITK
vtkSmartPointer<vtkImageExport> vtkExporter = vtkImageExport::New();
vtkExporter->SetInputConnection( imageStencilFilter->GetOutputPort() );
vtkExporter->Update();
typename ImageImportType::Pointer itkImporter = ImageImportType::New();
this->ConnectPipelines( vtkExporter, itkImporter );
itkImporter->Update();
// Store mask
m_InternalImageMask2D = itkImporter->GetOutput();
// Clean up VTK objects
vtkImporter->Delete();
imageStencilFilter->Delete();
//vtkExporter->Delete(); // TODO: crashes when outcommented; memory leak??
}
void ImageStatisticsCalculator::UnmaskedStatisticsProgressUpdate()
{
// Need to throw away every second progress event to reach a final count of
// 100 since two consecutive filters are used in this case
static int updateCounter = 0;
if ( updateCounter++ % 2 == 0 )
{
this->InvokeEvent( itk::ProgressEvent() );
}
}
void ImageStatisticsCalculator::MaskedStatisticsProgressUpdate()
{
this->InvokeEvent( itk::ProgressEvent() );
}
}
diff --git a/Modules/ImageStatistics/mitkImageStatisticsCalculator.h b/Modules/ImageStatistics/mitkImageStatisticsCalculator.h
index 96498533ea..da96371055 100644
--- a/Modules/ImageStatistics/mitkImageStatisticsCalculator.h
+++ b/Modules/ImageStatistics/mitkImageStatisticsCalculator.h
@@ -1,298 +1,298 @@
/*=========================================================================
Program: Medical Imaging & Interaction Toolkit
Language: C++
Date: $Date: 2009-05-12 19:56:03 +0200 (Di, 12 Mai 2009) $
Version: $Revision: 17179 $
Copyright (c) German Cancer Research Center, Division of Medical and
Biological Informatics. All rights reserved.
See MITKCopyright.txt or http://www.mitk.org/copyright.html for details.
This software is distributed WITHOUT ANY WARRANTY; without even
the implied warranty of MERCHANTABILITY or FITNESS FOR A PARTICULAR
PURPOSE. See the above copyright notices for more information.
=========================================================================*/
#ifndef _MITK_IMAGESTATISTICSCALCULATOR_H
#define _MITK_IMAGESTATISTICSCALCULATOR_H
#include <itkObject.h>
#include "ImageStatisticsExports.h"
#include <itkImage.h>
#include <itkTimeStamp.h>
#include "mitkImage.h"
#include "mitkImageTimeSelector.h"
#include "mitkPlanarFigure.h"
#include <vtkSmartPointer.h>
namespace mitk
{
/**
* \brief Class for calculating statistics and histogram for an (optionally
* masked) image.
*
* Images can be masked by either a (binary) image (of the same dimensions as
* the original image) or by a closed mitk::PlanarFigure, e.g. a circle or
* polygon. When masking with a planar figure, the slice corresponding to the
* plane containing the figure is extracted and then clipped with contour
* defined by the figure. Planar figures need to be aligned along the main axes
* of the image (transversal, sagittal, coronal). Planar figures on arbitrary
* rotated planes are not supported.
*
* For each operating mode (no masking, masking by image, masking by planar
* figure), the calculated statistics and histogram are cached so that, when
* switching back and forth between operation modes without modifying mask or
* image, the information doesn't need to be recalculated.
*
* Note: currently time-resolved and multi-channel pictures are not properly
* supported.
*/
class ImageStatistics_EXPORT ImageStatisticsCalculator : public itk::Object
{
public:
enum
{
MASKING_MODE_NONE = 0,
MASKING_MODE_IMAGE,
MASKING_MODE_PLANARFIGURE
};
typedef mitk::Image::HistogramType HistogramType;
typedef mitk::Image::HistogramType::ConstIterator HistogramConstIteratorType;
struct Statistics
{
unsigned int N;
double Min;
double Max;
double Mean;
double Median;
double Variance;
double Sigma;
double RMS;
void Reset()
{
N = 0;
Min = 0.0;
Max = 0.0;
Mean = 0.0;
Median = 0.0;
Variance = 0.0;
Sigma = 0.0;
RMS = 0.0;
}
};
mitkClassMacro( ImageStatisticsCalculator, itk::Object );
itkNewMacro( ImageStatisticsCalculator );
/** \brief Set image from which to compute statistics. */
void SetImage( const mitk::Image *image );
/** \brief Set binary image for masking. */
void SetImageMask( const mitk::Image *imageMask );
/** \brief Set planar figure for masking. */
- void SetPlanarFigure( const mitk::PlanarFigure *planarFigure );
+ void SetPlanarFigure( mitk::PlanarFigure *planarFigure );
/** \brief Set/Get operation mode for masking */
void SetMaskingMode( unsigned int mode );
/** \brief Set/Get operation mode for masking */
itkGetMacro( MaskingMode, unsigned int );
/** \brief Set/Get operation mode for masking */
void SetMaskingModeToNone();
/** \brief Set/Get operation mode for masking */
void SetMaskingModeToImage();
/** \brief Set/Get operation mode for masking */
void SetMaskingModeToPlanarFigure();
/** \brief Set a pixel value for pixels that will be ignored in the statistics */
void SetIgnorePixelValue(double value);
/** \brief Get the pixel value for pixels that will be ignored in the statistics */
double GetIgnorePixelValue();
/** \brief Set wether a pixel value should be ignored in the statistics */
void SetDoIgnorePixelValue(bool doit);
/** \brief Get wether a pixel value will be ignored in the statistics */
bool GetDoIgnorePixelValue();
/** \brief Compute statistics (together with histogram) for the current
* masking mode.
*
* Computation is not executed if statistics is already up to date. In this
* case, false is returned; otherwise, true.*/
virtual bool ComputeStatistics( unsigned int timeStep = 0 );
/** \brief Retrieve the histogram depending on the current masking mode. */
const HistogramType *GetHistogram( unsigned int timeStep = 0 ) const;
/** \brief Retrieve statistics depending on the current masking mode. */
const Statistics &GetStatistics( unsigned int timeStep = 0 ) const;
protected:
typedef std::vector< HistogramType::ConstPointer > HistogramVectorType;
typedef std::vector< Statistics > StatisticsVectorType;
typedef std::vector< itk::TimeStamp > TimeStampVectorType;
typedef std::vector< bool > BoolVectorType;
typedef itk::Image< unsigned short, 3 > MaskImage3DType;
typedef itk::Image< unsigned short, 2 > MaskImage2DType;
ImageStatisticsCalculator();
virtual ~ImageStatisticsCalculator();
/** \brief Depending on the masking mode, the image and mask from which to
* calculate statistics is extracted from the original input image and mask
* data.
*
* For example, a when using a PlanarFigure as mask, the 2D image slice
* corresponding to the PlanarFigure will be extracted from the original
* image. If masking is disabled, the original image is simply passed
* through. */
void ExtractImageAndMask( unsigned int timeStep = 0 );
/** \brief If the passed vector matches any of the three principal axes
* of the passed geometry, the ínteger value corresponding to the axis
* is set and true is returned. */
bool GetPrincipalAxis( const Geometry3D *geometry, Vector3D vector,
unsigned int &axis );
template < typename TPixel, unsigned int VImageDimension >
void InternalCalculateStatisticsUnmasked(
const itk::Image< TPixel, VImageDimension > *image,
Statistics &statistics,
typename HistogramType::ConstPointer *histogram );
template < typename TPixel, unsigned int VImageDimension >
void InternalCalculateStatisticsMasked(
const itk::Image< TPixel, VImageDimension > *image,
itk::Image< unsigned short, VImageDimension > *maskImage,
Statistics &statistics,
typename HistogramType::ConstPointer *histogram );
template < typename TPixel, unsigned int VImageDimension >
void InternalCalculateMaskFromPlanarFigure(
const itk::Image< TPixel, VImageDimension > *image, unsigned int axis );
template < typename TPixel, unsigned int VImageDimension >
void InternalMaskIgnoredPixels(
const itk::Image< TPixel, VImageDimension > *image,
itk::Image< unsigned short, VImageDimension > *maskImage );
/** Connection from ITK to VTK */
template <typename ITK_Exporter, typename VTK_Importer>
void ConnectPipelines(ITK_Exporter exporter, vtkSmartPointer<VTK_Importer> importer)
{
importer->SetUpdateInformationCallback(exporter->GetUpdateInformationCallback());
importer->SetPipelineModifiedCallback(exporter->GetPipelineModifiedCallback());
importer->SetWholeExtentCallback(exporter->GetWholeExtentCallback());
importer->SetSpacingCallback(exporter->GetSpacingCallback());
importer->SetOriginCallback(exporter->GetOriginCallback());
importer->SetScalarTypeCallback(exporter->GetScalarTypeCallback());
importer->SetNumberOfComponentsCallback(exporter->GetNumberOfComponentsCallback());
importer->SetPropagateUpdateExtentCallback(exporter->GetPropagateUpdateExtentCallback());
importer->SetUpdateDataCallback(exporter->GetUpdateDataCallback());
importer->SetDataExtentCallback(exporter->GetDataExtentCallback());
importer->SetBufferPointerCallback(exporter->GetBufferPointerCallback());
importer->SetCallbackUserData(exporter->GetCallbackUserData());
}
/** Connection from VTK to ITK */
template <typename VTK_Exporter, typename ITK_Importer>
void ConnectPipelines(vtkSmartPointer<VTK_Exporter> exporter, ITK_Importer importer)
{
importer->SetUpdateInformationCallback(exporter->GetUpdateInformationCallback());
importer->SetPipelineModifiedCallback(exporter->GetPipelineModifiedCallback());
importer->SetWholeExtentCallback(exporter->GetWholeExtentCallback());
importer->SetSpacingCallback(exporter->GetSpacingCallback());
importer->SetOriginCallback(exporter->GetOriginCallback());
importer->SetScalarTypeCallback(exporter->GetScalarTypeCallback());
importer->SetNumberOfComponentsCallback(exporter->GetNumberOfComponentsCallback());
importer->SetPropagateUpdateExtentCallback(exporter->GetPropagateUpdateExtentCallback());
importer->SetUpdateDataCallback(exporter->GetUpdateDataCallback());
importer->SetDataExtentCallback(exporter->GetDataExtentCallback());
importer->SetBufferPointerCallback(exporter->GetBufferPointerCallback());
importer->SetCallbackUserData(exporter->GetCallbackUserData());
}
void UnmaskedStatisticsProgressUpdate();
void MaskedStatisticsProgressUpdate();
-
+ /** m_Image contains the input image (e.g. 2D, 3D, 3D+t)*/
mitk::Image::ConstPointer m_Image;
mitk::Image::ConstPointer m_ImageMask;
- mitk::PlanarFigure::ConstPointer m_PlanarFigure;
+ mitk::PlanarFigure::Pointer m_PlanarFigure;
HistogramVectorType m_ImageHistogramVector;
HistogramVectorType m_MaskedImageHistogramVector;
HistogramVectorType m_PlanarFigureHistogramVector;
HistogramType::Pointer m_EmptyHistogram;
StatisticsVectorType m_ImageStatisticsVector;
StatisticsVectorType m_MaskedImageStatisticsVector;
StatisticsVectorType m_PlanarFigureStatisticsVector;
Statistics m_EmptyStatistics;
unsigned int m_MaskingMode;
bool m_MaskingModeChanged;
-
+ /** m_InternalImage contains a image volume at one time step (e.g. 2D, 3D)*/
mitk::Image::ConstPointer m_InternalImage;
MaskImage3DType::Pointer m_InternalImageMask3D;
MaskImage2DType::Pointer m_InternalImageMask2D;
TimeStampVectorType m_ImageStatisticsTimeStampVector;
TimeStampVectorType m_MaskedImageStatisticsTimeStampVector;
TimeStampVectorType m_PlanarFigureStatisticsTimeStampVector;
BoolVectorType m_ImageStatisticsCalculationTriggerVector;
BoolVectorType m_MaskedImageStatisticsCalculationTriggerVector;
BoolVectorType m_PlanarFigureStatisticsCalculationTriggerVector;
double m_IgnorePixelValue;
bool m_DoIgnorePixelValue;
bool m_IgnorePixelValueChanged;
};
}
#endif // #define _MITK_IMAGESTATISTICSCALCULATOR_H
diff --git a/Modules/MitkExt/Algorithms/mitkBoundingObjectToSegmentationFilter.cpp b/Modules/MitkExt/Algorithms/mitkBoundingObjectToSegmentationFilter.cpp
index 3c7b5dbe90..55411b9788 100644
--- a/Modules/MitkExt/Algorithms/mitkBoundingObjectToSegmentationFilter.cpp
+++ b/Modules/MitkExt/Algorithms/mitkBoundingObjectToSegmentationFilter.cpp
@@ -1,120 +1,122 @@
/*=========================================================================
Program: Medical Imaging & Interaction Toolkit
Language: C++
Date: $Date$
Version: $Revision: 27918 $
Copyright (c) German Cancer Research Center, Division of Medical and
Biological Informatics. All rights reserved.
See MITKCopyright.txt or http://www.mitk.org/copyright.html for details.
This software is distributed WITHOUT ANY WARRANTY; without even
the implied warranty of MERCHANTABILITY or FITNESS FOR A PARTICULAR
PURPOSE. See the above copyright notices for more information.
=========================================================================*/
#include "mitkBoundingObjectToSegmentationFilter.h"
#include "mitkImageCast.h"
+#include <itkImageRegionIteratorWithIndex.h>
+
mitk::BoundingObjectToSegmentationFilter::BoundingObjectToSegmentationFilter()
{
this->SetNumberOfRequiredInputs(1);
}
mitk::BoundingObjectToSegmentationFilter::~BoundingObjectToSegmentationFilter()
{
}
void mitk::BoundingObjectToSegmentationFilter::SetBoundingObject(mitk::BoundingObject::Pointer boundingObject)
{
mitk::BoundingObjectGroup* testgroup = dynamic_cast<mitk::BoundingObjectGroup*> (boundingObject.GetPointer());
if (testgroup)
m_boundingObjectGroup = testgroup;
else
{
m_boundingObjectGroup = mitk::BoundingObjectGroup::New();
m_boundingObjectGroup->AddBoundingObject(boundingObject);
}
}
void mitk::BoundingObjectToSegmentationFilter::GenerateData()
{
typedef itk::Image<unsigned char, 3> itkImageType;
mitk::Image::Pointer outputImage = this->GetOutput();
mitk::Image::ConstPointer inputImage = this->GetInput();
outputImage->Initialize(inputImage);
itkImageType::Pointer itkImage;
CastToItkImage(outputImage, itkImage);
itkImage->FillBuffer(0);
for (unsigned int i=0; i<m_boundingObjectGroup->GetCount(); i++)
{
//create region for boundingobject
mitk::BoundingObject::Pointer boundingObject = m_boundingObjectGroup->GetBoundingObjects().at(i);
mitk::Geometry3D::Pointer boGeometry = boundingObject->GetGeometry();
mitk::Geometry3D::Pointer inputImageGeometry = inputImage->GetSlicedGeometry();
mitk::BoundingBox::Pointer boToIm = boGeometry->CalculateBoundingBoxRelativeToTransform(inputImageGeometry->GetIndexToWorldTransform());
mitk::BoundingBox::ConstPointer imgBB = inputImageGeometry->GetBoundingBox();
mitk::BoundingBox::PointType minImg = imgBB->GetMinimum();
mitk::BoundingBox::PointType maxImg = imgBB->GetMaximum();
itkImageType::IndexType boIndex;
itkImageType::SizeType boSize;
mitk::BoundingBox::PointType min = boToIm->GetMinimum();
mitk::BoundingBox::PointType max = boToIm->GetMaximum();
//check if boundingbox is inside imageregion
for (int i =0; i<3; i++)
{
if (min [i] < minImg[i])
min[i] = minImg[i];
if (max [i] < minImg[i])
max[i] = minImg[i];
if (max[i] > maxImg[i])
max[i] = maxImg[i];
if (min [i] > maxImg[i])
min[i] = maxImg[i]-1;
}
// add 0.5 (boGeometry is no image geometry)
boIndex[0] = (mitk::SlicedData::IndexType::IndexValueType)(min[0] + 0.5);
boIndex[1] = (mitk::SlicedData::IndexType::IndexValueType)(min[1] + 0.5);
boIndex[2] = (mitk::SlicedData::IndexType::IndexValueType)(min[2] + 0.5);
// add 1 because we need 0.5 for each index
boSize[0] = (mitk::SlicedData::IndexType::IndexValueType) (max[0]-min[0]);
boSize[1] = (mitk::SlicedData::IndexType::IndexValueType) (max[1]-min[1]);
boSize[2] = (mitk::SlicedData::IndexType::IndexValueType) (max[2]-min[2]);
itkImageType::RegionType region(boIndex, boSize);
//create region iterator
itk::ImageRegionIteratorWithIndex<itkImageType> itBoundingObject = itk::ImageRegionIteratorWithIndex<itkImageType>(itkImage, region );
itBoundingObject.GoToBegin();
while(!itBoundingObject.IsAtEnd())
{
itkImageType::IndexType index = itBoundingObject.GetIndex();
mitk::Point3D p;
p[0] = index[0];
p[1] = index[1];
p[2] = index[2];
inputImageGeometry->IndexToWorld(p,p);
if (boundingObject->IsInside(p) && boundingObject->GetPositive())
itBoundingObject.Set(1);
else if (boundingObject->IsInside(p) && !boundingObject->GetPositive())
itBoundingObject.Set(0);
++itBoundingObject;
}
}
CastToMitkImage(itkImage, outputImage);
-}
\ No newline at end of file
+}
diff --git a/Modules/MitkExt/Algorithms/mitkCalculateSegmentationVolume.cpp b/Modules/MitkExt/Algorithms/mitkCalculateSegmentationVolume.cpp
index a339453733..3301d2b6eb 100644
--- a/Modules/MitkExt/Algorithms/mitkCalculateSegmentationVolume.cpp
+++ b/Modules/MitkExt/Algorithms/mitkCalculateSegmentationVolume.cpp
@@ -1,123 +1,125 @@
/*=========================================================================
Program: Medical Imaging & Interaction Toolkit
Language: C++
Date: $Date$
Version: $Revision$
Copyright (c) German Cancer Research Center, Division of Medical and
Biological Informatics. All rights reserved.
See MITKCopyright.txt or http://www.mitk.org/copyright.html for details.
This software is distributed WITHOUT ANY WARRANTY; without even
the implied warranty of MERCHANTABILITY or FITNESS FOR A PARTICULAR
PURPOSE. See the above copyright notices for more information.
=========================================================================*/
+#include <mitkImageAccessByItk.h>
+
#include "mitkCalculateSegmentationVolume.h"
#include "itkImageRegionConstIteratorWithIndex.h"
#include <limits>
namespace mitk
{
CalculateSegmentationVolume::CalculateSegmentationVolume()
{
}
CalculateSegmentationVolume::~CalculateSegmentationVolume()
{
}
template < typename TPixel, unsigned int VImageDimension >
void CalculateSegmentationVolume::ItkImageProcessing( itk::Image< TPixel, VImageDimension >* itkImage, TPixel* itkNotUsed(dummy) )
{
itk::ImageRegionConstIteratorWithIndex<itk::Image<TPixel, VImageDimension> > iterBinaryImage( itkImage, itkImage->GetLargestPossibleRegion() );
typename itk::ImageRegionConstIteratorWithIndex<itk::Image<TPixel, VImageDimension> >::IndexType currentIndex;
typename itk::ImageRegionConstIteratorWithIndex<itk::Image<TPixel, VImageDimension> >::IndexType minIndex;
for (unsigned int i = 0; i < VImageDimension; ++i) minIndex[i] = std::numeric_limits<long int>::max();
typename itk::ImageRegionConstIteratorWithIndex<itk::Image<TPixel, VImageDimension> >::IndexType maxIndex;
for (unsigned int i = 0; i < VImageDimension; ++i) maxIndex[i] = std::numeric_limits<long int>::min();
m_CenterOfMass.Fill(0.0);
m_Volume = 0;
while (!iterBinaryImage.IsAtEnd())
{
if ( iterBinaryImage.Get() > static_cast<TPixel>(0.0) )
{
// update center of mass
currentIndex = iterBinaryImage.GetIndex();
itk::Vector<float, VImageDimension> currentPoint;
for (unsigned int i = 0; i < VImageDimension; ++i) currentPoint[i] = currentIndex[i];
m_CenterOfMass = (m_CenterOfMass * ( static_cast<float>(m_Volume) / static_cast<float>(m_Volume+1) ) ) // e.g. 3 points: old center * 2/3 + currentPoint * 1/3;
+ currentPoint / static_cast<float>(m_Volume+1);
// update number of voxels
++m_Volume;
// update bounding box
for (unsigned int i = 0; i < VImageDimension; ++i)
{
if (currentIndex[i] < minIndex[i]) minIndex[i] = currentIndex[i];
if (currentIndex[i] > maxIndex[i]) maxIndex[i] = currentIndex[i];
}
}
++iterBinaryImage;
}
m_MinIndexOfBoundingBox[2] = 0.0;
m_MaxIndexOfBoundingBox[2] = 0.0;
for (unsigned int i = 0; i < VImageDimension; ++i)
{
m_MinIndexOfBoundingBox[i] = minIndex[i];
m_MaxIndexOfBoundingBox[i] = maxIndex[i];
}
}
bool CalculateSegmentationVolume::ReadyToRun()
{
Image::Pointer image;
GetPointerParameter("Input", image);
return image.IsNotNull() && GetGroupNode();
}
bool CalculateSegmentationVolume::ThreadedUpdateFunction()
{
// get image
Image::Pointer image;
GetPointerParameter("Input", image);
AccessFixedDimensionByItk( image.GetPointer(), ItkImageProcessing, 3 ); // some magic to call the correctly templated function (we only do 3D images here!)
// consider single voxel volume
Vector3D spacing = image->GetSlicedGeometry()->GetSpacing(); // spacing in mm
float volumeML = (ScalarType) m_Volume * spacing[0] * spacing[1] * spacing[2] / 1000.0; // convert to ml
DataNode* groupNode = GetGroupNode();
if (groupNode)
{
groupNode->SetProperty( "volume", FloatProperty::New(volumeML) );
groupNode->SetProperty( "centerOfMass", Vector3DProperty::New(m_CenterOfMass) );
groupNode->SetProperty( "boundingBoxMinimum", Vector3DProperty::New(m_MinIndexOfBoundingBox) );
groupNode->SetProperty( "boundingBoxMaximum", Vector3DProperty::New(m_MaxIndexOfBoundingBox) );
groupNode->SetProperty( "showVolume", BoolProperty::New(true) );
}
return true;
}
} // namespace
diff --git a/Modules/MitkExt/Algorithms/mitkContourUtils.cpp b/Modules/MitkExt/Algorithms/mitkContourUtils.cpp
index c8cb136f73..483eba1f23 100644
--- a/Modules/MitkExt/Algorithms/mitkContourUtils.cpp
+++ b/Modules/MitkExt/Algorithms/mitkContourUtils.cpp
@@ -1,166 +1,171 @@
/*=========================================================================
Program: Medical Imaging & Interaction Toolkit
Language: C++
Date: $Date$
Version: $Revision: 1.12 $
Copyright (c) German Cancer Research Center, Division of Medical and
Biological Informatics. All rights reserved.
See MITKCopyright.txt or http://www.mitk.org/copyright.html for details.
This software is distributed WITHOUT ANY WARRANTY; without even
the implied warranty of MERCHANTABILITY or FITNESS FOR A PARTICULAR
PURPOSE. See the above copyright notices for more information.
=========================================================================*/
#include "mitkContourUtils.h"
#include "mitkImageCast.h"
+#include "mitkImageAccessByItk.h"
+#include "mitkInstantiateAccessFunctions.h"
#include "ipSegmentation.h"
+#define InstantiateAccessFunction_ItkCopyFilledContourToSlice(pixelType, dim) \
+ template void mitk::ContourUtils::ItkCopyFilledContourToSlice(itk::Image<pixelType,dim>*, const mitk::Image*, int);
+
// explicitly instantiate the 2D version of this method
-InstantiateAccessFunctionForFixedDimension_2( mitk::ContourUtils::ItkCopyFilledContourToSlice, 2, const mitk::Image*, int );
+InstantiateAccessFunctionForFixedDimension(ItkCopyFilledContourToSlice, 2);
mitk::ContourUtils::ContourUtils()
{
}
mitk::ContourUtils::~ContourUtils()
{
}
mitk::Contour::Pointer mitk::ContourUtils::ProjectContourTo2DSlice(Image* slice, Contour* contourIn3D, bool itkNotUsed( correctionForIpSegmentation ), bool constrainToInside)
{
if ( !slice || !contourIn3D ) return NULL;
Contour::Pointer projectedContour = Contour::New();
const Contour::PathType::VertexListType* pointsIn3D = contourIn3D->GetContourPath()->GetVertexList();
const Geometry3D* sliceGeometry = slice->GetGeometry();
for ( Contour::PathType::VertexListType::const_iterator iter = pointsIn3D->begin();
iter != pointsIn3D->end();
++iter )
{
Contour::PathType::VertexType currentPointIn3DITK = *iter;
Point3D currentPointIn3D;
for (int i = 0; i < 3; ++i) currentPointIn3D[i] = currentPointIn3DITK[i];
Point3D projectedPointIn2D;
projectedPointIn2D.Fill(0.0);
sliceGeometry->WorldToIndex( currentPointIn3D, projectedPointIn2D );
// MITK_INFO << "world point " << currentPointIn3D << " in index is " << projectedPointIn2D;
if ( !sliceGeometry->IsIndexInside( projectedPointIn2D ) && constrainToInside )
{
MITK_INFO << "**" << currentPointIn3D << " is " << projectedPointIn2D << " --> correct it (TODO)" << std::endl;
}
projectedContour->AddVertex( projectedPointIn2D );
}
return projectedContour;
}
mitk::Contour::Pointer mitk::ContourUtils::BackProjectContourFrom2DSlice(const Geometry3D* sliceGeometry, Contour* contourIn2D, bool itkNotUsed( correctionForIpSegmentation ) )
{
if ( !sliceGeometry || !contourIn2D ) return NULL;
Contour::Pointer worldContour = Contour::New();
const Contour::PathType::VertexListType* pointsIn2D = contourIn2D->GetContourPath()->GetVertexList();
for ( Contour::PathType::VertexListType::const_iterator iter = pointsIn2D->begin();
iter != pointsIn2D->end();
++iter )
{
Contour::PathType::VertexType currentPointIn3DITK = *iter;
Point3D currentPointIn2D;
for (int i = 0; i < 3; ++i) currentPointIn2D[i] = currentPointIn3DITK[i];
Point3D worldPointIn3D;
worldPointIn3D.Fill(0.0);
sliceGeometry->IndexToWorld( currentPointIn2D, worldPointIn3D );
//MITK_INFO << "index " << currentPointIn2D << " world " << worldPointIn3D << std::endl;
worldContour->AddVertex( worldPointIn3D );
}
return worldContour;
}
void mitk::ContourUtils::FillContourInSlice( Contour* projectedContour, Image* sliceImage, int paintingPixelValue )
{
// 1. Use ipSegmentation to draw a filled(!) contour into a new 8 bit 2D image, which will later be copied back to the slice.
// We don't work on the "real" working data, because ipSegmentation would restrict us to 8 bit images
// convert the projected contour into a ipSegmentation format
mitkIpInt4_t* picContour = new mitkIpInt4_t[2 * projectedContour->GetNumberOfPoints()];
const Contour::PathType::VertexListType* pointsIn2D = projectedContour->GetContourPath()->GetVertexList();
unsigned int index(0);
for ( Contour::PathType::VertexListType::const_iterator iter = pointsIn2D->begin();
iter != pointsIn2D->end();
++iter, ++index )
{
picContour[ 2 * index + 0 ] = static_cast<mitkIpInt4_t>( (*iter)[0] + 1.0 ); // +0.5 wahrscheinlich richtiger
picContour[ 2 * index + 1 ] = static_cast<mitkIpInt4_t>( (*iter)[1] + 1.0 );
//MITK_INFO << "mitk 2d [" << (*iter)[0] << ", " << (*iter)[1] << "] pic [" << picContour[ 2*index+0] << ", " << picContour[ 2*index+1] << "]";
}
assert( sliceImage->GetSliceData() );
mitkIpPicDescriptor* originalPicSlice = sliceImage->GetSliceData()->GetPicDescriptor();
mitkIpPicDescriptor* picSlice = ipMITKSegmentationNew( originalPicSlice );
ipMITKSegmentationClear( picSlice );
assert( originalPicSlice && picSlice );
// here comes the actual contour filling algorithm (from ipSegmentation/Graphics Gems)
ipMITKSegmentationCombineRegion ( picSlice, picContour, projectedContour->GetNumberOfPoints(), NULL, IPSEGMENTATION_OR, 1); // set to 1
delete[] picContour;
// 2. Copy the filled contour to the working data slice
// copy all pixels that are non-zero to the original image (not caring for the actual type of the working image). perhaps make the replace value a parameter ( -> general painting tool ).
// make the pic slice an mitk/itk image (as little ipPic code as possible), call a templated method with accessbyitk, iterate over the original and the modified slice
Image::Pointer ipsegmentationModifiedSlice = Image::New();
ipsegmentationModifiedSlice->Initialize( picSlice );
ipsegmentationModifiedSlice->SetPicSlice( picSlice );
AccessFixedDimensionByItk_2( sliceImage, ItkCopyFilledContourToSlice, 2, ipsegmentationModifiedSlice, paintingPixelValue );
ipsegmentationModifiedSlice = NULL; // free MITK header information
ipMITKSegmentationFree( picSlice ); // free actual memory
}
template<typename TPixel, unsigned int VImageDimension>
void mitk::ContourUtils::ItkCopyFilledContourToSlice( itk::Image<TPixel,VImageDimension>* originalSlice, const Image* filledContourSlice, int overwritevalue )
{
typedef itk::Image<TPixel,VImageDimension> SliceType;
typename SliceType::Pointer filledContourSliceITK;
CastToItkImage( filledContourSlice, filledContourSliceITK );
// now the original slice and the ipSegmentation-painted slice are in the same format, and we can just copy all pixels that are non-zero
typedef itk::ImageRegionIterator< SliceType > OutputIteratorType;
typedef itk::ImageRegionConstIterator< SliceType > InputIteratorType;
InputIteratorType inputIterator( filledContourSliceITK, filledContourSliceITK->GetLargestPossibleRegion() );
OutputIteratorType outputIterator( originalSlice, originalSlice->GetLargestPossibleRegion() );
outputIterator.GoToBegin();
inputIterator.GoToBegin();
while ( !outputIterator.IsAtEnd() )
{
if ( inputIterator.Get() != 0 )
{
outputIterator.Set( overwritevalue );
}
++outputIterator;
++inputIterator;
}
}
diff --git a/Modules/MitkExt/Algorithms/mitkCorrectorAlgorithm.cpp b/Modules/MitkExt/Algorithms/mitkCorrectorAlgorithm.cpp
index 4561a458f8..afbf24fce1 100644
--- a/Modules/MitkExt/Algorithms/mitkCorrectorAlgorithm.cpp
+++ b/Modules/MitkExt/Algorithms/mitkCorrectorAlgorithm.cpp
@@ -1,507 +1,509 @@
/*=========================================================================
Program: Medical Imaging & Interaction Toolkit
Language: C++
Date: $Date$
Version: $Revision: 1.12 $
Copyright (c) German Cancer Research Center, Division of Medical and
Biological Informatics. All rights reserved.
See MITKCopyright.txt or http://www.mitk.org/copyright.html for details.
This software is distributed WITHOUT ANY WARRANTY; without even
the implied warranty of MERCHANTABILITY or FITNESS FOR A PARTICULAR
PURPOSE. See the above copyright notices for more information.
=========================================================================*/
#include "mitkCorrectorAlgorithm.h"
#include "mitkImageCast.h"
+#include "mitkImageAccessByItk.h"
+#include "mitkImageDataItem.h"
#include "mitkContourUtils.h"
mitk::CorrectorAlgorithm::CorrectorAlgorithm()
:ImageToImageFilter()
{
}
mitk::CorrectorAlgorithm::~CorrectorAlgorithm()
{
}
void mitk::CorrectorAlgorithm::GenerateData()
{
Image::Pointer inputImage = const_cast<Image*>(ImageToImageFilter::GetInput(0));
if (inputImage.IsNull() || inputImage->GetDimension() != 2)
{
itkExceptionMacro("CorrectorAlgorithm needs a 2D image as input.");
}
if (m_Contour.IsNull())
{
itkExceptionMacro("CorrectorAlgorithm needs a Contour object as input.");
}
// copy the input (since m_WorkingImage will be changed later)
m_WorkingImage = Image::New();
m_WorkingImage->Initialize( inputImage );
m_WorkingImage->SetVolume( inputImage.GetPointer()->GetData() );
if (inputImage->GetTimeSlicedGeometry() )
{
AffineGeometryFrame3D::Pointer originalGeometryAGF = inputImage->GetTimeSlicedGeometry()->Clone();
TimeSlicedGeometry::Pointer originalGeometry = dynamic_cast<TimeSlicedGeometry*>( originalGeometryAGF.GetPointer() );
m_WorkingImage->SetGeometry( originalGeometry );
}
else
{
itkExceptionMacro("Original image does not have a 'Time sliced geometry'! Cannot copy.");
}
// Convert to ipMITKSegmentationTYPE (because TobiasHeimannCorrectionAlgorithm relys on that data type)
itk::Image< ipMITKSegmentationTYPE, 2 >::Pointer correctPixelTypeImage;
CastToItkImage( m_WorkingImage, correctPixelTypeImage );
assert (correctPixelTypeImage.IsNotNull() );
// possible bug in CastToItkImage ?
// direction maxtrix is wrong/broken/not working after CastToItkImage, leading to a failed assertion in
// mitk/Core/DataStructures/mitkSlicedGeometry3D.cpp, 479:
// virtual void mitk::SlicedGeometry3D::SetSpacing(const mitk::Vector3D&): Assertion `aSpacing[0]>0 && aSpacing[1]>0 && aSpacing[2]>0' failed
// solution here: we overwrite it with an unity matrix
itk::Image< ipMITKSegmentationTYPE, 2 >::DirectionType imageDirection;
imageDirection.SetIdentity();
correctPixelTypeImage->SetDirection(imageDirection);
Image::Pointer temporarySlice = this->GetOutput();
// temporarySlice = ImportItkImage( correctPixelTypeImage );
CastToMitkImage( correctPixelTypeImage, temporarySlice );
TobiasHeimannCorrectionAlgorithm( temporarySlice->GetSliceData()->GetPicDescriptor() );
// temporarySlice is our return value (user can get it by calling GetOutput() )
CalculateDifferenceImage( temporarySlice, inputImage );
if ( m_DifferenceImage.IsNotNull() && inputImage->GetTimeSlicedGeometry() )
{
AffineGeometryFrame3D::Pointer originalGeometryAGF = inputImage->GetTimeSlicedGeometry()->Clone();
TimeSlicedGeometry::Pointer originalGeometry = dynamic_cast<TimeSlicedGeometry*>( originalGeometryAGF.GetPointer() );
m_DifferenceImage->SetGeometry( originalGeometry );
}
else
{
itkExceptionMacro("Original image does not have a 'Time sliced geometry'! Cannot copy.");
}
}
void mitk::CorrectorAlgorithm::TobiasHeimannCorrectionAlgorithm(mitkIpPicDescriptor* pic)
{
/*!
Some documentation (not by the original author)
TobiasHeimannCorrectionAlgorithm will be called, when the user has finished drawing a freehand line.
There should be different results, depending on the line's properties:
1. Without any prior segmentation, the start point and the end point of the drawn line will be
connected to a contour and the area enclosed by the contour will be marked as segmentation.
2. When the whole line is inside a segmentation, start and end point will be connected to
a contour and the area of this contour will be subtracted from the segmentation.
3. When the line starts inside a segmentation and ends outside with only a single
transition from segmentation to no-segmentation, nothing will happen.
4. When there are multiple transitions between inside-segmentation and
outside-segmentation, the line will be divided in so called segments. Each segment is
either fully inside or fully outside a segmentation. When it is inside a segmentation, its
enclosed area will be subtracted from the segmentation. When the segment is outside a
segmentation, its enclosed area it will be added to the segmentation.
The algorithm is described in full length in Tobias Heimann's diploma thesis
(MBI Technical Report 145, p. 37 - 40).
*/
int oaSize = 1000000; // if we need a fixed number, then let it be big
int* _ofsArray = new int[ oaSize ];
for (int i=0; i<oaSize; i++) _ofsArray[i] = 0;
std::vector<TSegData> segData;
segData.reserve( 16 );
Contour* contour3D = const_cast<Contour*>(m_Contour.GetPointer());
ContourUtils::Pointer contourUtils = ContourUtils::New();
Contour::Pointer projectedContour = contourUtils->ProjectContourTo2DSlice( m_WorkingImage, contour3D, true, false );
if (projectedContour.IsNull())
{
delete[] _ofsArray;
return;
}
if (projectedContour->GetNumberOfPoints() < 2)
{
delete[] _ofsArray;
return;
}
// convert the projected contour into a ipSegmentation format
mitkIpInt4_t* _points = new mitkIpInt4_t[2 * projectedContour->GetNumberOfPoints()];
const Contour::PathType::VertexListType* pointsIn2D = projectedContour->GetContourPath()->GetVertexList();
unsigned int index(0);
for ( Contour::PathType::VertexListType::const_iterator iter = pointsIn2D->begin();
iter != pointsIn2D->end();
++iter, ++index )
{
_points[ 2 * index + 0 ] = static_cast<mitkIpInt4_t>( (*iter)[0] + 0.5 );
_points[ 2 * index + 1 ] = static_cast<mitkIpInt4_t>( (*iter)[1] + 0.5 );
}
// store ofsets of the drawn line in array
int _ofsNum = 0;
unsigned int num = projectedContour->GetNumberOfPoints();
int lastOfs = -1;
for (unsigned int i=0; i<num-1; i++)
{
float x = _points [2*i] + 0.5;
float y = _points [2*i+1] + 0.5;
float difX = _points [2*i+2] - x + 0.5;
float difY = _points [2*i+3] - y + 0.5;
float length = sqrt( difX*difX + difY*difY );
float dx = difX / length;
float dy = difY / length;
for (int p=0; ((float)p)<length; p++)
{
// if ofs is out of bounds, very nasty things will happen, so better check coordinates:
if (x<0) x=0.5;
else if (x>=pic->n[0]) x = pic->n[0]-0.5;
if (y<0) y=0.5;
else if (y>=pic->n[1]) y = pic->n[1]-0.5;
// ok, now store safe ofs
int ofs = (int)(x) + pic->n[0]*((int)(y));
x += dx;
y += dy;
if (ofs != lastOfs)
{
_ofsArray[_ofsNum++] = ofs;
lastOfs = ofs;
}
}
}
if (_ofsNum == 0)
{
// contour was completely outside the binary image
delete[] _ofsArray;
delete[] _points;
return;
}
ipMITKSegmentationTYPE* picdata = static_cast<ipMITKSegmentationTYPE*>(pic->data);
// divide line in logical segments:
int numSegments = 0;
ipMITKSegmentationTYPE state = *(picdata + _ofsArray[0]);
int ofsP = 1;
int modifyStart, modifyEnd; // start of first and end of last segment
bool nextSegment;
segData.clear();
do
{
nextSegment = false;
while (ofsP<_ofsNum && *(picdata + _ofsArray[ofsP])==state) ofsP++;
if (ofsP<_ofsNum)
{
int lineStart = ofsP-1;
if (numSegments==0) modifyStart = ofsP;
state = *(picdata + _ofsArray[ofsP]);
while (ofsP<_ofsNum && *(picdata + _ofsArray[ofsP])==state) ofsP++;
if (ofsP<_ofsNum)
{
int lineEnd = ofsP;
modifyEnd = lineEnd;
nextSegment = true;
// now we've got a valid segment from lineStart to lineEnd
TSegData thisSegData;
thisSegData.lineStart = lineStart;
thisSegData.lineEnd = lineEnd;
thisSegData.modified = modifySegment( lineStart, lineEnd, state, pic, _ofsArray );
segData.push_back( thisSegData );
numSegments++;
}
}
} while (nextSegment);
for (int segNr=0; segNr < numSegments; segNr++)
{
// draw line if modified:
if ( segData[segNr].modified )
{
for (int i=segData[segNr].lineStart+1; i<segData[segNr].lineEnd; i++)
{
*(picdata + _ofsArray[i]) = 1;
}
}
}
if (numSegments == 0)
{
if (num <= 1)
{ // only a single pixel. _ofsArray[_ofsNum-1] in else statement would crash, so don't do anything
// no movement: delete operation
// This behaviour would probably confuse users when they use the correction
// tool to change a segmentation and it deletes much more than selected
// if (state == 1) ipMITKSegmentationReplaceRegion4N( pic, _ofsArray[0], 0 );
}
else if ( *(picdata + _ofsArray[_ofsNum-1]) == *(picdata + _ofsArray[0]))
{
// start point and end point both inside or both outside any segmentation
// normal paint operation
mitkIpInt4_t* p = new mitkIpInt4_t[2 * num];
for (unsigned int i = 0; i < num; i++)
{
p[2 * i] = (mitkIpInt4_t) _points [2 * i];
p[2 * i + 1] = (mitkIpInt4_t) _points [2 * i + 1];
}
if (state == 0) ipMITKSegmentationCombineRegion (pic, p, num, 0, IPSEGMENTATION_OR, 1);
else ipMITKSegmentationCombineRegion (pic, p, num, 0, IPSEGMENTATION_AND, 0);
delete[] p;
}
}
int numberOfContourPoints( 0 );
int oneContourOffset( 0 );
int newBufferSize( 0 );
int imageSize = pic->n[0]*pic->n[1];
for (oneContourOffset = 0; oneContourOffset < imageSize; oneContourOffset++)
if ( ((ipMITKSegmentationTYPE*) pic->data)[oneContourOffset]> 0) break;
float* contourPoints = ipMITKSegmentationGetContour8N( pic, oneContourOffset, numberOfContourPoints, newBufferSize ); // memory allocated with malloc
if (contourPoints)
{
// copy point from float* to mitk::Contour
Contour::Pointer contourInImageIndexCoordinates = Contour::New();
contourInImageIndexCoordinates->Initialize();
Point3D newPoint;
for (int index = 0; index < numberOfContourPoints; ++index)
{
newPoint[0] = contourPoints[ 2 * index + 0 ];
newPoint[1] = contourPoints[ 2 * index + 1];
newPoint[2] = 0;
contourInImageIndexCoordinates->AddVertex( newPoint );
}
free(contourPoints);
ContourUtils::Pointer contourUtils = ContourUtils::New();
contourUtils->FillContourInSlice( contourInImageIndexCoordinates, m_WorkingImage );
}
delete[] _ofsArray;
delete[] _points;
}
bool mitk::CorrectorAlgorithm::modifySegment( int lineStart, int lineEnd, ipMITKSegmentationTYPE state, mitkIpPicDescriptor *pic, int* _ofsArray )
{
// offsets for pixels right, top, left, bottom
int nbDelta4[4];
nbDelta4[0]=1; nbDelta4[1]=pic->n[0]; nbDelta4[1]*=-1; // necessary because of unsigned declaration of pic->n
nbDelta4[2]=-1; nbDelta4[3]=pic->n[0];
// offsets for pixels right, top-right, top, top-left left, bottom-left, bottom, bottom-right
int nbDelta8[8];
nbDelta8[0] = 1; nbDelta8[1] = nbDelta4[1]+1; nbDelta8[2] = nbDelta4[1]; nbDelta8[3] = nbDelta4[1]-1;
nbDelta8[4] = -1; nbDelta8[5] = nbDelta4[3]-1; nbDelta8[6] = nbDelta4[3]; nbDelta8[7] = nbDelta4[3]+1;
ipMITKSegmentationTYPE* picdata = static_cast<ipMITKSegmentationTYPE*>(pic->data);
ipMITKSegmentationTYPE saveStart = *(picdata + _ofsArray[lineStart]);
ipMITKSegmentationTYPE saveEnd = *(picdata + _ofsArray[lineEnd]);
ipMITKSegmentationTYPE newState = ((!state)&1) + 2; // probably equal to: ipMITKSegmentationTYPE newState = 3 - state;
// make two copies of pic:
mitkIpPicDescriptor *seg1 = mitkIpPicClone( pic );
mitkIpPicDescriptor *seg2 = mitkIpPicClone( pic );
int i;
// mark line in original
for (i=lineStart; i<=lineEnd; i++) {
*(picdata + _ofsArray[i]) = 3;
}
// mark the first side in copy 1:
bool firstPix = true;
bool modified;
int line = pic->n[0]; // #pixels in line
int maxOfs = (int)(line * pic->n[1]); // #pixels in slice
for (i=lineStart+1; i<lineEnd; i++) {
do {
modified = false;
for (int nb=0; nb<8; nb++) {
int nbOfs = _ofsArray[i] + nbDelta8[nb];
if ( nbOfs < 0 // above first line
|| nbOfs >= maxOfs // below last line
) continue;
ipMITKSegmentationTYPE nbVal = *(picdata + nbOfs);
ipMITKSegmentationTYPE destVal = *(((ipMITKSegmentationTYPE*)seg1->data) + nbOfs);
if (nbVal!=3 && destVal!=newState) { // get only neigbhours that are not part of the line itself
if (firstPix) {
*(((ipMITKSegmentationTYPE*)seg1->data) + nbOfs) = newState; // this one is used to mark the side!
firstPix = false;
modified = true;
}
else {
int tnb = 0;
while ( tnb < 4
&& ((nbOfs + nbDelta4[tnb]) >= 0) && ((nbOfs + nbDelta4[tnb]) < maxOfs)
&& *(((ipMITKSegmentationTYPE*)seg1->data) + nbOfs + nbDelta4[tnb]) != newState
)
tnb++;
if (tnb < 4 && ((nbOfs + nbDelta4[tnb]) >= 0) && ((nbOfs + nbDelta4[tnb]) < maxOfs) ) {
*(((ipMITKSegmentationTYPE*)seg1->data) + nbOfs) = newState; // we've got a buddy close
modified = true;
}
}
}
}
} while (modified);
}
// mark the other side in copy 2:
for (i=lineStart+1; i<lineEnd; i++) {
for (int nb=0; nb<4; nb++) {
int nbOfs = _ofsArray[i] + nbDelta4[nb];
if ( nbOfs < 0 // above first line
|| nbOfs >= maxOfs // below last line
) continue;
ipMITKSegmentationTYPE lineVal = *(picdata + nbOfs);
ipMITKSegmentationTYPE side1Val = *(((ipMITKSegmentationTYPE*)seg1->data) + nbOfs);
if (lineVal != 3 && side1Val != newState) {
*(((ipMITKSegmentationTYPE*)seg2->data) + nbOfs) = newState;
}
}
}
// take care of line ends for multiple segments:
*(((ipMITKSegmentationTYPE*)seg1->data) + _ofsArray[lineStart]) = newState;
*(((ipMITKSegmentationTYPE*)seg1->data) + _ofsArray[lineEnd]) = newState;
*(((ipMITKSegmentationTYPE*)seg2->data) + _ofsArray[lineStart]) = newState;
*(((ipMITKSegmentationTYPE*)seg2->data) + _ofsArray[lineEnd]) = newState;
// replace regions:
newState = (!state)&1;
int sizeRegion1 = 0, sizeRegion2 = 0;
for (i=lineStart+1; i<lineEnd; i++) {
if (*(((ipMITKSegmentationTYPE*)seg1->data) + _ofsArray[i]) != newState) {
sizeRegion1 += ipMITKSegmentationReplaceRegion4N( seg1, _ofsArray[i], newState );
}
if (*(((ipMITKSegmentationTYPE*)seg2->data) + _ofsArray[i]) != newState) {
sizeRegion2 += ipMITKSegmentationReplaceRegion4N( seg2, _ofsArray[i], newState );
}
}
// combine image:
//printf( "Size Region1 = %8i Size Region2 = %8i\n", sizeRegion1, sizeRegion2 );
int sizeDif;
ipMITKSegmentationTYPE *current, *segSrc;
if (sizeRegion1 < sizeRegion2) {
segSrc = (ipMITKSegmentationTYPE*)seg1->data;
sizeDif = sizeRegion2 - sizeRegion1;
}
else {
segSrc = (ipMITKSegmentationTYPE*)seg2->data;
sizeDif = sizeRegion1 - sizeRegion2;
}
modified = false;
if (sizeDif > 2*(lineEnd-lineStart)) {
// decision is safe enough:
ipMITKSegmentationTYPE *end = picdata + (pic->n[0]*pic->n[1]);
for (current = picdata; current<end; current++) {
if (*segSrc == newState) *current = newState;
segSrc++;
}
modified = true;
}
// restore line:
for (int i=lineStart+1; i<lineEnd; i++) {
*(picdata + _ofsArray[i]) = state;
}
// restore end points:
*(picdata + _ofsArray[lineStart]) = saveStart;
*(picdata + _ofsArray[lineEnd]) = saveEnd;
mitkIpPicFree( seg1 );
mitkIpPicFree( seg2 );
return modified;
}
void mitk::CorrectorAlgorithm::CalculateDifferenceImage( Image* modifiedImage, Image* originalImage )
{
/*
* modifiedImage has ipMITKSegmentationTYPE
* originalImage may be any type
*
* --> we calculate a diff image using ITK, switching for the correct type of originalImage
*/
m_DifferenceImage = NULL;
Image::Pointer tmpPtr = originalImage;
AccessFixedDimensionByItk_1( tmpPtr, ItkCalculateDifferenceImage, 2, modifiedImage );
}
template<typename TPixel, unsigned int VImageDimension>
void mitk::CorrectorAlgorithm::ItkCalculateDifferenceImage( itk::Image<TPixel, VImageDimension>* originalImage, Image* modifiedMITKImage )
{
typedef itk::Image<ipMITKSegmentationTYPE, VImageDimension> ModifiedImageType;
typedef itk::Image<short signed int, VImageDimension> DiffImageType;
typedef itk::ImageRegionConstIterator< itk::Image<TPixel,VImageDimension> > OriginalSliceIteratorType;
typedef itk::ImageRegionConstIterator< ModifiedImageType > ModifiedSliceIteratorType;
typedef itk::ImageRegionIterator< DiffImageType > DiffSliceIteratorType;
typename ModifiedImageType::Pointer modifiedImage;
CastToItkImage( modifiedMITKImage, modifiedImage );
// create new image as a copy of the input
// this new image is the output of this filter class
typename DiffImageType::Pointer diffImage;
m_DifferenceImage = Image::New();
PixelType pixelType( typeid(short signed int) );
m_DifferenceImage->Initialize( pixelType, 2, modifiedMITKImage->GetDimensions() );
CastToItkImage( m_DifferenceImage, diffImage );
// iterators over both input images (original and modified) and the output image (diff)
ModifiedSliceIteratorType modifiedIterator( modifiedImage, diffImage->GetLargestPossibleRegion() );
OriginalSliceIteratorType originalIterator( originalImage, diffImage->GetLargestPossibleRegion() );
DiffSliceIteratorType diffIterator( diffImage, diffImage->GetLargestPossibleRegion() );
modifiedIterator.GoToBegin();
originalIterator.GoToBegin();
diffIterator.GoToBegin();
while ( !diffIterator.IsAtEnd() )
{
short signed int difference = static_cast<short signed int>( static_cast<signed int>(modifiedIterator.Get()) -
static_cast<signed int>(originalIterator.Get())); // not good for bigger values ?!
diffIterator.Set( difference );
++modifiedIterator;
++originalIterator;
++diffIterator;
}
}
diff --git a/Modules/MitkExt/Algorithms/mitkDiffImageApplier.cpp b/Modules/MitkExt/Algorithms/mitkDiffImageApplier.cpp
index 97336e3356..3a62b82191 100644
--- a/Modules/MitkExt/Algorithms/mitkDiffImageApplier.cpp
+++ b/Modules/MitkExt/Algorithms/mitkDiffImageApplier.cpp
@@ -1,328 +1,329 @@
/*=========================================================================
Program: Medical Imaging & Interaction Toolkit
Language: C++
Date: $Date$
Version: $Revision: $
Copyright (c) German Cancer Research Center, Division of Medical and
Biological Informatics. All rights reserved.
See MITKCopyright.txt or http://www.mitk.org/copyright.html for details.
This software is distributed WITHOUT ANY WARRANTY; without even
the implied warranty of MERCHANTABILITY or FITNESS FOR A PARTICULAR
PURPOSE. See the above copyright notices for more information.
=========================================================================*/
#include "mitkDiffImageApplier.h"
#include "mitkImageCast.h"
+#include "mitkImageAccessByItk.h"
#include "mitkApplyDiffImageOperation.h"
#include "mitkRenderingManager.h"
#include "mitkSegmentationInterpolationController.h"
#include "mitkImageTimeSelector.h"
#include <itkImageSliceIteratorWithIndex.h>
#include <itkImageRegionConstIterator.h>
mitk::DiffImageApplier::DiffImageApplier()
{
}
mitk::DiffImageApplier::~DiffImageApplier()
{
}
void mitk::DiffImageApplier::ExecuteOperation( Operation* operation )
{
ApplyDiffImageOperation* imageOperation = dynamic_cast<ApplyDiffImageOperation*>( operation );
if ( imageOperation // we actually have the kind of operation that we can handle
&& imageOperation->IsImageStillValid() ) // AND the image is not yet deleted
{
m_Image = imageOperation->GetImage();
Image::Pointer image3D = m_Image; // will be changed later in case of 3D+t
m_SliceDifferenceImage = imageOperation->GetDiffImage();
m_TimeStep = imageOperation->GetTimeStep();
m_Factor = imageOperation->GetFactor();
if ( m_SliceDifferenceImage->GetDimension() == 2 )
{
m_SliceIndex = imageOperation->GetSliceIndex();
m_SliceDimension = imageOperation->GetSliceDimension();
switch (m_SliceDimension)
{
default:
case 2:
m_Dimension0 = 0;
m_Dimension1 = 1;
break;
case 1:
m_Dimension0 = 0;
m_Dimension1 = 2;
break;
case 0:
m_Dimension0 = 1;
m_Dimension1 = 2;
break;
}
if ( m_SliceDifferenceImage->GetDimension() != 2 || (m_Image->GetDimension() < 3 || m_Image->GetDimension() > 4) ||
m_SliceDifferenceImage->GetDimension(0) != m_Image->GetDimension(m_Dimension0) ||
m_SliceDifferenceImage->GetDimension(1) != m_Image->GetDimension(m_Dimension1) ||
m_SliceIndex >= m_Image->GetDimension(m_SliceDimension)
)
{
itkExceptionMacro("Slice and image dimensions differ or slice index is too large. Sorry, cannot work like this.");
return;
}
if ( m_Image->GetDimension() == 4 )
{
ImageTimeSelector::Pointer timeSelector = ImageTimeSelector::New();
timeSelector->SetInput( m_Image );
timeSelector->SetTimeNr( m_TimeStep );
timeSelector->UpdateLargestPossibleRegion();
image3D = timeSelector->GetOutput();
}
// this will do a long long if/else to find out both pixel types
AccessFixedDimensionByItk( image3D, ItkImageSwitch2DDiff, 3 );
if ( m_Factor == 1 || m_Factor == -1 )
{
if ( m_Factor == -1 )
{
// multiply diff pixels by factor and then send this diff slice
AccessFixedDimensionByItk( m_SliceDifferenceImage, ItkInvertPixelValues, 2 );
}
// just send the diff to SegmentationInterpolationController
SegmentationInterpolationController* interpolator = SegmentationInterpolationController::InterpolatorForImage( m_Image );
if (interpolator)
{
interpolator->BlockModified(true);
interpolator->SetChangedSlice( m_SliceDifferenceImage, m_SliceDimension, m_SliceIndex, m_TimeStep );
}
m_Image->Modified();
if (interpolator)
{
interpolator->BlockModified(false);
}
if ( m_Factor == -1 ) // return to normal values
{
AccessFixedDimensionByItk( m_SliceDifferenceImage, ItkInvertPixelValues, 2 );
}
}
else // no trivial case, too lazy to do something else
{
m_Image->Modified(); // check if interpolation is called. prefer to send diff directly
}
RenderingManager::GetInstance()->RequestUpdateAll();
}
else if ( m_SliceDifferenceImage->GetDimension() == 3 )
{
// ...
if ( m_SliceDifferenceImage->GetDimension(0) != m_Image->GetDimension(0) ||
m_SliceDifferenceImage->GetDimension(1) != m_Image->GetDimension(1) ||
m_SliceDifferenceImage->GetDimension(2) != m_Image->GetDimension(2) ||
m_TimeStep >= m_Image->GetDimension(3)
)
{
itkExceptionMacro("Diff image size differs from original image size. Sorry, cannot work like this.");
return;
}
if ( m_Image->GetDimension() == 4 )
{
ImageTimeSelector::Pointer timeSelector = ImageTimeSelector::New();
timeSelector->SetInput( m_Image );
timeSelector->SetTimeNr( m_TimeStep );
timeSelector->UpdateLargestPossibleRegion();
image3D = timeSelector->GetOutput();
}
// this will do a long long if/else to find out both pixel types
AccessFixedDimensionByItk( image3D, ItkImageSwitch3DDiff, 3 );
if ( m_Factor == 1 || m_Factor == -1 )
{
if ( m_Factor == -1 )
{
// multiply diff pixels by factor and then send this diff slice
AccessFixedDimensionByItk( m_SliceDifferenceImage, ItkInvertPixelValues, 3 );
}
// just send the diff to SegmentationInterpolationController
SegmentationInterpolationController* interpolator = SegmentationInterpolationController::InterpolatorForImage( m_Image );
if (interpolator)
{
interpolator->BlockModified(true);
interpolator->SetChangedVolume( m_SliceDifferenceImage, m_TimeStep );
}
m_Image->Modified();
if (interpolator)
{
interpolator->BlockModified(false);
}
if ( m_Factor == -1 ) // return to normal values
{
AccessFixedDimensionByItk( m_SliceDifferenceImage, ItkInvertPixelValues, 3 );
}
}
else // no trivial case, too lazy to do something else
{
m_Image->Modified(); // check if interpolation is called. prefer to send diff directly
}
RenderingManager::GetInstance()->RequestUpdateAll();
}
else
{
itkExceptionMacro("Diff image must be 2D or 3D. Sorry, cannot work like this.");
return;
}
}
m_Image = NULL;
m_SliceDifferenceImage = NULL;
}
mitk::DiffImageApplier* mitk::DiffImageApplier::GetInstanceForUndo()
{
static DiffImageApplier::Pointer s_Instance = DiffImageApplier::New();
return s_Instance;
}
// basically copied from mitk/Core/Algorithms/mitkImageAccessByItk.h
#define myMITKDiffImageApplierFilterAccessByItk(mitkImage, itkImageTypeFunction, pixeltype, dimension, itkimage2) \
if ( typeId == typeid(pixeltype) ) \
{ \
typedef itk::Image<pixeltype, dimension> ImageType; \
typedef mitk::ImageToItk<ImageType> ImageToItkType; \
itk::SmartPointer<ImageToItkType> imagetoitk = ImageToItkType::New(); \
imagetoitk->SetInput(mitkImage); \
imagetoitk->Update(); \
itkImageTypeFunction(imagetoitk->GetOutput(), itkimage2); \
}
#define myMITKDiffImageApplierFilterAccessAllTypesByItk(mitkImage, itkImageTypeFunction, dimension, itkimage2) \
{ \
myMITKDiffImageApplierFilterAccessByItk(mitkImage, itkImageTypeFunction, double, dimension, itkimage2) else \
myMITKDiffImageApplierFilterAccessByItk(mitkImage, itkImageTypeFunction, float, dimension, itkimage2) else \
myMITKDiffImageApplierFilterAccessByItk(mitkImage, itkImageTypeFunction, int, dimension, itkimage2) else \
myMITKDiffImageApplierFilterAccessByItk(mitkImage, itkImageTypeFunction, unsigned int, dimension, itkimage2) else \
myMITKDiffImageApplierFilterAccessByItk(mitkImage, itkImageTypeFunction, short, dimension, itkimage2) else \
myMITKDiffImageApplierFilterAccessByItk(mitkImage, itkImageTypeFunction, unsigned short, dimension, itkimage2) else \
myMITKDiffImageApplierFilterAccessByItk(mitkImage, itkImageTypeFunction, char, dimension, itkimage2) else \
myMITKDiffImageApplierFilterAccessByItk(mitkImage, itkImageTypeFunction, unsigned char, dimension, itkimage2) \
}
template<typename TPixel, unsigned int VImageDimension>
void mitk::DiffImageApplier::ItkImageSwitch2DDiff( itk::Image<TPixel,VImageDimension>* itkImage )
{
const std::type_info& typeId=*(m_SliceDifferenceImage->GetPixelType().GetTypeId());
myMITKDiffImageApplierFilterAccessAllTypesByItk( m_SliceDifferenceImage, ItkImageProcessing2DDiff, 2, itkImage );
}
template<typename TPixel, unsigned int VImageDimension>
void mitk::DiffImageApplier::ItkImageSwitch3DDiff( itk::Image<TPixel,VImageDimension>* itkImage )
{
const std::type_info& typeId=*(m_SliceDifferenceImage->GetPixelType().GetTypeId());
myMITKDiffImageApplierFilterAccessAllTypesByItk( m_SliceDifferenceImage, ItkImageProcessing3DDiff, 3, itkImage );
}
template<typename TPixel1, unsigned int VImageDimension1, typename TPixel2, unsigned int VImageDimension2>
void mitk::DiffImageApplier::ItkImageProcessing2DDiff( itk::Image<TPixel1,VImageDimension1>* diffImage, itk::Image<TPixel2,VImageDimension2>* outputImage )
{
typedef itk::Image<TPixel1, VImageDimension1> DiffImageType;
typedef itk::Image<TPixel2, VImageDimension2> VolumeImageType;
typedef itk::ImageSliceIteratorWithIndex< VolumeImageType > OutputSliceIteratorType;
typedef itk::ImageRegionConstIterator< DiffImageType > DiffSliceIteratorType;
typename VolumeImageType::RegionType sliceInVolumeRegion;
sliceInVolumeRegion = outputImage->GetLargestPossibleRegion();
sliceInVolumeRegion.SetSize( m_SliceDimension, 1 ); // just one slice
sliceInVolumeRegion.SetIndex( m_SliceDimension, m_SliceIndex ); // exactly this slice, please
OutputSliceIteratorType outputIterator( outputImage, sliceInVolumeRegion );
outputIterator.SetFirstDirection(m_Dimension0);
outputIterator.SetSecondDirection(m_Dimension1);
DiffSliceIteratorType diffIterator( diffImage, diffImage->GetLargestPossibleRegion() );
// iterate over output slice (and over input slice simultaneously)
outputIterator.GoToBegin();
diffIterator.GoToBegin();
while ( !outputIterator.IsAtEnd() )
{
while ( !outputIterator.IsAtEndOfSlice() )
{
while ( !outputIterator.IsAtEndOfLine() )
{
TPixel2 newValue = outputIterator.Get() + (TPixel2) ((double)diffIterator.Get() * m_Factor);
outputIterator.Set( newValue );
++outputIterator;
++diffIterator;
}
outputIterator.NextLine();
}
outputIterator.NextSlice();
}
}
template<typename TPixel1, unsigned int VImageDimension1, typename TPixel2, unsigned int VImageDimension2>
void mitk::DiffImageApplier::ItkImageProcessing3DDiff( itk::Image<TPixel1,VImageDimension1>* diffImage, itk::Image<TPixel2,VImageDimension2>* outputImage )
{
typedef itk::Image<TPixel1, VImageDimension1> DiffImageType;
typedef itk::Image<TPixel2, VImageDimension2> VolumeImageType;
typedef itk::ImageRegionIterator< VolumeImageType > OutputSliceIteratorType;
typedef itk::ImageRegionConstIterator< DiffImageType > DiffSliceIteratorType;
OutputSliceIteratorType outputIterator( outputImage, outputImage->GetLargestPossibleRegion() );
DiffSliceIteratorType diffIterator( diffImage, diffImage->GetLargestPossibleRegion() );
// iterate over output slice (and over input slice simultaneously)
outputIterator.GoToBegin();
diffIterator.GoToBegin();
while ( !outputIterator.IsAtEnd() )
{
TPixel2 newValue = outputIterator.Get() + (TPixel2) ((double)diffIterator.Get() * m_Factor);
outputIterator.Set( newValue );
++outputIterator;
++diffIterator;
}
}
template<typename TPixel, unsigned int VImageDimension>
void mitk::DiffImageApplier::ItkInvertPixelValues( itk::Image<TPixel,VImageDimension>* itkImage )
{
typedef itk::ImageRegionIterator< itk::Image<TPixel,VImageDimension> > IteratorType;
IteratorType iter( itkImage, itkImage->GetLargestPossibleRegion() );
iter.GoToBegin();
while ( !iter.IsAtEnd() )
{
iter.Set( -( iter.Get() ) );
++iter;
}
}
diff --git a/Modules/MitkExt/Algorithms/mitkLabeledImageToSurfaceFilter.cpp b/Modules/MitkExt/Algorithms/mitkLabeledImageToSurfaceFilter.cpp
index 9515bdc66d..d7d47e5bf0 100644
--- a/Modules/MitkExt/Algorithms/mitkLabeledImageToSurfaceFilter.cpp
+++ b/Modules/MitkExt/Algorithms/mitkLabeledImageToSurfaceFilter.cpp
@@ -1,388 +1,392 @@
/*=========================================================================
Program: Medical Imaging & Interaction Toolkit
Language: C++
Date: $Date$
Version: $Revision$
Copyright (c) German Cancer Research Center, Division of Medical and
Biological Informatics. All rights reserved.
See MITKCopyright.txt or http://www.mitk.org/copyright.html for details.
This software is distributed WITHOUT ANY WARRANTY; without even
the implied warranty of MERCHANTABILITY or FITNESS FOR A PARTICULAR
PURPOSE. See the above copyright notices for more information.
=========================================================================*/
#include <mitkLabeledImageToSurfaceFilter.h>
#include <vtkImageChangeInformation.h>
#include <vtkImageThreshold.h>
#include <vtkImageGaussianSmooth.h>
#include <vtkImageMarchingCubes.h>
#include <vtkPolyData.h>
#include <vtkSmoothPolyDataFilter.h>
#include <vtkDecimatePro.h>
#if (VTK_MAJOR_VERSION < 5)
#include <vtkDecimate.h>
#endif
#include <vtkLinearTransform.h>
#include <vtkMatrix4x4.h>
#include <mitkImageAccessByItk.h>
+#include <mitkInstantiateAccessFunctions.h>
#include <itkImageRegionIterator.h>
#include <itkNumericTraits.h>
mitk::LabeledImageToSurfaceFilter::LabeledImageToSurfaceFilter() :
m_GaussianStandardDeviation(1.5),
m_GenerateAllLabels(true),
m_Label(1),
m_BackgroundLabel(0)
{
}
mitk::LabeledImageToSurfaceFilter::~LabeledImageToSurfaceFilter()
{
}
void mitk::LabeledImageToSurfaceFilter::GenerateOutputInformation()
{
Superclass::GenerateOutputInformation();
//
// check which labels are available in the image
//
m_AvailableLabels = this->GetAvailableLabels();
m_IdxToLabels.clear();
//
// if we don't want to generate surfaces for all labels
// we have to remove all labels except m_Label and m_BackgroundLabel
// from the list of available labels
//
if ( ! m_GenerateAllLabels )
{
LabelMapType tmp;
LabelMapType::iterator it;
it = m_AvailableLabels.find( m_Label );
if ( it != m_AvailableLabels.end() )
tmp[m_Label] = it->second;
else
tmp[m_Label] = 0;
it = m_AvailableLabels.find( m_BackgroundLabel );
if ( it != m_AvailableLabels.end() )
tmp[m_BackgroundLabel] = it->second;
else
tmp[m_BackgroundLabel] = 0;
m_AvailableLabels = tmp;
}
//
// check for the number of labels: if the whole image is filled, no
// background is available and thus the numberOfOutpus is equal to the
// number of available labels in the image (which is a special case).
// If we have background voxels, the number of outputs is one less than
// then number of available labels.
//
unsigned int numberOfOutputs = 0;
if ( m_AvailableLabels.find( m_BackgroundLabel ) == m_AvailableLabels.end() )
numberOfOutputs = m_AvailableLabels.size();
else
numberOfOutputs = m_AvailableLabels.size() - 1;
if ( numberOfOutputs == 0 )
{
itkWarningMacro("Number of outputs == 0");
}
//
// determine the number of time steps of the input image
//
mitk::Image* image = ( mitk::Image* )GetInput();
unsigned int numberOfTimeSteps = image->GetTimeSlicedGeometry()->GetTimeSteps();
//
// set the number of outputs to the number of labels used.
// initialize the output surfaces accordingly (incl. time steps)
//
this->SetNumberOfOutputs( numberOfOutputs );
this->SetNumberOfRequiredOutputs( numberOfOutputs );
for ( unsigned int i = 0 ; i < numberOfOutputs; ++i )
{
if ( ! this->GetOutput( i ) )
{
mitk::Surface::Pointer output = static_cast<mitk::Surface*>( this->MakeOutput(0).GetPointer() );
assert ( output.IsNotNull() );
output->Expand( numberOfTimeSteps );
this->SetNthOutput( i, output.GetPointer() );
}
}
}
void mitk::LabeledImageToSurfaceFilter::GenerateData()
{
mitk::Image* image = ( mitk::Image* )GetInput();
if ( image == NULL )
{
itkWarningMacro("Image is NULL");
return;
}
mitk::Image::RegionType outputRegion = image->GetRequestedRegion();
m_IdxToLabels.clear();
if ( this->GetNumberOfOutputs() == 0 )
return;
//
// traverse the known labels and create surfaces for them.
//
unsigned int currentOutputIndex = 0;
for ( LabelMapType::iterator it = m_AvailableLabels.begin() ; it != m_AvailableLabels.end() ; ++it )
{
if ( it->first == m_BackgroundLabel )
continue;
if ( ( it->second == 0 ) && m_GenerateAllLabels )
continue;
assert ( currentOutputIndex < this->GetNumberOfOutputs() );
mitk::Surface::Pointer surface = this->GetOutput( currentOutputIndex );
assert( surface.IsNotNull() );
int tstart=outputRegion.GetIndex(3);
int tmax=tstart+outputRegion.GetSize(3); //GetSize()==1 - will aber 0 haben, wenn nicht zeitaufgeloet
int t;
for( t=tstart; t < tmax; ++t)
{
vtkImageData *vtkimagedata = image->GetVtkImageData( t );
CreateSurface( t,vtkimagedata,surface.GetPointer(), it->first );
}
m_IdxToLabels[ currentOutputIndex ] = it->first;
currentOutputIndex++;
}
}
void mitk::LabeledImageToSurfaceFilter::CreateSurface( int time, vtkImageData *vtkimage, mitk::Surface * surface, mitk::LabeledImageToSurfaceFilter::LabelType label )
{
vtkImageChangeInformation *indexCoordinatesImageFilter = vtkImageChangeInformation::New();
indexCoordinatesImageFilter->SetInput(vtkimage);
indexCoordinatesImageFilter->SetOutputOrigin(0.0,0.0,0.0);
vtkImageThreshold* threshold = vtkImageThreshold::New();
threshold->SetInput( indexCoordinatesImageFilter->GetOutput() );
//indexCoordinatesImageFilter->Delete();
threshold->SetInValue( 100 );
threshold->SetOutValue( 0 );
threshold->ThresholdBetween( label, label );
threshold->SetOutputScalarTypeToUnsignedChar();
threshold->ReleaseDataFlagOn();
vtkImageGaussianSmooth *gaussian = vtkImageGaussianSmooth::New();
gaussian->SetInput( threshold->GetOutput() );
//threshold->Delete();
gaussian->SetDimensionality( 3 );
gaussian->SetRadiusFactor( 0.49 );
gaussian->SetStandardDeviation( GetGaussianStandardDeviation() );
gaussian->ReleaseDataFlagOn();
gaussian->UpdateInformation();
gaussian->Update();
//MarchingCube -->create Surface
vtkMarchingCubes *skinExtractor = vtkMarchingCubes::New();
skinExtractor->ReleaseDataFlagOn();
skinExtractor->SetInput(gaussian->GetOutput());//RC++
indexCoordinatesImageFilter->Delete();
skinExtractor->SetValue(0, 50);
vtkPolyData *polydata;
polydata = skinExtractor->GetOutput();
polydata->Register(NULL);//RC++
skinExtractor->Delete();
if (m_Smooth)
{
vtkSmoothPolyDataFilter *smoother = vtkSmoothPolyDataFilter::New();
//read poly1 (poly1 can be the original polygon, or the decimated polygon)
smoother->SetInput(polydata);//RC++
smoother->SetNumberOfIterations( m_SmoothIteration );
smoother->SetRelaxationFactor( m_SmoothRelaxation );
smoother->SetFeatureAngle( 60 );
smoother->FeatureEdgeSmoothingOff();
smoother->BoundarySmoothingOff();
smoother->SetConvergence( 0 );
polydata->Delete();//RC--
polydata = smoother->GetOutput();
polydata->Register(NULL);//RC++
smoother->Delete();
}
//
//#if (VTK_MAJOR_VERSION >= 5)
// if (m_Decimate == Decimate )
// {
// MITK_ERROR << "vtkDecimate not available for VTK 5.0 and above.";
// MITK_ERROR << " Using vtkDecimatePro instead." << std::endl;
// m_Decimate = DecimatePro;
// }
//#endif
//decimate = to reduce number of polygons
if(m_Decimate==DecimatePro)
{
vtkDecimatePro *decimate = vtkDecimatePro::New();
decimate->SplittingOff();
decimate->SetErrorIsAbsolute(5);
decimate->SetFeatureAngle(30);
decimate->PreserveTopologyOn();
decimate->BoundaryVertexDeletionOff();
decimate->SetDegree(10); //std-value is 25!
decimate->SetInput(polydata);//RC++
decimate->SetTargetReduction(m_TargetReduction);
decimate->SetMaximumError(0.002);
polydata->Delete();//RC--
polydata = decimate->GetOutput();
polydata->Register(NULL);//RC++
decimate->Delete();
}
#if (VTK_MAJOR_VERSION < 5)
else if (m_Decimate==Decimate)
{
vtkDecimate *decimate = vtkDecimate::New();
decimate->SetInput( polydata );
decimate->PreserveTopologyOn();
decimate->BoundaryVertexDeletionOff();
decimate->SetTargetReduction( m_TargetReduction );
polydata->Delete();//RC--
polydata = decimate->GetOutput();
polydata->Register(NULL);//RC++
decimate->Delete();
}
#endif
polydata->Update();
polydata->SetSource(NULL);
if(polydata->GetNumberOfPoints() > 0)
{
mitk::Vector3D spacing = GetInput()->GetGeometry(time)->GetSpacing();
vtkPoints * points = polydata->GetPoints();
vtkMatrix4x4 *vtkmatrix = vtkMatrix4x4::New();
GetInput()->GetGeometry(time)->GetVtkTransform()->GetMatrix(vtkmatrix);
double (*matrix)[4] = vtkmatrix->Element;
unsigned int i,j;
for(i=0;i<3;++i)
for(j=0;j<3;++j)
matrix[i][j]/=spacing[j];
unsigned int n = points->GetNumberOfPoints();
vtkFloatingPointType point[3];
for (i = 0; i < n; i++)
{
points->GetPoint(i, point);
mitkVtkLinearTransformPoint(matrix,point,point);
points->SetPoint(i, point);
}
vtkmatrix->Delete();
}
surface->SetVtkPolyData(polydata, time);
polydata->UnRegister(NULL);
gaussian->Delete();
threshold->Delete();
}
template < typename TPixel, unsigned int VImageDimension >
void GetAvailableLabelsInternal( itk::Image<TPixel, VImageDimension>* image, mitk::LabeledImageToSurfaceFilter::LabelMapType& availableLabels )
{
typedef itk::Image<TPixel, VImageDimension> ImageType;
typedef itk::ImageRegionIterator< ImageType > ImageRegionIteratorType;
availableLabels.clear();
ImageRegionIteratorType it( image, image->GetLargestPossibleRegion() );
it.GoToBegin();
mitk::LabeledImageToSurfaceFilter::LabelMapType::iterator labelIt;
while( ! it.IsAtEnd() )
{
labelIt = availableLabels.find( ( mitk::LabeledImageToSurfaceFilter::LabelType ) ( it.Get() ) );
if ( labelIt == availableLabels.end() )
{
availableLabels[ ( mitk::LabeledImageToSurfaceFilter::LabelType ) ( it.Get() ) ] = 1;
}
else
{
labelIt->second += 1;
}
++it;
}
}
-InstantiateAccessFunctionForFixedDimension_1(GetAvailableLabelsInternal, 3, mitk::LabeledImageToSurfaceFilter::LabelMapType&);
+#define InstantiateAccessFunction_GetAvailableLabelsInternal(pixelType, dim) \
+template void GetAvailableLabelsInternal(itk::Image<pixelType, dim>*, mitk::LabeledImageToSurfaceFilter::LabelMapType&);
+
+InstantiateAccessFunctionForFixedDimension(GetAvailableLabelsInternal, 3);
mitk::LabeledImageToSurfaceFilter::LabelMapType mitk::LabeledImageToSurfaceFilter::GetAvailableLabels()
{
mitk::Image::Pointer image = ( mitk::Image* )GetInput();
LabelMapType availableLabels;
AccessFixedDimensionByItk_1( image, GetAvailableLabelsInternal, 3, availableLabels );
return availableLabels;
}
void mitk::LabeledImageToSurfaceFilter::CreateSurface(int, vtkImageData*, mitk::Surface*, const ScalarType)
{
itkWarningMacro( "This function should never be called!" );
assert(false);
}
mitk::LabeledImageToSurfaceFilter::LabelType mitk::LabeledImageToSurfaceFilter::GetLabelForNthOutput( const unsigned int& idx )
{
IdxToLabelMapType::iterator it = m_IdxToLabels.find( idx );
if ( it != m_IdxToLabels.end() )
{
return it->second;
}
else
{
itkWarningMacro( "Unknown index encountered: " << idx << ". There are " << this->GetNumberOfOutputs() << " outputs available." );
return itk::NumericTraits<LabelType>::max();
}
}
mitk::ScalarType mitk::LabeledImageToSurfaceFilter::GetVolumeForNthOutput( const unsigned int& i )
{
return GetVolumeForLabel( GetLabelForNthOutput( i ) );
}
mitk::ScalarType mitk::LabeledImageToSurfaceFilter::GetVolumeForLabel( const mitk::LabeledImageToSurfaceFilter::LabelType& label )
{
// get the image spacing
mitk::Image* image = ( mitk::Image* )GetInput();
const float* spacing = image->GetSlicedGeometry()->GetFloatSpacing();
// get the number of voxels encountered for the given label,
// calculate the volume and return it.
LabelMapType::iterator it = m_AvailableLabels.find( label );
if ( it != m_AvailableLabels.end() )
{
return static_cast<float>(it->second) * ( spacing[0] * spacing[1] * spacing[2] / 1000.0f );
}
else
{
itkWarningMacro( "Unknown label encountered: " << label );
return 0.0;
}
}
diff --git a/Modules/MitkExt/Algorithms/mitkOverwriteDirectedPlaneImageFilter.cpp b/Modules/MitkExt/Algorithms/mitkOverwriteDirectedPlaneImageFilter.cpp
index a04d8e822b..37b9c6bca3 100644
--- a/Modules/MitkExt/Algorithms/mitkOverwriteDirectedPlaneImageFilter.cpp
+++ b/Modules/MitkExt/Algorithms/mitkOverwriteDirectedPlaneImageFilter.cpp
@@ -1,490 +1,491 @@
/*=========================================================================
Program: Medical Imaging & Interaction Toolkit
Language: C++
Date: $Date: 2010-01-14 14:20:26 +0100 (Do, 14 Jan 2010) $
Version: $Revision: 21047 $
Copyright (c) German Cancer Research Center, Division of Medical and
Biological Informatics. All rights reserved.
See MITKCopyright.txt or http://www.mitk.org/copyright.html for details.
This software is distributed WITHOUT ANY WARRANTY; without even
the implied warranty of MERCHANTABILITY or FITNESS FOR A PARTICULAR
PURPOSE. See the above copyright notices for more information.
=========================================================================*/
#include "mitkOverwriteDirectedPlaneImageFilter.h"
#include "mitkImageCast.h"
+#include "mitkImageAccessByItk.h"
#include "mitkSegmentationInterpolationController.h"
#include "mitkApplyDiffImageOperation.h"
#include "mitkOperationEvent.h"
#include "mitkInteractionConst.h"
#include "mitkUndoController.h"
#include "mitkDiffImageApplier.h"
#include "mitkImageTimeSelector.h"
#include <itkImageSliceIteratorWithIndex.h>
#include <itkImageRegionIterator.h>
mitk::OverwriteDirectedPlaneImageFilter::OverwriteDirectedPlaneImageFilter()
:m_PlaneGeometry(0),
m_ImageGeometry3D(0),
m_TimeStep(0),
m_Dimension0(0),
m_Dimension1(1),
m_CreateUndoInformation(false)
{
}
mitk::OverwriteDirectedPlaneImageFilter::~OverwriteDirectedPlaneImageFilter()
{
}
void mitk::OverwriteDirectedPlaneImageFilter::GenerateData()
{
//
// this is the place to implement the major part of undo functionality (bug #491)
// here we have to create undo/do operations
//
// WHO is the operation actor? This object may not be destroyed ever (design of undo stack)!
// -> some singleton method of this filter?
//
// neccessary additional objects:
// - something that executes the operations
// - the operation class (must hold a binary diff or something)
// - observer commands to know when the image is deleted (no further action then, perhaps even remove the operations from the undo stack)
//
//Image::ConstPointer input = ImageToImageFilter::GetInput(0);
Image::ConstPointer input3D = ImageToImageFilter::GetInput(0);
//Image::ConstPointer slice = m_SliceImage;
if ( input3D.IsNull() || m_SliceImage.IsNull() ) return;
if ( input3D->GetDimension() == 4 )
{
ImageTimeSelector::Pointer timeSelector = ImageTimeSelector::New();
timeSelector->SetInput( input3D );
timeSelector->SetTimeNr( m_TimeStep );
timeSelector->UpdateLargestPossibleRegion();
input3D = timeSelector->GetOutput();
}
m_ImageGeometry3D = input3D->GetGeometry();
/*
if ( m_SliceDifferenceImage.IsNull() ||
m_SliceDifferenceImage->GetDimension(0) != m_SliceImage->GetDimension(0) ||
m_SliceDifferenceImage->GetDimension(1) != m_SliceImage->GetDimension(1) )
{
m_SliceDifferenceImage = mitk::Image::New();
mitk::PixelType pixelType( typeid(short signed int) );
m_SliceDifferenceImage->Initialize( pixelType, 2, m_SliceImage->GetDimensions() );
}
*/
//MITK_INFO << "Overwriting slice " << m_SliceIndex << " in dimension " << m_SliceDimension << " at time step " << m_TimeStep << std::endl;
// this will do a long long if/else to find out both pixel types
/*AccessFixedDimensionByItk( input3D, ItkImageSwitch, 3 );*/
AccessFixedDimensionByItk( input3D, ItkSliceOverwriting, 3 );
//SegmentationInterpolationController* interpolator = SegmentationInterpolationController::InterpolatorForImage( input3D );
//if (interpolator)
//{
// interpolator->BlockModified(true);
// //interpolator->SetChangedSlice( m_SliceDifferenceImage, m_SliceDimension, m_SliceIndex, m_TimeStep );
//}
/*
if ( m_CreateUndoInformation )
{
// create do/undo operations (we don't execute the doOp here, because it has already been executed during calculation of the diff image
ApplyDiffImageOperation* doOp = new ApplyDiffImageOperation( OpTEST, const_cast<Image*>(input.GetPointer()), m_SliceDifferenceImage, m_TimeStep, m_SliceDimension, m_SliceIndex );
ApplyDiffImageOperation* undoOp = new ApplyDiffImageOperation( OpTEST, const_cast<Image*>(input.GetPointer()), m_SliceDifferenceImage, m_TimeStep, m_SliceDimension, m_SliceIndex );
undoOp->SetFactor( -1.0 );
OperationEvent* undoStackItem = new OperationEvent( DiffImageApplier::GetInstanceForUndo(), doOp, undoOp, this->EventDescription(m_SliceDimension, m_SliceIndex, m_TimeStep) );
UndoController::GetCurrentUndoModel()->SetOperationEvent( undoStackItem );
}
*/
// this image is modified (good to know for the renderer)
input3D->Modified();
/*if (interpolator)
{
interpolator->BlockModified(false);
}*/
}
template<typename TPixel, unsigned int VImageDimension>
void mitk::OverwriteDirectedPlaneImageFilter::ItkSliceOverwriting( itk::Image<TPixel,VImageDimension>* input3D )
{
typedef itk::Image<TPixel, VImageDimension-1> SliceImageType;
typedef itk::Image<TPixel, VImageDimension> VolumeImageType;
typedef itk::ImageSliceIteratorWithIndex< VolumeImageType > OutputSliceIteratorType;
typedef itk::ImageRegionConstIterator< SliceImageType > SliceIteratorType;
typename SliceImageType::Pointer sliceImage = SliceImageType::New();
CastToItkImage(m_SliceImage,sliceImage);
SliceIteratorType sliceIterator( sliceImage, sliceImage->GetLargestPossibleRegion() );
sliceIterator.GoToBegin();
Point3D currentPointIn2D;
Point3D worldPointIn3D;
//Here we just iterate over the slice which must be written into the 3D volumen and set the corresponding pixel in our 3D volume
while ( !sliceIterator.IsAtEnd() )
{
currentPointIn2D[0] = sliceIterator.GetIndex()[0]+0.5;
currentPointIn2D[1] = sliceIterator.GetIndex()[1]+0.5;
currentPointIn2D[2] = 0;
m_PlaneGeometry->IndexToWorld( currentPointIn2D, worldPointIn3D );
typename itk::Image<TPixel,VImageDimension>::IndexType outputIndex;
m_ImageGeometry3D->WorldToIndex( worldPointIn3D, outputIndex );
// Only access ITK image if it's inside
if ( m_ImageGeometry3D->IsIndexInside( outputIndex ) )
{
input3D->SetPixel( outputIndex, (TPixel)sliceIterator.Get() );
}
++sliceIterator;
}
}
/****TEST***/
//Maybe a bit more efficient but doesn`t already work. See also ExtractCirectedPlaneImageFilter
//typename itk::Image<TPixel2,VImageDimension2>::IndexType outputIndex;
//if ( columns == extent[0] )
//{
////If we are at the end of a row, then we have to go to the beginning of the next row
//currentImagePointIn3D = origin;
//currentImagePointIn3D += spacing[1]*bottom*currentPointIn2D[1];
//columns = 0;
//m_ImageGeometry3D->WorldToIndex(currentImagePointIn3D, outputIndex);
//}
//else
//{
//if ( columns != 0 )
//{
//currentImagePointIn3D += spacing[0]*right;
//}
//m_ImageGeometry3D->WorldToIndex(currentImagePointIn3D, outputIndex);
//}
//if ( m_ImageGeometry3D->IsIndexInside( outputIndex ))
//{
//outputImage->SetPixel( outputIndex, (TPixel2)inputIterator.Get() );
//}
//else if (currentImagePointIn3D == origin)
//{
//Point3D temp;
//temp[0] = bottom[0]*spacing[0]*0.5;
//temp[1] = bottom[1]*spacing[1]*0.5;
//temp[2] = bottom[2]*spacing[2]*0.5;
//origin[0] += temp[0];
//origin[1] += temp[1];
//origin[2] += temp[2];
//currentImagePointIn3D = origin;
//m_ImageGeometry3D->WorldToIndex(currentImagePointIn3D, outputIndex);
//if ( m_ImageGeometry3D->IsIndexInside( outputIndex ))
//{
//outputImage->SetPixel( outputIndex, (TPixel2)inputIterator.Get() );
//}
//}
//columns++;
/****TEST ENDE****/
//*
// // Offset the world coordinate by one pixel to compensate for
// // index/world origin differences.
// Point3D offsetIndex;
// offsetIndex.Fill( 1 );
// Point3D offsetWorld;
// offsetWorld.Fill( 0 );
// m_PlaneGeometry->IndexToWorld( offsetIndex, offsetWorld );
// // remove origin shift
// const Point3D origin = m_PlaneGeometry->GetOrigin();
// offsetWorld[0] -= origin[0];
// offsetWorld[1] -= origin[1];
// offsetWorld[2] -= origin[2];
// // offset world coordinate
// worldPointIn3D[ 0 ] += offsetWorld[0];
// worldPointIn3D[ 1 ] += offsetWorld[1];
// worldPointIn3D[ 2 ] += offsetWorld[2];
//*/
// basically copied from mitk/Core/Algorithms/mitkImageAccessByItk.h
/*#define myMITKOverwriteDirectedPlaneImageFilterAccessByItk(mitkImage, itkImageTypeFunction, pixeltype, dimension, itkimage2) \
// if ( typeId == typeid(pixeltype) ) \
//{ \
// typedef itk::Image<pixeltype, dimension> ImageType; \
// typedef mitk::ImageToItk<ImageType> ImageToItkType; \
// itk::SmartPointer<ImageToItkType> imagetoitk = ImageToItkType::New(); \
// imagetoitk->SetInput(mitkImage); \
// imagetoitk->Update(); \
// itkImageTypeFunction(imagetoitk->GetOutput(), itkimage2); \
//}
//
//#define myMITKOverwriteDirectedPlaneImageFilterAccessAllTypesByItk(mitkImage, itkImageTypeFunction, dimension, itkimage2) \
//{ \
// myMITKOverwriteDirectedPlaneImageFilterAccessByItk(mitkImage, itkImageTypeFunction, double, dimension, itkimage2) else \
// myMITKOverwriteDirectedPlaneImageFilterAccessByItk(mitkImage, itkImageTypeFunction, float, dimension, itkimage2) else \
// myMITKOverwriteDirectedPlaneImageFilterAccessByItk(mitkImage, itkImageTypeFunction, int, dimension, itkimage2) else \
// myMITKOverwriteDirectedPlaneImageFilterAccessByItk(mitkImage, itkImageTypeFunction, unsigned int, dimension, itkimage2) else \
// myMITKOverwriteDirectedPlaneImageFilterAccessByItk(mitkImage, itkImageTypeFunction, short, dimension, itkimage2) else \
// myMITKOverwriteDirectedPlaneImageFilterAccessByItk(mitkImage, itkImageTypeFunction, unsigned short, dimension, itkimage2) else \
// myMITKOverwriteDirectedPlaneImageFilterAccessByItk(mitkImage, itkImageTypeFunction, char, dimension, itkimage2) else \
// myMITKOverwriteDirectedPlaneImageFilterAccessByItk(mitkImage, itkImageTypeFunction, unsigned char, dimension, itkimage2) \
//}*/
//
//
//template<typename TPixel, unsigned int VImageDimension>
//void mitk::OverwriteDirectedPlaneImageFilter::ItkImageSwitch( itk::Image<TPixel,VImageDimension>* itkImage )
//{
// const std::type_info& typeId=*(m_SliceImage->GetPixelType().GetTypeId());
//
// myMITKOverwriteDirectedPlaneImageFilterAccessAllTypesByItk( m_SliceImage, ItkImageProcessing, 2, itkImage );
//}
//template<typename TPixel1, unsigned int VImageDimension1, typename TPixel2, unsigned int VImageDimension2>
//void mitk::OverwriteDirectedPlaneImageFilter::ItkImageProcessing( itk::Image<TPixel1,VImageDimension1>* inputImage, itk::Image<TPixel2,VImageDimension2>* outputImage )
//{
// typedef itk::Image<TPixel1, VImageDimension1> SliceImageType;
// typedef itk::Image<short signed int, VImageDimension1> DiffImageType;
// typedef itk::Image<TPixel2, VImageDimension2> VolumeImageType;
//
// typedef itk::ImageSliceIteratorWithIndex< VolumeImageType > OutputSliceIteratorType;
// typedef itk::ImageRegionConstIterator< SliceImageType > InputSliceIteratorType;
// //typedef itk::ImageRegionIterator< DiffImageType > DiffSliceIteratorType;
//
// InputSliceIteratorType inputIterator( inputImage, inputImage->GetLargestPossibleRegion() );
//
// //typename DiffImageType::Pointer diffImage;
// //CastToItkImage( m_SliceDifferenceImage, diffImage );
// //DiffSliceIteratorType diffIterator( diffImage, diffImage->GetLargestPossibleRegion() );
//
// inputIterator.GoToBegin();
// //diffIterator.GoToBegin();
//
// //TEST
// Point3D origin = m_PlaneGeometry->GetOrigin();
// Vector3D right = m_PlaneGeometry->GetAxisVector(0);
// Vector3D bottom = m_PlaneGeometry->GetAxisVector(1);
// right.Normalize();
// bottom.Normalize();
//
// Vector2D spacing = inputImage->GetSpacing();
//
// Vector2D extentInMM;
// extentInMM[0] = m_PlaneGeometry->GetExtentInMM(0);
// extentInMM[1] = m_PlaneGeometry->GetExtentInMM(1);
//
// Vector2D extent;
// extent[0] = m_PlaneGeometry->GetExtent(0);
// extent[1] = m_PlaneGeometry->GetExtent(1);
// //TEST ENDE
//
// Point3D currentPointIn2D, worldPointIn3D;
// TPixel2 outputPixel = 0;
//
// int debugCounter( 0 );
//
// std::ofstream geometryFile;
// geometryFile.precision(30);
// geometryFile.open("C:/Users/fetzer/Desktop/TEST/geometryFileOv.txt");
//
// geometryFile<<"Offset: [ "<<m_PlaneGeometry->GetIndexToWorldTransform()->GetOffset()[0]<<", "<<m_PlaneGeometry->GetIndexToWorldTransform()->GetOffset()[1]<<", "<<m_PlaneGeometry->GetIndexToWorldTransform()->GetOffset()[2]<<" ]"<<std::endl;
// geometryFile<<"Transform: "<<m_PlaneGeometry->GetIndexToWorldTransform()->GetMatrix()<<std::endl;
//
// //std::ofstream overriderFile;
// //overriderFile.open("C:/Users/fetzer/Desktop/TEST/overridePoints.txt");
//
// //std::ofstream overriderFileIndex;
// //overriderFileIndex.open("C:/Users/fetzer/Desktop/TEST/overrideIndexPoints.txt");
//
//
// //TEST
// Point3D currentImagePointIn3D = origin;
// unsigned int columns ( 0 );
// //TEST ENDE
//
// while ( !inputIterator.IsAtEnd() )
// {
// // Input world point
// currentPointIn2D[0] = inputIterator.GetIndex()[0]+0.5;
// currentPointIn2D[1] = inputIterator.GetIndex()[1]+0.5;
// currentPointIn2D[2] = 0;
//
//m_PlaneGeometry->IndexToWorld( currentPointIn2D, worldPointIn3D );
//
//typename itk::Image<TPixel2,VImageDimension2>::IndexType outputIndex;
// m_ImageGeometry3D->WorldToIndex( worldPointIn3D, outputIndex );
//
// // Only access ITK image if it's inside
// if ( m_ImageGeometry3D->IsIndexInside( outputIndex ) )
// {
// //outputPixel = outputImage->GetPixel( outputIndex );
// outputImage->SetPixel( outputIndex, (TPixel2)inputIterator.Get() );
// /*if( inputIterator.Get() == mitk::paint::addPixelValue )
// {
// outputImage->SetPixel( outputIndex, (TPixel2)( 1 ) );
// }
// else if( inputIterator.Get() == mitk::paint::subPixelValue )
// {
// outputImage->SetPixel( outputIndex, (TPixel2)( 0 ) );
// }*/
// }
//
///****TEST***/
//
////typename itk::Image<TPixel2,VImageDimension2>::IndexType outputIndex;
//
////if ( columns == extent[0] )
////{
//////If we are at the end of a row, then we have to go to the beginning of the next row
////currentImagePointIn3D = origin;
////currentImagePointIn3D += spacing[1]*bottom*currentPointIn2D[1];
//columns = 0;
////m_ImageGeometry3D->WorldToIndex(currentImagePointIn3D, outputIndex);
////}
////else
////{
////if ( columns != 0 )
////{
////currentImagePointIn3D += spacing[0]*right;
////}
////m_ImageGeometry3D->WorldToIndex(currentImagePointIn3D, outputIndex);
////}
//
////if ( m_ImageGeometry3D->IsIndexInside( outputIndex ))
////{
////outputImage->SetPixel( outputIndex, (TPixel2)inputIterator.Get() );
////}
////else if (currentImagePointIn3D == origin)
////{
////Point3D temp;
////temp[0] = bottom[0]*spacing[0]*0.5;
////temp[1] = bottom[1]*spacing[1]*0.5;
////temp[2] = bottom[2]*spacing[2]*0.5;
////origin[0] += temp[0];
////origin[1] += temp[1];
////origin[2] += temp[2];
////currentImagePointIn3D = origin;
////m_ImageGeometry3D->WorldToIndex(currentImagePointIn3D, outputIndex);
////if ( m_ImageGeometry3D->IsIndexInside( outputIndex ))
////{
////outputImage->SetPixel( outputIndex, (TPixel2)inputIterator.Get() );
////}
////}
////columns++;
//
///****TEST ENDE****/
//
////*
//// // Offset the world coordinate by one pixel to compensate for
//// // index/world origin differences.
//// Point3D offsetIndex;
//// offsetIndex.Fill( 1 );
//// Point3D offsetWorld;
//// offsetWorld.Fill( 0 );
//// m_PlaneGeometry->IndexToWorld( offsetIndex, offsetWorld );
//// // remove origin shift
//// const Point3D origin = m_PlaneGeometry->GetOrigin();
//// offsetWorld[0] -= origin[0];
//// offsetWorld[1] -= origin[1];
//// offsetWorld[2] -= origin[2];
//// // offset world coordinate
//// worldPointIn3D[ 0 ] += offsetWorld[0];
//// worldPointIn3D[ 1 ] += offsetWorld[1];
//// worldPointIn3D[ 2 ] += offsetWorld[2];
////*/
// // Output index
//
//
////For the purpose of debug
////if( debugCounter%100 == 0)
//////{
////Point3D contIndex;
////m_ImageGeometry3D->WorldToIndex(worldPointIn3D,contIndex);
////overriderFile.precision(10);
////overriderFile<<"2D-Index: [ "<<currentPointIn2D[0]<<", "<<currentPointIn2D[1]<<" ] "<<"WorldIndex: [ "<<worldPointIn3D[0]<<", "<<worldPointIn3D[1]<<", "<<worldPointIn3D[2]<<" ]"<<" ContIndex: [ "<<contIndex[0]<<", "<<contIndex[1]<<", "<<contIndex[2]<<" ]"<<" Index: [ "<<outputIndex[0]<<", "<<outputIndex[1]<<", "<<outputIndex[2]<<" ]"<<std::endl;
////overriderFile<<"[ "<<worldPointIn3D[0]<<", "<<worldPointIn3D[1]<<", "<<worldPointIn3D[2]<<" ]"<<std::endl;
////overriderFileIndex<<"2D-Index: [ "<<currentPointIn2D[0]<<", "<<currentPointIn2D[1]<<" ] "<<"3D-Index: [ "<<outputIndex[0]<<", "<<outputIndex[1]<<", "<<outputIndex[2]<<" ]"<<std::endl;
////}
//
// // Set difference image
// //diffIterator.Set( static_cast<short signed int>(inputIterator.Get() - outputPixel ) ); // oh oh, not good for bigger values
// ++inputIterator;
////++debugCounter;
// //++diffIterator;
// }
// /*overriderFile.close();
// overriderFileIndex.close();*/
// geometryFile.close();
//
///*
// typename VolumeImageType::RegionType sliceInVolumeRegion;
//
// sliceInVolumeRegion = outputImage->GetLargestPossibleRegion();
// sliceInVolumeRegion.SetSize( m_SliceDimension, 1 ); // just one slice
// sliceInVolumeRegion.SetIndex( m_SliceDimension, m_SliceIndex ); // exactly this slice, please
//
// OutputSliceIteratorType outputIterator( outputImage, sliceInVolumeRegion );
// outputIterator.SetFirstDirection(m_Dimension0);
// outputIterator.SetSecondDirection(m_Dimension1);
//
// // iterate over output slice (and over input slice simultaneously)
// outputIterator.GoToBegin();
// while ( !outputIterator.IsAtEnd() )
// {
// while ( !outputIterator.IsAtEndOfSlice() )
// {
// while ( !outputIterator.IsAtEndOfLine() )
// {
// diffIterator.Set( static_cast<short signed int>(inputIterator.Get() - outputIterator.Get()) ); // oh oh, not good for bigger values
// outputIterator.Set( (TPixel2) inputIterator.Get() );
// ++outputIterator;
// ++inputIterator;
// ++diffIterator;
// }
// outputIterator.NextLine();
// }
// outputIterator.NextSlice();
// }
// */
//}
/*
std::string mitk::OverwriteDirectedPlaneImageFilter::EventDescription( unsigned int sliceDimension, unsigned int sliceIndex, unsigned int timeStep )
{
std::stringstream s;
s << "Changed slice (";
switch (sliceDimension)
{
default:
case 2:
s << "T";
break;
case 1:
s << "C";
break;
case 0:
s << "S";
break;
}
s << " " << sliceIndex << " " << timeStep << ")";
return s.str();
}
*/
-
\ No newline at end of file
+
diff --git a/Modules/MitkExt/Algorithms/mitkOverwriteSliceImageFilter.cpp b/Modules/MitkExt/Algorithms/mitkOverwriteSliceImageFilter.cpp
index 58bd05baae..76d8bb8455 100644
--- a/Modules/MitkExt/Algorithms/mitkOverwriteSliceImageFilter.cpp
+++ b/Modules/MitkExt/Algorithms/mitkOverwriteSliceImageFilter.cpp
@@ -1,246 +1,247 @@
/*=========================================================================
Program: Medical Imaging & Interaction Toolkit
Language: C++
Date: $Date$
Version: $Revision$
Copyright (c) German Cancer Research Center, Division of Medical and
Biological Informatics. All rights reserved.
See MITKCopyright.txt or http://www.mitk.org/copyright.html for details.
This software is distributed WITHOUT ANY WARRANTY; without even
the implied warranty of MERCHANTABILITY or FITNESS FOR A PARTICULAR
PURPOSE. See the above copyright notices for more information.
=========================================================================*/
#include "mitkOverwriteSliceImageFilter.h"
#include "mitkImageCast.h"
+#include "mitkImageAccessByItk.h"
#include "mitkSegmentationInterpolationController.h"
#include "mitkApplyDiffImageOperation.h"
#include "mitkOperationEvent.h"
#include "mitkInteractionConst.h"
#include "mitkUndoController.h"
#include "mitkDiffImageApplier.h"
#include "mitkImageTimeSelector.h"
#include <itkImageSliceIteratorWithIndex.h>
#include <itkImageRegionIterator.h>
mitk::OverwriteSliceImageFilter::OverwriteSliceImageFilter()
:m_SliceIndex(0),
m_SliceDimension(0),
m_TimeStep(0),
m_Dimension0(0),
m_Dimension1(1),
m_CreateUndoInformation(false)
{
}
mitk::OverwriteSliceImageFilter::~OverwriteSliceImageFilter()
{
}
void mitk::OverwriteSliceImageFilter::GenerateData()
{
//
// this is the place to implement the major part of undo functionality (bug #491)
// here we have to create undo/do operations
//
// WHO is the operation actor? This object may not be destroyed ever (design of undo stack)!
// -> some singleton method of this filter?
//
// neccessary additional objects:
// - something that executes the operations
// - the operation class (must hold a binary diff or something)
// - observer commands to know when the image is deleted (no further action then, perhaps even remove the operations from the undo stack)
//
Image::ConstPointer input = ImageToImageFilter::GetInput(0);
Image::ConstPointer input3D = input;
Image::ConstPointer slice = m_SliceImage;
if ( input.IsNull() || slice.IsNull() ) return;
switch (m_SliceDimension)
{
default:
case 2:
m_Dimension0 = 0;
m_Dimension1 = 1;
break;
case 1:
m_Dimension0 = 0;
m_Dimension1 = 2;
break;
case 0:
m_Dimension0 = 1;
m_Dimension1 = 2;
break;
}
if ( slice->GetDimension() < 2 || input->GetDimension() > 4 ||
slice->GetDimension(0) != input->GetDimension(m_Dimension0) ||
slice->GetDimension(1) != input->GetDimension(m_Dimension1) ||
m_SliceIndex >= input->GetDimension(m_SliceDimension)
)
{
itkExceptionMacro("Slice and image dimensions differ or slice index is too large. Sorry, cannot work like this.");
return;
}
if ( input->GetDimension() == 4 )
{
ImageTimeSelector::Pointer timeSelector = ImageTimeSelector::New();
timeSelector->SetInput( input );
timeSelector->SetTimeNr( m_TimeStep );
timeSelector->UpdateLargestPossibleRegion();
input3D = timeSelector->GetOutput();
}
if ( m_SliceDifferenceImage.IsNull() ||
m_SliceDifferenceImage->GetDimension(0) != m_SliceImage->GetDimension(0) ||
m_SliceDifferenceImage->GetDimension(1) != m_SliceImage->GetDimension(1) )
{
m_SliceDifferenceImage = mitk::Image::New();
mitk::PixelType pixelType( typeid(short signed int) );
m_SliceDifferenceImage->Initialize( pixelType, 2, m_SliceImage->GetDimensions() );
}
//MITK_INFO << "Overwriting slice " << m_SliceIndex << " in dimension " << m_SliceDimension << " at time step " << m_TimeStep << std::endl;
// this will do a long long if/else to find out both pixel types
AccessFixedDimensionByItk( input3D, ItkImageSwitch, 3 );
SegmentationInterpolationController* interpolator = SegmentationInterpolationController::InterpolatorForImage( input );
if (interpolator)
{
interpolator->BlockModified(true);
interpolator->SetChangedSlice( m_SliceDifferenceImage, m_SliceDimension, m_SliceIndex, m_TimeStep );
}
if ( m_CreateUndoInformation )
{
// create do/undo operations (we don't execute the doOp here, because it has already been executed during calculation of the diff image
ApplyDiffImageOperation* doOp = new ApplyDiffImageOperation( OpTEST, const_cast<Image*>(input.GetPointer()), m_SliceDifferenceImage, m_TimeStep, m_SliceDimension, m_SliceIndex );
ApplyDiffImageOperation* undoOp = new ApplyDiffImageOperation( OpTEST, const_cast<Image*>(input.GetPointer()), m_SliceDifferenceImage, m_TimeStep, m_SliceDimension, m_SliceIndex );
undoOp->SetFactor( -1.0 );
OperationEvent* undoStackItem = new OperationEvent( DiffImageApplier::GetInstanceForUndo(), doOp, undoOp, this->EventDescription(m_SliceDimension, m_SliceIndex, m_TimeStep) );
UndoController::GetCurrentUndoModel()->SetOperationEvent( undoStackItem );
}
// this image is modified (good to know for the renderer)
input->Modified();
if (interpolator)
{
interpolator->BlockModified(false);
}
}
// basically copied from mitk/Core/Algorithms/mitkImageAccessByItk.h
#define myMITKOverwriteSliceImageFilterAccessByItk(mitkImage, itkImageTypeFunction, pixeltype, dimension, itkimage2) \
if ( typeId == typeid(pixeltype) ) \
{ \
typedef itk::Image<pixeltype, dimension> ImageType; \
typedef mitk::ImageToItk<ImageType> ImageToItkType; \
itk::SmartPointer<ImageToItkType> imagetoitk = ImageToItkType::New(); \
imagetoitk->SetInput(mitkImage); \
imagetoitk->Update(); \
itkImageTypeFunction(imagetoitk->GetOutput(), itkimage2); \
}
#define myMITKOverwriteSliceImageFilterAccessAllTypesByItk(mitkImage, itkImageTypeFunction, dimension, itkimage2) \
{ \
myMITKOverwriteSliceImageFilterAccessByItk(mitkImage, itkImageTypeFunction, double, dimension, itkimage2) else \
myMITKOverwriteSliceImageFilterAccessByItk(mitkImage, itkImageTypeFunction, float, dimension, itkimage2) else \
myMITKOverwriteSliceImageFilterAccessByItk(mitkImage, itkImageTypeFunction, int, dimension, itkimage2) else \
myMITKOverwriteSliceImageFilterAccessByItk(mitkImage, itkImageTypeFunction, unsigned int, dimension, itkimage2) else \
myMITKOverwriteSliceImageFilterAccessByItk(mitkImage, itkImageTypeFunction, short, dimension, itkimage2) else \
myMITKOverwriteSliceImageFilterAccessByItk(mitkImage, itkImageTypeFunction, unsigned short, dimension, itkimage2) else \
myMITKOverwriteSliceImageFilterAccessByItk(mitkImage, itkImageTypeFunction, char, dimension, itkimage2) else \
myMITKOverwriteSliceImageFilterAccessByItk(mitkImage, itkImageTypeFunction, unsigned char, dimension, itkimage2) \
}
template<typename TPixel, unsigned int VImageDimension>
void mitk::OverwriteSliceImageFilter::ItkImageSwitch( itk::Image<TPixel,VImageDimension>* itkImage )
{
const std::type_info& typeId=*(m_SliceImage->GetPixelType().GetTypeId());
myMITKOverwriteSliceImageFilterAccessAllTypesByItk( m_SliceImage, ItkImageProcessing, 2, itkImage );
}
template<typename TPixel1, unsigned int VImageDimension1, typename TPixel2, unsigned int VImageDimension2>
void mitk::OverwriteSliceImageFilter::ItkImageProcessing( itk::Image<TPixel1,VImageDimension1>* inputImage, itk::Image<TPixel2,VImageDimension2>* outputImage )
{
typedef itk::Image<TPixel1, VImageDimension1> SliceImageType;
typedef itk::Image<short signed int, VImageDimension1> DiffImageType;
typedef itk::Image<TPixel2, VImageDimension2> VolumeImageType;
typedef itk::ImageSliceIteratorWithIndex< VolumeImageType > OutputSliceIteratorType;
typedef itk::ImageRegionConstIterator< SliceImageType > InputSliceIteratorType;
typedef itk::ImageRegionIterator< DiffImageType > DiffSliceIteratorType;
typename VolumeImageType::RegionType sliceInVolumeRegion;
sliceInVolumeRegion = outputImage->GetLargestPossibleRegion();
sliceInVolumeRegion.SetSize( m_SliceDimension, 1 ); // just one slice
sliceInVolumeRegion.SetIndex( m_SliceDimension, m_SliceIndex ); // exactly this slice, please
OutputSliceIteratorType outputIterator( outputImage, sliceInVolumeRegion );
outputIterator.SetFirstDirection(m_Dimension0);
outputIterator.SetSecondDirection(m_Dimension1);
InputSliceIteratorType inputIterator( inputImage, inputImage->GetLargestPossibleRegion() );
typename DiffImageType::Pointer diffImage;
CastToItkImage( m_SliceDifferenceImage, diffImage );
DiffSliceIteratorType diffIterator( diffImage, diffImage->GetLargestPossibleRegion() );
// iterate over output slice (and over input slice simultaneously)
outputIterator.GoToBegin();
inputIterator.GoToBegin();
diffIterator.GoToBegin();
while ( !outputIterator.IsAtEnd() )
{
while ( !outputIterator.IsAtEndOfSlice() )
{
while ( !outputIterator.IsAtEndOfLine() )
{
diffIterator.Set( static_cast<short signed int>(inputIterator.Get() - outputIterator.Get()) ); // oh oh, not good for bigger values
outputIterator.Set( (TPixel2) inputIterator.Get() );
++outputIterator;
++inputIterator;
++diffIterator;
}
outputIterator.NextLine();
}
outputIterator.NextSlice();
}
}
std::string mitk::OverwriteSliceImageFilter::EventDescription( unsigned int sliceDimension, unsigned int sliceIndex, unsigned int timeStep )
{
std::stringstream s;
s << "Changed slice (";
switch (sliceDimension)
{
default:
case 2:
s << "T";
break;
case 1:
s << "C";
break;
case 0:
s << "S";
break;
}
s << " " << sliceIndex << " " << timeStep << ")";
return s.str();
}
diff --git a/Modules/MitkExt/Algorithms/mitkPlaneCutFilter.h b/Modules/MitkExt/Algorithms/mitkPlaneCutFilter.h
index 9faede0175..5d7f699398 100644
--- a/Modules/MitkExt/Algorithms/mitkPlaneCutFilter.h
+++ b/Modules/MitkExt/Algorithms/mitkPlaneCutFilter.h
@@ -1,77 +1,77 @@
/*=========================================================================
Program: Medical Imaging & Interaction Toolkit
Language: C++
Date: $Date$
Version: $Revision$
Copyright (c) German Cancer Research Center, Division of Medical and
Biological Informatics. All rights reserved.
See MITKCopyright.txt or http://www.mitk.org/copyright.html for details.
This software is distributed WITHOUT ANY WARRANTY; without even
the implied warranty of MERCHANTABILITY or FITNESS FOR A PARTICULAR
PURPOSE. See the above copyright notices for more information.
=========================================================================*/
#ifndef PLANECUTFILTER_H_HEADER_INCLUDED_C1F48A22
#define PLANECUTFILTER_H_HEADER_INCLUDED_C1F48A22
#include "mitkCommon.h"
#include "MitkExtExports.h"
#include "mitkImageToImageFilter.h"
#include "mitkPlaneGeometry.h"
namespace itk
{
template <class TPixel, unsigned int VImageDimension> class ITK_EXPORT Image;
}
namespace mitk {
/**
\brief Filter to cut an image with a plane.
Everything in the direction of the normal
of the planes (if fill mode is set to "FILL") will be set to a specified value.
*/
class MitkExt_EXPORT PlaneCutFilter : public ImageToImageFilter
{
public:
mitkClassMacro(PlaneCutFilter, ImageToImageFilter);
/** Method for creation through the object factory. */
itkNewMacro(Self);
typedef enum {FILL, FILL_INVERSE} FillMode;
//##Documentation
//## @brief Set background grey level
itkSetMacro(BackgroundLevel, float);
itkGetMacro(BackgroundLevel, float);
- itkSetMacro(FillMode, FillMode);
- itkGetMacro(FillMode, FillMode);
+ itkSetEnumMacro(FillMode, FillMode);
+ itkGetEnumMacro(FillMode, FillMode);
itkSetObjectMacro(Plane, const PlaneGeometry);
itkGetObjectMacro(Plane, const PlaneGeometry);
protected:
float m_BackgroundLevel;
PlaneGeometry::ConstPointer m_Plane;
FillMode m_FillMode;
PlaneCutFilter();
~PlaneCutFilter();
virtual void GenerateData();
template <typename TPixel, unsigned int VImageDimension>
void _computeIntersection(itk::Image<TPixel, VImageDimension> *itkImage, const PlaneGeometry *plane, const Geometry3D *geometry);
};
} // namespace mitk
#endif /* PLANECUTFILTER_H_HEADER_INCLUDED_C1F48A22 */
diff --git a/Modules/MitkExt/Algorithms/mitkPlaneFit.cpp b/Modules/MitkExt/Algorithms/mitkPlaneFit.cpp
index de773d509f..56ecfbe975 100644
--- a/Modules/MitkExt/Algorithms/mitkPlaneFit.cpp
+++ b/Modules/MitkExt/Algorithms/mitkPlaneFit.cpp
@@ -1,212 +1,203 @@
/*=========================================================================
Program: Medical Imaging & Interaction Toolkit
Language: C++
Date: $Date$
Version: $Revision$
Copyright (c) German Cancer Research Center, Division of Medical and
Biological Informatics. All rights reserved.
See MITKCopyright.txt or http://www.mitk.org/copyright.html for details.
This software is distributed WITHOUT ANY WARRANTY; without even
the implied warranty of MERCHANTABILITY or FITNESS FOR A PARTICULAR
PURPOSE. See the above copyright notices for more information.
=========================================================================*/
#include "mitkPlaneFit.h"
#include "mitkPlaneGeometry.h"
#include "mitkGeometryData.h"
#include <vnl/algo/vnl_svd.h>
#include <vcl_iostream.h>
mitk::PlaneFit::PlaneFit()
: m_PointSet( NULL )
{
m_TimeSlicedGeometry = mitk::TimeSlicedGeometry::New();
}
mitk::PlaneFit::~PlaneFit()
{
}
void mitk::PlaneFit::GenerateOutputInformation()
{
mitk::PointSet::ConstPointer input = this->GetInput();
mitk::GeometryData::Pointer output = this->GetOutput();
itkDebugMacro(<<"GenerateOutputInformation()");
if (input.IsNull()) return;
if ( m_PointSet == NULL )
{
return;
}
bool update = false;
if ( output->GetGeometry() == NULL || output->GetTimeSlicedGeometry() == NULL )
update = true;
if ( ( ! update ) && ( output->GetTimeSlicedGeometry()->GetTimeSteps() != input->GetTimeSlicedGeometry()->GetTimeSteps() ) )
update = true;
if ( update )
{
mitk::PlaneGeometry::Pointer planeGeometry = mitk::PlaneGeometry::New();
m_TimeSlicedGeometry->InitializeEvenlyTimed(
planeGeometry, m_PointSet->GetPointSetSeriesSize() );
unsigned int t;
for ( t = 0;
(t < m_PointSet->GetPointSetSeriesSize())
&& (t < m_Planes.size());
++t )
{
m_TimeSlicedGeometry->SetGeometry3D( m_Planes[t], (int) t );
}
output->SetGeometry( m_TimeSlicedGeometry );
}
}
void mitk::PlaneFit::GenerateData()
{
unsigned int t;
for ( t = 0; t < m_PointSet->GetPointSetSeriesSize(); ++t )
{
// check number of data points - less then 3points isn't enough
if ( m_PointSet->GetSize( t ) >= 3 )
{
this->CalculateCentroid( t );
this->ProcessPointSet( t );
this->InitializePlane( t );
}
}
}
void mitk::PlaneFit::SetInput( const mitk::PointSet* pointSet )
{
// Process object is not const-correct so the const_cast is required here
this->ProcessObject::SetNthInput(0,
const_cast< mitk::PointSet * >( pointSet ) );
m_PointSet = pointSet;
unsigned int pointSetSize = pointSet->GetPointSetSeriesSize();
m_Planes.resize( pointSetSize );
m_Centroids.resize( pointSetSize );
m_PlaneVectors.resize( pointSetSize );
unsigned int t;
for ( t = 0; t < pointSetSize; ++t )
{
m_Planes[t] = mitk::PlaneGeometry::New();
}
}
const mitk::PointSet* mitk::PlaneFit::GetInput()
{
if (this->GetNumberOfInputs() < 1)
{
return 0;
}
return static_cast<const mitk::PointSet * > (this->ProcessObject::GetInput(0) );
}
void mitk::PlaneFit::CalculateCentroid( int t )
{
if ( m_PointSet == NULL ) return;
int ps_total = m_PointSet->GetSize( t );
m_Centroids[t][0] = m_Centroids[t][1] = m_Centroids[t][2] = 0.0;
- // sum of all points
- mitk::PointSet::PointsContainer::Iterator pit, end;
- pit = m_PointSet->GetPointSet( t )->GetPoints()->Begin();
- end = m_PointSet->GetPointSet( t )->GetPoints()->End();
- for ( ; pit!=end; ++pit )
+ for (int i=0; i<ps_total; i++)
{
- mitk::Point3D p3d = pit.Value();
+ mitk::Point3D p3d = m_PointSet->GetPoint(i,t);
m_Centroids[t][0] += p3d[0];
m_Centroids[t][1] += p3d[1];
m_Centroids[t][2] += p3d[2];
}
// calculation of centroid
m_Centroids[t][0] /= ps_total;
m_Centroids[t][1] /= ps_total;
m_Centroids[t][2] /= ps_total;
}
void mitk::PlaneFit::ProcessPointSet( int t )
{
if (m_PointSet == NULL ) return;
// int matrix with POINTS x (X,Y,Z)
vnl_matrix<mitk::ScalarType> dataM( m_PointSet->GetSize( t ), 3);
- // calculate point distance to centroid and inserting it in the matrix
- mitk::PointSet::PointsContainer::Iterator pit, end;
- pit = m_PointSet->GetPointSet( t )->GetPoints()->Begin();
- end = m_PointSet->GetPointSet( t )->GetPoints()->End();
-
- for (int p=0; pit!=end; pit++, p++)
+ int ps_total = m_PointSet->GetSize( t );
+ for (int i=0; i<ps_total; i++)
{
- mitk::Point3D p3d = pit.Value();
- dataM[p][0] = p3d[0] - m_Centroids[t][0];
- dataM[p][1] = p3d[1] - m_Centroids[t][1];
- dataM[p][2] = p3d[2] - m_Centroids[t][2];
+ mitk::Point3D p3d = m_PointSet->GetPoint(i,t);
+ dataM[i][0] = p3d[0] - m_Centroids[t][0];
+ dataM[i][1] = p3d[1] - m_Centroids[t][1];
+ dataM[i][2] = p3d[2] - m_Centroids[t][2];
}
-
// process the SVD (singular value decomposition) from ITK
// the vector will be orderd descending
vnl_svd<mitk::ScalarType> svd(dataM, 0.0);
// calculate the SVD of A
vnl_vector<mitk::ScalarType> v = svd.nullvector();
// Avoid erratic normal sign switching when the plane changes minimally
// by negating the vector for negative x values.
if ( v[0] < 0 )
{
v = -v;
}
m_PlaneVectors[t][0] = v[0];
m_PlaneVectors[t][1] = v[1];
m_PlaneVectors[t][2] = v[2];
}
mitk::PlaneGeometry::Pointer mitk::PlaneFit::GetPlaneGeometry( int t )
{
return m_Planes[t];
}
const mitk::Vector3D &mitk::PlaneFit::GetPlaneNormal( int t ) const
{
return m_PlaneVectors[t];
}
const mitk::Point3D &mitk::PlaneFit::GetCentroid( int t ) const
{
return m_Centroids[t];
}
void mitk::PlaneFit::InitializePlane( int t )
{
m_Planes[t]->InitializePlane( m_Centroids[t], m_PlaneVectors[t] );
}
diff --git a/Modules/MitkExt/Algorithms/mitkPlanesPerpendicularToLinesFilter.cpp b/Modules/MitkExt/Algorithms/mitkPlanesPerpendicularToLinesFilter.cpp
index 19e41695e5..82d9da2155 100644
--- a/Modules/MitkExt/Algorithms/mitkPlanesPerpendicularToLinesFilter.cpp
+++ b/Modules/MitkExt/Algorithms/mitkPlanesPerpendicularToLinesFilter.cpp
@@ -1,213 +1,213 @@
/*=========================================================================
Program: Medical Imaging & Interaction Toolkit
Language: C++
Date: $Date$
Version: $Revision$
Copyright (c) German Cancer Research Center, Division of Medical and
Biological Informatics. All rights reserved.
See MITKCopyright.txt or http://www.mitk.org/copyright.html for details.
This software is distributed WITHOUT ANY WARRANTY; without even
the implied warranty of MERCHANTABILITY or FITNESS FOR A PARTICULAR
PURPOSE. See the above copyright notices for more information.
=========================================================================*/
#include "mitkPlanesPerpendicularToLinesFilter.h"
#include <vnl/vnl_cross.h>
#include <vnl/vnl_quaternion.h>
#include <vnl/vnl_quaternion.txx>
mitk::PlanesPerpendicularToLinesFilter::PlanesPerpendicularToLinesFilter()
: m_Plane(NULL), m_UseAllPoints(false), m_CreatedGeometries(NULL), normal(3), targetRight(3)
{
m_CreatedGeometries = mitk::SlicedGeometry3D::New();
}
mitk::PlanesPerpendicularToLinesFilter::~PlanesPerpendicularToLinesFilter()
{
}
void mitk::PlanesPerpendicularToLinesFilter::GenerateOutputInformation()
{
mitk::Mesh::ConstPointer input = this->GetInput();
mitk::GeometryData::Pointer output = this->GetOutput();
itkDebugMacro(<<"GenerateOutputInformation()");
if(input.IsNull()) return;
output->SetGeometry(m_CreatedGeometries);
}
void mitk::PlanesPerpendicularToLinesFilter::CreatePlane(const mitk::Point3D& curr)
{
int j;
for(j=0;j<3;++j)
normal[j] = last[j]-curr[j]; //@todo globally define normal direction of display xxx
normal.normalize();
down = vnl_cross_3d(normal, targetRight);
down.normalize();
right = vnl_cross_3d(down, normal);
right.normalize();
itk2vtk(last.Get_vnl_vector()-right*halfWidthInMM-down*halfHeightInMM, origin);
right *= targetSpacing[0];
down *= targetSpacing[1];
normal *= targetSpacing[2];
mitk::Matrix3D matrix;
matrix.GetVnlMatrix().set_column(0, right);
matrix.GetVnlMatrix().set_column(1, down);
matrix.GetVnlMatrix().set_column(2, normal);
PlaneGeometry::Pointer plane = PlaneGeometry::New();
plane->GetIndexToWorldTransform()->SetMatrix(matrix);
plane->SetOrigin(origin);
plane->SetBounds(bounds);
planes.push_back(plane);
last = curr;
}
void mitk::PlanesPerpendicularToLinesFilter::GenerateData()
{
mitk::Mesh::ConstPointer input = this->GetInput();
mitk::GeometryData::Pointer output = this->GetOutput();
if(m_Plane.IsNotNull())
{
targetRight = m_Plane->GetMatrixColumn(0);
targetSpacing = m_Plane->GetSpacing();
bounds = m_Plane->GetBoundingBox()->GetBounds();
halfWidthInMM = m_Plane->GetExtentInMM(0)*0.5;
halfHeightInMM = m_Plane->GetExtentInMM(1)*0.5;
}
else
{
FillVector3D(targetRight, 1.0, 0.0, 0.0);
targetSpacing.Fill(1.0);
halfWidthInMM=halfHeightInMM=100.0;
ScalarType stdBounds[6] = {0.0, 2.0*halfWidthInMM, 0.0, 2.0*halfHeightInMM, 0.0, 0.0};
bounds = stdBounds;
}
if(m_UseAllPoints==false)
{
int i, size;
//iterate through all cells and build planes
Mesh::ConstCellIterator cellIt, cellEnd;
cellEnd = input->GetMesh()->GetCells()->End();
for( cellIt = input->GetMesh()->GetCells()->Begin(); cellIt != cellEnd; ++cellIt )
{
Mesh::CellType& cell = *cellIt->Value();
Mesh::PointIdIterator ptIt, ptEnd;
ptEnd = cell.PointIdsEnd();
size=cell.GetNumberOfPoints();
if(size<=1)
continue;
ptIt = cell.PointIdsBegin();
last = input->GetPoint(*ptIt);
++ptIt;
for(i=1;i<size;++i, ++ptIt)
{
CreatePlane(input->GetPoint(*ptIt));
}
}
}
else //m_UseAllPoints==true
{
//iterate through all points and build planes
mitk::PointSet::PointsConstIterator it, pend = input->GetPointSet()->GetPoints()->End();
it=input->GetPointSet()->GetPoints()->Begin();
last = it.Value();
++it;
for(;it!=pend;++it)
{
CreatePlane(it.Value());
}
}
if(planes.size()>0)
{
//initialize sliced-geometry for the number of created planes
- m_CreatedGeometries->Initialize(planes.size()+1);
+ m_CreatedGeometries->InitializeSlicedGeometry(planes.size()+1);
//set last plane at last point with same normal as the one before the last
PlaneGeometry::Pointer plane = static_cast<PlaneGeometry*>((*planes.rbegin())->Clone().GetPointer());
itk2vtk(last.Get_vnl_vector()-right*halfWidthInMM-down*halfHeightInMM, origin);
plane->SetOrigin(origin);
m_CreatedGeometries->SetGeometry2D(plane, planes.size());
//add all planes to sliced-geometry
int s;
for(s=0; planes.empty()==false; planes.pop_front(), ++s)
{
m_CreatedGeometries->SetGeometry2D(planes.front(), s);
}
m_CreatedGeometries->SetEvenlySpaced(false);
if(m_FrameGeometry.IsNotNull())
{
m_CreatedGeometries->SetIndexToWorldTransform(m_FrameGeometry->GetIndexToWorldTransform());
m_CreatedGeometries->SetBounds(m_FrameGeometry->GetBounds());
m_CreatedGeometries->SetReferenceGeometry(m_FrameGeometry);
}
}
output->SetGeometry(m_CreatedGeometries);
}
void mitk::PlanesPerpendicularToLinesFilter::SetPlane(const mitk::PlaneGeometry* aPlane)
{
if(aPlane!=NULL)
{
m_Plane = static_cast<mitk::PlaneGeometry*>(aPlane->Clone().GetPointer());
}
else
{
if(m_Plane.IsNull())
return;
m_Plane=NULL;
}
Modified();
}
const mitk::Mesh *mitk::PlanesPerpendicularToLinesFilter::GetInput(void)
{
if (this->GetNumberOfInputs() < 1)
{
return 0;
}
return static_cast<const mitk::Mesh * >
(this->ProcessObject::GetInput(0) );
}
void mitk::PlanesPerpendicularToLinesFilter::SetInput(const mitk::Mesh *input)
{
// Process object is not const-correct so the const_cast is required here
this->ProcessObject::SetNthInput(0,
const_cast< mitk::Mesh * >( input ) );
}
void mitk::PlanesPerpendicularToLinesFilter::SetFrameGeometry(const mitk::Geometry3D* frameGeometry)
{
if((frameGeometry != NULL) && (frameGeometry->IsValid()))
{
m_FrameGeometry = static_cast<mitk::Geometry3D*>(frameGeometry->Clone().GetPointer());
}
else
{
m_FrameGeometry = NULL;
}
}
diff --git a/Modules/MitkExt/Algorithms/mitkPointLocator.h b/Modules/MitkExt/Algorithms/mitkPointLocator.h
index 2ca4d6c368..205b5a602e 100644
--- a/Modules/MitkExt/Algorithms/mitkPointLocator.h
+++ b/Modules/MitkExt/Algorithms/mitkPointLocator.h
@@ -1,226 +1,226 @@
/*=========================================================================
Program: Medical Imaging & Interaction Toolkit
Language: C++
Date: $Date$
Version: $Revision$
Copyright (c) German Cancer Research Center, Division of Medical and
Biological Informatics. All rights reserved.
See MITKCopyright.txt or http://www.mitk.org/copyright.html for details.
This software is distributed WITHOUT ANY WARRANTY; without even
the implied warranty of MERCHANTABILITY or FITNESS FOR A PARTICULAR
PURPOSE. See the above copyright notices for more information.
=========================================================================*/
#ifndef _MITK_POINT_LOCATOR__H__
#define _MITK_POINT_LOCATOR__H__
#include <itkObject.h>
#include "MitkExtExports.h"
#include "mitkPointSet.h"
#include <vtkPoints.h>
//forward declarations
class vtkPointSet;
class ANNkd_tree;
namespace mitk
{
/**
* Convenience wrapper around ANN to provide fast nearest neighbour searches.
* Usage: set your points via SetPoints( vtkPointSet* Points ) or SetPoints(mitk::PointSet*).
* Then, you may query the closest point to an arbitrary coordinate by FindClosestPoint().
* There is no further call to update etc. needed.
* Currently only calls for 1 nearest neighbour are supported. Feel free to add functions
* for K nearest neighbours.
* NOTE: At least 1 point must be contained in the point set.
*/
class MitkExt_EXPORT PointLocator : public itk::Object
{
public:
mitkClassMacro( PointLocator, Object );
itkNewMacro( Self );
typedef int IdType;
typedef float DistanceType;
typedef float PixelType;
typedef double CoordRepType;
typedef itk::DefaultStaticMeshTraits<PixelType, 3, 2, CoordRepType,
CoordRepType, PixelType> MeshTraits;
typedef itk::PointSet<PixelType, 3, MeshTraits> ITKPointSet;
/**
* Sets the point which will be used for nearest-neighbour searches. Note
* there must be at least one point in the point set.
* @param points the point set containing points for nearest neighbours searches.
*/
void SetPoints( vtkPointSet* points );
/**
* Sets the point which will be used for nearest-neighbour searches. Note
* there must be at least one point in the point set.
* @param points the point set containing points for nearest neighbours searches.
*/
void SetPoints( mitk::PointSet* points );
/**
* Sets the point which will be used for nearest-neighbour searches. Note
* there must be at least one point in the point set.
* @param points the point set containing points for nearest neighbours searches.
*/
void SetPoints( ITKPointSet* pointSet );
/**
* Finds the nearest neighbour in the point set previously defined by SetPoints().
* The Id of the point is returned. Please note, that there is no case, in which
* no point is found, since as a precondition at least one point has to be contained
* in the point set.
* @param point the query point, for whom the nearest neighbour will be determined
* @returns the id of the nearest neighbour of the given point. The id corresponds to the id
* which is given in the original point set.
*/
IdType FindClosestPoint( const vtkFloatingPointType point[3] );
/**
* Finds the nearest neighbour in the point set previously defined by SetPoints().
* The Id of the point is returned. Please note, that there is no case, in which
* no point is found, since as a precondition at least one point has to be contained
* in the point set.
* @param x the x coordinated of the query point, for whom the nearest neighbour will be determined
* @param y the x coordinated of the query point, for whom the nearest neighbour will be determined
* @param z the x coordinated of the query point, for whom the nearest neighbour will be determined
* @returns the id of the nearest neighbour of the given point. The id corresponds to the id
* which is given in the original point set.
*/
IdType FindClosestPoint( vtkFloatingPointType x, vtkFloatingPointType y, vtkFloatingPointType z );
/**
* Finds the nearest neighbour in the point set previously defined by SetPoints().
* The Id of the point is returned. Please note, that there is no case, in which
* no point is found, since as a precondition at least one point has to be contained
* in the point set.
* @param point the query point, for whom the nearest neighbour will be determined
* @returns the id of the nearest neighbour of the given point. The id corresponds to the id
* which is given in the original point set.
*/
IdType FindClosestPoint( mitk::PointSet::PointType point );
/**
* Finds the nearest neighbour in the point set previously defined by SetPoints().
* The minimal distance between this point and the closest point of the point set is returned.
* Please note, that there is no case, in which
* no point is found, since as a precondition at least one point has to be contained
* in the point set.
* @param point the query point, for whom the minimal distance will be determined
* @returns the distance in world coordinates between the nearest point in point set and the given point
*/
DistanceType GetMinimalDistance( mitk::PointSet::PointType point );
/**
* Finds the nearest neighbour in the point set previously defined by SetPoints().
* The Index and minimal distance between this point and the closest point of the point set is returned.
* Please note, that there is no case, in which
* no point is found, since as a precondition at least one point has to be contained
* in the point set.
* @param point the query point, for whom the minimal distance will be determined
* @returns the index of and distance (in world coordinates) between the nearest point in point set and the given point
*/
bool FindClosestPointAndDistance( mitk::PointSet::PointType point, IdType* id, DistanceType* dist);
protected:
//
// Definition of a vector of ids
//
typedef std::vector<IdType> IdVectorType;
//
// ANN related typedefs, to prevent ANN from being in the global include path.
// Please note, that these line are prone to failure, if the point type in
// ANN changes. Please note also, that these typedefs are only used in the header
// file. The implementation always refers to the original types
//
typedef float* MyANNpoint;
typedef int MyANNidx;
typedef float MyANNdist;
typedef MyANNpoint* MyANNpointArray;
typedef MyANNidx* MyANNidxArray;
typedef MyANNdist* MyANNdistArray;
/**
* constructor
*/
PointLocator();
/**
* destructor
*/
~PointLocator();
/**
* Initializes the ann search tree using previously defined points
*/
void InitANN();
/**
* releases all memory occupied by the ann search tree and internal point set arrays
*/
void DestroyANN();
/**
* Finds the nearest neighbour in the point set previously defined by SetPoints().
* The Id of the point is returned. Please note, that there is no case, in which
* no point is found, since as a precondition at least one point has to be contained
* in the point set.
* @param point the query point, for whom the nearest neighbour will be determined
* @returns the id of the nearest neighbour of the given point. The id corresponds to the id
* which is given in the original point set.
*/
IdType FindClosestPoint( const MyANNpoint& point);
/**
* Finds the minimal distance between the given point and a point in the previously defined point set.
* The distance is returned. Please note, that there is no case, in which
* no distance is found, since as a precondition at least one point has to be contained
* in the point set.
* @param point the query point, for whom the minimal distance to a point in the previously defined point set will be determined
- * @returns the distance in world coordinates between the given point and the nearest neighbour.
+ * @returns the squared distance in world coordinates between the given point and the nearest neighbour.
*/
DistanceType GetMinimalDistance( const MyANNpoint& point);
bool m_SearchTreeInitialized;
IdVectorType m_IndexToPointIdContainer;
vtkPoints* m_VtkPoints;
mitk::PointSet* m_MitkPoints;
ITKPointSet* m_ItkPoints;
//
// ANN related variables
//
unsigned int m_ANNK;
unsigned int m_ANNDimension;
double m_ANNEpsilon;
MyANNpointArray m_ANNDataPoints;
MyANNpoint m_ANNQueryPoint;
MyANNidxArray m_ANNPointIndexes;
MyANNdistArray m_ANNDistances;
ANNkd_tree* m_ANNTree;
};
}
#endif
diff --git a/Modules/MitkExt/Algorithms/mitkShapeBasedInterpolationAlgorithm.cpp b/Modules/MitkExt/Algorithms/mitkShapeBasedInterpolationAlgorithm.cpp
index 7e249bbf06..af7b540e61 100644
--- a/Modules/MitkExt/Algorithms/mitkShapeBasedInterpolationAlgorithm.cpp
+++ b/Modules/MitkExt/Algorithms/mitkShapeBasedInterpolationAlgorithm.cpp
@@ -1,72 +1,73 @@
/*=========================================================================
Program: Medical Imaging & Interaction Toolkit
Language: C++
Date: $Date$
Version: $Revision: 1.12 $
Copyright (c) German Cancer Research Center, Division of Medical and
Biological Informatics. All rights reserved.
See MITKCopyright.txt or http://www.mitk.org/copyright.html for details.
This software is distributed WITHOUT ANY WARRANTY; without even
the implied warranty of MERCHANTABILITY or FITNESS FOR A PARTICULAR
PURPOSE. See the above copyright notices for more information.
=========================================================================*/
#include "mitkShapeBasedInterpolationAlgorithm.h"
#include "mitkImageCast.h"
+#include "mitkImageDataItem.h"
#include "ipSegmentation.h"
mitk::Image::Pointer
mitk::ShapeBasedInterpolationAlgorithm::Interpolate(
Image::ConstPointer lowerSlice, unsigned int lowerSliceIndex,
Image::ConstPointer upperSlice, unsigned int upperSliceIndex,
unsigned int requestedIndex,
unsigned int /*sliceDimension*/, // commented variables are not used
Image::Pointer resultImage,
unsigned int /*timeStep*/,
Image::ConstPointer /*referenceImage*/)
{
// convert these slices to the ipSegmentation data type (into an ITK image)
itk::Image< ipMITKSegmentationTYPE, 2 >::Pointer correctPixelTypeLowerITKSlice;
CastToItkImage( lowerSlice, correctPixelTypeLowerITKSlice );
assert ( correctPixelTypeLowerITKSlice.IsNotNull() );
itk::Image< ipMITKSegmentationTYPE, 2 >::Pointer correctPixelTypeUpperITKSlice;
CastToItkImage( upperSlice, correctPixelTypeUpperITKSlice );
assert ( correctPixelTypeUpperITKSlice.IsNotNull() );
// correct direction info
itk::Image< ipMITKSegmentationTYPE, 2 >::DirectionType imageDirection;
imageDirection.SetIdentity();
correctPixelTypeLowerITKSlice->SetDirection(imageDirection);
correctPixelTypeUpperITKSlice->SetDirection(imageDirection);
// back-convert to MITK images to access a mitkIpPicDescriptor
Image::Pointer correctPixelTypeLowerMITKSlice = Image::New();
CastToMitkImage( correctPixelTypeLowerITKSlice, correctPixelTypeLowerMITKSlice );
mitkIpPicDescriptor* lowerPICSlice = correctPixelTypeLowerMITKSlice->GetSliceData()->GetPicDescriptor();
Image::Pointer correctPixelTypeUpperMITKSlice = Image::New();
CastToMitkImage( correctPixelTypeUpperITKSlice, correctPixelTypeUpperMITKSlice );
mitkIpPicDescriptor* upperPICSlice = correctPixelTypeUpperMITKSlice->GetSliceData()->GetPicDescriptor();
// calculate where the current slice is in comparison to the lower and upper neighboring slices
float ratio = (float)(requestedIndex - lowerSliceIndex) / (float)(upperSliceIndex - lowerSliceIndex);
mitkIpPicDescriptor* ipPicResult = ipMITKSegmentationInterpolate( lowerPICSlice, upperPICSlice, ratio ); // magic
if (!ipPicResult) return NULL;
Geometry3D::Pointer originalGeometry = resultImage->GetGeometry();
resultImage->Initialize( ipPicResult );
resultImage->SetPicSlice( ipPicResult );
resultImage->SetGeometry( originalGeometry );
mitkIpPicFree( ipPicResult );
return resultImage;
}
diff --git a/Modules/MitkExt/Algorithms/mitkSimpleHistogram.cpp b/Modules/MitkExt/Algorithms/mitkSimpleHistogram.cpp
index 9806be62e4..72d6e6bc60 100644
--- a/Modules/MitkExt/Algorithms/mitkSimpleHistogram.cpp
+++ b/Modules/MitkExt/Algorithms/mitkSimpleHistogram.cpp
@@ -1,234 +1,244 @@
/*=========================================================================
Program: Medical Imaging & Interaction Toolkit
Language: C++
Date: $Date$
Version: $Revision$
Copyright (c) German Cancer Research Center, Division of Medical and
Biological Informatics. All rights reserved.
See MITKCopyright.txt or http://www.mitk.org/copyright.html for details.
This software is distributed WITHOUT ANY WARRANTY; without even
the implied warranty of MERCHANTABILITY or FITNESS FOR A PARTICULAR
PURPOSE. See the above copyright notices for more information.
=========================================================================*/
#include "mitkSimpleHistogram.h"
#include "mitkSimpleUnstructuredGridHistogram.h"
#include "mitkUnstructuredGrid.h"
namespace mitk {
void SimpleImageHistogram::ComputeFromBaseData( BaseData* src )
{
valid = false;
+ //check if input is valid
+ if (src==NULL) return;
Image* source = dynamic_cast<Image*>(src);
+ if (source==NULL) return;
+ else if (source->IsEmpty()) return;
+
+
// dummy histogram
{
min=0;
max=1;
first=0;
last=1;
}
{
int typInt=0;
{
const std::type_info* typ=source->GetPixelType().GetTypeId();
if (*typ == typeid(unsigned char )) typInt=0;
else if(*typ == typeid(signed char )) typInt=1;
else if(*typ == typeid(unsigned short)) typInt=2;
else if(*typ == typeid(signed short )) typInt=3;
else
{
MITK_WARN << "SimpleImageHistogram currently only supports un/signed char/short";
return;
}
}
first=-32768; last=65535; // support at least full signed and unsigned short range
if(histogram)
delete histogram;
histogram = new CountType[last-first+1];
memset(histogram,0,sizeof(CountType)*(last-first+1));
highest = 0;
max = first - 1;
min = last + 1;
unsigned int num=1;
for(unsigned int r=0;r<source->GetDimension();r++)
num*=source->GetDimension(r);
// MITK_INFO << "building histogramm of integer image: 0=" << source->GetDimension(0) << " 1=" << source->GetDimension(1) << " 2=" << source->GetDimension(2) << " 3=" << source->GetDimension(3);
void *src=source->GetData();
do
{
int value;
switch(typInt)
{
case 0: { unsigned char *t=(unsigned char *)src; value=*t++; src=(void*)t; } break;
case 1: { signed char *t=( signed char *)src; value=*t++; src=(void*)t; } break;
case 2: { unsigned short *t=(unsigned short*)src; value=*t++; src=(void*)t; } break;
case 3: { signed short *t=( signed short*)src; value=*t++; src=(void*)t; } break;
}
if(value >= first && value <= last)
{
if(value < min) min = value;
if(value > max) max = value;
CountType tmp = ++histogram[value-first];
if(tmp > highest) highest = tmp;
}
}
while(--num);
MITK_INFO << "histogramm computed: min=" << min << " max=" << max << " highestBin=" << highest << " samples=" << num;
}
invLogHighest = 1.0/log(double(highest));
valid = true;
}
+bool SimpleImageHistogram::GetValid()
+ {
+ return valid;
+ }
float SimpleImageHistogram::GetRelativeBin( double left, double right ) const
{
if( !valid )
return 0.0f;
int iLeft = floorf(left);
int iRight = ceilf(right);
/*
double sum = 0;
for( int r = 0 ; r < 256 ; r++)
{
int pos = left + (right-left) * r/255.0;
int posInArray = floorf(pos+0.5f) - first;
sum += float(log(double(histogram[posInArray])));
}
sum /= 256.0;
return float(sum*invLogHighest);
*/
CountType maximum = 0;
for( int i = iLeft; i <= iRight ; i++)
{
int posInArray = i - first;
if( histogram[posInArray] > maximum ) maximum = histogram[posInArray];
}
return float(log(double(maximum))*invLogHighest);
}
class ImageHistogramCacheElement : public SimpleHistogramCache::Element
{
public:
void ComputeFromBaseData(BaseData* baseData)
{
histogram.ComputeFromBaseData(baseData);
}
SimpleHistogram* GetHistogram()
{
return &histogram;
}
SimpleImageHistogram histogram;
};
class UnstructuredGridHistogramCacheElement : public SimpleHistogramCache::Element
{
public:
void ComputeFromBaseData(BaseData* baseData)
{
histogram.ComputeFromBaseData(baseData);
}
SimpleHistogram* GetHistogram()
{
return &histogram;
}
SimpleUnstructuredGridHistogram histogram;
};
SimpleHistogram* SimpleHistogramCache::operator[](BaseData::Pointer sp_BaseData)
{
BaseData *p_BaseData = sp_BaseData.GetPointer();
if(!p_BaseData)
{
MITK_WARN << "SimpleHistogramCache::operator[] with null base data called";
return 0;
}
Element *elementToUpdate = 0;
bool first = true;
for(CacheContainer::iterator iter = cache.begin(); iter != cache.end(); iter++)
{
Element *e = *iter;
BaseData *p_tmp = e->baseData.GetPointer();
if(p_tmp == p_BaseData)
{
if(!first)
{
cache.erase(iter);
cache.push_front(e);
}
if( p_BaseData->GetMTime() > e->m_LastUpdateTime.GetMTime())
goto recomputeElement;
//MITK_INFO << "using a cached histogram";
return e->GetHistogram();
}
first = false;
}
if (dynamic_cast<Image*>(p_BaseData))
{
elementToUpdate = new ImageHistogramCacheElement();
}
else if (dynamic_cast<UnstructuredGrid*>(p_BaseData))
{
elementToUpdate = new UnstructuredGridHistogramCacheElement();
}
else
{
MITK_WARN << "not supported: " << p_BaseData->GetNameOfClass();
}
elementToUpdate->baseData = p_BaseData;
cache.push_front(elementToUpdate);
TrimCache();
recomputeElement:
//MITK_INFO << "computing a new histogram";
elementToUpdate->ComputeFromBaseData(p_BaseData);
elementToUpdate->m_LastUpdateTime.Modified();
return elementToUpdate->GetHistogram();
}
}
diff --git a/Modules/MitkExt/Algorithms/mitkSimpleHistogram.h b/Modules/MitkExt/Algorithms/mitkSimpleHistogram.h
index d089f3a05a..1c2b92ec7a 100644
--- a/Modules/MitkExt/Algorithms/mitkSimpleHistogram.h
+++ b/Modules/MitkExt/Algorithms/mitkSimpleHistogram.h
@@ -1,155 +1,166 @@
/*=========================================================================
Program: Medical Imaging & Interaction Toolkit
Language: C++
Date: $Date$
Version: $Revision$
Copyright (c) German Cancer Research Center, Division of Medical and
Biological Informatics. All rights reserved.
See MITKCopyright.txt or http://www.mitk.org/copyright.html for details.
This software is distributed WITHOUT ANY WARRANTY; without even
the implied warranty of MERCHANTABILITY or FITNESS FOR A PARTICULAR
PURPOSE. See the above copyright notices for more information.
=========================================================================*/
#ifndef MITKSIMPLEHISTOGRAM_H
#define MITKSIMPLEHISTOGRAM_H
#include "MitkExtExports.h"
#include <mitkImage.h>
#include <mitkWeakPointer.h>
#include <itkImageRegionIterator.h>
#include <itkImageRegionIteratorWithIndex.h>
namespace mitk {
+
+//##Documentation
+//## @brief Abstract superclass for histograms with double values.
+//## Classes which are deriving from this class can be cached
+//## in the same way.
class MitkExt_EXPORT SimpleHistogram
{
public:
+ /** @brief Returns the minimal value of the histogram. */
virtual double GetMin() const = 0;
+ /** @brief Returns the maximum value of the histogram. */
virtual double GetMax() const = 0;
-
+ /** @brief Creates a new histogram out the source. */
virtual void ComputeFromBaseData( BaseData* source ) = 0;
+ /** @brief TODO: (What should this method do?)*/
virtual float GetRelativeBin( double start, double end ) const = 0;
-
};
class MitkExt_EXPORT SimpleImageHistogram : public SimpleHistogram
{
public:
SimpleImageHistogram()
{
valid=false;
histogram=0;
}
~SimpleImageHistogram()
{
if(histogram)
delete histogram;
}
+ /** @return Returns if the current histogram is valid, false if not. */
+ bool GetValid();
+
typedef itk::Image<short, 3> CTImage;
typedef itk::ImageRegionIterator< CTImage > CTIteratorType;
typedef itk::ImageRegionIteratorWithIndex< CTImage > CTIteratorIndexType;
typedef itk::Image<unsigned char, 3> BinImage;
typedef itk::ImageRegionIterator< BinImage > BinIteratorType;
typedef itk::ImageRegionIteratorWithIndex< BinImage > BinIteratorIndexType;
typedef unsigned long CountType;
protected:
CountType *histogram;
bool valid;
int first;
int last;
int min;
int max;
CountType highest;
double invLogHighest;
public:
double GetMin() const
{
if(!valid)
return 0;
return min;
}
double GetMax() const
{
if(!valid)
return 1;
return max;
}
+ /** @brief Creates a new histogram out the source which must be an image. Method does nothing if the image is invalid, NULL, etc.. */
void ComputeFromBaseData( BaseData* source );
float GetRelativeBin( double start, double end ) const;
};
class MitkExt_EXPORT SimpleHistogramCache
{
public:
static const unsigned int maxCacheSize = 64;
class Element
{
public:
mitk::WeakPointer<BaseData> baseData;
itk::TimeStamp m_LastUpdateTime;
virtual void ComputeFromBaseData(BaseData* baseData) = 0;
virtual SimpleHistogram* GetHistogram() = 0;
};
typedef std::list<Element*> CacheContainer;
CacheContainer cache;
SimpleHistogramCache()
{
}
~SimpleHistogramCache()
{
TrimCache(true);
}
SimpleHistogram *operator[](BaseData::Pointer sp_BaseData);
protected:
void TrimCache(bool full=false)
{
unsigned int targetSize = full?0:maxCacheSize;
while(cache.size()>targetSize)
{
delete cache.back();
cache.pop_back();
}
}
};
}
#endif // MITKSIMPLEHISTOGRAM_H
diff --git a/Modules/MitkExt/Controllers/mitkSegmentationInterpolationController.cpp b/Modules/MitkExt/Controllers/mitkSegmentationInterpolationController.cpp
index 19a773abe2..794a202c4a 100644
--- a/Modules/MitkExt/Controllers/mitkSegmentationInterpolationController.cpp
+++ b/Modules/MitkExt/Controllers/mitkSegmentationInterpolationController.cpp
@@ -1,485 +1,486 @@
/*=========================================================================
Program: Medical Imaging & Interaction Toolkit
Language: C++
Date: $Date$
Version: $Revision$
Copyright (c) German Cancer Research Center, Division of Medical and
Biological Informatics. All rights reserved.
See MITKCopyright.txt or http://www.mitk.org/copyright.html for details.
This software is distributed WITHOUT ANY WARRANTY; without even
the implied warranty of MERCHANTABILITY or FITNESS FOR A PARTICULAR
PURPOSE. See the above copyright notices for more information.
=========================================================================*/
#include "mitkSegmentationInterpolationController.h"
#include "mitkImageCast.h"
+#include "mitkImageAccessByItk.h"
#include "mitkExtractImageFilter.h"
#include "mitkImageTimeSelector.h"
#include "mitkShapeBasedInterpolationAlgorithm.h"
#include <itkCommand.h>
#include <itkImage.h>
#include <itkImageSliceConstIteratorWithIndex.h>
mitk::SegmentationInterpolationController::InterpolatorMapType mitk::SegmentationInterpolationController::s_InterpolatorForImage; // static member initialization
mitk::SegmentationInterpolationController* mitk::SegmentationInterpolationController::InterpolatorForImage(const Image* image)
{
InterpolatorMapType::iterator iter = s_InterpolatorForImage.find( image );
if ( iter != s_InterpolatorForImage.end() )
{
return iter->second;
}
else
{
return NULL;
}
}
mitk::SegmentationInterpolationController::SegmentationInterpolationController()
:m_BlockModified(false)
{
}
mitk::SegmentationInterpolationController::~SegmentationInterpolationController()
{
// remove this from the list of interpolators
for ( InterpolatorMapType::iterator iter = s_InterpolatorForImage.begin();
iter != s_InterpolatorForImage.end();
++iter )
{
if (iter->second == this)
{
s_InterpolatorForImage.erase( iter );
break;
}
}
}
void mitk::SegmentationInterpolationController::OnImageModified(const itk::EventObject&)
{
if (!m_BlockModified && m_Segmentation.IsNotNull() )
{
SetSegmentationVolume( m_Segmentation );
}
}
void mitk::SegmentationInterpolationController::BlockModified(bool block)
{
m_BlockModified = block;
}
void mitk::SegmentationInterpolationController::SetSegmentationVolume( const Image* segmentation )
{
// clear old information (remove all time steps
m_SegmentationCountInSlice.clear();
// delete this from the list of interpolators
InterpolatorMapType::iterator iter = s_InterpolatorForImage.find( segmentation );
if ( iter != s_InterpolatorForImage.end() )
{
s_InterpolatorForImage.erase( iter );
}
if (!segmentation) return;
if (segmentation->GetDimension() > 4 || segmentation->GetDimension() < 3)
{
itkExceptionMacro("SegmentationInterpolationController needs a 3D-segmentation or 3D+t, not 2D.");
}
if (m_Segmentation != segmentation)
{
// observe Modified() event of image
itk::ReceptorMemberCommand<SegmentationInterpolationController>::Pointer command = itk::ReceptorMemberCommand<SegmentationInterpolationController>::New();
command->SetCallbackFunction( this, &SegmentationInterpolationController::OnImageModified );
segmentation->AddObserver( itk::ModifiedEvent(), command );
}
m_Segmentation = segmentation;
m_SegmentationCountInSlice.resize( m_Segmentation->GetTimeSteps() );
for (unsigned int timeStep = 0; timeStep < m_Segmentation->GetTimeSteps(); ++timeStep)
{
m_SegmentationCountInSlice[timeStep].resize(3);
for (unsigned int dim = 0; dim < 3; ++dim)
{
m_SegmentationCountInSlice[timeStep][dim].clear();
m_SegmentationCountInSlice[timeStep][dim].resize( m_Segmentation->GetDimension(dim) );
m_SegmentationCountInSlice[timeStep][dim].assign( m_Segmentation->GetDimension(dim), 0 );
}
}
s_InterpolatorForImage.insert( std::make_pair( m_Segmentation, this ) );
// for all timesteps
// scan whole image
for (unsigned int timeStep = 0; timeStep < m_Segmentation->GetTimeSteps(); ++timeStep)
{
ImageTimeSelector::Pointer timeSelector = ImageTimeSelector::New();
timeSelector->SetInput( m_Segmentation );
timeSelector->SetTimeNr( timeStep );
timeSelector->UpdateLargestPossibleRegion();
Image::Pointer segmentation3D = timeSelector->GetOutput();
AccessFixedDimensionByItk_2( segmentation3D, ScanWholeVolume, 3, m_Segmentation, timeStep );
}
//PrintStatus();
SetReferenceVolume( m_ReferenceImage );
Modified();
}
void mitk::SegmentationInterpolationController::SetReferenceVolume( const Image* referenceImage )
{
m_ReferenceImage = referenceImage;
if ( m_ReferenceImage.IsNull() ) return; // no image set - ignore it then
assert ( m_Segmentation.IsNotNull() ); // should never happen
// ensure the reference image has the same dimensionality and extents as the segmentation image
if ( m_ReferenceImage.IsNull()
|| m_Segmentation.IsNull()
|| m_ReferenceImage->GetDimension() != m_Segmentation->GetDimension()
|| m_ReferenceImage->GetPixelType().GetNumberOfComponents() != 1
|| m_Segmentation->GetPixelType().GetNumberOfComponents() != 1
)
{
MITK_ERROR << "original patient image does not match segmentation, ignoring patient image" << std::endl;
m_ReferenceImage = NULL;
return;
}
for (unsigned int dim = 0; dim < m_Segmentation->GetDimension(); ++dim)
if ( m_ReferenceImage->GetDimension(dim) != m_Segmentation->GetDimension(dim) )
{
MITK_ERROR << "original patient image does not match segmentation (different extent in dimension " << dim
<< "), ignoring patient image" << std::endl;
m_ReferenceImage = NULL;
return;
}
}
void mitk::SegmentationInterpolationController::SetChangedVolume( const Image* sliceDiff, unsigned int timeStep )
{
if ( !sliceDiff ) return;
if ( sliceDiff->GetDimension() != 3 ) return;
AccessFixedDimensionByItk_1( sliceDiff, ScanChangedVolume, 3, timeStep );
//PrintStatus();
Modified();
}
void mitk::SegmentationInterpolationController::SetChangedSlice( const Image* sliceDiff, unsigned int sliceDimension, unsigned int sliceIndex, unsigned int timeStep )
{
if ( !sliceDiff ) return;
if ( sliceDimension > 2 ) return;
if ( timeStep >= m_SegmentationCountInSlice.size() ) return;
if ( sliceIndex >= m_SegmentationCountInSlice[timeStep][sliceDimension].size() ) return;
unsigned int dim0(0);
unsigned int dim1(1);
// determine the other two dimensions
switch (sliceDimension)
{
default:
case 2:
dim0 = 0; dim1 = 1; break;
case 1:
dim0 = 0; dim1 = 2; break;
case 0:
dim0 = 1; dim1 = 2; break;
}
mitkIpPicDescriptor* rawSlice = const_cast<Image*>(sliceDiff)->GetSliceData()->GetPicDescriptor(); // we promise not to change anything!
if (!rawSlice) return;
AccessFixedDimensionByItk_1( sliceDiff, ScanChangedSlice, 2, SetChangedSliceOptions(sliceDimension, sliceIndex, dim0, dim1, timeStep, rawSlice->data) );
//PrintStatus();
Modified();
}
template < typename DATATYPE >
void mitk::SegmentationInterpolationController::ScanChangedSlice( itk::Image<DATATYPE, 2>*, const SetChangedSliceOptions& options )
{
DATATYPE* pixelData( (DATATYPE*)options.pixelData );
unsigned int timeStep( options.timeStep );
unsigned int sliceDimension( options.sliceDimension );
unsigned int sliceIndex( options.sliceIndex );
if ( sliceDimension > 2 ) return;
if ( sliceIndex >= m_SegmentationCountInSlice[timeStep][sliceDimension].size() ) return;
unsigned int dim0( options.dim0 );
unsigned int dim1( options.dim1 );
int numberOfPixels(0); // number of pixels in this slice that are not 0
unsigned int dim0max = m_SegmentationCountInSlice[timeStep][dim0].size();
unsigned int dim1max = m_SegmentationCountInSlice[timeStep][dim1].size();
// scan the slice from two directions
// and set the flags for the two dimensions of the slice
for (unsigned int v = 0; v < dim1max; ++v)
{
for (unsigned int u = 0; u < dim0max; ++u)
{
DATATYPE value = *(pixelData + u + v * dim0max);
assert ( (signed) m_SegmentationCountInSlice[timeStep][dim0][u] + (signed)value >= 0 ); // just for debugging. This must always be true, otherwise some counting is going wrong
assert ( (signed) m_SegmentationCountInSlice[timeStep][dim1][v] + (signed)value >= 0 );
m_SegmentationCountInSlice[timeStep][dim0][u] = static_cast<unsigned int>( m_SegmentationCountInSlice[timeStep][dim0][u] + value );
m_SegmentationCountInSlice[timeStep][dim1][v] = static_cast<unsigned int>( m_SegmentationCountInSlice[timeStep][dim1][v] + value );
numberOfPixels += static_cast<int>( value );
}
}
// flag for the dimension of the slice itself
assert ( (signed) m_SegmentationCountInSlice[timeStep][sliceDimension][sliceIndex] + numberOfPixels >= 0 );
m_SegmentationCountInSlice[timeStep][sliceDimension][sliceIndex] += numberOfPixels;
//MITK_INFO << "scan t=" << timeStep << " from (0,0) to (" << dim0max << "," << dim1max << ") (" << pixelData << "-" << pixelData+dim0max*dim1max-1 << ") in slice " << sliceIndex << " found " << numberOfPixels << " pixels" << std::endl;
}
template < typename TPixel, unsigned int VImageDimension >
void mitk::SegmentationInterpolationController::ScanChangedVolume( itk::Image<TPixel, VImageDimension>* diffImage, unsigned int timeStep )
{
typedef itk::ImageSliceConstIteratorWithIndex< itk::Image<TPixel, VImageDimension> > IteratorType;
IteratorType iter( diffImage, diffImage->GetLargestPossibleRegion() );
iter.SetFirstDirection(0);
iter.SetSecondDirection(1);
int numberOfPixels(0); // number of pixels in this slice that are not 0
typename IteratorType::IndexType index;
unsigned int x = 0;
unsigned int y = 0;
unsigned int z = 0;
iter.GoToBegin();
while ( !iter.IsAtEnd() )
{
while ( !iter.IsAtEndOfSlice() )
{
while ( !iter.IsAtEndOfLine() )
{
index = iter.GetIndex();
x = index[0];
y = index[1];
z = index[2];
TPixel value = iter.Get();
assert ( (signed) m_SegmentationCountInSlice[timeStep][0][x] + (signed)value >= 0 ); // just for debugging. This must always be true, otherwise some counting is going wrong
assert ( (signed) m_SegmentationCountInSlice[timeStep][1][y] + (signed)value >= 0 );
m_SegmentationCountInSlice[timeStep][0][x] = static_cast<unsigned int>( m_SegmentationCountInSlice[timeStep][0][x] + value );
m_SegmentationCountInSlice[timeStep][1][y] = static_cast<unsigned int>( m_SegmentationCountInSlice[timeStep][1][y] + value );
numberOfPixels += static_cast<int>( value );
++iter;
}
iter.NextLine();
}
assert ( (signed) m_SegmentationCountInSlice[timeStep][2][z] + numberOfPixels >= 0 );
m_SegmentationCountInSlice[timeStep][2][z] += numberOfPixels;
numberOfPixels = 0;
iter.NextSlice();
}
}
template < typename DATATYPE >
void mitk::SegmentationInterpolationController::ScanWholeVolume( itk::Image<DATATYPE, 3>*, const Image* volume, unsigned int timeStep )
{
if (!volume) return;
if ( timeStep >= m_SegmentationCountInSlice.size() ) return;
for (unsigned int slice = 0; slice < volume->GetDimension(2); ++slice)
{
DATATYPE* rawVolume = static_cast<DATATYPE*>( const_cast<Image*>(volume)->GetVolumeData(timeStep)->GetData() ); // we again promise not to change anything, we'll just count
//DATATYPE* rawSlice = static_cast<DATATYPE*>( volume->GetSliceData(slice)->GetData() ); // TODO THIS wouldn't work. Did I mess up with some internal mitk::Image data structure?
DATATYPE* rawSlice = rawVolume + ( volume->GetDimension(0) * volume->GetDimension(1) * slice );
ScanChangedSlice<DATATYPE>( NULL, SetChangedSliceOptions(2, slice, 0, 1, timeStep, rawSlice) );
}
}
void mitk::SegmentationInterpolationController::PrintStatus()
{
unsigned int timeStep(0); // if needed, put a loop over time steps around everyting, but beware, output will be long
MITK_INFO << "Interpolator status (timestep 0): dimensions "
<< m_SegmentationCountInSlice[timeStep][0].size() << " "
<< m_SegmentationCountInSlice[timeStep][1].size() << " "
<< m_SegmentationCountInSlice[timeStep][2].size() << std::endl;
MITK_INFO << "Slice 0: " << m_SegmentationCountInSlice[timeStep][2][0] << std::endl;
// row "x"
for (unsigned int index = 0; index < m_SegmentationCountInSlice[timeStep][0].size(); ++index)
{
if ( m_SegmentationCountInSlice[timeStep][0][index] > 0 )
MITK_INFO << "O";
else
MITK_INFO << ".";
}
MITK_INFO << std::endl;
// rows "y" and "z" (diagonal)
for (unsigned int index = 1; index < m_SegmentationCountInSlice[timeStep][1].size(); ++index)
{
if ( m_SegmentationCountInSlice[timeStep][1][index] > 0 )
MITK_INFO << "O";
else
MITK_INFO << ".";
if ( m_SegmentationCountInSlice[timeStep][2].size() > index ) // if we also have a z value here, then print it, too
{
for (unsigned int indent = 1; indent < index; ++indent)
MITK_INFO << " ";
if ( m_SegmentationCountInSlice[timeStep][2][index] > 0 )
MITK_INFO << m_SegmentationCountInSlice[timeStep][2][index];//"O";
else
MITK_INFO << ".";
}
MITK_INFO << std::endl;
}
// z indices that are larger than the biggest y index
for (unsigned int index = m_SegmentationCountInSlice[timeStep][1].size(); index < m_SegmentationCountInSlice[timeStep][2].size(); ++index)
{
for (unsigned int indent = 0; indent < index; ++indent)
MITK_INFO << " ";
if ( m_SegmentationCountInSlice[timeStep][2][index] > 0 )
MITK_INFO << m_SegmentationCountInSlice[timeStep][2][index];//"O";
else
MITK_INFO << ".";
MITK_INFO << std::endl;
}
}
mitk::Image::Pointer mitk::SegmentationInterpolationController::Interpolate( unsigned int sliceDimension, unsigned int sliceIndex, unsigned int timeStep )
{
if (m_Segmentation.IsNull()) return NULL;
if ( timeStep >= m_SegmentationCountInSlice.size() ) return NULL;
if ( sliceDimension > 2 ) return NULL;
unsigned int upperLimit = m_SegmentationCountInSlice[timeStep][sliceDimension].size();
if ( sliceIndex >= upperLimit - 1 ) return NULL; // can't interpolate first and last slice
if ( sliceIndex < 1 ) return NULL;
if ( m_SegmentationCountInSlice[timeStep][sliceDimension][sliceIndex] > 0 ) return NULL; // slice contains a segmentation, won't interpolate anything then
unsigned int lowerBound(0);
unsigned int upperBound(0);
bool bounds( false );
for (lowerBound = sliceIndex - 1; /*lowerBound >= 0*/; --lowerBound)
{
if ( m_SegmentationCountInSlice[timeStep][sliceDimension][lowerBound] > 0 )
{
bounds = true;
break;
}
if (lowerBound == 0) break; // otherwise overflow and start at something like 4294967295
}
if (!bounds) return NULL;
bounds = false;
for (upperBound = sliceIndex + 1 ; upperBound < upperLimit; ++upperBound)
{
if ( m_SegmentationCountInSlice[timeStep][sliceDimension][upperBound] > 0 )
{
bounds = true;
break;
}
}
if (!bounds) return NULL;
// ok, we have found two neighboring slices with segmentations (and we made sure that the current slice does NOT contain anything
//MITK_INFO << "Interpolate in timestep " << timeStep << ", dimension " << sliceDimension << ": estimate slice " << sliceIndex << " from slices " << lowerBound << " and " << upperBound << std::endl;
mitk::Image::Pointer lowerMITKSlice;
mitk::Image::Pointer upperMITKSlice;
mitk::Image::Pointer resultImage;
try
{
// extract the two neighoring slices from the segmentation volume
ExtractImageFilter::Pointer extractor= ExtractImageFilter::New();
extractor->SetInput( m_Segmentation );
extractor->SetSliceDimension( sliceDimension );
extractor->SetSliceIndex( lowerBound );
extractor->SetTimeStep( timeStep );
extractor->Update();
lowerMITKSlice = extractor->GetOutput();
lowerMITKSlice->DisconnectPipeline(); // otherwise the next output of the filter will overwrite this pointer, too
extractor->SetInput( m_Segmentation );
extractor->SetSliceDimension( sliceDimension );
extractor->SetSliceIndex( sliceIndex );
extractor->SetTimeStep( timeStep );
extractor->Update();
resultImage = extractor->GetOutput();
resultImage->DisconnectPipeline();
extractor->SetInput( m_Segmentation );
extractor->SetSliceDimension( sliceDimension );
extractor->SetSliceIndex( upperBound );
extractor->SetTimeStep( timeStep );
extractor->Update();
upperMITKSlice = extractor->GetOutput();
if ( lowerMITKSlice.IsNull() || upperMITKSlice.IsNull() ) return NULL;
}
catch(...)
{
return NULL;
}
// interpolation algorithm gets some inputs
// two segmentations (guaranteed to be of the same data type, but no special data type guaranteed)
// orientation (sliceDimension) of the segmentations
// position of the two slices (sliceIndices)
// one volume image (original patient image)
//
// interpolation algorithm can use e.g. itk::ImageSliceConstIteratorWithIndex to
// inspect the original patient image at appropriate positions
mitk::SegmentationInterpolationAlgorithm::Pointer algorithm = mitk::ShapeBasedInterpolationAlgorithm::New().GetPointer();
return algorithm->Interpolate( lowerMITKSlice.GetPointer(), lowerBound,
upperMITKSlice.GetPointer(), upperBound,
sliceIndex,
sliceDimension,
resultImage,
timeStep,
m_ReferenceImage );
}
diff --git a/Modules/MitkExt/DataManagement/mitkBoundingObjectGroup.cpp b/Modules/MitkExt/DataManagement/mitkBoundingObjectGroup.cpp
index 7191e8b3fa..40f104bdb7 100644
--- a/Modules/MitkExt/DataManagement/mitkBoundingObjectGroup.cpp
+++ b/Modules/MitkExt/DataManagement/mitkBoundingObjectGroup.cpp
@@ -1,215 +1,215 @@
/*=========================================================================
Program: Medical Imaging & Interaction Toolkit
Language: C++
Date: $Date$
Version: $Revision$
Copyright (c) German Cancer Research Center, Division of Medical and
Biological Informatics. All rights reserved.
See MITKCopyright.txt or http://www.mitk.org/copyright.html for details.
This software is distributed WITHOUT ANY WARRANTY; without even
the implied warranty of MERCHANTABILITY or FITNESS FOR A PARTICULAR
PURPOSE. See the above copyright notices for more information.
=========================================================================*/
#include "mitkBoundingObjectGroup.h"
#include "mitkBaseProcess.h"
#include <vtkLinearTransform.h>
#include <itkSmartPointerForwardReference.txx>
mitk::BoundingObjectGroup::BoundingObjectGroup()
:m_BoundingObjects(0),
m_Counter(0),
m_CSGMode(Union)// m_CSGMode(Difference) //m_CSGMode(Intersection)
{
- GetTimeSlicedGeometry()->Initialize(1);
+ GetTimeSlicedGeometry()->InitializeEvenlyTimed(1);
GetGeometry(0)->SetIndexToWorldTransform(GetTimeSlicedGeometry()->GetIndexToWorldTransform());
SetVtkPolyData(NULL);
}
mitk::BoundingObjectGroup::~BoundingObjectGroup()
{
}
void mitk::BoundingObjectGroup::UpdateOutputInformation()
{
if ( this->GetSource() )
{
this->GetSource()->UpdateOutputInformation();
}
// calculate global bounding box
if(m_BoundingObjects.size() < 1 ) // if there is no BoundingObject, the bounding box is zero
{
mitk::BoundingBox::BoundsArrayType boundsArray;
boundsArray.Fill(0);
- GetTimeSlicedGeometry()->Initialize(1);
+ GetTimeSlicedGeometry()->InitializeEvenlyTimed(1);
GetGeometry()->SetBounds(boundsArray);
GetTimeSlicedGeometry()->UpdateInformation();
return;
}
// initialize container
mitk::BoundingBox::PointsContainer::Pointer pointscontainer=mitk::BoundingBox::PointsContainer::New();
mitk::BoundingBox::PointIdentifier pointid=0;
mitk::Point3D point;
mitk::AffineTransform3D* transform = GetTimeSlicedGeometry()->GetIndexToWorldTransform();
mitk::AffineTransform3D::Pointer inverse = mitk::AffineTransform3D::New();
transform->GetInverse(inverse);
// calculate a bounding box that includes all BoundingObjects
// \todo probably we should do this additionally for each time-step
//while (boundingObjectsIterator != boundingObjectsIteratorEnd)
for(unsigned int j = 0; j<m_BoundingObjects.size();j++)
{
const Geometry3D* geometry = m_BoundingObjects.at(j)->GetUpdatedTimeSlicedGeometry();
unsigned char i;
for(i=0; i<8; ++i)
{
point = inverse->TransformPoint(geometry->GetCornerPoint(i));
if(point[0]*point[0]+point[1]*point[1]+point[2]*point[2] < mitk::large)
pointscontainer->InsertElement( pointid++, point);
else
{
itkGenericOutputMacro( << "Unrealistically distant corner point encountered. Ignored. BoundingObject: " << m_BoundingObjects.at(j) );
}
}
}
mitk::BoundingBox::Pointer boundingBox = mitk::BoundingBox::New();
boundingBox->SetPoints(pointscontainer);
boundingBox->ComputeBoundingBox();
/* BoundingBox is centered around the center of all sub bounding objects */
//Point3D center = boundingBox->GetCenter();
//Point3D minimum, maximum;
//minimum.Fill(0); maximum.Fill(0);
//minimum += boundingBox->GetMinimum() - center;
//maximum += boundingBox->GetMaximum() - center;
//boundingBox->SetMinimum(minimum);
//boundingBox->SetMaximum(maximum);
Geometry3D* geometry3d = GetGeometry(0);
geometry3d->SetIndexToWorldTransform(transform);
geometry3d->SetBounds(boundingBox->GetBounds());
/* the objects position is the center of all sub bounding objects */
//geometry3d->SetOrigin(center);
GetTimeSlicedGeometry()->InitializeEvenlyTimed(geometry3d, GetTimeSlicedGeometry()->GetTimeSteps());
}
void mitk::BoundingObjectGroup::AddBoundingObject(mitk::BoundingObject::Pointer boundingObject)
{
if (boundingObject->GetPositive())
m_BoundingObjects.push_front(boundingObject);
else
m_BoundingObjects.push_back(boundingObject);
++m_Counter;
UpdateOutputInformation();
}
void mitk::BoundingObjectGroup::RemoveBoundingObject(mitk::BoundingObject::Pointer boundingObject)
{
std::deque<mitk::BoundingObject::Pointer>::iterator it = m_BoundingObjects.begin();
for (unsigned int i=0 ; i<m_BoundingObjects.size();i++)
{
if (m_BoundingObjects.at(i) == boundingObject)
m_BoundingObjects.erase(it);
++it;
}
--m_Counter;
UpdateOutputInformation();
}
bool mitk::BoundingObjectGroup::IsInside(const mitk::Point3D& p) const
{
bool inside = false; // initialize with true for intersection, with false for union
bool posInside = false;
bool negInside = false;
for (unsigned int i = 0; i<m_BoundingObjects.size();i++)
{
switch(m_CSGMode)
{
case Intersection:
inside = true;
// calculate intersection: each point, that is inside each BoundingObject is considered inside the group
inside = m_BoundingObjects.at(i)->IsInside(p) && inside;
if (!inside) // shortcut, it is enough to find one object that does not contain the point
i=m_BoundingObjects.size();
break;
case Union:
case Difference:
posInside = false;
negInside = false;
// calculate union: each point, that is inside least one BoundingObject is considered inside the group
if (m_BoundingObjects.at(i)->GetPositive())
posInside = m_BoundingObjects.at(i)->IsInside(p) || posInside;
else
negInside = m_BoundingObjects.at(i)->IsInside(p) || negInside;
if (posInside && !negInside)
inside = true;
else
inside = false;
break;
default:
inside = false;
// calculate union: each point, that is inside least one BoundingObject is considered inside the group
inside = m_BoundingObjects.at(i)->IsInside(p) || inside;
if (inside) // shortcut, it is enough to find one object that contains the point
i=m_BoundingObjects.size();
break;
}
}
return inside;
}
unsigned int mitk::BoundingObjectGroup::GetCount() const
{
return m_Counter;
}
bool mitk::BoundingObjectGroup::VerifyRequestedRegion()
{
return m_Counter > 0;
}
mitk::Geometry3D * mitk::BoundingObjectGroup::GetGeometry (int t) const
{
//if ( m_BoundingObjects == NULL )
return Superclass::GetGeometry(t);
//mitk::BoundingObjectGroup::BoundingObjectContainer::ConstIterator boI = m_BoundingObjects->Begin();
//const mitk::BoundingObjectGroup::BoundingObjectContainer::ConstIterator boIEnd = m_BoundingObjects->End();
//mitk::Geometry3D* currentGeometry = NULL;
//while ( boI != boIEnd )
//{
// currentGeometry = boI.Value()->GetGeometry( t );
// boI++;
//}
//return currentGeometry;
}
void mitk::BoundingObjectGroup::SetBoundingObjects(const std::deque<mitk::BoundingObject::Pointer> boundingObjects)
{
m_BoundingObjects = boundingObjects;
}
std::deque<mitk::BoundingObject::Pointer> mitk::BoundingObjectGroup::GetBoundingObjects()
{
return m_BoundingObjects;
}
diff --git a/Modules/MitkExt/DataManagement/mitkContour.cpp b/Modules/MitkExt/DataManagement/mitkContour.cpp
index 9d68b17b26..2cbbf686d8 100644
--- a/Modules/MitkExt/DataManagement/mitkContour.cpp
+++ b/Modules/MitkExt/DataManagement/mitkContour.cpp
@@ -1,163 +1,163 @@
/*=========================================================================
Program: Medical Imaging & Interaction Toolkit
Language: C++
Date: $Date$
Version: $Revision$
Copyright (c) German Cancer Research Center, Division of Medical and
Biological Informatics. All rights reserved.
See MITKCopyright.txt or http://www.mitk.org/copyright.html for details.
This software is distributed WITHOUT ANY WARRANTY; without even
the implied warranty of MERCHANTABILITY or FITNESS FOR A PARTICULAR
PURPOSE. See the above copyright notices for more information.
=========================================================================*/
#include "mitkContour.h"
mitk::Contour::Contour() :
m_ContourPath (PathType::New()),
m_CurrentWindow ( NULL ),
m_BoundingBox (BoundingBoxType::New()),
m_Vertices ( BoundingBoxType::PointsContainer::New() ),
m_Closed ( true ),
m_Selected ( false ),
m_Width (3.0)
{
Superclass::InitializeTimeSlicedGeometry();
}
mitk::Contour::Contour( const Contour & other ): BaseData(other),
m_ContourPath(other.m_ContourPath),
m_CurrentWindow(other.m_CurrentWindow),
m_BoundingBox(other.m_BoundingBox),
m_Vertices(other.m_Vertices),
m_Closed(other.m_Closed),
m_Selected(other.m_Selected),
m_Width(other.m_Width)
{
}
mitk::Contour::~Contour()
{
}
void mitk::Contour::AddVertex(mitk::Point3D newPoint)
{
BoundingBoxType::PointType p;
p.CastFrom(newPoint);
m_Vertices->InsertElement(m_Vertices->Size(), p);
ContinuousIndexType idx;
idx.CastFrom(newPoint);
m_ContourPath->AddVertex(idx);
m_BoundingBox->SetPoints(m_Vertices);
Modified();
}
void mitk::Contour::UpdateOutputInformation()
{
// \todo probably we should do this additionally for each time-step
float mitkBounds[6];
if (m_Vertices->Size() == 0) {
mitkBounds[0] = 0.0;
mitkBounds[1] = 0.0;
mitkBounds[2] = 0.0;
mitkBounds[3] = 0.0;
mitkBounds[4] = 0.0;
mitkBounds[5] = 0.0;
}
else
{
m_BoundingBox->ComputeBoundingBox();
BoundingBoxType::BoundsArrayType tmp = m_BoundingBox->GetBounds();
mitkBounds[0] = tmp[0];
mitkBounds[1] = tmp[1];
mitkBounds[2] = tmp[2];
mitkBounds[3] = tmp[3];
mitkBounds[4] = tmp[4];
mitkBounds[5] = tmp[5];
}
Geometry3D* geometry3d = GetGeometry(0);
geometry3d->SetBounds(mitkBounds);
GetTimeSlicedGeometry()->UpdateInformation();
}
void mitk::Contour::SetRequestedRegionToLargestPossibleRegion()
{
}
bool mitk::Contour::RequestedRegionIsOutsideOfTheBufferedRegion()
{
return false;
}
bool mitk::Contour::VerifyRequestedRegion()
{
return true;
}
void mitk::Contour::SetRequestedRegion(itk::DataObject*)
{
}
mitk::Contour::PathType::Pointer mitk::Contour::GetContourPath() const
{
return m_ContourPath;
}
void mitk::Contour::SetCurrentWindow(vtkRenderWindow* rw)
{
m_CurrentWindow = rw;
}
vtkRenderWindow* mitk::Contour::GetCurrentWindow() const
{
return m_CurrentWindow;
}
void mitk::Contour::Initialize()
{
m_ContourPath = PathType::New();
m_ContourPath->Initialize();
m_BoundingBox = BoundingBoxType::New();
m_Vertices = BoundingBoxType::PointsContainer::New();
- GetTimeSlicedGeometry()->Initialize(1);
+ GetTimeSlicedGeometry()->InitializeEvenlyTimed(1);
}
unsigned int mitk::Contour::GetNumberOfPoints() const
{
return m_Vertices->Size();
}
mitk::Contour::PointsContainerPointer
mitk::Contour::GetPoints() const
{
return m_Vertices;
}
void mitk::Contour::SetPoints(mitk::Contour::PointsContainerPointer points)
{
m_Vertices = points;
Modified();
}
void mitk::Contour::PrintSelf( std::ostream& os, itk::Indent indent) const
{
Superclass::PrintSelf( os, indent );
os << indent << "Number of verticies: " << GetNumberOfPoints() << std::endl;
mitk::Contour::PointsContainerIterator pointsIt = m_Vertices->Begin(), end = m_Vertices->End();
os << indent << "Verticies: " << std::endl;
int i = 0;
while ( pointsIt != end )
{
os << indent << indent << i << ": " << pointsIt.Value() << std::endl;
++pointsIt; ++i;
}
}
diff --git a/Modules/MitkExt/DataManagement/mitkContourSet.cpp b/Modules/MitkExt/DataManagement/mitkContourSet.cpp
index 09fc6c19b4..810f0df9f6 100644
--- a/Modules/MitkExt/DataManagement/mitkContourSet.cpp
+++ b/Modules/MitkExt/DataManagement/mitkContourSet.cpp
@@ -1,122 +1,122 @@
/*=========================================================================
Program: Medical Imaging & Interaction Toolkit
Language: C++
Date: $Date$
Version: $Revision$
Copyright (c) German Cancer Research Center, Division of Medical and
Biological Informatics. All rights reserved.
See MITKCopyright.txt or http://www.mitk.org/copyright.html for details.
This software is distributed WITHOUT ANY WARRANTY; without even
the implied warranty of MERCHANTABILITY or FITNESS FOR A PARTICULAR
PURPOSE. See the above copyright notices for more information.
=========================================================================*/
#include "mitkContourSet.h"
mitk::ContourSet::ContourSet() :
m_ContourVector( ContourVectorType() ),
m_NumberOfContours (0)
{
- GetTimeSlicedGeometry()->Initialize(1);
+ GetTimeSlicedGeometry()->InitializeEvenlyTimed(1);
}
mitk::ContourSet::~ContourSet()
{
}
void mitk::ContourSet::AddContour(unsigned int index, mitk::Contour::Pointer contour)
{
m_ContourVector.insert(std::make_pair<unsigned long, mitk::Contour::Pointer>( index , contour) );
}
void mitk::ContourSet::RemoveContour(unsigned long index)
{
m_ContourVector.erase( index );
}
void mitk::ContourSet::UpdateOutputInformation()
{
mitk::ContourSet::ContourVectorType contourVec = GetContours();
mitk::ContourSet::ContourIterator contoursIterator = contourVec.begin();
mitk::ContourSet::ContourIterator contoursIteratorEnd = contourVec.end();
// initialize container
mitk::BoundingBox::PointsContainer::Pointer pointscontainer=mitk::BoundingBox::PointsContainer::New();
mitk::BoundingBox::PointIdentifier pointid=0;
mitk::Point3D point;
mitk::AffineTransform3D* transform = GetTimeSlicedGeometry()->GetIndexToWorldTransform();
mitk::AffineTransform3D::Pointer inverse = mitk::AffineTransform3D::New();
transform->GetInverse(inverse);
// calculate a bounding box that includes all contours
// \todo probably we should do this additionally for each time-step
while (contoursIterator != contoursIteratorEnd)
{
const Geometry3D* geometry = (*contoursIterator).second->GetUpdatedTimeSlicedGeometry();
unsigned char i;
for(i=0; i<8; ++i)
{
point = inverse->TransformPoint(geometry->GetCornerPoint(i));
if(point[0]*point[0]+point[1]*point[1]+point[2]*point[2] < mitk::large)
pointscontainer->InsertElement( pointid++, point);
else
{
itkGenericOutputMacro( << "Unrealistically distant corner point encountered. Ignored. BoundingObject: " << (*contoursIterator).second );
}
}
++contoursIterator;
}
mitk::BoundingBox::Pointer boundingBox = mitk::BoundingBox::New();
boundingBox->SetPoints(pointscontainer);
boundingBox->ComputeBoundingBox();
Geometry3D* geometry3d = GetGeometry(0);
geometry3d->SetIndexToWorldTransform(transform);
geometry3d->SetBounds(boundingBox->GetBounds());
GetTimeSlicedGeometry()->InitializeEvenlyTimed(geometry3d, GetTimeSlicedGeometry()->GetTimeSteps());
}
void mitk::ContourSet::SetRequestedRegionToLargestPossibleRegion()
{
}
bool mitk::ContourSet::RequestedRegionIsOutsideOfTheBufferedRegion()
{
return true;
}
bool mitk::ContourSet::VerifyRequestedRegion()
{
return true;
}
void mitk::ContourSet::SetRequestedRegion(itk::DataObject*)
{
}
void mitk::ContourSet::Initialize()
{
m_ContourVector = ContourVectorType();
- GetTimeSlicedGeometry()->Initialize(1);
+ GetTimeSlicedGeometry()->InitializeEvenlyTimed(1);
}
unsigned int mitk::ContourSet::GetNumberOfContours()
{
return m_ContourVector.size();
}
mitk::ContourSet::ContourVectorType mitk::ContourSet::GetContours()
{
return m_ContourVector;
}
diff --git a/Modules/MitkExt/DataManagement/mitkDataStorageSelection.cpp b/Modules/MitkExt/DataManagement/mitkDataStorageSelection.cpp
index 4a0b31da5c..3fbe12b139 100644
--- a/Modules/MitkExt/DataManagement/mitkDataStorageSelection.cpp
+++ b/Modules/MitkExt/DataManagement/mitkDataStorageSelection.cpp
@@ -1,369 +1,369 @@
/*=========================================================================
Program: Medical Imaging & Interaction Toolkit
Language: C++
Date: $Date: 2009-07-14 19:11:20 +0200 (Tue, 14 Jul 2009) $
Version: $Revision: 18127 $
Copyright (c) German Cancer Research Center, Division of Medical and
Biological Informatics. All rights reserved.
See MITKCopyright.txt or http://www.mitk.org/copyright.html for details.
This software is distributed WITHOUT ANY WARRANTY; without even
the implied warranty of MERCHANTABILITY or FITNESS FOR A PARTICULAR
PURPOSE. See the above copyright notices for more information.
=========================================================================*/
#include "mitkDataStorageSelection.h"
#include <itkCommand.h>
#include <mitkBaseProperty.h>
#include <mitkPropertyList.h>
namespace mitk
{
DataStorageSelection::DataStorageSelection(mitk::DataStorage* _DataStorage, bool _AutoAddNodes)
: m_DataStorage(0), m_Predicate(0), m_SelfCall(false), m_AutoAddNodes(_AutoAddNodes)
{
this->SetDataStorage(_DataStorage);
}
DataStorageSelection::DataStorageSelection(mitk::DataStorage* _DataStorage
, mitk::NodePredicateBase* _Predicate
, bool _AutoAddNodes)
: m_DataStorage(0), m_Predicate(_Predicate), m_SelfCall(false), m_AutoAddNodes(_AutoAddNodes)
{
this->SetDataStorage(_DataStorage);
}
DataStorageSelection::~DataStorageSelection()
{
// kick datastorage and all nodes and all listeners
this->SetDataStorage(0);
}
mitk::DataStorage::Pointer DataStorageSelection::GetDataStorage() const
{
return m_DataStorage;
}
mitk::NodePredicateBase::Pointer DataStorageSelection::GetPredicate() const
{
return m_Predicate;
}
unsigned int DataStorageSelection::GetSize() const
{
return m_Nodes.size();
}
mitk::DataNode::Pointer DataStorageSelection::GetNode() const
{
return this->GetNode(0);
}
mitk::DataNode::Pointer DataStorageSelection::GetNode(unsigned int index) const
{
return (index < m_Nodes.size())? m_Nodes.at(index): 0;
}
std::vector<mitk::DataNode*> DataStorageSelection::GetNodes() const
{
return m_Nodes;
}
bool DataStorageSelection::DoesAutoAddNodes() const
{
return m_AutoAddNodes;
}
DataStorageSelection& DataStorageSelection::operator=(mitk::DataNode* node)
{
this->RemoveAllNodes();
this->AddNode(node);
return *this;
}
DataStorageSelection& DataStorageSelection::operator=(mitk::DataNode::Pointer node)
{
*this = node.GetPointer();
return *this;
}
void DataStorageSelection::SetDataStorage(mitk::DataStorage* _DataStorage)
{
// only proceed if we have a new datastorage
if(m_DataStorage != _DataStorage)
{
// if a data storage was set before remove old event listeners
if(m_DataStorage != 0)
{
if(m_AutoAddNodes)
this->m_DataStorage->AddNodeEvent.RemoveListener( mitk::MessageDelegate1<DataStorageSelection
, const mitk::DataNode*>( this, &DataStorageSelection::AddNode ) );
this->m_DataStorage->RemoveNodeEvent.RemoveListener( mitk::MessageDelegate1<DataStorageSelection
, const mitk::DataNode*>( this, &DataStorageSelection::RemoveNode ) );
m_DataStorage->RemoveObserver(m_DataStorageDeletedTag);
m_DataStorageDeletedTag = 0;
}
// set new data storage
m_DataStorage = _DataStorage;
// if new storage is not 0 subscribe for events
if(m_DataStorage != 0)
{
// subscribe for node added/removed events
if(m_AutoAddNodes)
this->m_DataStorage->AddNodeEvent.AddListener( mitk::MessageDelegate1<DataStorageSelection
, const mitk::DataNode*>( this, &DataStorageSelection::AddNode ) );
this->m_DataStorage->RemoveNodeEvent.AddListener( mitk::MessageDelegate1<DataStorageSelection
, const mitk::DataNode*>( this, &DataStorageSelection::RemoveNode ) );
itk::MemberCommand<DataStorageSelection>::Pointer ObjectChangedCommand
= itk::MemberCommand<DataStorageSelection>::New();
ObjectChangedCommand->SetCallbackFunction(this, &DataStorageSelection::ObjectChanged);
m_DataStorageDeletedTag = m_DataStorage->AddObserver(itk::DeleteEvent(), ObjectChangedCommand);
}
// Reset model (even if datastorage is 0->will be checked in Reset())
this->Reset();
}
}
void DataStorageSelection::SetPredicate(mitk::NodePredicateBase* _Predicate)
{
// ensure that a new predicate is set in order to avoid unnecessary changed events
if(m_Predicate != _Predicate)
{
m_Predicate = _Predicate;
this->Reset();
}
}
void DataStorageSelection::AddNode(const mitk::DataNode* node)
{
// garantuee no recursions when a new node event is thrown
if(m_SelfCall)
return;
// if we have a predicate, check node against predicate first
if(m_Predicate.IsNotNull() && !m_Predicate->CheckNode(node))
return;
// no duplicates
if(std::find(m_Nodes.begin(), m_Nodes.end(), node) != m_Nodes.end())
return;
mitk::DataNode* nonConstNode = const_cast<mitk::DataNode*>(node);
// add listener
this->AddListener(nonConstNode);
// add node
m_Nodes.push_back(nonConstNode);
NodeAdded.Send(node);
}
void DataStorageSelection::RemoveNode(const mitk::DataNode* node)
{
if(m_SelfCall)
return;
// find corresponding node
std::vector<mitk::DataNode*>::iterator nodeIt
= std::find(m_Nodes.begin(), m_Nodes.end(), node);
if(nodeIt == m_Nodes.end())
return;
mitk::DataNode* nonConstNode = const_cast<mitk::DataNode*>(node);
// add listener
this->RemoveListener(nonConstNode);
// remove node
m_Nodes.erase(nodeIt);
NodeRemoved.Send(node);
}
void DataStorageSelection::RemoveAllNodes()
{
// remove all nodes now (dont use iterators because removing elements
// would invalidate the iterator)
// start at the last element: first in, last out
unsigned int i = m_Nodes.size();
while(!m_Nodes.empty())
{
--i;
this->RemoveNode(m_Nodes.at(i));
}
}
void DataStorageSelection::ObjectChanged(const itk::Object *caller, const itk::EventObject &event)
{
if(m_SelfCall)
return;
const itk::DeleteEvent* delEvent = 0;
const itk::ModifiedEvent* modifiedEvent = dynamic_cast<const itk::ModifiedEvent*>(&event);
if(!modifiedEvent)
delEvent = dynamic_cast<const itk::DeleteEvent*>(&event);
const mitk::BaseProperty* prop = 0;
const mitk::PropertyList* propList = 0;
const mitk::DataNode* node = dynamic_cast<const mitk::DataNode*>(caller);
if(!node)
{
if((prop = dynamic_cast<const mitk::BaseProperty*>(caller)))
{
node = this->FindNode(prop);
}
else if((propList = dynamic_cast<const mitk::PropertyList*>(caller)))
{
node = this->FindNode(propList);
}
else if(dynamic_cast<const mitk::DataStorage*>(caller))
{
this->SetDataStorage(0);
}
}
if(prop && node)
{
PropertyChanged.Send(node, prop);
}
else if(node)
{
NodeChanged.Send(node);
}
}
//# protected
mitk::DataNode::Pointer DataStorageSelection::FindNode(const mitk::BaseProperty* prop) const
{
mitk::DataNode* node = 0;
for(Nodes::const_iterator it=m_Nodes.begin(); it!=m_Nodes.end(); ++it)
{
for(mitk::PropertyList::PropertyMap::const_iterator it2
= (*it)->GetPropertyList()->GetMap()->begin()
; it2 != (*it)->GetPropertyList()->GetMap()->end(); ++it2)
{
- if(it2->second.first == prop)
+ if(it2->second == prop)
{
node = *it;
break;
}
}
}
return node;
}
mitk::DataNode::Pointer DataStorageSelection::FindNode(const mitk::PropertyList* propList) const
{
mitk::DataNode* node = 0;
for(Nodes::const_iterator it=m_Nodes.begin(); it!=m_Nodes.end(); ++it)
{
if((*it)->GetPropertyList() == propList)
{
node = *it;
break;
}
}
return node;
}
void DataStorageSelection::Reset()
{
this->RemoveAllNodes();
// the whole reset depends on the fact if a data storage is set or not
if(m_DataStorage)
{
mitk::DataStorage::SetOfObjects::ConstPointer _NodeSet = 0;
if(m_AutoAddNodes && m_Predicate.IsNotNull())
// get subset
_NodeSet = m_DataStorage->GetSubset(m_Predicate);
// if predicate is NULL, select all nodes
else if(m_AutoAddNodes)
{
_NodeSet = m_DataStorage->GetAll();
}
else
return;
// finally add all nodes to the model
for(mitk::DataStorage::SetOfObjects::const_iterator it=_NodeSet->begin(); it!=_NodeSet->end()
; it++)
{
// save node
this->AddNode(*it);
}
}
}
void DataStorageSelection::RemoveListener(mitk::DataNode* node)
{
// remove node listener
node->RemoveObserver(m_NodeModifiedObserverTags[node]);
m_NodeModifiedObserverTags.erase(node);
// remove propertylist listener
mitk::PropertyList* propList = node->GetPropertyList();
propList->RemoveObserver(m_PropertyListModifiedObserverTags[propList]);
m_PropertyListModifiedObserverTags.erase(propList);
propList->RemoveObserver(m_PropertyListDeletedObserverTags[propList]);
m_PropertyListDeletedObserverTags.erase(propList);
mitk::BaseProperty* prop = 0;
// do the same for each property
for(mitk::PropertyList::PropertyMap::const_iterator it=propList->GetMap()->begin()
; it!=propList->GetMap()->end()
; ++it)
{
- prop = it->second.first;
+ prop = it->second;
prop->RemoveObserver(m_PropertyModifiedObserverTags[prop]);
m_PropertyModifiedObserverTags.erase(prop);
prop->RemoveObserver(m_PropertyDeletedObserverTags[prop]);
m_PropertyDeletedObserverTags.erase(prop);
}
}
void DataStorageSelection::AddListener(mitk::DataNode* node)
{
// node listener
itk::MemberCommand<DataStorageSelection>::Pointer ObjectChangedCommand
= itk::MemberCommand<DataStorageSelection>::New();
ObjectChangedCommand->SetCallbackFunction(this, &DataStorageSelection::ObjectChanged);
m_NodeModifiedObserverTags[node] = node->AddObserver(itk::ModifiedEvent()
, ObjectChangedCommand);
// create propertylist listener
mitk::PropertyList* propList = node->GetPropertyList();
m_PropertyListModifiedObserverTags[propList] = propList
->AddObserver(itk::ModifiedEvent(), ObjectChangedCommand);
m_PropertyListDeletedObserverTags[propList] = propList
->AddObserver(itk::DeleteEvent(), ObjectChangedCommand);
mitk::BaseProperty* prop = 0;
// do the same for each property
for(mitk::PropertyList::PropertyMap::const_iterator it=propList->GetMap()->begin()
; it!=propList->GetMap()->end()
; ++it)
{
- prop = it->second.first;
+ prop = it->second;
m_PropertyModifiedObserverTags[prop] = prop->AddObserver(itk::ModifiedEvent()
, ObjectChangedCommand);
m_PropertyDeletedObserverTags[prop] = prop->AddObserver(itk::ModifiedEvent()
, ObjectChangedCommand);
}
}
}
diff --git a/Modules/MitkExt/DataManagement/mitkExternAbstractTransformGeometry.cpp b/Modules/MitkExt/DataManagement/mitkExternAbstractTransformGeometry.cpp
index 5106754011..da85c2e3e1 100644
--- a/Modules/MitkExt/DataManagement/mitkExternAbstractTransformGeometry.cpp
+++ b/Modules/MitkExt/DataManagement/mitkExternAbstractTransformGeometry.cpp
@@ -1,64 +1,62 @@
/*=========================================================================
Program: Medical Imaging & Interaction Toolkit
Language: C++
Date: $Date$
Version: $Revision$
Copyright (c) German Cancer Research Center, Division of Medical and
Biological Informatics. All rights reserved.
See MITKCopyright.txt or http://www.mitk.org/copyright.html for details.
This software is distributed WITHOUT ANY WARRANTY; without even
the implied warranty of MERCHANTABILITY or FITNESS FOR A PARTICULAR
PURPOSE. See the above copyright notices for more information.
=========================================================================*/
#include "mitkExternAbstractTransformGeometry.h"
#include <vtkAbstractTransform.h>
mitk::ExternAbstractTransformGeometry::ExternAbstractTransformGeometry()
{
}
+mitk::ExternAbstractTransformGeometry::ExternAbstractTransformGeometry(const ExternAbstractTransformGeometry& other) : Superclass(other)
+{
+}
mitk::ExternAbstractTransformGeometry::~ExternAbstractTransformGeometry()
{
}
void mitk::ExternAbstractTransformGeometry::SetVtkAbstractTransform(vtkAbstractTransform* aVtkAbstractTransform)
{
Superclass::SetVtkAbstractTransform(aVtkAbstractTransform);
}
void mitk::ExternAbstractTransformGeometry::SetPlane(const mitk::PlaneGeometry* aPlane)
{
Superclass::SetPlane(aPlane);
}
void mitk::ExternAbstractTransformGeometry::SetParametricBounds(const BoundingBox::BoundsArrayType& bounds)
{
Superclass::SetParametricBounds(bounds);
//@warning affine-transforms and bounding-box should be set by specific sub-classes!
SetBounds(bounds);
if(m_Plane.IsNotNull())
{
m_Plane->SetSizeInUnits(bounds[1]-bounds[0], bounds[3]-bounds[2]);
m_Plane->SetBounds(bounds);
}
}
mitk::AffineGeometryFrame3D::Pointer mitk::ExternAbstractTransformGeometry::Clone() const
{
- Self::Pointer newGeometry = Self::New();
- newGeometry->Initialize();
- InitializeGeometry(newGeometry);
+ Self::Pointer newGeometry = new ExternAbstractTransformGeometry(*this);
+ newGeometry->UnRegister();
return newGeometry.GetPointer();
}
-void mitk::ExternAbstractTransformGeometry::InitializeGeometry(Self * newGeometry) const
-{
- Superclass::InitializeGeometry(newGeometry);
-}
diff --git a/Modules/MitkExt/DataManagement/mitkExternAbstractTransformGeometry.h b/Modules/MitkExt/DataManagement/mitkExternAbstractTransformGeometry.h
index fed23bb175..8577802bf5 100644
--- a/Modules/MitkExt/DataManagement/mitkExternAbstractTransformGeometry.h
+++ b/Modules/MitkExt/DataManagement/mitkExternAbstractTransformGeometry.h
@@ -1,71 +1,71 @@
/*=========================================================================
Program: Medical Imaging & Interaction Toolkit
Language: C++
Date: $Date$
Version: $Revision$
Copyright (c) German Cancer Research Center, Division of Medical and
Biological Informatics. All rights reserved.
See MITKCopyright.txt or http://www.mitk.org/copyright.html for details.
This software is distributed WITHOUT ANY WARRANTY; without even
the implied warranty of MERCHANTABILITY or FITNESS FOR A PARTICULAR
PURPOSE. See the above copyright notices for more information.
=========================================================================*/
#ifndef MITKEXTERNABSTRACTTRANSFORMPLANEGEOMETRY_H_HEADER_INCLUDED_C1C68A2C
#define MITKEXTERNABSTRACTTRANSFORMPLANEGEOMETRY_H_HEADER_INCLUDED_C1C68A2C
#include "mitkCommon.h"
#include "MitkExtExports.h"
#include "mitkAbstractTransformGeometry.h"
namespace mitk {
//##Documentation
//## @brief Identical with AbstractTransformGeometry, except that
//## it can be externally configured.
//##
//## In contrast to its superclass (AbstractTransformGeometry), this class
//## provides write access to the vtkAbstractTransform and m_Plane.
//## @note The PlaneGeometry is cloned, @em not linked/referenced.
//## @note The bounds of the PlaneGeometry are used as the parametric bounds.
//## @sa AbstractTransformGeometry
//## @ingroup Geometry
class MitkExt_EXPORT ExternAbstractTransformGeometry : public AbstractTransformGeometry
{
public:
mitkClassMacro(ExternAbstractTransformGeometry, AbstractTransformGeometry);
itkNewMacro(Self);
//##Documentation
//## @brief Set the vtkAbstractTransform (stored in m_VtkAbstractTransform)
virtual void SetVtkAbstractTransform(vtkAbstractTransform* aVtkAbstractTransform);
//##Documentation
//## @brief Set the rectangular area that is used for transformation by
//## m_VtkAbstractTransform and therewith defines the 2D manifold described by
//## ExternAbstractTransformGeometry
//##
//## @note The bounds of the PlaneGeometry are used as the parametric bounds.
//## @note The PlaneGeometry is cloned, @em not linked/referenced.
virtual void SetPlane(const mitk::PlaneGeometry* aPlane);
virtual void SetParametricBounds(const BoundingBox::BoundsArrayType& bounds);
virtual AffineGeometryFrame3D::Pointer Clone() const;
protected:
ExternAbstractTransformGeometry();
+ ExternAbstractTransformGeometry(const ExternAbstractTransformGeometry& other);
virtual ~ExternAbstractTransformGeometry();
- void InitializeGeometry(Self * newGeometry) const;
};
} // namespace mitk
#endif /* MITKEXTERNABSTRACTTRANSFORMPLANEGEOMETRY_H_HEADER_INCLUDED_C1C68A2C */
diff --git a/Modules/MitkExt/DataManagement/mitkExtrudedContour.cpp b/Modules/MitkExt/DataManagement/mitkExtrudedContour.cpp
index 92630ea703..1d0d6927ef 100644
--- a/Modules/MitkExt/DataManagement/mitkExtrudedContour.cpp
+++ b/Modules/MitkExt/DataManagement/mitkExtrudedContour.cpp
@@ -1,402 +1,402 @@
/*=========================================================================
Program: Medical Imaging & Interaction Toolkit
Language: C++
Date: $Date$
Version: $Revision$
Copyright (c) German Cancer Research Center, Division of Medical and
Biological Informatics. All rights reserved.
See MITKCopyright.txt or http://www.mitk.org/copyright.html for details.
This software is distributed WITHOUT ANY WARRANTY; without even
the implied warranty of MERCHANTABILITY or FITNESS FOR A PARTICULAR
PURPOSE. See the above copyright notices for more information.
=========================================================================*/
#include "mitkExtrudedContour.h"
#include "mitkVector.h"
#include "mitkBaseProcess.h"
#include <itkSmartPointerForwardReference.txx>
#include <vtkLinearExtrusionFilter.h>
#include <vtkPolyData.h>
#include <vtkPoints.h>
#include <vtkCellArray.h>
#include <vtkPlanes.h>
#include <vtkClipPolyData.h>
#include <vtkPolygon.h>
#include <vtkFloatArray.h>
#include <vtkDoubleArray.h>
#include <vtkPlane.h>
//vtkButterflySubdivisionFilter * subdivs;
#include <vtkSampleFunction.h>
#include <vtkTriangleFilter.h>
#include <vtkLinearSubdivisionFilter.h>
#include <vtkImageData.h>
#include <vtkCubeSource.h>
mitk::ExtrudedContour::ExtrudedContour()
: m_Contour(NULL), m_ClippingGeometry(NULL), m_AutomaticVectorGeneration(false)
{
- GetTimeSlicedGeometry()->Initialize(1);
+ GetTimeSlicedGeometry()->InitializeEvenlyTimed(1);
FillVector3D(m_Vector, 0.0, 0.0, 1.0);
m_RightVector.Fill(0.0);
m_ExtrusionFilter = vtkLinearExtrusionFilter::New();
m_ExtrusionFilter->CappingOff();
m_ExtrusionFilter->SetExtrusionTypeToVectorExtrusion();
#if ((VTK_MAJOR_VERSION > 4) || ((VTK_MAJOR_VERSION==4) && (VTK_MINOR_VERSION>=4) ))
double vtkvector[3]={0,0,1};
#else
float vtkvector[3]={0,0,1};
#endif
// set extrusion vector
m_ExtrusionFilter->SetVector(vtkvector);
m_TriangleFilter = vtkTriangleFilter::New();
m_TriangleFilter->SetInput(m_ExtrusionFilter->GetOutput());
m_SubdivisionFilter = vtkLinearSubdivisionFilter::New();
m_SubdivisionFilter->SetInput(m_TriangleFilter->GetOutput());
m_SubdivisionFilter->SetNumberOfSubdivisions(4);
m_ClippingBox = vtkPlanes::New();
m_ClipPolyDataFilter = vtkClipPolyData::New();
m_ClipPolyDataFilter->SetInput(m_SubdivisionFilter->GetOutput());
m_ClipPolyDataFilter->SetClipFunction(m_ClippingBox);
m_ClipPolyDataFilter->InsideOutOn();
m_Polygon = vtkPolygon::New();
m_ProjectionPlane = mitk::PlaneGeometry::New();
}
mitk::ExtrudedContour::~ExtrudedContour()
{
m_ClipPolyDataFilter->Delete();
m_ClippingBox->Delete();
m_SubdivisionFilter->Delete();
m_TriangleFilter->Delete();
m_ExtrusionFilter->Delete();
m_Polygon->Delete();
}
bool mitk::ExtrudedContour::IsInside(const Point3D& worldPoint) const
{
#if ((VTK_MAJOR_VERSION > 4) || ((VTK_MAJOR_VERSION==4) && (VTK_MINOR_VERSION>=4) ))
static double polygonNormal[3]={0.0,0.0,1.0};
#else
static float polygonNormal[3]={0.0,0.0,1.0};
#endif
// project point onto plane
float xt[3];
itk2vtk(worldPoint, xt);
xt[0] = worldPoint[0]-m_Origin[0];
xt[1] = worldPoint[1]-m_Origin[1];
xt[2] = worldPoint[2]-m_Origin[2];
float dist=xt[0]*m_Normal[0]+xt[1]*m_Normal[1]+xt[2]*m_Normal[2];
xt[0] -= dist*m_Normal[0];
xt[1] -= dist*m_Normal[1];
xt[2] -= dist*m_Normal[2];
#if ((VTK_MAJOR_VERSION > 4) || ((VTK_MAJOR_VERSION==4) && (VTK_MINOR_VERSION>=4) ))
double x[3];
#else
float x[3];
#endif
x[0] = xt[0]*m_Right[0]+xt[1]*m_Right[1]+xt[2]*m_Right[2];
x[1] = xt[0]*m_Down[0] +xt[1]*m_Down[1] +xt[2]*m_Down[2];
x[2] = 0;
#if ((VTK_MAJOR_VERSION > 4) || ((VTK_MAJOR_VERSION==4) && (VTK_MINOR_VERSION>=4) ))
// determine whether it's in the selection loop and then evaluate point
// in polygon only if absolutely necessary.
if ( x[0] >= this->m_ProjectedContourBounds[0] && x[0] <= this->m_ProjectedContourBounds[1] &&
x[1] >= this->m_ProjectedContourBounds[2] && x[1] <= this->m_ProjectedContourBounds[3] &&
this->m_Polygon->PointInPolygon(x, m_Polygon->Points->GetNumberOfPoints(),
((vtkDoubleArray *)this->m_Polygon->Points->GetData())->GetPointer(0),
(double*)const_cast<mitk::ExtrudedContour*>(this)->m_ProjectedContourBounds, polygonNormal) == 1 )
return true;
else
return false;
#else
// determine whether it's in the selection loop and then evaluate point
// in polygon only if absolutely necessary.
if ( x[0] >= this->m_ProjectedContourBounds[0] && x[0] <= this->m_ProjectedContourBounds[1] &&
x[1] >= this->m_ProjectedContourBounds[2] && x[1] <= this->m_ProjectedContourBounds[3] &&
this->m_Polygon->PointInPolygon(x, m_Polygon->Points->GetNumberOfPoints(),
((vtkFloatArray *)this->m_Polygon->Points->GetData())->GetPointer(0),
const_cast<mitk::ExtrudedContour*>(this)->m_ProjectedContourBounds, polygonNormal) == 1 )
return true;
else
return false;
#endif
}
mitk::ScalarType mitk::ExtrudedContour::GetVolume()
{
return -1.0;
}
void mitk::ExtrudedContour::UpdateOutputInformation()
{
if ( this->GetSource() )
{
this->GetSource()->UpdateOutputInformation();
}
if(GetMTime() > m_LastCalculateExtrusionTime)
{
BuildGeometry();
BuildSurface();
}
//if ( ( m_CalculateBoundingBox ) && ( m_PolyDataSeries.size() > 0 ) )
// CalculateBoundingBox();
}
void mitk::ExtrudedContour::BuildSurface()
{
if(m_Contour.IsNull())
{
SetVtkPolyData(NULL);
return;
}
// set extrusion contour
vtkPolyData *polyData = vtkPolyData::New();
vtkCellArray *polys = vtkCellArray::New();
polys->InsertNextCell(m_Polygon->GetPointIds());
polyData->SetPoints(m_Polygon->GetPoints());
//float vtkpoint[3];
//unsigned int i, numPts = m_Polygon->GetNumberOfPoints();
//for(i=0; i<numPts; ++i)
//{
// float * vtkpoint = this->m_Polygon->Points->GetPoint(i);
// pointids[i]=loopPoints->InsertNextPoint(vtkpoint);
//}
//polys->InsertNextCell( i, pointids );
//delete [] pointids;
//polyData->SetPoints( loopPoints );
polyData->SetPolys( polys );
polys->Delete();
m_ExtrusionFilter->SetInput(polyData);
polyData->Delete();
// set extrusion scale factor
m_ExtrusionFilter->SetScaleFactor(GetGeometry()->GetExtentInMM(2));
SetVtkPolyData(m_SubdivisionFilter->GetOutput());
//if(m_ClippingGeometry.IsNull())
//{
// SetVtkPolyData(m_SubdivisionFilter->GetOutput());
//}
//else
//{
// m_ClipPolyDataFilter->SetInput(m_SubdivisionFilter->GetOutput());
// mitk::BoundingBox::BoundsArrayType bounds=m_ClippingGeometry->GetBounds();
// m_ClippingBox->SetBounds(bounds[0], bounds[1], bounds[2], bounds[3], bounds[4], bounds[5]);
// m_ClippingBox->SetTransform(GetGeometry()->GetVtkTransform());
// m_ClipPolyDataFilter->SetClipFunction(m_ClippingBox);
// m_ClipPolyDataFilter->SetValue(0);
// SetVtkPolyData(m_ClipPolyDataFilter->GetOutput());
//}
m_LastCalculateExtrusionTime.Modified();
}
void mitk::ExtrudedContour::BuildGeometry()
{
if(m_Contour.IsNull())
return;
// Initialize(1);
Vector3D nullvector; nullvector.Fill(0.0);
float xProj[3];
unsigned int i;
unsigned int numPts = 20; //m_Contour->GetNumberOfPoints();
mitk::Contour::PathPointer path = m_Contour->GetContourPath();
mitk::Contour::PathType::InputType cstart = path->StartOfInput();
mitk::Contour::PathType::InputType cend = path->EndOfInput();
mitk::Contour::PathType::InputType cstep = (cend-cstart)/numPts;
mitk::Contour::PathType::InputType ccur;
// Part I: guarantee/calculate legal vectors
m_Vector.Normalize();
itk2vtk(m_Vector, m_Normal);
// check m_Vector
if(mitk::Equal(m_Vector, nullvector) || m_AutomaticVectorGeneration)
{
if ( m_AutomaticVectorGeneration == false)
itkWarningMacro("Extrusion vector is 0 ("<< m_Vector << "); trying to use normal of polygon");
vtkPoints *loopPoints = vtkPoints::New();
//mitk::Contour::PointsContainerIterator pointsIt = m_Contour->GetPoints()->Begin();
#if ((VTK_MAJOR_VERSION > 4) || ((VTK_MAJOR_VERSION==4) && (VTK_MINOR_VERSION>=4) ))
double vtkpoint[3];
#else
float vtkpoint[3];
#endif
unsigned int i=0;
for(i=0, ccur=cstart; i<numPts; ++i, ccur+=cstep)
{
itk2vtk(path->Evaluate(ccur), vtkpoint);
loopPoints->InsertNextPoint(vtkpoint);
}
// Make sure points define a loop with a m_Normal
vtkPolygon::ComputeNormal(loopPoints, m_Normal);
loopPoints->Delete();
vtk2itk(m_Normal, m_Vector);
if(mitk::Equal(m_Vector, nullvector))
{
itkExceptionMacro("Cannot calculate normal of polygon");
}
}
// check m_RightVector
if((mitk::Equal(m_RightVector, nullvector)) || (mitk::Equal(m_RightVector*m_Vector, 0.0)==false))
{
if(mitk::Equal(m_RightVector, nullvector))
{
itkDebugMacro("Right vector is 0. Calculating.");
}
else
{
itkWarningMacro("Right vector ("<<m_RightVector<<") not perpendicular to extrusion vector "<<m_Vector<<": "<<m_RightVector*m_Vector);
}
// calculate a legal m_RightVector
if( mitk::Equal( m_Vector[1], 0.0f ) == false )
{
FillVector3D( m_RightVector, 1.0f, -m_Vector[0]/m_Vector[1], 0.0f );
m_RightVector.Normalize();
}
else
{
FillVector3D( m_RightVector, 0.0f, 1.0f, 0.0f );
}
}
// calculate down-vector
VnlVector rightDV = m_RightVector.Get_vnl_vector(); rightDV.normalize(); vnl2vtk(rightDV, m_Right);
VnlVector downDV = vnl_cross_3d( m_Vector.Get_vnl_vector(), rightDV ); downDV.normalize(); vnl2vtk(downDV, m_Down);
// Part II: calculate plane as base for extrusion, project the contour
// on this plane and store as polygon for IsInside test and BoundingBox calculation
// initialize m_ProjectionPlane, yet with origin at 0
m_ProjectionPlane->InitializeStandardPlane(rightDV, downDV);
// create vtkPolygon from contour and simultaneously determine 2D bounds of
// contour projected on m_ProjectionPlane
//mitk::Contour::PointsContainerIterator pointsIt = m_Contour->GetPoints()->Begin();
m_Polygon->Points->Reset();
m_Polygon->Points->SetNumberOfPoints(numPts);
m_Polygon->PointIds->Reset();
m_Polygon->PointIds->SetNumberOfIds(numPts);
mitk::Point2D pt2d;
mitk::Point3D pt3d;
mitk::Point2D min, max;
min.Fill(ScalarTypeNumericTraits::max());
max.Fill(ScalarTypeNumericTraits::min());
xProj[2]=0.0;
for(i=0, ccur=cstart; i<numPts; ++i, ccur+=cstep)
{
pt3d.CastFrom(path->Evaluate(ccur));
m_ProjectionPlane->Map(pt3d, pt2d);
xProj[0]=pt2d[0];
if(pt2d[0]<min[0]) min[0]=pt2d[0];
if(pt2d[0]>max[0]) max[0]=pt2d[0];
xProj[1]=pt2d[1];
if(pt2d[1]<min[1]) min[1]=pt2d[1];
if(pt2d[1]>max[1]) max[1]=pt2d[1];
m_Polygon->Points->SetPoint(i, xProj);
m_Polygon->PointIds->SetId(i, i);
}
// shift parametric origin to (0,0)
for(i=0; i<numPts; ++i)
{
#if ((VTK_MAJOR_VERSION > 4) || ((VTK_MAJOR_VERSION==4) && (VTK_MINOR_VERSION>=4) ))
double * pt = this->m_Polygon->Points->GetPoint(i);
#else
float * pt = this->m_Polygon->Points->GetPoint(i);
#endif
pt[0]-=min[0]; pt[1]-=min[1];
itkDebugMacro( << i << ": (" << pt[0] << "," << pt[1] << "," << pt[2] << ")" );
}
this->m_Polygon->GetBounds(m_ProjectedContourBounds);
//m_ProjectedContourBounds[4]=-1.0; m_ProjectedContourBounds[5]=1.0;
// calculate origin (except translation along the normal) and bounds
// of m_ProjectionPlane:
// origin is composed of the minimum x-/y-coordinates of the polygon,
// bounds from the extent of the polygon, both after projecting on the plane
mitk::Point3D origin;
m_ProjectionPlane->Map(min, origin);
ScalarType bounds[6]={0, max[0]-min[0], 0, max[1]-min[1], 0, 1};
m_ProjectionPlane->SetBounds(bounds);
m_ProjectionPlane->SetOrigin(origin);
// Part III: initialize geometry
if(m_ClippingGeometry.IsNotNull())
{
ScalarType min_dist=ScalarTypeNumericTraits::max(), max_dist=ScalarTypeNumericTraits::min(), dist;
unsigned char i;
for(i=0; i<8; ++i)
{
dist = m_ProjectionPlane->SignedDistance( m_ClippingGeometry->GetCornerPoint(i) );
if(dist<min_dist) min_dist=dist;
if(dist>max_dist) max_dist=dist;
}
//incorporate translation along the normal into origin
origin = origin+m_Vector*min_dist;
m_ProjectionPlane->SetOrigin(origin);
bounds[5]=max_dist-min_dist;
}
else
bounds[5]=20;
itk2vtk(origin, m_Origin);
mitk::TimeSlicedGeometry::Pointer timeGeometry = this->GetTimeSlicedGeometry();
mitk::Geometry3D::Pointer g3d = timeGeometry->GetGeometry3D( 0 );
assert( g3d.IsNotNull() );
g3d->SetBounds(bounds);
g3d->SetIndexToWorldTransform(m_ProjectionPlane->GetIndexToWorldTransform());
g3d->TransferItkToVtkTransform();
timeGeometry->InitializeEvenlyTimed(g3d, 1);
}
unsigned long mitk::ExtrudedContour::GetMTime() const
{
unsigned long latestTime = Superclass::GetMTime();
if(m_Contour.IsNotNull())
{
unsigned long localTime;
localTime = m_Contour->GetMTime();
if(localTime > latestTime) latestTime = localTime;
}
return latestTime;
}
diff --git a/Modules/MitkExt/DataManagement/mitkOrganTypeProperty.h b/Modules/MitkExt/DataManagement/mitkOrganTypeProperty.h
index ccd9d9e376..0109569fe0 100644
--- a/Modules/MitkExt/DataManagement/mitkOrganTypeProperty.h
+++ b/Modules/MitkExt/DataManagement/mitkOrganTypeProperty.h
@@ -1,60 +1,61 @@
/*=========================================================================
Program: Medical Imaging & Interaction Toolkit
Language: C++
Date: $Date$
Version: $Revision$
Copyright (c) German Cancer Research Center, Division of Medical and
Biological Informatics. All rights reserved.
See MITKCopyright.txt or http://www.mitk.org/copyright.html for details.
This software is distributed WITHOUT ANY WARRANTY; without even
the implied warranty of MERCHANTABILITY or FITNESS FOR A PARTICULAR
PURPOSE. See the above copyright notices for more information.
=========================================================================*/
#ifndef mitkOrganTypeProperty_h_Included
#define mitkOrganTypeProperty_h_Included
#include "mitkCommon.h"
#include "MitkExtExports.h"
#include "mitkEnumerationProperty.h"
#include <itkObjectFactory.h>
namespace mitk
{
/**
\brief Enumerates all known organs :-)
\sa QmitkInteractiveSegmentation
\ingroup ToolManagerEtAl
\ingroup DataManagement
Last contributor $Author$
*/
class MitkExt_EXPORT OrganTypeProperty : public EnumerationProperty
{
public:
mitkClassMacro(OrganTypeProperty, EnumerationProperty);
itkNewMacro(OrganTypeProperty);
mitkNewMacro1Param(OrganTypeProperty, const IdType&);
mitkNewMacro1Param(OrganTypeProperty, const std::string&);
+ virtual BaseProperty& operator=(const BaseProperty& other) { return Superclass::operator=(other); }
protected:
OrganTypeProperty();
OrganTypeProperty( const IdType& value );
OrganTypeProperty( const std::string& value );
virtual ~OrganTypeProperty();
virtual void AddEnumerationTypes();
};
} // namespace
#endif
diff --git a/Modules/MitkExt/IO/mitkUnstructuredGridVtkWriter.h b/Modules/MitkExt/IO/mitkUnstructuredGridVtkWriter.h
index 6ec9dd8749..d8df668d96 100644
--- a/Modules/MitkExt/IO/mitkUnstructuredGridVtkWriter.h
+++ b/Modules/MitkExt/IO/mitkUnstructuredGridVtkWriter.h
@@ -1,144 +1,144 @@
/*=========================================================================
Program: Medical Imaging & Interaction Toolkit
Language: C++
Date: $Date$
Version: $Revision: 10863 $
Copyright (c) German Cancer Research Center, Division of Medical and
Biological Informatics. All rights reserved.
See MITKCopyright.txt or http://www.mitk.org/copyright.html for details.
This software is distributed WITHOUT ANY WARRANTY; without even
the implied warranty of MERCHANTABILITY or FITNESS FOR A PARTICULAR
PURPOSE. See the above copyright notices for more information.
=========================================================================*/
#ifndef _MITK_UNSTRUCTURED_GRID_VTK_WRITER__H_
#define _MITK_UNSTRUCTURED_GRID_VTK_WRITER__H_
#include <itkProcessObject.h>
#include <mitkFileWriterWithInformation.h>
#include "mitkUnstructuredGrid.h"
namespace mitk
{
/**
* @brief VTK-based writer for mitk::UnstructuredGrid
*
* The mitk::UnstructuredGrid is written using the VTK-writer-type provided as the
* template argument. If the mitk::UnstructuredGrid contains multiple points of
* time, multiple files are written. The life-span (time-bounds) of each
* each point of time is included in the filename according to the
* following scheme:
* &lt;filename&gt;_S&lt;timebounds[0]&gt;E&lt;timebounds[1]&gt;_T&lt;framenumber&gt;
* (S=start, E=end, T=time).
* Writing of multiple files according to a given filename pattern is not
* yet supported.
* @ingroup Process
*/
template<class VTKWRITER>
class UnstructuredGridVtkWriter : public mitk::FileWriterWithInformation
{
public:
mitkClassMacro( UnstructuredGridVtkWriter, mitk::FileWriterWithInformation );
itkNewMacro( Self );
mitkWriterMacro;
/**
* Sets the filename of the file to write.
* @param _arg the name of the file to write.
*/
itkSetStringMacro( FileName );
/**
* @returns the name of the file to be written to disk.
*/
itkGetStringMacro( FileName );
/**
* @warning multiple write not (yet) supported
*/
itkSetStringMacro( FilePrefix );
/**
* @warning multiple write not (yet) supported
*/
itkGetStringMacro( FilePrefix );
/**
* @warning multiple write not (yet) supported
*/
itkSetStringMacro( FilePattern );
/**
* @warning multiple write not (yet) supported
*/
itkGetStringMacro( FilePattern );
/**
* Sets the 0'th input object for the filter.
* @param input the first input for the filter.
*/
void SetInput( mitk::UnstructuredGrid* input );
/**
* @returns the 0'th input object of the filter.
*/
const UnstructuredGrid* GetInput();
/**
* Returns false if an error happened during writing
*/
itkGetMacro( Success, bool );
/**
* @brief Return the possible file extensions for the data type associated with the writer
*/
virtual std::vector<std::string> GetPossibleFileExtensions();
// FileWriterWithInformation methods
virtual const char * GetDefaultFilename();
virtual const char * GetFileDialogPattern();
virtual const char * GetDefaultExtension();
- virtual bool CanWriteDataType(BaseData::Pointer data);
+ virtual bool CanWriteBaseDataType(BaseData::Pointer data);
virtual void DoWrite(BaseData::Pointer data);
protected:
/**
* Constructor.
*/
UnstructuredGridVtkWriter();
/**
* Virtual destructor.
*/
virtual ~UnstructuredGridVtkWriter();
void ExecuteWrite(VTKWRITER* vtkWriter);
virtual void GenerateData();
std::string m_FileName;
std::string m_FilePrefix;
std::string m_FilePattern;
bool m_Success;
};
}
#include "mitkUnstructuredGridVtkWriter.txx"
#endif // _MITK_UNSTRUCTURED_GRID_VTK_WRITER__H_
diff --git a/Modules/MitkExt/IO/mitkUnstructuredGridVtkWriter.txx b/Modules/MitkExt/IO/mitkUnstructuredGridVtkWriter.txx
index 8b4435a9d4..41906e2a1d 100644
--- a/Modules/MitkExt/IO/mitkUnstructuredGridVtkWriter.txx
+++ b/Modules/MitkExt/IO/mitkUnstructuredGridVtkWriter.txx
@@ -1,252 +1,252 @@
/*=========================================================================
Program: Medical Imaging & Interaction Toolkit
Language: C++
Date: $Date$
Version: $Revision: 10863 $
Copyright (c) German Cancer Research Center, Division of Medical and
Biological Informatics. All rights reserved.
See MITKCopyright.txt or http://www.mitk.org/copyright.html for details.
This software is distributed WITHOUT ANY WARRANTY; without even
the implied warranty of MERCHANTABILITY or FITNESS FOR A PARTICULAR
PURPOSE. See the above copyright notices for more information.
=========================================================================*/
#ifndef _MITK_UNSTRUCTURED_GRID_VTKWRITER_TXX_
#define _MITK_UNSTRUCTURED_GRID_VTKWRITER_TXX_
#include <itkLightObject.h>
#include <vtkUnstructuredGrid.h>
#include <vtkLinearTransform.h>
#include <vtkTransformFilter.h>
#include <vtkUnstructuredGridWriter.h>
#include <vtkXMLUnstructuredGridWriter.h>
#include <vtkXMLPUnstructuredGridWriter.h>
#include <sstream>
#include <sys/stat.h>
#include <sys/types.h>
#include <stdio.h>
namespace mitk {
template<class VTKWRITER>
UnstructuredGridVtkWriter<VTKWRITER>::UnstructuredGridVtkWriter()
: m_Success(false)
{
this->SetNumberOfRequiredInputs(1);
}
template<class VTKWRITER>
UnstructuredGridVtkWriter<VTKWRITER>::~UnstructuredGridVtkWriter()
{
}
template<class VTKWRITER>
void UnstructuredGridVtkWriter<VTKWRITER>::GenerateData()
{
m_Success = false;
if ( m_FileName == "" )
{
itkWarningMacro( << "Sorry, filename has not been set!" );
return ;
}
mitk::UnstructuredGrid::Pointer input = const_cast<mitk::UnstructuredGrid*>(this->GetInput());
if (input.IsNull())
{
itkWarningMacro( << "Sorry, input to mitk::UnstructuredGridVtkWriter is NULL");
return;
}
VTKWRITER* unstructuredGridWriter = VTKWRITER::New();
vtkTransformFilter* transformPointSet = vtkTransformFilter::New();
vtkUnstructuredGrid * unstructuredGrid;
Geometry3D* geometry;
if(input->GetTimeSlicedGeometry()->GetTimeSteps()>1)
{
int t, timesteps;
timesteps = input->GetTimeSlicedGeometry()->GetTimeSteps();
for(t = 0; t < timesteps; ++t)
{
::itk::OStringStream filename;
geometry = input->GetGeometry(t);
if(input->GetTimeSlicedGeometry()->IsValidTime(t))
{
const mitk::TimeBounds& timebounds = geometry->GetTimeBounds();
filename << m_FileName.c_str() << "_S" << std::setprecision(0) << timebounds[0] << "_E" << std::setprecision(0) << timebounds[1] << "_T" << t << GetDefaultExtension();
}
else
{
itkWarningMacro(<<"Error on write: TimeSlicedGeometry invalid of unstructured grid " << filename << ".");
filename << m_FileName.c_str() << "_T" << t << GetDefaultExtension();
}
geometry->TransferItkToVtkTransform();
transformPointSet->SetInput(input->GetVtkUnstructuredGrid(t));
transformPointSet->SetTransform(geometry->GetVtkTransform());
transformPointSet->UpdateWholeExtent();
unstructuredGrid = static_cast<vtkUnstructuredGrid*>(transformPointSet->GetOutput());
unstructuredGridWriter->SetFileName(filename.str().c_str());
unstructuredGridWriter->SetInput(unstructuredGrid);
ExecuteWrite( unstructuredGridWriter );
}
}
else
{
geometry = input->GetGeometry();
geometry->TransferItkToVtkTransform();
transformPointSet->SetInput(input->GetVtkUnstructuredGrid());
transformPointSet->SetTransform(geometry->GetVtkTransform());
transformPointSet->UpdateWholeExtent();
unstructuredGrid = static_cast<vtkUnstructuredGrid*>(transformPointSet->GetOutput());
unstructuredGridWriter->SetFileName(m_FileName.c_str());
unstructuredGridWriter->SetInput(unstructuredGrid);
ExecuteWrite( unstructuredGridWriter );
}
transformPointSet->Delete();
unstructuredGridWriter->Delete();
m_Success = true;
}
template<class VTKWRITER>
void UnstructuredGridVtkWriter<VTKWRITER>::ExecuteWrite( VTKWRITER* vtkWriter )
{
struct stat fileStatus;
time_t timeBefore=0;
if (!stat(vtkWriter->GetFileName(), &fileStatus))
{
timeBefore = fileStatus.st_mtime;
}
if (!vtkWriter->Write())
{
itkExceptionMacro( << "Error during unstructured grid writing.");
}
// check if file can be written because vtkWriter doesn't check that
if (stat(vtkWriter->GetFileName(), &fileStatus) || (timeBefore == fileStatus.st_mtime))
{
itkExceptionMacro(<<"Error during unstructured grid writing: file could not be written");
}
}
template<class VTKWRITER>
void UnstructuredGridVtkWriter<VTKWRITER>::SetInput(UnstructuredGrid *input)
{
this->ProcessObject::SetNthInput(0, input);
}
template<class VTKWRITER>
const UnstructuredGrid* UnstructuredGridVtkWriter<VTKWRITER>::GetInput()
{
if (this->GetNumberOfInputs() < 1)
{
return 0;
}
else
{
return dynamic_cast<UnstructuredGrid*>(this->ProcessObject::GetInput(0));
}
}
template<class VTKWRITER>
-bool UnstructuredGridVtkWriter<VTKWRITER>::CanWriteDataType(BaseData::Pointer data)
+bool UnstructuredGridVtkWriter<VTKWRITER>::CanWriteBaseDataType(BaseData::Pointer data)
{
return (dynamic_cast<mitk::UnstructuredGrid*>(data.GetPointer()) != 0);
}
template<class VTKWRITER>
void UnstructuredGridVtkWriter<VTKWRITER>::DoWrite(BaseData::Pointer data)
{
- if (CanWriteDataType(data))
+ if (CanWriteBaseDataType(data))
{
this->SetInput(dynamic_cast<mitk::UnstructuredGrid*>(data.GetPointer()));
this->Update();
}
}
template<class VTKWRITER>
std::vector<std::string> UnstructuredGridVtkWriter<VTKWRITER>::GetPossibleFileExtensions()
{
throw std::exception(); // no specialization available!
}
template<class VTKWRITER>
const char* UnstructuredGridVtkWriter<VTKWRITER>::GetDefaultFilename()
{
throw std::exception(); // no specialization available!
}
template<class VTKWRITER>
const char* UnstructuredGridVtkWriter<VTKWRITER>::GetFileDialogPattern()
{
throw std::exception(); // no specialization available!
}
template<class VTKWRITER>
const char* UnstructuredGridVtkWriter<VTKWRITER>::GetDefaultExtension()
{
throw std::exception(); // no specialization available!
}
template<>
std::vector<std::string> UnstructuredGridVtkWriter<vtkUnstructuredGridWriter>::GetPossibleFileExtensions();
template<>
std::vector<std::string> UnstructuredGridVtkWriter<vtkXMLUnstructuredGridWriter>::GetPossibleFileExtensions();
template<>
std::vector<std::string> UnstructuredGridVtkWriter<vtkXMLPUnstructuredGridWriter>::GetPossibleFileExtensions();
template<>
const char * UnstructuredGridVtkWriter<vtkUnstructuredGridWriter>::GetDefaultFilename();
template<>
const char * UnstructuredGridVtkWriter<vtkXMLUnstructuredGridWriter>::GetDefaultFilename();
template<>
const char * UnstructuredGridVtkWriter<vtkXMLPUnstructuredGridWriter>::GetDefaultFilename();
template<>
const char * UnstructuredGridVtkWriter<vtkUnstructuredGridWriter>::GetFileDialogPattern();
template<>
const char * UnstructuredGridVtkWriter<vtkXMLUnstructuredGridWriter>::GetFileDialogPattern();
template<>
const char * UnstructuredGridVtkWriter<vtkXMLPUnstructuredGridWriter>::GetFileDialogPattern();
template<>
const char * UnstructuredGridVtkWriter<vtkUnstructuredGridWriter>::GetDefaultExtension();
template<>
const char * UnstructuredGridVtkWriter<vtkXMLUnstructuredGridWriter>::GetDefaultExtension();
template<>
const char * UnstructuredGridVtkWriter<vtkXMLPUnstructuredGridWriter>::GetDefaultExtension();
#ifndef __APPLE__
// On MacOS, we get duplicate symbol errors during linking of mitkCoreExt.
// It looks like the linker does not coalesce the two instantiations in
// mitkUnstructuredGridVtkWriter.cpp and mitkCoreExtObjectFactory.cpp
// (which both include this file)
template class MitkExt_EXPORT UnstructuredGridVtkWriter<vtkUnstructuredGridWriter>;
template class MitkExt_EXPORT UnstructuredGridVtkWriter<vtkXMLUnstructuredGridWriter>;
template class MitkExt_EXPORT UnstructuredGridVtkWriter<vtkXMLPUnstructuredGridWriter>;
#endif
}
#endif
diff --git a/Modules/MitkExt/Interactions/mitkAffineInteractor3D.cpp b/Modules/MitkExt/Interactions/mitkAffineInteractor3D.cpp
index 4dd92ff173..9b9dfaf8ad 100644
--- a/Modules/MitkExt/Interactions/mitkAffineInteractor3D.cpp
+++ b/Modules/MitkExt/Interactions/mitkAffineInteractor3D.cpp
@@ -1,490 +1,493 @@
/*=========================================================================
Program: Medical Imaging & Interaction Toolkit
Language: C++
Date: $Date: 2008-10-02 16:21:08 +0200 (Do, 02 Okt 2008) $
Version: $Revision: 13129 $
Copyright (c) German Cancer Research Center, Division of Medical and
Biological Informatics. All rights reserved.
See MITKCopyright.txt or http://www.mitk.org/copyright.html for details.
This software is distributed WITHOUT ANY WARRANTY; without even
the implied warranty of MERCHANTABILITY or FITNESS FOR A PARTICULAR
PURPOSE. See the above copyright notices for more information.
=========================================================================*/
#include "mitkAffineInteractor3D.h"
#include "mitkPointOperation.h"
#include "mitkPositionEvent.h"
#include "mitkStatusBar.h"
#include "mitkDataNode.h"
#include "mitkInteractionConst.h"
#include "mitkAction.h"
#include "mitkStateEvent.h"
#include "mitkOperationEvent.h"
#include "mitkUndoController.h"
#include "mitkStateMachineFactory.h"
#include "mitkStateTransitionOperation.h"
#include "mitkBaseRenderer.h"
#include "mitkRenderingManager.h"
#include "mitkRotationOperation.h"
#include <vtkRenderWindow.h>
#include <vtkRenderWindowInteractor.h>
#include <vtkInteractorStyle.h>
#include <vtkRenderer.h>
#include <vtkCamera.h>
#include <vtkPoints.h>
#include <vtkPointData.h>
#include <vtkDataArray.h>
namespace mitk
{
//how precise must the user pick the point
//default value
AffineInteractor3D
::AffineInteractor3D(const char * type, DataNode* dataNode, int /* n */ )
: Interactor( type, dataNode ),
m_Precision( 6.5 ),
m_InteractionMode( INTERACTION_MODE_TRANSLATION )
{
m_OriginalGeometry = Geometry3D::New();
// Initialize vector arithmetic
m_ObjectNormal[0] = 0.0;
m_ObjectNormal[1] = 0.0;
m_ObjectNormal[2] = 1.0;
}
AffineInteractor3D::~AffineInteractor3D()
{
}
void AffineInteractor3D::SetInteractionMode( unsigned int interactionMode )
{
m_InteractionMode = interactionMode;
}
void AffineInteractor3D::SetInteractionModeToTranslation()
{
m_InteractionMode = INTERACTION_MODE_TRANSLATION;
}
void AffineInteractor3D::SetInteractionModeToRotation()
{
m_InteractionMode = INTERACTION_MODE_ROTATION;
}
unsigned int AffineInteractor3D::GetInteractionMode() const
{
return m_InteractionMode;
}
void AffineInteractor3D::SetPrecision( ScalarType precision )
{
m_Precision = precision;
}
// Overwritten since this class can handle it better!
float AffineInteractor3D
::CanHandleEvent(StateEvent const* stateEvent) const
{
float returnValue = 0.5;
// If it is a key event that can be handled in the current state,
// then return 0.5
DisplayPositionEvent const *disPosEvent =
dynamic_cast <const DisplayPositionEvent *> (stateEvent->GetEvent());
// Key event handling:
if (disPosEvent == NULL)
{
// Check if the current state has a transition waiting for that key event.
if (this->GetCurrentState()->GetTransition(stateEvent->GetId())!=NULL)
{
return 0.5;
}
else
{
return 0.0;
}
}
//on MouseMove do nothing!
//if (stateEvent->GetEvent()->GetType() == Type_MouseMove)
//{
// return 0.0;
//}
//if the event can be understood and if there is a transition waiting for that event
if (this->GetCurrentState()->GetTransition(stateEvent->GetId())!=NULL)
{
returnValue = 0.5;//it can be understood
}
//int timeStep = disPosEvent->GetSender()->GetTimeStep();
//CurveModel *curveModel = dynamic_cast<CurveModel *>(
// m_DataNode->GetData() );
//if ( curveModel != NULL )
//{
// // Get the Geometry2D of the window the user interacts with (for 2D point
// // projection)
// BaseRenderer *renderer = stateEvent->GetEvent()->GetSender();
// const Geometry2D *projectionPlane = renderer->GetCurrentWorldGeometry2D();
// // For reading on the points, Ids etc
// //CurveModel::PointSetType *pointSet = curveModel->GetPointSet( timeStep );
// //if ( pointSet == NULL )
// //{
// // return 0.0;
// //}
//}
return returnValue;
}
bool AffineInteractor3D
::ExecuteAction( Action *action, StateEvent const *stateEvent )
{
bool ok = false;
// Get data object
BaseData *data = m_DataNode->GetData();
if ( data == NULL )
{
MITK_ERROR << "No data object present!";
return ok;
}
// Get Event and extract renderer
const Event *event = stateEvent->GetEvent();
BaseRenderer *renderer = NULL;
vtkRenderWindow *renderWindow = NULL;
vtkRenderWindowInteractor *renderWindowInteractor = NULL;
vtkRenderer *currentVtkRenderer = NULL;
vtkCamera *camera = NULL;
if ( event != NULL )
{
renderer = event->GetSender();
if ( renderer != NULL )
{
renderWindow = renderer->GetRenderWindow();
if ( renderWindow != NULL )
{
renderWindowInteractor = renderWindow->GetInteractor();
if ( renderWindowInteractor != NULL )
{
currentVtkRenderer = renderWindowInteractor
->GetInteractorStyle()->GetCurrentRenderer();
if ( currentVtkRenderer != NULL )
{
camera = currentVtkRenderer->GetActiveCamera();
}
}
}
}
}
// Check if we have a DisplayPositionEvent
const DisplayPositionEvent *dpe =
dynamic_cast< const DisplayPositionEvent * >( stateEvent->GetEvent() );
if ( dpe != NULL )
{
m_CurrentPickedPoint = dpe->GetWorldPosition();
m_CurrentPickedDisplayPoint = dpe->GetDisplayPosition();
}
// Get the timestep to also support 3D+t
int timeStep = 0;
ScalarType timeInMS = 0.0;
if ( renderer != NULL )
{
timeStep = renderer->GetTimeStep( data );
timeInMS = renderer->GetTime();
}
// If data is an mitk::Surface, extract it
Surface *surface = dynamic_cast< Surface * >( data );
vtkPolyData *polyData = NULL;
if ( surface != NULL )
{
polyData = surface->GetVtkPolyData( timeStep );
// Extract surface normal from surface (if existent, otherwise use default)
vtkPointData *pointData = polyData->GetPointData();
if ( pointData != NULL )
{
vtkDataArray *normal = polyData->GetPointData()->GetVectors( "planeNormal" );
if ( normal != NULL )
{
m_ObjectNormal[0] = normal->GetComponent( 0, 0 );
m_ObjectNormal[1] = normal->GetComponent( 0, 1 );
m_ObjectNormal[2] = normal->GetComponent( 0, 2 );
}
}
}
// Get geometry object
m_Geometry = data->GetGeometry( timeStep );
// Make sure that the data (if time-resolved) has enough entries;
// if not, create the required extra ones (empty)
data->Expand( timeStep+1 );
switch (action->GetActionId())
{
case AcDONOTHING:
ok = true;
break;
case AcCHECKOBJECT:
{
// Re-enable VTK interactor (may have been disabled previously)
if ( renderWindowInteractor != NULL )
{
renderWindowInteractor->Enable();
}
// Check if we have a DisplayPositionEvent
const DisplayPositionEvent *dpe =
dynamic_cast< const DisplayPositionEvent * >( stateEvent->GetEvent() );
if ( dpe == NULL )
{
ok = true;
break;
}
// Check if an object is present at the current mouse position
DataNode *pickedNode = dpe->GetPickedObjectNode();
StateEvent *newStateEvent;
if ( pickedNode == m_DataNode )
{
// Yes: object will be selected
newStateEvent = new StateEvent( EIDYES );
}
else
{
// No: back to start state
newStateEvent = new StateEvent( EIDNO );
}
this->HandleEvent( newStateEvent );
ok = true;
break;
}
case AcDESELECTOBJECT:
{
// Color object white
m_DataNode->SetColor( 1.0, 1.0, 1.0 );
RenderingManager::GetInstance()->RequestUpdateAll();
// Colorize surface / wireframe as inactive
this->ColorizeSurface( polyData,
m_CurrentPickedPoint, -1.0 );
ok = true;
break;
}
case AcSELECTPICKEDOBJECT:
{
// Color object red
m_DataNode->SetColor( 1.0, 0.0, 0.0 );
RenderingManager::GetInstance()->RequestUpdateAll();
// Colorize surface / wireframe dependend on distance from picked point
this->ColorizeSurface( polyData,
m_CurrentPickedPoint, 0.0 );
ok = true;
break;
}
case AcINITMOVE:
{
// Disable VTK interactor until MITK interaction has been completed
if ( renderWindowInteractor != NULL )
{
renderWindowInteractor->Disable();
}
// Check if we have a DisplayPositionEvent
const DisplayPositionEvent *dpe =
dynamic_cast< const DisplayPositionEvent * >( stateEvent->GetEvent() );
if ( dpe == NULL )
{
ok = true;
break;
}
//DataNode *pickedNode = dpe->GetPickedObjectNode();
m_InitialPickedPoint = m_CurrentPickedPoint;
m_InitialPickedDisplayPoint = m_CurrentPickedDisplayPoint;
if ( currentVtkRenderer != NULL )
{
vtkInteractorObserver::ComputeDisplayToWorld(
currentVtkRenderer,
m_InitialPickedDisplayPoint[0],
m_InitialPickedDisplayPoint[1],
0.0, //m_InitialInteractionPickedPoint[2],
m_InitialPickedPointWorld );
}
// Make deep copy of current Geometry3D of the plane
data->UpdateOutputInformation(); // make sure that the Geometry is up-to-date
m_OriginalGeometry = static_cast< Geometry3D * >(
data->GetGeometry( timeStep )->Clone().GetPointer() );
ok = true;
break;
}
case AcMOVE:
{
// Check if we have a DisplayPositionEvent
const DisplayPositionEvent *dpe =
dynamic_cast< const DisplayPositionEvent * >( stateEvent->GetEvent() );
if ( dpe == NULL )
{
ok = true;
break;
}
if ( currentVtkRenderer != NULL )
{
vtkInteractorObserver::ComputeDisplayToWorld(
currentVtkRenderer,
m_CurrentPickedDisplayPoint[0],
m_CurrentPickedDisplayPoint[1],
0.0, //m_InitialInteractionPickedPoint[2],
m_CurrentPickedPointWorld );
}
Vector3D interactionMove;
interactionMove[0] = m_CurrentPickedPointWorld[0] - m_InitialPickedPointWorld[0];
interactionMove[1] = m_CurrentPickedPointWorld[1] - m_InitialPickedPointWorld[1];
interactionMove[2] = m_CurrentPickedPointWorld[2] - m_InitialPickedPointWorld[2];
if ( m_InteractionMode == INTERACTION_MODE_TRANSLATION )
{
Point3D origin = m_OriginalGeometry->GetOrigin();
Vector3D transformedObjectNormal;
data->GetGeometry( timeStep )->IndexToWorld(
m_ObjectNormal, transformedObjectNormal );
data->GetGeometry( timeStep )->SetOrigin(
origin + transformedObjectNormal * (interactionMove * transformedObjectNormal) );
}
else if ( m_InteractionMode == INTERACTION_MODE_ROTATION )
{
if ( camera )
{
vtkFloatingPointType vpn[3];
camera->GetViewPlaneNormal( vpn );
Vector3D viewPlaneNormal;
viewPlaneNormal[0] = vpn[0];
viewPlaneNormal[1] = vpn[1];
viewPlaneNormal[2] = vpn[2];
Vector3D rotationAxis =
itk::CrossProduct( viewPlaneNormal, interactionMove );
rotationAxis.Normalize();
int *size = currentVtkRenderer->GetSize();
double l2 =
(m_CurrentPickedDisplayPoint[0] - m_InitialPickedDisplayPoint[0]) *
(m_CurrentPickedDisplayPoint[0] - m_InitialPickedDisplayPoint[0]) +
(m_CurrentPickedDisplayPoint[1] - m_InitialPickedDisplayPoint[1]) *
(m_CurrentPickedDisplayPoint[1] - m_InitialPickedDisplayPoint[1]);
double rotationAngle = 360.0 * sqrt(l2/(size[0]*size[0]+size[1]*size[1]));
// Use center of data bounding box as center of rotation
Point3D rotationCenter = m_OriginalGeometry->GetCenter();;
// Reset current Geometry3D to original state (pre-interaction) and
// apply rotation
RotationOperation op( OpROTATE, rotationCenter, rotationAxis, rotationAngle );
Geometry3D::Pointer newGeometry = static_cast< Geometry3D * >(
m_OriginalGeometry->Clone().GetPointer() );
newGeometry->ExecuteOperation( &op );
- data->SetGeometry( newGeometry, timeStep );
-
+ mitk::TimeSlicedGeometry::Pointer timeSlicedGeometry = data->GetTimeSlicedGeometry();
+ if (timeSlicedGeometry.IsNotNull())
+ {
+ timeSlicedGeometry->SetGeometry3D( newGeometry, timeStep );
+ }
}
}
RenderingManager::GetInstance()->RequestUpdateAll();
ok = true;
break;
}
default:
return Superclass::ExecuteAction( action, stateEvent );
}
return ok;
}
bool AffineInteractor3D::ColorizeSurface( vtkPolyData *polyData,
const Point3D & /*pickedPoint*/, double scalar )
{
if ( polyData == NULL )
{
return false;
}
//vtkPoints *points = polyData->GetPoints();
vtkPointData *pointData = polyData->GetPointData();
if ( pointData == NULL )
{
return false;
}
vtkDataArray *scalars = pointData->GetScalars();
if ( scalars == NULL )
{
return false;
}
for ( unsigned int i = 0; i < pointData->GetNumberOfTuples(); ++i )
{
scalars->SetComponent( i, 0, scalar );
}
polyData->Modified();
pointData->Update();
return true;
}
} // namespace
diff --git a/Modules/MitkExt/Interactions/mitkBinaryThresholdTool.cpp b/Modules/MitkExt/Interactions/mitkBinaryThresholdTool.cpp
index 0721b4fe08..415e038983 100644
--- a/Modules/MitkExt/Interactions/mitkBinaryThresholdTool.cpp
+++ b/Modules/MitkExt/Interactions/mitkBinaryThresholdTool.cpp
@@ -1,311 +1,312 @@
/*=========================================================================
Program: Medical Imaging & Interaction Toolkit
Language: C++
Date: $Date$
Version: $Revision: 1.12 $
Copyright (c) German Cancer Research Center, Division of Medical and
Biological Informatics. All rights reserved.
See MITKCopyright.txt or http://www.mitk.org/copyright.html for details.
This software is distributed WITHOUT ANY WARRANTY; without even
the implied warranty of MERCHANTABILITY or FITNESS FOR A PARTICULAR
PURPOSE. See the above copyright notices for more information.
=========================================================================*/
#include "mitkBinaryThresholdTool.h"
#include "mitkBinaryThresholdTool.xpm"
#include "mitkToolManager.h"
#include "mitkBoundingObjectToSegmentationFilter.h"
#include <mitkCoreObjectFactory.h>
#include "mitkLevelWindowProperty.h"
#include "mitkColorProperty.h"
#include "mitkProperties.h"
#include "mitkOrganTypeProperty.h"
#include "mitkVtkResliceInterpolationProperty.h"
#include "mitkDataStorage.h"
#include "mitkRenderingManager.h"
#include "mitkImageCast.h"
+#include "mitkImageAccessByItk.h"
#include "mitkImageTimeSelector.h"
#include <itkImageRegionIterator.h>
#include <itkBinaryThresholdImageFilter.h>
#include "mitkPadImageFilter.h"
#include "mitkMaskAndCutRoiImageFilter.h"
namespace mitk {
MITK_TOOL_MACRO(MitkExt_EXPORT, BinaryThresholdTool, "Thresholding tool");
}
mitk::BinaryThresholdTool::BinaryThresholdTool()
:m_SensibleMinimumThresholdValue(-100),
m_SensibleMaximumThresholdValue(+100),
m_CurrentThresholdValue(1)
{
this->SupportRoiOn();
m_ThresholdFeedbackNode = DataNode::New();
mitk::CoreObjectFactory::GetInstance()->SetDefaultProperties( m_ThresholdFeedbackNode );
m_ThresholdFeedbackNode->SetProperty( "color", ColorProperty::New(1.0, 0.0, 0.0) );
m_ThresholdFeedbackNode->SetProperty( "texture interpolation", BoolProperty::New(false) );
m_ThresholdFeedbackNode->SetProperty( "layer", IntProperty::New( 100 ) );
m_ThresholdFeedbackNode->SetProperty( "levelwindow", LevelWindowProperty::New( LevelWindow(100, 1) ) );
m_ThresholdFeedbackNode->SetProperty( "name", StringProperty::New("Thresholding feedback") );
m_ThresholdFeedbackNode->SetProperty( "opacity", FloatProperty::New(0.3) );
m_ThresholdFeedbackNode->SetProperty( "helper object", BoolProperty::New(true) );
}
mitk::BinaryThresholdTool::~BinaryThresholdTool()
{
}
const char** mitk::BinaryThresholdTool::GetXPM() const
{
return mitkBinaryThresholdTool_xpm;
}
const char* mitk::BinaryThresholdTool::GetName() const
{
return "Thresholding";
}
void mitk::BinaryThresholdTool::Activated()
{
m_ToolManager->RoiDataChanged += mitk::MessageDelegate<mitk::BinaryThresholdTool>(this, &mitk::BinaryThresholdTool::OnRoiDataChanged);
m_OriginalImageNode = m_ToolManager->GetReferenceData(0);
m_NodeForThresholding = m_OriginalImageNode;
if ( m_NodeForThresholding.IsNotNull() )
{
SetupPreviewNodeFor( m_NodeForThresholding );
}
else
{
m_ToolManager->ActivateTool(-1);
}
}
void mitk::BinaryThresholdTool::Deactivated()
{
m_ToolManager->RoiDataChanged -= mitk::MessageDelegate<mitk::BinaryThresholdTool>(this, &mitk::BinaryThresholdTool::OnRoiDataChanged);
m_NodeForThresholding = NULL;
m_OriginalImageNode = NULL;
try
{
if (DataStorage* storage = m_ToolManager->GetDataStorage())
{
storage->Remove( m_ThresholdFeedbackNode );
RenderingManager::GetInstance()->RequestUpdateAll();
}
}
catch(...)
{
// don't care
}
m_ThresholdFeedbackNode->SetData(NULL);
}
void mitk::BinaryThresholdTool::SetThresholdValue(int value)
{
if (m_ThresholdFeedbackNode.IsNotNull())
{
m_CurrentThresholdValue = value;
m_ThresholdFeedbackNode->SetProperty( "levelwindow", LevelWindowProperty::New( LevelWindow(m_CurrentThresholdValue, 1) ) );
RenderingManager::GetInstance()->RequestUpdateAll();
}
}
void mitk::BinaryThresholdTool::AcceptCurrentThresholdValue(const std::string& organName, const Color& color)
{
CreateNewSegmentationFromThreshold(m_NodeForThresholding, organName, color );
RenderingManager::GetInstance()->RequestUpdateAll();
m_ToolManager->ActivateTool(-1);
}
void mitk::BinaryThresholdTool::CancelThresholding()
{
m_ToolManager->ActivateTool(-1);
}
void mitk::BinaryThresholdTool::SetupPreviewNodeFor( DataNode* nodeForThresholding )
{
if (nodeForThresholding)
{
Image::Pointer image = dynamic_cast<Image*>( nodeForThresholding->GetData() );
Image::Pointer originalImage = dynamic_cast<Image*> (m_OriginalImageNode->GetData());
if (image.IsNotNull())
{
// initialize and a new node with the same image as our reference image
// use the level window property of this image copy to display the result of a thresholding operation
m_ThresholdFeedbackNode->SetData( image );
int layer(50);
nodeForThresholding->GetIntProperty("layer", layer);
m_ThresholdFeedbackNode->SetIntProperty("layer", layer+1);
if (DataStorage* storage = m_ToolManager->GetDataStorage())
{
if (storage->Exists(m_ThresholdFeedbackNode))
storage->Remove(m_ThresholdFeedbackNode);
storage->Add( m_ThresholdFeedbackNode, m_OriginalImageNode );
}
if (image.GetPointer() == originalImage.GetPointer())
{
m_SensibleMinimumThresholdValue = static_cast<int>( originalImage->GetScalarValueMin() );
m_SensibleMaximumThresholdValue = static_cast<int>( originalImage->GetScalarValueMax() );
}
LevelWindowProperty::Pointer lwp = dynamic_cast<LevelWindowProperty*>( m_ThresholdFeedbackNode->GetProperty( "levelwindow" ));
if (lwp)
{
m_CurrentThresholdValue = static_cast<int>( lwp->GetLevelWindow().GetLevel() );
}
else
{
m_CurrentThresholdValue = (m_SensibleMaximumThresholdValue + m_SensibleMinimumThresholdValue)/2;
}
IntervalBordersChanged.Send(m_SensibleMinimumThresholdValue, m_SensibleMaximumThresholdValue);
ThresholdingValueChanged.Send(m_CurrentThresholdValue);
}
}
}
void mitk::BinaryThresholdTool::CreateNewSegmentationFromThreshold(DataNode* node, const std::string& organName, const Color& color)
{
if (node)
{
Image::Pointer image = dynamic_cast<Image*>( m_NodeForThresholding->GetData() );
if (image.IsNotNull())
{
// create a new image of the same dimensions and smallest possible pixel type
DataNode::Pointer emptySegmentation = Tool::CreateEmptySegmentationNode( image, organName, color );
if (emptySegmentation)
{
// actually perform a thresholding and ask for an organ type
for (unsigned int timeStep = 0; timeStep < image->GetTimeSteps(); ++timeStep)
{
try
{
ImageTimeSelector::Pointer timeSelector = ImageTimeSelector::New();
timeSelector->SetInput( image );
timeSelector->SetTimeNr( timeStep );
timeSelector->UpdateLargestPossibleRegion();
Image::Pointer image3D = timeSelector->GetOutput();
AccessFixedDimensionByItk_2( image3D, ITKThresholding, 3, dynamic_cast<Image*>(emptySegmentation->GetData()), timeStep );
}
catch(...)
{
Tool::ErrorMessage("Error accessing single time steps of the original image. Cannot create segmentation.");
}
}
if (m_OriginalImageNode.GetPointer() != m_NodeForThresholding.GetPointer())
{
mitk::PadImageFilter::Pointer padFilter = mitk::PadImageFilter::New();
padFilter->SetInput(0, dynamic_cast<mitk::Image*> (emptySegmentation->GetData()));
padFilter->SetInput(1, dynamic_cast<mitk::Image*> (m_OriginalImageNode->GetData()));
padFilter->SetBinaryFilter(true);
padFilter->SetUpperThreshold(1);
padFilter->SetLowerThreshold(1);
padFilter->Update();
emptySegmentation->SetData(padFilter->GetOutput());
}
if (DataStorage::Pointer storage = m_ToolManager->GetDataStorage())
{
storage->Add( emptySegmentation, m_OriginalImageNode ); // add as a child, because the segmentation "derives" from the original
}
m_ToolManager->SetWorkingData( emptySegmentation );
}
}
}
}
template <typename TPixel, unsigned int VImageDimension>
void mitk::BinaryThresholdTool::ITKThresholding( itk::Image<TPixel, VImageDimension>* originalImage, Image* segmentation, unsigned int timeStep )
{
ImageTimeSelector::Pointer timeSelector = ImageTimeSelector::New();
timeSelector->SetInput( segmentation );
timeSelector->SetTimeNr( timeStep );
timeSelector->UpdateLargestPossibleRegion();
Image::Pointer segmentation3D = timeSelector->GetOutput();
typedef itk::Image< Tool::DefaultSegmentationDataType, 3> SegmentationType; // this is sure for new segmentations
SegmentationType::Pointer itkSegmentation;
CastToItkImage( segmentation3D, itkSegmentation );
// iterate over original and segmentation
typedef itk::ImageRegionConstIterator< itk::Image<TPixel, VImageDimension> > InputIteratorType;
typedef itk::ImageRegionIterator< SegmentationType > SegmentationIteratorType;
InputIteratorType inputIterator( originalImage, originalImage->GetLargestPossibleRegion() );
SegmentationIteratorType outputIterator( itkSegmentation, itkSegmentation->GetLargestPossibleRegion() );
inputIterator.GoToBegin();
outputIterator.GoToBegin();
while (!outputIterator.IsAtEnd())
{
if ( (signed)inputIterator.Get() >= m_CurrentThresholdValue )
{
outputIterator.Set( 1 );
}
else
{
outputIterator.Set( 0 );
}
++inputIterator;
++outputIterator;
}
}
void mitk::BinaryThresholdTool::OnRoiDataChanged()
{
mitk::DataNode::Pointer node = m_ToolManager->GetRoiData(0);
if (node.IsNotNull())
{
mitk::Image::Pointer image = dynamic_cast<mitk::Image*> (m_NodeForThresholding->GetData());
if (image.IsNull())
return;
mitk::MaskAndCutRoiImageFilter::Pointer roiFilter = mitk::MaskAndCutRoiImageFilter::New();
roiFilter->SetInput(image);
roiFilter->SetRegionOfInterest(node->GetData());
roiFilter->Update();
mitk::DataNode::Pointer tmpNode = mitk::DataNode::New();
mitk::Image::Pointer tmpImage = roiFilter->GetOutput();
tmpNode->SetData(tmpImage);
m_SensibleMaximumThresholdValue = static_cast<int> (roiFilter->GetMaxValue());
m_SensibleMinimumThresholdValue = static_cast<int> (roiFilter->GetMinValue());
SetupPreviewNodeFor( tmpNode );
m_NodeForThresholding = tmpNode;
return;
}
else
{
this->SetupPreviewNodeFor(m_OriginalImageNode);
m_NodeForThresholding = m_OriginalImageNode;
return;
}
}
diff --git a/Modules/MitkExt/Interactions/mitkBinaryThresholdULTool.cpp b/Modules/MitkExt/Interactions/mitkBinaryThresholdULTool.cpp
index 24031b11a0..14c785035f 100644
--- a/Modules/MitkExt/Interactions/mitkBinaryThresholdULTool.cpp
+++ b/Modules/MitkExt/Interactions/mitkBinaryThresholdULTool.cpp
@@ -1,319 +1,320 @@
/*=========================================================================
Program: Medical Imaging & Interaction Toolkit
Language: C++
Date: $Date$
Version: $Revision: 1.0 $
Copyright (c) German Cancer Research Center, Division of Medical and
Biological Informatics. All rights reserved.
See MITKCopyright.txt or http://www.mitk.org/copyright.html for details.
This software is distributed WITHOUT ANY WARRANTY; without even
the implied warranty of MERCHANTABILITY or FITNESS FOR A PARTICULAR
PURPOSE. See the above copyright notices for more information.
=========================================================================*/
#include "mitkBinaryThresholdULTool.h"
#include "mitkBinaryThresholdULTool.xpm"
#include "mitkToolManager.h"
#include "mitkLevelWindowProperty.h"
#include "mitkColorProperty.h"
#include "mitkProperties.h"
#include "mitkDataStorage.h"
#include "mitkRenderingManager.h"
#include "mitkImageCast.h"
+#include "mitkImageAccessByItk.h"
#include "mitkImageTimeSelector.h"
#include <itkImageRegionIterator.h>
#include <itkBinaryThresholdImageFilter.h>
#include "mitkMaskAndCutRoiImageFilter.h"
#include "mitkPadImageFilter.h"
namespace mitk {
MITK_TOOL_MACRO(MitkExt_EXPORT, BinaryThresholdULTool, "ThresholdingUL tool");
}
mitk::BinaryThresholdULTool::BinaryThresholdULTool()
:m_SensibleMinimumThresholdValue(-100),
m_SensibleMaximumThresholdValue(+100),
m_CurrentLowerThresholdValue(1),
m_CurrentUpperThresholdValue(1)
{
this->SupportRoiOn();
m_ThresholdFeedbackNode = DataNode::New();
m_ThresholdFeedbackNode->SetProperty( "color", ColorProperty::New(1.0, 0.0, 0.0) );
m_ThresholdFeedbackNode->SetProperty( "name", StringProperty::New("Thresholding feedback") );
m_ThresholdFeedbackNode->SetProperty( "opacity", FloatProperty::New(0.3) );
m_ThresholdFeedbackNode->SetProperty("binary", BoolProperty::New(true));
m_ThresholdFeedbackNode->SetProperty( "helper object", BoolProperty::New(true) );
}
mitk::BinaryThresholdULTool::~BinaryThresholdULTool()
{
}
const char** mitk::BinaryThresholdULTool::GetXPM() const
{
return mitkBinaryThresholdULTool_xpm;
}
const char* mitk::BinaryThresholdULTool::GetName() const
{
return "ThresholdingUL";
}
void mitk::BinaryThresholdULTool::Activated()
{
m_ToolManager->RoiDataChanged += mitk::MessageDelegate<mitk::BinaryThresholdULTool>(this, &mitk::BinaryThresholdULTool::OnRoiDataChanged);
m_OriginalImageNode = m_ToolManager->GetReferenceData(0);
m_NodeForThresholding = m_OriginalImageNode;
if ( m_NodeForThresholding.IsNotNull() )
{
SetupPreviewNode();
}
else
{
m_ToolManager->ActivateTool(-1);
}
}
void mitk::BinaryThresholdULTool::Deactivated()
{
m_ToolManager->RoiDataChanged -= mitk::MessageDelegate<mitk::BinaryThresholdULTool>(this, &mitk::BinaryThresholdULTool::OnRoiDataChanged);
m_NodeForThresholding = NULL;
m_OriginalImageNode = NULL;
try
{
if (DataStorage* storage = m_ToolManager->GetDataStorage())
{
storage->Remove( m_ThresholdFeedbackNode );
RenderingManager::GetInstance()->RequestUpdateAll();
}
}
catch(...)
{
// don't care
}
m_ThresholdFeedbackNode->SetData(NULL);
}
void mitk::BinaryThresholdULTool::SetThresholdValues(int lower, int upper)
{
if (m_ThresholdFeedbackNode.IsNotNull())
{
m_CurrentLowerThresholdValue = lower;
m_CurrentUpperThresholdValue = upper;
UpdatePreview();
}
}
void mitk::BinaryThresholdULTool::AcceptCurrentThresholdValue(const std::string& organName, const Color& color)
{
CreateNewSegmentationFromThreshold(m_NodeForThresholding, organName, color );
RenderingManager::GetInstance()->RequestUpdateAll();
m_ToolManager->ActivateTool(-1);
}
void mitk::BinaryThresholdULTool::CancelThresholding()
{
m_ToolManager->ActivateTool(-1);
}
void mitk::BinaryThresholdULTool::SetupPreviewNode()
{
if (m_NodeForThresholding.IsNotNull())
{
Image::Pointer image = dynamic_cast<Image*>( m_NodeForThresholding->GetData() );
Image::Pointer originalImage = dynamic_cast<Image*> (m_OriginalImageNode->GetData());
if (image.IsNotNull())
{
// initialize and a new node with the same image as our reference image
// use the level window property of this image copy to display the result of a thresholding operation
m_ThresholdFeedbackNode->SetData( image );
int layer(50);
m_NodeForThresholding->GetIntProperty("layer", layer);
m_ThresholdFeedbackNode->SetIntProperty("layer", layer+1);
if (DataStorage* ds = m_ToolManager->GetDataStorage())
{
if (!ds->Exists(m_ThresholdFeedbackNode))
ds->Add( m_ThresholdFeedbackNode, m_OriginalImageNode );
}
if (image.GetPointer() == originalImage.GetPointer())
{
m_SensibleMinimumThresholdValue = static_cast<int>( originalImage->GetScalarValueMin() );
m_SensibleMaximumThresholdValue = static_cast<int>( originalImage->GetScalarValueMax() );
}
m_CurrentLowerThresholdValue = (m_SensibleMaximumThresholdValue + m_SensibleMinimumThresholdValue) / 3;
m_CurrentUpperThresholdValue = 2*m_CurrentLowerThresholdValue;
IntervalBordersChanged.Send(m_SensibleMinimumThresholdValue, m_SensibleMaximumThresholdValue);
ThresholdingValuesChanged.Send(m_CurrentLowerThresholdValue, m_CurrentUpperThresholdValue);
}
}
}
void mitk::BinaryThresholdULTool::CreateNewSegmentationFromThreshold(DataNode* node, const std::string& organName, const Color& color)
{
if (node)
{
Image::Pointer image = dynamic_cast<Image*>( m_NodeForThresholding->GetData() );
if (image.IsNotNull())
{
// create a new image of the same dimensions and smallest possible pixel type
DataNode::Pointer emptySegmentation = Tool::CreateEmptySegmentationNode( image, organName, color );
if (emptySegmentation)
{
// actually perform a thresholding and ask for an organ type
for (unsigned int timeStep = 0; timeStep < image->GetTimeSteps(); ++timeStep)
{
try
{
ImageTimeSelector::Pointer timeSelector = ImageTimeSelector::New();
timeSelector->SetInput( image );
timeSelector->SetTimeNr( timeStep );
timeSelector->UpdateLargestPossibleRegion();
Image::Pointer image3D = timeSelector->GetOutput();
AccessFixedDimensionByItk_2( image3D, ITKThresholding, 3, dynamic_cast<Image*>(emptySegmentation->GetData()), timeStep );
}
catch(...)
{
Tool::ErrorMessage("Error accessing single time steps of the original image. Cannot create segmentation.");
}
}
//since we are maybe working on a smaller image, pad it to the size of the original image
if (m_OriginalImageNode.GetPointer() != m_NodeForThresholding.GetPointer())
{
mitk::PadImageFilter::Pointer padFilter = mitk::PadImageFilter::New();
padFilter->SetInput(0, dynamic_cast<mitk::Image*> (emptySegmentation->GetData()));
padFilter->SetInput(1, dynamic_cast<mitk::Image*> (m_OriginalImageNode->GetData()));
padFilter->SetBinaryFilter(true);
padFilter->SetUpperThreshold(1);
padFilter->SetLowerThreshold(1);
padFilter->Update();
emptySegmentation->SetData(padFilter->GetOutput());
}
if (DataStorage* ds = m_ToolManager->GetDataStorage())
{
ds->Add( emptySegmentation, m_OriginalImageNode );
}
m_ToolManager->SetWorkingData( emptySegmentation );
}
}
}
}
template <typename TPixel, unsigned int VImageDimension>
void mitk::BinaryThresholdULTool::ITKThresholding( itk::Image<TPixel, VImageDimension>* originalImage, Image* segmentation, unsigned int timeStep )
{
ImageTimeSelector::Pointer timeSelector = ImageTimeSelector::New();
timeSelector->SetInput( segmentation );
timeSelector->SetTimeNr( timeStep );
timeSelector->UpdateLargestPossibleRegion();
Image::Pointer segmentation3D = timeSelector->GetOutput();
typedef itk::Image< Tool::DefaultSegmentationDataType, 3> SegmentationType; // this is sure for new segmentations
SegmentationType::Pointer itkSegmentation;
CastToItkImage( segmentation3D, itkSegmentation );
// iterate over original and segmentation
typedef itk::ImageRegionConstIterator< itk::Image<TPixel, VImageDimension> > InputIteratorType;
typedef itk::ImageRegionIterator< SegmentationType > SegmentationIteratorType;
InputIteratorType inputIterator( originalImage, originalImage->GetLargestPossibleRegion() );
SegmentationIteratorType outputIterator( itkSegmentation, itkSegmentation->GetLargestPossibleRegion() );
inputIterator.GoToBegin();
outputIterator.GoToBegin();
while (!outputIterator.IsAtEnd())
{
if ( (signed)inputIterator.Get() >= m_CurrentLowerThresholdValue && (signed)inputIterator.Get() <= m_CurrentUpperThresholdValue )
{
outputIterator.Set( 1 );
}
else
{
outputIterator.Set( 0 );
}
++inputIterator;
++outputIterator;
}
}
void mitk::BinaryThresholdULTool::OnRoiDataChanged()
{
mitk::DataNode::Pointer node = m_ToolManager->GetRoiData(0);
if (node.IsNotNull())
{
mitk::MaskAndCutRoiImageFilter::Pointer roiFilter = mitk::MaskAndCutRoiImageFilter::New();
mitk::Image::Pointer image = dynamic_cast<mitk::Image*> (m_NodeForThresholding->GetData());
if (image.IsNull())
return;
roiFilter->SetInput(image);
roiFilter->SetRegionOfInterest(node->GetData());
roiFilter->Update();
mitk::DataNode::Pointer tmpNode = mitk::DataNode::New();
tmpNode->SetData(roiFilter->GetOutput());
m_SensibleMinimumThresholdValue = static_cast<int>( roiFilter->GetMinValue());
m_SensibleMaximumThresholdValue = static_cast<int>( roiFilter->GetMaxValue());
m_NodeForThresholding = tmpNode;
}
else
m_NodeForThresholding = m_OriginalImageNode;
this->SetupPreviewNode();
this->UpdatePreview();
}
void mitk::BinaryThresholdULTool::UpdatePreview()
{
typedef itk::Image<int, 3> ImageType;
typedef itk::Image<unsigned char, 3> SegmentationType;
typedef itk::BinaryThresholdImageFilter<ImageType, SegmentationType> ThresholdFilterType;
mitk::Image::Pointer thresholdimage = dynamic_cast<mitk::Image*> (m_NodeForThresholding->GetData());
if(thresholdimage)
{
ImageType::Pointer itkImage = ImageType::New();
CastToItkImage(thresholdimage, itkImage);
ThresholdFilterType::Pointer filter = ThresholdFilterType::New();
filter->SetInput(itkImage);
filter->SetLowerThreshold(m_CurrentLowerThresholdValue);
filter->SetUpperThreshold(m_CurrentUpperThresholdValue);
filter->SetInsideValue(1);
filter->SetOutsideValue(0);
filter->Update();
mitk::Image::Pointer new_image = mitk::Image::New();
CastToMitkImage(filter->GetOutput(), new_image);
m_ThresholdFeedbackNode->SetData(new_image);
}
RenderingManager::GetInstance()->RequestUpdateAll();
}
diff --git a/Modules/MitkExt/Interactions/mitkCalculateGrayValueStatisticsTool.cpp b/Modules/MitkExt/Interactions/mitkCalculateGrayValueStatisticsTool.cpp
index 1df9e39241..0f5d664ecc 100644
--- a/Modules/MitkExt/Interactions/mitkCalculateGrayValueStatisticsTool.cpp
+++ b/Modules/MitkExt/Interactions/mitkCalculateGrayValueStatisticsTool.cpp
@@ -1,340 +1,341 @@
/*=========================================================================
Program: Medical Imaging & Interaction Toolkit
Language: C++
Date: $Date$
Version: $Revision: 1.12 $
Copyright (c) German Cancer Research Center, Division of Medical and
Biological Informatics. All rights reserved.
See MITKCopyright.txt or http://www.mitk.org/copyright.html for details.
This software is distributed WITHOUT ANY WARRANTY; without even
the implied warranty of MERCHANTABILITY or FITNESS FOR A PARTICULAR
PURPOSE. See the above copyright notices for more information.
=========================================================================*/
#include "mitkCalculateGrayValueStatisticsTool.h"
#include "mitkCalculateGrayValueStatisticsTool.xpm"
+#include "mitkImageAccessByItk.h"
#include "mitkProgressBar.h"
#include "mitkStatusBar.h"
#include "mitkImageTimeSelector.h"
#include "mitkImageCast.h"
#include "mitkToolManager.h"
#include <itkCommand.h>
#include <itkHistogram.h>
namespace mitk {
MITK_TOOL_MACRO(MitkExt_EXPORT, CalculateGrayValueStatisticsTool, "Statistics tool");
}
mitk::CalculateGrayValueStatisticsTool::CalculateGrayValueStatisticsTool()
{
}
mitk::CalculateGrayValueStatisticsTool::~CalculateGrayValueStatisticsTool()
{
}
const char** mitk::CalculateGrayValueStatisticsTool::GetXPM() const
{
return mitkCalculateGrayValueStatisticsTool_xpm;
}
const char* mitk::CalculateGrayValueStatisticsTool::GetName() const
{
return "Statistics";
}
std::string mitk::CalculateGrayValueStatisticsTool::GetErrorMessage()
{
return "No statistics generated for these segmentations:";
}
void mitk::CalculateGrayValueStatisticsTool::StartProcessingAllData()
{
// clear/prepare report
m_CompleteReport.str("");
}
bool mitk::CalculateGrayValueStatisticsTool::ProcessOneWorkingData( DataNode* node )
{
if (node)
{
Image::Pointer image = dynamic_cast<Image*>( node->GetData() );
if (image.IsNull()) return false;
DataNode* referencenode = m_ToolManager->GetReferenceData(0);
if (!referencenode) return false;
try
{
ProgressBar::GetInstance()->AddStepsToDo(1);
// add to report
std::string nodename("structure");
node->GetName(nodename);
std::string message = "Calculating statistics for ";
message += nodename;
StatusBar::GetInstance()->DisplayText(message.c_str());
Image::Pointer refImage = dynamic_cast<Image*>( referencenode->GetData() );
Image::Pointer image = dynamic_cast<Image*>( node->GetData() );
m_CompleteReport << "======== Gray value analysis of " << nodename << " ========\n";
if (image.IsNotNull() && refImage.IsNotNull() )
{
for (unsigned int timeStep = 0; timeStep < image->GetTimeSteps(); ++timeStep)
{
ImageTimeSelector::Pointer timeSelector = ImageTimeSelector::New();
timeSelector->SetInput( refImage );
timeSelector->SetTimeNr( timeStep );
timeSelector->UpdateLargestPossibleRegion();
Image::Pointer refImage3D = timeSelector->GetOutput();
ImageTimeSelector::Pointer timeSelector2 = ImageTimeSelector::New();
timeSelector2->SetInput( image );
timeSelector2->SetTimeNr( timeStep );
timeSelector2->UpdateLargestPossibleRegion();
Image::Pointer image3D = timeSelector2->GetOutput();
if (image3D.IsNotNull() && refImage3D.IsNotNull() )
{
m_CompleteReport << "=== " << nodename << ", time step " << timeStep << " ===\n";
AccessFixedDimensionByItk_2( refImage3D, ITKHistogramming, 3, image3D, m_CompleteReport );
}
}
}
m_CompleteReport << "======== End of analysis for " << nodename << " ===========\n\n\n";
ProgressBar::GetInstance()->Progress();
}
catch(...)
{
return false;
}
}
return true;
}
void mitk::CalculateGrayValueStatisticsTool::FinishProcessingAllData()
{
SegmentationsProcessingTool::FinishProcessingAllData();
// show/send results
StatisticsCompleted.Send();
//MITK_INFO << m_CompleteReport.str() << std::endl;
}
#define ROUND_P(x) ((int)((x)+0.5))
template<typename TPixel, unsigned int VImageDimension>
void mitk::CalculateGrayValueStatisticsTool::CalculateMinMax(
itk::Image<TPixel, VImageDimension>* referenceImage, Image* segmentation, TPixel& minimum,
TPixel& maximum)
{
typedef itk::Image<TPixel, VImageDimension> ImageType;
typedef itk::Image<Tool::DefaultSegmentationDataType, VImageDimension> SegmentationType;
typename SegmentationType::Pointer segmentationItk;
CastToItkImage(segmentation, segmentationItk);
typename SegmentationType::RegionType segmentationRegion =
segmentationItk->GetLargestPossibleRegion();
segmentationRegion.Crop(referenceImage->GetLargestPossibleRegion());
itk::ImageRegionConstIteratorWithIndex<SegmentationType> segmentationIterator(segmentationItk,
segmentationRegion);
itk::ImageRegionConstIteratorWithIndex<ImageType> referenceIterator(referenceImage,
segmentationRegion);
segmentationIterator.GoToBegin();
referenceIterator.GoToBegin();
minimum = std::numeric_limits<TPixel>::max();
maximum = std::numeric_limits<TPixel>::min();
while (!segmentationIterator.IsAtEnd())
{
itk::Point<float, 3> pt;
segmentationItk->TransformIndexToPhysicalPoint(segmentationIterator.GetIndex(), pt);
typename ImageType::IndexType ind;
itk::ContinuousIndex<float, 3> contInd;
if (referenceImage->TransformPhysicalPointToContinuousIndex(pt, contInd))
{
for (unsigned int i = 0; i < 3; ++i)
ind[i] = ROUND_P(contInd[i]);
referenceIterator.SetIndex(ind);
if (segmentationIterator.Get() > 0)
{
if (referenceIterator.Get() < minimum)
minimum = referenceIterator.Get();
if (referenceIterator.Get() > maximum)
maximum = referenceIterator.Get();
}
}
++segmentationIterator;
}
}
template<typename TPixel, unsigned int VImageDimension>
void mitk::CalculateGrayValueStatisticsTool::ITKHistogramming(
itk::Image<TPixel, VImageDimension>* referenceImage, Image* segmentation,
std::stringstream& report)
{
typedef itk::Image<TPixel, VImageDimension> ImageType;
typedef itk::Image<Tool::DefaultSegmentationDataType, VImageDimension> SegmentationType;
typename SegmentationType::Pointer segmentationItk;
CastToItkImage( segmentation, segmentationItk );
// generate histogram
typename SegmentationType::RegionType segmentationRegion = segmentationItk->GetLargestPossibleRegion();
segmentationRegion.Crop( referenceImage->GetLargestPossibleRegion() );
itk::ImageRegionConstIteratorWithIndex< SegmentationType > segmentationIterator( segmentationItk, segmentationRegion);
itk::ImageRegionConstIteratorWithIndex< ImageType > referenceIterator( referenceImage, segmentationRegion);
segmentationIterator.GoToBegin();
referenceIterator.GoToBegin();
m_ITKHistogram = HistogramType::New();
TPixel minimum = std::numeric_limits<TPixel>::max();
TPixel maximum = std::numeric_limits<TPixel>::min();
CalculateMinMax(referenceImage, segmentation, minimum, maximum);
//initialize the histogram to the range of the cropped region
HistogramType::SizeType size;
#if defined(ITK_USE_REVIEW_STATISTICS)
typedef typename HistogramType::SizeType::ValueType HSizeValueType;
#else
typedef typename HistogramType::SizeType::SizeValueType HSizeValueType;
#endif
size.Fill(static_cast<HSizeValueType> (maximum - minimum + 1));
HistogramType::MeasurementVectorType lowerBound;
HistogramType::MeasurementVectorType upperBound;
lowerBound[0] = minimum;
upperBound[0] = maximum;
m_ITKHistogram->Initialize(size, lowerBound, upperBound);
double mean(0.0);
double sd(0.0);
double voxelCount(0.0);
//iterate through the cropped region add the values to the histogram
while (!segmentationIterator.IsAtEnd())
{
itk::Point< float, 3 > pt;
segmentationItk->TransformIndexToPhysicalPoint( segmentationIterator.GetIndex(), pt );
typename ImageType::IndexType ind;
itk::ContinuousIndex<float, 3> contInd;
if (referenceImage->TransformPhysicalPointToContinuousIndex(pt, contInd))
{
for (unsigned int i = 0; i < 3; ++i) ind[i] = ROUND_P(contInd[i]);
referenceIterator.SetIndex( ind );
if ( segmentationIterator.Get() > 0 )
{
HistogramType::MeasurementVectorType currentMeasurementVector;
currentMeasurementVector[0]
= static_cast<HistogramType::MeasurementType> (referenceIterator.Get());
m_ITKHistogram->IncreaseFrequency(currentMeasurementVector, 1);
mean = (mean * (static_cast<double> (voxelCount) / static_cast<double> (voxelCount + 1))) // 3 points: old center * 2/3 + currentPoint * 1/3;
+ static_cast<double> (referenceIterator.Get()) / static_cast<double> (voxelCount + 1);
voxelCount += 1.0;
}
}
++segmentationIterator;
}
// second pass for SD
segmentationIterator.GoToBegin();
referenceIterator.GoToBegin();
while ( !segmentationIterator.IsAtEnd() )
{
itk::Point< float, 3 > pt;
segmentationItk->TransformIndexToPhysicalPoint( segmentationIterator.GetIndex(), pt );
typename ImageType::IndexType ind;
itk::ContinuousIndex<float, 3> contInd;
if (referenceImage->TransformPhysicalPointToContinuousIndex(pt, contInd))
{
for (unsigned int i = 0; i < 3; ++i) ind[i] = ROUND_P(contInd[i]);
referenceIterator.SetIndex( ind );
if ( segmentationIterator.Get() > 0 )
{
sd += ((static_cast<double>(referenceIterator.Get() ) - mean)*(static_cast<double>(referenceIterator.Get() ) - mean));
}
}
++segmentationIterator;
}
sd /= static_cast<double>(voxelCount - 1);
sd = sqrt( sd );
// generate quantiles
TPixel histogramQuantileValues[5];
histogramQuantileValues[0] = m_ITKHistogram->Quantile(0, 0.05);
histogramQuantileValues[1] = m_ITKHistogram->Quantile(0, 0.25);
histogramQuantileValues[2] = m_ITKHistogram->Quantile(0, 0.50);
histogramQuantileValues[3] = m_ITKHistogram->Quantile(0, 0.75);
histogramQuantileValues[4] = m_ITKHistogram->Quantile(0, 0.95);
// report histogram values
std::locale C("C");
std::locale originalLocale = report.getloc();
report.imbue(C);
report << " Minimum:" << minimum
<< "\n 5% quantile: " << histogramQuantileValues[0]
<< "\n 25% quantile: " << histogramQuantileValues[1]
<< "\n 50% quantile: " << histogramQuantileValues[2]
<< "\n 75% quantile: " << histogramQuantileValues[3]
<< "\n 95% quantile: " << histogramQuantileValues[4]
<< "\n Maximum: " << maximum
<< "\n Mean: " << mean
<< "\n SD: " << sd
<< "\n";
report.imbue(originalLocale);
}
std::string mitk::CalculateGrayValueStatisticsTool::GetReport() const
{
return m_CompleteReport.str();
}
mitk::CalculateGrayValueStatisticsTool::HistogramType::ConstPointer mitk::CalculateGrayValueStatisticsTool::GetHistogram()
{
return m_ITKHistogram.GetPointer();
}
diff --git a/Modules/MitkExt/Interactions/mitkEventAndActionConstants.xml b/Modules/MitkExt/Interactions/mitkEventAndActionConstants.xml
index 153e87943f..69c850a546 100644
--- a/Modules/MitkExt/Interactions/mitkEventAndActionConstants.xml
+++ b/Modules/MitkExt/Interactions/mitkEventAndActionConstants.xml
@@ -1,365 +1,369 @@
<?xml version="1.0" encoding="utf-8"?>
<mitkInteraktionEvents>
<events>
<eventCategory NAME="NullEvent">
<event NAME="EIDNULLEVENT" ID="0" />
</eventCategory>
<eventCategory NAME="TDMouseEvents">
<event NAME="EIDTDMOUSEINPUT" ID="4001" />
</eventCategory>
<eventCategory NAME="MouseEvents">
<event NAME="EIDLEFTMOUSEBTN" ID="1" />
<event NAME="EIDRIGHTMOUSEBTN" ID="2" />
<event NAME="EIDLEFTMOUSEBTNANDSHIFT" ID="3" />
<event NAME="EIDMIDDLEMOUSEBTN" ID="4" />
<event NAME="EIDLEFTMOUSEBTNANDCTRL" ID="5" />
<event NAME="EIDMIDDLEMOUSEBTNANDCTRL" ID="6" />
<event NAME="EIDRIGHTMOUSEBTNANDCTRL" ID="7" />
<event NAME="EIDLEFTMOUSERELEASE" ID="505" />
<event NAME="EIDMIDDLEMOUSERELEASE" ID="506" />
<event NAME="EIDRIGHTMOUSERELEASE" ID="507" />
<event NAME="EIDLEFTMOUSERELEASEANDSHIFT" ID="508" />
<event NAME="EIDMOUSEMOVE" ID="520" />
<event NAME="EIDLEFTMOUSEBTNANDMOUSEMOVE" ID="530" />
<event NAME="EIDRIGHTMOUSEBTNANDMOUSEMOVE" ID="531" />
<event NAME="EIDMIDDLEMOUSEBTNANDMOUSEMOVE" ID="533" />
<event NAME="EIDCTRLANDLEFTMOUSEBTNANDMOUSEMOVE" ID="534" />
<event NAME="EIDCTRLANDRIGHTMOUSEBTNANDMOUSEMOVE" ID="535" />
<event NAME="EIDCTRLANDMIDDLEMOUSEBTNANDMOUSEMOVE" ID="536" />
<event NAME="EIDCTRLANDLEFTMOUSEBTNRELEASE" ID="537" />
<event NAME="EIDCTRLANDRIGHTMOUSEBTNRELEASE" ID="538" />
<event NAME="EIDCTRLANDMIDDLEMOUSEBTNRELEASE" ID="539" />
<event NAME="EIDSHIFTANDCTRLANDMIDDLEMOUSEBTN" ID="540" />
<event NAME="EIDSHIFTANDLEFTMOUSEBTNANDMOUSEMOVE" ID="541" />
<event NAME="EIDSHIFTANDCTRLANDMOUSEMOVE" ID="542" />
<event NAME="EIDSHIFTANDCTRLANDMOUSERELEASE" ID="543" />
<event NAME="EIDALTANDLEFTMOUSEBTN" ID="600" />
<event NAME="EIDALTANDLEFTMOUSEBTNANDMOUSEMOVE" ID="610" />
<event NAME="EIDALTANDLEFTMOUSERELEASE" ID="620" />
<event NAME="EIDSHIFTANDRIGHTMOUSEPRESS" ID="2000" />
<event NAME="EIDSHIFTANDRIGHTMOUSEMOVE" ID="2001" />
<event NAME="EIDSHIFTANDRIGHTMOUSERELEASE" ID="2002" />
<event NAME="EIDSHIFTANDMIDDLEMOUSEPRESS" ID="2003" />
<event NAME="EIDSHIFTANDMIDDLEMOUSEMOVE" ID="2004" />
<event NAME="EIDSHIFTANDMIDDLEMOUSERELEASE" ID="2005" />
</eventCategory>
<eventCategory NAME="NoMouseEvents">
<event NAME="EIDSTRGANDN" ID="10" />
<event NAME="EIDSTRGANDE" ID="11" />
<event NAME="EIDDELETE" ID="12" />
<event NAME="EIDN" ID="13" />
<event NAME="EIDESCAPE" ID="14" />
<event NAME="EIDP" ID="15" />
<event NAME="EIDR" ID="16" />
<event NAME="EIDT" ID="17" />
<event NAME="EIDS" ID="18" />
<event NAME="EIDE" ID="19" />
<event NAME="EIDSTRGANDALTANDA" ID="20" />
<event NAME="EIDSTRGANDALTANDB" ID="21" />
<event NAME="EIDH" ID="22" />
<event NAME="EIDRETURN" ID="23" />
<event NAME="EIDENTER" ID="24" />
<event NAME="EIDSPACE" ID="25" />
<event NAME="EIDSTRGANDALTANDH" ID="30" />
<event NAME="EIDSTRGANDALTANDI" ID="31" />
<event NAME="EIDSTRGANDALTANDS" ID="40" />
<event NAME="EIDALT" ID="90" />
<event NAME="EIDSTRGANDB" ID="91" />
</eventCategory>
<eventCategory NAME="own thrown events">
<event NAME="EIDNEW" ID="1000" />
<event NAME="EIDOLD" ID="1001" />
<event NAME="EIDFINISHED" ID="1002" />
<event NAME="EIDNO" ID="1003" />
<event NAME="EIDYES" ID="1004" />
<event NAME="EIDSAME" ID="1005" />
<event NAME="EIDNOANDLASTOBJECT" ID="1006" />
<event NAME="EIDNOANDNOTLASTOBJECT" ID="1007" />
<event NAME="EIDLAST" ID="1008" />
<event NAME="EIDNOTLAST" ID="1009" />
<event NAME="EIDSTSMALERNMINUS1" ID="1010" />
<event NAME="EIDSTLARGERNMINUS1" ID="1011" />
<event NAME="EIDPOSITIONEVENT" ID="1012" />
<event NAME="EIDEDIT" ID="1013" />
<event NAME="EIDSMALLERN" ID="1014" />
<event NAME="EIDEQUALSN" ID="1015" />
<event NAME="EIDLARGERN" ID="1016" />
<event NAME="EIDSUBDESELECT" ID="1020" />
<event NAME="EIDSMTOSELECTED" ID="1030" />
<event NAME="EIDSMTODESELECTED" ID="1031" />
<event NAME="EIDTIP" ID="1050" />
<event NAME="EIDHEAD" ID="1051" />
<event NAME="EIDBODY" ID="1052" />
</eventCategory>
<eventCategory NAME="external thrown events">
<event NAME="EIDCLEAR" ID="1100" />
<event NAME="EIDACTIVATETOOL" ID="1300" />
</eventCategory>
<eventCategory NAME="Puncture Application">
<event NAME="EIDPRINT" ID="3001" />
</eventCategory>
<eventCategory NAME="AriadneEvents">
<event NAME="EV_INIT" ID="5551001" />
<event NAME="EV_PREVIOUS" ID="5551002" />
<event NAME="EV_PATH_COLLECTION_SELECTED" ID="5551003" />
<event NAME="EV_NAVIGATION_SELECTED" ID="5551004" />
<event NAME="EV_LESS_THEN_MIN_COUNT" ID="5551005" />
<event NAME="EV_READY" ID="5551006" />
<event NAME="EV_NEXT" ID="5551007" />
<event NAME="EV_DONE" ID="5551008" />
<event NAME="EV_NEW_LANDMARK" ID="5551009" />
<event NAME="EV_REMOVE_LANDMARK" ID="5551010" />
</eventCategory>
+ <eventCategory NAME="FiberBundles">
+ <event NAME="EIDFIGUREHOVER" ID="12340" />
+ <event NAME="EIDNOFIGUREHOVER" ID="12341" />
+ </eventCategory>
</events>
<actions>
<actionCategory NAME="DoNothing">
<action NAME="AcDONOTHING" ID="0" />
</actionCategory>
<actionCategory NAME="Init">
<action NAME="AcINITNEWOBJECT" ID="5" />
<action NAME="AcINITEDITOBJECT" ID="6" />
<action NAME="AcINITEDITGROUP" ID="7" />
<action NAME="AcINITMOVEMENT" ID="8" />
<action NAME="AcINITMOVE" ID="9" />
<action NAME="AcINITFOREGROUND" ID="45">
<!--used in SeedsInteractor for setting the foreground seeds-->
</action>
<action NAME="AcINITBACKGROUND" ID="46">
<!--used in SeedsInteractor for setting the background seeds-->
</action>
<action NAME="AcINITNEUTRAL" ID="47">
<!--used in SeedsInteractor for setting the neutral seeds (rubber)-->
</action>
<action NAME="AcINITUPDATE" ID="1235">
<!--For shape model deformation-->
</action>
</actionCategory>
<actionCategory NAME="Add">
<action NAME="AcADDPOINT" ID="10" />
<action NAME="AcADD" ID="11" />
<action NAME="AcADDLINE" ID="12" />
<action NAME="AcADDANDFINISH" ID="13" />
<action NAME="AcADDSELECTEDTOGROUP" ID="64" />
</actionCategory>
<actionCategory NAME="Check">
<action NAME="AcCHECKPOINT" ID="21" />
<action NAME="AcCHECKLINE" ID="22" />
<action NAME="AcCHECKCELL" ID="23" />
<action NAME="AcCHECKELEMENT" ID="30">
<!--check if there is a element close enough (picking)-->
</action>
<action NAME="AcCHECKOBJECT" ID="31">
<!--check if an object is hit-->
</action>
<action NAME="AcCHECKNMINUS1" ID="32">
<!--check if the number of elements is equal to N-1-->
</action>
<action NAME="AcCHECKEQUALS1" ID="33">
<!--check if the number of elements in the data is equal to 1-->
</action>
<action NAME="AcCHECKNUMBEROFPOINTS" ID="330">
<!--check the number of elements in the data-->
</action>
<action NAME="AcCHECKSELECTED" ID="34">
<!--check if the given element is selected or not-->
</action>
<action NAME="AcCHECKONESELECTED" ID="340">
<!--check if there is an element that is selected-->
</action>
<action NAME="AcCHECKGREATERZERO" ID="35">
<!--check if the current number of elements is greater than 0-->
</action>
<action NAME="AcCHECKGREATERTWO" ID="36">
<!--check if the current number of elements is greater than two-->
</action>
<action NAME="AcCHECKOPERATION" ID="37">
<!--check if the operation is of one spectial type-->
</action>
<action NAME="AcCHECKONESUBINTERACTOR" ID="38" />
<action NAME="AcCHECKSUBINTERACTORS" ID="39" />
</actionCategory>
<actionCategory NAME="Finish">
<action NAME="AcFINISHOBJECT" ID="40" />
<action NAME="AcFINISHGROUP" ID="41" />
<action NAME="AcFINISHMOVEMENT" ID="42" />
<action NAME="AcFINISHMOVE" ID="43" />
<action NAME="AcFINISH" ID="44" />
</actionCategory>
<actionCategory NAME="Search">
<action NAME="AcSEARCHOBJECT" ID="50" />
<action NAME="AcSEARCHGROUP" ID="51" />
<action NAME="AcSEARCHANOTHEROBJECT" ID="52">
<!--one object is selected and another object is to be added to selection-->
</action>
</actionCategory>
<actionCategory NAME="Select">
<action NAME="AcSELECTPICKEDOBJECT" ID="60">
<!--select the picked object and deselect others-->
</action>
<action NAME="AcSELECTANOTHEROBJECT" ID="61" />
<action NAME="AcSELECTGROUP" ID="62" />
<action NAME="AcSELECTALL" ID="63" />
<action NAME="AcSELECT" ID="65" />
<action NAME="AcSELECTPOINT" ID="66" />
<action NAME="AcSELECTLINE" ID="68" />
<action NAME="AcSELECTCELL" ID="67" />
<action NAME="AcSELECTSUBOBJECT" ID="69">
<!--used in VesselGraphInteractor-->
</action>
</actionCategory>
<actionCategory NAME="Deselect">
<action NAME="AcDESELECTOBJECT" ID="70">
<!--deselect picked from group-->
</action>
<action NAME="AcDESELECTALL" ID="72" />
<action NAME="AcDESELECT" ID="75" />
<action NAME="AcDESELECTPOINT" ID="76" />
<action NAME="AcDESELECTLINE" ID="78" />
<action NAME="AcDESELECTCELL" ID="77" />
</actionCategory>
<actionCategory NAME="New">
<action NAME="AcNEWPOINT" ID="80" />
<action NAME="AcNEWSUBOBJECT" ID="81" />
</actionCategory>
<actionCategory NAME="Move">
<action NAME="AcMOVEPOINT" ID="90" />
<action NAME="AcMOVESELECTED" ID="91" />
<action NAME="AcMOVE" ID="92" />
</actionCategory>
<actionCategory NAME="Remove">
<action NAME="AcREMOVEPOINT" ID="100" />
<action NAME="AcREMOVE" ID="101" />
<action NAME="AcREMOVELINE" ID="102" />
<action NAME="AcREMOVEALL" ID="103" />
<action NAME="AcREMOVESELECTEDSUBOBJECT" ID="104">
<!--used in VesselGraphInteractor-->
</action>
<action NAME="AcDELETEPOINT" ID="120" />
<action NAME="AcCLEAR" ID="130">
<!--clear all elements from a list-->
</action>
</actionCategory>
<actionCategory NAME="Insert">
<action NAME="AcINSERTPOINT" ID="110" />
<action NAME="AcINSERTLINE" ID="111" />
</actionCategory>
<actionCategory NAME="AriadneActions">
<action NAME="AC_SET_NEXT_BUTTON_VISIBLE" ID="5550001" />
<action NAME="AC_SET_NEXT_BUTTON_INVISIBLE" ID="5550002" />
<action NAME="AC_SET_PREVIOUS_BUTTON_VISIBLE" ID="5550003" />
<action NAME="AC_SET_PREVIOUS_BUTTON_INVISIBLE" ID="5550004" />
<action NAME="AC_SET_ASSISTAND_WIDGET_STECK" ID="5550005" />
<action NAME="AC_SETMAX_COUNT_REF_POINTS" ID="5550006" />
<action NAME="AC_SET_NEXT_BUTTON_TEXT" ID="5550007" />
<action NAME="AC_CHECK_LANDMARK_COUNT" ID="5550008" />
<action NAME="AC_SET_DONE_FALSE" ID="5550009" />
<action NAME="AC_INIT" ID="55500010" />
<action NAME="AC_SET_APPLICATION_SELECTED_FALSE" ID="55500011" />
<action NAME="AC_SENSOR_ATTACHED" ID="55500012" />
<action NAME="AC_CLOSE_ASSISTENT" ID="55500013" />
<action NAME="AC_START_APPLICATION_TEXT" ID="55500014" />
<action NAME="AC_START_NAVIGATION" ID="55500015" />
<action NAME="AC_START_PATHCOLLECTION" ID="55500016" />
<action NAME="AC_LOAD_LANDMARKS" ID="55500017" />
<action NAME="AC_CALCULATE_LANDMARK_TRANSFORM" ID="55500018" />
</actionCategory>
<actionCategory NAME="Misc">
<action NAME="AcTERMINATE_INTERACTION" ID="666" />
<action NAME="AcTRANSLATESTART" ID="1000" />
<action NAME="AcTRANSLATE" ID="1001" />
<action NAME="AcSCALESTART" ID="1002" />
<action NAME="AcSCALE" ID="1003" />
<action NAME="AcROTATESTART" ID="1004" />
<action NAME="AcROTATE" ID="1005" />
<action NAME="AcINITAFFINEINTERACTIONS" ID="1006" />
<action NAME="AcFINISHAFFINEINTERACTIONS" ID="1007" />
<action NAME="AcTRANSLATEEND" ID="1008" />
<action NAME="AcSCALEEND" ID="1009" />
<action NAME="AcROTATEEND" ID="1010" />
<action NAME="AcINITZOOM" ID="1011" />
<action NAME="AcZOOM" ID="1012" />
<action NAME="AcSETSTARTPOINT" ID="1050" />
<action NAME="AcMODEDESELECT" ID="1100">
<!--set interactor in not selected mode-->
</action>
<action NAME="AcMODESELECT" ID="1101">
<!--set interactor in selected mode-->
</action>
<action NAME="AcMODESUBSELECT" ID="1102">
<!--set interacor in sub selected mode-->
</action>
<action NAME="AcINFORMLISTENERS" ID="1200">
<!--GlobalInteraction-->
</action>
<action NAME="AcASKINTERACTORS" ID="1201">
<!--GlobalInteraction-->
</action>
<action NAME="AcCHECKGREATERONE" ID="1500" />
<action NAME="AcCHECKBOUNDINGBOX" ID="1510" />
<action NAME="AcFORCESUBINTERACTORS" ID="1550" />
<action NAME="AcSENDCOORDINATES" ID="1600" />
<action NAME="AcTRANSMITEVENT" ID="2000">
<!--to transmit an event to a lower Interactor/Statemachine-->
</action>
<action NAME="AcPERIPHERYSEARCH" ID="3000">
<!--used in VesselGraphInteractor-->
</action>
<action NAME="AcROOTSEARCH" ID="3001">
<!--used in VesselGraphInteractor-->
</action>
<action NAME="AcTHICKSTVESSELSEARCH" ID="3002">
<!--used in VesselGraphInteractor-->
</action>
<action NAME="AcSHORTESTPATHSEARCH" ID="3003">
<!--used in VesselGraphInteractor-->
</action>
<action NAME="AcSINGLE" ID="3004">
<!--used in VesselGraphInteractor-->
</action>
<action NAME="AcATTRIBUTATION" ID="3005">
<!--used in VesselGraphInteractor-->
</action>
<action NAME="AcDEFAULT" ID="3007">
<!--used in VesselGraphInteractor-->
</action>
<action NAME="AcSETVESSELELEMENT" ID="3008">
<!--used in VesselGraphInteractor-->
</action>
<action NAME="AcCHECKBARRIERSTATUS" ID="3010">
<!--used in VesselGraphInteractor-->
</action>
<action NAME="AcUPDATEMESH" ID="1234">
<!--For Shape Model Interaction-->
</action>
<action NAME="AcINCREASE" ID="49012" />
<action NAME="AcDECREASE" ID="49013" />
<action NAME="AcMODIFY" ID="49014" />
<action NAME="AcUNDOUPDATE" ID="1236">
<!--For restoring a mesh after an update-->
</action>
<action NAME="AcONTDMOUSEINPUT" ID="4002">
</action>
</actionCategory>
<actionCategory NAME="SegmentationInteractor">
<action NAME="AcENTEROBJECT" ID="48000" />
<action NAME="AcLEAVEOBJECT" ID="48001" />
<action NAME="AcSWITCHOBJECT" ID="48002" />
<action NAME="AcUPDATELINE" ID="48003" />
<action NAME="AcINITLINE" ID="48004" />
<action NAME="AcTERMINATELINE" ID="48005" />
<action NAME="AcCREATEBOX" ID="48006" />
<action NAME="AcCREATEOBJECTFROMLINE" ID="48007" />
<action NAME="AcCANCEL" ID="48008" />
<action NAME="AcACTIVATETOOL" ID="48009" />
<action NAME="AcROTATEAROUNDPOINT1" ID="49002" />
<action NAME="AcROTATEAROUNDPOINT2" ID="49003" />
<action NAME="AcMOVEPOINT1" ID="49004" />
<action NAME="AcMOVEPOINT2" ID="49005" />
<action NAME="AcUPDATEPOINT" ID="49006" />
<action NAME="AcDISPLAYOPTIONS" ID="49009" />
<action NAME="AcCYCLE" ID="49010" />
<action NAME="AcACCEPT" ID="49011" />
</actionCategory>
</actions>
</mitkInteraktionEvents>
diff --git a/Modules/MitkExt/Interactions/mitkPaintbrushTool.cpp b/Modules/MitkExt/Interactions/mitkPaintbrushTool.cpp
index fe495a898a..8f3fe8e8b9 100644
--- a/Modules/MitkExt/Interactions/mitkPaintbrushTool.cpp
+++ b/Modules/MitkExt/Interactions/mitkPaintbrushTool.cpp
@@ -1,352 +1,353 @@
/*=========================================================================
Program: Medical Imaging & Interaction Toolkit
Language: C++
Date: $Date$
Version: $Revision: 1.12 $
Copyright (c) German Cancer Research Center, Division of Medical and
Biological Informatics. All rights reserved.
See MITKCopyright.txt or http://www.mitk.org/copyright.html for details.
This software is distributed WITHOUT ANY WARRANTY; without even
the implied warranty of MERCHANTABILITY or FITNESS FOR A PARTICULAR
PURPOSE. See the above copyright notices for more information.
=========================================================================*/
#include "mitkPaintbrushTool.h"
#include "mitkToolManager.h"
#include "mitkOverwriteSliceImageFilter.h"
#include "mitkBaseRenderer.h"
+#include "mitkImageDataItem.h"
#include "ipSegmentation.h"
#define ROUND(a) ((a)>0 ? (int)((a)+0.5) : -(int)(0.5-(a)))
int mitk::PaintbrushTool::m_Size = 1;
mitk::PaintbrushTool::PaintbrushTool(int paintingPixelValue)
:FeedbackContourTool("PressMoveReleaseWithCTRLInversionAllMouseMoves"),
m_PaintingPixelValue(paintingPixelValue),
m_LastContourSize(0) // other than initial mitk::PaintbrushTool::m_Size (around l. 28)
{
m_MasterContour = Contour::New();
m_MasterContour->Initialize();
}
mitk::PaintbrushTool::~PaintbrushTool()
{
}
void mitk::PaintbrushTool::Activated()
{
Superclass::Activated();
FeedbackContourTool::SetFeedbackContourVisible(true);
SizeChanged.Send(m_Size);
}
void mitk::PaintbrushTool::Deactivated()
{
FeedbackContourTool::SetFeedbackContourVisible(false);
Superclass::Deactivated();
}
void mitk::PaintbrushTool::SetSize(int value)
{
m_Size = value;
}
void mitk::PaintbrushTool::UpdateContour(const StateEvent* stateEvent)
{
// examine stateEvent and create a contour that matches the pixel mask that we are going to draw
const PositionEvent* positionEvent = dynamic_cast<const PositionEvent*>(stateEvent->GetEvent());
if (!positionEvent) return;
Image::Pointer m_WorkingSlice = FeedbackContourTool::GetAffectedWorkingSlice( positionEvent );
if (m_WorkingSlice.IsNull()) return;
// create a copy of this slice (at least match the pixel sizes/spacings),
// then draw the desired mask on it and create a contour from it
// Convert to ipMITKSegmentationTYPE (because getting pixels relys on that data type)
itk::Image< ipMITKSegmentationTYPE, 2 >::Pointer correctPixelTypeImage;
CastToItkImage( m_WorkingSlice, correctPixelTypeImage );
assert (correctPixelTypeImage.IsNotNull() );
itk::Image< ipMITKSegmentationTYPE, 2 >::DirectionType imageDirection;
imageDirection.SetIdentity();
correctPixelTypeImage->SetDirection(imageDirection);
Image::Pointer temporarySlice = Image::New();
CastToMitkImage( correctPixelTypeImage, temporarySlice );
mitkIpPicDescriptor* stupidClone = mitkIpPicClone( temporarySlice->GetSliceData()->GetPicDescriptor() );
unsigned int pixelWidth = m_Size + 1;
unsigned int pixelHeight = m_Size + 1;
if ( stupidClone->n[0] <= pixelWidth || stupidClone->n[1] <= pixelHeight )
{
MITK_INFO << "Brush size is bigger than your working image. Reconsider this...\n"
"(Or tell your progammer until (s)he fixes this message.)" << std::endl;
mitkIpPicFree( stupidClone );
return;
}
unsigned int lineLength( stupidClone->n[0] );
unsigned int oneContourOffset(0);
float circleCenterX = (float)m_Size / 2.0;
float circleCenterY = (float)m_Size / 2.0;
for (unsigned int x = 0; x <= pixelWidth; ++x)
{
for (unsigned int y = 0; y <= pixelHeight; ++y)
{
unsigned int offset = lineLength * y + x;
ipMITKSegmentationTYPE* current = (ipMITKSegmentationTYPE*)stupidClone->data + offset;
float pixelCenterX = x + 0.5;
float pixelCenterY = y + 0.5;
float xoff = pixelCenterX - circleCenterX;
float yoff = pixelCenterY - circleCenterY;
bool inside = xoff * xoff + yoff * yoff < (m_Size * m_Size) / 4.0; // no idea, if this would work for ellipses
if (inside)
{
*current = 1;
oneContourOffset = offset;
}
else
{
*current = 0;
}
}
}
int numberOfContourPoints( 0 );
int newBufferSize( 0 );
float* contourPoints = ipMITKSegmentationGetContour8N( stupidClone, oneContourOffset, numberOfContourPoints, newBufferSize ); // memory allocated with malloc
if (!contourPoints)
{
mitkIpPicFree( stupidClone );
return;
}
// copy point from float* to mitk::Contour
Contour::Pointer contourInImageIndexCoordinates = Contour::New();
contourInImageIndexCoordinates->Initialize();
Point3D newPoint;
//ipMITKSegmentationGetContour8N returns all points, which causes vtk warnings, since the first and the last points are coincident.
//leaving the last point out, the contour is still drawn correctly
for (int index = 0; index < numberOfContourPoints-1; ++index)
{
newPoint[0] = contourPoints[ 2 * index + 0 ] - circleCenterX; // master contour should be centered around (0,0)
newPoint[1] = contourPoints[ 2 * index + 1] - circleCenterY;
newPoint[2] = 0.0;
MITK_DEBUG << "Point [" << index << "] (" << newPoint[0] << ", " << newPoint[1] << ")" << std::endl;
contourInImageIndexCoordinates->AddVertex( newPoint );
}
free(contourPoints);
m_MasterContour = contourInImageIndexCoordinates;
mitkIpPicFree( stupidClone );
}
/**
Just show the contour, get one point as the central point and add surrounding points to the contour.
*/
bool mitk::PaintbrushTool::OnMousePressed (Action* action, const StateEvent* stateEvent)
{
if (FeedbackContourTool::OnMousePressed( action, stateEvent ))
{
const PositionEvent* positionEvent = dynamic_cast<const PositionEvent*>(stateEvent->GetEvent());
if (positionEvent)
{
UpdateContour( stateEvent );
}
}
return this->OnMouseMoved(action, stateEvent);
/*
return true;
*/
}
/**
Insert the point to the feedback contour,finish to build the contour and at the same time the painting function
*/
bool mitk::PaintbrushTool::OnMouseMoved (Action* itkNotUsed(action), const StateEvent* stateEvent)
{
bool leftMouseButtonPressed(
stateEvent->GetId() == 530
|| stateEvent->GetId() == 1
|| stateEvent->GetId() == 5
);
const PositionEvent* positionEvent = dynamic_cast<const PositionEvent*>(stateEvent->GetEvent());
if (!positionEvent) return false;
if ( m_LastContourSize != m_Size )
{
UpdateContour( stateEvent );
m_LastContourSize = m_Size;
}
DataNode* workingNode( m_ToolManager->GetWorkingData(0) );
if (!workingNode) return false;
Image* image = dynamic_cast<Image*>(workingNode->GetData());
const PlaneGeometry* planeGeometry( dynamic_cast<const PlaneGeometry*> (positionEvent->GetSender()->GetCurrentWorldGeometry2D() ) );
if ( !image || !planeGeometry )
return false;
int affectedDimension( -1 );
int affectedSlice( -1 );
if ( !SegTool2D::DetermineAffectedImageSlice( image, planeGeometry, affectedDimension, affectedSlice ) )
return false;
Point3D worldCoordinates = positionEvent->GetWorldPosition();
Point3D indexCoordinates;
image->GetGeometry()->WorldToIndex( worldCoordinates, indexCoordinates );
MITK_DEBUG << "Mouse at W " << worldCoordinates << std::endl;
MITK_DEBUG << "Mouse at I " << indexCoordinates << std::endl;
unsigned int firstDimension(0);
unsigned int secondDimension(1);
switch( affectedDimension )
{
case 2: // transversal
default:
firstDimension = 0;
secondDimension = 1;
break;
case 1: // frontal
firstDimension = 0;
secondDimension = 2;
break;
case 0: // sagittal
firstDimension = 1;
secondDimension = 2;
break;
}
// round to nearest voxel center (abort if this hasn't changed)
if ( m_Size % 2 == 0 ) // even
{
indexCoordinates[firstDimension] = ROUND( indexCoordinates[firstDimension] + 0.5);
indexCoordinates[secondDimension] = ROUND( indexCoordinates[secondDimension] + 0.5 );
}
else // odd
{
indexCoordinates[firstDimension] = ROUND( indexCoordinates[firstDimension] ) ;
indexCoordinates[secondDimension] = ROUND( indexCoordinates[secondDimension] ) ;
}
static Point3D lastPos; // uninitialized: if somebody finds out how this can be initialized in a one-liner, tell me
static bool lastLeftMouseButtonPressed(false);
if ( fabs(indexCoordinates[0] - lastPos[0]) > mitk::eps ||
fabs(indexCoordinates[1] - lastPos[1]) > mitk::eps ||
fabs(indexCoordinates[2] - lastPos[2]) > mitk::eps ||
leftMouseButtonPressed != lastLeftMouseButtonPressed
)
{
lastPos = indexCoordinates;
lastLeftMouseButtonPressed = leftMouseButtonPressed;
}
else
{
MITK_DEBUG << "." << std::flush;
return false;
}
MITK_DEBUG << "Mouse at C " << indexCoordinates;
Contour::Pointer contour = Contour::New();
contour->Initialize();
for (unsigned int index = 0; index < m_MasterContour->GetNumberOfPoints(); ++index)
{
Point3D point = m_MasterContour->GetPoints()->ElementAt(index);
point[0] += indexCoordinates[ firstDimension ];
point[1] += indexCoordinates[ secondDimension ];
MITK_DEBUG << "Contour point [" << index << "] :" << point;
contour->AddVertex( point );
}
Image::Pointer slice = SegTool2D::GetAffectedImageSliceAs2DImage( positionEvent, image );
if ( slice.IsNull() )
return false;
if (leftMouseButtonPressed)
{
FeedbackContourTool::FillContourInSlice( contour, slice, m_PaintingPixelValue );
OverwriteSliceImageFilter::Pointer slicewriter = OverwriteSliceImageFilter::New();
slicewriter->SetInput( image );
slicewriter->SetCreateUndoInformation( true );
slicewriter->SetSliceImage( slice );
slicewriter->SetSliceDimension( affectedDimension );
slicewriter->SetSliceIndex( affectedSlice );
slicewriter->SetTimeStep( positionEvent->GetSender()->GetTimeStep( image ) );
slicewriter->Update();
}
// visualize contour
Contour::Pointer displayContour = Contour::New();
displayContour->Initialize();
for (unsigned int index = 0; index < contour->GetNumberOfPoints(); ++index)
{
Point3D point = contour->GetPoints()->ElementAt(index);
/*if ( m_Size % 2 != 0 ) // even
{
point[0] += 0.5;
point[1] += 0.5;
}*/
displayContour->AddVertex( point );
}
displayContour = FeedbackContourTool::BackProjectContourFrom2DSlice( slice->GetGeometry(), displayContour );
SetFeedbackContour( *displayContour );
assert( positionEvent->GetSender()->GetRenderWindow() );
RenderingManager::GetInstance()->RequestUpdate( positionEvent->GetSender()->GetRenderWindow() );
return true;
}
bool mitk::PaintbrushTool::OnMouseReleased(Action* /*action*/, const StateEvent* /*stateEvent*/)
{
//FeedbackContourTool::SetFeedbackContourVisible(false);
return true;
}
/**
Called when the CTRL key is pressed. Will change the painting pixel value from 0 to 1 or from 1 to 0.
*/
bool mitk::PaintbrushTool::OnInvertLogic(Action* action, const StateEvent* stateEvent)
{
if (!FeedbackContourTool::OnInvertLogic(action, stateEvent)) return false;
// Inversion only for 0 and 1 as painting values
if (m_PaintingPixelValue == 1)
{
m_PaintingPixelValue = 0;
FeedbackContourTool::SetFeedbackContourColor( 1.0, 0.0, 0.0 );
}
else if (m_PaintingPixelValue == 0)
{
m_PaintingPixelValue = 1;
FeedbackContourTool::SetFeedbackContourColorDefault();
}
return true;
}
diff --git a/Modules/MitkExt/Interactions/mitkPixelManipulationTool.cpp b/Modules/MitkExt/Interactions/mitkPixelManipulationTool.cpp
index 2598485567..609fa1923f 100644
--- a/Modules/MitkExt/Interactions/mitkPixelManipulationTool.cpp
+++ b/Modules/MitkExt/Interactions/mitkPixelManipulationTool.cpp
@@ -1,171 +1,172 @@
/*=========================================================================
Program: Medical Imaging & Interaction Toolkit
Language: C++
Date: $Date$
Version: $Revision: 28959 $
Copyright (c) German Cancer Research Center, Division of Medical and
Biological Informatics. All rights reserved.
See MITKCopyright.txt or http://www.mitk.org/copyright.html for details.
This software is distributed WITHOUT ANY WARRANTY; without even
the implied warranty of MERCHANTABILITY or FITNESS FOR A PARTICULAR
PURPOSE. See the above copyright notices for more information.
=========================================================================*/
#include "mitkPixelManipulationTool.h"
#include "mitkToolManager.h"
#include "mitkImageCast.h"
+#include "mitkImageAccessByItk.h"
#include "mitkProperties.h"
#include "mitkBoundingObjectToSegmentationFilter.h"
#include <itkImageRegionIterator.h>
#include "mitkPixelManipulationTool.xpm"
namespace mitk {
MITK_TOOL_MACRO(MitkExt_EXPORT, PixelManipulationTool, "Pixel manipulation tool");
}
mitk::PixelManipulationTool::PixelManipulationTool() : Tool("dummy"),
m_Value(0),
m_FixedValue(false)
{
this->SupportRoiOn();
}
mitk::PixelManipulationTool::~PixelManipulationTool()
{
}
void mitk::PixelManipulationTool::Activated()
{
m_ToolManager->RoiDataChanged += mitk::MessageDelegate<mitk::PixelManipulationTool> (this,&mitk::PixelManipulationTool::OnRoiDataChanged);
m_OriginalImageNode = m_ToolManager->GetReferenceData(0);
if (m_OriginalImageNode.IsNotNull())
{
mitk::Image::Pointer image = dynamic_cast<mitk::Image*> (m_OriginalImageNode->GetData());
if ( image.IsNotNull())
{
//mitk::ScalarType scalar = image->GetScalarValueMax();
}
}
else
m_ToolManager->ActivateTool(-1);
}
void mitk::PixelManipulationTool::Deactivated()
{
m_ToolManager->RoiDataChanged -= mitk::MessageDelegate<mitk::PixelManipulationTool> (this,&mitk::PixelManipulationTool::OnRoiDataChanged);
}
const char* mitk::PixelManipulationTool::GetName() const
{
return "pixelmanipulation";
}
const char** mitk::PixelManipulationTool::GetXPM() const
{
return mitkPixelManipulationTool_xpm;
}
void mitk::PixelManipulationTool::OnRoiDataChanged()
{
}
void mitk::PixelManipulationTool::CalculateImage()
{
if (m_OriginalImageNode.IsNotNull())
{
mitk::Image::Pointer image = dynamic_cast<mitk::Image*> (m_OriginalImageNode->GetData());
mitk::DataNode* maskNode = m_ToolManager->GetRoiData(0);
mitk::Image::Pointer roi = mitk::Image::New();
if (maskNode)
{
mitk::BoundingObject* boundingObject = dynamic_cast<mitk::BoundingObject*> (maskNode->GetData());
if (boundingObject)
{
mitk::BoundingObjectToSegmentationFilter::Pointer filter = mitk::BoundingObjectToSegmentationFilter::New();
filter->SetBoundingObject( boundingObject);
filter->SetInput(image);
filter->Update();
roi = filter->GetOutput();
}
else
roi = dynamic_cast<mitk::Image*> (maskNode->GetData());
mitk::Image::Pointer newImage = mitk::Image::New();
newImage->Initialize(image);
if (image)
{
AccessByItk_3(image, ITKPixelManipulation, roi, newImage, m_Value);
this->AddImageToDataStorage(newImage);
}
}
}
}
template <typename TPixel, unsigned int VImageDimension>
void mitk::PixelManipulationTool::ITKPixelManipulation( itk::Image<TPixel, VImageDimension>* originalImage, Image* maskImage, Image* newImage, int newValue)
{
typedef itk::Image< TPixel, VImageDimension> itkImageType;
typedef itk::Image< unsigned char, 3> itkMaskType;
typename itkImageType::Pointer itkImage;
typename itkMaskType::Pointer itkMask;
CastToItkImage( newImage, itkImage);
CastToItkImage( maskImage, itkMask);
typedef itk::ImageRegionConstIterator< itkImageType > InputIteratorType;
typedef itk::ImageRegionIterator< itkImageType > OutputIteratorType;
typedef itk::ImageRegionConstIterator< itkMaskType > MaskIteratorType;
MaskIteratorType maskIterator ( itkMask, itkMask->GetLargestPossibleRegion() );
InputIteratorType inputIterator( originalImage, originalImage->GetLargestPossibleRegion() );
OutputIteratorType outputIterator( itkImage, itkImage->GetLargestPossibleRegion() );
inputIterator.GoToBegin();
outputIterator.GoToBegin();
maskIterator.GoToBegin();
while (!outputIterator.IsAtEnd())
{
if (maskIterator.Get())
{
if (m_FixedValue)
outputIterator.Set(newValue);
else
outputIterator.Set( inputIterator.Get()+ newValue);
}
else
outputIterator.Set( inputIterator.Get());
++inputIterator;
++outputIterator;
++maskIterator;
}
}
void mitk::PixelManipulationTool::AddImageToDataStorage(mitk::Image::Pointer image)
{
if (image.IsNotNull())
{
mitk::DataNode::Pointer node = mitk::DataNode::New();
std::string name = m_OriginalImageNode->GetName();
name.append("_modified");
node->SetName(name);
node->SetProperty("binary", mitk::BoolProperty::New(false));
node->SetData(image);
if (m_ToolManager)
m_ToolManager->GetDataStorage()->Add(node, m_OriginalImageNode);
}
-}
\ No newline at end of file
+}
diff --git a/Modules/MitkExt/Interactions/mitkRegionGrow3DTool.cpp b/Modules/MitkExt/Interactions/mitkRegionGrow3DTool.cpp
index 576f6b8683..e4a0b9e01d 100644
--- a/Modules/MitkExt/Interactions/mitkRegionGrow3DTool.cpp
+++ b/Modules/MitkExt/Interactions/mitkRegionGrow3DTool.cpp
@@ -1,441 +1,442 @@
/*=========================================================================
Program: Medical Imaging & Interaction Toolkit
Language: C++
Date: $Date$
Version: $Revision: 28959 $
Copyright (c) German Cancer Research Center, Division of Medical and
Biological Informatics. All rights reserved.
See MITKCopyright.txt or http://www.mitk.org/copyright.html for details.
This software is distributed WITHOUT ANY WARRANTY; without even
the implied warranty of MERCHANTABILITY or FITNESS FOR A PARTICULAR
PURPOSE. See the above copyright notices for more information.
=========================================================================*/
#include "mitkRegionGrow3DTool.h"
#include "mitkToolManager.h"
#include "mitkRenderingManager.h"
#include "mitkLevelWindowProperty.h"
#include "mitkPointSetInteractor.h"
#include "mitkGlobalInteraction.h"
#include "mitkITKImageImport.h"
#include "itkImage.h"
#include "itkBinaryThresholdImageFilter.h"
#include "itkConnectedAdaptiveThresholdImageFilter.h"
#include "mitkImageCast.h"
+#include "mitkImageAccessByItk.h"
#include "mitkMaskAndCutRoiImageFilter.h"
#include "mitkPadImageFilter.h"
#include "mitkRegionGrow3DTool.xpm"
namespace mitk {
MITK_TOOL_MACRO(MitkExt_EXPORT, RegionGrow3DTool, "RegionGrower 3D");
}
mitk::RegionGrow3DTool::RegionGrow3DTool(): Tool("PressMoveRelease"),
m_LowerThreshold(-5000),
m_UpperThreshold(5000),
m_CurrentRGDirectionIsUpwards(false)
{
CONNECT_ACTION( 42, OnMouseReleased );
this->SupportRoiOn();
m_FeedbackNode = DataNode::New();
m_FeedbackNode->SetProperty( "color", ColorProperty::New(1.0, 0.0, 0.0) );
m_FeedbackNode->SetProperty( "texture interpolation", BoolProperty::New(false) );
m_FeedbackNode->SetProperty( "layer", IntProperty::New( 100 ) );
m_FeedbackNode->SetProperty( "levelwindow", LevelWindowProperty::New( LevelWindow(100, 1) ) );
m_FeedbackNode->SetProperty( "name", StringProperty::New("failsafe region grow feedback") );
m_FeedbackNode->SetProperty( "opacity", FloatProperty::New(0.3) );
m_FeedbackNode->SetProperty( "helper object", BoolProperty::New(true) );
m_FeedbackNode->SetVisibility(false);
m_PointSetNode = mitk::DataNode::New();
m_PointSetNode->SetName("regiongrow3d pointset");
m_PointSetNode->SetProperty("helper object", mitk::BoolProperty::New(true));
m_PointSetNode->SetProperty("layer", mitk::IntProperty::New(2));
mitk::PointSet::Pointer pointSet = mitk::PointSet::New();
m_PointSetNode->SetData(pointSet);
}
mitk::RegionGrow3DTool::~RegionGrow3DTool()
{
}
bool mitk::RegionGrow3DTool::OnMouseReleased(Action*, const StateEvent* stateEvent)
{
mitk::PointSetInteractor::Pointer interactor = dynamic_cast<mitk::PointSetInteractor*> (m_PointSetNode->GetInteractor());
if (interactor.IsNotNull())
{
mitk::PointSet::Pointer pointSet = dynamic_cast<mitk::PointSet*> (m_PointSetNode->GetData());
if (pointSet.IsNotNull())
{
if (pointSet->GetSize() == 1)
{
//check if we have a valid picture
this->RunSegmentation();
SeedButtonToggled.Send(false);
}
}
}
return true;
}
void mitk::RegionGrow3DTool::Activated()
{
if (m_ToolManager)
{
m_ToolManager->RoiDataChanged += mitk::MessageDelegate<mitk::RegionGrow3DTool>(this, &mitk::RegionGrow3DTool::UpdatePreview);
m_OriginalImageNode = m_ToolManager->GetReferenceData(0);
m_NodeToProceed = m_OriginalImageNode;
if (m_NodeToProceed.IsNotNull())
{
SetupPreviewNodeFor(m_NodeToProceed);
mitk::Image::Pointer image = dynamic_cast<mitk::Image*> (m_OriginalImageNode->GetData());
if (image.IsNotNull())
{
m_RoiMin = image->GetScalarValueMin();
m_RoiMax = image->GetScalarValueMax();
}
}
else
m_ToolManager->ActivateTool(-1);
}
}
void mitk::RegionGrow3DTool::Deactivated()
{
m_ToolManager->RoiDataChanged -= mitk::MessageDelegate<mitk::RegionGrow3DTool>(this, &mitk::RegionGrow3DTool::UpdatePreview);
if (mitk::DataStorage* ds = m_ToolManager->GetDataStorage())
{
ds->Remove(m_PointSetNode);
ds->Remove(m_FeedbackNode);
}
m_FeedbackNode->SetData(NULL);
m_FeedbackNode->SetLevelWindow(NULL);
m_FeedbackNode->SetVisibility(false);
mitk::RenderingManager::GetInstance()->RequestUpdateAll();
}
const char* mitk::RegionGrow3DTool::GetName() const
{
return "RegionGrower 3D";
}
const char** mitk::RegionGrow3DTool::GetXPM() const
{
return mitkRegionGrow3DTool_xpm;
}
void mitk::RegionGrow3DTool::SetSeedPoint(bool toggled)
{
if (!m_ToolManager->GetDataStorage()->Exists(m_PointSetNode)) //no pointSet present
m_ToolManager->GetDataStorage()->Add(m_PointSetNode, m_OriginalImageNode);
//add Interactor if there is none and add it to GlobalInteraction
if (toggled == true) // button is down
{
mitk::PointSetInteractor::Pointer interactor = dynamic_cast<mitk::PointSetInteractor*> (m_PointSetNode->GetInteractor());
if (interactor.IsNull())
{
//create a new interactor and add it to node
interactor = mitk::PointSetInteractor::New("singlepointinteractorwithoutshiftclick", m_PointSetNode, 1);
}
mitk::GlobalInteraction::GetInstance()->AddInteractor(interactor);
}
else
{
mitk::PointSetInteractor::Pointer interactor = dynamic_cast<mitk::PointSetInteractor*> (m_PointSetNode->GetInteractor());
if (interactor.IsNotNull())
{
m_PointSetNode->SetInteractor(NULL);
mitk::GlobalInteraction::GetInstance()->RemoveInteractor(interactor);
}
}
}
void mitk::RegionGrow3DTool::RunSegmentation()
{
//safety if no pointSet or pointSet empty
mitk::PointSet::Pointer seedPointSet = dynamic_cast<mitk::PointSet*> (m_PointSetNode->GetData());
if (seedPointSet.IsNull())
{
return;
}
if (!(seedPointSet->GetSize() > 0))
{
return;
}
mitk::PointSet::PointType seedPoint = seedPointSet->GetPointSet()->GetPoints()->Begin().Value();
mitk::Image::Pointer image = dynamic_cast<mitk::Image*> (m_NodeToProceed->GetData());
if (image.IsNotNull())
{
m_LowerThreshold = static_cast<int> (m_RoiMin);
m_UpperThreshold = static_cast<int> (m_RoiMax);
AccessByItk_2(image, StartRegionGrowing, image->GetGeometry(), seedPoint);
}
}
template<typename TPixel, unsigned int VImageDimension>
void mitk::RegionGrow3DTool::StartRegionGrowing(itk::Image<TPixel, VImageDimension>* itkImage, mitk::Geometry3D* imageGeometry, mitk::PointSet::PointType seedPoint)
{
typedef itk::Image<TPixel, VImageDimension> InputImageType;
typedef typename InputImageType::IndexType IndexType;
typedef itk::ConnectedAdaptiveThresholdImageFilter<InputImageType, InputImageType> RegionGrowingFilterType;
typename RegionGrowingFilterType::Pointer regionGrower = RegionGrowingFilterType::New();
if ( !imageGeometry->IsInside(seedPoint) )
{
return;
}
IndexType seedIndex;
imageGeometry->WorldToIndex( seedPoint, seedIndex);// convert world coordinates to image indices
//int seedValue = itkImage->GetPixel(seedIndex);
regionGrower->SetInput( itkImage );
regionGrower->AddSeed( seedIndex );
regionGrower->SetLower( m_LowerThreshold );
regionGrower->SetUpper( m_UpperThreshold );
regionGrower->SetGrowingDirectionIsUpwards( m_CurrentRGDirectionIsUpwards );
try
{
regionGrower->Update();
}
catch( ... )
{
MITK_ERROR << "Something went wrong!" << endl;
return;
}
m_SeedpointValue = regionGrower->GetSeedpointValue();
//initialize slider
if(m_CurrentRGDirectionIsUpwards)
{
UpperThresholdValueChanged.Send(m_UpperThreshold);
LowerThresholdValueChanged.Send(m_SeedpointValue);
}
else
{
UpperThresholdValueChanged.Send(m_SeedpointValue);
LowerThresholdValueChanged.Send(m_LowerThreshold);
}
m_DetectedLeakagePoint = regionGrower->GetLeakagePoint();
mitk::Image::Pointer resultImage = mitk::ImportItkImage( regionGrower->GetOutput() );
m_FeedbackNode->SetData( resultImage );
m_FeedbackNode->SetVisibility(true);
InitializeLevelWindow();
}
void mitk::RegionGrow3DTool::InitializeLevelWindow()
{
mitk::LevelWindow tempLevelWindow;
m_FeedbackNode->GetLevelWindow(tempLevelWindow, NULL, "levelWindow");
mitk::ScalarType* level = new mitk::ScalarType(0.5);
mitk::ScalarType* window = new mitk::ScalarType(1);
int upper;
if (m_CurrentRGDirectionIsUpwards)
{
upper = m_UpperThreshold - m_SeedpointValue;
}
else
{
upper = m_SeedpointValue - m_LowerThreshold;
}
tempLevelWindow.SetRangeMinMax(mitk::ScalarType(0), mitk::ScalarType(upper));
tempLevelWindow.SetLevelWindow(*level, *window);
m_FeedbackNode->SetLevelWindow(tempLevelWindow, NULL, "levelWindow");
//get the suggested threshold from the detected leakage-point and adjust the slider
if (m_CurrentRGDirectionIsUpwards)
{
SliderValueChanged.Send(m_SeedpointValue + m_DetectedLeakagePoint -1);
}
else
{
SliderValueChanged.Send(m_SeedpointValue - m_DetectedLeakagePoint +1);
}
mitk::RenderingManager::GetInstance()->RequestUpdateAll();
}
void mitk::RegionGrow3DTool::ChangeLevelWindow(int value)
{
if (m_FeedbackNode.IsNull())
return;
mitk::LevelWindow tempLevelWindow;
m_FeedbackNode->GetLevelWindow(tempLevelWindow, NULL, "levelWindow"); //get the levelWindow associated with the preview
mitk::ScalarType level;// = this->m_UPPERTHRESHOLD - newValue + 0.5;
mitk::ScalarType* window = new mitk::ScalarType(1);
//adjust the levelwindow according to the position of the slider (newvalue)
if (m_CurrentRGDirectionIsUpwards)
{
level = m_UpperThreshold - value + 0.5;
tempLevelWindow.SetLevelWindow(level, *window);
}
else
{
level = value - m_LowerThreshold +0.5;
tempLevelWindow.SetLevelWindow(level, *window);
}
m_FeedbackNode->SetLevelWindow(tempLevelWindow, NULL, "levelWindow");
mitk::RenderingManager::GetInstance()->RequestUpdateAll();
}
void mitk::RegionGrow3DTool::ConfirmSegmentation( std::string name, mitk::Color color)
{
mitk::DataNode::Pointer new_node = mitk::DataNode::New();
new_node->SetColor(color);
new_node->SetName(name);
new_node->SetProperty("binary", mitk::BoolProperty::New("true"));
mitk::Image* image = dynamic_cast<mitk::Image*> (m_FeedbackNode->GetData());
mitk::LevelWindow tempLevelWindow;
m_FeedbackNode->GetLevelWindow( tempLevelWindow, NULL, "levelWindow");
int upperThresholdLabeledImage = (short int) tempLevelWindow.GetRangeMax();
int lowerThresholdLabeledImage = (short int) tempLevelWindow.GetLowerWindowBound() + 1;
typedef itk::Image<int, 3> InputImageType;
typedef itk::Image<unsigned char, 3> SegmentationType;
typedef itk::BinaryThresholdImageFilter<InputImageType, SegmentationType> ThresholdFilterType;
ThresholdFilterType::Pointer filter = ThresholdFilterType::New();
InputImageType::Pointer itkImage;
mitk::CastToItkImage(image, itkImage);
filter->SetInput(itkImage);
filter->SetInsideValue(1);
filter->SetOutsideValue(0);
filter->SetUpperThreshold(upperThresholdLabeledImage);
filter->SetLowerThreshold(lowerThresholdLabeledImage);
filter->Update();
mitk::Image::Pointer new_image = mitk::Image::New();
mitk::CastToMitkImage(filter->GetOutput(), new_image);
//pad to original size
if (m_OriginalImageNode.GetPointer() != m_NodeToProceed.GetPointer())
{
mitk::PadImageFilter::Pointer padFilter = mitk::PadImageFilter::New();
padFilter->SetInput(0, new_image);
padFilter->SetInput(1, dynamic_cast<mitk::Image*> (m_OriginalImageNode->GetData()));
padFilter->SetBinaryFilter(true);
padFilter->SetUpperThreshold(1);
padFilter->SetLowerThreshold(1);
padFilter->Update();
new_image = padFilter->GetOutput();
}
new_node->SetData(new_image);
m_ToolManager->GetDataStorage()->Add(new_node);
mitk::RenderingManager::GetInstance()->RequestUpdateAll();
m_ToolManager->ActivateTool(-1);
}
void mitk::RegionGrow3DTool::CancelSegmentation()
{
m_ToolManager->ActivateTool(-1);
}
void mitk::RegionGrow3DTool::SetupPreviewNodeFor( DataNode* nodeToProceed)
{
if (nodeToProceed)
{
Image::Pointer image = dynamic_cast<Image*>( nodeToProceed->GetData() );
if (image.IsNotNull())
{
m_FeedbackNode->SetData( image );
int layer(50);
nodeToProceed->GetIntProperty("layer", layer);
m_FeedbackNode->SetIntProperty("layer", layer+1);
m_FeedbackNode->SetLevelWindow(NULL);
if (DataStorage* storage = m_ToolManager->GetDataStorage())
{
if (storage->Exists(m_FeedbackNode))
storage->Remove(m_FeedbackNode);
storage->Add( m_FeedbackNode, nodeToProceed );
}
}
}
mitk::RenderingManager::GetInstance()->RequestUpdateAll();
}
void mitk::RegionGrow3DTool::UpdatePreview()
{
typedef itk::Image<int, 3> ItkImageType;
typedef itk::Image<unsigned char, 3> ItkMaskType;
mitk::DataNode::Pointer node = m_ToolManager->GetRoiData(0);
if (node.IsNull())
{
this->SetupPreviewNodeFor(m_OriginalImageNode);
m_NodeToProceed = m_OriginalImageNode;
mitk::Image::Pointer image = dynamic_cast<mitk::Image*> (m_OriginalImageNode->GetData());
if (image.IsNotNull())
{
m_RoiMin = image->GetScalarValueMin();
m_RoiMax = image->GetScalarValueMax();
}
return;
}
mitk::MaskAndCutRoiImageFilter::Pointer roiFilter = mitk::MaskAndCutRoiImageFilter::New();
roiFilter->SetInput(dynamic_cast<mitk::Image*> (m_NodeToProceed->GetData()));
roiFilter->SetRegionOfInterest(node->GetData());
roiFilter->Update();
mitk::DataNode::Pointer new_node = mitk::DataNode::New();
mitk::Image::Pointer tmpImage = roiFilter->GetOutput();
new_node->SetData(tmpImage);
m_RoiMax = roiFilter->GetMaxValue();
m_RoiMin = roiFilter->GetMinValue();
this->SetupPreviewNodeFor(new_node);
m_NodeToProceed = new_node;
//this->RunSegmentation();
}
void mitk::RegionGrow3DTool::SetCurrentRGDirectionIsUpwards(bool flag)
{
m_CurrentRGDirectionIsUpwards = flag;
}
diff --git a/Modules/MitkExt/Interactions/mitkRegionGrowingTool.cpp b/Modules/MitkExt/Interactions/mitkRegionGrowingTool.cpp
index de9b6efa1f..3c098bb5a0 100644
--- a/Modules/MitkExt/Interactions/mitkRegionGrowingTool.cpp
+++ b/Modules/MitkExt/Interactions/mitkRegionGrowingTool.cpp
@@ -1,711 +1,712 @@
/*=========================================================================
Program: Medical Imaging & Interaction Toolkit
Language: C++
Date: $Date$
Version: $Revision$
Copyright (c) German Cancer Research Center, Division of Medical and
Biological Informatics. All rights reserved.
See MITKCopyright.txt or http://www.mitk.org/copyright.html for details.
This software is distributed WITHOUT ANY WARRANTY; without even
the implied warranty of MERCHANTABILITY or FITNESS FOR A PARTICULAR
PURPOSE. See the above copyright notices for more information.
=========================================================================*/
#include "mitkRegionGrowingTool.h"
#include "mitkToolManager.h"
#include "mitkOverwriteSliceImageFilter.h"
+#include "mitkImageDataItem.h"
#include "mitkBaseRenderer.h"
#include "mitkRenderingManager.h"
#include "mitkApplicationCursor.h"
#include "ipSegmentation.h"
#include "mitkRegionGrowingTool.xpm"
#include "mitkOverwriteDirectedPlaneImageFilter.h"
#include "mitkExtractDirectedPlaneImageFilterNew.h"
namespace mitk {
MITK_TOOL_MACRO(MitkExt_EXPORT, RegionGrowingTool, "Region growing tool");
}
#define ROUND(a) ((a)>0 ? (int)((a)+0.5) : -(int)(0.5-(a)))
mitk::RegionGrowingTool::RegionGrowingTool()
:FeedbackContourTool("PressMoveRelease"),
m_LowerThreshold(200),
m_UpperThreshold(200),
m_InitialLowerThreshold(200),
m_InitialUpperThreshold(200),
m_ScreenYDifference(0),
m_OriginalPicSlice(NULL),
m_SeedPointMemoryOffset(0),
m_VisibleWindow(0),
m_DefaultWindow(0),
m_MouseDistanceScaleFactor(3.0),
m_LastWorkingSeed(-1),
m_FillFeedbackContour(true)
{
}
mitk::RegionGrowingTool::~RegionGrowingTool()
{
}
const char** mitk::RegionGrowingTool::GetXPM() const
{
return mitkRegionGrowingTool_xpm;
}
const char* mitk::RegionGrowingTool::GetName() const
{
return "Region Growing";
}
void mitk::RegionGrowingTool::Activated()
{
Superclass::Activated();
}
void mitk::RegionGrowingTool::Deactivated()
{
Superclass::Deactivated();
}
/**
1 Determine which slice is clicked into
2 Determine if the user clicked inside or outside of the segmentation
3 Depending on the pixel value under the mouse click position, two different things happen: (separated out into OnMousePressedInside and OnMousePressedOutside)
3.1 Create a skeletonization of the segmentation and try to find a nice cut
3.1.1 Call a ipSegmentation algorithm to create a nice cut
3.1.2 Set the result of this algorithm as the feedback contour
3.2 Initialize region growing
3.2.1 Determine memory offset inside the original image
3.2.2 Determine initial region growing parameters from the level window settings of the image
3.2.3 Perform a region growing (which generates a new feedback contour)
*/
bool mitk::RegionGrowingTool::OnMousePressed (Action* action, const StateEvent* stateEvent)
{
//ToolLogger::SetVerboseness(3);
MITK_INFO << "OnMousePressed" << std::endl;
if (FeedbackContourTool::OnMousePressed( action, stateEvent ))
{
MITK_INFO << "OnMousePressed: FeedbackContourTool says ok" << std::endl;
// 1. Find out which slice the user clicked, find out which slice of the toolmanager's reference and working image corresponds to that
const PositionEvent* positionEvent = dynamic_cast<const PositionEvent*>(stateEvent->GetEvent());
if (positionEvent)
{
MITK_INFO << "OnMousePressed: got positionEvent" << std::endl;
m_ReferenceSlice = FeedbackContourTool::GetAffectedReferenceSlice( positionEvent );
m_WorkingSlice = FeedbackContourTool::GetAffectedWorkingSlice( positionEvent );
if ( m_WorkingSlice.IsNotNull() ) // can't do anything without the segmentation
{
MITK_INFO << "OnMousePressed: got working slice" << std::endl;
// 2. Determine if the user clicked inside or outside of the segmentation
const Geometry3D* workingSliceGeometry = m_WorkingSlice->GetGeometry();
Point3D mprojectedPointIn2D;
workingSliceGeometry->WorldToIndex( positionEvent->GetWorldPosition(), mprojectedPointIn2D);
itk::Index<2> projectedPointInWorkingSlice2D;
projectedPointInWorkingSlice2D[0] = static_cast<int>( mprojectedPointIn2D[0] - 0.5 );
projectedPointInWorkingSlice2D[1] = static_cast<int>( mprojectedPointIn2D[1] - 0.5 );
if ( workingSliceGeometry->IsIndexInside( projectedPointInWorkingSlice2D ) )
{
MITK_INFO << "OnMousePressed: point " << positionEvent->GetWorldPosition() << " (index coordinates " << projectedPointInWorkingSlice2D << ") IS in working slice" << std::endl;
// Convert to ipMITKSegmentationTYPE (because getting pixels relys on that data type)
itk::Image< ipMITKSegmentationTYPE, 2 >::Pointer correctPixelTypeImage;
CastToItkImage( m_WorkingSlice, correctPixelTypeImage );
assert (correctPixelTypeImage.IsNotNull() );
// possible bug in CastToItkImage ?
// direction maxtrix is wrong/broken/not working after CastToItkImage, leading to a failed assertion in
// mitk/Core/DataStructures/mitkSlicedGeometry3D.cpp, 479:
// virtual void mitk::SlicedGeometry3D::SetSpacing(const mitk::Vector3D&): Assertion `aSpacing[0]>0 && aSpacing[1]>0 && aSpacing[2]>0' failed
// solution here: we overwrite it with an unity matrix
itk::Image< ipMITKSegmentationTYPE, 2 >::DirectionType imageDirection;
imageDirection.SetIdentity();
correctPixelTypeImage->SetDirection(imageDirection);
Image::Pointer temporarySlice = Image::New();
// temporarySlice = ImportItkImage( correctPixelTypeImage );
CastToMitkImage( correctPixelTypeImage, temporarySlice );
mitkIpPicDescriptor* workingPicSlice = temporarySlice->GetSliceData()->GetPicDescriptor();
int initialWorkingOffset = projectedPointInWorkingSlice2D[1] * workingPicSlice->n[0] + projectedPointInWorkingSlice2D[0];
if ( initialWorkingOffset < static_cast<int>( workingPicSlice->n[0] * workingPicSlice->n[1] ) &&
initialWorkingOffset >= 0 )
{
// 3. determine the pixel value under the last click
bool inside = static_cast<ipMITKSegmentationTYPE*>(workingPicSlice->data)[initialWorkingOffset] != 0;
m_PaintingPixelValue = inside ? 0 : 1; // if inside, we want to remove a part, otherwise we want to add something
if ( m_LastWorkingSeed >= static_cast<int>( workingPicSlice->n[0] * workingPicSlice->n[1] ) ||
m_LastWorkingSeed < 0 )
{
inside = false;
}
if ( m_ReferenceSlice.IsNotNull() )
{
MITK_INFO << "OnMousePressed: got reference slice" << std::endl;
m_OriginalPicSlice = m_ReferenceSlice->GetSliceData()->GetPicDescriptor();
// 3.1. Switch depending on the pixel value
if (inside)
{
OnMousePressedInside(action, stateEvent, workingPicSlice, initialWorkingOffset);
}
else
{
OnMousePressedOutside(action, stateEvent);
}
}
}
}
}
}
}
MITK_INFO << "end OnMousePressed" << std::endl;
return true;
}
/**
3.1 Create a skeletonization of the segmentation and try to find a nice cut
3.1.1 Call a ipSegmentation algorithm to create a nice cut
3.1.2 Set the result of this algorithm as the feedback contour
*/
bool mitk::RegionGrowingTool::OnMousePressedInside(Action* itkNotUsed( action ), const StateEvent* stateEvent, mitkIpPicDescriptor* workingPicSlice, int initialWorkingOffset)
{
const PositionEvent* positionEvent = dynamic_cast<const PositionEvent*>(stateEvent->GetEvent()); // checked in OnMousePressed
// 3.1.1. Create a skeletonization of the segmentation and try to find a nice cut
// apply the skeletonization-and-cut algorithm
// generate contour to remove
// set m_ReferenceSlice = NULL so nothing will happen during mouse move
// remember to fill the contour with 0 in mouserelease
mitkIpPicDescriptor* segmentationHistory = ipMITKSegmentationCreateGrowerHistory( workingPicSlice, m_LastWorkingSeed, NULL ); // free again
if (segmentationHistory)
{
tCutResult cutContour = ipMITKSegmentationGetCutPoints( workingPicSlice, segmentationHistory, initialWorkingOffset ); // tCutResult is a ipSegmentation type
mitkIpPicFree( segmentationHistory );
if (cutContour.cutIt)
{
// 3.1.2 copy point from float* to mitk::Contour
Contour::Pointer contourInImageIndexCoordinates = Contour::New();
contourInImageIndexCoordinates->Initialize();
Point3D newPoint;
for (int index = 0; index < cutContour.deleteSize; ++index)
{
newPoint[0] = cutContour.deleteCurve[ 2 * index + 0 ];
newPoint[1] = cutContour.deleteCurve[ 2 * index + 1 ];
newPoint[2] = 0.0;
contourInImageIndexCoordinates->AddVertex( newPoint - 0.5 );
}
free(cutContour.traceline);
free(cutContour.deleteCurve); // perhaps visualize this for fun?
free(cutContour.onGradient);
Contour::Pointer contourInWorldCoordinates = FeedbackContourTool::BackProjectContourFrom2DSlice( m_WorkingSlice->GetGeometry(), contourInImageIndexCoordinates, true ); // true: sub 0.5 for ipSegmentation correction
FeedbackContourTool::SetFeedbackContour( *contourInWorldCoordinates );
FeedbackContourTool::SetFeedbackContourVisible(true);
mitk::RenderingManager::GetInstance()->RequestUpdate( positionEvent->GetSender()->GetRenderWindow() );
m_FillFeedbackContour = true;
}
else
{
m_FillFeedbackContour = false;
}
}
else
{
m_FillFeedbackContour = false;
}
m_ReferenceSlice = NULL;
return true;
}
/**
3.2 Initialize region growing
3.2.1 Determine memory offset inside the original image
3.2.2 Determine initial region growing parameters from the level window settings of the image
3.2.3 Perform a region growing (which generates a new feedback contour)
*/
bool mitk::RegionGrowingTool::OnMousePressedOutside(Action* itkNotUsed( action ), const StateEvent* stateEvent)
{
const PositionEvent* positionEvent = dynamic_cast<const PositionEvent*>(stateEvent->GetEvent()); // checked in OnMousePressed
// 3.2 If we have a reference image, then perform an initial region growing, considering the reference image's level window
// if click was outside the image, don't continue
const Geometry3D* sliceGeometry = m_ReferenceSlice->GetGeometry();
Point3D mprojectedPointIn2D;
sliceGeometry->WorldToIndex( positionEvent->GetWorldPosition(), mprojectedPointIn2D );
itk::Index<2> projectedPointIn2D;
projectedPointIn2D[0] = static_cast<int>( mprojectedPointIn2D[0] - 0.5 );
projectedPointIn2D[1] = static_cast<int>( mprojectedPointIn2D[1] - 0.5 );
if ( sliceGeometry->IsIndexInside( mprojectedPointIn2D ) )
{
MITK_INFO << "OnMousePressed: point " << positionEvent->GetWorldPosition() << " (index coordinates " << mprojectedPointIn2D << ") IS in reference slice" << std::endl;
// 3.2.1 Remember Y cursor position and initial seed point
//m_ScreenYPositionAtStart = static_cast<int>(positionEvent->GetDisplayPosition()[1]);
m_LastScreenPosition = ApplicationCursor::GetInstance()->GetCursorPosition();
m_ScreenYDifference = 0;
m_SeedPointMemoryOffset = projectedPointIn2D[1] * m_OriginalPicSlice->n[0] + projectedPointIn2D[0];
m_LastWorkingSeed = m_SeedPointMemoryOffset; // remember for skeletonization
if ( m_SeedPointMemoryOffset < static_cast<int>( m_OriginalPicSlice->n[0] * m_OriginalPicSlice->n[1] ) &&
m_SeedPointMemoryOffset >= 0 )
{
// 3.2.2 Get level window from reference DataNode
// Use some logic to determine initial gray value bounds
LevelWindow lw(0, 500);
m_ToolManager->GetReferenceData(0)->GetLevelWindow(lw); // will fill lw if levelwindow property is present, otherwise won't touch it.
m_VisibleWindow = lw.GetWindow();
// necessary for limiting the upper and lower threshold to the maximum gray values
m_DefaultWindow = lw.GetDefaultWindow();
static bool initializedAlready = false; // just evaluated once
if (!initializedAlready)
{
m_InitialLowerThreshold = static_cast<int>(m_VisibleWindow / 10.0); // 20% of the visible gray values
m_InitialUpperThreshold = static_cast<int>(m_VisibleWindow / 10.0);
initializedAlready = true;
}
m_LowerThreshold = m_InitialLowerThreshold;
m_UpperThreshold = m_InitialUpperThreshold;
DisplayGeometry* displayGeometry = positionEvent->GetSender()->GetDisplayGeometry();
if (displayGeometry)
{
m_MouseDistanceScaleFactor = m_VisibleWindow / ( 3.0 * displayGeometry->GetDisplayHeight() );
}
// 3.2.3. Actually perform region growing
mitkIpPicDescriptor* result = PerformRegionGrowingAndUpdateContour();
ipMITKSegmentationFree( result);
// display the contour
FeedbackContourTool::SetFeedbackContourVisible(true);
mitk::RenderingManager::GetInstance()->RequestUpdate(positionEvent->GetSender()->GetRenderWindow());
m_FillFeedbackContour = true;
}
}
return true;
}
/**
If in region growing mode (m_ReferenceSlice != NULL), then
1. Calculate the new thresholds from mouse position (relative to first position)
2. Perform a new region growing and update the feedback contour
*/
bool mitk::RegionGrowingTool::OnMouseMoved (Action* action, const StateEvent* stateEvent)
{
if (FeedbackContourTool::OnMouseMoved( action, stateEvent ))
{
if ( m_ReferenceSlice.IsNotNull() && m_OriginalPicSlice )
{
const PositionEvent* positionEvent = dynamic_cast<const PositionEvent*>(stateEvent->GetEvent());
if (positionEvent)
{
ApplicationCursor* cursor = ApplicationCursor::GetInstance();
if (!cursor) return false;
m_ScreenYDifference += cursor->GetCursorPosition()[1] - m_LastScreenPosition[1];
cursor->SetCursorPosition( m_LastScreenPosition );
m_LowerThreshold = m_InitialLowerThreshold + static_cast<int>( m_ScreenYDifference * m_MouseDistanceScaleFactor );
if (m_LowerThreshold < 1) m_LowerThreshold = 1;
if (m_LowerThreshold > m_VisibleWindow / 2) m_LowerThreshold = m_VisibleWindow / 2;
m_UpperThreshold = m_InitialUpperThreshold + static_cast<int>( m_ScreenYDifference * m_MouseDistanceScaleFactor );
if (m_UpperThreshold < 1) m_UpperThreshold = 1;
if (m_UpperThreshold > m_VisibleWindow / 2) m_UpperThreshold = m_VisibleWindow / 2;
//MITK_INFO << "new interval: l " << m_LowerThreshold << " u " << m_UpperThreshold << std::endl;
// 2. Perform region growing again and show the result
mitkIpPicDescriptor* result = PerformRegionGrowingAndUpdateContour();
ipMITKSegmentationFree( result );
// 3. Update the contour
mitk::RenderingManager::GetInstance()->ForceImmediateUpdate(positionEvent->GetSender()->GetRenderWindow());
}
}
}
return true;
}
/**
If the feedback contour should be filled, then it is done here. (Contour is NOT filled, when skeletonization is done but no nice cut was found)
*/
bool mitk::RegionGrowingTool::OnMouseReleased(Action* action, const StateEvent* stateEvent)
{
if (FeedbackContourTool::OnMouseReleased( action, stateEvent ))
{
// 1. If we have a working slice, use the contour to fill a new piece on segmentation on it (or erase a piece that was selected by ipMITKSegmentationGetCutPoints)
if ( m_WorkingSlice.IsNotNull() && m_OriginalPicSlice )
{
const PositionEvent* positionEvent = dynamic_cast<const PositionEvent*>(stateEvent->GetEvent());
if (positionEvent)
{
// remember parameters for next time
m_InitialLowerThreshold = m_LowerThreshold;
m_InitialUpperThreshold = m_UpperThreshold;
if (m_FillFeedbackContour)
{
// 3. use contour to fill a region in our working slice
Contour* feedbackContour( FeedbackContourTool::GetFeedbackContour() );
if (feedbackContour)
{
Contour::Pointer projectedContour = FeedbackContourTool::ProjectContourTo2DSlice( m_WorkingSlice, feedbackContour, false, false ); // false: don't add any 0.5
// false: don't constrain the contour to the image's inside
if (projectedContour.IsNotNull())
{
FeedbackContourTool::FillContourInSlice( projectedContour, m_WorkingSlice, m_PaintingPixelValue );
// 4. write working slice back into image volume
int affectedDimension( -1 );
int affectedSlice( -1 );
const PlaneGeometry* planeGeometry( dynamic_cast<const PlaneGeometry*> (positionEvent->GetSender()->GetCurrentWorldGeometry2D() ) );
FeedbackContourTool::DetermineAffectedImageSlice( dynamic_cast<Image*>( m_ToolManager->GetWorkingData(0)->GetData() ), planeGeometry, affectedDimension, affectedSlice );
MITK_INFO << "OnMouseReleased: writing back to dimension " << affectedDimension << ", slice " << affectedSlice << " in working image" << std::endl;
//If dazu gemacht
Image::Pointer workingImage = dynamic_cast<Image*>( m_ToolManager->GetWorkingData(0)->GetData() );
if ( affectedDimension != -1 )
{
OverwriteSliceImageFilter::Pointer slicewriter = OverwriteSliceImageFilter::New();
slicewriter->SetInput( workingImage );
slicewriter->SetCreateUndoInformation( true );
slicewriter->SetSliceImage( m_WorkingSlice );
slicewriter->SetSliceDimension( affectedDimension );
slicewriter->SetSliceIndex( affectedSlice );
slicewriter->SetTimeStep( positionEvent->GetSender()->GetTimeStep( workingImage ) );
slicewriter->Update();
if ( m_ToolManager->GetRememberContourPosition() )
{
this->AddContourmarker(positionEvent);
}
}
else
{
OverwriteDirectedPlaneImageFilter::Pointer slicewriter = OverwriteDirectedPlaneImageFilter::New();
slicewriter->SetInput( workingImage );
slicewriter->SetCreateUndoInformation( false );
slicewriter->SetSliceImage( m_WorkingSlice );
slicewriter->SetPlaneGeometry3D( m_WorkingSlice->GetGeometry() );
slicewriter->SetTimeStep( positionEvent->GetSender()->GetTimeStep( workingImage ) );
slicewriter->Update();
if ( m_ToolManager->GetRememberContourPosition() )
{
this->AddContourmarker(positionEvent);
}
}
}
}
}
FeedbackContourTool::SetFeedbackContourVisible(false);
mitk::RenderingManager::GetInstance()->RequestUpdate( positionEvent->GetSender()->GetRenderWindow() );
}
}
}
m_ReferenceSlice = NULL; // don't leak
m_WorkingSlice = NULL;
m_OriginalPicSlice = NULL;
return true;
}
/**
Uses ipSegmentation algorithms to do the actual region growing. The result (binary image) is first smoothed by a 5x5 circle mask, then
its contour is extracted and converted to MITK coordinates.
*/
mitkIpPicDescriptor* mitk::RegionGrowingTool::PerformRegionGrowingAndUpdateContour()
{
// 1. m_OriginalPicSlice and m_SeedPointMemoryOffset are set to sensitive values, as well as m_LowerThreshold and m_UpperThreshold
assert (m_OriginalPicSlice);
if (m_OriginalPicSlice->n[0] != 256 || m_OriginalPicSlice->n[1] != 256) // ???
assert( (m_SeedPointMemoryOffset < static_cast<int>( m_OriginalPicSlice->n[0] * m_OriginalPicSlice->n[1] )) && (m_SeedPointMemoryOffset >= 0) ); // inside the image
// 2. ipSegmentation is used to perform region growing
float ignored;
int oneContourOffset( 0 );
mitkIpPicDescriptor* regionGrowerResult = ipMITKSegmentationGrowRegion4N( m_OriginalPicSlice,
m_SeedPointMemoryOffset, // seed point
true, // grayvalue interval relative to seed point gray value?
m_LowerThreshold,
m_UpperThreshold,
0, // continue until done (maxIterations == 0)
NULL, // allocate new memory (only this time, on mouse move we'll reuse the old buffer)
oneContourOffset, // a pixel that is near the resulting contour
ignored // ignored by us
);
if (!regionGrowerResult || oneContourOffset == -1)
{
Contour::Pointer dummyContour = Contour::New();
dummyContour->Initialize();
FeedbackContourTool::SetFeedbackContour( *dummyContour );
if (regionGrowerResult) ipMITKSegmentationFree(regionGrowerResult);
return NULL;
}
// 3. We smooth the result a little to reduce contour complexity
bool smoothResult( true ); // currently fixed, perhaps remove else block
mitkIpPicDescriptor* smoothedRegionGrowerResult;
if (smoothResult)
{
// Smooth the result (otherwise very detailed contour)
smoothedRegionGrowerResult = SmoothIPPicBinaryImage( regionGrowerResult, oneContourOffset );
ipMITKSegmentationFree( regionGrowerResult );
}
else
{
smoothedRegionGrowerResult = regionGrowerResult;
}
// 4. convert the result of region growing into a mitk::Contour
// At this point oneContourOffset could be useless, if smoothing destroyed a thin bridge. In these
// cases, we have two or more unconnected segmentation regions, and we don't know, which one is touched by oneContourOffset.
// In the bad case, the contour is not the one around our seedpoint, so the result looks very strange to the user.
// -> we remove the point where the contour started so far. Then we look from the bottom of the image for the first segmentation pixel
// and start another contour extraction from there. This is done, until the seedpoint is inside the contour
int numberOfContourPoints( 0 );
int newBufferSize( 0 );
float* contourPoints = ipMITKSegmentationGetContour8N( smoothedRegionGrowerResult, oneContourOffset, numberOfContourPoints, newBufferSize ); // memory allocated with malloc
if (contourPoints)
{
while ( !ipMITKSegmentationIsInsideContour( contourPoints, // contour
numberOfContourPoints, // points in contour
m_SeedPointMemoryOffset % smoothedRegionGrowerResult->n[0], // test point x
m_SeedPointMemoryOffset / smoothedRegionGrowerResult->n[0] // test point y
) )
{
// we decide that this cannot be part of the segmentation because the seedpoint is not contained in the contour (fill the 4-neighborhood with 0)
ipMITKSegmentationReplaceRegion4N( smoothedRegionGrowerResult, oneContourOffset, 0 );
// move the contour offset to the last row (x position of the seed point)
int rowLength = smoothedRegionGrowerResult->n[0]; // number of pixels in a row
oneContourOffset = m_SeedPointMemoryOffset % smoothedRegionGrowerResult->n[0] // x of seed point
+ rowLength*(smoothedRegionGrowerResult->n[1]-1); // y of last row
while ( oneContourOffset >=0
&& (*(static_cast<ipMITKSegmentationTYPE*>(smoothedRegionGrowerResult->data) + oneContourOffset) == 0) )
{
oneContourOffset -= rowLength; // if pixel at data+oneContourOffset is 0, then move up one row
}
if ( oneContourOffset < 0 )
{
break; // just use the last contour we found
}
free(contourPoints); // release contour memory
contourPoints = ipMITKSegmentationGetContour8N( smoothedRegionGrowerResult, oneContourOffset, numberOfContourPoints, newBufferSize ); // memory allocated with malloc
}
// copy point from float* to mitk::Contour
Contour::Pointer contourInImageIndexCoordinates = Contour::New();
contourInImageIndexCoordinates->Initialize();
Point3D newPoint;
for (int index = 0; index < numberOfContourPoints; ++index)
{
newPoint[0] = contourPoints[ 2 * index + 0 ];
newPoint[1] = contourPoints[ 2 * index + 1 ];
newPoint[2] = 0;
contourInImageIndexCoordinates->AddVertex( newPoint - 0.5);
}
free(contourPoints);
Contour::Pointer contourInWorldCoordinates = FeedbackContourTool::BackProjectContourFrom2DSlice( m_ReferenceSlice->GetGeometry(), contourInImageIndexCoordinates, true ); // true: sub 0.5 for ipSegmentation correctio
FeedbackContourTool::SetFeedbackContour( *contourInWorldCoordinates );
}
// 5. Result HAS TO BE freed by caller, contains the binary region growing result
return smoothedRegionGrowerResult;
}
/**
Helper method for SmoothIPPicBinaryImage. Smoothes a given part of and image.
\param sourceImage The original binary image.
\param dest The smoothed image (will be written without bounds checking).
\param contourOfs One offset of the contour. Is updated if a pixel is changed (which might change the contour).
\param maskOffsets Memory offsets that describe the smoothing mask.
\param maskSize Entries of the mask.
\param startOffset First pixel that should be smoothed using this mask.
\param endOffset Last pixel that should be smoothed using this mask.
*/
void mitk::RegionGrowingTool::SmoothIPPicBinaryImageHelperForRows( mitkIpPicDescriptor* sourceImage, mitkIpPicDescriptor* dest, int &contourOfs, int* maskOffsets, int maskSize, int startOffset, int endOffset )
{
// work on the very first row
ipMITKSegmentationTYPE* current;
ipMITKSegmentationTYPE* source = ((ipMITKSegmentationTYPE*)sourceImage->data) + startOffset; // + 1! don't read at start-1
ipMITKSegmentationTYPE* end = ((ipMITKSegmentationTYPE*)dest->data) + endOffset;
int ofs = startOffset;
int minority = (maskSize - 1) / 2;
for (current = ((ipMITKSegmentationTYPE*)dest->data) + startOffset; current<end; current++)
{
mitkIpInt1_t sum( 0 );
for (int i = 0; i < maskSize; ++i)
{
sum += *(source+maskOffsets[i]);
}
if (sum > minority)
{
*current = 1;
contourOfs = ofs;
}
else
{
*current = 0;
}
++source;
++ofs;
}
}
/**
Smoothes a binary ipPic image with a 5x5 mask. The image borders (some first and last rows) are treated differently.
*/
mitkIpPicDescriptor* mitk::RegionGrowingTool::SmoothIPPicBinaryImage( mitkIpPicDescriptor* image, int &contourOfs, mitkIpPicDescriptor* dest )
{
if (!image) return NULL;
// Original code from /trunk/mbi-qm/Qmitk/Qmitk2DSegTools/RegionGrowerTool.cpp (first version by T. Boettger?). Reformatted and documented and restructured.
#define MSK_SIZE5x5 21
#define MSK_SIZE3x3 5
#define MSK_SIZE3x1 3
// mask is an array of coordinates that form a rastered circle like this
//
// OOO
// OOOOO
// OOOOO
// OOOOO
// OOO
//
//
int mask5x5[MSK_SIZE5x5][2]
= {
/******/ {-1,-2}, {0,-2}, {1,-2}, /*****/
{-2,-1}, {-1,-1}, {0,-1}, {1,-1}, {2,-1},
{-2, 0}, {-1, 0}, {0, 0}, {1, 0}, {2, 0},
{-2, 1}, {-1, 1}, {0, 1}, {1, 1}, {2, 1},
/******/ {-1, 2}, {0, 2}, {1, 2} /*****/
};
int mask3x3[MSK_SIZE3x3][2]
= {
/******/ {0,-1}, /*****/
{-1, 0}, {0, 0}, {1, 0},
/******/ {0, 1} /*****/
};
int mask3x1[MSK_SIZE3x1][2]
= {
{-1, 0}, {0, 0}, {1, 0}
};
// The following lines iterate over all the pixels of a (sliced) image (except the first and last three rows).
// For each pixel, all the coordinates around it (according to mask) are evaluated (this means 21 pixels).
// If more than 10 of the evaluated pixels are non-zero, then the central pixel is set to 1, else to 0.
// This is determining a majority. If there is no clear majority, then the central pixel itself "decides".
int maskOffset5x5[MSK_SIZE5x5];
int line = image->n[0];
for (int i=0; i<MSK_SIZE5x5; i++)
{
maskOffset5x5[i] = mask5x5[i][0] + line * mask5x5[i][1]; // calculate memory offsets from the x,y mask elements
}
int maskOffset3x3[MSK_SIZE3x3];
for (int i=0; i<MSK_SIZE3x3; i++)
{
maskOffset3x3[i] = mask3x3[i][0] + line * mask3x3[i][1]; // calculate memory offsets from the x,y mask elements
}
int maskOffset3x1[MSK_SIZE3x1];
for (int i=0; i<MSK_SIZE3x1; i++)
{
maskOffset3x1[i] = mask3x1[i][0] + line * mask3x1[i][1]; // calculate memory offsets from the x,y mask elements
}
if (!dest)
{
// create pic if necessary
dest = ipMITKSegmentationNew( image );
}
int spareOut3Rows = 3*image->n[0];
int spareOut1Rows = 1*image->n[0];
if ( image->n[1] > 0 ) SmoothIPPicBinaryImageHelperForRows( image, dest, contourOfs, maskOffset3x1, MSK_SIZE3x1, 1, dest->n[0] );
if ( image->n[1] > 3 ) SmoothIPPicBinaryImageHelperForRows( image, dest, contourOfs, maskOffset3x3, MSK_SIZE3x3, spareOut1Rows, dest->n[0]*3 );
if ( image->n[1] > 6 ) SmoothIPPicBinaryImageHelperForRows( image, dest, contourOfs, maskOffset5x5, MSK_SIZE5x5, spareOut3Rows, dest->n[0]*dest->n[1] - spareOut3Rows );
if ( image->n[1] > 8 ) SmoothIPPicBinaryImageHelperForRows( image, dest, contourOfs, maskOffset3x3, MSK_SIZE3x3, dest->n[0]*dest->n[1] -spareOut3Rows, dest->n[0]*dest->n[1] - spareOut1Rows );
if ( image->n[1] > 10) SmoothIPPicBinaryImageHelperForRows( image, dest, contourOfs, maskOffset3x1, MSK_SIZE3x1, dest->n[0]*dest->n[1] -spareOut1Rows, dest->n[0]*dest->n[1] - 1 );
// correction for first pixel (sorry for the ugliness)
if ( *((ipMITKSegmentationTYPE*)(dest->data)+1) == 1 )
{
*((ipMITKSegmentationTYPE*)(dest->data)+0) = 1;
}
if (dest->n[0] * dest->n[1] > 2)
{
// correction for last pixel
if ( *((ipMITKSegmentationTYPE*)(dest->data)+dest->n[0]*dest->n[1]-2) == 1 )
{
*((ipMITKSegmentationTYPE*)(dest->data)+dest->n[0]*dest->n[1]-1) = 1;
}
}
return dest;
}
diff --git a/Modules/MitkExt/Interactions/mitkSetRegionTool.cpp b/Modules/MitkExt/Interactions/mitkSetRegionTool.cpp
index 0b054eedf1..cc442927ac 100644
--- a/Modules/MitkExt/Interactions/mitkSetRegionTool.cpp
+++ b/Modules/MitkExt/Interactions/mitkSetRegionTool.cpp
@@ -1,351 +1,352 @@
/*=========================================================================
Program: Medical Imaging & Interaction Toolkit
Language: C++
Date: $Date$
Version: $Revision$
Copyright (c) German Cancer Research Center, Division of Medical and
Biological Informatics. All rights reserved.
See MITKCopyright.txt or http://www.mitk.org/copyright.html for details.
This software is distributed WITHOUT ANY WARRANTY; without even
the implied warranty of MERCHANTABILITY or FITNESS FOR A PARTICULAR
PURPOSE. See the above copyright notices for more information.
=========================================================================*/
#include "mitkSetRegionTool.h"
#include "mitkToolManager.h"
#include "mitkOverwriteSliceImageFilter.h"
#include "ipSegmentation.h"
#include "mitkBaseRenderer.h"
+#include "mitkImageDataItem.h"
#include "mitkOverwriteDirectedPlaneImageFilter.h"
mitk::SetRegionTool::SetRegionTool(int paintingPixelValue)
:FeedbackContourTool("PressMoveReleaseWithCTRLInversion"),
m_PaintingPixelValue(paintingPixelValue),
m_FillContour(false),
m_StatusFillWholeSlice(false)
{
}
mitk::SetRegionTool::~SetRegionTool()
{
}
void mitk::SetRegionTool::Activated()
{
Superclass::Activated();
}
void mitk::SetRegionTool::Deactivated()
{
Superclass::Deactivated();
}
bool mitk::SetRegionTool::OnMousePressed (Action* action, const StateEvent* stateEvent)
{
if (!FeedbackContourTool::OnMousePressed( action, stateEvent )) return false;
const PositionEvent* positionEvent = dynamic_cast<const PositionEvent*>(stateEvent->GetEvent());
if (!positionEvent) return false;
// 1. Get the working image
Image::Pointer workingSlice = FeedbackContourTool::GetAffectedWorkingSlice( positionEvent );
if ( workingSlice.IsNull() ) return false; // can't do anything without the segmentation
// if click was outside the image, don't continue
const Geometry3D* sliceGeometry = workingSlice->GetGeometry();
itk::Index<2> projectedPointIn2D;
sliceGeometry->WorldToIndex( positionEvent->GetWorldPosition(), projectedPointIn2D );
if ( !sliceGeometry->IsIndexInside( projectedPointIn2D ) )
{
MITK_ERROR << "point apparently not inside segmentation slice" << std::endl;
return false; // can't use that as a seed point
}
// Convert to ipMITKSegmentationTYPE (because ipMITKSegmentationGetContour8N relys on that data type)
itk::Image< ipMITKSegmentationTYPE, 2 >::Pointer correctPixelTypeImage;
CastToItkImage( workingSlice, correctPixelTypeImage );
assert (correctPixelTypeImage.IsNotNull() );
// possible bug in CastToItkImage ?
// direction maxtrix is wrong/broken/not working after CastToItkImage, leading to a failed assertion in
// mitk/Core/DataStructures/mitkSlicedGeometry3D.cpp, 479:
// virtual void mitk::SlicedGeometry3D::SetSpacing(const mitk::Vector3D&): Assertion `aSpacing[0]>0 && aSpacing[1]>0 && aSpacing[2]>0' failed
// solution here: we overwrite it with an unity matrix
itk::Image< ipMITKSegmentationTYPE, 2 >::DirectionType imageDirection;
imageDirection.SetIdentity();
correctPixelTypeImage->SetDirection(imageDirection);
Image::Pointer temporarySlice = Image::New();
// temporarySlice = ImportItkImage( correctPixelTypeImage );
CastToMitkImage( correctPixelTypeImage, temporarySlice );
// check index positions
mitkIpPicDescriptor* originalPicSlice = temporarySlice->GetSliceData()->GetPicDescriptor();
int m_SeedPointMemoryOffset = projectedPointIn2D[1] * originalPicSlice->n[0] + projectedPointIn2D[0];
if ( m_SeedPointMemoryOffset >= static_cast<int>( originalPicSlice->n[0] * originalPicSlice->n[1] ) ||
m_SeedPointMemoryOffset < 0 )
{
MITK_ERROR << "Memory offset calculation if mitk::SetRegionTool has some serious flaw! Aborting.." << std::endl;
return false;
}
// 2. Determine the contour that surronds the selected "piece of the image"
// find a contour seed point
unsigned int oneContourOffset = static_cast<unsigned int>( m_SeedPointMemoryOffset ); // safe because of earlier check if m_SeedPointMemoryOffset < 0
/**
* The logic of finding a starting point for the contour is the following:
*
* - If the initial seed point is 0, we are either inside a hole or outside of every segmentation.
* We move to the right until we hit a 1, which must be part of a contour.
*
* - If the initial seed point is 1, then ...
* we now do the same (running to the right) until we hit a 1
*
* In both cases the found contour point is used to extract a contour and
* then a test is applied to find out if the initial seed point is contained
* in the contour. If this is the case, filling should be applied, otherwise
* nothing is done.
*/
unsigned int size = originalPicSlice->n[0] * originalPicSlice->n[1];
/*
unsigned int rowSize = originalPicSlice->n[0];
*/
ipMITKSegmentationTYPE* data = static_cast<ipMITKSegmentationTYPE*>(originalPicSlice->data);
if ( data[oneContourOffset] == 0 ) // initial seed 0
{
for ( ; oneContourOffset < size; ++oneContourOffset )
{
if ( data[oneContourOffset] > 0 ) break;
}
}
else if ( data[oneContourOffset] == 1 ) // initial seed 1
{
unsigned int lastValidPixel = size-1; // initialization, will be changed lateron
bool inSeg = true; // inside segmentation?
for ( ; oneContourOffset < size; ++oneContourOffset )
{
if ( ( data[oneContourOffset] == 0 ) && inSeg ) // pixel 0 and inside-flag set: this happens at the first pixel outside a filled region
{
inSeg = false;
lastValidPixel = oneContourOffset - 1; // store the last pixel position inside a filled region
break;
}
else // pixel 1, inside-flag doesn't matter: this happens while we are inside a filled region
{
inSeg = true; // first iteration lands here
}
}
oneContourOffset = lastValidPixel;
}
else
{
MITK_ERROR << "Fill/Erase was never intended to work with other than binary images." << std::endl;
m_FillContour = false;
return false;
}
if (oneContourOffset == size) // nothing found until end of slice
{
m_FillContour = false;
return false;
}
int numberOfContourPoints( 0 );
int newBufferSize( 0 );
//MITK_INFO << "getting contour from offset " << oneContourOffset << " ("<<oneContourOffset%originalPicSlice->n[0]<<","<<oneContourOffset/originalPicSlice->n[0]<<")"<<std::endl;
float* contourPoints = ipMITKSegmentationGetContour8N( originalPicSlice, oneContourOffset, numberOfContourPoints, newBufferSize ); // memory allocated with malloc
//MITK_INFO << "contourPoints " << contourPoints << " (N="<<numberOfContourPoints<<")"<<std::endl;
assert(contourPoints == NULL || numberOfContourPoints > 0);
bool cursorInsideContour = ipMITKSegmentationIsInsideContour( contourPoints, numberOfContourPoints, projectedPointIn2D[0], projectedPointIn2D[1]);
// decide if contour should be filled or not
m_FillContour = cursorInsideContour;
if (m_FillContour)
{
// copy point from float* to mitk::Contour
Contour::Pointer contourInImageIndexCoordinates = Contour::New();
contourInImageIndexCoordinates->Initialize();
Point3D newPoint;
for (int index = 0; index < numberOfContourPoints; ++index)
{
newPoint[0] = contourPoints[ 2 * index + 0 ];
newPoint[1] = contourPoints[ 2 * index + 1];
newPoint[2] = 0;
contourInImageIndexCoordinates->AddVertex( newPoint - 0.5 );
}
m_SegmentationContourInWorldCoordinates = FeedbackContourTool::BackProjectContourFrom2DSlice( workingSlice->GetGeometry(), contourInImageIndexCoordinates, true ); // true, correct the result from ipMITKSegmentationGetContour8N
// 3. Show the contour
FeedbackContourTool::SetFeedbackContour( *m_SegmentationContourInWorldCoordinates );
FeedbackContourTool::SetFeedbackContourVisible(true);
mitk::RenderingManager::GetInstance()->RequestUpdate(positionEvent->GetSender()->GetRenderWindow());
}
// always generate a second contour, containing the whole image (used when CTRL is pressed)
{
// copy point from float* to mitk::Contour
Contour::Pointer contourInImageIndexCoordinates = Contour::New();
contourInImageIndexCoordinates->Initialize();
Point3D newPoint;
newPoint[0] = 0; newPoint[1] = 0; newPoint[2] = 0.0;
contourInImageIndexCoordinates->AddVertex( newPoint );
newPoint[0] = originalPicSlice->n[0]; newPoint[1] = 0; newPoint[2] = 0.0;
contourInImageIndexCoordinates->AddVertex( newPoint );
newPoint[0] = originalPicSlice->n[0]; newPoint[1] = originalPicSlice->n[1]; newPoint[2] = 0.0;
contourInImageIndexCoordinates->AddVertex( newPoint );
newPoint[0] = 0; newPoint[1] = originalPicSlice->n[1]; newPoint[2] = 0.0;
contourInImageIndexCoordinates->AddVertex( newPoint );
m_WholeImageContourInWorldCoordinates = FeedbackContourTool::BackProjectContourFrom2DSlice( workingSlice->GetGeometry(), contourInImageIndexCoordinates, true ); // true, correct the result from ipMITKSegmentationGetContour8N
// 3. Show the contour
FeedbackContourTool::SetFeedbackContour( *m_SegmentationContourInWorldCoordinates );
FeedbackContourTool::SetFeedbackContourVisible(true);
mitk::RenderingManager::GetInstance()->RequestUpdate(positionEvent->GetSender()->GetRenderWindow());
}
free(contourPoints);
return true;
}
bool mitk::SetRegionTool::OnMouseReleased(Action* action, const StateEvent* stateEvent)
{
// 1. Hide the feedback contour, find out which slice the user clicked, find out which slice of the toolmanager's working image corresponds to that
FeedbackContourTool::SetFeedbackContourVisible(false);
const PositionEvent* positionEvent = dynamic_cast<const PositionEvent*>(stateEvent->GetEvent());
if (!positionEvent) return false;
assert( positionEvent->GetSender()->GetRenderWindow() );
mitk::RenderingManager::GetInstance()->RequestUpdate(positionEvent->GetSender()->GetRenderWindow());
if (!m_FillContour && !m_StatusFillWholeSlice) return true;
if (!FeedbackContourTool::OnMouseReleased( action, stateEvent )) return false;
DataNode* workingNode( m_ToolManager->GetWorkingData(0) );
if (!workingNode) return false;
Image* image = dynamic_cast<Image*>(workingNode->GetData());
const PlaneGeometry* planeGeometry( dynamic_cast<const PlaneGeometry*> (positionEvent->GetSender()->GetCurrentWorldGeometry2D() ) );
if ( !image || !planeGeometry ) return false;
int affectedDimension( -1 );
int affectedSlice( -1 );
FeedbackContourTool::DetermineAffectedImageSlice( image, planeGeometry, affectedDimension, affectedSlice );
Image::Pointer slice = FeedbackContourTool::GetAffectedImageSliceAs2DImage( positionEvent, image );
if ( slice.IsNull() )
{
MITK_ERROR << "Unable to extract slice." << std::endl;
return false;
}
Contour* feedbackContour( FeedbackContourTool::GetFeedbackContour() );
Contour::Pointer projectedContour = FeedbackContourTool::ProjectContourTo2DSlice( slice, feedbackContour, false, false ); // false: don't add 0.5 (done by FillContourInSlice)
// false: don't constrain the contour to the image's inside
if (projectedContour.IsNull()) return false;
FeedbackContourTool::FillContourInSlice( projectedContour, slice, m_PaintingPixelValue );
if ( affectedDimension != -1 )
{
// 5. Write the modified 2D working data slice back into the image
OverwriteSliceImageFilter::Pointer slicewriter = OverwriteSliceImageFilter::New();
slicewriter->SetInput( image );
slicewriter->SetCreateUndoInformation( true );
slicewriter->SetSliceImage( slice );
slicewriter->SetSliceDimension( affectedDimension );
slicewriter->SetSliceIndex( affectedSlice );
slicewriter->SetTimeStep( positionEvent->GetSender()->GetTimeStep( image ) );
slicewriter->Update();
if ( m_ToolManager->GetRememberContourPosition() )
{
this->AddContourmarker(positionEvent);
}
}
else if ( affectedDimension == -1 )
{
OverwriteDirectedPlaneImageFilter::Pointer slicewriter = OverwriteDirectedPlaneImageFilter::New();
slicewriter->SetInput( image );
slicewriter->SetCreateUndoInformation( false );
slicewriter->SetSliceImage( slice );
slicewriter->SetPlaneGeometry3D( slice->GetGeometry() );
slicewriter->SetTimeStep( positionEvent->GetSender()->GetTimeStep( image ) );
slicewriter->Update();
if ( m_ToolManager->GetRememberContourPosition() )
{
this->AddContourmarker(positionEvent);
}
}
else
{
MITK_ERROR << "FeedbackContourTool could not determine which slice of the image you are drawing on." << std::endl;
}
// 6. Make sure the result is drawn again --> is visible then.
assert( positionEvent->GetSender()->GetRenderWindow() );
mitk::RenderingManager::GetInstance()->RequestUpdate(positionEvent->GetSender()->GetRenderWindow());
m_WholeImageContourInWorldCoordinates = NULL;
m_SegmentationContourInWorldCoordinates = NULL;
return true;
}
/**
Called when the CTRL key is pressed. Will change the painting pixel value from 0 to 1 or from 1 to 0.
*/
bool mitk::SetRegionTool::OnInvertLogic(Action* action, const StateEvent* stateEvent)
{
if (!FeedbackContourTool::OnInvertLogic(action, stateEvent)) return false;
const PositionEvent* positionEvent = dynamic_cast<const PositionEvent*>(stateEvent->GetEvent());
if (!positionEvent) return false;
if (m_StatusFillWholeSlice)
{
// use contour extracted from image data
if (m_SegmentationContourInWorldCoordinates.IsNotNull())
FeedbackContourTool::SetFeedbackContour( *m_SegmentationContourInWorldCoordinates );
mitk::RenderingManager::GetInstance()->RequestUpdate(positionEvent->GetSender()->GetRenderWindow());
}
else
{
// use some artificial contour
if (m_WholeImageContourInWorldCoordinates.IsNotNull())
FeedbackContourTool::SetFeedbackContour( *m_WholeImageContourInWorldCoordinates );
mitk::RenderingManager::GetInstance()->RequestUpdate(positionEvent->GetSender()->GetRenderWindow());
}
m_StatusFillWholeSlice = !m_StatusFillWholeSlice;
return true;
}
diff --git a/Modules/MitkExt/Rendering/mitkContourSetVtkMapper3D.cpp b/Modules/MitkExt/Rendering/mitkContourSetVtkMapper3D.cpp
index 34605a1209..aa364badcd 100644
--- a/Modules/MitkExt/Rendering/mitkContourSetVtkMapper3D.cpp
+++ b/Modules/MitkExt/Rendering/mitkContourSetVtkMapper3D.cpp
@@ -1,163 +1,163 @@
/*=========================================================================
Program: Medical Imaging & Interaction Toolkit
Language: C++
Date: $Date$
Version: $Revision$
Copyright (c) German Cancer Research Center, Division of Medical and
Biological Informatics. All rights reserved.
See MITKCopyright.txt or http://www.mitk.org/copyright.html for details.
This software is distributed WITHOUT ANY WARRANTY; without even
the implied warranty of MERCHANTABILITY or FITNESS FOR A PARTICULAR
PURPOSE. See the above copyright notices for more information.
=========================================================================*/
#include "mitkContourSetVtkMapper3D.h"
#include "mitkDataNode.h"
#include "mitkProperties.h"
#include "mitkColorProperty.h"
#include "mitkVtkPropRenderer.h"
#include <vtkActor.h>
#include <vtkActor.h>
#include <vtkCellArray.h>
#include <vtkAppendPolyData.h>
#include <vtkPolyData.h>
#include <vtkPolyDataMapper.h>
#include <vtkFollower.h>
#include <vtkAssembly.h>
#include <vtkProp3DCollection.h>
#include <vtkRenderer.h>
#include <vtkLinearTransform.h>
#include <vtkTubeFilter.h>
#include <vtkPolygon.h>
#include <vtkProperty.h>
#include <vtkPolyDataMapper.h>
#include <stdlib.h>
mitk::ContourSetVtkMapper3D::ContourSetVtkMapper3D()
{
m_VtkPolyDataMapper = vtkPolyDataMapper::New();
m_Actor = vtkActor::New();
m_Actor->SetMapper(m_VtkPolyDataMapper);
m_ContourSet = vtkPolyData::New();
m_TubeFilter = vtkTubeFilter::New();
}
mitk::ContourSetVtkMapper3D::~ContourSetVtkMapper3D()
{
if( m_VtkPolyDataMapper )
m_VtkPolyDataMapper->Delete();;
if( m_TubeFilter )
m_TubeFilter->Delete();;
if( m_ContourSet )
m_ContourSet->Delete();;
if( m_Actor )
m_Actor->Delete();;
}
vtkProp* mitk::ContourSetVtkMapper3D::GetVtkProp(mitk::BaseRenderer* /*renderer*/)
{
return m_Actor;
}
-void mitk::ContourSetVtkMapper3D::GenerateData(mitk::BaseRenderer* renderer)
+void mitk::ContourSetVtkMapper3D::GenerateDataForRenderer(mitk::BaseRenderer* renderer)
{
if(IsVisible(renderer)==false)
{
m_Actor->VisibilityOff();
return;
}
m_Actor->VisibilityOn();
mitk::ContourSet::Pointer input = const_cast<mitk::ContourSet*>(this->GetInput());
if ( renderer->GetDisplayGeometryUpdateTime() > this->GetInput()->GetMTime() )
{
m_ContourSet = vtkPolyData::New();
vtkPoints *points = vtkPoints::New();
vtkCellArray *lines = vtkCellArray::New();
mitk::ContourSet::Pointer input = const_cast<mitk::ContourSet*>(this->GetInput());
mitk::ContourSet::ContourVectorType contourVec = input->GetContours();
mitk::ContourSet::ContourIterator contourIt = contourVec.begin();
vtkIdType firstPointIndex= 0, lastPointIndex=0;
vtkIdType ptIndex = 0;
while ( contourIt != contourVec.end() )
{
mitk::Contour* nextContour = (mitk::Contour*) (*contourIt).second;
Contour::InputType idx = nextContour->GetContourPath()->StartOfInput();
Contour::InputType end = nextContour->GetContourPath()->EndOfInput();
if (end > 50000) end = 0;
mitk::Contour::PointsContainerPointer contourPoints = nextContour->GetPoints();
mitk::Contour::PointsContainerIterator pointsIt = contourPoints->Begin();
unsigned int counter = 0;
firstPointIndex=ptIndex;
while ( pointsIt != contourPoints->End() )
{
if (counter %2 == 0)
{
Contour::BoundingBoxType::PointType point;
point = pointsIt.Value();
points->InsertPoint(ptIndex, point[0],point[1],point[2]);
if (ptIndex > firstPointIndex)
{
int cell[2] = {ptIndex-1,ptIndex};
lines->InsertNextCell((vtkIdType)2,(vtkIdType*) cell);
}
lastPointIndex=ptIndex;
ptIndex++;
}
pointsIt++;
idx+=1;
}
if (nextContour->GetClosed())
{
int cell[2] = {lastPointIndex,firstPointIndex};
lines->InsertNextCell((vtkIdType)2,(vtkIdType*) cell);
}
contourIt++;
}
m_ContourSet->SetPoints(points);
m_ContourSet->SetLines(lines);
m_ContourSet->Update();
m_TubeFilter->SetInput(m_ContourSet);
m_TubeFilter->SetRadius(1);
m_TubeFilter->Update();
m_VtkPolyDataMapper->SetInput(m_TubeFilter->GetOutput());
vtkFloatingPointType rgba[4]={0.0f,1.0f,0.0f,0.6f};
m_Actor->GetProperty()->SetColor(rgba);
m_Actor->SetMapper(m_VtkPolyDataMapper);
}
SetVtkMapperImmediateModeRendering(m_VtkPolyDataMapper);
}
const mitk::ContourSet* mitk::ContourSetVtkMapper3D::GetInput()
{
return static_cast<const mitk::ContourSet* > ( GetData() );
}
diff --git a/Modules/MitkExt/Rendering/mitkContourSetVtkMapper3D.h b/Modules/MitkExt/Rendering/mitkContourSetVtkMapper3D.h
index c291da3f54..c1d21e9c4e 100644
--- a/Modules/MitkExt/Rendering/mitkContourSetVtkMapper3D.h
+++ b/Modules/MitkExt/Rendering/mitkContourSetVtkMapper3D.h
@@ -1,70 +1,70 @@
/*=========================================================================
Program: Medical Imaging & Interaction Toolkit
Language: C++
Date: $Date$
Version: $Revision$
Copyright (c) German Cancer Research Center, Division of Medical and
Biological Informatics. All rights reserved.
See MITKCopyright.txt or http://www.mitk.org/copyright.html for details.
This software is distributed WITHOUT ANY WARRANTY; without even
the implied warranty of MERCHANTABILITY or FITNESS FOR A PARTICULAR
PURPOSE. See the above copyright notices for more information.
=========================================================================*/
#ifndef MITK_CONTOUR_SET_VTK_MAPPER_3D_H
#define MITK_CONTOUR_SET_VTK_MAPPER_3D_H
#include "mitkCommon.h"
#include "MitkExtExports.h"
#include "mitkVtkMapper3D.h"
#include "mitkContourSet.h"
#include "mitkBaseRenderer.h"
#include <vtkPolyData.h>
class vtkPolyDataMapper;
class vtkAppendPolyData;
class vtkActor;
class vtkTubeFilter;
namespace mitk {
//##Documentation
//## @brief Vtk-based mapper for mitk::Contour
//## @ingroup Mapper
class MitkExt_EXPORT ContourSetVtkMapper3D : public VtkMapper3D
{
public:
mitkClassMacro(ContourSetVtkMapper3D, VtkMapper3D);
itkNewMacro(Self);
virtual const mitk::ContourSet* GetInput();
virtual vtkProp* GetVtkProp(mitk::BaseRenderer* renderer);
protected:
ContourSetVtkMapper3D();
virtual ~ContourSetVtkMapper3D();
- virtual void GenerateData(mitk::BaseRenderer* renderer);
+ virtual void GenerateDataForRenderer(mitk::BaseRenderer* renderer);
vtkPolyDataMapper* m_VtkPolyDataMapper;
vtkTubeFilter* m_TubeFilter;
vtkPolyData *m_ContourSet;
vtkActor *m_Actor;
};
} // namespace mitk
#endif // MITK_CONTOUR_VTK_MAPPER_3D_H
diff --git a/Modules/MitkExt/Rendering/mitkContourVtkMapper3D.cpp b/Modules/MitkExt/Rendering/mitkContourVtkMapper3D.cpp
index 555ada0468..8e7081a0f4 100644
--- a/Modules/MitkExt/Rendering/mitkContourVtkMapper3D.cpp
+++ b/Modules/MitkExt/Rendering/mitkContourVtkMapper3D.cpp
@@ -1,181 +1,181 @@
/*=========================================================================
Program: Medical Imaging & Interaction Toolkit
Language: C++
Date: $Date$
Version: $Revision$
Copyright (c) German Cancer Research Center, Division of Medical and
Biological Informatics. All rights reserved.
See MITKCopyright.txt or http://www.mitk.org/copyright.html for details.
This software is distributed WITHOUT ANY WARRANTY; without even
the implied warranty of MERCHANTABILITY or FITNESS FOR A PARTICULAR
PURPOSE. See the above copyright notices for more information.
=========================================================================*/
#include "mitkContourVtkMapper3D.h"
#include "mitkDataNode.h"
#include "mitkProperties.h"
#include "mitkColorProperty.h"
#include "mitkVtkPropRenderer.h"
#include "mitkContour.h"
#include <vtkActor.h>
#include <vtkAppendPolyData.h>
#include <vtkAssembly.h>
#pragma GCC diagnostic ignored "-Wstrict-aliasing"
#include <vtkCellArray.h>
#pragma GCC diagnostic warning "-Wstrict-aliasing"
#include <vtkFollower.h>
#include <vtkLinearTransform.h>
#include <vtkPolyData.h>
#include <vtkPolyDataMapper.h>
#include <vtkPolygon.h>
#include <vtkProp3DCollection.h>
#include <vtkProperty.h>
#include <vtkRenderer.h>
#include <vtkSphereSource.h>
#include <vtkTubeFilter.h>
mitk::ContourVtkMapper3D::ContourVtkMapper3D()
{
m_VtkPolyDataMapper = vtkPolyDataMapper::New();
m_VtkPointList = vtkAppendPolyData::New();
m_Actor = vtkActor::New();
m_Actor->SetMapper(m_VtkPolyDataMapper);
m_TubeFilter = vtkTubeFilter::New();
}
mitk::ContourVtkMapper3D::~ContourVtkMapper3D()
{
if(m_VtkPolyDataMapper)
m_VtkPolyDataMapper->Delete();
if(m_TubeFilter)
m_TubeFilter->Delete();
if(m_VtkPointList)
m_VtkPointList->Delete();
if(m_Contour)
m_Contour->Delete();
if(m_Actor)
m_Actor->Delete();
}
vtkProp* mitk::ContourVtkMapper3D::GetVtkProp(mitk::BaseRenderer* /*renderer*/)
{
return m_Actor;
}
-void mitk::ContourVtkMapper3D::GenerateData(mitk::BaseRenderer* renderer)
+void mitk::ContourVtkMapper3D::GenerateDataForRenderer(mitk::BaseRenderer* renderer)
{
if ( IsVisible(renderer)==false )
{
m_Actor->VisibilityOff();
return;
}
m_Actor->VisibilityOn();
m_Contour = vtkPolyData::New();
mitk::Contour::Pointer input = const_cast<mitk::Contour*>(this->GetInput());
bool makeContour = true;
if ( makeContour )
{
vtkSmartPointer<vtkPoints> points = vtkSmartPointer<vtkPoints>::New();
vtkSmartPointer<vtkCellArray> lines = vtkSmartPointer<vtkCellArray>::New();
int numPts=input->GetNumberOfPoints();
if ( numPts > 200000 )
numPts = 200000;
mitk::Contour::PathPointer path = input->GetContourPath();
mitk::Contour::PathType::InputType cstart = path->StartOfInput();
mitk::Contour::PathType::InputType cend = path->EndOfInput();
mitk::Contour::PathType::InputType cstep = (cend-cstart+1)/numPts;
mitk::Contour::PathType::InputType ccur;
vtkIdType ptIndex = 0;
vtkIdType lastPointIndex = 0;
mitk::Contour::PointsContainerPointer contourPoints = input->GetPoints();
mitk::Contour::PointsContainerIterator pointsIt = contourPoints->Begin();
vtkFloatingPointType vtkpoint[3];
int i;
float pointSize = 2;
this->GetDataNode()->GetFloatProperty("spheres size", pointSize);
bool showPoints = true;
this->GetDataNode()->GetBoolProperty("show points", showPoints);
if ( showPoints )
{
m_VtkPointList = vtkAppendPolyData::New();
}
for ( i=0, ccur=cstart; i<numPts; ++i, ccur+=cstep )
{
itk2vtk(path->Evaluate(ccur), vtkpoint);
points->InsertPoint(ptIndex, vtkpoint);
if ( ptIndex > 0 )
{
int cell[2] = {ptIndex-1,ptIndex};
lines->InsertNextCell((vtkIdType)2,(vtkIdType*) cell);
}
lastPointIndex = ptIndex;
++ptIndex;
if ( showPoints )
{
vtkSmartPointer<vtkSphereSource> sphere = vtkSmartPointer<vtkSphereSource>::New();
sphere->SetRadius(pointSize);
sphere->SetCenter(vtkpoint);
m_VtkPointList->AddInput(sphere->GetOutput());
sphere->Update();
}
}
if ( input->GetClosed() )
{
int cell[2] = {lastPointIndex,0};
lines->InsertNextCell((vtkIdType)2,(vtkIdType*) cell);
}
m_Contour->SetPoints(points);
m_Contour->SetLines(lines);
m_Contour->Update();
m_TubeFilter->SetInput(m_Contour);
m_TubeFilter->SetRadius(pointSize / 2.0f);
m_TubeFilter->SetNumberOfSides(8);
m_TubeFilter->Update();
if ( showPoints )
{
m_VtkPointList->AddInput(m_TubeFilter->GetOutput());
m_VtkPolyDataMapper->SetInput(m_VtkPointList->GetOutput());
}
else
{
m_VtkPolyDataMapper->SetInput(m_TubeFilter->GetOutput());
}
vtkFloatingPointType rgba[4]={0.0f,1.0f,0.0f,0.6f};
m_Actor->GetProperty()->SetColor(rgba);
m_Actor->SetMapper(m_VtkPolyDataMapper);
}
SetVtkMapperImmediateModeRendering(m_VtkPolyDataMapper);
}
const mitk::Contour* mitk::ContourVtkMapper3D::GetInput()
{
return static_cast<const mitk::Contour* > ( GetData() );
}
diff --git a/Modules/MitkExt/Rendering/mitkContourVtkMapper3D.h b/Modules/MitkExt/Rendering/mitkContourVtkMapper3D.h
index e439511b88..cef2d7200e 100644
--- a/Modules/MitkExt/Rendering/mitkContourVtkMapper3D.h
+++ b/Modules/MitkExt/Rendering/mitkContourVtkMapper3D.h
@@ -1,69 +1,69 @@
/*=========================================================================
Program: Medical Imaging & Interaction Toolkit
Language: C++
Date: $Date$
Version: $Revision$
Copyright (c) German Cancer Research Center, Division of Medical and
Biological Informatics. All rights reserved.
See MITKCopyright.txt or http://www.mitk.org/copyright.html for details.
This software is distributed WITHOUT ANY WARRANTY; without even
the implied warranty of MERCHANTABILITY or FITNESS FOR A PARTICULAR
PURPOSE. See the above copyright notices for more information.
=========================================================================*/
#ifndef MITK_CONTOUR_VTK_MAPPER_3D_H
#define MITK_CONTOUR_VTK_MAPPER_3D_H
#include "MitkExtExports.h"
#include "mitkVtkMapper3D.h"
#include <vtkPolyData.h>
#include <vtkSmartPointer.h>
class vtkPolyDataMapper;
class vtkAppendPolyData;
class vtkActor;
class vtkTubeFilter;
namespace mitk {
class BaseRenderer;
class Contour;
/**
@brief Vtk-based mapper for mitk::Contour
@ingroup Mapper
*/
class MitkExt_EXPORT ContourVtkMapper3D : public VtkMapper3D
{
public:
mitkClassMacro(ContourVtkMapper3D, VtkMapper3D);
itkNewMacro(Self);
virtual const mitk::Contour* GetInput();
virtual vtkProp* GetVtkProp(mitk::BaseRenderer* renderer);
protected:
ContourVtkMapper3D();
virtual ~ContourVtkMapper3D();
- virtual void GenerateData(mitk::BaseRenderer* renderer);
+ virtual void GenerateDataForRenderer(mitk::BaseRenderer* renderer);
vtkSmartPointer<vtkPolyDataMapper> m_VtkPolyDataMapper;
vtkSmartPointer<vtkTubeFilter> m_TubeFilter;
vtkSmartPointer<vtkAppendPolyData> m_VtkPointList;
vtkSmartPointer<vtkPolyData> m_Contour;
vtkSmartPointer<vtkActor> m_Actor;
};
} // namespace mitk
#endif // MITK_CONTOUR_VTK_MAPPER_3D_H
diff --git a/Modules/MitkExt/Rendering/mitkEnhancedPointSetVtkMapper3D.cpp b/Modules/MitkExt/Rendering/mitkEnhancedPointSetVtkMapper3D.cpp
index 17749d6ec4..6817240a1c 100644
--- a/Modules/MitkExt/Rendering/mitkEnhancedPointSetVtkMapper3D.cpp
+++ b/Modules/MitkExt/Rendering/mitkEnhancedPointSetVtkMapper3D.cpp
@@ -1,439 +1,438 @@
/*=========================================================================
Program: Medical Imaging & Interaction Toolkit
Language: C++
Date: $Date$
Version: $Revision$
Copyright (c) German Cancer Research Center, Division of Medical and
Biological Informatics. All rights reserved.
See MITKCopyright.txt or http://www.mitk.org/copyright.html for details.
This software is distributed WITHOUT ANY WARRANTY; without even
the implied warranty of MERCHANTABILITY or FITNESS FOR A PARTICULAR
PURPOSE. See the above copyright notices for more information.
=========================================================================*/
#include "mitkEnhancedPointSetVtkMapper3D.h"
//#include <sstream>
#include <algorithm>
#include "mitkDataNode.h"
#include "mitkProperties.h"
#include "mitkLookupTables.h"
#include "mitkColorProperty.h"
//#include "mitkVtkPropRenderer.h"
#include <vtkActor.h>
#include <vtkAssembly.h>
#include <vtkProp3DCollection.h>
#include <vtkTubeFilter.h>
#include <vtkSphereSource.h>
#include <vtkCubeSource.h>
#include <vtkConeSource.h>
#include <vtkCylinderSource.h>
#include <vtkProperty.h>
#include <vtkPolyDataMapper.h>
#include <vtkTransformPolyDataFilter.h>
#include <vtkPolyDataAlgorithm.h>
#include <mitkLookupTableProperty.h>
const mitk::PointSet* mitk::EnhancedPointSetVtkMapper3D::GetInput()
{
return static_cast<const mitk::PointSet * > ( GetData() );
}
mitk::EnhancedPointSetVtkMapper3D::EnhancedPointSetVtkMapper3D()
{
m_Contour = vtkActor::New();
m_ContourSource = vtkTubeFilter::New();
m_PropAssembly = vtkAssembly::New();
}
vtkProp* mitk::EnhancedPointSetVtkMapper3D::GetVtkProp(mitk::BaseRenderer* /*renderer*/)
{
return m_PropAssembly;
}
mitk::EnhancedPointSetVtkMapper3D::~EnhancedPointSetVtkMapper3D()
{
m_Contour->Delete();
m_ContourSource->Delete();
m_PropAssembly->Delete();
// TODO: do cleanup correctly
// Clean up all remaining actors and poly-data sources
//std::for_each(m_PointActors.begin(), m_PointActors.end(), &mitk::EnhancedPointSetVtkMapper3D::DeleteVtkObject);
// std::for_each(m_SphereSources.begin(), m_SphereSources.end(), &mitk::EnhancedPointSetVtgkMapper3D::DeleteVtkObject);
// std::for_each(m_CubeSources.begin(), m_CubeSources.end(), &mitk::EnhancedPointSetVtkMapper3D::DeleteVtkObject);
// std::for_each(m_ConeSources.begin(), m_ConeSources.end(), &mitk::EnhancedPointSetVtkMapper3D::DeleteVtkObject);
// std::for_each(m_CylinderSources.begin(), m_CylinderSources.end(), &mitk::EnhancedPointSetVtkMapper3D::DeleteVtkObject);
//
}
void mitk::EnhancedPointSetVtkMapper3D::ReleaseGraphicsResources(vtkWindow * /*renWin*/)
{
// TODO: Do we have to call this for all actors??
//m_Actor->ReleaseGraphicsResources(renWin);
}
void mitk::EnhancedPointSetVtkMapper3D::UpdateVtkObjects()
{
// get and update the PointSet
const mitk::PointSet* pointset = this->GetInput();
//pointset->Update();
int timestep = this->GetTimestep();
mitk::PointSet::DataType* itkPointSet = pointset->GetPointSet( timestep );
mitk::PointSet::PointsContainer* points = itkPointSet->GetPoints();
mitk::PointSet::PointDataContainer* pointData = itkPointSet->GetPointData();
assert(points->Size() == pointData->Size());
mitk::PointSet::PointsIterator pIt;
mitk::PointSet::PointDataIterator pdIt;
/* search removed points and delete the corresponding source/actor/mapper objects */
for (ActorMap::iterator it = m_PointActors.begin(); it != m_PointActors.end(); )
{
PointIdentifier id = it->first;
if (!points->IndexExists(id))
{
this->RemoveEntryFromSourceMaps(id);
m_PropAssembly->GetParts()->RemoveItem(it->second.first); // remove from prop assembly
if (it->second.first != NULL)
it->second.first->Delete(); // Delete actor, which deletes mapper too (reference count)
ActorMap::iterator er = it; // save iterator for deleting
++it; // advance iterator to next object
m_PointActors.erase(er); // erase element from map. This invalidates er, therefore we had to advance it before deletion.
}
else
++it;
}
/* iterate over each point in the pointset and create corresponding vtk objects */
for (pIt = points->Begin(), pdIt = pointData->Begin(); pIt != itkPointSet->GetPoints()->End(); ++pIt, ++pdIt)
{
PointIdentifier pointID = pIt->Index();
assert (pointID == pdIt->Index());
mitk::PointSet::PointType point = pIt->Value();
mitk::PointSet::PointDataType data = pdIt->Value();
ActorMap::iterator aIt = m_PointActors.find(pointID); // Does an actor exist for the point?
/* Create/Update sources for the point */
vtkActor* a = NULL;
bool newPoint = (aIt == m_PointActors.end()); // current point is new
bool specChanged = (!newPoint && data.pointSpec != aIt->second.second); // point spec of current point has changed
if (newPoint) // point did not exist before, we have to create vtk objects for it
{ // create actor and mapper for the new point
a = vtkActor::New();
vtkPolyDataMapper* m = vtkPolyDataMapper::New();
a->SetMapper(m);
m->UnRegister( NULL );
aIt = m_PointActors.insert(std::make_pair(pointID, std::make_pair(a, data.pointSpec))).first; // insert element and update actormap iterator to point to new element
m_PropAssembly->AddPart(a);
}
else
{
a = aIt->second.first;
if (specChanged) // point exists, but point spec has changed
{
this->RemoveEntryFromSourceMaps( pointID );
}
}
if ( newPoint || specChanged ) // new point OR existing point but point spec changed
{
vtkPolyDataAlgorithm* source = NULL; // works only in VTK 5+
switch (data.pointSpec) // add to new map
{ //TODO: look up representation in a representationlookuptable
case PTSTART: //cube
m_CubeSources[pointID] = vtkCubeSource::New();
source = m_CubeSources[pointID];
break;
case PTCORNER: //cone
m_ConeSources[pointID] = vtkConeSource::New();
source = m_ConeSources[pointID];
break;
case PTEDGE: // cylinder
m_CylinderSources[pointID] = vtkCylinderSource::New();
source = m_CylinderSources[pointID];
break;
case PTUNDEFINED: // sphere
case PTEND:
default:
m_SphereSources[pointID] = vtkSphereSource::New();
source = m_SphereSources[pointID];
break;
}
vtkPolyDataMapper* m = dynamic_cast<vtkPolyDataMapper*>(a->GetMapper());
assert(m != NULL);
m->SetInput(source->GetOutput());
aIt->second.second = data.pointSpec; // update point spec in actormap
}
} // for each point
}
void mitk::EnhancedPointSetVtkMapper3D::GenerateData()
{
this->UpdateVtkObjects();
}
void mitk::EnhancedPointSetVtkMapper3D::ApplyProperties( mitk::BaseRenderer * renderer )
{
/* iterate over all points in pointset and apply properties to corresponding vtk objects */
// get and update the PointSet
const mitk::PointSet* pointset = this->GetInput();
int timestep = this->GetTimestep();
mitk::PointSet::DataType* itkPointSet = pointset->GetPointSet( timestep );
mitk::PointSet::PointsContainer* points = itkPointSet->GetPoints();
mitk::PointSet::PointDataContainer* pointData = itkPointSet->GetPointData();
assert(points->Size() == pointData->Size());
mitk::PointSet::PointsIterator pIt;
mitk::PointSet::PointDataIterator pdIt;
mitk::DataNode* n = this->GetDataNode();
assert(n != NULL);
for (pIt = points->Begin(), pdIt = pointData->Begin(); pIt != itkPointSet->GetPoints()->End(); ++pIt, ++pdIt) // for each point in the pointset
{
PointIdentifier pointID = pIt->Index();
assert (pointID == pdIt->Index());
mitk::PointSet::PointType point = pIt->Value();
mitk::PointSet::PointDataType data = pdIt->Value();
ActorMap::iterator aIt = m_PointActors.find(pointID); // Does an actor exist for the point?
assert(aIt != m_PointActors.end()); // UpdateVtkObjects() must ensure that actor exists
vtkActor* a = aIt->second.first;
assert(a != NULL);
SetVtkMapperImmediateModeRendering(a->GetMapper());
/* update properties */
// visibility
bool pointVisibility = true;
bool visValueFound = false;
mitk::BaseProperty* visProp = n->GetProperty("visibility", renderer);
mitk::BoolLookupTableProperty* visLTProp = dynamic_cast<mitk::BoolLookupTableProperty*>(visProp);
if (visLTProp != NULL)
{
mitk::BoolLookupTable visLookupTable = visLTProp->GetValue();
//if (visLookupTable != NULL)
//{
try
{
pointVisibility = visLookupTable.GetTableValue(pointID);
visValueFound = true;
}
catch (...)
{
}
//}
}
if (visValueFound == false)
{
pointVisibility = n->IsVisible(renderer, "show points"); // use BoolProperty instead
}
a->SetVisibility(pointVisibility);
// opacity
float opacity = 1.0;
bool opValueFound = false;
mitk::BaseProperty* opProp = n->GetProperty("opacity", renderer);
mitk::FloatLookupTableProperty* opLTProp = dynamic_cast<mitk::FloatLookupTableProperty*>(opProp);
if (opLTProp != NULL)
{
mitk::FloatLookupTable opLookupTable = opLTProp->GetValue();
//if (opLookupTable != NULL)
//{
try
{
opacity = opLookupTable.GetTableValue(pointID);
opValueFound = true;
}
catch (...)
{
}
//}
}
if (opValueFound == false)
{
n->GetOpacity(opacity, renderer);
}
a->GetProperty()->SetOpacity(opacity);
////////////////////// continue here ///////////////////
// pointsize & point position
float pointSize = 1.0;
n->GetFloatProperty( "pointsize", pointSize, renderer);
switch (data.pointSpec)
{ //TODO: look up representation in a representationlookuptable
case PTSTART: //cube
m_CubeSources[pointID]->SetXLength(pointSize);
m_CubeSources[pointID]->SetYLength(pointSize);
m_CubeSources[pointID]->SetZLength(pointSize);
//m_CubeSources[pointID]->SetCenter(pos[0], pos[1], pos[2]);
break;
case PTCORNER: //cone
m_ConeSources[pointID]->SetRadius(pointSize/2);
m_ConeSources[pointID]->SetHeight(pointSize);
m_ConeSources[pointID]->SetResolution(2); // two crossed triangles. Maybe introduce an extra property for
//m_ConeSources[pointID]->SetCenter(pos[0], pos[1], pos[2]);
break;
case PTEDGE: // cylinder
m_CylinderSources[pointID]->SetRadius(pointSize/2);
m_CylinderSources[pointID]->SetHeight(pointSize);
m_CylinderSources[pointID]->CappingOn();
m_CylinderSources[pointID]->SetResolution(6);
//m_CylinderSources[pointID]->SetCenter(pos[0], pos[1], pos[2]);
break;
case PTUNDEFINED: // sphere
case PTEND:
default:
m_SphereSources[pointID]->SetRadius(pointSize/2);
m_SphereSources[pointID]->SetThetaResolution(10);
m_SphereSources[pointID]->SetPhiResolution(10);
//m_SphereSources[pointID]->SetCenter(pos[0], pos[1], pos[2]);
break;
}
// set position
mitk::Point3D pos = pIt->Value();
aIt->second.first->SetPosition(pos[0], pos[1], pos[2]);
// selectedcolor & color
float color[3];
if (data.selected)
{
if(!n->GetColor(color, renderer, "selectedcolor"))
n->GetColor(color, renderer);
}
else
{
mitk::BaseProperty* a = n->GetProperty("colorLookupTable", renderer);
mitk::LookupTableProperty* b = dynamic_cast<mitk::LookupTableProperty*>(a);
if (b != NULL)
{
mitk::LookupTable::Pointer c = b->GetLookupTable();
vtkLookupTable *d = c->GetVtkLookupTable();
double *e=d->GetTableValue(pointID);
color[0]=e[0];
color[1]=e[1];
color[2]=e[2];
}
else
{
if(!n->GetColor(color, renderer, "unselectedcolor"))
n->GetColor(color, renderer);
}
}
// TODO: What about "color" property? 2D Mapper only uses unselected and selected color properties
a->GetProperty()->SetColor(color[0], color[1], color[2]);
// TODO: label property
}
//TODO test different pointSpec
// TODO "line width" "show contour" "contourcolor" "contoursize" "close contour" "show label", "label"
// TODO "show points" vs "visibility" - is visibility evaluated at all? in a superclass maybe?
// TODO create lookup tables for all properties that should be evaluated per point. also create editor widgets for these lookup tables!
// TODO check if property changes and pointset changes are reflected in the render window immediately.
// TODO check behavior with large PointSets
// TODO check for memory leaks on adding/deleting points
}
-void mitk::EnhancedPointSetVtkMapper3D::GenerateData( mitk::BaseRenderer * renderer )
+void mitk::EnhancedPointSetVtkMapper3D::GenerateDataForRenderer( mitk::BaseRenderer * renderer )
{
ApplyProperties(renderer);
}
void mitk::EnhancedPointSetVtkMapper3D::UpdateVtkTransform(mitk::BaseRenderer * /*renderer*/)
{
// TODO: apply new transform if time step changed
//vtkLinearTransform * vtktransform =
// this->GetDataNode()->GetVtkTransform(this->GetTimestep());
//m_SelectedActor->SetUserTransform(vtktransform);
//m_UnselectedActor->SetUserTransform(vtktransform);
//m_ContourActor->SetUserTransform(vtktransform);
}
void mitk::EnhancedPointSetVtkMapper3D::SetDefaultProperties(mitk::DataNode* node, mitk::BaseRenderer* renderer, bool overwrite)
{
node->AddProperty( "line width", mitk::IntProperty::New(2), renderer, overwrite );
node->AddProperty( "pointsize", mitk::FloatProperty::New(1.0), renderer, overwrite);
node->AddProperty( "selectedcolor", mitk::ColorProperty::New(1.0f, 1.0f, 0.0f), renderer, overwrite); //yellow for selected
node->AddProperty( "unselectedcolor", mitk::ColorProperty::New(0.5f, 1.0f, 0.5f), renderer, overwrite); // middle green for unselected
node->AddProperty( "color", mitk::ColorProperty::New(1.0f, 0.0f, 0.0f), renderer, overwrite); // red as standard
node->AddProperty( "show contour", mitk::BoolProperty::New(false), renderer, overwrite );
node->AddProperty( "contourcolor", mitk::ColorProperty::New(1.0f, 0.0f, 0.0f), renderer, overwrite);
node->AddProperty( "contoursize", mitk::FloatProperty::New(0.5), renderer, overwrite );
- node->AddProperty( "close contour", mitk::BoolProperty::New(false), renderer, overwrite );
node->AddProperty( "show points", mitk::BoolProperty::New(true), renderer, overwrite );
node->AddProperty( "show label", mitk::BoolProperty::New(false), renderer, overwrite );
node->AddProperty( "label", mitk::StringProperty::New("P"), renderer, overwrite );
node->AddProperty( "opacity", mitk::FloatProperty::New(1.0), renderer, overwrite );
Superclass::SetDefaultProperties(node, renderer, overwrite);
}
void mitk::EnhancedPointSetVtkMapper3D::DeleteVtkObject( vtkObject* o)
{
if (o != NULL)
o->Delete();
}
void mitk::EnhancedPointSetVtkMapper3D::RemoveEntryFromSourceMaps( mitk::PointSet::PointIdentifier pointID )
{
ActorMap::iterator aIt = m_PointActors.find(pointID);
if (aIt == m_PointActors.end())
return;
switch (aIt->second.second) // erase in old map
{ //TODO: look up representation in a representationlookuptable
case PTSTART: //cube
m_CubeSources[pointID]->Delete();
m_CubeSources.erase(pointID);
break;
case PTCORNER: //cone
m_ConeSources[pointID]->Delete();
m_ConeSources.erase(pointID);
break;
case PTEDGE: // cylinder
m_CylinderSources[pointID]->Delete();
m_CylinderSources.erase(pointID);
break;
case PTUNDEFINED: // sphere
case PTEND:
default:
m_SphereSources[pointID]->Delete();
m_SphereSources.erase(pointID);
break;
}
}
diff --git a/Modules/MitkExt/Rendering/mitkEnhancedPointSetVtkMapper3D.h b/Modules/MitkExt/Rendering/mitkEnhancedPointSetVtkMapper3D.h
index 131c96ee6b..ad5fb8e4b1 100644
--- a/Modules/MitkExt/Rendering/mitkEnhancedPointSetVtkMapper3D.h
+++ b/Modules/MitkExt/Rendering/mitkEnhancedPointSetVtkMapper3D.h
@@ -1,125 +1,125 @@
/*=========================================================================
Program: Medical Imaging & Interaction Toolkit
Language: C++
Date: $Date$
Version: $Revision$
Copyright (c) German Cancer Research Center, Division of Medical and
Biological Informatics. All rights reserved.
See MITKCopyright.txt or http://www.mitk.org/copyright.html for details.
This software is distributed WITHOUT ANY WARRANTY; without even
the implied warranty of MERCHANTABILITY or FITNESS FOR A PARTICULAR
PURPOSE. See the above copyright notices for more information.
=========================================================================*/
#ifndef MITKEnhancedPointSetVtkMapper3D_H_HEADER_INCLUDED_C1907273
#define MITKEnhancedPointSetVtkMapper3D_H_HEADER_INCLUDED_C1907273
#include "mitkCommon.h"
#include "MitkExtExports.h"
#include "mitkVtkMapper3D.h"
#include "mitkBaseRenderer.h"
#include "mitkPointSet.h"
#include "mitkVector.h"
class vtkActor;
class vtkAssembly;
class vtkSphereSource;
class vtkCubeSource;
class vtkConeSource;
class vtkCylinderSource;
class vtkTubeFilter;
class vtkProp;
namespace mitk {
/**
* \brief Alternative Vtk-based 3D mapper for mitk::PointSet
*
* This class renders mitk::PointSet objects in 3D views. It resembles the
* standard mitk::PointSetVtkMapper3D, but is designed to enable single
* points to be rendered with individual appearances.
*
* Instead of assembling one vtkPolyData object containing all points,
* a list of VTK source objects (spheres, cubes, cones, ...) is maintained.
* Therefore, the application can change the appearance and/or type of a
* specific point at runtime, without having to rebuild the
*
* You should use this class instead of the standard mapper if you
*
* - change the PointSet very often (by adding or removing points)
* - need different representations for points (+++)
* - want to change the point representation frequently (+++)
*
* Note: the class is still in experimental stage, and the points above
* marked with (+++) are not yet working correctly. Also, drawing lines
* between points (contour mode) is not yet supported. The class will be
* extended so that point representations are stored in a lookup table,
* which is indexed by point data from the rendered PointSet.
*
* \warn This mapper requires the PointData container to be the same size
* as the point container.
*
* \sa PointSetVtkMapper3D
*/
class MitkExt_EXPORT EnhancedPointSetVtkMapper3D : public VtkMapper3D
{
public:
mitkClassMacro(EnhancedPointSetVtkMapper3D, VtkMapper3D);
itkNewMacro(Self);
virtual const mitk::PointSet* GetInput();
virtual vtkProp* GetVtkProp(mitk::BaseRenderer* renderer);
virtual void UpdateVtkTransform(mitk::BaseRenderer *renderer);
static void SetDefaultProperties(mitk::DataNode* node,
mitk::BaseRenderer* renderer = NULL, bool overwrite = false);
void ReleaseGraphicsResources(vtkWindow *renWin);
protected:
EnhancedPointSetVtkMapper3D();
virtual ~EnhancedPointSetVtkMapper3D();
void RemoveEntryFromSourceMaps( mitk::PointSet::PointIdentifier pointID );
void DeleteVtkObject(vtkObject* o); // functor for stl_each in destructor
// update all vtk sources, mappers, actors with current data and properties
void UpdateVtkObjects();
virtual void GenerateData();
- virtual void GenerateData(mitk::BaseRenderer* renderer);
+ virtual void GenerateDataForRenderer(mitk::BaseRenderer* renderer);
virtual void ApplyProperties(mitk::BaseRenderer* renderer);
typedef mitk::PointSet::PointIdentifier PointIdentifier;
typedef std::map<PointIdentifier, vtkSphereSource*> SphereSourceMap;
typedef std::map<PointIdentifier, vtkCubeSource*> CubeSourceMap;
typedef std::map<PointIdentifier, vtkConeSource*> ConeSourceMap;
typedef std::map<PointIdentifier, vtkCylinderSource*> CylinderSourceMap;
typedef std::pair<vtkActor*, mitk::PointSpecificationType> ActorAndPointType;
typedef std::map<PointIdentifier, ActorAndPointType> ActorMap;
SphereSourceMap m_SphereSources; // stores all sphere sources
CubeSourceMap m_CubeSources; // stores all cube sources
ConeSourceMap m_ConeSources; // stores all cone sources
CylinderSourceMap m_CylinderSources; // stores all cylinder sources
ActorMap m_PointActors; // stores an actor for each point(referenced by its ID) and the currently used pointspec = which source type is generating the polydata
vtkActor* m_Contour;
vtkTubeFilter* m_ContourSource;
vtkAssembly* m_PropAssembly; // this contains everything, this will be returned by GetVtkProp()
};
} // namespace mitk
#endif /* MITKEnhancedPointSetVtkMapper3D_H_HEADER_INCLUDED_C1907273 */
diff --git a/Modules/MitkExt/Rendering/mitkGPUVolumeMapper3D.cpp b/Modules/MitkExt/Rendering/mitkGPUVolumeMapper3D.cpp
index cd94557cae..3d51ec5566 100644
--- a/Modules/MitkExt/Rendering/mitkGPUVolumeMapper3D.cpp
+++ b/Modules/MitkExt/Rendering/mitkGPUVolumeMapper3D.cpp
@@ -1,711 +1,711 @@
/*=========================================================================
Program: Medical Imaging & Interaction Toolkit
Language: C++
Date: $Date: 2009-06-18 15:59:04 +0200 (Thu, 18 Jun 2009) $
Version: $Revision: 17786 $
Copyright (c) German Cancer Research Center, Division of Medical and
Biological Informatics. All rights reserved.
See MITKCopyright.txt or http://www.mitk.org/copyright.html for details.
This software is distributed WITHOUT ANY WARRANTY; without even
the implied warranty of MERCHANTABILITY or FITNESS FOR A PARTICULAR
PURPOSE. See the above copyright notices for more information.
=========================================================================*/
#define GPU_INFO MITK_INFO("mapper.vr")
#define GPU_WARN MITK_WARN("mapper.vr")
#define GPU_ERROR MITK_ERROR("mapper.vr")
#include "mitkGPUVolumeMapper3D.h"
#include "mitkDataNode.h"
#include "mitkProperties.h"
#include "mitkLevelWindow.h"
#include "mitkColorProperty.h"
#include "mitkLevelWindowProperty.h"
#include "mitkLookupTableProperty.h"
#include "mitkTransferFunctionProperty.h"
#include "mitkTransferFunctionInitializer.h"
#include "mitkColorProperty.h"
#include "mitkVtkPropRenderer.h"
#include "mitkRenderingManager.h"
#include <vtkActor.h>
#include <vtkProperty.h>
#include <vtkVolumeTextureMapper2D.h>
#include <vtkVolume.h>
#include <vtkVolumeProperty.h>
#include <vtkColorTransferFunction.h>
#include <vtkPiecewiseFunction.h>
#include <vtkVolumeRayCastCompositeFunction.h>
#include <vtkVolumeRayCastMIPFunction.h>
#include <vtkFiniteDifferenceGradientEstimator.h>
#include <vtkRenderWindow.h>
#include <vtkRenderWindowInteractor.h>
#include <vtkImageWriter.h>
#include <vtkImageData.h>
#include <vtkLODProp3D.h>
#include <vtkImageResample.h>
#include <vtkPlane.h>
#include <vtkImplicitPlaneWidget.h>
#include <vtkAssembly.h>
#include <vtkCubeSource.h>
#include <vtkPolyDataMapper.h>
#include <itkMultiThreader.h>
// Only with VTK 5.6 or above
#if ((VTK_MAJOR_VERSION > 5) || ((VTK_MAJOR_VERSION==5) && (VTK_MINOR_VERSION>=6) ))
#include "vtkMitkGPUVolumeRayCastMapper.h"
#endif
#include "vtkMitkOpenGLGPUVolumeRayCastMapper.h"
#include "vtkMitkOpenGLVolumeTextureMapper3D.h"
const mitk::Image* mitk::GPUVolumeMapper3D::GetInput()
{
return static_cast<const mitk::Image*> ( GetData() );
}
void mitk::GPUVolumeMapper3D::MitkRenderVolumetricGeometry(mitk::BaseRenderer* renderer)
{
LocalStorage *ls = m_LSH.GetLocalStorage(renderer);
VtkMapper3D::MitkRenderVolumetricGeometry(renderer);
if(ls->m_gpuInitialized)
ls->m_MapperGPU->UpdateMTime();
}
bool mitk::GPUVolumeMapper3D::InitGPU(mitk::BaseRenderer* renderer)
{
LocalStorage *ls = m_LSH.GetLocalStorage(renderer);
if(ls->m_gpuInitialized)
return ls->m_gpuSupported;
GPU_INFO << "initializing gpu-slicing-vr (vtkMitkOpenGLVolumeTextureMapper3D)";
ls->m_MapperGPU = vtkMitkOpenGLVolumeTextureMapper3D::New();
ls->m_MapperGPU->SetUseCompressedTexture(false);
ls->m_MapperGPU->SetSampleDistance(1.0);
ls->m_VolumePropertyGPU = vtkVolumeProperty::New();
ls->m_VolumePropertyGPU->ShadeOn();
ls->m_VolumePropertyGPU->SetAmbient (0.25f); //0.05f
ls->m_VolumePropertyGPU->SetDiffuse (0.50f); //0.45f
ls->m_VolumePropertyGPU->SetSpecular(0.40f); //0.50f
ls->m_VolumePropertyGPU->SetSpecularPower(16.0f);
ls->m_VolumePropertyGPU->SetInterpolationTypeToLinear();
ls->m_VolumeGPU = vtkVolume::New();
ls->m_VolumeGPU->SetMapper( ls->m_MapperGPU );
ls->m_VolumeGPU->SetProperty( ls->m_VolumePropertyGPU );
ls->m_VolumeGPU->VisibilityOn();
ls->m_MapperGPU->SetInput( this->m_UnitSpacingImageFilter->GetOutput() );
ls->m_gpuSupported = ls->m_MapperGPU->IsRenderSupported(renderer->GetVtkRenderer(),ls->m_VolumePropertyGPU);
ls->m_gpuInitialized = true;
return ls->m_gpuSupported;
}
void mitk::GPUVolumeMapper3D::InitCPU(mitk::BaseRenderer* renderer)
{
LocalStorage *ls = m_LSH.GetLocalStorage(renderer);
if(ls->m_cpuInitialized)
return;
int numThreads = itk::MultiThreader::GetGlobalDefaultNumberOfThreads();
GPU_INFO << "initializing cpu-raycast-vr (vtkFixedPointVolumeRayCastMapper) (" << numThreads << " threads)";
ls->m_MapperCPU = vtkFixedPointVolumeRayCastMapper::New();
ls->m_MapperCPU->SetSampleDistance(1.0);
// ls->m_MapperCPU->LockSampleDistanceToInputSpacingOn();
ls->m_MapperCPU->SetImageSampleDistance(1.0);
ls->m_MapperCPU->IntermixIntersectingGeometryOn();
ls->m_MapperCPU->SetAutoAdjustSampleDistances(0);
ls->m_MapperCPU->SetNumberOfThreads( numThreads );
ls->m_VolumePropertyCPU = vtkVolumeProperty::New();
ls->m_VolumePropertyCPU->ShadeOn();
ls->m_VolumePropertyCPU->SetAmbient (0.10f); //0.05f
ls->m_VolumePropertyCPU->SetDiffuse (0.50f); //0.45f
ls->m_VolumePropertyCPU->SetSpecular(0.40f); //0.50f
ls->m_VolumePropertyCPU->SetSpecularPower(16.0f);
ls->m_VolumePropertyCPU->SetInterpolationTypeToLinear();
ls->m_VolumeCPU = vtkVolume::New();
ls->m_VolumeCPU->SetMapper( ls->m_MapperCPU );
ls->m_VolumeCPU->SetProperty( ls->m_VolumePropertyCPU );
ls->m_VolumeCPU->VisibilityOn();
ls->m_MapperCPU->SetInput( m_UnitSpacingImageFilter->GetOutput() );//m_Resampler->GetOutput());
ls->m_cpuInitialized=true;
}
void mitk::GPUVolumeMapper3D::DeinitGPU(mitk::BaseRenderer* renderer)
{
LocalStorage *ls = m_LSH.GetLocalStorage(renderer);
if(ls->m_gpuInitialized)
{
GPU_INFO << "deinitializing gpu-slicing-vr";
ls->m_VolumeGPU->Delete();
ls->m_MapperGPU->Delete();
ls->m_VolumePropertyGPU->Delete();
ls->m_gpuInitialized=false;
}
}
void mitk::GPUVolumeMapper3D::DeinitCPU(mitk::BaseRenderer* renderer)
{
LocalStorage *ls = m_LSH.GetLocalStorage(renderer);
if(!ls->m_cpuInitialized)
return;
GPU_INFO << "deinitializing cpu-raycast-vr";
ls->m_VolumeCPU->Delete();
ls->m_MapperCPU->Delete();
ls->m_VolumePropertyCPU->Delete();
ls->m_cpuInitialized=false;
}
mitk::GPUVolumeMapper3D::GPUVolumeMapper3D()
{
m_VolumeNULL=0;
m_commonInitialized=false;
}
mitk::GPUVolumeMapper3D::~GPUVolumeMapper3D()
{
DeinitCommon();
if(m_VolumeNULL)
m_VolumeNULL->Delete();
}
void mitk::GPUVolumeMapper3D::InitCommon()
{
if(m_commonInitialized)
return;
m_UnitSpacingImageFilter = vtkImageChangeInformation::New();
m_UnitSpacingImageFilter->SetOutputSpacing( 1.0, 1.0, 1.0 );
CreateDefaultTransferFunctions();
m_commonInitialized=true;
}
void mitk::GPUVolumeMapper3D::DeinitCommon()
{
if(!m_commonInitialized)
return;
m_UnitSpacingImageFilter->Delete();
m_DefaultColorTransferFunction->Delete();
m_DefaultOpacityTransferFunction->Delete();
m_DefaultGradientTransferFunction->Delete();
m_BinaryColorTransferFunction->Delete();
m_BinaryOpacityTransferFunction->Delete();
m_BinaryGradientTransferFunction->Delete();
m_commonInitialized=false;
}
bool mitk::GPUVolumeMapper3D::IsRenderable(mitk::BaseRenderer* renderer)
{
if(!IsVisible(renderer))
return false;
if(!GetDataNode())
return false;
bool value = false;
if(!GetDataNode()->GetBoolProperty("volumerendering",value,renderer))
return false;
if(!value)
return false;
mitk::Image *input = const_cast< mitk::Image * >( this->GetInput() );
if ( !input || !input->IsInitialized() )
return false;
vtkImageData *inputData = input->GetVtkImageData( this->GetTimestep() );
if(inputData==NULL)
return false;
return true;
}
void mitk::GPUVolumeMapper3D::InitVtkMapper(mitk::BaseRenderer* renderer)
{
// Only with VTK 5.6 or above
#if ((VTK_MAJOR_VERSION > 5) || ((VTK_MAJOR_VERSION==5) && (VTK_MINOR_VERSION>=6) ))
if(IsRAYEnabled(renderer))
{
DeinitCPU(renderer);
DeinitGPU(renderer);
if(!InitRAY(renderer))
{
GPU_WARN << "hardware renderer can't initialize ... falling back to software renderer";
goto fallback;
}
}
else
#endif
if(IsGPUEnabled(renderer))
{
DeinitCPU(renderer);
// Only with VTK 5.6 or above
#if ((VTK_MAJOR_VERSION > 5) || ((VTK_MAJOR_VERSION==5) && (VTK_MINOR_VERSION>=6) ))
DeinitRAY(renderer);
#endif
if(!InitGPU(renderer))
{
GPU_WARN << "hardware renderer can't initialize ... falling back to software renderer";
goto fallback;
}
}
else
{
fallback:
DeinitGPU(renderer);
// Only with VTK 5.6 or above
#if ((VTK_MAJOR_VERSION > 5) || ((VTK_MAJOR_VERSION==5) && (VTK_MINOR_VERSION>=6) ))
DeinitRAY(renderer);
#endif
InitCPU(renderer);
}
}
vtkProp *mitk::GPUVolumeMapper3D::GetVtkProp(mitk::BaseRenderer *renderer)
{
if(!IsRenderable(renderer))
{
if(!m_VolumeNULL)
{
m_VolumeNULL = vtkVolume::New();
m_VolumeNULL->VisibilityOff();
}
return m_VolumeNULL;
}
InitCommon();
InitVtkMapper( renderer );
LocalStorage *ls = m_LSH.GetLocalStorage(renderer);
// Only with VTK 5.6 or above
#if ((VTK_MAJOR_VERSION > 5) || ((VTK_MAJOR_VERSION==5) && (VTK_MINOR_VERSION>=6) ))
if(ls->m_rayInitialized)
return ls->m_VolumeRAY;
#endif
if(ls->m_gpuInitialized)
return ls->m_VolumeGPU;
return ls->m_VolumeCPU;
}
-void mitk::GPUVolumeMapper3D::GenerateData( mitk::BaseRenderer *renderer )
+void mitk::GPUVolumeMapper3D::GenerateDataForRenderer( mitk::BaseRenderer *renderer )
{
if(!IsRenderable(renderer))
return;
InitCommon();
InitVtkMapper( renderer );
mitk::Image *input = const_cast< mitk::Image * >( this->GetInput() );
vtkImageData *inputData = input->GetVtkImageData( this->GetTimestep() );
m_UnitSpacingImageFilter->SetInput( inputData );
LocalStorage *ls = m_LSH.GetLocalStorage(renderer);
// Only with VTK 5.6 or above
#if ((VTK_MAJOR_VERSION > 5) || ((VTK_MAJOR_VERSION==5) && (VTK_MINOR_VERSION>=6) ))
if(ls->m_rayInitialized)
{
GenerateDataRAY(renderer);
}
else
#endif
if(ls->m_gpuInitialized)
{
GenerateDataGPU(renderer);
}
else
{
GenerateDataCPU(renderer);
}
// UpdateTransferFunctions
UpdateTransferFunctions( renderer );
}
void mitk::GPUVolumeMapper3D::GenerateDataGPU( mitk::BaseRenderer *renderer )
{
LocalStorage *ls = m_LSH.GetLocalStorage(renderer);
bool useCompression = false;
GetDataNode()->GetBoolProperty("volumerendering.gpu.usetexturecompression",useCompression,renderer);
ls->m_MapperGPU->SetUseCompressedTexture(useCompression);
if( IsLODEnabled(renderer) && mitk::RenderingManager::GetInstance()->GetNextLOD( renderer ) == 0 )
ls->m_MapperGPU->SetSampleDistance(2.0);
else
ls->m_MapperGPU->SetSampleDistance(1.0);
// Updating shadings
{
float value=0;
if(GetDataNode()->GetFloatProperty("volumerendering.gpu.ambient",value,renderer))
ls->m_VolumePropertyGPU->SetAmbient(value);
if(GetDataNode()->GetFloatProperty("volumerendering.gpu.diffuse",value,renderer))
ls->m_VolumePropertyGPU->SetDiffuse(value);
if(GetDataNode()->GetFloatProperty("volumerendering.gpu.specular",value,renderer))
ls->m_VolumePropertyGPU->SetSpecular(value);
if(GetDataNode()->GetFloatProperty("volumerendering.gpu.specular.power",value,renderer))
ls->m_VolumePropertyGPU->SetSpecularPower(value);
}
}
void mitk::GPUVolumeMapper3D::GenerateDataCPU( mitk::BaseRenderer *renderer )
{
LocalStorage *ls = m_LSH.GetLocalStorage(renderer);
int nextLod = mitk::RenderingManager::GetInstance()->GetNextLOD( renderer );
if( IsLODEnabled(renderer) && nextLod == 0 )
{
ls->m_MapperCPU->SetImageSampleDistance(3.5);
ls->m_MapperCPU->SetSampleDistance(1.25);
ls->m_VolumePropertyCPU->SetInterpolationTypeToNearest();
}
else
{
ls->m_MapperCPU->SetImageSampleDistance(1.0);
ls->m_MapperCPU->SetSampleDistance(1.0);
ls->m_VolumePropertyCPU->SetInterpolationTypeToLinear();
}
// Check raycasting mode
if(IsMIPEnabled(renderer))
ls->m_MapperCPU->SetBlendModeToMaximumIntensity();
else
ls->m_MapperCPU->SetBlendModeToComposite();
// Updating shadings
{
float value=0;
if(GetDataNode()->GetFloatProperty("volumerendering.cpu.ambient",value,renderer))
ls->m_VolumePropertyCPU->SetAmbient(value);
if(GetDataNode()->GetFloatProperty("volumerendering.cpu.diffuse",value,renderer))
ls->m_VolumePropertyCPU->SetDiffuse(value);
if(GetDataNode()->GetFloatProperty("volumerendering.cpu.specular",value,renderer))
ls->m_VolumePropertyCPU->SetSpecular(value);
if(GetDataNode()->GetFloatProperty("volumerendering.cpu.specular.power",value,renderer))
ls->m_VolumePropertyCPU->SetSpecularPower(value);
}
}
void mitk::GPUVolumeMapper3D::CreateDefaultTransferFunctions()
{
m_DefaultOpacityTransferFunction = vtkPiecewiseFunction::New();
m_DefaultOpacityTransferFunction->AddPoint( 0.0, 0.0 );
m_DefaultOpacityTransferFunction->AddPoint( 255.0, 0.8 );
m_DefaultOpacityTransferFunction->ClampingOn();
m_DefaultGradientTransferFunction = vtkPiecewiseFunction::New();
m_DefaultGradientTransferFunction->AddPoint( 0.0, 0.0 );
m_DefaultGradientTransferFunction->AddPoint( 255.0, 0.8 );
m_DefaultGradientTransferFunction->ClampingOn();
m_DefaultColorTransferFunction = vtkColorTransferFunction::New();
m_DefaultColorTransferFunction->AddRGBPoint( 0.0, 0.0, 0.0, 0.0 );
m_DefaultColorTransferFunction->AddRGBPoint( 127.5, 1, 1, 0.0 );
m_DefaultColorTransferFunction->AddRGBPoint( 255.0, 0.8, 0.2, 0 );
m_DefaultColorTransferFunction->ClampingOn();
m_BinaryOpacityTransferFunction = vtkPiecewiseFunction::New();
m_BinaryOpacityTransferFunction->AddPoint( 0, 0.0 );
m_BinaryOpacityTransferFunction->AddPoint( 1, 1.0 );
m_BinaryGradientTransferFunction = vtkPiecewiseFunction::New();
m_BinaryGradientTransferFunction->AddPoint( 0.0, 1.0 );
m_BinaryColorTransferFunction = vtkColorTransferFunction::New();
}
void mitk::GPUVolumeMapper3D::UpdateTransferFunctions( mitk::BaseRenderer * renderer )
{
LocalStorage *ls = m_LSH.GetLocalStorage(renderer);
vtkPiecewiseFunction *opacityTransferFunction = m_DefaultOpacityTransferFunction;
vtkPiecewiseFunction *gradientTransferFunction = m_DefaultGradientTransferFunction;
vtkColorTransferFunction *colorTransferFunction = m_DefaultColorTransferFunction;
bool isBinary = false;
GetDataNode()->GetBoolProperty("binary", isBinary, renderer);
if(isBinary)
{
opacityTransferFunction = m_BinaryOpacityTransferFunction;
gradientTransferFunction = m_BinaryGradientTransferFunction;
colorTransferFunction = m_BinaryColorTransferFunction;
colorTransferFunction->RemoveAllPoints();
float rgb[3];
if( !GetDataNode()->GetColor( rgb,renderer ) )
rgb[0]=rgb[1]=rgb[2]=1;
colorTransferFunction->AddRGBPoint( 0,rgb[0],rgb[1],rgb[2] );
colorTransferFunction->Modified();
}
else
{
mitk::TransferFunctionProperty *transferFunctionProp =
dynamic_cast<mitk::TransferFunctionProperty*>(this->GetDataNode()->GetProperty("TransferFunction",renderer));
if( transferFunctionProp )
{
opacityTransferFunction = transferFunctionProp->GetValue()->GetScalarOpacityFunction();
gradientTransferFunction = transferFunctionProp->GetValue()->GetGradientOpacityFunction();
colorTransferFunction = transferFunctionProp->GetValue()->GetColorTransferFunction();
}
}
if(ls->m_gpuInitialized)
{
ls->m_VolumePropertyGPU->SetColor( colorTransferFunction );
ls->m_VolumePropertyGPU->SetScalarOpacity( opacityTransferFunction );
ls->m_VolumePropertyGPU->SetGradientOpacity( gradientTransferFunction );
}
// Only with VTK 5.6 or above
#if ((VTK_MAJOR_VERSION > 5) || ((VTK_MAJOR_VERSION==5) && (VTK_MINOR_VERSION>=6) ))
if(ls->m_rayInitialized)
{
ls->m_VolumePropertyRAY->SetColor( colorTransferFunction );
ls->m_VolumePropertyRAY->SetScalarOpacity( opacityTransferFunction );
ls->m_VolumePropertyRAY->SetGradientOpacity( gradientTransferFunction );
}
#endif
if(ls->m_cpuInitialized)
{
ls->m_VolumePropertyCPU->SetColor( colorTransferFunction );
ls->m_VolumePropertyCPU->SetScalarOpacity( opacityTransferFunction );
ls->m_VolumePropertyCPU->SetGradientOpacity( gradientTransferFunction );
}
}
void mitk::GPUVolumeMapper3D::ApplyProperties(vtkActor* /*actor*/, mitk::BaseRenderer* /*renderer*/)
{
//GPU_INFO << "ApplyProperties";
}
void mitk::GPUVolumeMapper3D::SetDefaultProperties(mitk::DataNode* node, mitk::BaseRenderer* renderer, bool overwrite)
{
//GPU_INFO << "SetDefaultProperties";
node->AddProperty( "volumerendering", mitk::BoolProperty::New( false ), renderer, overwrite );
node->AddProperty( "volumerendering.usemip", mitk::BoolProperty::New( false ), renderer, overwrite );
node->AddProperty( "volumerendering.uselod", mitk::BoolProperty::New( false ), renderer, overwrite );
node->AddProperty( "volumerendering.cpu.ambient", mitk::FloatProperty::New( 0.10f ), renderer, overwrite );
node->AddProperty( "volumerendering.cpu.diffuse", mitk::FloatProperty::New( 0.50f ), renderer, overwrite );
node->AddProperty( "volumerendering.cpu.specular", mitk::FloatProperty::New( 0.40f ), renderer, overwrite );
node->AddProperty( "volumerendering.cpu.specular.power", mitk::FloatProperty::New( 16.0f ), renderer, overwrite );
bool usegpu = true;
#ifdef __APPLE__
usegpu = false;
node->AddProperty( "volumerendering.uselod", mitk::BoolProperty::New( true ), renderer, overwrite );
#endif
node->AddProperty( "volumerendering.usegpu", mitk::BoolProperty::New( usegpu ), renderer, overwrite );
// Only with VTK 5.6 or above
#if ((VTK_MAJOR_VERSION > 5) || ((VTK_MAJOR_VERSION==5) && (VTK_MINOR_VERSION>=6) ))
node->AddProperty( "volumerendering.useray", mitk::BoolProperty::New( false ), renderer, overwrite );
node->AddProperty( "volumerendering.ray.ambient", mitk::FloatProperty::New( 0.25f ), renderer, overwrite );
node->AddProperty( "volumerendering.ray.diffuse", mitk::FloatProperty::New( 0.50f ), renderer, overwrite );
node->AddProperty( "volumerendering.ray.specular", mitk::FloatProperty::New( 0.40f ), renderer, overwrite );
node->AddProperty( "volumerendering.ray.specular.power", mitk::FloatProperty::New( 16.0f ), renderer, overwrite );
#endif
node->AddProperty( "volumerendering.gpu.ambient", mitk::FloatProperty::New( 0.25f ), renderer, overwrite );
node->AddProperty( "volumerendering.gpu.diffuse", mitk::FloatProperty::New( 0.50f ), renderer, overwrite );
node->AddProperty( "volumerendering.gpu.specular", mitk::FloatProperty::New( 0.40f ), renderer, overwrite );
node->AddProperty( "volumerendering.gpu.specular.power", mitk::FloatProperty::New( 16.0f ), renderer, overwrite );
node->AddProperty( "volumerendering.gpu.usetexturecompression", mitk::BoolProperty ::New( false ), renderer, overwrite );
node->AddProperty( "volumerendering.gpu.reducesliceartifacts" , mitk::BoolProperty ::New( false ), renderer, overwrite );
node->AddProperty( "binary", mitk::BoolProperty::New( false ), renderer, overwrite );
mitk::Image::Pointer image = dynamic_cast<mitk::Image*>(node->GetData());
if(image.IsNotNull() && image->IsInitialized())
{
if((overwrite) || (node->GetProperty("levelwindow", renderer)==NULL))
{
mitk::LevelWindowProperty::Pointer levWinProp = mitk::LevelWindowProperty::New();
mitk::LevelWindow levelwindow;
levelwindow.SetAuto( image );
levWinProp->SetLevelWindow( levelwindow );
node->SetProperty( "levelwindow", levWinProp, renderer );
}
if((overwrite) || (node->GetProperty("TransferFunction", renderer)==NULL))
{
// add a default transfer function
mitk::TransferFunction::Pointer tf = mitk::TransferFunction::New();
mitk::TransferFunctionInitializer::Pointer tfInit = mitk::TransferFunctionInitializer::New(tf);
tfInit->SetTransferFunctionMode(0);
node->SetProperty ( "TransferFunction", mitk::TransferFunctionProperty::New ( tf.GetPointer() ) );
}
}
Superclass::SetDefaultProperties(node, renderer, overwrite);
}
bool mitk::GPUVolumeMapper3D::IsLODEnabled( mitk::BaseRenderer * renderer ) const
{
bool value = false;
return GetDataNode()->GetBoolProperty("volumerendering.uselod",value,renderer) && value;
}
bool mitk::GPUVolumeMapper3D::IsMIPEnabled( mitk::BaseRenderer * renderer )
{
bool value = false;
return GetDataNode()->GetBoolProperty("volumerendering.usemip",value,renderer) && value;
}
bool mitk::GPUVolumeMapper3D::IsGPUEnabled( mitk::BaseRenderer * renderer )
{
LocalStorage *ls = m_LSH.GetLocalStorage(renderer);
bool value = false;
return ls->m_gpuSupported && GetDataNode()->GetBoolProperty("volumerendering.usegpu",value,renderer) && value;
}
// Only with VTK 5.6 or above
#if ((VTK_MAJOR_VERSION > 5) || ((VTK_MAJOR_VERSION==5) && (VTK_MINOR_VERSION>=6) ))
bool mitk::GPUVolumeMapper3D::InitRAY(mitk::BaseRenderer* renderer)
{
LocalStorage *ls = m_LSH.GetLocalStorage(renderer);
if(ls->m_rayInitialized)
return ls->m_raySupported;
GPU_INFO << "initializing gpu-raycast-vr (vtkMitkOpenGLGPUVolumeRayCastMapper)";
ls->m_MapperRAY = vtkMitkOpenGLGPUVolumeRayCastMapper::New();
ls->m_MapperRAY->SetAutoAdjustSampleDistances(0);
ls->m_MapperRAY->SetSampleDistance(1.0);
ls->m_VolumePropertyRAY = vtkVolumeProperty::New();
ls->m_VolumePropertyRAY->ShadeOn();
ls->m_VolumePropertyRAY->SetAmbient (0.25f); //0.05f
ls->m_VolumePropertyRAY->SetDiffuse (0.50f); //0.45f
ls->m_VolumePropertyRAY->SetSpecular(0.40f); //0.50f
ls->m_VolumePropertyRAY->SetSpecularPower(16.0f);
ls->m_VolumePropertyRAY->SetInterpolationTypeToLinear();
ls->m_VolumeRAY = vtkVolume::New();
ls->m_VolumeRAY->SetMapper( ls->m_MapperRAY );
ls->m_VolumeRAY->SetProperty( ls->m_VolumePropertyRAY );
ls->m_VolumeRAY->VisibilityOn();
ls->m_MapperRAY->SetInput( this->m_UnitSpacingImageFilter->GetOutput() );
ls->m_raySupported = ls->m_MapperRAY->IsRenderSupported(renderer->GetRenderWindow(),ls->m_VolumePropertyRAY);
ls->m_rayInitialized = true;
return ls->m_raySupported;
}
void mitk::GPUVolumeMapper3D::DeinitRAY(mitk::BaseRenderer* renderer)
{
LocalStorage *ls = m_LSH.GetLocalStorage(renderer);
if(ls->m_rayInitialized)
{
GPU_INFO << "deinitializing gpu-raycast-vr";
ls->m_VolumeRAY->Delete();
ls->m_MapperRAY->Delete();
ls->m_VolumePropertyRAY->Delete();
ls->m_rayInitialized=false;
}
}
void mitk::GPUVolumeMapper3D::GenerateDataRAY( mitk::BaseRenderer *renderer )
{
LocalStorage *ls = m_LSH.GetLocalStorage(renderer);
if( IsLODEnabled(renderer) && mitk::RenderingManager::GetInstance()->GetNextLOD( renderer ) == 0 )
ls->m_MapperRAY->SetImageSampleDistance(4.0);
else
ls->m_MapperRAY->SetImageSampleDistance(1.0);
// Check raycasting mode
if(IsMIPEnabled(renderer))
ls->m_MapperRAY->SetBlendModeToMaximumIntensity();
else
ls->m_MapperRAY->SetBlendModeToComposite();
// Updating shadings
{
float value=0;
if(GetDataNode()->GetFloatProperty("volumerendering.ray.ambient",value,renderer))
ls->m_VolumePropertyRAY->SetAmbient(value);
if(GetDataNode()->GetFloatProperty("volumerendering.ray.diffuse",value,renderer))
ls->m_VolumePropertyRAY->SetDiffuse(value);
if(GetDataNode()->GetFloatProperty("volumerendering.ray.specular",value,renderer))
ls->m_VolumePropertyRAY->SetSpecular(value);
if(GetDataNode()->GetFloatProperty("volumerendering.ray.specular.power",value,renderer))
ls->m_VolumePropertyRAY->SetSpecularPower(value);
}
}
bool mitk::GPUVolumeMapper3D::IsRAYEnabled( mitk::BaseRenderer * renderer )
{
LocalStorage *ls = m_LSH.GetLocalStorage(renderer);
bool value = false;
return ls->m_raySupported && GetDataNode()->GetBoolProperty("volumerendering.useray",value,renderer) && value;
}
#endif
diff --git a/Modules/MitkExt/Rendering/mitkGPUVolumeMapper3D.h b/Modules/MitkExt/Rendering/mitkGPUVolumeMapper3D.h
index c10b614a42..3bc49e7137 100644
--- a/Modules/MitkExt/Rendering/mitkGPUVolumeMapper3D.h
+++ b/Modules/MitkExt/Rendering/mitkGPUVolumeMapper3D.h
@@ -1,204 +1,204 @@
/*=========================================================================
Program: Medical Imaging & Interaction Toolkit
Language: C++
Date: $Date: 2009-05-26 17:32:07 +0200 (Tue, 26 May 2009) $
Version: $Revision: 17418 $
Copyright (c) German Cancer Research Center, Division of Medical and
Biological Informatics. All rights reserved.
See MITKCopyright.txt or http://www.mitk.org/copyright.html for details.
This software is distributed WITHOUT ANY WARRANTY; without even
the implied warranty of MERCHANTABILITY or FITNESS FOR A PARTICULAR
PURPOSE. See the above copyright notices for more information.
=========================================================================*/
#ifndef MITKGPUVOLUMEMAPPER3D_H_HEADER_INCLUDED
#define MITKGPUVOLUMEMAPPER3D_H_HEADER_INCLUDED
#include "mitkCommon.h"
#include "MitkExtExports.h"
#include "mitkBaseRenderer.h"
#include "mitkVtkMapper3D.h"
#include "mitkImage.h"
#include <vtkFixedPointVolumeRayCastMapper.h>
#include "vtkMitkVolumeTextureMapper3D.h"
// Only with VTK 5.6 or above
#if ((VTK_MAJOR_VERSION > 5) || ((VTK_MAJOR_VERSION==5) && (VTK_MINOR_VERSION>=6) ))
#include "vtkMitkGPUVolumeRayCastMapper.h"
#endif
#include <vtkVolumeProperty.h>
#include <vtkImageChangeInformation.h>
namespace mitk {
/************************************************************************/
/* Properties that influence the mapper are:
*
* - \b "level window": for the level window of the volume data
* - \b "LookupTable" : for the lookup table of the volume data
* - \b "TransferFunction" (mitk::TransferFunctionProperty): for the used transfer function of the volume data
************************************************************************/
//##Documentation
//## @brief Vtk-based mapper for VolumeData
//##
//## @ingroup Mapper
class MitkExt_EXPORT GPUVolumeMapper3D : public VtkMapper3D
{
public:
mitkClassMacro(GPUVolumeMapper3D, VtkMapper3D);
itkNewMacro(Self);
virtual const mitk::Image* GetInput();
virtual vtkProp *GetVtkProp(mitk::BaseRenderer *renderer);
virtual void ApplyProperties(vtkActor* actor, mitk::BaseRenderer* renderer);
static void SetDefaultProperties(mitk::DataNode* node, mitk::BaseRenderer* renderer = NULL, bool overwrite = false);
/** Returns true if this Mapper currently allows for Level-of-Detail rendering.
* This reflects whether this Mapper currently invokes StartEvent, EndEvent, and
* ProgressEvent on BaseRenderer. */
virtual bool IsLODEnabled( BaseRenderer *renderer = NULL ) const;
bool IsMIPEnabled( BaseRenderer *renderer = NULL );
bool IsGPUEnabled( BaseRenderer *renderer = NULL );
bool IsRAYEnabled( BaseRenderer *renderer = NULL );
virtual void MitkRenderVolumetricGeometry(mitk::BaseRenderer* renderer);
protected:
GPUVolumeMapper3D();
virtual ~GPUVolumeMapper3D();
bool IsRenderable(mitk::BaseRenderer* renderer);
void InitCommon();
void DeinitCommon();
void InitCPU(mitk::BaseRenderer* renderer);
void DeinitCPU(mitk::BaseRenderer* renderer);
void GenerateDataCPU(mitk::BaseRenderer* renderer);
bool InitGPU(mitk::BaseRenderer* renderer);
void DeinitGPU(mitk::BaseRenderer* renderer);
void GenerateDataGPU(mitk::BaseRenderer* renderer);
// Only with VTK 5.6 or above
#if ((VTK_MAJOR_VERSION > 5) || ((VTK_MAJOR_VERSION==5) && (VTK_MINOR_VERSION>=6) ))
bool InitRAY(mitk::BaseRenderer* renderer);
void DeinitRAY(mitk::BaseRenderer* renderer);
void GenerateDataRAY(mitk::BaseRenderer* renderer);
#endif
void InitVtkMapper(mitk::BaseRenderer* renderer);
- virtual void GenerateData(mitk::BaseRenderer* renderer);
+ virtual void GenerateDataForRenderer(mitk::BaseRenderer* renderer);
void CreateDefaultTransferFunctions();
void UpdateTransferFunctions( mitk::BaseRenderer *renderer );
vtkVolume * m_VolumeNULL;
bool m_commonInitialized;
vtkImageChangeInformation* m_UnitSpacingImageFilter;
vtkPiecewiseFunction *m_DefaultOpacityTransferFunction;
vtkPiecewiseFunction *m_DefaultGradientTransferFunction;
vtkColorTransferFunction *m_DefaultColorTransferFunction;
vtkPiecewiseFunction *m_BinaryOpacityTransferFunction;
vtkPiecewiseFunction *m_BinaryGradientTransferFunction;
vtkColorTransferFunction *m_BinaryColorTransferFunction;
class LocalStorage : public mitk::Mapper::BaseLocalStorage
{
public:
bool m_cpuInitialized;
vtkVolume *m_VolumeCPU;
vtkFixedPointVolumeRayCastMapper* m_MapperCPU;
vtkVolumeProperty* m_VolumePropertyCPU;
bool m_gpuSupported;
bool m_gpuInitialized;
vtkVolume *m_VolumeGPU;
vtkMitkVolumeTextureMapper3D* m_MapperGPU;
vtkVolumeProperty* m_VolumePropertyGPU;
// Only with VTK 5.6 or above
#if ((VTK_MAJOR_VERSION > 5) || ((VTK_MAJOR_VERSION==5) && (VTK_MINOR_VERSION>=6) ))
bool m_raySupported;
bool m_rayInitialized;
vtkVolume *m_VolumeRAY;
vtkMitkGPUVolumeRayCastMapper* m_MapperRAY;
vtkVolumeProperty* m_VolumePropertyRAY;
#endif
LocalStorage()
{
m_cpuInitialized = false;
m_gpuInitialized = false;
m_gpuSupported = true; // assume initially gpu slicing is supported
// Only with VTK 5.6 or above
#if ((VTK_MAJOR_VERSION > 5) || ((VTK_MAJOR_VERSION==5) && (VTK_MINOR_VERSION>=6) ))
m_rayInitialized = false;
m_raySupported = true; // assume initially gpu raycasting is supported
#endif
}
~LocalStorage()
{
if(m_cpuInitialized)
{
m_VolumeCPU->Delete();
m_MapperCPU->Delete();
m_VolumePropertyCPU->Delete();
m_cpuInitialized=false;
}
if(m_gpuInitialized)
{
m_VolumeGPU->Delete();
m_MapperGPU->Delete();
m_VolumePropertyGPU->Delete();
m_gpuInitialized=false;
}
// Only with VTK 5.6 or above
#if ((VTK_MAJOR_VERSION > 5) || ((VTK_MAJOR_VERSION==5) && (VTK_MINOR_VERSION>=6) ))
if(m_rayInitialized)
{
m_VolumeRAY->Delete();
m_MapperRAY->Delete();
m_VolumePropertyRAY->Delete();
m_rayInitialized=false;
}
#endif
}
};
mitk::Mapper::LocalStorageHandler<LocalStorage> m_LSH;
};
} // namespace mitk
#endif /* MITKVOLUMEDATAVTKMAPPER3D_H_HEADER_INCLUDED */
diff --git a/Modules/MitkExt/Rendering/mitkLineVtkMapper3D.cpp b/Modules/MitkExt/Rendering/mitkLineVtkMapper3D.cpp
index a754ee51b9..15e0a39667 100644
--- a/Modules/MitkExt/Rendering/mitkLineVtkMapper3D.cpp
+++ b/Modules/MitkExt/Rendering/mitkLineVtkMapper3D.cpp
@@ -1,160 +1,160 @@
/*=========================================================================
Program: Medical Imaging & Interaction Toolkit
Language: C++
Date: $Date$
Version: $Revision$
Copyright (c) German Cancer Research Center, Division of Medical and
Biological Informatics. All rights reserved.
See MITKCopyright.txt or http://www.mitk.org/copyright.html for details.
This software is distributed WITHOUT ANY WARRANTY; without even
the implied warranty of MERCHANTABILITY or FITNESS FOR A PARTICULAR
PURPOSE. See the above copyright notices for more information.
=========================================================================*/
#include "mitkLineVtkMapper3D.h"
#include <vtkPolyDataMapper.h>
#include <vtkActor.h>
#include <vtkProp3DCollection.h>
#include <mitkProperties.h>
#include "mitkStringProperty.h"
#include <vtkProperty.h>
mitk::LineVtkMapper3D::LineVtkMapper3D()
: PointSetVtkMapper3D()//constructor of superclass
{
}
mitk::LineVtkMapper3D::~LineVtkMapper3D()
{
}
-void mitk::LineVtkMapper3D::GenerateData(mitk::BaseRenderer* renderer)
+void mitk::LineVtkMapper3D::GenerateDataForRenderer(mitk::BaseRenderer* renderer)
{//from PointListVTKMapper3D and a little re-layouted!
if(IsVisible(renderer)==false)
{
m_Actor->VisibilityOff();
return;
}
m_Actor->VisibilityOn();
m_vtkPointList->Delete();
m_vtkTextList->Delete();
m_contour->Delete();
m_tubefilter->Delete();
m_vtkPointList = vtkAppendPolyData::New();
m_vtkTextList = vtkAppendPolyData::New();
m_contour = vtkPolyData::New();
m_tubefilter = vtkTubeFilter::New();
mitk::PointSet::Pointer input = const_cast<mitk::PointSet*>(this->GetInput());
mitk::PointSet::PointSetType::Pointer pointList;
pointList = input->GetPointList();
mitk::PointSet::PointsContainer::Iterator i;
int j;
bool makeContour;
if (dynamic_cast<mitk::BoolProperty *>(this->GetDataNode()->GetProperty("show contour").GetPointer()) == NULL)
makeContour = false;
else
makeContour = dynamic_cast<mitk::BoolProperty *>(this->GetDataNode()->GetProperty("show contour").GetPointer())->GetValue();
vtkPoints *points = vtkPoints::New();
vtkCellArray *polys = vtkCellArray::New();
for (j=0, i=pointList->GetPoints()->Begin(); i!=pointList->GetPoints()->End() ; i++,j++)
{
int cell[2] = {j-1,j};
points->InsertPoint(j,i.Value()[0],i.Value()[1],i.Value()[2]);
if (j>0)
polys->InsertNextCell(2,cell);
}
bool close;
if (dynamic_cast<mitk::BoolProperty *>(this->GetDataNode()->GetProperty("close contour").GetPointer()) == NULL)
close = false;
else
close = dynamic_cast<mitk::BoolProperty *>(this->GetDataNode()->GetProperty("close contour").GetPointer())->GetValue();
if (close)
{
int cell[2] = {j-1,0};
polys->InsertNextCell(2,cell);
}
m_contour->SetPoints(points);
points->Delete();
m_contour->SetLines(polys);
polys->Delete();
m_contour->Update();
m_tubefilter->SetInput(m_contour);
m_tubefilter->SetRadius(1);
m_tubefilter->Update();;
m_vtkPointList->AddInput(m_tubefilter->GetOutput());
// check for color prop and use it for rendering if it exists
float rgba[4]={1.0f,1.0f,1.0f,1.0f};
GetColor(rgba, renderer);
for (j=0, i=pointList->GetPoints()->Begin(); i!=pointList->GetPoints()->End() ; i++,j++)
{
vtkSphereSource *sphere = vtkSphereSource::New();
sphere->SetRadius(2);
sphere->SetCenter(i.Value()[0],i.Value()[1],i.Value()[2]);
m_vtkPointList->AddInput(sphere->GetOutput());
if (dynamic_cast<mitk::StringProperty *>(this->GetDataNode()->GetProperty("label").GetPointer()) == NULL)
{
}
else
{
const char * pointLabel =dynamic_cast<mitk::StringProperty *>(this->GetDataNode()->GetProperty("label").GetPointer())->GetValue();
char buffer[20];
std::string l = pointLabel;
if (input->GetSize()>1)
{
sprintf(buffer,"%d",j+1);
l.append(buffer);
}
// Define the text for the label
vtkVectorText *label = vtkVectorText::New();
label->SetText(l.c_str());
// Set up a transform to move the label to a new position.
vtkTransform *aLabelTransform =vtkTransform::New();
aLabelTransform->Identity();
aLabelTransform->Translate(i.Value()[0]+2,i.Value()[1]+2,i.Value()[2]);
aLabelTransform->Scale(5.7,5.7,5.7);
// Move the label to a new position.
vtkTransformPolyDataFilter *labelTransform = vtkTransformPolyDataFilter::New();
labelTransform->SetTransform(aLabelTransform);
labelTransform->SetInput(label->GetOutput());
m_vtkPointList->AddInput(labelTransform->GetOutput());
}
}
m_VtkPolyDataMapper->SetInput(m_vtkPointList->GetOutput());
m_Actor->GetProperty()->SetColor(rgba);
}
diff --git a/Modules/MitkExt/Rendering/mitkLineVtkMapper3D.h b/Modules/MitkExt/Rendering/mitkLineVtkMapper3D.h
index 96f40443bd..4c1a8f6364 100644
--- a/Modules/MitkExt/Rendering/mitkLineVtkMapper3D.h
+++ b/Modules/MitkExt/Rendering/mitkLineVtkMapper3D.h
@@ -1,71 +1,71 @@
/*=========================================================================
Program: Medical Imaging & Interaction Toolkit
Language: C++
Date: $Date$
Version: $Revision$
Copyright (c) German Cancer Research Center, Division of Medical and
Biological Informatics. All rights reserved.
See MITKCopyright.txt or http://www.mitk.org/copyright.html for details.
This software is distributed WITHOUT ANY WARRANTY; without even
the implied warranty of MERCHANTABILITY or FITNESS FOR A PARTICULAR
PURPOSE. See the above copyright notices for more information.
=========================================================================*/
#ifndef MITKLINEVTKMAPPER3D_H_HEADER_INCLUDED
#define MITKLINEVTKMAPPER3D_H_HEADER_INCLUDED
#include "mitkCommon.h"
#include "MitkExtExports.h"
#include "mitkPointSetVtkMapper3D.h"
#include "mitkPointSet.h"
#include "mitkBaseRenderer.h"
#include <vtkSphereSource.h>
#include <vtkAppendPolyData.h>
#include <vtkPolyData.h>
#include <vtkPoints.h>
#include <vtkPointData.h>
#include <vtkCellArray.h>
#include <vtkFloatArray.h>
#include <vtkTubeFilter.h>
#include <vtkVectorText.h>
#include <vtkTextSource.h>
#include <vtkTransform.h>
#include <vtkTransformPolyDataFilter.h>
class vtkActor;
class vtkAssembly;
class vtkFollower;
class vtkPolyDataMapper;
namespace mitk {
//##Documentation
//## @brief Vtk-based mapper to draw Lines from PointSet
//##
//## @ingroup Mapper
class MitkExt_EXPORT LineVtkMapper3D : public PointSetVtkMapper3D
{
public:
mitkClassMacro(LineVtkMapper3D, PointSetVtkMapper3D);
itkNewMacro(Self);
protected:
LineVtkMapper3D();
virtual ~LineVtkMapper3D();
- virtual void GenerateData(mitk::BaseRenderer* renderer);
+ virtual void GenerateDataForRenderer(mitk::BaseRenderer* renderer);
};
} // namespace mitk
#endif /* MITKLINEVTKMAPPER3D_H_HEADER_INCLUDED */
diff --git a/Modules/MitkExt/Rendering/mitkMeshVtkMapper3D.cpp b/Modules/MitkExt/Rendering/mitkMeshVtkMapper3D.cpp
index 4225c3bf5f..c1fd8a48cb 100644
--- a/Modules/MitkExt/Rendering/mitkMeshVtkMapper3D.cpp
+++ b/Modules/MitkExt/Rendering/mitkMeshVtkMapper3D.cpp
@@ -1,228 +1,228 @@
/*=========================================================================
Program: Medical Imaging & Interaction Toolkit
Language: C++
Date: $Date$
Version: $Revision$
Copyright (c) German Cancer Research Center, Division of Medical and
Biological Informatics. All rights reserved.
See MITKCopyright.txt or http://www.mitk.org/copyright.html for details.
This software is distributed WITHOUT ANY WARRANTY; without even
the implied warranty of MERCHANTABILITY or FITNESS FOR A PARTICULAR
PURPOSE. See the above copyright notices for more information.
=========================================================================*/
#include "mitkMeshVtkMapper3D.h"
#include "mitkDataNode.h"
#include "mitkProperties.h"
#include "mitkVtkPropRenderer.h"
#ifndef VCL_VC60
#include "mitkMeshUtil.h"
#endif
#include <vtkActor.h>
#include <vtkFollower.h>
#include <vtkAssembly.h>
#include <vtkProp3DCollection.h>
#include <vtkRenderer.h>
#include <vtkPropAssembly.h>
#include <vtkProperty.h>
#include <vtkPolyDataMapper.h>
#include <stdlib.h>
const mitk::Mesh* mitk::MeshVtkMapper3D::GetInput()
{
return static_cast<const mitk::Mesh * > ( GetData() );
}
vtkProp* mitk::MeshVtkMapper3D::GetVtkProp(mitk::BaseRenderer * /*renderer*/)
{
return m_PropAssembly;
}
void mitk::MeshVtkMapper3D::UpdateVtkTransform(mitk::BaseRenderer * /*renderer*/)
{
vtkLinearTransform * vtktransform =
this->GetDataNode()->GetVtkTransform(this->GetTimestep());
m_SpheresActor->SetUserTransform(vtktransform);
m_ContourActor->SetUserTransform(vtktransform);
}
mitk::MeshVtkMapper3D::MeshVtkMapper3D()
: m_PropAssembly(NULL)
{
m_Spheres = vtkAppendPolyData::New();
m_Contour = vtkPolyData::New();
m_SpheresActor = vtkActor::New();
m_SpheresMapper = vtkPolyDataMapper::New();
m_SpheresActor->SetMapper(m_SpheresMapper);
m_ContourActor = vtkActor::New();
m_ContourMapper = vtkPolyDataMapper::New();
m_ContourActor->SetMapper(m_ContourMapper);
m_ContourActor->GetProperty()->SetAmbient(1.0);
m_PropAssembly = vtkPropAssembly::New();
// a vtkPropAssembly is not a sub-class of vtkProp3D, so
// we cannot use m_Prop3D.
}
mitk::MeshVtkMapper3D::~MeshVtkMapper3D()
{
m_ContourActor->Delete();
m_SpheresActor->Delete();
m_ContourMapper->Delete();
m_SpheresMapper->Delete();
m_PropAssembly->Delete();
m_Spheres->Delete();
m_Contour->Delete();
}
void mitk::MeshVtkMapper3D::GenerateData()
{
m_PropAssembly->VisibilityOn();
if(m_PropAssembly->GetParts()->IsItemPresent(m_SpheresActor))
m_PropAssembly->RemovePart(m_SpheresActor);
if(m_PropAssembly->GetParts()->IsItemPresent(m_ContourActor))
m_PropAssembly->RemovePart(m_ContourActor);
m_Spheres->RemoveAllInputs();
m_Contour->Initialize();
mitk::Mesh::Pointer input = const_cast<mitk::Mesh*>(this->GetInput());
input->Update();
mitk::Mesh::DataType::Pointer itkMesh = input->GetMesh( this->GetTimestep() );
if ( itkMesh.GetPointer() == NULL)
{
m_PropAssembly->VisibilityOff();
return;
}
mitk::Mesh::PointsContainer::Iterator i;
int j;
float floatRgba[4] = {1.0f,1.0f,1.0f,1.0f};
vtkFloatingPointType doubleRgba[4]={1.0f,1.0f,1.0f,1.0f};
mitk::Color tmpColor;
// check for color prop and use it for rendering if it exists
m_DataNode->GetColor(floatRgba, NULL);
if (dynamic_cast<mitk::ColorProperty*>(this->GetDataNode()->GetProperty("unselectedcolor")) != NULL)
{
tmpColor = dynamic_cast<mitk::ColorProperty *>(this->GetDataNode()->GetProperty("unselectedcolor"))->GetValue();
floatRgba[0] = tmpColor[0];
floatRgba[1] = tmpColor[1];
floatRgba[2] = tmpColor[2];
floatRgba[3] = 1.0f; //!!define a new ColorProp to be able to pass alpha value
doubleRgba[0] = floatRgba[0];
doubleRgba[1] = floatRgba[1];
doubleRgba[2] = floatRgba[2];
doubleRgba[3] = floatRgba[3];
}
if(itkMesh->GetNumberOfPoints()>0)
{
// build m_Spheres->GetOutput() vtkPolyData
float pointSize = 2.0;
mitk::FloatProperty::Pointer pointSizeProp = dynamic_cast<mitk::FloatProperty *>(this->GetDataNode()->GetProperty("pointsize"));
if (pointSizeProp.IsNotNull())
pointSize = pointSizeProp->GetValue();
for (j=0, i=itkMesh->GetPoints()->Begin(); i!=itkMesh->GetPoints()->End() ; i++,j++)
{
vtkSphereSource *sphere = vtkSphereSource::New();
sphere->SetRadius(pointSize);
sphere->SetCenter(i.Value()[0],i.Value()[1],i.Value()[2]);
m_Spheres->AddInput(sphere->GetOutput());
sphere->Delete();
}
// setup mapper, actor and add to assembly
m_SpheresMapper->SetInput(m_Spheres->GetOutput());
m_SpheresActor->GetProperty()->SetColor(doubleRgba);
m_PropAssembly->AddPart(m_SpheresActor);
}
if(itkMesh->GetNumberOfCells()>0)
{
// build m_Contour vtkPolyData
#ifdef VCL_VC60
itkExceptionMacro(<<"MeshVtkMapper3D currently not working for MS Visual C++ 6.0, because MeshUtils are currently not supported.");
#else
m_Contour = MeshUtil<mitk::Mesh::MeshType>::MeshToPolyData(itkMesh.GetPointer(), false, false, 0, NULL, m_Contour);
#endif
if(m_Contour->GetNumberOfCells()>0)
{
// setup mapper, actor and add to assembly
m_ContourMapper->SetInput(m_Contour);
bool wireframe=true;
GetDataNode()->GetVisibility(wireframe, NULL, "wireframe");
if(wireframe)
m_ContourActor->GetProperty()->SetRepresentationToWireframe();
else
m_ContourActor->GetProperty()->SetRepresentationToSurface();
m_ContourActor->GetProperty()->SetColor(doubleRgba);
m_PropAssembly->AddPart(m_ContourActor);
}
}
}
-void mitk::MeshVtkMapper3D::GenerateData( mitk::BaseRenderer* renderer )
+void mitk::MeshVtkMapper3D::GenerateDataForRenderer( mitk::BaseRenderer* renderer )
{
SetVtkMapperImmediateModeRendering(m_ContourMapper);
SetVtkMapperImmediateModeRendering(m_SpheresMapper);
if(IsVisible(renderer)==false)
{
m_SpheresActor->VisibilityOff();
m_ContourActor->VisibilityOff();
return;
}
bool makeContour = false;
this->GetDataNode()->GetBoolProperty("show contour", makeContour);
if (makeContour)
{
m_ContourActor->VisibilityOn();
}
else
{
m_ContourActor->VisibilityOff();
}
bool showPoints = true;
this->GetDataNode()->GetBoolProperty("show points", showPoints);
if(showPoints)
{
m_SpheresActor->VisibilityOn();
}
else
{
m_SpheresActor->VisibilityOff();
}
}
void mitk::MeshVtkMapper3D::ResetMapper( BaseRenderer* /*renderer*/ )
{
m_PropAssembly->VisibilityOff();
}
diff --git a/Modules/MitkExt/Rendering/mitkMeshVtkMapper3D.h b/Modules/MitkExt/Rendering/mitkMeshVtkMapper3D.h
index 56f47b3bfd..c6a5bde398 100644
--- a/Modules/MitkExt/Rendering/mitkMeshVtkMapper3D.h
+++ b/Modules/MitkExt/Rendering/mitkMeshVtkMapper3D.h
@@ -1,93 +1,93 @@
/*=========================================================================
Program: Medical Imaging & Interaction Toolkit
Language: C++
Date: $Date$
Version: $Revision$
Copyright (c) German Cancer Research Center, Division of Medical and
Biological Informatics. All rights reserved.
See MITKCopyright.txt or http://www.mitk.org/copyright.html for details.
This software is distributed WITHOUT ANY WARRANTY; without even
the implied warranty of MERCHANTABILITY or FITNESS FOR A PARTICULAR
PURPOSE. See the above copyright notices for more information.
=========================================================================*/
#ifndef MITKMESHVTKMAPPER3D_H_HEADER_INCLUDED
#define MITKMESHVTKMAPPER3D_H_HEADER_INCLUDED
#include "mitkCommon.h"
#include "MitkExtExports.h"
#include "mitkVtkMapper3D.h"
#include "mitkMesh.h"
#include "mitkBaseRenderer.h"
#include <vtkSphereSource.h>
#include <vtkAppendPolyData.h>
#include <vtkPolyData.h>
#include <vtkPoints.h>
#include <vtkPointData.h>
#include <vtkCellArray.h>
#include <vtkFloatArray.h>
#include <vtkTubeFilter.h>
#include <vtkVectorText.h>
#include <vtkTextSource.h>
#include <vtkLinearTransform.h>
#include <vtkTransformPolyDataFilter.h>
class vtkActor;
class vtkAssembly;
class vtkFollower;
class vtkPolyDataMapper;
class vtkPropAssembly;
namespace mitk {
/**
* \brief Vtk-based mapper for PointList
* \ingroup Mapper
*/
class MitkExt_EXPORT MeshVtkMapper3D : public VtkMapper3D
{
public:
mitkClassMacro(MeshVtkMapper3D, VtkMapper3D);
itkNewMacro(Self);
virtual const mitk::Mesh* GetInput();
virtual vtkProp* GetVtkProp(mitk::BaseRenderer *renderer);
virtual void UpdateVtkTransform(mitk::BaseRenderer *renderer);
protected:
MeshVtkMapper3D();
virtual ~MeshVtkMapper3D();
virtual void GenerateData();
- virtual void GenerateData(mitk::BaseRenderer* renderer);
+ virtual void GenerateDataForRenderer(mitk::BaseRenderer* renderer);
virtual void ResetMapper( BaseRenderer* renderer );
vtkPropAssembly* m_PropAssembly;
vtkActor *m_SpheresActor;
vtkActor *m_ContourActor;
vtkPolyDataMapper* m_ContourMapper;
vtkPolyDataMapper* m_SpheresMapper;
vtkPolyDataMapper* m_TextVtkPolyDataMapper;
vtkAppendPolyData *m_Spheres;
vtkPolyData *m_Contour;
};
} // namespace mitk
#endif /* MITKMESHVTKMAPPER3D_H_HEADER_INCLUDED*/
diff --git a/Modules/MitkExt/Rendering/mitkSplineVtkMapper3D.cpp b/Modules/MitkExt/Rendering/mitkSplineVtkMapper3D.cpp
index 97fcac60ab..2d1fe3e3fe 100644
--- a/Modules/MitkExt/Rendering/mitkSplineVtkMapper3D.cpp
+++ b/Modules/MitkExt/Rendering/mitkSplineVtkMapper3D.cpp
@@ -1,235 +1,235 @@
/*=========================================================================
Program: Medical Imaging & Interaction Toolkit
Language: C++
Date: $Date$
Version: $Revision$
Copyright (c) German Cancer Research Center, Division of Medical and
Biological Informatics. All rights reserved.
See MITKCopyright.txt or http://www.mitk.org/copyright.html for details.
This software is distributed WITHOUT ANY WARRANTY; without even
the implied warranty of MERCHANTABILITY or FITNESS FOR A PARTICULAR
PURPOSE. See the above copyright notices for more information.
=========================================================================*/
#include "mitkSplineVtkMapper3D.h"
#include <vtkProp.h>
#include <vtkPropAssembly.h>
#include <vtkCardinalSpline.h>
#include <vtkPoints.h>
#include <vtkPolyData.h>
#include <vtkCellArray.h>
#include <vtkPolyDataMapper.h>
#include <vtkActor.h>
#include <vtkProperty.h>
#include <vtkTubeFilter.h>
#include <vtkPropCollection.h>
#include <mitkProperties.h>
#include <mitkPointSet.h>
mitk::SplineVtkMapper3D::SplineVtkMapper3D()
: m_SplinesAvailable (false), m_SplinesAddedToAssembly(false)
{
m_SplinesActor = vtkActor::New();
m_SplineAssembly = vtkPropAssembly::New();
m_SplineResolution = 500;
}
mitk::SplineVtkMapper3D::~SplineVtkMapper3D()
{
m_SplinesActor->Delete();
m_SplineAssembly->Delete();
}
vtkProp*
mitk::SplineVtkMapper3D::GetVtkProp(mitk::BaseRenderer * /*renderer*/)
{
return m_SplineAssembly;
}
void mitk::SplineVtkMapper3D::UpdateVtkTransform(mitk::BaseRenderer * /*renderer*/)
{
vtkLinearTransform * vtktransform =
this->GetDataNode()->GetVtkTransform(this->GetTimestep());
m_SplinesActor->SetUserTransform(vtktransform);
}
void
mitk::SplineVtkMapper3D::GenerateData()
{
Superclass::GenerateData();
// only update spline if UpdateSpline has not been called from
// external, e.g. by the SplineMapper2D. But call it the first time when m_SplineUpdateTime = 0 and m_LastUpdateTime = 0.
if ( m_SplineUpdateTime < m_LastUpdateTime || m_SplineUpdateTime == 0)
{
this->UpdateSpline();
this->ApplyProperties();
}
if ( m_SplinesAvailable )
{
if ( ! m_SplinesAddedToAssembly )
{
m_SplineAssembly->AddPart( m_SplinesActor );
m_SplinesAddedToAssembly = true;
}
}
else
{
if ( m_SplinesAddedToAssembly )
{
m_SplineAssembly->RemovePart( m_SplinesActor );
m_SplinesAddedToAssembly = false;
}
}
}
-void mitk::SplineVtkMapper3D::GenerateData( mitk::BaseRenderer* renderer )
+void mitk::SplineVtkMapper3D::GenerateDataForRenderer( mitk::BaseRenderer* renderer )
{
if ( IsVisible( renderer ) == false )
{
m_SplinesActor->VisibilityOff();
m_SplineAssembly->VisibilityOff();
}
else
{
m_SplinesActor->VisibilityOn();
m_SplineAssembly->VisibilityOn();
//remove the PointsAssembly if it was added in superclass. No need to display points and spline!
if(m_SplineAssembly->GetParts()->IsItemPresent(m_PointsAssembly))
m_SplineAssembly->RemovePart(m_PointsAssembly);
}
//if the properties have been changed, then refresh the properties
if ( (m_SplineUpdateTime < this->m_DataNode->GetPropertyList()->GetMTime() ) ||
(m_SplineUpdateTime < this->m_DataNode->GetPropertyList(renderer)->GetMTime() ) )
this->ApplyProperties();
}
void mitk::SplineVtkMapper3D::ApplyProperties()
{
//vtk changed the type of rgba during releases. Due to that, the following convert is done
vtkFloatingPointType rgba[ 4 ] = {1.0f, 1.0f, 1.0f, 1.0f};//white
//getting the color from DataNode
float temprgba[4];
this->GetDataNode()->GetColor( &temprgba[0], NULL );
//convert to rgba, what ever type it has!
rgba[0] = temprgba[0]; rgba[1] = temprgba[1]; rgba[2] = temprgba[2]; rgba[3] = temprgba[3];
//finaly set the color inside the actor
m_SplinesActor->GetProperty()->SetColor( rgba );
float lineWidth;
if (dynamic_cast<mitk::FloatProperty *>(this->GetDataNode()->GetProperty("line width")) == NULL)
lineWidth = 1.0;
else
lineWidth = dynamic_cast<mitk::FloatProperty *>(this->GetDataNode()->GetProperty("line width"))->GetValue();
m_SplinesActor->GetProperty()->SetLineWidth(lineWidth);
m_SplineUpdateTime.Modified();
}
bool mitk::SplineVtkMapper3D::SplinesAreAvailable()
{
return m_SplinesAvailable;
}
vtkPolyData* mitk::SplineVtkMapper3D::GetSplinesPolyData()
{
if ( m_SplinesAvailable )
return ( dynamic_cast<vtkPolyDataMapper*>( m_SplinesActor->GetMapper() ) )->GetInput();
else
return NULL;
}
vtkActor* mitk::SplineVtkMapper3D::GetSplinesActor()
{
if ( m_SplinesAvailable )
return m_SplinesActor;
else
return vtkActor::New();
}
unsigned long mitk::SplineVtkMapper3D::GetLastUpdateTime() const
{
return m_LastUpdateTime.GetMTime();
}
void mitk::SplineVtkMapper3D::UpdateSpline()
{
mitk::PointSet::Pointer input = const_cast<mitk::PointSet*>( this->GetInput( ) );
// input->Update();//already done in superclass
// Number of points on the spline
unsigned int numberOfOutputPoints = m_SplineResolution;
unsigned int numberOfInputPoints = input->GetSize();
if ( numberOfInputPoints >= 2 )
{
m_SplinesAvailable = true;
vtkCardinalSpline* splineX = vtkCardinalSpline::New();
vtkCardinalSpline* splineY = vtkCardinalSpline::New();
vtkCardinalSpline* splineZ = vtkCardinalSpline::New();
unsigned int index = 0;
mitk::PointSet::DataType::PointsContainer::Pointer pointsContainer = input->GetPointSet()->GetPoints();
for ( mitk::PointSet::DataType::PointsContainer::Iterator it = pointsContainer->Begin(); it != pointsContainer->End(); ++it, ++index )
//for ( unsigned int i = 0 ; i < numberOfInputPoints; ++i )
{
mitk::PointSet::PointType point = it->Value();
splineX->AddPoint( index, point[ 0 ] );
splineY->AddPoint( index, point[ 1 ] );
splineZ->AddPoint( index, point[ 2 ] );
}
vtkPoints* points = vtkPoints::New();
vtkPolyData* profileData = vtkPolyData::New();
// Interpolate x, y and z by using the three spline filters and
// create new points
double t = 0.0f;
for ( unsigned int i = 0; i < numberOfOutputPoints; ++i )
{
t = ( ( ( ( double ) numberOfInputPoints ) - 1.0f ) / ( ( ( double ) numberOfOutputPoints ) - 1.0f ) ) * ( ( double ) i );
points->InsertPoint( i, splineX->Evaluate( t ), splineY->Evaluate( t ), splineZ->Evaluate( t ) ) ;
}
// Create the polyline.
vtkCellArray* lines = vtkCellArray::New();
lines->InsertNextCell( numberOfOutputPoints );
for ( unsigned int i = 0; i < numberOfOutputPoints; ++i )
lines->InsertCellPoint( i );
profileData->SetPoints( points );
profileData->SetLines( lines );
// Add thickness to the resulting line.
//vtkTubeFilter* profileTubes = vtkTubeFilter::New();
//profileTubes->SetNumberOfSides(8);
//profileTubes->SetInput(profileData);
//profileTubes->SetRadius(.005);
vtkPolyDataMapper* profileMapper = vtkPolyDataMapper::New();
profileMapper->SetInput( profileData );
m_SplinesActor->SetMapper( profileMapper );
}
else
{
m_SplinesAvailable = false;
}
m_SplineUpdateTime.Modified();
}
diff --git a/Modules/MitkExt/Rendering/mitkSplineVtkMapper3D.h b/Modules/MitkExt/Rendering/mitkSplineVtkMapper3D.h
index 3bce2ab1dc..7117c08011 100644
--- a/Modules/MitkExt/Rendering/mitkSplineVtkMapper3D.h
+++ b/Modules/MitkExt/Rendering/mitkSplineVtkMapper3D.h
@@ -1,99 +1,99 @@
/*=========================================================================
Program: Medical Imaging & Interaction Toolkit
Language: C++
Date: $Date$
Version: $Revision$
Copyright (c) German Cancer Research Center, Division of Medical and
Biological Informatics. All rights reserved.
See MITKCopyright.txt or http://www.mitk.org/copyright.html for details.
This software is distributed WITHOUT ANY WARRANTY; without even
the implied warranty of MERCHANTABILITY or FITNESS FOR A PARTICULAR
PURPOSE. See the above copyright notices for more information.
=========================================================================*/
#ifndef _MITK_SPLINE_VTK_MAPPER_3D__H
#define _MITK_SPLINE_VTK_MAPPER_3D__H
#include "mitkPointSetVtkMapper3D.h"
#include "MitkExtExports.h"
class vtkActor;
class vtkAssembly;
namespace mitk
{
//##Documentation
//## @brief Vtk-based mapper for Splines
//##
//## properties looked for:
//## "line width" = with of the spline
//## @ingroup Mapper
/************************************************************************/
/*
* - \b "line width": (FloatProperty) line width of the spline
*/
/************************************************************************/
class MitkExt_EXPORT SplineVtkMapper3D : public PointSetVtkMapper3D
{
public:
mitkClassMacro( SplineVtkMapper3D, PointSetVtkMapper3D );
itkNewMacro( Self );
virtual vtkProp* GetVtkProp(mitk::BaseRenderer *renderer);
virtual void UpdateVtkTransform(mitk::BaseRenderer *renderer);
bool SplinesAreAvailable();
vtkPolyData* GetSplinesPolyData();
vtkActor* GetSplinesActor();
unsigned long GetLastUpdateTime() const;
virtual void UpdateSpline();
itkSetMacro( SplineResolution, unsigned int );
itkGetMacro( SplineResolution, unsigned int );
protected:
SplineVtkMapper3D();
virtual ~SplineVtkMapper3D();
virtual void GenerateData();
- virtual void GenerateData(mitk::BaseRenderer * renderer);
+ virtual void GenerateDataForRenderer(mitk::BaseRenderer * renderer);
virtual void ApplyProperties();
vtkActor* m_SplinesActor;
vtkPropAssembly* m_SplineAssembly;
bool m_SplinesAvailable;
bool m_SplinesAddedToAssembly;
unsigned int m_SplineResolution;
itk::TimeStamp m_SplineUpdateTime;
};
} //namespace mitk
#endif
diff --git a/Modules/MitkExt/Rendering/mitkUnstructuredGridMapper2D.cpp b/Modules/MitkExt/Rendering/mitkUnstructuredGridMapper2D.cpp
index 4251686d1d..65ef95247a 100644
--- a/Modules/MitkExt/Rendering/mitkUnstructuredGridMapper2D.cpp
+++ b/Modules/MitkExt/Rendering/mitkUnstructuredGridMapper2D.cpp
@@ -1,559 +1,559 @@
/*=========================================================================
Program: Medical Imaging & Interaction Toolkit
Language: C++
Date: $Date$
Version: $Revision: 11618 $
Copyright (c) German Cancer Research Center, Division of Medical and
Biological Informatics. All rights reserved.
See MITKCopyright.txt or http://www.mitk.org/copyright.html for details.
This software is distributed WITHOUT ANY WARRANTY; without even
the implied warranty of MERCHANTABILITY or FITNESS FOR A PARTICULAR
PURPOSE. See the above copyright notices for more information.
=========================================================================*/
#include <mitkGL.h>
#include "mitkUnstructuredGridMapper2D.h"
#include "mitkBaseRenderer.h"
#include "mitkPlaneGeometry.h"
#include "mitkUnstructuredGrid.h"
#include "mitkTransferFunction.h"
#include "mitkTransferFunctionProperty.h"
#include "mitkColorProperty.h"
#include "mitkVtkScalarModeProperty.h"
#include "mitkProperties.h"
#include "mitkAbstractTransformGeometry.h"
#include "mitkVtkMapper3D.h"
#include <vtkPointSetSlicer.h>
#include <vtkUnstructuredGrid.h>
#include <vtkPlane.h>
#include <vtkCellArray.h>
#include <vtkLookupTable.h>
#include <vtkPointData.h>
#include <vtkCellData.h>
#include <vtkLinearTransform.h>
#include <vtkVolume.h>
#include <vtkAssembly.h>
#include <vtkVolumeProperty.h>
#include <vtkAbstractMapper3D.h>
#include <vtkAbstractVolumeMapper.h>
#include <vtkScalarsToColors.h>
#include <vtkPiecewiseFunction.h>
#include <vtkColorTransferFunction.h>
#include <vtkProp3DCollection.h>
void mitk::UnstructuredGridMapper2D::GenerateData()
{
mitk::DataNode::ConstPointer node = this->GetDataNode();
if ( node.IsNull() )
return;
if (!node->GetProperty(m_ScalarMode, "scalar mode"))
{
m_ScalarMode = mitk::VtkScalarModeProperty::New(0);
}
if (!node->GetProperty(m_ScalarVisibility, "scalar visibility"))
{
m_ScalarVisibility = mitk::BoolProperty::New(true);
}
if (!node->GetProperty(m_Outline, "outline polygons"))
{
m_Outline = mitk::BoolProperty::New(false);
}
if (!node->GetProperty(m_Color, "color"))
{
m_Color = mitk::ColorProperty::New(1.0f, 1.0f, 1.0f);
}
if (!node->GetProperty(m_LineWidth, "line width"))
{
m_LineWidth = mitk::IntProperty::New(1);
}
}
-void mitk::UnstructuredGridMapper2D::GenerateData( mitk::BaseRenderer* renderer )
+void mitk::UnstructuredGridMapper2D::GenerateDataForRenderer( mitk::BaseRenderer* renderer )
{
mitk::BaseData::Pointer input = const_cast<mitk::BaseData*>( this->GetData() );
assert( input );
input->Update();
if (m_VtkPointSet) m_VtkPointSet->UnRegister(0);
m_VtkPointSet = this->GetVtkPointSet(renderer);
assert(m_VtkPointSet);
m_VtkPointSet->Register(0);
if (m_ScalarVisibility->GetValue())
{
mitk::DataNode::ConstPointer node = this->GetDataNode();
mitk::TransferFunctionProperty::Pointer transferFuncProp;
node->GetProperty(transferFuncProp, "TransferFunction", renderer);
if (transferFuncProp.IsNotNull())
{
mitk::TransferFunction::Pointer tf = transferFuncProp->GetValue();
if (m_ScalarsToColors) m_ScalarsToColors->UnRegister(0);
m_ScalarsToColors = static_cast<vtkScalarsToColors*>(tf->GetColorTransferFunction());
m_ScalarsToColors->Register(0);
if (m_ScalarsToOpacity) m_ScalarsToOpacity->UnRegister(0);
m_ScalarsToOpacity = tf->GetScalarOpacityFunction();
m_ScalarsToOpacity->Register(0);
}
else
{
if (m_ScalarsToColors) m_ScalarsToColors->UnRegister(0);
m_ScalarsToColors = this->GetVtkLUT(renderer);
assert(m_ScalarsToColors);
m_ScalarsToColors->Register(0);
float opacity;
node->GetOpacity(opacity, renderer);
if (m_ScalarsToOpacity) m_ScalarsToOpacity->UnRegister(0);
m_ScalarsToOpacity = vtkPiecewiseFunction::New();
double range[2];
m_VtkPointSet->GetScalarRange(range);
m_ScalarsToOpacity->AddSegment(range[0], opacity, range[1], opacity);
}
}
}
void mitk::UnstructuredGridMapper2D::Paint( mitk::BaseRenderer* renderer )
{
if ( IsVisible( renderer ) == false )
return ;
vtkLinearTransform * vtktransform = GetDataNode()->GetVtkTransform();
vtkLinearTransform * inversetransform = vtktransform->GetLinearInverse();
Geometry2D::ConstPointer worldGeometry = renderer->GetCurrentWorldGeometry2D();
PlaneGeometry::ConstPointer worldPlaneGeometry = dynamic_cast<const PlaneGeometry*>( worldGeometry.GetPointer() );
Point3D point;
Vector3D normal;
if(worldPlaneGeometry.IsNotNull())
{
// set up vtkPlane according to worldGeometry
point=worldPlaneGeometry->GetOrigin();
normal=worldPlaneGeometry->GetNormal(); normal.Normalize();
m_Plane->SetTransform((vtkAbstractTransform*)NULL);
}
else
{
//@FIXME: does not work correctly. Does m_Plane->SetTransform really transforms a "plane plane" into a "curved plane"?
return;
AbstractTransformGeometry::ConstPointer worldAbstractGeometry = dynamic_cast<const AbstractTransformGeometry*>(renderer->GetCurrentWorldGeometry2D());
if(worldAbstractGeometry.IsNotNull())
{
// set up vtkPlane according to worldGeometry
point=const_cast<mitk::BoundingBox*>(worldAbstractGeometry->GetParametricBoundingBox())->GetMinimum();
FillVector3D(normal, 0, 0, 1);
m_Plane->SetTransform(worldAbstractGeometry->GetVtkAbstractTransform()->GetInverse());
}
else
return;
}
vtkFloatingPointType vp[ 3 ], vnormal[ 3 ];
vnl2vtk(point.Get_vnl_vector(), vp);
vnl2vtk(normal.Get_vnl_vector(), vnormal);
//normally, we would need to transform the surface and cut the transformed surface with the cutter.
//This might be quite slow. Thus, the idea is, to perform an inverse transform of the plane instead.
//@todo It probably does not work for scaling operations yet:scaling operations have to be
//dealed with after the cut is performed by scaling the contour.
inversetransform->TransformPoint( vp, vp );
inversetransform->TransformNormalAtPoint( vp, vnormal, vnormal );
m_Plane->SetOrigin( vp );
m_Plane->SetNormal( vnormal );
// set data into cutter
m_Slicer->SetInput( m_VtkPointSet );
// m_Cutter->GenerateCutScalarsOff();
// m_Cutter->SetSortByToSortByCell();
// calculate the cut
m_Slicer->Update();
// fetch geometry
mitk::DisplayGeometry::Pointer displayGeometry = renderer->GetDisplayGeometry();
assert( displayGeometry );
// float toGL=displayGeometry->GetSizeInDisplayUnits()[1];
//apply color and opacity read from the PropertyList
ApplyProperties( renderer );
// traverse the cut contour
vtkPolyData * contour = m_Slicer->GetOutput();
vtkPoints *vpoints = contour->GetPoints();
vtkCellArray *vlines = contour->GetLines();
vtkCellArray *vpolys = contour->GetPolys();
vtkPointData *vpointdata = contour->GetPointData();
vtkDataArray* vscalars = vpointdata->GetScalars();
vtkCellData *vcelldata = contour->GetCellData();
vtkDataArray* vcellscalars = vcelldata->GetScalars();
const int numberOfLines = contour->GetNumberOfLines();
const int numberOfPolys = contour->GetNumberOfPolys();
const bool useCellData = m_ScalarMode->GetVtkScalarMode() == VTK_SCALAR_MODE_DEFAULT ||
m_ScalarMode->GetVtkScalarMode() == VTK_SCALAR_MODE_USE_CELL_DATA;
const bool usePointData = m_ScalarMode->GetVtkScalarMode() == VTK_SCALAR_MODE_USE_POINT_DATA;
Point3D p;
Point2D p2d;
vlines->InitTraversal();
vpolys->InitTraversal();
mitk::Color outlineColor = m_Color->GetColor();
glLineWidth((float)m_LineWidth->GetValue());
for (int i = 0;i < numberOfLines;++i )
{
vtkIdType *cell(0);
vtkIdType cellSize(0);
vlines->GetNextCell( cellSize, cell );
float rgba[4] = {outlineColor[0], outlineColor[1], outlineColor[2], 1.0f};
if (m_ScalarVisibility->GetValue() && vcellscalars)
{
if ( useCellData )
{ // color each cell according to cell data
double scalar = vcellscalars->GetComponent( i, 0 );
double rgb[3] = { 1.0f, 1.0f, 1.0f };
m_ScalarsToColors->GetColor(scalar, rgb);
rgba[0] = (float)rgb[0];
rgba[1] = (float)rgb[1];
rgba[2] = (float)rgb[2];
rgba[3] = (float)m_ScalarsToOpacity->GetValue(scalar);
}
else if ( usePointData )
{
double scalar = vscalars->GetComponent( i, 0 );
double rgb[3] = { 1.0f, 1.0f, 1.0f };
m_ScalarsToColors->GetColor(scalar, rgb);
rgba[0] = (float)rgb[0];
rgba[1] = (float)rgb[1];
rgba[2] = (float)rgb[2];
rgba[3] = (float)m_ScalarsToOpacity->GetValue(scalar);
}
}
glColor4fv( rgba );
glBegin ( GL_LINE_LOOP );
for ( int j = 0;j < cellSize;++j )
{
vpoints->GetPoint( cell[ j ], vp );
//take transformation via vtktransform into account
vtktransform->TransformPoint( vp, vp );
vtk2itk( vp, p );
//convert 3D point (in mm) to 2D point on slice (also in mm)
worldGeometry->Map( p, p2d );
//convert point (until now mm and in worldcoordinates) to display coordinates (units )
displayGeometry->WorldToDisplay( p2d, p2d );
//convert display coordinates ( (0,0) is top-left ) in GL coordinates ( (0,0) is bottom-left )
//p2d[1]=toGL-p2d[1];
//add the current vertex to the line
glVertex2f( p2d[0], p2d[1] );
}
glEnd ();
}
bool polyOutline = m_Outline->GetValue();
bool scalarVisibility = m_ScalarVisibility->GetValue();
// only draw polygons if there are cell scalars
// or the outline property is set to true
if ((scalarVisibility && vcellscalars) || polyOutline)
{
glEnable(GL_BLEND);
glBlendFunc(GL_SRC_ALPHA, GL_ONE_MINUS_SRC_ALPHA);
glPolygonMode(GL_FRONT_AND_BACK, GL_FILL);
// cache the transformed points
// a fixed size array is way faster than 'new'
// slices through 3d cells usually do not generated
// polygons with more than 6 vertices
Point2D cachedPoints[10];
for (int i = 0;i < numberOfPolys;++i )
{
vtkIdType *cell(0);
vtkIdType cellSize(0);
vpolys->GetNextCell( cellSize, cell );
float rgba[4] = {1.0f, 1.0f, 1.0f, 0};
if (scalarVisibility && vcellscalars)
{
if ( useCellData )
{ // color each cell according to cell data
double scalar = vcellscalars->GetComponent( i, 0 );
double rgb[3] = { 1.0f, 1.0f, 1.0f };
m_ScalarsToColors->GetColor(scalar, rgb);
rgba[0] = (float)rgb[0];
rgba[1] = (float)rgb[1];
rgba[2] = (float)rgb[2];
rgba[3] = (float)m_ScalarsToOpacity->GetValue(scalar);
}
else if ( usePointData )
{
double scalar = vscalars->GetComponent( i, 0 );
double rgb[3] = { 1.0f, 1.0f, 1.0f };
m_ScalarsToColors->GetColor(scalar, rgb);
rgba[0] = (float)rgb[0];
rgba[1] = (float)rgb[1];
rgba[2] = (float)rgb[2];
rgba[3] = (float)m_ScalarsToOpacity->GetValue(scalar);
}
}
glColor4fv( rgba );
glBegin( GL_POLYGON );
for (int j = 0; j < cellSize; ++j)
{
vpoints->GetPoint( cell[ j ], vp );
//take transformation via vtktransform into account
vtktransform->TransformPoint( vp, vp );
vtk2itk( vp, p );
//convert 3D point (in mm) to 2D point on slice (also in mm)
worldGeometry->Map( p, p2d );
//convert point (until now mm and in worldcoordinates) to display coordinates (units )
displayGeometry->WorldToDisplay( p2d, p2d );
//convert display coordinates ( (0,0) is top-left ) in GL coordinates ( (0,0) is bottom-left )
//p2d[1]=toGL-p2d[1];
cachedPoints[j][0] = p2d[0];
cachedPoints[j][1] = p2d[1];
//add the current vertex to the line
glVertex2f( p2d[0], p2d[1] );
}
glEnd();
if (polyOutline)
{
glColor4f(outlineColor[0], outlineColor[1], outlineColor[2], 1.0f);
glPolygonMode(GL_FRONT_AND_BACK, GL_LINE);
glBegin( GL_POLYGON );
//glPolygonOffset(1.0, 1.0);
for (int j = 0; j < cellSize; ++j)
{
//add the current vertex to the line
glVertex2f( cachedPoints[j][0], cachedPoints[j][1] );
}
glEnd();
}
}
glDisable(GL_BLEND);
}
}
vtkAbstractMapper3D*
mitk::UnstructuredGridMapper2D
::GetVtkAbstractMapper3D(mitk::BaseRenderer * renderer)
{
//MITK_INFO << "GETVTKABSTRACTMAPPER3D\n";
mitk::DataNode::ConstPointer node = this->GetDataNode();
if ( node.IsNull() )
return 0;
mitk::VtkMapper3D::Pointer mitkMapper = dynamic_cast< mitk::VtkMapper3D* > ( node->GetMapper( 2 ) );
if ( mitkMapper.IsNull() )
{
return 0;
}
mitkMapper->Update(renderer);
vtkAssembly* assembly = dynamic_cast<vtkAssembly*>(mitkMapper->GetVtkProp(renderer));
if (assembly)
{
vtkProp3DCollection* collection = assembly->GetParts();
collection->InitTraversal();
vtkProp3D* prop3d = 0;
do
{
prop3d = collection->GetNextProp3D();
vtkActor* actor = dynamic_cast<vtkActor*>( prop3d );
if (actor)
{
return dynamic_cast<vtkAbstractMapper3D*>( actor->GetMapper() );
}
vtkVolume* volume = dynamic_cast<vtkVolume*>( prop3d );
if (volume)
{
return dynamic_cast<vtkAbstractMapper3D*>( volume->GetMapper() );
}
} while (prop3d != collection->GetLastProp3D());
}
else
{
vtkActor* actor = dynamic_cast<vtkActor*>( mitkMapper->GetVtkProp(renderer) );
if (actor)
{
return dynamic_cast<vtkAbstractMapper3D*>( actor->GetMapper() );
}
vtkVolume* volume = dynamic_cast<vtkVolume*>( mitkMapper->GetVtkProp(renderer) );
if (volume)
{
return dynamic_cast<vtkAbstractMapper3D*>( volume->GetMapper() );
}
}
return 0;
}
vtkPointSet*
mitk::UnstructuredGridMapper2D
::GetVtkPointSet(mitk::BaseRenderer* renderer)
{
//MITK_INFO << "GETVTKPOINTSET\n";
vtkAbstractMapper3D * abstractMapper = GetVtkAbstractMapper3D(renderer);
if ( abstractMapper == 0 )
{
// try to get data from the node
mitk::DataNode::ConstPointer node = this->GetDataNode();
if ( node.IsNull() )
return 0;
mitk::BaseData::Pointer data = node->GetData();
mitk::UnstructuredGrid::Pointer grid = dynamic_cast<mitk::UnstructuredGrid*>(data.GetPointer());
if (!grid.IsNull())
return static_cast<vtkPointSet*>(grid->GetVtkUnstructuredGrid());
return 0;
}
else
{
vtkMapper* mapper = dynamic_cast<vtkMapper*>(abstractMapper);
if (mapper)
{
return dynamic_cast<vtkPointSet*>(mapper->GetInput());
}
vtkAbstractVolumeMapper* volMapper = dynamic_cast<vtkAbstractVolumeMapper*>(abstractMapper);
if (volMapper)
{
return dynamic_cast<vtkPointSet*>(volMapper->GetDataSetInput());
}
}
return 0;
}
vtkScalarsToColors* mitk::UnstructuredGridMapper2D::GetVtkLUT(mitk::BaseRenderer* renderer)
{
//MITK_INFO << "GETVTKLUT\n";
vtkMapper * mapper = dynamic_cast<vtkMapper*>(GetVtkAbstractMapper3D(renderer));
if (mapper)
return mapper->GetLookupTable();
else
{
mitk::DataNode::ConstPointer node = this->GetDataNode();
if ( node.IsNull() )
return 0;
mitk::VtkMapper3D::Pointer mitkMapper = dynamic_cast< mitk::VtkMapper3D* > ( node->GetMapper( 2 ) );
if ( mitkMapper.IsNull() )
{
//MITK_INFO << "mitkMapper is null\n";
return 0;
}
mitkMapper->Update(renderer);
vtkVolume* volume = dynamic_cast<vtkVolume*>( mitkMapper->GetVtkProp(renderer) );
if (volume)
{
//MITK_INFO << "found volume prop\n";
return static_cast<vtkScalarsToColors*>(volume->GetProperty()->GetRGBTransferFunction());
}
vtkAssembly* assembly = dynamic_cast<vtkAssembly*>(mitkMapper->GetVtkProp(renderer));
if (assembly)
{
//MITK_INFO << "found assembly prop\n";
mitk::TransferFunctionProperty::Pointer transferFuncProp;
node->GetProperty(transferFuncProp, "TransferFunction", 0);
if (transferFuncProp.IsNotNull())
{
MITK_INFO << "return colortransferfunction\n";
return static_cast<vtkScalarsToColors*>(transferFuncProp->GetValue()->GetColorTransferFunction());
}
}
return 0;
}
}
bool mitk::UnstructuredGridMapper2D::IsConvertibleToVtkPointSet(mitk::BaseRenderer * renderer)
{
return ( GetVtkPointSet(renderer) != 0 );
}
mitk::UnstructuredGridMapper2D::UnstructuredGridMapper2D()
{
m_Plane = vtkPlane::New();
m_Slicer = vtkPointSetSlicer::New();
m_Slicer->SetSlicePlane( m_Plane );
m_ScalarsToColors = 0;
m_ScalarsToOpacity = 0;
m_VtkPointSet = 0;
//m_LUT = vtkLookupTable::New();
//m_LUT->SetTableRange( 0, 255 );
//m_LUT->SetNumberOfColors( 255 );
//m_LUT->SetRampToLinear ();
//m_LUT->Build();
}
mitk::UnstructuredGridMapper2D::~UnstructuredGridMapper2D()
{
m_Slicer->Delete();
m_Plane->Delete();
if (m_ScalarsToOpacity != 0) m_ScalarsToOpacity->UnRegister(0);
if (m_ScalarsToColors != 0) m_ScalarsToColors->UnRegister(0);
if (m_VtkPointSet != 0) m_VtkPointSet->UnRegister(0);
}
diff --git a/Modules/MitkExt/Rendering/mitkUnstructuredGridMapper2D.h b/Modules/MitkExt/Rendering/mitkUnstructuredGridMapper2D.h
index 0f7297587a..233c4a2f45 100644
--- a/Modules/MitkExt/Rendering/mitkUnstructuredGridMapper2D.h
+++ b/Modules/MitkExt/Rendering/mitkUnstructuredGridMapper2D.h
@@ -1,113 +1,113 @@
/*=========================================================================
Program: Medical Imaging & Interaction Toolkit
Language: C++
Date: $Date$
Version: $Revision: 3393 $
Copyright (c) German Cancer Research Center, Division of Medical and
Biological Informatics. All rights reserved.
See MITKCopyright.txt or http://www.mitk.org/copyright.html for details.
This software is distributed WITHOUT ANY WARRANTY; without even
the implied warranty of MERCHANTABILITY or FITNESS FOR A PARTICULAR
PURPOSE. See the above copyright notices for more information.
=========================================================================*/
#ifndef MitkPointSetSliceLMapper2D_H
#define MitkPointSetSliceLMapper2D_H
#include "mitkCommon.h"
#include "MitkExtExports.h"
#include "mitkGLMapper2D.h"
#include "mitkTransferFunction.h"
#include "mitkProperties.h"
#include "mitkColorProperty.h"
#include "mitkVtkScalarModeProperty.h"
class vtkPointSetSlicer;
class vtkPlane;
class vtkLookupTable;
class vtkPointSet;
class vtkScalarsToColors;
class vtkPiecewiseFunction;
class vtkAbstractMapper3D;
namespace mitk
{
class BaseRenderer;
/**
* @brief OpenGL-based mapper to display a 2d cut through a poly data
* OpenGL-based mapper to display a 2D cut through a poly data. The result is
* normally a line. This class can be added to any data object, which is
* rendered in 3D via a vtkPolyData.
*/
class MitkExt_EXPORT UnstructuredGridMapper2D : public GLMapper2D
{
public:
mitkClassMacro( UnstructuredGridMapper2D, GLMapper2D );
itkNewMacro( Self );
/**
* Renders a cut through a pointset by cutting trough the n-cells,
* producing (n-1)-cells.
* @param renderer the render to render in.
*/
virtual void Paint( mitk::BaseRenderer* renderer );
protected:
UnstructuredGridMapper2D();
virtual ~UnstructuredGridMapper2D();
virtual void GenerateData();
- virtual void GenerateData(BaseRenderer*);
+ virtual void GenerateDataForRenderer(BaseRenderer*);
/**
* Determines, if the associated BaseData is mapped three-dimensionally (mapper-slot id 2)
* with a class convertable to vtkAbstractMapper3D().
* @returns NULL if it is not convertable or the appropriate Mapper otherwise
*/
virtual vtkAbstractMapper3D* GetVtkAbstractMapper3D(BaseRenderer* renderer);
/**
* Determines the pointset object to be cut.
* returns the pointset if possible, otherwise NULL.
*/
virtual vtkPointSet* GetVtkPointSet(BaseRenderer* renderer );
/**
* Determines the LookupTable used by the associated vtkMapper.
* returns the LUT if possible, otherwise NULL.
*/
virtual vtkScalarsToColors* GetVtkLUT(BaseRenderer* renderer );
/**
* Checks if this mapper can be used to generate cuts through the associated
* base data.
* @return true if yes or false if not.
*/
virtual bool IsConvertibleToVtkPointSet(BaseRenderer* renderer);
vtkPlane* m_Plane;
vtkPointSetSlicer* m_Slicer;
vtkPointSet* m_VtkPointSet;
vtkScalarsToColors* m_ScalarsToColors;
vtkPiecewiseFunction* m_ScalarsToOpacity;
mitk::ColorProperty::Pointer m_Color;
mitk::IntProperty::Pointer m_LineWidth;
mitk::BoolProperty::Pointer m_Outline;
mitk::BoolProperty::Pointer m_ScalarVisibility;
mitk::VtkScalarModeProperty::Pointer m_ScalarMode;
};
} // namespace mitk
#endif /* MitkPointSetSliceLMapper2D_H */
diff --git a/Modules/MitkExt/Rendering/mitkUnstructuredGridVtkMapper3D.cpp b/Modules/MitkExt/Rendering/mitkUnstructuredGridVtkMapper3D.cpp
index ccfdd40d24..4e7958bed8 100644
--- a/Modules/MitkExt/Rendering/mitkUnstructuredGridVtkMapper3D.cpp
+++ b/Modules/MitkExt/Rendering/mitkUnstructuredGridVtkMapper3D.cpp
@@ -1,419 +1,419 @@
/*=========================================================================
Program: Medical Imaging & Interaction Toolkit
Language: C++
Date: $Date$
Version: $Revision: $
Copyright (c) German Cancer Research Center, Division of Medical and
Biological Informatics. All rights reserved.
See MITKCopyright.txt or http://www.mitk.org/copyright.html for details.
This software is distributed WITHOUT ANY WARRANTY; without even
the implied warranty of MERCHANTABILITY or FITNESS FOR A PARTICULAR
PURPOSE. See the above copyright notices for more information.
=========================================================================*/
#include "mitkUnstructuredGridVtkMapper3D.h"
#include "mitkDataNode.h"
#include "mitkProperties.h"
#include "mitkTransferFunctionProperty.h"
#include "mitkColorProperty.h"
//#include "mitkLookupTableProperty.h"
#include "mitkGridRepresentationProperty.h"
#include "mitkGridVolumeMapperProperty.h"
#include "mitkVtkInterpolationProperty.h"
#include "mitkVtkScalarModeProperty.h"
#include "mitkDataStorage.h"
#include "mitkSurfaceVtkMapper3D.h"
#include <vtkUnstructuredGrid.h>
#include <vtkVolume.h>
#include <vtkVolumeProperty.h>
#include <vtkProperty.h>
#include <vtkPlanes.h>
const mitk::UnstructuredGrid* mitk::UnstructuredGridVtkMapper3D::GetInput()
{
return static_cast<const mitk::UnstructuredGrid * > ( GetData() );
}
mitk::UnstructuredGridVtkMapper3D::UnstructuredGridVtkMapper3D()
{
m_VtkTriangleFilter = vtkDataSetTriangleFilter::New();
m_Assembly = vtkAssembly::New();
m_Volume = vtkVolume::New();
m_Actor = vtkActor::New();
m_ActorWireframe = vtkActor::New();
m_VtkDataSetMapper = vtkUnstructuredGridMapper::New();
m_VtkDataSetMapper->SetResolveCoincidentTopologyToPolygonOffset();
m_VtkDataSetMapper->SetResolveCoincidentTopologyPolygonOffsetParameters(0,1);
m_Actor->SetMapper(m_VtkDataSetMapper);
m_VtkDataSetMapper2 = vtkUnstructuredGridMapper::New();
m_VtkDataSetMapper2->SetResolveCoincidentTopologyToPolygonOffset();
m_VtkDataSetMapper2->SetResolveCoincidentTopologyPolygonOffsetParameters(1,1);
m_ActorWireframe->SetMapper(m_VtkDataSetMapper2);
m_ActorWireframe->GetProperty()->SetRepresentationToWireframe();
m_Assembly->AddPart(m_Actor);
m_Assembly->AddPart(m_ActorWireframe);
m_Assembly->AddPart(m_Volume);
m_VtkVolumeRayCastMapper = 0;
m_VtkPTMapper = 0;
m_VtkVolumeZSweepMapper = 0;
//m_GenerateNormals = false;
}
mitk::UnstructuredGridVtkMapper3D::~UnstructuredGridVtkMapper3D()
{
if (m_VtkTriangleFilter != 0)
m_VtkTriangleFilter->Delete();
if (m_VtkVolumeRayCastMapper != 0)
m_VtkVolumeRayCastMapper->Delete();
#if (VTK_MAJOR_VERSION >= 5)
if (m_VtkVolumeZSweepMapper != 0)
m_VtkVolumeZSweepMapper->Delete();
if (m_VtkPTMapper != 0)
m_VtkPTMapper->Delete();
#endif
if (m_VtkDataSetMapper != 0)
m_VtkDataSetMapper->Delete();
if (m_VtkDataSetMapper2 != 0)
m_VtkDataSetMapper2->Delete();
if (m_Assembly != 0)
m_Assembly->Delete();
if (m_Actor != 0)
m_Actor->Delete();
if (m_ActorWireframe != 0)
m_ActorWireframe->Delete();
if (m_Volume != 0)
m_Volume->Delete();
}
vtkProp* mitk::UnstructuredGridVtkMapper3D::GetVtkProp(mitk::BaseRenderer* /*renderer*/)
{
return m_Assembly;
}
void mitk::UnstructuredGridVtkMapper3D::GenerateData()
{
m_Assembly->VisibilityOn();
m_ActorWireframe->GetProperty()->SetAmbient(1.0);
m_ActorWireframe->GetProperty()->SetDiffuse(0.0);
m_ActorWireframe->GetProperty()->SetSpecular(0.0);
mitk::DataNode::ConstPointer node = this->GetDataNode();
mitk::TransferFunctionProperty::Pointer transferFuncProp;
if (node->GetProperty(transferFuncProp, "TransferFunction"))
{
mitk::TransferFunction::Pointer transferFunction = transferFuncProp->GetValue();
if (transferFunction->GetColorTransferFunction()->GetSize() < 2)
{
mitk::UnstructuredGrid::Pointer input = const_cast< mitk::UnstructuredGrid* >(this->GetInput());
if (input.IsNull()) return;
vtkUnstructuredGrid * grid = input->GetVtkUnstructuredGrid(this->GetTimestep());
if (grid == 0) return;
double* scalarRange = grid->GetScalarRange();
vtkColorTransferFunction* colorFunc = transferFunction->GetColorTransferFunction();
colorFunc->RemoveAllPoints();
colorFunc->AddRGBPoint(scalarRange[0], 1, 0, 0);
colorFunc->AddRGBPoint((scalarRange[0] + scalarRange[1])/2.0, 0, 1, 0);
colorFunc->AddRGBPoint(scalarRange[1], 0, 0, 1);
}
}
}
-void mitk::UnstructuredGridVtkMapper3D::GenerateData(mitk::BaseRenderer* renderer)
+void mitk::UnstructuredGridVtkMapper3D::GenerateDataForRenderer(mitk::BaseRenderer* renderer)
{
if(!IsVisible(renderer))
{
m_Assembly->VisibilityOff();
return;
}
//
// get the TimeSlicedGeometry of the input object
//
mitk::UnstructuredGrid::Pointer input = const_cast< mitk::UnstructuredGrid* >( this->GetInput() );
//
// set the input-object at time t for the mapper
//
vtkUnstructuredGrid * grid = input->GetVtkUnstructuredGrid( this->GetTimestep() );
if(grid == 0)
{
m_Assembly->VisibilityOff();
return;
}
m_Assembly->VisibilityOn();
m_VtkTriangleFilter->SetInput(grid);
m_VtkDataSetMapper->SetInput(grid);
m_VtkDataSetMapper2->SetInput(grid);
mitk::DataNode::ConstPointer node = this->GetDataNode();
bool clip = false;
node->GetBoolProperty("enable clipping", clip);
mitk::DataNode::Pointer bbNode = renderer->GetDataStorage()->GetNamedDerivedNode("Clipping Bounding Object", node);
if (clip && bbNode.IsNotNull())
{
m_VtkDataSetMapper->SetBoundingObject(dynamic_cast<mitk::BoundingObject*>(bbNode->GetData()));
m_VtkDataSetMapper2->SetBoundingObject(dynamic_cast<mitk::BoundingObject*>(bbNode->GetData()));
}
else
{
m_VtkDataSetMapper->SetBoundingObject(0);
m_VtkDataSetMapper2->SetBoundingObject(0);
}
//
// apply properties read from the PropertyList
//
ApplyProperties(0, renderer);
}
void mitk::UnstructuredGridVtkMapper3D::ResetMapper( BaseRenderer* /*renderer*/ )
{
m_Assembly->VisibilityOff();
}
void mitk::UnstructuredGridVtkMapper3D::ApplyProperties(vtkActor* /*actor*/, mitk::BaseRenderer* renderer)
{
mitk::DataNode::Pointer node = this->GetDataNode();
Superclass::ApplyProperties(m_Actor, renderer);
Superclass::ApplyProperties(m_ActorWireframe, renderer);
vtkVolumeProperty* volProp = m_Volume->GetProperty();
vtkProperty* property = m_Actor->GetProperty();
vtkProperty* wireframeProp = m_ActorWireframe->GetProperty();
mitk::SurfaceVtkMapper3D::ApplyMitkPropertiesToVtkProperty(node,property,renderer);
mitk::SurfaceVtkMapper3D::ApplyMitkPropertiesToVtkProperty(node,wireframeProp,renderer);
mitk::TransferFunctionProperty::Pointer transferFuncProp;
if (node->GetProperty(transferFuncProp, "TransferFunction", renderer))
{
mitk::TransferFunction::Pointer transferFunction = transferFuncProp->GetValue();
volProp->SetColor(transferFunction->GetColorTransferFunction());
volProp->SetScalarOpacity(transferFunction->GetScalarOpacityFunction());
volProp->SetGradientOpacity(transferFunction->GetGradientOpacityFunction());
m_VtkDataSetMapper->SetLookupTable(transferFunction->GetColorTransferFunction());
m_VtkDataSetMapper2->SetLookupTable(transferFunction->GetColorTransferFunction());
}
bool isVolumeRenderingOn = false;
node->GetBoolProperty("volumerendering", isVolumeRenderingOn, renderer);
if (isVolumeRenderingOn)
{
m_Assembly->RemovePart(m_Actor);
m_Assembly->RemovePart(m_ActorWireframe);
m_Assembly->AddPart(m_Volume);
mitk::GridVolumeMapperProperty::Pointer mapperProp;
if (node->GetProperty(mapperProp, "volumerendering.mapper", renderer))
{
mitk::GridVolumeMapperProperty::IdType type = mapperProp->GetValueAsId();
switch (type) {
case mitk::GridVolumeMapperProperty::RAYCAST:
if (m_VtkVolumeRayCastMapper == 0) {
m_VtkVolumeRayCastMapper = vtkUnstructuredGridVolumeRayCastMapper::New();
m_VtkVolumeRayCastMapper->SetInput(m_VtkTriangleFilter->GetOutput());
}
m_Volume->SetMapper(m_VtkVolumeRayCastMapper);
break;
case mitk::GridVolumeMapperProperty::PT:
if (m_VtkPTMapper == 0) {
m_VtkPTMapper = vtkProjectedTetrahedraMapper::New();
m_VtkPTMapper->SetInputConnection(m_VtkTriangleFilter->GetOutputPort());
}
m_Volume->SetMapper(m_VtkPTMapper);
break;
case mitk::GridVolumeMapperProperty::ZSWEEP:
if (m_VtkVolumeZSweepMapper == 0) {
m_VtkVolumeZSweepMapper = vtkUnstructuredGridVolumeZSweepMapper::New();
m_VtkVolumeZSweepMapper->SetInputConnection(m_VtkTriangleFilter->GetOutputPort());
}
m_Volume->SetMapper(m_VtkVolumeZSweepMapper);
break;
}
}
}
else
{
m_Assembly->RemovePart(m_Volume);
m_Assembly->AddPart(m_Actor);
m_Assembly->RemovePart(m_ActorWireframe);
mitk::GridRepresentationProperty::Pointer gridRepProp;
if (node->GetProperty(gridRepProp, "grid representation", renderer))
{
mitk::GridRepresentationProperty::IdType type = gridRepProp->GetValueAsId();
switch (type) {
case mitk::GridRepresentationProperty::POINTS:
property->SetRepresentationToPoints();
break;
case mitk::GridRepresentationProperty::WIREFRAME:
property->SetRepresentationToWireframe();
break;
case mitk::GridRepresentationProperty::SURFACE:
property->SetRepresentationToSurface();
break;
}
// if (type == mitk::GridRepresentationProperty::WIREFRAME_SURFACE)
// {
// m_Assembly->AddPart(m_ActorWireframe);
// }
}
}
// mitk::LevelWindow levelWindow;
// if(node->GetLevelWindow(levelWindow, renderer, "levelWindow"))
// {
// m_VtkVolumeRayCastMapper->SetScalarRange(levelWindow.GetMin(),levelWindow.GetMax());
// }
// else
// if(node->GetLevelWindow(levelWindow, renderer))
// {
// m_VtkVolumeRayCastMapper->SetScalarRange(levelWindow.GetMin(),levelWindow.GetMax());
// }
//
// mitk::VtkRepresentationProperty* representationProperty;
// node->GetProperty(representationProperty, "material.representation", renderer);
// if ( representationProperty != NULL )
// m_Volume->GetProperty()->SetRepresentation( representationProperty->GetVtkRepresentation() );
//
// mitk::VtkInterpolationProperty* interpolationProperty;
// node->GetProperty(interpolationProperty, "material.interpolation", renderer);
// if ( interpolationProperty != NULL )
// m_Volume->GetProperty()->SetInterpolation( interpolationProperty->GetVtkInterpolation() );
//
mitk::VtkScalarModeProperty* scalarMode = 0;
if(node->GetProperty(scalarMode, "scalar mode", renderer))
{
if (m_VtkVolumeRayCastMapper)
m_VtkVolumeRayCastMapper->SetScalarMode(scalarMode->GetVtkScalarMode());
if (m_VtkPTMapper)
m_VtkPTMapper->SetScalarMode(scalarMode->GetVtkScalarMode());
if (m_VtkVolumeZSweepMapper)
m_VtkVolumeZSweepMapper->SetScalarMode(scalarMode->GetVtkScalarMode());
m_VtkDataSetMapper->SetScalarMode(scalarMode->GetVtkScalarMode());
m_VtkDataSetMapper2->SetScalarMode(scalarMode->GetVtkScalarMode());
}
else
{
if (m_VtkVolumeRayCastMapper)
m_VtkVolumeRayCastMapper->SetScalarModeToDefault();
if (m_VtkPTMapper)
m_VtkPTMapper->SetScalarModeToDefault();
if (m_VtkVolumeZSweepMapper)
m_VtkVolumeZSweepMapper->SetScalarModeToDefault();
m_VtkDataSetMapper->SetScalarModeToDefault();
m_VtkDataSetMapper2->SetScalarModeToDefault();
}
bool scalarVisibility = true;
node->GetBoolProperty("scalar visibility", scalarVisibility, renderer);
m_VtkDataSetMapper->SetScalarVisibility(scalarVisibility ? 1 : 0);
m_VtkDataSetMapper2->SetScalarVisibility(scalarVisibility ? 1 : 0);
// double scalarRangeLower = std::numeric_limits<double>::min();
// double scalarRangeUpper = std::numeric_limits<double>::max();
// mitk::DoubleProperty* lowerRange = 0;
// if (node->GetProperty(lowerRange, "scalar range min", renderer))
// {
// scalarRangeLower = lowerRange->GetValue();
// }
// mitk::DoubleProperty* upperRange = 0;
// if (node->GetProperty(upperRange, "scalar range max", renderer))
// {
// scalarRangeUpper = upperRange->GetValue();
// }
// m_VtkDataSetMapper->SetScalarRange(scalarRangeLower, scalarRangeUpper);
// m_VtkDataSetMapper2->SetScalarRange(scalarRangeLower, scalarRangeUpper);
// bool colorMode = false;
// node->GetBoolProperty("color mode", colorMode);
// m_VtkVolumeRayCastMapper->SetColorMode( (colorMode ? 1 : 0) );
// float scalarsMin = 0;
// if (dynamic_cast<mitk::FloatProperty *>(node->GetProperty("ScalarsRangeMinimum").GetPointer()) != NULL)
// scalarsMin = dynamic_cast<mitk::FloatProperty*>(node->GetProperty("ScalarsRangeMinimum").GetPointer())->GetValue();
// float scalarsMax = 1.0;
// if (dynamic_cast<mitk::FloatProperty *>(node->GetProperty("ScalarsRangeMaximum").GetPointer()) != NULL)
// scalarsMax = dynamic_cast<mitk::FloatProperty*>(node->GetProperty("ScalarsRangeMaximum").GetPointer())->GetValue();
// m_VtkVolumeRayCastMapper->SetScalarRange(scalarsMin,scalarsMax);
}
void mitk::UnstructuredGridVtkMapper3D::SetDefaultProperties(mitk::DataNode* node, mitk::BaseRenderer* renderer, bool overwrite)
{
SurfaceVtkMapper3D::SetDefaultPropertiesForVtkProperty(node, renderer, overwrite);
node->AddProperty("grid representation", GridRepresentationProperty::New(), renderer, overwrite);
node->AddProperty("volumerendering", BoolProperty::New(false), renderer, overwrite);
node->AddProperty("volumerendering.mapper", GridVolumeMapperProperty::New(), renderer, overwrite);
node->AddProperty("scalar mode", VtkScalarModeProperty::New(0), renderer, overwrite);
node->AddProperty("scalar visibility", BoolProperty::New(true), renderer, overwrite);
//node->AddProperty("scalar range min", DoubleProperty::New(std::numeric_limits<double>::min()), renderer, overwrite);
//node->AddProperty("scalar range max", DoubleProperty::New(std::numeric_limits<double>::max()), renderer, overwrite);
node->AddProperty("outline polygons", BoolProperty::New(false), renderer, overwrite);
node->AddProperty("color", ColorProperty::New(1.0f, 1.0f, 1.0f), renderer, overwrite);
node->AddProperty("line width", IntProperty::New(1), renderer, overwrite);
if(overwrite || node->GetProperty("TransferFunction", renderer) == 0)
{
// add a default transfer function
mitk::TransferFunction::Pointer tf = mitk::TransferFunction::New();
//tf->GetColorTransferFunction()->RemoveAllPoints();
node->SetProperty ("TransferFunction", mitk::TransferFunctionProperty::New(tf.GetPointer()));
}
Superclass::SetDefaultProperties(node, renderer, overwrite);
}
diff --git a/Modules/MitkExt/Rendering/mitkUnstructuredGridVtkMapper3D.h b/Modules/MitkExt/Rendering/mitkUnstructuredGridVtkMapper3D.h
index 2f2472ecd4..3cef9d7601 100644
--- a/Modules/MitkExt/Rendering/mitkUnstructuredGridVtkMapper3D.h
+++ b/Modules/MitkExt/Rendering/mitkUnstructuredGridVtkMapper3D.h
@@ -1,93 +1,93 @@
/*=========================================================================
Program: Medical Imaging & Interaction Toolkit
Language: C++
Date: $Date$
Version: $Revision: $
Copyright (c) German Cancer Research Center, Division of Medical and
Biological Informatics. All rights reserved.
See MITKCopyright.txt or http://www.mitk.org/copyright.html for details.
This software is distributed WITHOUT ANY WARRANTY; without even
the implied warranty of MERCHANTABILITY or FITNESS FOR A PARTICULAR
PURPOSE. See the above copyright notices for more information.
=========================================================================*/
#ifndef _MITK_UNSTRUCTURED_GRID_VTK_MAPPER_3D_H_
#define _MITK_UNSTRUCTURED_GRID_VTK_MAPPER_3D_H_
#include "mitkCommon.h"
#include "MitkExtExports.h"
#include "mitkVtkMapper3D.h"
#include "mitkUnstructuredGrid.h"
#include "mitkBaseRenderer.h"
#include <vtkAssembly.h>
#include <vtkActor.h>
#include <vtkVolume.h>
#include <vtkDataSetTriangleFilter.h>
#include "vtkUnstructuredGridMapper.h"
#include <vtkUnstructuredGridVolumeRayCastMapper.h>
#if (VTK_MAJOR_VERSION >= 5)
#include <vtkProjectedTetrahedraMapper.h>
#include <vtkUnstructuredGridVolumeZSweepMapper.h>
#endif
namespace mitk {
//##Documentation
//## @brief Vtk-based mapper for UnstructuredGrid
//##
//## @ingroup Mapper
class MitkExt_EXPORT UnstructuredGridVtkMapper3D : public VtkMapper3D
{
public:
mitkClassMacro(UnstructuredGridVtkMapper3D, VtkMapper3D);
itkNewMacro(Self);
virtual const mitk::UnstructuredGrid* GetInput();
virtual vtkProp* GetVtkProp(mitk::BaseRenderer* renderer);
static void SetDefaultProperties(mitk::DataNode* node, mitk::BaseRenderer* renderer = NULL, bool overwrite = false);
void ApplyProperties(vtkActor* /*actor*/, mitk::BaseRenderer* renderer);
protected:
UnstructuredGridVtkMapper3D();
virtual ~UnstructuredGridVtkMapper3D();
virtual void GenerateData();
- virtual void GenerateData(mitk::BaseRenderer* renderer);
+ virtual void GenerateDataForRenderer(mitk::BaseRenderer* renderer);
virtual void ResetMapper( BaseRenderer* /*renderer*/ );
void SetProperties(mitk::BaseRenderer* renderer);
vtkAssembly* m_Assembly;
vtkActor* m_Actor;
vtkActor* m_ActorWireframe;
vtkVolume* m_Volume;
vtkDataSetTriangleFilter* m_VtkTriangleFilter;
vtkUnstructuredGridMapper* m_VtkDataSetMapper;
vtkUnstructuredGridMapper* m_VtkDataSetMapper2;
vtkUnstructuredGridVolumeRayCastMapper* m_VtkVolumeRayCastMapper;
vtkProjectedTetrahedraMapper* m_VtkPTMapper;
vtkUnstructuredGridVolumeZSweepMapper* m_VtkVolumeZSweepMapper;
};
} // namespace mitk
#endif /* _MITK_UNSTRUCTURED_GRID_VTK_MAPPER_3D_H_ */
diff --git a/Modules/MitkExt/Testing/files.cmake b/Modules/MitkExt/Testing/files.cmake
index 918340f695..9ce27db6b0 100644
--- a/Modules/MitkExt/Testing/files.cmake
+++ b/Modules/MitkExt/Testing/files.cmake
@@ -1,40 +1,41 @@
-SET(MODULE_TESTS
+SET(MODULE_TESTS
mitkAutoCropImageFilterTest.cpp
mitkBoundingObjectCutterTest.cpp
mitkContourMapper2DTest.cpp
mitkContourTest.cpp
mitkCoreExtObjectFactoryTest
mitkDataNodeExtTest.cpp
mitkExternalToolsTest.cpp
mitkMeshTest.cpp
mitkMultiStepperTest.cpp
mitkOrganTypePropertyTest.cpp
mitkPipelineSmartPointerCorrectnessTest.cpp
mitkPlaneFitTest.cpp
mitkPointLocatorTest.cpp
# mitkSegmentationInterpolationTest.cpp
# mitkTestTemplate.cpp
mitkToolManagerTest.cpp
mitkUnstructuredGridTest.cpp
+ mitkSimpleHistogramTest.cpp
)
SET(MODULE_IMAGE_TESTS
mitkUnstructuredGridVtkWriterTest.cpp
- mitkCompressedImageContainerTest.cpp
+ mitkCompressedImageContainerTest.cpp
mitkCylindricToCartesianFilterTest.cpp
- #mitkExtractImageFilterTest.cpp
+ #mitkExtractImageFilterTest.cpp
mitkManualSegmentationToSurfaceFilterTest.cpp
- mitkOverwriteSliceImageFilterTest.cpp
+ mitkOverwriteSliceImageFilterTest.cpp
mitkSurfaceToImageFilterTest.cpp
)
-SET(MODULE_CUSTOM_TESTS
+SET(MODULE_CUSTOM_TESTS
mitkLabeledImageToSurfaceFilterTest.cpp
)
SET(MODULE_TESTIMAGES
US4DCyl.pic.gz
Pic3D.pic.gz
Pic2DplusT.pic.gz
BallBinary30x30x30.pic.gz
Png2D-bw.png
binary.stl
ball.stl
-)
+)
\ No newline at end of file
diff --git a/Modules/MitkExt/Testing/mitkCompareImageSliceTestHelper.h b/Modules/MitkExt/Testing/mitkCompareImageSliceTestHelper.h
index 4762e50a45..d2209c2eff 100644
--- a/Modules/MitkExt/Testing/mitkCompareImageSliceTestHelper.h
+++ b/Modules/MitkExt/Testing/mitkCompareImageSliceTestHelper.h
@@ -1,161 +1,163 @@
/*=========================================================================
Program: Medical Imaging & Interaction Toolkit
Language: C++
Date: $Date$
Version: $Revision$
Copyright (c) German Cancer Research Center, Division of Medical and
Biological Informatics. All rights reserved.
See MITKCopyright.txt or http://www.mitk.org/copyright.html for details.
This software is distributed WITHOUT ANY WARRANTY; without even
the implied warranty of MERCHANTABILITY or FITNESS FOR A PARTICULAR
PURPOSE. See the above copyright notices for more information.
=========================================================================*/
#ifndef mitkCompareImageSliceTestHelperhincluded
#define mitkCompareImageSliceTestHelperhincluded
#include "mitkImageCast.h"
+#include "mitkImageAccessByItk.h"
#include <itkImageSliceConstIteratorWithIndex.h>
#include <itkImageRegionConstIterator.h>
// copied from mitk/Core/Algorithms/mitkOverwriteSliceImageFilter.cpp
// basically copied from mitk/Core/Algorithms/mitkImageAccessByItk.h
#define myMITKOverwriteSliceImageFilterAccessByItk(mitkImage, itkImageTypeFunction, pixeltype, dimension, itkimage2) \
if ( typeId == typeid(pixeltype) ) \
{ \
typedef itk::Image<pixeltype, dimension> ImageType; \
typedef mitk::ImageToItk<ImageType> ImageToItkType; \
itk::SmartPointer<ImageToItkType> imagetoitk = ImageToItkType::New(); \
imagetoitk->SetInput(mitkImage); \
imagetoitk->Update(); \
itkImageTypeFunction(imagetoitk->GetOutput(), itkimage2); \
}
#define myMITKOverwriteSliceImageFilterAccessAllTypesByItk(mitkImage, itkImageTypeFunction, dimension, itkimage2) \
{ \
myMITKOverwriteSliceImageFilterAccessByItk(mitkImage, itkImageTypeFunction, double, dimension, itkimage2) else \
myMITKOverwriteSliceImageFilterAccessByItk(mitkImage, itkImageTypeFunction, float, dimension, itkimage2) else \
myMITKOverwriteSliceImageFilterAccessByItk(mitkImage, itkImageTypeFunction, int, dimension, itkimage2) else \
myMITKOverwriteSliceImageFilterAccessByItk(mitkImage, itkImageTypeFunction, unsigned int, dimension, itkimage2) else \
myMITKOverwriteSliceImageFilterAccessByItk(mitkImage, itkImageTypeFunction, short, dimension, itkimage2) else \
myMITKOverwriteSliceImageFilterAccessByItk(mitkImage, itkImageTypeFunction, unsigned short, dimension, itkimage2) else \
myMITKOverwriteSliceImageFilterAccessByItk(mitkImage, itkImageTypeFunction, char, dimension, itkimage2) else \
myMITKOverwriteSliceImageFilterAccessByItk(mitkImage, itkImageTypeFunction, unsigned char, dimension, itkimage2) \
}
class CompareImageSliceTestHelper
{
private:
/* variables to be used by CompareSlice only */
static unsigned int m_Dimension0;
static unsigned int m_Dimension1;
static unsigned int m_SliceDimension;
static unsigned int m_SliceIndex;
static bool m_ComparisonResult;
static mitk::Image* m_SliceImage;
public:
template<typename TPixel1, unsigned int VImageDimension1, typename TPixel2, unsigned int VImageDimension2>
static void ItkImageCompare( itk::Image<TPixel1,VImageDimension1>* inputImage, itk::Image<TPixel2,VImageDimension2>* outputImage )
{
m_ComparisonResult = false;
typedef itk::Image<TPixel1, VImageDimension1> SliceImageType;
typedef itk::Image<TPixel2, VImageDimension2> VolumeImageType;
typedef itk::ImageSliceConstIteratorWithIndex< VolumeImageType > OutputSliceIteratorType;
typedef itk::ImageRegionConstIterator< SliceImageType > InputSliceIteratorType;
typename VolumeImageType::RegionType sliceInVolumeRegion;
sliceInVolumeRegion = outputImage->GetLargestPossibleRegion();
sliceInVolumeRegion.SetSize( m_SliceDimension, 1 ); // just one slice
sliceInVolumeRegion.SetIndex( m_SliceDimension, m_SliceIndex ); // exactly this slice, please
OutputSliceIteratorType outputIterator( outputImage, sliceInVolumeRegion );
outputIterator.SetFirstDirection(m_Dimension0);
outputIterator.SetSecondDirection(m_Dimension1);
InputSliceIteratorType inputIterator( inputImage, inputImage->GetLargestPossibleRegion() );
// iterate over output slice (and over input slice simultaneously)
outputIterator.GoToBegin();
inputIterator.GoToBegin();
while ( !outputIterator.IsAtEnd() )
{
while ( !outputIterator.IsAtEndOfSlice() )
{
while ( !outputIterator.IsAtEndOfLine() )
{
m_ComparisonResult = outputIterator.Get() == (TPixel2) inputIterator.Get();
if (!m_ComparisonResult) return; // return on first mismatch
++outputIterator;
++inputIterator;
}
outputIterator.NextLine();
}
outputIterator.NextSlice();
}
}
template<typename TPixel, unsigned int VImageDimension>
static void ItkImageSwitch( itk::Image<TPixel,VImageDimension>* itkImage )
{
const std::type_info& typeId=*(m_SliceImage->GetPixelType().GetTypeId());
- myMITKOverwriteSliceImageFilterAccessAllTypesByItk( m_SliceImage, ItkImageCompare, 2, itkImage );
+ //myMITKOverwriteSliceImageFilterAccessAllTypesByItk( m_SliceImage, ItkImageCompare, 2, itkImage );
+ AccessFixedDimensionByItk_1(m_SliceImage, ItkImageCompare, 2, itkImage)
}
static bool CompareSlice( mitk::Image* image, unsigned int sliceDimension, unsigned int sliceIndex, mitk::Image* slice )
{
if ( !image || ! slice ) return false;
switch (sliceDimension)
{
default:
case 2:
m_Dimension0 = 0;
m_Dimension1 = 1;
break;
case 1:
m_Dimension0 = 0;
m_Dimension1 = 2;
break;
case 0:
m_Dimension0 = 1;
m_Dimension1 = 2;
break;
}
if ( slice->GetDimension() != 2 || image->GetDimension() != 3 ||
slice->GetDimension(0) != image->GetDimension(m_Dimension0) ||
slice->GetDimension(1) != image->GetDimension(m_Dimension1) )
{
std::cerr << "Slice and image dimensions differ. Sorry, cannot work like this." << std::endl;
return false;
}
// this will do a long long if/else to find out both pixel typesA
m_SliceImage = slice;
m_SliceIndex = sliceIndex;
m_SliceDimension = sliceDimension;
m_ComparisonResult = false;
AccessFixedDimensionByItk( image, ItkImageSwitch, 3 );
return m_ComparisonResult;
}
}; // end class
#endif
diff --git a/Modules/MitkExt/Testing/mitkPointLocatorTest.cpp b/Modules/MitkExt/Testing/mitkPointLocatorTest.cpp
index 1f36e6106b..50b2e1829e 100644
--- a/Modules/MitkExt/Testing/mitkPointLocatorTest.cpp
+++ b/Modules/MitkExt/Testing/mitkPointLocatorTest.cpp
@@ -1,155 +1,168 @@
/*=========================================================================
Program: Medical Imaging & Interaction Toolkit
Language: C++
Date: $Date$
Version: $Revision$
Copyright (c) German Cancer Research Center, Division of Medical and
Biological Informatics. All rights reserved.
See MITKCopyright.txt or http://www.mitk.org/copyright.html for details.
This software is distributed WITHOUT ANY WARRANTY; without even
the implied warranty of MERCHANTABILITY or FITNESS FOR A PARTICULAR
PURPOSE. See the above copyright notices for more information.
=========================================================================*/
#include <mitkPointSet.h>
+#include <mitkTestingMacros.h>
#include <vtkPolyData.h>
#include <vtkPoints.h>
#include <mitkPointLocator.h>
#include <vtkPointLocator.h>
#include <cstdlib>
vtkFloatingPointType GenerateRandomNumber( const vtkFloatingPointType& min = 0.0, const vtkFloatingPointType& max = 100.0 )
{
return ( ( ( vtkFloatingPointType ) ( std::rand( ) ) ) / ( ( vtkFloatingPointType ) ( RAND_MAX ) ) ) * ( max - min) + min;
}
void GenerateRandomPoint( vtkFloatingPointType& x, vtkFloatingPointType& y, vtkFloatingPointType& z, const vtkFloatingPointType& min = 0.0, const vtkFloatingPointType& max = 100.0 )
{
x = GenerateRandomNumber(min, max);
y = GenerateRandomNumber(min, max);
z = GenerateRandomNumber(min, max);
}
int mitkPointLocatorTest(int /*argc*/, char* /*argv*/[])
{
+ MITK_TEST_BEGIN("mitkPointLocator");
std::srand( 1 );
unsigned int num_points = 10000;
// Create PointSet with randomly defined point
- std::cout << "Creating random point set of 10000 points ";
+ MITK_TEST_OUTPUT(<< "Creating random point set of 10000 points ");
vtkPoints* points = vtkPoints::New();
- if ( points == NULL )
- {
- std::cout << "vtkPoints == NULL. [FAILED]" << std::endl;
- return EXIT_FAILURE;
- }
-
for (unsigned int i = 0; i < num_points ; ++i )
{
points->InsertPoint(i, GenerateRandomNumber(), GenerateRandomNumber(), GenerateRandomNumber());
}
-
vtkPolyData* pointSet = vtkPolyData::New();
pointSet->SetPoints( points );
-
points->Delete();
-
- if ( (unsigned) pointSet->GetNumberOfPoints() != num_points )
- {
- std::cout << "Number of points in the vtkPointSet != "<< num_points <<". [FAILED]" << std::endl;
- return EXIT_FAILURE;
- }
- std::cout << "[PASSED]" << std::endl;
+
+ MITK_TEST_CONDITION_REQUIRED((unsigned) pointSet->GetNumberOfPoints()== num_points,"Test number of points in vtkPointSet");
// feed the point set into a vtk point locator
- std::cout << "Building vtkPointLocator ";
+ MITK_TEST_OUTPUT(<< "Building vtkPointLocator ");
vtkPointLocator* vtkPointLoc = vtkPointLocator::New();
vtkPointLoc->SetDataSet( pointSet );
vtkPointLoc->BuildLocator();
- std::cout << "[PASSED]" << std::endl;
+ MITK_TEST_OUTPUT(<< "[PASSED]");
// feed the point set into the mitk point locator
- std::cout << "Building mitkPointLocator ";
- mitk::PointLocator::Pointer mitkPointLocator = mitk::PointLocator::New();
- mitk::PointLocator::Pointer mitkPointLocator2 = mitk::PointLocator::New();
- if ( mitkPointLocator.IsNull() )
- {
- std::cout << "[FAILED]" << std::endl;
- return EXIT_FAILURE;
- }
- else
- {
- std::cout << "[PASSED]" << std::endl;
- }
+ MITK_TEST_OUTPUT(<< "Building mitkPointLocator ");
+ mitk::PointLocator::Pointer mitkPointLocatorInitializedByVtkPointSet = mitk::PointLocator::New();
+ mitk::PointLocator::Pointer mitkPointLocatorInitializedByMITKPointSet = mitk::PointLocator::New();
+ mitk::PointLocator::Pointer mitkPointLocatorInitializedByITKPointSet = mitk::PointLocator::New();
+ MITK_TEST_CONDITION_REQUIRED(mitkPointLocatorInitializedByVtkPointSet.IsNotNull(), "Test whether mitkPointLocator is not null");
mitk::PointSet::Pointer mitkPointSet = mitk::PointSet::New();
+ mitk::PointLocator::ITKPointSet::Pointer itkPointSet = mitk::PointLocator::ITKPointSet::New();
for ( int i=0; i<pointSet->GetNumberOfPoints();i++ )
{
mitk::Point3D pnt;
pnt[0] = pointSet->GetPoint( i )[0];
pnt[1] = pointSet->GetPoint( i )[1];
pnt[2] = pointSet->GetPoint( i )[2];
mitkPointSet->InsertPoint(i, pnt );
+ mitk::PointLocator::ITKPointSet::PointType itkPoint;
+ itkPoint[0] = pointSet->GetPoint( i )[0];
+ itkPoint[1] = pointSet->GetPoint( i )[1];
+ itkPoint[2] = pointSet->GetPoint( i )[2];
+ itkPointSet->SetPoint(i,itkPoint);
}
- std::cout << "Setting random point set ";
- mitkPointLocator->SetPoints( pointSet );
- mitkPointLocator2->SetPoints( mitkPointSet );
- std::cout << "[PASSED]" << std::endl;
+ MITK_TEST_OUTPUT(<< "Setting random point set ");
+ mitkPointLocatorInitializedByVtkPointSet->SetPoints( pointSet );
+ mitkPointLocatorInitializedByMITKPointSet->SetPoints( mitkPointSet );
+ mitkPointLocatorInitializedByITKPointSet->SetPoints( itkPointSet );
+ MITK_TEST_OUTPUT(<< "[PASSED]");
- std::cout << "Testing 1000 random points ";
+ MITK_TEST_OUTPUT(<< "Testing 1000 random points ");
// generate N random points and calculate the closest
// points with both the vtk and mitk pointlocator.
// verify, that the point ids are the same.
vtkFloatingPointType p[3], x, y, z;
mitk::PointSet::PointType pointType;
- for ( unsigned int i = 0 ; i < 1000 ; ++i )
+ for ( unsigned int i = 0 ; i < 100 ; ++i )
{
GenerateRandomPoint( x, y, z );
p[0] = x;
p[1] = y;
p[2] = z;
pointType[0] = p[0];
pointType[1] = p[1];
pointType[2] = p[2];
- int closestPoint1 = vtkPointLoc->FindClosestPoint(p);
- int closestPoint2 = mitkPointLocator->FindClosestPoint(p);
- int closestPoint3 = mitkPointLocator->FindClosestPoint(x, y, z);
- int closestPoint4 = mitkPointLocator2->FindClosestPoint(p);
- int closestPoint5 = mitkPointLocator2->FindClosestPoint(pointType);
-
- if ( closestPoint1 != closestPoint2 )
- {
- std::cout << "Id returned by vtkPointLocator doesn't match the one returned by mitk::PointLocator. [FAILED]" << std::endl;
- return EXIT_FAILURE;
- }
- if ( closestPoint2 != closestPoint3 )
- {
- std::cout << "There is a mismatch between passing coords as array and as single x/y/z coords. [FAILED]" << std::endl;
- return EXIT_FAILURE;
- }
- if ( closestPoint2 != closestPoint4 )
- {
- std::cout << "There is a mismatch between passing the points as mitkPointSet and vtkPointSet. [FAILED]" << std::endl;
- return EXIT_FAILURE;
- }
- if ( closestPoint4 != closestPoint5 )
- {
- std::cout << "There is a mismatch between passing coords as array and as single x/y/z coords when using MITK-Types. [FAILED]" << std::endl;
- return EXIT_FAILURE;
- }
+ int closestPointReference = vtkPointLoc->FindClosestPoint(p); // ground truth vtkPointLocator
+ int closestPointVTK1 = mitkPointLocatorInitializedByVtkPointSet->FindClosestPoint(p);
+ int closestPointVTK2 = mitkPointLocatorInitializedByVtkPointSet->FindClosestPoint(x, y, z);
+ int closestPointVTK3 = mitkPointLocatorInitializedByVtkPointSet->FindClosestPoint(pointType);
+ int closestPointMITK1 = mitkPointLocatorInitializedByMITKPointSet->FindClosestPoint(p);
+ int closestPointMITK2 = mitkPointLocatorInitializedByMITKPointSet->FindClosestPoint(x, y, z);
+ int closestPointMITK3 = mitkPointLocatorInitializedByMITKPointSet->FindClosestPoint(pointType);
+ int closestPointITK1 = mitkPointLocatorInitializedByITKPointSet->FindClosestPoint(p);
+ int closestPointITK2 = mitkPointLocatorInitializedByITKPointSet->FindClosestPoint(x, y, z);
+ int closestPointITK3 = mitkPointLocatorInitializedByITKPointSet->FindClosestPoint(pointType);
+ MITK_TEST_CONDITION_REQUIRED(closestPointReference==closestPointVTK1,"Test FindClosestPoint() using a point array with a PointLocator initialized with a vtkPointSet");
+ MITK_TEST_CONDITION_REQUIRED(closestPointReference==closestPointVTK2,"Test FindClosestPoint() using single coordinates with a PointLocator initialized with a vtkPointSet");
+ MITK_TEST_CONDITION_REQUIRED(closestPointReference==closestPointVTK3,"Test FindClosestPoint() using an mitk::PointSet with a PointLocator initialized with a vtkPointSet");
+ MITK_TEST_CONDITION_REQUIRED(closestPointReference==closestPointMITK1,"Test FindClosestPoint() using a point array with a PointLocator initialized with a mitk::PointSet");
+ MITK_TEST_CONDITION_REQUIRED(closestPointReference==closestPointMITK2,"Test FindClosestPoint() using single coordinates with a PointLocator initialized with a mitk::PointSet");
+ MITK_TEST_CONDITION_REQUIRED(closestPointReference==closestPointMITK3,"Test FindClosestPoint() using an mitk::PointSet with a PointLocator initialized with a mitk::PointSet");
+ MITK_TEST_CONDITION_REQUIRED(closestPointReference==closestPointITK1,"Test FindClosestPoint() using a point array with a PointLocator initialized with a itk::PointSet");
+ MITK_TEST_CONDITION_REQUIRED(closestPointReference==closestPointITK2,"Test FindClosestPoint() using single coordinates with a PointLocator initialized with a itk::PointSet");
+ MITK_TEST_CONDITION_REQUIRED(closestPointReference==closestPointITK3,"Test FindClosestPoint() using an mitk::PointSet with a PointLocator initialized with a itk::PointSet");
+ //Test GetMinimalDistance
+ // Get closest point
+ //double* closestPoint = vtkPointLoc->GetPoints()->GetPoint(closestPointReference);
+ double* closestPoint = pointSet->GetPoint(closestPointReference);
+ mitk::PointSet::PointType cP;
+ cP[0] = closestPoint[0];
+ cP[1] = closestPoint[1];
+ cP[2] = closestPoint[2];
+ mitk::PointLocator::DistanceType minimalDistanceReference = cP.SquaredEuclideanDistanceTo(pointType);
+
+ //mitk::PointLocator::DistanceType minimalDistanceReference =
+ // (x-closestPoint[0])*(x-closestPoint[0])+(y-closestPoint[1])*(y-closestPoint[1])+(z-closestPoint[2])*(z-closestPoint[2]);
+ mitk::PointLocator::DistanceType minimalDistanceVtk = mitkPointLocatorInitializedByVtkPointSet->GetMinimalDistance(pointType);
+ mitk::PointLocator::DistanceType minimalDistanceItk = mitkPointLocatorInitializedByITKPointSet->GetMinimalDistance(pointType);
+ mitk::PointLocator::DistanceType minimalDistanceMITK = mitkPointLocatorInitializedByMITKPointSet->GetMinimalDistance(pointType);
+ MITK_TEST_CONDITION_REQUIRED(mitk::Equal(minimalDistanceReference,minimalDistanceVtk), "Test GetMinimalDistance() using a PointLocator initialized with a vtkPointSet" );
+ MITK_TEST_CONDITION_REQUIRED(mitk::Equal(minimalDistanceReference,minimalDistanceItk), "Test GetMinimalDistance() using a PointLocator initialized with a itkPointSet" );
+ MITK_TEST_CONDITION_REQUIRED(mitk::Equal(minimalDistanceReference,minimalDistanceMITK), "Test GetMinimalDistance() using a PointLocator initialized with a MITKPointSet" );
+ int closestPointCombinedVtk;
+ mitk::PointLocator::DistanceType minimalDistanceCombinedVtk;
+ mitkPointLocatorInitializedByVtkPointSet->FindClosestPointAndDistance(pointType,&closestPointCombinedVtk,&minimalDistanceCombinedVtk);
+ int closestPointCombinedITK;
+ mitk::PointLocator::DistanceType minimalDistanceCombinedITK;
+ mitkPointLocatorInitializedByITKPointSet->FindClosestPointAndDistance(pointType,&closestPointCombinedITK,&minimalDistanceCombinedITK);
+ int closestPointCombinedMITK;
+ mitk::PointLocator::DistanceType minimalDistanceCombinedMITK;
+ mitkPointLocatorInitializedByMITKPointSet->FindClosestPointAndDistance(pointType,&closestPointCombinedMITK,&minimalDistanceCombinedMITK);
+ MITK_TEST_CONDITION_REQUIRED(mitk::Equal(minimalDistanceReference,minimalDistanceCombinedVtk), "Test distance returned by FindClosestPointAndDistance() using a PointLocator initialized with a vtkPointSet" );
+ MITK_TEST_CONDITION_REQUIRED(mitk::Equal(minimalDistanceReference,minimalDistanceCombinedITK), "Test distance returned by FindClosestPointAndDistance() using a PointLocator initialized with a itkPointSet" );
+ MITK_TEST_CONDITION_REQUIRED(mitk::Equal(minimalDistanceReference,minimalDistanceCombinedMITK), "Test distance returned by FindClosestPointAndDistance() using a PointLocator initialized with a MITKPointSet" );
+ MITK_TEST_CONDITION_REQUIRED(closestPointReference==closestPointCombinedVtk,"Test closest point returned by FindClosestPointAndDistance() using a point array with a PointLocator initialized with a vtkPointSet");
+ MITK_TEST_CONDITION_REQUIRED(closestPointReference==closestPointCombinedITK,"Test closest point returned by FindClosestPointAndDistance() using a point array with a PointLocator initialized with a itkPointSet");
+ MITK_TEST_CONDITION_REQUIRED(closestPointReference==closestPointCombinedMITK,"Test closest point returned by FindClosestPointAndDistance() using a point array with a PointLocator initialized with a MITKPointSet");
}
vtkPointLoc->Delete();
pointSet->Delete();
- std::cout << "[PASSED]" << std::endl;
- std::cout<<"[TEST DONE]"<<std::endl;
- return EXIT_SUCCESS;
+ MITK_TEST_END();
}
diff --git a/Modules/MitkExt/Testing/mitkSimpleHistogramTest.cpp b/Modules/MitkExt/Testing/mitkSimpleHistogramTest.cpp
new file mode 100644
index 0000000000..68bb96e027
--- /dev/null
+++ b/Modules/MitkExt/Testing/mitkSimpleHistogramTest.cpp
@@ -0,0 +1,47 @@
+/*=========================================================================
+
+Program: Medical Imaging & Interaction Toolkit
+Language: C++
+Date: $Date$
+Version: $Revision$
+
+Copyright (c) German Cancer Research Center, Division of Medical and
+Biological Informatics. All rights reserved.
+See MITKCopyright.txt or http://www.mitk.org/copyright.html for details.
+
+This software is distributed WITHOUT ANY WARRANTY; without even
+the implied warranty of MERCHANTABILITY or FITNESS FOR A PARTICULAR
+PURPOSE. See the above copyright notices for more information.
+
+=========================================================================*/
+
+#include <mitkSimpleHistogram.h>
+#include <mitkTestingMacros.h>
+#include <mitkSurface.h>
+
+int mitkSimpleHistogramTest(int /*argc*/, char* /*argv*/[])
+{
+ MITK_TEST_BEGIN("mitkSimpleHistogram");
+
+ mitk::SimpleImageHistogram* myTestSimpleImageHistogram = new mitk::SimpleImageHistogram();
+
+ MITK_TEST_CONDITION_REQUIRED(myTestSimpleImageHistogram!=NULL,"Testing instanciation.");
+ MITK_TEST_CONDITION_REQUIRED(myTestSimpleImageHistogram->GetMax()==1,"Testing GetMax().");
+ MITK_TEST_CONDITION_REQUIRED(myTestSimpleImageHistogram->GetMin()==0,"Testing GetMin().");
+ MITK_TEST_CONDITION_REQUIRED(myTestSimpleImageHistogram->GetRelativeBin(1.0,5.0) ==0,"Testing GetRelativeBin().");
+ bool success = true;
+ try
+ {
+ myTestSimpleImageHistogram->ComputeFromBaseData(NULL);
+ myTestSimpleImageHistogram->ComputeFromBaseData(mitk::Image::New()); //an empty image
+ myTestSimpleImageHistogram->ComputeFromBaseData(mitk::Surface::New()); //an invalid value
+ }
+ catch(...)
+ {
+ success = false;
+ }
+ MITK_TEST_CONDITION_REQUIRED(success,"Testing ComputeFromBaseData() with invalid input values.");
+ MITK_TEST_CONDITION_REQUIRED(!myTestSimpleImageHistogram->GetValid(),"Testing if histogram is invalid after invalid input.");
+
+ MITK_TEST_END();
+}
\ No newline at end of file
diff --git a/Modules/OpenCVVideoSupport/mitkImageToOpenCVImageFilter.cpp b/Modules/OpenCVVideoSupport/mitkImageToOpenCVImageFilter.cpp
index 22448475e5..f7ee6d8907 100644
--- a/Modules/OpenCVVideoSupport/mitkImageToOpenCVImageFilter.cpp
+++ b/Modules/OpenCVVideoSupport/mitkImageToOpenCVImageFilter.cpp
@@ -1,110 +1,121 @@
/*=========================================================================
Program: Medical Imaging & Interaction Toolkit
Language: C++
Date: $Date: 2010-01-14 14:20:26 +0100 (Do, 14 Jan 2010) $
Version: $Revision: 21047 $
Copyright (c) German Cancer Research Center, Division of Medical and
Biological Informatics. All rights reserved.
See MITKCopyright.txt or http://www.mitk.org/copyright.html for details.
This software is distributed WITHOUT ANY WARRANTY; without even
the implied warranty of MERCHANTABILITY or FITNESS FOR A PARTICULAR
PURPOSE. See the above copyright notices for more information.
=========================================================================*/
#include "mitkImageToOpenCVImageFilter.h"
#include <itkImportImageFilter.h>
#include <itkRGBPixel.h>
#include <mitkImageAccessByItk.h>
mitk::ImageToOpenCVImageFilter::ImageToOpenCVImageFilter()
: m_OpenCVImage(0)
{
}
mitk::ImageToOpenCVImageFilter::~ImageToOpenCVImageFilter()
{
m_OpenCVImage = 0;
}
+int mitk::ImageToOpenCVImageFilter::GetDepth(const std::type_info& typeInfo) const
+{
+ if(typeInfo == typeid(unsigned char))
+ {
+ return IPL_DEPTH_8U;
+ }
+ else if(typeInfo == typeid(char))
+ {
+ return IPL_DEPTH_8S;
+ }
+ else if(typeInfo == typeid(unsigned short))
+ {
+ return IPL_DEPTH_16U;
+ }
+ else if(typeInfo == typeid(short))
+ {
+ return IPL_DEPTH_16S;
+ }
+ else if(typeInfo == typeid(int))
+ {
+ return IPL_DEPTH_32S;
+ }
+ else if(typeInfo == typeid(float))
+ {
+ return IPL_DEPTH_32F;
+ }
+ else if(typeInfo == typeid(double))
+ {
+ return IPL_DEPTH_64F;
+ }
+ // rgb image
+ else if(typeInfo == typeid(UCRGBPixelType))
+ {
+ return IPL_DEPTH_8U;
+ }
+ else if(typeInfo == typeid(USRGBPixelType))
+ {
+ return IPL_DEPTH_16U;
+ }
+ else if(typeInfo == typeid(FloatRGBPixelType))
+ {
+ return IPL_DEPTH_64F;
+ }
+ else if(typeInfo == typeid(DoubleRGBPixelType))
+ {
+ return IPL_DEPTH_64F;
+ }
+ else return -1;
+}
+
bool mitk::ImageToOpenCVImageFilter::CheckImage( mitk::Image* image )
{
if(image == 0)
{
MITK_WARN << "MITK Image is 0";
return false;
}
if(image->GetDimension() != 2)
{
MITK_WARN << "Only 2D Images allowed";
return false;
}
return true;
}
IplImage* mitk::ImageToOpenCVImageFilter::GetOpenCVImage()
{
if(!m_OpenCVImage && this->CheckImage( m_Image ) == true )
{
- // gray image
- if(m_Image->GetPixelType() == typeid(unsigned char))
- {
- AccessFixedTypeByItk_1 ( m_Image.GetPointer(), ItkImageProcessing, unsigned char, 2, IPL_DEPTH_8U );
- }
- else if(m_Image->GetPixelType() == typeid(char))
- {
- AccessFixedTypeByItk_1 ( m_Image.GetPointer(), ItkImageProcessing, char, 2, IPL_DEPTH_8S );
- }
- else if(m_Image->GetPixelType() == typeid(unsigned short))
- {
- AccessFixedTypeByItk_1 ( m_Image.GetPointer(), ItkImageProcessing, unsigned short, 2, IPL_DEPTH_16U );
- }
- else if(m_Image->GetPixelType() == typeid(short))
- {
- AccessFixedTypeByItk_1 ( m_Image.GetPointer(), ItkImageProcessing, short, 2, IPL_DEPTH_16S );
- }
- else if(m_Image->GetPixelType() == typeid(int))
- {
- AccessFixedTypeByItk_1 ( m_Image.GetPointer(), ItkImageProcessing, int, 2, IPL_DEPTH_32S );
- }
- else if(m_Image->GetPixelType() == typeid(float))
- {
- AccessFixedTypeByItk_1 ( m_Image.GetPointer(), ItkImageProcessing, float, 2, IPL_DEPTH_32F );
- }
- else if(m_Image->GetPixelType() == typeid(double))
- {
- AccessFixedTypeByItk_1 ( m_Image.GetPointer(), ItkImageProcessing, double, 2, IPL_DEPTH_64F );
- }
-
- // rgb image
- else if(m_Image->GetPixelType() == typeid(UCRGBPixelType))
- {
- AccessFixedTypeByItk_1 ( m_Image.GetPointer(), ItkImageProcessing, UCRGBPixelType, 2, IPL_DEPTH_8U );
- }
- else if(m_Image->GetPixelType() == typeid(USRGBPixelType))
+ try
{
- AccessFixedTypeByItk_1 ( m_Image.GetPointer(), ItkImageProcessing, USRGBPixelType, 2, IPL_DEPTH_16U );
+ AccessFixedTypeByItk(m_Image.GetPointer(), ItkImageProcessing,
+ MITK_ACCESSBYITK_PIXEL_TYPES_SEQ // gray image
+ (UCRGBPixelType)(USRGBPixelType)(FloatRGBPixelType)(DoubleRGBPixelType), // rgb image
+ (2) // dimensions
+ )
}
- else if(m_Image->GetPixelType() == typeid(FloatRGBPixelType))
- {
- AccessFixedTypeByItk_1 ( m_Image.GetPointer(), ItkImageProcessing, FloatRGBPixelType, 2, IPL_DEPTH_64F );
- }
- else if(m_Image->GetPixelType() == typeid(DoubleRGBPixelType))
- {
- AccessFixedTypeByItk_1 ( m_Image.GetPointer(), ItkImageProcessing, DoubleRGBPixelType, 2, IPL_DEPTH_64F );
- }
-
+ catch (const AccessByItkException& ) {}
}
return m_OpenCVImage;
}
void mitk::ImageToOpenCVImageFilter::SetImage( mitk::Image* _Image )
{
if(m_Image == _Image) return;
m_Image = _Image;
m_OpenCVImage = 0;
-}
\ No newline at end of file
+}
diff --git a/Modules/OpenCVVideoSupport/mitkImageToOpenCVImageFilter.h b/Modules/OpenCVVideoSupport/mitkImageToOpenCVImageFilter.h
index 5a98ff885d..10ad739b61 100644
--- a/Modules/OpenCVVideoSupport/mitkImageToOpenCVImageFilter.h
+++ b/Modules/OpenCVVideoSupport/mitkImageToOpenCVImageFilter.h
@@ -1,140 +1,142 @@
/*=========================================================================
Program: Medical Imaging & Interaction Toolkit
Language: C++
Date: $Date: 2010-01-28 18:32:03 +0100 (Do, 28 Jan 2010) $
Version: $Revision: 21147 $
Copyright (c) German Cancer Research Center, Division of Medical and
Biological Informatics. All rights reserved.
See MITKCopyright.txt or http://www.mitk.org/copyright.html for details.
This software is distributed WITHOUT ANY WARRANTY; without even
the implied warranty of MERCHANTABILITY or FITNESS FOR A PARTICULAR
PURPOSE. See the above copyright notices for more information.
=========================================================================*/
#ifndef mitkImageToOpenCVImageFilter_h
#define mitkImageToOpenCVImageFilter_h
#include <mitkCommon.h>
#include <mitkImage.h>
#include <mitkWeakPointer.h>
#include <itkMacro.h>
#include <itkImage.h>
#include <itkRGBPixel.h>
#include <itkImageRegionIterator.h>
#include <cv.h>
#include "mitkOpenCVVideoSupportExports.h"
namespace mitk
{
/**
\brief A pseudo-Filter for creating OpenCV images from MITK images with the option of copying data or referencing it
Last contributor: $Author: mueller $
*/
class MITK_OPENCVVIDEOSUPPORT_EXPORT ImageToOpenCVImageFilter : public itk::Object
{
public:
typedef itk::RGBPixel< unsigned char > UCRGBPixelType;
typedef itk::RGBPixel< unsigned short > USRGBPixelType;
typedef itk::RGBPixel< float > FloatRGBPixelType;
typedef itk::RGBPixel< double > DoubleRGBPixelType;
template <typename TPixel, unsigned int VImageDimension>
static mitk::Image::Pointer ConvertIplToMitkImage( const IplImage * input, bool copyBuffer = true );
mitkClassMacro(ImageToOpenCVImageFilter, itk::Object);
itkNewMacro(ImageToOpenCVImageFilter);
void SetImage( mitk::Image* _Image );
itkGetMacro(Image, mitk::Image*);
bool CheckImage(mitk::Image* image);
///
/// Get the produced OpenCVImage.
/// ATTENTION: Do not forget to release this image again with cvReleaseImage().
///
IplImage* GetOpenCVImage();
protected:
ImageToOpenCVImageFilter(); // purposely hidden
virtual ~ImageToOpenCVImageFilter();
+ int GetDepth(const std::type_info& typeInfo) const;
+
template<typename TPixel, unsigned int VImageDimension>
- void ItkImageProcessing( itk::Image<TPixel,VImageDimension>* image, int depth );
+ void ItkImageProcessing( itk::Image<TPixel,VImageDimension>* image );
template<typename TPixel, unsigned int VImageDimension>
- void ItkImageProcessing( itk::Image<itk::RGBPixel<TPixel>,VImageDimension>* image, int depth );
+ void ItkImageProcessing( itk::Image<itk::RGBPixel<TPixel>,VImageDimension>* image );
protected:
///
/// Saves if the filter should copy the data or just reference it
///
mitk::WeakPointer<mitk::Image> m_Image;
IplImage* m_OpenCVImage;
};
template<typename TPixel, unsigned int VImageDimension>
- void mitk::ImageToOpenCVImageFilter::ItkImageProcessing( itk::Image<TPixel,VImageDimension>* image, int depth )
+ void mitk::ImageToOpenCVImageFilter::ItkImageProcessing( itk::Image<TPixel,VImageDimension>* image )
{
typedef itk::Image<TPixel, VImageDimension> ImageType;
const unsigned int numberOfPixels = m_Image->GetDimension(0) * m_Image->GetDimension(1);
const unsigned int numberOfBytes = numberOfPixels * sizeof( typename ImageType::PixelType );
const typename ImageType::PixelType * itkBuffer = image->GetBufferPointer();
typename ImageType::SizeType size = image->GetLargestPossibleRegion().GetSize();
// create new opencv image
m_OpenCVImage = cvCreateImage( cvSize( size[0], size[1] )
- , depth, 1 );
+ , GetDepth(typeid(TPixel)), 1 );
memcpy( m_OpenCVImage->imageData, itkBuffer, numberOfBytes );
}
template<typename TPixel, unsigned int VImageDimension>
- void mitk::ImageToOpenCVImageFilter::ItkImageProcessing( itk::Image<itk::RGBPixel<TPixel>,VImageDimension>* image, int depth )
+ void mitk::ImageToOpenCVImageFilter::ItkImageProcessing( itk::Image<itk::RGBPixel<TPixel>,VImageDimension>* image )
{
typedef itk::RGBPixel<TPixel> RGBPixelType;
typedef itk::Image<RGBPixelType, VImageDimension> RGBImageType;
typedef itk::ImageRegionIterator<RGBImageType> RGBIteratorType;
RGBIteratorType it(image, image->GetLargestPossibleRegion());
typename RGBImageType::SizeType size = image->GetLargestPossibleRegion().GetSize();
// create new opencv image
- m_OpenCVImage = cvCreateImage( cvSize( size[0], size[1] ), depth, 3 );
+ m_OpenCVImage = cvCreateImage( cvSize( size[0], size[1] ), GetDepth(typeid(RGBPixelType)), 3 );
unsigned int x = 0,y = 0;
CvScalar s;
for ( it.GoToBegin(); !it.IsAtEnd(); ++it )
{
s.val[0] = it.Value().GetBlue();
s.val[1] = it.Value().GetGreen();
s.val[2] = it.Value().GetRed();
//MITK_DEBUG << "[" << x << "," << y << "] " << s.val[0] << "(B)," << s.val[1] << "(G)," << s.val[2] << "(R)";
cvSet2D(m_OpenCVImage,y,x,s);
++x;
// next line found
if( x == size[0] )
{
x = 0;
++y;
}
}
}
} // namespace
#endif // mitkImageToOpenCVImageFilter_h
diff --git a/Modules/OpenCVVideoSupport/mitkOpenCVVideoSource.cpp b/Modules/OpenCVVideoSupport/mitkOpenCVVideoSource.cpp
index acd5e05809..a8c36f37cb 100644
--- a/Modules/OpenCVVideoSupport/mitkOpenCVVideoSource.cpp
+++ b/Modules/OpenCVVideoSupport/mitkOpenCVVideoSource.cpp
@@ -1,428 +1,435 @@
/*=========================================================================
Program: Medical Imaging & Interaction Toolkit
Language: C++
Date: $Date$
Version: $Revision$
Copyright (c) German Cancer Research Center, Division of Medical and
Biological Informatics. All rights reserved.
See MITKCopyright.txt or http://www.mitk.org/copyright.html for details.
This software is distributed WITHOUT ANY WARRANTY; without even
the implied warranty of MERCHANTABILITY or FITNESS FOR A PARTICULAR
PURPOSE. See the above copyright notices for more information.
=========================================================================*/
#include "mitkOpenCVVideoSource.h"
#include <iostream>
#include <algorithm>
mitk::OpenCVVideoSource::OpenCVVideoSource()
: m_VideoCapture(0),
m_CurrentImage(0),
m_CurrentVideoTexture(0),
m_PauseImage(0),
m_GrabbingDeviceNumber(-1),
m_RepeatVideo(false),
m_UseCVCAMLib(false),
m_UndistortImage(false),
m_RotationAngle(0.0),
m_RotationEnabled(false)
{
}
mitk::OpenCVVideoSource::~OpenCVVideoSource()
{
this->Reset();
}
void mitk::OpenCVVideoSource::SetVideoFileInput(const char * filename, bool repeatVideo, bool /*useCVCAMLib*/)
{
this->Reset();
m_VideoFileName = filename;
m_VideoCapture = cvCaptureFromFile(filename);
if(!m_VideoCapture)
MITK_WARN << "Error in initializing video file input!";
m_RepeatVideo = repeatVideo;
//m_CurrentImage = cvCreateImage(cvSize(m_CaptureWidth,m_CaptureHeight),8,3);
this->Modified();
}
void mitk::OpenCVVideoSource::SetVideoCameraInput(int cameraindex, bool /*useCVCAMLib*/)
{
this->Reset();
m_GrabbingDeviceNumber = cameraindex;
m_VideoCapture = cvCaptureFromCAM(m_GrabbingDeviceNumber);
if(!m_VideoCapture)
MITK_ERROR << "Error in initializing CVHighGUI video camera!"<< std::endl;
this->Modified();
}
double mitk::OpenCVVideoSource::GetVideoCaptureProperty(int property_id)
{
return cvGetCaptureProperty(m_VideoCapture, property_id);
}
int mitk::OpenCVVideoSource::SetVideoCaptureProperty(int property_id, double value)
{
return cvSetCaptureProperty(m_VideoCapture, property_id, value);
}
//method extended for "static video feature" if enabled
unsigned char* mitk::OpenCVVideoSource::GetVideoTexture()
{ // Fetch Frame and return pointer to opengl texture
FetchFrame();
if (m_RotationEnabled)
{
//store pointer to release memory for the image after rotation
IplImage * tmpImage = m_CurrentImage;
//rotate the image to get a static video
m_CurrentImage = this->RotateImage(m_CurrentImage);
// release memory
cvReleaseImage(&tmpImage); //
}
//transfer the image to a texture
this->UpdateVideoTexture();
return this->m_CurrentVideoTexture;
this->Modified();
}
cv::Mat mitk::OpenCVVideoSource::GetImage()
{
if(m_CurrentImage)
{
cv::Mat copy( m_CurrentImage, false );
return copy.clone();
}
return cv::Mat();
}
const IplImage * mitk::OpenCVVideoSource::GetCurrentFrame()
{
return m_CurrentImage;
}
void mitk::OpenCVVideoSource::GetCurrentFrameAsOpenCVImage(IplImage * image)
{ // get last captured frame for processing the image data
if(m_CurrentImage)
{
if(image)
{
image->origin = m_CurrentImage->origin;
memcpy(image->imageData,m_CurrentImage->imageData,m_CurrentImage->width*m_CurrentImage->height*m_CurrentImage->nChannels);
}
}
}
void mitk::OpenCVVideoSource::FetchFrame()
{ // main procedure for updating video data
if(m_CapturingInProcess)
{
if(m_VideoCapture) // we use highgui
{
if(!m_CapturePaused)
{
// release old image here
m_CurrentImage = cvQueryFrame(m_VideoCapture);
++m_FrameCount;
}
if(m_CurrentImage == NULL) // do we need to repeat the video if it is from video file?
{
double framePos = this->GetVideoCaptureProperty(CV_CAP_PROP_POS_AVI_RATIO);
MITK_DEBUG << "End of video file found. framePos: " << framePos;
if(m_RepeatVideo && framePos >= 0.99)
{
MITK_DEBUG << "Restarting video file playback.";
this->SetVideoCaptureProperty(CV_CAP_PROP_POS_AVI_RATIO, 0);
m_FrameCount = 0;
m_CurrentImage = cvQueryFrame(m_VideoCapture);
}
+ else
+ {
+ std::ostringstream s;
+ s << "End of video file " << m_VideoFileName;
+ std::logic_error err( s.str() );
+ throw err;
+ }
}
else
{
// only undistort if not paused
if(m_UndistortImage && m_UndistortCameraImage.IsNotNull())
m_UndistortCameraImage->UndistortImageFast(m_CurrentImage, 0);
}
if(m_CaptureWidth == 0 || m_CaptureHeight == 0)
{
MITK_DEBUG << "Trying to set m_CaptureWidth & m_CaptureHeight.";
m_CaptureWidth = m_CurrentImage->width;
m_CaptureHeight = m_CurrentImage->height;
MITK_INFO << "frame width: " << m_CaptureWidth << ", height: " << m_CaptureHeight;
m_CurrentImage->origin = 0;
}
}
}
}
void mitk::OpenCVVideoSource::UpdateVideoTexture()
{ //write the grabbed frame into an opengl compatible array, that means flip it and swap channel order
if(!m_CurrentImage)
return;
if(m_CurrentVideoTexture == NULL)
m_CurrentVideoTexture = new unsigned char[m_CaptureWidth*m_CaptureHeight*3];
int width = m_CurrentImage->width;
int height = m_CurrentImage->height;
int widthStep = m_CurrentImage->widthStep;
int nChannels = m_CurrentImage->nChannels;
unsigned char* tex = m_CurrentVideoTexture;
char* data = m_CurrentImage->imageData;
char* currentData = m_CurrentImage->imageData;
int hIndex=0;
int wIndex=0;
int iout,jout;
for(int i=0;i<width*height*3;i+=3,++wIndex)
{
if(wIndex >= width)
{
wIndex=0;
hIndex++;
}
// vertically flip the image
iout = -hIndex+height-1;
jout = wIndex;
currentData = data + iout*widthStep;
tex[i+2] = currentData[jout*nChannels + 0]; // B
tex[i+1] = currentData[jout*nChannels + 1]; // G
tex[i] = currentData[jout*nChannels + 2]; // R
}
}
void mitk::OpenCVVideoSource::StartCapturing()
{
if(m_VideoCapture != NULL)
m_CapturingInProcess = true;
else
m_CapturingInProcess = false;
}
void mitk::OpenCVVideoSource::StopCapturing()
{
m_CapturingInProcess = false;
}
bool mitk::OpenCVVideoSource::OnlineImageUndistortionEnabled() const
{
return m_UndistortCameraImage;
}
void mitk::OpenCVVideoSource::PauseCapturing()
{
m_CapturePaused = !m_CapturePaused;
if(m_CapturePaused)
{
m_PauseImage = cvCloneImage(m_CurrentImage);
// undistort this pause image if necessary
if(m_UndistortImage)
m_UndistortCameraImage->UndistortImageFast(m_PauseImage, 0);
m_CurrentImage = m_PauseImage;
}
else
{
cvReleaseImage( &m_PauseImage ); // release old pause image if necessary
m_CurrentImage = 0;
m_PauseImage = 0;
}
}
void mitk::OpenCVVideoSource::EnableOnlineImageUndistortion(mitk::Point3D focal, mitk::Point3D principal, mitk::Point4D distortion)
{
// Initialize Undistortion
m_UndistortImage = true;
float kc[4];
kc[0] = distortion[0]; kc[1] = distortion[1];
kc[2] = distortion[2]; kc[3] = distortion[3];
if(m_CaptureWidth == 0 || m_CaptureHeight == 0)
FetchFrame();
m_UndistortCameraImage = mitk::UndistortCameraImage::New();
m_UndistortCameraImage->SetUndistortImageFastInfo(focal[0], focal[1], principal[0], principal[1], kc, (float)m_CaptureWidth, (float)m_CaptureHeight);
}
void mitk::OpenCVVideoSource::DisableOnlineImageUndistortion()
{
m_UndistortImage = false;
}
// functions for compatibility with ITK segmentation only
void mitk::OpenCVVideoSource::GetCurrentFrameAsItkHSVPixelImage(HSVPixelImageType::Pointer &Image)
{
FetchFrame();
// Prepare iteration
HSVConstIteratorType itImage( Image, Image->GetLargestPossibleRegion());
itImage.Begin();
HSVPixelType pixel;
int rowsize = 3 * m_CaptureWidth;
char* bufferend;
char* picture;
picture = this->m_CurrentImage->imageData;
bufferend = this->m_CurrentImage->imageData + 3*(m_CaptureHeight*m_CaptureWidth);
float r,g,b,h,s,v;
try
{
// we have to flip the image
for(char* datapointer = bufferend - rowsize;datapointer >= picture; datapointer -= rowsize)
{
for(char* current = datapointer; current < datapointer + rowsize; current++)
{
b = *current; current++;
g = *current; current++;
r = *current;
RGBtoHSV(r,g,b,h,s,v);
pixel[0] = h;
pixel[1] = s;
pixel[2] = v;
itImage.Set(pixel);
++itImage;
}
}
}
catch( ... )
{
std::cout << "Exception raised mitkOpenCVVideoSource: get hsv itk image conversion error." << std::endl;
}
}
void mitk::OpenCVVideoSource::RGBtoHSV(float r, float g, float b, float &h, float &s, float &v)
{
if(r > 1.0)
r = r/255;
if(b > 1.0)
b = b/255;
if(g > 1.0)
g = g/255;
float mn=r,mx=r;
int maxVal=0;
if (g > mx){ mx=g;maxVal=1;}
if (b > mx){ mx=b;maxVal=2;}
if (g < mn) mn=g;
if (b < mn) mn=b;
float delta = mx - mn;
v = mx;
if( mx != 0 )
s = delta / mx;
else
{
s = 0;
h = 0;
return;
}
if (s==0.0f)
{
h=-1;
return;
}
else
{
switch (maxVal)
{
case 0:{h = ( g - b ) / delta;break;} // yel < h < mag
case 1:{h = 2 + ( b - r ) / delta;break;} // cyan < h < yel
case 2:{h = 4 + ( r - g ) / delta;break;} // mag < h < cyan
}
}
h *= 60;
if( h < 0 ) h += 360;
}
/*
* Rotate input image according to rotation angle around the viewing direction.
* Angle is supposed to be calculated in QmitkARRotationComponet in the update() method.
*/
IplImage* mitk::OpenCVVideoSource::RotateImage(IplImage* input)
{
if(input == NULL)
{ //warn the user and quit
std::cout<<"openCVVideoSource: Current video image is null! "<< std::endl;
return input;
}
IplImage* dst = cvCloneImage( input );
double angle = this->GetRotationAngle(); //degree
CvPoint2D32f centre;
CvMat *translate = cvCreateMat(2, 3, CV_32FC1);
cvSetZero(translate);
centre.x = m_CaptureWidth/2;
centre.y = m_CaptureHeight/2;
cv2DRotationMatrix(centre, angle, 1.0, translate);
cvWarpAffine(input, dst, translate,CV_INTER_LINEAR + CV_WARP_FILL_OUTLIERS , cvScalarAll(0));
cvReleaseMat(&translate);
return dst;
}
void mitk::OpenCVVideoSource::Reset()
{
// set capturing to false
this->StopCapturing();
if(m_VideoCapture)
cvReleaseCapture(&m_VideoCapture);
m_VideoCapture = 0;
m_CurrentImage = 0;
m_CaptureWidth = 0;
m_CaptureHeight = 0;
delete m_CurrentVideoTexture;
m_CurrentVideoTexture = 0;
if(m_PauseImage)
cvReleaseImage(&m_PauseImage);
m_PauseImage = 0;
m_CapturePaused = false;
m_VideoFileName.clear();
m_GrabbingDeviceNumber = -1;
// do not touch repeat video
//m_RepeatVideo = false;
m_UseCVCAMLib = false;
// do not touch undistort settings
// bool m_UndistortImage;
}
void mitk::OpenCVVideoSource::EnableRotation(bool enable= true)
{
m_RotationEnabled = enable;
this->Modified();
}
void mitk::OpenCVVideoSource::SetRotationAngle(double rotationAngle)
{
m_RotationAngle = rotationAngle;
this->Modified();
}
double mitk::OpenCVVideoSource::GetRotationAngle()
{
return m_RotationAngle;
}
diff --git a/Modules/PlanarFigure/Algorithms/mitkPlanarFigureObjectFactory.cpp b/Modules/PlanarFigure/Algorithms/mitkPlanarFigureObjectFactory.cpp
index 01afd55ffa..6071943627 100644
--- a/Modules/PlanarFigure/Algorithms/mitkPlanarFigureObjectFactory.cpp
+++ b/Modules/PlanarFigure/Algorithms/mitkPlanarFigureObjectFactory.cpp
@@ -1,125 +1,130 @@
/*=========================================================================
Program: Medical Imaging & Interaction Toolkit
Language: C++
Date: $Date: 2010-04-16 16:53:19 +0200 (Fr, 16 Apr 2010) $
Version: $Revision: 16916 $
Copyright (c) German Cancer Research Center, Division of Medical and
Biological Informatics. All rights reserved.
See MITKCopyright.txt or http://www.mitk.org/copyright.html for details.
This software is distributed WITHOUT ANY WARRANTY; without even
the implied warranty of MERCHANTABILITY or FITNESS FOR A PARTICULAR
PURPOSE. See the above copyright notices for more information.
=========================================================================*/
#include "mitkPlanarFigureObjectFactory.h"
+#include "mitkPlanarFigureWriter.h"
#include "mitkCoreObjectFactory.h"
#include "mitkPlanarFigureIOFactory.h"
#include "mitkPlanarFigureWriterFactory.h"
#include "mitkPlanarFigure.h"
#include "mitkPlanarFigureMapper2D.h"
typedef std::multimap<std::string, std::string> MultimapType;
mitk::PlanarFigureObjectFactory::PlanarFigureObjectFactory()
{
static bool alreadyDone = false;
if ( !alreadyDone )
{
MITK_INFO << "PlanarFigureObjectFactory c'tor" << std::endl;
RegisterIOFactories();
itk::ObjectFactoryBase::RegisterFactory( PlanarFigureIOFactory::New() );
PlanarFigureWriterFactory::RegisterOneFactory();
+ m_FileWriters.push_back( PlanarFigureWriter::New().GetPointer() );
+
+ mitk::CoreObjectFactory::GetInstance()->RegisterExtraFactory(this);
+
CreateFileExtensionsMap();
alreadyDone = true;
}
}
mitk::Mapper::Pointer mitk::PlanarFigureObjectFactory::CreateMapper(mitk::DataNode* node, MapperSlotId id)
{
mitk::Mapper::Pointer newMapper=NULL;
mitk::BaseData *data = node->GetData();
if ( id == mitk::BaseRenderer::Standard2D )
{
if ( dynamic_cast<PlanarFigure*>(data) != NULL )
{
newMapper = mitk::PlanarFigureMapper2D::New();
newMapper->SetDataNode(node);
}
}
else if ( id == mitk::BaseRenderer::Standard3D )
{
}
return newMapper;
}
void mitk::PlanarFigureObjectFactory::SetDefaultProperties(mitk::DataNode* node)
{
if ( node == NULL )
{
return;
}
mitk::DataNode::Pointer nodePointer = node;
mitk::PlanarFigure::Pointer pf = dynamic_cast<mitk::PlanarFigure*>( node->GetData() );
if ( pf.IsNotNull() )
{
mitk::PlanarFigureMapper2D::SetDefaultProperties(node);
}
}
const char* mitk::PlanarFigureObjectFactory::GetFileExtensions()
{
return "";
};
mitk::CoreObjectFactoryBase::MultimapType mitk::PlanarFigureObjectFactory::GetFileExtensionsMap()
{
return m_FileExtensionsMap;
}
const char* mitk::PlanarFigureObjectFactory::GetSaveFileExtensions()
{
//return ";;Planar Figures (*.pf)"; // for mitk::PlanarFigure and derived classes
std::string fileExtension;
this->CreateFileExtensions(m_SaveFileExtensionsMap, fileExtension);
return fileExtension.c_str();
};
mitk::CoreObjectFactoryBase::MultimapType mitk::PlanarFigureObjectFactory::GetSaveFileExtensionsMap()
{
return m_SaveFileExtensionsMap;
}
void mitk::PlanarFigureObjectFactory::CreateFileExtensionsMap()
{
m_SaveFileExtensionsMap.insert(std::pair<std::string, std::string>("*.pf", "Planar Figure Files"));
}
void mitk::PlanarFigureObjectFactory::RegisterIOFactories()
{
}
void RegisterPlanarFigureObjectFactory()
{
static bool oneObjectFactoryRegistered = false;
if ( !oneObjectFactoryRegistered )
{
MITK_INFO << "Registering PlanarFigureObjectFactory..." << std::endl;
mitk::CoreObjectFactory::GetInstance()->RegisterExtraFactory( mitk::PlanarFigureObjectFactory::New() );
oneObjectFactoryRegistered = true;
}
}
diff --git a/Modules/PlanarFigure/IO/mitkPlanarFigureReader.cpp b/Modules/PlanarFigure/IO/mitkPlanarFigureReader.cpp
index 267770d1bb..83a88751a8 100644
--- a/Modules/PlanarFigure/IO/mitkPlanarFigureReader.cpp
+++ b/Modules/PlanarFigure/IO/mitkPlanarFigureReader.cpp
@@ -1,426 +1,426 @@
/*=========================================================================
Program: Medical Imaging & Interaction Toolkit
Language: C++
Date: $Date: 2009-06-17 14:15:34 +0200 (Mi, 17. Jun 2009) $
Version: $Revision: 17745 $
Copyright (c) German Cancer Research Center, Division of Medical and
Biological Informatics. All rights reserved.
See MITKCopyright.txt or http://www.mitk.org/copyright.html for details.
This software is distributed WITHOUT ANY WARRANTY; without even
the implied warranty of MERCHANTABILITY or FITNESS FOR A PARTICULAR
PURPOSE. See the above copyright notices for more information.
=========================================================================*/
#include "mitkPlanarFigureReader.h"
#include "mitkPlanarAngle.h"
#include "mitkPlanarCircle.h"
#include "mitkPlanarLine.h"
#include "mitkPlanarArrow.h"
#include "mitkPlanarCross.h"
#include "mitkPlanarFourPointAngle.h"
#include "mitkPlanarPolygon.h"
#include "mitkPlanarRectangle.h"
#include "mitkPlaneGeometry.h"
-#include "mitkBasePropertyDeserializer.h"
+#include "mitkBasePropertySerializer.h"
#include <tinyxml.h>
#include <itksys/SystemTools.hxx>
mitk::PlanarFigureReader::PlanarFigureReader() : PlanarFigureSource(), FileReader(),
m_FileName(""), m_FilePrefix(""), m_FilePattern(""), m_Success(false)
{
this->SetNumberOfRequiredOutputs(1);
this->SetNumberOfOutputs(1);
this->SetNthOutput(0, this->MakeOutput(0));
m_CanReadFromMemory = true;
//this->Modified();
//this->GetOutput()->Modified();
//this->GetOutput()->ReleaseData();
}
mitk::PlanarFigureReader::~PlanarFigureReader()
{}
mitk::PlanarFigureSource::DataObjectPointer mitk::PlanarFigureReader::MakeOutput ( unsigned int )
{
return static_cast<itk::DataObject*>(PlanarCircle::New().GetPointer()); // just as a stand in for the pipeline update mechanism. This will be overwritten in GenerateData()
}
void mitk::PlanarFigureReader::GenerateData()
{
m_Success = false;
this->SetNumberOfOutputs(0); // reset all outputs, we add new ones depending on the file content
TiXmlDocument document;
if(m_ReadFromMemory)
{
if(m_MemoryBuffer == NULL || m_MemorySize == 0)
{
//check
itkWarningMacro( << "Sorry, memory buffer has not been set!" );
return;
}
if(m_MemoryBuffer[ m_MemorySize - 1 ] == '\0')
{
document.Parse(m_MemoryBuffer);
}
else
{
char * tmpArray = new char[(int)m_MemorySize+1];
tmpArray[m_MemorySize] = '\0';
memcpy(tmpArray,m_MemoryBuffer,m_MemorySize);
document.Parse(m_MemoryBuffer);
delete [] tmpArray;
}
}
else
{
if (m_FileName.empty())
{
itkWarningMacro( << "Sorry, filename has not been set!" );
return;
}
if (this->CanReadFile( m_FileName.c_str()) == false)
{
itkWarningMacro( << "Sorry, can't read file " << m_FileName << "!" );
return;
}
if (!document.LoadFile(m_FileName))
{
MITK_ERROR << "Could not open/read/parse " << m_FileName << ". TinyXML reports: '" << document.ErrorDesc() << "'. "
<< "The error occurred in row " << document.ErrorRow() << ", column " << document.ErrorCol() << ".";
return;
}
}
int fileVersion = 1;
TiXmlElement* versionObject = document.FirstChildElement("Version");
if (versionObject != NULL)
{
if ( versionObject->QueryIntAttribute( "FileVersion", &fileVersion ) != TIXML_SUCCESS )
{
MITK_WARN << m_FileName << " does not contain version information! Trying version 1 format." << std::endl;
}
}
else
{
MITK_WARN << m_FileName << " does not contain version information! Trying version 1 format." << std::endl;
}
if (fileVersion != 1) // add file version selection and version specific file parsing here, if newer file versions are created
{
MITK_WARN << "File version > 1 is not supported by this reader.";
return;
}
/* file version 1 reader code */
for( TiXmlElement* pfElement = document.FirstChildElement("PlanarFigure");
pfElement != NULL;
pfElement = pfElement->NextSiblingElement("PlanarFigure") )
{
if (pfElement == NULL)
continue;
std::string type = pfElement->Attribute("type");
mitk::PlanarFigure::Pointer planarFigure = NULL;
if (type == "PlanarAngle")
{
planarFigure = mitk::PlanarAngle::New();
}
else if (type == "PlanarCircle")
{
planarFigure = mitk::PlanarCircle::New();
}
else if (type == "PlanarCross")
{
planarFigure = mitk::PlanarCross::New();
}
else if (type == "PlanarFourPointAngle")
{
planarFigure = mitk::PlanarFourPointAngle::New();
}
else if (type == "PlanarLine")
{
planarFigure = mitk::PlanarLine::New();
}
else if (type == "PlanarPolygon")
{
planarFigure = mitk::PlanarPolygon::New();
}
else if (type == "PlanarRectangle")
{
planarFigure = mitk::PlanarRectangle::New();
}
else if (type == "PlanarArrow")
{
planarFigure = mitk::PlanarArrow::New();
}
else
{
// unknown type
MITK_WARN << "encountered unknown planar figure type '" << type << "'. Skipping this element.";
continue;
}
// Read properties of the planar figure
for( TiXmlElement* propertyElement = pfElement->FirstChildElement("property");
propertyElement != NULL;
propertyElement = propertyElement->NextSiblingElement("property") )
{
const char* keya = propertyElement->Attribute("key");
std::string key( keya ? keya : "");
const char* typea = propertyElement->Attribute("type");
std::string type( typea ? typea : "");
// hand propertyElement to specific reader
std::stringstream propertyDeserializerClassName;
- propertyDeserializerClassName << type << "Deserializer";
+ propertyDeserializerClassName << type << "Serializer";
std::list<itk::LightObject::Pointer> readers =
itk::ObjectFactoryBase::CreateAllInstance(propertyDeserializerClassName.str().c_str());
if (readers.size() < 1)
{
MITK_ERROR << "No property reader found for " << type;
}
if (readers.size() > 1)
{
MITK_WARN << "Multiple property readers found for " << type << ". Using arbitrary first one.";
}
for ( std::list<itk::LightObject::Pointer>::iterator iter = readers.begin();
iter != readers.end();
++iter )
{
- if (BasePropertyDeserializer* reader = dynamic_cast<BasePropertyDeserializer*>( iter->GetPointer() ) )
+ if (BasePropertySerializer* reader = dynamic_cast<BasePropertySerializer*>( iter->GetPointer() ) )
{
BaseProperty::Pointer property = reader->Deserialize( propertyElement->FirstChildElement() );
if (property.IsNotNull())
{
planarFigure->GetPropertyList()->ReplaceProperty(key, property);
}
else
{
MITK_ERROR << "There were errors while loading property '" << key << "' of type " << type << ". Your data may be corrupted";
}
break;
}
}
}
// Read geometry of containing plane
TiXmlElement* geoElement = pfElement->FirstChildElement("Geometry");
if (geoElement != NULL)
{
try
{
// Create plane geometry
mitk::PlaneGeometry::Pointer planeGeo = mitk::PlaneGeometry::New();
// Extract and set plane transform parameters
DoubleList transformList = this->GetDoubleAttributeListFromXMLNode( geoElement->FirstChildElement( "transformParam" ), "param", 12 );
typedef mitk::AffineGeometryFrame3D::TransformType TransformType;
TransformType::ParametersType parameters;
parameters.SetSize( 12 );
unsigned int i;
DoubleList::iterator it;
for ( it = transformList.begin(), i = 0;
it != transformList.end();
++it, ++i )
{
parameters.SetElement( i, *it );
}
typedef mitk::AffineGeometryFrame3D::TransformType TransformType;
TransformType::Pointer affineGeometry = TransformType::New();
affineGeometry->SetParameters( parameters );
planeGeo->SetIndexToWorldTransform( affineGeometry );
// Extract and set plane bounds
DoubleList boundsList = this->GetDoubleAttributeListFromXMLNode( geoElement->FirstChildElement( "boundsParam" ), "bound", 6 );
typedef mitk::Geometry3D::BoundsArrayType BoundsArrayType;
BoundsArrayType bounds;
for ( it = boundsList.begin(), i = 0;
it != boundsList.end();
++it, ++i )
{
bounds[i] = *it;
}
planeGeo->SetBounds( bounds );
// Extract and set spacing and origin
Vector3D spacing = this->GetVectorFromXMLNode(geoElement->FirstChildElement("Spacing"));
planeGeo->SetSpacing( spacing );
Point3D origin = this->GetPointFromXMLNode(geoElement->FirstChildElement("Origin"));
planeGeo->SetOrigin( origin );
planarFigure->SetGeometry2D(planeGeo);
}
catch (...)
{
}
}
TiXmlElement* cpElement = pfElement->FirstChildElement("ControlPoints");
bool first = true;
if (cpElement != NULL)
for( TiXmlElement* vertElement = cpElement->FirstChildElement("Vertex"); vertElement != NULL; vertElement = vertElement->NextSiblingElement("Vertex"))
{
if (vertElement == NULL)
continue;
int id = 0;
mitk::Point2D::ValueType x = 0.0;
mitk::Point2D::ValueType y = 0.0;
if (vertElement->QueryIntAttribute("id", &id) == TIXML_WRONG_TYPE)
return; // TODO: can we do a better error handling?
if (vertElement->QueryFloatAttribute("x", &x) == TIXML_WRONG_TYPE)
return; // TODO: can we do a better error handling?
if (vertElement->QueryFloatAttribute("y", &y) == TIXML_WRONG_TYPE)
return; // TODO: can we do a better error handling?
Point2D p;
p.SetElement(0, x);
p.SetElement(1, y);
if (first == true) // needed to set m_FigurePlaced to true
{
planarFigure->PlaceFigure(p);
first = false;
}
planarFigure->SetControlPoint(id, p, true);
}
// Calculate feature quantities of this PlanarFigure
planarFigure->EvaluateFeatures();
// Make sure that no control point is currently selected
planarFigure->DeselectControlPoint();
// \TODO: what about m_FigurePlaced and m_SelectedControlPoint ??
this->SetNthOutput( this->GetNumberOfOutputs(), planarFigure ); // add planarFigure as new output of this filter
}
m_Success = true;
}
mitk::Point3D mitk::PlanarFigureReader::GetPointFromXMLNode(TiXmlElement* e)
{
if (e == NULL)
throw std::invalid_argument("node invalid"); // TODO: can we do a better error handling?
mitk::Point3D point;
mitk::ScalarType p(-1.0);
if (e->QueryFloatAttribute("x", &p) == TIXML_WRONG_TYPE)
throw std::invalid_argument("node malformatted"); // TODO: can we do a better error handling?
point.SetElement(0, p);
if (e->QueryFloatAttribute("y", &p) == TIXML_WRONG_TYPE)
throw std::invalid_argument("node malformatted"); // TODO: can we do a better error handling?
point.SetElement(1, p);
if (e->QueryFloatAttribute("z", &p) == TIXML_WRONG_TYPE)
throw std::invalid_argument("node malformatted"); // TODO: can we do a better error handling?
point.SetElement(2, p);
return point;
}
mitk::Vector3D mitk::PlanarFigureReader::GetVectorFromXMLNode(TiXmlElement* e)
{
if (e == NULL)
throw std::invalid_argument("node invalid"); // TODO: can we do a better error handling?
mitk::Vector3D vector;
mitk::ScalarType p(-1.0);
if (e->QueryFloatAttribute("x", &p) == TIXML_WRONG_TYPE)
throw std::invalid_argument("node malformatted"); // TODO: can we do a better error handling?
vector.SetElement(0, p);
if (e->QueryFloatAttribute("y", &p) == TIXML_WRONG_TYPE)
throw std::invalid_argument("node malformatted"); // TODO: can we do a better error handling?
vector.SetElement(1, p);
if (e->QueryFloatAttribute("z", &p) == TIXML_WRONG_TYPE)
throw std::invalid_argument("node malformatted"); // TODO: can we do a better error handling?
vector.SetElement(2, p);
return vector;
}
mitk::PlanarFigureReader::DoubleList
mitk::PlanarFigureReader::GetDoubleAttributeListFromXMLNode(TiXmlElement* e, const char *attributeNameBase, unsigned int count)
{
DoubleList list;
if (e == NULL)
throw std::invalid_argument("node invalid"); // TODO: can we do a better error handling?
for ( unsigned int i = 0; i < count; ++i )
{
mitk::ScalarType p(-1.0);
std::stringstream attributeName;
attributeName << attributeNameBase << i;
if (e->QueryFloatAttribute( attributeName.str().c_str(), &p ) == TIXML_WRONG_TYPE)
throw std::invalid_argument("node malformatted"); // TODO: can we do a better error handling?
list.push_back( p );
}
return list;
}
void mitk::PlanarFigureReader::GenerateOutputInformation()
{
}
int mitk::PlanarFigureReader::CanReadFile ( const char *name )
{
if (std::string(name).empty())
return false;
return (itksys::SystemTools::LowerCase(itksys::SystemTools::GetFilenameLastExtension(name)) == ".pf"); //assume, we can read all .pf files
//TiXmlDocument document(name);
//if (document.LoadFile() == false)
// return false;
//return (document.FirstChildElement("PlanarFigure") != NULL);
}
bool mitk::PlanarFigureReader::CanReadFile(const std::string filename, const std::string, const std::string)
{
if (filename.empty())
return false;
return (itksys::SystemTools::LowerCase(itksys::SystemTools::GetFilenameLastExtension(filename)) == ".pf"); //assume, we can read all .pf files
//TiXmlDocument document(filename);
//if (document.LoadFile() == false)
// return false;
//return (document.FirstChildElement("PlanarFigure") != NULL);
}
void mitk::PlanarFigureReader::ResizeOutputs( const unsigned int& num )
{
unsigned int prevNum = this->GetNumberOfOutputs();
this->SetNumberOfOutputs( num );
for ( unsigned int i = prevNum; i < num; ++i )
{
this->SetNthOutput( i, this->MakeOutput( i ).GetPointer() );
}
}
diff --git a/Modules/PlanarFigure/IO/mitkPlanarFigureWriter.cpp b/Modules/PlanarFigure/IO/mitkPlanarFigureWriter.cpp
index 524eb47bcb..8e67d5f530 100644
--- a/Modules/PlanarFigure/IO/mitkPlanarFigureWriter.cpp
+++ b/Modules/PlanarFigure/IO/mitkPlanarFigureWriter.cpp
@@ -1,304 +1,304 @@
/*=========================================================================
Program: Medical Imaging & Interaction Toolkit
Language: C++
Date: $Date: 2009-05-12 19:56:03 +0200 (Di, 12. Mai 2009) $
Version: $Revision: 17179 $
Copyright (c) German Cancer Research Center, Division of Medical and
Biological Informatics. All rights reserved.
See MITKCopyright.txt or http://www.mitk.org/copyright.html for details.
This software is distributed WITHOUT ANY WARRANTY; without even
the implied warranty of MERCHANTABILITY or FITNESS FOR A PARTICULAR
PURPOSE. See the above copyright notices for more information.
=========================================================================*/
#include "mitkPlanarFigureWriter.h"
#include "mitkBasePropertySerializer.h"
#include <tinyxml.h>
mitk::PlanarFigureWriter::PlanarFigureWriter()
: m_FileName(""), m_FilePrefix(""), m_FilePattern(""), m_Extension(".pf"),
m_MimeType("application/MITK.PlanarFigure"), m_Success(false)
{
this->SetNumberOfRequiredInputs( 1 );
this->SetNumberOfOutputs( 0 );
//this->SetNthOutput( 0, mitk::PlanarFigure::New().GetPointer() );
m_CanWriteToMemory = true;
}
mitk::PlanarFigureWriter::~PlanarFigureWriter()
{}
void mitk::PlanarFigureWriter::GenerateData()
{
m_Success = false;
if (!m_WriteToMemory && m_FileName.empty())
{
MITK_ERROR << "Could not write planar figures. File name is invalid";
throw std::invalid_argument("file name is empty");
}
TiXmlDocument document;
TiXmlDeclaration* decl = new TiXmlDeclaration( "1.0", "", "" ); // TODO what to write here? encoding? etc....
document.LinkEndChild( decl );
TiXmlElement* version = new TiXmlElement("Version");
version->SetAttribute("Writer", __FILE__ );
version->SetAttribute("CVSRevision", "$Revision: 17055 $" );
version->SetAttribute("FileVersion", 1 );
document.LinkEndChild(version);
/* create xml element for each input */
for ( unsigned int i = 0 ; i < this->GetNumberOfInputs(); ++i )
{
// Create root element for this PlanarFigure
InputType::Pointer pf = this->GetInput( i );
if (pf.IsNull())
continue;
TiXmlElement* pfElement = new TiXmlElement("PlanarFigure");
pfElement->SetAttribute("type", pf->GetNameOfClass());
document.LinkEndChild(pfElement);
if ( pf->GetNumberOfControlPoints() == 0 )
continue;
//PlanarFigure::VertexContainerType* vertices = pf->GetControlPoints();
//if (vertices == NULL)
// continue;
// Serialize property list of PlanarFigure
mitk::PropertyList::Pointer propertyList = pf->GetPropertyList();
mitk::PropertyList::PropertyMap::const_iterator it;
for ( it = propertyList->GetMap()->begin(); it != propertyList->GetMap()->end(); ++it )
{
// Create seralizer for this property
- const mitk::BaseProperty* prop = it->second.first;
+ const mitk::BaseProperty* prop = it->second;
std::string serializerName = std::string( prop->GetNameOfClass() ) + "Serializer";
std::list< itk::LightObject::Pointer > allSerializers = itk::ObjectFactoryBase::CreateAllInstance(
serializerName.c_str() );
if ( allSerializers.size() != 1 )
{
// No or too many serializer(s) found, skip this property
continue;
}
mitk::BasePropertySerializer* serializer = dynamic_cast< mitk::BasePropertySerializer* >(
allSerializers.begin()->GetPointer() );
if ( serializer == NULL )
{
// Serializer not valid; skip this property
}
TiXmlElement* keyElement = new TiXmlElement( "property" );
keyElement->SetAttribute( "key", it->first );
keyElement->SetAttribute( "type", prop->GetNameOfClass() );
serializer->SetProperty( prop );
TiXmlElement* valueElement = NULL;
try
{
valueElement = serializer->Serialize();
}
catch (...)
{
}
if ( valueElement == NULL )
{
// Serialization failed; skip this property
continue;
}
// Add value to property element
keyElement->LinkEndChild( valueElement );
// Append serialized property to property list
pfElement->LinkEndChild( keyElement );
}
// Serialize control points of PlanarFigure
TiXmlElement* controlPointsElement = new TiXmlElement("ControlPoints");
pfElement->LinkEndChild(controlPointsElement);
for (unsigned int i = 0; i < pf->GetNumberOfControlPoints(); i++)
{
TiXmlElement* vElement = new TiXmlElement("Vertex");
vElement->SetAttribute("id", i);
vElement->SetDoubleAttribute("x", pf->GetControlPoint(i)[0]);
vElement->SetDoubleAttribute("y", pf->GetControlPoint(i)[1]);
controlPointsElement->LinkEndChild(vElement);
}
TiXmlElement* geoElement = new TiXmlElement("Geometry");
const PlaneGeometry* planeGeo = dynamic_cast<const PlaneGeometry*>(pf->GetGeometry2D());
if (planeGeo != NULL)
{
// Write parameters of IndexToWorldTransform of the PlaneGeometry
typedef mitk::AffineGeometryFrame3D::TransformType TransformType;
const TransformType* affineGeometry = planeGeo->GetIndexToWorldTransform();
const TransformType::ParametersType& parameters = affineGeometry->GetParameters();
TiXmlElement* vElement = new TiXmlElement( "transformParam" );
for ( unsigned int i = 0; i < affineGeometry->GetNumberOfParameters(); ++i )
{
std::stringstream paramName;
paramName << "param" << i;
vElement->SetDoubleAttribute( paramName.str().c_str(), parameters.GetElement( i ) );
}
geoElement->LinkEndChild( vElement );
// Write bounds of the PlaneGeometry
typedef mitk::Geometry3D::BoundsArrayType BoundsArrayType;
const BoundsArrayType& bounds = planeGeo->GetBounds();
vElement = new TiXmlElement( "boundsParam" );
for ( unsigned int i = 0; i < 6; ++i )
{
std::stringstream boundName;
boundName << "bound" << i;
vElement->SetDoubleAttribute( boundName.str().c_str(), bounds.GetElement( i ) );
}
geoElement->LinkEndChild( vElement );
// Write spacing and origin of the PlaneGeometry
Vector3D spacing = planeGeo->GetSpacing();
Point3D origin = planeGeo->GetOrigin();
geoElement->LinkEndChild(this->CreateXMLVectorElement("Spacing", spacing));
geoElement->LinkEndChild(this->CreateXMLVectorElement("Origin", origin));
pfElement->LinkEndChild(geoElement);
}
}
if(m_WriteToMemory)
{
// Declare a printer
TiXmlPrinter printer;
// attach it to the document you want to convert in to a std::string
document.Accept(&printer);
// Create memory buffer and print tinyxmldocument there...
- m_MemoryBufferSize = printer.Size();
+ m_MemoryBufferSize = printer.Size() + 1;
m_MemoryBuffer = new char[m_MemoryBufferSize];
- memcpy(m_MemoryBuffer,printer.CStr(),m_MemoryBufferSize);
+ strcpy(m_MemoryBuffer,printer.CStr());
}
else
{
if (document.SaveFile( m_FileName) == false)
{
MITK_ERROR << "Could not write planar figures to " << m_FileName << "\nTinyXML reports '" << document.ErrorDesc() << "'";
throw std::ios_base::failure("Error during writing of planar figure xml file.");
}
}
m_Success = true;
}
void mitk::PlanarFigureWriter::ReleaseMemory()
{
if(m_MemoryBuffer != NULL)
{
delete [] m_MemoryBuffer;
}
}
TiXmlElement* mitk::PlanarFigureWriter::CreateXMLVectorElement(const char* name, itk::FixedArray<mitk::ScalarType, 3> v)
{
TiXmlElement* vElement = new TiXmlElement(name);
vElement->SetDoubleAttribute("x", v.GetElement(0));
vElement->SetDoubleAttribute("y", v.GetElement(1));
vElement->SetDoubleAttribute("z", v.GetElement(2));
return vElement;
}
void mitk::PlanarFigureWriter::ResizeInputs( const unsigned int& num )
{
//unsigned int prevNum = this->GetNumberOfInputs();
this->SetNumberOfInputs( num );
//for ( unsigned int i = prevNum; i < num; ++i )
//{
// this->SetNthInput( i, mitk::PlanarFigure::New().GetPointer() );
//}
}
void mitk::PlanarFigureWriter::SetInput( InputType* PlanarFigure )
{
this->ProcessObject::SetNthInput( 0, PlanarFigure );
}
void mitk::PlanarFigureWriter::SetInput( const unsigned int& id, InputType* PlanarFigure )
{
if ( id >= this->GetNumberOfInputs() )
this->ResizeInputs( id + 1 );
this->ProcessObject::SetNthInput( id, PlanarFigure );
}
mitk::PlanarFigure* mitk::PlanarFigureWriter::GetInput()
{
if ( this->GetNumberOfInputs() < 1 )
return NULL;
else
return dynamic_cast<InputType*> ( this->GetInput( 0 ) );
}
mitk::PlanarFigure* mitk::PlanarFigureWriter::GetInput( const unsigned int& num )
{
return dynamic_cast<InputType*> ( this->ProcessObject::GetInput( num ) );
}
bool mitk::PlanarFigureWriter::CanWriteDataType( DataNode* input )
{
if ( input == NULL )
return false;
mitk::BaseData* data = input->GetData();
if ( data == NULL)
return false;
mitk::PlanarFigure::Pointer PlanarFigure = dynamic_cast<mitk::PlanarFigure*>( data );
if( PlanarFigure.IsNull() )
return false;
// add code for special subclasses here
return true;
}
void mitk::PlanarFigureWriter::SetInput( DataNode* input )
{
if (this->CanWriteDataType(input))
this->ProcessObject::SetNthInput( 0, dynamic_cast<mitk::PlanarFigure*>( input->GetData() ) );
}
std::string mitk::PlanarFigureWriter::GetWritenMIMEType()
{
return m_MimeType;
}
std::vector<std::string> mitk::PlanarFigureWriter::GetPossibleFileExtensions()
{
std::vector<std::string> possibleFileExtensions;
possibleFileExtensions.push_back(m_Extension);
return possibleFileExtensions;
}
std::string mitk::PlanarFigureWriter::GetFileExtension()
{
return m_Extension;
}
diff --git a/Modules/PlanarFigure/IO/mitkPlanarFigureWriter.h b/Modules/PlanarFigure/IO/mitkPlanarFigureWriter.h
index 63f0085123..2b9cc0e38b 100644
--- a/Modules/PlanarFigure/IO/mitkPlanarFigureWriter.h
+++ b/Modules/PlanarFigure/IO/mitkPlanarFigureWriter.h
@@ -1,188 +1,206 @@
/*=========================================================================
Program: Medical Imaging & Interaction Toolkit
Language: C++
Date: $Date: 2009-05-12 19:56:03 +0200 (Di, 12. Mai 2009) $
Version: $Revision: 17179 $
Copyright (c) German Cancer Research Center, Division of Medical and
Biological Informatics. All rights reserved.
See MITKCopyright.txt or http://www.mitk.org/copyright.html for details.
This software is distributed WITHOUT ANY WARRANTY; without even
the implied warranty of MERCHANTABILITY or FITNESS FOR A PARTICULAR
PURPOSE. See the above copyright notices for more information.
=========================================================================*/
#ifndef _MITK_PlanarFigure_WRITER__H_
#define _MITK_PlanarFigure_WRITER__H_
#include <itkProcessObject.h>
#include "PlanarFigureExports.h"
-#include <mitkFileWriter.h>
+#include <mitkFileWriterWithInformation.h>
#include <mitkPlanarFigure.h>
class TiXmlElement;
namespace mitk
{
/**
* @brief XML-based writer for mitk::PlanarFigures
*
* XML-based writer for mitk::PlanarFigures.
* @ingroup Process
*/
- class PlanarFigure_EXPORT PlanarFigureWriter : public mitk::FileWriter
+ class PlanarFigure_EXPORT PlanarFigureWriter : public mitk::FileWriterWithInformation
{
public:
mitkClassMacro( PlanarFigureWriter, mitk::FileWriter );
mitkWriterMacro;
itkNewMacro( Self );
typedef mitk::PlanarFigure InputType;
typedef InputType::Pointer InputTypePointer;
/**
* Sets the filename of the file to write.
* @param FileName the name of the file to write.
*/
itkSetStringMacro( FileName );
/**
* @returns the name of the file to be written to disk.
*/
itkGetStringMacro( FileName );
/**
* @warning multiple write not (yet) supported
*/
itkSetStringMacro( FilePrefix );
/**
* @warning multiple write not (yet) supported
*/
itkGetStringMacro( FilePrefix );
/**
* @warning multiple write not (yet) supported
*/
itkSetStringMacro( FilePattern );
/**
* @warning multiple write not (yet) supported
*/
itkGetStringMacro( FilePattern );
/**
* Sets the 0'th input object for the filter.
* @param input the first input for the filter.
*/
void SetInput( InputType* input );
/**
* Sets the n'th input object for the filter. If num is
* larger than GetNumberOfInputs() the number of inputs is
* resized appropriately.
* @param input the n'th input for the filter.
*/
void SetInput( const unsigned int& num, InputType* input);
/**
* @returns the 0'th input object of the filter.
*/
PlanarFigure* GetInput();
/**
* @param num the index of the desired output object.
* @returns the n'th input object of the filter.
*/
PlanarFigure* GetInput( const unsigned int& num );
/**
* @brief Return the possible file extensions for the data type associated with the writer
*/
virtual std::vector<std::string> GetPossibleFileExtensions();
/**
* @brief Return the extension to be added to the filename.
*/
virtual std::string GetFileExtension();
/**
* @brief Check if the Writer can write the Content of the
*/
virtual bool CanWriteDataType( DataNode* );
/**
* @brief Return the MimeType of the saved File.
*/
virtual std::string GetWritenMIMEType();
/**
* @brief Set the DataTreenode as Input. Important: The Writer always have a SetInput-Function.
*/
virtual void SetInput( DataNode* );
/**
* @returns whether the last write attempt was successful or not.
*/
itkGetConstMacro(Success, bool);
+
+ virtual const char * GetDefaultFilename() { return "PlanarFigure.pf"; }
+ virtual const char * GetFileDialogPattern() { return "Planar Figure Files (*.pf)"; }
+ virtual const char * GetDefaultExtension() { return ".pf"; }
+ virtual bool CanWriteBaseDataType(BaseData::Pointer data)
+ {
+ mitk::DataNode::Pointer node = mitk::DataNode::New();
+ node->SetData(data);
+ return CanWriteDataType(node);
+ }
+ virtual void DoWrite(BaseData::Pointer data) {
+ if (CanWriteBaseDataType(data)) {
+ this->SetInput(dynamic_cast<mitk::PlanarFigure*>(data.GetPointer()));
+ this->Update();
+ }
+ }
+
+
/**
@brief CAUTION: It's up to the user to call this function to release the
memory buffer after use in case the file writer has written to its memory array.
See mitkFileWriter base class. */
virtual void ReleaseMemory();
protected:
/**
* Constructor.
*/
PlanarFigureWriter();
/**
* Virtual destructor.
*/
virtual ~PlanarFigureWriter();
/**
* Writes the a .pf file in xml format that contains all input planar figures
*/
virtual void GenerateData();
/**
* Resizes the number of inputs of the writer.
* The inputs are initialized by empty PlanarFigures
* @param num the new number of inputs
*/
virtual void ResizeInputs( const unsigned int& num );
/**Documentation
* \brief creates a TinyXML element that contains x, y, and z values
*
* \param[in] name the name of the XML element
* \param[in] v the vector or point that contains the x, y and z values
* \return returns a TiXmlElement named name and three attributes x, y and z.
*/
TiXmlElement* CreateXMLVectorElement(const char* name, itk::FixedArray<mitk::ScalarType, 3> v);
std::string m_FileName;
std::string m_FilePrefix;
std::string m_FilePattern;
std::string m_Extension;
std::string m_MimeType;
bool m_Success;
};
}
#endif
diff --git a/Modules/PlanarFigure/Rendering/mitkPlanarFigureMapper2D.cpp b/Modules/PlanarFigure/Rendering/mitkPlanarFigureMapper2D.cpp
index 75a2b88997..410fa0bd05 100644
--- a/Modules/PlanarFigure/Rendering/mitkPlanarFigureMapper2D.cpp
+++ b/Modules/PlanarFigure/Rendering/mitkPlanarFigureMapper2D.cpp
@@ -1,630 +1,675 @@
/*=========================================================================
Program: Medical Imaging & Interaction Toolkit
Language: C++
Date: $Date: 2009-04-23 13:50:34 +0200 (Do, 23 Apr 2009) $
Version: $Revision: 16947 $
Copyright (c) German Cancer Research Center, Division of Medical and
Biological Informatics. All rights reserved.
See MITKCopyright.txt or http://www.mitk.org/copyright.html for details.
This software is distributed WITHOUT ANY WARRANTY; without even
the implied warranty of MERCHANTABILITY or FITNESS FOR A PARTICULAR
PURPOSE. See the above copyright notices for more information.
=========================================================================*/
#include "mitkPlanarFigureMapper2D.h"
#include "mitkBaseRenderer.h"
#include "mitkPlaneGeometry.h"
#include "mitkColorProperty.h"
#include "mitkProperties.h"
#include "mitkGL.h"
#include "mitkVtkPropRenderer.h"
mitk::PlanarFigureMapper2D::PlanarFigureMapper2D()
{
this->InitializeDefaultPlanarFigureProperties();
}
mitk::PlanarFigureMapper2D::~PlanarFigureMapper2D()
{
}
void mitk::PlanarFigureMapper2D::Paint( mitk::BaseRenderer *renderer )
{
if ( !this->IsVisible( renderer ) )
{
return;
}
// Get PlanarFigure from input
mitk::PlanarFigure *planarFigure = const_cast< mitk::PlanarFigure * >(
static_cast< const mitk::PlanarFigure * >( this->GetData() ) );
// Check if PlanarFigure has already been placed; otherwise, do nothing
if ( !planarFigure->IsPlaced() )
{
return;
}
// Get 2D geometry frame of PlanarFigure
mitk::Geometry2D *planarFigureGeometry2D =
dynamic_cast< Geometry2D * >( planarFigure->GetGeometry( 0 ) );
if ( planarFigureGeometry2D == NULL )
{
MITK_ERROR << "PlanarFigure does not have valid Geometry2D!";
return;
}
// Get current world 2D geometry from renderer
const mitk::Geometry2D *rendererGeometry2D = renderer->GetCurrentWorldGeometry2D();
// If the PlanarFigure geometry is a plane geometry, check if current
// world plane is parallel to and within the planar figure geometry bounds
// (otherwise, display nothing)
mitk::PlaneGeometry *planarFigurePlaneGeometry =
dynamic_cast< PlaneGeometry * >( planarFigureGeometry2D );
const mitk::PlaneGeometry *rendererPlaneGeometry =
dynamic_cast< const PlaneGeometry * >( rendererGeometry2D );
if ( (planarFigurePlaneGeometry != NULL) && (rendererPlaneGeometry != NULL) )
{
double planeThickness = planarFigurePlaneGeometry->GetExtentInMM( 2 );
if ( !planarFigurePlaneGeometry->IsParallel( rendererPlaneGeometry )
|| !(planarFigurePlaneGeometry->DistanceFromPlane(
rendererPlaneGeometry ) < planeThickness / 3.0) )
{
// Planes are not parallel or renderer plane is not within PlanarFigure
// geometry bounds --> exit
return;
}
}
else
{
// Plane is not valid (curved reformations are not possible yet)
return;
}
// Get display geometry
mitk::DisplayGeometry *displayGeometry = renderer->GetDisplayGeometry();
assert( displayGeometry != NULL );
// Apply visual appearance properties from the PropertyList
this->ApplyProperties( renderer );
// Enable line antialiasing
glEnable( GL_LINE_SMOOTH );
glHint( GL_LINE_SMOOTH_HINT, GL_NICEST );
// Get properties from node (if present)
const mitk::DataNode* node=this->GetDataNode();
this->InitializePlanarFigurePropertiesFromDataNode( node );
PlanarFigureDisplayMode lineDisplayMode = PF_DEFAULT;
if ( m_IsSelected )
{
lineDisplayMode = PF_SELECTED;
}
else if ( m_IsHovering )
{
lineDisplayMode = PF_HOVER;
}
mitk::Point2D firstPoint; firstPoint[0] = 0; firstPoint[1] = 1;
if ( m_DrawOutline )
{
// Draw the outline for all polylines if requested
this->DrawMainLines( planarFigure,
m_OutlineColor[lineDisplayMode],
m_OutlineOpacity[lineDisplayMode],
m_DrawShadow,
m_OutlineWidth,
m_ShadowWidthFactor,
firstPoint,
planarFigureGeometry2D, rendererGeometry2D, displayGeometry );
// Draw the outline for all helper objects if requested
this->DrawHelperLines( planarFigure,
m_OutlineColor[lineDisplayMode],
m_OutlineOpacity[lineDisplayMode],
m_DrawShadow,
m_OutlineWidth,
m_ShadowWidthFactor,
firstPoint,
planarFigureGeometry2D, rendererGeometry2D, displayGeometry );
}
// Draw the main line for all polylines
this->DrawMainLines( planarFigure,
m_LineColor[lineDisplayMode],
m_LineOpacity[lineDisplayMode],
m_DrawShadow,
m_LineWidth,
m_ShadowWidthFactor,
firstPoint,
planarFigureGeometry2D, rendererGeometry2D, displayGeometry );
double annotationOffset = 0.0;
// draw name near the first point (if present)
std::string name = node->GetName();
if ( !name.empty() )
{
mitk::VtkPropRenderer* openGLrenderer = dynamic_cast<mitk::VtkPropRenderer*>( renderer );
if ( openGLrenderer )
{
if ( m_IsSelected || m_IsHovering )
{
openGLrenderer->WriteSimpleText( name,
firstPoint[0] + 6.0, firstPoint[1] + 4.0,
0,
0,
0); //this is a shadow
openGLrenderer->WriteSimpleText( name,
firstPoint[0] + 5.0, firstPoint[1] + 5.0,
m_LineColor[lineDisplayMode][0],
m_LineColor[lineDisplayMode][1],
m_LineColor[lineDisplayMode][2] );
}
// If drawing is successful, add approximate height to annotation offset
annotationOffset -= 15.0;
}
}
// draw feature quantities (if requested) new the first point
if ( m_DrawQuantities )
{
std::stringstream quantityString;
quantityString.setf( ios::fixed, ios::floatfield );
quantityString.precision( 1 );
bool firstActiveFeature = true;
for ( unsigned int i = 0; i < planarFigure->GetNumberOfFeatures(); ++i )
{
if( planarFigure->IsFeatureActive(i) && planarFigure->IsFeatureVisible( i ) )
{
if ( ! firstActiveFeature )
{
quantityString << " / ";
}
quantityString << planarFigure->GetQuantity( i ) << " ";
quantityString << planarFigure->GetFeatureUnit( i );
firstActiveFeature = false;
}
}
mitk::VtkPropRenderer* openGLrenderer = dynamic_cast<mitk::VtkPropRenderer*>( renderer );
if ( openGLrenderer )
{
openGLrenderer->WriteSimpleText( quantityString.str().c_str(),
firstPoint[0] + 6.0, firstPoint[1] + 4.0 + annotationOffset,
0,
0,
0); //this is a shadow
openGLrenderer->WriteSimpleText( quantityString.str().c_str(),
firstPoint[0] + 5.0, firstPoint[1] + 5.0 + annotationOffset,
m_LineColor[lineDisplayMode][0],
m_LineColor[lineDisplayMode][1],
m_LineColor[lineDisplayMode][2] );
// If drawing is successful, add approximate height to annotation offset
annotationOffset -= 15.0;
}
}
// Draw helper objects
this->DrawHelperLines( planarFigure,
m_HelperlineColor[lineDisplayMode],
m_HelperlineOpacity[lineDisplayMode],
m_DrawShadow,
m_LineWidth,
m_ShadowWidthFactor,
firstPoint,
planarFigureGeometry2D, rendererGeometry2D, displayGeometry );
// Draw markers at control points (selected control point will be colored)
for ( unsigned int i = 0; i < planarFigure->GetNumberOfControlPoints(); ++i )
{
bool isEditable = true;
m_DataNode->GetBoolProperty( "planarfigure.iseditable", isEditable );
PlanarFigureDisplayMode pointDisplayMode = PF_DEFAULT;
// Only if planar figure is marked as editable: display markers (control points) in a
// different style if mouse is over them or they are selected
if ( isEditable )
{
if ( i == (unsigned int) planarFigure->GetSelectedControlPoint() )
{
pointDisplayMode = PF_SELECTED;
}
else if ( m_IsHovering )
{
pointDisplayMode = PF_HOVER;
}
}
this->DrawMarker( planarFigure->GetControlPoint( i ),
m_MarkerlineColor[pointDisplayMode],
m_MarkerlineOpacity[pointDisplayMode],
m_MarkerColor[pointDisplayMode],
m_MarkerOpacity[pointDisplayMode],
m_LineWidth,
m_ControlPointShape,
planarFigureGeometry2D,
rendererGeometry2D,
displayGeometry );
}
if ( planarFigure->IsPreviewControlPointVisible() )
{
this->DrawMarker( planarFigure->GetPreviewControlPoint(),
m_MarkerlineColor[PF_HOVER],
m_MarkerlineOpacity[PF_HOVER],
m_MarkerColor[PF_HOVER],
m_MarkerOpacity[PF_HOVER],
m_LineWidth,
m_ControlPointShape,
planarFigureGeometry2D,
rendererGeometry2D,
displayGeometry
);
}
glLineWidth( 1.0f );
}
void mitk::PlanarFigureMapper2D::PaintPolyLine(
mitk::PlanarFigure::PolyLineType vertices,
bool closed,
float* color,
float opacity,
float lineWidth,
Point2D& firstPoint,
const Geometry2D* planarFigureGeometry2D,
const Geometry2D* rendererGeometry2D,
const DisplayGeometry* displayGeometry)
{
glColor4f( color[0], color[1], color[2], opacity );
glLineWidth(lineWidth);
if ( closed )
{
glBegin( GL_LINE_LOOP );
}
else
{
glBegin( GL_LINE_STRIP );
}
for ( PlanarFigure::PolyLineType::iterator iter = vertices.begin(); iter!=vertices.end(); iter++ )
{
// Draw this 2D point as OpenGL vertex
mitk::Point2D displayPoint;
this->TransformObjectToDisplay( iter->Point, displayPoint,
planarFigureGeometry2D, rendererGeometry2D, displayGeometry );
if(iter == vertices.begin())
firstPoint = displayPoint;
glVertex2f( displayPoint[0], displayPoint[1] );
}
glEnd();
}
void mitk::PlanarFigureMapper2D::DrawMainLines(
mitk::PlanarFigure* figure,
float* color,
float opacity,
bool drawShadow,
float lineWidth,
float shadowWidthFactor,
Point2D& firstPoint,
const Geometry2D* planarFigureGeometry2D,
const Geometry2D* rendererGeometry2D,
const DisplayGeometry* displayGeometry)
{
for ( unsigned short loop = 0; loop < figure->GetPolyLinesSize(); ++loop )
{
PlanarFigure::PolyLineType polyline = figure->GetPolyLine(loop);
if ( drawShadow )
{
float* shadow = new float[3];
shadow[0] = 0;
shadow[1] = 0;
shadow[2] = 0;
this->PaintPolyLine( polyline,
figure->IsClosed(),
shadow, 0.8, lineWidth*shadowWidthFactor, firstPoint,
planarFigureGeometry2D, rendererGeometry2D, displayGeometry );
delete shadow;
}
this->PaintPolyLine( polyline,
figure->IsClosed(),
color, opacity, lineWidth, firstPoint,
planarFigureGeometry2D, rendererGeometry2D, displayGeometry );
}
}
void mitk::PlanarFigureMapper2D::DrawHelperLines(
mitk::PlanarFigure* figure,
float* color,
float opacity,
bool drawShadow,
float lineWidth,
float shadowWidthFactor,
Point2D& firstPoint,
const Geometry2D* planarFigureGeometry2D,
const Geometry2D* rendererGeometry2D,
const DisplayGeometry* displayGeometry)
{
// Draw helper objects
for ( unsigned int loop = 0; loop < figure->GetHelperPolyLinesSize(); ++loop )
{
const mitk::PlanarFigure::PolyLineType helperPolyLine = figure->GetHelperPolyLine(loop,
displayGeometry->GetScaleFactorMMPerDisplayUnit(),
displayGeometry->GetDisplayHeight() );
// Check if the current helper objects is to be painted
if ( !figure->IsHelperToBePainted( loop ) )
{
continue;
}
// check if shadow shall be painted around the figure
if ( drawShadow )
{
float* shadow = new float[3];
shadow[0] = 0;
shadow[1] = 0;
shadow[2] = 0;
// paint shadow by painting the figure twice
// one in black with a slightly broader line-width ...
this->PaintPolyLine( helperPolyLine, false,
shadow, 0.8, lineWidth*shadowWidthFactor, firstPoint,
planarFigureGeometry2D, rendererGeometry2D, displayGeometry );
delete shadow;
}
// ... and once normally above the shadow.
this->PaintPolyLine( helperPolyLine, false,
color, opacity, lineWidth, firstPoint,
planarFigureGeometry2D, rendererGeometry2D, displayGeometry );
}
}
void mitk::PlanarFigureMapper2D::TransformObjectToDisplay(
const mitk::Point2D &point2D,
mitk::Point2D &displayPoint,
const mitk::Geometry2D *objectGeometry,
const mitk::Geometry2D *rendererGeometry,
const mitk::DisplayGeometry *displayGeometry )
{
mitk::Point3D point3D;
// Map circle point from local 2D geometry into 3D world space
objectGeometry->Map( point2D, point3D );
// Project 3D world point onto display geometry
rendererGeometry->Map( point3D, displayPoint );
displayGeometry->WorldToDisplay( displayPoint, displayPoint );
}
void mitk::PlanarFigureMapper2D::DrawMarker(
const mitk::Point2D &point,
float* lineColor,
float lineOpacity,
float* markerColor,
float markerOpacity,
float lineWidth,
PlanarFigureControlPointStyleProperty::Shape shape,
const mitk::Geometry2D *objectGeometry,
const mitk::Geometry2D *rendererGeometry,
const mitk::DisplayGeometry *displayGeometry )
{
mitk::Point2D displayPoint;
this->TransformObjectToDisplay(
point, displayPoint,
objectGeometry, rendererGeometry, displayGeometry );
glColor4f( markerColor[0], markerColor[1], markerColor[2], markerOpacity );
glLineWidth( lineWidth );
switch ( shape )
{
case PlanarFigureControlPointStyleProperty::Square:
default:
// Paint filled square
// Disable line antialiasing (does not look nice for squares)
glDisable( GL_LINE_SMOOTH );
glRectf(
displayPoint[0] - 4, displayPoint[1] - 4,
displayPoint[0] + 4, displayPoint[1] + 4 );
// Paint outline
glColor4f( lineColor[0], lineColor[1], lineColor[2], lineOpacity );
glBegin( GL_LINE_LOOP );
glVertex2f( displayPoint[0] - 4, displayPoint[1] - 4 );
glVertex2f( displayPoint[0] - 4, displayPoint[1] + 4 );
glVertex2f( displayPoint[0] + 4, displayPoint[1] + 4 );
glVertex2f( displayPoint[0] + 4, displayPoint[1] - 4 );
glEnd();
break;
case PlanarFigureControlPointStyleProperty::Circle:
// Paint filled circle
glBegin( GL_POLYGON );
float radius = 4.0;
for ( int angle = 0; angle < 8; ++angle )
{
float angleRad = angle * (float) 3.14159 / 4.0;
float x = displayPoint[0] + radius * (float)cos( angleRad );
float y = displayPoint[1] + radius * (float)sin( angleRad );
glVertex2f(x,y);
}
glEnd();
// Paint outline
glColor4f( lineColor[0], lineColor[1], lineColor[2], lineOpacity );
glBegin( GL_LINE_LOOP );
for ( int angle = 0; angle < 8; ++angle )
{
float angleRad = angle * (float) 3.14159 / 4.0;
float x = displayPoint[0] + radius * (float)cos( angleRad );
float y = displayPoint[1] + radius * (float)sin( angleRad );
glVertex2f(x,y);
}
glEnd();
break;
} // end switch
}
void mitk::PlanarFigureMapper2D::InitializeDefaultPlanarFigureProperties()
{
m_IsSelected = false;
m_IsHovering = false;
m_DrawOutline = false;
m_DrawQuantities = false;
m_DrawShadow = false;
m_ShadowWidthFactor = 1.2;
m_LineWidth = 1.0;
m_OutlineWidth = 4.0;
m_HelperlineWidth = 2.0;
m_ControlPointShape = PlanarFigureControlPointStyleProperty::Square;
this->SetColorProperty( m_LineColor, PF_DEFAULT, 1.0, 1.0, 1.0 );
this->SetFloatProperty( m_LineOpacity, PF_DEFAULT, 1.0 );
this->SetColorProperty( m_OutlineColor, PF_DEFAULT, 0.0, 0.0, 1.0 );
this->SetFloatProperty( m_OutlineOpacity, PF_DEFAULT, 1.0 );
this->SetColorProperty( m_HelperlineColor, PF_DEFAULT, 0.4, 0.8, 0.2 );
this->SetFloatProperty( m_HelperlineOpacity, PF_DEFAULT, 0.4 );
this->SetColorProperty( m_MarkerlineColor, PF_DEFAULT, 1.0, 1.0, 1.0 );
this->SetFloatProperty( m_MarkerlineOpacity, PF_DEFAULT, 1.0 );
this->SetColorProperty( m_MarkerColor, PF_DEFAULT, 1.0, 1.0, 1.0 );
this->SetFloatProperty( m_MarkerOpacity, PF_DEFAULT, 0.0 );
this->SetColorProperty( m_LineColor, PF_HOVER, 1.0, 0.7, 0.0 );
this->SetFloatProperty( m_LineOpacity, PF_HOVER, 1.0 );
this->SetColorProperty( m_OutlineColor, PF_HOVER, 0.0, 0.0, 1.0 );
this->SetFloatProperty( m_OutlineOpacity, PF_HOVER, 1.0 );
this->SetColorProperty( m_HelperlineColor, PF_HOVER, 0.4, 0.8, 0.2 );
this->SetFloatProperty( m_HelperlineOpacity, PF_HOVER, 0.4 );
this->SetColorProperty( m_MarkerlineColor, PF_HOVER, 1.0, 1.0, 1.0 );
this->SetFloatProperty( m_MarkerlineOpacity, PF_HOVER, 1.0 );
this->SetColorProperty( m_MarkerColor, PF_HOVER, 1.0, 0.6, 0.0 );
this->SetFloatProperty( m_MarkerOpacity, PF_HOVER, 0.2 );
this->SetColorProperty( m_LineColor, PF_SELECTED, 1.0, 0.0, 0.0 );
this->SetFloatProperty( m_LineOpacity, PF_SELECTED, 1.0 );
this->SetColorProperty( m_OutlineColor, PF_SELECTED, 0.0, 0.0, 1.0 );
this->SetFloatProperty( m_OutlineOpacity, PF_SELECTED, 1.0 );
this->SetColorProperty( m_HelperlineColor, PF_SELECTED, 0.4, 0.8, 0.2 );
this->SetFloatProperty( m_HelperlineOpacity, PF_SELECTED, 0.4 );
this->SetColorProperty( m_MarkerlineColor, PF_SELECTED, 1.0, 1.0, 1.0 );
this->SetFloatProperty( m_MarkerlineOpacity, PF_SELECTED, 1.0 );
this->SetColorProperty( m_MarkerColor, PF_SELECTED, 1.0, 0.6, 0.0 );
this->SetFloatProperty( m_MarkerOpacity, PF_SELECTED, 1.0 );
}
void mitk::PlanarFigureMapper2D::InitializePlanarFigurePropertiesFromDataNode( const mitk::DataNode* node )
{
if ( node == NULL )
{
return;
}
node->GetBoolProperty( "selected", m_IsSelected );
node->GetBoolProperty( "planarfigure.ishovering", m_IsHovering );
node->GetBoolProperty( "planarfigure.drawoutline", m_DrawOutline );
node->GetBoolProperty( "planarfigure.drawquantities", m_DrawQuantities );
node->GetBoolProperty( "planarfigure.drawshadow", m_DrawShadow );
node->GetFloatProperty( "planarfigure.line.width", m_LineWidth );
node->GetFloatProperty( "planarfigure.shadow.widthmodifier", m_ShadowWidthFactor );
node->GetFloatProperty( "planarfigure.outline.width", m_OutlineWidth );
node->GetFloatProperty( "planarfigure.helperline.width", m_HelperlineWidth );
PlanarFigureControlPointStyleProperty::Pointer styleProperty =
dynamic_cast< PlanarFigureControlPointStyleProperty* >( node->GetProperty( "planarfigure.controlpointshape" ) );
if ( styleProperty.IsNotNull() )
{
m_ControlPointShape = styleProperty->GetShape();
}
node->GetColor( m_LineColor[PF_DEFAULT], NULL, "planarfigure.default.line.color" );
node->GetFloatProperty( "planarfigure.default.line.opacity", m_LineOpacity[PF_DEFAULT] );
node->GetColor( m_OutlineColor[PF_DEFAULT], NULL, "planarfigure.default.outline.color" );
node->GetFloatProperty( "planarfigure.default.outline.opacity", m_OutlineOpacity[PF_DEFAULT] );
node->GetColor( m_HelperlineColor[PF_DEFAULT], NULL, "planarfigure.default.helperline.color" );
node->GetFloatProperty( "planarfigure.default.helperline.opacity", m_HelperlineOpacity[PF_DEFAULT] );
node->GetColor( m_MarkerlineColor[PF_DEFAULT], NULL, "planarfigure.default.markerline.color" );
node->GetFloatProperty( "planarfigure.default.markerline.opacity", m_MarkerlineOpacity[PF_DEFAULT] );
node->GetColor( m_MarkerColor[PF_DEFAULT], NULL, "planarfigure.default.marker.color" );
node->GetFloatProperty( "planarfigure.default.marker.opacity", m_MarkerOpacity[PF_DEFAULT] );
node->GetColor( m_LineColor[PF_HOVER], NULL, "planarfigure.hover.line.color" );
node->GetFloatProperty( "planarfigure.hover.line.opacity", m_LineOpacity[PF_HOVER] );
node->GetColor( m_OutlineColor[PF_HOVER], NULL, "planarfigure.hover.outline.color" );
node->GetFloatProperty( "planarfigure.hover.outline.opacity", m_OutlineOpacity[PF_HOVER] );
node->GetColor( m_HelperlineColor[PF_HOVER], NULL, "planarfigure.hover.helperline.color" );
node->GetFloatProperty( "planarfigure.hover.helperline.opacity", m_HelperlineOpacity[PF_HOVER] );
node->GetColor( m_MarkerlineColor[PF_HOVER], NULL, "planarfigure.hover.markerline.color" );
node->GetFloatProperty( "planarfigure.hover.markerline.opacity", m_MarkerlineOpacity[PF_HOVER] );
node->GetColor( m_MarkerColor[PF_HOVER], NULL, "planarfigure.hover.marker.color" );
node->GetFloatProperty( "planarfigure.hover.marker.opacity", m_MarkerOpacity[PF_HOVER] );
node->GetColor( m_LineColor[PF_SELECTED], NULL, "planarfigure.selected.line.color" );
node->GetFloatProperty( "planarfigure.selected.line.opacity", m_LineOpacity[PF_SELECTED] );
node->GetColor( m_OutlineColor[PF_SELECTED], NULL, "planarfigure.selected.outline.color" );
node->GetFloatProperty( "planarfigure.selected.outline.opacity", m_OutlineOpacity[PF_SELECTED] );
node->GetColor( m_HelperlineColor[PF_SELECTED], NULL, "planarfigure.selected.helperline.color" );
node->GetFloatProperty( "planarfigure.selected.helperline.opacity", m_HelperlineOpacity[PF_SELECTED] );
node->GetColor( m_MarkerlineColor[PF_SELECTED], NULL, "planarfigure.selected.markerline.color" );
node->GetFloatProperty( "planarfigure.selected.markerline.opacity", m_MarkerlineOpacity[PF_SELECTED] );
node->GetColor( m_MarkerColor[PF_SELECTED], NULL, "planarfigure.selected.marker.color" );
node->GetFloatProperty( "planarfigure.selected.marker.opacity", m_MarkerOpacity[PF_SELECTED] );
}
void mitk::PlanarFigureMapper2D::SetDefaultProperties( mitk::DataNode* node, mitk::BaseRenderer* renderer, bool overwrite )
{
node->AddProperty( "visible", mitk::BoolProperty::New(true), renderer, overwrite );
+
+ //node->SetProperty("planarfigure.iseditable",mitk::BoolProperty::New(true));
+ //node->SetProperty("planarfigure.isextendable",mitk::BoolProperty::New(true));
+ //node->AddProperty( "planarfigure.ishovering", mitk::BoolProperty::New(true) );
+ node->AddProperty( "planarfigure.drawoutline", mitk::BoolProperty::New(true) );
+ //node->AddProperty( "planarfigure.drawquantities", mitk::BoolProperty::New(true) );
+ node->AddProperty( "planarfigure.drawshadow", mitk::BoolProperty::New(true) );
+
+ node->AddProperty("planarfigure.line.width", mitk::FloatProperty::New(2.0) );
+ node->AddProperty("planarfigure.shadow.widthmodifier", mitk::FloatProperty::New(2.0) );
+ node->AddProperty("planarfigure.outline.width", mitk::FloatProperty::New(2.0) );
+ node->AddProperty("planarfigure.helperline.width", mitk::FloatProperty::New(2.0) );
+
+ node->AddProperty( "planarfigure.default.line.color", mitk::ColorProperty::New(1.0,1.0,1.0) );
+ node->AddProperty( "planarfigure.default.line.opacity", mitk::FloatProperty::New(1.0) );
+ node->AddProperty( "planarfigure.default.outline.color", mitk::ColorProperty::New(1.0,1.0,1.0) );
+ node->AddProperty( "planarfigure.default.outline.opacity", mitk::FloatProperty::New(1.0) );
+ node->AddProperty( "planarfigure.default.helperline.color", mitk::ColorProperty::New(1.0,1.0,1.0) );
+ node->AddProperty( "planarfigure.default.helperline.opacity", mitk::FloatProperty::New(1.0) );
+ node->AddProperty( "planarfigure.default.markerline.color", mitk::ColorProperty::New(1.0,1.0,1.0) );
+ node->AddProperty( "planarfigure.default.markerline.opacity", mitk::FloatProperty::New(1.0) );
+ node->AddProperty( "planarfigure.default.marker.color", mitk::ColorProperty::New(1.0,1.0,1.0) );
+ node->AddProperty( "planarfigure.default.marker.opacity",mitk::FloatProperty::New(1.0) );
+
+ node->AddProperty( "planarfigure.hover.line.color", mitk::ColorProperty::New(0.0,1.0,0.0) );
+ node->AddProperty( "planarfigure.hover.line.opacity", mitk::FloatProperty::New(1.0) );
+ node->AddProperty( "planarfigure.hover.outline.color", mitk::ColorProperty::New(0.0,1.0,0.0) );
+ node->AddProperty( "planarfigure.hover.outline.opacity", mitk::FloatProperty::New(1.0) );
+ node->AddProperty( "planarfigure.hover.helperline.color", mitk::ColorProperty::New(0.0,1.0,0.0) );
+ node->AddProperty( "planarfigure.hover.helperline.opacity", mitk::FloatProperty::New(1.0) );
+ node->AddProperty( "planarfigure.hover.markerline.color", mitk::ColorProperty::New(0.0,1.0,0.0) );
+ node->AddProperty( "planarfigure.hover.markerline.opacity", mitk::FloatProperty::New(1.0) );
+ node->AddProperty( "planarfigure.hover.marker.color", mitk::ColorProperty::New(0.0,1.0,0.0) );
+ node->AddProperty( "planarfigure.hover.marker.opacity", mitk::FloatProperty::New(1.0) );
+
+ node->AddProperty( "planarfigure.selected.line.color", mitk::ColorProperty::New(1.0,0.0,0.0) );
+ node->AddProperty( "planarfigure.selected.line.opacity",mitk::FloatProperty::New(1.0) );
+ node->AddProperty( "planarfigure.selected.outline.color", mitk::ColorProperty::New(1.0,0.0,0.0) );
+ node->AddProperty( "planarfigure.selected.outline.opacity", mitk::FloatProperty::New(1.0));
+ node->AddProperty( "planarfigure.selected.helperline.color", mitk::ColorProperty::New(1.0,0.0,0.0) );
+ node->AddProperty( "planarfigure.selected.helperline.opacity",mitk::FloatProperty::New(1.0) );
+ node->AddProperty( "planarfigure.selected.markerline.color", mitk::ColorProperty::New(1.0,0.0,0.0) );
+ node->AddProperty( "planarfigure.selected.markerline.opacity", mitk::FloatProperty::New(1.0) );
+ node->AddProperty( "planarfigure.selected.marker.color", mitk::ColorProperty::New(1.0,0.0,0.0) );
+ node->AddProperty( "planarfigure.selected.marker.opacity",mitk::FloatProperty::New(1.0));
}
diff --git a/Modules/PlanarFigure/Testing/mitkPlanarFigureIOTest.cpp b/Modules/PlanarFigure/Testing/mitkPlanarFigureIOTest.cpp
index f6c5630c91..8257e67148 100644
--- a/Modules/PlanarFigure/Testing/mitkPlanarFigureIOTest.cpp
+++ b/Modules/PlanarFigure/Testing/mitkPlanarFigureIOTest.cpp
@@ -1,566 +1,566 @@
/*=========================================================================
Copyright (c) German Cancer Research Center, Division of Medical and
Biological Informatics. All rights reserved.
See MITKCopyright.txt or http://www.mitk.org/copyright.html for details.
This software is distributed WITHOUT ANY WARRANTY; without even
the implied warranty of MERCHANTABILITY or FITNESS FOR A PARTICULAR
PURPOSE. See the above copyright notices for more information.
=========================================================================*/
#include "mitkTestingMacros.h"
#include "mitkPlanarAngle.h"
#include "mitkPlanarCircle.h"
#include "mitkPlanarCross.h"
#include "mitkPlanarFourPointAngle.h"
#include "mitkPlanarLine.h"
#include "mitkPlanarPolygon.h"
#include "mitkPlanarRectangle.h"
#include "mitkPlanarFigureWriter.h"
#include "mitkPlanarFigureReader.h"
#include "mitkPlaneGeometry.h"
#include <itksys/SystemTools.hxx>
/** \brief Helper class for testing PlanarFigure reader and writer classes. */
class PlanarFigureIOTestClass
{
public:
typedef std::list< mitk::PlanarFigure::Pointer > PlanarFigureList;
typedef std::vector< mitk::PlanarFigureWriter::Pointer > PlanarFigureToMemoryWriterList;
static PlanarFigureList CreatePlanarFigures()
{
PlanarFigureList planarFigures;
// Create PlaneGeometry on which to place the PlanarFigures
mitk::PlaneGeometry::Pointer planeGeometry = mitk::PlaneGeometry::New();
planeGeometry->InitializeStandardPlane( 100.0, 100.0 );
// Create a few sample points for PlanarFigure placement
mitk::Point2D p0; p0[0] = 20.0; p0[1] = 20.0;
mitk::Point2D p1; p1[0] = 80.0; p1[1] = 80.0;
mitk::Point2D p2; p2[0] = 90.0; p2[1] = 10.0;
mitk::Point2D p3; p3[0] = 10.0; p3[1] = 90.0;
// Create PlanarAngle
mitk::PlanarAngle::Pointer planarAngle = mitk::PlanarAngle::New();
planarAngle->SetGeometry2D( planeGeometry );
planarAngle->PlaceFigure( p0 );
planarAngle->SetCurrentControlPoint( p1 );
planarAngle->AddControlPoint( p2 );
planarFigures.push_back( planarAngle.GetPointer() );
// Create PlanarCircle
mitk::PlanarCircle::Pointer planarCircle = mitk::PlanarCircle::New();
planarCircle->SetGeometry2D( planeGeometry );
planarCircle->PlaceFigure( p0 );
planarCircle->SetCurrentControlPoint( p1 );
planarFigures.push_back( planarCircle.GetPointer() );
// Create PlanarCross
mitk::PlanarCross::Pointer planarCross = mitk::PlanarCross::New();
planarCross->SetSingleLineMode( false );
planarCross->SetGeometry2D( planeGeometry );
planarCross->PlaceFigure( p0 );
planarCross->SetCurrentControlPoint( p1 );
planarCross->AddControlPoint( p2 );
planarCross->AddControlPoint( p3 );
planarFigures.push_back( planarCross.GetPointer() );
// Create PlanarFourPointAngle
mitk::PlanarFourPointAngle::Pointer planarFourPointAngle = mitk::PlanarFourPointAngle::New();
planarFourPointAngle->SetGeometry2D( planeGeometry );
planarFourPointAngle->PlaceFigure( p0 );
planarFourPointAngle->SetCurrentControlPoint( p1 );
planarFourPointAngle->AddControlPoint( p2 );
planarFourPointAngle->AddControlPoint( p3 );
planarFigures.push_back( planarFourPointAngle.GetPointer() );
// Create PlanarLine
mitk::PlanarLine::Pointer planarLine = mitk::PlanarLine::New();
planarLine->SetGeometry2D( planeGeometry );
planarLine->PlaceFigure( p0 );
planarLine->SetCurrentControlPoint( p1 );
planarFigures.push_back( planarLine.GetPointer() );
// Create PlanarPolygon
mitk::PlanarPolygon::Pointer planarPolygon = mitk::PlanarPolygon::New();
planarPolygon->SetClosed( false );
planarPolygon->SetGeometry2D( planeGeometry );
planarPolygon->PlaceFigure( p0 );
planarPolygon->SetCurrentControlPoint( p1 );
planarPolygon->AddControlPoint( p2 );
planarPolygon->AddControlPoint( p3 );
planarFigures.push_back( planarPolygon.GetPointer() );
// Create PlanarRectangle
mitk::PlanarRectangle::Pointer planarRectangle = mitk::PlanarRectangle::New();
planarRectangle->SetGeometry2D( planeGeometry );
planarRectangle->PlaceFigure( p0 );
planarRectangle->SetCurrentControlPoint( p1 );
planarFigures.push_back( planarRectangle.GetPointer() );
//create preciseGeometry which is using float coordinates
mitk::PlaneGeometry::Pointer preciseGeometry = mitk::PlaneGeometry::New();
mitk::Vector3D right;
right[0] = 0.0;
right[1] = 1.23456;
right[2] = 0.0;
mitk::Vector3D down;
down[0] = 1.23456;
down[1] = 0.0;
down[2] = 0.0;
mitk::Vector3D spacing;
spacing[0] = 0.0123456;
spacing[1] = 0.0123456;
spacing[2] = 1.123456;
preciseGeometry->InitializeStandardPlane( right, down, &spacing );
//convert points into the precise coordinates
mitk::Point2D p0precise; p0precise[0] = p0[0] * spacing[0]; p0precise[1] = p0[1] * spacing[1];
mitk::Point2D p1precise; p1precise[0] = p1[0] * spacing[0]; p1precise[1] = p1[1] * spacing[1];
mitk::Point2D p2precise; p2precise[0] = p2[0] * spacing[0]; p2precise[1] = p2[1] * spacing[1];
mitk::Point2D p3precise; p3precise[0] = p3[0] * spacing[0]; p3precise[1] = p3[1] * spacing[1];
//Now all PlanarFigures are create using the precise Geometry
// Create PlanarCross
mitk::PlanarCross::Pointer nochncross = mitk::PlanarCross::New();
nochncross->SetSingleLineMode( false );
nochncross->SetGeometry2D( preciseGeometry );
nochncross->PlaceFigure( p0precise );
nochncross->SetCurrentControlPoint( p1precise );
nochncross->AddControlPoint( p2precise );
nochncross->AddControlPoint( p3precise );
planarFigures.push_back( nochncross.GetPointer() );
// Create PlanarAngle
mitk::PlanarAngle::Pointer planarAnglePrecise = mitk::PlanarAngle::New();
planarAnglePrecise->SetGeometry2D( preciseGeometry );
planarAnglePrecise->PlaceFigure( p0precise );
planarAnglePrecise->SetCurrentControlPoint( p1precise );
planarAnglePrecise->AddControlPoint( p2precise );
planarFigures.push_back( planarAnglePrecise.GetPointer() );
// Create PlanarCircle
mitk::PlanarCircle::Pointer planarCirclePrecise = mitk::PlanarCircle::New();
planarCirclePrecise->SetGeometry2D( preciseGeometry );
planarCirclePrecise->PlaceFigure( p0precise );
planarCirclePrecise->SetCurrentControlPoint( p1precise );
planarFigures.push_back( planarCirclePrecise.GetPointer() );
// Create PlanarFourPointAngle
mitk::PlanarFourPointAngle::Pointer planarFourPointAnglePrecise = mitk::PlanarFourPointAngle::New();
planarFourPointAnglePrecise->SetGeometry2D( preciseGeometry );
planarFourPointAnglePrecise->PlaceFigure( p0precise );
planarFourPointAnglePrecise->SetCurrentControlPoint( p1precise );
planarFourPointAnglePrecise->AddControlPoint( p2precise );
planarFourPointAnglePrecise->AddControlPoint( p3precise );
planarFigures.push_back( planarFourPointAnglePrecise.GetPointer() );
// Create PlanarLine
mitk::PlanarLine::Pointer planarLinePrecise = mitk::PlanarLine::New();
planarLinePrecise->SetGeometry2D( preciseGeometry );
planarLinePrecise->PlaceFigure( p0precise );
planarLinePrecise->SetCurrentControlPoint( p1precise );
planarFigures.push_back( planarLinePrecise.GetPointer() );
// Create PlanarPolygon
mitk::PlanarPolygon::Pointer planarPolygonPrecise = mitk::PlanarPolygon::New();
planarPolygonPrecise->SetClosed( false );
planarPolygonPrecise->SetGeometry2D( preciseGeometry );
planarPolygonPrecise->PlaceFigure( p0precise );
planarPolygonPrecise->SetCurrentControlPoint( p1precise );
planarPolygonPrecise->AddControlPoint( p2precise );
planarPolygonPrecise->AddControlPoint( p3precise );
planarFigures.push_back( planarPolygonPrecise.GetPointer() );
// Create PlanarRectangle
mitk::PlanarRectangle::Pointer planarRectanglePrecise = mitk::PlanarRectangle::New();
planarRectanglePrecise->SetGeometry2D( preciseGeometry );
planarRectanglePrecise->PlaceFigure( p0precise );
planarRectanglePrecise->SetCurrentControlPoint( p1precise );
planarFigures.push_back( planarRectanglePrecise.GetPointer() );
return planarFigures;
}
static PlanarFigureList CreateDeepCopiedPlanarFigures(PlanarFigureList original)
{
PlanarFigureList copiedPlanarFigures;
PlanarFigureList::iterator it1;
for ( it1 = original.begin(); it1 != original.end(); ++it1 )
{
mitk::PlanarFigure::Pointer copiedFigure;
if(strcmp((*it1)->GetNameOfClass(), "PlanarAngle") == 0)
{
copiedFigure = mitk::PlanarAngle::New();
}
if(strcmp((*it1)->GetNameOfClass(), "PlanarCircle") == 0)
{
copiedFigure = mitk::PlanarCircle::New();
}
if(strcmp((*it1)->GetNameOfClass(), "PlanarLine") == 0)
{
copiedFigure = mitk::PlanarLine::New();
}
if(strcmp((*it1)->GetNameOfClass(), "PlanarPolygon") == 0)
{
copiedFigure = mitk::PlanarPolygon::New();
}
if(strcmp((*it1)->GetNameOfClass(), "PlanarCross") == 0)
{
copiedFigure = mitk::PlanarCross::New();
}
if(strcmp((*it1)->GetNameOfClass(), "PlanarRectangle") == 0)
{
copiedFigure = mitk::PlanarRectangle::New();
}
if(strcmp((*it1)->GetNameOfClass(), "PlanarFourPointAngle") == 0)
{
copiedFigure = mitk::PlanarFourPointAngle::New();
}
copiedFigure->DeepCopy((*it1));
copiedPlanarFigures.push_back(copiedFigure.GetPointer());
}
return copiedPlanarFigures;
}
static void VerifyPlanarFigures( PlanarFigureList &planarFigures1, PlanarFigureList &planarFigures2 )
{
PlanarFigureList::iterator it1, it2;
for ( it1 = planarFigures1.begin(); it1 != planarFigures1.end(); ++it1 )
{
bool planarFigureFound = false;
for ( it2 = planarFigures2.begin(); it2 != planarFigures2.end(); ++it2 )
{
// Compare PlanarFigures (returns false if different types)
if ( ComparePlanarFigures( *it1, *it2 ) )
{
planarFigureFound = true;
}
}
// Test if (at least) on PlanarFigure of the first type was found in the second list
MITK_TEST_CONDITION_REQUIRED(
planarFigureFound,
"Testing if " << (*it1)->GetNameOfClass() << " has a counterpart" );
}
}
static bool ComparePlanarFigures( mitk::PlanarFigure* figure1, mitk::PlanarFigure* figure2 )
{
// Test if PlanarFigures are of same type; otherwise return
if ( strcmp( figure1->GetNameOfClass(), figure2->GetNameOfClass() ) != 0 )
{
return false;
}
const char* figureName = figure1->GetNameOfClass();
// Test for equal number of control points
if(figure1->GetNumberOfControlPoints() != figure2->GetNumberOfControlPoints())
{
return false;
}
// Test if all control points are equal
for ( unsigned int i = 0; i < figure1->GetNumberOfControlPoints(); ++i )
{
mitk::Point2D point1 = figure1->GetControlPoint( i );
mitk::Point2D point2 = figure2->GetControlPoint( i );
if(point1.EuclideanDistanceTo( point2 ) >= mitk::eps)
{
return false;
}
}
// Test for equal number of properties
typedef mitk::PropertyList::PropertyMap PropertyMap;
const PropertyMap* properties1 = figure1->GetPropertyList()->GetMap();
const PropertyMap* properties2 = figure2->GetPropertyList()->GetMap();
if(properties1->size() != properties2->size())
{
return false;
}
MITK_INFO << "List 1:";
for (PropertyMap::const_iterator i1 = properties1->begin(); i1 != properties1->end(); ++i1)
{
std::cout << i1->first << std::endl;
}
MITK_INFO << "List 2:";
for (PropertyMap::const_iterator i2 = properties2->begin(); i2 != properties2->end(); ++i2)
{
std::cout << i2->first << std::endl;
}
MITK_INFO << "-------";
// Test if all properties are equal
if(!std::equal( properties1->begin(), properties1->end(), properties2->begin(), PropertyMapEntryCompare() ))
{
return false;
}
// Test if Geometry is equal
const mitk::PlaneGeometry* planeGeometry1 = dynamic_cast<const mitk::PlaneGeometry*>(figure1->GetGeometry2D());
const mitk::PlaneGeometry* planeGeometry2 = dynamic_cast<const mitk::PlaneGeometry*>(figure2->GetGeometry2D());
// Test Geometry transform parameters
typedef mitk::AffineGeometryFrame3D::TransformType TransformType;
const TransformType* affineGeometry1 = planeGeometry1->GetIndexToWorldTransform();
const TransformType::ParametersType& parameters1 = affineGeometry1->GetParameters();
const TransformType::ParametersType& parameters2 = planeGeometry2->GetIndexToWorldTransform()->GetParameters();
for ( unsigned int i = 0; i < affineGeometry1->GetNumberOfParameters(); ++i )
{
if ( fabs(parameters1.GetElement( i ) - parameters2.GetElement( i )) >= mitk::eps )
{
return false;
}
}
// Test Geometry bounds
typedef mitk::Geometry3D::BoundsArrayType BoundsArrayType;
const BoundsArrayType& bounds1 = planeGeometry1->GetBounds();
const BoundsArrayType& bounds2 = planeGeometry2->GetBounds();
for ( unsigned int i = 0; i < 6; ++i )
{
if ( fabs(bounds1.GetElement( i ) - bounds2.GetElement( i )) >= mitk::eps )
{
return false;
};
}
// Test Geometry spacing and origin
mitk::Vector3D spacing1 = planeGeometry1->GetSpacing();
mitk::Vector3D spacing2 = planeGeometry2->GetSpacing();
if((spacing1 - spacing2).GetNorm() >= mitk::eps)
{
return false;
}
mitk::Point3D origin1 = planeGeometry1->GetOrigin();
mitk::Point3D origin2 = planeGeometry2->GetOrigin();
if(origin1.EuclideanDistanceTo( origin2 ) >= mitk::eps)
{
return false;
}
return true;
}
static void SerializePlanarFigures( PlanarFigureList &planarFigures, std::string& fileName )
{
//std::string sceneFileName = Poco::Path::temp() + /*Poco::Path::separator() +*/ "scene.zip";
std::cout << "File name: " << fileName << std::endl;
mitk::PlanarFigureWriter::Pointer writer = mitk::PlanarFigureWriter::New();
writer->SetFileName( fileName.c_str() );
unsigned int i;
PlanarFigureList::iterator it;
for ( it = planarFigures.begin(), i = 0;
it != planarFigures.end();
++it, ++i )
{
writer->SetInput( i, *it );
}
writer->Update();
MITK_TEST_CONDITION_REQUIRED(
writer->GetSuccess(),
"Testing if writing was successful");
}
static PlanarFigureList DeserializePlanarFigures( std::string& fileName)
{
// Read in the planar figures
mitk::PlanarFigureReader::Pointer reader = mitk::PlanarFigureReader::New();
reader->SetFileName( fileName.c_str() );
reader->Update();
MITK_TEST_CONDITION_REQUIRED(
reader->GetSuccess(),
"Testing if reading was successful");
// Store them in the list and return it
PlanarFigureList planarFigures;
for ( unsigned int i = 0; i < reader->GetNumberOfOutputs(); ++i )
{
mitk::PlanarFigure* figure = reader->GetOutput( i );
planarFigures.push_back( figure );
}
return planarFigures;
}
static PlanarFigureToMemoryWriterList SerializePlanarFiguresToMemoryBuffers( PlanarFigureList &planarFigures )
{
PlanarFigureToMemoryWriterList pfMemoryWriters;
unsigned int i;
PlanarFigureList::iterator it;
bool success = true;
for ( it = planarFigures.begin(), i = 0;
it != planarFigures.end();
++it, ++i )
{
mitk::PlanarFigureWriter::Pointer writer = mitk::PlanarFigureWriter::New();
writer->SetWriteToMemory( true );
writer->SetInput( *it );
writer->Update();
pfMemoryWriters.push_back(writer);
if(!writer->GetSuccess())
success = false;
}
MITK_TEST_CONDITION_REQUIRED(success, "Testing if writing to memory buffers was successful");
return pfMemoryWriters;
}
static PlanarFigureList DeserializePlanarFiguresFromMemoryBuffers( PlanarFigureToMemoryWriterList pfMemoryWriters)
{
// Store them in the list and return it
PlanarFigureList planarFigures;
bool success = true;
for ( unsigned int i = 0; i < pfMemoryWriters.size(); ++i )
{
// Read in the planar figures
mitk::PlanarFigureReader::Pointer reader = mitk::PlanarFigureReader::New();
reader->SetReadFromMemory( true );
reader->SetMemoryBuffer(pfMemoryWriters[i]->GetMemoryPointer(), pfMemoryWriters[i]->GetMemorySize());
reader->Update();
mitk::PlanarFigure* figure = reader->GetOutput( 0 );
planarFigures.push_back( figure );
if(!reader->GetSuccess())
success = false;
}
MITK_TEST_CONDITION_REQUIRED(success, "Testing if reading was successful");
return planarFigures;
}
private:
class PropertyMapEntryCompare
{
public:
bool operator()(
const mitk::PropertyList::PropertyMap::value_type &entry1,
const mitk::PropertyList::PropertyMap::value_type &entry2 )
{
- MITK_INFO << "Comparing " << entry1.first << "(" << entry1.second.first->GetValueAsString() << ") and " << entry2.first << "(" << entry2.second.first->GetValueAsString() << ")";
+ MITK_INFO << "Comparing " << entry1.first << "(" << entry1.second->GetValueAsString() << ") and " << entry2.first << "(" << entry2.second->GetValueAsString() << ")";
// Compare property objects contained in the map entries (see mitk::PropertyList)
- return *(entry1.second.first) == *(entry2.second.first);
+ return *(entry1.second) == *(entry2.second);
}
};
}; // end test helper class
/** \brief Test for PlanarFigure reader and writer classes.
*
* The test works as follows:
*
* First, a number of PlanarFigure objects of different types are created and placed with
* various control points. These objects are the serialized to file, read again from file, and
* the retrieved objects are compared with their control points, properties, and geometry
* information to the original PlanarFigure objects.
*/
int mitkPlanarFigureIOTest(int /* argc */, char* /*argv*/[])
{
MITK_TEST_BEGIN("PlanarFigureIO");
// Create a number of PlanarFigure objects
PlanarFigureIOTestClass::PlanarFigureList originalPlanarFigures =
PlanarFigureIOTestClass::CreatePlanarFigures();
// Create a number of "deep-copied" planar figures to test the DeepCopy function
PlanarFigureIOTestClass::PlanarFigureList copiedPlanarFigures =
PlanarFigureIOTestClass::CreateDeepCopiedPlanarFigures(originalPlanarFigures);
PlanarFigureIOTestClass::VerifyPlanarFigures(originalPlanarFigures, copiedPlanarFigures );
// Write PlanarFigure objects into temp file
// tmpname
static unsigned long count = 0;
unsigned long n = count++;
std::ostringstream name;
for (int i = 0; i < 6; ++i)
{
name << char('a' + (n % 26));
n /= 26;
}
std::string myname;
myname.append(name.str());
std::string fileName = itksys::SystemTools::GetCurrentWorkingDirectory() + myname + ".pf";
PlanarFigureIOTestClass::SerializePlanarFigures( originalPlanarFigures, fileName );
// Write PlanarFigure objects to memory buffers
PlanarFigureIOTestClass::PlanarFigureToMemoryWriterList writersWithMemoryBuffers =
PlanarFigureIOTestClass::SerializePlanarFiguresToMemoryBuffers( originalPlanarFigures );
// Read PlanarFigure objects from temp file
PlanarFigureIOTestClass::PlanarFigureList retrievedPlanarFigures =
PlanarFigureIOTestClass::DeserializePlanarFigures( fileName );
// Read PlanarFigure objects from memory buffers
PlanarFigureIOTestClass::PlanarFigureList retrievedPlanarFiguresFromMemory =
PlanarFigureIOTestClass::DeserializePlanarFiguresFromMemoryBuffers( writersWithMemoryBuffers );
PlanarFigureIOTestClass::PlanarFigureToMemoryWriterList::iterator it = writersWithMemoryBuffers.begin();
while(it != writersWithMemoryBuffers.end())
{
(*it)->ReleaseMemory();
++it;
}
// Test if original and retrieved PlanarFigure objects are the same
PlanarFigureIOTestClass::VerifyPlanarFigures( originalPlanarFigures, retrievedPlanarFigures );
// Test if original and memory retrieved PlanarFigure objects are the same
PlanarFigureIOTestClass::VerifyPlanarFigures( originalPlanarFigures, retrievedPlanarFiguresFromMemory );
//empty the originalPlanarFigures
originalPlanarFigures.empty();
// Test if deep-copied and retrieved PlanarFigure objects are the same
PlanarFigureIOTestClass::VerifyPlanarFigures( copiedPlanarFigures, retrievedPlanarFigures );
MITK_TEST_END()
}
diff --git a/Modules/QmitkExt/CMakeLists.txt b/Modules/QmitkExt/CMakeLists.txt
index 7e34aab28c..35a84a9cf8 100644
--- a/Modules/QmitkExt/CMakeLists.txt
+++ b/Modules/QmitkExt/CMakeLists.txt
@@ -1,6 +1,6 @@
MITK_CREATE_MODULE( QmitkExt
- INCLUDE_DIRS QmitkApplicationBase QmitkPropertyObservers QmitkFunctionalityComponents vtkQtChartHeaders
+ INCLUDE_DIRS QmitkApplicationBase QmitkPropertyObservers QmitkFunctionalityComponents
DEPENDS MitkExt Qmitk qwt qxt PlanarFigure SceneSerialization
QT_MODULE
)
diff --git a/Modules/QmitkExt/QmitkApplicationBase/QmitkCommonFunctionality.cpp b/Modules/QmitkExt/QmitkApplicationBase/QmitkCommonFunctionality.cpp
index 2d184f3a07..438defcfbb 100644
--- a/Modules/QmitkExt/QmitkApplicationBase/QmitkCommonFunctionality.cpp
+++ b/Modules/QmitkExt/QmitkApplicationBase/QmitkCommonFunctionality.cpp
@@ -1,654 +1,654 @@
/*=========================================================================
Program: Medical Imaging & Interaction Toolkit
Language: C++
Date: $Date: 2008-09-18 09:35:44 +0200 (Do, 18 Sep 2008) $
Version: $Revision: 15278 $
Copyright (c) German Cancer Research Center, Division of Medical and
Biological Informatics. All rights reserved.
See MITKCopyright.txt or http://www.mitk.org/copyright.html for details.
This software is distributed WITHOUT ANY WARRANTY; without even
the implied warranty of MERCHANTABILITY or FITNESS FOR A PARTICULAR
PURPOSE. See the above copyright notices for more information.
=========================================================================*/
#include <qregexp.h>
#include <qmessagebox.h>
#include <qfileinfo.h>
#include <qstring.h>
#include <QDateTime>
#include <string>
#include <strstream>
#include "mitkPointSetWriter.h"
#include "mitkConfig.h"
#include "mitkCoreObjectFactory.h"
#include "QmitkCommonFunctionality.h"
#include <mitkImageAccessByItk.h>
#include <mitkPicFileReader.h>
#include <mitkIpPic.h>
#include <vtkWindowToImageFilter.h>
#include <vtkRenderWindow.h>
#include <vtkPNGWriter.h>
#include <vtkCellArray.h>
#include <vtkTriangleFilter.h>
void CommonFunctionality::SaveToFileWriter( mitk::FileWriterWithInformation::Pointer fileWriter, mitk::BaseData::Pointer data, const char* aFileName, const char* propFileName)
{
- if (! fileWriter->CanWriteDataType(data) ) {
+ if (! fileWriter->CanWriteBaseDataType(data) ) {
QMessageBox::critical(NULL,"ERROR","Could not write file. Invalid data type for file writer.");
return;
}
QString fileName;
if (aFileName == NULL)
{
QString proposedName("");
if(propFileName == NULL)
{
proposedName.append(fileWriter->GetDefaultFilename());
}
else
{
proposedName.append(propFileName).append(fileWriter->GetDefaultExtension());
}
fileName = QFileDialog::getSaveFileName(NULL, "Save file", proposedName,fileWriter->GetFileDialogPattern());
// Check if an extension exists already and if not, append the default extension
if ( !fileName.contains( QRegExp("\\.\\w+$") ) )
{
fileName.append( fileWriter->GetDefaultExtension() );
}
else
{
std::string extension = itksys::SystemTools::GetFilenameLastExtension( fileName.toLocal8Bit().constData() );
if (!fileWriter->IsExtensionValid(extension))
{
QString message;
message.append("File extension not suitable for writing given data. Choose one extension of this list: ");
message.append(fileWriter->GetPossibleFileExtensionsAsString().c_str());
QMessageBox::critical(NULL,"ERROR",message);
return;
}
}
}
else
fileName = aFileName;
if (fileName.isEmpty() == false )
{
fileWriter->SetFileName( fileName.toLocal8Bit().constData() );
fileWriter->DoWrite( data );
}
}
/**
* Saves the given mitk::BaseData to a file. The user is prompted to
* enter a file name. Currently only mitk::Image, mitk::Surface, mitk::PointSet and
* mitk::VesselGraphData are supported. This function is deprecated
* until the save-problem is solved by means of a Save-Factory or any
* other "nice" mechanism
*/
void CommonFunctionality::SaveBaseData( mitk::BaseData* data, const char * aFileName )
{
//save initial time
QDateTime initialTime = QDateTime::currentDateTime();
std::string fileNameUsed; //file name that was actually used by the writer (e.g. after file open dialog)
bool writingSuccessful = false;
try{
if (data != NULL)
{
mitk::Image::Pointer image = dynamic_cast<mitk::Image*>(data);
QString classname(data->GetNameOfClass());
if ( image.IsNotNull() && (classname.compare("Image")==0 || classname.compare("SeedsImage")==0 ) )
{
fileNameUsed = CommonFunctionality::SaveImage(image, aFileName, true);
if(!(fileNameUsed.length()>0)){
return;
} else {
writingSuccessful = true;
}
}
if(!writingSuccessful)
{
mitk::PointSet::Pointer pointset = dynamic_cast<mitk::PointSet*>(data);
if(pointset.IsNotNull())
{
std::string fileName;
if(aFileName == NULL)
fileName = "PointSet";
else
fileName = aFileName;
fileName = itksys::SystemTools::GetFilenameWithoutExtension(fileName);
// fileName += ".mps";
QString selected_suffix("MITK Point-Sets (*.mps)");
QString possible_suffixes("MITK Point-Sets (*.mps)");
QString initialFileName = QString::fromStdString(fileName);
/*QString qfileName = QFileDialog::getSaveFileName( NULL, "Save image", initialFilename ,mitk::CoreObjectFactory::GetInstance()->GetSaveFileExtensions(),&selected_suffix);
*/
QString qfileName = QFileDialog::getSaveFileName(NULL, "Save file", initialFileName, possible_suffixes, &selected_suffix);
MITK_INFO<<qfileName.toLocal8Bit().constData();
mitk::PointSetWriter::Pointer writer = mitk::PointSetWriter::New();
std::string extension = itksys::SystemTools::GetFilenameLastExtension( qfileName.toLocal8Bit().constData() );
if (extension == "") // if no extension has been entered manually into the filename
{
// get from combobox selected file extension
extension = itksys::SystemTools::GetFilenameLastExtension( selected_suffix.toLocal8Bit().constData());
extension = extension.substr(0, extension.size()-1);
qfileName += QString::fromStdString(extension);
}
MITK_INFO<<"extension: " << extension;
// check if extension is valid
if (!writer->IsExtensionValid(extension))
{
QString message;
message.append("File extension not suitable for writing point set data. Choose one extension of this list: ");
message.append(writer->GetPossibleFileExtensionsAsString().c_str());
QMessageBox::critical(NULL,"ERROR",message);
return;
}
if (qfileName.isEmpty() == false )
{
writer->SetInput( pointset );
writer->SetFileName( qfileName.toLocal8Bit().constData() );
writer->Update();
fileNameUsed = writer->GetFileName();
writingSuccessful = true;
} else {
return;
}
}
if(!writingSuccessful)
{
mitk::Surface::Pointer surface = dynamic_cast<mitk::Surface*>(data);
if(surface.IsNotNull())
{
fileNameUsed = CommonFunctionality::SaveSurface(surface, aFileName);
if(!(fileNameUsed.length()>0)){
return;
} else {
writingSuccessful = true;
}
}
if(!writingSuccessful)
{
// now try the file writers provided by the CoreObjectFactory
mitk::CoreObjectFactory::FileWriterList fileWriters = mitk::CoreObjectFactory::GetInstance()->GetFileWriters();
bool writerFound = false;
for (mitk::CoreObjectFactory::FileWriterList::iterator it = fileWriters.begin() ; it != fileWriters.end() ; ++it)
{
- if ( (*it)->CanWriteDataType(data) ) {
+ if ( (*it)->CanWriteBaseDataType(data) ) {
writerFound = true;
SaveToFileWriter(*it, data, NULL, aFileName);
fileNameUsed = (*it)->GetFileName();
// correct writer has been found->break
if(!(fileNameUsed.length()>0)){
return;
} else {
writingSuccessful = true;
break;
}
}
}
if(!writerFound)
{
// no appropriate writer has been found
QMessageBox::critical(NULL,"ERROR","Could not find file writer for this data type");
return;
}
}
}
}
} else {
QMessageBox::critical(NULL,"ERROR","Cannot write data (invalid/empty)");
return;
}
} catch(itk::ExceptionObject e)
{
QMessageBox::critical( NULL, "SaveDialog", e.GetDescription(),QMessageBox::Ok, QMessageBox::NoButton, QMessageBox::NoButton);
}
//writing is assumed to have been successful
//check if file exists, file size >0 and last modified after this function was called
try{
QFileInfo* fileInfo = new QFileInfo(QString(fileNameUsed.c_str()));
if(!fileInfo->exists())
{
QMessageBox::warning(NULL,"WARNING","File was not created or was split into multiple files");
} else if(fileInfo->size()==0) {
QMessageBox::warning(NULL,"WARNING","File is empty");
} else if(fileInfo->lastModified()<initialTime) {
QMessageBox::warning(NULL,"WARNING","Save not successful. File was not updated (only old version available)");
}
delete fileInfo;
} catch(...) {
QMessageBox::critical(NULL,"ERROR","Save not successful. Possibly no writing permission.");
}
}
mitk::DataNode::Pointer CommonFunctionality::FileOpen( const QString& fileName)
{
return FileOpen( fileName.toLocal8Bit().constData() );
}
mitk::DataNode::Pointer CommonFunctionality::FileOpen( const char * fileName )
{
mitk::DataNodeFactory::Pointer factory = mitk::DataNodeFactory::New();
try
{
factory->SetFileName( fileName );
factory->Update();
return factory->GetOutput( 0 );
}
catch ( itk::ExceptionObject & ex )
{
itkGenericOutputMacro( << "Exception during file open: " << ex );
return NULL;
}
}
mitk::DataNode::Pointer CommonFunctionality::FileOpenImageSequence(const QString& aFileName)
{
return FileOpenImageSequence( aFileName.toLocal8Bit().constData() );
}
mitk::DataNode::Pointer CommonFunctionality::FileOpenImageSequence(const char* aFileName)
{
if(aFileName==NULL) return NULL;
mitk::DataNodeFactory::Pointer factory = mitk::DataNodeFactory::New();
QString fileName = aFileName;
if (!fileName.contains("dcm") && !fileName.contains("DCM"))
{
int fnstart = fileName.lastIndexOf( QRegExp("[/\\\\]"), fileName.length() );
if(fnstart<0) fnstart=0;
int start = fileName.indexOf( QRegExp("[0-9]"), fnstart );
if(start<0)
{
return FileOpen(fileName.toLocal8Bit().constData());;
}
char prefix[1024], pattern[1024];
strncpy(prefix, fileName.toLocal8Bit().constData(), start);
prefix[start]=0;
int stop=fileName.indexOf( QRegExp("[^0-9]"), start );
sprintf(pattern, "%%s%%0%uu%s",stop-start,fileName.toLocal8Bit().constData()+stop);
factory->SetFilePattern( pattern );
factory->SetFilePrefix( prefix );
}
else
{
// factory->SetFileName( fileName );
factory->SetFilePattern( fileName.toLocal8Bit().constData() );
factory->SetFilePrefix( fileName.toLocal8Bit().constData() );
}
factory->Update();
return factory->GetOutput( 0 );
}
mitk::DataNode::Pointer CommonFunctionality::FileOpenImageSequence()
{
QString fileName = QFileDialog::getOpenFileName(NULL,mitk::CoreObjectFactory::GetInstance()->GetFileExtensions());
if ( !fileName.isNull() )
{
return FileOpenImageSequence(fileName);
}
else
{
return NULL;
}
}
mitk::DataNode::Pointer CommonFunctionality::FileOpen()
{
return CommonFunctionality::FileOpenSpecific( mitk::CoreObjectFactory::GetInstance()->GetFileExtensions() );
}
mitk::DataNode::Pointer CommonFunctionality::FileOpenSpecific( const QString& fileExtensions)
{
return FileOpenSpecific( fileExtensions.toLocal8Bit().constData() );
}
mitk::DataNode::Pointer CommonFunctionality::FileOpenSpecific( const char *fileExtensions )
{
QString fileName = QFileDialog::getOpenFileName( NULL, fileExtensions );
if ( !fileName.isNull() )
{
mitk::DataNode::Pointer result = FileOpen(fileName.toLocal8Bit().constData());
if ( result.IsNull() )
{
return FileOpenImageSequence(fileName);
}
else
{
return result;
}
}
else
{
return NULL;
}
}
mitk::DataNode::Pointer CommonFunctionality::OpenVolumeOrSliceStack()
{
mitk::DataNode::Pointer newNode = NULL;
QString fileName = QFileDialog::getOpenFileName(NULL,mitk::CoreObjectFactory::GetInstance()->GetFileExtensions() );
if ( !fileName.isNull() )
{
newNode = CommonFunctionality::FileOpen(fileName);
if (newNode.IsNotNull())
{
mitk::Image::Pointer imageData = dynamic_cast<mitk::Image*> (newNode->GetData()) ;
if (imageData.IsNull()) return NULL;
if (imageData->GetDimension(2) == 1)
{
// std::string dir = itksys::SystemTools::GetFilenamePath( std::string(fileName.ascii()) )
newNode = CommonFunctionality::FileOpenImageSequence(fileName);
imageData = dynamic_cast<mitk::Image*> (newNode->GetData());
}
return newNode;
}
}
{
return NULL;
}
}
#include "mitkSurfaceVtkWriter.h"
#include <vtkSTLWriter.h>
#include <vtkPolyDataWriter.h>
#include <vtkXMLPolyDataWriter.h>
std::string CommonFunctionality::SaveSurface(mitk::Surface* surface, const char* aFileName)
{
std::string fileName;
if(aFileName == NULL)
fileName = "Surface";
else
fileName = aFileName;
std::string selectedItemsName = itksys::SystemTools::GetFilenameWithoutExtension(fileName);
//selectedItemsName += ".stl"
QString selected_suffix("STL File (*.stl)");
QString possible_suffixes("STL File (*.stl);; VTK File (*.vtk);; VTP File (*.vtp)");
QString qfileName = QFileDialog::getSaveFileName(NULL, "Save surface object", QString::fromStdString(selectedItemsName), possible_suffixes,
&selected_suffix);
if (qfileName.isEmpty())
return "";
std::string extension = itksys::SystemTools::GetFilenameLastExtension( qfileName.toStdString() );
if (extension == "") // if no extension has been entered manually into the filename
{
// get from combobox selected file extension
extension = itksys::SystemTools::GetFilenameLastExtension( selected_suffix.toLocal8Bit().constData());
extension = extension.substr(0, extension.size()-1);
qfileName += QString::fromStdString(extension);
}
if(extension == ".stl" )
{
mitk::SurfaceVtkWriter<vtkSTLWriter>::Pointer writer=mitk::SurfaceVtkWriter<vtkSTLWriter>::New();
// check if surface actually consists of triangles; if not, the writer will not do anything; so, convert to triangles...
vtkPolyData* polys = surface->GetVtkPolyData();
if( polys->GetNumberOfStrips() > 0 )
{
vtkTriangleFilter* triangleFilter = vtkTriangleFilter::New();
triangleFilter->SetInput(polys);
triangleFilter->Update();
polys = triangleFilter->GetOutput();
polys->Register(NULL);
triangleFilter->Delete();
surface->SetVtkPolyData(polys);
}
writer->SetInput( surface );
writer->SetFileName(qfileName.toLocal8Bit().constData());
writer->GetVtkWriter()->SetFileTypeToBinary();
writer->Write();
}
else if(extension == ".vtp")
{
mitk::SurfaceVtkWriter<vtkXMLPolyDataWriter>::Pointer writer=mitk::SurfaceVtkWriter<vtkXMLPolyDataWriter>::New();
writer->SetInput( surface );
writer->SetFileName(qfileName.toLocal8Bit().constData());
writer->GetVtkWriter()->SetDataModeToBinary();
writer->Write();
}
else if (extension == ".vtk")
{
mitk::SurfaceVtkWriter<vtkPolyDataWriter>::Pointer writer=mitk::SurfaceVtkWriter<vtkPolyDataWriter>::New();
writer->SetInput( surface );
writer->SetFileName(qfileName.toLocal8Bit().constData());
writer->Write();
}
else
{
// file extension not suitable for writing specified data type
QMessageBox::critical(NULL,"ERROR","File extension not suitable for writing Surface data. Choose .vtk, .stl or .vtp");
return "";
}
return qfileName.toLocal8Bit().constData();
}
#include "mitkImageWriter.h"
#include <itksys/SystemTools.hxx>
std::string CommonFunctionality::SaveImage(mitk::Image* image, const char* aFileName, bool askForDifferentFilename)
{
static QString lastDirectory = "";
QString selected_suffix("Nearly Raw Raster Data (*.nrrd)");
std::string fileName;
if(aFileName == NULL || askForDifferentFilename)
{
QString initialFilename(aFileName);
if (initialFilename.isEmpty()) initialFilename = "NewImage.pic";
// prepend the last directory
initialFilename = lastDirectory + initialFilename;
QString qfileName = QFileDialog::getSaveFileName( NULL, "Save image", initialFilename ,mitk::CoreObjectFactory::GetInstance()->GetSaveFileExtensions(),&selected_suffix);
MITK_INFO<<qfileName.toLocal8Bit().constData();
if (qfileName.isEmpty() )
return "";
fileName = qfileName.toLocal8Bit().constData();
}
else
fileName = aFileName;
try
{
std::string dir = itksys::SystemTools::GetFilenamePath( fileName );
std::string baseFilename = itksys::SystemTools::GetFilenameWithoutLastExtension( fileName );
std::string extension = itksys::SystemTools::GetFilenameLastExtension( fileName );
if (extension == "") // if no extension has been entered manually into the filename
{
// get from combobox selected file extension
extension = itksys::SystemTools::GetFilenameLastExtension( selected_suffix.toLocal8Bit().constData());
extension = extension.substr(0, extension.size()-1);
fileName += extension;
}
if (extension == ".gz")
{
QMessageBox::critical( NULL, "SaveDialog", "Warning: You can not save an image in the compressed \n"
".pic.gz format. You must save as a normal .pic file.\n"
"Please press Save again and choose a filename with a .pic ending.",
QMessageBox::Ok, QMessageBox::NoButton, QMessageBox::NoButton);
return "";
}
// check if extension is suitable for writing image data
mitk::ImageWriter::Pointer imageWriter = mitk::ImageWriter::New();
if (!imageWriter->IsExtensionValid(extension))
{
QString message;
message.append("File extension not suitable for writing image data. Choose one extension of this list: ");
message.append(imageWriter->GetPossibleFileExtensionsAsString().c_str());
QMessageBox::critical(NULL,"ERROR",message);
return "";
}
dir += "/";
lastDirectory = dir.c_str(); // remember path for next save dialog
dir += baseFilename;
imageWriter->SetInput(image);
imageWriter->SetFileName(dir.c_str());
imageWriter->SetExtension(extension.c_str());
imageWriter->Write();
}
catch ( itk::ExceptionObject &err)
{
itkGenericOutputMacro( << "Exception during write: " << err );
QString exceptionString;
exceptionString.append("Error during write image: ");
exceptionString.append(err.GetDescription());
QMessageBox::critical(NULL,"ERROR",exceptionString);
return "";
}
catch ( ... )
{
itkGenericOutputMacro( << "Unknown type of exception during write" );
QMessageBox::critical(NULL,"ERROR","Error during write image. Possibly no writing permission.");
fileName = "";
}
return fileName;
}
std::string CommonFunctionality::SaveScreenshot( vtkRenderWindow* renderWindow , const char* filename )
{
//
// perform some error checking
//
if ( ! renderWindow )
{
itkGenericOutputMacro( << "render window is NULL!" );
return std::string("");
}
if ( ! renderWindow )
{
itkGenericOutputMacro( << "Unsupported type of render window! The only supported type is currently QmitkRenderWindow." );
return std::string("");
}
//
// create the screenshot before the filechooser is opened,
// so there the file chooser will not be part of the screenshot
//
//QPixmap buffer = QPixmap::grabWindow( qtRenderWindow->winId() );
// new Version:
//// take screenshot of render window without the coloured frame of 2 pixels by cropping the raw image data
vtkWindowToImageFilter* wti = vtkWindowToImageFilter::New();
wti->SetInput( renderWindow );
wti->Update();
vtkImageData* imageData = wti->GetOutput();
int framesize = 5;
int* windowSize = renderWindow->GetSize();
int numberOfScalarComponents = imageData->GetNumberOfScalarComponents();
vtkImageData* processedImageData = vtkImageData::New();
processedImageData->SetNumberOfScalarComponents(numberOfScalarComponents);
processedImageData->SetExtent(0,windowSize[0]-2*framesize-1,0,windowSize[1]-2*framesize-1,0,0);
processedImageData->SetScalarTypeToUnsignedChar();
for (int i=framesize; i<windowSize[0]-framesize; i++)
{
for (int j=framesize; j<windowSize[1]-framesize; j++)
{
for (int k=0; k<numberOfScalarComponents; k++)
{
processedImageData->SetScalarComponentFromDouble(i-framesize,j-framesize,0,k,imageData->GetScalarComponentAsDouble(i,j,0,k));
}
}
}
// write new image as *.png to file
vtkPNGWriter* pngWriter = vtkPNGWriter::New();
//
// if the provided filename is empty ask the user
// for the name of the file in which the screenshot
// should be saved
//
std::string concreteFilename = "";
if( filename == NULL )
{
//
// show a file selector with the supported file formats
//
QString qfileName = QFileDialog::getSaveFileName( NULL, "Save screenshot", QString( "" ), QString( ".png" ).toLocal8Bit().constData() );
if ( qfileName.isEmpty() )
return "";
concreteFilename = qfileName.toLocal8Bit().constData();
}
else
concreteFilename = filename;
// make sure the filename ends with .png
const std::string outFileSuffix("png");
std::string::size_type pos = concreteFilename.rfind('.');
if ( pos == std::string::npos )
concreteFilename = concreteFilename + '.' + outFileSuffix;
else
{
std::string extname = concreteFilename.substr(pos+1);
if ( extname.empty() ) concreteFilename += outFileSuffix; // name ended with '.'
if ( !(extname == outFileSuffix) )
concreteFilename.replace( pos+1, std::string::npos, "png" );
}
//
// wait for 500 ms to let the file chooser close itself
//
// int msecs = 500;
// clock_t ticks = ( clock_t )( ( ( ( float ) msecs ) / 1000.0f ) * ( ( float ) CLOCKS_PER_SEC ) );
// clock_t goal = ticks + std::clock();
// while ( goal > std::clock() );
//
//
// save the screenshot under the given filename
//
pngWriter->SetInput(processedImageData);
//pngWriter->SetInput( wti->GetOutput() );
pngWriter->SetFileName( concreteFilename.c_str() );
pngWriter->Write();
if ( pngWriter->GetErrorCode() != 0 )
QMessageBox::information(NULL, "Save Screenshot...", "The file could not be saved. Please check filename, format and access rights...");
wti->Delete();
pngWriter->Delete();
return concreteFilename;
}
diff --git a/Modules/QmitkExt/QmitkFunctionalityComponents/QmitkThresholdComponent.cpp b/Modules/QmitkExt/QmitkFunctionalityComponents/QmitkThresholdComponent.cpp
index 6d2d791c2e..459944acad 100644
--- a/Modules/QmitkExt/QmitkFunctionalityComponents/QmitkThresholdComponent.cpp
+++ b/Modules/QmitkExt/QmitkFunctionalityComponents/QmitkThresholdComponent.cpp
@@ -1,637 +1,638 @@
/*=========================================================================
Program: Medical Imaging & Interaction Toolkit
Language: C++
Date: $Date$
Version: $Revision$
Copyright (c) German Cancer Research Center, Division of Medical and
Biological Informatics. All rights reserved.
See MITKCopyright.txt or http://www.mitk.org/copyright.html for details.
This software is distributed WITHOUT ANY WARRANTY; without even
the implied warranty of MERCHANTABILITY or FITNESS FOR A PARTICULAR
PURPOSE. See the above copyright notices for more information.
=========================================================================*/
#include "QmitkThresholdComponent.h"
#include "ui_QmitkThresholdComponentControls.h"
#include <QmitkDataStorageComboBox.h>
#include <mitkDataStorage.h>
#include "mitkRenderingManager.h"
#include "mitkProperties.h"
#include "mitkDataNodeFactory.h"
#include "mitkImageTimeSelector.h"
#include "mitkLevelWindowProperty.h"
#include <mitkNodePredicateDataType.h>
#include <mitkNodePredicateProperty.h>
#include <qlineedit.h>
#include <qslider.h>
#include <qgroupbox.h>
#include <qcheckbox.h>
#include <QIntValidator>
+#include <mitkImageCast.h>
#include <mitkImageAccessByItk.h>
//#include <mitkIpPicTypeMultiplex.h>
#include <itkImageConstIteratorWithIndex.h>
/*************** CONSTRUCTOR ***************/
QmitkThresholdComponent::QmitkThresholdComponent(QObject * parent, const char * parentName, bool updateSelector, bool showSelector, QmitkStdMultiWidget * /*mitkStdMultiWidget*/)
: QmitkFunctionalityComponentContainer(parent, parentName, updateSelector, showSelector),
m_ThresholdImageNode(NULL),
m_ThresholdComponentGUI(NULL),
m_ThresholdNodeExisting(false)
{
SetAvailability(true);
SetComponentName("ThresholdFinder");
}
/*************** DESTRUCTOR ***************/
QmitkThresholdComponent::~QmitkThresholdComponent()
{
}
/************** SET SELECTOR VISIBILITY ***************/
void QmitkThresholdComponent::SetSelectorVisibility(bool /*visibility*/)
{
if(m_ThresholdComponentGUI)
{
//m_ImageContent->setShown(visibility);
m_ImageContent->setShown(true);
}
}
/*************** GET IMAGE CONTENT ***************/
QGroupBox* QmitkThresholdComponent::GetImageContent()
{
return (QGroupBox*) m_ImageContent;
}
/*************** GET TREE NODE SELECTOR ***************/
QmitkDataStorageComboBox* QmitkThresholdComponent::GetTreeNodeSelector()
{
return m_TreeNodeSelector;
}
/*************** CONNECTIONS ***************/
void QmitkThresholdComponent::CreateConnections()
{
if ( m_ThresholdComponentGUI )
{
connect( (QObject*)(m_TreeNodeSelector), SIGNAL(OnSelectionChanged (const mitk::DataNode *)), (QObject*) this, SLOT(ImageSelected(const mitk::DataNode *)));
connect( (QObject*)(m_ThresholdFinder), SIGNAL(toggled(bool)), (QObject*) this, SLOT(ShowThresholdFinderContent(bool)));
connect( (QObject*)(m_ThresholdSelectDataGroupBox), SIGNAL(toggled(bool)), (QObject*) this, SLOT(ShowImageContent(bool)));
connect( (QObject*)(m_ThresholdInputSlider), SIGNAL(sliderMoved(int)), (QObject*) this, SLOT(ThresholdSliderChanged(int)));
connect( (QObject*)(m_ThresholdInputNumber), SIGNAL(returnPressed()), (QObject*) this, SLOT(ThresholdValueChanged()));
//connect( (QObject*)( m_ShowThresholdGroupBox), SIGNAL(toggled(bool)), (QObject*) this, SLOT(ShowThreshold(bool)));
//to connect the toplevel checkable GroupBox with the method SetContentContainerVisibility to inform all containing komponent to shrink or to expand
connect( (QObject*)(m_ThresholdFinder), SIGNAL(toggled(bool)), (QObject*) this, SLOT(SetContentContainerVisibility(bool)));
connect( (QObject*)(m_CreateSegmentationButton), SIGNAL(released()), (QObject*) this, SLOT(CreateThresholdSegmentation()));
}
}
/*************** DATA STORAGE CHANGED ***************/
void QmitkThresholdComponent::DataStorageChanged(mitk::DataStorage::Pointer ds)
{
if(!ds)
return;
m_DataStorage = ds;
m_TreeNodeSelector->SetDataStorage(ds);
if(m_ThresholdComponentGUI != NULL)
{
for(unsigned int i = 0; i < m_AddedChildList.size(); i++)
{
QmitkBaseFunctionalityComponent* functionalityComponent = dynamic_cast<QmitkBaseFunctionalityComponent*>(m_AddedChildList[i]);
if (functionalityComponent != NULL)
functionalityComponent->DataStorageChanged(ds);
}
}
if(!ds)
return;
DataObjectSelected();
SetSliderRange();
ShowThreshold();
}
/*************** IMAGE SELECTED ***************/
void QmitkThresholdComponent::ImageSelected(const mitk::DataNode* item)
{
if(m_ThresholdComponentGUI != NULL)
{
mitk::DataNode::Pointer selectedItem = const_cast< mitk::DataNode*>(item);
m_TreeNodeSelector->SetSelectedNode(selectedItem);
for(unsigned int i = 0; i < m_AddedChildList.size(); i++)
{
QmitkBaseFunctionalityComponent* functionalityComponent = dynamic_cast<QmitkBaseFunctionalityComponent*>(m_AddedChildList[i]);
if (functionalityComponent != NULL)
functionalityComponent->ImageSelected(item);
}
}
DataObjectSelected();
SetSliderRange();
ShowThreshold();
}
/*************** DATA OBJECT SELECTED **************/
void QmitkThresholdComponent::DataObjectSelected()
{
if(m_Active)
{
if(m_ThresholdNodeExisting)
{
m_ThresholdImageNode->SetData(m_TreeNodeSelector->GetSelectedNode()->GetData());
}
else
{
CreateThresholdImageNode();
m_ThresholdImageNode->SetData(m_TreeNodeSelector->GetSelectedNode()->GetData());
}
ShowThreshold();
}
}
/** \brief Method to set the DataStorage*/
void QmitkThresholdComponent::SetDataStorage(mitk::DataStorage::Pointer dataStorage)
{
m_DataStorage = dataStorage;
}
/** \brief Method to get the DataStorage*/
mitk::DataStorage::Pointer QmitkThresholdComponent::GetDataStorage()
{
return m_DataStorage;
}
/*************** CREATE CONTAINER WIDGET **************/
void QmitkThresholdComponent::CreateQtPartControl(QWidget * /*parent*/, mitk::DataStorage::Pointer dataStorage)
{
m_GUI = new QWidget;
m_ThresholdComponentGUI = new Ui::QmitkThresholdComponentControls;
m_ThresholdComponentGUI->setupUi(m_GUI);
/*CREATE GUI ELEMENTS*/
m_ThresholdFinder = new QGroupBox("2. Find Threshold", m_GUI);
m_ThresholdSelectDataGroupBox = new QGroupBox("Show Image Selector", m_ThresholdFinder);
m_TreeNodeSelector = new QmitkDataStorageComboBox(m_ThresholdSelectDataGroupBox);
m_ImageContent = new QGroupBox("m_ImageContent", m_ThresholdSelectDataGroupBox);
m_ContainerContent = new QGroupBox(m_ImageContent);
m_ShowThresholdGroupBox = new QGroupBox("m_ShowThresholdGroupBox", m_ContainerContent);
m_ThresholdInputNumber = new QLineEdit(m_ShowThresholdGroupBox);
m_ThresholdInputSlider = new QSlider(m_ShowThresholdGroupBox);
m_ThresholdInputSlider->setOrientation(Qt::Horizontal);
m_ThresholdValueContent = new QGroupBox("m_ThresholdValueContent", m_ShowThresholdGroupBox);
m_CreateSegmentationButton = new QPushButton("Create Segmentation", m_ThresholdValueContent);
m_DeleateImageIfDeactivatedCheckBox = new QCheckBox("Deleate Threshold Image if \nComponent is deactivated", m_ThresholdValueContent);
m_ThresholdFinder->setCheckable(true);
m_ThresholdFinder->setChecked(true);
m_ThresholdSelectDataGroupBox->setCheckable(true);
m_ThresholdSelectDataGroupBox->setChecked(true);
m_ThresholdInputNumber->setFixedSize(40, 20);
QIntValidator* intValid = new QIntValidator(-32000, 5000, m_ThresholdInputNumber);
m_ThresholdInputNumber->setValidator(intValid);
m_ThresholdInputNumber->setText("0");
m_ThresholdValueContent->setMaximumHeight(90);
// m_ThresholdSelectDataGroupBox->setContentsMargins(0,9,9,9);
// m_ImageContent->setContentsMargins(0,9,9,9);
// m_ContainerContent->setContentsMargins(0,9,9,9);
// m_ShowThresholdGroupBox->setContentsMargins(0,9,9,9);
//m_ThresholdValueContent->setContentsMargins(0,9,9,9);
//m_ThresholdFinder->setFlat(true);
//m_ThresholdSelectDataGroupBox->setFlat(true);
//m_ImageContent->setFlat(true);
//m_ContainerContent->setFlat(true);
//m_ShowThresholdGroupBox->setFlat(true);
//m_ThresholdValueContent->setFlat(true);
QVBoxLayout* guiLayout = new QVBoxLayout(m_GUI);
m_GUI->setLayout(guiLayout);
guiLayout->addWidget(m_ThresholdFinder);
QVBoxLayout* thresholdFinderLayout = new QVBoxLayout(m_ThresholdFinder);
thresholdFinderLayout->setContentsMargins(0,9,0,9);
m_ThresholdFinder->setLayout(thresholdFinderLayout);
thresholdFinderLayout->addWidget(m_ThresholdSelectDataGroupBox);
thresholdFinderLayout->addWidget(m_ImageContent);
QVBoxLayout* thresholdSelectDataGroupBoxLayout = new QVBoxLayout(m_ThresholdSelectDataGroupBox);
thresholdSelectDataGroupBoxLayout->setContentsMargins(0,9,0,9);
m_ThresholdSelectDataGroupBox->setLayout(thresholdSelectDataGroupBoxLayout);
thresholdSelectDataGroupBoxLayout->addWidget(m_TreeNodeSelector);
QVBoxLayout* imageContentLayout = new QVBoxLayout(m_ImageContent);
imageContentLayout->setContentsMargins(0,9,0,9);
m_ImageContent->setLayout(imageContentLayout);
imageContentLayout->addWidget(m_ContainerContent);
QVBoxLayout* containerContentLayout = new QVBoxLayout(m_ContainerContent);
containerContentLayout->setContentsMargins(0,9,0,9);
m_ContainerContent->setLayout(containerContentLayout);
containerContentLayout->addWidget(m_ShowThresholdGroupBox);
QVBoxLayout* showThresholdGroupBoxLayout = new QVBoxLayout(m_ShowThresholdGroupBox);
showThresholdGroupBoxLayout->setContentsMargins(0,9,0,9);
m_ShowThresholdGroupBox->setLayout(showThresholdGroupBoxLayout);
QHBoxLayout* thresholdInputLayout = new QHBoxLayout(m_ShowThresholdGroupBox);
thresholdInputLayout->addWidget(m_ThresholdInputNumber);
thresholdInputLayout->addWidget(m_ThresholdInputSlider);
showThresholdGroupBoxLayout->addLayout(thresholdInputLayout);
showThresholdGroupBoxLayout->addWidget(m_ThresholdValueContent);
QVBoxLayout* thresholdValueContentLayout = new QVBoxLayout(m_ThresholdValueContent);
thresholdValueContentLayout->setContentsMargins(0,9,0,9);
m_ThresholdValueContent->setLayout(thresholdValueContentLayout);
thresholdValueContentLayout->addWidget(m_DeleateImageIfDeactivatedCheckBox);
thresholdValueContentLayout->addWidget(m_CreateSegmentationButton);
this->CreateConnections();
SetDataStorage(dataStorage);
m_TreeNodeSelector->SetDataStorage(dataStorage);
m_TreeNodeSelector->SetPredicate(mitk::NodePredicateDataType::New("Image"));
if(m_ShowSelector)
{
m_ImageContent->setShown( m_ThresholdSelectDataGroupBox->isChecked());
//m_ImageContent->setShown(true);
}
else
{
m_ThresholdSelectDataGroupBox->setShown(m_ShowSelector);
//m_ThresholdSelectDataGroupBox->setShown(true);
}
}
/*************** GET CONTENT CONTAINER ***************/
QGroupBox * QmitkThresholdComponent::GetContentContainer()
{
return m_ContainerContent;
}
/************ GET MAIN CHECK BOX CONTAINER ************/
QGroupBox * QmitkThresholdComponent::GetMainCheckBoxContainer()
{
return m_ThresholdFinder;
}
///*********** SET CONTENT CONTAINER VISIBLE ************/
//void QmitkThresholdComponent::SetContentContainerVisibility()
//{
// for(unsigned int i = 0; i < m_AddedChildList.size(); i++)
// {
// if(m_AddedChildList[i]->GetContentContainer() != NULL)
// {
// m_AddedChildList[i]->GetContentContainer()->setShown(GetMainCheckBoxContainer()->isChecked());
// }
// }
//}
/*************** ACTIVATED ***************/
void QmitkThresholdComponent::Activated()
{
QmitkBaseFunctionalityComponent::Activated();
m_Active = true;
for(unsigned int i = 0; i < m_AddedChildList.size(); i++)
{
m_AddedChildList[i]->Activated();
}
CreateThresholdImageNode();
ShowThreshold();
SetSliderRange();
}
/*************** DEACTIVATED ***************/
void QmitkThresholdComponent::Deactivated()
{
QmitkBaseFunctionalityComponent::Deactivated();
m_Active = false;
for(unsigned int i = 0; i < m_AddedChildList.size(); i++)
{
m_AddedChildList[i]->Deactivated();
}
ShowThreshold();
if( m_DeleateImageIfDeactivatedCheckBox->isChecked())
{
DeleteThresholdNode();
}
}
///************ SHOW THRESHOLD FINDER CONTENT ***********/
void QmitkThresholdComponent::ShowThresholdFinderContent(bool)
{
// m_ShowThresholdGroupBox->setShown( m_ThresholdFinder->isChecked());
// m_ContainerContent->setShown( m_ThresholdSelectDataGroupBox->isChecked());
m_ContainerContent->setShown( m_ThresholdFinder->isChecked());
if(m_ShowSelector)
{
//m_ThresholdSelectDataGroupBox->setShown( m_ThresholdSelectDataGroupBox->isChecked());
//m_ThresholdSelectDataGroupBox->setShown( true);
m_ThresholdSelectDataGroupBox->setShown(m_ThresholdFinder->isChecked());
}
//ShowThreshold();
}
///*************** SHOW IMAGE CONTENT **************/
void QmitkThresholdComponent::ShowImageContent(bool)
{
//m_ImageContent->setShown( m_ThresholdSelectDataGroupBox->isChecked());
m_ImageContent->setShown( true);
if(m_ShowSelector)
{
//m_ImageContent->setShown( m_ThresholdSelectDataGroupBox->isChecked());
m_ImageContent->setShown( true);
}
else
{
//m_ThresholdSelectDataGroupBox->setShown(m_ShowSelector);
m_ThresholdSelectDataGroupBox->setShown(true);
}
}
///*************** SHOW THRESHOLD **************/
void QmitkThresholdComponent::ShowThreshold(bool)
{
if(m_ThresholdImageNode)
{
if(m_Active == true)
{
m_ThresholdImageNode->SetProperty("visible", mitk::BoolProperty::New(( m_ThresholdFinder->isChecked())) );
}
else
{
if( m_DeleateImageIfDeactivatedCheckBox->isChecked())
{
m_ThresholdImageNode->SetProperty("visible", mitk::BoolProperty::New((false)) );
}
}
mitk::RenderingManager::GetInstance()->RequestUpdateAll();
}
}
///*************** THRESHOLD VALUE CHANGED **************/
//By Slider
void QmitkThresholdComponent::ThresholdSliderChanged(int)
{
int value = m_ThresholdInputSlider->value();
if (m_ThresholdImageNode)
{
m_ThresholdImageNode->SetLevelWindow(mitk::LevelWindow(value,1));
mitk::RenderingManager::GetInstance()->RequestUpdateAll();
}
m_ThresholdInputNumber->setText(QString::number(value));
}
///*************** THRESHOLD VALUE CHANGED **************/
//By LineEdit
void QmitkThresholdComponent::ThresholdValueChanged( )
{
int value = atoi( m_ThresholdInputNumber->text().toLocal8Bit().constData() );
if (m_ThresholdImageNode)
{
m_ThresholdImageNode->SetLevelWindow(mitk::LevelWindow(value,1));
mitk::RenderingManager::GetInstance()->RequestUpdateAll();
}
m_ThresholdInputSlider->setValue(value);
}
///*************** SET SLIDER RANGE **************/
void QmitkThresholdComponent::SetSliderRange()
{
if(m_Active)
{
if( m_ThresholdFinder->isChecked()==true)
{
if(!m_TreeNodeSelector->GetSelectedNode())
return;
if(!m_TreeNodeSelector->GetSelectedNode()->GetData())
return;
mitk::Image* currentImage = dynamic_cast<mitk::Image*>(m_TreeNodeSelector->GetSelectedNode()->GetData());
if(currentImage)
{
int min = (int) currentImage->GetScalarValueMin();
int max = (int) currentImage->GetScalarValueMaxNoRecompute();
//int realMax = currentImage->GetScalarValueMax();
if(min < -32000)
{
min = (int) currentImage->GetScalarValue2ndMin();
max = (int) currentImage->GetScalarValue2ndMaxNoRecompute();
}
QIntValidator* intValid = new QIntValidator(min-150, max+150, m_ThresholdInputNumber);
m_ThresholdInputNumber->setValidator(intValid);
m_ThresholdInputNumber->setText("1");
m_ThresholdInputSlider->setMinimum(min-150);
m_ThresholdInputSlider->setMaximum(max+150);
m_ThresholdInputSlider->setRange(min-150, max+150);
m_ThresholdInputSlider->setPageStep(1);
m_ThresholdInputSlider->setValue(1);
m_GUI->repaint();
//m_ThresholdInputSlider->resize();
/* m_ThresholdInputSlider->setMinValue((int)currentImage->GetScalarValueMin());
m_ThresholdInputSlider->setMaxValue((int)currentImage->GetScalarValueMaxNoRecompute());*/
}
}
}
}
///*************** DELETE THRESHOLD NODE **************/
void QmitkThresholdComponent::DeleteThresholdNode()
{
if(m_ThresholdImageNode)
{
mitk::DataNode::Pointer foundNode = m_DataStorage->GetNamedNode("Thresholdview image");
foundNode->Delete();
m_ThresholdNodeExisting = false;
return;
}
}
///*************CREATE THRESHOLD IMAGE NODE************/
void QmitkThresholdComponent::CreateThresholdImageNode()
{
if(m_Active)
{
if( m_ThresholdNodeExisting)
return;
if(!m_TreeNodeSelector)
return;
if(!m_TreeNodeSelector->GetSelectedNode())
return;
m_ThresholdImageNode = mitk::DataNode::New();
mitk::StringProperty::Pointer nameProp = mitk::StringProperty::New("Thresholdview image" );
m_ThresholdImageNode->SetProperty( "name", nameProp );
mitk::BoolProperty::Pointer componentThresholdImageProp = mitk::BoolProperty::New(true);
m_ThresholdImageNode->SetProperty( "isComponentThresholdImage", componentThresholdImageProp );
m_ThresholdImageNode->SetData(m_TreeNodeSelector->GetSelectedNode()->GetData());
m_ThresholdImageNode->SetColor(0.0,1.0,0.0);
m_ThresholdImageNode->SetOpacity(.25);
int layer = 0;
m_ThresholdImageNode->GetIntProperty("layer", layer);
m_ThresholdImageNode->SetIntProperty("layer", layer+1);
m_ThresholdImageNode->SetLevelWindow(mitk::LevelWindow(atoi( m_ThresholdInputNumber->text().toLocal8Bit().constData()),1));
m_ThresholdNodeExisting = true;
m_DataStorage->Add(m_ThresholdImageNode);
}
}
/*************CREAET THRESHOLD SEGMENTATION************/
void QmitkThresholdComponent::CreateThresholdSegmentation()
{
mitk::Image::Pointer original = dynamic_cast<mitk::Image*>(m_TreeNodeSelector->GetSelectedNode()->GetData());
// we NEED a reference image for size etc.
if (!original) return;
// actually create a new empty segmentation
mitk::PixelType pixelType( typeid(DefaultSegmentationDataType) );
mitk::Image::Pointer segmentation = mitk::Image::New();
//segmentation->SetProperty( "organ type", OrganTypeProperty::New( organType ) );
segmentation->Initialize( pixelType, original->GetDimension(), original->GetDimensions() );
unsigned int byteSize = sizeof(DefaultSegmentationDataType);
for (unsigned int dim = 0; dim < segmentation->GetDimension(); ++dim)
{
byteSize *= segmentation->GetDimension(dim);
}
memset( segmentation->GetData(), 0, byteSize );
if (original->GetTimeSlicedGeometry() )
{
mitk::AffineGeometryFrame3D::Pointer originalGeometryAGF = original->GetTimeSlicedGeometry()->Clone();
mitk::TimeSlicedGeometry::Pointer originalGeometry = dynamic_cast<mitk::TimeSlicedGeometry*>( originalGeometryAGF.GetPointer() );
segmentation->SetGeometry( originalGeometry );
}
else
{
MITK_INFO<<"Original image does not have a 'Time sliced geometry'! Cannot create a segmentation.";
return ;
}
mitk::DataNode::Pointer emptySegmentationNode = CreateSegmentationNode( segmentation);
if (emptySegmentationNode)
{
// actually perform a thresholding and ask for an organ type
for (unsigned int timeStep = 0; timeStep < original->GetTimeSteps(); ++timeStep)
{
try
{
mitk::ImageTimeSelector::Pointer timeSelector = mitk::ImageTimeSelector::New();
timeSelector->SetInput( original );
timeSelector->SetTimeNr( timeStep );
timeSelector->UpdateLargestPossibleRegion();
mitk::Image::Pointer image3D = timeSelector->GetOutput();
AccessFixedDimensionByItk_2( image3D, ITKThresholding, 3, dynamic_cast<mitk::Image*>(emptySegmentationNode->GetData()), timeStep );
}
catch(...)
{
MITK_INFO<<"Error accessing single time steps of the original image. Cannot create segmentation.";
}
}
mitk::DataNode::Pointer originalNode = m_TreeNodeSelector->GetSelectedNode();
m_DataStorage->Add( emptySegmentationNode, originalNode ); // add as a child, because the segmentation "derives" from the original
}
}
mitk::DataNode::Pointer QmitkThresholdComponent::CreateSegmentationNode( mitk::Image* image)
{
if (!image) return NULL;
// decorate the datatreenode with some properties
mitk::DataNode::Pointer segmentationNode = mitk::DataNode::New();
segmentationNode->SetData( image );
// name
segmentationNode->SetProperty( "name", mitk::StringProperty::New( "TH segmentation from ThresholdFinder" ) );
// visualization properties
segmentationNode->SetProperty( "binary", mitk::BoolProperty::New(true) );
segmentationNode->SetProperty( "color", mitk::ColorProperty::New(0.0, 1.0, 0.0) );
segmentationNode->SetProperty( "texture interpolation", mitk::BoolProperty::New(false) );
segmentationNode->SetProperty( "layer", mitk::IntProperty::New(10) );
segmentationNode->SetProperty( "levelwindow", mitk::LevelWindowProperty::New( mitk::LevelWindow(0.5, 1) ) );
segmentationNode->SetProperty( "opacity", mitk::FloatProperty::New(0.3) );
segmentationNode->SetProperty( "segmentation", mitk::BoolProperty::New(true) );
segmentationNode->SetProperty( "showVolume", mitk::BoolProperty::New( false ) );
return segmentationNode;
}
template <typename TPixel, unsigned int VImageDimension>
void QmitkThresholdComponent::ITKThresholding( itk::Image<TPixel, VImageDimension>* originalImage, mitk::Image* segmentation, unsigned int timeStep )
{
mitk::ImageTimeSelector::Pointer timeSelector = mitk::ImageTimeSelector::New();
timeSelector->SetInput( segmentation );
timeSelector->SetTimeNr( timeStep );
timeSelector->UpdateLargestPossibleRegion();
mitk::Image::Pointer segmentation3D = timeSelector->GetOutput();
typedef itk::Image< DefaultSegmentationDataType, 3> SegmentationType; // this is sure for new segmentations
SegmentationType::Pointer itkSegmentation;
CastToItkImage( segmentation3D, itkSegmentation );
// iterate over original and segmentation
typedef itk::ImageRegionConstIterator< itk::Image<TPixel, VImageDimension> > InputIteratorType;
typedef itk::ImageRegionIterator< SegmentationType > SegmentationIteratorType;
InputIteratorType inputIterator( originalImage, originalImage->GetLargestPossibleRegion() );
SegmentationIteratorType outputIterator( itkSegmentation, itkSegmentation->GetLargestPossibleRegion() );
inputIterator.GoToBegin();
outputIterator.GoToBegin();
while (!outputIterator.IsAtEnd())
{
if ( (signed)inputIterator.Get() >= atoi( m_ThresholdInputNumber->text().toLocal8Bit().constData()) )
{
outputIterator.Set( 1 );
}
else
{
outputIterator.Set( 0 );
}
++inputIterator;
++outputIterator;
}
}
diff --git a/Modules/QmitkExt/QmitkPointListView.cpp b/Modules/QmitkExt/QmitkPointListView.cpp
index 8d696d12cc..e2d625fe87 100644
--- a/Modules/QmitkExt/QmitkPointListView.cpp
+++ b/Modules/QmitkExt/QmitkPointListView.cpp
@@ -1,417 +1,417 @@
/*=========================================================================
Program: Medical Imaging & Interaction Toolkit
Language: C++
Date: $Date$
Version: $Revision: 1.12 $
Copyright (c) German Cancer Research Center, Division of Medical and
Biological Informatics. All rights reserved.
See MITKCopyright.txt or http://www.mitk.org/copyright.html for details.
This software is distributed WITHOUT ANY WARRANTY; without even
the implied warranty of MERCHANTABILITY or FITNESS FOR A PARTICULAR
PURPOSE. See the above copyright notices for more information.
=========================================================================*/
#include "QmitkPointListView.h"
#include "QmitkPointListModel.h"
#include "QmitkStdMultiWidget.h"
#include "QmitkEditPointDialog.h"
#include "mitkRenderingManager.h"
#include <QKeyEvent>
#include <QPalette>
#include <QTimer>
#include <QMenu>
#include <QMessageBox>
QmitkPointListView::QmitkPointListView( QWidget* parent )
:QListView( parent ),
m_PointListModel( new QmitkPointListModel() ),
m_SelfCall( false ),
m_showFading(false),
m_MultiWidget( NULL)
{
QListView::setAlternatingRowColors( true );
// logic
QListView::setSelectionBehavior( QAbstractItemView::SelectRows );
QListView::setSelectionMode( QAbstractItemView::SingleSelection );
QListView::setModel( m_PointListModel );
QString tooltip = QString("Use the F2/F3 keys to move a point up/down, the Del key to remove a point\nand the mouse wheel to change the timestep.\n\nTimeStep:\t%1").arg(0);
QListView::setToolTip(tooltip);
//m_FadeTimer = new QTimer();
this->setContextMenuPolicy(Qt::CustomContextMenu);
m_TimeStepFaderLabel = new QLabel(this);
QFont font("Arial", 17);
m_TimeStepFaderLabel->setFont(font);
//Define Size
this->setMinimumHeight(40);
//horizontal, vertical
this->setSizePolicy(QSizePolicy::Ignored, QSizePolicy::Ignored);
//connect
connect( m_PointListModel, SIGNAL(SignalUpdateSelection()), this, SLOT(OnPointSetSelectionChanged()) );
connect( this, SIGNAL(doubleClicked ( const QModelIndex & )),
this, SLOT(OnPointDoubleClicked( const QModelIndex & )) );
connect( QListView::selectionModel(), SIGNAL(selectionChanged(const QItemSelection &, const QItemSelection &)),
this, SLOT(OnListViewSelectionChanged(const QItemSelection& , const QItemSelection&)) );
connect(this, SIGNAL(customContextMenuRequested(const QPoint &)), this, SLOT(ctxMenu(const QPoint &)));
}
QmitkPointListView::~QmitkPointListView()
{
delete m_PointListModel;
}
void QmitkPointListView::SetPointSetNode( mitk::DataNode* pointSetNode )
{
m_PointListModel->SetPointSetNode( pointSetNode);
}
const mitk::PointSet* QmitkPointListView::GetPointSet() const
{
return m_PointListModel->GetPointSet();
}
void QmitkPointListView::SetMultiWidget( QmitkStdMultiWidget* multiWidget )
{
m_MultiWidget = multiWidget;
}
QmitkStdMultiWidget* QmitkPointListView::GetMultiWidget() const
{
return m_MultiWidget;
}
void QmitkPointListView::OnPointDoubleClicked(const QModelIndex & index)
{
mitk::PointSet::PointType p;
mitk::PointSet::PointIdentifier id;
m_PointListModel->GetPointForModelIndex(index, p, id);
QmitkEditPointDialog _EditPointDialog(this);
_EditPointDialog.SetPoint(m_PointListModel->GetPointSet(), id, m_PointListModel->GetTimeStep());
_EditPointDialog.exec();
}
void QmitkPointListView::OnPointSetSelectionChanged()
{
const mitk::PointSet* pointSet = m_PointListModel->GetPointSet();
if (pointSet == NULL)
return;
// update this view's selection status as a result to changes in the point set data structure
m_SelfCall = true;
int timeStep = m_PointListModel->GetTimeStep();
if ( pointSet->GetNumberOfSelected( timeStep ) > 1 )
{
MITK_ERROR << "Point set has multiple selected points. This view is not designed for more than one selected point.";
}
int selectedIndex = pointSet->SearchSelectedPoint( timeStep );
if (selectedIndex == -1) // no selected point is found
{
m_SelfCall = false;
return;
}
QModelIndex index;
bool modelIndexOkay = m_PointListModel->GetModelIndexForPointID(selectedIndex, index);
if (modelIndexOkay == true)
QListView::selectionModel()->select( index , QItemSelectionModel::ClearAndSelect );
emit SignalPointSelectionChanged();
m_SelfCall = false;
}
void QmitkPointListView::OnListViewSelectionChanged(const QItemSelection& selected, const QItemSelection& /*deselected*/)
{
if (m_SelfCall)
return;
mitk::PointSet* pointSet = const_cast<mitk::PointSet*>( m_PointListModel->GetPointSet() );
if (pointSet == NULL)
return;
// (take care that this widget doesn't react to self-induced changes by setting m_SelfCall)
m_SelfCall = true;
// update selection of all points in pointset: select the one(s) that are selected in the view, deselect all others
QModelIndexList selectedIndexes = selected.indexes();
for (mitk::PointSet::PointsContainer::Iterator it = pointSet->GetPointSet(m_PointListModel->GetTimeStep())->GetPoints()->Begin();
it != pointSet->GetPointSet(m_PointListModel->GetTimeStep())->GetPoints()->End(); ++it)
{
QModelIndex index;
if (m_PointListModel->GetModelIndexForPointID(it->Index(), index))
{
if (selectedIndexes.indexOf(index) != -1) // index is found in the selected indices list
{
pointSet->SetSelectInfo(it->Index(), true, m_PointListModel->GetTimeStep());
if ( m_MultiWidget != NULL)
{
m_MultiWidget->MoveCrossToPosition(pointSet->GetPoint(it->Index(), m_PointListModel->GetTimeStep()));
}
}
else
{
pointSet->SetSelectInfo(it->Index(), false, m_PointListModel->GetTimeStep());
}
}
}
m_SelfCall = false;
emit SignalPointSelectionChanged();
mitk::RenderingManager::GetInstance()->RequestUpdateAll();
}
void QmitkPointListView::keyPressEvent( QKeyEvent * e )
{
if (m_PointListModel == NULL)
return;
int key = e->key();
switch (key)
{
case Qt::Key_F2:
m_PointListModel->MoveSelectedPointUp();
break;
case Qt::Key_F3:
m_PointListModel->MoveSelectedPointDown();
break;
case Qt::Key_Delete:
m_PointListModel->RemoveSelectedPoint();
break;
default:
break;
}
}
void QmitkPointListView::wheelEvent(QWheelEvent *event)
{
if (!m_PointListModel || !m_PointListModel->GetPointSet() || (int)(m_PointListModel->GetPointSet()->GetTimeSteps()) == 1 /*|| !m_4DPointSet*/)
return;
int whe = event->delta();
mitk::PointSet::Pointer ps = dynamic_cast<mitk::PointSet*>(m_PointListModel->GetPointSet());
unsigned int numberOfTS = ps->GetTimeSteps();
if(numberOfTS == 1)
return;
int currentTS = this->m_PointListModel->GetTimeStep();
if(whe > 0)
{
if((currentTS >= (int)(m_PointListModel->GetPointSet()->GetTimeSteps())))
return;
this->m_PointListModel->SetTimeStep(++currentTS);
}
else
{
if((currentTS <= 0))
return;
this->m_PointListModel->SetTimeStep(--currentTS);
}
QString tooltip = QString("Use the F2/F3 keys to move a point up/down, the Del key to remove a point\nand the mouse wheel to change the timestep.\n\nTimeStep:\t%1").arg(currentTS);
this->setToolTip(tooltip);
fadeTimeStepIn();
}
void QmitkPointListView::fadeTimeStepIn()
{
//Setup Widget
QWidget *m_TimeStepFader = new QWidget(this);
QHBoxLayout *layout = new QHBoxLayout(m_TimeStepFader);
int x = (int)(this->geometry().x()+this->width()*0.6);
int y = (int)(this->geometry().y()+this->height()*0.8);
m_TimeStepFader->move(x,y);
m_TimeStepFader->resize(60, 55);
m_TimeStepFader->setLayout(layout);
m_TimeStepFader->setAttribute(Qt::WA_DeleteOnClose);
//setup Label
// QLabel *label = new QLabel(QString("%1").arg(this->m_PointListModel->GetTimeStep()));
layout->addWidget(m_TimeStepFaderLabel);
m_TimeStepFaderLabel->setAlignment(Qt::AlignCenter);
m_TimeStepFaderLabel->setFrameStyle(QFrame::StyledPanel | QFrame::Raised);
m_TimeStepFaderLabel->setLineWidth(2);
m_TimeStepFaderLabel->setText(QString("%1").arg(this->m_PointListModel->GetTimeStep()));
//give the widget opacity and some colour
QPalette pal = m_TimeStepFaderLabel->palette();
QColor semiTransparentColor(139, 192, 223, 50);
QColor labelTransparentColor(0,0,0,200);
pal.setColor(m_TimeStepFaderLabel->backgroundRole(), semiTransparentColor);
pal.setColor(m_TimeStepFaderLabel->foregroundRole(), labelTransparentColor);
m_TimeStepFaderLabel->setAutoFillBackground(true);
m_TimeStepFaderLabel->setPalette(pal);
//show the widget
m_TimeStepFader->show();
//and start the timer
m_TimeStepFaderLabel->setVisible(true);
QTimer::singleShot(2000, this, SLOT(fadeTimeStepOut()));
}
void QmitkPointListView::fadeTimeStepOut()
{
m_TimeStepFaderLabel->hide();
}
void QmitkPointListView::ctxMenu(const QPoint &pos)
{
QMenu *menu = new QMenu;
// menu->setStyle();
// menu->addAction(tr("Test Item"), this, SLOT(test_slot()));
//add Fading check
QAction *showFading = new QAction(this);
showFading->setCheckable(false); //TODO: reset when fading is working
showFading->setEnabled(false); //TODO: reset when fading is working
showFading->setText("Fade TimeStep");
connect(showFading, SIGNAL(triggered(bool)), this, SLOT(SetFading(bool)));
menu->addAction(showFading);
//add Clear action
QAction *clearList = new QAction(this);
clearList->setText("Clear List");
connect(clearList, SIGNAL(triggered()), this, SLOT(ClearPointList()));
menu->addAction(clearList);
//add Clear TimeStep action
QAction *clearTS = new QAction(this);
clearTS->setText("Clear current time step");
connect(clearTS, SIGNAL(triggered()), this, SLOT(ClearPointListTS()));
menu->addAction(clearTS);
// //add "show time step in list" option
// QAction *viewTS = new QAction(this);
// viewTS->setText("Show time step in list");
// viewTS->setCheckable(true);
// viewTS->setChecked(false);
// connect(viewTS, SIGNAL(triggered(bool)), this, SLOT(ClearPointList(bool)));
// menu->addAction(viewTS);
menu->exec(this->mapToGlobal(pos));
}
void QmitkPointListView::SetFading(bool onOff)
{
m_showFading = onOff;
}
void QmitkPointListView::ClearPointList()
{
if(!m_PointListModel->GetPointSet())
return;
mitk::PointSet::Pointer curPS = m_PointListModel->GetPointSet();
if ( curPS->GetSize() == 0)
return;
switch( QMessageBox::question( this, tr("Clear Points"),
tr("Remove all points from the displayed list?"),
QMessageBox::Yes | QMessageBox::No, QMessageBox::No))
{
case QMessageBox::Yes:
{
// m_PointListModel->ClearList();
// /*
// if (curPS)
// {
// curPS->Clear();
// }
// */
// mitk::RenderingManager::GetInstance()->RequestUpdateAll();
// break;
mitk::PointSet::PointsIterator it;
mitk::PointSet::PointsContainer *curPsPoints;
- while( !curPS->IsEmpty(0))
+ while( !curPS->IsEmptyTimeStep(0))
{
curPsPoints = curPS->GetPointSet()->GetPoints();
it = curPsPoints->Begin();
curPS->SetSelectInfo(it->Index(),true);
m_PointListModel->RemoveSelectedPoint();
}
mitk::RenderingManager::GetInstance()->RequestUpdateAll();
break;
}
case QMessageBox::No:
default:
break;
}
// emit PointListChanged();
}
void QmitkPointListView::ClearPointListTS()
{
// mitk::PointSet* /*::Pointer*/ curPS = m_PointListModel->GetPointSet();
// if ( curPS->GetSize() == 0)
// return;
// int ts = this->m_PointListModel->GetTimeStep();
// switch( QMessageBox::question( this, tr("Clear Points in Timestep"),
// tr("Remove all points from the list with the timestep %1?").arg(ts),
// QMessageBox::Yes | QMessageBox::No, QMessageBox::No))
// {
// case QMessageBox::Yes:
// if (curPS)
// {
// mitk::PointSet::DataType::Pointer curPSwithTS = curPS->GetPointSet(ts);
// //curPSwithTS->Clear();
// }
// mitk::RenderingManager::GetInstance()->RequestUpdateAll();
// break;
// case QMessageBox::No:
// default:
// break;
// }
// // emit PointListChanged();
}
diff --git a/Modules/QmitkExt/QmitkTransferFunctionGeneratorWidget.cpp b/Modules/QmitkExt/QmitkTransferFunctionGeneratorWidget.cpp
index ad82c5d3f3..db98b5b8f8 100644
--- a/Modules/QmitkExt/QmitkTransferFunctionGeneratorWidget.cpp
+++ b/Modules/QmitkExt/QmitkTransferFunctionGeneratorWidget.cpp
@@ -1,510 +1,509 @@
/*=========================================================================
Program: Medical Imaging & Interaction Toolkit
Language: C++
Date: $Date: 2009-07-14 19:11:20 +0200 (Tue, 14 Jul 2009) $
Version: $Revision: 18127 $
Copyright (c) German Cancer Research Center, Division of Medical and
Biological Informatics. All rights reserved.
See MITKCopyright.txt or http://www.mitk.org/copyright.html for details.
This software is distributed WITHOUT ANY WARRANTY; without even
the implied warranty of MERCHANTABILITY or FITNESS FOR A PARTICULAR
PURPOSE. See the above copyright notices for more information.
=========================================================================*/
#include "QmitkTransferFunctionGeneratorWidget.h"
#include <mitkTransferFunctionProperty.h>
#include <mitkRenderingManager.h>
#include <mitkTransferFunctionInitializer.h>
#include <mitkUnstructuredGrid.h>
#include <QFileDialog>
#include <SceneSerializationExports.h>
#include <mitkTransferFunctionPropertySerializer.h>
-#include <mitkTransferFunctionPropertyDeserializer.h>
#include <vtkUnstructuredGrid.h>
QmitkTransferFunctionGeneratorWidget::QmitkTransferFunctionGeneratorWidget(QWidget* parent,
Qt::WindowFlags f) :
QWidget(parent, f), deltaScale(1.0), deltaMax(1024), deltaMin(1)
{
histoGramm = NULL;
this->setupUi(this);
// LevelWindow Tab
{
connect( m_CrossLevelWindow, SIGNAL( SignalDeltaMove( int, int ) ), this, SLOT( OnDeltaLevelWindow( int, int ) ) );
}
// Threshold Tab
{
connect( m_CrossThreshold, SIGNAL( SignalDeltaMove( int, int ) ), this, SLOT( OnDeltaThreshold( int, int ) ) );
thDelta = 100;
}
// Presets Tab
{
m_TransferFunctionComboBox->setVisible(false);
connect( m_TransferFunctionComboBox, SIGNAL( activated( int ) ), this, SIGNAL(SignalTransferFunctionModeChanged(int)) );
connect( m_TransferFunctionComboBox, SIGNAL( activated( int ) ), this, SLOT(OnPreset(int)) );
connect( m_SavePreset, SIGNAL( clicked() ), this, SLOT( OnSavePreset() ) );
connect( m_LoadPreset, SIGNAL( clicked() ), this, SLOT( OnLoadPreset() ) );
}
presetFileName = ".";
}
int QmitkTransferFunctionGeneratorWidget::AddPreset(const QString &presetName)
{
m_TransferFunctionComboBox->setVisible(true);
m_TransferFunctionComboBox->addItem( presetName);
return m_TransferFunctionComboBox->count()-1;
}
void QmitkTransferFunctionGeneratorWidget::SetPresetsTabEnabled(bool enable)
{
m_PresetTab->setEnabled(enable);
}
void QmitkTransferFunctionGeneratorWidget::SetThresholdTabEnabled(bool enable)
{
m_ThresholdTab->setEnabled(enable);
}
void QmitkTransferFunctionGeneratorWidget::SetBellTabEnabled(bool enable)
{
m_BellTab->setEnabled(enable);
}
void QmitkTransferFunctionGeneratorWidget::OnSavePreset( )
{
if(tfpToChange.IsNull())
return;
mitk::TransferFunction::Pointer tf = tfpToChange->GetValue();
std::string fileName;
std::string fileNameOutput;
presetFileName = QFileDialog::getSaveFileName( this,"Choose a filename to save the transferfunction",presetFileName, "Transferfunction (*.xml)" );
fileName=presetFileName.toLocal8Bit().constData();
MITK_INFO << "Saving Transferfunction under path: " << fileName;
fileNameOutput= ReduceFileName(fileName);
if ( mitk::TransferFunctionPropertySerializer::SerializeTransferFunction( fileName.c_str(), tf ))
m_InfoPreset->setText( QString( (std::string("saved ")+ fileNameOutput).c_str() ) );
else
m_InfoPreset->setText( QString( std::string("saving failed").c_str() ) );
/*
FILE *f=fopen("c:\\temp.txt","w");
// grayvalue -> opacity
{
mitk::TransferFunction::ControlPoints scalarOpacityPoints = tf->GetScalarOpacityPoints();
fprintf(f,"// grayvalue->opacity \n"
"{\n"
" vtkPiecewiseFunction *f=tf->GetScalarOpacityFunction();\n"
" f->RemoveAllPoints();\n");
for ( mitk::TransferFunction::ControlPoints::iterator iter = scalarOpacityPoints.begin(); iter != scalarOpacityPoints.end(); ++iter )
fprintf(f," f->AddPoint(%f,%f);\n",iter->first, iter->second);
fprintf(f," f->Modified();\n"
"}\n");
}
// gradient
{
mitk::TransferFunction::ControlPoints gradientOpacityPoints = tf->GetGradientOpacityPoints();
fprintf(f,"// gradient at grayvalue->opacity \n"
"{\n"
" vtkPiecewiseFunction *f=tf->GetGradientOpacityFunction();\n"
" f->RemoveAllPoints();\n");
for ( mitk::TransferFunction::ControlPoints::iterator iter = gradientOpacityPoints.begin(); iter != gradientOpacityPoints.end(); ++iter )
fprintf(f," f->AddPoint(%f,%f);\n",iter->first, iter->second);
fprintf(f," f->Modified();\n"
"}\n");
}
// color
{
mitk::TransferFunction::RGBControlPoints points = tf->GetRGBPoints();
fprintf(f,"// grayvalue->color \n"
"{\n"
" vtkColorTransferFunction *f=tf->GetColorTransferFunction();\n"
" f->RemoveAllPoints();\n");
for ( mitk::TransferFunction::RGBControlPoints::iterator iter = points.begin(); iter != points.end(); ++iter )
fprintf(f," f->AddRGBPoint(%f,%f,%f,%f);\n",iter->first, iter->second[0], iter->second[1], iter->second[2]);
fprintf(f," f->Modified();\n"
"}\n");
}
fclose(f);
MITK_INFO << "saved under C:\\temp.txt";
*/
}
void QmitkTransferFunctionGeneratorWidget::OnLoadPreset( )
{
if(tfpToChange.IsNull())
return;
std::string fileName;
std::string fileNameOutput;
presetFileName = QFileDialog::getOpenFileName( this,"Choose a file to open the transferfunction from",presetFileName, "Transferfunction (*.xml)" );
fileName=presetFileName.toLocal8Bit().constData();
MITK_INFO << "Loading Transferfunction from path: " << fileName;
fileNameOutput= ReduceFileName(fileName);
- mitk::TransferFunction::Pointer tf = mitk::TransferFunctionPropertyDeserializer::DeserializeTransferFunction(fileName.c_str());
+ mitk::TransferFunction::Pointer tf = mitk::TransferFunctionPropertySerializer::DeserializeTransferFunction(fileName.c_str());
if(tf.IsNotNull())
{
/*
if( histoGramm )
tf->InitializeByItkHistogram( histoGramm );
*/
tfpToChange->SetValue( tf );
m_InfoPreset->setText( QString( (std::string("loaded ")+ fileNameOutput).c_str() ) );
mitk::RenderingManager::GetInstance()->RequestUpdateAll();
emit SignalUpdateCanvas();
/*
vtkFloatingPointType* dp = tf->GetScalarOpacityFunction()->GetDataPointer();
for (int i = 0; i < tf->GetScalarOpacityFunction()->GetSize(); i++)
{
MITK_INFO << "x: " << dp[i * 2] << " y: " << dp[i * 2 + 1];
}
*/
}
}
void QmitkTransferFunctionGeneratorWidget::OnPreset(int mode)
{
//first item is only information
if( --mode == -1 )
return;
m_InfoPreset->setText(QString("selected ") + m_TransferFunctionComboBox->currentText());
//revert to first item
m_TransferFunctionComboBox->setCurrentIndex( 0 );
}
static double transformationGlocke ( double x )
{
double z = 0.1;
double a = 2 - 2 * z;
double b = 2 * z - 1;
x = a * x + b;
return x;
}
static double stepFunctionGlocke ( double x )
{
x = 1-(2*x -1.0); // map [0.5;1] to [0,1]
x = x * ( 3*x - 2*x*x ); // apply smoothing function
x = x * x;
return x;
}
double QmitkTransferFunctionGeneratorWidget::ScaleDelta(int d) const
{
//MITK_INFO << "Scaling (int) " << d << "to (double) " << deltaScale*(double)d;
return deltaScale*(double)d;
}
void QmitkTransferFunctionGeneratorWidget::OnDeltaLevelWindow(int dx, int dy) // bell
{
//std::string infoText;
// m_InfoThreshold->setText( QString( x.c_str() ) );
if(tfpToChange.IsNull())
return;
thPos += ScaleDelta(dx);
thDelta -= ScaleDelta(dy);
if(thDelta < deltaMin)
thDelta = deltaMin;
if(thDelta > deltaMax)
thDelta = deltaMax;
if(thPos < histoMinimum)
thPos = histoMinimum;
if(thPos > histoMaximum)
thPos = histoMaximum;
std::stringstream ss;
ss << "Click on the cross and move the mouse"<<"\n"
<<"\n"
<< "center at " << thPos << "\n"
<< "width " << thDelta * 2;
m_InfoLevelWindow->setText( QString( ss.str().c_str() ) );
mitk::TransferFunction::Pointer tf = tfpToChange->GetValue();
// grayvalue->opacity
{
vtkPiecewiseFunction *f=tf->GetScalarOpacityFunction();
f->RemoveAllPoints();
for( int r = 0; r<= 6; r++)
{
double relPos = (r / 6.0) * 0.5 + 0.5;
f->AddPoint(thPos+thDelta*(-transformationGlocke(relPos)),stepFunctionGlocke(relPos));
f->AddPoint(thPos+thDelta*( transformationGlocke(relPos)),stepFunctionGlocke(relPos));
}
f->Modified();
}
// gradient at grayvalue->opacity
{
vtkPiecewiseFunction *f=tf->GetGradientOpacityFunction();
f->RemoveAllPoints();
f->AddPoint( 0, 1.0 );
f->Modified();
}
/*
// grayvalue->color
{
vtkColorTransferFunction *ctf=tf->GetColorTransferFunction();
ctf->RemoveAllPoints();
ctf->AddRGBPoint( 0, 1.0, 1.0, 1.0 );
ctf->Modified();
}
*/
tf->Modified();
mitk::RenderingManager::GetInstance()->RequestUpdateAll();
emit SignalUpdateCanvas();
}
static double stepFunctionThreshold ( double x )
{
x = 0.5*x + 0.5; // map [-1;1] to [0,1]
x = x * ( 3*x - 2*x*x ); // apply smoothing function
x = x * x;
return x;
}
void QmitkTransferFunctionGeneratorWidget::OnDeltaThreshold(int dx, int dy) // LEVELWINDOW
{
if(tfpToChange.IsNull())
return;
thPos += ScaleDelta(dx);
thDelta += ScaleDelta(dy);
if(thDelta < deltaMin)
thDelta = deltaMin;
if(thDelta > deltaMax)
thDelta = deltaMax;
if(thPos < histoMinimum)
thPos = histoMinimum;
if(thPos > histoMaximum)
thPos = histoMaximum;
//MITK_INFO << "threshold pos: " << thPos << " delta: " << thDelta;
//MITK_INFO << "histoMinimum: " << histoMinimum << " max: " << histoMaximum;
std::stringstream ss;
ss << "Click on the cross and move the mouse"<<"\n"
<<"\n"
<< "threshold at " << thPos << "\n"
<< "width " << thDelta * 2;
m_InfoThreshold->setText( QString( ss.str().c_str() ) );
mitk::TransferFunction::Pointer tf = tfpToChange->GetValue();
// grayvalue->opacity
{
vtkPiecewiseFunction *f=tf->GetScalarOpacityFunction();
f->RemoveAllPoints();
for( int r = 1; r<= 4; r++)
{
double relPos = r / 4.0;
f->AddPoint(thPos+thDelta*(-relPos),stepFunctionThreshold(-relPos));
f->AddPoint(thPos+thDelta*( relPos),stepFunctionThreshold( relPos));
}
f->Modified();
}
// gradient at grayvalue->opacity
{
vtkPiecewiseFunction *f=tf->GetGradientOpacityFunction();
f->RemoveAllPoints();
f->AddPoint( 0, 1.0 );
f->Modified();
}
/*
// grayvalue->color
{
vtkColorTransferFunction *ctf=tf->GetColorTransferFunction();
ctf->RemoveAllPoints();
ctf->AddRGBPoint( 0, 1.0, 1.0, 1.0 );
ctf->Modified();
}
*/
tf->Modified();
mitk::RenderingManager::GetInstance()->RequestUpdateAll();
emit SignalUpdateCanvas();
}
std::string QmitkTransferFunctionGeneratorWidget::ReduceFileName(std::string fileNameLong )
{
if (fileNameLong.length()< 40)
return fileNameLong;
//MITK_INFO <<" fileName > 20 ";
std::string fileNameShort;
std::string fileNameRevert;
for(unsigned int i=0; i< fileNameLong.length(); i++)
{
if(i<3)
{
char x= fileNameLong[i];
fileNameShort= fileNameShort+x;
}
if(i==3)
{
fileNameShort= fileNameShort+"...";
break;
}
}
//MITK_INFO <<" fileNameShort: " << fileNameShort.c_str();
unsigned int len( fileNameLong.length() );
for(unsigned int i=len-1; i <= len; i--)
{
std::string x=std::string("")+fileNameLong[i];
if ( x.compare("/")==0 || x.compare("\\")==0)
{
fileNameRevert= "/" + fileNameRevert;
break;
}
if (i>=fileNameLong.length()-24)
{
fileNameRevert= x+ fileNameRevert;
//MITK_INFO <<" fileNameRevert: " << fileNameRevert.c_str();
}
else
{
fileNameRevert= "/..." + fileNameRevert;
break;
}
}
return fileNameShort+fileNameRevert;
}
QmitkTransferFunctionGeneratorWidget::~QmitkTransferFunctionGeneratorWidget()
{
}
void QmitkTransferFunctionGeneratorWidget::SetDataNode(mitk::DataNode* node)
{
histoGramm = NULL;
if (node)
{
tfpToChange = dynamic_cast<mitk::TransferFunctionProperty*>(node->GetProperty("TransferFunction"));
if(!tfpToChange)
{
node->SetProperty("TransferFunction", tfpToChange = mitk::TransferFunctionProperty::New() );
dynamic_cast<mitk::TransferFunctionProperty*>(node->GetProperty("TransferFunction"));
}
mitk::TransferFunction::Pointer tf = tfpToChange->GetValue();
if( mitk::Image* image = dynamic_cast<mitk::Image*>( node->GetData() ) )
{
// tf->InitializeByItkHistogram( histoGramm = image->GetScalarHistogram() );
histoMinimum= image->GetScalarValueMin();
histoMaximum= image->GetScalarValueMax();
}
else if (mitk::UnstructuredGrid* grid = dynamic_cast<mitk::UnstructuredGrid*>( node->GetData() ) )
{
double* range = grid->GetVtkUnstructuredGrid()->GetScalarRange();
histoMinimum = range[0];
histoMaximum = range[1];
double histoRange = histoMaximum - histoMinimum;
deltaMax = histoRange/4.0;
deltaMin = histoRange/400.0;
deltaScale = histoRange/1024.0;
}
else
{
MITK_WARN << "QmitkTransferFunctonGeneratorWidget does not support " << node->GetData()->GetNameOfClass() << " instances";
}
thPos = ( histoMinimum + histoMaximum ) / 2.0;
}
else
{
tfpToChange = 0;
m_InfoPreset->setText( QString( "" ) );
}
}
diff --git a/Modules/QmitkExt/vtkQtChartHeaders/vtkQtBarChart.h b/Modules/QmitkExt/vtkQtChartHeaders/vtkQtBarChart.h
deleted file mode 100644
index 934720971c..0000000000
--- a/Modules/QmitkExt/vtkQtChartHeaders/vtkQtBarChart.h
+++ /dev/null
@@ -1,230 +0,0 @@
-/*=========================================================================
-
- Program: Visualization Toolkit
- Module: $RCSfile: vtkQtBarChart.h,v $
-
- Copyright (c) Ken Martin, Will Schroeder, Bill Lorensen
- All rights reserved.
- See Copyright.txt or http://www.kitware.com/Copyright.htm for details.
-
- This software is distributed WITHOUT ANY WARRANTY; without even
- the implied warranty of MERCHANTABILITY or FITNESS FOR A PARTICULAR
- PURPOSE. See the above copyright notice for more information.
-
-=========================================================================*/
-/*-------------------------------------------------------------------------
- Copyright 2008 Sandia Corporation.
- Under the terms of Contract DE-AC04-94AL85000 with Sandia Corporation,
- the U.S. Government retains certain rights in this software.
--------------------------------------------------------------------------*/
-
-/// \file vtkQtBarChart.h
-/// \date February 15, 2008
-
-#ifndef _vtkQtBarChart_h
-#define _vtkQtBarChart_h
-
-#include "vtkQtChartExport.h"
-#include "vtkQtChartSeriesLayer.h"
-
-class vtkQtBarChartInternal;
-class vtkQtBarChartOptions;
-class vtkQtBarChartSeriesOptions;
-
-
-/// \class vtkQtBarChart
-/// \brief
-/// The vtkQtBarChart class is used to display a bar chart.
-class VTKQTCHART_EXPORT vtkQtBarChart : public vtkQtChartSeriesLayer
-{
- Q_OBJECT
-
-public:
- vtkQtBarChart();
- virtual ~vtkQtBarChart();
-
- /// \name Setup Methods
- //@{
- virtual void setChartArea(vtkQtChartArea *area);
-
- virtual void setModel(vtkQtChartSeriesModel *model);
- //@}
-
- /// \name Drawing Parameters
- //@{
- /// \brief
- /// Gets the bar chart drawing options.
- /// \return
- /// A pointer to the bar chart drawing options.
- vtkQtBarChartOptions *getOptions() const {return this->Options;}
-
- /// \brief
- /// Sets the bar chart drawing options.
- ///
- /// This method sets all the options at once, which can prevent
- /// unnecessary view updates.
- ///
- /// \param options The new bar chart drawing options.
- void setOptions(const vtkQtBarChartOptions &options);
-
- /// \brief
- /// Gets the bar chart series options.
- /// \param series The series index.
- /// \return
- /// A pointer to the bar chart series options.
- vtkQtBarChartSeriesOptions *getBarSeriesOptions(int series) const;
-
- virtual QPixmap getSeriesIcon(int series) const;
- //@}
-
- /// \name Layout Methods
- //@{
- virtual void getLayerDomain(vtkQtChartLayerDomain &domain) const;
-
- virtual void layoutChart(const QRectF &area);
-
- virtual bool getHelpText(const QPointF &point, QString &text);
-
- /// \brief
- /// Notifies the chart layer that a resize interaction has finished.
- ///
- /// The chart bar tree is not updated while the chart is in an
- /// interactive state. It is updated in this method if needed.
- virtual void finishInteractiveResize();
- //@}
-
- /// \name Selection Methods
- //@{
- virtual void getSeriesAt(const QPointF &point,
- vtkQtChartSeriesSelection &selection) const;
-
- virtual void getPointsAt(const QPointF &point,
- vtkQtChartSeriesSelection &selection) const;
-
- virtual void getSeriesIn(const QRectF &area,
- vtkQtChartSeriesSelection &selection) const;
-
- virtual void getPointsIn(const QRectF &area,
- vtkQtChartSeriesSelection &selection) const;
- //@}
-
- /// \name QGraphicsItem Methods
- //@{
- virtual QRectF boundingRect() const;
-
- virtual void paint(QPainter *painter, const QStyleOptionGraphicsItem *option,
- QWidget *widget=0);
- //@}
-
-public slots:
- /// \brief
- /// Refreshes the bar chart data from the model.
- ///
- /// The currently displayed data is cleaned up. If a model is set,
- /// it is used to populate the bar chart.
- void reset();
-
-protected:
- /// \brief
- /// Creates a new bar chart series options object.
- /// \param parent The parent object.
- /// \return
- /// A pointer to the new bar chart series options object.
- virtual vtkQtChartSeriesOptions *createOptions(QObject *parent);
-
- /// \brief
- /// Sets up the series options defaults.
- /// \param options The new series options object.
- virtual void setupOptions(vtkQtChartSeriesOptions *options);
-
-private slots:
- /// \brief
- /// Prepares the bar chart for a series insertion.
- /// \param first The first series index to be added.
- /// \param last The last series index to be added.
- void prepareSeriesInsert(int first, int last);
-
- /// \brief
- /// Inserts bar chart series at the given indexes.
- /// \param first The first series index to be added.
- /// \param last The last series index to be added.
- void insertSeries(int first, int last);
-
- /// \brief
- /// Removes the specified series from the chart.
- /// \param first The first series index to be removed.
- /// \param last The last series index to be removed.
- void startSeriesRemoval(int first, int last);
-
- /// \brief
- /// Finishes the domain changes after removing the series.
- /// \param first The first series index to be removed.
- /// \param last The last series index to be removed.
- void finishSeriesRemoval(int first, int last);
-
- /// Requests a chart layout when the axis corner option changes.
- void handleAxesCornerChange();
-
- /// Changes the bar outline style.
- void handleOutlineChange();
-
- /// \brief
- /// Changes the series visibility.
- ///
- /// The signal sender is used to determine which series has changed.
- ///
- /// \param visible True if the series should be shown.
- void handleSeriesVisibilityChange(bool visible);
-
- /// \brief
- /// Changes the series pen.
- /// \param pen The new series pen.
- void handleSeriesPenChange(const QPen &pen);
-
- /// \brief
- /// Changes the series brush.
- /// \param brush The new series brush.
- void handleSeriesBrushChange(const QBrush &brush);
-
- /// \brief
- /// Called to set up the highlights.
- ///
- /// The set up request is ignored if the model is being changed.
- void updateHighlights();
-
-private:
- /// \brief
- /// Adds the domain for the given series to the current domain.
- /// \param series The series index.
- /// \param seriesGroup Used to return the series group index.
- /// \return
- /// True if the domain was modified.
- bool addSeriesDomain(int series, int &seriesGroup);
-
- /// \brief
- /// Calculates the domain for the given series group.
- /// \param seriesGroup The series group index.
- void calculateDomain(int seriesGroup);
-
- /// \brief
- /// Creates an ordered list of series bars.
- /// \param seriesGroup The series group index.
- void createBarList(int seriesGroup);
-
- /// \brief
- /// Builds the bar tree for the given series group.
- /// \param seriesGroup The series group index.
- void buildBarTree(int seriesGroup);
-
-private:
- vtkQtBarChartInternal *Internal; ///< Stores the bar series.
- vtkQtBarChartOptions *Options; ///< Stores the drawing options.
- bool InModelChange; ///< Used for selection changes.
- bool BuildNeeded; ///< Used when resizing interactively.
-
-private:
- vtkQtBarChart(const vtkQtBarChart &);
- vtkQtBarChart &operator=(const vtkQtBarChart &);
-};
-
-#endif
diff --git a/Modules/QmitkExt/vtkQtChartHeaders/vtkQtBarChartOptions.h b/Modules/QmitkExt/vtkQtChartHeaders/vtkQtBarChartOptions.h
deleted file mode 100644
index 6b69c438ac..0000000000
--- a/Modules/QmitkExt/vtkQtChartHeaders/vtkQtBarChartOptions.h
+++ /dev/null
@@ -1,187 +0,0 @@
-/*=========================================================================
-
- Program: Visualization Toolkit
- Module: $RCSfile: vtkQtBarChartOptions.h,v $
-
- Copyright (c) Ken Martin, Will Schroeder, Bill Lorensen
- All rights reserved.
- See Copyright.txt or http://www.kitware.com/Copyright.htm for details.
-
- This software is distributed WITHOUT ANY WARRANTY; without even
- the implied warranty of MERCHANTABILITY or FITNESS FOR A PARTICULAR
- PURPOSE. See the above copyright notice for more information.
-
-=========================================================================*/
-/*-------------------------------------------------------------------------
- Copyright 2008 Sandia Corporation.
- Under the terms of Contract DE-AC04-94AL85000 with Sandia Corporation,
- the U.S. Government retains certain rights in this software.
--------------------------------------------------------------------------*/
-
-/// \file vtkQtBarChartOptions.h
-/// \date February 22, 2008
-
-#ifndef _vtkQtBarChartOptions_h
-#define _vtkQtBarChartOptions_h
-
-#include "vtkQtChartExport.h"
-#include <QObject>
-
-#include "vtkQtChartLayer.h" // needed for enum
-#include <QColor> // needed for static member
-
-class vtkQtChartHelpFormatter;
-
-
-/// \class vtkQtBarChartOptions
-/// \brief
-/// The vtkQtBarChartOptions class stores the drawing options for a
-/// bar chart.
-///
-/// The default settings are as follows:
-/// \li axes: \c BottomLeft
-/// \li bar group fraction: 0.7
-/// \li bar width fraction: 0.9
-/// \li outline style: \c Darker
-/// \li selection background: \c LightBlue
-class VTKQTCHART_EXPORT vtkQtBarChartOptions : public QObject
-{
- Q_OBJECT
-
-public:
- enum OutlineStyle
- {
- Darker = 0, ///< Draws the bar outline in a darker color.
- Black ///< Draws a black bar outline.
- };
-
-public:
- /// \brief
- /// Creates a bar chart options instance.
- /// \param parent The parent object.
- vtkQtBarChartOptions(QObject *parent=0);
-
- /// \brief
- /// Makes a copy of another bar chart options instance.
- /// \param other The bar chart options to copy.
- vtkQtBarChartOptions(const vtkQtBarChartOptions &other);
- virtual ~vtkQtBarChartOptions();
-
- /// \brief
- /// Gets the pair of axes used by the bar chart.
- /// \return
- /// The pair of axes used by the bar chart.
- vtkQtChartLayer::AxesCorner getAxesCorner() const {return this->AxesCorner;}
-
- /// \brief
- /// Sets the pair of axes used by the bar chart.
- /// \param axes The new chart axes.
- void setAxesCorner(vtkQtChartLayer::AxesCorner axes);
-
- /// \brief
- /// Gets the bar group fraction.
- ///
- /// The bar group fraction is used to set the spacing between the
- /// groups of bars. For a bar chart with one series, this also sets
- /// the width of the bars.
- ///
- /// \return
- /// The bar group fraction.
- float getBarGroupFraction() const {return this->GroupFraction;}
-
- /// \brief
- /// Sets the bar group fraction.
- /// \param fraction The new bar group fraction.
- void setBarGroupFraction(float fraction);
-
- /// \brief
- /// Gets the bar width fraction.
- ///
- /// The bar width fraction is used to set the spacing between the
- /// bars of different series.
- ///
- /// \return
- /// The bar width fraction.
- float getBarWidthFraction() const {return this->BarFraction;}
-
- /// \brief
- /// Sets the bar width fraction.
- /// \param fraction The new bar width fraction.
- void setBarWidthFraction(float fraction);
-
- /// \brief
- /// Gets the outline style for the bars.
- /// \return
- /// The current outline style.
- OutlineStyle getOutlineStyle() const {return this->OutlineType;}
-
- /// \brief
- /// Sets the outline style for the bars.
- ///
- /// The default style is \c Darker.
- ///
- /// \param style The outline style to use.
- void setOutlineStyle(OutlineStyle style);
-
- /// \brief
- /// Gets the highlight background color.
- /// \return
- /// The current highlight background color.
- const QColor &getHighlightColor() const {return this->Highlight;}
-
- /// \brief
- /// Sets the highlight background color.
- /// \param color The color for the highlight background.
- void setHighlightColor(const QColor &color);
-
- /// \brief
- /// Gets the chart help text formatter.
- ///
- /// The help text formatter stores the format string. It is also
- /// used to generate the help text.
- ///
- /// \return
- /// A pointer to the chart help text formatter.
- vtkQtChartHelpFormatter *getHelpFormat() {return this->Help;}
-
- /// \brief
- /// Gets the chart help text formatter.
- /// \return
- /// A pointer to the chart help text formatter.
- const vtkQtChartHelpFormatter *getHelpFormat() const {return this->Help;}
-
- /// \brief
- /// Makes a copy of another bar chart options instance.
- /// \param other The bar chart options to copy.
- /// \return
- /// A reference to the object being assigned.
- vtkQtBarChartOptions &operator=(const vtkQtBarChartOptions &other);
-
-signals:
- /// Emitted when the bar chart axes change.
- void axesCornerChanged();
-
- /// Emitted when bar group or bar width fractions change.
- void barFractionsChanged();
-
- /// Emitted when the outline style changes.
- void outlineStyleChanged();
-
- /// Emitted when the highlight color changes.
- void highlightChanged();
-
-public:
- /// Defines the default highlight background.
- static const QColor LightBlue;
-
-private:
- /// Stores the highlight background color.
- QColor Highlight;
- vtkQtChartLayer::AxesCorner AxesCorner; ///< Stores the chart axes.
- OutlineStyle OutlineType; ///< Stores the outline style.
- vtkQtChartHelpFormatter *Help; ///< Stores the help text format.
- float GroupFraction; ///< Stores the bar group fraction.
- float BarFraction; ///< Stores the bar width fraction.
-};
-
-#endif
diff --git a/Modules/QmitkExt/vtkQtChartHeaders/vtkQtBarChartSeriesOptions.h b/Modules/QmitkExt/vtkQtChartHeaders/vtkQtBarChartSeriesOptions.h
deleted file mode 100644
index 0162e7a91a..0000000000
--- a/Modules/QmitkExt/vtkQtChartHeaders/vtkQtBarChartSeriesOptions.h
+++ /dev/null
@@ -1,54 +0,0 @@
-/*=========================================================================
-
- Program: Visualization Toolkit
- Module: $RCSfile: vtkQtBarChartSeriesOptions.h,v $
-
- Copyright (c) Ken Martin, Will Schroeder, Bill Lorensen
- All rights reserved.
- See Copyright.txt or http://www.kitware.com/Copyright.htm for details.
-
- This software is distributed WITHOUT ANY WARRANTY; without even
- the implied warranty of MERCHANTABILITY or FITNESS FOR A PARTICULAR
- PURPOSE. See the above copyright notice for more information.
-
-=========================================================================*/
-/*-------------------------------------------------------------------------
- Copyright 2008 Sandia Corporation.
- Under the terms of Contract DE-AC04-94AL85000 with Sandia Corporation,
- the U.S. Government retains certain rights in this software.
--------------------------------------------------------------------------*/
-
-/// \file vtkQtBarChartSeriesOptions.h
-/// \date February 22, 2008
-
-#ifndef _vtkQtBarChartSeriesOptions_h
-#define _vtkQtBarChartSeriesOptions_h
-
-#include "vtkQtChartExport.h"
-#include "vtkQtChartSeriesOptions.h"
-
-
-/// \class vtkQtBarChartSeriesOptions
-/// \brief
-/// The vtkQtBarChartSeriesOptions class stores the drawing options
-/// for a bar chart series.
-class VTKQTCHART_EXPORT vtkQtBarChartSeriesOptions :
- public vtkQtChartSeriesOptions
-{
- Q_OBJECT
-
-public:
- /// \brief
- /// Creates a bar chart series options object.
- /// \param parent The parent object.
- vtkQtBarChartSeriesOptions(QObject *parent=0);
- virtual ~vtkQtBarChartSeriesOptions() {}
-
- /// \brief
- /// Sets the series brush using the style generator.
- /// \param style The style index for the generator.
- /// \param generator The style generator to use.
- virtual void setStyle(int style, vtkQtChartStyleGenerator *generator);
-};
-
-#endif
diff --git a/Modules/QmitkExt/vtkQtChartHeaders/vtkQtChartArea.h b/Modules/QmitkExt/vtkQtChartHeaders/vtkQtChartArea.h
deleted file mode 100644
index fab3e934f5..0000000000
--- a/Modules/QmitkExt/vtkQtChartHeaders/vtkQtChartArea.h
+++ /dev/null
@@ -1,275 +0,0 @@
-/*=========================================================================
-
- Program: Visualization Toolkit
- Module: $RCSfile: vtkQtChartArea.h,v $
-
- Copyright (c) Ken Martin, Will Schroeder, Bill Lorensen
- All rights reserved.
- See Copyright.txt or http://www.kitware.com/Copyright.htm for details.
-
- This software is distributed WITHOUT ANY WARRANTY; without even
- the implied warranty of MERCHANTABILITY or FITNESS FOR A PARTICULAR
- PURPOSE. See the above copyright notice for more information.
-
-=========================================================================*/
-/*-------------------------------------------------------------------------
- Copyright 2008 Sandia Corporation.
- Under the terms of Contract DE-AC04-94AL85000 with Sandia Corporation,
- the U.S. Government retains certain rights in this software.
--------------------------------------------------------------------------*/
-
-/// \file vtkQtChartArea.h
-/// \date February 1, 2008
-
-#ifndef _vtkQtChartArea_h
-#define _vtkQtChartArea_h
-
-#include "vtkQtChartExport.h"
-#include <QGraphicsView>
-
-class vtkQtChartAreaInternal;
-class vtkQtChartAxisLayer;
-class vtkQtChartContentsSpace;
-class vtkQtChartInteractor;
-class vtkQtChartLayer;
-class vtkQtChartMouseBox;
-class vtkQtChartStyleManager;
-class QCursor;
-class QString;
-
-
-/// \class vtkQtChartArea
-/// \brief
-/// The vtkQtChartArea class manages the chart axes and layers.
-class VTKQTCHART_EXPORT vtkQtChartArea : public QGraphicsView
-{
- Q_OBJECT
-
-public:
- /// \brief
- /// Creates a chart area instance.
- /// \param parent The parent widget.
- vtkQtChartArea(QWidget *parent=0);
- virtual ~vtkQtChartArea();
-
- /// \name Layer Methods
- //@{
- /// \brief
- /// Adds a chart layer to the top of the layer list.
- /// \param chart The chart to add to the list.
- /// \sa vtkQtChartArea::insertLayer(int, vtkQtChartLayer *)
- void addLayer(vtkQtChartLayer *chart);
-
- /// \brief
- /// Inserts a chart layer in the layer list.
- ///
- /// The chart layers are drawn in the order they reside in the list
- /// of layers. A chart at the beginning of the list is drawn
- /// underneath the other layers. A chart at the end of the list is
- /// drawn on top of the other layers.
- ///
- /// The chart area has two built in chart layers: the grid and axis
- /// layers. By default, the grid layer is on the bottom and the axis
- /// layer is on the next layer. The index of these layers can be
- /// used to place other layers in the chart.
- ///
- /// \param index Where to insert the chart.
- /// \param chart The chart to insert in the list.
- /// \sa
- /// vtkQtChartArea::getGridLayerIndex(),
- /// vtkQtChartArea::getAxisLayerIndex()
- void insertLayer(int index, vtkQtChartLayer *chart);
-
- /// \brief
- /// Removes a chart layer from the layer list.
- /// \param chart The chart to remove from the list.
- void removeLayer(vtkQtChartLayer *chart);
-
- /// \brief
- /// Gets the number of chart layers in the list.
- /// \return
- /// The number of chart layers in the list.
- int getNumberOfLayers() const;
-
- /// \brief
- /// Gets the chart layer at the specified index.
- /// \param index The index of the layer.
- /// \return
- /// A pointer to the chart layer at the specified index.
- vtkQtChartLayer *getLayer(int index) const;
-
- /// \brief
- /// Gets the chart layer with the specified chart type.
- /// \param chartName The chart type name to find.
- /// \return
- /// A pointer to the chart layer with the specified chart type.
- vtkQtChartLayer *getLayer(const QString &chartName) const;
-
- /// \brief
- /// Gets the chart axis layer.
- /// \return
- /// A pointer to the chart axis layer.
- vtkQtChartAxisLayer *getAxisLayer() const;
-
- /// \brief
- /// Gets the index for the axis layer.
- /// \return
- /// The index for the axis layer.
- int getAxisLayerIndex() const;
-
- /// \brief
- /// Gets the index for the grid layer.
- /// \return
- /// The index for the grid layer.
- int getGridLayerIndex() const;
- //@}
-
- /// \name Interaction Methods
- //@{
- /// \brief
- /// Gets the current chart interactor.
- /// \return
- /// A pointer to the current chart interactor.
- vtkQtChartInteractor *getInteractor() const;
-
- /// \brief
- /// Sets the chart interactor.
- ///
- /// This method sets up the interactor to work with the chart. The
- /// contents space and mouse box are set on the interactor.
- ///
- /// \param interactor The new chart interactor.
- void setInteractor(vtkQtChartInteractor *interactor);
-
- /// \brief
- /// Gets the contents space object.
- /// \return
- /// A pointer to the contents space object.
- vtkQtChartContentsSpace *getContentsSpace() const;
-
- /// \brief
- /// Gets the mouse box object.
- /// \return
- /// A pointer to the mouse box object.
- vtkQtChartMouseBox *getMouseBox() const;
-
- /// \brief
- /// Notifies the chart layers that a resize interaction has started.
- ///
- /// Chart layers can use this method to reduce the processing load
- /// during an interaction.
- void startInteractiveResize();
-
- /// \brief
- /// Gets whether or no the chart is interactively resizing.
- /// \return
- /// True if the chart is interactively resizing.
- bool isInteractivelyResizing() const;
-
- /// Notifies the chart layers that a resize interaction has finished.
- void finishInteractiveResize();
- //@}
-
- /// \brief
- /// Gets the style manager for layers that want unique styles.
- /// \return
- /// A pointer to the style manager.
- vtkQtChartStyleManager *getStyleManager() const;
-
-public slots:
- /// Calculates the axis and chart layout.
- void layoutChart();
-
- /// Merges layout requests into one delayed layout event.
- void updateLayout();
-
-signals:
- /// Emitted when a delayed chart layout is needed.
- void delayedLayoutNeeded();
-
- /// \brief
- /// Emitted when a chart layer has been inserted.
- /// \param index The index of the layer.
- /// \param chart The chart layer that was inserted.
- void layerInserted(int index, vtkQtChartLayer *chart);
-
- /// \brief
- /// Emitted before a chart layer is removed.
- /// \param index The index of the layer.
- /// \param chart The chart layer that will be removed.
- void removingLayer(int index, vtkQtChartLayer *chart);
-
- /// \brief
- /// Emitted when a chart layer has been removed.
- /// \param index The index of the layer.
- /// \param chart The chart layer that was removed.
- void layerRemoved(int index, vtkQtChartLayer *chart);
-
-protected:
- /// \brief
- /// Updates the layout when the font changes.
- /// \param e Event specific information.
- /// \return
- /// True if the event was handled.
- virtual bool viewportEvent(QEvent *e);
-
- /// \brief
- /// Updates the layout when the size changes.
- /// \param e Event specific information.
- virtual void resizeEvent(QResizeEvent *e);
-
- /// \name Interaction Methods
- //@{
- /// \brief
- /// Handles the key press events for the chart.
- ///
- /// All the interaction events are forwarded to the vtkQtChartInteractor.
- /// It is up to the interactor object to accept or ignore the events.
- ///
- /// \param e Event specific information.
- virtual void keyPressEvent(QKeyEvent *e);
-
- /// \brief
- /// Handles the mouse press events for the chart.
- /// \param e Event specific information.
- virtual void mousePressEvent(QMouseEvent *e);
-
- /// \brief
- /// Handles the mouse move events for the chart.
- /// \param e Event specific information.
- virtual void mouseMoveEvent(QMouseEvent *e);
-
- /// \brief
- /// Handles the mouse release events for the chart.
- /// \param e Event specific information.
- virtual void mouseReleaseEvent(QMouseEvent *e);
-
- /// \brief
- /// Handles the mouse double click events for the chart.
- /// \param e Event specific information.
- virtual void mouseDoubleClickEvent(QMouseEvent *e);
-
- /// \brief
- /// Handles the mouse wheel events for the chart.
- /// \param e Event specific information.
- virtual void wheelEvent(QWheelEvent *e);
- //@}
-
-private slots:
- /// Updates the layout after a zoom change.
- void handleZoomChange();
-
- /// \brief
- /// Changes the view cursor to the requested one.
- /// \param newCursor The new view cursor.
- void changeCursor(const QCursor &newCursor);
-
-private:
- vtkQtChartAreaInternal *Internal; ///< Stores the list of chart layers.
-
-private:
- vtkQtChartArea(const vtkQtChartArea &);
- vtkQtChartArea &operator=(const vtkQtChartArea &);
-};
-
-#endif
diff --git a/Modules/QmitkExt/vtkQtChartHeaders/vtkQtChartAxis.h b/Modules/QmitkExt/vtkQtChartHeaders/vtkQtChartAxis.h
deleted file mode 100644
index eee36d878e..0000000000
--- a/Modules/QmitkExt/vtkQtChartHeaders/vtkQtChartAxis.h
+++ /dev/null
@@ -1,476 +0,0 @@
-/*=========================================================================
-
- Program: Visualization Toolkit
- Module: $RCSfile: vtkQtChartAxis.h,v $
-
- Copyright (c) Ken Martin, Will Schroeder, Bill Lorensen
- All rights reserved.
- See Copyright.txt or http://www.kitware.com/Copyright.htm for details.
-
- This software is distributed WITHOUT ANY WARRANTY; without even
- the implied warranty of MERCHANTABILITY or FITNESS FOR A PARTICULAR
- PURPOSE. See the above copyright notice for more information.
-
-=========================================================================*/
-/*-------------------------------------------------------------------------
- Copyright 2008 Sandia Corporation.
- Under the terms of Contract DE-AC04-94AL85000 with Sandia Corporation,
- the U.S. Government retains certain rights in this software.
--------------------------------------------------------------------------*/
-
-/// \file vtkQtChartAxis.h
-/// \date February 1, 2008
-
-#ifndef _vtkQtChartAxis_h
-#define _vtkQtChartAxis_h
-
-#include "vtkQtChartExport.h"
-#include <QObject>
-#include <QGraphicsItem>
-
-#include "vtkQtChartGraphicsItemTypes.h" // needed for enum
-
-class vtkQtChartAxisInternal;
-class vtkQtChartAxisModel;
-class vtkQtChartAxisOptions;
-class vtkQtChartContentsArea;
-class vtkQtChartContentsSpace;
-class QGraphicsLineItem;
-class QVariant;
-
-
-/// \class vtkQtChartAxis
-/// \brief
-/// The vtkQtChartAxis class is used to display a cartesian axis.
-class VTKQTCHART_EXPORT vtkQtChartAxis : public QObject, public QGraphicsItem
-{
- Q_OBJECT
-
-public:
- enum AxisLocation
- {
- Left = 0, ///< The axis is on the left of the chart.
- Bottom, ///< The axis is on the bottom of the chart.
- Right, ///< The axis is on the right of the chart.
- Top ///< The axis is on the top of the chart.
- };
-
- enum AxisDomain
- {
- UnsupportedDomain = -1,
- Number = 0, ///< Domain for int and double.
- Date, ///< Domain for QDate and QDateTime.
- Time, ///< Domain for QTime.
- String ///< Domain for QString.
- };
-
- enum {Type = vtkQtChart_AxisType};
-
-public:
- /// \brief
- /// Creates a chart axis view.
- /// \param location Where on the chart the axis will be drawn.
- /// \param parent The parent item.
- vtkQtChartAxis(AxisLocation location, QGraphicsItem *parent=0);
- virtual ~vtkQtChartAxis();
-
- virtual int type() const {return vtkQtChartAxis::Type;}
-
- /// \name Setup Methods
- //@{
- /// \brief
- /// Gets the axis location on the chart.
- /// \return
- /// The axis location on the chart.
- AxisLocation getLocation() const {return this->Location;}
-
- /// \brief
- /// Gets the chart axis model.
- /// \return
- /// A pointer to the chart axis model.
- vtkQtChartAxisModel *getModel() const {return this->Model;}
-
- /// \brief
- /// Sets the chart axis model.
- /// \param model The model to display.
- void setModel(vtkQtChartAxisModel *model);
-
- /// \brief
- /// Sets the neighboring axes if any.
- ///
- /// The neighboring axes are used when laying out the axis. The
- /// axis pixel positions are adjusted to accound for the space
- /// requirements of its neighbors.
- ///
- /// \param atMin The axis at the minimum value end.
- /// \param atMax The axis at the maximum value end.
- void setNeigbors(const vtkQtChartAxis *atMin, const vtkQtChartAxis *atMax);
-
- /// \brief
- /// Sets the parallel axis.
- /// \param across The axis parallel to this one.
- void setParallelAxis(const vtkQtChartAxis *across);
-
- /// \brief
- /// Sets the axis' contents space object.
- /// \param contents The new contents space object.
- void setContentsSpace(const vtkQtChartContentsSpace *contents);
-
- /// \brief
- /// Sets whether or not data is available for the axis.
- ///
- /// This parameter is used when the best fit range is zero. If data
- /// is available, the axis generates labels around the data value.
- /// This is needed when the data points are the same value for an
- /// axis, such as a vertical or horizontal line on a line chart.
- ///
- /// \param available True if data is available.
- void setDataAvailable(bool available);
-
- /// \brief
- /// Gets whether or not the axis labels are generated from the
- /// view size.
- /// \return
- /// True if the axis labels are generated from the view size.
- bool isBestFitGenerated() const;
-
- /// \brief
- /// Sets whether or not the axis labels are generated from the
- /// view size.
- /// \param on True if the axis labels should be generated.
- void setBestFitGenerated(bool on);
-
- /// \brief
- /// Gets the value range used when generating the axis labels.
- /// \param min Used to return the minimum value.
- /// \param max Used to return the maximum value.
- void getBestFitRange(QVariant &min, QVariant &max) const;
-
- /// \brief
- /// Sets the value range used when generating the axis labels.
- /// \param min The minimum value.
- /// \param max The maximum value.
- void setBestFitRange(const QVariant &min, const QVariant &max);
-
- /// \brief
- /// Gets whether or not range padding is used.
- ///
- /// This setting only affects the best-fit layout. When range
- /// padding is used, the axis makes sure there is space between
- /// the best-fit range and the actual minimum and maximum labels.
- ///
- /// \return
- /// True if range padding is used.
- bool isRangePaddingUsed() const;
-
- /// \brief
- /// Sets whether or not range padding is used.
- /// \param padRange True if range padding should be used.
- void setRangePaddingUsed(bool padRange);
-
- /// \brief
- /// Gets whether or not the range is expanded to zero.
- ///
- /// This setting only affects the best-fit layout. If the range
- /// does not include zero, the range is expanded to include it.
- /// This is used by the bar chart to make sure the minimum bar has
- /// some length to it.
- ///
- /// \return
- /// True if the range is expanded to zero.
- bool isExpansionToZeroUsed() const;
-
- /// \brief
- /// Sets whether or not the range is expanded to zero.
- /// \param expand True if the range should be expanded to zero.
- void setExpansionToZeroUsed(bool expand);
-
- /// \brief
- /// Gets whether or not extra space is added around the axis tick
- /// marks.
- ///
- /// This setting does not affect the best-fit layout. Extra space is
- /// added before the minimum and after the maximum. This is usefull
- /// for chart objects that expand around the tick mark like the bar
- /// in a bar chart.
- ///
- /// \return
- /// True if extra space is added around the axis tick marks.
- bool isExtraSpaceUsed() const;
-
- /// \brief
- /// Sets whether or not extra space is added around the axis tick
- /// marks.
- /// \param addSpace True if space should be added around the axis
- /// tick marks.
- void setExtraSpaceUsed(bool addSpace);
-
- /// \brief
- /// Gets whether or not the space for the axis is too small.
- /// \return
- /// True if the space for the axis is too small.
- bool isSpaceTooSmall() const;
-
- /// \brief
- /// Sets whether or not the space for the axis is too small.
- /// \param tooSmall True if the space for the axis is too small.
- void setSpaceTooSmall(bool tooSmall);
- //@}
-
- /// \name Drawing Parameters
- //@{
- /// \brief
- /// Gets the chart axis drawing options.
- /// \return
- /// A pointer to the chart axis drawing options.
- vtkQtChartAxisOptions *getOptions() const {return this->Options;}
-
- /// \brief
- /// Sets the chart axis drawing options.
- ///
- /// This method sets all the axis options at once, which can prevent
- /// unnecessary view updates.
- ///
- /// \param options The new axis drawing options.
- void setOptions(const vtkQtChartAxisOptions &options);
- //@}
-
- /// \name Display Methods
- //@{
- /// \brief
- /// Used to layout the chart axis.
- ///
- /// This method must be called before the axis can be drawn.
- ///
- /// \param area The total chart area.
- void layoutAxis(const QRectF &area);
-
- /// \brief
- /// Used to adjust the bounding width for the axis.
- ///
- /// This method only affects left and right locations. It is called
- /// after the neighboring axes have been layed out. The neighboring
- /// axes may need more space to display the labels.
- void adjustAxisLayout();
-
- /// \brief
- /// Gets the space needed for the axis.
- ///
- /// If the axis is horizontal, the space needed is the preferred
- /// height. If the axis is vertical, the space needed is the
- /// preferred width. The preferred height can be obtained at any
- /// time. The preferred width is only valid after a layout.
- ///
- /// \return
- /// The space needed for the axis.
- float getPreferredSpace() const;
-
- /// \brief
- /// Gets the axis label font height.
- /// \return
- /// The axis label font height.
- float getFontHeight() const;
-
- /// \brief
- /// Gets the maximum label width.
- ///
- /// The maximum label width is only valid after a layout.
- ///
- /// \return
- /// The maximum label width.
- float getMaxLabelWidth() const;
-
- /// \brief
- /// Gets the length of the axis label tick marks.
- /// \return
- /// The length of the axis label tick marks.
- float getTickLength() const;
-
- /// \brief
- /// Gets the length of the small axis label tick marks.
- /// \return
- /// The length of the small axis label tick marks.
- float getSmallTickLength() const;
-
- /// \brief
- /// Gets the distance between the axis label and the tick mark.
- /// return
- /// The distance between the axis label and the tick mark.
- float getTickLabelSpacing() const;
-
- /// \brief
- /// Gets whether or not logarithmic scale can be used.
- /// \return
- /// True if logarithmic scale can be used.
- bool isLogScaleAvailable() const;
-
- /// \brief
- /// Paints the chart axis using the given painter.
- /// \param painter The painter to use.
- /// \param option The area to paint and the level of detail.
- /// \param widget The widget being painted.
- virtual void paint(QPainter *painter, const QStyleOptionGraphicsItem *option,
- QWidget *widget=0);
- //@}
-
- /// \name Location Methods
- //@{
- virtual QRectF boundingRect() const;
-
- /// \brief
- /// Gets the bounding rectangle for the axis.
- ///
- /// The bounding box returned is only valid after a layout. The
- /// rectangle is in chart coordinates.
- ///
- /// \return
- /// The bounding rectangle for the axis.
- QRectF getBounds() const;
-
- /// \brief
- /// Gets wether or not the given label tickmark is visible.
- /// \param index The index of the label.
- /// \return
- /// True if the given label tickmark is visible.
- bool isLabelTickVisible(int index) const;
-
- /// \brief
- /// Gets the location of the given label.
- /// \param index The index of the label.
- /// \return
- /// The location of the given label.
- float getLabelLocation(int index) const;
-
- /// \brief
- /// Gets the current axis domain.
- /// \return
- /// The current axis domain.
- AxisDomain getAxisDomain() const;
-
- /// \brief
- /// Gets whether or not the given value is in the axis domain.
- /// \param value The value to test.
- /// \return
- /// True if the given value is in the axis domain.
- bool isValueInDomain(const QVariant &value) const;
-
- /// \brief
- /// Gets the pixel location for the given value.
- ///
- /// The pixel location relates to the orientation of the axis.
- ///
- /// \param value The value to map.
- /// \return
- /// The pixel location for the given value.
- float getPixel(const QVariant &value) const;
-
- /// \brief
- /// Gets the pixel location for zero.
- ///
- /// For int and double domains, the pixel location returned is
- /// limited by the axis pixel range. For non-numeric domains, the
- /// axis minimum pixel location is returned.
- ///
- /// \return
- /// The pixel location for zero.
- float getZeroPixel() const;
- //@}
-
- /// \brief
- /// Gets whether or not logarithmic scale can be used for the
- /// given range.
- /// \param min The range minimum.
- /// \param max The range maximum.
- /// \return
- /// True if logarithmic scale can be used for the given range.
- static bool isLogScaleValid(const QVariant &min, const QVariant &max);
-
-signals:
- /// Emitted when the axis needs to be layed out again.
- void layoutNeeded();
-
- /// \brief
- /// Emitted when the pixel-value scale changes.
- ///
- /// The pixel-value scale is only modified inside the axis layout
- /// method. Charts using this signal should never emit
- /// \c layoutNeeded when responding to this signal. Instead, set a
- /// flag to use when the chart layout method is called.
- void pixelScaleChanged();
-
-public slots:
- /// Resets the chart axis view.
- void reset();
-
- /// \brief
- /// Sets the contents offset for the axis.
- /// \param offset The new contents offset.
- void setOffset(float offset);
-
-private slots:
- /// Updates the layout for the new font.
- void handleFontChange();
-
- /// Updates the labels with the new presentation.
- void handlePresentationChange();
-
- /// Updates the axis and label colors.
- void handleColorChange();
-
- /// Updates the layout for the new axis scale.
- void handleAxisScaleChange();
-
- /// \brief
- /// Adds the new label in the given location.
- /// \param index Where to insert the new label.
- void insertLabel(int index);
-
- /// \brief
- /// Cleans up the view data for the given index.
- /// \param index The label being removed.
- void startLabelRemoval(int index);
-
- /// \brief
- /// Finishes the label removal by requesting a relayout.
- /// \param index The label being removed.
- void finishLabelRemoval(int index);
-
-private:
- /// \brief
- /// Get the estimated maximum label width.
- ///
- /// This method is used when using a best-fit layout. The label
- /// width is estimated using the min and max values.
- ///
- /// \param minimum The minimum value.
- /// \param maximum The maximum value.
- /// \return
- /// The estimated maximum label width.
- float getLabelWidthGuess(const QVariant &minimum,
- const QVariant &maximum) const;
-
- /// \brief
- /// Generates labels for a linear, best-fit layout.
- /// \param contents The axis contents area.
- void generateLabels(const QRectF &contents);
-
- /// \brief
- /// Generates labels for a logarithmic, best-fit layout.
- /// \param contents The axis contents area.
- void generateLogLabels(const QRectF &contents);
-
-public:
- static const double MinLogValue; ///< Stores the log scale minimum.
-
-private:
- vtkQtChartAxisInternal *Internal; ///< Stores the view data.
- vtkQtChartAxisOptions *Options; ///< Stores the drawing options.
- vtkQtChartAxisModel *Model; ///< Stores the list of labels.
- const vtkQtChartAxis *AtMin; ///< Stores the axis at the min.
- const vtkQtChartAxis *AtMax; ///< Stores the axis at the max.
- const vtkQtChartAxis *Across; ///< Stores the parallel axis.
- const vtkQtChartContentsSpace *Zoom; ///< Stores the contents space.
- AxisLocation Location; ///< Stores the axis location.
-};
-
-#endif
diff --git a/Modules/QmitkExt/vtkQtChartHeaders/vtkQtChartAxisCornerDomain.h b/Modules/QmitkExt/vtkQtChartHeaders/vtkQtChartAxisCornerDomain.h
deleted file mode 100644
index ee08b18a9d..0000000000
--- a/Modules/QmitkExt/vtkQtChartHeaders/vtkQtChartAxisCornerDomain.h
+++ /dev/null
@@ -1,156 +0,0 @@
-/*=========================================================================
-
- Program: Visualization Toolkit
- Module: $RCSfile: vtkQtChartAxisCornerDomain.h,v $
-
- Copyright (c) Ken Martin, Will Schroeder, Bill Lorensen
- All rights reserved.
- See Copyright.txt or http://www.kitware.com/Copyright.htm for details.
-
- This software is distributed WITHOUT ANY WARRANTY; without even
- the implied warranty of MERCHANTABILITY or FITNESS FOR A PARTICULAR
- PURPOSE. See the above copyright notice for more information.
-
-=========================================================================*/
-/*-------------------------------------------------------------------------
- Copyright 2008 Sandia Corporation.
- Under the terms of Contract DE-AC04-94AL85000 with Sandia Corporation,
- the U.S. Government retains certain rights in this software.
--------------------------------------------------------------------------*/
-
-/// \file vtkQtChartAxisCornerDomain.h
-/// \date March 3, 2008
-
-#ifndef _vtkQtChartAxisCornerDomain_h
-#define _vtkQtChartAxisCornerDomain_h
-
-#include "vtkQtChartExport.h"
-#include "vtkQtChartAxis.h" // needed for enum
-
-class vtkQtChartAxisCornerDomainInternal;
-class vtkQtChartAxisDomainPriority;
-class vtkQtChartSeriesDomain;
-
-
-/// \class vtkQtChartAxisCornerDomain
-/// \brief
-/// The vtkQtChartAxisCornerDomain class is used to merge similar
-/// domains for a pair of axes.
-class VTKQTCHART_EXPORT vtkQtChartAxisCornerDomain
-{
-public:
- vtkQtChartAxisCornerDomain();
- vtkQtChartAxisCornerDomain(const vtkQtChartAxisCornerDomain &other);
- ~vtkQtChartAxisCornerDomain();
-
- /// \brief
- /// Gets the number of domains.
- ///
- /// Compatible domains are merged together. The number of domains is
- /// the number of different types of domains added to the corner.
- ///
- /// \return
- /// The number of domains.
- int getNumberOfDomains() const;
-
- /// \brief
- /// Gets the domain for the given index.
- /// \param index The domain index.
- /// \return
- /// A pointer to the domain at the given index.
- const vtkQtChartSeriesDomain *getDomain(int index) const;
-
- /// \brief
- /// Gets the domain for the given index.
- /// \param index The domain index.
- /// \return
- /// A pointer to the domain at the given index.
- vtkQtChartSeriesDomain *getDomain(int index);
-
- /// \brief
- /// Gets the best domain match for the given priorities.
- /// \param xPriority The x-axis priority.
- /// \param yPriority The y-axis priority.
- /// \return
- /// A pointer to the domain for the given priorities.
- const vtkQtChartSeriesDomain *getDomain(
- const vtkQtChartAxisDomainPriority &xPriority,
- const vtkQtChartAxisDomainPriority &yPriority) const;
-
- /// \brief
- /// Gets the best domain match for the given type and priority.
- /// \param xDomain The domain type for the x-axis.
- /// \param yPriority The y-axis priority.
- /// \return
- /// A pointer to the domain for the given type and priority.
- const vtkQtChartSeriesDomain *getDomain(
- vtkQtChartAxis::AxisDomain xDomain,
- const vtkQtChartAxisDomainPriority &yPriority) const;
-
- /// \brief
- /// Gets the best domain match for the given type and priority.
- /// \param xPriority The x-axis priority.
- /// \param yDomain The domain type for the y-axis.
- /// \return
- /// A pointer to the domain for the given type and priority.
- const vtkQtChartSeriesDomain *getDomain(
- const vtkQtChartAxisDomainPriority &xPriority,
- vtkQtChartAxis::AxisDomain yDomain) const;
-
- /// \brief
- /// Gets the best domain match for the given types.
- /// \param xDomain The domain type for the x-axis.
- /// \param yDomain The domain type for the y-axis.
- /// \param index Used to return the index of the returned domain.
- /// \return
- /// A pointer to the domain for the given types.
- const vtkQtChartSeriesDomain *getDomain(
- vtkQtChartAxis::AxisDomain xDomain,
- vtkQtChartAxis::AxisDomain yDomain, int *index=0) const;
-
- /// \brief
- /// Merges the given domain with the current domains.
- ///
- /// If the domain is compatible with one of the current domains, it
- /// is merged. Otherwise, the domain is added to the list. The index
- /// can be used to get a pointer to the combined or newly created
- /// domain.
- ///
- /// \param domain The domain to add.
- /// \param index Used to return the index where the domain was added.
- /// \return
- /// True if the new domain changed the current domains.
- bool mergeDomain(const vtkQtChartSeriesDomain &domain, int *index=0);
-
- /// \brief
- /// Removes the domain at the specified index.
- /// \param index The index to remove.
- void removeDomain(int index);
-
- /// Removes all the domains.
- void clear();
-
- /// \brief
- /// Sets the preferences for the horizontal axis.
- /// \param padRange True if the range should be padded.
- /// \param expandToZero True if the range should be expanded to zero.
- /// \param addSpace True if space should be added to the end labels.
- void setHorizontalPreferences(bool padRange, bool expandToZero,
- bool addSpace);
-
- /// \brief
- /// Sets the preferences for the vertical axis.
- /// \param padRange True if the range should be padded.
- /// \param expandToZero True if the range should be expanded to zero.
- /// \param addSpace True if space should be added to the end labels.
- void setVerticalPreferences(bool padRange, bool expandToZero,
- bool addSpace);
-
- vtkQtChartAxisCornerDomain &operator=(
- const vtkQtChartAxisCornerDomain &other);
-
-private:
- vtkQtChartAxisCornerDomainInternal *Internal; ///< Stores the domains.
-};
-
-#endif
diff --git a/Modules/QmitkExt/vtkQtChartHeaders/vtkQtChartAxisDomain.h b/Modules/QmitkExt/vtkQtChartHeaders/vtkQtChartAxisDomain.h
deleted file mode 100644
index a0b47905c5..0000000000
--- a/Modules/QmitkExt/vtkQtChartHeaders/vtkQtChartAxisDomain.h
+++ /dev/null
@@ -1,263 +0,0 @@
-/*=========================================================================
-
- Program: Visualization Toolkit
- Module: $RCSfile: vtkQtChartAxisDomain.h,v $
-
- Copyright (c) Ken Martin, Will Schroeder, Bill Lorensen
- All rights reserved.
- See Copyright.txt or http://www.kitware.com/Copyright.htm for details.
-
- This software is distributed WITHOUT ANY WARRANTY; without even
- the implied warranty of MERCHANTABILITY or FITNESS FOR A PARTICULAR
- PURPOSE. See the above copyright notice for more information.
-
-=========================================================================*/
-/*-------------------------------------------------------------------------
- Copyright 2008 Sandia Corporation.
- Under the terms of Contract DE-AC04-94AL85000 with Sandia Corporation,
- the U.S. Government retains certain rights in this software.
--------------------------------------------------------------------------*/
-
-/// \file vtkQtChartAxisDomain.h
-/// \date February 14, 2008
-
-#ifndef _vtkQtChartAxisDomain_h
-#define _vtkQtChartAxisDomain_h
-
-#include "vtkQtChartExport.h"
-#include "vtkQtChartAxis.h" // needed for enum
-#include <QList> // needed for parameter
-#include <QVariant> // needed for parameter/enum
-
-
-/// \class vtkQtChartAxisDomain
-/// \brief
-/// The vtkQtChartAxisDomain class is used to merge similar domains
-/// for an axis.
-class VTKQTCHART_EXPORT vtkQtChartAxisDomain
-{
-public:
- vtkQtChartAxisDomain();
- vtkQtChartAxisDomain(const vtkQtChartAxisDomain &other);
- ~vtkQtChartAxisDomain() {}
-
- /// \name Setup Methods
- //@{
- /// \brief
- /// Gets whether or not the domain is empty.
- ///
- /// The domain is empty if both the range and list are empty.
- ///
- /// \return
- /// True if the domain is empty.
- bool isEmpty() const;
-
- /// \brief
- /// Gets whether or not the range is inside the list.
- /// \return
- /// True if the range is inside the list.
- bool isRangeInList() const;
-
- /// \brief
- /// Gets the axis domain type.
- /// \return
- /// The axis domain type.
- vtkQtChartAxis::AxisDomain getDomainType() const;
-
- /// \brief
- /// Gets the QVariant domain type.
- /// \return
- /// The QVariant domain type.
- QVariant::Type getVariantType() const;
-
- /// \brief
- /// Gets whether or not the given type is compatible with the
- /// current domain type.
- /// \param domain The QVariant domain type.
- /// \return
- /// True if the given type is compatible with the current domain.
- bool isTypeCompatible(QVariant::Type domain) const;
-
- /// \brief
- /// Gets the current domain.
- /// \param isRange Used to return whether or not the domain is a range.
- /// \return
- /// A reference to the current domain values.
- const QList<QVariant> &getDomain(bool &isRange) const;
-
- /// \brief
- /// Sets the domain to the given range.
- /// \param range A list of two values.
- void setRange(const QList<QVariant> &range);
-
- /// \brief
- /// Sets the domain to the given list of values.
- /// \note
- /// The list should be sorted before calling this method.
- /// \param domain The list of domain values.
- void setDomain(const QList<QVariant> &domain);
-
- /// \brief
- /// Merges the given range with the current domain.
- /// \param range A list of two values.
- /// \return
- /// True if the merge was successful.
- bool mergeRange(const QList<QVariant> &range);
-
- /// \brief
- /// Merges the given list with the current domain.
- /// \note
- /// The list should be sorted before calling this method.
- /// \param domain The list of domain values.
- /// \return
- /// True if the merge was successful.
- bool mergeDomain(const QList<QVariant> &domain);
-
- /// \brief
- /// Merges the given domain with the current domain.
- ///
- /// The axis domain preferences are merged as well as the domain
- /// values.
- ///
- /// \param other The domain to merge.
- /// \return
- /// True if the merge was successful.
- bool mergeDomain(const vtkQtChartAxisDomain &other);
-
- /// Clears the domain contents.
- void clear();
- //@}
-
- /// \name Preference Methods
- //@{
- /// \brief
- /// Gets whether or not the range should be padded.
- /// \return
- /// True if the range should be padded.
- bool isRangePaddingUsed() const {return this->PadRange;}
-
- /// \brief
- /// Sets whether or not the range should be padded.
- /// \param padRange True if the range should be padded.
- void setRangePaddingUsed(bool padRange) {this->PadRange = padRange;}
-
- /// \brief
- /// Gets whether or not the range should be expanded to zero.
- /// \return
- /// True if the range should be expanded to zero.
- bool isExpansionToZeroUsed() const {return this->ExpandToZero;}
-
- /// \brief
- /// Sets whether or not the range should be expanded to zero.
- /// \param expand True if the range should be expanded to zero.
- void setExpansionToZeroUsed(bool expand) {this->ExpandToZero = expand;}
-
- /// \brief
- /// Gets whether or not space should be added to the end labels.
- /// \return
- /// True if space should be added to the end labels.
- bool isExtraSpaceUsed() const {return this->AddSpace;}
-
- /// \brief
- /// Sets whether or not space should be added to the end labels.
- /// \param addSpace True if space should be added to the end labels.
- void setExtraSpaceUsed(bool addSpace) {this->AddSpace = addSpace;}
-
- /// \brief
- /// Sets the axis preferences.
- /// \param padRange True if the range should be padded.
- /// \param expandToZero True if the range should be expanded to zero.
- /// \param addSpace True if space should be added to the end labels.
- void setPreferences(bool padRange, bool expandToZero, bool addSpace);
- //@}
-
- vtkQtChartAxisDomain &operator=(const vtkQtChartAxisDomain &other);
-
-public:
- /// \brief
- /// Translates the QVariant type to axis domain type.
- /// \param domain The QVariant domain type.
- /// \return
- /// The axis domain type.
- static vtkQtChartAxis::AxisDomain getAxisDomain(QVariant::Type domain);
-
- /// \brief
- /// Sorts the list of variants according to value.
- ///
- /// The list of variants is sorted according to value using a quick
- /// sort algorithm. The list is sorted in place and non-recursively.
- ///
- /// \param list The list of shapes to be sorted.
- static void sort(QList<QVariant> &list);
-
-private:
- /// \brief
- /// Merges the given numeric range with the current domain.
- ///
- /// The numeric values are promoted to doubles if there is a mix of
- /// int and double.
- ///
- /// \param range A list of two numbers.
- /// \return
- /// True if the merge was successful.
- bool mergeNumberRange(const QList<QVariant> &range);
-
- /// \brief
- /// Merges the given numeric list with the current domain.
- /// \param domain The list of domain numbers.
- /// \return
- /// True if the merge was successful.
- bool mergeNumberDomain(const QList<QVariant> &domain);
-
- /// \brief
- /// Merges the given string list with the current domain.
- ///
- /// New strings are appended to the list. Duplicate strings are not
- /// added.
- ///
- /// \param domain The list of domain strings.
- /// \return
- /// True if the merge was successful.
- bool mergeStringDomain(const QList<QVariant> &domain);
-
- /// \brief
- /// Merges the given date range with the current domain.
- ///
- /// The date values are promoted to date-time if there is a mix of
- /// date and date-time.
- ///
- /// \param range A list of two dates.
- /// \return
- /// True if the merge was successful.
- bool mergeDateRange(const QList<QVariant> &range);
-
- /// \brief
- /// Merges the given date list with the current domain.
- /// \param domain The list of domain dates.
- /// \return
- /// True if the merge was successful.
- bool mergeDateDomain(const QList<QVariant> &domain);
-
- /// \brief
- /// Merges the given time range with the current domain.
- /// \param range A list of two times.
- /// \return
- /// True if the merge was successful.
- bool mergeTimeRange(const QList<QVariant> &range);
-
- /// \brief
- /// Merges the given time list with the current domain.
- /// \param domain The list of domain times.
- /// \return
- /// True if the merge was successful.
- bool mergeTimeDomain(const QList<QVariant> &domain);
-
-private:
- QList<QVariant> List; ///< Stores the domain list.
- QList<QVariant> Range; ///< Stores the domain range.
- bool PadRange; ///< True if the range should be padded.
- bool ExpandToZero; ///< True if the range should be expanded to zero.
- bool AddSpace; ///< True if space should be added to the end labels.
-};
-
-#endif
diff --git a/Modules/QmitkExt/vtkQtChartHeaders/vtkQtChartAxisDomainPriority.h b/Modules/QmitkExt/vtkQtChartHeaders/vtkQtChartAxisDomainPriority.h
deleted file mode 100644
index 277af4e215..0000000000
--- a/Modules/QmitkExt/vtkQtChartHeaders/vtkQtChartAxisDomainPriority.h
+++ /dev/null
@@ -1,77 +0,0 @@
-/*=========================================================================
-
- Program: Visualization Toolkit
- Module: $RCSfile: vtkQtChartAxisDomainPriority.h,v $
-
- Copyright (c) Ken Martin, Will Schroeder, Bill Lorensen
- All rights reserved.
- See Copyright.txt or http://www.kitware.com/Copyright.htm for details.
-
- This software is distributed WITHOUT ANY WARRANTY; without even
- the implied warranty of MERCHANTABILITY or FITNESS FOR A PARTICULAR
- PURPOSE. See the above copyright notice for more information.
-
-=========================================================================*/
-/*-------------------------------------------------------------------------
- Copyright 2008 Sandia Corporation.
- Under the terms of Contract DE-AC04-94AL85000 with Sandia Corporation,
- the U.S. Government retains certain rights in this software.
--------------------------------------------------------------------------*/
-
-/// \file vtkQtChartAxisDomainPriority.h
-/// \date February 14, 2008
-
-#ifndef _vtkQtChartAxisDomainPriority_h
-#define _vtkQtChartAxisDomainPriority_h
-
-#include "vtkQtChartExport.h"
-#include <QList> // Needed for parameter and return type.
-
-
-/// \class vtkQtChartAxisDomainPriority
-/// \brief
-/// The vtkQtChartAxisDomainPriority class stores the domain
-/// priority order.
-class VTKQTCHART_EXPORT vtkQtChartAxisDomainPriority
-{
-public:
- enum DomainType
- {
- Number = 0, ///< Domain for int and double.
- Date, ///< Domain for QDate and QDateTime.
- Time, ///< Domain for QTime.
- String ///< Domain for QString.
- };
-
-public:
- vtkQtChartAxisDomainPriority();
- vtkQtChartAxisDomainPriority(const vtkQtChartAxisDomainPriority &other);
- ~vtkQtChartAxisDomainPriority() {}
-
- /// \brief
- /// Gets the default domain priority order.
- /// \return
- /// The default domain priority order.
- QList<int> getDefaultOrder() const;
-
- /// \brief
- /// Gets the current domain priority order.
- /// \return
- /// A reference to the domain priority order.
- const QList<int> &getOrder() const {return this->Order;}
-
- /// \brief
- /// Sets the domain priority order.
- /// \param order The new domain priority order.
- void setOrder(const QList<int> &order);
-
- vtkQtChartAxisDomainPriority &operator=(
- const vtkQtChartAxisDomainPriority &other);
- bool operator==(const vtkQtChartAxisDomainPriority &other) const;
- bool operator!=(const vtkQtChartAxisDomainPriority &other) const;
-
-private:
- QList<int> Order; ///< Stores the domain priority order.
-};
-
-#endif
diff --git a/Modules/QmitkExt/vtkQtChartHeaders/vtkQtChartAxisLayer.h b/Modules/QmitkExt/vtkQtChartHeaders/vtkQtChartAxisLayer.h
deleted file mode 100644
index b76e3914cb..0000000000
--- a/Modules/QmitkExt/vtkQtChartHeaders/vtkQtChartAxisLayer.h
+++ /dev/null
@@ -1,197 +0,0 @@
-/*=========================================================================
-
- Program: Visualization Toolkit
- Module: $RCSfile: vtkQtChartAxisLayer.h,v $
-
- Copyright (c) Ken Martin, Will Schroeder, Bill Lorensen
- All rights reserved.
- See Copyright.txt or http://www.kitware.com/Copyright.htm for details.
-
- This software is distributed WITHOUT ANY WARRANTY; without even
- the implied warranty of MERCHANTABILITY or FITNESS FOR A PARTICULAR
- PURPOSE. See the above copyright notice for more information.
-
-=========================================================================*/
-/*-------------------------------------------------------------------------
- Copyright 2008 Sandia Corporation.
- Under the terms of Contract DE-AC04-94AL85000 with Sandia Corporation,
- the U.S. Government retains certain rights in this software.
--------------------------------------------------------------------------*/
-
-/// \file vtkQtChartAxisLayer.h
-/// \date February 1, 2008
-
-#ifndef _vtkQtChartAxisLayer_h
-#define _vtkQtChartAxisLayer_h
-
-#include "vtkQtChartExport.h"
-#include "vtkQtChartLayer.h"
-#include "vtkQtChartAxis.h" // Needed for enum
-
-class vtkQtChartAxisDomain;
-class vtkQtChartAxisDomainPriority;
-class vtkQtChartAxisLayerItem;
-class QFont;
-class QGraphicsRectItem;
-
-
-/// \class vtkQtChartAxisLayer
-/// \brief
-/// The vtkQtChartAxisLayer class is used to display the chart axes.
-class VTKQTCHART_EXPORT vtkQtChartAxisLayer : public vtkQtChartLayer
-{
- Q_OBJECT
-
-public:
- enum AxisBehavior
- {
- ChartSelect = 0, ///< The axis labels are determined by the charts.
- BestFit, ///< The axis labels are determined by space.
- FixedInterval ///< The axis labels are fixed.
- };
-
- enum {Type = vtkQtChart_AxisLayerType};
-
-public:
- vtkQtChartAxisLayer();
- virtual ~vtkQtChartAxisLayer();
-
- /// \name Axis Methods
- //@{
- /// \brief
- /// Gets the axis in the specified location.
- /// \param location The location of the axis.
- /// \return
- /// A pointer to the specified axis.
- vtkQtChartAxis *getAxis(vtkQtChartAxis::AxisLocation location) const;
-
- /// \brief
- /// Gets the horizontal axis in the specified pair.
- /// \param axes The pair of chart axes.
- /// \return
- /// A pointer to the specified axis.
- vtkQtChartAxis *getHorizontalAxis(vtkQtChartLayer::AxesCorner axes) const;
-
- /// \brief
- /// Gets the vertical axis in the specified pair.
- /// \param axes The pair of chart axes.
- /// \return
- /// A pointer to the specified axis.
- vtkQtChartAxis *getVerticalAxis(vtkQtChartLayer::AxesCorner axes) const;
-
- /// \brief
- /// Gets the layout behavior for the specified axis.
- /// \param location The location of the axis.
- /// \return
- /// The layout behavior for the specified axis.
- AxisBehavior getAxisBehavior(vtkQtChartAxis::AxisLocation location) const;
-
- /// \brief
- /// Sets the layout behavior for the specified axis.
- /// \param location The location of the axis.
- /// \param behavior The new layout behavior.
- void setAxisBehavior(vtkQtChartAxis::AxisLocation location,
- AxisBehavior behavior);
-
- /// \brief
- /// Gets the domain priority order for the given axis.
- /// \param location The location of the axis.
- /// \return
- /// A reference to the domain priority order.
- const vtkQtChartAxisDomainPriority &getAxisDomainPriority(
- vtkQtChartAxis::AxisLocation location) const;
-
- /// \brief
- /// Sets the domain priority order for the given axis.
- /// \param location The location of the axis.
- /// \param priority The new domain priority order.
- void setAxisDomainPriority(vtkQtChartAxis::AxisLocation location,
- const vtkQtChartAxisDomainPriority &priority);
- //@}
-
- /// \brief
- /// Used to layout the chart axes.
- ///
- /// The \c area passed to this method is the total chart area. The
- /// axis layer uses the whole area to layout the axes. Once the
- /// layout is complete, the space inside the axes is passed to the
- /// other chart layers.
- ///
- /// \param area The area the axes should occupy.
- /// \sa
- /// vtkQtChartAxisLayer::getLayerBounds()
- virtual void layoutChart(const QRectF &area);
-
- /// \brief
- /// Sets the chart area that contains this layer.
- ///
- /// The contents space object for the axes is set to the one used
- /// by the chart area.
- ///
- /// \param area The new chart area.
- virtual void setChartArea(vtkQtChartArea *area);
-
- /// \brief
- /// Gets the area inside the chart axes.
- /// \return
- /// The area inside the chart axes.
- QRectF getLayerBounds() const {return this->LayerBounds;}
-
- virtual QRectF boundingRect() const;
- virtual void paint(QPainter *painter, const QStyleOptionGraphicsItem *option,
- QWidget *widget=0);
-
-public slots:
- /// Sets a flag to gather the chart domains during layout.
- void handleChartRangeChange();
-
- /// Clears the flag to gather the chart domains during layout.
- void cancelChartRangeChange();
-
-private:
- /// Sets up the axis objects for the chart.
- void setupAxesCorner();
-
- /// \brief
- /// Gets the domain type for the given axis.
- /// \param location The location of the axis.
- /// \return
- /// The axis domain type.
- vtkQtChartAxis::AxisDomain getAxisDomain(
- vtkQtChartAxis::AxisLocation location) const;
-
- /// \brief
- /// Gets the corner for the given set of axes.
- /// \param first The location of the first axis.
- /// \param second The location of the second axis.
- /// \return
- /// The corner for the given set of axes.
- vtkQtChartLayer::AxesCorner getCorner(vtkQtChartAxis::AxisLocation first,
- vtkQtChartAxis::AxisLocation second) const;
-
- /// \brief
- /// Finds the domain for the axis based on the chart domains.
- /// \param axis The location of the axis.
- /// \param neighbor The location of the neighboring axis.
- /// \param neighborDomain The domain type of the neighboring axis.
- /// \param layerDomain The chart layer domains.
- /// \param axisDomain Used to return the axis domain.
- void findAxisDomain(vtkQtChartAxis::AxisLocation axis,
- vtkQtChartAxis::AxisLocation neighbor,
- vtkQtChartAxis::AxisDomain neighborDomain,
- const vtkQtChartLayerDomain &layerDomain,
- vtkQtChartAxisDomain &axisDomain) const;
-
-private:
- QRectF LayerBounds; ///< Stores the layer bounds.
- QGraphicsRectItem *Border; ///< Draws the layer boundary.
- vtkQtChartAxis *Axis[4]; ///< Stores the axis objects.
- vtkQtChartAxisLayerItem *Option[4]; ///< Stores the axis behaviors.
- bool RangeChanged; ///< True if the range has changed.
-
-private:
- vtkQtChartAxisLayer(const vtkQtChartAxisLayer &);
- vtkQtChartAxisLayer &operator=(const vtkQtChartAxisLayer &);
-};
-
-#endif
diff --git a/Modules/QmitkExt/vtkQtChartHeaders/vtkQtChartAxisModel.h b/Modules/QmitkExt/vtkQtChartHeaders/vtkQtChartAxisModel.h
deleted file mode 100644
index be2f5813ec..0000000000
--- a/Modules/QmitkExt/vtkQtChartHeaders/vtkQtChartAxisModel.h
+++ /dev/null
@@ -1,131 +0,0 @@
-/*=========================================================================
-
- Program: Visualization Toolkit
- Module: $RCSfile: vtkQtChartAxisModel.h,v $
-
- Copyright (c) Ken Martin, Will Schroeder, Bill Lorensen
- All rights reserved.
- See Copyright.txt or http://www.kitware.com/Copyright.htm for details.
-
- This software is distributed WITHOUT ANY WARRANTY; without even
- the implied warranty of MERCHANTABILITY or FITNESS FOR A PARTICULAR
- PURPOSE. See the above copyright notice for more information.
-
-=========================================================================*/
-/*-------------------------------------------------------------------------
- Copyright 2008 Sandia Corporation.
- Under the terms of Contract DE-AC04-94AL85000 with Sandia Corporation,
- the U.S. Government retains certain rights in this software.
--------------------------------------------------------------------------*/
-
-/// \file vtkQtChartAxisModel.h
-/// \date 2/5/2008
-
-#ifndef _vtkQtChartAxisModel_h
-#define _vtkQtChartAxisModel_h
-
-
-#include "vtkQtChartExport.h"
-#include <QObject>
-
-class vtkQtChartAxisModelInternal;
-class QVariant;
-
-
-/// \class vtkQtChartAxisModel
-/// \brief
-/// The vtkQtChartAxisModel class stores the labels for a chart axis.
-class VTKQTCHART_EXPORT vtkQtChartAxisModel : public QObject
-{
- Q_OBJECT
-
-public:
- /// \brief
- /// Creates a chart axis model.
- /// \param parent The parent object.
- vtkQtChartAxisModel(QObject *parent=0);
- virtual ~vtkQtChartAxisModel();
-
- /// \brief
- /// Adds a label to the chart axis.
- /// \param label The label to add.
- void addLabel(const QVariant &label);
-
- /// \brief
- /// Adds a label to the chart axis.
- /// \param index Where to insert the label.
- /// \param label The label to add.
- void insertLabel(int index, const QVariant &label);
-
- /// \brief
- /// Removes a label from the chart axis.
- /// \param index The index of the label to remove.
- void removeLabel(int index);
-
- /// Removes all the labels from the chart axis.
- void removeAllLabels();
-
- /// \brief
- /// Blocks the model modification signals.
- ///
- /// This method should be called before making multiple changes to
- /// the model. It will prevent the view from updating before the
- /// changes are complete. Once all the changes are made, the
- /// \c finishModifyingData method should be called to notify the
- /// view of the changes.
- ///
- /// \sa vtkQtChartAxisModel::finishModifyingData()
- void startModifyingData();
-
- /// \brief
- /// Unblocks the model modification signals.
- ///
- /// The \c labelsReset signal is emitted to synchronize the view.
- ///
- /// \sa vtkQtChartAxisModel::startModifyingData()
- void finishModifyingData();
-
- /// \brief
- /// Gets the number of labels in the chart axis.
- /// \return
- /// The number of labels in the chart axis.
- int getNumberOfLabels() const;
-
- /// \brief
- /// Gets a specified chart axis label.
- /// \param index Which chart axis to get.
- /// \param label Used to return the label.
- void getLabel(int index, QVariant &label) const;
-
- /// \brief
- /// Gets the index of the given label.
- /// \param label The label value to find.
- /// \return
- /// The index of the label or -1 if not found.
- int getLabelIndex(const QVariant &label) const;
-
-signals:
- /// \brief
- /// Emitted when a new label is added.
- /// \param index Where the label was added.
- void labelInserted(int index);
-
- /// \brief
- /// Emitted before a label is removed.
- /// \param index The index being removed.
- void removingLabel(int index);
-
- /// \brief
- /// Emitted after a label is removed.
- /// \param index The index being removed.
- void labelRemoved(int index);
-
- /// Emitted when the axis labels are reset.
- void labelsReset();
-
-private:
- vtkQtChartAxisModelInternal *Internal; ///< Stores the list of labels.
- bool InModify; ///< True when blocking signals.
-};
-
-#endif
diff --git a/Modules/QmitkExt/vtkQtChartHeaders/vtkQtChartAxisOptions.h b/Modules/QmitkExt/vtkQtChartHeaders/vtkQtChartAxisOptions.h
deleted file mode 100644
index aa9e0da487..0000000000
--- a/Modules/QmitkExt/vtkQtChartHeaders/vtkQtChartAxisOptions.h
+++ /dev/null
@@ -1,279 +0,0 @@
-/*=========================================================================
-
- Program: Visualization Toolkit
- Module: $RCSfile: vtkQtChartAxisOptions.h,v $
-
- Copyright (c) Ken Martin, Will Schroeder, Bill Lorensen
- All rights reserved.
- See Copyright.txt or http://www.kitware.com/Copyright.htm for details.
-
- This software is distributed WITHOUT ANY WARRANTY; without even
- the implied warranty of MERCHANTABILITY or FITNESS FOR A PARTICULAR
- PURPOSE. See the above copyright notice for more information.
-
-=========================================================================*/
-/*-------------------------------------------------------------------------
- Copyright 2008 Sandia Corporation.
- Under the terms of Contract DE-AC04-94AL85000 with Sandia Corporation,
- the U.S. Government retains certain rights in this software.
--------------------------------------------------------------------------*/
-
-/// \file vtkQtChartAxisOptions.h
-/// \date 2/6/2008
-
-#ifndef _vtkQtChartAxisOptions_h
-#define _vtkQtChartAxisOptions_h
-
-
-#include "vtkQtChartExport.h"
-#include <QObject>
-
-#include <QColor> // Needed for member variable
-#include <QFont> // Needed for member variable
-#include <QString> // Needed for return value
-
-class QVariant;
-
-
-/// \class vtkQtChartAxisOptions
-/// \brief
-/// The vtkQtChartAxisOptions class stores the drawing options for a
-/// chart axis.
-class VTKQTCHART_EXPORT vtkQtChartAxisOptions : public QObject
-{
- Q_OBJECT
-
-public:
- enum NotationType
- {
- Standard = 0,
- Exponential,
- Engineering,
- StandardOrExponential
- };
-
- enum AxisGridColor
- {
- Lighter = 0, ///< The grid color is based on the axis color.
- Specified ///< The grid color is specified.
- };
-
- enum AxisScale
- {
- Linear, ///< Use a linear scale.
- Logarithmic ///< Use a logarithmic scale.
- };
-
-public:
- /// \brief
- /// Creates a chart axis options instance.
- /// \param parent The parent object.
- vtkQtChartAxisOptions(QObject *parent=0);
-
- /// \brief
- /// Makes a copy of another axis options instance.
- /// \param other The axis options to copy.
- vtkQtChartAxisOptions(const vtkQtChartAxisOptions &other);
- virtual ~vtkQtChartAxisOptions() {}
-
- /// \brief
- /// Gets whether or not the axis is visible.
- /// \return
- /// True if the axis is visible.
- bool isVisible() const {return this->Visible;}
-
- /// \brief
- /// Sets whether or not the axis should be visible.
- /// \param visible True if the axis should be visible.
- void setVisible(bool visible);
-
- /// \brief
- /// Gets whether or not the axis labels are visible.
- /// \return
- /// True if the axis labels are visible.
- bool areLabelsVisible() const {return this->ShowLabels;}
-
- /// \brief
- /// Sets whether or not the axis labels should be visible.
- /// \param visible True if the axis labels should be visible.
- void setLabelsVisible(bool visible);
-
- /// \brief
- /// Gets whether or not the axis grid is visible.
- /// \return
- /// True if the axis grid is visible.
- bool isGridVisible() const {return this->ShowGrid;}
-
- /// \brief
- /// Sets whether or not the axis grid should be visible.
- /// \param visible True if the axis grid should be visible.
- void setGridVisible(bool visible);
-
- /// \brief
- /// Gets the axis color.
- /// \return
- /// The axis color.
- const QColor &getAxisColor() const {return this->AxisColor;}
-
- /// \brief
- /// Sets the axis color.
- ///
- /// If the grid color is tied to the axis color, the grid
- /// color will also be set.
- ///
- /// \param color The new axis color.
- /// \sa vtkQtChartAxisOptions::setGridColorType(AxisGridColor)
- void setAxisColor(const QColor &color);
-
- /// \brief
- /// Gets the color of the axis labels.
- /// \return
- /// The color of the axis labels.
- const QColor &getLabelColor() const {return this->LabelColor;}
-
- /// \brief
- /// Sets the color of the axis labels.
- /// \param color The new axis label color.
- void setLabelColor(const QColor &color);
-
- /// \brief
- /// Gets the font used to draw the axis labels.
- /// \return
- /// The font used to draw the axis labels.
- const QFont &getLabelFont() const {return this->LabelFont;}
-
- /// \brief
- /// Sets the font used to draw the axis labels.
- /// \param font The font to use.
- void setLabelFont(const QFont &font);
-
- /// \brief
- /// Gets the axis scale (linear or logarithmic).
- /// \return
- /// The axis scale.
- AxisScale getAxisScale() const {return this->Scale;}
-
- /// \brief
- /// Sets the axis scale (linear or logarithmic).
- /// \param scale The new axis scale.
- void setAxisScale(AxisScale scale);
-
- /// \brief
- /// Gets the decimal precision of the axis labels.
- /// \return
- /// The decimal precision of the axis labels.
- /// \sa pqChartValue::getString()
- int getPrecision() const {return this->Precision;}
-
- /// \brief
- /// Sets the decimal precision of the axis labels.
- /// \param precision The number of decimal places to use.
- /// \sa pqChartValue::getString()
- void setPrecision(int precision);
-
- /// \brief
- /// Gets the notation type for the axis labels.
- /// \return
- /// The notation type for the axis labels.
- /// \sa pqChartValue::getString()
- NotationType getNotation() const {return this->Notation;}
-
- /// \brief
- /// Sets the notation type for the axis labels.
- /// \param notation The new axis notation type.
- /// \sa pqChartValue::getString()
- void setNotation(NotationType notation);
-
- /// \brief
- /// Sets the axis grid color type.
- ///
- /// The axis grid color type determines if the grid color is
- /// tied to the axis color. If the grid color type is \c Lighter,
- /// the grid color will be a lighter version of the axis color.
- ///
- /// \param type The new axis grid color type.
- void setGridColorType(AxisGridColor type);
-
- /// \brief
- /// Gets the axis grid color type.
- /// \return
- /// The axis grid color type.
- /// \sa vtkQtChartAxisOptions::setGridColorType(AxisGridColor)
- AxisGridColor getGridColorType() const {return this->GridType;}
-
- /// \brief
- /// Gets the axis grid color.
- ///
- /// If the grid color type is \c Lighter, the color returned will be
- /// a lighter version of the axis color. Otherwise, the specified
- /// color will be returned.
- ///
- /// \return
- /// The axis grid color.
- /// \sa vtkQtChartAxisOptions::setGridColorType(AxisGridColor)
- QColor getGridColor() const;
-
- /// \brief
- /// Sets the axis grid color.
- ///
- /// If the axis grid color type is \c Lighter, calling this method
- /// will not change the color used for drawing the grid. It will
- /// still set the specified grid color in case the type changes.
- ///
- /// \param color The new axis grid color.
- void setGridColor(const QColor &color);
-
- /// \brief
- /// Makes a copy of another axis options instance.
- /// \param other The axis options to copy.
- /// \return
- /// A reference to the object being assigned.
- vtkQtChartAxisOptions &operator=(const vtkQtChartAxisOptions &other);
-
- /// \brief
- /// Formats the given value according to the axis options.
- /// \param value The value to convert to a string.
- /// \return
- /// The value formatted as a string.
- QString formatValue(const QVariant &value) const;
-
-signals:
- /// Emitted when the axis or label visibility changes.
- void visibilityChanged();
-
- /// Emitted when the axis or label color changes.
- void colorChanged();
-
- /// Emitted when the label font changes.
- void fontChanged();
-
- /// Emitted when the axis scale changes.
- void axisScaleChanged();
-
- /// Emitted when the precision or notation changes.
- void presentationChanged();
-
- /// Emitted when the grid color or visibility changes.
- void gridChanged();
-
-private:
- /// Stores the axis scale type (linear or logarithmic).
- AxisScale Scale;
-
- /// Stores the axis label notation type.
- NotationType Notation;
-
- /// Stores the grid color type (lighter or specified).
- AxisGridColor GridType;
-
- QColor AxisColor; ///< Stores the axis color.
- QColor GridColor; ///< Stores the specified grid color.
- QColor LabelColor; ///< Stores the color for the axis labels.
- QFont LabelFont; ///< Stores the font for the axis labels.
- int Precision; ///< Stores axis label precision.
- bool Visible; ///< True if the axis should be drawn.
- bool ShowLabels; ///< True if the labels should be drawn.
- bool ShowGrid; ///< True if the grid should be drawn.
-};
-
-#endif
diff --git a/Modules/QmitkExt/vtkQtChartHeaders/vtkQtChartBar.h b/Modules/QmitkExt/vtkQtChartHeaders/vtkQtChartBar.h
deleted file mode 100644
index 52bcde5d2d..0000000000
--- a/Modules/QmitkExt/vtkQtChartHeaders/vtkQtChartBar.h
+++ /dev/null
@@ -1,80 +0,0 @@
-/*=========================================================================
-
- Program: Visualization Toolkit
- Module: $RCSfile: vtkQtChartBar.h,v $
-
- Copyright (c) Ken Martin, Will Schroeder, Bill Lorensen
- All rights reserved.
- See Copyright.txt or http://www.kitware.com/Copyright.htm for details.
-
- This software is distributed WITHOUT ANY WARRANTY; without even
- the implied warranty of MERCHANTABILITY or FITNESS FOR A PARTICULAR
- PURPOSE. See the above copyright notice for more information.
-
-=========================================================================*/
-/*-------------------------------------------------------------------------
- Copyright 2008 Sandia Corporation.
- Under the terms of Contract DE-AC04-94AL85000 with Sandia Corporation,
- the U.S. Government retains certain rights in this software.
--------------------------------------------------------------------------*/
-
-/// \file vtkQtChartBar.h
-/// \date November 13, 2008
-
-#ifndef _vtkQtChartBar_h
-#define _vtkQtChartBar_h
-
-#include "vtkQtChartExport.h"
-#include "vtkQtChartShape.h"
-
-
-/// \class vtkQtChartBar
-/// \brief
-/// The vtkQtChartBar class defines a bar used by the chart bar
-/// locator.
-class VTKQTCHART_EXPORT vtkQtChartBar : public vtkQtChartShape
-{
-public:
- vtkQtChartBar();
-
- /// \brief
- /// Constructs a chart bar shape.
- /// \param series The series index.
- /// \param index The index in the given series.
- vtkQtChartBar(int series, int index);
- vtkQtChartBar(const vtkQtChartBar &other);
- virtual ~vtkQtChartBar();
-
- vtkQtChartBar &operator=(const vtkQtChartBar &other);
-
- virtual void getBounds(QRectF &bounds) const;
- virtual bool contains(const QPointF &point) const;
- virtual bool intersects(const QRectF &area) const;
-
- /// \brief
- /// Sets the bar shape.
- /// \param rectangle The new bar shape.
- virtual void setRectangle(const QRectF &rectangle) {this->setBar(rectangle);}
-
- /// \brief
- /// Gets the bar shape.
- /// \return
- /// The bar rectangle.
- QRectF &getBar() {return *this->Bar;}
-
- /// \brief
- /// Gets the bar shape.
- /// \return
- /// The bar rectangle.
- const QRectF &getBar() const {return *this->Bar;}
-
- /// \brief
- /// Sets the bar shape.
- /// \param bar The new bar rectangle.
- void setBar(const QRectF &bar);
-
-private:
- QRectF *Bar; ///< Stores the rectangle.
-};
-
-#endif
diff --git a/Modules/QmitkExt/vtkQtChartHeaders/vtkQtChartBarLocator.h b/Modules/QmitkExt/vtkQtChartHeaders/vtkQtChartBarLocator.h
deleted file mode 100644
index 2894ff1cfa..0000000000
--- a/Modules/QmitkExt/vtkQtChartHeaders/vtkQtChartBarLocator.h
+++ /dev/null
@@ -1,220 +0,0 @@
-/*=========================================================================
-
- Program: Visualization Toolkit
- Module: $RCSfile: vtkQtChartBarLocator.h,v $
-
- Copyright (c) Ken Martin, Will Schroeder, Bill Lorensen
- All rights reserved.
- See Copyright.txt or http://www.kitware.com/Copyright.htm for details.
-
- This software is distributed WITHOUT ANY WARRANTY; without even
- the implied warranty of MERCHANTABILITY or FITNESS FOR A PARTICULAR
- PURPOSE. See the above copyright notice for more information.
-
-=========================================================================*/
-/*-------------------------------------------------------------------------
- Copyright 2008 Sandia Corporation.
- Under the terms of Contract DE-AC04-94AL85000 with Sandia Corporation,
- the U.S. Government retains certain rights in this software.
--------------------------------------------------------------------------*/
-
-/// \file vtkQtChartBarLocator.h
-/// \date October 1, 2008
-
-#ifndef _vtkQtChartBarLocator_h
-#define _vtkQtChartBarLocator_h
-
-#include "vtkQtChartExport.h"
-#include <QLinkedList> // Needed for parameter.
-#include <QList> // Needed for parameter.
-
-class vtkQtChartBar;
-class QPointF;
-class QRectF;
-
-
-/// \class vtkQtChartBarLocatorNode
-/// \brief
-/// The vtkQtChartBarLocatorNode class is used to build a tree of
-/// chart bar shapes.
-class VTKQTCHART_EXPORT vtkQtChartBarLocatorNode
-{
-public:
- /// \brief
- /// Constructs a chart bar locator node.
- /// \param element The chart bar element to wrap.
- vtkQtChartBarLocatorNode(vtkQtChartBar *element=0);
- ~vtkQtChartBarLocatorNode();
-
- /// \brief
- /// Gets whether or not the bounding area contains the given point.
- /// \param point The position to evaluate.
- /// \return
- /// True if the bounding area contains the given point.
- bool contains(const QPointF &point) const;
-
- /// \brief
- /// Gets whether or not the bounding area intersects the given area.
- /// \param area The rectangle to evaluate.
- /// \return
- /// True if the bounding area intersects the given area.
- bool intersects(const QRectF &area) const;
-
- /// \brief
- /// Gets the bounding rectangle.
- /// \return
- /// The bounding rectangle.
- const QRectF &getBounds() const {return *this->Bounds;}
-
- /// \brief
- /// Sets the bounding rectangle.
- /// \param bounds The new bounding rectangle.
- void setBounds(const QRectF &bounds);
-
- /// \brief
- /// Gets the chart shape element.
- /// \return
- /// A pointer to the chart shape element.
- vtkQtChartBar *getElement() const {return this->Element;}
-
- /// \brief
- /// Sets the chart shape element.
- /// \param element The new chart shape element.
- void setElement(vtkQtChartBar *element);
-
- /// \brief
- /// Gets the parent node.
- /// \return
- /// A pointer to the parent node.
- vtkQtChartBarLocatorNode *getParent() const {return this->Parent;}
-
- /// \brief
- /// Sets the parent node.
- /// \param parent The new parent node.
- void setParent(vtkQtChartBarLocatorNode *parent) {this->Parent = parent;}
-
- /// \brief
- /// Gets whether or not the node has children.
- /// \return
- /// True if the node has children.
- bool hasChildren() const {return this->First || this->Second;}
-
- /// \brief
- /// Gets the first child node.
- /// \return
- /// A pointer to the first child node.
- vtkQtChartBarLocatorNode *getFirst() const {return this->First;}
-
- /// \brief
- /// Sets the first child node.
- /// \param first The first child node.
- void setFirst(vtkQtChartBarLocatorNode *first) {this->First = first;}
-
- /// \brief
- /// Gets the second child node.
- /// \return
- /// A pointer to the second child node.
- vtkQtChartBarLocatorNode *getSecond() const {return this->Second;}
-
- /// \brief
- /// Sets the second child node.
- /// \param second The second child node.
- void setSecond(vtkQtChartBarLocatorNode *second) {this->Second = second;}
-
- /// \brief
- /// Updates the bounding rectangle.
- ///
- /// The bounding rectangle is the bounds of the element or the
- /// bounds of the child nodes.
- void updateBounds();
-
-private:
- QRectF *Bounds; ///< Stores the bounding rectangle.
- vtkQtChartBar *Element; ///< Stores the shape element.
- vtkQtChartBarLocatorNode *Parent; ///< Stores the parent node.
- vtkQtChartBarLocatorNode *First; ///< Stores the first child node.
- vtkQtChartBarLocatorNode *Second; ///< Stores the second child node.
-
-private:
- vtkQtChartBarLocatorNode(const vtkQtChartBarLocatorNode &);
- vtkQtChartBarLocatorNode &operator=(const vtkQtChartBarLocatorNode &);
-};
-
-
-/// \class vtkQtChartBarLocator
-/// \brief
-/// The vtkQtChartBarLocator class is used to locate bars in a tree
-/// structure.
-///
-/// The tree is built from a list of bars. The leaf nodes store the
-/// bars. The bounding rectangles can be updated if the layout
-/// remains unchanged.
-class VTKQTCHART_EXPORT vtkQtChartBarLocator
-{
-public:
- vtkQtChartBarLocator();
- ~vtkQtChartBarLocator();
-
- /// Removes all the tree items.
- void clear();
-
- /// \brief
- /// Builds a bar tree from the ordered list of rectangles.
- ///
- /// The bar pointers are stored by the tree and should not be
- /// deleted until the tree has been cleared.
- ///
- /// \param list The ordered list of rectangles.
- void build(const QList<vtkQtChartBar *> &list);
-
- /// \brief
- /// Updates the bounding rectangles in the bar tree.
- ///
- /// The nodes are traversed from last to first. The bounding
- /// rectangle of each node is updated using the bar if it is a leaf
- /// or the bounds of the children otherwise.
- void update();
-
- /// \brief
- /// Gets the bar at the specified point.
- /// \param point The point to search.
- /// \return
- /// A pointer to the bar at the given point.
- vtkQtChartBar *getItemAt(const QPointF &point) const;
-
- /// \brief
- /// Gets the bars in the specified rectangle.
- /// \param area The rectangle to search.
- /// \return
- /// The list of bars in the given rectangle.
- QList<vtkQtChartBar *> getItemsIn(const QRectF &area) const;
-
- /// \brief
- /// Gets the last node in the tree.
- /// \return
- /// A pointer to the last node in the tree.
- vtkQtChartBarLocatorNode *getLast();
-
- /// \brief
- /// Gets the previous node in the tree.
- /// \param node The node to search from.
- /// \return
- /// A pointer to the previous node in the tree.
- vtkQtChartBarLocatorNode *getPrevious(vtkQtChartBarLocatorNode *node);
-
-private:
- /// \brief
- /// Builds a bar tree from the ordered list of items.
- /// \param list The ordered list of items.
- void buildTree(QLinkedList<vtkQtChartBarLocatorNode *> &list) const;
-
-private:
- vtkQtChartBarLocatorNode *Root; ///< Stores the tree root.
- QList<vtkQtChartBarLocatorNode *> Items; ///< Stores the item list.
-
-private:
- vtkQtChartBarLocator(const vtkQtChartBarLocator &);
- vtkQtChartBarLocator &operator=(const vtkQtChartBarLocator &);
-};
-
-#endif
diff --git a/Modules/QmitkExt/vtkQtChartHeaders/vtkQtChartColorStyleGenerator.h b/Modules/QmitkExt/vtkQtChartHeaders/vtkQtChartColorStyleGenerator.h
deleted file mode 100644
index d0cea59303..0000000000
--- a/Modules/QmitkExt/vtkQtChartHeaders/vtkQtChartColorStyleGenerator.h
+++ /dev/null
@@ -1,148 +0,0 @@
-/*=========================================================================
-
- Program: Visualization Toolkit
- Module: $RCSfile: vtkQtChartColorStyleGenerator.h,v $
-
- Copyright (c) Ken Martin, Will Schroeder, Bill Lorensen
- All rights reserved.
- See Copyright.txt or http://www.kitware.com/Copyright.htm for details.
-
- This software is distributed WITHOUT ANY WARRANTY; without even
- the implied warranty of MERCHANTABILITY or FITNESS FOR A PARTICULAR
- PURPOSE. See the above copyright notice for more information.
-
-=========================================================================*/
-/*-------------------------------------------------------------------------
- Copyright 2008 Sandia Corporation.
- Under the terms of Contract DE-AC04-94AL85000 with Sandia Corporation,
- the U.S. Government retains certain rights in this software.
--------------------------------------------------------------------------*/
-
-/// \file vtkQtChartColorStyleGenerator.h
-/// \date September 22, 2008
-
-#ifndef _vtkQtChartColorStyleGenerator_h
-#define _vtkQtChartColorStyleGenerator_h
-
-#include "vtkQtChartExport.h"
-#include "vtkQtChartStyleGenerator.h"
-#include "vtkQtChartColors.h" // Needed for enum.
-
-class vtkQtChartColorStyleGeneratorInternal;
-
-
-/// \class vtkQtChartColorStyleGenerator
-/// \brief
-/// The vtkQtChartColorStyleGenerator class generates series drawing
-/// options using color and pen style.
-class VTKQTCHART_EXPORT vtkQtChartColorStyleGenerator :
- public vtkQtChartStyleGenerator
-{
- Q_OBJECT
-
-public:
- /// \brief
- /// Creates a color/style generator.
- /// \param parent The parent object.
- /// \param scheme The initial color scheme.
- vtkQtChartColorStyleGenerator(QObject *parent=0,
- vtkQtChartColors::ColorScheme scheme=vtkQtChartColors::Spectrum);
- virtual ~vtkQtChartColorStyleGenerator();
-
- /// \name vtkQtChartStyleGenerator Methods
- //@{
- /// \brief
- /// Gets the brush for the specified series index.
- ///
- /// If the index is greater than the internal color list, the index
- /// will be wrapped around repeating the colors.
- ///
- /// \param index The series index.
- /// \return
- /// The brush for the specified series index.
- virtual QBrush getSeriesBrush(int index) const;
-
- /// \brief
- /// Gets the pen for the specified series index.
- ///
- /// If the index is greater than the internal color list, the index
- /// will be wrapped around repeating the colors. The repeated
- /// colors will have the next pen style in the list.
- ///
- /// \param index The series index.
- /// \return
- /// The pen for the specified series index.
- virtual QPen getSeriesPen(int index) const;
- //@}
-
- /// \name Color Methods
- //@{
- /// \brief
- /// Gets the list of colors.
- /// \return
- /// A pointer to the list of colors.
- vtkQtChartColors *getColors() {return this->Colors;}
-
- /// \brief
- /// Gets the list of colors.
- /// \return
- /// A pointer to the list of colors.
- const vtkQtChartColors *getColors() const {return this->Colors;}
- //@}
-
- /// \name Pen Style Methods
- //@{
- /// \brief
- /// Gets the number of pen styles in the style list.
- /// \return
- /// The number of pen styles in the style list.
- int getNumberOfStyles() const;
-
- /// \brief
- /// Gets a pen style from the pen styles list.
- ///
- /// This method provides access to the list of styles. If the index
- /// is out of range, a default style will be returned.
- ///
- /// \param index The list index for the style.
- /// \return
- /// The pen style for the given index.
- /// \sa vtkQtChartStyleGenerator::getSeriesPen(int)
- Qt::PenStyle getPenStyle(int index) const;
-
- /// \brief
- /// Sets the pen style for the given index.
- ///
- /// This method does nothing if the index is out of range.
- ///
- /// \param index Which pen style to modify.
- /// \param style The new pen style.
- void setPenStyle(int index, Qt::PenStyle style);
-
- /// Clears the list of pen styles.
- void clearPenStyles();
-
- /// \brief
- /// Adds a pen style to the list of pen styles.
- /// \param style The new pen style to add.
- void addPenStyle(Qt::PenStyle style);
-
- /// \brief
- /// Inserts a new pen style into the list of pen styles.
- /// \param index Where to insert the new pen style.
- /// \param style The new pen style to insert.
- void insertPenStyle(int index, Qt::PenStyle style);
-
- /// \brief
- /// Removes the pen style for the given index.
- /// \param index Which pen style to remove from the list.
- void removePenStyle(int index);
- //@}
-
-private:
- /// Stores the list of pen styles.
- vtkQtChartColorStyleGeneratorInternal *Internal;
- vtkQtChartColors *Colors; ///< Stores the color list.
-};
-
-#endif
diff --git a/Modules/QmitkExt/vtkQtChartHeaders/vtkQtChartColors.h b/Modules/QmitkExt/vtkQtChartHeaders/vtkQtChartColors.h
deleted file mode 100644
index eecc6a3b93..0000000000
--- a/Modules/QmitkExt/vtkQtChartHeaders/vtkQtChartColors.h
+++ /dev/null
@@ -1,147 +0,0 @@
-/*=========================================================================
-
- Program: Visualization Toolkit
- Module: $RCSfile: vtkQtChartColors.h,v $
-
- Copyright (c) Ken Martin, Will Schroeder, Bill Lorensen
- All rights reserved.
- See Copyright.txt or http://www.kitware.com/Copyright.htm for details.
-
- This software is distributed WITHOUT ANY WARRANTY; without even
- the implied warranty of MERCHANTABILITY or FITNESS FOR A PARTICULAR
- PURPOSE. See the above copyright notice for more information.
-
-=========================================================================*/
-/*-------------------------------------------------------------------------
- Copyright 2008 Sandia Corporation.
- Under the terms of Contract DE-AC04-94AL85000 with Sandia Corporation,
- the U.S. Government retains certain rights in this software.
--------------------------------------------------------------------------*/
-
-/// \file vtkQtChartColors.h
-/// \date September 22, 2008
-
-#ifndef _vtkQtChartColors_h
-#define _vtkQtChartColors_h
-
-#include "vtkQtChartExport.h"
-#include <QColor> // Needed for return type.
-
-class vtkQtChartColorsInternal;
-
-
-/// \class vtkQtChartColors
-/// \brief
-/// The vtkQtChartColors class stores a list of colors.
-class VTKQTCHART_EXPORT vtkQtChartColors
-{
-public:
- enum ColorScheme
- {
- Spectrum = 0, ///< 7 different hues.
- Warm, ///< 6 warm colors (red to yellow).
- Cool, ///< 7 cool colors (green to purple).
- Blues, ///< 7 different blues.
- WildFlower, ///< 7 colors from blue to magenta.
- Citrus, ///< 6 colors from green to orange.
- Custom ///< User specified color scheme.
- };
-
-public:
- /// \brief
- /// Creates a chart colors instance.
- /// \param scheme The initial color scheme.
- vtkQtChartColors(ColorScheme scheme=Spectrum);
-
- /// \brief
- /// Makes a copy of another chart colors instance.
- /// \param other The chart colors to copy.
- vtkQtChartColors(const vtkQtChartColors &other);
- ~vtkQtChartColors();
-
- /// \brief
- /// Makes a copy of another chart colors instance.
- /// \param other The chart colors to copy.
- /// \return
- /// A reference to the object being assigned.
- vtkQtChartColors &operator=(const vtkQtChartColors &other);
-
- /// \brief
- /// Gets the current color scheme.
- /// \return
- /// The current color scheme.
- ColorScheme getColorScheme() const {return this->Scheme;}
-
- /// \brief
- /// Sets the color scheme.
- ///
- /// The color scheme will automatically be changed to \c Custom if
- /// the color list is modified.
- ///
- /// \param scheme The new color scheme.
- void setColorScheme(ColorScheme scheme);
-
- /// \brief
- /// Gets the number of colors in the color list.
- /// \return
- /// The number of colors in the color list.
- int getNumberOfColors() const;
-
- /// \brief
- /// Gets the color for the given index.
- /// \return
- /// The color for the given index.
- QColor getColor(int index) const;
-
- /// \brief
- /// Sets the color for the given index.
- ///
- /// This method does nothing if the index is out of range.
- ///
- /// \param index Which color to modify.
- /// \param color The new color.
- void setColor(int index, const QColor &color);
-
- /// Clears the list of colors.
- void clearColors();
-
- /// \brief
- /// Adds a color to the list of colors.
- /// \param color The new color to add.
- void addColor(const QColor &color);
-
- /// \brief
- /// Inserts a new color into the list of colors.
- /// \param index Where to insert the new color.
- /// \param color The new color to insert.
- void insertColor(int index, const QColor &color);
-
- /// \brief
- /// Removes the color for the given index.
- /// \param index Which color to remove from the list.
- void removeColor(int index);
-
-public:
- /// \brief
- /// Creates a lighter color from the given color.
- ///
- /// The \c QColor::light method does not work for black. This
- /// function uses a 3D equation in rgb space to compute the
- /// lighter color, which works for all colors including black.
- /// the factor determines how light the new color will be. The
- /// factor is used to find the point between the current color
- /// and white.
- ///
- /// \param color The starting color.
- /// \param factor A percentage (0.0 to 1.0) of the distance from
- /// the given color to white.
- /// \return
- /// The new lighter color.
- static QColor lighter(const QColor color, float factor=0.7);
-
-private:
- vtkQtChartColorsInternal *Internal; ///< Stores the color list.
- ColorScheme Scheme; ///< Stores the color scheme.
-};
-
-#endif
diff --git a/Modules/QmitkExt/vtkQtChartHeaders/vtkQtChartContentsArea.h b/Modules/QmitkExt/vtkQtChartHeaders/vtkQtChartContentsArea.h
deleted file mode 100644
index 202f255544..0000000000
--- a/Modules/QmitkExt/vtkQtChartHeaders/vtkQtChartContentsArea.h
+++ /dev/null
@@ -1,65 +0,0 @@
-/*=========================================================================
-
- Program: Visualization Toolkit
- Module: $RCSfile: vtkQtChartContentsArea.h,v $
-
- Copyright (c) Ken Martin, Will Schroeder, Bill Lorensen
- All rights reserved.
- See Copyright.txt or http://www.kitware.com/Copyright.htm for details.
-
- This software is distributed WITHOUT ANY WARRANTY; without even
- the implied warranty of MERCHANTABILITY or FITNESS FOR A PARTICULAR
- PURPOSE. See the above copyright notice for more information.
-
-=========================================================================*/
-/*-------------------------------------------------------------------------
- Copyright 2008 Sandia Corporation.
- Under the terms of Contract DE-AC04-94AL85000 with Sandia Corporation,
- the U.S. Government retains certain rights in this software.
--------------------------------------------------------------------------*/
-
-/// \file vtkQtChartContentsArea.h
-/// \date 2/8/2008
-
-#ifndef _vtkQtChartContentsArea_h
-#define _vtkQtChartContentsArea_h
-
-#include "vtkQtChartExport.h"
-#include <QGraphicsItem>
-
-#include "vtkQtChartGraphicsItemTypes.h" // needed for enum
-
-
-class VTKQTCHART_EXPORT vtkQtChartContentsArea : public QGraphicsItem
-{
-public:
- enum {Type = vtkQtChart_ContentsAreaType};
-
-public:
- vtkQtChartContentsArea(QGraphicsItem *parent=0, QGraphicsScene *scene=0);
- virtual ~vtkQtChartContentsArea() {}
-
- /// \brief
- /// Sets the x offset.
- /// \param offset The new x offset.
- void setXOffset(float offset);
-
- /// \brief
- /// Sets the y offset.
- /// \param offset The new y offset.
- void setYOffset(float offset);
-
- virtual int type() const {return vtkQtChartContentsArea::Type;}
- virtual QRectF boundingRect() const;
- virtual void paint(QPainter *painter, const QStyleOptionGraphicsItem *option,
- QWidget *widget=0);
-
-private:
- void updateMatrix();
-
-private:
- float XOffset;
- float YOffset;
-};
-
-#endif
diff --git a/Modules/QmitkExt/vtkQtChartHeaders/vtkQtChartContentsSpace.h b/Modules/QmitkExt/vtkQtChartHeaders/vtkQtChartContentsSpace.h
deleted file mode 100644
index 0ecc201372..0000000000
--- a/Modules/QmitkExt/vtkQtChartHeaders/vtkQtChartContentsSpace.h
+++ /dev/null
@@ -1,378 +0,0 @@
-/*=========================================================================
-
- Program: Visualization Toolkit
- Module: $RCSfile: vtkQtChartContentsSpace.h,v $
-
- Copyright (c) Ken Martin, Will Schroeder, Bill Lorensen
- All rights reserved.
- See Copyright.txt or http://www.kitware.com/Copyright.htm for details.
-
- This software is distributed WITHOUT ANY WARRANTY; without even
- the implied warranty of MERCHANTABILITY or FITNESS FOR A PARTICULAR
- PURPOSE. See the above copyright notice for more information.
-
-=========================================================================*/
-/*-------------------------------------------------------------------------
- Copyright 2008 Sandia Corporation.
- Under the terms of Contract DE-AC04-94AL85000 with Sandia Corporation,
- the U.S. Government retains certain rights in this software.
--------------------------------------------------------------------------*/
-
-/// \file vtkQtChartContentsSpace.h
-/// \date 2/7/2008
-
-#ifndef _vtkQtChartContentsSpace_h
-#define _vtkQtChartContentsSpace_h
-
-
-#include "vtkQtChartExport.h"
-#include <QObject>
-
-class vtkQtChartContentsSpaceInternal;
-class QPoint;
-class QPointF;
-class QRectF;
-
-
-/// \class vtkQtChartContentsSpace
-/// \brief
-/// The vtkQtChartContentsSpace class defines the contents space
-/// for a chart.
-class VTKQTCHART_EXPORT vtkQtChartContentsSpace : public QObject
-{
- Q_OBJECT
-
-public:
- enum ZoomFlags
- {
- ZoomBoth, ///< Zoom in both directions.
- ZoomXOnly, ///< Zoom only in the x-direction.
- ZoomYOnly ///< Zoom only in the y-direction.
- };
-
-public:
- /// \brief
- /// Creates a chart contents space instance.
- /// \param parent The parent object.
- vtkQtChartContentsSpace(QObject *parent=0);
- virtual ~vtkQtChartContentsSpace();
-
- /// \name Contents Methods
- //@{
- /// \brief
- /// Gets the x offset.
- /// \return
- /// The x offset.
- float getXOffset() const {return this->OffsetX;}
-
- /// \brief
- /// Gets the y offset.
- /// \return
- /// The y offset.
- float getYOffset() const {return this->OffsetY;}
-
- /// \brief
- /// Gets the maximum x offset.
- /// \return
- /// The maximum x offset.
- float getMaximumXOffset() const {return this->MaximumX;}
-
- /// \brief
- /// Gets the maximum y offset.
- /// \return
- /// The maximum y offset.
- float getMaximumYOffset() const {return this->MaximumY;}
-
- /// \brief
- /// Gets the contents width.
- /// \return
- /// The contents width.
- float getContentsWidth() const;
-
- /// \brief
- /// Gets the contents height.
- /// \return
- /// The contents height.
- float getContentsHeight() const;
-
- /// \brief
- /// Translates a point to layer contents coordinates.
- ///
- /// The point is adjusted from widget origin to layer bounds origin.
- /// The point is also translated to account for panning offset.
- ///
- /// \param point The point to translate.
- void translateToLayerContents(QPointF &point) const;
-
- /// \brief
- /// Translates a point to layer contents coordinates.
- ///
- /// The rectangle is adjusted from widget origin to layer bounds
- /// origin. The rectangle is also translated to account for panning
- /// offset.
- ///
- /// \param area The rectangle to translate.
- void translateToLayerContents(QRectF &area) const;
- //@}
-
- /// \name Size Methods
- //@{
- /// \brief
- /// Gets the width of the chart.
- /// \return
- /// The width of the chart.
- float getChartWidth() const {return this->Width;}
-
- /// \brief
- /// Gets the height of the chart.
- /// \return
- /// The height of the chart.
- float getChartHeight() const {return this->Height;}
-
- /// \brief
- /// Sets the size of the chart.
- ///
- /// The chart size must be set in order to zoom in or out. The
- /// contents size methods are only valid when the chart size is set.
- ///
- /// \param width The chart width.
- /// \param height The chart height.
- void setChartSize(float width, float height);
-
- /// \brief
- /// Gets the chart layer bounds.
- /// \param bounds Used to return the chart layer bounds.
- void getChartLayerBounds(QRectF &bounds) const;
-
- /// \brief
- /// Sets the chart layer bounds.
- /// \param bounds The chart layer bounds.
- void setChartLayerBounds(const QRectF &bounds);
- //@}
-
- /// \name Zoom Methods
- //@{
- /// \brief
- /// Gets the x-axis zoom factor.
- /// \return
- /// The x-axis zoom factor.
- float getXZoomFactor() const {return this->ZoomFactorX;}
-
- /// \brief
- /// Gets the y-axis zoom factor.
- /// \return
- /// The y-axis zoom factor.
- float getYZoomFactor() const {return this->ZoomFactorY;}
-
- /// \brief
- /// Zooms the chart to the given factor.
- /// \param factor The new zoom factor for both axes.
- /// \sa vtkQtChartContentsSpace::zoomToFactor(float, float)
- void zoomToFactor(float factor);
-
- /// \brief
- /// Zooms the chart to the given factors.
- ///
- /// The zoom factors of the chart are independent of each other. In
- /// other words, the x-axis can be zoomed to a different factor
- /// than the y-axis.
- ///
- /// When the zoom factors are changed, the new zoom viewport will
- /// be added to the zoom history. The zoom history can be navigated
- /// using the \c historyNext and \c historyPrevious methods. The
- /// user can also navigate through the history using the keyboard
- /// shortcuts.
- ///
- /// \param xFactor The x-axis zoom factor.
- /// \param yFactor The y-axis zoom factor.
- void zoomToFactor(float xFactor, float yFactor);
-
- /// \brief
- /// Zooms only the x-axis to a given factor.
- /// \param factor The x-axis zoom factor.
- /// \sa vtkQtChartContentsSpace::zoomToFactor(float, float)
- void zoomToFactorX(float factor);
-
- /// \brief
- /// Zooms only the y-axis to a given factor.
- /// \param factor The y-axis zoom factor.
- /// \sa vtkQtChartContentsSpace::zoomToFactor(float, float)
- void zoomToFactorY(float factor);
-
- /// \brief
- /// Zooms in by a predetermined factor.
- /// \param flags Used to change the interaction slightly.
- void zoomIn(ZoomFlags flags);
-
- /// \brief
- /// Zooms out by a predetermined factor.
- /// \param flags Used to change the interaction slightly.
- void zoomOut(ZoomFlags flags);
- //@}
-
- /// \name Mouse Interactions
- //@{
- /// \brief
- /// Signals the start of a mouse move interaction.
- ///
- /// While an interaction is in progress, the zoom history will not
- /// be updated. When \c finishInteraction is called, the history is
- /// updated if the zoom factors have changed.
- ///
- /// \sa vtkQtChartContentsSpace::finishInteraction()
- void startInteraction();
-
- /// \brief
- /// Gets whether or not an interaction is currently in progress.
- /// \return
- /// True if an interaction is currently in progress.
- /// \sa vtkQtChartContentsSpace::startInteraction(),
- /// vtkQtChartContentsSpace::finishInteraction()
- bool isInInteraction() const;
-
- /// \brief
- /// Signals the end of a mouse move interaction.
- /// \sa vtkQtChartContentsSpace::startInteraction()
- void finishInteraction();
- //@}
-
- /// \name History Methods
- //@{
- /// \brief
- /// Gets whether or not a previous zoom viewport is available.
- /// \return
- /// True if a previous zoom viewport is available.
- bool isHistoryPreviousAvailable() const;
-
- /// \brief
- /// Gets whether or not a forward zoom viewport is available.
- /// \return
- /// True if a forward zoom viewport is available.
- bool isHistoryNextAvailable() const;
- //@}
-
-public slots:
- /// \brief
- /// Sets the x offset.
- /// \param offset The new x offset.
- void setXOffset(float offset);
-
- /// \brief
- /// Sets the y offset.
- /// \param offset The new y offset.
- void setYOffset(float offset);
-
- /// \brief
- /// Sets the maximum x offset.
- /// \param maximum The maximum x offset.
- void setMaximumXOffset(float maximum);
-
- /// \brief
- /// Sets the maximum y offset.
- /// \param maximum The maximum y offset.
- void setMaximumYOffset(float maximum);
-
- /// Pans up by a predetermined amount.
- void panUp();
-
- /// Pans down by a predetermined amount.
- void panDown();
-
- /// Pans left by a predetermined amount.
- void panLeft();
-
- /// Pans right by a predetermined amount.
- void panRight();
-
- /// Resets the zoom factors to 1.
- void resetZoom();
-
- /// Changes the view to the next one in the history.
- void historyNext();
-
- /// Changes the view to the previous one in the history.
- void historyPrevious();
-
-public:
- /// \brief
- /// Gets the zoom factor step.
- /// \return
- /// The zoom factor step.
- /// \sa vtkQtChartContentsSpace::zoomIn(ZoomFlags),
- /// vtkQtChartContentsSpace::zoomOut(ZoomFlags)
- static float getZoomFactorStep();
-
- /// \brief
- /// Sets the zoom factor step.
- /// \param step The new zoom factor step.
- static void setZoomFactorStep(float step);
-
- /// \brief
- /// Gets the pan step.
- /// \return
- /// The pan step.
- /// \sa vtkQtChartContentsSpace::panUp(),
- /// vtkQtChartContentsSpace::panDown(),
- /// vtkQtChartContentsSpace::panLeft(),
- /// vtkQtChartContentsSpace::panRight(),
- static float getPanStep();
-
- /// \brief
- /// Sets the pan step.
- /// \param step The new pan step.
- static void setPanStep(float step);
-
-signals:
- /// \brief
- /// Emitted when the x offset has changed.
- /// \param offset The new x offset.
- void xOffsetChanged(float offset);
-
- /// \brief
- /// Emitted when the y offset has changed.
- /// \param offset The new y offset.
- void yOffsetChanged(float offset);
-
- /// \brief
- /// Emitted when the maximum offsets have changed.
- ///
- /// This signal is sent when either or both of the offsets have
- /// changed. Sending the changes as one improves the chart layout.
- ///
- /// \param xMaximum The maximum x offset.
- /// \param yMaximum The maximum y offset.
- void maximumChanged(float xMaximum, float yMaximum);
-
- /// \brief
- /// Emitted when the view history availability changes.
- /// \param available True if there is a history item available
- /// before the current one.
- void historyPreviousAvailabilityChanged(bool available);
-
- /// \brief
- /// Emitted when the view history availability changes.
- /// \param available True if there is a history item available
- /// after the current one.
- void historyNextAvailabilityChanged(bool available);
-
-private:
- /// Adds the current zoom viewport to the history.
- void addHistory();
-
-private:
- /// Keeps track of mouse position and history.
- vtkQtChartContentsSpaceInternal *Internal;
- float OffsetX; ///< Stores the x offset.
- float OffsetY; ///< Stores the y offset.
- float MaximumX; ///< Stores the maximum x offset.
- float MaximumY; ///< Stores the maximum y offset.
- float Width; ///< Stores the chart width.
- float Height; ///< Stores the chart height.
- float ZoomFactorX; ///< Stores the x-axis zoom factor.
- float ZoomFactorY; ///< Stores the y-axis zoom factor.
-
- static float ZoomFactorStep; ///< Stores the zoom factor step.
- static float PanStep; ///< Stores the pan step.
-};
-
-#endif
diff --git a/Modules/QmitkExt/vtkQtChartHeaders/vtkQtChartExport.h b/Modules/QmitkExt/vtkQtChartHeaders/vtkQtChartExport.h
deleted file mode 100644
index b3cb6d06cc..0000000000
--- a/Modules/QmitkExt/vtkQtChartHeaders/vtkQtChartExport.h
+++ /dev/null
@@ -1,42 +0,0 @@
-/*=========================================================================
-
- Program: Visualization Toolkit
- Module: $RCSfile: vtkQtChartExport.h.in,v $
-
- Copyright (c) Ken Martin, Will Schroeder, Bill Lorensen
- All rights reserved.
- See Copyright.txt or http://www.kitware.com/Copyright.htm for details.
-
- This software is distributed WITHOUT ANY WARRANTY; without even
- the implied warranty of MERCHANTABILITY or FITNESS FOR A PARTICULAR
- PURPOSE. See the above copyright notice for more information.
-
-=========================================================================*/
-/*-------------------------------------------------------------------------
- Copyright 2008 Sandia Corporation.
- Under the terms of Contract DE-AC04-94AL85000 with Sandia Corporation,
- the U.S. Government retains certain rights in this software.
--------------------------------------------------------------------------*/
-
-/// \file vtkQtChartExport.h
-/// \brief
-/// Used to switch between dll import and export on windows.
-/// \date February 1, 2008
-
-#ifndef __vtkQtChartExport_h
-#define __vtkQtChartExport_h
-
-#define VTKQTCHART_BUILD_SHARED_LIBS
-
-#if defined(WIN32) && defined(VTKQTCHART_BUILD_SHARED_LIBS)
-# if defined(vtkQtChart_EXPORTS)
-# define VTKQTCHART_EXPORT __declspec(dllexport)
-# else
-# define VTKQTCHART_EXPORT __declspec(dllimport)
-# endif
-#else
-# define VTKQTCHART_EXPORT
-#endif
-
-#endif
-
diff --git a/Modules/QmitkExt/vtkQtChartHeaders/vtkQtChartGraphicsItemTypes.h b/Modules/QmitkExt/vtkQtChartHeaders/vtkQtChartGraphicsItemTypes.h
deleted file mode 100644
index 9f030a4bc1..0000000000
--- a/Modules/QmitkExt/vtkQtChartHeaders/vtkQtChartGraphicsItemTypes.h
+++ /dev/null
@@ -1,50 +0,0 @@
-/*=========================================================================
-
- Program: Visualization Toolkit
- Module: $RCSfile: vtkQtChartGraphicsItemTypes.h,v $
-
- Copyright (c) Ken Martin, Will Schroeder, Bill Lorensen
- All rights reserved.
- See Copyright.txt or http://www.kitware.com/Copyright.htm for details.
-
- This software is distributed WITHOUT ANY WARRANTY; without even
- the implied warranty of MERCHANTABILITY or FITNESS FOR A PARTICULAR
- PURPOSE. See the above copyright notice for more information.
-
-=========================================================================*/
-/*-------------------------------------------------------------------------
- Copyright 2008 Sandia Corporation.
- Under the terms of Contract DE-AC04-94AL85000 with Sandia Corporation,
- the U.S. Government retains certain rights in this software.
--------------------------------------------------------------------------*/
-
-/// \file vtkQtChartGraphicsItemTypes.h
-/// \date June 18, 2008
-
-#ifndef _vtkQtChartGraphicsItemTypes_h
-#define _vtkQtChartGraphicsItemTypes_h
-
-#include <QGraphicsItem> // needed for variable
-
-enum vtkQtChartGraphicsItemTypes
-{
- vtkQtChart_AxisType = QGraphicsItem::UserType + 1,
- vtkQtChart_AxisItemType,
- vtkQtChart_AxisLayerType,
- vtkQtChart_BarChartType,
- vtkQtChart_BarChartItemType,
- vtkQtChart_ContentsAreaType,
- vtkQtChart_GridLayerType,
- vtkQtChart_GridLayerItemType,
- vtkQtChart_LayerType,
- vtkQtChart_LineChartType,
- vtkQtChart_LineChartItemType,
- vtkQtChart_PointMarkerType,
- vtkQtChart_PolylineItemType,
- vtkQtChart_SeriesLayerType,
- vtkQtChart_StackedChartType,
- vtkQtChart_StatisticalBoxChartType,
- vtkQtChart_StatisticalBoxChartItemType
-};
-
-#endif
diff --git a/Modules/QmitkExt/vtkQtChartHeaders/vtkQtChartGridLayer.h b/Modules/QmitkExt/vtkQtChartHeaders/vtkQtChartGridLayer.h
deleted file mode 100644
index 200946c734..0000000000
--- a/Modules/QmitkExt/vtkQtChartHeaders/vtkQtChartGridLayer.h
+++ /dev/null
@@ -1,87 +0,0 @@
-/*=========================================================================
-
- Program: Visualization Toolkit
- Module: $RCSfile: vtkQtChartGridLayer.h,v $
-
- Copyright (c) Ken Martin, Will Schroeder, Bill Lorensen
- All rights reserved.
- See Copyright.txt or http://www.kitware.com/Copyright.htm for details.
-
- This software is distributed WITHOUT ANY WARRANTY; without even
- the implied warranty of MERCHANTABILITY or FITNESS FOR A PARTICULAR
- PURPOSE. See the above copyright notice for more information.
-
-=========================================================================*/
-/*-------------------------------------------------------------------------
- Copyright 2008 Sandia Corporation.
- Under the terms of Contract DE-AC04-94AL85000 with Sandia Corporation,
- the U.S. Government retains certain rights in this software.
--------------------------------------------------------------------------*/
-
-/// \file vtkQtChartGridLayer.h
-/// \date February 1, 2008
-
-#ifndef _vtkQtChartGridLayer_h
-#define _vtkQtChartGridLayer_h
-
-#include "vtkQtChartExport.h"
-#include "vtkQtChartLayer.h"
-
-class vtkQtChartAxis;
-
-
-/// \class vtkQtChartGridLayer
-/// \brief
-/// The vtkQtChartGridLayer class is used to dislpay the chart
-/// background grid.
-class VTKQTCHART_EXPORT vtkQtChartGridLayer : public vtkQtChartLayer
-{
- Q_OBJECT
-
-public:
- enum {Type = vtkQtChart_GridLayerType};
-
-public:
- vtkQtChartGridLayer();
- virtual ~vtkQtChartGridLayer();
-
- virtual void setChartArea(vtkQtChartArea *area);
-
- virtual void layoutChart(const QRectF &area);
-
- virtual QRectF boundingRect() const;
- virtual void paint(QPainter *painter, const QStyleOptionGraphicsItem *option,
- QWidget *widget=0);
-
-public slots:
- /// \brief
- /// Sets the x-axis pan offset.
- /// \param xOffset The new x-axis pan offset.
- void setXOffset(float xOffset);
-
- /// \brief
- /// Sets the y-axis pan offset.
- /// \param yOffset The new y-axis pan offset.
- void setYOffset(float yOffset);
-
-private slots:
- /// Updates the grid when the options change.
- void handleGridChange();
-
-private:
- /// \brief
- /// Draws the grid for the given axis.
- /// \param painter The painter to use.
- /// \param axis The axis to draw.
- void drawAxisGrid(QPainter *painter, vtkQtChartAxis *axis);
-
-private:
- vtkQtChartAxis *Axis[4]; ///< Stores the axis objects.
- QSizeF *Bounds; ///< Stores the bounds.
-
-private:
- vtkQtChartGridLayer(const vtkQtChartGridLayer &);
- vtkQtChartGridLayer &operator=(const vtkQtChartGridLayer &);
-};
-
-#endif
diff --git a/Modules/QmitkExt/vtkQtChartHeaders/vtkQtChartHelpFormatter.h b/Modules/QmitkExt/vtkQtChartHeaders/vtkQtChartHelpFormatter.h
deleted file mode 100644
index 50f694ac49..0000000000
--- a/Modules/QmitkExt/vtkQtChartHeaders/vtkQtChartHelpFormatter.h
+++ /dev/null
@@ -1,76 +0,0 @@
-/*=========================================================================
-
- Program: Visualization Toolkit
- Module: $RCSfile: vtkQtChartHelpFormatter.h,v $
-
- Copyright (c) Ken Martin, Will Schroeder, Bill Lorensen
- All rights reserved.
- See Copyright.txt or http://www.kitware.com/Copyright.htm for details.
-
- This software is distributed WITHOUT ANY WARRANTY; without even
- the implied warranty of MERCHANTABILITY or FITNESS FOR A PARTICULAR
- PURPOSE. See the above copyright notice for more information.
-
-=========================================================================*/
-/*-------------------------------------------------------------------------
- Copyright 2008 Sandia Corporation.
- Under the terms of Contract DE-AC04-94AL85000 with Sandia Corporation,
- the U.S. Government retains certain rights in this software.
--------------------------------------------------------------------------*/
-
-/// \file vtkQtChartHelpFormatter.h
-/// \date June 5, 2008
-
-#ifndef _vtkQtChartHelpFormatter_h
-#define _vtkQtChartHelpFormatter_h
-
-#include "vtkQtChartExport.h"
-#include <QString> // needed for return type
-
-class QStringList;
-
-
-/// \class vtkQtChartHelpFormatter
-/// \brief
-/// The vtkQtChartHelpFormatter class is used to generate help text
-/// from a format string.
-class VTKQTCHART_EXPORT vtkQtChartHelpFormatter
-{
-public:
- vtkQtChartHelpFormatter();
-
- /// \brief
- /// Creates a help formatter instance.
- /// \param format The help string format.
- vtkQtChartHelpFormatter(const QString &format);
- ~vtkQtChartHelpFormatter() {}
-
- /// \brief
- /// Gets the help string format.
- /// \return
- /// A reference to the help string format.
- const QString &getFormat() const {return this->Format;}
-
- /// \brief
- /// Sets the help string format.
- /// \param format The help string format.
- void setFormat(const QString &format) {this->Format = format;}
-
- /// \brief
- /// Creates a help string for the given parameters.
- ///
- /// The series name replaces all instances of %s in the format
- /// string. The data list replaces %1, %2, ... %n in the format
- /// string. the list will only replace numbers up to its length.
- ///
- /// \param series The series name.
- /// \param data The list of data arguments.
- /// \return
- /// The formatted help string.
- QString getHelpText(const QString &series, const QStringList &data) const;
-
-private:
- QString Format; ///< Stores the help format.
-};
-
-#endif
diff --git a/Modules/QmitkExt/vtkQtChartHeaders/vtkQtChartInteractor.h b/Modules/QmitkExt/vtkQtChartHeaders/vtkQtChartInteractor.h
deleted file mode 100644
index 1d0f132c06..0000000000
--- a/Modules/QmitkExt/vtkQtChartHeaders/vtkQtChartInteractor.h
+++ /dev/null
@@ -1,280 +0,0 @@
-/*=========================================================================
-
- Program: Visualization Toolkit
- Module: $RCSfile: vtkQtChartInteractor.h,v $
-
- Copyright (c) Ken Martin, Will Schroeder, Bill Lorensen
- All rights reserved.
- See Copyright.txt or http://www.kitware.com/Copyright.htm for details.
-
- This software is distributed WITHOUT ANY WARRANTY; without even
- the implied warranty of MERCHANTABILITY or FITNESS FOR A PARTICULAR
- PURPOSE. See the above copyright notice for more information.
-
-=========================================================================*/
-/*-------------------------------------------------------------------------
- Copyright 2008 Sandia Corporation.
- Under the terms of Contract DE-AC04-94AL85000 with Sandia Corporation,
- the U.S. Government retains certain rights in this software.
--------------------------------------------------------------------------*/
-
-/// \file vtkQtChartInteractor.h
-/// \date 5/2/2007
-
-#ifndef _vtkQtChartInteractor_h
-#define _vtkQtChartInteractor_h
-
-
-#include "vtkQtChartExport.h"
-#include <QObject>
-
-class vtkQtChartArea;
-class vtkQtChartContentsSpace;
-class vtkQtChartInteractorInternal;
-class vtkQtChartInteractorModeList;
-class vtkQtChartMouseBox;
-class vtkQtChartMouseFunction;
-class QCursor;
-class QKeyEvent;
-class QMouseEvent;
-class QRect;
-class QWheelEvent;
-
-
-/*!
- * \class vtkQtChartInteractor
- * \brief
- * The vtkQtChartInteractor class is used to interact with a chart.
- *
- * The contents space and mouse box object used by the chart are
- * shared among the mouse functions. The contents space object is
- * used to convert widget coordinates to contents coordinates. It is
- * also used to pan and zoom the contents. The chart uses the mouse
- * box to draw a dashed rectangle on top of the chart. Mouse
- * functions can use this rectangle for selection or zooming.
- *
- * The keyboard shortcuts are as follows:
- * \code
- * Plus...................Zoom in.
- * Minus..................Zoom out.
- * Ctrl+Plus..............Horizontally zoom in.
- * Ctrl+minus.............Horizontally zoom out.
- * Alt+Plus...............Vertically zoom in.
- * Alt+minus..............Vertically zoom out.
- * Up.....................Pan up.
- * Down...................Pan down.
- * Left...................Pan left.
- * Right..................Pan right.
- * Alt+Left...............Go to previous view in the history.
- * Alt+Right..............Go to next view in the history.
- * \endcode
- */
-class VTKQTCHART_EXPORT vtkQtChartInteractor : public QObject
-{
- Q_OBJECT
-
-public:
- /// \brief
- /// Creates a chart interactor instance.
- /// \param parent The parent object.
- vtkQtChartInteractor(QObject *parent=0);
- virtual ~vtkQtChartInteractor();
-
- /// \name Setup Methods
- //@{
- /// \brief
- /// Gets the chart area.
- /// \return
- /// A pointer to the chart area.
- vtkQtChartArea *getChartArea() const {return this->ChartArea;}
-
- /// \brief
- /// Sets the chart area.
- /// \param area The new chart area.
- void setChartArea(vtkQtChartArea *area) {this->ChartArea = area;}
- //@}
-
- /// \name Configuration Methods
- //@{
- /// \brief
- /// Sets the given function on the indicated mouse button.
- ///
- /// This method clears any functions currently assigned to the
- /// given button before adding the new function.
- ///
- /// \param button The mouse button to assign the function to.
- /// \param function The mouse function to add.
- /// \param modifiers The keyboard modifiers used to activate the
- /// function.
- void setFunction(Qt::MouseButton button, vtkQtChartMouseFunction *function,
- Qt::KeyboardModifiers modifiers=Qt::NoModifier);
-
- /// \brief
- /// Sets the given function on the mouse wheel.
- /// \param function The mouse function to add.
- /// \param modifiers The keyboard modifiers used to activate the
- /// function.
- void setWheelFunction(vtkQtChartMouseFunction *function,
- Qt::KeyboardModifiers modifiers=Qt::NoModifier);
-
- /// \brief
- /// Adds the given function to the indicated mouse button.
- ///
- /// If the new function is not combinable, it will be added to its
- /// own interaction mode. If the function is combinable, it is
- /// added to the first mode that does not have the given modifiers.
- ///
- /// \param button The mouse button to assign the function to.
- /// \param function The mouse function to add.
- /// \param modifiers The keyboard modifiers used to activate the
- /// function.
- void addFunction(Qt::MouseButton button, vtkQtChartMouseFunction *function,
- Qt::KeyboardModifiers modifiers=Qt::NoModifier);
-
- /// \brief
- /// Adds the given function to the mouse wheel.
- /// \param function The mouse function to add.
- /// \param modifiers The keyboard modifiers used to activate the
- /// function.
- void addWheelFunction(vtkQtChartMouseFunction *function,
- Qt::KeyboardModifiers modifiers=Qt::NoModifier);
-
- /// \brief
- /// Removes the given function from its assigned button.
- /// \param function The mouse function to remove.
- void removeFunction(vtkQtChartMouseFunction *function);
-
- /// \brief
- /// Removes all the functions assigned to the given button.
- /// \param button The mouse button to clear.
- void removeFunctions(Qt::MouseButton button);
-
- /// Removes all the functions assigned to the mouse wheel.
- void removeWheelFunctions();
-
- /// Removes all the functions from all the buttons.
- void removeAllFunctions();
-
- /// \brief
- /// Gets the number of modes on a mouse button.
- /// \param button The mouse button.
- /// \return
- /// The number of modes on a mouse button.
- int getNumberOfModes(Qt::MouseButton button) const;
-
- /// \brief
- /// Gets the current mode for the given button.
- /// \param button The mouse button.
- /// \return
- /// The current mode for the given button.
- int getMode(Qt::MouseButton button) const;
-
- /// \brief
- /// Sets the current mode for the given button.
- /// \param button The mouse button.
- /// \param index The new interaction mode.
- void setMode(Qt::MouseButton button, int index);
-
- /// \brief
- /// Gets the number of modes on the mouse wheel.
- /// \return
- /// The number of modes on the mouse wheel.
- int getNumberOfWheelModes() const;
-
- /// \brief
- /// Gets the current mode for the mouse wheel.
- /// \return
- /// The current mode for the mouse wheel.
- int getWheelMode() const;
-
- /// \brief
- /// Sets the current mode for the mouse wheel.
- /// \param index The new interaction mode.
- void setWheelMode(int index);
- //@}
-
- /// \name Interaction Methods
- //@{
- /// \brief
- /// Handles the key press events for the chart.
- /// \param e Event specific information.
- virtual bool keyPressEvent(QKeyEvent *e);
-
- /// \brief
- /// Calls the appropriate function to handle the mouse press.
- ///
- /// The mouse button and that button's current mode are used to
- /// determine the function to call. If a function on another button
- /// owns the mouse, the event will be ignored.
- ///
- /// \param e Event specific information.
- virtual void mousePressEvent(QMouseEvent *e);
-
- /// \brief
- /// Calls the appropriate function to handle the mouse move.
- /// \param e Event specific information.
- virtual void mouseMoveEvent(QMouseEvent *e);
-
- /// \brief
- /// Calls the appropriate function to handle the mouse release.
- /// \param e Event specific information.
- virtual void mouseReleaseEvent(QMouseEvent *e);
-
- /// \brief
- /// Calls the appropriate function to handle the double click.
- /// \param e Event specific information.
- virtual void mouseDoubleClickEvent(QMouseEvent *e);
-
- /// \brief
- /// Handles the mouse wheel events for the chart.
- /// \param e Event specific information.
- virtual void wheelEvent(QWheelEvent *e);
- //@}
-
-signals:
- /// \brief
- /// Emitted when the mouse cursor needs to be changed.
- /// \param cursor The new cursor to use.
- void cursorChangeRequested(const QCursor &cursor);
-
-private slots:
- /// \brief
- /// Called to begin a new mouse state.
- ///
- /// Only one mouse function can own the mouse at one time.
- ///
- /// \param owner The mouse function requesting the mouse state.
- void beginState(vtkQtChartMouseFunction *owner);
-
- /// \brief
- /// Called to end the current mouse state.
- ///
- /// Only the current owner should end the current state.
- ///
- /// \param owner The mouse function releasing the mouse state.
- void endState(vtkQtChartMouseFunction *owner);
-
-private:
- /// \brief
- /// Adds the given function to the given list.
- /// \param list The list to add the function to.
- /// \param function The mouse function to add.
- /// \param modifiers The keyboard modifiers used to activate the
- /// function.
- void addFunction(vtkQtChartInteractorModeList *list,
- vtkQtChartMouseFunction *function, Qt::KeyboardModifiers modifiers);
-
- /// \brief
- /// Removes all the functions assigned to the given list.
- /// \param list The list of functions to clear.
- void removeFunctions(vtkQtChartInteractorModeList *list);
-
-private:
- /// Stores the mouse function configuration.
- vtkQtChartInteractorInternal *Internal;
- vtkQtChartArea *ChartArea; ///< Stores the chart area.
- Qt::KeyboardModifier XModifier; ///< Stores the zoom x-only modifier.
- Qt::KeyboardModifier YModifier; ///< Stores the zoom y-only modifier.
-};
-
-#endif
diff --git a/Modules/QmitkExt/vtkQtChartHeaders/vtkQtChartInteractorSetup.h b/Modules/QmitkExt/vtkQtChartHeaders/vtkQtChartInteractorSetup.h
deleted file mode 100644
index d4df2a0c0c..0000000000
--- a/Modules/QmitkExt/vtkQtChartHeaders/vtkQtChartInteractorSetup.h
+++ /dev/null
@@ -1,85 +0,0 @@
-/*=========================================================================
-
- Program: Visualization Toolkit
- Module: $RCSfile: vtkQtChartInteractorSetup.h,v $
-
- Copyright (c) Ken Martin, Will Schroeder, Bill Lorensen
- All rights reserved.
- See Copyright.txt or http://www.kitware.com/Copyright.htm for details.
-
- This software is distributed WITHOUT ANY WARRANTY; without even
- the implied warranty of MERCHANTABILITY or FITNESS FOR A PARTICULAR
- PURPOSE. See the above copyright notice for more information.
-
-=========================================================================*/
-/*-------------------------------------------------------------------------
- Copyright 2008 Sandia Corporation.
- Under the terms of Contract DE-AC04-94AL85000 with Sandia Corporation,
- the U.S. Government retains certain rights in this software.
--------------------------------------------------------------------------*/
-
-/// \file vtkQtChartInteractorSetup.h
-/// \date March 11, 2008
-
-#ifndef _vtkQtChartInteractorSetup_h
-#define _vtkQtChartInteractorSetup_h
-
-
-#include "vtkQtChartExport.h"
-
-class vtkQtChartArea;
-class vtkQtChartMouseSelection;
-
-
-/// \class vtkQtChartInteractorSetup
-/// \brief
-/// The vtkQtChartInteractorSetup class is used to set up the chart
-/// interactor.
-class VTKQTCHART_EXPORT vtkQtChartInteractorSetup
-{
-public:
- vtkQtChartInteractorSetup() {}
- ~vtkQtChartInteractorSetup() {}
-
- /// \brief
- /// Creates the default interactor setup for the given chart.
- ///
- /// Selection is set on the left mouse button. All the zoom
- /// functionality is added to the middle button. The panning
- /// capability is added to the right button. The separate zooming
- /// functions are accessed using keyboard modifiers.
- /// \li No modifiers: regular drag zoom.
- /// \li Control: x-only drag zoom.
- /// \li Alt: y-only drag zoom.
- /// \li Shift: zoom box.
- ///
- /// The interactor is created as a child of the chart area. The
- /// mouse functions are created as children of the interactor.
- ///
- /// \param area The chart to add the interactor to.
- /// \return
- /// A pointer to the mouse selection handler.
- static vtkQtChartMouseSelection *createDefault(vtkQtChartArea *area);
-
- /// \brief
- /// Creates an interactor with the zoom functionality on separate
- /// buttons.
- ///
- /// The panning capability is added to the left button along with
- /// selection. The left button interaction mode must be set to
- /// access the different functionality. The zoom box function is
- /// set on the right button. The rest of the zoom capability is
- /// added to the middle button. X-only and y-only zooms are
- /// accessed using the control and alt modifiers respectively. If
- /// no modifiers are pressed, regular drag zoom is activated.
- ///
- /// The interactor is created as a child of the chart area. The
- /// mouse functions are created as children of the interactor.
- ///
- /// \param area The chart to add the interactor to.
- /// \return
- /// A pointer to the mouse selection handler.
- static vtkQtChartMouseSelection *createSplitZoom(vtkQtChartArea *area);
-};
-
-#endif
diff --git a/Modules/QmitkExt/vtkQtChartHeaders/vtkQtChartLayer.h b/Modules/QmitkExt/vtkQtChartHeaders/vtkQtChartLayer.h
deleted file mode 100644
index 803d82abd6..0000000000
--- a/Modules/QmitkExt/vtkQtChartHeaders/vtkQtChartLayer.h
+++ /dev/null
@@ -1,152 +0,0 @@
-/*=========================================================================
-
- Program: Visualization Toolkit
- Module: $RCSfile: vtkQtChartLayer.h,v $
-
- Copyright (c) Ken Martin, Will Schroeder, Bill Lorensen
- All rights reserved.
- See Copyright.txt or http://www.kitware.com/Copyright.htm for details.
-
- This software is distributed WITHOUT ANY WARRANTY; without even
- the implied warranty of MERCHANTABILITY or FITNESS FOR A PARTICULAR
- PURPOSE. See the above copyright notice for more information.
-
-=========================================================================*/
-/*-------------------------------------------------------------------------
- Copyright 2008 Sandia Corporation.
- Under the terms of Contract DE-AC04-94AL85000 with Sandia Corporation,
- the U.S. Government retains certain rights in this software.
--------------------------------------------------------------------------*/
-
-/// \file vtkQtChartLayer.h
-/// \date February 1, 2008
-
-#ifndef _vtkQtChartLayer_h
-#define _vtkQtChartLayer_h
-
-#include "vtkQtChartExport.h"
-#include <QObject>
-#include <QGraphicsItem>
-
-#include "vtkQtChartGraphicsItemTypes.h" // needed for enum
-
-class vtkQtChartAxis;
-class vtkQtChartLayerDomain;
-class vtkQtChartArea;
-class QPainter;
-
-
-/// \class vtkQtChartLayer
-/// \brief
-/// The vtkQtChartLayer class is the base class for all chart
-/// drawing layers.
-class VTKQTCHART_EXPORT vtkQtChartLayer : public QObject, public QGraphicsItem
-{
- Q_OBJECT
-
-public:
- enum AxesCorner
- {
- BottomLeft = 0, ///< Uses the bottom and left axes.
- BottomRight, ///< Uses the bottom and right axes.
- TopLeft, ///< Uses the top and left axes.
- TopRight ///< Uses the top and right axes.
- };
-
- enum {Type = vtkQtChart_LayerType};
-
-public:
- vtkQtChartLayer();
- virtual ~vtkQtChartLayer() {}
-
- virtual int type() const {return vtkQtChartLayer::Type;}
-
- /// \brief
- /// Gets the chart area containing this layer.
- /// \return
- /// A pointer to the chart area.
- vtkQtChartArea *getChartArea() const {return this->ChartArea;}
-
- /// \brief
- /// Sets the chart area that contains this layer.
- ///
- /// The chart area will call this method when the layer is added to
- /// it. The layer can overload this method to perform any setup it
- /// needs to.
- ///
- /// \param area The new chart area.
- virtual void setChartArea(vtkQtChartArea *area) {this->ChartArea = area;}
-
- /// \brief
- /// Gets the chart layer's domain.
- ///
- /// The layer should use the \c mergeDomain method of the \c domain
- /// parameter to add its domains. The domains from all of the chart
- /// layers will be combined using the \c domain object.
- ///
- /// \param domain Used to return the chart layer's domain.
- virtual void getLayerDomain(vtkQtChartLayerDomain &domain) const;
-
- /// \brief
- /// Used to layout the chart layer.
- ///
- /// Use the \c AxisDomain from the relevant axes to determine if
- /// the chart data can be displayed. The domain priority for the
- /// axes can override a layer's desired domain.
- ///
- /// \param area The area the chart should occupy.
- virtual void layoutChart(const QRectF &area)=0;
-
- /// \brief
- /// Used to filter items while drawing.
- ///
- /// Items can be filtered in two ways. First, this method can
- /// return true to skip drawing the item. Second, the painter can
- /// be modified to clip the item. The default implementation simply
- /// returns false.
- ///
- /// \note
- /// The painter is in scene coordinates when passed in. It will
- /// be transformed to item coordinates after this call. To clip
- /// in item coordinates, use the item's paint method.
- /// \param item One of the layer's child items.
- /// \param painter The painter used to draw the item.
- /// \return
- /// True if the item should not be drawn.
- virtual bool drawItemFilter(QGraphicsItem *item, QPainter *painter);
-
- /// \brief
- /// Gets the help text for the given location.
- ///
- /// When the chart receives a help event, the layers are searched,
- /// in order, for help text at the help event location. If a layer
- /// has an item at the location, it should return true.
- ///
- /// \param point The help location in scene coordinates.
- /// \param text Used to return the help text.
- /// \return
- /// True if help text is found for the given location.
- virtual bool getHelpText(const QPointF &point, QString &text);
-
- /// Notifies the chart layer that a resize interaction has started.
- virtual void startInteractiveResize() {}
-
- /// Notifies the chart layer that a resize interaction has finished.
- virtual void finishInteractiveResize() {}
-
-signals:
- /// Emitted when the layer layout needs to be calculated.
- void layoutNeeded();
-
- /// \brief
- /// Emitted when the axis range for the layer has changed.
- /// \note
- /// This signal should be emitted before the \c layoutNeeded
- /// signal to be effective.
- void rangeChanged();
-
-protected:
- vtkQtChartArea *ChartArea; ///< Stores the containing chart area.
-};
-
-#endif
diff --git a/Modules/QmitkExt/vtkQtChartHeaders/vtkQtChartLayerDomain.h b/Modules/QmitkExt/vtkQtChartHeaders/vtkQtChartLayerDomain.h
deleted file mode 100644
index c122a117fe..0000000000
--- a/Modules/QmitkExt/vtkQtChartHeaders/vtkQtChartLayerDomain.h
+++ /dev/null
@@ -1,66 +0,0 @@
-/*=========================================================================
-
- Program: Visualization Toolkit
- Module: $RCSfile: vtkQtChartLayerDomain.h,v $
-
- Copyright (c) Ken Martin, Will Schroeder, Bill Lorensen
- All rights reserved.
- See Copyright.txt or http://www.kitware.com/Copyright.htm for details.
-
- This software is distributed WITHOUT ANY WARRANTY; without even
- the implied warranty of MERCHANTABILITY or FITNESS FOR A PARTICULAR
- PURPOSE. See the above copyright notice for more information.
-
-=========================================================================*/
-/*-------------------------------------------------------------------------
- Copyright 2008 Sandia Corporation.
- Under the terms of Contract DE-AC04-94AL85000 with Sandia Corporation,
- the U.S. Government retains certain rights in this software.
--------------------------------------------------------------------------*/
-
-/// \file vtkQtChartLayerDomain.h
-/// \date March 4, 2008
-
-#ifndef _vtkQtChartLayerDomain_h
-#define _vtkQtChartLayerDomain_h
-
-#include "vtkQtChartExport.h"
-#include "vtkQtChartLayer.h" // needed for enum
-
-class vtkQtChartAxisCornerDomain;
-
-
-/// \class vtkQtChartLayerDomain
-/// \brief
-/// The vtkQtChartLayerDomain class is used to merge chart layer
-/// domains.
-class VTKQTCHART_EXPORT vtkQtChartLayerDomain
-{
-public:
- vtkQtChartLayerDomain();
- ~vtkQtChartLayerDomain();
-
- /// \brief
- /// Gets the domain for the specified corner.
- /// \param corner The chart corner.
- /// \return
- /// A pointer to the merged domain for the specified corner.
- const vtkQtChartAxisCornerDomain *getDomain(
- vtkQtChartLayer::AxesCorner corner) const;
-
- /// \brief
- /// Merges the domain for the given corner with the current
- /// domains.
- /// \param domain The domain to add.
- /// \param corner The chart corner for the domain.
- void mergeDomain(const vtkQtChartAxisCornerDomain &domain,
- vtkQtChartLayer::AxesCorner corner);
-
- /// Removes all the domains.
- void clear();
-
-private:
- vtkQtChartAxisCornerDomain *Domains[4]; ///< Stores the domains.
-};
-
-#endif
diff --git a/Modules/QmitkExt/vtkQtChartHeaders/vtkQtChartLegend.h b/Modules/QmitkExt/vtkQtChartHeaders/vtkQtChartLegend.h
deleted file mode 100755
index 34e4694a56..0000000000
--- a/Modules/QmitkExt/vtkQtChartHeaders/vtkQtChartLegend.h
+++ /dev/null
@@ -1,246 +0,0 @@
-/*=========================================================================
-
- Program: Visualization Toolkit
- Module: $RCSfile: vtkQtChartLegend.h,v $
-
- Copyright (c) Ken Martin, Will Schroeder, Bill Lorensen
- All rights reserved.
- See Copyright.txt or http://www.kitware.com/Copyright.htm for details.
-
- This software is distributed WITHOUT ANY WARRANTY; without even
- the implied warranty of MERCHANTABILITY or FITNESS FOR A PARTICULAR
- PURPOSE. See the above copyright notice for more information.
-
-=========================================================================*/
-/*-------------------------------------------------------------------------
- Copyright 2008 Sandia Corporation.
- Under the terms of Contract DE-AC04-94AL85000 with Sandia Corporation,
- the U.S. Government retains certain rights in this software.
--------------------------------------------------------------------------*/
-
-/// \file vtkQtChartLegend.h
-/// \date February 12, 2008
-
-#ifndef _vtkQtChartLegend_h
-#define _vtkQtChartLegend_h
-
-
-#include "vtkQtChartExport.h"
-#include <QWidget>
-
-class vtkQtChartLegendInternal;
-class vtkQtChartLegendModel;
-class QFont;
-class QPainter;
-class QPoint;
-class QRect;
-
-
-/// \class vtkQtChartLegend
-/// \brief
-/// The vtkQtChartLegend class displays a chart legend.
-///
-/// A vtkQtChartLegendModel is used to describe the entries. Each entry
-/// can have an icon and a label. The icon is used to visually
-/// identify the series on the chart. For a line chart series, the
-/// image should be drawn in the same color and line style.
-class VTKQTCHART_EXPORT vtkQtChartLegend : public QWidget
-{
- Q_OBJECT
-
-public:
- enum LegendLocation
- {
- Left = 0, ///< Place the legend on the left of the chart.
- Top, ///< Place the legend on the top of the chart.
- Right, ///< Place the legend on the right of the chart.
- Bottom ///< Place the legend on the bottom of the chart.
- };
-
- enum ItemFlow
- {
- LeftToRight = 0, ///< Items are arranged left to right.
- TopToBottom ///< Items are arranged top to bottom.
- };
-
-public:
- /// \brief
- /// Creates a chart legend instance.
- /// \param parent The parent widget.
- vtkQtChartLegend(QWidget *parent=0);
- virtual ~vtkQtChartLegend();
-
- /// \name Setup Methods
- //@{
- /// \brief
- /// Gets the legend model.
- /// \return
- /// A pointer to the legend model.
- vtkQtChartLegendModel *getModel() const {return this->Model;}
-
- /// \brief
- /// Gets the legend location.
- /// \return
- /// The legend location.
- LegendLocation getLocation() const {return this->Location;}
-
- /// \brief
- /// Sets the legend location.
- ///
- /// The chart uses the location to place the legend in the
- /// appropriate place. The combination of location and flow
- /// determine how the legend looks.
- ///
- /// \param location The new legend location.
- void setLocation(LegendLocation location);
-
- /// \brief
- /// Gets the legend item flow.
- /// \return
- /// The legend item flow.
- ItemFlow getFlow() const {return this->Flow;}
-
- /// \brief
- /// Sets the legend item flow.
- ///
- /// The flow is used to determine the layout direction of the
- /// legend entries. Depending on the location, the same flow type
- /// can look different.
- ///
- /// \param flow The new item flow.
- void setFlow(ItemFlow flow);
- //@}
-
- /// \brief
- /// Gets the panning offset.
- /// \return
- /// The current panning offset.
- int getOffset() const;
-
- /// \brief
- /// Gets the preferred size of the chart legend.
- /// \return
- /// The preferred size of the chart legend.
- virtual QSize sizeHint() const {return this->Bounds;}
-
- /// \brief
- /// Draws the legend using the given painter.
- /// \param painter The painter to use.
- void drawLegend(QPainter &painter);
-
-signals:
- /// Emitted when the legend location is changed.
- void locationChanged();
-
-public slots:
- /// Resets the chart legend.
- void reset();
-
- /// \brief
- /// Sets the visibility for the given entry.
- /// \param index The legend index of the entry.
- /// \param visible True if the entry should be visible.
- void setEntryVisible(int index, bool visible);
-
- /// \brief
- /// Sets the visibility for the given set of entries.
- /// \param first The first index of the entry range.
- /// \param last The last index of the entry range.
- /// \param visible True if the entry should be visible.
- void setEntriesVisible(int first, int last, bool visible);
-
- /// \brief
- /// Sets the panning offset.
- ///
- /// The offset is applied to the x or y axis depending on the
- /// legend's location.
- ///
- /// \param offset The new panning offset.
- void setOffset(int offset);
-
-protected slots:
- /// \brief
- /// Inserts a new entry in the legend.
- /// \param index Where to insert the entry.
- void insertEntry(int index);
-
- /// \brief
- /// Starts the entry removal process.
- /// \param index The entry being removed.
- void startEntryRemoval(int index);
-
- /// \brief
- /// Finishes the entry removal process.
- /// \param index The entry that was removed.
- void finishEntryRemoval(int index);
-
- /// \brief
- /// Updates the text for the given entry.
- /// \param index The index of the modified entry.
- void updateEntryText(int index);
-
-protected:
- /// \brief
- /// Updates the layout when the font changes.
- /// \param e Event specific information.
- /// \return
- /// True if the event was handled.
- virtual bool event(QEvent *e);
-
- /// \brief
- /// Draws the chart title.
- /// \param e Event specific information.
- virtual void paintEvent(QPaintEvent *e);
-
- /// \brief
- /// Updates the maximum offset when the size changes.
- /// \param e Event specific information.
- virtual void resizeEvent(QResizeEvent *e);
-
- /// \brief
- /// Used for panning the contents of the legend.
- ///
- /// The widget cursor is set for panning.
- ///
- /// \param e Event specific information.
- virtual void mousePressEvent(QMouseEvent *e);
-
- /// \brief
- /// Used for panning the contents of the legend.
- ///
- /// The conents are moved by changing the offset.
- ///
- /// \param e Event specific information.
- virtual void mouseMoveEvent(QMouseEvent *e);
-
- /// \brief
- /// Used for panning the contents of the legend.
- ///
- /// The widget cursor is reset after panning.
- ///
- /// \param e Event specific information.
- virtual void mouseReleaseEvent(QMouseEvent *e);
-
-private:
- /// Calculates the preferred size of the chart legend.
- void calculateSize();
-
- /// Sets the maximum offset using the contents size.
- void updateMaximum();
-
-private:
- vtkQtChartLegendInternal *Internal; ///< Stores the graphical items.
- vtkQtChartLegendModel *Model; ///< A pointer to the model.
- LegendLocation Location; ///< Stores the legend location.
- ItemFlow Flow; ///< Stores the order of the items.
- QSize Bounds; ///< Stores the prefered size.
- int IconSize; ///< Stores the icon size.
- int TextSpacing; ///< The space between icon and text.
- int Margin; ///< The margin around the entries.
-
-private:
- vtkQtChartLegend(const vtkQtChartLegend &);
- vtkQtChartLegend &operator=(const vtkQtChartLegend &);
-};
-
-#endif
diff --git a/Modules/QmitkExt/vtkQtChartHeaders/vtkQtChartLegendManager.h b/Modules/QmitkExt/vtkQtChartHeaders/vtkQtChartLegendManager.h
deleted file mode 100644
index 528f2f6cbf..0000000000
--- a/Modules/QmitkExt/vtkQtChartHeaders/vtkQtChartLegendManager.h
+++ /dev/null
@@ -1,172 +0,0 @@
-/*=========================================================================
-
- Program: Visualization Toolkit
- Module: $RCSfile: vtkQtChartLegendManager.h,v $
-
- Copyright (c) Ken Martin, Will Schroeder, Bill Lorensen
- All rights reserved.
- See Copyright.txt or http://www.kitware.com/Copyright.htm for details.
-
- This software is distributed WITHOUT ANY WARRANTY; without even
- the implied warranty of MERCHANTABILITY or FITNESS FOR A PARTICULAR
- PURPOSE. See the above copyright notice for more information.
-
-=========================================================================*/
-/*-------------------------------------------------------------------------
- Copyright 2008 Sandia Corporation.
- Under the terms of Contract DE-AC04-94AL85000 with Sandia Corporation,
- the U.S. Government retains certain rights in this software.
--------------------------------------------------------------------------*/
-
-/// \file vtkQtChartLegendManager.h
-/// \date January 8, 2009
-
-#ifndef _vtkQtChartLegendManager_h
-#define _vtkQtChartLegendManager_h
-
-#include "vtkQtChartExport.h"
-#include <QObject>
-
-class vtkQtChartArea;
-class vtkQtChartLayer;
-class vtkQtChartLegend;
-class vtkQtChartLegendManagerInternal;
-class vtkQtChartLegendModel;
-class vtkQtChartSeriesLayer;
-class vtkQtChartSeriesModel;
-
-
-/// \class vtkQtChartLegendManager
-/// \brief
-/// The vtkQtChartLegendManager class builds a chart legend from the
-/// chart series layers.
-class VTKQTCHART_EXPORT vtkQtChartLegendManager : public QObject
-{
- Q_OBJECT
-
-public:
- /// \brief
- /// Creates a chart legend manager instance.
- /// \param parent The parent object.
- vtkQtChartLegendManager(QObject *parent=0);
- virtual ~vtkQtChartLegendManager();
-
- /// \name Setup Methods
- //@{
- /// \brief
- /// Sets the chart area that holds the chart series layers.
- /// \param area The new chart area.
- void setChartArea(vtkQtChartArea *area);
-
- /// \brief
- /// Sets the chart legend to manage.
- /// \param legend The new chart legend.
- void setChartLegend(vtkQtChartLegend *legend);
- //@}
-
-public slots:
- /// \brief
- /// Inserts a chart layer at the given index.
- /// \param index The index of the layer.
- /// \param chart The chart layer that was inserted.
- void insertLayer(int index, vtkQtChartLayer *chart);
-
- /// \brief
- /// Removes the specified chart layer from the list.
- /// \param index The index of the layer.
- /// \param chart The chart layer that will be removed.
- void removeLayer(int index, vtkQtChartLayer *chart);
-
- /// \brief
- /// Sets the visibility for the series in the given chart layer.
- /// \param chart The chart layer.
- /// \param visible True if the layer series should be visible.
- void setLayerVisible(vtkQtChartLayer *chart, bool visible);
-
-private slots:
- /// \brief
- /// Changes the series model for a series layer.
- /// \param previous The previous series model.
- /// \param current The current series model.
- void changeModel(vtkQtChartSeriesModel *previous,
- vtkQtChartSeriesModel *current);
-
- /// \brief
- /// Sets the visibility for the given series.
- /// \param series The chart series index.
- /// \param visible True if the series should be visible.
- void updateSeriesVisibility(int series, bool visible);
-
- /// \brief
- /// Updates the legend model for series changes.
- /// \param first The first index of the series range.
- /// \param last The last index of the series range.
- void updateModelEntries(int first, int last);
-
- /// Inserts all the series for the model sending the signal.
- void insertModelEntries();
-
- /// \brief
- /// Inserts the given series for the model sending the signal.
- /// \param first The first index of the series range.
- /// \param last The last index of the series range.
- void insertModelEntries(int first, int last);
-
- /// Removes all the series for the model sending the signal.
- void removeModelEntries();
-
- /// \brief
- /// Removes the given series for the model sending the signal.
- /// \param first The first index of the series range.
- /// \param last The last index of the series range.
- void removeModelEntries(int first, int last);
-
-private:
- /// \brief
- /// Gets the starting legend index for the given chart layer.
- /// \param chart The chart series layer.
- /// \return
- /// The starting legend index for the given chart layer.
- int getLegendIndex(vtkQtChartSeriesLayer *chart);
-
- /// \brief
- /// Gets the starting legend index for the given chart model.
- /// \param model The chart series model.
- /// \param chart Used to return the model's chart layer.
- /// \return
- /// The starting legend index for the given chart model.
- int getLegendIndex(vtkQtChartSeriesModel *model,
- vtkQtChartSeriesLayer **chart=0);
-
- /// \brief
- /// Inserts entries into the chart legend.
- /// \param legend The chart legend model to modify.
- /// \param index The starting legend index for the chart layer.
- /// \param chart The chart series layer.
- /// \param model The chart series model.
- /// \param first The first model index in the series range.
- /// \param last The last model index in the series range.
- void insertLegendEntries(vtkQtChartLegendModel *legend, int index,
- vtkQtChartSeriesLayer *chart, vtkQtChartSeriesModel *model,
- int first, int last);
-
- /// \brief
- /// Removes entries from the chart legend.
- /// \param legend The chart legend model to modify.
- /// \param index The starting legend index for the chart layer.
- /// \param first The first model index in the series range.
- /// \param last The last model index in the series range.
- void removeLegendEntries(vtkQtChartLegendModel *legend, int index,
- int first, int last);
-
-private:
- vtkQtChartLegendManagerInternal *Internal; ///< Stores the layers.
- vtkQtChartArea *Area; ///< Stores the chart area.
- vtkQtChartLegend *Legend; ///< Stores the chart legend.
-
-private:
- vtkQtChartLegendManager(const vtkQtChartLegendManager &);
- vtkQtChartLegendManager &operator=(const vtkQtChartLegendManager &);
-};
-
-#endif
diff --git a/Modules/QmitkExt/vtkQtChartHeaders/vtkQtChartLegendModel.h b/Modules/QmitkExt/vtkQtChartHeaders/vtkQtChartLegendModel.h
deleted file mode 100755
index e4df3316df..0000000000
--- a/Modules/QmitkExt/vtkQtChartHeaders/vtkQtChartLegendModel.h
+++ /dev/null
@@ -1,173 +0,0 @@
-/*=========================================================================
-
- Program: Visualization Toolkit
- Module: $RCSfile: vtkQtChartLegendModel.h,v $
-
- Copyright (c) Ken Martin, Will Schroeder, Bill Lorensen
- All rights reserved.
- See Copyright.txt or http://www.kitware.com/Copyright.htm for details.
-
- This software is distributed WITHOUT ANY WARRANTY; without even
- the implied warranty of MERCHANTABILITY or FITNESS FOR A PARTICULAR
- PURPOSE. See the above copyright notice for more information.
-
-=========================================================================*/
-/*-------------------------------------------------------------------------
- Copyright 2008 Sandia Corporation.
- Under the terms of Contract DE-AC04-94AL85000 with Sandia Corporation,
- the U.S. Government retains certain rights in this software.
--------------------------------------------------------------------------*/
-
-/// \file vtkQtChartLegendModel.h
-/// \date February 12, 2008
-
-#ifndef _vtkQtChartLegendModel_h
-#define _vtkQtChartLegendModel_h
-
-
-#include "vtkQtChartExport.h"
-#include <QObject>
-#include <QPixmap> // Needed for return type
-#include <QString> // Needed for return type
-
-class vtkQtChartLegendModelInternal;
-class vtkQtPointMarker;
-class QPen;
-
-
-/// \class vtkQtChartLegendModel
-/// \brief
-/// The vtkQtChartLegendModel class stores the data for a chart legend.
-class VTKQTCHART_EXPORT vtkQtChartLegendModel : public QObject
-{
- Q_OBJECT
-
-public:
- /// \brief
- /// Creates a chart legend model.
- /// \param parent The parent object.
- vtkQtChartLegendModel(QObject *parent=0);
- virtual ~vtkQtChartLegendModel();
-
- /// \brief
- /// Adds an entry to the chart legend.
- /// \param icon The series identifying image.
- /// \param text The series label.
- /// \return
- /// The id for the inserted entry or zero for failure.
- int addEntry(const QPixmap &icon, const QString &text);
-
- /// \brief
- /// Inserts an entry into the chart legend.
- /// \param index Where to place the new entry.
- /// \param icon The series identifying image.
- /// \param text The series label.
- /// \return
- /// The id for the inserted entry or zero for failure.
- int insertEntry(int index, const QPixmap &icon, const QString &text);
-
- /// \brief
- /// Removes an entry from the chart legend.
- /// \param index The index of the entry to remove.
- void removeEntry(int index);
-
- /// Removes all the entries from the legend.
- void removeAllEntries();
-
- /// \brief
- /// Blocks the model modification signals.
- ///
- /// This method should be called before making multiple changes to
- /// the model. It will prevent the view from updating before the
- /// changes are complete. Once all the changes are made, the
- /// \c finishModifyingData method should be called to notify the
- /// view of the changes.
- ///
- /// \sa vtkQtChartLegendModel::finishModifyingData()
- void startModifyingData();
-
- /// \brief
- /// Unblocks the model modification signals.
- ///
- /// The \c entriesReset signal is emitted to synchronize the view.
- ///
- /// \sa vtkQtChartLegendModel::startModifyingData()
- void finishModifyingData();
-
- /// \brief
- /// Gets the number of entries in the legend.
- /// \return
- /// The number of entries in the legend.
- int getNumberOfEntries() const;
-
- /// \brief
- /// Gets the index for the given id.
- /// \param id The entry identifier.
- /// \return
- /// The index for the entry that matches the id or -1 if there is
- /// no matching entry.
- int getIndexForId(unsigned int id) const;
-
- /// \brief
- /// Gets the icon for the given index.
- /// \param index The index of the entry.
- /// \return
- /// The icon for the given index or a null pixmap if the index is
- /// out of bounds.
- QPixmap getIcon(int index) const;
-
- /// \brief
- /// Sets the icon for the given index.
- /// \param index The index of the entry.
- /// \param icon The new series icon.
- void setIcon(int index, const QPixmap &icon);
-
- /// \brief
- /// Gets the text for the given index.
- /// \param index The index of the entry.
- /// \return
- /// The text for the given index or a null string if the index is
- /// out of bounds.
- QString getText(int index) const;
-
- /// \brief
- /// Sets the text for the given index.
- /// \param index The index of the entry.
- /// \param text The new series label.
- void setText(int index, const QString &text);
-
-signals:
- /// \brief
- /// Emitted when a new entry is added.
- /// \param index Where the entry was added.
- void entryInserted(int index);
-
- /// \brief
- /// Emitted before an entry is removed.
- /// \param index The index being removed.
- void removingEntry(int index);
-
- /// \brief
- /// Emitted after an entry is removed.
- /// \param index The index being removed.
- void entryRemoved(int index);
-
- /// Emitted when the legend entries are reset.
- void entriesReset();
-
- /// \brief
- /// Emitted when the icon for an entry has changed.
- /// \param index The index of the entry that changed.
- void iconChanged(int index);
-
- /// \brief
- /// Emitted when the text for an entry has changed.
- /// \param index The index of the entry that changed.
- void textChanged(int index);
-
-private:
- vtkQtChartLegendModelInternal *Internal; ///< Stores the legend items.
- bool InModify; ///< True when blocking signals.
-};
-
-#endif
diff --git a/Modules/QmitkExt/vtkQtChartHeaders/vtkQtChartMouseBox.h b/Modules/QmitkExt/vtkQtChartHeaders/vtkQtChartMouseBox.h
deleted file mode 100644
index 3466cf38f7..0000000000
--- a/Modules/QmitkExt/vtkQtChartHeaders/vtkQtChartMouseBox.h
+++ /dev/null
@@ -1,147 +0,0 @@
-/*=========================================================================
-
- Program: Visualization Toolkit
- Module: $RCSfile: vtkQtChartMouseBox.h,v $
-
- Copyright (c) Ken Martin, Will Schroeder, Bill Lorensen
- All rights reserved.
- See Copyright.txt or http://www.kitware.com/Copyright.htm for details.
-
- This software is distributed WITHOUT ANY WARRANTY; without even
- the implied warranty of MERCHANTABILITY or FITNESS FOR A PARTICULAR
- PURPOSE. See the above copyright notice for more information.
-
-=========================================================================*/
-/*-------------------------------------------------------------------------
- Copyright 2008 Sandia Corporation.
- Under the terms of Contract DE-AC04-94AL85000 with Sandia Corporation,
- the U.S. Government retains certain rights in this software.
--------------------------------------------------------------------------*/
-
-/// \file vtkQtChartMouseBox.h
-/// \date March 11, 2008
-
-#ifndef _vtkQtChartMouseBox_h
-#define _vtkQtChartMouseBox_h
-
-
-#include "vtkQtChartExport.h"
-#include <QObject>
-
-class QGraphicsView;
-class QPoint;
-class QPointF;
-class QRectF;
-
-
-/*!
- * \class vtkQtChartMouseBox
- * \brief
- * The vtkQtChartMouseBox class is used to draw a mouse box that
- * can be used for zooming or selection.
- *
- * To use the vtkQtChartMouseBox, code needs to be added to several
- * key methods. The drag box interaction starts in the mouse press
- * event. The box grows or shrinks in the mouse move event. In the
- * mouse release event, the box is finalized and used for its
- * intent (zoom, select, etc.).
- *
- * In the mouse press event, the mouse location needs to be saved.
- * The position should be in the mouse box's parent coordinates.
- * \code
- * void SomeClass::mousePressEvent(QMouseEvent *e)
- * {
- * this->mouseBox->setStartingPosition(e->pos());
- * this->mouseBox->setVisible(true);
- * }
- * \endcode
- *
- * In the mouse move event, the drag box needs to be updated. The
- * point set in the mouse press event should remain unchanged until
- * the mouse release event. If your class watches all mouse move
- * events, make sure the box is only updated for drag events.
- * \code
- * void SomeClass::mouseMoveEvent(QMouseEvent *e)
- * {
- * this->mouseBox->adjustRectangle(e->pos());
- * }
- * \endcode
- *
- * In the mouse release event, the drag box needs to be updated
- * with the release location before using it. After using the box,
- * it should be hidden.
- * \code
- * void SomeClass::mouseReleaseEvent(QMouseEvent *e)
- * {
- * this->mouseBox->adjustRectangle(e->pos());
- * ...
- * this->mouseBox->setVisible(false);
- * }
- * \endcode
- */
-class VTKQTCHART_EXPORT vtkQtChartMouseBox : public QObject
-{
- Q_OBJECT
-
-public:
- vtkQtChartMouseBox(QGraphicsView *view);
- ~vtkQtChartMouseBox();
-
- /// \brief
- /// Gets whether or not the mouse box is visible.
- /// \return
- /// True if the mouse box should be painted.
- bool isVisible() const {return this->Showing;}
-
- /// \brief
- /// Sets whether or not the mouse box is visible.
- /// \param visible True if the mouse box should be painted.
- void setVisible(bool visible);
-
- /// \brief
- /// Gets the mouse box starting position.
- /// \return
- /// A reference to the mouse box starting position.
- const QPointF &getStartingPosition() const;
-
- /// \brief
- /// Sets the mouse box starting position.
- ///
- /// The starting position should be set before calling
- /// \c adjustRectangle. The starting position and adjustment
- /// positions should be in view coordinates.
- ///
- /// \param start The original mouse press location in view coordinates.
- /// \sa vtkQtChartMouseBox::adjustRectangle(const QPointF &)
- void setStartingPosition(const QPoint &start);
-
- /// \brief
- /// Adjusts the boundary of the mouse box.
- ///
- /// The selection or zoom box should contain the original mouse
- /// down location and the current mouse location. This method
- /// is used to adjust the box based on the current mouse location.
- ///
- /// \param current The current position of the mouse in view coordinates.
- void adjustRectangle(const QPoint &current);
-
- /// \brief
- /// Gets the current mouse box.
- /// \return
- /// A reference to the mouse box.
- const QRectF &getRectangle() const;
-
-signals:
- // \brief
- // Emitted when the mouse box changes.
- // \param area The area to repaint in scene coordinates.
- void updateNeeded(const QRectF &area);
-
-private:
- QGraphicsView *View; ///< Stores the graphics view.
- QPointF *Last; ///< Stores the mouse down location.
- QRectF *Box; ///< Stores the mouse box.
- bool Showing; ///< True if the mouse box should be painted.
-};
-
-#endif
diff --git a/Modules/QmitkExt/vtkQtChartHeaders/vtkQtChartMouseFunction.h b/Modules/QmitkExt/vtkQtChartHeaders/vtkQtChartMouseFunction.h
deleted file mode 100644
index 070ffe0006..0000000000
--- a/Modules/QmitkExt/vtkQtChartHeaders/vtkQtChartMouseFunction.h
+++ /dev/null
@@ -1,143 +0,0 @@
-/*=========================================================================
-
- Program: Visualization Toolkit
- Module: $RCSfile: vtkQtChartMouseFunction.h,v $
-
- Copyright (c) Ken Martin, Will Schroeder, Bill Lorensen
- All rights reserved.
- See Copyright.txt or http://www.kitware.com/Copyright.htm for details.
-
- This software is distributed WITHOUT ANY WARRANTY; without even
- the implied warranty of MERCHANTABILITY or FITNESS FOR A PARTICULAR
- PURPOSE. See the above copyright notice for more information.
-
-=========================================================================*/
-/*-------------------------------------------------------------------------
- Copyright 2008 Sandia Corporation.
- Under the terms of Contract DE-AC04-94AL85000 with Sandia Corporation,
- the U.S. Government retains certain rights in this software.
--------------------------------------------------------------------------*/
-
-/// \file vtkQtChartMouseFunction.h
-/// \date March 11, 2008
-
-#ifndef _vtkQtChartMouseFunction_h
-#define _vtkQtChartMouseFunction_h
-
-
-#include "vtkQtChartExport.h"
-#include <QObject>
-
-class vtkQtChartArea;
-class QCursor;
-class QMouseEvent;
-class QRectF;
-class QWheelEvent;
-
-
-/// \class vtkQtChartMouseFunction
-/// \brief
-/// The vtkQtChartMouseFunction class is the base class for all chart
-/// mouse functions.
-class VTKQTCHART_EXPORT vtkQtChartMouseFunction : public QObject
-{
- Q_OBJECT
-
-public:
- /// \brief
- /// Creates a chart mouse function instance.
- /// \param parent The parent object.
- vtkQtChartMouseFunction(QObject *parent=0);
- virtual ~vtkQtChartMouseFunction() {}
-
- /// \brief
- /// Gets whether or not the function is combinable.
- ///
- /// If a function can be combined with other functions on the same
- /// mouse button mode, this method should return true. Functions
- /// are combined using keyboard modifiers. If a function uses the
- /// keyboard modifiers, it should return false.
- ///
- /// \return
- /// True if the other functions can be combined with this one.
- virtual bool isCombinable() const {return true;}
-
- /// \brief
- /// Gets whether or not the function owns the mouse.
- /// \return
- /// True if the function owns the mouse.
- bool isMouseOwner() const {return this->OwnsMouse;}
-
- /// \brief
- /// Sets whether or not the function owns the mouse.
- /// \param owns True if the function owns the mouse.
- /// \sa
- // vtkQtChartMouseFunction::interactionStarted(vtkQtChartMouseFunction *)
- virtual void setMouseOwner(bool owns) {this->OwnsMouse = owns;}
-
- /// \brief
- /// Called to handle the mouse press event.
- /// \param e Event specific information.
- /// \param chart The chart area.
- /// \return
- /// True if the event was used.
- virtual bool mousePressEvent(QMouseEvent *e, vtkQtChartArea *chart)=0;
-
- /// \brief
- /// Called to handle the mouse move event.
- /// \param e Event specific information.
- /// \param chart The chart area.
- /// \return
- /// True if the event was used.
- virtual bool mouseMoveEvent(QMouseEvent *e, vtkQtChartArea *chart)=0;
-
- /// \brief
- /// Called to handle the mouse release event.
- /// \param e Event specific information.
- /// \param chart The chart area.
- /// \return
- /// True if the event was used.
- virtual bool mouseReleaseEvent(QMouseEvent *e, vtkQtChartArea *chart)=0;
-
- /// \brief
- /// Called to handle the double click event.
- /// \param e Event specific information.
- /// \param chart The chart area.
- /// \return
- /// True if the event was used.
- virtual bool mouseDoubleClickEvent(QMouseEvent *e, vtkQtChartArea *chart)=0;
-
- /// \brief
- /// Called to handle the wheel event.
- /// \param e Event specific information.
- /// \param chart The chart area.
- /// \return
- /// True if the event was used.
- virtual bool wheelEvent(QWheelEvent *e, vtkQtChartArea *chart);
-
-signals:
- /// \brief
- /// Emitted when a function interaction has started.
- ///
- /// A mouse function should not assume it has ownership after
- /// emitting this signal. The interactor will call \c setMouseOwner
- /// if no other function owns the mouse.
- ///
- /// \param function The function requesting mouse ownership.
- void interactionStarted(vtkQtChartMouseFunction *function);
-
- /// \brief
- /// Emitted when a function has finished an interaction state.
- /// \param function The function releasing mouse control.
- void interactionFinished(vtkQtChartMouseFunction *function);
-
- /// \brief
- /// Emitted when the mouse cursor needs to be changed.
- /// \param cursor The new cursor to use.
- void cursorChangeRequested(const QCursor &cursor);
-
-private:
- bool OwnsMouse; ///< True if the function owns mouse control.
-};
-
-#endif
diff --git a/Modules/QmitkExt/vtkQtChartHeaders/vtkQtChartMousePan.h b/Modules/QmitkExt/vtkQtChartHeaders/vtkQtChartMousePan.h
deleted file mode 100644
index d8131a1e97..0000000000
--- a/Modules/QmitkExt/vtkQtChartHeaders/vtkQtChartMousePan.h
+++ /dev/null
@@ -1,67 +0,0 @@
-/*=========================================================================
-
- Program: Visualization Toolkit
- Module: $RCSfile: vtkQtChartMousePan.h,v $
-
- Copyright (c) Ken Martin, Will Schroeder, Bill Lorensen
- All rights reserved.
- See Copyright.txt or http://www.kitware.com/Copyright.htm for details.
-
- This software is distributed WITHOUT ANY WARRANTY; without even
- the implied warranty of MERCHANTABILITY or FITNESS FOR A PARTICULAR
- PURPOSE. See the above copyright notice for more information.
-
-=========================================================================*/
-/*-------------------------------------------------------------------------
- Copyright 2008 Sandia Corporation.
- Under the terms of Contract DE-AC04-94AL85000 with Sandia Corporation,
- the U.S. Government retains certain rights in this software.
--------------------------------------------------------------------------*/
-
-/// \file vtkQtChartMousePan.h
-/// \date March 11, 2008
-
-#ifndef _vtkQtChartMousePan_h
-#define _vtkQtChartMousePan_h
-
-
-#include "vtkQtChartExport.h"
-#include "vtkQtChartMouseFunction.h"
-
-class vtkQtChartContentsSpace;
-class vtkQtChartMousePanInternal;
-class QMouseEvent;
-
-
-/// \class vtkQtChartMousePan
-/// \brief
-/// The vtkQtChartMousePan class pans the contents in response to
-/// mouse events.
-class VTKQTCHART_EXPORT vtkQtChartMousePan : public vtkQtChartMouseFunction
-{
-public:
- /// \brief
- /// Creates a mouse pan instance.
- /// \param parent Te parent object.
- vtkQtChartMousePan(QObject *parent=0);
- virtual ~vtkQtChartMousePan();
-
- /// \name vtkQtChartMouseFunction Methods
- //@{
- virtual void setMouseOwner(bool owns);
-
- virtual bool mousePressEvent(QMouseEvent *e, vtkQtChartArea *chart);
- virtual bool mouseMoveEvent(QMouseEvent *e, vtkQtChartArea *chart);
- virtual bool mouseReleaseEvent(QMouseEvent *e, vtkQtChartArea *chart);
- virtual bool mouseDoubleClickEvent(QMouseEvent *e, vtkQtChartArea *chart);
- //@}
-
-private:
- vtkQtChartMousePanInternal *Internal; ///< Stores the last mouse position.
-
-private:
- vtkQtChartMousePan(const vtkQtChartMousePan &);
- vtkQtChartMousePan &operator=(const vtkQtChartMousePan &);
-};
-
-#endif
diff --git a/Modules/QmitkExt/vtkQtChartHeaders/vtkQtChartMouseSelection.h b/Modules/QmitkExt/vtkQtChartHeaders/vtkQtChartMouseSelection.h
deleted file mode 100644
index 9b316372c2..0000000000
--- a/Modules/QmitkExt/vtkQtChartHeaders/vtkQtChartMouseSelection.h
+++ /dev/null
@@ -1,123 +0,0 @@
-/*=========================================================================
-
- Program: Visualization Toolkit
- Module: $RCSfile: vtkQtChartMouseSelection.h,v $
-
- Copyright (c) Ken Martin, Will Schroeder, Bill Lorensen
- All rights reserved.
- See Copyright.txt or http://www.kitware.com/Copyright.htm for details.
-
- This software is distributed WITHOUT ANY WARRANTY; without even
- the implied warranty of MERCHANTABILITY or FITNESS FOR A PARTICULAR
- PURPOSE. See the above copyright notice for more information.
-
-=========================================================================*/
-/*-------------------------------------------------------------------------
- Copyright 2008 Sandia Corporation.
- Under the terms of Contract DE-AC04-94AL85000 with Sandia Corporation,
- the U.S. Government retains certain rights in this software.
--------------------------------------------------------------------------*/
-
-/// \file vtkQtChartMouseSelection.h
-/// \date March 11, 2008
-
-#ifndef _vtkQtChartMouseSelection_h
-#define _vtkQtChartMouseSelection_h
-
-
-#include "vtkQtChartExport.h"
-#include "vtkQtChartMouseFunction.h"
-
-class vtkQtChartArea;
-class vtkQtChartMouseSelectionHandler;
-class vtkQtChartMouseSelectionInternal;
-class QMouseEvent;
-class QString;
-class QStringList;
-
-
-/// \class vtkQtChartMouseSelection
-/// \brief
-/// The vtkQtChartMouseSelection class is used to select chart elements
-/// based on the current selection mode.
-class VTKQTCHART_EXPORT vtkQtChartMouseSelection :
- public vtkQtChartMouseFunction
-{
- Q_OBJECT
-
-public:
- /// \brief
- /// Creates a mouse selection object.
- /// \param parent The parent object.
- vtkQtChartMouseSelection(QObject *parent=0);
- virtual ~vtkQtChartMouseSelection();
-
- /// \name Configuration Methods
- //@{
- virtual bool isCombinable() const {return false;}
-
- /// \brief
- /// Gets the name of current selection mode.
- /// \return
- /// The name of the current selection mode.
- const QString &getSelectionMode() const;
-
- /// \brief
- /// Gets the list of selection modes.
- /// \return
- /// The list of selection modes.
- const QStringList &getModeList() const;
-
- /// \brief
- /// Adds a selection handler to the list.
- ///
- /// The selection mode list is rebuilt when a new handler is added.
- ///
- /// \param handler The new selection handler.
- void addHandler(vtkQtChartMouseSelectionHandler *handler);
-
- /// \brief
- /// Inserts a selection handler into the list.
- /// \param index Where to insert the handler.
- /// \param handler The new selection handler.
- void insertHandler(int index, vtkQtChartMouseSelectionHandler *handler);
-
- /// \brief
- /// Removes the given selection handler from the list.
- /// \param handler The selection handler to remove.
- void removeHandler(vtkQtChartMouseSelectionHandler *handler);
- //@}
-
- /// \name Interaction Methods
- //@{
- virtual bool mousePressEvent(QMouseEvent *e, vtkQtChartArea *chart);
- virtual bool mouseMoveEvent(QMouseEvent *e, vtkQtChartArea *chart);
- virtual bool mouseReleaseEvent(QMouseEvent *e, vtkQtChartArea *chart);
- virtual bool mouseDoubleClickEvent(QMouseEvent *e, vtkQtChartArea *chart);
- //@}
-
-public slots:
- /// \brief
- /// Sets the current selection mode.
- /// \param mode The name of the new selection mode.
- void setSelectionMode(const QString &mode);
-
-signals:
- /// Emitted when the list of available modes changes.
- void modeListChanged();
-
- /// \brief
- /// Emitted when the selection mode changes.
- /// \param mode The name of the new selection mode.
- void selectionModeChanged(const QString &mode);
-
-private:
- /// Stores the mode data and selection handlers.
- vtkQtChartMouseSelectionInternal *Internal;
-
-private:
- vtkQtChartMouseSelection(const vtkQtChartMouseSelection &);
- vtkQtChartMouseSelection &operator=(const vtkQtChartMouseSelection &);
-};
-
-#endif
diff --git a/Modules/QmitkExt/vtkQtChartHeaders/vtkQtChartMouseSelectionHandler.h b/Modules/QmitkExt/vtkQtChartHeaders/vtkQtChartMouseSelectionHandler.h
deleted file mode 100644
index ed612adb2a..0000000000
--- a/Modules/QmitkExt/vtkQtChartHeaders/vtkQtChartMouseSelectionHandler.h
+++ /dev/null
@@ -1,119 +0,0 @@
-/*=========================================================================
-
- Program: Visualization Toolkit
- Module: $RCSfile: vtkQtChartMouseSelectionHandler.h,v $
-
- Copyright (c) Ken Martin, Will Schroeder, Bill Lorensen
- All rights reserved.
- See Copyright.txt or http://www.kitware.com/Copyright.htm for details.
-
- This software is distributed WITHOUT ANY WARRANTY; without even
- the implied warranty of MERCHANTABILITY or FITNESS FOR A PARTICULAR
- PURPOSE. See the above copyright notice for more information.
-
-=========================================================================*/
-/*-------------------------------------------------------------------------
- Copyright 2008 Sandia Corporation.
- Under the terms of Contract DE-AC04-94AL85000 with Sandia Corporation,
- the U.S. Government retains certain rights in this software.
--------------------------------------------------------------------------*/
-
-/// \file vtkQtChartMouseSelectionHandler.h
-/// \date March 19, 2008
-
-#ifndef _vtkQtChartMouseSelectionHandler_h
-#define _vtkQtChartMouseSelectionHandler_h
-
-#include "vtkQtChartExport.h"
-#include <QObject>
-
-class vtkQtChartArea;
-class vtkQtChartMouseBox;
-class QMouseEvent;
-class QString;
-class QStringList;
-
-
-/// \class vtkQtChartMouseSelectionHandler
-/// \brief
-/// The vtkQtChartMouseSelectionHandler class is the base class for
-/// all selection handlers.
-class VTKQTCHART_EXPORT vtkQtChartMouseSelectionHandler : public QObject
-{
-public:
- /// \brief
- /// Creates a mouse selection handler.
- /// \param parent The parent object.
- vtkQtChartMouseSelectionHandler(QObject *parent=0);
- virtual ~vtkQtChartMouseSelectionHandler() {}
-
- /// \brief
- /// Gets the number of mouse modes.
- /// \return
- /// The number of mouse modes.
- virtual int getNumberOfModes() const=0;
-
- /// \brief
- /// Gets the list of mouse mode names.
- /// \param list Used to return the list of modes.
- virtual void getModeList(QStringList &list) const=0;
-
- /// \brief
- /// Handles the mouse press event.
- /// \param mode The current mouse mode.
- /// \param e The mouse event.
- /// \param chart The chart area.
- /// \return
- /// True if the event was handled.
- virtual bool mousePressEvent(const QString &mode, QMouseEvent *e,
- vtkQtChartArea *chart)=0;
-
- /// \brief
- /// Gets whether or not mouse move is available for the given mode.
- /// \param mode The mouse mode name.
- /// \return
- /// True if mouse move is available for the given mode.
- virtual bool isMouseMoveAvailable(const QString &mode) const=0;
-
- /// \brief
- /// Starts a mouse move for the given mode.
- /// \param mode The mouse mode to start.
- /// \param chart The chart area.
- virtual void startMouseMove(const QString &mode, vtkQtChartArea *chart)=0;
-
- /// \brief
- /// Handles the mouse move event.
- /// \param mode The current mouse mode.
- /// \param e The mouse event.
- /// \param chart The chart area.
- virtual void mouseMoveEvent(const QString &mode, QMouseEvent *e,
- vtkQtChartArea *chart)=0;
-
- /// \brief
- /// Finishes a mouse move for the given mode.
- /// \param mode The mouse mode to finish.
- /// \param chart The chart area.
- virtual void finishMouseMove(const QString &mode, vtkQtChartArea *chart)=0;
-
- /// \brief
- /// Handles the mouse release event.
- /// \param mode The current mouse mode.
- /// \param e The mouse event.
- /// \param chart The chart area.
- /// \return
- /// True if the event was handled.
- virtual bool mouseReleaseEvent(const QString &mode, QMouseEvent *e,
- vtkQtChartArea *chart)=0;
-
- /// \brief
- /// Handles the mouse double click event.
- /// \param mode The current mouse mode.
- /// \param e The mouse event.
- /// \param chart The chart area.
- /// \return
- /// True if the event was handled.
- virtual bool mouseDoubleClickEvent(const QString &mode, QMouseEvent *e,
- vtkQtChartArea *chart)=0;
-};
-
-#endif
diff --git a/Modules/QmitkExt/vtkQtChartHeaders/vtkQtChartMouseZoom.h b/Modules/QmitkExt/vtkQtChartHeaders/vtkQtChartMouseZoom.h
deleted file mode 100644
index af815962a5..0000000000
--- a/Modules/QmitkExt/vtkQtChartHeaders/vtkQtChartMouseZoom.h
+++ /dev/null
@@ -1,157 +0,0 @@
-/*=========================================================================
-
- Program: Visualization Toolkit
- Module: $RCSfile: vtkQtChartMouseZoom.h,v $
-
- Copyright (c) Ken Martin, Will Schroeder, Bill Lorensen
- All rights reserved.
- See Copyright.txt or http://www.kitware.com/Copyright.htm for details.
-
- This software is distributed WITHOUT ANY WARRANTY; without even
- the implied warranty of MERCHANTABILITY or FITNESS FOR A PARTICULAR
- PURPOSE. See the above copyright notice for more information.
-
-=========================================================================*/
-/*-------------------------------------------------------------------------
- Copyright 2008 Sandia Corporation.
- Under the terms of Contract DE-AC04-94AL85000 with Sandia Corporation,
- the U.S. Government retains certain rights in this software.
--------------------------------------------------------------------------*/
-
-/// \file vtkQtChartMouseZoom.h
-/// \date March 11, 2008
-
-#ifndef _vtkQtChartMouseZoom_h
-#define _vtkQtChartMouseZoom_h
-
-
-#include "vtkQtChartExport.h"
-#include "vtkQtChartMouseFunction.h"
-
-class vtkQtChartArea;
-class vtkQtChartMouseZoomInternal;
-class QCursor;
-class QMouseEvent;
-
-
-/// \class vtkQtChartMouseZoom
-/// \brief
-/// The vtkQtChartMouseZoom class zooms the contents in response to
-/// mouse events.
-class VTKQTCHART_EXPORT vtkQtChartMouseZoom : public vtkQtChartMouseFunction
-{
-public:
- enum ZoomFlags
- {
- ZoomBoth, ///< Zoom in both directions.
- ZoomXOnly, ///< Zoom only in the x-direction.
- ZoomYOnly ///< Zoom only in the y-direction.
- };
-
-public:
- /// \brief
- /// Creates a new mouse zoom object.
- /// \param parent The parent object.
- vtkQtChartMouseZoom(QObject *parent=0);
- virtual ~vtkQtChartMouseZoom();
-
- /// \name vtkQtChartMouseFunction Methods
- //@{
- virtual void setMouseOwner(bool owns);
-
- virtual bool mousePressEvent(QMouseEvent *e, vtkQtChartArea *chart);
- virtual bool mouseMoveEvent(QMouseEvent *e, vtkQtChartArea *chart);
- virtual bool mouseReleaseEvent(QMouseEvent *e, vtkQtChartArea *chart);
- virtual bool mouseDoubleClickEvent(QMouseEvent *e, vtkQtChartArea *chart);
- virtual bool wheelEvent(QWheelEvent *e, vtkQtChartArea *chart);
- //@}
-
- /// \brief
- /// Gets the zoom flags used during interaction.
- /// \return
- /// The zoom flags used during interaction.
- ZoomFlags getFlags() const {return this->Flags;}
-
-protected:
- /// \brief
- /// Sets the zoom flags to use during interaction.
- /// \param flags The zoom flags to use.
- void setFlags(ZoomFlags flags) {this->Flags = flags;}
-
-private:
- vtkQtChartMouseZoomInternal *Internal; ///< Stores the last position.
- ZoomFlags Flags; ///< Stores the zoom flags.
-
-private:
- vtkQtChartMouseZoom(const vtkQtChartMouseZoom &);
- vtkQtChartMouseZoom &operator=(const vtkQtChartMouseZoom &);
-};
-
-
-/// \class vtkQtChartMouseZoomX
-/// \brief
-/// The vtkQtChartMouseZoomX class zooms the contents in the x-direction.
-class VTKQTCHART_EXPORT vtkQtChartMouseZoomX : public vtkQtChartMouseZoom
-{
-public:
- /// \brief
- /// Creates a new mouse zoom-x object.
- /// \param parent The parent object.
- vtkQtChartMouseZoomX(QObject *parent=0);
- virtual ~vtkQtChartMouseZoomX() {}
-
-private:
- vtkQtChartMouseZoomX(const vtkQtChartMouseZoomX &);
- vtkQtChartMouseZoomX &operator=(const vtkQtChartMouseZoomX &);
-};
-
-
-/// \class vtkQtChartMouseZoomY
-/// \brief
-/// The vtkQtChartMouseZoomY class zooms the contents in the y-direction.
-class VTKQTCHART_EXPORT vtkQtChartMouseZoomY : public vtkQtChartMouseZoom
-{
-public:
- /// \brief
- /// Creates a new mouse zoom-y object.
- /// \param parent The parent object.
- vtkQtChartMouseZoomY(QObject *parent=0);
- virtual ~vtkQtChartMouseZoomY() {}
-
-private:
- vtkQtChartMouseZoomY(const vtkQtChartMouseZoomY &);
- vtkQtChartMouseZoomY &operator=(const vtkQtChartMouseZoomY &);
-};
-
-
-/// \class vtkQtChartMouseZoomBox
-/// \brief
-/// The vtkQtChartMouseZoomBox class zooms the contents to a rectangle.
-class VTKQTCHART_EXPORT vtkQtChartMouseZoomBox : public vtkQtChartMouseFunction
-{
-public:
- /// \brief
- /// Creates a new mouse zoom box object.
- /// \param parent The parent object.
- vtkQtChartMouseZoomBox(QObject *parent=0);
- virtual ~vtkQtChartMouseZoomBox();
-
- /// \name vtkQtChartMouseFunction Methods
- //@{
- virtual void setMouseOwner(bool owns);
-
- virtual bool mousePressEvent(QMouseEvent *e, vtkQtChartArea *chart);
- virtual bool mouseMoveEvent(QMouseEvent *e, vtkQtChartArea *chart);
- virtual bool mouseReleaseEvent(QMouseEvent *e, vtkQtChartArea *chart);
- virtual bool mouseDoubleClickEvent(QMouseEvent *e, vtkQtChartArea *chart);
- //@}
-
-private:
- QCursor *ZoomCursor; ///< Stores the zoom cursor.
-
-private:
- vtkQtChartMouseZoomBox(const vtkQtChartMouseZoomBox &);
- vtkQtChartMouseZoomBox &operator=(const vtkQtChartMouseZoomBox &);
-};
-
-#endif
diff --git a/Modules/QmitkExt/vtkQtChartHeaders/vtkQtChartPenBrushGenerator.h b/Modules/QmitkExt/vtkQtChartHeaders/vtkQtChartPenBrushGenerator.h
deleted file mode 100644
index 20edd817e5..0000000000
--- a/Modules/QmitkExt/vtkQtChartHeaders/vtkQtChartPenBrushGenerator.h
+++ /dev/null
@@ -1,188 +0,0 @@
-/*=========================================================================
-
- Program: Visualization Toolkit
- Module: $RCSfile: vtkQtChartPenBrushGenerator.h,v $
-
- Copyright (c) Ken Martin, Will Schroeder, Bill Lorensen
- All rights reserved.
- See Copyright.txt or http://www.kitware.com/Copyright.htm for details.
-
- This software is distributed WITHOUT ANY WARRANTY; without even
- the implied warranty of MERCHANTABILITY or FITNESS FOR A PARTICULAR
- PURPOSE. See the above copyright notice for more information.
-
-=========================================================================*/
-/*-------------------------------------------------------------------------
- Copyright 2008 Sandia Corporation.
- Under the terms of Contract DE-AC04-94AL85000 with Sandia Corporation,
- the U.S. Government retains certain rights in this software.
--------------------------------------------------------------------------*/
-
-/// \file vtkQtChartPenBrushGenerator.h
-/// \date September 22, 2008
-
-#ifndef _vtkQtChartPenBrushGenerator_h
-#define _vtkQtChartPenBrushGenerator_h
-
-#include "vtkQtChartExport.h"
-#include "vtkQtChartStyleGenerator.h"
-
-class vtkQtChartColors;
-class vtkQtChartPenBrushGeneratorInternal;
-
-
-/// \class vtkQtChartPenBrushGenerator
-/// \brief
-/// The vtkQtChartPenBrushGenerator class generates series drawing
-/// options using pen and brush lists.
-class VTKQTCHART_EXPORT vtkQtChartPenBrushGenerator :
- public vtkQtChartStyleGenerator
-{
- Q_OBJECT
-
-public:
- /// \brief
- /// Creates a pen/brush generator.
- /// \param parent The parent object.
- vtkQtChartPenBrushGenerator(QObject *parent=0);
- virtual ~vtkQtChartPenBrushGenerator();
-
- /// \name vtkQtChartStyleGenerator Methods
- //@{
- /// \brief
- /// Gets the brush for the specified series index.
- ///
- /// If the index is greater than the internal brush list, the index
- /// will be wrapped to repeat the brushes.
- ///
- /// \param index The series index.
- /// \return
- /// The brush for the specified series index.
- virtual QBrush getSeriesBrush(int index) const;
-
- /// \brief
- /// Gets the pen for the specified series index.
- ///
- /// If the index is greater than the internal pen list, the index
- /// will be wrapped to repeat the pens.
- ///
- /// \param index The series index.
- /// \return
- /// The pen for the specified series index.
- virtual QPen getSeriesPen(int index) const;
- //@}
-
- /// \name Brush Methods
- //@{
- /// \brief
- /// Gets the number of brushes (fill styles) in the list.
- /// \return
- /// The number of brushes (fill styles) in the list.
- int getNumberOfBrushes() const;
-
- /// \brief
- /// Gets a fill style from the list.
- ///
- /// The index must be in the range [0, getNumberOfBrushes()-1]. If
- /// it is not, an error message will be printed and an empty QBrush
- /// will be returned.
- ///
- /// \param index The index of the brush.
- /// \return
- /// The fill style for the given index.
- QBrush getBrush(int index) const;
-
- /// \brief
- /// Sets the fill style for the given index.
- ///
- /// This method will do nothing if the index is out of range.
- ///
- /// \param index The brush list index.
- /// \param brush The new fill style.
- void setBrush(int index, const QBrush &brush);
-
- /// Clears the list of brushes (fill styles).
- void clearBrushes();
-
- /// \brief
- /// Adds the color list to the brush list.
- /// \param colors The list of colors to add.
- void addBrushes(const vtkQtChartColors &colors);
-
- /// \brief
- /// Adds a new brush to the list of fill styles.
- /// \param brush The fill style to add.
- void addBrush(const QBrush &brush);
-
- /// \brief
- /// Inserts a new brush into the list of fill styles.
- /// \param index Where to insert the brush.
- /// \param brush The fill style to insert.
- void insertBrush(int index, const QBrush &brush);
-
- /// \brief
- /// Removes the brush at the given index.
- /// \param index The index of the brush to remove.
- void removeBrush(int index);
- //@}
-
- /// \name Pen Methods
- //@{
- /// \brief
- /// Gets the number of pens (stroke styles) in the list.
- /// \return
- /// The number of pens (stroke styles) in the list.
- int getNumberOfPens() const;
-
- /// \brief
- /// Gets a stroke style from the list.
- ///
- /// The index must be in the range [0, getNumberOfPens()-1]. If it
- /// is not, an error message will be printed and an empty QPen will
- /// be returned.
- ///
- /// \param index The index of the pen.
- /// \return
- /// The stroke style for the given index.
- QPen getPen(int index) const;
-
- /// \brief
- /// Sets the stroke style for the given index.
- ///
- /// This method will do nothing if the index is out of range.
- ///
- /// \param index The pen list index.
- /// \param pen The new stroke style.
- void setPen(int index, const QPen &pen);
-
- /// Clears the list of pens (stroke styles).
- void clearPens();
-
- /// \brief
- /// Adds the color list to the pen list.
- /// \param colors The list of colors to add.
- void addPens(const vtkQtChartColors &colors);
-
- /// \brief
- /// Adds a pen to the list of stroke styles.
- /// \param pen The stroke style to add.
- void addPen(const QPen &pen);
-
- /// \brief
- /// Inserts a pen into the list of stroke styles.
- /// \param index Where to insert the pen.
- /// \param pen The stroke style to insert.
- void insertPen(int index, const QPen &pen);
-
- /// \brief
- /// Removes the pen at the given index.
- /// \param index The index of the pen to remove.
- void removePen(int index);
- //@}
-
-private:
- /// Stores the pen and brush lists.
- vtkQtChartPenBrushGeneratorInternal *Internal;
-};
-
-#endif
diff --git a/Modules/QmitkExt/vtkQtChartHeaders/vtkQtChartQuad.h b/Modules/QmitkExt/vtkQtChartHeaders/vtkQtChartQuad.h
deleted file mode 100644
index 42030cfc73..0000000000
--- a/Modules/QmitkExt/vtkQtChartHeaders/vtkQtChartQuad.h
+++ /dev/null
@@ -1,86 +0,0 @@
-/*=========================================================================
-
- Program: Visualization Toolkit
- Module: $RCSfile: vtkQtChartQuad.h,v $
-
- Copyright (c) Ken Martin, Will Schroeder, Bill Lorensen
- All rights reserved.
- See Copyright.txt or http://www.kitware.com/Copyright.htm for details.
-
- This software is distributed WITHOUT ANY WARRANTY; without even
- the implied warranty of MERCHANTABILITY or FITNESS FOR A PARTICULAR
- PURPOSE. See the above copyright notice for more information.
-
-=========================================================================*/
-/*-------------------------------------------------------------------------
- Copyright 2008 Sandia Corporation.
- Under the terms of Contract DE-AC04-94AL85000 with Sandia Corporation,
- the U.S. Government retains certain rights in this software.
--------------------------------------------------------------------------*/
-
-/// \file vtkQtChartQuad.h
-/// \date November 13, 2008
-
-#ifndef _vtkQtChartQuad_h
-#define _vtkQtChartQuad_h
-
-#include "vtkQtChartExport.h"
-#include "vtkQtChartShape.h"
-
-class QPolygonF;
-
-
-/// \class vtkQtChartQuad
-/// \brief
-/// The vtkQtChartQuad class defines a quad used by the chart shape
-/// locator.
-class VTKQTCHART_EXPORT vtkQtChartQuad : public vtkQtChartShape
-{
-public:
- vtkQtChartQuad();
-
- /// \brief
- /// Creates a quad instance.
- /// \param series The chart series.
- /// \param index The chart series index.
- vtkQtChartQuad(int series, int index);
- vtkQtChartQuad(const vtkQtChartQuad &other);
- virtual ~vtkQtChartQuad();
-
- vtkQtChartQuad &operator=(const vtkQtChartQuad &other);
-
- virtual void getBounds(QRectF &bounds) const;
- virtual bool contains(const QPointF &point) const;
- virtual bool intersects(const QRectF &area) const;
-
- /// \brief
- /// Sets the quad shape.
- ///
- /// The polygon should be a list of four points. The points should
- /// form a convex, clock-wise loop.
- ///
- /// \param polygon The list of points to define the quad.
- virtual void setPolygon(const QPolygonF &polygon) {this->setPoints(polygon);}
-
- /// \brief
- /// Gets the list of quad points.
- /// \return
- /// The list of quad points.
- const QPolygonF &getPoints() const;
-
- /// \brief
- /// Sets the quad shape.
- /// \param points The list of points to define the quad.
- void setPoints(const QPolygonF &points);
-
- /// \brief
- /// Sets the point for the given index.
- /// \param index The index of the quad point.
- /// \param point The new point.
- void setPoint(int index, const QPointF &point);
-
-private:
- QPolygonF *Points; ///< Stores the four points.
-};
-
-#endif
diff --git a/Modules/QmitkExt/vtkQtChartHeaders/vtkQtChartScene.h b/Modules/QmitkExt/vtkQtChartHeaders/vtkQtChartScene.h
deleted file mode 100644
index a784b72e60..0000000000
--- a/Modules/QmitkExt/vtkQtChartHeaders/vtkQtChartScene.h
+++ /dev/null
@@ -1,73 +0,0 @@
-/*=========================================================================
-
- Program: Visualization Toolkit
- Module: $RCSfile: vtkQtChartScene.h,v $
-
- Copyright (c) Ken Martin, Will Schroeder, Bill Lorensen
- All rights reserved.
- See Copyright.txt or http://www.kitware.com/Copyright.htm for details.
-
- This software is distributed WITHOUT ANY WARRANTY; without even
- the implied warranty of MERCHANTABILITY or FITNESS FOR A PARTICULAR
- PURPOSE. See the above copyright notice for more information.
-
-=========================================================================*/
-/*-------------------------------------------------------------------------
- Copyright 2008 Sandia Corporation.
- Under the terms of Contract DE-AC04-94AL85000 with Sandia Corporation,
- the U.S. Government retains certain rights in this software.
--------------------------------------------------------------------------*/
-
-/// \file vtkQtChartScene.h
-/// \date March 12, 2008
-
-#ifndef _vtkQtChartScene_h
-#define _vtkQtChartScene_h
-
-#include "vtkQtChartExport.h"
-#include <QGraphicsScene>
-
-class vtkQtChartMouseBox;
-
-
-/// \class vtkQtChartScene
-/// \brief
-/// The vtkQtChartScene class is used to draw the mouse box and make
-/// it possible for chart layers to clip correctly.
-class VTKQTCHART_EXPORT vtkQtChartScene : public QGraphicsScene
-{
-public:
- /// \brief
- /// Creates a chart scene.
- /// \param parent The parent object.
- vtkQtChartScene(QObject *parent=0);
- virtual ~vtkQtChartScene() {}
-
- /// \brief
- /// Sets the chart mouse box.
- /// \param box The chart mouse box.
- void setMouseBox(vtkQtChartMouseBox *box) {this->Box = box;}
-
-protected:
- /// \brief
- /// Allows the chart layers to clip their objects.
- /// \param painter The painter to use.
- /// \param numItems The length of the \c items array.
- /// \param items The list of graphics items to draw.
- /// \param options The graphics item painting options.
- /// \param widget The widget being painted.
- virtual void drawItems(QPainter *painter, int numItems,
- QGraphicsItem **items, const QStyleOptionGraphicsItem *options,
- QWidget *widget=0);
-
- /// \brief
- /// Draws the chart mouse box in the foreground.
- /// \param painter The painter to use.
- /// \param area The area to update.
- virtual void drawForeground(QPainter *painter, const QRectF &area);
-
-private:
- vtkQtChartMouseBox *Box; ///< Stores the mouse box.
-};
-
-#endif
diff --git a/Modules/QmitkExt/vtkQtChartHeaders/vtkQtChartSeriesDomain.h b/Modules/QmitkExt/vtkQtChartHeaders/vtkQtChartSeriesDomain.h
deleted file mode 100644
index 499265b259..0000000000
--- a/Modules/QmitkExt/vtkQtChartHeaders/vtkQtChartSeriesDomain.h
+++ /dev/null
@@ -1,74 +0,0 @@
-/*=========================================================================
-
- Program: Visualization Toolkit
- Module: $RCSfile: vtkQtChartSeriesDomain.h,v $
-
- Copyright (c) Ken Martin, Will Schroeder, Bill Lorensen
- All rights reserved.
- See Copyright.txt or http://www.kitware.com/Copyright.htm for details.
-
- This software is distributed WITHOUT ANY WARRANTY; without even
- the implied warranty of MERCHANTABILITY or FITNESS FOR A PARTICULAR
- PURPOSE. See the above copyright notice for more information.
-
-=========================================================================*/
-/*-------------------------------------------------------------------------
- Copyright 2008 Sandia Corporation.
- Under the terms of Contract DE-AC04-94AL85000 with Sandia Corporation,
- the U.S. Government retains certain rights in this software.
--------------------------------------------------------------------------*/
-
-/// \file vtkQtChartSeriesDomain.h
-/// \date March 3, 2008
-
-#ifndef _vtkQtChartSeriesDomain_h
-#define _vtkQtChartSeriesDomain_h
-
-#include "vtkQtChartExport.h"
-
-class vtkQtChartAxisDomain;
-class vtkQtChartSeriesDomainInternal;
-
-
-/// \class vtkQtChartSeriesDomain
-/// \brief
-/// The vtkQtChartSeriesDomain class is used to associate the two
-/// domains for a series.
-class VTKQTCHART_EXPORT vtkQtChartSeriesDomain
-{
-public:
- vtkQtChartSeriesDomain();
- vtkQtChartSeriesDomain(const vtkQtChartSeriesDomain &other);
- ~vtkQtChartSeriesDomain();
-
- /// \brief
- /// Gets the x-axis domain for the series.
- /// \return
- /// A reference to the x-axis domain.
- const vtkQtChartAxisDomain &getXDomain() const;
-
- /// \brief
- /// Gets the x-axis domain for the series.
- /// \return
- /// A reference to the x-axis domain.
- vtkQtChartAxisDomain &getXDomain();
-
- /// \brief
- /// Gets the y-axis domain for the series.
- /// \return
- /// A reference to the y-axis domain.
- const vtkQtChartAxisDomain &getYDomain() const;
-
- /// \brief
- /// Gets the y-axis domain for the series.
- /// \return
- /// A reference to the y-axis domain.
- vtkQtChartAxisDomain &getYDomain();
-
- vtkQtChartSeriesDomain &operator=(const vtkQtChartSeriesDomain &other);
-
-private:
- vtkQtChartSeriesDomainInternal *Internal; ///< Stores the domains.
-};
-
-#endif
diff --git a/Modules/QmitkExt/vtkQtChartHeaders/vtkQtChartSeriesDomainGroup.h b/Modules/QmitkExt/vtkQtChartHeaders/vtkQtChartSeriesDomainGroup.h
deleted file mode 100644
index 152e048403..0000000000
--- a/Modules/QmitkExt/vtkQtChartHeaders/vtkQtChartSeriesDomainGroup.h
+++ /dev/null
@@ -1,135 +0,0 @@
-/*=========================================================================
-
- Program: Visualization Toolkit
- Module: $RCSfile: vtkQtChartSeriesDomainGroup.h,v $
-
- Copyright (c) Ken Martin, Will Schroeder, Bill Lorensen
- All rights reserved.
- See Copyright.txt or http://www.kitware.com/Copyright.htm for details.
-
- This software is distributed WITHOUT ANY WARRANTY; without even
- the implied warranty of MERCHANTABILITY or FITNESS FOR A PARTICULAR
- PURPOSE. See the above copyright notice for more information.
-
-=========================================================================*/
-/*-------------------------------------------------------------------------
- Copyright 2008 Sandia Corporation.
- Under the terms of Contract DE-AC04-94AL85000 with Sandia Corporation,
- the U.S. Government retains certain rights in this software.
--------------------------------------------------------------------------*/
-
-/// \file vtkQtChartSeriesDomainGroup.h
-/// \date March 6, 2008
-
-#ifndef _vtkQtChartSeriesDomainGroup_h
-#define _vtkQtChartSeriesDomainGroup_h
-
-#include "vtkQtChartExport.h"
-#include <QList> // needed for return type
-
-
-/// \class vtkQtChartSeriesDomainGroup
-/// \brief
-/// The vtkQtChartSeriesDomainGroup class is used to group together
-/// series with similar domains.
-class VTKQTCHART_EXPORT vtkQtChartSeriesDomainGroup
-{
-public:
- /// \brief
- /// Creates a chart series domain group.
- /// \param sortSeries True if the series should be sorted when added
- /// to a group.
- vtkQtChartSeriesDomainGroup(bool sortSeries=false);
- virtual ~vtkQtChartSeriesDomainGroup() {}
-
- /// \brief
- /// Gets the number of groups.
- /// \return
- /// The number of groups.
- int getNumberOfGroups() const;
-
- /// \brief
- /// Gets the number of series in the given group.
- /// \param group The group index.
- /// \return
- /// The number of series in the group.
- int getNumberOfSeries(int group) const;
-
- /// \brief
- /// Gets the list of series in the given group.
- /// \param group The group index.
- /// \return
- /// The list of series in the given group.
- QList<int> getGroup(int group) const;
-
- /// \brief
- /// Finds the group index for the given series.
- /// \param series The series to look up.
- /// \return
- /// The group index of the series or -1 on failure.
- int findGroup(int series) const;
-
- /// \brief
- /// Updates the series indexes prior to an insert.
- /// \param seriesFirst The first index to be inserted.
- /// \param seriesLast The last index to be inserted.
- virtual void prepareInsert(int seriesFirst, int seriesLast);
-
- /// \brief
- /// Inserts a new series in the specified group.
- /// \param series The new series.
- /// \param group The group index.
- virtual void insertSeries(int series, int group);
-
- /// Sorts the newly inserted series if sorting is enabled.
- void finishInsert();
-
- /// \brief
- /// Removes a series from its group.
- /// \param series The series to remove.
- /// \return
- /// The series group index.
- virtual int removeSeries(int series);
-
- /// \brief
- /// Updates the series indexes after a removal.
- /// \param seriesFirst The first index removed.
- /// \param seriesLast The last index removed.
- virtual void finishRemoval(int seriesFirst=-1, int seriesLast=-1);
-
- /// Removes all the series groups.
- virtual void clear();
-
-public:
- /// \brief
- /// Merges two sorted lists of series indexes.
- /// \param target The list where the result will be stored.
- /// \param source The list of seires to merge.
- static void mergeSeriesLists(QList<int> &target, const QList<int> &source);
-
-protected:
- /// \brief
- /// Inserts a new group in the list.
- ///
- /// Subclasses can override this method to set up data structures
- /// associated with the series group.
- ///
- /// \param group The group index.
- virtual void insertGroup(int group);
-
- /// \brief
- /// Removes a group from the list.
- ///
- /// Subclasses should override this method to clean up any data
- /// structures associated with the series group.
- ///
- /// \param group The group index.
- virtual void removeGroup(int group);
-
-private:
- QList<QList<int> > Groups; ///< Stores the series groups.
- QList<QList<int> > ToSort; ///< Stores the new series groups.
- bool SortSeries; ///< True if series are sorted.
-};
-
-#endif
diff --git a/Modules/QmitkExt/vtkQtChartHeaders/vtkQtChartSeriesLayer.h b/Modules/QmitkExt/vtkQtChartHeaders/vtkQtChartSeriesLayer.h
deleted file mode 100644
index d78b39e2b2..0000000000
--- a/Modules/QmitkExt/vtkQtChartHeaders/vtkQtChartSeriesLayer.h
+++ /dev/null
@@ -1,230 +0,0 @@
-/*=========================================================================
-
- Program: Visualization Toolkit
- Module: $RCSfile: vtkQtChartSeriesLayer.h,v $
-
- Copyright (c) Ken Martin, Will Schroeder, Bill Lorensen
- All rights reserved.
- See Copyright.txt or http://www.kitware.com/Copyright.htm for details.
-
- This software is distributed WITHOUT ANY WARRANTY; without even
- the implied warranty of MERCHANTABILITY or FITNESS FOR A PARTICULAR
- PURPOSE. See the above copyright notice for more information.
-
-=========================================================================*/
-/*-------------------------------------------------------------------------
- Copyright 2008 Sandia Corporation.
- Under the terms of Contract DE-AC04-94AL85000 with Sandia Corporation,
- the U.S. Government retains certain rights in this software.
--------------------------------------------------------------------------*/
-
-/// \file vtkQtChartSeriesLayer.h
-/// \date February 14, 2008
-
-#ifndef _vtkQtChartSeriesLayer_h
-#define _vtkQtChartSeriesLayer_h
-
-#include "vtkQtChartExport.h"
-#include "vtkQtChartLayer.h"
-#include <QPixmap> // needed for return type
-
-class vtkQtChartContentsArea;
-class vtkQtChartSeriesModel;
-class vtkQtChartSeriesOptions;
-class vtkQtChartSeriesSelection;
-class vtkQtChartSeriesSelectionModel;
-class QPointF;
-class QRectF;
-
-
-/// \class vtkQtChartSeriesLayer
-/// \brief
-/// The vtkQtChartSeriesLayer class is the base class for chart
-/// layers that use the chart series model.
-///
-/// It stores the pointer to the chart series model and the list of
-/// options for the series. The series options are created using the
-/// \c createOptions method. Subclasses should overload this method to
-/// create the appropriate type of options object.
-class VTKQTCHART_EXPORT vtkQtChartSeriesLayer : public vtkQtChartLayer
-{
- Q_OBJECT
-
-public:
- enum {Type = vtkQtChart_SeriesLayerType};
-
-public:
- vtkQtChartSeriesLayer(bool useContents=true);
- virtual ~vtkQtChartSeriesLayer() {}
-
- /// \brief
- /// Sets the chart area for the chart layer.
- ///
- /// If the model is set before the chart layer is added to a chart
- /// area, series options will not be available. Setting the chart
- /// area will create the series options for the model in this case.
- /// Subclasses can extend this method to handle the new options.
- ///
- /// \param area The new chart area.
- virtual void setChartArea(vtkQtChartArea *area);
-
- /// \brief
- /// Gets the chart series model.
- /// \return
- /// A pointer to the chart series model.
- vtkQtChartSeriesModel *getModel() const {return this->Model;}
-
- /// \brief
- /// Sets the chart series model.
- /// \param model The new chart series model.
- virtual void setModel(vtkQtChartSeriesModel *model);
-
- /// \brief
- /// Gets the drawing options for the given series.
- /// \param series The index of the series.
- /// \return
- /// A pointer to the drawing options for the given series.
- vtkQtChartSeriesOptions *getSeriesOptions(int series) const;
-
- /// \brief
- /// Gets the index for the given series options.
- /// \param options The series options object.
- /// \return
- /// The index for the given series options.
- int getSeriesOptionsIndex(vtkQtChartSeriesOptions *options) const;
-
- /// \brief
- /// Gets the icon for a given series.
- ///
- /// The icon is used by the chart legend.
- ///
- /// \param series The index of the series.
- /// \return
- /// A pixmap representation of the series.
- virtual QPixmap getSeriesIcon(int series) const;
-
- /// \brief
- /// Gets the chart series selection model.
- /// \return
- /// A pointer to the chart series selection model.
- vtkQtChartSeriesSelectionModel *getSelectionModel() const;
-
- /// \brief
- /// Gets the list of series at a given position.
- /// \param point The position in scene coordinates.
- /// \param selection Used to return the list of series.
- virtual void getSeriesAt(const QPointF &point,
- vtkQtChartSeriesSelection &selection) const;
-
- /// \brief
- /// Gets the list of points at a given position.
- /// \param point The position in scene coordinates.
- /// \param selection Used to return the list of points.
- virtual void getPointsAt(const QPointF &point,
- vtkQtChartSeriesSelection &selection) const;
-
- /// \brief
- /// Gets the list of series in a given area.
- /// \param area The rectangle in scene coordinates.
- /// \param selection Used to return the list of series.
- virtual void getSeriesIn(const QRectF &area,
- vtkQtChartSeriesSelection &selection) const;
-
- /// \brief
- /// Gets the list of points in a given area.
- /// \param area The rectangle in scene coordinates.
- /// \param selection Used to return the list of points.
- virtual void getPointsIn(const QRectF &area,
- vtkQtChartSeriesSelection &selection) const;
-
-public slots:
- /// \brief
- /// Sets the contents x-axis offset.
- /// \param offset The new x-axis offset.
- void setXOffset(float offset);
-
- /// \brief
- /// Sets the contents y-axis offset.
- /// \param offset The new y-axis offset.
- void setYOffset(float offset);
-
- /// Resets the series options for the model.
- void resetSeriesOptions();
-
-signals:
- /// \brief
- /// Emitted when the series model is changed.
- /// \param previous The previous series model.
- /// \param current The current series model.
- void modelChanged(vtkQtChartSeriesModel *previous,
- vtkQtChartSeriesModel *current);
-
- /// \brief
- /// Emitted when the name or icon changes for a set of series.
- /// \param first The first series index of the range.
- /// \param last The last series index of the range.
- void modelSeriesChanged(int first, int last);
-
- /// \brief
- /// Emitted when the visibility for a series has changed.
- /// \param series The index of the series.
- /// \param visible True if the series is visible.
- void modelSeriesVisibilityChanged(int series, bool visible);
-
-protected:
- /// \brief
- /// Creates an options object for a series.
- /// \note
- /// Subclasses should only create the options in this method. Use
- /// the \c setupOptions to set up connections.
- /// \param parent The parent of the options object.
- /// \return
- /// A pointer to a new options object.
- /// \sa
- /// vtkQtChaerSeriesLayer::setupOptions(vtkQtChartSeriesOptions *)
- virtual vtkQtChartSeriesOptions *createOptions(QObject *parent) = 0;
-
- /// \brief
- /// Sets up the options object.
- ///
- /// The style has been reserved and set before this method is called.
- /// Signal connections should be set up here in order to avoid slot
- /// calls during setup.
- ///
- /// \param options The newly created series options.
- virtual void setupOptions(vtkQtChartSeriesOptions *options) = 0;
-
-private slots:
- /// \brief
- /// Inserts new options for the given series.
- /// \param first The first index of the new series.
- /// \param last The last index of the new series.
- void insertSeriesOptions(int first, int last);
-
- /// \brief
- /// Removes options for the given series.
- /// \param first The first index of the series to remove.
- /// \param last The last index of the series to remove.
- void removeSeriesOptions(int first, int last);
-
-private:
- /// Removes all the series options.
- void clearOptions();
-
-protected:
- /// Stores the series/point selection.
- vtkQtChartSeriesSelectionModel *Selection;
- vtkQtChartSeriesModel *Model; ///< Stores the series model.
- vtkQtChartContentsArea *Contents; ///< Used for panning.
-
-private:
- /// Stores the series options.
- QList<vtkQtChartSeriesOptions *> Options;
-
-private:
- vtkQtChartSeriesLayer(const vtkQtChartSeriesLayer &);
- vtkQtChartSeriesLayer &operator=(const vtkQtChartSeriesLayer &);
-};
-
-#endif
-
diff --git a/Modules/QmitkExt/vtkQtChartHeaders/vtkQtChartSeriesModel.h b/Modules/QmitkExt/vtkQtChartHeaders/vtkQtChartSeriesModel.h
deleted file mode 100644
index 59a8d67283..0000000000
--- a/Modules/QmitkExt/vtkQtChartHeaders/vtkQtChartSeriesModel.h
+++ /dev/null
@@ -1,117 +0,0 @@
-/*=========================================================================
-
- Program: Visualization Toolkit
- Module: $RCSfile: vtkQtChartSeriesModel.h,v $
-
- Copyright (c) Ken Martin, Will Schroeder, Bill Lorensen
- All rights reserved.
- See Copyright.txt or http://www.kitware.com/Copyright.htm for details.
-
- This software is distributed WITHOUT ANY WARRANTY; without even
- the implied warranty of MERCHANTABILITY or FITNESS FOR A PARTICULAR
- PURPOSE. See the above copyright notice for more information.
-
-=========================================================================*/
-/*-------------------------------------------------------------------------
- Copyright 2008 Sandia Corporation.
- Under the terms of Contract DE-AC04-94AL85000 with Sandia Corporation,
- the U.S. Government retains certain rights in this software.
--------------------------------------------------------------------------*/
-
-/// \file vtkQtChartSeriesModel.h
-/// \date February 8, 2008
-
-#ifndef _vtkQtChartSeriesModel_h
-#define _vtkQtChartSeriesModel_h
-
-#include "vtkQtChartExport.h"
-#include <QVariant> // Needed for return type.
-#include <QList> // Needed for return type.
-
-
-/// \class vtkQtChartSeriesModel
-/// \brief
-/// The vtkQtChartSeriesModel class is the base class for all chart
-/// series models.
-class VTKQTCHART_EXPORT vtkQtChartSeriesModel : public QObject
-{
- Q_OBJECT
-
-public:
- /// \brief
- /// Creates a chart series model.
- /// \param parent The parent object.
- vtkQtChartSeriesModel(QObject *parent=0);
- virtual ~vtkQtChartSeriesModel() {}
-
- /// \brief
- /// Gets the number of series in the model.
- /// \return
- /// The number of series in the model.
- virtual int getNumberOfSeries() const = 0;
-
- /// \brief
- /// Gets the number of values in a series.
- /// \param series The series index.
- /// \return
- /// The number of values in a series.
- virtual int getNumberOfSeriesValues(int series) const = 0;
-
- /// \brief
- /// Gets the name for the given series.
- /// \param series The series index.
- /// \return
- /// The name for the given series.
- virtual QVariant getSeriesName(int series) const = 0;
-
- /// \brief
- /// Gets the series value for the given index and component.
- /// \param series The series index.
- /// \param index The index in the given series.
- /// \param component The component index.
- /// \return
- /// The series value for the given index and component.
- virtual QVariant getSeriesValue(int series, int index,
- int component) const = 0;
-
- /// \brief
- /// Gets the value range for a series component.
- /// \param series The series index.
- /// \param component The component index.
- /// \return
- /// The value range for a series component.
- virtual QList<QVariant> getSeriesRange(int series, int component) const = 0;
-
-signals:
- /// Emitted when the model is about to be reset.
- void modelAboutToBeReset();
-
- /// Emitted when the model has been reset.
- void modelReset();
-
- /// \brief
- /// Emitted when series will be inserted into the model.
- /// \param first The first index to be added.
- /// \param last The last index to be added.
- void seriesAboutToBeInserted(int first, int last);
-
- /// \brief
- /// Emitted when series have been inserted into the model.
- /// \param first The first index that was inserted.
- /// \param last The last index that was inserted.
- void seriesInserted(int first, int last);
-
- /// \brief
- /// Emitted when series will be removed from the model.
- /// \param first The first index to be removed.
- /// \param last The last index to be removed.
- void seriesAboutToBeRemoved(int first, int last);
-
- /// \brief
- /// Emitted when series have been removed from the model.
- /// \param first The first index that was removed.
- /// \param last The last index that was removed.
- void seriesRemoved(int first, int last);
-};
-
-#endif
diff --git a/Modules/QmitkExt/vtkQtChartHeaders/vtkQtChartSeriesModelCollection.h b/Modules/QmitkExt/vtkQtChartHeaders/vtkQtChartSeriesModelCollection.h
deleted file mode 100644
index a0cda25c41..0000000000
--- a/Modules/QmitkExt/vtkQtChartHeaders/vtkQtChartSeriesModelCollection.h
+++ /dev/null
@@ -1,138 +0,0 @@
-/*=========================================================================
-
- Program: Visualization Toolkit
- Module: $RCSfile: vtkQtChartSeriesModelCollection.h,v $
-
- Copyright (c) Ken Martin, Will Schroeder, Bill Lorensen
- All rights reserved.
- See Copyright.txt or http://www.kitware.com/Copyright.htm for details.
-
- This software is distributed WITHOUT ANY WARRANTY; without even
- the implied warranty of MERCHANTABILITY or FITNESS FOR A PARTICULAR
- PURPOSE. See the above copyright notice for more information.
-
-=========================================================================*/
-/*-------------------------------------------------------------------------
- Copyright 2008 Sandia Corporation.
- Under the terms of Contract DE-AC04-94AL85000 with Sandia Corporation,
- the U.S. Government retains certain rights in this software.
--------------------------------------------------------------------------*/
-
-/// \file vtkQtChartSeriesModelCollection.h
-/// \date February 8, 2008
-
-#ifndef _vtkQtChartSeriesModelCollection_h
-#define _vtkQtChartSeriesModelCollection_h
-
-#include "vtkQtChartExport.h"
-#include "vtkQtChartSeriesModel.h"
-
-
-/// \class vtkQtChartSeriesModelCollection
-/// \brief
-/// The vtkQtChartSeriesModelCollection class is used to combine
-/// chart series models.
-///
-/// The collection maps the overall series index to the model
-/// specific series index.
-class VTKQTCHART_EXPORT vtkQtChartSeriesModelCollection :
- public vtkQtChartSeriesModel
-{
- Q_OBJECT
-
-public:
- /// \brief
- /// Creates a chart series model collection.
- /// \param parent The parent object.
- vtkQtChartSeriesModelCollection(QObject *parent=0);
- virtual ~vtkQtChartSeriesModelCollection() {}
-
- /// \name vtkQtChartSeriesModel Methods
- //@{
- virtual int getNumberOfSeries() const;
- virtual int getNumberOfSeriesValues(int series) const;
- virtual QVariant getSeriesName(int series) const;
- virtual QVariant getSeriesValue(int series, int index, int component) const;
- virtual QList<QVariant> getSeriesRange(int series, int component) const;
- //@}
-
- /// \brief
- /// Adds a series model to the collection.
- /// \param model The series model to add.
- void addSeriesModel(vtkQtChartSeriesModel *model);
-
- /// \brief
- /// Removes a series model from the collection.
- /// \param model The series model to remove.
- void removeSeriesModel(vtkQtChartSeriesModel *model);
-
- /// \brief
- /// Gets the number of series models in the collection.
- /// \return
- /// The number of series models in the collection.
- int getNumberOfSeriesModels() const;
-
- /// \brief
- /// Gets the series model at the specified index.
- /// \param index The series model index.
- /// \return
- /// A pointer to the series model.
- vtkQtChartSeriesModel *getSeriesModel(int index) const;
-
-protected slots:
- /// \brief
- /// Called when a series is about to be inserted into a model.
- ///
- /// This method uses the signal sender to determine which model has
- /// changed. It then maps the model series indexes to collection
- /// series indexes and re-emits the signal.
- ///
- /// \param first The first model series index.
- /// \param last The last model series index.
- void onSeriesAboutToBeInserted(int first, int last);
-
- /// \brief
- /// Called when a series is inserted into a model.
- /// \param first The first model series index.
- /// \param last The last model series index.
- void onSeriesInserted(int first, int last);
-
- /// \brief
- /// Called when a series is about to be removed from a model.
- /// \param first The first model series index.
- /// \param last The last model series index.
- void onSeriesAboutToBeRemoved(int first, int last);
-
- /// \brief
- /// Called when a series is removed from a model.
- /// \param first The first model series index.
- /// \param last The last model series index.
- void onSeriesRemoved(int first, int last);
-
-private:
- /// \brief
- /// Gets the series model for the given index.
- /// \param series The collection series index. Used to return the
- /// model series index.
- /// \return
- /// A pointer to the series model.
- vtkQtChartSeriesModel *modelForSeries(int &series) const;
-
- /// \brief
- /// Gets the first series in the given model.
- /// \param model The series model.
- /// \return
- /// The first series in the given model.
- int seriesForModel(vtkQtChartSeriesModel *model) const;
-
-private:
- QList<vtkQtChartSeriesModel *> Models; ///< Stores the models.
-
-private:
- vtkQtChartSeriesModelCollection(const vtkQtChartSeriesModelCollection &);
- vtkQtChartSeriesModelCollection &operator=(
- const vtkQtChartSeriesModelCollection &);
-};
-
-#endif
-
diff --git a/Modules/QmitkExt/vtkQtChartHeaders/vtkQtChartSeriesModelRange.h b/Modules/QmitkExt/vtkQtChartHeaders/vtkQtChartSeriesModelRange.h
deleted file mode 100644
index 53d669e14b..0000000000
--- a/Modules/QmitkExt/vtkQtChartHeaders/vtkQtChartSeriesModelRange.h
+++ /dev/null
@@ -1,103 +0,0 @@
-/*=========================================================================
-
- Program: Visualization Toolkit
- Module: $RCSfile: vtkQtChartSeriesModelRange.h,v $
-
- Copyright (c) Ken Martin, Will Schroeder, Bill Lorensen
- All rights reserved.
- See Copyright.txt or http://www.kitware.com/Copyright.htm for details.
-
- This software is distributed WITHOUT ANY WARRANTY; without even
- the implied warranty of MERCHANTABILITY or FITNESS FOR A PARTICULAR
- PURPOSE. See the above copyright notice for more information.
-
-=========================================================================*/
-/*-------------------------------------------------------------------------
- Copyright 2008 Sandia Corporation.
- Under the terms of Contract DE-AC04-94AL85000 with Sandia Corporation,
- the U.S. Government retains certain rights in this software.
--------------------------------------------------------------------------*/
-
-/// \file vtkQtChartSeriesModelRange.h
-/// \date February 19, 2008
-
-#ifndef _vtkQtChartSeriesModelRange_h
-#define _vtkQtChartSeriesModelRange_h
-
-#include "vtkQtChartExport.h"
-#include <QObject>
-#include <QList> // Needed for return type.
-#include <QVariant> // Needed for return type.
-
-class vtkQtChartSeriesModel;
-
-
-/// \class vtkQtChartSeriesModelRange
-/// \brief
-/// The vtkQtChartSeriesModelRange class stores the series ranges
-/// for a series model.
-class VTKQTCHART_EXPORT vtkQtChartSeriesModelRange : public QObject
-{
- Q_OBJECT
-
-public:
- /// \brief
- /// Creates a chart series model range.
- /// \param model The series model to use.
- vtkQtChartSeriesModelRange(vtkQtChartSeriesModel *model);
- ~vtkQtChartSeriesModelRange() {}
-
- /// \brief
- /// Initializes the series ranges.
- /// \param xShared True if the series share the same x-axis array.
- void initializeRanges(bool xShared=false);
-
- /// \brief
- /// Gets whether or not the series share the same x-axis array.
- /// \return
- /// True if the series share the same x-axis array.
- bool isXRangeShared() const {return this->XRangeShared;}
-
- /// \brief
- /// Gets the value range for a series component.
- /// \param series The series index.
- /// \param component The component index.
- /// \return
- /// The value range for a series component.
- QList<QVariant> getSeriesRange(int series, int component) const;
-
-private slots:
- /// Recalculates the series ranges.
- void resetSeries();
-
- /// \brief
- /// Adds series ranges to the list.
- ///
- /// The range for each series is calculated when it is added.
- ///
- /// \param first The first series index.
- /// \param last The last series index.
- void insertSeries(int first, int last);
-
- /// \brief
- /// Removes series ranges from the list.
- /// \param first The first series index.
- /// \param last The last series index.
- void removeSeries(int first, int last);
-
-private:
- /// \brief
- /// Calculates the range for the given series component.
- /// \param series The series index.
- /// \param component The component index.
- /// \return
- /// The value range for a series component.
- QList<QVariant> computeSeriesRange(int series, int component);
-
-private:
- QList<QList<QVariant> > Range[2]; ///< Stores the series ranges.
- vtkQtChartSeriesModel *Model; ///< Stores the series model.
- bool XRangeShared; ///< True if the series share the same x-axis array.
-};
-
-#endif
diff --git a/Modules/QmitkExt/vtkQtChartHeaders/vtkQtChartSeriesOptions.h b/Modules/QmitkExt/vtkQtChartHeaders/vtkQtChartSeriesOptions.h
deleted file mode 100644
index 5015029632..0000000000
--- a/Modules/QmitkExt/vtkQtChartHeaders/vtkQtChartSeriesOptions.h
+++ /dev/null
@@ -1,126 +0,0 @@
-/*=========================================================================
-
- Program: Visualization Toolkit
- Module: $RCSfile: vtkQtChartSeriesOptions.h,v $
-
- Copyright (c) Ken Martin, Will Schroeder, Bill Lorensen
- All rights reserved.
- See Copyright.txt or http://www.kitware.com/Copyright.htm for details.
-
- This software is distributed WITHOUT ANY WARRANTY; without even
- the implied warranty of MERCHANTABILITY or FITNESS FOR A PARTICULAR
- PURPOSE. See the above copyright notice for more information.
-
-=========================================================================*/
-/*-------------------------------------------------------------------------
- Copyright 2008 Sandia Corporation.
- Under the terms of Contract DE-AC04-94AL85000 with Sandia Corporation,
- the U.S. Government retains certain rights in this software.
--------------------------------------------------------------------------*/
-
-/// \file vtkQtChartSeriesOptions.h
-/// \date February 15, 2008
-
-#ifndef _vtkQtChartSeriesOptions_h
-#define _vtkQtChartSeriesOptions_h
-
-#include "vtkQtChartExport.h"
-#include <QObject>
-
-class vtkQtChartStyleGenerator;
-class QBrush;
-class QPen;
-
-
-/// \class vtkQtChartSeriesOptions
-/// \brief
-/// The vtkQtChartSeriesOptions class stores the common series
-/// drawing options.
-class VTKQTCHART_EXPORT vtkQtChartSeriesOptions : public QObject
-{
- Q_OBJECT
-
-public:
- /// \brief
- /// Creates a series options object.
- /// \param parent The parent object.
- vtkQtChartSeriesOptions(QObject *parent=0);
- vtkQtChartSeriesOptions(const vtkQtChartSeriesOptions &other);
- virtual ~vtkQtChartSeriesOptions();
-
- vtkQtChartSeriesOptions &operator=(const vtkQtChartSeriesOptions &other);
-
- /// \brief
- /// Gets the style generator index for the series.
- /// \return
- /// The style generator index for the series.
- int getStyle() const {return this->Style;}
-
- /// \brief
- /// Sets the style generator index for the series.
- ///
- /// This method only sets the style index. It can be overridden to
- /// use the generator to set other series options.
- ///
- /// \param style The style index for the generator.
- /// \param generator The style generator to use.
- virtual void setStyle(int style, vtkQtChartStyleGenerator *generator);
-
- /// \brief
- /// Gets whether or not the series should be visible.
- /// \return
- /// True if the series should be visible.
- bool isVisible() const {return this->Visible;}
-
- /// \brief
- /// Sets whether or not the series should be visible.
- /// \param visible True if the series should be visible.
- void setVisible(bool visible);
-
- /// \brief
- /// Gets the series pen.
- /// \return
- /// A reference to the series pen.
- const QPen &getPen() const;
-
- /// \brief
- /// Sets the series pen.
- /// \param pen The new series pen.
- void setPen(const QPen &pen);
-
- /// \brief
- /// Gets the series brush.
- /// \return
- /// A reference to the series brush.
- const QBrush &getBrush() const;
-
- /// \brief
- /// Sets the series brush.
- /// \param brush The new series brush.
- void setBrush(const QBrush &brush);
-
-signals:
- /// \brief
- /// Emitted when the series visibility option has changed.
- /// \param visible True if the series should be displayed.
- void visibilityChanged(bool visible);
-
- /// \brief
- /// Emitted when the series pen option has changed.
- /// \param pen The new series pen.
- void penChanged(const QPen &pen);
-
- /// \brief
- /// Emitted when the series brush option has changed.
- /// \param brush The new series brush.
- void brushChanged(const QBrush &brush);
-
-private:
- QPen *Pen; ///< Stores the series pen.
- QBrush *Brush; ///< Stores the series brush.
- int Style; ///< Stores the style generator index.
- bool Visible; ///< True if the series should be displayed.
-};
-
-#endif
-
diff --git a/Modules/QmitkExt/vtkQtChartHeaders/vtkQtChartSeriesSelection.h b/Modules/QmitkExt/vtkQtChartHeaders/vtkQtChartSeriesSelection.h
deleted file mode 100644
index 0438a53efc..0000000000
--- a/Modules/QmitkExt/vtkQtChartHeaders/vtkQtChartSeriesSelection.h
+++ /dev/null
@@ -1,251 +0,0 @@
-/*=========================================================================
-
- Program: Visualization Toolkit
- Module: $RCSfile: vtkQtChartSeriesSelection.h,v $
-
- Copyright (c) Ken Martin, Will Schroeder, Bill Lorensen
- All rights reserved.
- See Copyright.txt or http://www.kitware.com/Copyright.htm for details.
-
- This software is distributed WITHOUT ANY WARRANTY; without even
- the implied warranty of MERCHANTABILITY or FITNESS FOR A PARTICULAR
- PURPOSE. See the above copyright notice for more information.
-
-=========================================================================*/
-/*-------------------------------------------------------------------------
- Copyright 2008 Sandia Corporation.
- Under the terms of Contract DE-AC04-94AL85000 with Sandia Corporation,
- the U.S. Government retains certain rights in this software.
--------------------------------------------------------------------------*/
-
-/// \file vtkQtChartSeriesSelection.h
-/// \date March 14, 2008
-
-#ifndef _vtkQtChartSeriesSelection_h
-#define _vtkQtChartSeriesSelection_h
-
-#include "vtkQtChartExport.h"
-#include <QList> // needed for typedef
-#include <QPair> // needed for typedef
-
-typedef QList<QPair<int, int> > vtkQtChartIndexRangeList;
-typedef QPair<int, int> vtkQtChartIndexRange;
-
-
-/// \class vtkQtChartSeriesSelectionItem
-/// \brief
-/// The vtkQtChartSeriesSelectionItem class stores a list of index
-/// ranges.
-class VTKQTCHART_EXPORT vtkQtChartSeriesSelectionItem
-{
-public:
- vtkQtChartSeriesSelectionItem();
- vtkQtChartSeriesSelectionItem(int series);
- vtkQtChartSeriesSelectionItem(const vtkQtChartSeriesSelectionItem &other);
- ~vtkQtChartSeriesSelectionItem() {}
-
- vtkQtChartSeriesSelectionItem &operator=(
- const vtkQtChartSeriesSelectionItem &other);
-
- int Series; ///< Stores the series index.
- vtkQtChartIndexRangeList Points; ///< Stores the list of ranges.
-};
-
-
-/// \class vtkQtChartSeriesSelection
-/// \brief
-/// The vtkQtChartSeriesSelection class is used for series and point
-/// selection.
-class VTKQTCHART_EXPORT vtkQtChartSeriesSelection
-{
-public:
- enum SelectionType
- {
- NoSelection = 0, ///< No selection is made.
- SeriesSelection, ///< The selection contains series indexes.
- PointSelection ///< The selection contains point indexes.
- };
-
-public:
- vtkQtChartSeriesSelection();
- vtkQtChartSeriesSelection(const vtkQtChartSeriesSelection &other);
- ~vtkQtChartSeriesSelection() {}
-
- /// \brief
- /// Gets whether or not the selection is empty.
- /// \return
- /// True if the selection is empty.
- bool isEmpty() const;
-
- /// \brief
- /// Gets the selection type.
- /// \return
- /// The selection type.
- SelectionType getType() const;
-
- /// Clears the selection lists.
- bool clear();
-
- /// \name Series Selection Methods
- //@{
- /// \brief
- /// Gets the list of selected series ranges.
- /// \return
- /// A reference to the list of selected series ranges.
- const vtkQtChartIndexRangeList &getSeries() const;
-
- /// \brief
- /// Sets the list of selected series ranges.
- /// \param series The new list of selected series ranges.
- /// \return
- /// True if the selection was modified.
- bool setSeries(const vtkQtChartIndexRangeList &series);
-
- /// \brief
- /// Sets the list of selected series ranges.
- /// \param series The series index range to select.
- /// \return
- /// True if the selection was modified.
- bool setSeries(const vtkQtChartIndexRange &series);
-
- /// \brief
- /// Adds the list of series ranges to the selection.
- /// \param series The list of selected series ranges to add.
- /// \return
- /// True if the selection was modified.
- bool addSeries(const vtkQtChartIndexRangeList &series);
-
- /// \brief
- /// Adds the series index range to the selection.
- /// \param series The series index range to add.
- /// \return
- /// True if the selection was modified.
- bool addSeries(const vtkQtChartIndexRange &series);
-
- /// \brief
- /// Subtracts the list of series ranges from the selection.
- /// \param series The list of selected series ranges to subtract.
- /// \return
- /// True if the selection was modified.
- bool subtractSeries(const vtkQtChartIndexRangeList &series);
-
- /// \brief
- /// Subtracts the series index range from the selection.
- /// \param series The series index range to subtract.
- /// \return
- /// True if the selection was modified.
- bool subtractSeries(const vtkQtChartIndexRange &series);
-
- /// \brief
- /// Selects unique series from the given list and the selection.
- /// \param series The list of series ranges.
- /// \return
- /// True if the selection was modified.
- bool xorSeries(const vtkQtChartIndexRangeList &series);
-
- /// \brief
- /// Selects unique series from the given range and the selection.
- /// \param series The series index range.
- /// \return
- /// True if the selection was modified.
- bool xorSeries(const vtkQtChartIndexRange &series);
-
- /// \brief
- /// Trims the selected series to the given bounds.
- /// \param minimum The minimum series index.
- /// \param maximum The maximum series index.
- void limitSeries(int minimum, int maximum);
- //@}
-
- /// \name Point Selection Methods
- //@{
- /// \brief
- /// Gets the list of selected point ranges.
- /// \return
- /// A reference to the list of selected point ranges.
- const QList<vtkQtChartSeriesSelectionItem> &getPoints() const;
-
- /// \brief
- /// Sets the list of selected point ranges.
- /// \param points The new list of selected point ranges.
- /// \return
- /// True if the selection was modified.
- bool setPoints(const QList<vtkQtChartSeriesSelectionItem> &points);
-
- /// \brief
- /// Adds the list of point ranges to the selection.
- /// \param points The list of selected point ranges to add.
- /// \return
- /// True if the selection was modified.
- bool addPoints(const QList<vtkQtChartSeriesSelectionItem> &points);
-
- /// \brief
- /// Subtracts the list of point ranges from the selection.
- /// \param points The list of selected point ranges to subtract.
- /// \return
- /// True if the selection was modified.
- bool subtractPoints(const QList<vtkQtChartSeriesSelectionItem> &points);
-
- /// \brief
- /// Subtracts all the selected points in the given series from
- /// the selection.
- /// \param series The list of series ranges to subtract.
- /// \return
- /// True if the selection was modified.
- bool subtractPoints(const vtkQtChartIndexRange &series);
-
- /// \brief
- /// Selects unique points from the given list and the selection.
- /// \param points The list of point ranges.
- /// \return
- /// True if the selection was modified.
- bool xorPoints(const QList<vtkQtChartSeriesSelectionItem> &points);
-
- /// \brief
- /// Gets the list of series that have selected points.
- /// \return
- /// The list of series that have selected points.
- QList<int> getPointSeries() const;
-
- /// \brief
- /// Trims the selected point indexes for the given series.
- /// \param series The series index.
- /// \param minimum The minimum point index.
- /// \param maximum The maximum point index.
- void limitPoints(int series, int minimum, int maximum);
- //@}
-
- vtkQtChartSeriesSelection &operator=(const vtkQtChartSeriesSelection &other);
-
-private:
- /// \brief
- /// Adds the source ranges to the target ranges.
- /// \param source The list of index ranges to add.
- /// \param target The list of index ranges to be added to.
- /// \return
- /// True if the target list was modified in the union.
- bool addRanges(const vtkQtChartIndexRangeList &source,
- vtkQtChartIndexRangeList &target);
-
- /// \brief
- /// Subtracts the source ranges from the target ranges.
- /// \param source The list of index ranges to subtract.
- /// \param target The list of index ranges to be subtracted from.
- /// \return
- /// True if the target list was modified in the subtraction.
- bool subtractRanges(const vtkQtChartIndexRangeList &source,
- vtkQtChartIndexRangeList &target);
-
- /// \brief
- /// Trims the index ranges to be within the given bounds.
- /// \param list The index ranges to limit.
- /// \param minimum The minimum index.
- /// \param maximum The maximum index.
- void limitRanges(vtkQtChartIndexRangeList &list, int minimum, int maximum);
-
-private:
- vtkQtChartIndexRangeList Series; ///< Stores the selected series.
- QList<vtkQtChartSeriesSelectionItem> Points; ///< Stores the selected points.
-};
-
-#endif
diff --git a/Modules/QmitkExt/vtkQtChartHeaders/vtkQtChartSeriesSelectionHandler.h b/Modules/QmitkExt/vtkQtChartHeaders/vtkQtChartSeriesSelectionHandler.h
deleted file mode 100644
index 1e7dd45bf2..0000000000
--- a/Modules/QmitkExt/vtkQtChartHeaders/vtkQtChartSeriesSelectionHandler.h
+++ /dev/null
@@ -1,115 +0,0 @@
-/*=========================================================================
-
- Program: Visualization Toolkit
- Module: $RCSfile: vtkQtChartSeriesSelectionHandler.h,v $
-
- Copyright (c) Ken Martin, Will Schroeder, Bill Lorensen
- All rights reserved.
- See Copyright.txt or http://www.kitware.com/Copyright.htm for details.
-
- This software is distributed WITHOUT ANY WARRANTY; without even
- the implied warranty of MERCHANTABILITY or FITNESS FOR A PARTICULAR
- PURPOSE. See the above copyright notice for more information.
-
-=========================================================================*/
-/*-------------------------------------------------------------------------
- Copyright 2008 Sandia Corporation.
- Under the terms of Contract DE-AC04-94AL85000 with Sandia Corporation,
- the U.S. Government retains certain rights in this software.
--------------------------------------------------------------------------*/
-
-/// \file vtkQtChartSeriesSelectionHandler.h
-/// \date March 19, 2008
-
-#ifndef _vtkQtChartSeriesSelectionHandler_h
-#define _vtkQtChartSeriesSelectionHandler_h
-
-#include "vtkQtChartExport.h"
-#include "vtkQtChartMouseSelectionHandler.h"
-
-class vtkQtChartSeriesLayer;
-class vtkQtChartSeriesSelectionHandlerInternal;
-
-
-/// \class vtkQtChartSeriesSelectionHandler
-/// \brief
-/// The vtkQtChartSeriesSelectionHandler class handles mouse
-/// selection for chart series layers.
-class VTKQTCHART_EXPORT vtkQtChartSeriesSelectionHandler :
- public vtkQtChartMouseSelectionHandler
-{
-public:
- /// \brief
- /// Creates a chart series selection handler.
- /// \param parent The parent object.
- vtkQtChartSeriesSelectionHandler(QObject *parent=0);
- virtual ~vtkQtChartSeriesSelectionHandler();
-
- /// \name Setup Methods
- //@{
- /// \brief
- /// Sets the mode names for series and point selection.
- ///
- /// Pass in an empty string to prevent that mode type.
- ///
- /// \param series The name of the series selection mode.
- /// \param points The name of the point selection mode.
- void setModeNames(const QString &series, const QString &points);
-
- /// \brief
- /// Sets the allowed modifiers for the selection modes.
- ///
- /// If the shift modifier is allowed, the selection handler will
- /// allow the user to select contiguous items. If the control
- /// modifier is allowed, the selection handler will allow the user
- /// to do xor selection.
- ///
- /// \param series The allowed series mode modifiers.
- /// \param points The allowed point mode modifiers.
- void setMousePressModifiers(Qt::KeyboardModifiers series,
- Qt::KeyboardModifiers points);
-
- /// \brief
- /// Gets the chart layer associated with the handler.
- /// \return
- /// A pointer to the chart layer.
- vtkQtChartSeriesLayer *getLayer() const {return this->Layer;}
-
- /// \brief
- /// Sets the chart layer associated with the handler.
- /// \param layer The chart layer for the handler to use.
- void setLayer(vtkQtChartSeriesLayer *layer) {this->Layer = layer;}
- //@}
-
- /// \name vtkQtChartMouseSelectionHandler Methods
- //@{
- virtual int getNumberOfModes() const;
- virtual void getModeList(QStringList &list) const;
-
- virtual bool mousePressEvent(const QString &mode, QMouseEvent *e,
- vtkQtChartArea *chart);
- virtual bool isMouseMoveAvailable(const QString &mode) const;
- virtual void startMouseMove(const QString &mode, vtkQtChartArea *chart);
- virtual void mouseMoveEvent(const QString &mode, QMouseEvent *e,
- vtkQtChartArea *chart);
- virtual void finishMouseMove(const QString &mode, vtkQtChartArea *chart);
- virtual bool mouseReleaseEvent(const QString &mode, QMouseEvent *e,
- vtkQtChartArea *chart);
- virtual bool mouseDoubleClickEvent(const QString &mode, QMouseEvent *e,
- vtkQtChartArea *chart);
- //@}
-
-protected:
- vtkQtChartSeriesLayer *Layer; ///< Stores the chart layer.
-
-private:
- /// Stores the selection information.
- vtkQtChartSeriesSelectionHandlerInternal *Internal;
-
-private:
- vtkQtChartSeriesSelectionHandler(const vtkQtChartSeriesSelectionHandler &);
- vtkQtChartSeriesSelectionHandler &operator=(
- const vtkQtChartSeriesSelectionHandler &);
-};
-
-#endif
diff --git a/Modules/QmitkExt/vtkQtChartHeaders/vtkQtChartSeriesSelectionModel.h b/Modules/QmitkExt/vtkQtChartHeaders/vtkQtChartSeriesSelectionModel.h
deleted file mode 100644
index e114cf759c..0000000000
--- a/Modules/QmitkExt/vtkQtChartHeaders/vtkQtChartSeriesSelectionModel.h
+++ /dev/null
@@ -1,221 +0,0 @@
-/*=========================================================================
-
- Program: Visualization Toolkit
- Module: $RCSfile: vtkQtChartSeriesSelectionModel.h,v $
-
- Copyright (c) Ken Martin, Will Schroeder, Bill Lorensen
- All rights reserved.
- See Copyright.txt or http://www.kitware.com/Copyright.htm for details.
-
- This software is distributed WITHOUT ANY WARRANTY; without even
- the implied warranty of MERCHANTABILITY or FITNESS FOR A PARTICULAR
- PURPOSE. See the above copyright notice for more information.
-
-=========================================================================*/
-/*-------------------------------------------------------------------------
- Copyright 2008 Sandia Corporation.
- Under the terms of Contract DE-AC04-94AL85000 with Sandia Corporation,
- the U.S. Government retains certain rights in this software.
--------------------------------------------------------------------------*/
-
-/// \file vtkQtChartSeriesSelectionModel.h
-/// \date March 14, 2008
-
-#ifndef _vtkQtChartSeriesSelectionModel_h
-#define _vtkQtChartSeriesSelectionModel_h
-
-#include "vtkQtChartExport.h"
-#include <QObject>
-
-class vtkQtChartSeriesModel;
-class vtkQtChartSeriesSelection;
-
-
-/// \class vtkQtChartSeriesSelectionModel
-/// \brief
-/// The vtkQtChartSeriesSelectionModel class ties a series selection
-/// to a series model.
-class VTKQTCHART_EXPORT vtkQtChartSeriesSelectionModel : public QObject
-{
- Q_OBJECT
-
-public:
- /// \brief
- /// Creates a series selection model.
- /// \param parent The parent object.
- vtkQtChartSeriesSelectionModel(QObject *parent=0);
- virtual ~vtkQtChartSeriesSelectionModel();
-
- /// \brief
- /// Gets the series model associated with the selection model.
- /// \return
- /// The series model associated with the selection model.
- vtkQtChartSeriesModel *getModel() const {return this->Model;}
-
- /// \brief
- /// Sets the series model associated with the selection model.
- /// \param model The new series model.
- void setModel(vtkQtChartSeriesModel *model);
-
- /// \brief
- /// Gets whether or not the selection model is in an interactive
- /// change.
- /// \return
- /// Trure if the selection model is in an interactive change.
- /// \sa vtkQtChartSeriesSelectionModel::beginInteractiveChange()
- bool isInInteractiveChange() const {return this->InInteractMode;}
-
- /// \brief
- /// Called to begin an interactive selection change.
- ///
- /// Interactive selection changes such as a selection box can send
- /// a lot of change signals as the user drags the mouse around. The
- /// chart needs to update the selection based on those signals in
- /// order for the user to see the changes. If an expensive process
- /// is attached to the selection change signal, this can cause a
- /// visible slow-down in the application. This method allows the
- /// selection to keep the chart painter up to date while allowing
- /// the expensive process to delay execution.
- ///
- /// The interactive controller should call this method before
- /// starting a change such as with a selection box. It should call
- /// the \c endInteractiveChange method when the interaction is done.
- /// The expensive process should listen to the \c selectionChanged
- /// and \c interactionFinished signals. The \c interactionFinished
- /// is emitted at the end of the interactive change. In order to
- /// keep track of non-interactive changes, the \c selectionChanged
- /// signal must be monitored. This signal will be emitted for every
- /// selection change. Therefore, the listening code should check
- /// to see if the model is in an interactive change before executing
- /// an expensive process.
- void beginInteractiveChange();
-
- /// \brief
- /// Called to end an interactive selection change.
- /// \sa vtkQtChartSeriesSelectionModel::beginInteractiveChange()
- void endInteractiveChange();
-
- /// \brief
- /// Gets whether or not the selection is empty.
- /// \return
- /// True if the selection is empty.
- bool isSelectionEmpty() const;
-
- /// \brief
- /// Gets the current selection.
- /// \return
- /// A reference to the current selection.
- const vtkQtChartSeriesSelection &getSelection() const;
-
- /// Selects all the model series.
- void selectAllSeries();
-
- /// Selects all the model points.
- void selectAllPoints();
-
- /// Clears the selection.
- void selectNone();
-
- /// Inverts the selection.
- void selectInverse();
-
- /// \brief
- /// Sets the current selection.
- /// \param selection The new selection.
- void setSelection(const vtkQtChartSeriesSelection &selection);
-
- /// \brief
- /// Adds to the current selection.
- /// \param selection The selection to add.
- void addSelection(const vtkQtChartSeriesSelection &selection);
-
- /// \brief
- /// Subtracts from the current selection.
- /// \param selection The selection to subtract.
- void subtractSelection(const vtkQtChartSeriesSelection &selection);
-
- /// \brief
- /// Performs an exclusive or between the specified selection and
- /// the current selection.
- /// \param selection The selection to modify the current selection.
- void xorSelection(const vtkQtChartSeriesSelection &selection);
-
-signals:
- /// \brief
- /// Emitted when the selection changes.
- /// \param list The list of selected series/points.
- void selectionChanged(const vtkQtChartSeriesSelection &list);
-
- /// \brief
- /// Emitted when an interactive selection change is finished.
- ///
- /// This signal can be used to delay expensive processes until
- /// after the selection change is complete.
- ///
- /// \sa vtkQtChartSeriesSelectionModel::beginInteractiveChange()
- void interactionFinished();
-
-public slots:
- /// \name Model Modification Handlers
- //@{
- /// \brief
- /// Begins the model reset process.
- ///
- /// The selection model is cleared. The selection changed signal
- /// is emitted when the model finishes resetting.
- void beginModelReset();
-
- /// Ends the model reset process.
- void endModelReset();
-
- /// \brief
- /// Begins the series insertion process.
- ///
- /// The indexes for the series in the selection model are updated
- /// to reflect the changes. The selection changed signal is emitted
- /// when the insertion is completed.
- ///
- /// \param first The first index of the insertion range.
- /// \param last The last index of the insertion range.
- void beginInsertSeries(int first, int last);
-
- /// \brief
- /// Ends the series insertion process.
- /// \param first The first index of the insertion range.
- /// \param last The last index of the insertion range.
- void endInsertSeries(int first, int last);
-
- /// \brief
- /// Begins the series removal process.
- ///
- /// Any reference to the removed range is deleted from the selection
- /// model. The selection indexes are updated to reflect the change.
- /// The selection changed signal is emitted when the removal is
- /// completed.
- ///
- /// \param first The first index of the removal range.
- /// \param last The last index of the removal range.
- void beginRemoveSeries(int first, int last);
-
- /// \brief
- /// Ends the series removal process.
- /// \param first The first index of the removal range.
- /// \param last The last index of the removal range.
- void endRemoveSeries(int first, int last);
- //@}
-
-private:
- /// \brief
- /// Trims the selection to ranges valid for the model.
- /// \param list The selection to limit.
- void limitSelection(vtkQtChartSeriesSelection &list);
-
-private:
- /// Stores the series selection.
- vtkQtChartSeriesSelection *Selection;
- vtkQtChartSeriesModel *Model; ///< A pointer to the model.
- bool PendingSignal; ///< Used during model changes.
- bool InInteractMode; ///< True if in interact mode.
-};
-
-#endif
diff --git a/Modules/QmitkExt/vtkQtChartHeaders/vtkQtChartShape.h b/Modules/QmitkExt/vtkQtChartHeaders/vtkQtChartShape.h
deleted file mode 100644
index bd07ce4191..0000000000
--- a/Modules/QmitkExt/vtkQtChartHeaders/vtkQtChartShape.h
+++ /dev/null
@@ -1,152 +0,0 @@
-/*=========================================================================
-
- Program: Visualization Toolkit
- Module: $RCSfile: vtkQtChartShape.h,v $
-
- Copyright (c) Ken Martin, Will Schroeder, Bill Lorensen
- All rights reserved.
- See Copyright.txt or http://www.kitware.com/Copyright.htm for details.
-
- This software is distributed WITHOUT ANY WARRANTY; without even
- the implied warranty of MERCHANTABILITY or FITNESS FOR A PARTICULAR
- PURPOSE. See the above copyright notice for more information.
-
-=========================================================================*/
-/*-------------------------------------------------------------------------
- Copyright 2008 Sandia Corporation.
- Under the terms of Contract DE-AC04-94AL85000 with Sandia Corporation,
- the U.S. Government retains certain rights in this software.
--------------------------------------------------------------------------*/
-
-/// \file vtkQtChartShape.h
-/// \date November 13, 2008
-
-#ifndef _vtkQtChartShape_h
-#define _vtkQtChartShape_h
-
-#include "vtkQtChartExport.h"
-
-class QPointF;
-class QPolygonF;
-class QRectF;
-
-
-/// \class vtkQtChartShape
-/// \brief
-/// The vtkQtChartShape class is the base class for shapes used in
-/// the chart shape locators.
-class VTKQTCHART_EXPORT vtkQtChartShape
-{
-public:
- enum BoundingBoxCode
- {
- Left = 0x01000000, ///< Left of bounding box.
- Top = 0x00010000, ///< Above the bounding box.
- Right = 0x00000100, ///< Right of bounding box.
- Bottom = 0x00000001 ///< Below the bounding box.
- };
-
-public:
- vtkQtChartShape();
-
- /// \brief
- /// Constructs a chart shape.
- /// \param series The series index.
- /// \param index The index in the given series.
- vtkQtChartShape(int series, int index);
- vtkQtChartShape(const vtkQtChartShape &other);
- virtual ~vtkQtChartShape() {}
-
- vtkQtChartShape &operator=(const vtkQtChartShape &other);
-
- /// \brief
- /// Gets the bounding box for the shape.
- /// \param bounds Used to return the bounding box.
- virtual void getBounds(QRectF &bounds) const = 0;
-
- /// \brief
- /// Gets whether or not the shape contains the given point.
- /// \param point The position to evaluate.
- /// \return
- /// True if the shape contains the given point.
- virtual bool contains(const QPointF &point) const = 0;
-
- /// \brief
- /// Gets whether or not the shape intersects the given area.
- /// \param area The area to evaluate.
- /// \return
- /// True if the shape intersects the given area.
- virtual bool intersects(const QRectF &area) const = 0;
-
- /// \brief
- /// Sets the shape for rectangular types.
- ///
- /// This method can be used to set the shape. The default
- /// implementation does nothing. This is useful for objects that
- /// have a rectangular shape.
- ///
- /// \param rectangle The new shape.
- /// \sa vtkQtChartShape::setPolygon(const QPolygonF &)
- virtual void setRectangle(const QRectF &rectangle);
-
- /// \brief
- /// Sets the shape for polygonal types.
- ///
- /// This method can be used to set the shape. The default
- /// implementation does nothing. This is useful for objects that
- /// have a polygonal shape.
- ///
- /// \param polygon The new shape.
- /// \sa vtkQtChartShape::setRectangle(const QRectF &)
- virtual void setPolygon(const QPolygonF &polygon);
-
- /// \brief
- /// Gets the series number.
- /// \return
- /// The series number.
- int getSeries() const {return this->Series;}
-
- /// \brief
- /// Sets the series number.
- /// \param series The new series number.
- void setSeries(int series) {this->Series = series;}
-
- /// \brief
- /// Gets the index in the series.
- /// \return
- /// The index in the series.
- int getIndex() const {return this->Index;}
-
- /// \brief
- /// Sets the index in the series.
- /// \param index The new index in the series.
- void setIndex(int index) {this->Index = index;}
-
-public:
- /// \brief
- /// Gets the bounding box code for the given point and rectangle.
- ///
- /// This method combines the x and y bounding box codes.
- ///
- /// \param point The position to evaluate.
- /// \param bounds The bounding box.
- static int getBoundingBoxCode(const QPointF &point, const QRectF &bounds);
-
- /// \brief
- /// Gets the bounding box code for the given coordinate and rectangle.
- /// \param x The x position to evaluate.
- /// \param bounds The bounding box.
- static int getXBoundingBoxCode(float x, const QRectF &bounds);
-
- /// \brief
- /// Gets the bounding box code for the given coordinate and rectangle.
- /// \param y The y position to evaluate.
- /// \param bounds The bounding box.
- static int getYBoundingBoxCode(float y, const QRectF &bounds);
-
-private:
- int Series; ///< Stores the series.
- int Index; ///< Stores the index.
-};
-
-#endif
diff --git a/Modules/QmitkExt/vtkQtChartHeaders/vtkQtChartShapeLocator.h b/Modules/QmitkExt/vtkQtChartHeaders/vtkQtChartShapeLocator.h
deleted file mode 100644
index 8621278028..0000000000
--- a/Modules/QmitkExt/vtkQtChartHeaders/vtkQtChartShapeLocator.h
+++ /dev/null
@@ -1,231 +0,0 @@
-/*=========================================================================
-
- Program: Visualization Toolkit
- Module: $RCSfile: vtkQtChartShapeLocator.h,v $
-
- Copyright (c) Ken Martin, Will Schroeder, Bill Lorensen
- All rights reserved.
- See Copyright.txt or http://www.kitware.com/Copyright.htm for details.
-
- This software is distributed WITHOUT ANY WARRANTY; without even
- the implied warranty of MERCHANTABILITY or FITNESS FOR A PARTICULAR
- PURPOSE. See the above copyright notice for more information.
-
-=========================================================================*/
-/*-------------------------------------------------------------------------
- Copyright 2008 Sandia Corporation.
- Under the terms of Contract DE-AC04-94AL85000 with Sandia Corporation,
- the U.S. Government retains certain rights in this software.
--------------------------------------------------------------------------*/
-
-/// \file vtkQtChartShapeLocator.h
-/// \date October 15, 2008
-
-#ifndef _vtkQtChartShapeLocator_h
-#define _vtkQtChartShapeLocator_h
-
-#include "vtkQtChartExport.h"
-#include <QLinkedList> // Needed for parameter.
-#include <QList> // Needed for parameter.
-
-class vtkQtChartShape;
-class QPointF;
-class QRectF;
-
-
-/// \class vtkQtChartShapeLocatorNode
-/// \brief
-/// The vtkQtChartShapeLocatorNode class is used to build a tree of
-/// chart shapes.
-class VTKQTCHART_EXPORT vtkQtChartShapeLocatorNode
-{
-public:
- /// \brief
- /// Constructs a chart shape locator node.
- /// \param element The chart shape element to wrap.
- vtkQtChartShapeLocatorNode(vtkQtChartShape *element=0);
- ~vtkQtChartShapeLocatorNode();
-
- /// \brief
- /// Gets whether or not the bounding area contains the given point.
- /// \param point The position to evaluate.
- /// \return
- /// True if the bounding area contains the given point.
- bool contains(const QPointF &point) const;
-
- /// \brief
- /// Gets whether or not the bounding area intersects the given area.
- /// \param area The rectangle to evaluate.
- /// \return
- /// True if the bounding area intersects the given area.
- bool intersects(const QRectF &area) const;
-
- /// \brief
- /// Gets the bounding rectangle.
- /// \return
- /// The bounding rectangle.
- const QRectF &getBounds() const {return *this->Bounds;}
-
- /// \brief
- /// Sets the bounding rectangle.
- /// \param bounds The new bounding rectangle.
- void setBounds(const QRectF &bounds);
-
- /// \brief
- /// Gets the chart shape element.
- /// \return
- /// A pointer to the chart shape element.
- vtkQtChartShape *getElement() const {return this->Element;}
-
- /// \brief
- /// Sets the chart shape element.
- /// \param element The new chart shape element.
- void setElement(vtkQtChartShape *element);
-
- /// \brief
- /// Gets the parent node.
- /// \return
- /// A pointer to the parent node.
- vtkQtChartShapeLocatorNode *getParent() const {return this->Parent;}
-
- /// \brief
- /// Sets the parent node.
- /// \param parent The new parent node.
- void setParent(vtkQtChartShapeLocatorNode *parent) {this->Parent = parent;}
-
- /// \brief
- /// Gets whether or not the node has children.
- /// \return
- /// True if the node has children.
- bool hasChildren() const {return this->Nodes.size() > 0;}
-
- /// \brief
- /// Gets the list of child nodes.
- /// \return
- /// The list of child nodes.
- const QList<vtkQtChartShapeLocatorNode *> &getNodes() const {return this->Nodes;}
-
- /// \brief
- /// Gets the list of child nodes.
- /// \return
- /// The list of child nodes.
- QList<vtkQtChartShapeLocatorNode *> &getNodes() {return this->Nodes;}
-
- /// \brief
- /// Updates the bounding rectangle.
- ///
- /// The bounding rectangle is the bounds of the element or the
- /// bounds of the child nodes.
- void updateBounds();
-
-private:
- QRectF *Bounds; ///< Stores the bounds.
- vtkQtChartShape *Element; ///< Stores the shape.
- vtkQtChartShapeLocatorNode *Parent; ///< Stores the parent node.
- QList<vtkQtChartShapeLocatorNode *> Nodes; ///< Stores the child nodes.
-
-private:
- vtkQtChartShapeLocatorNode(const vtkQtChartShapeLocatorNode &);
- vtkQtChartShapeLocatorNode &operator=(const vtkQtChartShapeLocatorNode &);
-};
-
-
-/// \class vtkQtChartShapeLocator
-/// \brief
-/// The vtkQtChartShapeLocator class is used to locate shapes in a
-/// tree structure.
-///
-/// The tree is built from a table of shapes. The leaf nodes store the
-/// shapes and use them for searches. The parent nodes in the tree use
-/// the bounding rectangle for searches. The bounding rectangles can
-/// be updated if the layout remains unchanged.
-class VTKQTCHART_EXPORT vtkQtChartShapeLocator
-{
-public:
- vtkQtChartShapeLocator();
- ~vtkQtChartShapeLocator();
-
- /// Removes all the tree items.
- void clear();
-
- /// \brief
- /// Builds a shape tree from the ordered table of shapes.
- ///
- /// The shape pointers are stored by the tree and should not be
- /// deleted until the tree has been cleared.
- ///
- /// \param table The ordered table of shapes.
- void build(const QList<QList<vtkQtChartShape *> > &table);
-
- /// \brief
- /// Builds a shape tree from the list of shapes.
- ///
- /// The list of shapes should be sorted in the x-axis direction
- /// before calling this method. The list will be divided into a
- /// table and sorted in the y-axis direction before building the
- /// tree. The shape pointers are stored by the tree and should not
- /// be deleted until the tree has been cleared.
- ///
- /// \param list The list of shapes.
- void build(const QList<vtkQtChartShape *> &list);
-
- /// \brief
- /// Updates the bounding rectangles in the shape tree.
- ///
- /// The nodes are traversed from last to first. The bounding
- /// rectangle of each node is updated using the shape if it is a
- /// leaf or the bounds of the children otherwise.
- void update();
-
- /// \brief
- /// Gets the shapes at the specified point.
- /// \param point The point to search.
- /// \return
- /// The list of shapes at the given point.
- QList<vtkQtChartShape *> getItemsAt(const QPointF &point) const;
-
- /// \brief
- /// Gets the shapes in the specified rectangle.
- /// \param area The rectangle to search.
- /// \return
- /// The list of shapes in the given rectangle.
- QList<vtkQtChartShape *> getItemsIn(const QRectF &area) const;
-
- /// \brief
- /// Gets the last node in the tree.
- /// \return
- /// A pointer to the last node in the tree.
- vtkQtChartShapeLocatorNode *getLast();
-
- /// \brief
- /// Gets the previous node in the tree.
- /// \param node The node to search from.
- /// \return
- /// A pointer to the previous node in the tree.
- vtkQtChartShapeLocatorNode *getPrevious(vtkQtChartShapeLocatorNode *node);
-
-public:
- /// \brief
- /// Sorts the list of shapes according to the y value.
- ///
- /// The list of shapes is sorted by the y-axis value using a quick
- /// sort algorithm. The list is sorted in place and non-recursively.
- ///
- /// \param list The list of shapes to be sorted.
- static void sort(QList<vtkQtChartShape *> &list);
-
-private:
- /// \brief
- /// Builds a shape tree from the ordered table of items.
- /// \param table the ordered table of items.
- void build(QLinkedList<QLinkedList<vtkQtChartShapeLocatorNode *> > &table);
-
-private:
- vtkQtChartShapeLocatorNode *Root; ///< Stores the root node.
-
-private:
- vtkQtChartShapeLocator(const vtkQtChartShapeLocator &);
- vtkQtChartShapeLocator &operator=(const vtkQtChartShapeLocator &);
-};
-
-#endif
diff --git a/Modules/QmitkExt/vtkQtChartHeaders/vtkQtChartStyleGenerator.h b/Modules/QmitkExt/vtkQtChartHeaders/vtkQtChartStyleGenerator.h
deleted file mode 100644
index 98b3ba611c..0000000000
--- a/Modules/QmitkExt/vtkQtChartHeaders/vtkQtChartStyleGenerator.h
+++ /dev/null
@@ -1,66 +0,0 @@
-/* -*- Mode: C++; -*- */
-
-/*=========================================================================
-
- Program: Visualization Toolkit
- Module: $RCSfile: vtkQtChartStyleGenerator.h,v $
-
- Copyright (c) Ken Martin, Will Schroeder, Bill Lorensen
- All rights reserved.
- See Copyright.txt or http://www.kitware.com/Copyright.htm for details.
-
- This software is distributed WITHOUT ANY WARRANTY; without even
- the implied warranty of MERCHANTABILITY or FITNESS FOR A PARTICULAR
- PURPOSE. See the above copyright notice for more information.
-
-=========================================================================*/
-/*-------------------------------------------------------------------------
- Copyright 2008 Sandia Corporation.
- Under the terms of Contract DE-AC04-94AL85000 with Sandia Corporation,
- the U.S. Government retains certain rights in this software.
--------------------------------------------------------------------------*/
-
-/// \file vtkQtChartStyleGenerator.h
-/// \date February 15, 2008
-
-#ifndef __vtkQtChartStyleGenerator_h
-#define __vtkQtChartStyleGenerator_h
-
-#include "vtkQtChartExport.h"
-#include <QObject>
-#include <QBrush> // Needed for return value.
-#include <QPen> // Needed for return value.
-
-
-/// \class vtkQtChartStyleGenerator
-/// \brief
-/// The vtkQtChartStyleGenerator class is the base class for all
-/// series options generators.
-class VTKQTCHART_EXPORT vtkQtChartStyleGenerator : public QObject
-{
- Q_OBJECT
-
-public:
- /// \brief
- /// Creates a chart style generator.
- /// \param parent The parent object.
- vtkQtChartStyleGenerator(QObject *parent=0);
- virtual ~vtkQtChartStyleGenerator() {}
-
- /// \brief
- /// Gets the brush for the specified series index.
- /// \param index The series index.
- /// \return
- /// The brush for the specified series index.
- virtual QBrush getSeriesBrush(int index) const = 0;
-
- /// \brief
- /// Gets the pen for the specified series index.
- /// \param index The series index.
- /// \return
- /// The pen for the specified series index.
- virtual QPen getSeriesPen(int index) const = 0;
-};
-
-#endif
-
diff --git a/Modules/QmitkExt/vtkQtChartHeaders/vtkQtChartStyleManager.h b/Modules/QmitkExt/vtkQtChartHeaders/vtkQtChartStyleManager.h
deleted file mode 100644
index 08a3c1329a..0000000000
--- a/Modules/QmitkExt/vtkQtChartHeaders/vtkQtChartStyleManager.h
+++ /dev/null
@@ -1,92 +0,0 @@
-/*=========================================================================
-
- Program: Visualization Toolkit
- Module: $RCSfile: vtkQtChartStyleManager.h,v $
-
- Copyright (c) Ken Martin, Will Schroeder, Bill Lorensen
- All rights reserved.
- See Copyright.txt or http://www.kitware.com/Copyright.htm for details.
-
- This software is distributed WITHOUT ANY WARRANTY; without even
- the implied warranty of MERCHANTABILITY or FITNESS FOR A PARTICULAR
- PURPOSE. See the above copyright notice for more information.
-
-=========================================================================*/
-/*-------------------------------------------------------------------------
- Copyright 2008 Sandia Corporation.
- Under the terms of Contract DE-AC04-94AL85000 with Sandia Corporation,
- the U.S. Government retains certain rights in this software.
--------------------------------------------------------------------------*/
-
-/// \file vtkQtChartStyleManager.h
-/// \date February 15, 2008
-
-#ifndef _vtkQtChartStyleManager_h
-#define _vtkQtChartStyleManager_h
-
-
-#include "vtkQtChartExport.h"
-#include <QObject>
-
-class vtkQtChartStyleGenerator;
-
-
-/// \class vtkQtChartStyleManager
-/// \brief
-/// The vtkQtChartStyleManager class allows several chart layers
-/// to share the same style generator.
-///
-/// Sharing a style generator keeps the style from repeating. This is
-/// useful when several chart layers are displayed in the same chart.
-/// For example, a line chart and a bar chart can share a style
-/// generator to make sure that none of the series are the same color.
-class VTKQTCHART_EXPORT vtkQtChartStyleManager : public QObject
-{
-public:
- /// \brief
- /// Creates a chart style manager.
- /// \param parent The parent object.
- vtkQtChartStyleManager(QObject *parent=0);
- virtual ~vtkQtChartStyleManager() {}
-
- /// \brief
- /// Gets the options generator.
- /// \return
- /// A pointer to the options generator.
- vtkQtChartStyleGenerator *getGenerator();
-
- /// \brief
- /// Sets the options generator.
- /// \param generator The new options generator.
- void setGenerator(vtkQtChartStyleGenerator *generator);
-
- /// \brief
- /// Reserves a style index for the style generator.
- ///
- /// The index returned is the lowest index available. If there are
- /// empty spots from removals, the index will come from the first
- /// empty spot.
- ///
- /// \return
- /// The reserved style index for the style generator.
- int reserveStyle();
-
- /// \brief
- /// Releases a series style index.
- ///
- /// When an index is released, the empty spot is saved so it can be
- /// used for the next reservation.
- ///
- /// \param index The style index to release.
- void releaseStyle(int index);
-
-private:
- /// Stores the default style generator.
- vtkQtChartStyleGenerator *DefaultGenerator;
-
- /// Stores the current style generator.
- vtkQtChartStyleGenerator *Generator;
- QList<int> Ids; ///< Stores the list of available indexes.
-};
-
-#endif
diff --git a/Modules/QmitkExt/vtkQtChartHeaders/vtkQtChartTableSeriesModel.h b/Modules/QmitkExt/vtkQtChartHeaders/vtkQtChartTableSeriesModel.h
deleted file mode 100644
index 8b44727021..0000000000
--- a/Modules/QmitkExt/vtkQtChartHeaders/vtkQtChartTableSeriesModel.h
+++ /dev/null
@@ -1,140 +0,0 @@
-/*=========================================================================
-
- Program: Visualization Toolkit
- Module: $RCSfile: vtkQtChartTableSeriesModel.h,v $
-
- Copyright (c) Ken Martin, Will Schroeder, Bill Lorensen
- All rights reserved.
- See Copyright.txt or http://www.kitware.com/Copyright.htm for details.
-
- This software is distributed WITHOUT ANY WARRANTY; without even
- the implied warranty of MERCHANTABILITY or FITNESS FOR A PARTICULAR
- PURPOSE. See the above copyright notice for more information.
-
-=========================================================================*/
-/*-------------------------------------------------------------------------
- Copyright 2008 Sandia Corporation.
- Under the terms of Contract DE-AC04-94AL85000 with Sandia Corporation,
- the U.S. Government retains certain rights in this software.
--------------------------------------------------------------------------*/
-
-/// \file vtkQtChartTableSeriesModel.h
-/// \date February 11, 2008
-
-#ifndef _vtkQtChartTableSeriesModel_h
-#define _vtkQtChartTableSeriesModel_h
-
-#include "vtkQtChartExport.h"
-#include "vtkQtChartSeriesModel.h"
-
-class vtkQtChartSeriesModelRange;
-class QAbstractItemModel;
-class QModelIndex;
-
-
-/// \class vtkQtChartTableSeriesModel
-/// \brief
-/// The vtkQtChartTableSeriesModel class is a chart series model
-/// proxy for a QAbstractItemModel table.
-class VTKQTCHART_EXPORT vtkQtChartTableSeriesModel :
- public vtkQtChartSeriesModel
-{
- Q_OBJECT
-
-public:
- /// \brief
- /// Creates a table series model.
- /// \param model The item model to display.
- /// \param parent The parent object.
- vtkQtChartTableSeriesModel(QAbstractItemModel *model, QObject *parent=0);
- virtual ~vtkQtChartTableSeriesModel() {}
-
- /// \brief
- /// Gets whether or not columns are series.
- /// \return
- /// True if columns are series.
- bool getColumnsAsSeries() const;
-
- /// \brief
- /// Sets whether or not columns are series.
- /// \param columnsAsSeries True if columns are series.
- void setColumnsAsSeries(bool columnsAsSeries);
-
- /// \name vtkQtChartSeriesModel Methods
- //@{
- virtual int getNumberOfSeries() const;
- virtual int getNumberOfSeriesValues(int series) const;
- virtual QVariant getSeriesName(int series) const;
- virtual QVariant getSeriesValue(int series, int index, int component) const;
- virtual QList<QVariant> getSeriesRange(int series, int component) const;
- //@}
-
-protected slots:
- /// \brief
- /// Called when the item model is about to insert rows.
- /// \param index The parent model index.
- /// \param first The first index of the insertion range.
- /// \param last The last index of the insertion range.
- void rowsAboutToBeInserted(const QModelIndex &index, int first, int last);
-
- /// \brief
- /// Called when the item model has inserted rows.
- /// \param index The parent model index.
- /// \param first The first index of the insertion range.
- /// \param last The last index of the insertion range.
- void rowsInserted(const QModelIndex &index, int first, int last);
-
- /// \brief
- /// Called when the item model is about to insert columns.
- /// \param index The parent model index.
- /// \param first The first index of the insertion range.
- /// \param last The last index of the insertion range.
- void columnsAboutToBeInserted(const QModelIndex &index, int first, int last);
-
- /// \brief
- /// Called when the item model has inserted columns.
- /// \param index The parent model index.
- /// \param first The first index of the insertion range.
- /// \param last The last index of the insertion range.
- void columnsInserted(const QModelIndex &index, int first, int last);
-
- /// \brief
- /// Called when the item model is about to remove rows.
- /// \param index The parent model index.
- /// \param first The first index of the removal range.
- /// \param last The last index of the removal range.
- void rowsAboutToBeRemoved(const QModelIndex &index, int first, int last);
-
- /// \brief
- /// Called when the item model has removed rows.
- /// \param index The parent model index.
- /// \param first The first index of the removal range.
- /// \param last The last index of the removal range.
- void rowsRemoved(const QModelIndex &index, int first, int last);
-
- /// \brief
- /// Called when the item model is about to remove columns.
- /// \param index The parent model index.
- /// \param first The first index of the removal range.
- /// \param last The last index of the removal range.
- void columnsAboutToBeRemoved(const QModelIndex &index, int first, int last);
-
- /// \brief
- /// Called when the item model has removed columns.
- /// \param index The parent model index.
- /// \param first The first index of the removal range.
- /// \param last The last index of the removal range.
- void columnsRemoved(const QModelIndex &index, int first, int last);
-
-protected:
- QAbstractItemModel *Model; ///< Stores the item model.
- vtkQtChartSeriesModelRange *Range; ///< Stores the series ranges.
- bool ColumnsAsSeries; ///< True if columns are series.
-
-private:
- vtkQtChartTableSeriesModel(const vtkQtChartTableSeriesModel &);
- vtkQtChartTableSeriesModel &operator=(const vtkQtChartTableSeriesModel &);
-};
-
-#endif
-
diff --git a/Modules/QmitkExt/vtkQtChartHeaders/vtkQtChartTitle.h b/Modules/QmitkExt/vtkQtChartHeaders/vtkQtChartTitle.h
deleted file mode 100644
index 28f34d98ea..0000000000
--- a/Modules/QmitkExt/vtkQtChartHeaders/vtkQtChartTitle.h
+++ /dev/null
@@ -1,125 +0,0 @@
-/*=========================================================================
-
- Program: Visualization Toolkit
- Module: $RCSfile: vtkQtChartTitle.h,v $
-
- Copyright (c) Ken Martin, Will Schroeder, Bill Lorensen
- All rights reserved.
- See Copyright.txt or http://www.kitware.com/Copyright.htm for details.
-
- This software is distributed WITHOUT ANY WARRANTY; without even
- the implied warranty of MERCHANTABILITY or FITNESS FOR A PARTICULAR
- PURPOSE. See the above copyright notice for more information.
-
-=========================================================================*/
-/*-------------------------------------------------------------------------
- Copyright 2008 Sandia Corporation.
- Under the terms of Contract DE-AC04-94AL85000 with Sandia Corporation,
- the U.S. Government retains certain rights in this software.
--------------------------------------------------------------------------*/
-
-/// \file vtkQtChartTitle.h
-/// \date 11/17/2006
-
-#ifndef _vtkQtChartTitle_h
-#define _vtkQtChartTitle_h
-
-
-#include "vtkQtChartExport.h"
-#include <QWidget>
-#include <QString> // Needed for return type
-
-class QPainter;
-
-
-/// \class vtkQtChartTitle
-/// \brief
-/// The vtkQtChartTitle class is used to draw a chart title.
-///
-/// The text for the title can be drawn horizontally or vertically.
-/// This allows the title to be used on a vertical axis.
-class VTKQTCHART_EXPORT vtkQtChartTitle : public QWidget
-{
- Q_OBJECT
-
-public:
- /// \brief
- /// Creates a chart title instance.
- /// \param orient The orientation of the title.
- /// \param parent The parent widget.
- vtkQtChartTitle(Qt::Orientation orient=Qt::Horizontal, QWidget *parent=0);
- virtual ~vtkQtChartTitle() {}
-
- /// \brief
- /// Gets the orientation of the chart title.
- /// \return
- /// The orientation of the chart title.
- Qt::Orientation getOrientation() const {return this->Orient;}
-
- /// \brief
- /// Sets the orientation of the chart title.
- /// \param orient The orientation of the title.
- void setOrientation(Qt::Orientation orient);
-
- /// \brief
- /// Gets the chart title text.
- /// \return
- /// The chart title text.
- QString getText() const {return this->Text;}
-
- /// \brief
- /// Sets the chart title text.
- /// \param text The text to display.
- void setText(const QString &text);
-
- /// \brief
- /// Gets the text alignment flags for the title.
- /// \return
- /// The text alignment flags for the title.
- int getTextAlignment() const {return this->Align;}
-
- /// \brief
- /// Sets the text alignment flags for the title.
- /// \param flags The text alignment flags to use.
- void setTextAlignment(int flags) {this->Align = flags;}
-
- /// \brief
- /// Gets the preferred size of the chart title.
- /// \return
- /// The preferred size of the chart title.
- virtual QSize sizeHint() const {return this->Bounds;}
-
- /// \brief
- /// Draws the title using the given painter.
- /// \param painter The painter to use.
- void drawTitle(QPainter &painter);
-
-signals:
- /// Emitted when the title orientation has changed.
- void orientationChanged();
-
-protected:
- /// \brief
- /// Updates the layout when the font changes.
- /// \param e Event specific information.
- /// \return
- /// True if the event was handled.
- virtual bool event(QEvent *e);
-
- /// \brief
- /// Draws the chart title.
- /// \param e Event specific information.
- virtual void paintEvent(QPaintEvent *e);
-
-private:
- /// Calculates the preferred size of the chart title.
- void calculateSize();
-
-private:
- QString Text; ///< Stores the display text.
- QSize Bounds; ///< Stores the preferred size.
- Qt::Orientation Orient; ///< Stores the title orientation.
- int Align; ///< Stores the text alignment flags.
-};
-
-#endif
diff --git a/Modules/QmitkExt/vtkQtChartHeaders/vtkQtChartWidget.h b/Modules/QmitkExt/vtkQtChartHeaders/vtkQtChartWidget.h
deleted file mode 100644
index 625c8a185c..0000000000
--- a/Modules/QmitkExt/vtkQtChartHeaders/vtkQtChartWidget.h
+++ /dev/null
@@ -1,164 +0,0 @@
-/*=========================================================================
-
- Program: Visualization Toolkit
- Module: $RCSfile: vtkQtChartWidget.h,v $
-
- Copyright (c) Ken Martin, Will Schroeder, Bill Lorensen
- All rights reserved.
- See Copyright.txt or http://www.kitware.com/Copyright.htm for details.
-
- This software is distributed WITHOUT ANY WARRANTY; without even
- the implied warranty of MERCHANTABILITY or FITNESS FOR A PARTICULAR
- PURPOSE. See the above copyright notice for more information.
-
-=========================================================================*/
-/*-------------------------------------------------------------------------
- Copyright 2008 Sandia Corporation.
- Under the terms of Contract DE-AC04-94AL85000 with Sandia Corporation,
- the U.S. Government retains certain rights in this software.
--------------------------------------------------------------------------*/
-
-/// \file vtkQtChartWidget.h
-/// \date 11/21/2006
-
-#ifndef _vtkQtChartWidget_h
-#define _vtkQtChartWidget_h
-
-
-#include "vtkQtChartExport.h"
-#include <QWidget>
-#include "vtkQtChartAxis.h" // Needed for enum
-
-class vtkQtChartLegend;
-class vtkQtChartTitle;
-class vtkQtChartArea;
-class QGridLayout;
-class QHBoxLayout;
-class QPrinter;
-class QString;
-class QStringList;
-class QVBoxLayout;
-
-
-
-/// \class vtkQtChartWidget
-/// \brief
-/// The vtkQtChartWidget class is a container for the chart widgets.
-///
-/// The main charting widget is the chart area. It holds the chart
-/// layers. The title and legend widgets are arranged around the
-/// chart area. A title can be added for each axis as well as an
-/// overall title for the chart.
-///
-/// The main chart area is created and owned by the chart widget. The
-/// other widgets should be created and passed in.
-class VTKQTCHART_EXPORT vtkQtChartWidget : public QWidget
-{
- Q_OBJECT
-
-public:
- /// \brief
- /// Creates a chart widget instance.
- /// \param parent The parent widget.
- vtkQtChartWidget(QWidget *parent=0);
- virtual ~vtkQtChartWidget();
-
- /// \brief
- /// Gets the overall title for the chart.
- /// \return
- /// A pointer to the overall title for the chart.
- vtkQtChartTitle *getTitle() const {return this->Title;}
-
- /// \brief
- /// Sets the overall title for the chart.
- /// \param title The new chart title.
- void setTitle(vtkQtChartTitle *title);
-
- /// \brief
- /// Gets the chart legend.
- /// \return
- /// A pointer to the chart legend.
- vtkQtChartLegend *getLegend() const {return this->Legend;}
-
- /// \brief
- /// Sets the chart legend.
- /// \param legend The new chart legend.
- void setLegend(vtkQtChartLegend *legend);
-
- /// \brief
- /// Gets the main chart area.
- /// \return
- /// A pointer to the main chart area.
- vtkQtChartArea *getChartArea() const {return this->Charts;}
-
- /// \brief
- /// Gets the title for the given axis location.
- /// \param axis The axis location on the chart.
- /// \return
- /// A pointer to the axis title.
- vtkQtChartTitle *getAxisTitle(vtkQtChartAxis::AxisLocation axis) const;
-
- /// \brief
- /// Sets the title for the given axis location.
- /// \param axis The axis location on the chart.
- /// \param title The new axis title.
- void setAxisTitle(vtkQtChartAxis::AxisLocation axis, vtkQtChartTitle *title);
-
- /// \brief
- /// Gets the preferred size of the chart.
- /// \return
- /// The preferred size of the chart.
- virtual QSize sizeHint() const;
-
-public slots:
- /// \brief
- /// Prints the chart using the given printer.
- /// \param printer The printer to use.
- void printChart(QPrinter &printer);
-
- /// \brief
- /// Saves a screenshot of the chart to the given files.
- /// \param files The list of files to write.
- void saveChart(const QStringList &files);
-
- /// \brief
- /// Saves a screenshot of the chart to the given file.
- /// \param filename The name of the file to write.
- void saveChart(const QString &filename);
-
-signals:
- /// \brief
- /// Emitted when a new chart title has been set.
- /// \param title The new chart title.
- void newChartTitle(vtkQtChartTitle *title);
-
- /// \brief
- /// Emitted when a new chart legend has been set.
- /// \param legend The new chart legend.
- void newChartLegend(vtkQtChartLegend *legend);
-
- /// \brief
- /// Emitted when a new axis title has been set.
- /// \param axis The axis location.
- /// \param title The new axis title.
- void newAxisTitle(vtkQtChartAxis::AxisLocation axis, vtkQtChartTitle *title);
-
-private slots:
- /// Moves the legend when the location changes.
- void changeLegendLocation();
-
-private:
- vtkQtChartTitle *Title; ///< Stores the chart title.
- vtkQtChartLegend *Legend; ///< Stores the chart legend.
- vtkQtChartArea *Charts; ///< Stores the chart area.
- vtkQtChartTitle *LeftTitle; ///< Stores the left axis title.
- vtkQtChartTitle *TopTitle; ///< Stores the top axis title.
- vtkQtChartTitle *RightTitle; ///< Stores the right axis title.
- vtkQtChartTitle *BottomTitle; ///< Stores the bottom axis title.
- QVBoxLayout *TitleLayout; ///< Layout for the chart title.
- QGridLayout *LegendLayout; ///< Layout for the chart legend.
- QVBoxLayout *TopLayout; ///< Layout for the top and bottom titles.
- QHBoxLayout *ChartLayout; ///< Layout for the chart and other titles.
-};
-
-#endif
diff --git a/Modules/QmitkExt/vtkQtChartHeaders/vtkQtChartZoomHistory.h b/Modules/QmitkExt/vtkQtChartHeaders/vtkQtChartZoomHistory.h
deleted file mode 100644
index b703b520b4..0000000000
--- a/Modules/QmitkExt/vtkQtChartHeaders/vtkQtChartZoomHistory.h
+++ /dev/null
@@ -1,211 +0,0 @@
-/*=========================================================================
-
- Program: Visualization Toolkit
- Module: $RCSfile: vtkQtChartZoomHistory.h,v $
-
- Copyright (c) Ken Martin, Will Schroeder, Bill Lorensen
- All rights reserved.
- See Copyright.txt or http://www.kitware.com/Copyright.htm for details.
-
- This software is distributed WITHOUT ANY WARRANTY; without even
- the implied warranty of MERCHANTABILITY or FITNESS FOR A PARTICULAR
- PURPOSE. See the above copyright notice for more information.
-
-=========================================================================*/
-/*-------------------------------------------------------------------------
- Copyright 2008 Sandia Corporation.
- Under the terms of Contract DE-AC04-94AL85000 with Sandia Corporation,
- the U.S. Government retains certain rights in this software.
--------------------------------------------------------------------------*/
-
-/// \file vtkQtChartZoomHistory.h
-/// \date 2/7/2008
-
-#ifndef _vtkQtChartZoomHistory_h
-#define _vtkQtChartZoomHistory_h
-
-
-#include "vtkQtChartExport.h"
-
-class vtkQtChartZoomHistoryInternal;
-
-
-/// \class vtkQtChartZoomViewport
-/// \brief
-/// The vtkQtChartZoomViewport class stores the position and zoom
-/// factors for a viewport.
-///
-/// The position stores the top-left corner of the viewport in
-/// content coordinates. The zoom factors are stored as percentages.
-class VTKQTCHART_EXPORT vtkQtChartZoomViewport
-{
-public:
- vtkQtChartZoomViewport();
- ~vtkQtChartZoomViewport() {}
-
- /// \brief
- /// Sets the viewport position coordinates.
- /// \param x The x coordinate.
- /// \param y The y coordinate.
- /// \sa vtkQtChartZoomViewport::getXPosition(),
- /// vtkQtChartZoomViewport::getYPosition()
- void setPosition(float x, float y);
-
- /// \brief
- /// Sets the zoom percentages.
- /// \param x The x-axis zoom factor.
- /// \param y The y-axis zoom factor.
- /// \sa vtkQtChartZoomViewport::getXZoom(),
- /// vtkQtChartZoomViewport::getYZoom()
- void setZoom(float x, float y);
-
- /// \brief
- /// Gets the x coordinate of the viewport.
- /// \return
- /// The x coordinate of the viewport.
- /// \sa vtkQtChartZoomViewport::setPosition(float, float)
- float getXPosition() const {return this->X;}
-
- /// \brief
- /// Gets the y coordinate of the viewport.
- /// \return
- /// The y coordinate of the viewport.
- /// \sa vtkQtChartZoomViewport::setPosition(float, float)
- float getYPosition() const {return this->Y;}
-
- /// \brief
- /// Gets the x-axis zoom factor.
- /// \return
- /// The x-axis zoom factor.
- /// \sa vtkQtChartZoomViewport::setZoom(float, float)
- float getXZoom() const {return this->XFactor;}
-
- /// \brief
- /// Gets the y-axis zoom factor.
- /// \return
- /// The y-axis zoom factor.
- /// \sa vtkQtChartZoomViewport::setZoom(float, float)
- float getYZoom() const {return this->YFactor;}
-
-private:
- float X; ///< Stores the x position coordinate.
- float Y; ///< Stores the y position coordinate.
- float XFactor; ///< Stores the x-axis zoom factor.
- float YFactor; ///< Stores the y-axis zoom factor.
-};
-
-
-/// \class vtkQtChartZoomHistory
-/// \brief
-/// The vtkQtChartZoomHistory class stores a list of
-/// vtkQtChartZoomViewport objects.
-///
-/// The zoom history contains a list of zoom viewports. The list is
-/// ordered chronologically, and contains an index to the current item.
-/// The history list is limited to a certain number of items. The
-/// default limit is 10, but it can be changed using the \c setLimit
-/// method.
-///
-/// When adding items to the history list, the new item will become
-/// the current item. The front of the list may be trimmed to stay
-/// within limits. If the current item is in the middle of the list,
-/// the subsequent items will be removed before adding the new item
-/// to the end of the list.
-///
-/// The history list is navigated using the \c getPrevious and
-/// \c getNext methods. You can also use the \c getCurrent method to
-/// get the current item without changing the index.
-///
-/// \sa vtkQtChartZoomHistory::setLimit(int),
-/// vtkQtChartZoomHistory::addHistory(float, float, float, float),
-/// vtkQtChartZoomHistory::getNext(),
-/// vtkQtChartZoomHistory::getPrevious(),
-/// vtkQtChartZoomHistory::getCurrent()
-class VTKQTCHART_EXPORT vtkQtChartZoomHistory
-{
-public:
- vtkQtChartZoomHistory();
- ~vtkQtChartZoomHistory();
-
- /// \brief
- /// Sets the maximum number of items in the history.
- /// \param limit The maximum number of entries.
- void setLimit(int limit);
-
- /// \brief
- /// Gets the maximum number of items in the history.
- /// \return
- /// The maximum number of entries.
- int getLimit() const {return this->Allowed;}
-
- /// \brief
- /// Adds a zoom viewport to the history list.
- ///
- /// The new item will become the current item in the list. If the
- /// current item is not at the end of the list, all the subsequent
- /// items will be removed. If the list is longer than the allowed
- /// limit, items will be removed from the front of the list.
- ///
- /// \param x The x position of the viewport.
- /// \param y The y position of the viewport.
- /// \param xZoom The x-axis zoom factor for the viewport.
- /// \param yZoom The y-axis zoom factor for the viewport.
- /// \sa vtkQtChartZoomHistory::updatePosition(float, float)
- void addHistory(float x, float y, float xZoom, float yZoom);
-
- /// \brief
- /// Used to update the viewport position for the current
- /// zoom factors.
- ///
- /// This method allows the current zoom viewport to be updated when
- /// the user changes the viewport position by panning or scrolling.
- ///
- /// \param x The x position of the viewport.
- /// \param y The y position of the viewport.
- /// \sa vtkQtChartZoomHistory::addHistory(float, float, float, float)
- void updatePosition(float x, float y);
-
- /// \brief
- /// Gets whether or not a zoom viewport is before the current.
- /// \return
- /// True if a zoom viewport is before the current.
- bool isPreviousAvailable() const;
-
- /// \brief
- /// Gets whether or not a zoom viewport is after the current.
- /// \return
- /// True if a zoom viewport is after the current.
- bool isNextAvailable() const;
-
- /// \brief
- /// Gets the current zoom viewport.
- /// \return
- /// A pointer to the current zoom viewport or null if the list
- /// is empty.
- const vtkQtChartZoomViewport *getCurrent() const;
-
- /// \brief
- /// Gets the previous zoom viewport in the history.
- /// \return
- /// A pointer to the previous zoom viewport or null if the
- /// beginning of the list is reached.
- /// \sa vtkQtChartZoomHistory::getNext()
- const vtkQtChartZoomViewport *getPrevious();
-
- /// \brief
- /// Gets the next zoom viewport in the history.
- /// \return
- /// A pointer to the next zoom viewport or null if the end
- /// of the list is reached.
- /// \sa vtkQtChartZoomHistory::getPrevious()
- const vtkQtChartZoomViewport *getNext();
-
-private:
- /// Stores the zoom viewport list.
- vtkQtChartZoomHistoryInternal *Internal;
-
- int Current; ///< Stores the current item index.
- int Allowed; ///< Stores the list length limit.
-};
-
-#endif
diff --git a/Modules/QmitkExt/vtkQtChartHeaders/vtkQtLineChart.h b/Modules/QmitkExt/vtkQtChartHeaders/vtkQtLineChart.h
deleted file mode 100644
index fabb4f1f01..0000000000
--- a/Modules/QmitkExt/vtkQtChartHeaders/vtkQtLineChart.h
+++ /dev/null
@@ -1,235 +0,0 @@
-/*=========================================================================
-
- Program: Visualization Toolkit
- Module: $RCSfile: vtkQtLineChart.h,v $
-
- Copyright (c) Ken Martin, Will Schroeder, Bill Lorensen
- All rights reserved.
- See Copyright.txt or http://www.kitware.com/Copyright.htm for details.
-
- This software is distributed WITHOUT ANY WARRANTY; without even
- the implied warranty of MERCHANTABILITY or FITNESS FOR A PARTICULAR
- PURPOSE. See the above copyright notice for more information.
-
-=========================================================================*/
-/*-------------------------------------------------------------------------
- Copyright 2008 Sandia Corporation.
- Under the terms of Contract DE-AC04-94AL85000 with Sandia Corporation,
- the U.S. Government retains certain rights in this software.
--------------------------------------------------------------------------*/
-
-/// \file vtkQtLineChart.h
-/// \date February 14, 2008
-
-#ifndef _vtkQtChartLineLayer_h
-#define _vtkQtChartLineLayer_h
-
-#include "vtkQtChartExport.h"
-#include "vtkQtChartSeriesLayer.h"
-
-class vtkQtLineChartInternal;
-class vtkQtLineChartOptions;
-class vtkQtLineChartSeriesOptions;
-
-
-/// \class vtkQtLineChart
-/// \brief
-/// The vtkQtLineChart class is used to display a line chart.
-class VTKQTCHART_EXPORT vtkQtLineChart : public vtkQtChartSeriesLayer
-{
- Q_OBJECT
-
-public:
- enum {Type = vtkQtChart_LineChartType};
-
-public:
- vtkQtLineChart();
- virtual ~vtkQtLineChart();
-
- /// \name Setup Methods
- //@{
- virtual void setChartArea(vtkQtChartArea *area);
-
- virtual void setModel(vtkQtChartSeriesModel *model);
- //@}
-
- /// \name Drawing Parameters
- //@{
- /// \brief
- /// Gets the line chart drawing options.
- /// \return
- /// A pointer to the line chart drawing options.
- vtkQtLineChartOptions *getOptions() const {return this->Options;}
-
- /// \brief
- /// Sets the line chart drawing options.
- ///
- /// This method sets all the options at once, which can prevent
- /// unnecessary view updates.
- ///
- /// \param options The new line chart drawing options.
- void setOptions(const vtkQtLineChartOptions &options);
-
- /// \brief
- /// Gets the line chart series options.
- /// \param series The series index.
- /// \return
- /// A pointer to the line chart series options.
- vtkQtLineChartSeriesOptions *getLineSeriesOptions(int series) const;
-
- virtual QPixmap getSeriesIcon(int series) const;
- //@}
-
- /// \name Layout Methods
- //@{
- virtual void getLayerDomain(vtkQtChartLayerDomain &domain) const;
-
- virtual void layoutChart(const QRectF &area);
-
- virtual bool getHelpText(const QPointF &point, QString &text);
-
- /// \brief
- /// Notifies the chart layer that a resize interaction has finished.
- ///
- /// The chart search trees are not updated while the chart is in an
- /// interactive state. It is updated in this method if needed.
- virtual void finishInteractiveResize();
- //@}
-
- /// \name Selection Methods
- //@{
- virtual void getSeriesAt(const QPointF &point,
- vtkQtChartSeriesSelection &selection) const;
-
- virtual void getPointsAt(const QPointF &point,
- vtkQtChartSeriesSelection &selection) const;
-
- virtual void getSeriesIn(const QRectF &area,
- vtkQtChartSeriesSelection &selection) const;
-
- virtual void getPointsIn(const QRectF &area,
- vtkQtChartSeriesSelection &selection) const;
- //@}
-
- /// \name QGraphicsItem Methods
- //@{
- virtual QRectF boundingRect() const;
- virtual void paint(QPainter *painter, const QStyleOptionGraphicsItem *option,
- QWidget *widget);
- //@}
-
-public slots:
- /// \brief
- /// Refreshes the line chart data from the model.
- ///
- /// The currently displayed data is cleaned up. If a model is set,
- /// it is used to populate the line chart.
- void reset();
-
-protected:
- /// \brief
- /// Creates a new line chart series options object.
- /// \param parent The parent object.
- /// \return
- /// A pointer to the new line chart series options object.
- virtual vtkQtChartSeriesOptions *createOptions(QObject *parent);
-
- /// \brief
- /// Sets up the series options defaults.
- /// \param options The new series options object.
- virtual void setupOptions(vtkQtChartSeriesOptions *options);
-
-private slots:
- /// \brief
- /// Prepares the line chart for a series insertion.
- /// \param first The first series index to be added.
- /// \param last The last series index to be added.
- void prepareSeriesInsert(int first, int last);
-
- /// \brief
- /// Inserts line chart series at the given indexes.
- /// \param first The first series index to be added.
- /// \param last The last series index to be added.
- void insertSeries(int first, int last);
-
- /// \brief
- /// Removes the specified series from the chart.
- /// \param first The first series index to be removed.
- /// \param last The last series index to be removed.
- void startSeriesRemoval(int first, int last);
-
- /// \brief
- /// Finishes removing the series by updating the layout.
- /// \param first The first series index to be removed.
- /// \param last The last series index to be removed.
- void finishSeriesRemoval(int first, int last);
-
- /// \brief
- /// Changes the series visibility.
- ///
- /// The signal sender is used to determine which series has changed.
- ///
- /// \param visible True if the series should be shown.
- void handleSeriesVisibilityChange(bool visible);
-
- /// \brief
- /// Changes the series axes corner.
- ///
- /// Both of the domains are updated for the change.
- ///
- /// \param corner The new axes corner.
- /// \param previous The previous axes corner.
- void handleSeriesAxesCornerChange(int corner, int previous);
-
- /// \brief
- /// Changes the series point visibility.
- /// \param visible True if the series points should be shown.
- void handleSeriesPointVisibilityChange(bool visible);
-
- /// Changes the series point marker.
- void handleSeriesPointMarkerChange();
-
- /// \brief
- /// Changes the series pen.
- /// \param pen The new series pen.
- void handleSeriesPenChange(const QPen &pen);
-
- /// \brief
- /// Changes the series brush.
- /// \param brush The new series brush.
- void handleSeriesBrushChange(const QBrush &brush);
-
- /// \brief
- /// Called to update the highlights.
- ///
- /// The update request is ignored if the model is being changed.
- void updateHighlights();
-
-private:
- /// \brief
- /// Adds the domain for the given series to the given domain.
- /// \param series The series index.
- /// \param corner Which domain set to update.
- /// \param seriesGroup Used to return the domain group.
- /// \return
- /// True if the domain was modified.
- bool addSeriesDomain(int series, vtkQtChartLayer::AxesCorner corner,
- int *seriesGroup);
-
- /// \brief
- /// Calculates the domain for the given series group.
- /// \param seriesGroup The series group index.
- /// \param corner Which domain set to update.
- void calculateDomain(int seriesGroup, vtkQtChartLayer::AxesCorner corner);
-
- /// Builds the search trees for the line chart.
- void buildTree();
-
-private:
- vtkQtLineChartInternal *Internal; ///< Stores the view data.
- vtkQtLineChartOptions *Options; ///< Stores the drawing options.
- bool InModelChange; ///< Used for selection changes.
- bool BuildNeeded; ///< Used when resizing interactively.
-};
-
-#endif
diff --git a/Modules/QmitkExt/vtkQtChartHeaders/vtkQtLineChartOptions.h b/Modules/QmitkExt/vtkQtChartHeaders/vtkQtLineChartOptions.h
deleted file mode 100644
index 4742e21b4a..0000000000
--- a/Modules/QmitkExt/vtkQtChartHeaders/vtkQtLineChartOptions.h
+++ /dev/null
@@ -1,79 +0,0 @@
-/*=========================================================================
-
- Program: Visualization Toolkit
- Module: $RCSfile: vtkQtLineChartOptions.h,v $
-
- Copyright (c) Ken Martin, Will Schroeder, Bill Lorensen
- All rights reserved.
- See Copyright.txt or http://www.kitware.com/Copyright.htm for details.
-
- This software is distributed WITHOUT ANY WARRANTY; without even
- the implied warranty of MERCHANTABILITY or FITNESS FOR A PARTICULAR
- PURPOSE. See the above copyright notice for more information.
-
-=========================================================================*/
-/*-------------------------------------------------------------------------
- Copyright 2008 Sandia Corporation.
- Under the terms of Contract DE-AC04-94AL85000 with Sandia Corporation,
- the U.S. Government retains certain rights in this software.
--------------------------------------------------------------------------*/
-
-/// \file vtkQtLineChartOptions.h
-/// \date June 6, 2008
-
-#ifndef _vtkQtLineChartOptions_h
-#define _vtkQtLineChartOptions_h
-
-#include "vtkQtChartExport.h"
-#include <QObject>
-
-class vtkQtChartHelpFormatter;
-
-
-/// \class vtkQtLineChartOptions
-/// \brief
-/// The vtkQtLineChartOptions class stores the line chart options.
-class VTKQTCHART_EXPORT vtkQtLineChartOptions : public QObject
-{
- Q_OBJECT
-
-public:
- /// \brief
- /// Creates a line chart options instance.
- /// \param parent The parent object.
- vtkQtLineChartOptions(QObject *parent=0);
-
- /// \brief
- /// Makes a copy of another line chart options instance.
- /// \param other The line chart options to copy.
- vtkQtLineChartOptions(const vtkQtLineChartOptions &other);
- virtual ~vtkQtLineChartOptions();
-
- /// \brief
- /// Gets the chart help text formatter.
- ///
- /// The help text formatter stores the format string. It is also
- /// used to generate the help text.
- ///
- /// \return
- /// A pointer to the chart help text formatter.
- vtkQtChartHelpFormatter *getHelpFormat() {return this->Help;}
-
- /// \brief
- /// Gets the chart help text formatter.
- /// \return
- /// A pointer to the chart help text formatter.
- const vtkQtChartHelpFormatter *getHelpFormat() const {return this->Help;}
-
- /// \brief
- /// Makes a copy of another line chart options instance.
- /// \param other The line chart options to copy.
- /// \return
- /// A reference to the object being assigned.
- vtkQtLineChartOptions &operator=(const vtkQtLineChartOptions &other);
-
-private:
- vtkQtChartHelpFormatter *Help; ///< Stores the help text format.
-};
-
-#endif
diff --git a/Modules/QmitkExt/vtkQtChartHeaders/vtkQtLineChartSeriesOptions.h b/Modules/QmitkExt/vtkQtChartHeaders/vtkQtLineChartSeriesOptions.h
deleted file mode 100644
index 04cfded15f..0000000000
--- a/Modules/QmitkExt/vtkQtChartHeaders/vtkQtLineChartSeriesOptions.h
+++ /dev/null
@@ -1,128 +0,0 @@
-/*=========================================================================
-
- Program: Visualization Toolkit
- Module: $RCSfile: vtkQtLineChartSeriesOptions.h,v $
-
- Copyright (c) Ken Martin, Will Schroeder, Bill Lorensen
- All rights reserved.
- See Copyright.txt or http://www.kitware.com/Copyright.htm for details.
-
- This software is distributed WITHOUT ANY WARRANTY; without even
- the implied warranty of MERCHANTABILITY or FITNESS FOR A PARTICULAR
- PURPOSE. See the above copyright notice for more information.
-
-=========================================================================*/
-/*-------------------------------------------------------------------------
- Copyright 2008 Sandia Corporation.
- Under the terms of Contract DE-AC04-94AL85000 with Sandia Corporation,
- the U.S. Government retains certain rights in this software.
--------------------------------------------------------------------------*/
-
-/// \file vtkQtLineChartSeriesOptions.h
-/// \date February 15, 2008
-
-#ifndef _vtkQtLineChartSeriesOptions_h
-#define _vtkQtLineChartSeriesOptions_h
-
-#include "vtkQtChartExport.h"
-#include "vtkQtChartSeriesOptions.h"
-#include "vtkQtChartLayer.h" // needed for enum
-#include "vtkQtPointMarker.h" // needed for enum
-
-class QSizeF;
-
-
-/// \class vtkQtLineChartSeriesOptions
-/// \brief
-/// The vtkQtLineChartSeriesOptions class stores the options for a
-/// line chart series.
-class VTKQTCHART_EXPORT vtkQtLineChartSeriesOptions :
- public vtkQtChartSeriesOptions
-{
- Q_OBJECT
-
-public:
- /// \brief
- /// Creates a line chart series options object.
- /// \param parent The parent object.
- vtkQtLineChartSeriesOptions(QObject *parent=0);
- virtual ~vtkQtLineChartSeriesOptions();
-
- /// \brief
- /// Sets the style generator index for the series.
- ///
- /// This method uses the style generator to assign the initial pen
- /// for the series.
- ///
- /// \param style The style index for the generator.
- /// \param generator The style generator to use.
- virtual void setStyle(int style, vtkQtChartStyleGenerator *generator);
-
- /// \brief
- /// Gets the axes corner for the series.
- /// \return
- /// The axes corner for the series.
- vtkQtChartLayer::AxesCorner getAxesCorner() const;
-
- /// \brief
- /// Sets the axes corner for the series.
- /// \param axes The new axes corner for the series.
- void setAxesCorner(vtkQtChartLayer::AxesCorner axes);
-
- /// \brief
- /// Gets whether or not the series points should be visible.
- /// \return
- /// True if the series points should be visible.
- bool arePointsVisible() const {return this->ShowPoints;}
-
- /// \brief
- /// Sets whether or not the series points should be visible.
- /// \param visible True if the series points should be visible.
- void setPointsVisible(bool visible);
-
- /// \brief
- /// Gets the series marker style.
- /// \return
- /// The series marker style.
- vtkQtPointMarker::MarkerStyle getMarkerStyle() const;
-
- /// \brief
- /// Sets the series marker style.
- /// \param style The new series marker style.
- void setMarkerStyle(vtkQtPointMarker::MarkerStyle style);
-
- /// \brief
- /// Gets the marker size for the series.
- /// \return
- /// A reference to the series marker size.
- const QSizeF &getMarkerSize() const;
-
- /// \brief
- /// Sets the marker size for the series.
- /// \param size The new series marker size.
- void setMarkerSize(const QSizeF &size);
-
-signals:
- /// \brief
- /// Emitted when the series axes corner changes.
- /// \param corner The new axes corner.
- /// \param previous The previous axes corner.
- void axesCornerChanged(int corner, int previous);
-
- /// \brief
- /// Emitted when the series point visibility changes.
- /// \param visible True if the series points should be visible.
- void pointVisibilityChanged(bool visible);
-
- /// Emitted when the point marker style or size has changed.
- void pointMarkerChanged();
-
-protected:
- vtkQtChartLayer::AxesCorner AxesCorner; ///< Stores the axes corner.
- vtkQtPointMarker::MarkerStyle PointStyle; ///< Stores the marker style.
- QSizeF *PointSize; ///< Stores the marker size.
- bool ShowPoints; ///< True if points are shown.
-};
-
-#endif
-
diff --git a/Modules/QmitkExt/vtkQtChartHeaders/vtkQtPointMarker.h b/Modules/QmitkExt/vtkQtChartHeaders/vtkQtPointMarker.h
deleted file mode 100755
index b26f24d304..0000000000
--- a/Modules/QmitkExt/vtkQtChartHeaders/vtkQtPointMarker.h
+++ /dev/null
@@ -1,72 +0,0 @@
-/*=========================================================================
-
- Program: Visualization Toolkit
- Module: $RCSfile: vtkQtPointMarker.h,v $
-
- Copyright (c) Ken Martin, Will Schroeder, Bill Lorensen
- All rights reserved.
- See Copyright.txt or http://www.kitware.com/Copyright.htm for details.
-
- This software is distributed WITHOUT ANY WARRANTY; without even
- the implied warranty of MERCHANTABILITY or FITNESS FOR A PARTICULAR
- PURPOSE. See the above copyright notice for more information.
-
-=========================================================================*/
-/*-------------------------------------------------------------------------
- Copyright 2008 Sandia Corporation.
- Under the terms of Contract DE-AC04-94AL85000 with Sandia Corporation,
- the U.S. Government retains certain rights in this software.
--------------------------------------------------------------------------*/
-
-/// \file vtkQtPointMarker.h
-/// \date February 12, 2008
-
-#ifndef _vtkQtPointMarker_h
-#define _vtkQtPointMarker_h
-
-
-#include "vtkQtChartExport.h"
-#include <QSizeF>
-#include <QRectF>
-
-class QPainter;
-
-
-/// \class vtkQtPointMarker
-/// \brief
-/// The vtkQtPointMarker class is used to draw a shape at a point.
-class VTKQTCHART_EXPORT vtkQtPointMarker
-{
-public:
- enum MarkerStyle
- {
- Cross = 0, ///< Draws a cross.
- Plus, ///< Draws a plus.
- Square, ///< Draws a square.
- Circle, ///< Draws a circle.
- Diamond, ///< Draws a diamond.
-
- /// The next available style for extension classes.
- UserStyle = 32
- };
-
-public:
- vtkQtPointMarker(const QSizeF &size, MarkerStyle style=Circle);
- virtual ~vtkQtPointMarker();
-
- virtual void paint(QPainter *painter);
-
- QSizeF getSize() const;
- void setSize(const QSizeF &size);
-
- MarkerStyle getStyle() const {return this->Style;}
- void setStyle(MarkerStyle style);
-
-protected:
- QRectF Rect;
-
-private:
- MarkerStyle Style;
-};
-
-#endif
diff --git a/Modules/QmitkExt/vtkQtChartHeaders/vtkQtPolylineItem.h b/Modules/QmitkExt/vtkQtChartHeaders/vtkQtPolylineItem.h
deleted file mode 100644
index 4bd4e390ce..0000000000
--- a/Modules/QmitkExt/vtkQtChartHeaders/vtkQtPolylineItem.h
+++ /dev/null
@@ -1,69 +0,0 @@
-/*=========================================================================
-
- Program: Visualization Toolkit
- Module: $RCSfile: vtkQtPolylineItem.h,v $
-
- Copyright (c) Ken Martin, Will Schroeder, Bill Lorensen
- All rights reserved.
- See Copyright.txt or http://www.kitware.com/Copyright.htm for details.
-
- This software is distributed WITHOUT ANY WARRANTY; without even
- the implied warranty of MERCHANTABILITY or FITNESS FOR A PARTICULAR
- PURPOSE. See the above copyright notice for more information.
-
-=========================================================================*/
-/*-------------------------------------------------------------------------
- Copyright 2008 Sandia Corporation.
- Under the terms of Contract DE-AC04-94AL85000 with Sandia Corporation,
- the U.S. Government retains certain rights in this software.
--------------------------------------------------------------------------*/
-
-/// \file vtkQtPolylineItem.h
-/// \date February 6, 2008
-
-#ifndef _vtkQtPolylineItem_h
-#define _vtkQtPolylineItem_h
-
-#include "vtkQtChartExport.h"
-#include <QGraphicsItem>
-
-#include "vtkQtChartGraphicsItemTypes.h" // needed for enum
-
-class QPen;
-class QPolygonF;
-
-
-class VTKQTCHART_EXPORT vtkQtPolylineItem : public QGraphicsItem
-{
-public:
- enum {Type = vtkQtChart_PolylineItemType};
-
-public:
- vtkQtPolylineItem(QGraphicsItem *parent=0, QGraphicsScene *scene=0);
- virtual ~vtkQtPolylineItem();
-
- const QPen& pen() const;
- void setPen(const QPen& p);
-
- void setPolyline(const QPolygonF& line);
- const QPolygonF& polyline() const;
-
- virtual int type() const {return vtkQtPolylineItem::Type;}
- virtual QRectF boundingRect() const;
- virtual QPainterPath shape() const;
- virtual bool contains(const QPointF &point) const;
-
- virtual void paint(QPainter* p, const QStyleOptionGraphicsItem* option,
- QWidget* widget);
-
-private:
- bool doesLineCrossBox(const QPointF &point1, const QPointF &point2,
- const QRectF &box) const;
-
-protected:
- QPen* Pen;
- QPolygonF* Polyline;
-};
-
-#endif
-
diff --git a/Modules/QmitkExt/vtkQtChartHeaders/vtkQtSeriesFilterLineEdit.h b/Modules/QmitkExt/vtkQtChartHeaders/vtkQtSeriesFilterLineEdit.h
deleted file mode 100755
index 0c6a539619..0000000000
--- a/Modules/QmitkExt/vtkQtChartHeaders/vtkQtSeriesFilterLineEdit.h
+++ /dev/null
@@ -1,54 +0,0 @@
-/*=========================================================================
-
- Program: Visualization Toolkit
- Module: $RCSfile: vtkQtSeriesFilterLineEdit.h,v $
-
- Copyright (c) Ken Martin, Will Schroeder, Bill Lorensen
- All rights reserved.
- See Copyright.txt or http://www.kitware.com/Copyright.htm for details.
-
- This software is distributed WITHOUT ANY WARRANTY; without even
- the implied warranty of MERCHANTABILITY or FITNESS FOR A PARTICULAR
- PURPOSE. See the above copyright notice for more information.
-
-=========================================================================*/
-/*-------------------------------------------------------------------------
- Copyright 2008 Sandia Corporation.
- Under the terms of Contract DE-AC04-94AL85000 with Sandia Corporation,
- the U.S. Government retains certain rights in this software.
--------------------------------------------------------------------------*/
-
-/// \file vtkQtSeriesFilterLineEdit.h
-/// \date February 12, 2008
-
-#ifndef _vtkQtSeriesFilterLineEdit_h
-#define _vtkQtSeriesFilterLineEdit_h
-
-#include "vtkQtChartExport.h"
-
-#include <QLineEdit>
-
-class vtkQtChartSeriesLayer;
-
-/// \class vtkQtSeriesFilterLineEdit
-/// \brief
-/// The vtkQtSeriesFilterLineEdit class is used to filter series in a chart
-class VTKQTCHART_EXPORT vtkQtSeriesFilterLineEdit : public QLineEdit
-{
- Q_OBJECT
-
-public:
- vtkQtSeriesFilterLineEdit(QWidget* parent = 0);
- virtual ~vtkQtSeriesFilterLineEdit();
-
- void setLayer(vtkQtChartSeriesLayer* layer);
- vtkQtChartSeriesLayer* getLayer();
-
-private slots:
- void filterSeries(const QString& text);
-
-private:
- vtkQtChartSeriesLayer* Layer;
-};
-
-#endif
diff --git a/Modules/QmitkExt/vtkQtChartHeaders/vtkQtStackedChart.h b/Modules/QmitkExt/vtkQtChartHeaders/vtkQtStackedChart.h
deleted file mode 100644
index 34d56d754d..0000000000
--- a/Modules/QmitkExt/vtkQtChartHeaders/vtkQtStackedChart.h
+++ /dev/null
@@ -1,255 +0,0 @@
-/*=========================================================================
-
- Program: Visualization Toolkit
- Module: $RCSfile: vtkQtStackedChart.h,v $
-
- Copyright (c) Ken Martin, Will Schroeder, Bill Lorensen
- All rights reserved.
- See Copyright.txt or http://www.kitware.com/Copyright.htm for details.
-
- This software is distributed WITHOUT ANY WARRANTY; without even
- the implied warranty of MERCHANTABILITY or FITNESS FOR A PARTICULAR
- PURPOSE. See the above copyright notice for more information.
-
-=========================================================================*/
-/*-------------------------------------------------------------------------
- Copyright 2008 Sandia Corporation.
- Under the terms of Contract DE-AC04-94AL85000 with Sandia Corporation,
- the U.S. Government retains certain rights in this software.
--------------------------------------------------------------------------*/
-
-/// \file vtkQtStackedChart.h
-/// \date February 27, 2008
-
-#ifndef _vtkQtChartStackedLayer_h
-#define _vtkQtChartStackedLayer_h
-
-#include "vtkQtChartExport.h"
-#include "vtkQtChartSeriesLayer.h"
-
-class vtkQtStackedChartInternal;
-class vtkQtStackedChartOptions;
-class vtkQtStackedChartSeriesOptions;
-
-
-/// \class vtkQtStackedChart
-/// \brief
-/// The vtkQtStackedChart class is used to display a stacked chart.
-class VTKQTCHART_EXPORT vtkQtStackedChart : public vtkQtChartSeriesLayer
-{
- Q_OBJECT
-
-public:
- vtkQtStackedChart();
- virtual ~vtkQtStackedChart();
-
- /// \name Setup Methods
- //@{
- virtual void setChartArea(vtkQtChartArea *area);
-
- virtual void setModel(vtkQtChartSeriesModel *model);
- //@}
-
- /// \name Drawing Parameters
- //@{
- /// \brief
- /// Gets the stacked chart drawing options.
- /// \return
- /// A pointer to the stacked chart drawing options.
- vtkQtStackedChartOptions *getOptions() const {return this->Options;}
-
- /// \brief
- /// Sets the stacked chart drawing options.
- ///
- /// This method sets all the options at once, which can prevent
- /// unnecessary view updates.
- ///
- /// \param options The new stacked chart drawing options.
- void setOptions(const vtkQtStackedChartOptions &options);
-
- /// \brief
- /// Gets the stacked chart series options.
- /// \param series The series index.
- /// \return
- /// A pointer to the stacked chart series options.
- vtkQtStackedChartSeriesOptions *getStackedSeriesOptions(int series) const;
-
- virtual QPixmap getSeriesIcon(int series) const;
- //@}
-
- /// \name Layout Methods
- //@{
- virtual void getLayerDomain(vtkQtChartLayerDomain &domain) const;
-
- virtual void layoutChart(const QRectF &area);
-
- virtual bool getHelpText(const QPointF &point, QString &text);
-
- /// \brief
- /// Notifies the chart layer that a resize interaction has finished.
- ///
- /// The chart quad tree is not updated while the chart is in an
- /// interactive state. It is updated in this method if needed.
- virtual void finishInteractiveResize();
- //@}
-
- /// \name Selection Methods
- //@{
- virtual void getSeriesAt(const QPointF &point,
- vtkQtChartSeriesSelection &selection) const;
-
- virtual void getPointsAt(const QPointF &point,
- vtkQtChartSeriesSelection &selection) const;
-
- virtual void getSeriesIn(const QRectF &area,
- vtkQtChartSeriesSelection &selection) const;
-
- virtual void getPointsIn(const QRectF &area,
- vtkQtChartSeriesSelection &selection) const;
- //@}
-
- /// \name QGraphicsItem Methods
- //@{
- virtual QRectF boundingRect() const;
- virtual void paint(QPainter *painter, const QStyleOptionGraphicsItem *option,
- QWidget *widget=0);
- //@}
-
-public slots:
- /// \brief
- /// Refreshes the stacked chart data from the model.
- ///
- /// The currently displayed data is cleaned up. If a model is set,
- /// it is used to populate the stacked chart.
- void reset();
-
-protected:
- /// \brief
- /// Creates a new stacked chart series options object.
- /// \param parent The parent object.
- /// \return
- /// A pointer to the new stacked chart series options object.
- virtual vtkQtChartSeriesOptions *createOptions(QObject *parent);
-
- /// \brief
- /// Sets up the series options defaults.
- /// \param options The new series options object.
- virtual void setupOptions(vtkQtChartSeriesOptions *options);
-
-private slots:
- /// \brief
- /// Prepares the stacked chart for a series insertion.
- /// \param first The first series index to be added.
- /// \param last The last series index to be added.
- void prepareSeriesInsert(int first, int last);
-
- /// \brief
- /// Inserts stacked chart series at the given indexes.
- /// \param first The first series index to be added.
- /// \param last The last series index to be added.
- void insertSeries(int first, int last);
-
- /// \brief
- /// Removes the specified series from the chart.
- /// \param first The first series index to be removed.
- /// \param last The last series index to be removed.
- void startSeriesRemoval(int first, int last);
-
- /// \brief
- /// Finishes the domain changes after removing the series.
- /// \param first The first series index to be removed.
- /// \param last The last series index to be removed.
- void finishSeriesRemoval(int first, int last);
-
- /// Requests a chart layout when the axis corner option changes.
- void handleAxesCornerChange();
-
- /// Updates the chart when the sumation type has changed.
- void handleSumationChange();
-
- /// Updates the chart when the gradient option has changed.
- void handleGradientChange();
-
- /// \brief
- /// Changes the series visibility.
- ///
- /// The signal sender is used to determine which series has changed.
- ///
- /// \param visible True if the series should be shown.
- void handleSeriesVisibilityChange(bool visible);
-
- /// \brief
- /// Changes the series pen.
- /// \param pen The new series pen.
- void handleSeriesPenChange(const QPen &pen);
-
- /// \brief
- /// Changes the series brush.
- /// \param brush The new series brush.
- void handleSeriesBrushChange(const QBrush &brush);
-
- /// \brief
- /// Called to layout the highlights.
- ///
- /// The layout request is ignored if the model is being changed.
- void updateHighlights();
-
- /// Called by the animation timeline to animate hiding a series.
- void seriesVisibilityAnimate(qreal time);
-
- /// Called by the animation timeline when animation is finished.
- void seriesVisibilityAnimateFinished();
-
-private:
- /// Called to layout the highlights.
- void layoutHighlights();
-
- /// \brief
- /// Adds the domain for the given series to the current domain.
- /// \param series The series index
- /// \param seriesGroup Used to return the domain group.
- void addSeriesDomain(int series, int *seriesGroup);
-
- /// \brief
- /// Updates the series table index map.
- /// \param seriesGroup The domain group to update.
- void updateItemMap(int seriesGroup);
-
- /// \brief
- /// Creates the table for the given series domain group.
- /// \param seriesGroup The domain group index.
- void createTable(int seriesGroup);
-
- /// \brief
- /// Normalizes the table for the given series domain group.
- /// \param seriesGroup The domain group index.
- void normalizeTable(int seriesGroup);
-
- /// \brief
- /// Calculates the x-axis domain for the given domain group.
- /// \param seriesGroup The domain group index.
- void calculateXDomain(int seriesGroup);
-
- /// \brief
- /// Calculates the y-axis domain for the given domain group.
- /// \param seriesGroup The domain group index.
- void calculateYDomain(int seriesGroup);
-
- /// \brief
- /// Creates an ordered table of series quadrilaterals.
- /// \param seriesGroup The domain group index.
- void createQuadTable(int seriesGroup);
-
- /// \brief
- /// Builds the quad tree for the given domain group.
- /// \param seriesGroup The domain group index.
- void buildQuadTree(int seriesGroup);
-
-private:
- vtkQtStackedChartInternal *Internal; ///< Stores the series.
- vtkQtStackedChartOptions *Options; ///< Stores the drawing options.
- bool InModelChange; ///< Used for selection changes.
- bool BuildNeeded; ///< Used when resizing interactively.
-};
-
-#endif
diff --git a/Modules/QmitkExt/vtkQtChartHeaders/vtkQtStackedChartOptions.h b/Modules/QmitkExt/vtkQtChartHeaders/vtkQtStackedChartOptions.h
deleted file mode 100644
index 07af4b21cd..0000000000
--- a/Modules/QmitkExt/vtkQtChartHeaders/vtkQtStackedChartOptions.h
+++ /dev/null
@@ -1,131 +0,0 @@
-/*=========================================================================
-
- Program: Visualization Toolkit
- Module: $RCSfile: vtkQtStackedChartOptions.h,v $
-
- Copyright (c) Ken Martin, Will Schroeder, Bill Lorensen
- All rights reserved.
- See Copyright.txt or http://www.kitware.com/Copyright.htm for details.
-
- This software is distributed WITHOUT ANY WARRANTY; without even
- the implied warranty of MERCHANTABILITY or FITNESS FOR A PARTICULAR
- PURPOSE. See the above copyright notice for more information.
-
-=========================================================================*/
-/*-------------------------------------------------------------------------
- Copyright 2008 Sandia Corporation.
- Under the terms of Contract DE-AC04-94AL85000 with Sandia Corporation,
- the U.S. Government retains certain rights in this software.
--------------------------------------------------------------------------*/
-
-/// \file vtkQtStackedChartOptions.h
-/// \date February 27, 2008
-
-#ifndef _vtkQtStackedChartOptions_h
-#define _vtkQtStackedChartOptions_h
-
-#include "vtkQtChartExport.h"
-#include <QObject>
-#include "vtkQtChartLayer.h" // needed for enum
-
-class vtkQtChartHelpFormatter;
-
-
-/// \class vtkQtStackedChartOptions
-/// \brief
-/// The vtkQtStackedChartOptions class stores the stacked chart
-/// options.
-class VTKQTCHART_EXPORT vtkQtStackedChartOptions : public QObject
-{
- Q_OBJECT
-
-public:
- /// \brief
- /// Creates a stacked chart options instance.
- /// \param parent The parent object.
- vtkQtStackedChartOptions(QObject *parent=0);
-
- /// \brief
- /// Makes a copy of another stacked chart options instance.
- /// \param other The stacked chart options to copy.
- vtkQtStackedChartOptions(const vtkQtStackedChartOptions &other);
- virtual ~vtkQtStackedChartOptions();
-
- /// \brief
- /// Gets the pair of axes used by the stacked chart.
- /// \return
- /// The pair of axes used by the bar chart.
- vtkQtChartLayer::AxesCorner getAxesCorner() const {return this->Axes;}
-
- /// \brief
- /// Sets the pair of axes used by the stacked chart.
- /// \param axes The new chart axes.
- void setAxesCorner(vtkQtChartLayer::AxesCorner axes);
-
- /// \brief
- /// Gets whether or not the sum is normalized.
- /// \return
- /// True if the sum is normalized.
- bool isSumNormalized() const {return this->Normalized;}
-
- /// \brief
- /// Sets whether or not the sum is normalized.
- /// \param normalized True if the sum should be normalized.
- void setSumNormalized(bool normalized);
-
- /// \brief
- /// Gets whether or not gradients are displayed.
- /// \return
- /// True if the stacked series should be displayed with a gradient.
- bool isGradientDislpayed() const {return this->Gradient;}
-
- /// \brief
- /// Sets whether or not gradients are displayed.
- /// \param gradient True if gradients should be displayed.
- void setGradientDisplayed(bool gradient);
-
- /// \brief
- /// Gets the chart help text formatter.
- ///
- /// The help text formatter stores the format string. It is also
- /// used to generate the help text.
- ///
- /// \return
- /// A pointer to the chart help text formatter.
- vtkQtChartHelpFormatter *getHelpFormat() {return this->Help;}
-
- /// \brief
- /// Gets the chart help text formatter.
- /// \return
- /// A pointer to the chart help text formatter.
- const vtkQtChartHelpFormatter *getHelpFormat() const {return this->Help;}
-
- /// \brief
- /// Makes a copy of another stacked chart options instance.
- /// \param other The stacked chart options to copy.
- /// \return
- /// A reference to the object being assigned.
- vtkQtStackedChartOptions &operator=(const vtkQtStackedChartOptions &other);
-
-signals:
- /// Emitted when the stacked chart axes change.
- void axesCornerChanged();
-
- /// Emitted when the sumation normalization changes.
- void sumationChanged();
-
- /// Emitted when the gradient option changes.
- void gradientChanged();
-
-private:
- vtkQtChartLayer::AxesCorner Axes; ///< Stores the chart axes.
- vtkQtChartHelpFormatter *Help; ///< Stores the help text format.
-
- /// True if the sum should be normalized.
- bool Normalized;
-
- /// True if the stacked series should be displayed with a gradient.
- bool Gradient;
-};
-
-#endif
diff --git a/Modules/QmitkExt/vtkQtChartHeaders/vtkQtStackedChartSeriesOptions.h b/Modules/QmitkExt/vtkQtChartHeaders/vtkQtStackedChartSeriesOptions.h
deleted file mode 100644
index d1a32d87e7..0000000000
--- a/Modules/QmitkExt/vtkQtChartHeaders/vtkQtStackedChartSeriesOptions.h
+++ /dev/null
@@ -1,59 +0,0 @@
-/*=========================================================================
-
- Program: Visualization Toolkit
- Module: $RCSfile: vtkQtStackedChartSeriesOptions.h,v $
-
- Copyright (c) Ken Martin, Will Schroeder, Bill Lorensen
- All rights reserved.
- See Copyright.txt or http://www.kitware.com/Copyright.htm for details.
-
- This software is distributed WITHOUT ANY WARRANTY; without even
- the implied warranty of MERCHANTABILITY or FITNESS FOR A PARTICULAR
- PURPOSE. See the above copyright notice for more information.
-
-=========================================================================*/
-/*-------------------------------------------------------------------------
- Copyright 2008 Sandia Corporation.
- Under the terms of Contract DE-AC04-94AL85000 with Sandia Corporation,
- the U.S. Government retains certain rights in this software.
--------------------------------------------------------------------------*/
-
-/// \file vtkQtStackedChartSeriesOptions.h
-/// \date February 27, 2008
-
-#ifndef _vtkQtStackedChartSeriesOptions_h
-#define _vtkQtStackedChartSeriesOptions_h
-
-#include "vtkQtChartExport.h"
-#include "vtkQtChartSeriesOptions.h"
-
-
-/// \class vtkQtStackedChartSeriesOptions
-/// \brief
-/// The vtkQtStackedChartSeriesOptions class stores the options for
-/// a stacked chart series.
-class VTKQTCHART_EXPORT vtkQtStackedChartSeriesOptions :
- public vtkQtChartSeriesOptions
-{
- Q_OBJECT
-
-public:
- /// \brief
- /// Creates a stacked chart series options object.
- /// \param parent The parent object.
- vtkQtStackedChartSeriesOptions(QObject *parent=0);
- virtual ~vtkQtStackedChartSeriesOptions() {}
-
- /// \brief
- /// Sets the style generator index for the series.
- ///
- /// This method uses the style generator to assign the initial
- /// brush and pen for the series. The pen is based on the brush
- /// color.
- ///
- /// \param style The style index for the generator.
- /// \param generator The style generator to use.
- virtual void setStyle(int style, vtkQtChartStyleGenerator *generator);
-};
-
-#endif
diff --git a/Modules/QmitkExt/vtkQtChartHeaders/vtkQtStatisticalBoxChart.h b/Modules/QmitkExt/vtkQtChartHeaders/vtkQtStatisticalBoxChart.h
deleted file mode 100644
index 78c77aa6dd..0000000000
--- a/Modules/QmitkExt/vtkQtChartHeaders/vtkQtStatisticalBoxChart.h
+++ /dev/null
@@ -1,233 +0,0 @@
-/*=========================================================================
-
- Program: Visualization Toolkit
- Module: $RCSfile: vtkQtStatisticalBoxChart.h,v $
-
- Copyright (c) Ken Martin, Will Schroeder, Bill Lorensen
- All rights reserved.
- See Copyright.txt or http://www.kitware.com/Copyright.htm for details.
-
- This software is distributed WITHOUT ANY WARRANTY; without even
- the implied warranty of MERCHANTABILITY or FITNESS FOR A PARTICULAR
- PURPOSE. See the above copyright notice for more information.
-
-=========================================================================*/
-/*-------------------------------------------------------------------------
- Copyright 2008 Sandia Corporation.
- Under the terms of Contract DE-AC04-94AL85000 with Sandia Corporation,
- the U.S. Government retains certain rights in this software.
--------------------------------------------------------------------------*/
-
-/// \file vtkQtStatisticalBoxChart.h
-/// \date May 15, 2008
-
-#ifndef _vtkQtStatisticalBoxChart_h
-#define _vtkQtStatisticalBoxChart_h
-
-#include "vtkQtChartExport.h"
-#include "vtkQtChartSeriesLayer.h"
-
-class vtkQtStatisticalBoxChartInternal;
-class vtkQtStatisticalBoxChartOptions;
-class vtkQtStatisticalBoxChartSeriesOptions;
-
-
-/// \class vtkQtStatisticalBoxChart
-/// \brief
-/// The vtkQtStatisticalBoxChart class is used to display a statistical box chart.
-class VTKQTCHART_EXPORT vtkQtStatisticalBoxChart : public vtkQtChartSeriesLayer
-{
- Q_OBJECT
-
-public:
- vtkQtStatisticalBoxChart();
- virtual ~vtkQtStatisticalBoxChart();
-
- /// \name Setup Methods
- //@{
- virtual void setChartArea(vtkQtChartArea *area);
-
- virtual void setModel(vtkQtChartSeriesModel *model);
- //@}
-
- /// \name Drawing Parameters
- //@{
- /// \brief
- /// Gets the box chart drawing options.
- /// \return
- /// A pointer to the box chart drawing options.
- vtkQtStatisticalBoxChartOptions *getOptions() const {return this->Options;}
-
- /// \brief
- /// Sets the box chart drawing options.
- ///
- /// This method sets all the options at once, which can prevent
- /// unnecessary view updates.
- ///
- /// \param options The new box chart drawing options.
- void setOptions(const vtkQtStatisticalBoxChartOptions &options);
-
- /// \brief
- /// Gets the statistical box chart series options.
- /// \param series The series index.
- /// \return
- /// A pointer to the statistical box chart series options.
- vtkQtStatisticalBoxChartSeriesOptions *getBoxSeriesOptions(int series) const;
-
- virtual QPixmap getSeriesIcon(int series) const;
- //@}
-
- /// \name Layout Methods
- //@{
- virtual void getLayerDomain(vtkQtChartLayerDomain &domain) const;
-
- virtual void layoutChart(const QRectF &area);
-
- virtual bool getHelpText(const QPointF &point, QString &text);
-
- /// \brief
- /// Notifies the chart layer that a resize interaction has finished.
- ///
- /// The chart search tree is not updated while the chart is in an
- /// interactive state. It is updated in this method if needed.
- virtual void finishInteractiveResize();
- //@}
-
- /// \name Selection Methods
- //@{
- virtual void getSeriesAt(const QPointF &point,
- vtkQtChartSeriesSelection &selection) const;
-
- virtual void getPointsAt(const QPointF &point,
- vtkQtChartSeriesSelection &selection) const;
-
- virtual void getSeriesIn(const QRectF &area,
- vtkQtChartSeriesSelection &selection) const;
-
- virtual void getPointsIn(const QRectF &area,
- vtkQtChartSeriesSelection &selection) const;
- //@}
-
- /// \name QGraphicsItem Methods
- //@{
- virtual QRectF boundingRect() const;
-
- virtual void paint(QPainter *painter, const QStyleOptionGraphicsItem *option,
- QWidget *widget=0);
- //@}
-
-public slots:
- /// \brief
- /// Refreshes the statistical box chart data from the model.
- ///
- /// The currently displayed data is cleaned up. If a model is set,
- /// it is used to populate the statistical box chart.
- void reset();
-
-protected:
- /// \brief
- /// Creates a new statistical box chart series options object.
- /// \param parent The parent object.
- /// \return
- /// A pointer to the new statistical box chart series options object.
- virtual vtkQtChartSeriesOptions *createOptions(QObject *parent);
-
- /// \brief
- /// Sets up the series options defaults.
- /// \param options The new series options object.
- virtual void setupOptions(vtkQtChartSeriesOptions *options);
-
-private slots:
- /// \brief
- /// Prepares the statistical box chart for a series insertion.
- /// \param first The first series index to be added.
- /// \param last The last series index to be added.
- void prepareSeriesInsert(int first, int last);
-
- /// \brief
- /// Inserts statistical box chart series at the given indexes.
- /// \param first The first series index to be added.
- /// \param last The last series index to be added.
- void insertSeries(int first, int last);
-
- /// \brief
- /// Removes the specified series from the chart.
- /// \param first The first series index to be removed.
- /// \param last The last series index to be removed.
- void startSeriesRemoval(int first, int last);
-
- /// \brief
- /// Finishes the domain changes after removing the series.
- /// \param first The first series index to be removed.
- /// \param last The last series index to be removed.
- void finishSeriesRemoval(int first, int last);
-
- /// Requests a chart layout when the axis corner option changes.
- void handleAxesCornerChange();
-
- /// Changes the box outline style.
- void handleOutlineChange();
-
- /// \brief
- /// Changes the series visibility.
- ///
- /// The signal sender is used to determine which series has changed.
- ///
- /// \param visible True if the series should be shown.
- void handleSeriesVisibilityChange(bool visible);
-
- /// \brief
- /// Changes the series pen.
- /// \param pen The new series pen.
- void handleSeriesPenChange(const QPen &pen);
-
- /// \brief
- /// Changes the series brush.
- /// \param brush The new series brush.
- void handleSeriesBrushChange(const QBrush &brush);
-
- /// Changes the series point marker.
- void handleSeriesPointMarkerChanged();
-
- /// \brief
- /// Called to set up the highlights.
- ///
- /// The set up request is ignored if the model is being changed.
- void updateHighlights();
-
-private:
- /// \brief
- /// Adds the domain for the given series to the current domain.
- /// \param series The series index.
- /// \param seriesGroup Used to return the series group index.
- /// \return
- /// True if the domain was modified.
- bool addSeriesDomain(int series, int &seriesGroup);
-
- /// \brief
- /// Calculates the domain for the given series group.
- /// \param seriesGroup The series group index.
- void calculateDomain(int seriesGroup);
-
- /// \brief
- /// Creates an ordered table of series shapes.
- /// \param seriesGroup The series group index.
- void createShapeTable(int seriesGroup);
-
- /// \brief
- /// Builds the shape tree for the given series group.
- /// \param seriesGroup The series group index.
- void buildShapeTree(int seriesGroup);
-
-private:
- vtkQtStatisticalBoxChartInternal *Internal; ///< Stores the box series.
- vtkQtStatisticalBoxChartOptions *Options; ///< Stores the drawing options.
- bool InModelChange; ///< Used for selection changes.
- bool BuildNeeded; ///< Used for interactive resize.
-
-private:
- vtkQtStatisticalBoxChart(const vtkQtStatisticalBoxChart &);
- vtkQtStatisticalBoxChart &operator=(const vtkQtStatisticalBoxChart &);
-};
-
-#endif
diff --git a/Modules/QmitkExt/vtkQtChartHeaders/vtkQtStatisticalBoxChartOptions.h b/Modules/QmitkExt/vtkQtChartHeaders/vtkQtStatisticalBoxChartOptions.h
deleted file mode 100644
index b7537faa2e..0000000000
--- a/Modules/QmitkExt/vtkQtChartHeaders/vtkQtStatisticalBoxChartOptions.h
+++ /dev/null
@@ -1,166 +0,0 @@
-/*=========================================================================
-
- Program: Visualization Toolkit
- Module: $RCSfile: vtkQtStatisticalBoxChartOptions.h,v $
-
- Copyright (c) Ken Martin, Will Schroeder, Bill Lorensen
- All rights reserved.
- See Copyright.txt or http://www.kitware.com/Copyright.htm for details.
-
- This software is distributed WITHOUT ANY WARRANTY; without even
- the implied warranty of MERCHANTABILITY or FITNESS FOR A PARTICULAR
- PURPOSE. See the above copyright notice for more information.
-
-=========================================================================*/
-/*-------------------------------------------------------------------------
- Copyright 2008 Sandia Corporation.
- Under the terms of Contract DE-AC04-94AL85000 with Sandia Corporation,
- the U.S. Government retains certain rights in this software.
--------------------------------------------------------------------------*/
-
-/// \file vtkQtStatisticalBoxChartOptions.h
-/// \date May 15, 2008
-
-#ifndef _vtkQtStatisticalBoxChartOptions_h
-#define _vtkQtStatisticalBoxChartOptions_h
-
-#include "vtkQtChartExport.h"
-#include <QObject>
-
-#include "vtkQtChartLayer.h" // needed for enum
-
-class vtkQtChartHelpFormatter;
-
-
-/// \class vtkQtStatisticalBoxChartOptions
-/// \brief
-/// The vtkQtStatisticalBoxChartOptions class stores the drawing options for a
-/// box chart.
-///
-/// The default settings are as follows:
-/// \li axes: \c BottomLeft
-/// \li box width fraction: 0.8
-/// \li outline style: \c Darker
-class VTKQTCHART_EXPORT vtkQtStatisticalBoxChartOptions : public QObject
-{
- Q_OBJECT
-
-public:
- enum OutlineStyle
- {
- Darker, ///< Draws the box outline in a darker color.
- Black ///< Draws a black box outline.
- };
-
-public:
- /// \brief
- /// Creates a box chart options instance.
- /// \param parent The parent object.
- vtkQtStatisticalBoxChartOptions(QObject *parent=0);
-
- /// \brief
- /// Makes a copy of another box chart options instance.
- /// \param other The box chart options to copy.
- vtkQtStatisticalBoxChartOptions(
- const vtkQtStatisticalBoxChartOptions &other);
- virtual ~vtkQtStatisticalBoxChartOptions() {}
-
- /// \brief
- /// Gets the pair of axes used by the box chart.
- /// \return
- /// The pair of axes used by the box chart.
- vtkQtChartLayer::AxesCorner getAxesCorner() const {return this->AxesCorner;}
-
- /// \brief
- /// Sets the pair of axes used by the box chart.
- /// \param axes The new chart axes.
- void setAxesCorner(vtkQtChartLayer::AxesCorner axes);
-
- /// \brief
- /// Gets the box width fraction.
- ///
- /// The box width fraction is used to set the spacing between the
- /// boxs of different series.
- ///
- /// \return
- /// The box width fraction.
- float getBoxWidthFraction() const {return this->BoxFraction;}
-
- /// \brief
- /// Sets the box width fraction.
- /// \param fraction The new box width fraction.
- void setBoxWidthFraction(float fraction);
-
- /// \brief
- /// Gets the outline style for the boxes.
- /// \return
- /// The current outline style.
- OutlineStyle getOutlineStyle() const {return this->OutlineType;}
-
- /// \brief
- /// Sets the outline style for the boxes.
- ///
- /// The default style is \c Darker.
- ///
- /// \param style The outline style to use.
- void setOutlineStyle(OutlineStyle style);
-
- /// \brief
- /// Gets the chart help text formatter.
- ///
- /// The help text formatter stores the format string. It is also
- /// used to generate the help text.
- ///
- /// \return
- /// A pointer to the chart help text formatter.
- vtkQtChartHelpFormatter *getHelpFormat() {return this->Help;}
-
- /// \brief
- /// Gets the chart help text formatter.
- /// \return
- /// A pointer to the chart help text formatter.
- const vtkQtChartHelpFormatter *getHelpFormat() const {return this->Help;}
-
- /// \brief
- /// Gets the outlier help text formatter.
- ///
- /// The help text formatter stores the format string. It is also
- /// used to generate the help text.
- ///
- /// \return
- /// A pointer to the outlier help text formatter.
- vtkQtChartHelpFormatter *getOutlierFormat() {return this->Outlier;}
-
- /// \brief
- /// Gets the outlier help text formatter.
- /// \return
- /// A pointer to the outlier help text formatter.
- const vtkQtChartHelpFormatter *getOutlierFormat() const {return this->Outlier;}
-
- /// \brief
- /// Makes a copy of another box chart options instance.
- /// \param other The box chart options to copy.
- /// \return
- /// A reference to the object being assigned.
- vtkQtStatisticalBoxChartOptions &operator=(
- const vtkQtStatisticalBoxChartOptions &other);
-
-signals:
- /// Emitted when the box chart axes change.
- void axesCornerChanged();
-
- /// Emitted when the box width fraction changes.
- void boxFractionChanged();
-
- /// Emitted when the outline style changes.
- void outlineStyleChanged();
-
-private:
- vtkQtChartLayer::AxesCorner AxesCorner; ///< Stores the chart axes.
- OutlineStyle OutlineType; ///< Stores the outline style.
- vtkQtChartHelpFormatter *Help; ///< Stores the help text format.
- vtkQtChartHelpFormatter *Outlier; ///< Stores the outlier text format.
- float BoxFraction; ///< Stores the box width fraction.
-};
-
-#endif
diff --git a/Modules/QmitkExt/vtkQtChartHeaders/vtkQtStatisticalBoxChartSeriesOptions.h b/Modules/QmitkExt/vtkQtChartHeaders/vtkQtStatisticalBoxChartSeriesOptions.h
deleted file mode 100644
index a2556969b1..0000000000
--- a/Modules/QmitkExt/vtkQtChartHeaders/vtkQtStatisticalBoxChartSeriesOptions.h
+++ /dev/null
@@ -1,91 +0,0 @@
-/*=========================================================================
-
- Program: Visualization Toolkit
- Module: $RCSfile: vtkQtStatisticalBoxChartSeriesOptions.h,v $
-
- Copyright (c) Ken Martin, Will Schroeder, Bill Lorensen
- All rights reserved.
- See Copyright.txt or http://www.kitware.com/Copyright.htm for details.
-
- This software is distributed WITHOUT ANY WARRANTY; without even
- the implied warranty of MERCHANTABILITY or FITNESS FOR A PARTICULAR
- PURPOSE. See the above copyright notice for more information.
-
-=========================================================================*/
-/*-------------------------------------------------------------------------
- Copyright 2008 Sandia Corporation.
- Under the terms of Contract DE-AC04-94AL85000 with Sandia Corporation,
- the U.S. Government retains certain rights in this software.
--------------------------------------------------------------------------*/
-
-/// \file vtkQtStatisticalBoxChartSeriesOptions.h
-/// \date May 15, 2008
-
-#ifndef _vtkQtStatisticalBoxChartSeriesOptions_h
-#define _vtkQtStatisticalBoxChartSeriesOptions_h
-
-#include "vtkQtChartExport.h"
-#include "vtkQtChartSeriesOptions.h"
-#include "vtkQtPointMarker.h" // needed for enum
-
-class QSizeF;
-
-
-/// \class vtkQtStatisticalBoxChartSeriesOptions
-/// \brief
-/// The vtkQtStatisticalBoxChartSeriesOptions class stores the
-/// options for a statistical box chart series.
-class VTKQTCHART_EXPORT vtkQtStatisticalBoxChartSeriesOptions :
- public vtkQtChartSeriesOptions
-{
- Q_OBJECT
-
-public:
- /// \brief
- /// Creates a statistical box chart series options object.
- /// \param parent The parent object.
- vtkQtStatisticalBoxChartSeriesOptions(QObject *parent=0);
- virtual ~vtkQtStatisticalBoxChartSeriesOptions();
-
- /// \brief
- /// Sets the style generator index for the series.
- ///
- /// This method uses the style generator to assign the initial brush
- /// for the series.
- ///
- /// \param style The style index for the generator.
- /// \param generator The style generator to use.
- virtual void setStyle(int style, vtkQtChartStyleGenerator *generator);
-
- /// \brief
- /// Gets the series marker style.
- /// \return
- /// The series marker style.
- vtkQtPointMarker::MarkerStyle getMarkerStyle() const;
-
- /// \brief
- /// Sets the series marker style.
- /// \param style The new series marker style.
- void setMarkerStyle(vtkQtPointMarker::MarkerStyle style);
-
- /// \brief
- /// Gets the marker size for the series.
- /// \return
- /// A reference to the series marker size.
- const QSizeF &getMarkerSize() const;
-
- /// \brief
- /// Sets the marker size for the series.
- /// \param size The new series marker size.
- void setMarkerSize(const QSizeF &size);
-
-signals:
- /// Emitted when the point marker style or size has changed.
- void pointMarkerChanged();
-
-protected:
- vtkQtPointMarker::MarkerStyle PointStyle; ///< Stores the marker style.
- QSizeF *PointSize; ///< Stores the marker size.
-};
-
-#endif
diff --git a/Modules/RigidRegistration/mitkImageRegistrationMethod-TYPE.cpp b/Modules/RigidRegistration/mitkImageRegistrationMethod-TYPE.cpp
index bf7536e58a..22840d05a2 100644
--- a/Modules/RigidRegistration/mitkImageRegistrationMethod-TYPE.cpp
+++ b/Modules/RigidRegistration/mitkImageRegistrationMethod-TYPE.cpp
@@ -1,20 +1,24 @@
/*=========================================================================
Program: Medical Imaging & Interaction Toolkit
Language: C++
Date: $Date$
Version: $Revision$
Copyright (c) German Cancer Research Center, Division of Medical and
Biological Informatics. All rights reserved.
See MITKCopyright.txt or http://www.mitk.org/copyright.html for details.
This software is distributed WITHOUT ANY WARRANTY; without even
the implied warranty of MERCHANTABILITY or FITNESS FOR A PARTICULAR
PURPOSE. See the above copyright notices for more information.
=========================================================================*/
-#include <mitkImageRegistrationMethod.txx>
+#include <mitkImageRegistrationMethodAccessFunctor.txx>
+#include <mitkInstantiateAccessFunctions.h>
-InstantiateAccessFunctionForFixedPixelType( mitk::ImageRegistrationMethod::GenerateData2, @TYPE@);
+#define InstantiateAccessFunction_RegistrationAccessItkImage(pixelType, dim) \
+ template void mitk::ImageRegistrationMethodAccessFunctor::AccessItkImage(itk::Image<pixelType, dim>* itkImage1, mitk::ImageRegistrationMethod* method);
+
+InstantiateAccessFunctionForFixedPixelType(RegistrationAccessItkImage, (@TYPE@))
diff --git a/Modules/RigidRegistration/mitkImageRegistrationMethod.cpp b/Modules/RigidRegistration/mitkImageRegistrationMethod.cpp
index 8d98b8e91d..d2f310500b 100644
--- a/Modules/RigidRegistration/mitkImageRegistrationMethod.cpp
+++ b/Modules/RigidRegistration/mitkImageRegistrationMethod.cpp
@@ -1,94 +1,94 @@
/*=========================================================================
Program: Medical Imaging & Interaction Toolkit
Language: C++
Date: $Date$
Version: $Revision$
Copyright (c) German Cancer Research Center, Division of Medical and
Biological Informatics. All rights reserved.
See MITKCopyright.txt or http://www.mitk.org/copyright.html for details.
This software is distributed WITHOUT ANY WARRANTY; without even
the implied warranty of MERCHANTABILITY or FITNESS FOR A PARTICULAR
PURPOSE. See the above copyright notices for more information.
=========================================================================*/
#include "mitkImageRegistrationMethod.h"
-
+#include "mitkImageRegistrationMethodAccessFunctor.h"
namespace mitk {
ImageRegistrationMethod::ImageRegistrationMethod()
: m_Interpolator(0)
{
m_ReferenceImage = Image::New();
m_OptimizerScales.clear();
}
ImageRegistrationMethod::~ImageRegistrationMethod()
{
}
void ImageRegistrationMethod::GenerateData()
{
if (this->GetInput())
{
- AccessByItk(this->GetInput(), GenerateData2);
+ ImageRegistrationMethodAccessFunctor()(this->GetInput(), this);
}
}
void ImageRegistrationMethod::SetObserver(RigidRegistrationObserver::Pointer observer)
{
m_Observer = observer;
}
void ImageRegistrationMethod::SetInterpolator(int interpolator)
{
m_Interpolator = interpolator;
}
void ImageRegistrationMethod::SetReferenceImage(Image::Pointer fixedImage)
{
m_ReferenceImage = fixedImage;
SetNthInput(1, m_ReferenceImage);
Modified();
}
void ImageRegistrationMethod::SetMovingMask(Image::Pointer movingMask)
{
m_MovingMask = movingMask;
SetNthInput(3, m_MovingMask);
Modified();
}
void ImageRegistrationMethod::SetFixedMask(Image::Pointer FixedMask)
{
m_FixedMask = FixedMask;
SetNthInput(4, m_FixedMask);
Modified();
}
void ImageRegistrationMethod::SetTransform(itk::Object::Pointer transform)
{
m_Transform = transform;
}
void ImageRegistrationMethod::SetMetric(itk::Object::Pointer metric)
{
m_Metric = metric;
}
void ImageRegistrationMethod::SetOptimizer(itk::Object::Pointer optimizer)
{
m_Optimizer = optimizer;
}
void ImageRegistrationMethod::SetOptimizerScales(itk::Array<double> scales)
{
m_OptimizerScales = scales;
}
} // end namespace
diff --git a/Modules/RigidRegistration/mitkImageRegistrationMethod.h b/Modules/RigidRegistration/mitkImageRegistrationMethod.h
index 035bb2a63c..f419598d4e 100644
--- a/Modules/RigidRegistration/mitkImageRegistrationMethod.h
+++ b/Modules/RigidRegistration/mitkImageRegistrationMethod.h
@@ -1,103 +1,100 @@
/*=========================================================================
Program: Medical Imaging & Interaction Toolkit
Language: C++
Date: $Date$
Version: $Revision$
Copyright (c) German Cancer Research Center, Division of Medical and
Biological Informatics. All rights reserved.
See MITKCopyright.txt or http://www.mitk.org/copyright.html for details.
This software is distributed WITHOUT ANY WARRANTY; without even
the implied warranty of MERCHANTABILITY or FITNESS FOR A PARTICULAR
PURPOSE. See the above copyright notices for more information.
=========================================================================*/
#ifndef MITKIMAGEREGISTRATIONMETHOD_H
#define MITKIMAGEREGISTRATIONMETHOD_H
#include "itkImageRegistrationMethod.h"
#include "MitkRigidRegistrationExports.h"
#include "itkSingleValuedNonLinearOptimizer.h"
#include "mitkImageToImageFilter.h"
#include "mitkImageAccessByItk.h"
#include "mitkRigidRegistrationObserver.h"
#include "mitkCommon.h"
#include "itkImageMaskSpatialObject.h"
#include "mitkRigidRegistrationPreset.h"
namespace mitk
{
/*!
\brief Main class for the rigid registration pipeline.
\ingroup RigidRegistration
\author Daniel Stein
*/
class MITK_RIGIDREGISTRATION_EXPORT ImageRegistrationMethod : public ImageToImageFilter
{
public:
typedef itk::SingleValuedNonLinearOptimizer OptimizerType;
typedef itk::ImageMaskSpatialObject< 3 > MaskType;
mitkClassMacro(ImageRegistrationMethod, ImageToImageFilter);
itkNewMacro(Self);
static const int LINEARINTERPOLATOR = 0;
static const int NEARESTNEIGHBORINTERPOLATOR = 1;
void SetObserver(RigidRegistrationObserver::Pointer observer);
void SetInterpolator(int interpolator);
virtual void GenerateData();
virtual void SetReferenceImage( Image::Pointer fixedImage);
virtual void SetFixedMask( Image::Pointer fixedMask);
virtual void SetMovingMask( Image::Pointer movingMask);
void SetOptimizerScales(itk::Array<double> scales);
void SetTransform(itk::Object::Pointer transform);
void SetMetric(itk::Object::Pointer metric);
void SetOptimizer(itk::Object::Pointer optimizer);
protected:
ImageRegistrationMethod();
virtual ~ImageRegistrationMethod();
- template < typename TPixel, unsigned int VImageDimension >
- void GenerateData2( itk::Image<TPixel, VImageDimension>* itkImage1);
+ friend struct ImageRegistrationMethodAccessFunctor;
RigidRegistrationObserver::Pointer m_Observer;
int m_Interpolator;
Image::Pointer m_ReferenceImage;
Image::Pointer m_FixedMask;
Image::Pointer m_MovingMask;
virtual void GenerateOutputInformation(){};
private:
itk::Object::Pointer m_Transform;
itk::Object::Pointer m_Metric;
itk::Object::Pointer m_Optimizer;
itk::Array<double> m_OptimizerScales;
};
}
-//#include "mitkImageRegistrationMethod.txx"
-
#endif // MITKIMAGEREGISTRATIONMETHOD_H
diff --git a/Modules/RigidRegistration/mitkImageRegistrationMethod.txx b/Modules/RigidRegistration/mitkImageRegistrationMethod.txx
deleted file mode 100644
index 2fc85d43d9..0000000000
--- a/Modules/RigidRegistration/mitkImageRegistrationMethod.txx
+++ /dev/null
@@ -1,166 +0,0 @@
-/*=========================================================================
-
-Program: Medical Imaging & Interaction Toolkit
-Language: C++
-Date: $Date: 2007-09-05 13:45:48 +0200 (Mi, 05 Sep 2007) $
-Version: $Revision: 9502 $
-
-Copyright (c) German Cancer Research Center, Division of Medical and
-Biological Informatics. All rights reserved.
-See MITKCopyright.txt or http://www.mitk.org/copyright.html for details.
-
-This software is distributed WITHOUT ANY WARRANTY; without even
-the implied warranty of MERCHANTABILITY or FITNESS FOR A PARTICULAR
-PURPOSE. See the above copyright notices for more information.
-
-=========================================================================*/
-
-#include "mitkImageRegistrationMethod.h"
-
-#include "mitkITKImageImport.h"
-#include "mitkRigidRegistrationObserver.h"
-
-#include <itkResampleImageFilter.h>
-#include <itkImageRegistrationMethod.h>
-#include <itkLinearInterpolateImageFunction.h>
-#include <itkNearestNeighborInterpolateImageFunction.h>
-#include <itkImage.h>
-
-#include <itkImageToImageMetric.h>
-#include <itkSingleValuedNonLinearOptimizer.h>
-
-#include <itkNormalizeImageFilter.h>
-#include <itkDiscreteGaussianImageFilter.h>
-#include <itkObject.h>
-
-namespace mitk {
-
- template<typename TPixel, unsigned int VImageDimension>
- void ImageRegistrationMethod::GenerateData2(itk::Image<TPixel, VImageDimension>* itkImage1)
- {
- //convert mitk masks to itk masks
- typedef typename itk::Image<TPixel, VImageDimension> FixedImageType;
- typedef typename itk::Image<TPixel, VImageDimension> MovingImageType;
- typedef typename itk::Image< unsigned char, VImageDimension > MaskImageType;
- typedef typename itk::ImageMaskSpatialObject< VImageDimension > ImageMaskType;
- typename ImageMaskType::Pointer movingImageMask;
- if(m_MovingMask.IsNotNull())
- {
- typename MovingImageType::Pointer movingMask = MovingImageType::New();
- mitk::CastToItkImage(m_MovingMask, movingMask);
- typename itk::CastImageFilter<MovingImageType, MaskImageType>::Pointer maskImageCaster = itk::CastImageFilter<MovingImageType, MaskImageType>::New();
- maskImageCaster->SetInput(movingMask);
- maskImageCaster->UpdateLargestPossibleRegion();
- movingImageMask = ImageMaskType::New();
- movingImageMask->SetImage(maskImageCaster->GetOutput());
- }
- typename ImageMaskType::Pointer fixedImageMask;
- if(m_FixedMask.IsNotNull())
- {
- typename FixedImageType::Pointer fixedMask = FixedImageType::New();
- mitk::CastToItkImage(m_FixedMask, fixedMask);
- typename itk::CastImageFilter<FixedImageType, MaskImageType>::Pointer maskImageCaster = itk::CastImageFilter<FixedImageType, MaskImageType>::New();
- maskImageCaster->SetInput(fixedMask);
- maskImageCaster->UpdateLargestPossibleRegion();
- fixedImageMask = ImageMaskType::New();
- fixedImageMask->SetImage(maskImageCaster->GetOutput());
- }
- // typedefs
- typedef typename itk::Image<TPixel, VImageDimension> FixedImageType;
- typedef typename itk::Image<TPixel, VImageDimension> MovingImageType;
- typedef typename itk::LinearInterpolateImageFunction<MovingImageType, double> InterpolatorType;
- typedef itk::NearestNeighborInterpolateImageFunction<MovingImageType, double> InterpolatorType2;
- typedef typename itk::ImageRegistrationMethod<FixedImageType, MovingImageType> RegistrationType;
- typedef typename itk::Transform< double, VImageDimension, VImageDimension > TransformType;
- typedef typename TransformType::Pointer TransformPointer;
- typedef typename itk::ImageToImageMetric<FixedImageType, MovingImageType> MetricType;
- typedef typename MetricType::Pointer MetricPointer;
- typedef typename itk::SingleValuedNonLinearOptimizer OptimizerType;
- // the fixed and the moving image
- typename FixedImageType::Pointer fixedImage = FixedImageType::New();
- typename MovingImageType::Pointer movingImage = itkImage1;
- mitk::CastToItkImage(m_ReferenceImage, fixedImage);
- // the metric
- MetricPointer metric = dynamic_cast<MetricType*>(m_Metric.GetPointer());
- if(movingImageMask.IsNotNull())
- metric->SetMovingImageMask(movingImageMask);
- if(fixedImageMask.IsNotNull())
- metric->SetFixedImageMask(fixedImageMask);
- // the transform
- TransformPointer transform = dynamic_cast<TransformType*>(m_Transform.GetPointer());
- // the optimizer
- typename OptimizerType::Pointer optimizer = dynamic_cast<OptimizerType*>(m_Optimizer.GetPointer());
- // optimizer scales
- if (m_OptimizerScales.Size() != 0)
- {
- typename OptimizerType::ScalesType scales( transform->GetNumberOfParameters() );
- for (unsigned int i = 0; i < scales.Size(); i++)
- {
- scales[i] = m_OptimizerScales[i];
- }
- optimizer->SetScales( scales );
- }
- // the registration method
- typename RegistrationType::Pointer registration = RegistrationType::New();
- registration->SetMetric(metric);
- registration->SetOptimizer(optimizer);
- registration->SetTransform(transform);
- registration->SetFixedImage(fixedImage);
- registration->SetMovingImage(movingImage);
- registration->SetFixedImageRegion(fixedImage->GetBufferedRegion());
-// if(transFac->GetTransformParameters()->GetInitialParameters().size())
-// {
-// registration->SetInitialTransformParameters( transFac->GetTransformParameters()->GetInitialParameters() );
-// }
-// else
-// {
- itk::Array<double> zeroInitial;
- zeroInitial.set_size(transform->GetNumberOfParameters());
- zeroInitial.fill(0.0);
- if (zeroInitial.size() >= 1)
- {
- zeroInitial[0] = 1.0;
- }
- if (zeroInitial.size() >= 5)
- {
- zeroInitial[4] = 1.0;
- }
- if (zeroInitial.size() >= 9)
- {
- zeroInitial[8] = 1.0;
- }
- registration->SetInitialTransformParameters( zeroInitial );
- optimizer->SetInitialPosition( zeroInitial );
-// }
- if (m_Interpolator == LINEARINTERPOLATOR)
- {
- typename InterpolatorType::Pointer interpolator = InterpolatorType::New();
- registration->SetInterpolator(interpolator);
- }
- else if (m_Interpolator == NEARESTNEIGHBORINTERPOLATOR)
- {
- typename InterpolatorType2::Pointer interpolator = InterpolatorType2::New();
- registration->SetInterpolator(interpolator);
- }
- // registering command observer with the optimizer
- if (m_Observer.IsNotNull())
- {
- m_Observer->AddStepsToDo(20);
- optimizer->AddObserver(itk::AnyEvent(), m_Observer);
- registration->AddObserver(itk::AnyEvent(), m_Observer);
- transform->AddObserver(itk::AnyEvent(), m_Observer);
- }
- registration->Update();
- if (m_Observer.IsNotNull())
- {
- optimizer->RemoveAllObservers();
- registration->RemoveAllObservers();
- transform->RemoveAllObservers();
- m_Observer->SetRemainingProgress(15);
- }
- if (m_Observer.IsNotNull())
- {
- m_Observer->SetRemainingProgress(5);
- }
- }
-} // end namespace
diff --git a/Core/Code/Algorithms/mitkImageCast.h b/Modules/RigidRegistration/mitkImageRegistrationMethodAccessFunctor.h
similarity index 51%
copy from Core/Code/Algorithms/mitkImageCast.h
copy to Modules/RigidRegistration/mitkImageRegistrationMethodAccessFunctor.h
index 931b9a6194..cd3a7dbbbd 100644
--- a/Core/Code/Algorithms/mitkImageCast.h
+++ b/Modules/RigidRegistration/mitkImageRegistrationMethodAccessFunctor.h
@@ -1,27 +1,43 @@
/*=========================================================================
Program: Medical Imaging & Interaction Toolkit
Language: C++
Date: $Date$
Version: $Revision$
Copyright (c) German Cancer Research Center, Division of Medical and
Biological Informatics. All rights reserved.
See MITKCopyright.txt or http://www.mitk.org/copyright.html for details.
This software is distributed WITHOUT ANY WARRANTY; without even
the implied warranty of MERCHANTABILITY or FITNESS FOR A PARTICULAR
PURPOSE. See the above copyright notices for more information.
=========================================================================*/
+#ifndef MITKIMAGEREGISTRATIONMETHODACCESSFUNCTOR_H
+#define MITKIMAGEREGISTRATIONMETHODACCESSFUNCTOR_H
-#ifndef MITKIMAGECAST_H_HEADER_INCLUDED
-#define MITKIMAGECAST_H_HEADER_INCLUDED
+#include <mitkImageAccessByItk.h>
-#include "itkDiffusionTensor3D.h"
-#include "itkVector.h"
+namespace mitk
+{
+ class ImageRegistrationMethod;
-#include <mitkImageAccessByItk.h>
+ struct ImageRegistrationMethodAccessFunctor
+ {
+ typedef ImageRegistrationMethodAccessFunctor Self;
+
+ void operator()(const mitk::Image* img, ImageRegistrationMethod* method)
+ {
+ AccessByItk_1(img, AccessItkImage, method)
+ }
+
+ template < typename TPixel, unsigned int VImageDimension >
+ void AccessItkImage( itk::Image<TPixel, VImageDimension>* itkImage1,
+ ImageRegistrationMethod* method);
+ };
+}
+
+#endif // MITKIMAGEREGISTRATIONMETHODACCESSFUNCTOR_H
-#endif // of MITKIMAGECAST_H_HEADER_INCLUDED
diff --git a/Modules/RigidRegistration/mitkImageRegistrationMethodAccessFunctor.txx b/Modules/RigidRegistration/mitkImageRegistrationMethodAccessFunctor.txx
new file mode 100644
index 0000000000..7351fede91
--- /dev/null
+++ b/Modules/RigidRegistration/mitkImageRegistrationMethodAccessFunctor.txx
@@ -0,0 +1,157 @@
+/*=========================================================================
+
+Program: Medical Imaging & Interaction Toolkit
+Language: C++
+Date: $Date$
+Version: $Revision$
+
+Copyright (c) German Cancer Research Center, Division of Medical and
+Biological Informatics. All rights reserved.
+See MITKCopyright.txt or http://www.mitk.org/copyright.html for details.
+
+method software is distributed WITHOUT ANY WARRANTY; without even
+the implied warranty of MERCHANTABILITY or FITNESS FOR A PARTICULAR
+PURPOSE. See the above copyright notices for more information.
+
+=========================================================================*/
+
+#include "mitkImageRegistrationMethodAccessFunctor.h"
+#include "mitkImageRegistrationMethod.h"
+
+#include <mitkImageCast.h>
+
+#include <itkLinearInterpolateImageFunction.h>
+
+namespace mitk {
+
+template<typename TPixel, unsigned int VImageDimension>
+void ImageRegistrationMethodAccessFunctor::AccessItkImage(itk::Image<TPixel, VImageDimension>* itkImage1,
+ ImageRegistrationMethod* method)
+{
+ //convert mitk masks to itk masks
+ typedef typename itk::Image<TPixel, VImageDimension> FixedImageType;
+ typedef typename itk::Image<TPixel, VImageDimension> MovingImageType;
+ typedef typename itk::Image< unsigned char, VImageDimension > MaskImageType;
+ typedef typename itk::ImageMaskSpatialObject< VImageDimension > ImageMaskType;
+ typename ImageMaskType::Pointer movingImageMask;
+ if(method->m_MovingMask.IsNotNull())
+ {
+ typename MovingImageType::Pointer movingMask = MovingImageType::New();
+ mitk::CastToItkImage(method->m_MovingMask, movingMask);
+ typename itk::CastImageFilter<MovingImageType, MaskImageType>::Pointer maskImageCaster = itk::CastImageFilter<MovingImageType, MaskImageType>::New();
+ maskImageCaster->SetInput(movingMask);
+ maskImageCaster->UpdateLargestPossibleRegion();
+ movingImageMask = ImageMaskType::New();
+ movingImageMask->SetImage(maskImageCaster->GetOutput());
+ }
+ typename ImageMaskType::Pointer fixedImageMask;
+ if(method->m_FixedMask.IsNotNull())
+ {
+ typename FixedImageType::Pointer fixedMask = FixedImageType::New();
+ mitk::CastToItkImage(method->m_FixedMask, fixedMask);
+ typename itk::CastImageFilter<FixedImageType, MaskImageType>::Pointer maskImageCaster = itk::CastImageFilter<FixedImageType, MaskImageType>::New();
+ maskImageCaster->SetInput(fixedMask);
+ maskImageCaster->UpdateLargestPossibleRegion();
+ fixedImageMask = ImageMaskType::New();
+ fixedImageMask->SetImage(maskImageCaster->GetOutput());
+ }
+ // typedefs
+ typedef typename itk::Image<TPixel, VImageDimension> FixedImageType;
+ typedef typename itk::Image<TPixel, VImageDimension> MovingImageType;
+ typedef typename itk::LinearInterpolateImageFunction<MovingImageType, double> InterpolatorType;
+ typedef itk::NearestNeighborInterpolateImageFunction<MovingImageType, double> InterpolatorType2;
+ typedef typename itk::ImageRegistrationMethod<FixedImageType, MovingImageType> RegistrationType;
+ typedef typename itk::Transform< double, VImageDimension, VImageDimension > TransformType;
+ typedef typename TransformType::Pointer TransformPointer;
+ typedef typename itk::ImageToImageMetric<FixedImageType, MovingImageType> MetricType;
+ typedef typename MetricType::Pointer MetricPointer;
+ typedef typename itk::SingleValuedNonLinearOptimizer OptimizerType;
+ // the fixed and the moving image
+ typename FixedImageType::Pointer fixedImage = FixedImageType::New();
+ typename MovingImageType::Pointer movingImage = itkImage1;
+ mitk::CastToItkImage(method->m_ReferenceImage, fixedImage);
+ // the metric
+ MetricPointer metric = dynamic_cast<MetricType*>(method->m_Metric.GetPointer());
+ if(movingImageMask.IsNotNull())
+ metric->SetMovingImageMask(movingImageMask);
+ if(fixedImageMask.IsNotNull())
+ metric->SetFixedImageMask(fixedImageMask);
+ // the transform
+ TransformPointer transform = dynamic_cast<TransformType*>(method->m_Transform.GetPointer());
+ // the optimizer
+ typename OptimizerType::Pointer optimizer = dynamic_cast<OptimizerType*>(method->m_Optimizer.GetPointer());
+ // optimizer scales
+ if (method->m_OptimizerScales.Size() != 0)
+ {
+ typename OptimizerType::ScalesType scales( transform->GetNumberOfParameters() );
+ for (unsigned int i = 0; i < scales.Size(); i++)
+ {
+ scales[i] = method->m_OptimizerScales[i];
+ }
+ optimizer->SetScales( scales );
+ }
+ // the registration method
+ typename RegistrationType::Pointer registration = RegistrationType::New();
+ registration->SetMetric(metric);
+ registration->SetOptimizer(optimizer);
+ registration->SetTransform(transform);
+ registration->SetFixedImage(fixedImage);
+ registration->SetMovingImage(movingImage);
+ registration->SetFixedImageRegion(fixedImage->GetBufferedRegion());
+// if(transFac->GetTransformParameters()->GetInitialParameters().size())
+// {
+// registration->SetInitialTransformParameters( transFac->GetTransformParameters()->GetInitialParameters() );
+// }
+// else
+// {
+ itk::Array<double> zeroInitial;
+ zeroInitial.set_size(transform->GetNumberOfParameters());
+ zeroInitial.fill(0.0);
+ if (zeroInitial.size() >= 1)
+ {
+ zeroInitial[0] = 1.0;
+ }
+ if (zeroInitial.size() >= 5)
+ {
+ zeroInitial[4] = 1.0;
+ }
+ if (zeroInitial.size() >= 9)
+ {
+ zeroInitial[8] = 1.0;
+ }
+ registration->SetInitialTransformParameters( zeroInitial );
+ optimizer->SetInitialPosition( zeroInitial );
+// }
+ if (method->m_Interpolator == ImageRegistrationMethod::LINEARINTERPOLATOR)
+ {
+ typename InterpolatorType::Pointer interpolator = InterpolatorType::New();
+ registration->SetInterpolator(interpolator);
+ }
+ else if (method->m_Interpolator == ImageRegistrationMethod::NEARESTNEIGHBORINTERPOLATOR)
+ {
+ typename InterpolatorType2::Pointer interpolator = InterpolatorType2::New();
+ registration->SetInterpolator(interpolator);
+ }
+ // registering command observer with the optimizer
+ if (method->m_Observer.IsNotNull())
+ {
+ method->m_Observer->AddStepsToDo(20);
+ optimizer->AddObserver(itk::AnyEvent(), method->m_Observer);
+ registration->AddObserver(itk::AnyEvent(), method->m_Observer);
+ transform->AddObserver(itk::AnyEvent(), method->m_Observer);
+ }
+ registration->Update();
+ if (method->m_Observer.IsNotNull())
+ {
+ optimizer->RemoveAllObservers();
+ registration->RemoveAllObservers();
+ transform->RemoveAllObservers();
+ method->m_Observer->SetRemainingProgress(15);
+ }
+ if (method->m_Observer.IsNotNull())
+ {
+ method->m_Observer->SetRemainingProgress(5);
+ }
+}
+
+} // end namespace
diff --git a/Modules/RigidRegistration/mitkPyramidalRegistrationMethod-TYPE.cpp b/Modules/RigidRegistration/mitkPyramidalRegistrationMethod-TYPE.cpp
index 724c9f0178..703a795012 100644
--- a/Modules/RigidRegistration/mitkPyramidalRegistrationMethod-TYPE.cpp
+++ b/Modules/RigidRegistration/mitkPyramidalRegistrationMethod-TYPE.cpp
@@ -1,20 +1,25 @@
/*=========================================================================
Program: Medical Imaging & Interaction Toolkit
Language: C++
Date: $Date: 2009-05-28 17:19:30 +0200 (Thu, 28 May 2009) $
Version: $Revision: 17495 $
Copyright (c) German Cancer Research Center, Division of Medical and
Biological Informatics. All rights reserved.
See MITKCopyright.txt or http://www.mitk.org/copyright.html for details.
This software is distributed WITHOUT ANY WARRANTY; without even
the implied warranty of MERCHANTABILITY or FITNESS FOR A PARTICULAR
PURPOSE. See the above copyright notices for more information.
=========================================================================*/
-#include <mitkPyramidalRegistrationMethod.txx>
+#include <mitkPyramidalRegistrationMethodAccessFunctor.txx>
+#include <mitkInstantiateAccessFunctions.h>
+
+#define InstantiateAccessFunction_PyramidalAccessItkImage(pixelType, dim) \
+ template void mitk::PyramidalRegistrationMethodAccessFunctor::AccessItkImage(itk::Image<pixelType, dim>* itkImage1, mitk::PyramidalRegistrationMethod* method);
+
+InstantiateAccessFunctionForFixedPixelType(PyramidalAccessItkImage, (@TYPE@))
-InstantiateAccessFunctionForFixedPixelType( mitk::PyramidalRegistrationMethod::GenerateData2, @TYPE@);
diff --git a/Modules/RigidRegistration/mitkPyramidalRegistrationMethod.cpp b/Modules/RigidRegistration/mitkPyramidalRegistrationMethod.cpp
index 234caea4cd..f089e2680d 100644
--- a/Modules/RigidRegistration/mitkPyramidalRegistrationMethod.cpp
+++ b/Modules/RigidRegistration/mitkPyramidalRegistrationMethod.cpp
@@ -1,180 +1,180 @@
/*=========================================================================
Program: Medical Imaging & Interaction Toolkit
Language: C++
Date: $Date: 2009-05-28 17:19:30 +0200 (Thu, 28 May 2009) $
Version: $Revision: 17495 $
Copyright (c) German Cancer Research Center, Division of Medical and
Biological Informatics. All rights reserved.
See MITKCopyright.txt or http://www.mitk.org/copyright.html for details.
This software is distributed WITHOUT ANY WARRANTY; without even
the implied warranty of MERCHANTABILITY or FITNESS FOR A PARTICULAR
PURPOSE. See the above copyright notices for more information.
=========================================================================*/
#include "mitkPyramidalRegistrationMethod.h"
-
+#include "mitkPyramidalRegistrationMethodAccessFunctor.h"
namespace mitk {
PyramidalRegistrationMethod::PyramidalRegistrationMethod() : m_Observer(NULL), m_Interpolator(0)
{
m_OptimizerParameters = OptimizerParameters::New();
m_TransformParameters = TransformParameters::New();
m_MetricParameters = MetricParameters::New();
m_ReferenceImage = Image::New();
m_MovingMask = Image::New();
m_FixedMask = Image::New();
m_Preset = new mitk::RigidRegistrationPreset();
bool succeed = m_Preset->LoadPreset();
if(!succeed)
{
std::cout << "RigidRegistrationParameters.xml is empty or does not exist. There are no presets to select." << std::endl;
return;
}
m_UseMask = false;
m_BlurMovingImage = true;
m_BlurFixedImage = true;
}
PyramidalRegistrationMethod::~PyramidalRegistrationMethod()
{
}
void PyramidalRegistrationMethod::GenerateData()
{
if (this->GetInput())
{
- AccessByItk(this->GetInput(), GenerateData2);
+ PyramidalRegistrationMethodAccessFunctor()(this->GetInput(), this);
}
}
void PyramidalRegistrationMethod::SetObserver(RigidRegistrationObserver::Pointer observer)
{
m_Observer = observer;
}
void PyramidalRegistrationMethod::SetInterpolator(int interpolator)
{
m_Interpolator = interpolator;
}
void PyramidalRegistrationMethod::SetReferenceImage(Image::Pointer fixedImage)
{
m_ReferenceImage = fixedImage;
SetNthInput(1, m_ReferenceImage);
Modified();
}
mitk::TransformParameters::Pointer PyramidalRegistrationMethod::ParseTransformParameters(itk::Array<double> transformValues)
{
mitk::TransformParameters::Pointer transformParameters = TransformParameters::New();
itk::Array<double> initialParameters;
if(transformParameters->GetInitialParameters().size())
{
initialParameters = transformParameters->GetInitialParameters();
}
transformParameters = mitk::TransformParameters::New();
transformParameters->SetTransform(transformValues[0]);
if(transformParameters->GetInitialParameters().size())
{
transformParameters->SetInitialParameters(initialParameters);
}
// Set scales. Every type of transform has a different number of scales!!!
// TODO: Finish for al types of transform (or find a better solution)
itk::Array<double> scales;
if(transformValues[0] == mitk::TransformParameters::AFFINETRANSFORM) scales.SetSize(12);
if(transformValues[0] == mitk::TransformParameters::TRANSLATIONTRANSFORM) scales.SetSize(3);
for(unsigned int i = 0; i < scales.size(); i++)
{
scales[i] = transformValues[i+2];
}
transformParameters->SetScales(scales);
transformParameters->SetTransformInitializerOn(false);
// Use Scales
if(transformValues[1] == 1)
{
transformParameters->SetUseOptimizerScales(true);
}
return transformParameters;
}
mitk::MetricParameters::Pointer PyramidalRegistrationMethod::ParseMetricParameters(itk::Array<double> metricValues)
{
mitk::MetricParameters::Pointer metricParameters = mitk::MetricParameters::New();
metricParameters->SetMetric(metricValues[0]);
metricParameters->SetComputeGradient(metricValues[1]);
// Some things have to be checked for every metric individually
if(metricValues[0] == mitk::MetricParameters::MUTUALINFORMATIONHISTOGRAMIMAGETOIMAGEMETRIC)
{
metricParameters->SetNumberOfHistogramBinsMutualInformationHistogram(metricValues[2]);
}
if(metricValues[0] == mitk::MetricParameters::MATTESMUTUALINFORMATIONIMAGETOIMAGEMETRIC)
{
metricParameters->SetSpatialSamplesMattesMutualInformation(metricValues[3]);
metricParameters->SetNumberOfHistogramBinsMattesMutualInformation(metricValues[4]);
}
return metricParameters;
}
mitk::OptimizerParameters::Pointer PyramidalRegistrationMethod::ParseOptimizerParameters(itk::Array<double> optimizerValues)
{
mitk::OptimizerParameters::Pointer optimizerParameters = mitk::OptimizerParameters::New();
optimizerParameters->SetOptimizer(optimizerValues[0]);
optimizerParameters->SetMaximize(optimizerValues[1]); //should be when used with maximize mutual information for example
if(optimizerValues[0] == mitk::OptimizerParameters::GRADIENTDESCENTOPTIMIZER)
{
optimizerParameters->SetLearningRateGradientDescent(optimizerValues[2]);
optimizerParameters->SetNumberOfIterationsGradientDescent(optimizerValues[3]);
}
if(optimizerValues[0] == mitk::OptimizerParameters::REGULARSTEPGRADIENTDESCENTOPTIMIZER)
{
cout << "use regularstepgradientdescent" << endl;
optimizerParameters->SetGradientMagnitudeToleranceRegularStepGradientDescent(optimizerValues[2]);
optimizerParameters->SetMinimumStepLengthRegularStepGradientDescent(optimizerValues[3]);
optimizerParameters->SetMaximumStepLengthRegularStepGradientDescent(optimizerValues[4]);
optimizerParameters->SetRelaxationFactorRegularStepGradientDescent(optimizerValues[5]);
optimizerParameters->SetNumberOfIterationsRegularStepGradientDescent(optimizerValues[6]);
}
return optimizerParameters;
}
void PyramidalRegistrationMethod::SetMovingMask(Image::Pointer movingMask)
{
m_MovingMask = movingMask;
SetNthInput(3, m_MovingMask);
Modified();
}
void PyramidalRegistrationMethod::SetFixedMask(Image::Pointer FixedMask)
{
m_FixedMask = FixedMask;
SetNthInput(4, m_FixedMask);
Modified();
}
} // end namespace
diff --git a/Modules/RigidRegistration/mitkPyramidalRegistrationMethod.h b/Modules/RigidRegistration/mitkPyramidalRegistrationMethod.h
index 19404311f5..d2e8911e24 100644
--- a/Modules/RigidRegistration/mitkPyramidalRegistrationMethod.h
+++ b/Modules/RigidRegistration/mitkPyramidalRegistrationMethod.h
@@ -1,167 +1,166 @@
/*=========================================================================
Program: Medical Imaging & Interaction Toolkit
Language: C++
Date: $Date: 2009-05-28 17:19:30 +0200 (Thu, 28 May 2009) $
Version: $Revision: 17495 $
Copyright (c) German Cancer Research Center, Division of Medical and
Biological Informatics. All rights reserved.
See MITKCopyright.txt or http://www.mitk.org/copyright.html for details.
This software is distributed WITHOUT ANY WARRANTY; without even
the implied warranty of MERCHANTABILITY or FITNESS FOR A PARTICULAR
PURPOSE. See the above copyright notices for more information.
=========================================================================*/
#ifndef MITKPYRAMIDALREGISTRATIONMETHOD_H
#define MITKPYRAMIDALREGISTRATIONMETHOD_H
#include "itkImageRegistrationMethod.h"
#include "MitkRigidRegistrationExports.h"
#include "itkSingleValuedNonLinearOptimizer.h"
#include "mitkImageToImageFilter.h"
#include "mitkImageAccessByItk.h"
#include "mitkRigidRegistrationObserver.h"
#include "mitkCommon.h"
#include "mitkOptimizerParameters.h"
#include "mitkTransformParameters.h"
#include "mitkMetricParameters.h"
#include "itkImageMaskSpatialObject.h"
#include "mitkRigidRegistrationPreset.h"
namespace mitk
{
/*!
\brief Main class for the rigid registration pipeline.
\ingroup RigidRegistration
\author Thomas van Bruggen */
class MITK_RIGIDREGISTRATION_EXPORT PyramidalRegistrationMethod : public ImageToImageFilter
{
public:
typedef itk::SingleValuedNonLinearOptimizer OptimizerType;
typedef itk::ImageMaskSpatialObject< 3 > MaskType;
mitkClassMacro(PyramidalRegistrationMethod, ImageToImageFilter);
itkNewMacro(Self);
static const int LINEARINTERPOLATOR = 0;
static const int NEARESTNEIGHBORINTERPOLATOR = 1;
void SetObserver(RigidRegistrationObserver::Pointer observer);
void SetInterpolator(int interpolator);
virtual void GenerateData();
virtual void SetReferenceImage( Image::Pointer fixedImage);
virtual void SetFixedMask( Image::Pointer fixedMask);
virtual void SetMovingMask( Image::Pointer movingMask);
void SetOptimizerParameters(OptimizerParameters::Pointer optimizerParameters)
{
m_OptimizerParameters = optimizerParameters;
}
OptimizerParameters::Pointer GetOptimizerParameters()
{
return m_OptimizerParameters;
}
void SetTransformParameters(TransformParameters::Pointer transformParameters)
{
m_TransformParameters = transformParameters;
}
TransformParameters::Pointer GetTransformParameters()
{
return m_TransformParameters;
}
void SetMetricParameters(MetricParameters::Pointer metricParameters)
{
m_MetricParameters = metricParameters;
}
MetricParameters::Pointer GetMetricParameters()
{
return m_MetricParameters;
}
void SetPresets(std::vector<std::string> presets)
{
m_Presets = presets;
}
itkSetMacro(FixedSchedule, itk::Array2D<unsigned int>);
itkSetMacro(MovingSchedule, itk::Array2D<unsigned int>);
itkSetMacro(MatchHistograms, bool);
itkGetMacro(Preset, mitk::RigidRegistrationPreset*);
itkSetMacro(BlurFixedImage, bool);
itkSetMacro(BlurMovingImage, bool);
protected:
PyramidalRegistrationMethod();
virtual ~PyramidalRegistrationMethod();
- template < typename TPixel, unsigned int VImageDimension >
- void GenerateData2( itk::Image<TPixel, VImageDimension>* itkImage1);
+ friend struct PyramidalRegistrationMethodAccessFunctor;
RigidRegistrationObserver::Pointer m_Observer;
int m_Interpolator;
Image::Pointer m_ReferenceImage;
Image::Pointer m_FixedMask;
Image::Pointer m_MovingMask;
void GenerateOutputInformation(){};
private:
OptimizerParameters::Pointer m_OptimizerParameters;
TransformParameters::Pointer m_TransformParameters;
MetricParameters::Pointer m_MetricParameters;
std::vector<std::string> m_Presets;
mitk::RigidRegistrationPreset* m_Preset;
// Schedules
itk::Array2D<unsigned int> m_FixedSchedule;
itk::Array2D<unsigned int> m_MovingSchedule;
bool m_UseMask;
bool m_MatchHistograms;
bool m_BlurFixedImage;
bool m_BlurMovingImage;
MaskType::Pointer m_BrainMask;
mitk::TransformParameters::Pointer ParseTransformParameters(itk::Array<double> transformValues);
mitk::MetricParameters::Pointer ParseMetricParameters(itk::Array<double> metricValues);
mitk::OptimizerParameters::Pointer ParseOptimizerParameters(itk::Array<double> optimizerValues);
};
}
#endif // MITKIMAGEREGISTRATIONMETHOD_H
diff --git a/Modules/RigidRegistration/mitkPyramidalRegistrationMethod.txx b/Modules/RigidRegistration/mitkPyramidalRegistrationMethod.txx
deleted file mode 100644
index a075e53833..0000000000
--- a/Modules/RigidRegistration/mitkPyramidalRegistrationMethod.txx
+++ /dev/null
@@ -1,291 +0,0 @@
-/*=========================================================================
-
-Program: Medical Imaging & Interaction Toolkit
-Language: C++
-Date: $Date: 2007-09-05 13:45:48 +0200 (Mi, 05 Sep 2007) $
-Version: $Revision: 9502 $
-
-Copyright (c) German Cancer Research Center, Division of Medical and
-Biological Informatics. All rights reserved.
-See MITKCopyright.txt or http://www.mitk.org/copyright.html for details.
-
-This software is distributed WITHOUT ANY WARRANTY; without even
-the implied warranty of MERCHANTABILITY or FITNESS FOR A PARTICULAR
-PURPOSE. See the above copyright notices for more information.
-
-=========================================================================*/
-
-#include "mitkPyramidalRegistrationMethod.h"
-
-#include "mitkMetricFactory.h"
-#include "mitkTransformFactory.h"
-#include "mitkOptimizerFactory.h"
-#include "mitkTransformParameters.h"
-#include "mitkMetricParameters.h"
-#include <mitkITKImageImport.h>
-#include "mitkRigidRegistrationObserver.h"
-
-#include "itkResampleImageFilter.h"
-#include "itkImageRegistrationMethod.h"
-#include "itkMultiResolutionImageRegistrationMethod.h"
-#include "itkLinearInterpolateImageFunction.h"
-#include "itkNearestNeighborInterpolateImageFunction.h"
-#include "itkImage.h"
-
-#include "itkImageToImageMetric.h"
-#include "itkSingleValuedNonLinearOptimizer.h"
-
-
-#include "itkDiscreteGaussianImageFilter.h"
-
-#include "mitkRegistrationInterfaceCommand.h"
-
-#include <itkRescaleIntensityImageFilter.h>
-#include <itkHistogramMatchingImageFilter.h>
-#include <itkCastImageFilter.h>
-
-#include <itkStatisticsImageFilter.h>
-#include <itkIntensityWindowingImageFilter.h>
-
-namespace mitk {
-
-
- template<typename TPixel, unsigned int VImageDimension>
- void PyramidalRegistrationMethod::GenerateData2(itk::Image<TPixel, VImageDimension>* itkImage1)
- {
-
- // TYPEDEFS
- typedef itk::Image< TPixel, VImageDimension > ImageType;
-
- typedef float InternalPixelType;
- typedef itk::Image< InternalPixelType, VImageDimension > InternalImageType;
-
- typedef typename itk::Transform
- < double, VImageDimension, VImageDimension > TransformType;
- typedef mitk::TransformFactory<InternalPixelType,
- VImageDimension> TransformFactoryType;
- typedef itk::LinearInterpolateImageFunction
- < InternalImageType, double > InterpolatorType;
- typedef mitk::MetricFactory
- <InternalPixelType, VImageDimension> MetricFactoryType;
- typedef itk::RecursiveMultiResolutionPyramidImageFilter<
- InternalImageType,
- InternalImageType > ImagePyramidType;
- typedef itk::DiscreteGaussianImageFilter
- <ImageType, InternalImageType> GaussianFilterType;
-
-
-
- typedef itk::MultiResolutionImageRegistrationMethod<
- InternalImageType,
- InternalImageType > RegistrationType;
- typedef RegistrationInterfaceCommand
- <RegistrationType, TPixel> CommandType;
-
- typedef itk::CastImageFilter<ImageType,
- InternalImageType> CastImageFilterType;
-
- itk::Array<double> initialParameters;
- if(m_TransformParameters->GetInitialParameters().size())
- {
- initialParameters = m_TransformParameters->GetInitialParameters();
- }
-
- // LOAD PARAMETERS
- itk::Array<double> transformValues = m_Preset->getTransformValues(m_Presets[0]);
- itk::Array<double> metricValues = m_Preset->getMetricValues(m_Presets[0]);
- itk::Array<double> optimizerValues = m_Preset->getOptimizerValues(m_Presets[0]);
- m_TransformParameters = ParseTransformParameters(transformValues);
- m_MetricParameters = ParseMetricParameters(metricValues);
- m_OptimizerParameters = ParseOptimizerParameters(optimizerValues);
-
-
- // The fixed and the moving image
- typename InternalImageType::Pointer fixedImage = InternalImageType::New();
- typename InternalImageType::Pointer movingImage = InternalImageType::New();
-
-
-
-
- mitk::CastToItkImage(m_ReferenceImage, fixedImage);
-
- // Blur the moving image
- if(m_BlurMovingImage)
- {
- typename GaussianFilterType::Pointer gaussianFilter = GaussianFilterType::New();
- gaussianFilter->SetInput(itkImage1);
- gaussianFilter->SetVariance(6.0);
- gaussianFilter->SetMaximumError( 0.1 );
- //gaussianFilter->SetMaximumKernelWidth ( 3 );
- gaussianFilter->Update();
- movingImage = gaussianFilter->GetOutput();
- } else{
- typename CastImageFilterType::Pointer castImageFilter = CastImageFilterType::New();
- castImageFilter->SetInput(itkImage1);
- castImageFilter->Update();
- movingImage = castImageFilter->GetOutput();
- }
-
- if(m_MatchHistograms)
- {
- typedef itk::RescaleIntensityImageFilter<InternalImageType,InternalImageType> FilterType;
- typedef itk::HistogramMatchingImageFilter<InternalImageType,InternalImageType> HEFilterType;
-
- typename FilterType::Pointer inputRescaleFilter = FilterType::New();
- typename FilterType::Pointer referenceRescaleFilter = FilterType::New();
-
- referenceRescaleFilter->SetInput(fixedImage);
- inputRescaleFilter->SetInput(movingImage);
-
- const float desiredMinimum = 0.0;
- const float desiredMaximum = 255.0;
-
- referenceRescaleFilter->SetOutputMinimum( desiredMinimum );
- referenceRescaleFilter->SetOutputMaximum( desiredMaximum );
- referenceRescaleFilter->UpdateLargestPossibleRegion();
- inputRescaleFilter->SetOutputMinimum( desiredMinimum );
- inputRescaleFilter->SetOutputMaximum( desiredMaximum );
- inputRescaleFilter->UpdateLargestPossibleRegion();
-
- // Histogram match the images
- typename HEFilterType::Pointer intensityEqualizeFilter = HEFilterType::New();
-
- intensityEqualizeFilter->SetReferenceImage( inputRescaleFilter->GetOutput() );
- intensityEqualizeFilter->SetInput( referenceRescaleFilter->GetOutput() );
- intensityEqualizeFilter->SetNumberOfHistogramLevels( 64 );
- intensityEqualizeFilter->SetNumberOfMatchPoints( 12 );
- intensityEqualizeFilter->ThresholdAtMeanIntensityOn();
- intensityEqualizeFilter->Update();
-
- //fixedImage = referenceRescaleFilter->GetOutput();
- //movingImage = IntensityEqualizeFilter->GetOutput();
-
- fixedImage = intensityEqualizeFilter->GetOutput();
- movingImage = inputRescaleFilter->GetOutput();
-
- }
-
-
-
- typename TransformFactoryType::Pointer transFac = TransformFactoryType::New();
- transFac->SetTransformParameters(m_TransformParameters);
- transFac->SetFixedImage(fixedImage);
- transFac->SetMovingImage(movingImage);
- typename TransformType::Pointer transform = transFac->GetTransform();
-
-
- typename InterpolatorType::Pointer interpolator = InterpolatorType::New();
- typename MetricFactoryType::Pointer metFac = MetricFactoryType::New();
- metFac->SetMetricParameters(m_MetricParameters);
-
-
- typename OptimizerFactory::Pointer optFac = OptimizerFactory::New();
- optFac->SetOptimizerParameters(m_OptimizerParameters);
- optFac->SetNumberOfTransformParameters(transform->GetNumberOfParameters());
- typename OptimizerType::Pointer optimizer = optFac->GetOptimizer();
-
- // optimizer scales
- if (m_TransformParameters->GetUseOptimizerScales())
- {
- itk::Array<double> optimizerScales = m_TransformParameters->GetScales();
- typename OptimizerType::ScalesType scales( transform->GetNumberOfParameters() );
- for (unsigned int i = 0; i < scales.Size(); i++)
- {
- scales[i] = optimizerScales[i];
- }
- optimizer->SetScales( scales );
- }
-
- typename ImagePyramidType::Pointer fixedImagePyramid = ImagePyramidType::New();
- typename ImagePyramidType::Pointer movingImagePyramid = ImagePyramidType::New();
-
- if(m_FixedSchedule.size() > 0 && m_MovingSchedule.size() > 0)
- {
- fixedImagePyramid->SetSchedule(m_FixedSchedule);
- movingImagePyramid->SetSchedule(m_MovingSchedule);
- // Otherwise just use the default schedule
- }
-
-
-
-
- typename RegistrationType::Pointer registration = RegistrationType::New();
- registration->SetOptimizer( optimizer );
- registration->SetTransform( transform );
- registration->SetInterpolator( interpolator );
- registration->SetMetric( metFac->GetMetric() );
- registration->SetFixedImagePyramid( fixedImagePyramid );
- registration->SetMovingImagePyramid( movingImagePyramid );
- registration->SetFixedImage( fixedImage );
- registration->SetMovingImage( movingImage );
- registration->SetFixedImageRegion( fixedImage->GetBufferedRegion() );
-
- if(transFac->GetTransformParameters()->GetInitialParameters().size())
- {
- registration->SetInitialTransformParameters( transFac->GetTransformParameters()->GetInitialParameters() );
- }
- else
- {
- itk::Array<double> zeroInitial;
- zeroInitial.set_size(transform->GetNumberOfParameters());
- zeroInitial.fill(0.0);
- zeroInitial[0] = 1.0;
- zeroInitial[4] = 1.0;
- zeroInitial[8] = 1.0;
- registration->SetInitialTransformParameters( zeroInitial );
- }
-
-
- if(m_UseMask)
- {
- itk::ImageMaskSpatialObject< VImageDimension>* mask =
- dynamic_cast< itk::ImageMaskSpatialObject< VImageDimension>* > ( m_BrainMask.GetPointer() );
- registration->GetMetric()->SetFixedImageMask(mask);
- }
-
- // registering command observer with the optimizer
- if (m_Observer.IsNotNull())
- {
- m_Observer->AddStepsToDo(20);
- optimizer->AddObserver(itk::AnyEvent(), m_Observer);
- registration->AddObserver(itk::AnyEvent(), m_Observer);
- transform->AddObserver(itk::AnyEvent(), m_Observer);
- }
-
- typename CommandType::Pointer command = CommandType::New();
- command->observer = m_Observer;
- command->m_Presets = m_Presets;
- command->m_UseMask = m_UseMask;
- command->m_BrainMask = m_BrainMask;
-
- registration->AddObserver( itk::IterationEvent(), command );
- registration->SetSchedules(m_FixedSchedule, m_MovingSchedule);
-
-
- // Start the registration process
- try
- {
- registration->StartRegistration();
- }
- catch( itk::ExceptionObject & err )
- {
- std::cout << "ExceptionObject caught !" << std::endl;
- std::cout << err << std::endl;
- }
- if (m_Observer.IsNotNull())
- {
- optimizer->RemoveAllObservers();
- registration->RemoveAllObservers();
- transform->RemoveAllObservers();
- m_Observer->SetRemainingProgress(15);
- }
- if (m_Observer.IsNotNull())
- {
- m_Observer->SetRemainingProgress(5);
- }
-
- }
-
-
-
-} // end namespace
diff --git a/Modules/RigidRegistration/mitkPyramidalRegistrationMethodAccessFunctor.h b/Modules/RigidRegistration/mitkPyramidalRegistrationMethodAccessFunctor.h
new file mode 100644
index 0000000000..9c4e41d0c9
--- /dev/null
+++ b/Modules/RigidRegistration/mitkPyramidalRegistrationMethodAccessFunctor.h
@@ -0,0 +1,43 @@
+/*=========================================================================
+
+Program: Medical Imaging & Interaction Toolkit
+Language: C++
+Date: $Date$
+Version: $Revision$
+
+Copyright (c) German Cancer Research Center, Division of Medical and
+Biological Informatics. All rights reserved.
+See MITKCopyright.txt or http://www.mitk.org/copyright.html for details.
+
+This software is distributed WITHOUT ANY WARRANTY; without even
+the implied warranty of MERCHANTABILITY or FITNESS FOR A PARTICULAR
+PURPOSE. See the above copyright notices for more information.
+
+=========================================================================*/
+
+#ifndef MITKPYRAMIDALREGISTRATIONMETHODACCESSFUNCTOR_H
+#define MITKPYRAMIDALREGISTRATIONMETHODACCESSFUNCTOR_H
+
+#include <mitkImageAccessByItk.h>
+
+namespace mitk
+{
+ class PyramidalRegistrationMethod;
+
+ struct PyramidalRegistrationMethodAccessFunctor
+ {
+ typedef PyramidalRegistrationMethodAccessFunctor Self;
+
+ void operator()(const mitk::Image* img, PyramidalRegistrationMethod* method)
+ {
+ AccessByItk_1(img, AccessItkImage, method)
+ }
+
+ template < typename TPixel, unsigned int VImageDimension >
+ void AccessItkImage( itk::Image<TPixel, VImageDimension>* itkImage1,
+ PyramidalRegistrationMethod* method);
+ };
+}
+
+#endif // MITKPYRAMIDALREGISTRATIONMETHODACCESSFUNCTOR_H
+
diff --git a/Modules/RigidRegistration/mitkPyramidalRegistrationMethodAccessFunctor.txx b/Modules/RigidRegistration/mitkPyramidalRegistrationMethodAccessFunctor.txx
new file mode 100644
index 0000000000..c5668e93be
--- /dev/null
+++ b/Modules/RigidRegistration/mitkPyramidalRegistrationMethodAccessFunctor.txx
@@ -0,0 +1,248 @@
+/*=========================================================================
+
+Program: Medical Imaging & Interaction Toolkit
+Language: C++
+Date: $Date$
+Version: $Revision$
+
+Copyright (c) German Cancer Research Center, Division of Medical and
+Biological Informatics. All rights reserved.
+See MITKCopyright.txt or http://www.mitk.org/copyright.html for details.
+
+method software is distributed WITHOUT ANY WARRANTY; without even
+the implied warranty of MERCHANTABILITY or FITNESS FOR A PARTICULAR
+PURPOSE. See the above copyright notices for more information.
+
+=========================================================================*/
+
+#include "mitkPyramidalRegistrationMethodAccessFunctor.h"
+#include "mitkPyramidalRegistrationMethod.h"
+
+#include <mitkImageCast.h>
+
+#include <itkLinearInterpolateImageFunction.h>
+#include <itkMultiResolutionImageRegistrationMethod.h>
+#include <itkRescaleIntensityImageFilter.h>
+#include <itkHistogramMatchingImageFilter.h>
+
+#include "mitkMetricFactory.h"
+#include "mitkTransformFactory.h"
+#include "mitkOptimizerFactory.h"
+#include "mitkRegistrationInterfaceCommand.h"
+
+namespace mitk {
+
+template<typename TPixel, unsigned int VImageDimension>
+void PyramidalRegistrationMethodAccessFunctor::AccessItkImage(itk::Image<TPixel, VImageDimension>* itkImage1,
+ PyramidalRegistrationMethod* method)
+{
+
+ // TYPEDEFS
+ typedef itk::Image< TPixel, VImageDimension > ImageType;
+
+ typedef float InternalPixelType;
+ typedef itk::Image<InternalPixelType, VImageDimension> InternalImageType;
+
+ typedef typename itk::Transform<double, VImageDimension, VImageDimension> TransformType;
+ typedef mitk::TransformFactory<InternalPixelType, VImageDimension> TransformFactoryType;
+ typedef itk::LinearInterpolateImageFunction<InternalImageType, double> InterpolatorType;
+ typedef mitk::MetricFactory<InternalPixelType, VImageDimension> MetricFactoryType;
+ typedef itk::RecursiveMultiResolutionPyramidImageFilter<InternalImageType, InternalImageType > ImagePyramidType;
+ typedef itk::DiscreteGaussianImageFilter<ImageType, InternalImageType> GaussianFilterType;
+
+ typedef itk::MultiResolutionImageRegistrationMethod<InternalImageType, InternalImageType > RegistrationType;
+ typedef RegistrationInterfaceCommand<RegistrationType, TPixel> CommandType;
+
+ typedef itk::CastImageFilter<ImageType, InternalImageType> CastImageFilterType;
+
+ itk::Array<double> initialParameters;
+ if(method->m_TransformParameters->GetInitialParameters().size())
+ {
+ initialParameters = method->m_TransformParameters->GetInitialParameters();
+ }
+
+ // LOAD PARAMETERS
+ itk::Array<double> transformValues = method->m_Preset->getTransformValues(method->m_Presets[0]);
+ itk::Array<double> metricValues = method->m_Preset->getMetricValues(method->m_Presets[0]);
+ itk::Array<double> optimizerValues = method->m_Preset->getOptimizerValues(method->m_Presets[0]);
+ method->m_TransformParameters = method->ParseTransformParameters(transformValues);
+ method->m_MetricParameters = method->ParseMetricParameters(metricValues);
+ method->m_OptimizerParameters = method->ParseOptimizerParameters(optimizerValues);
+
+
+ // The fixed and the moving image
+ typename InternalImageType::Pointer fixedImage = InternalImageType::New();
+ typename InternalImageType::Pointer movingImage = InternalImageType::New();
+
+ mitk::CastToItkImage(method->m_ReferenceImage, fixedImage);
+
+ // Blur the moving image
+ if(method->m_BlurMovingImage)
+ {
+ typename GaussianFilterType::Pointer gaussianFilter = GaussianFilterType::New();
+ gaussianFilter->SetInput(itkImage1);
+ gaussianFilter->SetVariance(6.0);
+ gaussianFilter->SetMaximumError( 0.1 );
+ //gaussianFilter->SetMaximumKernelWidth ( 3 );
+ gaussianFilter->Update();
+ movingImage = gaussianFilter->GetOutput();
+ }
+ else
+ {
+ typename CastImageFilterType::Pointer castImageFilter = CastImageFilterType::New();
+ castImageFilter->SetInput(itkImage1);
+ castImageFilter->Update();
+ movingImage = castImageFilter->GetOutput();
+ }
+
+ if(method->m_MatchHistograms)
+ {
+ typedef itk::RescaleIntensityImageFilter<InternalImageType,InternalImageType> FilterType;
+ typedef itk::HistogramMatchingImageFilter<InternalImageType,InternalImageType> HEFilterType;
+
+ typename FilterType::Pointer inputRescaleFilter = FilterType::New();
+ typename FilterType::Pointer referenceRescaleFilter = FilterType::New();
+
+ referenceRescaleFilter->SetInput(fixedImage);
+ inputRescaleFilter->SetInput(movingImage);
+
+ const float desiredMinimum = 0.0;
+ const float desiredMaximum = 255.0;
+
+ referenceRescaleFilter->SetOutputMinimum( desiredMinimum );
+ referenceRescaleFilter->SetOutputMaximum( desiredMaximum );
+ referenceRescaleFilter->UpdateLargestPossibleRegion();
+ inputRescaleFilter->SetOutputMinimum( desiredMinimum );
+ inputRescaleFilter->SetOutputMaximum( desiredMaximum );
+ inputRescaleFilter->UpdateLargestPossibleRegion();
+
+ // Histogram match the images
+ typename HEFilterType::Pointer intensityEqualizeFilter = HEFilterType::New();
+
+ intensityEqualizeFilter->SetReferenceImage( inputRescaleFilter->GetOutput() );
+ intensityEqualizeFilter->SetInput( referenceRescaleFilter->GetOutput() );
+ intensityEqualizeFilter->SetNumberOfHistogramLevels( 64 );
+ intensityEqualizeFilter->SetNumberOfMatchPoints( 12 );
+ intensityEqualizeFilter->ThresholdAtMeanIntensityOn();
+ intensityEqualizeFilter->Update();
+
+ //fixedImage = referenceRescaleFilter->GetOutput();
+ //movingImage = IntensityEqualizeFilter->GetOutput();
+
+ fixedImage = intensityEqualizeFilter->GetOutput();
+ movingImage = inputRescaleFilter->GetOutput();
+ }
+
+ typename TransformFactoryType::Pointer transFac = TransformFactoryType::New();
+ transFac->SetTransformParameters(method->m_TransformParameters);
+ transFac->SetFixedImage(fixedImage);
+ transFac->SetMovingImage(movingImage);
+ typename TransformType::Pointer transform = transFac->GetTransform();
+
+ typename InterpolatorType::Pointer interpolator = InterpolatorType::New();
+ typename MetricFactoryType::Pointer metFac = MetricFactoryType::New();
+ metFac->SetMetricParameters(method->m_MetricParameters);
+
+ typename OptimizerFactory::Pointer optFac = OptimizerFactory::New();
+ optFac->SetOptimizerParameters(method->m_OptimizerParameters);
+ optFac->SetNumberOfTransformParameters(transform->GetNumberOfParameters());
+ typename PyramidalRegistrationMethod::OptimizerType::Pointer optimizer = optFac->GetOptimizer();
+
+ // optimizer scales
+ if (method->m_TransformParameters->GetUseOptimizerScales())
+ {
+ itk::Array<double> optimizerScales = method->m_TransformParameters->GetScales();
+ typename PyramidalRegistrationMethod::OptimizerType::ScalesType scales( transform->GetNumberOfParameters() );
+ for (unsigned int i = 0; i < scales.Size(); i++)
+ {
+ scales[i] = optimizerScales[i];
+ }
+ optimizer->SetScales( scales );
+ }
+
+ typename ImagePyramidType::Pointer fixedImagePyramid = ImagePyramidType::New();
+ typename ImagePyramidType::Pointer movingImagePyramid = ImagePyramidType::New();
+
+ if(method->m_FixedSchedule.size() > 0 && method->m_MovingSchedule.size() > 0)
+ {
+ fixedImagePyramid->SetSchedule(method->m_FixedSchedule);
+ movingImagePyramid->SetSchedule(method->m_MovingSchedule);
+ // Otherwise just use the default schedule
+ }
+
+ typename RegistrationType::Pointer registration = RegistrationType::New();
+ registration->SetOptimizer( optimizer );
+ registration->SetTransform( transform );
+ registration->SetInterpolator( interpolator );
+ registration->SetMetric( metFac->GetMetric() );
+ registration->SetFixedImagePyramid( fixedImagePyramid );
+ registration->SetMovingImagePyramid( movingImagePyramid );
+ registration->SetFixedImage( fixedImage );
+ registration->SetMovingImage( movingImage );
+ registration->SetFixedImageRegion( fixedImage->GetBufferedRegion() );
+
+ if(transFac->GetTransformParameters()->GetInitialParameters().size())
+ {
+ registration->SetInitialTransformParameters( transFac->GetTransformParameters()->GetInitialParameters() );
+ }
+ else
+ {
+ itk::Array<double> zeroInitial;
+ zeroInitial.set_size(transform->GetNumberOfParameters());
+ zeroInitial.fill(0.0);
+ zeroInitial[0] = 1.0;
+ zeroInitial[4] = 1.0;
+ zeroInitial[8] = 1.0;
+ registration->SetInitialTransformParameters( zeroInitial );
+ }
+
+ if(method->m_UseMask)
+ {
+ itk::ImageMaskSpatialObject< VImageDimension>* mask =
+ dynamic_cast< itk::ImageMaskSpatialObject< VImageDimension>* > ( method->m_BrainMask.GetPointer() );
+ registration->GetMetric()->SetFixedImageMask(mask);
+ }
+
+ // registering command observer with the optimizer
+ if (method->m_Observer.IsNotNull())
+ {
+ method->m_Observer->AddStepsToDo(20);
+ optimizer->AddObserver(itk::AnyEvent(), method->m_Observer);
+ registration->AddObserver(itk::AnyEvent(), method->m_Observer);
+ transform->AddObserver(itk::AnyEvent(), method->m_Observer);
+ }
+
+ typename CommandType::Pointer command = CommandType::New();
+ command->observer = method->m_Observer;
+ command->m_Presets = method->m_Presets;
+ command->m_UseMask = method->m_UseMask;
+ command->m_BrainMask = method->m_BrainMask;
+
+ registration->AddObserver( itk::IterationEvent(), command );
+ registration->SetSchedules(method->m_FixedSchedule, method->m_MovingSchedule);
+
+ // Start the registration process
+ try
+ {
+ registration->StartRegistration();
+ }
+ catch( itk::ExceptionObject & err )
+ {
+ std::cout << "ExceptionObject caught !" << std::endl;
+ std::cout << err << std::endl;
+ }
+ if (method->m_Observer.IsNotNull())
+ {
+ optimizer->RemoveAllObservers();
+ registration->RemoveAllObservers();
+ transform->RemoveAllObservers();
+ method->m_Observer->SetRemainingProgress(15);
+ }
+ if (method->m_Observer.IsNotNull())
+ {
+ method->m_Observer->SetRemainingProgress(5);
+ }
+
+}
+
+} // end namespace
diff --git a/Modules/RigidRegistrationUI/RigidRegistrationTransforms/QmitkAffineTransformView.cpp b/Modules/RigidRegistrationUI/RigidRegistrationTransforms/QmitkAffineTransformView.cpp
index 1a482db407..e12d9ef343 100644
--- a/Modules/RigidRegistrationUI/RigidRegistrationTransforms/QmitkAffineTransformView.cpp
+++ b/Modules/RigidRegistrationUI/RigidRegistrationTransforms/QmitkAffineTransformView.cpp
@@ -1,258 +1,259 @@
/*=========================================================================
Program: Medical Imaging & Interaction Toolkit
Language: C++
Date: $Date$
Version: $Revision: -1 $
Copyright (c) German Cancer Research Center, Division of Medical and
Biological Informatics. All rights reserved.
See MITKCopyright.txt or http://www.mitk.org/copyright.html for details.
This software is distributed WITHOUT ANY WARRANTY; without even
the implied warranty of MERCHANTABILITY or FITNESS FOR A PARTICULAR
PURPOSE. See the above copyright notices for more information.
=========================================================================*/
#include "QmitkAffineTransformView.h"
#include "mitkImageAccessByItk.h"
+#include <mitkImageCast.h>
#include <itkAffineTransform.h>
#include <itkCenteredTransformInitializer.h>
#include <QValidator>
QmitkAffineTransformView::QmitkAffineTransformView(QWidget* parent, Qt::WindowFlags f ) : QmitkRigidRegistrationTransformsGUIBase(parent, f),
m_CenterX(0), m_CenterY(0), m_CenterZ(0)
{
}
QmitkAffineTransformView::~QmitkAffineTransformView()
{
}
mitk::TransformParameters::TransformType QmitkAffineTransformView::GetTransformType()
{
return mitk::TransformParameters::AFFINETRANSFORM;
}
itk::Object::Pointer QmitkAffineTransformView::GetTransform()
{
if (m_FixedImage.IsNotNull())
{
AccessByItk(m_FixedImage, GetTransform2);
return m_TransformObject;
}
return NULL;
}
template < class TPixelType, unsigned int VImageDimension >
itk::Object::Pointer QmitkAffineTransformView::GetTransform2(itk::Image<TPixelType, VImageDimension>* /*itkImage1*/)
{
typedef typename itk::Image< TPixelType, VImageDimension > FixedImageType;
typedef typename itk::Image< TPixelType, VImageDimension > MovingImageType;
typename FixedImageType::Pointer fixedImage;
mitk::CastToItkImage(m_FixedImage, fixedImage);
typename MovingImageType::Pointer movingImage;
mitk::CastToItkImage(m_MovingImage, movingImage);
typename itk::AffineTransform< double, VImageDimension>::Pointer transformPointer = itk::AffineTransform< double, VImageDimension>::New();
transformPointer->SetIdentity();
if (m_Controls.m_CenterForInitializerAffine->isChecked())
{
typedef typename itk::AffineTransform< double, VImageDimension > AffineTransformType;
typedef typename itk::CenteredTransformInitializer<AffineTransformType, FixedImageType, MovingImageType> TransformInitializerType;
typename TransformInitializerType::Pointer transformInitializer = TransformInitializerType::New();
transformInitializer->SetFixedImage( fixedImage );
transformInitializer->SetMovingImage( movingImage );
transformInitializer->SetTransform( transformPointer );
if (m_Controls.m_MomentsAffine->isChecked())
{
transformInitializer->MomentsOn();
}
else
{
transformInitializer->GeometryOn();
}
transformInitializer->InitializeTransform();
}
m_CenterX = transformPointer->GetCenter()[0];
m_CenterY = transformPointer->GetCenter()[1];
m_CenterZ = transformPointer->GetCenter()[2];
m_TransformObject = transformPointer.GetPointer();
return transformPointer.GetPointer();
}
itk::Array<double> QmitkAffineTransformView::GetTransformParameters()
{
itk::Array<double> transformValues;
transformValues.SetSize(15);
transformValues.fill(0);
transformValues[0] = m_Controls.m_UseOptimizerScalesAffine->isChecked();
transformValues[1] = m_Controls.m_ScalesAffineTransformScale1->text().toDouble();
transformValues[2] = m_Controls.m_ScalesAffineTransformScale2->text().toDouble();
transformValues[3] = m_Controls.m_ScalesAffineTransformScale3->text().toDouble();
transformValues[4] = m_Controls.m_ScalesAffineTransformScale4->text().toDouble();
transformValues[5] = m_Controls.m_ScalesAffineTransformScale5->text().toDouble();
transformValues[6] = m_Controls.m_ScalesAffineTransformScale6->text().toDouble();
transformValues[7] = m_Controls.m_ScalesAffineTransformScale7->text().toDouble();
transformValues[8] = m_Controls.m_ScalesAffineTransformScale8->text().toDouble();
transformValues[9] = m_Controls.m_ScalesAffineTransformScale9->text().toDouble();
transformValues[10] = m_Controls.m_ScalesAffineTransformScaleTranslationX->text().toDouble();
transformValues[11] = m_Controls.m_ScalesAffineTransformScaleTranslationY->text().toDouble();
transformValues[12] = m_Controls.m_ScalesAffineTransformScaleTranslationZ->text().toDouble();
transformValues[13] = m_Controls.m_CenterForInitializerAffine->isChecked();
transformValues[14] = m_Controls.m_MomentsAffine->isChecked();
return transformValues;
}
void QmitkAffineTransformView::SetTransformParameters(itk::Array<double> transformValues)
{
m_Controls.m_UseOptimizerScalesAffine->setChecked(transformValues[0]);
m_Controls.m_ScalesAffineTransformScale1->setText(QString::number(transformValues[1]));
m_Controls.m_ScalesAffineTransformScale2->setText(QString::number(transformValues[2]));
m_Controls.m_ScalesAffineTransformScale3->setText(QString::number(transformValues[3]));
m_Controls.m_ScalesAffineTransformScale4->setText(QString::number(transformValues[4]));
m_Controls.m_ScalesAffineTransformScale5->setText(QString::number(transformValues[5]));
m_Controls.m_ScalesAffineTransformScale6->setText(QString::number(transformValues[6]));
m_Controls.m_ScalesAffineTransformScale7->setText(QString::number(transformValues[7]));
m_Controls.m_ScalesAffineTransformScale8->setText(QString::number(transformValues[8]));
m_Controls.m_ScalesAffineTransformScale9->setText(QString::number(transformValues[9]));
m_Controls.m_ScalesAffineTransformScaleTranslationX->setText(QString::number(transformValues[10]));
m_Controls.m_ScalesAffineTransformScaleTranslationY->setText(QString::number(transformValues[11]));
m_Controls.m_ScalesAffineTransformScaleTranslationZ->setText(QString::number(transformValues[12]));
m_Controls.m_CenterForInitializerAffine->setChecked(transformValues[13]);
m_Controls.m_MomentsAffine->setChecked(transformValues[14]);
m_Controls.m_GeometryAffine->setChecked(!transformValues[14]);
}
QString QmitkAffineTransformView::GetName()
{
return "Affine";
}
void QmitkAffineTransformView::SetupUI(QWidget* parent)
{
m_Controls.setupUi(parent);
QValidator* validatorLineEditInputFloat = new QDoubleValidator(0, 20000000, 8, this);
m_Controls.m_ScalesAffineTransformScale1->setValidator(validatorLineEditInputFloat);
m_Controls.m_ScalesAffineTransformScale2->setValidator(validatorLineEditInputFloat);
m_Controls.m_ScalesAffineTransformScale3->setValidator(validatorLineEditInputFloat);
m_Controls.m_ScalesAffineTransformScale4->setValidator(validatorLineEditInputFloat);
m_Controls.m_ScalesAffineTransformScale5->setValidator(validatorLineEditInputFloat);
m_Controls.m_ScalesAffineTransformScale6->setValidator(validatorLineEditInputFloat);
m_Controls.m_ScalesAffineTransformScale7->setValidator(validatorLineEditInputFloat);
m_Controls.m_ScalesAffineTransformScale8->setValidator(validatorLineEditInputFloat);
m_Controls.m_ScalesAffineTransformScale9->setValidator(validatorLineEditInputFloat);
m_Controls.m_ScalesAffineTransformScaleTranslationX->setValidator(validatorLineEditInputFloat);
m_Controls.m_ScalesAffineTransformScaleTranslationY->setValidator(validatorLineEditInputFloat);
m_Controls.m_ScalesAffineTransformScaleTranslationZ->setValidator(validatorLineEditInputFloat);
}
itk::Array<double> QmitkAffineTransformView::GetScales()
{
itk::Array<double> scales;
scales.SetSize(12);
scales.Fill(1.0);
scales[0] = m_Controls.m_ScalesAffineTransformScale1->text().toDouble();
scales[1] = m_Controls.m_ScalesAffineTransformScale2->text().toDouble();
scales[2] = m_Controls.m_ScalesAffineTransformScale3->text().toDouble();
scales[3] = m_Controls.m_ScalesAffineTransformScale4->text().toDouble();
scales[4] = m_Controls.m_ScalesAffineTransformScale5->text().toDouble();
scales[5] = m_Controls.m_ScalesAffineTransformScale6->text().toDouble();
scales[6] = m_Controls.m_ScalesAffineTransformScale7->text().toDouble();
scales[7] = m_Controls.m_ScalesAffineTransformScale8->text().toDouble();
scales[8] = m_Controls.m_ScalesAffineTransformScale9->text().toDouble();
scales[9] = m_Controls.m_ScalesAffineTransformScaleTranslationX->text().toDouble();
scales[10] = m_Controls.m_ScalesAffineTransformScaleTranslationY->text().toDouble();
scales[11] = m_Controls.m_ScalesAffineTransformScaleTranslationZ->text().toDouble();
return scales;
}
vtkTransform* QmitkAffineTransformView::Transform(vtkMatrix4x4* vtkmatrix, vtkTransform* vtktransform, itk::Array<double> transformParams)
{
if (m_MovingImage.IsNotNull())
{
// - the 9 rotation-coefficients are copied
// directly to the top left part of the matrix
int m = 0;
for (unsigned int i = 0; i < m_FixedImage->GetDimension(); i++)
{
for (unsigned int j = 0; j < m_FixedImage->GetDimension(); j++)
{
vtkmatrix->SetElement(i, j, transformParams[m]);
m++;
}
}
// - the 3 translation-coefficients are corrected to take
// into account the center of the transformation
float center[4];
center[0] = m_CenterX;
center[1] = m_CenterY;
center[2] = m_CenterZ;
center[3] = 1;
std::cout<< "rotation center: " << center[0] << " " << center[1] << " " << center [2] << std::endl;
float translation[4];
vtkmatrix->MultiplyPoint(center, translation);
if (m_FixedImage->GetDimension() == 2)
{
vtkmatrix->SetElement(0, 3, -translation[0] + center[0] + transformParams[4]);
vtkmatrix->SetElement(1, 3, -translation[1] + center[1] + transformParams[5]);
}
else if (m_FixedImage->GetDimension() == 3)
{
vtkmatrix->SetElement(0, 3, -translation[0] + center[0] + transformParams[9]);
vtkmatrix->SetElement(1, 3, -translation[1] + center[1] + transformParams[10]);
vtkmatrix->SetElement(2, 3, -translation[2] + center[2] + transformParams[11]);
}
// set the transform matrix to init the transform
vtktransform->SetMatrix(vtkmatrix);
}
return vtktransform;
}
int QmitkAffineTransformView::GetNumberOfTransformParameters()
{
if (m_FixedImage.IsNotNull())
{
if (m_FixedImage->GetDimension() == 2)
{
m_Controls.m_ScalesAffineTransformScale7->hide();
m_Controls.m_ScalesAffineTransformScale8->hide();
m_Controls.m_ScalesAffineTransformScale9->hide();
m_Controls.m_ScalesAffineTransformScaleTranslationX->hide();
m_Controls.m_ScalesAffineTransformScaleTranslationY->hide();
m_Controls.m_ScalesAffineTransformScaleTranslationZ->hide();
m_Controls.textLabel2_7->setText("Translation Scale X:");
m_Controls.textLabel3_6->setText("Translation Scale Y:");
m_Controls.textLabel4_4->hide();
m_Controls.textLabel5_4->hide();
m_Controls.textLabel6_4->hide();
m_Controls.textLabel11_3->hide();
m_Controls.textLabel12_3->hide();
m_Controls.textLabel13_2->hide();
return 6;
}
else
{
m_Controls.m_ScalesAffineTransformScale7->show();
m_Controls.m_ScalesAffineTransformScale8->show();
m_Controls.m_ScalesAffineTransformScale9->show();
m_Controls.m_ScalesAffineTransformScaleTranslationX->show();
m_Controls.m_ScalesAffineTransformScaleTranslationY->show();
m_Controls.m_ScalesAffineTransformScaleTranslationZ->show();
m_Controls.textLabel2_7->setText("Scale 5:");
m_Controls.textLabel3_6->setText("Scale 6:");
m_Controls.textLabel4_4->show();
m_Controls.textLabel5_4->show();
m_Controls.textLabel6_4->show();
m_Controls.textLabel11_3->show();
m_Controls.textLabel12_3->show();
m_Controls.textLabel13_2->show();
return 12;
}
}
else
return 0;
}
diff --git a/Modules/RigidRegistrationUI/RigidRegistrationTransforms/QmitkCenteredRigid2DTransformView.cpp b/Modules/RigidRegistrationUI/RigidRegistrationTransforms/QmitkCenteredRigid2DTransformView.cpp
index 97d6a1e2e0..df287b188f 100644
--- a/Modules/RigidRegistrationUI/RigidRegistrationTransforms/QmitkCenteredRigid2DTransformView.cpp
+++ b/Modules/RigidRegistrationUI/RigidRegistrationTransforms/QmitkCenteredRigid2DTransformView.cpp
@@ -1,178 +1,179 @@
/*=========================================================================
Program: Medical Imaging & Interaction Toolkit
Language: C++
Date: $Date$
Version: $Revision: -1 $
Copyright (c) German Cancer Research Center, Division of Medical and
Biological Informatics. All rights reserved.
See MITKCopyright.txt or http://www.mitk.org/copyright.html for details.
This software is distributed WITHOUT ANY WARRANTY; without even
the implied warranty of MERCHANTABILITY or FITNESS FOR A PARTICULAR
PURPOSE. See the above copyright notices for more information.
=========================================================================*/
#include "QmitkCenteredRigid2DTransformView.h"
#include "mitkImageAccessByItk.h"
+#include <mitkImageCast.h>
#include <itkCenteredRigid2DTransform.h>
#include <itkCenteredTransformInitializer.h>
#include <QValidator>
QmitkCenteredRigid2DTransformView::QmitkCenteredRigid2DTransformView(QWidget* parent, Qt::WindowFlags f ) : QmitkRigidRegistrationTransformsGUIBase(parent, f),
m_CenterX(0), m_CenterY(0), m_CenterZ(0)
{
}
QmitkCenteredRigid2DTransformView::~QmitkCenteredRigid2DTransformView()
{
}
mitk::TransformParameters::TransformType QmitkCenteredRigid2DTransformView::GetTransformType()
{
return mitk::TransformParameters::CENTEREDRIGID2DTRANSFORM;
}
itk::Object::Pointer QmitkCenteredRigid2DTransformView::GetTransform()
{
if (m_FixedImage.IsNotNull())
{
AccessByItk(m_FixedImage, GetTransform2);
return m_TransformObject;
}
return NULL;
}
template < class TPixelType, unsigned int VImageDimension >
itk::Object::Pointer QmitkCenteredRigid2DTransformView::GetTransform2(itk::Image<TPixelType, VImageDimension>* /* itkImage1 */)
{
if (VImageDimension == 2)
{
typedef typename itk::Image< TPixelType, 2 > FixedImage2DType;
typedef typename itk::Image< TPixelType, 2 > MovingImage2DType;
typename FixedImage2DType::Pointer fixedImage2D;
mitk::CastToItkImage(m_FixedImage, fixedImage2D);
typename MovingImage2DType::Pointer movingImage2D;
mitk::CastToItkImage(m_MovingImage, movingImage2D);
typename itk::CenteredRigid2DTransform< double >::Pointer transformPointer = itk::CenteredRigid2DTransform< double >::New();
transformPointer->SetIdentity();
if (m_Controls.m_CenterForInitializerCenteredRigid2D->isChecked())
{
typedef typename itk::CenteredRigid2DTransform< double > CenteredRigid2DTransformType;
typedef typename itk::CenteredTransformInitializer<CenteredRigid2DTransformType, FixedImage2DType, MovingImage2DType> TransformInitializerType;
typename TransformInitializerType::Pointer transformInitializer = TransformInitializerType::New();
transformInitializer->SetFixedImage( fixedImage2D );
transformInitializer->SetMovingImage( movingImage2D );
transformInitializer->SetTransform( transformPointer );
if (m_Controls.m_MomentsCenteredRigid2D->isChecked())
{
transformInitializer->MomentsOn();
}
else
{
transformInitializer->GeometryOn();
}
transformInitializer->InitializeTransform();
}
transformPointer->SetAngle( m_Controls.m_AngleCenteredRigid2D->text().toFloat() );
m_CenterX = transformPointer->GetCenter()[0];
m_CenterY = transformPointer->GetCenter()[1];
m_TransformObject = transformPointer.GetPointer();
return transformPointer.GetPointer();
}
return NULL;
}
itk::Array<double> QmitkCenteredRigid2DTransformView::GetTransformParameters()
{
itk::Array<double> transformValues;
transformValues.SetSize(9);
transformValues.fill(0);
transformValues[0] = m_Controls.m_UseOptimizerScalesCenteredRigid2D->isChecked();
transformValues[1] = m_Controls.m_RotationScaleCenteredRigid2D->text().toDouble();
transformValues[2] = m_Controls.m_CenterXScaleCenteredRigid2D->text().toDouble();
transformValues[3] = m_Controls.m_CenterYScaleCenteredRigid2D->text().toDouble();
transformValues[4] = m_Controls.m_TranslationXScaleCenteredRigid2D->text().toDouble();
transformValues[5] = m_Controls.m_TranslationYScaleCenteredRigid2D->text().toDouble();
transformValues[6] = m_Controls.m_AngleCenteredRigid2D->text().toFloat();
transformValues[7] = m_Controls.m_CenterForInitializerCenteredRigid2D->isChecked();
transformValues[8] = m_Controls.m_MomentsCenteredRigid2D->isChecked();
return transformValues;
}
void QmitkCenteredRigid2DTransformView::SetTransformParameters(itk::Array<double> transformValues)
{
m_Controls.m_UseOptimizerScalesCenteredRigid2D->setChecked(transformValues[0]);
m_Controls.m_RotationScaleCenteredRigid2D->setText(QString::number(transformValues[1]));
m_Controls.m_CenterXScaleCenteredRigid2D->setText(QString::number(transformValues[2]));
m_Controls.m_CenterYScaleCenteredRigid2D->setText(QString::number(transformValues[3]));
m_Controls.m_TranslationXScaleCenteredRigid2D->setText(QString::number(transformValues[4]));
m_Controls.m_TranslationYScaleCenteredRigid2D->setText(QString::number(transformValues[5]));
m_Controls.m_AngleCenteredRigid2D->setText(QString::number(transformValues[6]));
m_Controls.m_CenterForInitializerCenteredRigid2D->setChecked(transformValues[7]);
m_Controls.m_MomentsCenteredRigid2D->setChecked(transformValues[8]);
m_Controls.m_GeometryCenteredRigid2D->setChecked(!transformValues[8]);
}
QString QmitkCenteredRigid2DTransformView::GetName()
{
return "CenteredRigid2D";
}
void QmitkCenteredRigid2DTransformView::SetupUI(QWidget* parent)
{
m_Controls.setupUi(parent);
QValidator* validatorLineEditInputFloat = new QDoubleValidator(0, 20000000, 8, this);
m_Controls.m_AngleCenteredRigid2D->setValidator(validatorLineEditInputFloat);
m_Controls.m_RotationScaleCenteredRigid2D->setValidator(validatorLineEditInputFloat);
m_Controls.m_CenterXScaleCenteredRigid2D->setValidator(validatorLineEditInputFloat);
m_Controls.m_CenterYScaleCenteredRigid2D->setValidator(validatorLineEditInputFloat);
m_Controls.m_TranslationXScaleCenteredRigid2D->setValidator(validatorLineEditInputFloat);
m_Controls.m_TranslationYScaleCenteredRigid2D->setValidator(validatorLineEditInputFloat);
}
itk::Array<double> QmitkCenteredRigid2DTransformView::GetScales()
{
itk::Array<double> scales;
scales.SetSize(5);
scales.Fill(1.0);
if (m_Controls.m_UseOptimizerScalesCenteredRigid2D->isChecked())
{
scales[0] = m_Controls.m_RotationScaleCenteredRigid2D->text().toDouble();
scales[1] = m_Controls.m_CenterXScaleCenteredRigid2D->text().toDouble();
scales[2] = m_Controls.m_CenterYScaleCenteredRigid2D->text().toDouble();
scales[3] = m_Controls.m_TranslationXScaleCenteredRigid2D->text().toDouble();
scales[4] = m_Controls.m_TranslationYScaleCenteredRigid2D->text().toDouble();
}
return scales;
}
vtkTransform* QmitkCenteredRigid2DTransformView::Transform(vtkMatrix4x4* /* vtkmatrix */, vtkTransform* vtktransform, itk::Array<double> transformParams)
{
if (m_MovingImage.IsNotNull())
{
mitk::ScalarType angle = transformParams[0] * 45.0 / atan(1.0);;
vtktransform->PostMultiply();
vtktransform->Translate(-transformParams[1], -transformParams[2], 0);
vtktransform->RotateZ(angle);
vtktransform->Translate(transformParams[1], transformParams[2], 0);
vtktransform->Translate(transformParams[3], transformParams[4], 0);
vtktransform->PreMultiply();
}
return vtktransform;
}
int QmitkCenteredRigid2DTransformView::GetNumberOfTransformParameters()
{
if (m_FixedImage.IsNotNull())
{
if (m_FixedImage->GetDimension() == 2)
return 5;
else
return 0;
}
else
return 0;
}
diff --git a/Modules/RigidRegistrationUI/RigidRegistrationTransforms/QmitkCenteredSimilarity2DTransformView.cpp b/Modules/RigidRegistrationUI/RigidRegistrationTransforms/QmitkCenteredSimilarity2DTransformView.cpp
index a4e979504e..04a5726d18 100644
--- a/Modules/RigidRegistrationUI/RigidRegistrationTransforms/QmitkCenteredSimilarity2DTransformView.cpp
+++ b/Modules/RigidRegistrationUI/RigidRegistrationTransforms/QmitkCenteredSimilarity2DTransformView.cpp
@@ -1,186 +1,187 @@
/*=========================================================================
Program: Medical Imaging & Interaction Toolkit
Language: C++
Date: $Date$
Version: $Revision: -1 $
Copyright (c) German Cancer Research Center, Division of Medical and
Biological Informatics. All rights reserved.
See MITKCopyright.txt or http://www.mitk.org/copyright.html for details.
This software is distributed WITHOUT ANY WARRANTY; without even
the implied warranty of MERCHANTABILITY or FITNESS FOR A PARTICULAR
PURPOSE. See the above copyright notices for more information.
=========================================================================*/
#include "QmitkCenteredSimilarity2DTransformView.h"
#include "mitkImageAccessByItk.h"
+#include <mitkImageCast.h>
#include <itkCenteredSimilarity2DTransform.h>
#include <itkCenteredTransformInitializer.h>
#include <QValidator>
QmitkCenteredSimilarity2DTransformView::QmitkCenteredSimilarity2DTransformView(QWidget* parent, Qt::WindowFlags f ) : QmitkRigidRegistrationTransformsGUIBase(parent, f),
m_CenterX(0), m_CenterY(0), m_CenterZ(0)
{
}
QmitkCenteredSimilarity2DTransformView::~QmitkCenteredSimilarity2DTransformView()
{
}
mitk::TransformParameters::TransformType QmitkCenteredSimilarity2DTransformView::GetTransformType()
{
return mitk::TransformParameters::CENTEREDSIMILARITY2DTRANSFORM;
}
itk::Object::Pointer QmitkCenteredSimilarity2DTransformView::GetTransform()
{
if (m_FixedImage.IsNotNull())
{
AccessByItk(m_FixedImage, GetTransform2);
return m_TransformObject;
}
return NULL;
}
template < class TPixelType, unsigned int VImageDimension >
itk::Object::Pointer QmitkCenteredSimilarity2DTransformView::GetTransform2(itk::Image<TPixelType, VImageDimension>* /* itkImage1 */)
{
if (VImageDimension == 2)
{
typedef typename itk::Image< TPixelType, 2 > FixedImage2DType;
typedef typename itk::Image< TPixelType, 2 > MovingImage2DType;
typename FixedImage2DType::Pointer fixedImage2D;
mitk::CastToItkImage(m_FixedImage, fixedImage2D);
typename MovingImage2DType::Pointer movingImage2D;
mitk::CastToItkImage(m_MovingImage, movingImage2D);
typename itk::CenteredSimilarity2DTransform< double >::Pointer transformPointer = itk::CenteredSimilarity2DTransform< double >::New();
transformPointer->SetIdentity();
if (m_Controls.m_CenterForInitializerCenteredSimilarity2D->isChecked())
{
typedef typename itk::CenteredSimilarity2DTransform< double > CenteredSimilarity2DTransformType;
typedef typename itk::CenteredTransformInitializer<CenteredSimilarity2DTransformType, FixedImage2DType, MovingImage2DType> TransformInitializerType;
typename TransformInitializerType::Pointer transformInitializer = TransformInitializerType::New();
transformInitializer->SetFixedImage( fixedImage2D );
transformInitializer->SetMovingImage( movingImage2D );
transformInitializer->SetTransform( transformPointer );
if (m_Controls.m_MomentsCenteredSimilarity2D->isChecked())
{
transformInitializer->MomentsOn();
}
else
{
transformInitializer->GeometryOn();
}
transformInitializer->InitializeTransform();
}
transformPointer->SetScale( m_Controls.m_InitialScaleCenteredSimilarity2D->text().toFloat() );
transformPointer->SetAngle( m_Controls.m_AngleCenteredSimilarity2D->text().toFloat() );
m_CenterX = transformPointer->GetCenter()[0];
m_CenterY = transformPointer->GetCenter()[1];
m_TransformObject = transformPointer.GetPointer();
return transformPointer.GetPointer();
}
return NULL;
}
itk::Array<double> QmitkCenteredSimilarity2DTransformView::GetTransformParameters()
{
itk::Array<double> transformValues;
transformValues.SetSize(11);
transformValues.fill(0);
transformValues[0] = m_Controls.m_UseOptimizerScalesCenteredSimilarity2D->isChecked();
transformValues[1] = m_Controls.m_ScalesCenteredSimilarity2DTransformScale1->text().toDouble();
transformValues[2] = m_Controls.m_ScalesCenteredSimilarity2DTransformScale2->text().toDouble();
transformValues[3] = m_Controls.m_ScalesCenteredSimilarity2DTransformScale3->text().toDouble();
transformValues[4] = m_Controls.m_ScalesCenteredSimilarity2DTransformScale4->text().toDouble();
transformValues[5] = m_Controls.m_ScalesCenteredSimilarity2DTransformScaleTranslationX->text().toDouble();
transformValues[6] = m_Controls.m_ScalesCenteredSimilarity2DTransformScaleTranslationY->text().toDouble();
transformValues[7] = m_Controls.m_InitialScaleCenteredSimilarity2D->text().toFloat();
transformValues[8] = m_Controls.m_AngleCenteredSimilarity2D->text().toFloat();
transformValues[9] = m_Controls.m_CenterForInitializerCenteredSimilarity2D->isChecked();
transformValues[10] = m_Controls.m_MomentsCenteredSimilarity2D->isChecked();
return transformValues;
}
void QmitkCenteredSimilarity2DTransformView::SetTransformParameters(itk::Array<double> transformValues)
{
m_Controls.m_UseOptimizerScalesCenteredSimilarity2D->setChecked(transformValues[0]);
m_Controls.m_ScalesCenteredSimilarity2DTransformScale1->setText(QString::number(transformValues[1]));
m_Controls.m_ScalesCenteredSimilarity2DTransformScale2->setText(QString::number(transformValues[2]));
m_Controls.m_ScalesCenteredSimilarity2DTransformScale3->setText(QString::number(transformValues[3]));
m_Controls.m_ScalesCenteredSimilarity2DTransformScale4->setText(QString::number(transformValues[4]));
m_Controls.m_ScalesCenteredSimilarity2DTransformScaleTranslationX->setText(QString::number(transformValues[5]));
m_Controls.m_ScalesCenteredSimilarity2DTransformScaleTranslationY->setText(QString::number(transformValues[6]));
m_Controls.m_InitialScaleCenteredSimilarity2D->setText(QString::number(transformValues[7]));
m_Controls.m_AngleCenteredSimilarity2D->setText(QString::number(transformValues[8]));
m_Controls.m_CenterForInitializerCenteredSimilarity2D->setChecked(transformValues[9]);
m_Controls.m_MomentsCenteredSimilarity2D->setChecked(transformValues[10]);
m_Controls.m_GeometryCenteredSimilarity2D->setChecked(!transformValues[10]);
}
QString QmitkCenteredSimilarity2DTransformView::GetName()
{
return "CenteredSimilarity2D";
}
void QmitkCenteredSimilarity2DTransformView::SetupUI(QWidget* parent)
{
m_Controls.setupUi(parent);
QValidator* validatorLineEditInputFloat = new QDoubleValidator(0, 20000000, 8, this);
m_Controls.m_ScalesCenteredSimilarity2DTransformScale1->setValidator(validatorLineEditInputFloat);
m_Controls.m_ScalesCenteredSimilarity2DTransformScale2->setValidator(validatorLineEditInputFloat);
m_Controls.m_ScalesCenteredSimilarity2DTransformScale3->setValidator(validatorLineEditInputFloat);
m_Controls.m_ScalesCenteredSimilarity2DTransformScale4->setValidator(validatorLineEditInputFloat);
m_Controls.m_ScalesCenteredSimilarity2DTransformScaleTranslationX->setValidator(validatorLineEditInputFloat);
m_Controls.m_ScalesCenteredSimilarity2DTransformScaleTranslationY->setValidator(validatorLineEditInputFloat);
}
itk::Array<double> QmitkCenteredSimilarity2DTransformView::GetScales()
{
itk::Array<double> scales;
scales.SetSize(6);
scales.Fill(1.0);
if (m_Controls.m_UseOptimizerScalesCenteredSimilarity2D->isChecked())
{
scales[0] = m_Controls.m_ScalesCenteredSimilarity2DTransformScale1->text().toDouble();
scales[1] = m_Controls.m_ScalesCenteredSimilarity2DTransformScale2->text().toDouble();
scales[2] = m_Controls.m_ScalesCenteredSimilarity2DTransformScale3->text().toDouble();
scales[3] = m_Controls.m_ScalesCenteredSimilarity2DTransformScale4->text().toDouble();
scales[4] = m_Controls.m_ScalesCenteredSimilarity2DTransformScaleTranslationX->text().toDouble();
scales[5] = m_Controls.m_ScalesCenteredSimilarity2DTransformScaleTranslationY->text().toDouble();
}
return scales;
}
vtkTransform* QmitkCenteredSimilarity2DTransformView::Transform(vtkMatrix4x4* /*vtkmatrix*/, vtkTransform* vtktransform, itk::Array<double> transformParams)
{
if (m_MovingImage.IsNotNull())
{
mitk::ScalarType angle = transformParams[1] * 45.0 / atan(1.0);
vtktransform->PostMultiply();
vtktransform->Translate(-transformParams[2], -transformParams[3], 0);
vtktransform->Scale(transformParams[0], transformParams[0], 1);
vtktransform->RotateZ(angle);
vtktransform->Translate(transformParams[2], transformParams[3], 0);
vtktransform->Translate(transformParams[4], transformParams[5], 0);
vtktransform->PreMultiply();
}
return vtktransform;
}
int QmitkCenteredSimilarity2DTransformView::GetNumberOfTransformParameters()
{
if (m_FixedImage.IsNotNull())
{
if (m_FixedImage->GetDimension() == 2)
return 6;
else
return 0;
}
else
return 0;
}
diff --git a/Modules/RigidRegistrationUI/RigidRegistrationTransforms/QmitkEuler2DTransformView.cpp b/Modules/RigidRegistrationUI/RigidRegistrationTransforms/QmitkEuler2DTransformView.cpp
index 9a5a820e13..2567d428f0 100644
--- a/Modules/RigidRegistrationUI/RigidRegistrationTransforms/QmitkEuler2DTransformView.cpp
+++ b/Modules/RigidRegistrationUI/RigidRegistrationTransforms/QmitkEuler2DTransformView.cpp
@@ -1,162 +1,163 @@
/*=========================================================================
Program: Medical Imaging & Interaction Toolkit
Language: C++
Date: $Date$
Version: $Revision: -1 $
Copyright (c) German Cancer Research Center, Division of Medical and
Biological Informatics. All rights reserved.
See MITKCopyright.txt or http://www.mitk.org/copyright.html for details.
This software is distributed WITHOUT ANY WARRANTY; without even
the implied warranty of MERCHANTABILITY or FITNESS FOR A PARTICULAR
PURPOSE. See the above copyright notices for more information.
=========================================================================*/
#include "QmitkEuler2DTransformView.h"
#include "mitkImageAccessByItk.h"
+#include <mitkImageCast.h>
#include <itkEuler2DTransform.h>
#include <itkCenteredTransformInitializer.h>
#include <QValidator>
QmitkEuler2DTransformView::QmitkEuler2DTransformView(QWidget* parent, Qt::WindowFlags f ) : QmitkRigidRegistrationTransformsGUIBase(parent, f),
m_CenterX(0), m_CenterY(0), m_CenterZ(0)
{
}
QmitkEuler2DTransformView::~QmitkEuler2DTransformView()
{
}
mitk::TransformParameters::TransformType QmitkEuler2DTransformView::GetTransformType()
{
return mitk::TransformParameters::EULER2DTRANSFORM;
}
itk::Object::Pointer QmitkEuler2DTransformView::GetTransform()
{
if (m_FixedImage.IsNotNull())
{
AccessByItk(m_FixedImage, GetTransform2);
return m_TransformObject;
}
return NULL;
}
template < class TPixelType, unsigned int VImageDimension >
itk::Object::Pointer QmitkEuler2DTransformView::GetTransform2(itk::Image<TPixelType, VImageDimension>* /* itkImage1 */)
{
if (VImageDimension == 2)
{
typedef typename itk::Image< TPixelType, 2 > FixedImage2DType;
typedef typename itk::Image< TPixelType, 2 > MovingImage2DType;
typename FixedImage2DType::Pointer fixedImage2D;
mitk::CastToItkImage(m_FixedImage, fixedImage2D);
typename MovingImage2DType::Pointer movingImage2D;
mitk::CastToItkImage(m_MovingImage, movingImage2D);
typename itk::Euler2DTransform< double >::Pointer transformPointer = itk::Euler2DTransform< double >::New();
transformPointer->SetIdentity();
if (m_Controls.m_CenterForInitializerEuler2D->isChecked())
{
typedef typename itk::Euler2DTransform< double > Euler2DTransformType;
typedef typename itk::CenteredTransformInitializer<Euler2DTransformType, FixedImage2DType, MovingImage2DType> TransformInitializerType;
typename TransformInitializerType::Pointer transformInitializer = TransformInitializerType::New();
transformInitializer->SetFixedImage( fixedImage2D );
transformInitializer->SetMovingImage( movingImage2D );
transformInitializer->SetTransform( transformPointer );
if (m_Controls.m_MomentsEuler2D->isChecked())
{
transformInitializer->MomentsOn();
}
else
{
transformInitializer->GeometryOn();
}
transformInitializer->InitializeTransform();
}
m_TransformObject = transformPointer.GetPointer();
return transformPointer.GetPointer();
}
return NULL;
}
itk::Array<double> QmitkEuler2DTransformView::GetTransformParameters()
{
itk::Array<double> transformValues;
transformValues.SetSize(6);
transformValues.fill(0);
transformValues[0] = m_Controls.m_UseOptimizerScalesEuler2D->isChecked();
transformValues[1] = m_Controls.m_RotationScaleEuler2D->text().toDouble();
transformValues[2] = m_Controls.m_TranslationXScaleEuler2D->text().toDouble();
transformValues[3] = m_Controls.m_TranslationYScaleEuler2D->text().toDouble();
transformValues[4] = m_Controls.m_CenterForInitializerEuler2D->isChecked();
transformValues[5] = m_Controls.m_MomentsEuler2D->isChecked();
return transformValues;
}
void QmitkEuler2DTransformView::SetTransformParameters(itk::Array<double> transformValues)
{
m_Controls.m_UseOptimizerScalesEuler2D->setChecked(transformValues[0]);
m_Controls.m_RotationScaleEuler2D->setText(QString::number(transformValues[1]));
m_Controls.m_TranslationXScaleEuler2D->setText(QString::number(transformValues[2]));
m_Controls.m_TranslationYScaleEuler2D->setText(QString::number(transformValues[3]));
m_Controls.m_CenterForInitializerEuler2D->setChecked(transformValues[4]);
m_Controls.m_MomentsEuler2D->setChecked(transformValues[5]);
m_Controls.m_GeometryEuler2D->setChecked(!transformValues[5]);
}
QString QmitkEuler2DTransformView::GetName()
{
return "Euler2D";
}
void QmitkEuler2DTransformView::SetupUI(QWidget* parent)
{
m_Controls.setupUi(parent);
QValidator* validatorLineEditInputFloat = new QDoubleValidator(0, 20000000, 8, this);
m_Controls.m_RotationScaleEuler2D->setValidator(validatorLineEditInputFloat);
m_Controls.m_TranslationXScaleEuler2D->setValidator(validatorLineEditInputFloat);
m_Controls.m_TranslationYScaleEuler2D->setValidator(validatorLineEditInputFloat);
}
itk::Array<double> QmitkEuler2DTransformView::GetScales()
{
itk::Array<double> scales;
scales.SetSize(3);
scales.Fill(1.0);
if (m_Controls.m_UseOptimizerScalesEuler2D->isChecked())
{
scales[0] = m_Controls.m_RotationScaleEuler2D->text().toDouble();
scales[1] = m_Controls.m_TranslationXScaleEuler2D->text().toDouble();
scales[2] = m_Controls.m_TranslationYScaleEuler2D->text().toDouble();
}
return scales;
}
vtkTransform* QmitkEuler2DTransformView::Transform(vtkMatrix4x4* /*vtkmatrix*/, vtkTransform* vtktransform, itk::Array<double> transformParams)
{
if (m_MovingImage.IsNotNull())
{
mitk::ScalarType angle = transformParams[0] * 45.0 / atan(1.0);
vtktransform->PostMultiply();
vtktransform->RotateZ(angle);
vtktransform->Translate(transformParams[1], transformParams[2], 0);
vtktransform->PreMultiply();
}
return vtktransform;
}
int QmitkEuler2DTransformView::GetNumberOfTransformParameters()
{
if (m_FixedImage.IsNotNull())
{
if (m_FixedImage->GetDimension() == 2)
return 3;
else
return 0;
}
else
return 0;
}
diff --git a/Modules/RigidRegistrationUI/RigidRegistrationTransforms/QmitkFixedCenterOfRotationAffineTransformView.cpp b/Modules/RigidRegistrationUI/RigidRegistrationTransforms/QmitkFixedCenterOfRotationAffineTransformView.cpp
index 2104c292e4..4fb3812c22 100644
--- a/Modules/RigidRegistrationUI/RigidRegistrationTransforms/QmitkFixedCenterOfRotationAffineTransformView.cpp
+++ b/Modules/RigidRegistrationUI/RigidRegistrationTransforms/QmitkFixedCenterOfRotationAffineTransformView.cpp
@@ -1,253 +1,254 @@
/*=========================================================================
Program: Medical Imaging & Interaction Toolkit
Language: C++
Date: $Date$
Version: $Revision: -1 $
Copyright (c) German Cancer Research Center, Division of Medical and
Biological Informatics. All rights reserved.
See MITKCopyright.txt or http://www.mitk.org/copyright.html for details.
This software is distributed WITHOUT ANY WARRANTY; without even
the implied warranty of MERCHANTABILITY or FITNESS FOR A PARTICULAR
PURPOSE. See the above copyright notices for more information.
=========================================================================*/
#include "QmitkFixedCenterOfRotationAffineTransformView.h"
#include "mitkImageAccessByItk.h"
+#include <mitkImageCast.h>
#include <itkFixedCenterOfRotationAffineTransform.h>
#include <itkCenteredTransformInitializer.h>
#include <QValidator>
QmitkFixedCenterOfRotationAffineTransformView::QmitkFixedCenterOfRotationAffineTransformView(QWidget* parent, Qt::WindowFlags f ) : QmitkRigidRegistrationTransformsGUIBase(parent, f),
m_CenterX(0), m_CenterY(0), m_CenterZ(0)
{
}
QmitkFixedCenterOfRotationAffineTransformView::~QmitkFixedCenterOfRotationAffineTransformView()
{
}
mitk::TransformParameters::TransformType QmitkFixedCenterOfRotationAffineTransformView::GetTransformType()
{
return mitk::TransformParameters::FIXEDCENTEROFROTATIONAFFINETRANSFORM;
}
itk::Object::Pointer QmitkFixedCenterOfRotationAffineTransformView::GetTransform()
{
if (m_FixedImage.IsNotNull())
{
AccessByItk(m_FixedImage, GetTransform2);
return m_TransformObject;
}
return NULL;
}
template < class TPixelType, unsigned int VImageDimension >
itk::Object::Pointer QmitkFixedCenterOfRotationAffineTransformView::GetTransform2(itk::Image<TPixelType, VImageDimension>* /*itkImage1*/)
{
typedef typename itk::Image< TPixelType, VImageDimension > FixedImageType;
typedef typename itk::Image< TPixelType, VImageDimension > MovingImageType;
typename FixedImageType::Pointer fixedImage;
mitk::CastToItkImage(m_FixedImage, fixedImage);
typename MovingImageType::Pointer movingImage;
mitk::CastToItkImage(m_MovingImage, movingImage);
typedef typename itk::FixedCenterOfRotationAffineTransform< double, VImageDimension > CenteredAffineTransformType;
typename itk::FixedCenterOfRotationAffineTransform< double, VImageDimension>::Pointer transformPointer = itk::FixedCenterOfRotationAffineTransform< double, VImageDimension>::New();
transformPointer->SetIdentity();
if (m_Controls.m_CenterForInitializerFixedCenterOfRotationAffine->isChecked())
{
typedef typename itk::FixedCenterOfRotationAffineTransform< double, VImageDimension > FixedCenterOfRotationAffineTransformType;
typedef typename itk::CenteredTransformInitializer<FixedCenterOfRotationAffineTransformType, FixedImageType, MovingImageType> TransformInitializerType;
typename TransformInitializerType::Pointer transformInitializer = TransformInitializerType::New();
transformInitializer->SetFixedImage( fixedImage );
transformInitializer->SetMovingImage( movingImage );
transformInitializer->SetTransform( transformPointer );
if (m_Controls.m_MomentsFixedCenterOfRotationAffine->isChecked())
{
transformInitializer->MomentsOn();
}
else
{
transformInitializer->GeometryOn();
}
m_CenterX = transformPointer->GetCenter()[0];
m_CenterY = transformPointer->GetCenter()[1];
m_CenterZ = transformPointer->GetCenter()[2];
transformInitializer->InitializeTransform();
}
m_TransformObject = transformPointer.GetPointer();
return transformPointer.GetPointer();
}
itk::Array<double> QmitkFixedCenterOfRotationAffineTransformView::GetTransformParameters()
{
itk::Array<double> transformValues;
transformValues.SetSize(15);
transformValues.fill(0);
transformValues[0] = m_Controls.m_UseOptimizerScalesFixedCenterOfRotationAffine->isChecked();
transformValues[1] = m_Controls.m_ScalesFixedCenterOfRotationAffineTransformScale1->text().toDouble();
transformValues[2] = m_Controls.m_ScalesFixedCenterOfRotationAffineTransformScale2->text().toDouble();
transformValues[3] = m_Controls.m_ScalesFixedCenterOfRotationAffineTransformScale3->text().toDouble();
transformValues[4] = m_Controls.m_ScalesFixedCenterOfRotationAffineTransformScale4->text().toDouble();
transformValues[5] = m_Controls.m_ScalesFixedCenterOfRotationAffineTransformScale5->text().toDouble();
transformValues[6] = m_Controls.m_ScalesFixedCenterOfRotationAffineTransformScale6->text().toDouble();
transformValues[7] = m_Controls.m_ScalesFixedCenterOfRotationAffineTransformScale7->text().toDouble();
transformValues[8] = m_Controls.m_ScalesFixedCenterOfRotationAffineTransformScale8->text().toDouble();
transformValues[9] = m_Controls.m_ScalesFixedCenterOfRotationAffineTransformScale9->text().toDouble();
transformValues[10] = m_Controls.m_ScalesFixedCenterOfRotationAffineTransformScaleTranslationX->text().toDouble();
transformValues[11] = m_Controls.m_ScalesFixedCenterOfRotationAffineTransformScaleTranslationY->text().toDouble();
transformValues[12] = m_Controls.m_ScalesFixedCenterOfRotationAffineTransformScaleTranslationZ->text().toDouble();
transformValues[13] = m_Controls.m_CenterForInitializerFixedCenterOfRotationAffine->isChecked();
transformValues[14] = m_Controls.m_MomentsFixedCenterOfRotationAffine->isChecked();
return transformValues;
}
void QmitkFixedCenterOfRotationAffineTransformView::SetTransformParameters(itk::Array<double> transformValues)
{
m_Controls.m_UseOptimizerScalesFixedCenterOfRotationAffine->setChecked(transformValues[0]);
m_Controls.m_ScalesFixedCenterOfRotationAffineTransformScale1->setText(QString::number(transformValues[1]));
m_Controls.m_ScalesFixedCenterOfRotationAffineTransformScale2->setText(QString::number(transformValues[2]));
m_Controls.m_ScalesFixedCenterOfRotationAffineTransformScale3->setText(QString::number(transformValues[3]));
m_Controls.m_ScalesFixedCenterOfRotationAffineTransformScale4->setText(QString::number(transformValues[4]));
m_Controls.m_ScalesFixedCenterOfRotationAffineTransformScale5->setText(QString::number(transformValues[5]));
m_Controls.m_ScalesFixedCenterOfRotationAffineTransformScale6->setText(QString::number(transformValues[6]));
m_Controls.m_ScalesFixedCenterOfRotationAffineTransformScale7->setText(QString::number(transformValues[7]));
m_Controls.m_ScalesFixedCenterOfRotationAffineTransformScale8->setText(QString::number(transformValues[8]));
m_Controls.m_ScalesFixedCenterOfRotationAffineTransformScale9->setText(QString::number(transformValues[9]));
m_Controls.m_ScalesFixedCenterOfRotationAffineTransformScaleTranslationX->setText(QString::number(transformValues[10]));
m_Controls.m_ScalesFixedCenterOfRotationAffineTransformScaleTranslationY->setText(QString::number(transformValues[11]));
m_Controls.m_ScalesFixedCenterOfRotationAffineTransformScaleTranslationZ->setText(QString::number(transformValues[12]));
m_Controls.m_CenterForInitializerFixedCenterOfRotationAffine->setChecked(transformValues[13]);
m_Controls.m_MomentsFixedCenterOfRotationAffine->setChecked(transformValues[14]);
m_Controls.m_GeometryFixedCenterOfRotationAffine->setChecked(!transformValues[14]);
}
QString QmitkFixedCenterOfRotationAffineTransformView::GetName()
{
return "FixedCenterOfRotationAffine";
}
void QmitkFixedCenterOfRotationAffineTransformView::SetupUI(QWidget* parent)
{
m_Controls.setupUi(parent);
QValidator* validatorLineEditInputFloat = new QDoubleValidator(0, 20000000, 8, this);
m_Controls.m_ScalesFixedCenterOfRotationAffineTransformScale1->setValidator(validatorLineEditInputFloat);
m_Controls.m_ScalesFixedCenterOfRotationAffineTransformScale2->setValidator(validatorLineEditInputFloat);
m_Controls.m_ScalesFixedCenterOfRotationAffineTransformScale3->setValidator(validatorLineEditInputFloat);
m_Controls.m_ScalesFixedCenterOfRotationAffineTransformScale4->setValidator(validatorLineEditInputFloat);
m_Controls.m_ScalesFixedCenterOfRotationAffineTransformScale5->setValidator(validatorLineEditInputFloat);
m_Controls.m_ScalesFixedCenterOfRotationAffineTransformScale6->setValidator(validatorLineEditInputFloat);
m_Controls.m_ScalesFixedCenterOfRotationAffineTransformScale7->setValidator(validatorLineEditInputFloat);
m_Controls.m_ScalesFixedCenterOfRotationAffineTransformScale8->setValidator(validatorLineEditInputFloat);
m_Controls.m_ScalesFixedCenterOfRotationAffineTransformScale9->setValidator(validatorLineEditInputFloat);
m_Controls.m_ScalesFixedCenterOfRotationAffineTransformScaleTranslationX->setValidator(validatorLineEditInputFloat);
m_Controls.m_ScalesFixedCenterOfRotationAffineTransformScaleTranslationY->setValidator(validatorLineEditInputFloat);
m_Controls.m_ScalesFixedCenterOfRotationAffineTransformScaleTranslationZ->setValidator(validatorLineEditInputFloat);
}
itk::Array<double> QmitkFixedCenterOfRotationAffineTransformView::GetScales()
{
itk::Array<double> scales;
scales.SetSize(12);
scales.Fill(1.0);
if (m_Controls.m_UseOptimizerScalesFixedCenterOfRotationAffine->isChecked())
{
scales[0] = m_Controls.m_ScalesFixedCenterOfRotationAffineTransformScale1->text().toDouble();
scales[1] = m_Controls.m_ScalesFixedCenterOfRotationAffineTransformScale2->text().toDouble();
scales[2] = m_Controls.m_ScalesFixedCenterOfRotationAffineTransformScale3->text().toDouble();
scales[3] = m_Controls.m_ScalesFixedCenterOfRotationAffineTransformScale4->text().toDouble();
scales[4] = m_Controls.m_ScalesFixedCenterOfRotationAffineTransformScale5->text().toDouble();
scales[5] = m_Controls.m_ScalesFixedCenterOfRotationAffineTransformScale6->text().toDouble();
scales[6] = m_Controls.m_ScalesFixedCenterOfRotationAffineTransformScale7->text().toDouble();
scales[7] = m_Controls.m_ScalesFixedCenterOfRotationAffineTransformScale8->text().toDouble();
scales[8] = m_Controls.m_ScalesFixedCenterOfRotationAffineTransformScale9->text().toDouble();
scales[9] = m_Controls.m_ScalesFixedCenterOfRotationAffineTransformScaleTranslationX->text().toDouble();
scales[10] = m_Controls.m_ScalesFixedCenterOfRotationAffineTransformScaleTranslationY->text().toDouble();
scales[11] = m_Controls.m_ScalesFixedCenterOfRotationAffineTransformScaleTranslationZ->text().toDouble();
}
return scales;
}
vtkTransform* QmitkFixedCenterOfRotationAffineTransformView::Transform(vtkMatrix4x4* vtkmatrix, vtkTransform* vtktransform, itk::Array<double> transformParams)
{
if (m_MovingImage.IsNotNull())
{
int m = 0;
for (unsigned int i = 0; i < m_FixedImage->GetDimension(); i++)
{
for (unsigned int j = 0; j < m_FixedImage->GetDimension(); j++)
{
vtkmatrix->SetElement(i, j, transformParams[m]);
m++;
}
}
float center[4];
float translation[4];
center[0] = m_CenterX;
center[1] = m_CenterY;
center[2] = m_CenterZ;
center[3] = 1;
vtkmatrix->MultiplyPoint(center, translation);
if (m_FixedImage->GetDimension() == 2)
{
vtkmatrix->SetElement(0, 3, -translation[0] + center[0] + transformParams[4]);
vtkmatrix->SetElement(1, 3, -translation[1] + center[1] + transformParams[5]);
}
else if (m_FixedImage->GetDimension() == 3)
{
vtkmatrix->SetElement(0, 3, -translation[0] + center[0] + transformParams[9]);
vtkmatrix->SetElement(1, 3, -translation[1] + center[1] + transformParams[10]);
vtkmatrix->SetElement(2, 3, -translation[2] + center[2] + transformParams[11]);
}
vtktransform->SetMatrix(vtkmatrix);
}
return vtktransform;
}
int QmitkFixedCenterOfRotationAffineTransformView::GetNumberOfTransformParameters()
{
if (m_FixedImage.IsNotNull())
{
if (m_FixedImage->GetDimension() == 2)
{
m_Controls.m_ScalesFixedCenterOfRotationAffineTransformScale7->hide();
m_Controls.m_ScalesFixedCenterOfRotationAffineTransformScale8->hide();
m_Controls.m_ScalesFixedCenterOfRotationAffineTransformScale9->hide();
m_Controls.m_ScalesFixedCenterOfRotationAffineTransformScaleTranslationX->hide();
m_Controls.m_ScalesFixedCenterOfRotationAffineTransformScaleTranslationY->hide();
m_Controls.m_ScalesFixedCenterOfRotationAffineTransformScaleTranslationZ->hide();
m_Controls.textLabel2_7_2_2->setText("Translation Scale X:");
m_Controls.textLabel3_6_2_2->setText("Translation Scale Y:");
m_Controls.textLabel4_4_3_2->hide();
m_Controls.textLabel5_4_2_2->hide();
m_Controls.textLabel6_4_2_2->hide();
m_Controls.textLabel11_3_2_2->hide();
m_Controls.textLabel12_3_2_2->hide();
m_Controls.textLabel13_2_2_2->hide();
return 6;
}
else
{
m_Controls.m_ScalesFixedCenterOfRotationAffineTransformScale7->show();
m_Controls.m_ScalesFixedCenterOfRotationAffineTransformScale8->show();
m_Controls.m_ScalesFixedCenterOfRotationAffineTransformScale9->show();
m_Controls.m_ScalesFixedCenterOfRotationAffineTransformScaleTranslationX->show();
m_Controls.m_ScalesFixedCenterOfRotationAffineTransformScaleTranslationY->show();
m_Controls.m_ScalesFixedCenterOfRotationAffineTransformScaleTranslationZ->show();
m_Controls.textLabel2_7_2_2->setText("Scale 5:");
m_Controls.textLabel3_6_2_2->setText("Scale 6:");
m_Controls.textLabel4_4_3_2->show();
m_Controls.textLabel5_4_2_2->show();
m_Controls.textLabel6_4_2_2->show();
m_Controls.textLabel11_3_2_2->show();
m_Controls.textLabel12_3_2_2->show();
m_Controls.textLabel13_2_2_2->show();
return 12;
}
}
else
return 0;
}
diff --git a/Modules/RigidRegistrationUI/RigidRegistrationTransforms/QmitkQuaternionRigidTransformView.cpp b/Modules/RigidRegistrationUI/RigidRegistrationTransforms/QmitkQuaternionRigidTransformView.cpp
index 39568c1b6d..9fbc045293 100644
--- a/Modules/RigidRegistrationUI/RigidRegistrationTransforms/QmitkQuaternionRigidTransformView.cpp
+++ b/Modules/RigidRegistrationUI/RigidRegistrationTransforms/QmitkQuaternionRigidTransformView.cpp
@@ -1,197 +1,198 @@
/*=========================================================================
Program: Medical Imaging & Interaction Toolkit
Language: C++
Date: $Date$
Version: $Revision: -1 $
Copyright (c) German Cancer Research Center, Division of Medical and
Biological Informatics. All rights reserved.
See MITKCopyright.txt or http://www.mitk.org/copyright.html for details.
This software is distributed WITHOUT ANY WARRANTY; without even
the implied warranty of MERCHANTABILITY or FITNESS FOR A PARTICULAR
PURPOSE. See the above copyright notices for more information.
=========================================================================*/
#include "QmitkQuaternionRigidTransformView.h"
#include "mitkImageAccessByItk.h"
+#include <mitkImageCast.h>
#include <itkQuaternionRigidTransform.h>
#include <itkCenteredTransformInitializer.h>
#include <QValidator>
QmitkQuaternionRigidTransformView::QmitkQuaternionRigidTransformView(QWidget* parent, Qt::WindowFlags f ) : QmitkRigidRegistrationTransformsGUIBase(parent, f),
m_CenterX(0), m_CenterY(0), m_CenterZ(0)
{
}
QmitkQuaternionRigidTransformView::~QmitkQuaternionRigidTransformView()
{
}
mitk::TransformParameters::TransformType QmitkQuaternionRigidTransformView::GetTransformType()
{
return mitk::TransformParameters::QUATERNIONRIGIDTRANSFORM;
}
itk::Object::Pointer QmitkQuaternionRigidTransformView::GetTransform()
{
if (m_FixedImage.IsNotNull())
{
AccessByItk(m_FixedImage, GetTransform2);
return m_TransformObject;
}
return NULL;
}
template < class TPixelType, unsigned int VImageDimension >
itk::Object::Pointer QmitkQuaternionRigidTransformView::GetTransform2(itk::Image<TPixelType, VImageDimension>* /*itkImage1*/)
{
if (VImageDimension == 3)
{
typedef typename itk::Image< TPixelType, 3 > FixedImage3DType;
typedef typename itk::Image< TPixelType, 3 > MovingImage3DType;
typename FixedImage3DType::Pointer fixedImage3D;
mitk::CastToItkImage(m_FixedImage, fixedImage3D);
typename MovingImage3DType::Pointer movingImage3D;
mitk::CastToItkImage(m_MovingImage, movingImage3D);
typename itk::QuaternionRigidTransform< double >::Pointer transformPointer = itk::QuaternionRigidTransform< double >::New();
transformPointer->SetIdentity();
typedef typename itk::QuaternionRigidTransform< double > QuaternionRigidTransformType;
if (m_Controls.m_CenterForInitializerQuaternionRigid->isChecked())
{
typedef typename itk::CenteredTransformInitializer<QuaternionRigidTransformType, FixedImage3DType, MovingImage3DType> TransformInitializerType;
typename TransformInitializerType::Pointer transformInitializer = TransformInitializerType::New();
transformInitializer->SetFixedImage( fixedImage3D );
transformInitializer->SetMovingImage( movingImage3D );
transformInitializer->SetTransform( transformPointer );
if (m_Controls.m_MomentsQuaternionRigid->isChecked())
{
transformInitializer->MomentsOn();
}
else
{
transformInitializer->GeometryOn();
}
transformInitializer->InitializeTransform();
}
m_CenterX = transformPointer->GetCenter()[0];
m_CenterY = transformPointer->GetCenter()[1];
m_CenterZ = transformPointer->GetCenter()[2];
m_TransformObject = transformPointer.GetPointer();
return transformPointer.GetPointer();
}
return NULL;
}
itk::Array<double> QmitkQuaternionRigidTransformView::GetTransformParameters()
{
itk::Array<double> transformValues;
transformValues.SetSize(10);
transformValues.fill(0);
transformValues[0] = m_Controls.m_UseOptimizerScalesQuaternionRigid->isChecked();
transformValues[1] = m_Controls.m_ScalesQuaternionRigidTransformScale1->text().toDouble();
transformValues[2] = m_Controls.m_ScalesQuaternionRigidTransformScale2->text().toDouble();
transformValues[3] = m_Controls.m_ScalesQuaternionRigidTransformScale3->text().toDouble();
transformValues[4] = m_Controls.m_ScalesQuaternionRigidTransformScale4->text().toDouble();
transformValues[5] = m_Controls.m_ScalesQuaternionRigidTransformScaleTranslationX->text().toDouble();
transformValues[6] = m_Controls.m_ScalesQuaternionRigidTransformScaleTranslationY->text().toDouble();
transformValues[7] = m_Controls.m_ScalesQuaternionRigidTransformScaleTranslationZ->text().toDouble();
transformValues[8] = m_Controls.m_CenterForInitializerQuaternionRigid->isChecked();
transformValues[9] = m_Controls.m_MomentsQuaternionRigid->isChecked();
return transformValues;
}
void QmitkQuaternionRigidTransformView::SetTransformParameters(itk::Array<double> transformValues)
{
m_Controls.m_UseOptimizerScalesQuaternionRigid->setChecked(transformValues[0]);
m_Controls.m_ScalesQuaternionRigidTransformScale1->setText(QString::number(transformValues[1]));
m_Controls.m_ScalesQuaternionRigidTransformScale2->setText(QString::number(transformValues[2]));
m_Controls.m_ScalesQuaternionRigidTransformScale3->setText(QString::number(transformValues[3]));
m_Controls.m_ScalesQuaternionRigidTransformScale4->setText(QString::number(transformValues[4]));
m_Controls.m_ScalesQuaternionRigidTransformScaleTranslationX->setText(QString::number(transformValues[5]));
m_Controls.m_ScalesQuaternionRigidTransformScaleTranslationY->setText(QString::number(transformValues[6]));
m_Controls.m_ScalesQuaternionRigidTransformScaleTranslationZ->setText(QString::number(transformValues[7]));
m_Controls.m_CenterForInitializerQuaternionRigid->setChecked(transformValues[8]);
m_Controls.m_MomentsQuaternionRigid->setChecked(transformValues[9]);
m_Controls.m_GeometryQuaternionRigid->setChecked(!transformValues[9]);
}
QString QmitkQuaternionRigidTransformView::GetName()
{
return "QuaternionRigid";
}
void QmitkQuaternionRigidTransformView::SetupUI(QWidget* parent)
{
m_Controls.setupUi(parent);
QValidator* validatorLineEditInputFloat = new QDoubleValidator(0, 20000000, 8, this);
m_Controls.m_ScalesQuaternionRigidTransformScale1->setValidator(validatorLineEditInputFloat);
m_Controls.m_ScalesQuaternionRigidTransformScale2->setValidator(validatorLineEditInputFloat);
m_Controls.m_ScalesQuaternionRigidTransformScale3->setValidator(validatorLineEditInputFloat);
m_Controls.m_ScalesQuaternionRigidTransformScale4->setValidator(validatorLineEditInputFloat);
m_Controls.m_ScalesQuaternionRigidTransformScaleTranslationX->setValidator(validatorLineEditInputFloat);
m_Controls.m_ScalesQuaternionRigidTransformScaleTranslationY->setValidator(validatorLineEditInputFloat);
m_Controls.m_ScalesQuaternionRigidTransformScaleTranslationZ->setValidator(validatorLineEditInputFloat);
}
itk::Array<double> QmitkQuaternionRigidTransformView::GetScales()
{
itk::Array<double> scales;
scales.SetSize(7);
scales.Fill(1.0);
if (m_Controls.m_UseOptimizerScalesQuaternionRigid->isChecked())
{
scales[0] = m_Controls.m_ScalesQuaternionRigidTransformScale1->text().toDouble();
scales[1] = m_Controls.m_ScalesQuaternionRigidTransformScale2->text().toDouble();
scales[2] = m_Controls.m_ScalesQuaternionRigidTransformScale3->text().toDouble();
scales[3] = m_Controls.m_ScalesQuaternionRigidTransformScale4->text().toDouble();
scales[4] = m_Controls.m_ScalesQuaternionRigidTransformScaleTranslationX->text().toDouble();
scales[5] = m_Controls.m_ScalesQuaternionRigidTransformScaleTranslationY->text().toDouble();
scales[6] = m_Controls.m_ScalesQuaternionRigidTransformScaleTranslationZ->text().toDouble();
}
return scales;
}
vtkTransform* QmitkQuaternionRigidTransformView::Transform(vtkMatrix4x4* vtkmatrix, vtkTransform* vtktransform, itk::Array<double> transformParams)
{
if (m_MovingImage.IsNotNull())
{
itk::QuaternionRigidTransform<double>::Pointer quaternionTransform = itk::QuaternionRigidTransform<double>::New();
quaternionTransform->SetParameters(transformParams);
itk::Matrix<double, 3, 3> Matrix = quaternionTransform->GetMatrix();
for (int i = 0; i < 3; i++)
{
for (int j = 0; j < 3; j++)
{
vtkmatrix->SetElement(i, j, Matrix[i][j]);
}
}
float center[4];
float translation[4];
center[0] = m_CenterX;
center[1] = m_CenterY;
center[2] = m_CenterZ;
center[3] = 1;
vtkmatrix->MultiplyPoint(center, translation);
vtkmatrix->SetElement(0, 3, -translation[0] + center[0] + transformParams[4]);
vtkmatrix->SetElement(1, 3, -translation[1] + center[1] + transformParams[5]);
vtkmatrix->SetElement(2, 3, -translation[2] + center[2] + transformParams[6]);
vtktransform->SetMatrix(vtkmatrix);
}
return vtktransform;
}
int QmitkQuaternionRigidTransformView::GetNumberOfTransformParameters()
{
if (m_FixedImage.IsNotNull())
{
if (m_FixedImage->GetDimension() == 2)
return 0;
else
return 7;
}
else
return 0;
}
diff --git a/Modules/RigidRegistrationUI/RigidRegistrationTransforms/QmitkRigid2DTransformView.cpp b/Modules/RigidRegistrationUI/RigidRegistrationTransforms/QmitkRigid2DTransformView.cpp
index ff79248055..5b9c4f9c4e 100644
--- a/Modules/RigidRegistrationUI/RigidRegistrationTransforms/QmitkRigid2DTransformView.cpp
+++ b/Modules/RigidRegistrationUI/RigidRegistrationTransforms/QmitkRigid2DTransformView.cpp
@@ -1,162 +1,163 @@
/*=========================================================================
Program: Medical Imaging & Interaction Toolkit
Language: C++
Date: $Date$
Version: $Revision: -1 $
Copyright (c) German Cancer Research Center, Division of Medical and
Biological Informatics. All rights reserved.
See MITKCopyright.txt or http://www.mitk.org/copyright.html for details.
This software is distributed WITHOUT ANY WARRANTY; without even
the implied warranty of MERCHANTABILITY or FITNESS FOR A PARTICULAR
PURPOSE. See the above copyright notices for more information.
=========================================================================*/
#include "QmitkRigid2DTransformView.h"
#include "mitkImageAccessByItk.h"
+#include <mitkImageCast.h>
#include <itkRigid2DTransform.h>
#include <itkCenteredTransformInitializer.h>
#include <QValidator>
QmitkRigid2DTransformView::QmitkRigid2DTransformView(QWidget* parent, Qt::WindowFlags f ) : QmitkRigidRegistrationTransformsGUIBase(parent, f),
m_CenterX(0), m_CenterY(0), m_CenterZ(0)
{
}
QmitkRigid2DTransformView::~QmitkRigid2DTransformView()
{
}
mitk::TransformParameters::TransformType QmitkRigid2DTransformView::GetTransformType()
{
return mitk::TransformParameters::RIGID2DTRANSFORM;
}
itk::Object::Pointer QmitkRigid2DTransformView::GetTransform()
{
if (m_FixedImage.IsNotNull())
{
AccessByItk(m_FixedImage, GetTransform2);
return m_TransformObject;
}
return NULL;
}
template < class TPixelType, unsigned int VImageDimension >
itk::Object::Pointer QmitkRigid2DTransformView::GetTransform2(itk::Image<TPixelType, VImageDimension>* /*itkImage1*/)
{
if (VImageDimension == 2)
{
typedef typename itk::Image< TPixelType, 2 > FixedImage2DType;
typedef typename itk::Image< TPixelType, 2 > MovingImage2DType;
typename FixedImage2DType::Pointer fixedImage2D;
mitk::CastToItkImage(m_FixedImage, fixedImage2D);
typename MovingImage2DType::Pointer movingImage2D;
mitk::CastToItkImage(m_MovingImage, movingImage2D);
typename itk::Rigid2DTransform< double >::Pointer transformPointer = itk::Rigid2DTransform< double >::New();
transformPointer->SetIdentity();
if (m_Controls.m_CenterForInitializerRigid2D->isChecked())
{
typedef typename itk::Rigid2DTransform< double > Rigid2DTransformType;
typedef typename itk::CenteredTransformInitializer<Rigid2DTransformType, FixedImage2DType, MovingImage2DType> TransformInitializerType;
typename TransformInitializerType::Pointer transformInitializer = TransformInitializerType::New();
transformInitializer->SetFixedImage( fixedImage2D );
transformInitializer->SetMovingImage( movingImage2D );
transformInitializer->SetTransform( transformPointer );
if (m_Controls.m_MomentsRigid2D->isChecked())
{
transformInitializer->MomentsOn();
}
else
{
transformInitializer->GeometryOn();
}
transformInitializer->InitializeTransform();
}
m_TransformObject = transformPointer.GetPointer();
return transformPointer.GetPointer();
}
return NULL;
}
itk::Array<double> QmitkRigid2DTransformView::GetTransformParameters()
{
itk::Array<double> transformValues;
transformValues.SetSize(6);
transformValues.fill(0);
transformValues[0] = m_Controls.m_UseOptimizerScalesRigid2D->isChecked();
transformValues[1] = m_Controls.m_ScalesRigid2DTransformScale1->text().toDouble();
transformValues[2] = m_Controls.m_ScalesRigid2DTransformScaleTranslationX->text().toDouble();
transformValues[3] = m_Controls.m_ScalesRigid2DTransformScaleTranslationY->text().toDouble();
transformValues[4] = m_Controls.m_CenterForInitializerRigid2D->isChecked();
transformValues[5] = m_Controls.m_MomentsRigid2D->isChecked();
return transformValues;
}
void QmitkRigid2DTransformView::SetTransformParameters(itk::Array<double> transformValues)
{
m_Controls.m_UseOptimizerScalesRigid2D->setChecked(transformValues[0]);
m_Controls.m_ScalesRigid2DTransformScale1->setText(QString::number(transformValues[1]));
m_Controls.m_ScalesRigid2DTransformScaleTranslationX->setText(QString::number(transformValues[2]));
m_Controls.m_ScalesRigid2DTransformScaleTranslationY->setText(QString::number(transformValues[3]));
m_Controls.m_CenterForInitializerRigid2D->setChecked(transformValues[4]);
m_Controls.m_MomentsRigid2D->setChecked(transformValues[5]);
m_Controls.m_GeometryRigid2D->setChecked(!transformValues[5]);
}
QString QmitkRigid2DTransformView::GetName()
{
return "Rigid2D";
}
void QmitkRigid2DTransformView::SetupUI(QWidget* parent)
{
m_Controls.setupUi(parent);
QValidator* validatorLineEditInputFloat = new QDoubleValidator(0, 20000000, 8, this);
m_Controls.m_ScalesRigid2DTransformScale1->setValidator(validatorLineEditInputFloat);
m_Controls.m_ScalesRigid2DTransformScaleTranslationX->setValidator(validatorLineEditInputFloat);
m_Controls.m_ScalesRigid2DTransformScaleTranslationY->setValidator(validatorLineEditInputFloat);
}
itk::Array<double> QmitkRigid2DTransformView::GetScales()
{
itk::Array<double> scales;
scales.SetSize(3);
scales.Fill(1.0);
if (m_Controls.m_UseOptimizerScalesRigid2D->isChecked())
{
scales[0] = m_Controls.m_ScalesRigid2DTransformScale1->text().toDouble();
scales[1] = m_Controls.m_ScalesRigid2DTransformScaleTranslationX->text().toDouble();
scales[2] = m_Controls.m_ScalesRigid2DTransformScaleTranslationY->text().toDouble();
}
return scales;
}
vtkTransform* QmitkRigid2DTransformView::Transform(vtkMatrix4x4* /*vtkmatrix*/, vtkTransform* vtktransform, itk::Array<double> transformParams)
{
if (m_MovingImage.IsNotNull())
{
mitk::ScalarType angle = transformParams[0] * 45.0 / atan(1.0);
vtktransform->PostMultiply();
vtktransform->RotateZ(angle);
vtktransform->Translate(transformParams[1], transformParams[2], 0);
vtktransform->PreMultiply();
}
return vtktransform;
}
int QmitkRigid2DTransformView::GetNumberOfTransformParameters()
{
if (m_FixedImage.IsNotNull())
{
if (m_FixedImage->GetDimension() == 2)
return 3;
else
return 0;
}
else
return 0;
}
diff --git a/Modules/RigidRegistrationUI/RigidRegistrationTransforms/QmitkScaleSkewVersor3DTransformView.cpp b/Modules/RigidRegistrationUI/RigidRegistrationTransforms/QmitkScaleSkewVersor3DTransformView.cpp
index 1aeb9c7a7f..16d16f913c 100644
--- a/Modules/RigidRegistrationUI/RigidRegistrationTransforms/QmitkScaleSkewVersor3DTransformView.cpp
+++ b/Modules/RigidRegistrationUI/RigidRegistrationTransforms/QmitkScaleSkewVersor3DTransformView.cpp
@@ -1,228 +1,229 @@
/*=========================================================================
Program: Medical Imaging & Interaction Toolkit
Language: C++
Date: $Date$
Version: $Revision: -1 $
Copyright (c) German Cancer Research Center, Division of Medical and
Biological Informatics. All rights reserved.
See MITKCopyright.txt or http://www.mitk.org/copyright.html for details.
This software is distributed WITHOUT ANY WARRANTY; without even
the implied warranty of MERCHANTABILITY or FITNESS FOR A PARTICULAR
PURPOSE. See the above copyright notices for more information.
=========================================================================*/
#include "QmitkScaleSkewVersor3DTransformView.h"
#include "mitkImageAccessByItk.h"
+#include <mitkImageCast.h>
#include <itkScaleSkewVersor3DTransform.h>
#include <itkCenteredTransformInitializer.h>
#include <QValidator>
QmitkScaleSkewVersor3DTransformView::QmitkScaleSkewVersor3DTransformView(QWidget* parent, Qt::WindowFlags f ) : QmitkRigidRegistrationTransformsGUIBase(parent, f),
m_CenterX(0), m_CenterY(0), m_CenterZ(0)
{
}
QmitkScaleSkewVersor3DTransformView::~QmitkScaleSkewVersor3DTransformView()
{
}
mitk::TransformParameters::TransformType QmitkScaleSkewVersor3DTransformView::GetTransformType()
{
return mitk::TransformParameters::SCALESKEWVERSOR3DTRANSFORM;
}
itk::Object::Pointer QmitkScaleSkewVersor3DTransformView::GetTransform()
{
if (m_FixedImage.IsNotNull())
{
AccessByItk(m_FixedImage, GetTransform2);
return m_TransformObject;
}
return NULL;
}
template < class TPixelType, unsigned int VImageDimension >
itk::Object::Pointer QmitkScaleSkewVersor3DTransformView::GetTransform2(itk::Image<TPixelType, VImageDimension>* /*itkImage1*/)
{
if (VImageDimension == 3)
{
typedef typename itk::Image< TPixelType, 3 > FixedImage3DType;
typedef typename itk::Image< TPixelType, 3 > MovingImage3DType;
typename FixedImage3DType::Pointer fixedImage3D;
mitk::CastToItkImage(m_FixedImage, fixedImage3D);
typename MovingImage3DType::Pointer movingImage3D;
mitk::CastToItkImage(m_MovingImage, movingImage3D);
typename itk::ScaleSkewVersor3DTransform< double >::Pointer transformPointer = itk::ScaleSkewVersor3DTransform< double >::New();
transformPointer->SetIdentity();
if (m_Controls.m_CenterForInitializerScaleSkewVersorRigid3D->isChecked())
{
typedef typename itk::ScaleSkewVersor3DTransform< double > ScaleSkewVersor3DTransformType;
typedef typename itk::CenteredTransformInitializer<ScaleSkewVersor3DTransformType, FixedImage3DType, MovingImage3DType> TransformInitializerType;
typename TransformInitializerType::Pointer transformInitializer = TransformInitializerType::New();
transformInitializer->SetFixedImage( fixedImage3D );
transformInitializer->SetMovingImage( movingImage3D );
transformInitializer->SetTransform( transformPointer );
if (m_Controls.m_MomentsScaleSkewVersorRigid3D->isChecked())
{
transformInitializer->MomentsOn();
}
else
{
transformInitializer->GeometryOn();
}
transformInitializer->InitializeTransform();
}
m_CenterX = transformPointer->GetCenter()[0];
m_CenterY = transformPointer->GetCenter()[1];
m_CenterZ = transformPointer->GetCenter()[2];
m_TransformObject = transformPointer.GetPointer();
return transformPointer.GetPointer();
}
return NULL;
}
itk::Array<double> QmitkScaleSkewVersor3DTransformView::GetTransformParameters()
{
itk::Array<double> transformValues;
transformValues.SetSize(18);
transformValues.fill(0);
transformValues[0] = m_Controls.m_UseOptimizerScalesScaleSkewVersorRigid3DTransform->isChecked();
transformValues[1] = m_Controls.m_ScalesScaleSkewVersorRigid3DTransformScale1->text().toDouble();
transformValues[2] = m_Controls.m_ScalesScaleSkewVersorRigid3DTransformScale2->text().toDouble();
transformValues[3] = m_Controls.m_ScalesScaleSkewVersorRigid3DTransformScale3->text().toDouble();
transformValues[4] = m_Controls.m_ScalesScaleSkewVersorRigid3DTransformScaleTranslationX->text().toDouble();
transformValues[5] = m_Controls.m_ScaleScaleSkewVersorRigid3DTransformScaleTranslationY->text().toDouble();
transformValues[6] = m_Controls.m_ScalesScaleSkewVersorRigid3DTransformScaleTranslationZ->text().toDouble();
transformValues[7] = m_Controls.m_ScalesScaleSkewVersorRigid3DTransformScale7->text().toDouble();
transformValues[8] = m_Controls.m_ScalesScaleSkewVersorRigid3DTransformScale8->text().toDouble();
transformValues[9] = m_Controls.m_ScalesScaleSkewVersorRigid3DTransformScale9->text().toDouble();
transformValues[10] = m_Controls.m_ScalesScaleSkewVersorRigid3DTransformScale10->text().toDouble();
transformValues[11] = m_Controls.m_ScalesScaleSkewVersorRigid3DTransformScale11->text().toDouble();
transformValues[12] = m_Controls.m_ScalesScaleSkewVersorRigid3DTransformScale12->text().toDouble();
transformValues[13] = m_Controls.m_ScalesScaleSkewVersorRigid3DTransformScale13->text().toDouble();
transformValues[14] = m_Controls.m_ScalesScaleSkewVersorRigid3DTransformScale14->text().toDouble();
transformValues[15] = m_Controls.m_ScalesScaleSkewVersorRigid3DTransformScale15->text().toDouble();
transformValues[16] = m_Controls.m_CenterForInitializerScaleSkewVersorRigid3D->isChecked();
transformValues[17] = m_Controls.m_MomentsScaleSkewVersorRigid3D->isChecked();
return transformValues;
}
void QmitkScaleSkewVersor3DTransformView::SetTransformParameters(itk::Array<double> transformValues)
{
m_Controls.m_UseOptimizerScalesScaleSkewVersorRigid3DTransform->setChecked(transformValues[0]);
m_Controls.m_ScalesScaleSkewVersorRigid3DTransformScale1->setText(QString::number(transformValues[1]));
m_Controls.m_ScalesScaleSkewVersorRigid3DTransformScale2->setText(QString::number(transformValues[2]));
m_Controls.m_ScalesScaleSkewVersorRigid3DTransformScale3->setText(QString::number(transformValues[3]));
m_Controls.m_ScalesScaleSkewVersorRigid3DTransformScaleTranslationX->setText(QString::number(transformValues[4]));
m_Controls.m_ScaleScaleSkewVersorRigid3DTransformScaleTranslationY->setText(QString::number(transformValues[5]));
m_Controls.m_ScalesScaleSkewVersorRigid3DTransformScaleTranslationZ->setText(QString::number(transformValues[6]));
m_Controls.m_ScalesScaleSkewVersorRigid3DTransformScale7->setText(QString::number(transformValues[7]));
m_Controls.m_ScalesScaleSkewVersorRigid3DTransformScale8->setText(QString::number(transformValues[8]));
m_Controls.m_ScalesScaleSkewVersorRigid3DTransformScale9->setText(QString::number(transformValues[9]));
m_Controls.m_ScalesScaleSkewVersorRigid3DTransformScale10->setText(QString::number(transformValues[10]));
m_Controls.m_ScalesScaleSkewVersorRigid3DTransformScale11->setText(QString::number(transformValues[11]));
m_Controls.m_ScalesScaleSkewVersorRigid3DTransformScale12->setText(QString::number(transformValues[12]));
m_Controls.m_ScalesScaleSkewVersorRigid3DTransformScale13->setText(QString::number(transformValues[13]));
m_Controls.m_ScalesScaleSkewVersorRigid3DTransformScale14->setText(QString::number(transformValues[14]));
m_Controls.m_ScalesScaleSkewVersorRigid3DTransformScale15->setText(QString::number(transformValues[15]));
m_Controls.m_CenterForInitializerScaleSkewVersorRigid3D->setChecked(transformValues[16]);
m_Controls.m_MomentsScaleSkewVersorRigid3D->setChecked(transformValues[17]);
m_Controls.m_GeometryScaleSkewVersorRigid3D->setChecked(!transformValues[17]);
}
QString QmitkScaleSkewVersor3DTransformView::GetName()
{
return "ScaleSkewVersor3D";
}
void QmitkScaleSkewVersor3DTransformView::SetupUI(QWidget* parent)
{
m_Controls.setupUi(parent);
QValidator* validatorLineEditInputFloat = new QDoubleValidator(0, 20000000, 8, this);
m_Controls.m_ScalesScaleSkewVersorRigid3DTransformScale1->setValidator(validatorLineEditInputFloat);
m_Controls.m_ScalesScaleSkewVersorRigid3DTransformScale2->setValidator(validatorLineEditInputFloat);
m_Controls.m_ScalesScaleSkewVersorRigid3DTransformScale3->setValidator(validatorLineEditInputFloat);
m_Controls.m_ScalesScaleSkewVersorRigid3DTransformScaleTranslationX->setValidator(validatorLineEditInputFloat);
m_Controls.m_ScaleScaleSkewVersorRigid3DTransformScaleTranslationY->setValidator(validatorLineEditInputFloat);
m_Controls.m_ScalesScaleSkewVersorRigid3DTransformScaleTranslationZ->setValidator(validatorLineEditInputFloat);
m_Controls.m_ScalesScaleSkewVersorRigid3DTransformScale7->setValidator(validatorLineEditInputFloat);
m_Controls.m_ScalesScaleSkewVersorRigid3DTransformScale8->setValidator(validatorLineEditInputFloat);
m_Controls.m_ScalesScaleSkewVersorRigid3DTransformScale9->setValidator(validatorLineEditInputFloat);
m_Controls.m_ScalesScaleSkewVersorRigid3DTransformScale10->setValidator(validatorLineEditInputFloat);
m_Controls.m_ScalesScaleSkewVersorRigid3DTransformScale11->setValidator(validatorLineEditInputFloat);
m_Controls.m_ScalesScaleSkewVersorRigid3DTransformScale12->setValidator(validatorLineEditInputFloat);
m_Controls.m_ScalesScaleSkewVersorRigid3DTransformScale13->setValidator(validatorLineEditInputFloat);
m_Controls.m_ScalesScaleSkewVersorRigid3DTransformScale14->setValidator(validatorLineEditInputFloat);
m_Controls.m_ScalesScaleSkewVersorRigid3DTransformScale15->setValidator(validatorLineEditInputFloat);
}
itk::Array<double> QmitkScaleSkewVersor3DTransformView::GetScales()
{
itk::Array<double> scales;
scales.SetSize(15);
scales.Fill(1.0);
if (m_Controls.m_UseOptimizerScalesScaleSkewVersorRigid3DTransform->isChecked())
{
scales[0] = m_Controls.m_ScalesScaleSkewVersorRigid3DTransformScale1->text().toDouble();
scales[1] = m_Controls.m_ScalesScaleSkewVersorRigid3DTransformScale2->text().toDouble();
scales[2] = m_Controls.m_ScalesScaleSkewVersorRigid3DTransformScale3->text().toDouble();
scales[3] = m_Controls.m_ScalesScaleSkewVersorRigid3DTransformScaleTranslationX->text().toDouble();
scales[4] = m_Controls.m_ScaleScaleSkewVersorRigid3DTransformScaleTranslationY->text().toDouble();
scales[5] = m_Controls.m_ScalesScaleSkewVersorRigid3DTransformScaleTranslationZ->text().toDouble();
scales[6] = m_Controls.m_ScalesScaleSkewVersorRigid3DTransformScale7->text().toDouble();
scales[7] = m_Controls.m_ScalesScaleSkewVersorRigid3DTransformScale8->text().toDouble();
scales[8] = m_Controls.m_ScalesScaleSkewVersorRigid3DTransformScale9->text().toDouble();
scales[9] = m_Controls.m_ScalesScaleSkewVersorRigid3DTransformScale10->text().toDouble();
scales[10] = m_Controls.m_ScalesScaleSkewVersorRigid3DTransformScale11->text().toDouble();
scales[11] = m_Controls.m_ScalesScaleSkewVersorRigid3DTransformScale12->text().toDouble();
scales[12] = m_Controls.m_ScalesScaleSkewVersorRigid3DTransformScale13->text().toDouble();
scales[13] = m_Controls.m_ScalesScaleSkewVersorRigid3DTransformScale14->text().toDouble();
scales[14] = m_Controls.m_ScalesScaleSkewVersorRigid3DTransformScale15->text().toDouble();
}
return scales;
}
vtkTransform* QmitkScaleSkewVersor3DTransformView::Transform(vtkMatrix4x4* vtkmatrix, vtkTransform* vtktransform, itk::Array<double> transformParams)
{
if (m_MovingImage.IsNotNull())
{
itk::ScaleSkewVersor3DTransform<double>::Pointer versorTransform = itk::ScaleSkewVersor3DTransform<double>::New();
versorTransform->SetParameters(transformParams);
itk::Matrix<double, 3, 3> Matrix = versorTransform->GetMatrix();
for (int i = 0; i < 3; i++)
{
for (int j = 0; j < 3; j++)
{
vtkmatrix->SetElement(i, j, Matrix[i][j]);
}
}
float center[4];
float translation[4];
center[0] = m_CenterX;
center[1] = m_CenterY;
center[2] = m_CenterZ;
center[3] = 1;
vtkmatrix->MultiplyPoint(center, translation);
vtkmatrix->SetElement(0, 3, -translation[0] + center[0] + transformParams[3]);
vtkmatrix->SetElement(1, 3, -translation[1] + center[1] + transformParams[4]);
vtkmatrix->SetElement(2, 3, -translation[2] + center[2] + transformParams[5]);
vtktransform->SetMatrix(vtkmatrix);
}
return vtktransform;
}
int QmitkScaleSkewVersor3DTransformView::GetNumberOfTransformParameters()
{
if (m_FixedImage.IsNotNull())
{
if (m_FixedImage->GetDimension() == 2)
return 0;
else
return 15;
}
else
return 0;
}
diff --git a/Modules/RigidRegistrationUI/RigidRegistrationTransforms/QmitkSimilarity2DTransformView.cpp b/Modules/RigidRegistrationUI/RigidRegistrationTransforms/QmitkSimilarity2DTransformView.cpp
index 52f3b3b69a..16fa157492 100644
--- a/Modules/RigidRegistrationUI/RigidRegistrationTransforms/QmitkSimilarity2DTransformView.cpp
+++ b/Modules/RigidRegistrationUI/RigidRegistrationTransforms/QmitkSimilarity2DTransformView.cpp
@@ -1,173 +1,174 @@
/*=========================================================================
Program: Medical Imaging & Interaction Toolkit
Language: C++
Date: $Date$
Version: $Revision: -1 $
Copyright (c) German Cancer Research Center, Division of Medical and
Biological Informatics. All rights reserved.
See MITKCopyright.txt or http://www.mitk.org/copyright.html for details.
This software is distributed WITHOUT ANY WARRANTY; without even
the implied warranty of MERCHANTABILITY or FITNESS FOR A PARTICULAR
PURPOSE. See the above copyright notices for more information.
=========================================================================*/
#include "QmitkSimilarity2DTransformView.h"
#include "mitkImageAccessByItk.h"
+#include <mitkImageCast.h>
#include <itkSimilarity2DTransform.h>
#include <itkCenteredTransformInitializer.h>
#include <QValidator>
QmitkSimilarity2DTransformView::QmitkSimilarity2DTransformView(QWidget* parent, Qt::WindowFlags f ) : QmitkRigidRegistrationTransformsGUIBase(parent, f),
m_CenterX(0), m_CenterY(0), m_CenterZ(0)
{
}
QmitkSimilarity2DTransformView::~QmitkSimilarity2DTransformView()
{
}
mitk::TransformParameters::TransformType QmitkSimilarity2DTransformView::GetTransformType()
{
return mitk::TransformParameters::SIMILARITY2DTRANSFORM;
}
itk::Object::Pointer QmitkSimilarity2DTransformView::GetTransform()
{
if (m_FixedImage.IsNotNull())
{
AccessByItk(m_FixedImage, GetTransform2);
return m_TransformObject;
}
return NULL;
}
template < class TPixelType, unsigned int VImageDimension >
itk::Object::Pointer QmitkSimilarity2DTransformView::GetTransform2(itk::Image<TPixelType, VImageDimension>* /* itkImage1 */)
{
if (VImageDimension == 2)
{
typedef typename itk::Image< TPixelType, 2 > FixedImage2DType;
typedef typename itk::Image< TPixelType, 2 > MovingImage2DType;
typename FixedImage2DType::Pointer fixedImage2D;
mitk::CastToItkImage(m_FixedImage, fixedImage2D);
typename MovingImage2DType::Pointer movingImage2D;
mitk::CastToItkImage(m_MovingImage, movingImage2D);
typename itk::Similarity2DTransform< double >::Pointer transformPointer = itk::Similarity2DTransform< double >::New();
transformPointer->SetIdentity();
if (m_Controls.m_CenterForInitializerSimilarity2D->isChecked())
{
typedef typename itk::Similarity2DTransform< double > Similarity2DTransformType;
typedef typename itk::CenteredTransformInitializer<Similarity2DTransformType, FixedImage2DType, MovingImage2DType> TransformInitializerType;
typename TransformInitializerType::Pointer transformInitializer = TransformInitializerType::New();
transformInitializer->SetFixedImage( fixedImage2D );
transformInitializer->SetMovingImage( movingImage2D );
transformInitializer->SetTransform( transformPointer );
if (m_Controls.m_MomentsSimilarity2D->isChecked())
{
transformInitializer->MomentsOn();
}
else
{
transformInitializer->GeometryOn();
}
transformInitializer->InitializeTransform();
}
transformPointer->SetScale( m_Controls.m_InitialScaleSimilarity2D->text().toFloat() );
transformPointer->SetAngle( m_Controls.m_AngleSimilarity2D->text().toFloat() );
m_TransformObject = transformPointer.GetPointer();
return transformPointer.GetPointer();
}
return NULL;
}
itk::Array<double> QmitkSimilarity2DTransformView::GetTransformParameters()
{
itk::Array<double> transformValues;
transformValues.SetSize(9);
transformValues.fill(0);
transformValues[0] = m_Controls.m_UseOptimizerScalesSimilarity2D->isChecked();
transformValues[1] = m_Controls.m_ScalingScaleSimilarity2D->text().toDouble();
transformValues[2] = m_Controls.m_RotationScaleSimilarity2D->text().toDouble();
transformValues[3] = m_Controls.m_TranslationXScaleSimilarity2D->text().toDouble();
transformValues[4] = m_Controls.m_TranslationYScaleSimilarity2D->text().toDouble();
transformValues[5] = m_Controls.m_InitialScaleSimilarity2D->text().toFloat();
transformValues[6] = m_Controls.m_AngleSimilarity2D->text().toFloat();
transformValues[7] = m_Controls.m_CenterForInitializerSimilarity2D->isChecked();
transformValues[8] = m_Controls.m_MomentsSimilarity2D->isChecked();
return transformValues;
}
void QmitkSimilarity2DTransformView::SetTransformParameters(itk::Array<double> transformValues)
{
m_Controls.m_UseOptimizerScalesSimilarity2D->setChecked(transformValues[0]);
m_Controls.m_ScalingScaleSimilarity2D->setText(QString::number(transformValues[1]));
m_Controls.m_RotationScaleSimilarity2D->setText(QString::number(transformValues[2]));
m_Controls.m_TranslationXScaleSimilarity2D->setText(QString::number(transformValues[3]));
m_Controls.m_TranslationYScaleSimilarity2D->setText(QString::number(transformValues[4]));
m_Controls.m_InitialScaleSimilarity2D->setText(QString::number(transformValues[5]));
m_Controls.m_AngleSimilarity2D->setText(QString::number(transformValues[6]));
m_Controls.m_CenterForInitializerSimilarity2D->setChecked(transformValues[7]);
m_Controls.m_MomentsSimilarity2D->setChecked(transformValues[8]);
m_Controls.m_GeometrySimilarity2D->setChecked(!transformValues[8]);
}
QString QmitkSimilarity2DTransformView::GetName()
{
return "Similarity2D";
}
void QmitkSimilarity2DTransformView::SetupUI(QWidget* parent)
{
m_Controls.setupUi(parent);
QValidator* validatorLineEditInputFloat = new QDoubleValidator(0, 20000000, 8, this);
m_Controls.m_ScalingScaleSimilarity2D->setValidator(validatorLineEditInputFloat);
m_Controls.m_RotationScaleSimilarity2D->setValidator(validatorLineEditInputFloat);
m_Controls.m_TranslationXScaleSimilarity2D->setValidator(validatorLineEditInputFloat);
m_Controls.m_TranslationYScaleSimilarity2D->setValidator(validatorLineEditInputFloat);
}
itk::Array<double> QmitkSimilarity2DTransformView::GetScales()
{
itk::Array<double> scales;
scales.SetSize(4);
scales.Fill(1.0);
if (m_Controls.m_UseOptimizerScalesSimilarity2D->isChecked())
{
scales[0] = m_Controls.m_ScalingScaleSimilarity2D->text().toDouble();
scales[1] = m_Controls.m_RotationScaleSimilarity2D->text().toDouble();
scales[2] = m_Controls.m_TranslationXScaleSimilarity2D->text().toDouble();
scales[3] = m_Controls.m_TranslationYScaleSimilarity2D->text().toDouble();
}
return scales;
}
vtkTransform* QmitkSimilarity2DTransformView::Transform(vtkMatrix4x4* /* vtkmatrix */, vtkTransform* vtktransform, itk::Array<double> transformParams)
{
if (m_MovingImage.IsNotNull())
{
mitk::ScalarType angle = transformParams[1] * 45.0 / atan(1.0);
vtktransform->PostMultiply();
vtktransform->Scale(transformParams[0], transformParams[0], 1);
vtktransform->RotateZ(angle);
vtktransform->Translate(transformParams[2], transformParams[3], 0);
vtktransform->PreMultiply();
}
return vtktransform;
}
int QmitkSimilarity2DTransformView::GetNumberOfTransformParameters()
{
if (m_FixedImage.IsNotNull())
{
if (m_FixedImage->GetDimension() == 2)
return 4;
else
return 0;
}
else
return 0;
}
diff --git a/Modules/RigidRegistrationUI/RigidRegistrationTransforms/QmitkSimilarity3DTransformView.cpp b/Modules/RigidRegistrationUI/RigidRegistrationTransforms/QmitkSimilarity3DTransformView.cpp
index 05f298bbf3..0bfc2b9cb4 100644
--- a/Modules/RigidRegistrationUI/RigidRegistrationTransforms/QmitkSimilarity3DTransformView.cpp
+++ b/Modules/RigidRegistrationUI/RigidRegistrationTransforms/QmitkSimilarity3DTransformView.cpp
@@ -1,197 +1,198 @@
/*=========================================================================
Program: Medical Imaging & Interaction Toolkit
Language: C++
Date: $Date$
Version: $Revision: -1 $
Copyright (c) German Cancer Research Center, Division of Medical and
Biological Informatics. All rights reserved.
See MITKCopyright.txt or http://www.mitk.org/copyright.html for details.
This software is distributed WITHOUT ANY WARRANTY; without even
the implied warranty of MERCHANTABILITY or FITNESS FOR A PARTICULAR
PURPOSE. See the above copyright notices for more information.
=========================================================================*/
#include "QmitkSimilarity3DTransformView.h"
#include "mitkImageAccessByItk.h"
+#include <mitkImageCast.h>
#include <itkSimilarity3DTransform.h>
#include <itkCenteredTransformInitializer.h>
#include <QValidator>
QmitkSimilarity3DTransformView::QmitkSimilarity3DTransformView(QWidget* parent, Qt::WindowFlags f ) : QmitkRigidRegistrationTransformsGUIBase(parent, f),
m_CenterX(0), m_CenterY(0), m_CenterZ(0)
{
}
QmitkSimilarity3DTransformView::~QmitkSimilarity3DTransformView()
{
}
mitk::TransformParameters::TransformType QmitkSimilarity3DTransformView::GetTransformType()
{
return mitk::TransformParameters::SIMILARITY3DTRANSFORM;
}
itk::Object::Pointer QmitkSimilarity3DTransformView::GetTransform()
{
if (m_FixedImage.IsNotNull())
{
AccessByItk(m_FixedImage, GetTransform2);
return m_TransformObject;
}
return NULL;
}
template < class TPixelType, unsigned int VImageDimension >
itk::Object::Pointer QmitkSimilarity3DTransformView::GetTransform2(itk::Image<TPixelType, VImageDimension>* /*itkImage1*/)
{
if (VImageDimension == 3)
{
typedef typename itk::Image< TPixelType, 3 > FixedImage3DType;
typedef typename itk::Image< TPixelType, 3 > MovingImage3DType;
typename FixedImage3DType::Pointer fixedImage3D;
mitk::CastToItkImage(m_FixedImage, fixedImage3D);
typename MovingImage3DType::Pointer movingImage3D;
mitk::CastToItkImage(m_MovingImage, movingImage3D);
typename itk::Similarity3DTransform< double >::Pointer transformPointer = itk::Similarity3DTransform< double >::New();
transformPointer->SetIdentity();
if (m_Controls.m_CenterForInitializerSimilarity3D->isChecked())
{
typedef typename itk::Similarity3DTransform< double > Similarity3DTransformType;
typedef typename itk::CenteredTransformInitializer<Similarity3DTransformType, FixedImage3DType, MovingImage3DType> TransformInitializerType;
typename TransformInitializerType::Pointer transformInitializer = TransformInitializerType::New();
transformInitializer->SetFixedImage( fixedImage3D );
transformInitializer->SetMovingImage( movingImage3D );
transformInitializer->SetTransform( transformPointer );
if (m_Controls.m_MomentsSimilarity3D->isChecked())
{
transformInitializer->MomentsOn();
}
else
{
transformInitializer->GeometryOn();
}
transformInitializer->InitializeTransform();
}
m_CenterX = transformPointer->GetCenter()[0];
m_CenterY = transformPointer->GetCenter()[1];
m_CenterZ = transformPointer->GetCenter()[2];
m_TransformObject = transformPointer.GetPointer();
return transformPointer.GetPointer();
}
return NULL;
}
itk::Array<double> QmitkSimilarity3DTransformView::GetTransformParameters()
{
itk::Array<double> transformValues;
transformValues.SetSize(10);
transformValues.fill(0);
transformValues[0] = m_Controls.m_UseOptimizerScalesSimilarity3D->isChecked();
transformValues[1] = m_Controls.m_ScalesSimilarity3DTransformScale1->text().toDouble();
transformValues[2] = m_Controls.m_ScalesSimilarity3DTransformScale2->text().toDouble();
transformValues[3] = m_Controls.m_ScalesSimilarity3DTransformScale3->text().toDouble();
transformValues[4] = m_Controls.m_ScalesSimilarity3DTransformScale4->text().toDouble();
transformValues[5] = m_Controls.m_ScalesSimilarity3DTransformScaleTranslationX->text().toDouble();
transformValues[6] = m_Controls.m_ScalesSimilarity3DTransformScaleTranslationY->text().toDouble();
transformValues[7] = m_Controls.m_ScalesSimilarity3DTransformScaleTranslationZ->text().toDouble();
transformValues[8] = m_Controls.m_CenterForInitializerSimilarity3D->isChecked();
transformValues[9] = m_Controls.m_MomentsSimilarity3D->isChecked();
return transformValues;
}
void QmitkSimilarity3DTransformView::SetTransformParameters(itk::Array<double> transformValues)
{
m_Controls.m_UseOptimizerScalesSimilarity3D->setChecked(transformValues[0]);
m_Controls.m_ScalesSimilarity3DTransformScale1->setText(QString::number(transformValues[1]));
m_Controls.m_ScalesSimilarity3DTransformScale2->setText(QString::number(transformValues[2]));
m_Controls.m_ScalesSimilarity3DTransformScale3->setText(QString::number(transformValues[3]));
m_Controls.m_ScalesSimilarity3DTransformScale4->setText(QString::number(transformValues[4]));
m_Controls.m_ScalesSimilarity3DTransformScaleTranslationX->setText(QString::number(transformValues[5]));
m_Controls.m_ScalesSimilarity3DTransformScaleTranslationY->setText(QString::number(transformValues[6]));
m_Controls.m_ScalesSimilarity3DTransformScaleTranslationZ->setText(QString::number(transformValues[7]));
m_Controls.m_CenterForInitializerSimilarity3D->setChecked(transformValues[8]);
m_Controls.m_MomentsSimilarity3D->setChecked(transformValues[9]);
m_Controls.m_GeometrySimilarity3D->setChecked(!transformValues[9]);
}
QString QmitkSimilarity3DTransformView::GetName()
{
return "Similarity3D";
}
void QmitkSimilarity3DTransformView::SetupUI(QWidget* parent)
{
m_Controls.setupUi(parent);
QValidator* validatorLineEditInputFloat = new QDoubleValidator(0, 20000000, 8, this);
m_Controls.m_ScalesSimilarity3DTransformScale1->setValidator(validatorLineEditInputFloat);
m_Controls.m_ScalesSimilarity3DTransformScale2->setValidator(validatorLineEditInputFloat);
m_Controls.m_ScalesSimilarity3DTransformScale3->setValidator(validatorLineEditInputFloat);
m_Controls.m_ScalesSimilarity3DTransformScale4->setValidator(validatorLineEditInputFloat);
m_Controls.m_ScalesSimilarity3DTransformScaleTranslationX->setValidator(validatorLineEditInputFloat);
m_Controls.m_ScalesSimilarity3DTransformScaleTranslationY->setValidator(validatorLineEditInputFloat);
m_Controls.m_ScalesSimilarity3DTransformScaleTranslationZ->setValidator(validatorLineEditInputFloat);
}
itk::Array<double> QmitkSimilarity3DTransformView::GetScales()
{
itk::Array<double> scales;
scales.SetSize(7);
scales.Fill(1.0);
if (m_Controls.m_UseOptimizerScalesSimilarity3D->isChecked())
{
scales[0] = m_Controls.m_ScalesSimilarity3DTransformScale1->text().toDouble();
scales[1] = m_Controls.m_ScalesSimilarity3DTransformScale2->text().toDouble();
scales[2] = m_Controls.m_ScalesSimilarity3DTransformScale3->text().toDouble();
scales[3] = m_Controls.m_ScalesSimilarity3DTransformScale4->text().toDouble();
scales[4] = m_Controls.m_ScalesSimilarity3DTransformScaleTranslationX->text().toDouble();
scales[5] = m_Controls.m_ScalesSimilarity3DTransformScaleTranslationY->text().toDouble();
scales[6] = m_Controls.m_ScalesSimilarity3DTransformScaleTranslationZ->text().toDouble();
}
return scales;
}
vtkTransform* QmitkSimilarity3DTransformView::Transform(vtkMatrix4x4* vtkmatrix, vtkTransform* vtktransform, itk::Array<double> transformParams)
{
if (m_MovingImage.IsNotNull())
{
itk::Similarity3DTransform<double>::Pointer similarityTransform = itk::Similarity3DTransform<double>::New();
similarityTransform->SetParameters(transformParams);
itk::Matrix<double, 3, 3> Matrix = similarityTransform->GetMatrix();
for (int i = 0; i < 3; i++)
{
for (int j = 0; j < 3; j++)
{
vtkmatrix->SetElement(i, j, Matrix[i][j]);
}
}
float center[4];
float translation[4];
center[0] = m_CenterX;
center[1] = m_CenterY;
center[2] = m_CenterZ;
center[3] = 1;
vtkmatrix->MultiplyPoint(center, translation);
vtkmatrix->SetElement(0, 3, -translation[0] + center[0] + transformParams[4]);
vtkmatrix->SetElement(1, 3, -translation[1] + center[1] + transformParams[5]);
vtkmatrix->SetElement(2, 3, -translation[2] + center[2] + transformParams[6]);
vtktransform->SetMatrix(vtkmatrix);
}
return vtktransform;
}
int QmitkSimilarity3DTransformView::GetNumberOfTransformParameters()
{
if (m_FixedImage.IsNotNull())
{
if (m_FixedImage->GetDimension() == 2)
return 0;
else
return 7;
}
else
return 0;
}
diff --git a/Modules/RigidRegistrationUI/RigidRegistrationTransforms/QmitkVersorRigid3DTransformView.cpp b/Modules/RigidRegistrationUI/RigidRegistrationTransforms/QmitkVersorRigid3DTransformView.cpp
index e0c5b62e03..3ec9a4a320 100644
--- a/Modules/RigidRegistrationUI/RigidRegistrationTransforms/QmitkVersorRigid3DTransformView.cpp
+++ b/Modules/RigidRegistrationUI/RigidRegistrationTransforms/QmitkVersorRigid3DTransformView.cpp
@@ -1,208 +1,209 @@
/*=========================================================================
Program: Medical Imaging & Interaction Toolkit
Language: C++
Date: $Date$
Version: $Revision: -1 $
Copyright (c) German Cancer Research Center, Division of Medical and
Biological Informatics. All rights reserved.
See MITKCopyright.txt or http://www.mitk.org/copyright.html for details.
This software is distributed WITHOUT ANY WARRANTY; without even
the implied warranty of MERCHANTABILITY or FITNESS FOR A PARTICULAR
PURPOSE. See the above copyright notices for more information.
=========================================================================*/
#include "QmitkVersorRigid3DTransformView.h"
#include "mitkImageAccessByItk.h"
+#include <mitkImageCast.h>
#include <itkVersorRigid3DTransform.h>
#include <itkCenteredTransformInitializer.h>
#include <QValidator>
QmitkVersorRigid3DTransformView::QmitkVersorRigid3DTransformView(QWidget* parent, Qt::WindowFlags f ) : QmitkRigidRegistrationTransformsGUIBase(parent, f),
m_CenterX(0), m_CenterY(0), m_CenterZ(0)
{
}
QmitkVersorRigid3DTransformView::~QmitkVersorRigid3DTransformView()
{
}
mitk::TransformParameters::TransformType QmitkVersorRigid3DTransformView::GetTransformType()
{
return mitk::TransformParameters::VERSORRIGID3DTRANSFORM;
}
itk::Object::Pointer QmitkVersorRigid3DTransformView::GetTransform()
{
if (m_FixedImage.IsNotNull())
{
AccessByItk(m_FixedImage, GetTransform2);
return m_TransformObject;
}
return NULL;
}
template < class TPixelType, unsigned int VImageDimension >
itk::Object::Pointer QmitkVersorRigid3DTransformView::GetTransform2(itk::Image<TPixelType, VImageDimension>* /*itkImage1*/)
{
if (VImageDimension == 3)
{
typedef typename itk::Image< TPixelType, 3 > FixedImage3DType;
typedef typename itk::Image< TPixelType, 3 > MovingImage3DType;
typename FixedImage3DType::Pointer fixedImage3D;
mitk::CastToItkImage(m_FixedImage, fixedImage3D);
typename MovingImage3DType::Pointer movingImage3D;
mitk::CastToItkImage(m_MovingImage, movingImage3D);
typename itk::VersorRigid3DTransform< double >::Pointer transformPointer = itk::VersorRigid3DTransform< double >::New();
transformPointer->SetIdentity();
typedef typename itk::VersorRigid3DTransform< double > VersorRigid3DTransformType;
if (m_Controls.m_CenterForInitializerVersorRigid3D->isChecked())
{
typedef typename itk::CenteredTransformInitializer<VersorRigid3DTransformType, FixedImage3DType, MovingImage3DType> TransformInitializerType;
typename TransformInitializerType::Pointer transformInitializer = TransformInitializerType::New();
transformInitializer->SetFixedImage( fixedImage3D );
transformInitializer->SetMovingImage( movingImage3D );
transformInitializer->SetTransform( transformPointer );
if (m_Controls.m_MomentsVersorRigid3D->isChecked())
{
transformInitializer->MomentsOn();
}
else
{
transformInitializer->GeometryOn();
}
transformInitializer->InitializeTransform();
}
typedef VersorRigid3DTransformType::VersorType VersorType;
typedef VersorType::VectorType VectorType;
VersorType rotation;
VectorType axis;
axis[0] = 0.0;
axis[1] = 0.0;
axis[2] = 1.0;
const double angle = 0;
rotation.Set( axis, angle );
transformPointer->SetRotation( rotation );
m_CenterX = transformPointer->GetCenter()[0];
m_CenterY = transformPointer->GetCenter()[1];
m_CenterZ = transformPointer->GetCenter()[2];
m_TransformObject = transformPointer.GetPointer();
return transformPointer.GetPointer();
}
return NULL;
}
itk::Array<double> QmitkVersorRigid3DTransformView::GetTransformParameters()
{
itk::Array<double> transformValues;
transformValues.SetSize(9);
transformValues.fill(0);
transformValues[0] = m_Controls.m_UseOptimizerScalesVersorRigid3D->isChecked();
transformValues[1] = m_Controls.m_ScalesVersorRigid3DTransformScale1->text().toDouble();
transformValues[2] = m_Controls.m_ScalesVersorRigid3DTransformScale2->text().toDouble();
transformValues[3] = m_Controls.m_ScalesVersorRigid3DTransformScale3->text().toDouble();
transformValues[4] = m_Controls.m_ScalesVersorRigid3DTransformScaleTranslationX->text().toDouble();
transformValues[5] = m_Controls.m_ScalesVersorRigid3DTransformScaleTranslationY->text().toDouble();
transformValues[6] = m_Controls.m_ScalesVersorRigid3DTransformScaleTranslationZ->text().toDouble();
transformValues[7] = m_Controls.m_CenterForInitializerVersorRigid3D->isChecked();
transformValues[8] = m_Controls.m_MomentsVersorRigid3D->isChecked();
return transformValues;
}
void QmitkVersorRigid3DTransformView::SetTransformParameters(itk::Array<double> transformValues)
{
m_Controls.m_UseOptimizerScalesVersorRigid3D->setChecked(transformValues[0]);
m_Controls.m_ScalesVersorRigid3DTransformScale1->setText(QString::number(transformValues[1]));
m_Controls.m_ScalesVersorRigid3DTransformScale2->setText(QString::number(transformValues[2]));
m_Controls.m_ScalesVersorRigid3DTransformScale3->setText(QString::number(transformValues[3]));
m_Controls.m_ScalesVersorRigid3DTransformScaleTranslationX->setText(QString::number(transformValues[4]));
m_Controls.m_ScalesVersorRigid3DTransformScaleTranslationY->setText(QString::number(transformValues[5]));
m_Controls.m_ScalesVersorRigid3DTransformScaleTranslationZ->setText(QString::number(transformValues[6]));
m_Controls.m_CenterForInitializerVersorRigid3D->setChecked(transformValues[7]);
m_Controls.m_MomentsVersorRigid3D->setChecked(transformValues[8]);
m_Controls.m_GeometryVersorRigid3D->setChecked(!transformValues[8]);
}
QString QmitkVersorRigid3DTransformView::GetName()
{
return "VersorRigid3D";
}
void QmitkVersorRigid3DTransformView::SetupUI(QWidget* parent)
{
m_Controls.setupUi(parent);
QValidator* validatorLineEditInputFloat = new QDoubleValidator(0, 20000000, 8, this);
m_Controls.m_ScalesVersorRigid3DTransformScale1->setValidator(validatorLineEditInputFloat);
m_Controls.m_ScalesVersorRigid3DTransformScale2->setValidator(validatorLineEditInputFloat);
m_Controls.m_ScalesVersorRigid3DTransformScale3->setValidator(validatorLineEditInputFloat);
m_Controls.m_ScalesVersorRigid3DTransformScaleTranslationX->setValidator(validatorLineEditInputFloat);
m_Controls.m_ScalesVersorRigid3DTransformScaleTranslationY->setValidator(validatorLineEditInputFloat);
m_Controls.m_ScalesVersorRigid3DTransformScaleTranslationZ->setValidator(validatorLineEditInputFloat);
}
itk::Array<double> QmitkVersorRigid3DTransformView::GetScales()
{
itk::Array<double> scales;
scales.SetSize(6);
scales.Fill(1.0);
if (m_Controls.m_UseOptimizerScalesVersorRigid3D->isChecked())
{
scales[0] = m_Controls.m_ScalesVersorRigid3DTransformScale1->text().toDouble();
scales[1] = m_Controls.m_ScalesVersorRigid3DTransformScale2->text().toDouble();
scales[2] = m_Controls.m_ScalesVersorRigid3DTransformScale3->text().toDouble();
scales[3] = m_Controls.m_ScalesVersorRigid3DTransformScaleTranslationX->text().toDouble();
scales[4] = m_Controls.m_ScalesVersorRigid3DTransformScaleTranslationY->text().toDouble();
scales[5] = m_Controls.m_ScalesVersorRigid3DTransformScaleTranslationZ->text().toDouble();
}
return scales;
}
vtkTransform* QmitkVersorRigid3DTransformView::Transform(vtkMatrix4x4* vtkmatrix, vtkTransform* vtktransform, itk::Array<double> transformParams)
{
if (m_MovingImage.IsNotNull())
{
itk::VersorRigid3DTransform<double>::Pointer versorTransform = itk::VersorRigid3DTransform<double>::New();
versorTransform->SetParameters(transformParams);
itk::Matrix<double, 3, 3> Matrix = versorTransform->GetMatrix();
for (int i = 0; i < 3; i++)
{
for (int j = 0; j < 3; j++)
{
vtkmatrix->SetElement(i, j, Matrix[i][j]);
}
}
float center[4];
float translation[4];
center[0] = m_CenterX;
center[1] = m_CenterY;
center[2] = m_CenterZ;
center[3] = 1;
vtkmatrix->MultiplyPoint(center, translation);
vtkmatrix->SetElement(0, 3, -translation[0] + center[0] + transformParams[3]);
vtkmatrix->SetElement(1, 3, -translation[1] + center[1] + transformParams[4]);
vtkmatrix->SetElement(2, 3, -translation[2] + center[2] + transformParams[5]);
vtktransform->SetMatrix(vtkmatrix);
}
return vtktransform;
}
int QmitkVersorRigid3DTransformView::GetNumberOfTransformParameters()
{
if (m_FixedImage.IsNotNull())
{
if (m_FixedImage->GetDimension() == 2)
return 0;
else
return 6;
}
else
return 0;
}
diff --git a/Modules/RigidRegistrationUI/RigidRegistrationTransforms/QmitkVersorTransformView.cpp b/Modules/RigidRegistrationUI/RigidRegistrationTransforms/QmitkVersorTransformView.cpp
index 77d6d5e965..7eb2c4a033 100644
--- a/Modules/RigidRegistrationUI/RigidRegistrationTransforms/QmitkVersorTransformView.cpp
+++ b/Modules/RigidRegistrationUI/RigidRegistrationTransforms/QmitkVersorTransformView.cpp
@@ -1,181 +1,182 @@
/*=========================================================================
Program: Medical Imaging & Interaction Toolkit
Language: C++
Date: $Date$
Version: $Revision: -1 $
Copyright (c) German Cancer Research Center, Division of Medical and
Biological Informatics. All rights reserved.
See MITKCopyright.txt or http://www.mitk.org/copyright.html for details.
This software is distributed WITHOUT ANY WARRANTY; without even
the implied warranty of MERCHANTABILITY or FITNESS FOR A PARTICULAR
PURPOSE. See the above copyright notices for more information.
=========================================================================*/
#include "QmitkVersorTransformView.h"
#include "mitkImageAccessByItk.h"
+#include <mitkImageCast.h>
#include <itkVersorTransform.h>
#include <itkCenteredTransformInitializer.h>
#include <QValidator>
QmitkVersorTransformView::QmitkVersorTransformView(QWidget* parent, Qt::WindowFlags f ) : QmitkRigidRegistrationTransformsGUIBase(parent, f),
m_CenterX(0), m_CenterY(0), m_CenterZ(0)
{
}
QmitkVersorTransformView::~QmitkVersorTransformView()
{
}
mitk::TransformParameters::TransformType QmitkVersorTransformView::GetTransformType()
{
return mitk::TransformParameters::VERSORTRANSFORM;
}
itk::Object::Pointer QmitkVersorTransformView::GetTransform()
{
if (m_FixedImage.IsNotNull())
{
AccessByItk(m_FixedImage, GetTransform2);
return m_TransformObject;
}
return NULL;
}
template < class TPixelType, unsigned int VImageDimension >
itk::Object::Pointer QmitkVersorTransformView::GetTransform2(itk::Image<TPixelType, VImageDimension>* /*itkImage1*/)
{
if (VImageDimension == 3)
{
typedef typename itk::Image< TPixelType, 3 > FixedImage3DType;
typedef typename itk::Image< TPixelType, 3 > MovingImage3DType;
typename FixedImage3DType::Pointer fixedImage3D;
mitk::CastToItkImage(m_FixedImage, fixedImage3D);
typename MovingImage3DType::Pointer movingImage3D;
mitk::CastToItkImage(m_MovingImage, movingImage3D);
typename itk::VersorTransform< double >::Pointer transformPointer = itk::VersorTransform< double >::New();
transformPointer->SetIdentity();
typedef typename itk::VersorTransform< double > VersorTransformType;
if (m_Controls.m_CenterForInitializerVersor->isChecked())
{
typedef typename itk::CenteredTransformInitializer<VersorTransformType, FixedImage3DType, MovingImage3DType> TransformInitializerType;
typename TransformInitializerType::Pointer transformInitializer = TransformInitializerType::New();
transformInitializer->SetFixedImage( fixedImage3D );
transformInitializer->SetMovingImage( movingImage3D );
transformInitializer->SetTransform( transformPointer );
if (m_Controls.m_MomentsVersor->isChecked())
{
transformInitializer->MomentsOn();
}
else
{
transformInitializer->GeometryOn();
}
transformInitializer->InitializeTransform();
}
m_CenterX = transformPointer->GetCenter()[0];
m_CenterY = transformPointer->GetCenter()[1];
m_CenterZ = transformPointer->GetCenter()[2];
m_TransformObject = transformPointer.GetPointer();
return transformPointer.GetPointer();
}
return NULL;
}
itk::Array<double> QmitkVersorTransformView::GetTransformParameters()
{
itk::Array<double> transformValues;
transformValues.SetSize(6);
transformValues.fill(0);
transformValues[0] = m_Controls.m_UseOptimizerScalesVersor->isChecked();
transformValues[1] = m_Controls.m_ScalesVersorTransformScale1->text().toDouble();
transformValues[2] = m_Controls.m_ScalesVersorTransformScale2->text().toDouble();
transformValues[3] = m_Controls.m_ScalesVersorTransformScale3->text().toDouble();
transformValues[4] = m_Controls.m_CenterForInitializerVersor->isChecked();
transformValues[5] = m_Controls.m_MomentsVersor->isChecked();
return transformValues;
}
void QmitkVersorTransformView::SetTransformParameters(itk::Array<double> transformValues)
{
m_Controls.m_UseOptimizerScalesVersor->setChecked(transformValues[0]);
m_Controls.m_ScalesVersorTransformScale1->setText(QString::number(transformValues[1]));
m_Controls.m_ScalesVersorTransformScale2->setText(QString::number(transformValues[2]));
m_Controls.m_ScalesVersorTransformScale3->setText(QString::number(transformValues[3]));
m_Controls.m_CenterForInitializerVersor->setChecked(transformValues[4]);
m_Controls.m_MomentsVersor->setChecked(transformValues[5]);
m_Controls.m_GeometryVersor->setChecked(!transformValues[5]);
}
QString QmitkVersorTransformView::GetName()
{
return "Versor";
}
void QmitkVersorTransformView::SetupUI(QWidget* parent)
{
m_Controls.setupUi(parent);
QValidator* validatorLineEditInputFloat = new QDoubleValidator(0, 20000000, 8, this);
m_Controls.m_ScalesVersorTransformScale1->setValidator(validatorLineEditInputFloat);
m_Controls.m_ScalesVersorTransformScale2->setValidator(validatorLineEditInputFloat);
m_Controls.m_ScalesVersorTransformScale3->setValidator(validatorLineEditInputFloat);
}
itk::Array<double> QmitkVersorTransformView::GetScales()
{
itk::Array<double> scales;
scales.SetSize(3);
scales.Fill(1.0);
if (m_Controls.m_UseOptimizerScalesVersor->isChecked())
{
scales[0] = m_Controls.m_ScalesVersorTransformScale1->text().toDouble();
scales[1] = m_Controls.m_ScalesVersorTransformScale2->text().toDouble();
scales[2] = m_Controls.m_ScalesVersorTransformScale3->text().toDouble();
}
return scales;
}
vtkTransform* QmitkVersorTransformView::Transform(vtkMatrix4x4* vtkmatrix, vtkTransform* vtktransform, itk::Array<double> transformParams)
{
if (m_MovingImage.IsNotNull())
{
itk::VersorTransform<double>::Pointer versorTransform = itk::VersorTransform<double>::New();
versorTransform->SetParameters(transformParams);
itk::Matrix<double, 3, 3> Matrix = versorTransform->GetMatrix();
for (int i = 0; i < 3; i++)
{
for (int j = 0; j < 3; j++)
{
vtkmatrix->SetElement(i, j, Matrix[i][j]);
}
}
float center[4];
float translation[4];
center[0] = m_CenterX;
center[1] = m_CenterY;
center[2] = m_CenterZ;
center[3] = 1;
vtkmatrix->MultiplyPoint(center, translation);
vtkmatrix->SetElement(0, 3, -translation[0] + center[0]);
vtkmatrix->SetElement(1, 3, -translation[1] + center[1]);
vtkmatrix->SetElement(2, 3, -translation[2] + center[2]);
vtktransform->SetMatrix(vtkmatrix);
}
return vtktransform;
}
int QmitkVersorTransformView::GetNumberOfTransformParameters()
{
if (m_FixedImage.IsNotNull())
{
if (m_FixedImage->GetDimension() == 2)
return 0;
else
return 3;
}
else
return 0;
}
diff --git a/Modules/SceneSerialization/Testing/mitkSceneIOTest.cpp b/Modules/SceneSerialization/Testing/mitkSceneIOTest.cpp
index d8acf244e3..00fe024829 100644
--- a/Modules/SceneSerialization/Testing/mitkSceneIOTest.cpp
+++ b/Modules/SceneSerialization/Testing/mitkSceneIOTest.cpp
@@ -1,339 +1,339 @@
/*=========================================================================
Program: Medical Imaging & Interaction Toolkit
Language: C++
Date: $Date$
Version: $Revision: 1.12 $
Copyright (c) German Cancer Research Center, Division of Medical and
Biological Informatics. All rights reserved.
See MITKCopyright.txt or http://www.mitk.org/copyright.html for details.
This software is distributed WITHOUT ANY WARRANTY; without even
the implied warranty of MERCHANTABILITY or FITNESS FOR A PARTICULAR
PURPOSE. See the above copyright notices for more information.
=========================================================================*/
#include "mitkTestingMacros.h"
#include "mitkTestingConfig.h"
#include "mitkSceneIO.h"
#include "mitkStandaloneDataStorage.h"
#include "mitkStandardFileLocations.h"
#include "mitkDataNodeFactory.h"
#include "mitkCoreObjectFactory.h"
#include "mitkBaseData.h"
#include "mitkImage.h"
#include "mitkSurface.h"
#include "mitkPointSet.h"
#include "Poco/File.h"
#include "Poco/TemporaryFile.h"
#ifndef WIN32
#include <ulimit.h>
#include <errno.h>
#endif
class SceneIOTestClass
{
public:
static mitk::BaseData::Pointer LoadBaseData(const std::string& filename)
{
mitk::DataNodeFactory::Pointer factory = mitk::DataNodeFactory::New();
try
{
factory->SetFileName( filename );
factory->Update();
if(factory->GetNumberOfOutputs()<1)
{
MITK_TEST_FAILED_MSG(<< "Could not find test data '" << filename << "'");
}
mitk::DataNode::Pointer node = factory->GetOutput( 0 );
return node->GetData();
}
catch ( itk::ExceptionObject & e )
{
MITK_TEST_FAILED_MSG(<< "Failed loading test data '" << filename << "': " << e.what());
}
}
static mitk::Image::Pointer LoadImage(const std::string& filename)
{
mitk::BaseData::Pointer basedata = LoadBaseData( filename );
mitk::Image::Pointer image = dynamic_cast<mitk::Image*>(basedata.GetPointer());
if(image.IsNull())
{
MITK_TEST_FAILED_MSG(<< "Test image '" << filename << "' was not loaded as an mitk::Image");
}
return image;
}
static mitk::Surface::Pointer LoadSurface(const std::string& filename)
{
mitk::BaseData::Pointer basedata = LoadBaseData( filename );
mitk::Surface::Pointer surface = dynamic_cast<mitk::Surface*>(basedata.GetPointer());
if(surface.IsNull())
{
MITK_TEST_FAILED_MSG(<< "Test surface '" << filename << "' was not loaded as an mitk::Surface");
}
return surface;
}
static mitk::PointSet::Pointer CreatePointSet()
{
mitk::PointSet::Pointer ps = mitk::PointSet::New();
mitk::PointSet::PointType p;
mitk::FillVector3D(p, 1.0, -2.0, 33.0);
ps->SetPoint(0, p);
mitk::FillVector3D(p, 100.0, -200.0, 3300.0);
ps->SetPoint(1, p);
mitk::FillVector3D(p, 2.0, -3.0, 22.0);
ps->SetPoint(2, p, mitk::PTCORNER); // add point spec
//mitk::FillVector3D(p, -2.0, -2.0, -2.22);
//ps->SetPoint(0, p, 1); // ID 0 in timestep 1
//mitk::FillVector3D(p, -1.0, -1.0, -11.22);
//ps->SetPoint(1, p, 1); // ID 1 in timestep 1
//mitk::FillVector3D(p, 1000.0, 1000.0, 1122.22);
//ps->SetPoint(11, p, mitk::PTCORNER, 2); // ID 11, point spec, timestep 2
return ps;
}
static void FillStorage(mitk::DataStorage* storage, std::string imageName, std::string surfaceName)
{
mitk::Image::Pointer image = LoadImage(imageName);
MITK_TEST_CONDITION_REQUIRED(image.IsNotNull(),"Loading test image Pic3D.pic.gz");
image->SetProperty("image type", mitk::StringProperty::New("test image") );
image->SetProperty("greetings", mitk::StringProperty::New("to mom") );
mitk::DataNode::Pointer imagenode = mitk::DataNode::New();
imagenode->SetData( image );
imagenode->SetName( "Pic3D" );
storage->Add( imagenode );
mitk::DataNode::Pointer imagechildnode = mitk::DataNode::New();
imagechildnode->SetData( image );
imagechildnode->SetName( "Pic3D again" );
storage->Add( imagechildnode, imagenode );
mitk::Surface::Pointer surface = LoadSurface(surfaceName );
MITK_TEST_CONDITION_REQUIRED(surface.IsNotNull(),"Loading test surface binary.stl");
surface->SetProperty("surface type", mitk::StringProperty::New("test surface") );
surface->SetProperty("greetings", mitk::StringProperty::New("to dad") );
mitk::DataNode::Pointer surfacenode = mitk::DataNode::New();
surfacenode->SetData( surface );
surfacenode->SetName( "binary" );
storage->Add( surfacenode );
mitk::PointSet::Pointer ps = CreatePointSet();
mitk::DataNode::Pointer psenode = mitk::DataNode::New();
psenode->SetData( ps );
psenode->SetName( "points" );
storage->Add( psenode );
}
static void VerifyStorage(mitk::DataStorage* storage)
{
//TODO the Surface and PointSet are uncommented until the material property is saved properly
mitk::DataNode::Pointer imagenode = storage->GetNamedNode("Pic3D");
MITK_TEST_CONDITION_REQUIRED(imagenode.IsNotNull(),"Get previously stored image node");
//Image
std::string testString("");
imagenode->GetStringProperty("image type", testString);
MITK_TEST_CONDITION_REQUIRED(!(testString == "test image") ,"Get StringProperty from previously stored image node");
imagenode->GetStringProperty("greetings", testString);
MITK_TEST_CONDITION_REQUIRED(!(testString == "to mom") ,"Get another StringProperty from previously stored image node");
mitk::Image::Pointer image = dynamic_cast<mitk::Image*>(imagenode->GetData());
MITK_TEST_CONDITION_REQUIRED(image.IsNotNull(),"Loading test image from Datastorage");
//Get Image child node
mitk::DataNode::Pointer imagechildnode = storage->GetNamedNode("Pic3D again");
mitk::DataStorage::SetOfObjects::ConstPointer objects = storage->GetSources(imagechildnode);
MITK_TEST_CONDITION_REQUIRED(objects->Size() == 1,"Check size of image child nodes source list");
MITK_TEST_CONDITION_REQUIRED(objects->ElementAt(0) == imagenode,"Check for right parent node");
mitk::Image::Pointer imagechild = dynamic_cast<mitk::Image*>(imagechildnode->GetData());
MITK_TEST_CONDITION_REQUIRED(imagechild.IsNotNull(),"Loading child test image from Datastorage");
//Surface
mitk::DataNode::Pointer surfacenode = storage->GetNamedNode("binary");
MITK_TEST_CONDITION_REQUIRED(surfacenode.IsNotNull(),"Get previously stored surface node");
surfacenode->GetStringProperty("surface type", testString);
MITK_TEST_CONDITION_REQUIRED(!(testString.compare("test surface") == 0) ,"Get StringProperty from previously stored surface node");
surfacenode->GetStringProperty("greetings", testString);
MITK_TEST_CONDITION_REQUIRED(!(testString.compare("to dad") == 0) ,"Get another StringProperty from previously stored surface node");
mitk::Surface::Pointer surface = dynamic_cast<mitk::Surface*>(surfacenode->GetData());
MITK_TEST_CONDITION_REQUIRED(surface.IsNotNull(),"Loading test surface from Datastorage");
//PointSet
mitk::DataNode::Pointer pointsnode = storage->GetNamedNode("points");
MITK_TEST_CONDITION_REQUIRED(pointsnode.IsNotNull(),"Get previously stored PointSet node");
mitk::PointSet::Pointer pointset = dynamic_cast<mitk::PointSet*>(pointsnode->GetData());
MITK_TEST_CONDITION_REQUIRED(pointset.IsNotNull(),"Loading test PointSet from Datastorage");
mitk::PointSet::PointType p = pointset->GetPoint(0);
MITK_TEST_CONDITION_REQUIRED(p[0] == 1.0 && p[1] == -2.0 && p[2] == 33.0, "Test Pointset entry 0 after loading");
p = pointset->GetPoint(1);
MITK_TEST_CONDITION_REQUIRED(p[0] == 100.0 && p[1] == -200.0 && p[2] == 3300.0, "Test Pointset entry 1 after loading");
p = pointset->GetPoint(2);
MITK_TEST_CONDITION_REQUIRED(p[0] == 2.0 && p[1] == -3.0 && p[2] == 22.0, "Test Pointset entry 2 after loading");
}
}; // end test helper class
int mitkSceneIOTest(int argc, char* argv[])
{
MITK_TEST_BEGIN("SceneIO")
std::string sceneFileName;
for (unsigned int i = 0; i < 1; ++i) // TODO change to " < 2" to check cases where file system would be full
{
if (i == 1)
{
// call ulimit and restrict maximum file size to something small
#ifndef WIN32
errno = 0;
long int value = ulimit(UL_SETFSIZE, 1);
MITK_TEST_CONDITION_REQUIRED( value != -1, "ulimit() returned with errno = " << errno );
#else
continue;
#endif
}
// create a data storage and fill it with some test data
mitk::SceneIO::Pointer sceneIO = mitk::SceneIO::New();
MITK_TEST_CONDITION_REQUIRED(sceneIO.IsNotNull(),"SceneIO instantiation")
mitk::DataStorage::Pointer storage = mitk::StandaloneDataStorage::New().GetPointer();
MITK_TEST_CONDITION_REQUIRED(storage.IsNotNull(),"StandaloneDataStorage instantiation");
std::cout << "ImageName: " << argv[1] << std::endl;
std::cout << "SurfaceName: " << argv[2] << std::endl;
SceneIOTestClass::FillStorage(storage, argv[1], argv[2]);
// attempt to save it
Poco::Path newname( Poco::TemporaryFile::tempName() );
sceneFileName = std::string( MITK_TEST_OUTPUT_DIR ) + Poco::Path::separator() + newname.getFileName() + ".zip";
MITK_TEST_CONDITION_REQUIRED( sceneIO->SaveScene( storage->GetAll(), storage, sceneFileName), "Saving scene file '" << sceneFileName << "'");
// test if no errors were reported
mitk::SceneIO::FailedBaseDataListType::ConstPointer failedNodes = sceneIO->GetFailedNodes();
if (failedNodes.IsNotNull() && !failedNodes->empty())
{
MITK_TEST_OUTPUT( << "The following nodes could not be serialized:");
for ( mitk::SceneIO::FailedBaseDataListType::const_iterator iter = failedNodes->begin();
iter != failedNodes->end();
++iter )
{
MITK_TEST_OUTPUT_NO_ENDL( << " - ");
if ( mitk::BaseData* data =(*iter)->GetData() )
{
MITK_TEST_OUTPUT_NO_ENDL( << data->GetNameOfClass());
}
else
{
MITK_TEST_OUTPUT_NO_ENDL( << "(NULL)");
}
MITK_TEST_OUTPUT( << " contained in node '" << (*iter)->GetName() << "'");
// \TODO: should we fail the test case if failed properties exist?
}
}
mitk::PropertyList::ConstPointer failedProperties = sceneIO->GetFailedProperties();
if (failedProperties.IsNotNull() && !failedProperties->IsEmpty())
{
MITK_TEST_OUTPUT( << "The following properties could not be serialized:");
const mitk::PropertyList::PropertyMap* propmap = failedProperties->GetMap();
for ( mitk::PropertyList::PropertyMap::const_iterator iter = propmap->begin();
iter != propmap->end();
++iter )
{
- MITK_TEST_OUTPUT( << " - " << iter->second.first->GetNameOfClass() << " associated to key '" << iter->first << "'");
+ MITK_TEST_OUTPUT( << " - " << iter->second->GetNameOfClass() << " associated to key '" << iter->first << "'");
// \TODO: should we fail the test case if failed properties exist?
}
}
MITK_TEST_CONDITION_REQUIRED(failedProperties.IsNotNull() && failedProperties->IsEmpty(), "Checking if all properties have been saved.")
MITK_TEST_CONDITION_REQUIRED(failedNodes.IsNotNull() && failedNodes->empty(), "Checking if all nodes have been saved.")
//Now do the loading part
sceneIO = mitk::SceneIO::New();
//Load scene into the datastorage and clean the DS first
MITK_TEST_OUTPUT(<< "Loading scene again");
storage = sceneIO->LoadScene(sceneFileName,storage,true);
// test if no errors were reported
failedNodes = sceneIO->GetFailedNodes();
if (failedNodes.IsNotNull() && !failedNodes->empty())
{
MITK_TEST_OUTPUT( << "The following nodes could not be serialized:");
for ( mitk::SceneIO::FailedBaseDataListType::const_iterator iter = failedNodes->begin();
iter != failedNodes->end();
++iter )
{
MITK_TEST_OUTPUT_NO_ENDL( << " - ");
if ( mitk::BaseData* data =(*iter)->GetData() )
{
MITK_TEST_OUTPUT_NO_ENDL( << data->GetNameOfClass());
}
else
{
MITK_TEST_OUTPUT_NO_ENDL( << "(NULL)");
}
MITK_TEST_OUTPUT( << " contained in node '" << (*iter)->GetName() << "'");
// \TODO: should we fail the test case if failed properties exist?
}
}
failedProperties = sceneIO->GetFailedProperties();
if (failedProperties.IsNotNull() && !failedProperties->IsEmpty())
{
MITK_TEST_OUTPUT( << "The following properties could not be serialized:");
const mitk::PropertyList::PropertyMap* propmap = failedProperties->GetMap();
for ( mitk::PropertyList::PropertyMap::const_iterator iter = propmap->begin();
iter != propmap->end();
++iter )
{
- MITK_TEST_OUTPUT( << " - " << iter->second.first->GetNameOfClass() << " associated to key '" << iter->first << "'");
+ MITK_TEST_OUTPUT( << " - " << iter->second->GetNameOfClass() << " associated to key '" << iter->first << "'");
// \TODO: should we fail the test case if failed properties exist?
}
}
// check if data storage content has been restored correctly
SceneIOTestClass::VerifyStorage(storage);
}
// if no sub-test failed remove the scene file, otherwise it is kept for debugging purposes
if ( mitk::TestManager::GetInstance()->NumberOfFailedTests() == 0 )
{
Poco::File pocoSceneFile( sceneFileName );
MITK_TEST_CONDITION_REQUIRED( pocoSceneFile.exists(), "Checking if scene file still exists before cleaning up." )
pocoSceneFile.remove();
}
MITK_TEST_END();
}
diff --git a/Modules/SceneSerialization/mitkPropertyListDeserializerV1.cpp b/Modules/SceneSerialization/mitkPropertyListDeserializerV1.cpp
index ff7d924cf1..4115522559 100644
--- a/Modules/SceneSerialization/mitkPropertyListDeserializerV1.cpp
+++ b/Modules/SceneSerialization/mitkPropertyListDeserializerV1.cpp
@@ -1,91 +1,91 @@
/*=========================================================================
Program: Medical Imaging & Interaction Toolkit
Language: C++
Date: $Date$
Version: $Revision: 1.12 $
Copyright (c) German Cancer Research Center, Division of Medical and
Biological Informatics. All rights reserved.
See MITKCopyright.txt or http://www.mitk.org/copyright.html for details.
This software is distributed WITHOUT ANY WARRANTY; without even
the implied warranty of MERCHANTABILITY or FITNESS FOR A PARTICULAR
PURPOSE. See the above copyright notices for more information.
=========================================================================*/
#include "mitkSerializerMacros.h"
#include "mitkPropertyListDeserializerV1.h"
-#include "mitkBasePropertyDeserializer.h"
+#include "mitkBasePropertySerializer.h"
#include <tinyxml.h>
MITK_REGISTER_SERIALIZER(PropertyListDeserializerV1)
mitk::PropertyListDeserializerV1::PropertyListDeserializerV1()
{
}
mitk::PropertyListDeserializerV1::~PropertyListDeserializerV1()
{
}
bool mitk::PropertyListDeserializerV1::Deserialize()
{
bool error(false);
m_PropertyList = PropertyList::New();
TiXmlDocument document( m_Filename );
if (!document.LoadFile())
{
MITK_ERROR << "Could not open/read/parse " << m_Filename << "\nTinyXML reports: " << document.ErrorDesc() << std::endl;
return false;
}
for( TiXmlElement* propertyElement = document.FirstChildElement("property"); propertyElement != NULL; propertyElement = propertyElement->NextSiblingElement("property") )
{
const char* keya = propertyElement->Attribute("key");
std::string key( keya ? keya : "");
const char* typea = propertyElement->Attribute("type");
std::string type( typea ? typea : "");
// hand propertyElement to specific reader
std::stringstream propertyDeserializerClassName;
- propertyDeserializerClassName << type << "Deserializer";
+ propertyDeserializerClassName << type << "Serializer";
std::list<itk::LightObject::Pointer> readers = itk::ObjectFactoryBase::CreateAllInstance(propertyDeserializerClassName.str().c_str());
if (readers.size() < 1)
{
MITK_ERROR << "No property reader found for " << type;
error = true;
}
if (readers.size() > 1)
{
MITK_WARN << "Multiple property readers found for " << type << ". Using arbitrary first one.";
}
for ( std::list<itk::LightObject::Pointer>::iterator iter = readers.begin();
iter != readers.end();
++iter )
{
- if (BasePropertyDeserializer* reader = dynamic_cast<BasePropertyDeserializer*>( iter->GetPointer() ) )
+ if (BasePropertySerializer* reader = dynamic_cast<BasePropertySerializer*>( iter->GetPointer() ) )
{
BaseProperty::Pointer property = reader->Deserialize( propertyElement->FirstChildElement() );
if (property.IsNotNull())
{
m_PropertyList->ReplaceProperty(key, property);
}
else
{
MITK_ERROR << "There were errors while loding property '" << key << "' of type " << type << ". Your data may be corrupted";
error = true;
}
break;
}
}
}
return !error;
}
diff --git a/Modules/SceneSerialization/mitkSceneReaderV1.cpp b/Modules/SceneSerialization/mitkSceneReaderV1.cpp
index c56442d031..41a1dfdf27 100644
--- a/Modules/SceneSerialization/mitkSceneReaderV1.cpp
+++ b/Modules/SceneSerialization/mitkSceneReaderV1.cpp
@@ -1,255 +1,255 @@
/*=========================================================================
Program: Medical Imaging & Interaction Toolkit
Language: C++
Date: $Date$
Version: $Revision: 1.12 $
Copyright (c) German Cancer Research Center, Division of Medical and
Biological Informatics. All rights reserved.
See MITKCopyright.txt or http://www.mitk.org/copyright.html for details.
This software is distributed WITHOUT ANY WARRANTY; without even
the implied warranty of MERCHANTABILITY or FITNESS FOR A PARTICULAR
PURPOSE. See the above copyright notices for more information.
=========================================================================*/
#include "mitkSceneReaderV1.h"
#include "mitkSerializerMacros.h"
#include "mitkDataNodeFactory.h"
#include "mitkBaseRenderer.h"
#include "mitkPropertyListDeserializer.h"
#include "Poco/Path.h"
MITK_REGISTER_SERIALIZER(SceneReaderV1)
bool mitk::SceneReaderV1::LoadScene( TiXmlDocument& document, const std::string& workingDirectory, DataStorage* storage )
{
assert(storage);
bool error(false);
// TODO prepare to detect errors (such as cycles) from wrongly written or edited xml files
// iterate all nodes
// first level nodes should be <node> elements
for( TiXmlElement* element = document.FirstChildElement("node"); element != NULL; element = element->NextSiblingElement("node") )
{
// 1. if there is a <data type="..." file="..."> element,
- // - construct a name for the appropriate deserializer
- // - try to instantiate this deserializer via itk object factory
- // - if deserializer could be created, use it to read the file into a BaseData object
+ // - construct a name for the appropriate serializer
+ // - try to instantiate this serializer via itk object factory
+ // - if serializer could be created, use it to read the file into a BaseData object
// - if successful, call the new node's SetData(..)
DataNode::Pointer node = LoadBaseDataFromDataTag( element->FirstChildElement("data"), workingDirectory, error );
// 2. check child nodes
const char* uida = element->Attribute("UID");
std::string uid("");
if (uida)
{
uid = uida;
m_NodeForID[uid] = node.GetPointer();
m_IDForNode[ node.GetPointer() ] = uid;
}
else
{
MITK_ERROR << "No UID found for current node. Node will have no parents.";
error = true;
}
// remember node for later adding to DataStorage
m_Nodes.insert( std::make_pair( node, std::list<std::string>() ) );
// 3. if there are <source> elements, remember parent objects
for( TiXmlElement* source = element->FirstChildElement("source"); source != NULL; source = source->NextSiblingElement("source") )
{
const char* sourceUID = source->Attribute("UID");
if (sourceUID)
{
m_Nodes[node].push_back( std::string(sourceUID) );
}
}
// 5. if there are <properties> nodes,
// - instantiate the appropriate PropertyListDeSerializer
// - use them to construct PropertyList objects
// - add these properties to the node (if necessary, use renderwindow name)
bool success = DecorateNodeWithProperties(node, element, workingDirectory);
if (!success)
{
MITK_ERROR << "Could not load properties for node.";
error = true;
}
} // end for all <node>
// remove all unknown parent UIDs
for (NodesAndParentsMapType::iterator nodesIter = m_Nodes.begin();
nodesIter != m_Nodes.end();
++nodesIter)
{
for (std::list<std::string>::iterator parentsIter = nodesIter->second.begin();
parentsIter != nodesIter->second.end();)
{
if (m_NodeForID.find( *parentsIter ) == m_NodeForID.end())
{
parentsIter = nodesIter->second.erase( parentsIter );
MITK_WARN << "Found a DataNode with unknown parents. Will add it to DataStorage without any parent objects.";
error = true;
}
else
{
++parentsIter;
}
}
}
// repeat
// for all created nodes
unsigned int lastMapSize(0);
while ( lastMapSize != m_Nodes.size()) // this is to prevent infinite loops; each iteration must at least add one node to DataStorage
{
lastMapSize = m_Nodes.size();
for (NodesAndParentsMapType::iterator nodesIter = m_Nodes.begin();
nodesIter != m_Nodes.end();
++nodesIter)
{
bool addNow(true);
// if any parent node is not yet in DataStorage, skip node for now and check later
for (std::list<std::string>::iterator parentsIter = nodesIter->second.begin();
parentsIter != nodesIter->second.end();
++parentsIter)
{
if ( !storage->Exists( m_NodeForID[ *parentsIter ] ) )
{
addNow = false;
break;
}
}
if (addNow)
{
DataStorage::SetOfObjects::Pointer parents = DataStorage::SetOfObjects::New();
for (std::list<std::string>::iterator parentsIter = nodesIter->second.begin();
parentsIter != nodesIter->second.end();
++parentsIter)
{
parents->push_back( m_NodeForID[ *parentsIter ] );
}
// if all parents are found in datastorage (or are unknown), add node to DataStorage
storage->Add( nodesIter->first, parents );
// remove this node from m_Nodes
m_Nodes.erase( nodesIter );
// break this for loop because iterators are probably invalid
break;
}
}
}
// All nodes that are still in m_Nodes at this point are not part of a proper directed graph structure. We'll add such nodes without any parent information.
for (NodesAndParentsMapType::iterator nodesIter = m_Nodes.begin();
nodesIter != m_Nodes.end();
++nodesIter)
{
storage->Add( nodesIter->first );
MITK_WARN << "Encountered node that is not part of a directed graph structure. Will be added to DataStorage without parents.";
error = true;
}
return !error;
}
mitk::DataNode::Pointer mitk::SceneReaderV1::LoadBaseDataFromDataTag( TiXmlElement* dataElement, const std::string& workingDirectory, bool& error )
{
DataNode::Pointer node;
if (dataElement)
{
const char* filename( dataElement->Attribute("file") );
if ( filename )
{
DataNodeFactory::Pointer factory = DataNodeFactory::New();
factory->SetFileName( workingDirectory + Poco::Path::separator() + filename );
try
{
factory->Update();
node = factory->GetOutput();
}
catch (std::exception& e)
{
MITK_ERROR << "Error during attempt to read '" << filename << "'. Exception says: " << e.what();
error = true;
}
if (node.IsNull())
{
MITK_ERROR << "Error during attempt to read '" << filename << "'. Factory returned NULL object.";
error = true;
}
}
}
// in case there was no <data> element we create a new empty node (for appending a propertylist later)
if (node.IsNull())
{
node = DataNode::New();
}
return node;
}
bool mitk::SceneReaderV1::DecorateNodeWithProperties(DataNode* node, TiXmlElement* nodeElement, const std::string& workingDirectory)
{
assert(node);
assert(nodeElement);
bool error(false);
for( TiXmlElement* properties = nodeElement->FirstChildElement("properties"); properties != NULL; properties = properties->NextSiblingElement("properties") )
{
const char* propertiesfilea( properties->Attribute("file") );
std::string propertiesfile( propertiesfilea ? propertiesfilea : "" );
const char* renderwindowa( properties->Attribute("renderwindow") );
std::string renderwindow( renderwindowa ? renderwindowa : "" );
BaseRenderer* renderer = BaseRenderer::GetByName( renderwindow );
if (renderer || renderwindow.empty())
{
PropertyList::Pointer propertyList = node->GetPropertyList(renderer); // DataNode implementation always returns a propertylist
// clear all properties from node that might be set by DataNodeFactory during loading
propertyList->Clear();
// use deserializer to construct new properties
PropertyListDeserializer::Pointer deserializer = PropertyListDeserializer::New();
deserializer->SetFilename(workingDirectory + Poco::Path::separator() + propertiesfile);
bool success = deserializer->Deserialize();
error |= !success;
PropertyList::Pointer readProperties = deserializer->GetOutput();
if (readProperties.IsNotNull())
{
propertyList->ConcatenatePropertyList( readProperties, true ); // true = replace
}
else
{
MITK_ERROR << "Property list reader did not return a property list. This is an implementation error. Please tell your developer.";
error = true;
}
}
else
{
MITK_ERROR << "Found properties for renderer " << renderwindow << " but there is no such renderer in current application. Ignoring those properties";
error = true;
}
}
return !error;
}
diff --git a/Modules/SceneSerializationBase/BasePropertyDeserializer/mitkAnnotationPropertyDeserializer.cpp b/Modules/SceneSerializationBase/BasePropertyDeserializer/mitkAnnotationPropertyDeserializer.cpp
deleted file mode 100644
index b50ee1a413..0000000000
--- a/Modules/SceneSerializationBase/BasePropertyDeserializer/mitkAnnotationPropertyDeserializer.cpp
+++ /dev/null
@@ -1,56 +0,0 @@
-/*=========================================================================
-
-Program: Medical Imaging & Interaction Toolkit
-Language: C++
-Date: $Date: 2009-10-08 16:58:56 +0200 (Do, 08. Okt 2009) $
-Version: $Revision: 1.12 $
-
-Copyright (c) German Cancer Research Center, Division of Medical and
-Biological Informatics. All rights reserved.
-See MITKCopyright.txt or http://www.mitk.org/copyright.html for details.
-
-This software is distributed WITHOUT ANY WARRANTY; without even
-the implied warranty of MERCHANTABILITY or FITNESS FOR A PARTICULAR
-PURPOSE. See the above copyright notices for more information.
-
-=========================================================================*/
-
-#ifndef mitkAnnotationPropertyDeserializer_h_included
-#define mitkAnnotationPropertyDeserializer_h_included
-
-#include "mitkBasePropertyDeserializer.h"
-
-#include "mitkAnnotationProperty.h"
-
-#include "SceneSerializationBaseExports.h"
-
-namespace mitk
-{
-
-class SceneSerializationBase_EXPORT AnnotationPropertyDeserializer : public BasePropertyDeserializer
-{
- public:
- mitkClassMacro( AnnotationPropertyDeserializer, BasePropertyDeserializer );
- itkNewMacro(Self);
-
- virtual BaseProperty::Pointer Deserialize(TiXmlElement* element)
- {
- if (!element) return NULL;
- const char* label( element->Attribute("label") );
- Point3D p;
- if ( element->QueryFloatAttribute( "x", &p[0] ) != TIXML_SUCCESS )
- return NULL;
- if ( element->QueryFloatAttribute( "y", &p[1] ) != TIXML_SUCCESS )
- return NULL;
- if ( element->QueryFloatAttribute( "z", &p[2] ) != TIXML_SUCCESS )
- return NULL;
- return AnnotationProperty::New(label, p).GetPointer();
- }
- protected:
- AnnotationPropertyDeserializer() {}
- virtual ~AnnotationPropertyDeserializer() {}
-};
-} // namespace
-// important to put this into the GLOBAL namespace (because it starts with 'namespace mitk')
-MITK_REGISTER_SERIALIZER(AnnotationPropertyDeserializer);
-#endif
diff --git a/Modules/SceneSerializationBase/BasePropertyDeserializer/mitkBoolLookupTablePropertyDeserializer.cpp b/Modules/SceneSerializationBase/BasePropertyDeserializer/mitkBoolLookupTablePropertyDeserializer.cpp
deleted file mode 100644
index 8456febef7..0000000000
--- a/Modules/SceneSerializationBase/BasePropertyDeserializer/mitkBoolLookupTablePropertyDeserializer.cpp
+++ /dev/null
@@ -1,67 +0,0 @@
-/*=========================================================================
-
-Program: Medical Imaging & Interaction Toolkit
-Language: C++
-Date: $Date: 2009-10-08 17:07:40 +0200 (Do, 08. Okt 2009) $
-Version: $Revision: 1.12 $
-
-Copyright (c) German Cancer Research Center, Division of Medical and
-Biological Informatics. All rights reserved.
-See MITKCopyright.txt or http://www.mitk.org/copyright.html for details.
-
-This software is distributed WITHOUT ANY WARRANTY; without even
-the implied warranty of MERCHANTABILITY or FITNESS FOR A PARTICULAR
-PURPOSE. See the above copyright notices for more information.
-
-=========================================================================*/
-
-#ifndef mitkBoolLookupTablePropertyDeserializer_h_included
-#define mitkBoolLookupTablePropertyDeserializer_h_included
-
-#include "mitkBasePropertyDeserializer.h"
-
-#include "mitkProperties.h"
-
-#include "SceneSerializationBaseExports.h"
-
-namespace mitk
-{
-
-class SceneSerializationBase_EXPORT BoolLookupTablePropertyDeserializer : public BasePropertyDeserializer
-{
- public:
-
- mitkClassMacro( BoolLookupTablePropertyDeserializer, BasePropertyDeserializer );
- itkNewMacro(Self);
-
- virtual BaseProperty::Pointer Deserialize(TiXmlElement* element)
- {
- if (!element)
- return NULL;
-
- BoolLookupTable lut;
- for( TiXmlElement* child = element->FirstChildElement("LUTValue"); child != NULL; child = child->NextSiblingElement("LUTValue"))
- {
-
- int xmlID;
- if (child->QueryIntAttribute("id", &xmlID) == TIXML_WRONG_TYPE)
- return NULL; // TODO: can we do a better error handling?
- BoolLookupTable::IdentifierType id = static_cast<BoolLookupTable::IdentifierType>(xmlID);
- BoolLookupTable::ValueType val = std::string(child->Attribute("value")) == std::string("true");
- lut.SetTableValue(id, val);
- }
- return BoolLookupTableProperty::New(lut).GetPointer();
- }
-
- protected:
- BoolLookupTablePropertyDeserializer() {}
- virtual ~BoolLookupTablePropertyDeserializer() {}
-};
-
-} // namespace
-
-// important to put this into the GLOBAL namespace (because it starts with 'namespace mitk')
-MITK_REGISTER_SERIALIZER(BoolLookupTablePropertyDeserializer);
-
-#endif
-
diff --git a/Modules/SceneSerializationBase/BasePropertyDeserializer/mitkClippingPropertyDeserializer.cpp b/Modules/SceneSerializationBase/BasePropertyDeserializer/mitkClippingPropertyDeserializer.cpp
deleted file mode 100644
index 9c7cb617c8..0000000000
--- a/Modules/SceneSerializationBase/BasePropertyDeserializer/mitkClippingPropertyDeserializer.cpp
+++ /dev/null
@@ -1,74 +0,0 @@
-/*=========================================================================
-
-Program: Medical Imaging & Interaction Toolkit
-Language: C++
-Date: $Date: 2009-10-08 16:58:56 +0200 (Do, 08. Okt 2009) $
-Version: $Revision: 1.12 $
-
-Copyright (c) German Cancer Research Center, Division of Medical and
-Biological Informatics. All rights reserved.
-See MITKCopyright.txt or http://www.mitk.org/copyright.html for details.
-
-This software is distributed WITHOUT ANY WARRANTY; without even
-the implied warranty of MERCHANTABILITY or FITNESS FOR A PARTICULAR
-PURPOSE. See the above copyright notices for more information.
-
-=========================================================================*/
-
-#ifndef mitkClippingPropertyDeserializer_h_included
-#define mitkClippingPropertyDeserializer_h_included
-
-#include "mitkBasePropertyDeserializer.h"
-#include "mitkClippingProperty.h"
-#include "mitkVector.h"
-
-#include "SceneSerializationBaseExports.h"
-
-namespace mitk
-{
-
-class SceneSerializationBase_EXPORT ClippingPropertyDeserializer : public BasePropertyDeserializer
-{
- public:
-
- mitkClassMacro( ClippingPropertyDeserializer, BasePropertyDeserializer );
- itkNewMacro(Self);
-
- virtual BaseProperty::Pointer Deserialize(TiXmlElement* element)
- {
- if (!element)
- return NULL;
- bool enabled = std::string(element->Attribute("enabled")) == "true";
-
- TiXmlElement* originElement = element->FirstChildElement("origin");
- if (originElement == NULL)
- return NULL;
- Point3D origin;
- if ( originElement->QueryFloatAttribute( "x", &origin[0] ) != TIXML_SUCCESS )
- return NULL;
- if ( originElement->QueryFloatAttribute( "y", &origin[1] ) != TIXML_SUCCESS )
- return NULL;
- if ( originElement->QueryFloatAttribute( "z", &origin[2] ) != TIXML_SUCCESS )
- return NULL;
- TiXmlElement* normalElement = element->FirstChildElement("normal");
- if (normalElement == NULL)
- return NULL;
- Vector3D normal;
- if ( normalElement->QueryFloatAttribute( "x", &normal[0] ) != TIXML_SUCCESS )
- return NULL;
- if ( normalElement->QueryFloatAttribute( "y", &normal[1] ) != TIXML_SUCCESS )
- return NULL;
- if ( normalElement->QueryFloatAttribute( "z", &normal[2] ) != TIXML_SUCCESS )
- return NULL;
- ClippingProperty::Pointer cp = ClippingProperty::New(origin, normal);
- cp->SetClippingEnabled(enabled);
- return cp.GetPointer();
- }
- protected:
- ClippingPropertyDeserializer() {}
- virtual ~ClippingPropertyDeserializer() {}
-};
-} // namespace
-// important to put this into the GLOBAL namespace (because it starts with 'namespace mitk')
-MITK_REGISTER_SERIALIZER(ClippingPropertyDeserializer);
-#endif
diff --git a/Modules/SceneSerializationBase/BasePropertyDeserializer/mitkColorPropertyDeserializer.cpp b/Modules/SceneSerializationBase/BasePropertyDeserializer/mitkColorPropertyDeserializer.cpp
deleted file mode 100644
index 4c481a1ace..0000000000
--- a/Modules/SceneSerializationBase/BasePropertyDeserializer/mitkColorPropertyDeserializer.cpp
+++ /dev/null
@@ -1,61 +0,0 @@
-/*=========================================================================
-
-Program: Medical Imaging & Interaction Toolkit
-Language: C++
-Date: $Date$
-Version: $Revision: 1.12 $
-
-Copyright (c) German Cancer Research Center, Division of Medical and
-Biological Informatics. All rights reserved.
-See MITKCopyright.txt or http://www.mitk.org/copyright.html for details.
-
-This software is distributed WITHOUT ANY WARRANTY; without even
-the implied warranty of MERCHANTABILITY or FITNESS FOR A PARTICULAR
-PURPOSE. See the above copyright notices for more information.
-
-=========================================================================*/
-
-#ifndef mitkColorPropertyDeserializer_h_included
-#define mitkColorPropertyDeserializer_h_included
-
-#include "mitkBasePropertyDeserializer.h"
-
-#include "mitkColorProperty.h"
-
-#include "SceneSerializationBaseExports.h"
-
-namespace mitk
-{
-
-class SceneSerializationBase_EXPORT ColorPropertyDeserializer : public BasePropertyDeserializer
-{
- public:
-
- mitkClassMacro( ColorPropertyDeserializer, BasePropertyDeserializer );
- itkNewMacro(Self);
-
- virtual BaseProperty::Pointer Deserialize(TiXmlElement* element)
- {
- if (!element) return NULL;
-
- Color c;
- if ( element->QueryFloatAttribute( "r", &c[0] ) != TIXML_SUCCESS ) return NULL;
- if ( element->QueryFloatAttribute( "g", &c[1] ) != TIXML_SUCCESS ) return NULL;
- if ( element->QueryFloatAttribute( "b", &c[2] ) != TIXML_SUCCESS ) return NULL;
-
- return ColorProperty::New( c ).GetPointer();
- }
-
- protected:
-
- ColorPropertyDeserializer() {}
- virtual ~ColorPropertyDeserializer() {}
-};
-
-} // namespace
-
-// important to put this into the GLOBAL namespace (because it starts with 'namespace mitk')
-MITK_REGISTER_SERIALIZER(ColorPropertyDeserializer);
-
-#endif
-
diff --git a/Modules/SceneSerializationBase/BasePropertyDeserializer/mitkDoublePropertyDeserializer.cpp b/Modules/SceneSerializationBase/BasePropertyDeserializer/mitkDoublePropertyDeserializer.cpp
deleted file mode 100644
index 86d0a61635..0000000000
--- a/Modules/SceneSerializationBase/BasePropertyDeserializer/mitkDoublePropertyDeserializer.cpp
+++ /dev/null
@@ -1,64 +0,0 @@
-/*=========================================================================
-
-Program: Medical Imaging & Interaction Toolkit
-Language: C++
-Date: $Date$
-Version: $Revision: 1.12 $
-
-Copyright (c) German Cancer Research Center, Division of Medical and
-Biological Informatics. All rights reserved.
-See MITKCopyright.txt or http://www.mitk.org/copyright.html for details.
-
-This software is distributed WITHOUT ANY WARRANTY; without even
-the implied warranty of MERCHANTABILITY or FITNESS FOR A PARTICULAR
-PURPOSE. See the above copyright notices for more information.
-
-=========================================================================*/
-
-#ifndef mitkDoublePropertyDeserializer_h_included
-#define mitkDoublePropertyDeserializer_h_included
-
-#include "mitkBasePropertyDeserializer.h"
-
-#include "mitkProperties.h"
-
-#include "SceneSerializationBaseExports.h"
-
-namespace mitk
-{
-
-class SceneSerializationBase_EXPORT DoublePropertyDeserializer : public BasePropertyDeserializer
-{
- public:
-
- mitkClassMacro( DoublePropertyDeserializer, BasePropertyDeserializer );
- itkNewMacro(Self);
-
- virtual BaseProperty::Pointer Deserialize(TiXmlElement* element)
- {
- if (!element) return NULL;
-
- double d;
- if ( element->QueryDoubleAttribute( "value", &d ) == TIXML_SUCCESS )
- {
- return DoubleProperty::New(d).GetPointer();
- }
- else
- {
- return NULL;
- }
- }
-
- protected:
-
- DoublePropertyDeserializer() {}
- virtual ~DoublePropertyDeserializer() {}
-};
-
-} // namespace
-
-// important to put this into the GLOBAL namespace (because it starts with 'namespace mitk')
-MITK_REGISTER_SERIALIZER(DoublePropertyDeserializer);
-
-#endif
-
diff --git a/Modules/SceneSerializationBase/BasePropertyDeserializer/mitkEnumerationPropertySubclassesDeserializer.cpp b/Modules/SceneSerializationBase/BasePropertyDeserializer/mitkEnumerationPropertySubclassesDeserializer.cpp
deleted file mode 100644
index d612068281..0000000000
--- a/Modules/SceneSerializationBase/BasePropertyDeserializer/mitkEnumerationPropertySubclassesDeserializer.cpp
+++ /dev/null
@@ -1,88 +0,0 @@
-/*=========================================================================
-
-Program: Medical Imaging & Interaction Toolkit
-Language: C++
-Date: $Date$
-Version: $Revision: 1.12 $
-
-Copyright (c) German Cancer Research Center, Division of Medical and
-Biological Informatics. All rights reserved.
-See MITKCopyright.txt or http://www.mitk.org/copyright.html for details.
-
-This software is distributed WITHOUT ANY WARRANTY; without even
-the implied warranty of MERCHANTABILITY or FITNESS FOR A PARTICULAR
-PURPOSE. See the above copyright notices for more information.
-
-=========================================================================*/
-
-// TODO this should be moved to module SceneSerializationExt
-
-#ifndef mitkEnumerationSubclassesDeserializer_h_included
-#define mitkEnumerationSubclassesDeserializer_h_included
-
-#include "mitkBasePropertyDeserializer.h"
-
-/*
-#include "mitkGridRepresentationProperty.h"
-#include "mitkGridVolumeMapperProperty.h"
-#include "mitkOrganTypeProperty.h"
-*/
-#include "mitkPlaneOrientationProperty.h"
-#include "mitkShaderProperty.h"
-#include "mitkVtkInterpolationProperty.h"
-#include "mitkVtkRepresentationProperty.h"
-#include "mitkVtkResliceInterpolationProperty.h"
-#include "mitkVtkScalarModeProperty.h"
-#include "mitkVtkVolumeRenderingProperty.h"
-#include "mitkModalityProperty.h"
-
-#include "SceneSerializationBaseExports.h"
-
-
-#define MITK_REGISTER_ENUM_SUB_DESERIALIZER(classname) \
- \
-namespace mitk \
-{ \
- \
-class SceneSerializationBase_EXPORT classname ## Deserializer : public BasePropertyDeserializer \
-{ \
- public: \
- \
- mitkClassMacro( classname ## Deserializer, BasePropertyDeserializer ); \
- itkNewMacro(Self); \
-\
- virtual BaseProperty::Pointer Deserialize(TiXmlElement* element) \
- { \
- if (!element) return NULL; \
- const char* sa( element->Attribute("value") ); \
- std::string s(sa?sa:""); \
- classname::Pointer property = classname::New(); \
- property->SetValue( s ); \
- return property.GetPointer(); \
- } \
- \
- \
- protected: \
- \
- classname ## Deserializer () {} \
- virtual ~classname ## Deserializer () {} \
-}; \
- \
-} \
- \
-MITK_REGISTER_SERIALIZER( classname ## Deserializer );
-
-/*
-MITK_REGISTER_ENUM_SUB_DESERIALIZER(GridRepresentationProperty);
-MITK_REGISTER_ENUM_SUB_DESERIALIZER(GridVolumeMapperProperty);
-MITK_REGISTER_ENUM_SUB_DESERIALIZER(OrganTypeProperty);
-*/
-MITK_REGISTER_ENUM_SUB_DESERIALIZER(PlaneOrientationProperty);
-MITK_REGISTER_ENUM_SUB_DESERIALIZER(ShaderProperty);
-MITK_REGISTER_ENUM_SUB_DESERIALIZER(VtkInterpolationProperty);
-MITK_REGISTER_ENUM_SUB_DESERIALIZER(VtkRepresentationProperty);
-MITK_REGISTER_ENUM_SUB_DESERIALIZER(VtkResliceInterpolationProperty);
-MITK_REGISTER_ENUM_SUB_DESERIALIZER(VtkScalarModeProperty);
-MITK_REGISTER_ENUM_SUB_DESERIALIZER(VtkVolumeRenderingProperty);
-MITK_REGISTER_ENUM_SUB_DESERIALIZER(ModalityProperty);
-#endif
diff --git a/Modules/SceneSerializationBase/BasePropertyDeserializer/mitkFloatLookupTablePropertyDeserializer.cpp b/Modules/SceneSerializationBase/BasePropertyDeserializer/mitkFloatLookupTablePropertyDeserializer.cpp
deleted file mode 100644
index acbb098ec7..0000000000
--- a/Modules/SceneSerializationBase/BasePropertyDeserializer/mitkFloatLookupTablePropertyDeserializer.cpp
+++ /dev/null
@@ -1,65 +0,0 @@
-/*=========================================================================
-
-Program: Medical Imaging & Interaction Toolkit
-Language: C++
-Date: $Date: 2009-10-08 17:07:40 +0200 (Do, 08. Okt 2009) $
-Version: $Revision: 1.12 $
-
-Copyright (c) German Cancer Research Center, Division of Medical and
-Biological Informatics. All rights reserved.
-See MITKCopyright.txt or http://www.mitk.org/copyright.html for details.
-
-This software is distributed WITHOUT ANY WARRANTY; without even
-the implied warranty of MERCHANTABILITY or FITNESS FOR A PARTICULAR
-PURPOSE. See the above copyright notices for more information.
-
-=========================================================================*/
-
-#ifndef mitkFloatLookupTablePropertyDeserializer_h_included
-#define mitkFloatLookupTablePropertyDeserializer_h_included
-
-#include "mitkBasePropertyDeserializer.h"
-
-#include "mitkProperties.h"
-
-#include "SceneSerializationBaseExports.h"
-
-namespace mitk
-{
-
-class SceneSerializationBase_EXPORT FloatLookupTablePropertyDeserializer : public BasePropertyDeserializer
-{
- public:
-
- mitkClassMacro( FloatLookupTablePropertyDeserializer, BasePropertyDeserializer );
- itkNewMacro(Self);
-
- virtual BaseProperty::Pointer Deserialize(TiXmlElement* element)
- {
- if (!element)
- return NULL;
-
- FloatLookupTable lut;
- for( TiXmlElement* child = element->FirstChildElement("LUTValue"); child != NULL; child = child->NextSiblingElement("LUTValue"))
- {
-
- int tempID;
- if (child->QueryIntAttribute("id", &tempID) == TIXML_WRONG_TYPE)
- return NULL; // TODO: can we do a better error handling?
- FloatLookupTable::IdentifierType id = static_cast<FloatLookupTable::IdentifierType>(tempID);
- float tempVal = -1.0;
- if (child->QueryFloatAttribute("value", &tempVal) == TIXML_WRONG_TYPE)
- return NULL; // TODO: can we do a better error handling?
- FloatLookupTable::ValueType val = static_cast<FloatLookupTable::ValueType>(tempVal);
- lut.SetTableValue(id, val);
- }
- return FloatLookupTableProperty::New(lut).GetPointer();
- }
- protected:
- FloatLookupTablePropertyDeserializer() {}
- virtual ~FloatLookupTablePropertyDeserializer() {}
-};
-} // namespace
-// important to put this into the GLOBAL namespace (because it starts with 'namespace mitk')
-MITK_REGISTER_SERIALIZER(FloatLookupTablePropertyDeserializer);
-#endif
diff --git a/Modules/SceneSerializationBase/BasePropertyDeserializer/mitkFloatPropertyDeserializer.cpp b/Modules/SceneSerializationBase/BasePropertyDeserializer/mitkFloatPropertyDeserializer.cpp
deleted file mode 100644
index 1b12d55094..0000000000
--- a/Modules/SceneSerializationBase/BasePropertyDeserializer/mitkFloatPropertyDeserializer.cpp
+++ /dev/null
@@ -1,64 +0,0 @@
-/*=========================================================================
-
-Program: Medical Imaging & Interaction Toolkit
-Language: C++
-Date: $Date$
-Version: $Revision: 1.12 $
-
-Copyright (c) German Cancer Research Center, Division of Medical and
-Biological Informatics. All rights reserved.
-See MITKCopyright.txt or http://www.mitk.org/copyright.html for details.
-
-This software is distributed WITHOUT ANY WARRANTY; without even
-the implied warranty of MERCHANTABILITY or FITNESS FOR A PARTICULAR
-PURPOSE. See the above copyright notices for more information.
-
-=========================================================================*/
-
-#ifndef mitkFloatPropertyDeserializer_h_included
-#define mitkFloatPropertyDeserializer_h_included
-
-#include "mitkBasePropertyDeserializer.h"
-
-#include "mitkProperties.h"
-
-#include "SceneSerializationBaseExports.h"
-
-namespace mitk
-{
-
-class SceneSerializationBase_EXPORT FloatPropertyDeserializer : public BasePropertyDeserializer
-{
- public:
-
- mitkClassMacro( FloatPropertyDeserializer, BasePropertyDeserializer );
- itkNewMacro(Self);
-
- virtual BaseProperty::Pointer Deserialize(TiXmlElement* element)
- {
- if (!element) return NULL;
-
- float f;
- if ( element->QueryFloatAttribute( "value", &f ) == TIXML_SUCCESS )
- {
- return FloatProperty::New(f).GetPointer();
- }
- else
- {
- return NULL;
- }
- }
-
- protected:
-
- FloatPropertyDeserializer() {}
- virtual ~FloatPropertyDeserializer() {}
-};
-
-} // namespace
-
-// important to put this into the GLOBAL namespace (because it starts with 'namespace mitk')
-MITK_REGISTER_SERIALIZER(FloatPropertyDeserializer);
-
-#endif
-
diff --git a/Modules/SceneSerializationBase/BasePropertyDeserializer/mitkGroupTagPropertyDeserializer.cpp b/Modules/SceneSerializationBase/BasePropertyDeserializer/mitkGroupTagPropertyDeserializer.cpp
deleted file mode 100644
index 6442ead2ba..0000000000
--- a/Modules/SceneSerializationBase/BasePropertyDeserializer/mitkGroupTagPropertyDeserializer.cpp
+++ /dev/null
@@ -1,55 +0,0 @@
-/*=========================================================================
-
-Program: Medical Imaging & Interaction Toolkit
-Language: C++
-Date: $Date: 2009-10-08 17:07:40 +0200 (Do, 08. Okt 2009) $
-Version: $Revision: 1.12 $
-
-Copyright (c) German Cancer Research Center, Division of Medical and
-Biological Informatics. All rights reserved.
-See MITKCopyright.txt or http://www.mitk.org/copyright.html for details.
-
-This software is distributed WITHOUT ANY WARRANTY; without even
-the implied warranty of MERCHANTABILITY or FITNESS FOR A PARTICULAR
-PURPOSE. See the above copyright notices for more information.
-
-=========================================================================*/
-
-#ifndef mitkGroupTagPropertyDeserializer_h_included
-#define mitkGroupTagPropertyDeserializer_h_included
-
-#include "mitkBasePropertyDeserializer.h"
-
-#include "mitkGroupTagProperty.h"
-
-#include "SceneSerializationBaseExports.h"
-
-namespace mitk
-{
-
-class SceneSerializationBase_EXPORT GroupTagPropertyDeserializer : public BasePropertyDeserializer
-{
- public:
-
- mitkClassMacro( GroupTagPropertyDeserializer, BasePropertyDeserializer );
- itkNewMacro(Self);
-
- virtual BaseProperty::Pointer Deserialize(TiXmlElement*)
- {
- //if (!element)
- // return NULL;
- return GroupTagProperty::New().GetPointer();
- }
-
- protected:
- GroupTagPropertyDeserializer() {}
- virtual ~GroupTagPropertyDeserializer() {}
-};
-
-} // namespace
-
-// important to put this into the GLOBAL namespace (because it starts with 'namespace mitk')
-MITK_REGISTER_SERIALIZER(GroupTagPropertyDeserializer);
-
-#endif
-
diff --git a/Modules/SceneSerializationBase/BasePropertyDeserializer/mitkIntLookupTablePropertyDeserializer.cpp b/Modules/SceneSerializationBase/BasePropertyDeserializer/mitkIntLookupTablePropertyDeserializer.cpp
deleted file mode 100644
index 9d46b2eaf1..0000000000
--- a/Modules/SceneSerializationBase/BasePropertyDeserializer/mitkIntLookupTablePropertyDeserializer.cpp
+++ /dev/null
@@ -1,64 +0,0 @@
-/*=========================================================================
-
-Program: Medical Imaging & Interaction Toolkit
-Language: C++
-Date: $Date: 2009-10-08 17:07:40 +0200 (Do, 08. Okt 2009) $
-Version: $Revision: 1.12 $
-
-Copyright (c) German Cancer Research Center, Division of Medical and
-Biological Informatics. All rights reserved.
-See MITKCopyright.txt or http://www.mitk.org/copyright.html for details.
-
-This software is distributed WITHOUT ANY WARRANTY; without even
-the implied warranty of MERCHANTABILITY or FITNESS FOR A PARTICULAR
-PURPOSE. See the above copyright notices for more information.
-
-=========================================================================*/
-
-#ifndef mitkIntLookupTablePropertyDeserializer_h_included
-#define mitkIntLookupTablePropertyDeserializer_h_included
-
-#include "mitkBasePropertyDeserializer.h"
-
-#include "mitkProperties.h"
-
-#include "SceneSerializationBaseExports.h"
-
-namespace mitk
-{
-
-class SceneSerializationBase_EXPORT IntLookupTablePropertyDeserializer : public BasePropertyDeserializer
-{
- public:
-
- mitkClassMacro( IntLookupTablePropertyDeserializer, BasePropertyDeserializer );
- itkNewMacro(Self);
-
- virtual BaseProperty::Pointer Deserialize(TiXmlElement* element)
- {
- if (!element)
- return NULL;
-
- IntLookupTable lut;
- for( TiXmlElement* child = element->FirstChildElement("LUTValue"); child != NULL; child = child->NextSiblingElement("LUTValue"))
- {
-
- int temp;
- if (child->QueryIntAttribute("id", &temp) == TIXML_WRONG_TYPE)
- return NULL; // TODO: can we do a better error handling?
- IntLookupTable::IdentifierType id = static_cast<IntLookupTable::IdentifierType>(temp);
- if (child->QueryIntAttribute("value", &temp) == TIXML_WRONG_TYPE)
- return NULL; // TODO: can we do a better error handling?
- IntLookupTable::ValueType val = static_cast<IntLookupTable::ValueType>(temp);
- lut.SetTableValue(id, val);
- }
- return IntLookupTableProperty::New(lut).GetPointer();
- }
- protected:
- IntLookupTablePropertyDeserializer() {}
- virtual ~IntLookupTablePropertyDeserializer() {}
-};
-} // namespace
-// important to put this into the GLOBAL namespace (because it starts with 'namespace mitk')
-MITK_REGISTER_SERIALIZER(IntLookupTablePropertyDeserializer);
-#endif
diff --git a/Modules/SceneSerializationBase/BasePropertyDeserializer/mitkIntPropertyDeserializer.cpp b/Modules/SceneSerializationBase/BasePropertyDeserializer/mitkIntPropertyDeserializer.cpp
deleted file mode 100644
index fd3944c6e2..0000000000
--- a/Modules/SceneSerializationBase/BasePropertyDeserializer/mitkIntPropertyDeserializer.cpp
+++ /dev/null
@@ -1,64 +0,0 @@
-/*=========================================================================
-
-Program: Medical Imaging & Interaction Toolkit
-Language: C++
-Date: $Date$
-Version: $Revision: 1.12 $
-
-Copyright (c) German Cancer Research Center, Division of Medical and
-Biological Informatics. All rights reserved.
-See MITKCopyright.txt or http://www.mitk.org/copyright.html for details.
-
-This software is distributed WITHOUT ANY WARRANTY; without even
-the implied warranty of MERCHANTABILITY or FITNESS FOR A PARTICULAR
-PURPOSE. See the above copyright notices for more information.
-
-=========================================================================*/
-
-#ifndef mitkIntPropertyDeserializer_h_included
-#define mitkIntPropertyDeserializer_h_included
-
-#include "mitkBasePropertyDeserializer.h"
-
-#include "mitkProperties.h"
-
-#include "SceneSerializationBaseExports.h"
-
-namespace mitk
-{
-
-class SceneSerializationBase_EXPORT IntPropertyDeserializer : public BasePropertyDeserializer
-{
- public:
-
- mitkClassMacro( IntPropertyDeserializer, BasePropertyDeserializer );
- itkNewMacro(Self);
-
- virtual BaseProperty::Pointer Deserialize(TiXmlElement* element)
- {
- if (!element) return NULL;
-
- int integer;
- if ( element->QueryIntAttribute( "value", &integer ) == TIXML_SUCCESS )
- {
- return IntProperty::New(integer).GetPointer();
- }
- else
- {
- return NULL;
- }
- }
-
- protected:
-
- IntPropertyDeserializer() {}
- virtual ~IntPropertyDeserializer() {}
-};
-
-} // namespace
-
-// important to put this into the GLOBAL namespace (because it starts with 'namespace mitk')
-MITK_REGISTER_SERIALIZER(IntPropertyDeserializer);
-
-#endif
-
diff --git a/Modules/SceneSerializationBase/BasePropertyDeserializer/mitkLevelWindowPropertyDeserializer.cpp b/Modules/SceneSerializationBase/BasePropertyDeserializer/mitkLevelWindowPropertyDeserializer.cpp
deleted file mode 100644
index 5f062d326f..0000000000
--- a/Modules/SceneSerializationBase/BasePropertyDeserializer/mitkLevelWindowPropertyDeserializer.cpp
+++ /dev/null
@@ -1,86 +0,0 @@
-/*=========================================================================
-
-Program: Medical Imaging & Interaction Toolkit
-Language: C++
-Date: $Date$
-Version: $Revision: 1.12 $
-
-Copyright (c) German Cancer Research Center, Division of Medical and
-Biological Informatics. All rights reserved.
-See MITKCopyright.txt or http://www.mitk.org/copyright.html for details.
-
-This software is distributed WITHOUT ANY WARRANTY; without even
-the implied warranty of MERCHANTABILITY or FITNESS FOR A PARTICULAR
-PURPOSE. See the above copyright notices for more information.
-
-=========================================================================*/
-
-#ifndef mitkLevelWindowPropertyDeserializer_h_included
-#define mitkLevelWindowPropertyDeserializer_h_included
-
-#include "mitkBasePropertyDeserializer.h"
-
-#include "mitkLevelWindowProperty.h"
-
-#include "SceneSerializationBaseExports.h"
-
-namespace mitk
-{
-
-class SceneSerializationBase_EXPORT LevelWindowPropertyDeserializer : public BasePropertyDeserializer
-{
- public:
-
- mitkClassMacro( LevelWindowPropertyDeserializer, BasePropertyDeserializer );
- itkNewMacro(Self);
-
- virtual BaseProperty::Pointer Deserialize(TiXmlElement* element)
- {
- if (!element) return NULL;
-
- bool isFixed(false);
- if (element->Attribute("fixed"))
- isFixed = std::string(element->Attribute("fixed")) == "true";
-
- float level;
- float window;
- TiXmlElement* child = element->FirstChildElement("CurrentSettings");
- if ( child->QueryFloatAttribute( "level", &level ) != TIXML_SUCCESS ) return NULL;
- if ( child->QueryFloatAttribute( "window", &window ) != TIXML_SUCCESS ) return NULL;
-
- float defaultLevel;
- float defaultWindow;
- child = element->FirstChildElement("DefaultSettings");
- if ( child->QueryFloatAttribute( "level", &defaultLevel ) != TIXML_SUCCESS ) return NULL;
- if ( child->QueryFloatAttribute( "window", &defaultWindow ) != TIXML_SUCCESS ) return NULL;
-
- float minRange;
- float maxRange;
- child = element->FirstChildElement("CurrentRange");
- if ( child->QueryFloatAttribute( "min", &minRange ) != TIXML_SUCCESS ) return NULL;
- if ( child->QueryFloatAttribute( "max", &maxRange ) != TIXML_SUCCESS ) return NULL;
-
-
-
- LevelWindow lw;
- lw.SetRangeMinMax( minRange, maxRange );
- lw.SetDefaultLevelWindow( defaultLevel, defaultWindow );
- lw.SetLevelWindow( level, window );
- lw.SetFixed( isFixed );
-
- return LevelWindowProperty::New( lw ).GetPointer();
- }
-
- protected:
-
- LevelWindowPropertyDeserializer() {}
- virtual ~LevelWindowPropertyDeserializer() {}
-};
-
-} // namespace
-
-// important to put this into the GLOBAL namespace (because it starts with 'namespace mitk')
-MITK_REGISTER_SERIALIZER(LevelWindowPropertyDeserializer);
-
-#endif
-
diff --git a/Modules/SceneSerializationBase/BasePropertyDeserializer/mitkLookupTablePropertyDeserializer.cpp b/Modules/SceneSerializationBase/BasePropertyDeserializer/mitkLookupTablePropertyDeserializer.cpp
deleted file mode 100644
index 4b65827598..0000000000
--- a/Modules/SceneSerializationBase/BasePropertyDeserializer/mitkLookupTablePropertyDeserializer.cpp
+++ /dev/null
@@ -1,157 +0,0 @@
-/*=========================================================================
-
-Program: Medical Imaging & Interaction Toolkit
-Language: C++
-Date: $Date$
-Version: $Revision: 1.12 $
-
-Copyright (c) German Cancer Research Center, Division of Medical and
-Biological Informatics. All rights reserved.
-See MITKCopyright.txt or http://www.mitk.org/copyright.html for details.
-
-This software is distributed WITHOUT ANY WARRANTY; without even
-the implied warranty of MERCHANTABILITY or FITNESS FOR A PARTICULAR
-PURPOSE. See the above copyright notices for more information.
-
-=========================================================================*/
-
-#ifndef mitkLookupTablePropertyDeserializer_h_included
-#define mitkLookupTablePropertyDeserializer_h_included
-
-#include "mitkBasePropertyDeserializer.h"
-
-#include "mitkLookupTableProperty.h"
-
-#include "SceneSerializationBaseExports.h"
-
-namespace mitk
-{
-
-class SceneSerializationBase_EXPORT LookupTablePropertyDeserializer : public BasePropertyDeserializer
-{
- public:
-
- mitkClassMacro( LookupTablePropertyDeserializer, BasePropertyDeserializer );
- itkNewMacro(Self);
-
- virtual BaseProperty::Pointer Deserialize(TiXmlElement* element)
- {
- if (!element) return NULL;
-
-#if ( (VTK_MAJOR_VERSION < 5) && (VTK_MINOR_VERSION < 4) )
- typedef float OUR_VTK_FLOAT_TYPE;
- float range[2];
- float rgba[4];
-#else
- typedef double OUR_VTK_FLOAT_TYPE;
- double range[2];
- double rgba[4];
-#endif
-
- double d; // bec. of tinyXML's interface that takes a pointer to float or double...
-
- vtkLookupTable* lut = vtkLookupTable::New();
-
- int numberOfColors;
- int scale;
- int ramp; // hope the int values don't change betw. vtk versions...
- if ( element->QueryIntAttribute( "NumberOfColors", &numberOfColors ) == TIXML_SUCCESS )
- {
- lut->SetNumberOfTableValues( numberOfColors );
- }
- else
- return NULL;
- if ( element->QueryIntAttribute( "Scale", &scale ) == TIXML_SUCCESS )
- {
- lut->SetScale( scale );
- }
- else
- return NULL;
- if ( element->QueryIntAttribute( "Ramp", &ramp ) == TIXML_SUCCESS )
- {
- lut->SetRamp( ramp );
- }
- else
- return NULL;
-
- TiXmlElement* child = element->FirstChildElement("HueRange");
- if (child)
- {
- if ( child->QueryDoubleAttribute( "min", &d ) != TIXML_SUCCESS )
- return NULL;
- range[0] = static_cast<OUR_VTK_FLOAT_TYPE>(d);
- if ( child->QueryDoubleAttribute( "max", &d ) != TIXML_SUCCESS )
- return NULL;
- range[1] = static_cast<OUR_VTK_FLOAT_TYPE>(d);
- lut->SetHueRange( range );
- }
-
- child = element->FirstChildElement("ValueRange");
- if (child)
- {
- if ( child->QueryDoubleAttribute( "min", &d ) != TIXML_SUCCESS ) return NULL; range[0] = static_cast<OUR_VTK_FLOAT_TYPE>(d);
- if ( child->QueryDoubleAttribute( "max", &d ) != TIXML_SUCCESS ) return NULL; range[1] = static_cast<OUR_VTK_FLOAT_TYPE>(d);
- lut->SetValueRange( range );
- }
-
- child = element->FirstChildElement("SaturationRange");
- if (child)
- {
- if ( child->QueryDoubleAttribute( "min", &d ) != TIXML_SUCCESS ) return NULL; range[0] = static_cast<OUR_VTK_FLOAT_TYPE>(d);
- if ( child->QueryDoubleAttribute( "max", &d ) != TIXML_SUCCESS ) return NULL; range[1] = static_cast<OUR_VTK_FLOAT_TYPE>(d);
- lut->SetSaturationRange( range );
- }
-
- child = element->FirstChildElement("AlphaRange");
- if (child)
- {
- if ( child->QueryDoubleAttribute( "min", &d ) != TIXML_SUCCESS ) return NULL; range[0] = static_cast<OUR_VTK_FLOAT_TYPE>(d);
- if ( child->QueryDoubleAttribute( "max", &d ) != TIXML_SUCCESS ) return NULL; range[1] = static_cast<OUR_VTK_FLOAT_TYPE>(d);
- lut->SetAlphaRange( range );
- }
-
- child = element->FirstChildElement("TableRange");
- if (child)
- {
- if ( child->QueryDoubleAttribute( "min", &d ) != TIXML_SUCCESS ) return NULL; range[0] = static_cast<OUR_VTK_FLOAT_TYPE>(d);
- if ( child->QueryDoubleAttribute( "max", &d ) != TIXML_SUCCESS ) return NULL; range[1] = static_cast<OUR_VTK_FLOAT_TYPE>(d);
- lut->SetTableRange( range );
- }
-
- child = element->FirstChildElement("Table");
- if (child)
- {
- unsigned int index(0);
- for( TiXmlElement* grandChild = child->FirstChildElement("RgbaColor"); grandChild; grandChild = grandChild->NextSiblingElement("RgbaColor"))
- {
- if ( grandChild->QueryDoubleAttribute("R", &d) != TIXML_SUCCESS ) return NULL; rgba[0] = static_cast<OUR_VTK_FLOAT_TYPE>(d);
- if ( grandChild->QueryDoubleAttribute("G", &d) != TIXML_SUCCESS ) return NULL; rgba[1] = static_cast<OUR_VTK_FLOAT_TYPE>(d);
- if ( grandChild->QueryDoubleAttribute("B", &d) != TIXML_SUCCESS ) return NULL; rgba[2] = static_cast<OUR_VTK_FLOAT_TYPE>(d);
- if ( grandChild->QueryDoubleAttribute("A", &d) != TIXML_SUCCESS ) return NULL; rgba[3] = static_cast<OUR_VTK_FLOAT_TYPE>(d);
-
- lut->SetTableValue( index, rgba );
- ++index;
- }
- }
-
- LookupTable::Pointer mitkLut = LookupTable::New();
- mitkLut->SetVtkLookupTable( lut );
-
- lut->Delete();
-
- return LookupTableProperty::New(mitkLut).GetPointer();
- }
-
- protected:
-
- LookupTablePropertyDeserializer() {}
- virtual ~LookupTablePropertyDeserializer() {}
-};
-
-} // namespace
-
-// important to put this into the GLOBAL namespace (because it starts with 'namespace mitk')
-MITK_REGISTER_SERIALIZER(LookupTablePropertyDeserializer);
-
-#endif
-
diff --git a/Modules/SceneSerializationBase/BasePropertyDeserializer/mitkPoint3dPropertyDeserializer.cpp b/Modules/SceneSerializationBase/BasePropertyDeserializer/mitkPoint3dPropertyDeserializer.cpp
deleted file mode 100644
index e7a53ddb69..0000000000
--- a/Modules/SceneSerializationBase/BasePropertyDeserializer/mitkPoint3dPropertyDeserializer.cpp
+++ /dev/null
@@ -1,61 +0,0 @@
-/*=========================================================================
-
-Program: Medical Imaging & Interaction Toolkit
-Language: C++
-Date: $Date$
-Version: $Revision: 1.12 $
-
-Copyright (c) German Cancer Research Center, Division of Medical and
-Biological Informatics. All rights reserved.
-See MITKCopyright.txt or http://www.mitk.org/copyright.html for details.
-
-This software is distributed WITHOUT ANY WARRANTY; without even
-the implied warranty of MERCHANTABILITY or FITNESS FOR A PARTICULAR
-PURPOSE. See the above copyright notices for more information.
-
-=========================================================================*/
-
-#ifndef mitkPoint3dPropertyDeserializer_h_included
-#define mitkPoint3dPropertyDeserializer_h_included
-
-#include "mitkBasePropertyDeserializer.h"
-
-#include "mitkProperties.h"
-
-#include "SceneSerializationBaseExports.h"
-
-namespace mitk
-{
-
-class SceneSerializationBase_EXPORT Point3dPropertyDeserializer : public BasePropertyDeserializer
-{
- public:
-
- mitkClassMacro( Point3dPropertyDeserializer, BasePropertyDeserializer );
- itkNewMacro(Self);
-
- virtual BaseProperty::Pointer Deserialize(TiXmlElement* element)
- {
- if (!element) return NULL;
-
- Point3D v;
- if ( element->QueryFloatAttribute( "x", &v[0] ) != TIXML_SUCCESS ) return NULL;
- if ( element->QueryFloatAttribute( "y", &v[1] ) != TIXML_SUCCESS ) return NULL;
- if ( element->QueryFloatAttribute( "z", &v[2] ) != TIXML_SUCCESS ) return NULL;
-
- return Point3dProperty::New( v ).GetPointer();
- }
-
- protected:
-
- Point3dPropertyDeserializer() {}
- virtual ~Point3dPropertyDeserializer() {}
-};
-
-} // namespace
-
-// important to put this into the GLOBAL namespace (because it starts with 'namespace mitk')
-MITK_REGISTER_SERIALIZER(Point3dPropertyDeserializer);
-
-#endif
-
diff --git a/Modules/SceneSerializationBase/BasePropertyDeserializer/mitkPoint3iPropertyDeserializer.cpp b/Modules/SceneSerializationBase/BasePropertyDeserializer/mitkPoint3iPropertyDeserializer.cpp
deleted file mode 100644
index eb3d4b9806..0000000000
--- a/Modules/SceneSerializationBase/BasePropertyDeserializer/mitkPoint3iPropertyDeserializer.cpp
+++ /dev/null
@@ -1,50 +0,0 @@
-/*=========================================================================
-
-Program: Medical Imaging & Interaction Toolkit
-Language: C++
-Date: $Date: 2009-10-08 16:58:56 +0200 (Do, 08. Okt 2009) $
-Version: $Revision: 1.12 $
-
-Copyright (c) German Cancer Research Center, Division of Medical and
-Biological Informatics. All rights reserved.
-See MITKCopyright.txt or http://www.mitk.org/copyright.html for details.
-
-This software is distributed WITHOUT ANY WARRANTY; without even
-the implied warranty of MERCHANTABILITY or FITNESS FOR A PARTICULAR
-PURPOSE. See the above copyright notices for more information.
-
-=========================================================================*/
-
-#ifndef mitkPoint3iPropertyDeserializer_h_included
-#define mitkPoint3iPropertyDeserializer_h_included
-
-#include "mitkBasePropertyDeserializer.h"
-#include "mitkProperties.h"
-
-#include "SceneSerializationBaseExports.h"
-
-namespace mitk
-{
-class SceneSerializationBase_EXPORT Point3iPropertyDeserializer : public BasePropertyDeserializer
-{
- public:
- mitkClassMacro( Point3iPropertyDeserializer, BasePropertyDeserializer );
- itkNewMacro(Self);
- virtual BaseProperty::Pointer Deserialize(TiXmlElement* element)
- {
- if (!element) return NULL;
-
- Point3I v;
- if ( element->QueryIntAttribute( "x", &v[0] ) != TIXML_SUCCESS ) return NULL;
- if ( element->QueryIntAttribute( "y", &v[1] ) != TIXML_SUCCESS ) return NULL;
- if ( element->QueryIntAttribute( "z", &v[2] ) != TIXML_SUCCESS ) return NULL;
- return Point3iProperty::New( v ).GetPointer();
- }
- protected:
- Point3iPropertyDeserializer() {}
- virtual ~Point3iPropertyDeserializer() {}
-};
-} // namespace
-// important to put this into the GLOBAL namespace (because it starts with 'namespace mitk')
-MITK_REGISTER_SERIALIZER(Point3iPropertyDeserializer);
-#endif
diff --git a/Modules/SceneSerializationBase/BasePropertyDeserializer/mitkPoint4dPropertyDeserializer.cpp b/Modules/SceneSerializationBase/BasePropertyDeserializer/mitkPoint4dPropertyDeserializer.cpp
deleted file mode 100644
index a2404e2347..0000000000
--- a/Modules/SceneSerializationBase/BasePropertyDeserializer/mitkPoint4dPropertyDeserializer.cpp
+++ /dev/null
@@ -1,62 +0,0 @@
-/*=========================================================================
-
-Program: Medical Imaging & Interaction Toolkit
-Language: C++
-Date: $Date$
-Version: $Revision: 1.12 $
-
-Copyright (c) German Cancer Research Center, Division of Medical and
-Biological Informatics. All rights reserved.
-See MITKCopyright.txt or http://www.mitk.org/copyright.html for details.
-
-This software is distributed WITHOUT ANY WARRANTY; without even
-the implied warranty of MERCHANTABILITY or FITNESS FOR A PARTICULAR
-PURPOSE. See the above copyright notices for more information.
-
-=========================================================================*/
-
-#ifndef mitkPoint4dPropertyDeserializer_h_included
-#define mitkPoint4dPropertyDeserializer_h_included
-
-#include "mitkBasePropertyDeserializer.h"
-
-#include "mitkProperties.h"
-
-#include "SceneSerializationBaseExports.h"
-
-namespace mitk
-{
-
-class SceneSerializationBase_EXPORT Point4dPropertyDeserializer : public BasePropertyDeserializer
-{
- public:
-
- mitkClassMacro( Point4dPropertyDeserializer, BasePropertyDeserializer );
- itkNewMacro(Self);
-
- virtual BaseProperty::Pointer Deserialize(TiXmlElement* element)
- {
- if (!element) return NULL;
-
- Point4D v;
- if ( element->QueryFloatAttribute( "x", &v[0] ) != TIXML_SUCCESS ) return NULL;
- if ( element->QueryFloatAttribute( "y", &v[1] ) != TIXML_SUCCESS ) return NULL;
- if ( element->QueryFloatAttribute( "z", &v[2] ) != TIXML_SUCCESS ) return NULL;
- if ( element->QueryFloatAttribute( "t", &v[3] ) != TIXML_SUCCESS ) return NULL;
-
- return Point4dProperty::New( v ).GetPointer();
- }
-
- protected:
-
- Point4dPropertyDeserializer() {}
- virtual ~Point4dPropertyDeserializer() {}
-};
-
-} // namespace
-
-// important to put this into the GLOBAL namespace (because it starts with 'namespace mitk')
-MITK_REGISTER_SERIALIZER(Point4dPropertyDeserializer);
-
-#endif
-
diff --git a/Modules/SceneSerializationBase/BasePropertyDeserializer/mitkStringLookupTablePropertyDeserializer.cpp b/Modules/SceneSerializationBase/BasePropertyDeserializer/mitkStringLookupTablePropertyDeserializer.cpp
deleted file mode 100644
index e3f85aea7a..0000000000
--- a/Modules/SceneSerializationBase/BasePropertyDeserializer/mitkStringLookupTablePropertyDeserializer.cpp
+++ /dev/null
@@ -1,65 +0,0 @@
-/*=========================================================================
-
-Program: Medical Imaging & Interaction Toolkit
-Language: C++
-Date: $Date: 2009-10-08 17:07:40 +0200 (Do, 08. Okt 2009) $
-Version: $Revision: 1.12 $
-
-Copyright (c) German Cancer Research Center, Division of Medical and
-Biological Informatics. All rights reserved.
-See MITKCopyright.txt or http://www.mitk.org/copyright.html for details.
-
-This software is distributed WITHOUT ANY WARRANTY; without even
-the implied warranty of MERCHANTABILITY or FITNESS FOR A PARTICULAR
-PURPOSE. See the above copyright notices for more information.
-
-=========================================================================*/
-
-#ifndef mitkStringLookupTablePropertyDeserializer_h_included
-#define mitkStringLookupTablePropertyDeserializer_h_included
-
-#include "mitkBasePropertyDeserializer.h"
-
-#include "mitkProperties.h"
-
-#include "SceneSerializationBaseExports.h"
-
-namespace mitk
-{
-
-class SceneSerializationBase_EXPORT StringLookupTablePropertyDeserializer : public BasePropertyDeserializer
-{
- public:
-
- mitkClassMacro( StringLookupTablePropertyDeserializer, BasePropertyDeserializer );
- itkNewMacro(Self);
-
- virtual BaseProperty::Pointer Deserialize(TiXmlElement* element)
- {
- if (!element)
- return NULL;
-
- StringLookupTable lut;
- for( TiXmlElement* child = element->FirstChildElement("LUTValue"); child != NULL; child = child->NextSiblingElement("LUTValue"))
- {
-
- int temp;
- if (child->QueryIntAttribute("id", &temp) == TIXML_WRONG_TYPE)
- return NULL; // TODO: can we do a better error handling?
- StringLookupTable::IdentifierType id = static_cast<StringLookupTable::IdentifierType>(temp);
-
- if (child->Attribute("value") == NULL)
- return NULL; // TODO: can we do a better error handling?
- StringLookupTable::ValueType val = child->Attribute("value");
- lut.SetTableValue(id, val);
- }
- return StringLookupTableProperty::New(lut).GetPointer();
- }
- protected:
- StringLookupTablePropertyDeserializer() {}
- virtual ~StringLookupTablePropertyDeserializer() {}
-};
-} // namespace
-// important to put this into the GLOBAL namespace (because it starts with 'namespace mitk')
-MITK_REGISTER_SERIALIZER(StringLookupTablePropertyDeserializer);
-#endif
diff --git a/Modules/SceneSerializationBase/BasePropertyDeserializer/mitkStringPropertyDeserializer.cpp b/Modules/SceneSerializationBase/BasePropertyDeserializer/mitkStringPropertyDeserializer.cpp
deleted file mode 100644
index 804d98cb99..0000000000
--- a/Modules/SceneSerializationBase/BasePropertyDeserializer/mitkStringPropertyDeserializer.cpp
+++ /dev/null
@@ -1,56 +0,0 @@
-/*=========================================================================
-
-Program: Medical Imaging & Interaction Toolkit
-Language: C++
-Date: $Date$
-Version: $Revision: 1.12 $
-
-Copyright (c) German Cancer Research Center, Division of Medical and
-Biological Informatics. All rights reserved.
-See MITKCopyright.txt or http://www.mitk.org/copyright.html for details.
-
-This software is distributed WITHOUT ANY WARRANTY; without even
-the implied warranty of MERCHANTABILITY or FITNESS FOR A PARTICULAR
-PURPOSE. See the above copyright notices for more information.
-
-=========================================================================*/
-
-#ifndef mitkStringPropertyDeserializer_h_included
-#define mitkStringPropertyDeserializer_h_included
-
-#include "mitkBasePropertyDeserializer.h"
-
-#include "mitkStringProperty.h"
-
-#include "SceneSerializationBaseExports.h"
-
-namespace mitk
-{
-
-class SceneSerializationBase_EXPORT StringPropertyDeserializer : public BasePropertyDeserializer
-{
- public:
-
- mitkClassMacro( StringPropertyDeserializer, BasePropertyDeserializer );
- itkNewMacro(Self);
-
- virtual BaseProperty::Pointer Deserialize(TiXmlElement* element)
- {
- if (!element) return NULL;
- const char* s( element->Attribute("value") );
- return StringProperty::New( std::string(s?s:"") ).GetPointer();
- }
-
- protected:
-
- StringPropertyDeserializer() {}
- virtual ~StringPropertyDeserializer() {}
-};
-
-} // namespace
-
-// important to put this into the GLOBAL namespace (because it starts with 'namespace mitk')
-MITK_REGISTER_SERIALIZER(StringPropertyDeserializer);
-
-#endif
-
diff --git a/Modules/SceneSerializationBase/BasePropertyDeserializer/mitkTransferFunctionPropertyDeserializer.cpp b/Modules/SceneSerializationBase/BasePropertyDeserializer/mitkTransferFunctionPropertyDeserializer.cpp
deleted file mode 100644
index 8fb56825e6..0000000000
--- a/Modules/SceneSerializationBase/BasePropertyDeserializer/mitkTransferFunctionPropertyDeserializer.cpp
+++ /dev/null
@@ -1,139 +0,0 @@
-/*=========================================================================
-
-Program: Medical Imaging & Interaction Toolkit
-Language: C++
-Date: $Date$
-Version: $Revision: 1.12 $
-
-Copyright (c) German Cancer Research Center, Division of Medical and
-Biological Informatics. All rights reserved.
-See MITKCopyright.txt or http://www.mitk.org/copyright.html for details.
-
-This software is distributed WITHOUT ANY WARRANTY; without even
-the implied warranty of MERCHANTABILITY or FITNESS FOR A PARTICULAR
-PURPOSE. See the above copyright notices for more information.
-
-=========================================================================*/
-
-#include "mitkTransferFunctionPropertyDeserializer.h"
-
-namespace mitk {
-
-mitk::TransferFunctionPropertyDeserializer::TransferFunctionPropertyDeserializer()
-{
-}
-
-mitk::TransferFunctionPropertyDeserializer::~TransferFunctionPropertyDeserializer()
-{
-}
-
-BaseProperty::Pointer mitk::TransferFunctionPropertyDeserializer::Deserialize(TiXmlElement* element)
-{
- if (!element)
- return NULL;
-
- TransferFunction::Pointer tf = TransferFunction::New();
-
- // deserialize scalar opacity function
- TiXmlElement* scalarOpacityPointlist = element->FirstChildElement("ScalarOpacity");
- if (scalarOpacityPointlist == NULL)
- return NULL;
-
- tf->ClearScalarOpacityPoints();
-
- for( TiXmlElement* pointElement = scalarOpacityPointlist->FirstChildElement("point"); pointElement != NULL; pointElement = pointElement->NextSiblingElement("point"))
- {
- double x;
- double y;
- if (pointElement->QueryDoubleAttribute("x", &x) == TIXML_WRONG_TYPE)
- return NULL; // TODO: can we do a better error handling?
- if (pointElement->QueryDoubleAttribute("y", &y) == TIXML_WRONG_TYPE)
- return NULL; // TODO: can we do a better error handling?
- tf->AddScalarOpacityPoint(x, y);
- }
-
- TiXmlElement* gradientOpacityPointlist = element->FirstChildElement("GradientOpacity");
- if (gradientOpacityPointlist == NULL)
- return NULL;
-
- tf->ClearGradientOpacityPoints();
-
- for( TiXmlElement* pointElement = gradientOpacityPointlist->FirstChildElement("point"); pointElement != NULL; pointElement = pointElement->NextSiblingElement("point"))
- {
- double x;
- double y;
- if (pointElement->QueryDoubleAttribute("x", &x) == TIXML_WRONG_TYPE)
- return NULL; // TODO: can we do a better error handling?
- if (pointElement->QueryDoubleAttribute("y", &y) == TIXML_WRONG_TYPE)
- return NULL; // TODO: can we do a better error handling?
- tf->AddGradientOpacityPoint(x, y);
- }
-
- TiXmlElement* rgbPointlist = element->FirstChildElement("Color");
- if (rgbPointlist == NULL)
- return NULL;
- vtkColorTransferFunction* ctf = tf->GetColorTransferFunction();
- if (ctf == NULL)
- return NULL;
-
- ctf->RemoveAllPoints();
-
- for( TiXmlElement* pointElement = rgbPointlist->FirstChildElement("point"); pointElement != NULL; pointElement = pointElement->NextSiblingElement("point"))
- {
- double x;
- double r,g,b, midpoint, sharpness;
- if (pointElement->QueryDoubleAttribute("x", &x) == TIXML_WRONG_TYPE)
- return NULL; // TODO: can we do a better error handling?
- if (pointElement->QueryDoubleAttribute("r", &r) == TIXML_WRONG_TYPE)
- return NULL; // TODO: can we do a better error handling?
- if (pointElement->QueryDoubleAttribute("g", &g) == TIXML_WRONG_TYPE)
- return NULL; // TODO: can we do a better error handling?
- if (pointElement->QueryDoubleAttribute("b", &b) == TIXML_WRONG_TYPE)
- return NULL; // TODO: can we do a better error handling?
- if (pointElement->QueryDoubleAttribute("midpoint", &midpoint) == TIXML_WRONG_TYPE)
- return NULL; // TODO: can we do a better error handling?
- if (pointElement->QueryDoubleAttribute("sharpness", &sharpness) == TIXML_WRONG_TYPE)
- return NULL; // TODO: can we do a better error handling?
- ctf->AddRGBPoint(x, r, g, b, midpoint, sharpness);
- }
- return TransferFunctionProperty::New(tf).GetPointer();
-}
-
-mitk::TransferFunction::Pointer mitk::TransferFunctionPropertyDeserializer::DeserializeTransferFunction( const char *filePath )
-{
- TiXmlDocument document( filePath );
-
- if (!document.LoadFile())
- {
- MITK_ERROR << "Could not open/read/parse " << filePath << "\nTinyXML reports: " << document.ErrorDesc() << std::endl;
- return NULL;
- }
-
- // find version node --> note version in some variable
- int fileVersion = 1;
- TiXmlElement* versionObject = document.FirstChildElement("Version");
- if (versionObject)
- {
- if ( versionObject->QueryIntAttribute( "TransferfunctionVersion", &fileVersion ) != TIXML_SUCCESS )
- {
- MITK_WARN << "Transferfunction file " << filePath << " does not contain version information! Trying version 1 format.";
- }
- }
-
- TiXmlElement* input = document.FirstChildElement("TransferFunction");
-
- TransferFunctionPropertyDeserializer::Pointer tfpd = TransferFunctionPropertyDeserializer::New();
- BaseProperty::Pointer bp = tfpd->Deserialize(input);
- TransferFunctionProperty::Pointer tfp = dynamic_cast<TransferFunctionProperty*>(bp.GetPointer());
-
- if(tfp.IsNotNull())
- {
- TransferFunction::Pointer tf = tfp->GetValue();
- return tf;
- }
- MITK_WARN << "Can't deserialize transferfunction";
- return NULL;
-}
-} // namespace
-// important to put this into the GLOBAL namespace (because it starts with 'namespace mitk')
-MITK_REGISTER_SERIALIZER(TransferFunctionPropertyDeserializer);
diff --git a/Modules/SceneSerializationBase/BasePropertyDeserializer/mitkTransferFunctionPropertyDeserializer.h b/Modules/SceneSerializationBase/BasePropertyDeserializer/mitkTransferFunctionPropertyDeserializer.h
deleted file mode 100644
index 4f9ee445f1..0000000000
--- a/Modules/SceneSerializationBase/BasePropertyDeserializer/mitkTransferFunctionPropertyDeserializer.h
+++ /dev/null
@@ -1,48 +0,0 @@
-/*=========================================================================
-
-Program: Medical Imaging & Interaction Toolkit
-Language: C++
-Date: $Date: 2009-10-23 11:12:48 +0200 (Fr, 23 Okt 2009) $
-Version: $Revision: 1.12 $
-
-Copyright (c) German Cancer Research Center, Division of Medical and
-Biological Informatics. All rights reserved.
-See MITKCopyright.txt or http://www.mitk.org/copyright.html for details.
-
-This software is distributed WITHOUT ANY WARRANTY; without even
-the implied warranty of MERCHANTABILITY or FITNESS FOR A PARTICULAR
-PURPOSE. See the above copyright notices for more information.
-
-=========================================================================*/
-
-#include "mitkBasePropertyDeserializer.h"
-#include "mitkTransferFunctionProperty.h"
-
-#include "SceneSerializationBaseExports.h"
-
-namespace mitk
-{
-
- class SceneSerializationBase_EXPORT TransferFunctionPropertyDeserializer : public BasePropertyDeserializer
- {
- public:
-
- mitkClassMacro( TransferFunctionPropertyDeserializer, BasePropertyDeserializer );
- itkNewMacro(Self);
-
- virtual BaseProperty::Pointer Deserialize(TiXmlElement* element);
- static TransferFunction::Pointer DeserializeTransferFunction( const char *filePath );
-
-
- protected:
-
- TransferFunctionPropertyDeserializer();
- virtual ~TransferFunctionPropertyDeserializer();
- };
-
-} // namespace
-
-
-
-
-
diff --git a/Modules/SceneSerializationBase/BasePropertyDeserializer/mitkVector3DPropertyDeserializer.cpp b/Modules/SceneSerializationBase/BasePropertyDeserializer/mitkVector3DPropertyDeserializer.cpp
deleted file mode 100644
index 97518fc0a2..0000000000
--- a/Modules/SceneSerializationBase/BasePropertyDeserializer/mitkVector3DPropertyDeserializer.cpp
+++ /dev/null
@@ -1,61 +0,0 @@
-/*=========================================================================
-
-Program: Medical Imaging & Interaction Toolkit
-Language: C++
-Date: $Date$
-Version: $Revision: 1.12 $
-
-Copyright (c) German Cancer Research Center, Division of Medical and
-Biological Informatics. All rights reserved.
-See MITKCopyright.txt or http://www.mitk.org/copyright.html for details.
-
-This software is distributed WITHOUT ANY WARRANTY; without even
-the implied warranty of MERCHANTABILITY or FITNESS FOR A PARTICULAR
-PURPOSE. See the above copyright notices for more information.
-
-=========================================================================*/
-
-#ifndef mitkVector3dPropertyDeserializer_h_included
-#define mitkVector3dPropertyDeserializer_h_included
-
-#include "mitkBasePropertyDeserializer.h"
-
-#include "mitkProperties.h"
-
-#include "SceneSerializationBaseExports.h"
-
-namespace mitk
-{
-
-class SceneSerializationBase_EXPORT Vector3DPropertyDeserializer : public BasePropertyDeserializer
-{
- public:
-
- mitkClassMacro( Vector3DPropertyDeserializer, BasePropertyDeserializer );
- itkNewMacro(Self);
-
- virtual BaseProperty::Pointer Deserialize(TiXmlElement* element)
- {
- if (!element) return NULL;
-
- Vector3D v;
- if ( element->QueryFloatAttribute( "x", &v[0] ) != TIXML_SUCCESS ) return NULL;
- if ( element->QueryFloatAttribute( "y", &v[1] ) != TIXML_SUCCESS ) return NULL;
- if ( element->QueryFloatAttribute( "z", &v[2] ) != TIXML_SUCCESS ) return NULL;
-
- return Vector3DProperty::New( v ).GetPointer();
- }
-
- protected:
-
- Vector3DPropertyDeserializer() {}
- virtual ~Vector3DPropertyDeserializer() {}
-};
-
-} // namespace
-
-// important to put this into the GLOBAL namespace (because it starts with 'namespace mitk')
-MITK_REGISTER_SERIALIZER(Vector3DPropertyDeserializer);
-
-#endif
-
diff --git a/Modules/SceneSerializationBase/BasePropertySerializer/mitkAnnotationPropertySerializer.cpp b/Modules/SceneSerializationBase/BasePropertySerializer/mitkAnnotationPropertySerializer.cpp
index 7e905a4ee5..b194ab11d2 100644
--- a/Modules/SceneSerializationBase/BasePropertySerializer/mitkAnnotationPropertySerializer.cpp
+++ b/Modules/SceneSerializationBase/BasePropertySerializer/mitkAnnotationPropertySerializer.cpp
@@ -1,64 +1,78 @@
/*=========================================================================
Program: Medical Imaging & Interaction Toolkit
Language: C++
Date: $Date: 2009-07-07 15:56:37 +0200 (Di, 07. Jul 2009) $
Version: $Revision: 1.12 $
Copyright (c) German Cancer Research Center, Division of Medical and
Biological Informatics. All rights reserved.
See MITKCopyright.txt or http://www.mitk.org/copyright.html for details.
This software is distributed WITHOUT ANY WARRANTY; without even
the implied warranty of MERCHANTABILITY or FITNESS FOR A PARTICULAR
PURPOSE. See the above copyright notices for more information.
=========================================================================*/
#ifndef mitkAnnotationPropertySerializer_h_included
#define mitkAnnotationPropertySerializer_h_included
#include "mitkBasePropertySerializer.h"
#include "mitkAnnotationProperty.h"
#include "SceneSerializationBaseExports.h"
namespace mitk
{
class SceneSerializationBase_EXPORT AnnotationPropertySerializer : public BasePropertySerializer
{
public:
mitkClassMacro( AnnotationPropertySerializer, BasePropertySerializer );
itkNewMacro(Self);
virtual TiXmlElement* Serialize()
{
if (const AnnotationProperty* prop = dynamic_cast<const AnnotationProperty*>(m_Property.GetPointer()))
{
TiXmlElement* element = new TiXmlElement("annotation");
element->SetAttribute("label", prop->GetLabel());
Point3D point = prop->GetPosition();
element->SetDoubleAttribute("x", point[0]);
element->SetDoubleAttribute("y", point[1]);
element->SetDoubleAttribute("z", point[2]);
return element;
}
else return NULL;
}
+ virtual BaseProperty::Pointer Deserialize(TiXmlElement* element)
+ {
+ if (!element) return NULL;
+ const char* label( element->Attribute("label") );
+ Point3D p;
+ if ( element->QueryFloatAttribute( "x", &p[0] ) != TIXML_SUCCESS )
+ return NULL;
+ if ( element->QueryFloatAttribute( "y", &p[1] ) != TIXML_SUCCESS )
+ return NULL;
+ if ( element->QueryFloatAttribute( "z", &p[2] ) != TIXML_SUCCESS )
+ return NULL;
+ return AnnotationProperty::New(label, p).GetPointer();
+ }
+
protected:
AnnotationPropertySerializer() {}
virtual ~AnnotationPropertySerializer() {}
};
} // namespace
// important to put this into the GLOBAL namespace (because it starts with 'namespace mitk')
MITK_REGISTER_SERIALIZER(AnnotationPropertySerializer);
#endif
diff --git a/Modules/SceneSerializationBase/BasePropertySerializer/mitkBoolLookupTablePropertySerializer.cpp b/Modules/SceneSerializationBase/BasePropertySerializer/mitkBoolLookupTablePropertySerializer.cpp
index d1d458a1bf..cf2a679403 100644
--- a/Modules/SceneSerializationBase/BasePropertySerializer/mitkBoolLookupTablePropertySerializer.cpp
+++ b/Modules/SceneSerializationBase/BasePropertySerializer/mitkBoolLookupTablePropertySerializer.cpp
@@ -1,67 +1,86 @@
/*=========================================================================
Program: Medical Imaging & Interaction Toolkit
Language: C++
Date: $Date: 2009-10-08 17:10:12 +0200 (Do, 08. Okt 2009) $
Version: $Revision: 1.12 $
Copyright (c) German Cancer Research Center, Division of Medical and
Biological Informatics. All rights reserved.
See MITKCopyright.txt or http://www.mitk.org/copyright.html for details.
This software is distributed WITHOUT ANY WARRANTY; without even
the implied warranty of MERCHANTABILITY or FITNESS FOR A PARTICULAR
PURPOSE. See the above copyright notices for more information.
=========================================================================*/
#ifndef mitkBoolLookupTablePropertySerializer_h_included
#define mitkBoolLookupTablePropertySerializer_h_included
#include "mitkBasePropertySerializer.h"
#include "mitkProperties.h"
#include "SceneSerializationBaseExports.h"
namespace mitk
{
class SceneSerializationBase_EXPORT BoolLookupTablePropertySerializer : public BasePropertySerializer
{
public:
mitkClassMacro( BoolLookupTablePropertySerializer, BasePropertySerializer );
itkNewMacro(Self);
virtual TiXmlElement* Serialize()
{
const BoolLookupTableProperty* prop = dynamic_cast<const BoolLookupTableProperty*>(m_Property.GetPointer());
if (prop == NULL)
return NULL;
BoolLookupTable lut = prop->GetValue();
//if (lut.IsNull())
// return NULL; // really?
const BoolLookupTable::LookupTableType& map = lut.GetLookupTable();
TiXmlElement* element = new TiXmlElement("BoolLookupTable");
for (BoolLookupTable::LookupTableType::const_iterator it = map.begin(); it != map.end(); ++it)
{
TiXmlElement* tableEntry = new TiXmlElement("LUTValue");
tableEntry->SetAttribute("id", it->first);
if (it->second == true)
tableEntry->SetAttribute("value", "true");
else
tableEntry->SetAttribute("value", "false");
element->LinkEndChild( tableEntry );
}
return element;
}
+
+ virtual BaseProperty::Pointer Deserialize(TiXmlElement* element)
+ {
+ if (!element)
+ return NULL;
+
+ BoolLookupTable lut;
+ for( TiXmlElement* child = element->FirstChildElement("LUTValue"); child != NULL; child = child->NextSiblingElement("LUTValue"))
+ {
+
+ int xmlID;
+ if (child->QueryIntAttribute("id", &xmlID) == TIXML_WRONG_TYPE)
+ return NULL; // TODO: can we do a better error handling?
+ BoolLookupTable::IdentifierType id = static_cast<BoolLookupTable::IdentifierType>(xmlID);
+ BoolLookupTable::ValueType val = std::string(child->Attribute("value")) == std::string("true");
+ lut.SetTableValue(id, val);
+ }
+ return BoolLookupTableProperty::New(lut).GetPointer();
+ }
protected:
BoolLookupTablePropertySerializer() {}
virtual ~BoolLookupTablePropertySerializer() {}
};
} // namespace
// important to put this into the GLOBAL namespace (because it starts with 'namespace mitk')
MITK_REGISTER_SERIALIZER(BoolLookupTablePropertySerializer);
#endif
diff --git a/Modules/SceneSerializationBase/mitkBoolPropertySerializer.cpp b/Modules/SceneSerializationBase/BasePropertySerializer/mitkBoolPropertySerializer.cpp
similarity index 89%
rename from Modules/SceneSerializationBase/mitkBoolPropertySerializer.cpp
rename to Modules/SceneSerializationBase/BasePropertySerializer/mitkBoolPropertySerializer.cpp
index 67ec6d9ec3..cf782df281 100644
--- a/Modules/SceneSerializationBase/mitkBoolPropertySerializer.cpp
+++ b/Modules/SceneSerializationBase/BasePropertySerializer/mitkBoolPropertySerializer.cpp
@@ -1,67 +1,73 @@
/*=========================================================================
Program: Medical Imaging & Interaction Toolkit
Language: C++
Date: $Date$
Version: $Revision: 1.12 $
Copyright (c) German Cancer Research Center, Division of Medical and
Biological Informatics. All rights reserved.
See MITKCopyright.txt or http://www.mitk.org/copyright.html for details.
This software is distributed WITHOUT ANY WARRANTY; without even
the implied warranty of MERCHANTABILITY or FITNESS FOR A PARTICULAR
PURPOSE. See the above copyright notices for more information.
=========================================================================*/
#ifndef mitkBoolPropertySerializer_h_included
#define mitkBoolPropertySerializer_h_included
#include "mitkBasePropertySerializer.h"
#include "mitkProperties.h"
#include "SceneSerializationBaseExports.h"
namespace mitk
{
class SceneSerializationBase_EXPORT BoolPropertySerializer : public BasePropertySerializer
{
public:
mitkClassMacro( BoolPropertySerializer, BasePropertySerializer );
itkNewMacro(Self);
virtual TiXmlElement* Serialize()
{
if (const BoolProperty* prop = dynamic_cast<const BoolProperty*>(m_Property.GetPointer()))
{
TiXmlElement* element = new TiXmlElement("bool");
if (prop->GetValue() == true)
{
element->SetAttribute("value", "true");
}
else
{
element->SetAttribute("value", "false");
}
return element;
}
else return NULL;
}
+ virtual BaseProperty::Pointer Deserialize(TiXmlElement* element)
+ {
+ if (!element) return NULL;
+ return BoolProperty::New( std::string(element->Attribute("value")) == "true" ).GetPointer();
+ }
+
protected:
BoolPropertySerializer() {}
virtual ~BoolPropertySerializer() {}
};
} // namespace
// important to put this into the GLOBAL namespace (because it starts with 'namespace mitk')
MITK_REGISTER_SERIALIZER(BoolPropertySerializer);
#endif
diff --git a/Modules/SceneSerializationBase/BasePropertySerializer/mitkClippingPropertySerializer.cpp b/Modules/SceneSerializationBase/BasePropertySerializer/mitkClippingPropertySerializer.cpp
index 52ca7ee473..e20f357d8d 100644
--- a/Modules/SceneSerializationBase/BasePropertySerializer/mitkClippingPropertySerializer.cpp
+++ b/Modules/SceneSerializationBase/BasePropertySerializer/mitkClippingPropertySerializer.cpp
@@ -1,69 +1,100 @@
/*=========================================================================
Program: Medical Imaging & Interaction Toolkit
Language: C++
Date: $Date: 2009-07-07 15:56:37 +0200 (Di, 07. Jul 2009) $
Version: $Revision: 1.12 $
Copyright (c) German Cancer Research Center, Division of Medical and
Biological Informatics. All rights reserved.
See MITKCopyright.txt or http://www.mitk.org/copyright.html for details.
This software is distributed WITHOUT ANY WARRANTY; without even
the implied warranty of MERCHANTABILITY or FITNESS FOR A PARTICULAR
PURPOSE. See the above copyright notices for more information.
=========================================================================*/
#ifndef mitkClippingPropertySerializer_h_included
#define mitkClippingPropertySerializer_h_included
#include "mitkBasePropertySerializer.h"
#include "mitkClippingProperty.h"
#include "mitkVector.h"
#include "SceneSerializationBaseExports.h"
namespace mitk
{
class SceneSerializationBase_EXPORT ClippingPropertySerializer : public BasePropertySerializer
{
public:
mitkClassMacro( ClippingPropertySerializer, BasePropertySerializer );
itkNewMacro(Self);
virtual TiXmlElement* Serialize()
{
if (const ClippingProperty* prop = dynamic_cast<const ClippingProperty*>(m_Property.GetPointer()))
{
TiXmlElement* element = new TiXmlElement("clipping");
if (prop->GetClippingEnabled())
element->SetAttribute("enabled", "true");
else
element->SetAttribute("enabled", "false");
TiXmlElement* originElement = new TiXmlElement("origin");
const Point3D origin = prop->GetOrigin();
originElement->SetDoubleAttribute("x", origin[0]);
originElement->SetDoubleAttribute("y", origin[1]);
originElement->SetDoubleAttribute("z", origin[2]);
element->LinkEndChild(originElement);
TiXmlElement* normalElement = new TiXmlElement("normal");
const Vector3D normal = prop->GetNormal();
normalElement->SetDoubleAttribute("x", normal[0]);
normalElement->SetDoubleAttribute("y", normal[1]);
normalElement->SetDoubleAttribute("z", normal[2]);
element->LinkEndChild(normalElement);
return element;
}
else
return NULL;
}
+
+ virtual BaseProperty::Pointer Deserialize(TiXmlElement* element)
+ {
+ if (!element)
+ return NULL;
+ bool enabled = std::string(element->Attribute("enabled")) == "true";
+
+ TiXmlElement* originElement = element->FirstChildElement("origin");
+ if (originElement == NULL)
+ return NULL;
+ Point3D origin;
+ if ( originElement->QueryFloatAttribute( "x", &origin[0] ) != TIXML_SUCCESS )
+ return NULL;
+ if ( originElement->QueryFloatAttribute( "y", &origin[1] ) != TIXML_SUCCESS )
+ return NULL;
+ if ( originElement->QueryFloatAttribute( "z", &origin[2] ) != TIXML_SUCCESS )
+ return NULL;
+ TiXmlElement* normalElement = element->FirstChildElement("normal");
+ if (normalElement == NULL)
+ return NULL;
+ Vector3D normal;
+ if ( normalElement->QueryFloatAttribute( "x", &normal[0] ) != TIXML_SUCCESS )
+ return NULL;
+ if ( normalElement->QueryFloatAttribute( "y", &normal[1] ) != TIXML_SUCCESS )
+ return NULL;
+ if ( normalElement->QueryFloatAttribute( "z", &normal[2] ) != TIXML_SUCCESS )
+ return NULL;
+ ClippingProperty::Pointer cp = ClippingProperty::New(origin, normal);
+ cp->SetClippingEnabled(enabled);
+ return cp.GetPointer();
+ }
protected:
ClippingPropertySerializer() {}
virtual ~ClippingPropertySerializer() {}
};
} // namespace
// important to put this into the GLOBAL namespace (because it starts with 'namespace mitk')
MITK_REGISTER_SERIALIZER(ClippingPropertySerializer);
#endif
diff --git a/Modules/SceneSerializationBase/BasePropertySerializer/mitkColorPropertySerializer.cpp b/Modules/SceneSerializationBase/BasePropertySerializer/mitkColorPropertySerializer.cpp
index bb6dd7256c..0084ddfa7b 100644
--- a/Modules/SceneSerializationBase/BasePropertySerializer/mitkColorPropertySerializer.cpp
+++ b/Modules/SceneSerializationBase/BasePropertySerializer/mitkColorPropertySerializer.cpp
@@ -1,63 +1,75 @@
/*=========================================================================
Program: Medical Imaging & Interaction Toolkit
Language: C++
Date: $Date$
Version: $Revision: 1.12 $
Copyright (c) German Cancer Research Center, Division of Medical and
Biological Informatics. All rights reserved.
See MITKCopyright.txt or http://www.mitk.org/copyright.html for details.
This software is distributed WITHOUT ANY WARRANTY; without even
the implied warranty of MERCHANTABILITY or FITNESS FOR A PARTICULAR
PURPOSE. See the above copyright notices for more information.
=========================================================================*/
#ifndef mitkColorPropertySerializer_h_included
#define mitkColorPropertySerializer_h_included
#include "mitkBasePropertySerializer.h"
#include "mitkColorProperty.h"
#include "SceneSerializationBaseExports.h"
namespace mitk
{
class SceneSerializationBase_EXPORT ColorPropertySerializer : public BasePropertySerializer
{
public:
mitkClassMacro( ColorPropertySerializer, BasePropertySerializer );
itkNewMacro(Self);
virtual TiXmlElement* Serialize()
{
if (const ColorProperty* prop = dynamic_cast<const ColorProperty*>(m_Property.GetPointer()))
{
TiXmlElement* element = new TiXmlElement("color");
Color color = prop->GetValue();
element->SetDoubleAttribute("r", color[0]);
element->SetDoubleAttribute("g", color[1]);
element->SetDoubleAttribute("b", color[2]);
return element;
}
else return NULL;
}
+ virtual BaseProperty::Pointer Deserialize(TiXmlElement* element)
+ {
+ if (!element) return NULL;
+
+ Color c;
+ if ( element->QueryFloatAttribute( "r", &c[0] ) != TIXML_SUCCESS ) return NULL;
+ if ( element->QueryFloatAttribute( "g", &c[1] ) != TIXML_SUCCESS ) return NULL;
+ if ( element->QueryFloatAttribute( "b", &c[2] ) != TIXML_SUCCESS ) return NULL;
+
+ return ColorProperty::New( c ).GetPointer();
+ }
+
protected:
ColorPropertySerializer() {}
virtual ~ColorPropertySerializer() {}
};
} // namespace
// important to put this into the GLOBAL namespace (because it starts with 'namespace mitk')
MITK_REGISTER_SERIALIZER(ColorPropertySerializer);
#endif
diff --git a/Modules/SceneSerializationBase/BasePropertySerializer/mitkDoublePropertySerializer.cpp b/Modules/SceneSerializationBase/BasePropertySerializer/mitkDoublePropertySerializer.cpp
index 164bbb2cc9..638e5da94f 100644
--- a/Modules/SceneSerializationBase/BasePropertySerializer/mitkDoublePropertySerializer.cpp
+++ b/Modules/SceneSerializationBase/BasePropertySerializer/mitkDoublePropertySerializer.cpp
@@ -1,60 +1,75 @@
/*=========================================================================
Program: Medical Imaging & Interaction Toolkit
Language: C++
Date: $Date$
Version: $Revision: 1.12 $
Copyright (c) German Cancer Research Center, Division of Medical and
Biological Informatics. All rights reserved.
See MITKCopyright.txt or http://www.mitk.org/copyright.html for details.
This software is distributed WITHOUT ANY WARRANTY; without even
the implied warranty of MERCHANTABILITY or FITNESS FOR A PARTICULAR
PURPOSE. See the above copyright notices for more information.
=========================================================================*/
#ifndef mitkDoublePropertySerializer_h_included
#define mitkDoublePropertySerializer_h_included
#include "mitkBasePropertySerializer.h"
#include "mitkProperties.h"
#include "SceneSerializationBaseExports.h"
namespace mitk
{
class SceneSerializationBase_EXPORT DoublePropertySerializer : public BasePropertySerializer
{
public:
mitkClassMacro( DoublePropertySerializer, BasePropertySerializer );
itkNewMacro(Self);
virtual TiXmlElement* Serialize()
{
if (const DoubleProperty* prop = dynamic_cast<const DoubleProperty*>(m_Property.GetPointer()))
{
TiXmlElement* element = new TiXmlElement("double");
element->SetDoubleAttribute("value", prop->GetValue());
return element;
}
else return NULL;
}
+ virtual BaseProperty::Pointer Deserialize(TiXmlElement* element)
+ {
+ if (!element) return NULL;
+
+ double d;
+ if ( element->QueryDoubleAttribute( "value", &d ) == TIXML_SUCCESS )
+ {
+ return DoubleProperty::New(d).GetPointer();
+ }
+ else
+ {
+ return NULL;
+ }
+ }
+
protected:
DoublePropertySerializer() {}
virtual ~DoublePropertySerializer() {}
};
} // namespace
// important to put this into the GLOBAL namespace (because it starts with 'namespace mitk')
MITK_REGISTER_SERIALIZER(DoublePropertySerializer);
#endif
diff --git a/Modules/SceneSerializationBase/BasePropertySerializer/mitkEnumerationSubclassesSerializer.cpp b/Modules/SceneSerializationBase/BasePropertySerializer/mitkEnumerationSubclassesSerializer.cpp
index ebf9bed27e..ccfa93f886 100644
--- a/Modules/SceneSerializationBase/BasePropertySerializer/mitkEnumerationSubclassesSerializer.cpp
+++ b/Modules/SceneSerializationBase/BasePropertySerializer/mitkEnumerationSubclassesSerializer.cpp
@@ -1,58 +1,76 @@
/*=========================================================================
Program: Medical Imaging & Interaction Toolkit
Language: C++
Date: $Date$
Version: $Revision: 1.12 $
Copyright (c) German Cancer Research Center, Division of Medical and
Biological Informatics. All rights reserved.
See MITKCopyright.txt or http://www.mitk.org/copyright.html for details.
This software is distributed WITHOUT ANY WARRANTY; without even
the implied warranty of MERCHANTABILITY or FITNESS FOR A PARTICULAR
PURPOSE. See the above copyright notices for more information.
=========================================================================*/
#ifndef mitkEnumerationSubclassesSerializer_h_included
#define mitkEnumerationSubclassesSerializer_h_included
#include "mitkEnumerationPropertySerializer.h"
+#include "mitkPlaneOrientationProperty.h"
+#include "mitkShaderProperty.h"
+#include "mitkVtkInterpolationProperty.h"
+#include "mitkVtkRepresentationProperty.h"
+#include "mitkVtkResliceInterpolationProperty.h"
+#include "mitkVtkScalarModeProperty.h"
+#include "mitkVtkVolumeRenderingProperty.h"
+#include "mitkModalityProperty.h"
+
#define MITK_REGISTER_ENUM_SUB_SERIALIZER(classname) \
\
namespace mitk \
{ \
\
class SceneSerializationBase_EXPORT classname ## Serializer : public EnumerationPropertySerializer \
{ \
public: \
\
mitkClassMacro( classname ## Serializer, EnumerationPropertySerializer ); \
itkNewMacro(Self); \
+ \
+ virtual BaseProperty::Pointer Deserialize(TiXmlElement* element) \
+ { \
+ if (!element) return NULL; \
+ const char* sa( element->Attribute("value") ); \
+ \
+ std::string s(sa?sa:""); \
+ classname::Pointer property = classname::New(); \
+ property->SetValue( s ); \
+ \
+ return property.GetPointer(); \
+ } \
\
protected: \
\
classname ## Serializer () {} \
virtual ~classname ## Serializer () {} \
}; \
\
} \
\
MITK_REGISTER_SERIALIZER( classname ## Serializer );
-MITK_REGISTER_ENUM_SUB_SERIALIZER(GridRepresentationProperty);
-MITK_REGISTER_ENUM_SUB_SERIALIZER(GridVolumeMapperProperty);
-MITK_REGISTER_ENUM_SUB_SERIALIZER(OrganTypeProperty);
MITK_REGISTER_ENUM_SUB_SERIALIZER(PlaneOrientationProperty);
MITK_REGISTER_ENUM_SUB_SERIALIZER(ShaderProperty);
MITK_REGISTER_ENUM_SUB_SERIALIZER(VtkInterpolationProperty);
MITK_REGISTER_ENUM_SUB_SERIALIZER(VtkRepresentationProperty);
MITK_REGISTER_ENUM_SUB_SERIALIZER(VtkResliceInterpolationProperty);
MITK_REGISTER_ENUM_SUB_SERIALIZER(VtkScalarModeProperty);
MITK_REGISTER_ENUM_SUB_SERIALIZER(VtkVolumeRenderingProperty);
MITK_REGISTER_ENUM_SUB_SERIALIZER(ModalityProperty);
#endif
diff --git a/Modules/SceneSerializationBase/BasePropertySerializer/mitkFloatLookupTablePropertySerializer.cpp b/Modules/SceneSerializationBase/BasePropertySerializer/mitkFloatLookupTablePropertySerializer.cpp
index 2231ed86b9..eead55e782 100644
--- a/Modules/SceneSerializationBase/BasePropertySerializer/mitkFloatLookupTablePropertySerializer.cpp
+++ b/Modules/SceneSerializationBase/BasePropertySerializer/mitkFloatLookupTablePropertySerializer.cpp
@@ -1,64 +1,86 @@
/*=========================================================================
Program: Medical Imaging & Interaction Toolkit
Language: C++
Date: $Date: 2009-10-08 17:10:12 +0200 (Do, 08. Okt 2009) $
Version: $Revision: 1.12 $
Copyright (c) German Cancer Research Center, Division of Medical and
Biological Informatics. All rights reserved.
See MITKCopyright.txt or http://www.mitk.org/copyright.html for details.
This software is distributed WITHOUT ANY WARRANTY; without even
the implied warranty of MERCHANTABILITY or FITNESS FOR A PARTICULAR
PURPOSE. See the above copyright notices for more information.
=========================================================================*/
#ifndef mitkFloatLookupTablePropertySerializer_h_included
#define mitkFloatLookupTablePropertySerializer_h_included
#include "mitkBasePropertySerializer.h"
#include "mitkProperties.h"
#include "SceneSerializationBaseExports.h"
namespace mitk
{
class SceneSerializationBase_EXPORT FloatLookupTablePropertySerializer : public BasePropertySerializer
{
public:
mitkClassMacro( FloatLookupTablePropertySerializer, BasePropertySerializer );
itkNewMacro(Self);
virtual TiXmlElement* Serialize()
{
const FloatLookupTableProperty* prop = dynamic_cast<const FloatLookupTableProperty*>(m_Property.GetPointer());
if (prop == NULL)
return NULL;
FloatLookupTable lut = prop->GetValue();
//if (lut.IsNull())
// return NULL; // really?
const FloatLookupTable::LookupTableType& map = lut.GetLookupTable();
TiXmlElement* element = new TiXmlElement("FloatLookupTableTable");
for (FloatLookupTable::LookupTableType::const_iterator it = map.begin(); it != map.end(); ++it)
{
TiXmlElement* tableEntry = new TiXmlElement("LUTValue");
tableEntry->SetAttribute("id", it->first);
tableEntry->SetDoubleAttribute("value", static_cast<double>(it->second));
element->LinkEndChild( tableEntry );
}
return element;
}
+
+ virtual BaseProperty::Pointer Deserialize(TiXmlElement* element)
+ {
+ if (!element)
+ return NULL;
+
+ FloatLookupTable lut;
+ for( TiXmlElement* child = element->FirstChildElement("LUTValue"); child != NULL; child = child->NextSiblingElement("LUTValue"))
+ {
+
+ int tempID;
+ if (child->QueryIntAttribute("id", &tempID) == TIXML_WRONG_TYPE)
+ return NULL; // TODO: can we do a better error handling?
+ FloatLookupTable::IdentifierType id = static_cast<FloatLookupTable::IdentifierType>(tempID);
+ float tempVal = -1.0;
+ if (child->QueryFloatAttribute("value", &tempVal) == TIXML_WRONG_TYPE)
+ return NULL; // TODO: can we do a better error handling?
+ FloatLookupTable::ValueType val = static_cast<FloatLookupTable::ValueType>(tempVal);
+ lut.SetTableValue(id, val);
+ }
+ return FloatLookupTableProperty::New(lut).GetPointer();
+ }
protected:
FloatLookupTablePropertySerializer() {}
virtual ~FloatLookupTablePropertySerializer() {}
};
} // namespace
// important to put this into the GLOBAL namespace (because it starts with 'namespace mitk')
MITK_REGISTER_SERIALIZER(FloatLookupTablePropertySerializer);
#endif
diff --git a/Modules/SceneSerializationBase/BasePropertySerializer/mitkFloatPropertySerializer.cpp b/Modules/SceneSerializationBase/BasePropertySerializer/mitkFloatPropertySerializer.cpp
index 7e419eead1..8c25f346a6 100644
--- a/Modules/SceneSerializationBase/BasePropertySerializer/mitkFloatPropertySerializer.cpp
+++ b/Modules/SceneSerializationBase/BasePropertySerializer/mitkFloatPropertySerializer.cpp
@@ -1,60 +1,75 @@
/*=========================================================================
Program: Medical Imaging & Interaction Toolkit
Language: C++
Date: $Date$
Version: $Revision: 1.12 $
Copyright (c) German Cancer Research Center, Division of Medical and
Biological Informatics. All rights reserved.
See MITKCopyright.txt or http://www.mitk.org/copyright.html for details.
This software is distributed WITHOUT ANY WARRANTY; without even
the implied warranty of MERCHANTABILITY or FITNESS FOR A PARTICULAR
PURPOSE. See the above copyright notices for more information.
=========================================================================*/
#ifndef mitkFloatPropertySerializer_h_included
#define mitkFloatPropertySerializer_h_included
#include "mitkBasePropertySerializer.h"
#include "mitkProperties.h"
#include "SceneSerializationBaseExports.h"
namespace mitk
{
class SceneSerializationBase_EXPORT FloatPropertySerializer : public BasePropertySerializer
{
public:
mitkClassMacro( FloatPropertySerializer, BasePropertySerializer );
itkNewMacro(Self);
virtual TiXmlElement* Serialize()
{
if (const FloatProperty* prop = dynamic_cast<const FloatProperty*>(m_Property.GetPointer()))
{
TiXmlElement* element = new TiXmlElement("float");
element->SetDoubleAttribute("value", static_cast<double>(prop->GetValue()));
return element;
}
else return NULL;
}
+ virtual BaseProperty::Pointer Deserialize(TiXmlElement* element)
+ {
+ if (!element) return NULL;
+
+ float f;
+ if ( element->QueryFloatAttribute( "value", &f ) == TIXML_SUCCESS )
+ {
+ return FloatProperty::New(f).GetPointer();
+ }
+ else
+ {
+ return NULL;
+ }
+ }
+
protected:
FloatPropertySerializer() {}
virtual ~FloatPropertySerializer() {}
};
} // namespace
// important to put this into the GLOBAL namespace (because it starts with 'namespace mitk')
MITK_REGISTER_SERIALIZER(FloatPropertySerializer);
#endif
diff --git a/Modules/SceneSerializationBase/BasePropertySerializer/mitkGroupTagPropertySerializer.cpp b/Modules/SceneSerializationBase/BasePropertySerializer/mitkGroupTagPropertySerializer.cpp
index b10ad3de5a..9be9a05c77 100644
--- a/Modules/SceneSerializationBase/BasePropertySerializer/mitkGroupTagPropertySerializer.cpp
+++ b/Modules/SceneSerializationBase/BasePropertySerializer/mitkGroupTagPropertySerializer.cpp
@@ -1,59 +1,66 @@
/*=========================================================================
Program: Medical Imaging & Interaction Toolkit
Language: C++
Date: $Date: 2009-07-07 15:56:37 +0200 (Di, 07. Jul 2009) $
Version: $Revision: 1.12 $
Copyright (c) German Cancer Research Center, Division of Medical and
Biological Informatics. All rights reserved.
See MITKCopyright.txt or http://www.mitk.org/copyright.html for details.
This software is distributed WITHOUT ANY WARRANTY; without even
the implied warranty of MERCHANTABILITY or FITNESS FOR A PARTICULAR
PURPOSE. See the above copyright notices for more information.
=========================================================================*/
#ifndef mitkGroupTagPropertySerializer_h_included
#define mitkGroupTagPropertySerializer_h_included
#include "mitkBasePropertySerializer.h"
#include "mitkGroupTagProperty.h"
#include "SceneSerializationBaseExports.h"
namespace mitk
{
class SceneSerializationBase_EXPORT GroupTagPropertySerializer : public BasePropertySerializer
{
public:
mitkClassMacro( GroupTagPropertySerializer, BasePropertySerializer );
itkNewMacro(Self);
virtual TiXmlElement* Serialize()
{
if (dynamic_cast<const GroupTagProperty*>(m_Property.GetPointer()) != NULL)
{
TiXmlElement* element = new TiXmlElement("GroupTag");
return element;
}
else return NULL;
}
+ virtual BaseProperty::Pointer Deserialize(TiXmlElement*)
+ {
+ //if (!element)
+ // return NULL;
+ return GroupTagProperty::New().GetPointer();
+ }
+
protected:
GroupTagPropertySerializer() {}
virtual ~GroupTagPropertySerializer() {}
};
} // namespace
// important to put this into the GLOBAL namespace (because it starts with 'namespace mitk')
MITK_REGISTER_SERIALIZER(GroupTagPropertySerializer);
#endif
diff --git a/Modules/SceneSerializationBase/BasePropertySerializer/mitkIntLookupTablePropertySerializer.cpp b/Modules/SceneSerializationBase/BasePropertySerializer/mitkIntLookupTablePropertySerializer.cpp
index 3bc3261126..80ef617aef 100644
--- a/Modules/SceneSerializationBase/BasePropertySerializer/mitkIntLookupTablePropertySerializer.cpp
+++ b/Modules/SceneSerializationBase/BasePropertySerializer/mitkIntLookupTablePropertySerializer.cpp
@@ -1,64 +1,85 @@
/*=========================================================================
Program: Medical Imaging & Interaction Toolkit
Language: C++
Date: $Date: 2009-10-08 17:10:12 +0200 (Do, 08. Okt 2009) $
Version: $Revision: 1.12 $
Copyright (c) German Cancer Research Center, Division of Medical and
Biological Informatics. All rights reserved.
See MITKCopyright.txt or http://www.mitk.org/copyright.html for details.
This software is distributed WITHOUT ANY WARRANTY; without even
the implied warranty of MERCHANTABILITY or FITNESS FOR A PARTICULAR
PURPOSE. See the above copyright notices for more information.
=========================================================================*/
#ifndef mitkIntLookupTablePropertySerializer_h_included
#define mitkIntLookupTablePropertySerializer_h_included
#include "mitkBasePropertySerializer.h"
#include "mitkProperties.h"
#include "SceneSerializationBaseExports.h"
namespace mitk
{
class SceneSerializationBase_EXPORT IntLookupTablePropertySerializer : public BasePropertySerializer
{
public:
mitkClassMacro( IntLookupTablePropertySerializer, BasePropertySerializer );
itkNewMacro(Self);
virtual TiXmlElement* Serialize()
{
const IntLookupTableProperty* prop = dynamic_cast<const IntLookupTableProperty*>(m_Property.GetPointer());
if (prop == NULL)
return NULL;
IntLookupTable lut = prop->GetValue();
//if (lut.IsNull())
// return NULL; // really?
const IntLookupTable::LookupTableType& map = lut.GetLookupTable();
TiXmlElement* element = new TiXmlElement("IntLookupTableTable");
for (IntLookupTable::LookupTableType::const_iterator it = map.begin(); it != map.end(); ++it)
{
TiXmlElement* tableEntry = new TiXmlElement("LUTValue");
tableEntry->SetAttribute("id", it->first);
tableEntry->SetAttribute("value", it->second);
element->LinkEndChild( tableEntry );
}
return element;
}
+
+ virtual BaseProperty::Pointer Deserialize(TiXmlElement* element)
+ {
+ if (!element)
+ return NULL;
+
+ IntLookupTable lut;
+ for( TiXmlElement* child = element->FirstChildElement("LUTValue"); child != NULL; child = child->NextSiblingElement("LUTValue"))
+ {
+
+ int temp;
+ if (child->QueryIntAttribute("id", &temp) == TIXML_WRONG_TYPE)
+ return NULL; // TODO: can we do a better error handling?
+ IntLookupTable::IdentifierType id = static_cast<IntLookupTable::IdentifierType>(temp);
+ if (child->QueryIntAttribute("value", &temp) == TIXML_WRONG_TYPE)
+ return NULL; // TODO: can we do a better error handling?
+ IntLookupTable::ValueType val = static_cast<IntLookupTable::ValueType>(temp);
+ lut.SetTableValue(id, val);
+ }
+ return IntLookupTableProperty::New(lut).GetPointer();
+ }
protected:
IntLookupTablePropertySerializer() {}
virtual ~IntLookupTablePropertySerializer() {}
};
} // namespace
// important to put this into the GLOBAL namespace (because it starts with 'namespace mitk')
MITK_REGISTER_SERIALIZER(IntLookupTablePropertySerializer);
#endif
diff --git a/Modules/SceneSerializationBase/BasePropertySerializer/mitkIntPropertySerializer.cpp b/Modules/SceneSerializationBase/BasePropertySerializer/mitkIntPropertySerializer.cpp
index 27c02a2aea..ba129c131b 100644
--- a/Modules/SceneSerializationBase/BasePropertySerializer/mitkIntPropertySerializer.cpp
+++ b/Modules/SceneSerializationBase/BasePropertySerializer/mitkIntPropertySerializer.cpp
@@ -1,60 +1,75 @@
/*=========================================================================
Program: Medical Imaging & Interaction Toolkit
Language: C++
Date: $Date$
Version: $Revision: 1.12 $
Copyright (c) German Cancer Research Center, Division of Medical and
Biological Informatics. All rights reserved.
See MITKCopyright.txt or http://www.mitk.org/copyright.html for details.
This software is distributed WITHOUT ANY WARRANTY; without even
the implied warranty of MERCHANTABILITY or FITNESS FOR A PARTICULAR
PURPOSE. See the above copyright notices for more information.
=========================================================================*/
#ifndef mitkIntPropertySerializer_h_included
#define mitkIntPropertySerializer_h_included
#include "mitkBasePropertySerializer.h"
#include "mitkProperties.h"
#include "SceneSerializationBaseExports.h"
namespace mitk
{
class SceneSerializationBase_EXPORT IntPropertySerializer : public BasePropertySerializer
{
public:
mitkClassMacro( IntPropertySerializer, BasePropertySerializer );
itkNewMacro(Self);
virtual TiXmlElement* Serialize()
{
if (const IntProperty* prop = dynamic_cast<const IntProperty*>(m_Property.GetPointer()))
{
TiXmlElement* element = new TiXmlElement("int");
element->SetAttribute("value", prop->GetValue());
return element;
}
else return NULL;
}
+ virtual BaseProperty::Pointer Deserialize(TiXmlElement* element)
+ {
+ if (!element) return NULL;
+
+ int integer;
+ if ( element->QueryIntAttribute( "value", &integer ) == TIXML_SUCCESS )
+ {
+ return IntProperty::New(integer).GetPointer();
+ }
+ else
+ {
+ return NULL;
+ }
+ }
+
protected:
IntPropertySerializer() {}
virtual ~IntPropertySerializer() {}
};
} // namespace
// important to put this into the GLOBAL namespace (because it starts with 'namespace mitk')
MITK_REGISTER_SERIALIZER(IntPropertySerializer);
#endif
diff --git a/Modules/SceneSerializationBase/BasePropertySerializer/mitkLevelWindowPropertySerializer.cpp b/Modules/SceneSerializationBase/BasePropertySerializer/mitkLevelWindowPropertySerializer.cpp
index 440edbe2df..4a45adb51d 100644
--- a/Modules/SceneSerializationBase/BasePropertySerializer/mitkLevelWindowPropertySerializer.cpp
+++ b/Modules/SceneSerializationBase/BasePropertySerializer/mitkLevelWindowPropertySerializer.cpp
@@ -1,82 +1,119 @@
/*=========================================================================
Program: Medical Imaging & Interaction Toolkit
Language: C++
Date: $Date$
Version: $Revision: 1.12 $
Copyright (c) German Cancer Research Center, Division of Medical and
Biological Informatics. All rights reserved.
See MITKCopyright.txt or http://www.mitk.org/copyright.html for details.
This software is distributed WITHOUT ANY WARRANTY; without even
the implied warranty of MERCHANTABILITY or FITNESS FOR A PARTICULAR
PURPOSE. See the above copyright notices for more information.
=========================================================================*/
#ifndef mitkLevelWindowPropertySerializer_h_included
#define mitkLevelWindowPropertySerializer_h_included
#include "mitkBasePropertySerializer.h"
#include "mitkLevelWindowProperty.h"
#include "SceneSerializationBaseExports.h"
namespace mitk
{
class SceneSerializationBase_EXPORT LevelWindowPropertySerializer : public BasePropertySerializer
{
public:
mitkClassMacro( LevelWindowPropertySerializer, BasePropertySerializer );
itkNewMacro(Self);
virtual TiXmlElement* Serialize()
{
if (const LevelWindowProperty* prop = dynamic_cast<const LevelWindowProperty*>(m_Property.GetPointer()))
{
TiXmlElement* element = new TiXmlElement("LevelWindow");
LevelWindow lw = prop->GetLevelWindow();
std::string boolString("false");
if (lw.IsFixed() == true)
boolString = "true";
element->SetAttribute("fixed", boolString.c_str());
TiXmlElement* child = new TiXmlElement("CurrentSettings");
element->LinkEndChild( child );
child->SetDoubleAttribute("level", lw.GetLevel());
child->SetDoubleAttribute("window", lw.GetWindow());
child = new TiXmlElement("DefaultSettings");
element->LinkEndChild( child );
child->SetDoubleAttribute("level", lw.GetDefaultLevel());
child->SetDoubleAttribute("window", lw.GetDefaultWindow());
child = new TiXmlElement("CurrentRange");
element->LinkEndChild( child );
child->SetDoubleAttribute("min", lw.GetRangeMin());
child->SetDoubleAttribute("max", lw.GetRangeMax());
return element;
}
else return NULL;
}
+ virtual BaseProperty::Pointer Deserialize(TiXmlElement* element)
+ {
+ if (!element) return NULL;
+
+ bool isFixed(false);
+ if (element->Attribute("fixed"))
+ isFixed = std::string(element->Attribute("fixed")) == "true";
+
+ float level;
+ float window;
+ TiXmlElement* child = element->FirstChildElement("CurrentSettings");
+ if ( child->QueryFloatAttribute( "level", &level ) != TIXML_SUCCESS ) return NULL;
+ if ( child->QueryFloatAttribute( "window", &window ) != TIXML_SUCCESS ) return NULL;
+
+ float defaultLevel;
+ float defaultWindow;
+ child = element->FirstChildElement("DefaultSettings");
+ if ( child->QueryFloatAttribute( "level", &defaultLevel ) != TIXML_SUCCESS ) return NULL;
+ if ( child->QueryFloatAttribute( "window", &defaultWindow ) != TIXML_SUCCESS ) return NULL;
+
+ float minRange;
+ float maxRange;
+ child = element->FirstChildElement("CurrentRange");
+ if ( child->QueryFloatAttribute( "min", &minRange ) != TIXML_SUCCESS ) return NULL;
+ if ( child->QueryFloatAttribute( "max", &maxRange ) != TIXML_SUCCESS ) return NULL;
+
+
+
+ LevelWindow lw;
+ lw.SetRangeMinMax( minRange, maxRange );
+ lw.SetDefaultLevelWindow( defaultLevel, defaultWindow );
+ lw.SetLevelWindow( level, window );
+ lw.SetFixed( isFixed );
+
+ return LevelWindowProperty::New( lw ).GetPointer();
+ }
+
protected:
LevelWindowPropertySerializer() {}
virtual ~LevelWindowPropertySerializer() {}
};
} // namespace
// important to put this into the GLOBAL namespace (because it starts with 'namespace mitk')
MITK_REGISTER_SERIALIZER(LevelWindowPropertySerializer);
#endif
diff --git a/Modules/SceneSerializationBase/BasePropertySerializer/mitkLookupTablePropertySerializer.cpp b/Modules/SceneSerializationBase/BasePropertySerializer/mitkLookupTablePropertySerializer.cpp
index 16b7acb1ab..e51ba4e5d8 100644
--- a/Modules/SceneSerializationBase/BasePropertySerializer/mitkLookupTablePropertySerializer.cpp
+++ b/Modules/SceneSerializationBase/BasePropertySerializer/mitkLookupTablePropertySerializer.cpp
@@ -1,120 +1,228 @@
/*=========================================================================
Program: Medical Imaging & Interaction Toolkit
Language: C++
Date: $Date$
Version: $Revision: 1.12 $
Copyright (c) German Cancer Research Center, Division of Medical and
Biological Informatics. All rights reserved.
See MITKCopyright.txt or http://www.mitk.org/copyright.html for details.
This software is distributed WITHOUT ANY WARRANTY; without even
the implied warranty of MERCHANTABILITY or FITNESS FOR A PARTICULAR
PURPOSE. See the above copyright notices for more information.
=========================================================================*/
#ifndef mitkLookupTablePropertySerializer_h_included
#define mitkLookupTablePropertySerializer_h_included
#include "mitkBasePropertySerializer.h"
#include "mitkLookupTableProperty.h"
#include "SceneSerializationBaseExports.h"
namespace mitk
{
class SceneSerializationBase_EXPORT LookupTablePropertySerializer : public BasePropertySerializer
{
public:
mitkClassMacro( LookupTablePropertySerializer, BasePropertySerializer );
itkNewMacro(Self);
virtual TiXmlElement* Serialize()
{
if (const LookupTableProperty* prop = dynamic_cast<const LookupTableProperty*>(m_Property.GetPointer()))
{
LookupTable::Pointer mitkLut = const_cast<LookupTableProperty*>(prop)->GetLookupTable();
if (mitkLut.IsNull()) return NULL; // really?
vtkLookupTable* lut = mitkLut->GetVtkLookupTable();
if (!lut) return NULL;
TiXmlElement* element = new TiXmlElement("LookupTable");
#if ( (VTK_MAJOR_VERSION < 5) && (VTK_MINOR_VERSION < 4) )
float* range;
float* rgba;
#else
double* range;
double* rgba;
#endif
element->SetAttribute("NumberOfColors", lut->GetNumberOfTableValues());
element->SetAttribute("Scale", lut->GetScale());
element->SetAttribute("Ramp", lut->GetRamp());
range = lut->GetHueRange();
TiXmlElement* child = new TiXmlElement("HueRange");
element->LinkEndChild( child );
child->SetDoubleAttribute("min", range[0]);
child->SetDoubleAttribute("max", range[1]);
range = lut->GetValueRange();
child = new TiXmlElement("ValueRange");
element->LinkEndChild( child );
child->SetDoubleAttribute("min", range[0]);
child->SetDoubleAttribute("max", range[1]);
range = lut->GetSaturationRange();
child = new TiXmlElement("SaturationRange");
element->LinkEndChild( child );
child->SetDoubleAttribute("min", range[0]);
child->SetDoubleAttribute("max", range[1]);
range = lut->GetAlphaRange();
child = new TiXmlElement("AlphaRange");
element->LinkEndChild( child );
child->SetDoubleAttribute("min", range[0]);
child->SetDoubleAttribute("max", range[1]);
range = lut->GetTableRange();
child = new TiXmlElement("TableRange");
element->LinkEndChild( child );
child->SetDoubleAttribute("min", range[0]);
child->SetDoubleAttribute("max", range[1]);
child = new TiXmlElement("Table");
element->LinkEndChild( child );
for ( int index = 0; index < lut->GetNumberOfTableValues(); ++index)
{
TiXmlElement* grandChildNinife = new TiXmlElement("RgbaColor");
rgba = lut->GetTableValue(index);
grandChildNinife->SetDoubleAttribute("R", rgba[0]);
grandChildNinife->SetDoubleAttribute("G", rgba[1]);
grandChildNinife->SetDoubleAttribute("B", rgba[2]);
grandChildNinife->SetDoubleAttribute("A", rgba[3]);
child->LinkEndChild( grandChildNinife );
}
return element;
}
else return NULL;
}
+ virtual BaseProperty::Pointer Deserialize(TiXmlElement* element)
+ {
+ if (!element) return NULL;
+
+#if ( (VTK_MAJOR_VERSION < 5) && (VTK_MINOR_VERSION < 4) )
+ typedef float OUR_VTK_FLOAT_TYPE;
+ float range[2];
+ float rgba[4];
+#else
+ typedef double OUR_VTK_FLOAT_TYPE;
+ double range[2];
+ double rgba[4];
+#endif
+
+ double d; // bec. of tinyXML's interface that takes a pointer to float or double...
+
+ vtkLookupTable* lut = vtkLookupTable::New();
+
+ int numberOfColors;
+ int scale;
+ int ramp; // hope the int values don't change betw. vtk versions...
+ if ( element->QueryIntAttribute( "NumberOfColors", &numberOfColors ) == TIXML_SUCCESS )
+ {
+ lut->SetNumberOfTableValues( numberOfColors );
+ }
+ else
+ return NULL;
+ if ( element->QueryIntAttribute( "Scale", &scale ) == TIXML_SUCCESS )
+ {
+ lut->SetScale( scale );
+ }
+ else
+ return NULL;
+ if ( element->QueryIntAttribute( "Ramp", &ramp ) == TIXML_SUCCESS )
+ {
+ lut->SetRamp( ramp );
+ }
+ else
+ return NULL;
+
+ TiXmlElement* child = element->FirstChildElement("HueRange");
+ if (child)
+ {
+ if ( child->QueryDoubleAttribute( "min", &d ) != TIXML_SUCCESS )
+ return NULL;
+ range[0] = static_cast<OUR_VTK_FLOAT_TYPE>(d);
+ if ( child->QueryDoubleAttribute( "max", &d ) != TIXML_SUCCESS )
+ return NULL;
+ range[1] = static_cast<OUR_VTK_FLOAT_TYPE>(d);
+ lut->SetHueRange( range );
+ }
+
+ child = element->FirstChildElement("ValueRange");
+ if (child)
+ {
+ if ( child->QueryDoubleAttribute( "min", &d ) != TIXML_SUCCESS ) return NULL; range[0] = static_cast<OUR_VTK_FLOAT_TYPE>(d);
+ if ( child->QueryDoubleAttribute( "max", &d ) != TIXML_SUCCESS ) return NULL; range[1] = static_cast<OUR_VTK_FLOAT_TYPE>(d);
+ lut->SetValueRange( range );
+ }
+
+ child = element->FirstChildElement("SaturationRange");
+ if (child)
+ {
+ if ( child->QueryDoubleAttribute( "min", &d ) != TIXML_SUCCESS ) return NULL; range[0] = static_cast<OUR_VTK_FLOAT_TYPE>(d);
+ if ( child->QueryDoubleAttribute( "max", &d ) != TIXML_SUCCESS ) return NULL; range[1] = static_cast<OUR_VTK_FLOAT_TYPE>(d);
+ lut->SetSaturationRange( range );
+ }
+
+ child = element->FirstChildElement("AlphaRange");
+ if (child)
+ {
+ if ( child->QueryDoubleAttribute( "min", &d ) != TIXML_SUCCESS ) return NULL; range[0] = static_cast<OUR_VTK_FLOAT_TYPE>(d);
+ if ( child->QueryDoubleAttribute( "max", &d ) != TIXML_SUCCESS ) return NULL; range[1] = static_cast<OUR_VTK_FLOAT_TYPE>(d);
+ lut->SetAlphaRange( range );
+ }
+
+ child = element->FirstChildElement("TableRange");
+ if (child)
+ {
+ if ( child->QueryDoubleAttribute( "min", &d ) != TIXML_SUCCESS ) return NULL; range[0] = static_cast<OUR_VTK_FLOAT_TYPE>(d);
+ if ( child->QueryDoubleAttribute( "max", &d ) != TIXML_SUCCESS ) return NULL; range[1] = static_cast<OUR_VTK_FLOAT_TYPE>(d);
+ lut->SetTableRange( range );
+ }
+
+ child = element->FirstChildElement("Table");
+ if (child)
+ {
+ unsigned int index(0);
+ for( TiXmlElement* grandChild = child->FirstChildElement("RgbaColor"); grandChild; grandChild = grandChild->NextSiblingElement("RgbaColor"))
+ {
+ if ( grandChild->QueryDoubleAttribute("R", &d) != TIXML_SUCCESS ) return NULL; rgba[0] = static_cast<OUR_VTK_FLOAT_TYPE>(d);
+ if ( grandChild->QueryDoubleAttribute("G", &d) != TIXML_SUCCESS ) return NULL; rgba[1] = static_cast<OUR_VTK_FLOAT_TYPE>(d);
+ if ( grandChild->QueryDoubleAttribute("B", &d) != TIXML_SUCCESS ) return NULL; rgba[2] = static_cast<OUR_VTK_FLOAT_TYPE>(d);
+ if ( grandChild->QueryDoubleAttribute("A", &d) != TIXML_SUCCESS ) return NULL; rgba[3] = static_cast<OUR_VTK_FLOAT_TYPE>(d);
+
+ lut->SetTableValue( index, rgba );
+ ++index;
+ }
+ }
+
+ LookupTable::Pointer mitkLut = LookupTable::New();
+ mitkLut->SetVtkLookupTable( lut );
+
+ lut->Delete();
+
+ return LookupTableProperty::New(mitkLut).GetPointer();
+ }
+
protected:
LookupTablePropertySerializer() {}
virtual ~LookupTablePropertySerializer() {}
};
} // namespace
// important to put this into the GLOBAL namespace (because it starts with 'namespace mitk')
MITK_REGISTER_SERIALIZER(LookupTablePropertySerializer);
#endif
diff --git a/Modules/SceneSerializationBase/BasePropertySerializer/mitkPoint3dPropertySerializer.cpp b/Modules/SceneSerializationBase/BasePropertySerializer/mitkPoint3dPropertySerializer.cpp
index 0479ed8fcc..ff28b6293f 100644
--- a/Modules/SceneSerializationBase/BasePropertySerializer/mitkPoint3dPropertySerializer.cpp
+++ b/Modules/SceneSerializationBase/BasePropertySerializer/mitkPoint3dPropertySerializer.cpp
@@ -1,63 +1,75 @@
/*=========================================================================
Program: Medical Imaging & Interaction Toolkit
Language: C++
Date: $Date$
Version: $Revision: 1.12 $
Copyright (c) German Cancer Research Center, Division of Medical and
Biological Informatics. All rights reserved.
See MITKCopyright.txt or http://www.mitk.org/copyright.html for details.
This software is distributed WITHOUT ANY WARRANTY; without even
the implied warranty of MERCHANTABILITY or FITNESS FOR A PARTICULAR
PURPOSE. See the above copyright notices for more information.
=========================================================================*/
#ifndef mitkPoint3dPropertySerializer_h_included
#define mitkPoint3dPropertySerializer_h_included
#include "mitkBasePropertySerializer.h"
#include "mitkProperties.h"
#include "SceneSerializationBaseExports.h"
namespace mitk
{
class SceneSerializationBase_EXPORT Point3dPropertySerializer : public BasePropertySerializer
{
public:
mitkClassMacro( Point3dPropertySerializer, BasePropertySerializer );
itkNewMacro(Self);
virtual TiXmlElement* Serialize()
{
if (const Point3dProperty* prop = dynamic_cast<const Point3dProperty*>(m_Property.GetPointer()))
{
TiXmlElement* element = new TiXmlElement("point");
Point3D point = prop->GetValue();
element->SetDoubleAttribute("x", point[0]);
element->SetDoubleAttribute("y", point[1]);
element->SetDoubleAttribute("z", point[2]);
return element;
}
else return NULL;
}
+ virtual BaseProperty::Pointer Deserialize(TiXmlElement* element)
+ {
+ if (!element) return NULL;
+
+ Point3D v;
+ if ( element->QueryFloatAttribute( "x", &v[0] ) != TIXML_SUCCESS ) return NULL;
+ if ( element->QueryFloatAttribute( "y", &v[1] ) != TIXML_SUCCESS ) return NULL;
+ if ( element->QueryFloatAttribute( "z", &v[2] ) != TIXML_SUCCESS ) return NULL;
+
+ return Point3dProperty::New( v ).GetPointer();
+ }
+
protected:
Point3dPropertySerializer() {}
virtual ~Point3dPropertySerializer() {}
};
} // namespace
// important to put this into the GLOBAL namespace (because it starts with 'namespace mitk')
MITK_REGISTER_SERIALIZER(Point3dPropertySerializer);
#endif
diff --git a/Modules/SceneSerializationBase/BasePropertySerializer/mitkPoint3iPropertySerializer.cpp b/Modules/SceneSerializationBase/BasePropertySerializer/mitkPoint3iPropertySerializer.cpp
index 9097c7c3be..e49a3fbb14 100644
--- a/Modules/SceneSerializationBase/BasePropertySerializer/mitkPoint3iPropertySerializer.cpp
+++ b/Modules/SceneSerializationBase/BasePropertySerializer/mitkPoint3iPropertySerializer.cpp
@@ -1,54 +1,65 @@
/*=========================================================================
Program: Medical Imaging & Interaction Toolkit
Language: C++
Date: $Date: 2009-07-07 15:56:37 +0200 (Di, 07. Jul 2009) $
Version: $Revision: 1.12 $
Copyright (c) German Cancer Research Center, Division of Medical and
Biological Informatics. All rights reserved.
See MITKCopyright.txt or http://www.mitk.org/copyright.html for details.
This software is distributed WITHOUT ANY WARRANTY; without even
the implied warranty of MERCHANTABILITY or FITNESS FOR A PARTICULAR
PURPOSE. See the above copyright notices for more information.
=========================================================================*/
#ifndef mitkPoint3iPropertySerializer_h_included
#define mitkPoint3iPropertySerializer_h_included
#include "mitkBasePropertySerializer.h"
#include "mitkProperties.h"
#include "SceneSerializationBaseExports.h"
namespace mitk
{
class SceneSerializationBase_EXPORT Point3iPropertySerializer : public BasePropertySerializer
{
public:
mitkClassMacro( Point3iPropertySerializer, BasePropertySerializer );
itkNewMacro(Self);
virtual TiXmlElement* Serialize()
{
if (const Point3iProperty* prop = dynamic_cast<const Point3iProperty*>(m_Property.GetPointer()))
{
TiXmlElement* element = new TiXmlElement("point");
Point3I point = prop->GetValue();
element->SetAttribute("x", point[0]);
element->SetAttribute("y", point[1]);
element->SetAttribute("z", point[2]);
return element;
}
else return NULL;
}
+
+ virtual BaseProperty::Pointer Deserialize(TiXmlElement* element)
+ {
+ if (!element) return NULL;
+
+ Point3I v;
+ if ( element->QueryIntAttribute( "x", &v[0] ) != TIXML_SUCCESS ) return NULL;
+ if ( element->QueryIntAttribute( "y", &v[1] ) != TIXML_SUCCESS ) return NULL;
+ if ( element->QueryIntAttribute( "z", &v[2] ) != TIXML_SUCCESS ) return NULL;
+ return Point3iProperty::New( v ).GetPointer();
+ }
protected:
Point3iPropertySerializer() {}
virtual ~Point3iPropertySerializer() {}
};
} // namespace
// important to put this into the GLOBAL namespace (because it starts with 'namespace mitk')
MITK_REGISTER_SERIALIZER(Point3iPropertySerializer);
#endif
diff --git a/Modules/SceneSerializationBase/BasePropertySerializer/mitkPoint4dPropertySerializer.cpp b/Modules/SceneSerializationBase/BasePropertySerializer/mitkPoint4dPropertySerializer.cpp
index b4c40fa2a7..b8f89bbaf4 100644
--- a/Modules/SceneSerializationBase/BasePropertySerializer/mitkPoint4dPropertySerializer.cpp
+++ b/Modules/SceneSerializationBase/BasePropertySerializer/mitkPoint4dPropertySerializer.cpp
@@ -1,64 +1,77 @@
/*=========================================================================
Program: Medical Imaging & Interaction Toolkit
Language: C++
Date: $Date$
Version: $Revision: 1.12 $
Copyright (c) German Cancer Research Center, Division of Medical and
Biological Informatics. All rights reserved.
See MITKCopyright.txt or http://www.mitk.org/copyright.html for details.
This software is distributed WITHOUT ANY WARRANTY; without even
the implied warranty of MERCHANTABILITY or FITNESS FOR A PARTICULAR
PURPOSE. See the above copyright notices for more information.
=========================================================================*/
#ifndef mitkPoint4dPropertySerializer_h_included
#define mitkPoint4dPropertySerializer_h_included
#include "mitkBasePropertySerializer.h"
#include "mitkProperties.h"
#include "SceneSerializationBaseExports.h"
namespace mitk
{
class SceneSerializationBase_EXPORT Point4dPropertySerializer : public BasePropertySerializer
{
public:
mitkClassMacro( Point4dPropertySerializer, BasePropertySerializer );
itkNewMacro(Self);
virtual TiXmlElement* Serialize()
{
if (const Point4dProperty* prop = dynamic_cast<const Point4dProperty*>(m_Property.GetPointer()))
{
TiXmlElement* element = new TiXmlElement("point");
Point4D point = prop->GetValue();
element->SetDoubleAttribute("x", point[0]);
element->SetDoubleAttribute("y", point[1]);
element->SetDoubleAttribute("z", point[2]);
element->SetDoubleAttribute("t", point[3]);
return element;
}
else return NULL;
}
+ virtual BaseProperty::Pointer Deserialize(TiXmlElement* element)
+ {
+ if (!element) return NULL;
+
+ Point4D v;
+ if ( element->QueryFloatAttribute( "x", &v[0] ) != TIXML_SUCCESS ) return NULL;
+ if ( element->QueryFloatAttribute( "y", &v[1] ) != TIXML_SUCCESS ) return NULL;
+ if ( element->QueryFloatAttribute( "z", &v[2] ) != TIXML_SUCCESS ) return NULL;
+ if ( element->QueryFloatAttribute( "t", &v[3] ) != TIXML_SUCCESS ) return NULL;
+
+ return Point4dProperty::New( v ).GetPointer();
+ }
+
protected:
Point4dPropertySerializer() {}
virtual ~Point4dPropertySerializer() {}
};
} // namespace
// important to put this into the GLOBAL namespace (because it starts with 'namespace mitk')
MITK_REGISTER_SERIALIZER(Point4dPropertySerializer);
#endif
diff --git a/Modules/SceneSerializationBase/BasePropertySerializer/mitkStringLookupTablePropertySerializer.cpp b/Modules/SceneSerializationBase/BasePropertySerializer/mitkStringLookupTablePropertySerializer.cpp
index 7a09294337..f6f01eefc0 100644
--- a/Modules/SceneSerializationBase/BasePropertySerializer/mitkStringLookupTablePropertySerializer.cpp
+++ b/Modules/SceneSerializationBase/BasePropertySerializer/mitkStringLookupTablePropertySerializer.cpp
@@ -1,64 +1,86 @@
/*=========================================================================
Program: Medical Imaging & Interaction Toolkit
Language: C++
Date: $Date: 2009-10-08 17:10:12 +0200 (Do, 08. Okt 2009) $
Version: $Revision: 1.12 $
Copyright (c) German Cancer Research Center, Division of Medical and
Biological Informatics. All rights reserved.
See MITKCopyright.txt or http://www.mitk.org/copyright.html for details.
This software is distributed WITHOUT ANY WARRANTY; without even
the implied warranty of MERCHANTABILITY or FITNESS FOR A PARTICULAR
PURPOSE. See the above copyright notices for more information.
=========================================================================*/
#ifndef mitkStringLookupTablePropertySerializer_h_included
#define mitkStringLookupTablePropertySerializer_h_included
#include "mitkBasePropertySerializer.h"
#include "mitkProperties.h"
#include "SceneSerializationBaseExports.h"
namespace mitk
{
class SceneSerializationBase_EXPORT StringLookupTablePropertySerializer : public BasePropertySerializer
{
public:
mitkClassMacro( StringLookupTablePropertySerializer, BasePropertySerializer );
itkNewMacro(Self);
virtual TiXmlElement* Serialize()
{
const StringLookupTableProperty* prop = dynamic_cast<const StringLookupTableProperty*>(m_Property.GetPointer());
if (prop == NULL)
return NULL;
StringLookupTable lut = prop->GetValue();
//if (lut.IsNull())
// return NULL; // really?
const StringLookupTable::LookupTableType& map = lut.GetLookupTable();
TiXmlElement* element = new TiXmlElement("StringLookupTable");
for (StringLookupTable::LookupTableType::const_iterator it = map.begin(); it != map.end(); ++it)
{
TiXmlElement* tableEntry = new TiXmlElement("LUTValue");
tableEntry->SetAttribute("id", it->first);
tableEntry->SetAttribute("value", it->second);
element->LinkEndChild( tableEntry );
}
return element;
}
+
+ virtual BaseProperty::Pointer Deserialize(TiXmlElement* element)
+ {
+ if (!element)
+ return NULL;
+
+ StringLookupTable lut;
+ for( TiXmlElement* child = element->FirstChildElement("LUTValue"); child != NULL; child = child->NextSiblingElement("LUTValue"))
+ {
+
+ int temp;
+ if (child->QueryIntAttribute("id", &temp) == TIXML_WRONG_TYPE)
+ return NULL; // TODO: can we do a better error handling?
+ StringLookupTable::IdentifierType id = static_cast<StringLookupTable::IdentifierType>(temp);
+
+ if (child->Attribute("value") == NULL)
+ return NULL; // TODO: can we do a better error handling?
+ StringLookupTable::ValueType val = child->Attribute("value");
+ lut.SetTableValue(id, val);
+ }
+ return StringLookupTableProperty::New(lut).GetPointer();
+ }
protected:
StringLookupTablePropertySerializer() {}
virtual ~StringLookupTablePropertySerializer() {}
};
} // namespace
// important to put this into the GLOBAL namespace (because it starts with 'namespace mitk')
MITK_REGISTER_SERIALIZER(StringLookupTablePropertySerializer);
#endif
diff --git a/Modules/SceneSerializationBase/BasePropertySerializer/mitkStringPropertySerializer.cpp b/Modules/SceneSerializationBase/BasePropertySerializer/mitkStringPropertySerializer.cpp
index 820c0234f0..523dcb4172 100644
--- a/Modules/SceneSerializationBase/BasePropertySerializer/mitkStringPropertySerializer.cpp
+++ b/Modules/SceneSerializationBase/BasePropertySerializer/mitkStringPropertySerializer.cpp
@@ -1,60 +1,67 @@
/*=========================================================================
Program: Medical Imaging & Interaction Toolkit
Language: C++
Date: $Date$
Version: $Revision: 1.12 $
Copyright (c) German Cancer Research Center, Division of Medical and
Biological Informatics. All rights reserved.
See MITKCopyright.txt or http://www.mitk.org/copyright.html for details.
This software is distributed WITHOUT ANY WARRANTY; without even
the implied warranty of MERCHANTABILITY or FITNESS FOR A PARTICULAR
PURPOSE. See the above copyright notices for more information.
=========================================================================*/
#ifndef mitkStringPropertySerializer_h_included
#define mitkStringPropertySerializer_h_included
#include "mitkBasePropertySerializer.h"
#include "mitkStringProperty.h"
#include "SceneSerializationBaseExports.h"
namespace mitk
{
class SceneSerializationBase_EXPORT StringPropertySerializer : public BasePropertySerializer
{
public:
mitkClassMacro( StringPropertySerializer, BasePropertySerializer );
itkNewMacro(Self);
virtual TiXmlElement* Serialize()
{
if (const StringProperty* prop = dynamic_cast<const StringProperty*>(m_Property.GetPointer()))
{
TiXmlElement* element = new TiXmlElement("string");
element->SetAttribute("value", prop->GetValue());
return element;
}
else return NULL;
}
+ virtual BaseProperty::Pointer Deserialize(TiXmlElement* element)
+ {
+ if (!element) return NULL;
+ const char* s( element->Attribute("value") );
+ return StringProperty::New( std::string(s?s:"") ).GetPointer();
+ }
+
protected:
StringPropertySerializer() {}
virtual ~StringPropertySerializer() {}
};
} // namespace
// important to put this into the GLOBAL namespace (because it starts with 'namespace mitk')
MITK_REGISTER_SERIALIZER(StringPropertySerializer);
#endif
diff --git a/Modules/SceneSerializationBase/BasePropertySerializer/mitkTransferFunctionPropertySerializer.cpp b/Modules/SceneSerializationBase/BasePropertySerializer/mitkTransferFunctionPropertySerializer.cpp
index 25bee4e628..b1181386c2 100644
--- a/Modules/SceneSerializationBase/BasePropertySerializer/mitkTransferFunctionPropertySerializer.cpp
+++ b/Modules/SceneSerializationBase/BasePropertySerializer/mitkTransferFunctionPropertySerializer.cpp
@@ -1,125 +1,233 @@
/*=========================================================================
Program: Medical Imaging & Interaction Toolkit
Language: C++
Date: $Date$
Version: $Revision: 1.12 $
Copyright (c) German Cancer Research Center, Division of Medical and
Biological Informatics. All rights reserved.
See MITKCopyright.txt or http://www.mitk.org/copyright.html for details.
This software is distributed WITHOUT ANY WARRANTY; without even
the implied warranty of MERCHANTABILITY or FITNESS FOR A PARTICULAR
PURPOSE. See the above copyright notices for more information.
=========================================================================*/
#include "mitkTransferFunctionPropertySerializer.h"
namespace mitk {
mitk::TransferFunctionPropertySerializer::TransferFunctionPropertySerializer()
{
}
mitk::TransferFunctionPropertySerializer::~TransferFunctionPropertySerializer()
{
}
TiXmlElement* mitk::TransferFunctionPropertySerializer::Serialize()
{
if (const TransferFunctionProperty* prop = dynamic_cast<const TransferFunctionProperty*>(mitk::BasePropertySerializer::m_Property.GetPointer()))
{
TransferFunction* transferfunction = prop->GetValue();
if (!transferfunction)
return NULL;
TiXmlElement* element = new TiXmlElement("TransferFunction");
// serialize scalar opacity function
TiXmlElement* scalarOpacityPointlist = new TiXmlElement( "ScalarOpacity" );
TransferFunction::ControlPoints scalarOpacityPoints = transferfunction->GetScalarOpacityPoints();
for ( TransferFunction::ControlPoints::iterator iter = scalarOpacityPoints.begin();
iter != scalarOpacityPoints.end();
++iter )
{
TiXmlElement* pointel = new TiXmlElement("point");
pointel->SetDoubleAttribute("x", iter->first);
pointel->SetDoubleAttribute("y", iter->second);
scalarOpacityPointlist->LinkEndChild( pointel );
}
element->LinkEndChild( scalarOpacityPointlist );
// serialize gradient opacity function
TiXmlElement* gradientOpacityPointlist = new TiXmlElement( "GradientOpacity" );
TransferFunction::ControlPoints gradientOpacityPoints = transferfunction->GetGradientOpacityPoints();
for ( TransferFunction::ControlPoints::iterator iter = gradientOpacityPoints.begin();
iter != gradientOpacityPoints.end();
++iter )
{
TiXmlElement* pointel = new TiXmlElement("point");
pointel->SetDoubleAttribute("x", iter->first);
pointel->SetDoubleAttribute("y", iter->second);
gradientOpacityPointlist->LinkEndChild( pointel );
}
element->LinkEndChild( gradientOpacityPointlist );
// serialize color function
vtkColorTransferFunction* ctf = transferfunction->GetColorTransferFunction();
if (ctf == NULL)
return NULL;
TiXmlElement* pointlist = new TiXmlElement("Color");
for (int i = 0; i < ctf->GetSize(); i++ )
{
double myVal[6];
ctf->GetNodeValue(i, myVal);
TiXmlElement* pointel = new TiXmlElement("point");
pointel->SetDoubleAttribute("x", myVal[0]);
pointel->SetDoubleAttribute("r", myVal[1]);
pointel->SetDoubleAttribute("g", myVal[2]);
pointel->SetDoubleAttribute("b", myVal[3]);
pointel->SetDoubleAttribute("midpoint", myVal[4]);
pointel->SetDoubleAttribute("sharpness", myVal[5]);
pointlist->LinkEndChild( pointel );
}
element->LinkEndChild( pointlist );
return element;
}
else return NULL;
}
bool mitk::TransferFunctionPropertySerializer::SerializeTransferFunction( const char * filename, TransferFunction::Pointer tf )
{
TransferFunctionPropertySerializer::Pointer tfps=TransferFunctionPropertySerializer::New();
tfps->SetProperty( TransferFunctionProperty::New( tf ) );
TiXmlElement* s=tfps->Serialize();
if(!s)
{
MITK_ERROR << "cant serialize transfer function";
return false;
}
TiXmlDocument document;
TiXmlDeclaration* decl = new TiXmlDeclaration( "1.0", "UTF-8", "" ); // TODO what to write here? encoding? standalone would mean that we provide a DTD somewhere...
document.LinkEndChild( decl );
TiXmlElement* version = new TiXmlElement("Version");
version->SetAttribute("TransferfunctionVersion", 1 );
document.LinkEndChild(version);
document.LinkEndChild(s);
if ( !document.SaveFile( filename ) )
{
MITK_ERROR << "Could not write scene to " << filename << "\nTinyXML reports '" << document.ErrorDesc() << "'";
return false;
}
return true;
}
+BaseProperty::Pointer mitk::TransferFunctionPropertySerializer::Deserialize(TiXmlElement* element)
+{
+ if (!element)
+ return NULL;
+
+ TransferFunction::Pointer tf = TransferFunction::New();
+
+ // deserialize scalar opacity function
+ TiXmlElement* scalarOpacityPointlist = element->FirstChildElement("ScalarOpacity");
+ if (scalarOpacityPointlist == NULL)
+ return NULL;
+
+ tf->ClearScalarOpacityPoints();
+
+ for( TiXmlElement* pointElement = scalarOpacityPointlist->FirstChildElement("point"); pointElement != NULL; pointElement = pointElement->NextSiblingElement("point"))
+ {
+ double x;
+ double y;
+ if (pointElement->QueryDoubleAttribute("x", &x) == TIXML_WRONG_TYPE)
+ return NULL; // TODO: can we do a better error handling?
+ if (pointElement->QueryDoubleAttribute("y", &y) == TIXML_WRONG_TYPE)
+ return NULL; // TODO: can we do a better error handling?
+ tf->AddScalarOpacityPoint(x, y);
+ }
+
+ TiXmlElement* gradientOpacityPointlist = element->FirstChildElement("GradientOpacity");
+ if (gradientOpacityPointlist == NULL)
+ return NULL;
+
+ tf->ClearGradientOpacityPoints();
+
+ for( TiXmlElement* pointElement = gradientOpacityPointlist->FirstChildElement("point"); pointElement != NULL; pointElement = pointElement->NextSiblingElement("point"))
+ {
+ double x;
+ double y;
+ if (pointElement->QueryDoubleAttribute("x", &x) == TIXML_WRONG_TYPE)
+ return NULL; // TODO: can we do a better error handling?
+ if (pointElement->QueryDoubleAttribute("y", &y) == TIXML_WRONG_TYPE)
+ return NULL; // TODO: can we do a better error handling?
+ tf->AddGradientOpacityPoint(x, y);
+ }
+
+ TiXmlElement* rgbPointlist = element->FirstChildElement("Color");
+ if (rgbPointlist == NULL)
+ return NULL;
+ vtkColorTransferFunction* ctf = tf->GetColorTransferFunction();
+ if (ctf == NULL)
+ return NULL;
+
+ ctf->RemoveAllPoints();
+
+ for( TiXmlElement* pointElement = rgbPointlist->FirstChildElement("point"); pointElement != NULL; pointElement = pointElement->NextSiblingElement("point"))
+ {
+ double x;
+ double r,g,b, midpoint, sharpness;
+ if (pointElement->QueryDoubleAttribute("x", &x) == TIXML_WRONG_TYPE)
+ return NULL; // TODO: can we do a better error handling?
+ if (pointElement->QueryDoubleAttribute("r", &r) == TIXML_WRONG_TYPE)
+ return NULL; // TODO: can we do a better error handling?
+ if (pointElement->QueryDoubleAttribute("g", &g) == TIXML_WRONG_TYPE)
+ return NULL; // TODO: can we do a better error handling?
+ if (pointElement->QueryDoubleAttribute("b", &b) == TIXML_WRONG_TYPE)
+ return NULL; // TODO: can we do a better error handling?
+ if (pointElement->QueryDoubleAttribute("midpoint", &midpoint) == TIXML_WRONG_TYPE)
+ return NULL; // TODO: can we do a better error handling?
+ if (pointElement->QueryDoubleAttribute("sharpness", &sharpness) == TIXML_WRONG_TYPE)
+ return NULL; // TODO: can we do a better error handling?
+ ctf->AddRGBPoint(x, r, g, b, midpoint, sharpness);
+ }
+ return TransferFunctionProperty::New(tf).GetPointer();
+}
+
+mitk::TransferFunction::Pointer mitk::TransferFunctionPropertySerializer::DeserializeTransferFunction( const char *filePath )
+{
+ TiXmlDocument document( filePath );
+
+ if (!document.LoadFile())
+ {
+ MITK_ERROR << "Could not open/read/parse " << filePath << "\nTinyXML reports: " << document.ErrorDesc() << std::endl;
+ return NULL;
+ }
+
+ // find version node --> note version in some variable
+ int fileVersion = 1;
+ TiXmlElement* versionObject = document.FirstChildElement("Version");
+ if (versionObject)
+ {
+ if ( versionObject->QueryIntAttribute( "TransferfunctionVersion", &fileVersion ) != TIXML_SUCCESS )
+ {
+ MITK_WARN << "Transferfunction file " << filePath << " does not contain version information! Trying version 1 format.";
+ }
+ }
+
+ TiXmlElement* input = document.FirstChildElement("TransferFunction");
+
+ TransferFunctionPropertySerializer::Pointer tfpd = TransferFunctionPropertySerializer::New();
+ BaseProperty::Pointer bp = tfpd->Deserialize(input);
+ TransferFunctionProperty::Pointer tfp = dynamic_cast<TransferFunctionProperty*>(bp.GetPointer());
+
+ if(tfp.IsNotNull())
+ {
+ TransferFunction::Pointer tf = tfp->GetValue();
+ return tf;
+ }
+ MITK_WARN << "Can't deserialize transferfunction";
+ return NULL;
+}
+
} // namespace
// important to put this into the GLOBAL namespace (because it starts with 'namespace mitk')
MITK_REGISTER_SERIALIZER(TransferFunctionPropertySerializer);
\ No newline at end of file
diff --git a/Modules/SceneSerializationBase/BasePropertySerializer/mitkTransferFunctionPropertySerializer.h b/Modules/SceneSerializationBase/BasePropertySerializer/mitkTransferFunctionPropertySerializer.h
index 87c40fae76..a375ea726d 100644
--- a/Modules/SceneSerializationBase/BasePropertySerializer/mitkTransferFunctionPropertySerializer.h
+++ b/Modules/SceneSerializationBase/BasePropertySerializer/mitkTransferFunctionPropertySerializer.h
@@ -1,42 +1,44 @@
/*=========================================================================
Program: Medical Imaging & Interaction Toolkit
Language: C++
Date: $Date: 2009-10-23 11:12:48 +0200 (Fr, 23 Okt 2009) $
Version: $Revision: 1.12 $
Copyright (c) German Cancer Research Center, Division of Medical and
Biological Informatics. All rights reserved.
See MITKCopyright.txt or http://www.mitk.org/copyright.html for details.
This software is distributed WITHOUT ANY WARRANTY; without even
the implied warranty of MERCHANTABILITY or FITNESS FOR A PARTICULAR
PURPOSE. See the above copyright notices for more information.
=========================================================================*/
#include "mitkTransferFunctionProperty.h"
#include "mitkBasePropertySerializer.h"
#include "SceneSerializationBaseExports.h"
namespace mitk
{
class SceneSerializationBase_EXPORT TransferFunctionPropertySerializer : public BasePropertySerializer
{
public:
mitkClassMacro( TransferFunctionPropertySerializer, BasePropertySerializer );
itkNewMacro(Self);
virtual TiXmlElement* Serialize();
+ virtual BaseProperty::Pointer Deserialize(TiXmlElement* element);
+
static bool SerializeTransferFunction( const char * filename, TransferFunction::Pointer tf );
-
+ static TransferFunction::Pointer DeserializeTransferFunction( const char *filePath );
protected:
TransferFunctionPropertySerializer();
virtual ~TransferFunctionPropertySerializer();
};
} // namespace
diff --git a/Modules/SceneSerializationBase/BasePropertySerializer/mitkVector3DPropertySerializer.cpp b/Modules/SceneSerializationBase/BasePropertySerializer/mitkVector3DPropertySerializer.cpp
index 85a0717a16..82c86a2885 100644
--- a/Modules/SceneSerializationBase/BasePropertySerializer/mitkVector3DPropertySerializer.cpp
+++ b/Modules/SceneSerializationBase/BasePropertySerializer/mitkVector3DPropertySerializer.cpp
@@ -1,63 +1,75 @@
/*=========================================================================
Program: Medical Imaging & Interaction Toolkit
Language: C++
Date: $Date$
Version: $Revision: 1.12 $
Copyright (c) German Cancer Research Center, Division of Medical and
Biological Informatics. All rights reserved.
See MITKCopyright.txt or http://www.mitk.org/copyright.html for details.
This software is distributed WITHOUT ANY WARRANTY; without even
the implied warranty of MERCHANTABILITY or FITNESS FOR A PARTICULAR
PURPOSE. See the above copyright notices for more information.
=========================================================================*/
#ifndef mitkVector3DPropertySerializer_h_included
#define mitkVector3DPropertySerializer_h_included
#include "mitkBasePropertySerializer.h"
#include "mitkProperties.h"
#include "SceneSerializationBaseExports.h"
namespace mitk
{
class SceneSerializationBase_EXPORT Vector3DPropertySerializer : public BasePropertySerializer
{
public:
mitkClassMacro( Vector3DPropertySerializer, BasePropertySerializer );
itkNewMacro(Self);
virtual TiXmlElement* Serialize()
{
if (const Vector3DProperty* prop = dynamic_cast<const Vector3DProperty*>(m_Property.GetPointer()))
{
TiXmlElement* element = new TiXmlElement("vector");
Vector3D point = prop->GetValue();
element->SetDoubleAttribute("x", point[0]);
element->SetDoubleAttribute("y", point[1]);
element->SetDoubleAttribute("z", point[2]);
return element;
}
else return NULL;
}
+ virtual BaseProperty::Pointer Deserialize(TiXmlElement* element)
+ {
+ if (!element) return NULL;
+
+ Vector3D v;
+ if ( element->QueryFloatAttribute( "x", &v[0] ) != TIXML_SUCCESS ) return NULL;
+ if ( element->QueryFloatAttribute( "y", &v[1] ) != TIXML_SUCCESS ) return NULL;
+ if ( element->QueryFloatAttribute( "z", &v[2] ) != TIXML_SUCCESS ) return NULL;
+
+ return Vector3DProperty::New( v ).GetPointer();
+ }
+
protected:
Vector3DPropertySerializer() {}
virtual ~Vector3DPropertySerializer() {}
};
} // namespace
// important to put this into the GLOBAL namespace (because it starts with 'namespace mitk')
MITK_REGISTER_SERIALIZER(Vector3DPropertySerializer);
#endif
diff --git a/Modules/SceneSerializationBase/CMakeLists.txt b/Modules/SceneSerializationBase/CMakeLists.txt
index 849d793a24..0bc639abc2 100644
--- a/Modules/SceneSerializationBase/CMakeLists.txt
+++ b/Modules/SceneSerializationBase/CMakeLists.txt
@@ -1,6 +1,6 @@
MITK_CREATE_MODULE( SceneSerializationBase
- INCLUDE_DIRS BaseDataSerializer BasePropertySerializer BasePropertyDeserializer
+ INCLUDE_DIRS BaseDataSerializer BasePropertySerializer
DEPENDS Mitk
)
ADD_SUBDIRECTORY(Testing)
diff --git a/Modules/SceneSerializationBase/Testing/mitkPropertySerializationTest.cpp b/Modules/SceneSerializationBase/Testing/mitkPropertySerializationTest.cpp
index 5122d51767..d3789e8242 100644
--- a/Modules/SceneSerializationBase/Testing/mitkPropertySerializationTest.cpp
+++ b/Modules/SceneSerializationBase/Testing/mitkPropertySerializationTest.cpp
@@ -1,284 +1,267 @@
/*=========================================================================
Program: Medical Imaging & Interaction Toolkit
Language: C++
Date: $Date$
Version: $Revision: 1.12 $
Copyright (c) German Cancer Research Center, Division of Medical and
Biological Informatics. All rights reserved.
See MITKCopyright.txt or http://www.mitk.org/copyright.html for details.
This software is distributed WITHOUT ANY WARRANTY; without even
the implied warranty of MERCHANTABILITY or FITNESS FOR A PARTICULAR
PURPOSE. See the above copyright notices for more information.
=========================================================================*/
#include "mitkTestingMacros.h"
#include "mitkDataNodeFactory.h"
#include "mitkCoreObjectFactory.h"
#include "mitkBaseProperty.h"
#include "mitkProperties.h"
#include <mitkAnnotationProperty.h>
#include <mitkClippingProperty.h>
#include <mitkColorProperty.h>
#include <mitkEnumerationProperty.h>
/*
#include <mitkGridRepresentationProperty.h>
#include <mitkGridVolumeMapperProperty.h>
#include <mitkOrganTypeProperty.h>
*/
#include <mitkModalityProperty.h>
//#include <mitkOdfNormalizationMethodProperty.h>
//#include <mitkOdfScaleByProperty.h>
#include <mitkPlaneOrientationProperty.h>
#include <mitkShaderProperty.h>
#include <mitkVtkInterpolationProperty.h>
#include <mitkVtkRepresentationProperty.h>
#include <mitkVtkResliceInterpolationProperty.h>
#include <mitkVtkScalarModeProperty.h>
#include <mitkVtkVolumeRenderingProperty.h>
#include <mitkGroupTagProperty.h>
#include <mitkLevelWindowProperty.h>
#include <mitkLookupTableProperty.h>
#include <mitkStringProperty.h>
#include <mitkTransferFunctionProperty.h>
#include "mitkPropertyList.h"
#include "mitkPropertyListSerializer.h"
#include "mitkBasePropertySerializer.h"
-#include "mitkBasePropertyDeserializer.h"
#include <mitkPointSet.h>
#include <mitkImage.h>
#include <mitkSurface.h>
#include <mitkVtkWidgetRendering.h>
/*
#include <mitkContour.h>
#include <mitkContourSet.h>
#include <mitkMesh.h>
#include <mitkCone.h>
#include <mitkCuboid.h>
#include <mitkCylinder.h>
#include <mitkEllipsoid.h>
#include <mitkExtrudedContour.h>
#include <mitkPlane.h>
#include <mitkUnstructuredGrid.h>
*/
void TestAllProperties(const mitk::PropertyList* propList);
/**Documentation
-* \brief Test for all PropertySerializer and PropertyDeserializer classes.
+* \brief Test for all PropertySerializer classes.
*
*/
int mitkPropertySerializationTest(int /* argc */, char* /*argv*/[])
{
MITK_TEST_BEGIN("PropertySerializationTest");
- mitk::PropertyListSerializer::Pointer serializer = mitk::PropertyListSerializer::New(); // make sure something from the lib is actually used (registration of serializers/deserializers)
+ mitk::PropertyListSerializer::Pointer serializer = mitk::PropertyListSerializer::New(); // make sure something from the lib is actually used (registration of serializers)
/* build list of properties that will be serialized and deserialized */
mitk::PropertyList::Pointer propList = mitk::PropertyList::New();
propList->SetProperty("booltrue", mitk::BoolProperty::New(true));
propList->SetProperty("boolfalse", mitk::BoolProperty::New(false));
propList->SetProperty("int", mitk::IntProperty::New(-32));
propList->SetProperty("float", mitk::FloatProperty::New(-31.337));
propList->SetProperty("double", mitk::DoubleProperty::New(-31.337));
propList->SetProperty("string", mitk::StringProperty::New("Hello MITK"));
mitk::Point3D p3d;
mitk::FillVector3D(p3d, 1.0, 2.2, -3.3);
propList->SetProperty("p3d", mitk::Point3dProperty::New(p3d));
mitk::Point3I p3i;
mitk::FillVector3D(p3i, 1, 2, -3);
propList->SetProperty("p3i", mitk::Point3iProperty::New(p3i));
mitk::Point4D p4d;
mitk::FillVector4D(p4d, 1.5, 2.6, -3.7, 4.44);
propList->SetProperty("p4d", mitk::Point4dProperty::New(p4d));
mitk::Vector3D v3d;
mitk::FillVector3D(v3d, 1.0, 2.2, -3.3);
propList->SetProperty("v3d", mitk::Vector3DProperty::New(v3d));
propList->SetProperty("annotation", mitk::AnnotationProperty::New("My Annotation", p3d));
propList->SetProperty("clipping", mitk::ClippingProperty::New(p3d, v3d));
propList->SetProperty("color", mitk::ColorProperty::New(1.0, 0.2, 0.2));
//mitk::EnumerationProperty::Pointer en = mitk::EnumerationProperty::New();
//en->AddEnum("PC", 1); en->AddEnum("Playstation", 2); en->AddEnum("Wii", 111); en->AddEnum("XBox", 7);
//en->SetValue("XBox");
//propList->SetProperty("enum", en);
/*
propList->SetProperty("gridrep", mitk::GridRepresentationProperty::New(2));
propList->SetProperty("gridvol", mitk::GridVolumeMapperProperty::New(0));
propList->SetProperty("OrganTypeProperty", mitk::OrganTypeProperty::New("Larynx"));
*/
propList->SetProperty("modality", mitk::ModalityProperty::New("Color Doppler"));
//propList->SetProperty("OdfNormalizationMethodProperty", mitk::OdfNormalizationMethodProperty::New("Global Maximum"));
//propList->SetProperty("OdfScaleByProperty", mitk::OdfScaleByProperty::New("Principal Curvature"));
propList->SetProperty("PlaneOrientationProperty", mitk::PlaneOrientationProperty::New("Arrows in positive direction"));
propList->SetProperty("ShaderProperty", mitk::ShaderProperty::New("fixed"));
propList->SetProperty("VtkInterpolationProperty", mitk::VtkInterpolationProperty::New("Gouraud"));
propList->SetProperty("VtkRepresentationProperty", mitk::VtkRepresentationProperty::New("Surface"));
propList->SetProperty("VtkResliceInterpolationProperty", mitk::VtkResliceInterpolationProperty::New("Cubic"));
propList->SetProperty("VtkScalarModeProperty", mitk::VtkScalarModeProperty::New("PointFieldData"));
propList->SetProperty("VtkVolumeRenderingProperty", mitk::VtkVolumeRenderingProperty::New("COMPOSITE"));
mitk::BoolLookupTable blt;
blt.SetTableValue(0, true); blt.SetTableValue(1, false); blt.SetTableValue(2, true);
propList->SetProperty("BoolLookupTableProperty", mitk::BoolLookupTableProperty::New(blt));
mitk::FloatLookupTable flt;
flt.SetTableValue(0, 3.1); flt.SetTableValue(1, 3.3); flt.SetTableValue(2, 7.0);
propList->SetProperty("FloatLookupTableProperty", mitk::FloatLookupTableProperty::New(flt));
mitk::IntLookupTable ilt;
ilt.SetTableValue(0, 3); ilt.SetTableValue(1, 2); ilt.SetTableValue(2, 11);
propList->SetProperty("IntLookupTableProperty", mitk::IntLookupTableProperty::New(ilt));
mitk::StringLookupTable slt;
slt.SetTableValue(0, "Hello"); slt.SetTableValue(1, "MITK"); slt.SetTableValue(2, "world");
propList->SetProperty("StringLookupTableProperty", mitk::StringLookupTableProperty::New(slt));
propList->SetProperty("GroupTagProperty", mitk::GroupTagProperty::New());
propList->SetProperty("LevelWindowProperty", mitk::LevelWindowProperty::New(mitk::LevelWindow(100.0, 50.0)));
mitk::LookupTable::Pointer lt = mitk::LookupTable::New();
lt->ChangeOpacityForAll(0.25);
lt->ChangeOpacity(17, 0.88);
propList->SetProperty("LookupTableProperty", mitk::LookupTableProperty::New(lt));
propList->SetProperty("StringProperty", mitk::StringProperty::New("Oh why, gruel world"));
//mitk::TransferFunction::Pointer tf = mitk::TransferFunction::New();
//tf->SetTransferFunctionMode(1);
//propList->SetProperty("TransferFunctionProperty", mitk::TransferFunctionProperty::New(tf));
MITK_TEST_CONDITION_REQUIRED(propList->GetMap()->size() > 0, "Initialize PropertyList");
TestAllProperties(propList);
/* test default property lists of basedata objects */
// activate the following tests after MaterialProperty is deleted
mitk::DataNode::Pointer node = mitk::DataNode::New();
node->SetData(mitk::PointSet::New());
TestAllProperties(node->GetPropertyList());
node->SetData(mitk::Image::New());
TestAllProperties(node->GetPropertyList());
node->SetData(mitk::Surface::New());
TestAllProperties(node->GetPropertyList());
node->SetData(mitk::VtkWidgetRendering::New());
TestAllProperties(node->GetPropertyList());
/*
node->SetData(mitk::Contour::New());
TestAllProperties(node->GetPropertyList());
node->SetData(mitk::ContourSet::New());
TestAllProperties(node->GetPropertyList());
node->SetData(mitk::Mesh::New());
TestAllProperties(node->GetPropertyList());
node->SetData(mitk::Cone::New());
TestAllProperties(node->GetPropertyList());
node->SetData(mitk::Cuboid::New());
TestAllProperties(node->GetPropertyList());
node->SetData(mitk::Cylinder::New());
TestAllProperties(node->GetPropertyList());
node->SetData(mitk::Ellipsoid::New());
TestAllProperties(node->GetPropertyList());
node->SetData(mitk::ExtrudedContour::New());
TestAllProperties(node->GetPropertyList());
node->SetData(mitk::Plane::New());
TestAllProperties(node->GetPropertyList());
//node->SetData(mitk::TrackingVolume::New()); // TrackingVolume is in IGT Module, it does not have special properties, therefore we skip it here
//TestAllProperties(node->GetPropertyList());
node->SetData(mitk::UnstructuredGrid::New());
TestAllProperties(node->GetPropertyList());
*/
/* untested base data types:
BaseDataTestImplementation
RenderWindowFrame
mitk::DiffusionImage< TPixelType >
GeometryData
mitk::Geometry2DData
GradientBackground
ItkBaseDataAdapter
ManufacturerLogo
SlicedData
QBallImage
SeedsImage
TensorImage
BoundingObject
BoundingObjectGroup
*/
MITK_TEST_END();
}
void TestAllProperties(const mitk::PropertyList* propList)
{
assert(propList);
/* try to serialize each property in the list, then deserialize again and check for equality */
for (mitk::PropertyList::PropertyMap::const_iterator it = propList->GetMap()->begin(); it != propList->GetMap()->end(); ++it)
{
- const mitk::BaseProperty* prop = it->second.first;
+ const mitk::BaseProperty* prop = it->second;
// construct name of serializer class
std::string serializername = std::string(prop->GetNameOfClass()) + "Serializer";
std::list<itk::LightObject::Pointer> allSerializers = itk::ObjectFactoryBase::CreateAllInstance(serializername.c_str());
MITK_TEST_CONDITION(allSerializers.size() > 0, std::string("Creating serializers for ") + serializername);
if (allSerializers.size() == 0)
{
MITK_TEST_OUTPUT( << "serialization not possible, skipping " << prop->GetNameOfClass());
continue;
}
if (allSerializers.size() > 1)
{
MITK_TEST_OUTPUT (<< "Warning: " << allSerializers.size() << " serializers found for " << prop->GetNameOfClass() << "testing only the first one.");
}
mitk::BasePropertySerializer* serializer = dynamic_cast<mitk::BasePropertySerializer*>( allSerializers.begin()->GetPointer());
MITK_TEST_CONDITION(serializer != NULL, serializername + std::string(" is valid"));
if (serializer != NULL)
{
serializer->SetProperty(prop);
TiXmlElement* valueelement = NULL;
try
{
valueelement = serializer->Serialize();
}
catch (...)
{
}
MITK_TEST_CONDITION(valueelement != NULL, std::string("Serialize property with ") + serializername);
if (valueelement == NULL)
{
MITK_TEST_OUTPUT( << "serialization failed, skipping deserialization");
continue;
}
- /* build deserializer and try to deserialize property */
- std::string deserializerName = std::string(prop->GetNameOfClass()) + std::string("Deserializer");
- std::list<itk::LightObject::Pointer> allDeserializers = itk::ObjectFactoryBase::CreateAllInstance(deserializerName.c_str());
- MITK_TEST_CONDITION(allDeserializers.size() > 0, std::string("Creating deserializers for ") + deserializerName);
- if (allDeserializers.size() == 0)
+
+ mitk::BaseProperty::Pointer deserializedProp = serializer->Deserialize( valueelement );
+ MITK_TEST_CONDITION(deserializedProp.IsNotNull(), "serializer created valid property");
+ if (deserializedProp.IsNotNull())
{
- MITK_TEST_OUTPUT( << "deserialization not possible, skipping deserialization of " << prop->GetNameOfClass());
- continue;
- }
- if (allDeserializers.size() > 1)
- {
- MITK_TEST_OUTPUT (<< "Warning: " << allDeserializers.size() << " deserializers found for " << prop->GetNameOfClass() << "testing only the first one.");
- }
- mitk::BasePropertyDeserializer* deserializer = dynamic_cast<mitk::BasePropertyDeserializer*>( allDeserializers.begin()->GetPointer());
- MITK_TEST_CONDITION(deserializer != NULL, deserializerName + std::string(" is valid"));
- if (deserializer != NULL)
- {
- mitk::BaseProperty::Pointer deserializedProp = deserializer->Deserialize( valueelement );
- MITK_TEST_CONDITION(deserializedProp.IsNotNull(), "deserializer created valid property");
- if (deserializedProp.IsNotNull())
- {
- MITK_TEST_CONDITION(*(deserializedProp.GetPointer()) == *prop, "deserialized property equals initial property for type " << prop->GetNameOfClass());
- }
+ MITK_TEST_CONDITION(*(deserializedProp.GetPointer()) == *prop, "deserialized property equals initial property for type " << prop->GetNameOfClass());
}
+
}
else
{
MITK_TEST_OUTPUT( << "created serializer object is of class " << allSerializers.begin()->GetPointer()->GetNameOfClass())
}
} // for all properties
}
diff --git a/Modules/SceneSerializationBase/files.cmake b/Modules/SceneSerializationBase/files.cmake
index 43c4280eea..399a128a1b 100644
--- a/Modules/SceneSerializationBase/files.cmake
+++ b/Modules/SceneSerializationBase/files.cmake
@@ -1,9 +1,8 @@
# Do not glob files in the Testing directory
file(GLOB SRCS
*.cpp
- BasePropertyDeserializer/*.cpp
BasePropertySerializer/*.cpp
)
set(CPP_FILES ${SRCS})
diff --git a/Modules/SceneSerializationBase/mitkBasePropertyDeserializer.h b/Modules/SceneSerializationBase/mitkBasePropertyDeserializer.h
deleted file mode 100644
index 0f986a5f31..0000000000
--- a/Modules/SceneSerializationBase/mitkBasePropertyDeserializer.h
+++ /dev/null
@@ -1,60 +0,0 @@
-/*=========================================================================
-
-Program: Medical Imaging & Interaction Toolkit
-Language: C++
-Date: $Date$
-Version: $Revision: 1.12 $
-
-Copyright (c) German Cancer Research Center, Division of Medical and
-Biological Informatics. All rights reserved.
-See MITKCopyright.txt or http://www.mitk.org/copyright.html for details.
-
-This software is distributed WITHOUT ANY WARRANTY; without even
-the implied warranty of MERCHANTABILITY or FITNESS FOR A PARTICULAR
-PURPOSE. See the above copyright notices for more information.
-
-=========================================================================*/
-
-#ifndef mitkBasePropertyDeserializer_h_included
-#define mitkBasePropertyDeserializer_h_included
-
-#include "SceneSerializationBaseExports.h"
-#include "mitkSerializerMacros.h"
-
-#include <itkObjectFactoryBase.h>
-#include "mitkBaseProperty.h"
-
-#include <tinyxml.h>
-
-namespace mitk
-{
-
-/**
- \brief Base class for objects that deserialize BaseProperty types.
-
- The name of sub-classes must be deduced from the class name of the object that should be constructed from its serialization.
- The serialization assumes that
-
- \verbatim
- IF the class derived from BaseProperty is called GreenProperty
- THEN the deserializer for this class must be called GreenPropertyDeserializer
- \endverbatim
-*/
-class SceneSerializationBase_EXPORT BasePropertyDeserializer : public itk::Object
-{
- public:
-
- mitkClassMacro( BasePropertyDeserializer, itk::Object );
-
- virtual BaseProperty::Pointer Deserialize(TiXmlElement*);
-
- protected:
-
- BasePropertyDeserializer();
- virtual ~BasePropertyDeserializer();
-};
-
-} // namespace
-
-#endif
-
diff --git a/Modules/SceneSerializationBase/mitkBasePropertySerializer.cpp b/Modules/SceneSerializationBase/mitkBasePropertySerializer.cpp
index 0e34921ff9..c957519a74 100644
--- a/Modules/SceneSerializationBase/mitkBasePropertySerializer.cpp
+++ b/Modules/SceneSerializationBase/mitkBasePropertySerializer.cpp
@@ -1,35 +1,40 @@
/*=========================================================================
Program: Medical Imaging & Interaction Toolkit
Language: C++
Date: $Date$
Version: $Revision: 1.12 $
Copyright (c) German Cancer Research Center, Division of Medical and
Biological Informatics. All rights reserved.
See MITKCopyright.txt or http://www.mitk.org/copyright.html for details.
This software is distributed WITHOUT ANY WARRANTY; without even
the implied warranty of MERCHANTABILITY or FITNESS FOR A PARTICULAR
PURPOSE. See the above copyright notices for more information.
=========================================================================*/
#include "mitkBasePropertySerializer.h"
mitk::BasePropertySerializer::BasePropertySerializer()
{
}
mitk::BasePropertySerializer::~BasePropertySerializer()
{
}
TiXmlElement* mitk::BasePropertySerializer::Serialize()
{
MITK_INFO << this->GetNameOfClass()
<< " is asked to serialize an object " << (const void*) this->m_Property;
return NULL;
}
+mitk::BaseProperty::Pointer mitk::BasePropertySerializer::Deserialize(TiXmlElement*)
+{
+ MITK_ERROR << this->GetNameOfClass() << " is asked to deserialize an object but has no implementation. This is bad.";
+ return NULL;
+}
diff --git a/Modules/SceneSerializationBase/mitkBasePropertySerializer.h b/Modules/SceneSerializationBase/mitkBasePropertySerializer.h
index f5a872ebae..a484411e1c 100644
--- a/Modules/SceneSerializationBase/mitkBasePropertySerializer.h
+++ b/Modules/SceneSerializationBase/mitkBasePropertySerializer.h
@@ -1,70 +1,79 @@
/*=========================================================================
Program: Medical Imaging & Interaction Toolkit
Language: C++
Date: $Date$
Version: $Revision: 1.12 $
Copyright (c) German Cancer Research Center, Division of Medical and
Biological Informatics. All rights reserved.
See MITKCopyright.txt or http://www.mitk.org/copyright.html for details.
This software is distributed WITHOUT ANY WARRANTY; without even
the implied warranty of MERCHANTABILITY or FITNESS FOR A PARTICULAR
PURPOSE. See the above copyright notices for more information.
=========================================================================*/
#ifndef mitkSerializeBaseProperty_h_included
#define mitkSerializeBaseProperty_h_included
#include "SceneSerializationBaseExports.h"
#include "mitkSerializerMacros.h"
#include <itkObjectFactoryBase.h>
#include "mitkBaseProperty.h"
#include <tinyxml.h>
namespace mitk
{
/**
\brief Base class for objects that serialize BaseProperty types.
The name of sub-classes must be deduced from the class name of the object that should be serialized.
The serialization assumes that
\verbatim
If the class derived from BaseProperty is called GreenProperty
Then the serializer for this class must be called GreenPropertySerializer
\endverbatim
*/
class SceneSerializationBase_EXPORT BasePropertySerializer : public itk::Object
{
public:
mitkClassMacro( BasePropertySerializer, itk::Object );
itkSetConstObjectMacro(Property, BaseProperty);
/**
\brief Serializes given BaseProperty object.
- \return the filename of the newly created file.
+ \return The filename of the newly created file.
This should be overwritten by specific sub-classes.
- */
+ */
virtual TiXmlElement* Serialize();
+ /**
+ \brief Deserializes given TiXmlElement.
+ \return The deserialized Property.
+
+ This should be overwritten by specific sub-classes.
+ */
+
+ virtual BaseProperty::Pointer Deserialize(TiXmlElement*);
+
protected:
BasePropertySerializer();
virtual ~BasePropertySerializer();
BaseProperty::ConstPointer m_Property;
};
} // namespace
#endif
diff --git a/Modules/SceneSerializationBase/mitkBoolPropertyDeserializer.cpp b/Modules/SceneSerializationBase/mitkBoolPropertyDeserializer.cpp
deleted file mode 100644
index e582e58c9c..0000000000
--- a/Modules/SceneSerializationBase/mitkBoolPropertyDeserializer.cpp
+++ /dev/null
@@ -1,55 +0,0 @@
-/*=========================================================================
-
-Program: Medical Imaging & Interaction Toolkit
-Language: C++
-Date: $Date$
-Version: $Revision: 1.12 $
-
-Copyright (c) German Cancer Research Center, Division of Medical and
-Biological Informatics. All rights reserved.
-See MITKCopyright.txt or http://www.mitk.org/copyright.html for details.
-
-This software is distributed WITHOUT ANY WARRANTY; without even
-the implied warranty of MERCHANTABILITY or FITNESS FOR A PARTICULAR
-PURPOSE. See the above copyright notices for more information.
-
-=========================================================================*/
-
-#ifndef mitkBoolPropertyDeserializer_h_included
-#define mitkBoolPropertyDeserializer_h_included
-
-#include "mitkBasePropertyDeserializer.h"
-
-#include "mitkProperties.h"
-
-#include "SceneSerializationBaseExports.h"
-
-namespace mitk
-{
-
-class SceneSerializationBase_EXPORT BoolPropertyDeserializer : public BasePropertyDeserializer
-{
- public:
-
- mitkClassMacro( BoolPropertyDeserializer, BasePropertyDeserializer );
- itkNewMacro(Self);
-
- virtual BaseProperty::Pointer Deserialize(TiXmlElement* element)
- {
- if (!element) return NULL;
- return BoolProperty::New( std::string(element->Attribute("value")) == "true" ).GetPointer();
- }
-
- protected:
-
- BoolPropertyDeserializer() {}
- virtual ~BoolPropertyDeserializer() {}
-};
-
-} // namespace
-
-// important to put this into the GLOBAL namespace (because it starts with 'namespace mitk')
-MITK_REGISTER_SERIALIZER(BoolPropertyDeserializer);
-
-#endif
-
diff --git a/Modules/SceneSerializationBase/mitkPropertyListSerializer.cpp b/Modules/SceneSerializationBase/mitkPropertyListSerializer.cpp
index 0f99d98081..3390c36c9e 100644
--- a/Modules/SceneSerializationBase/mitkPropertyListSerializer.cpp
+++ b/Modules/SceneSerializationBase/mitkPropertyListSerializer.cpp
@@ -1,167 +1,167 @@
/*=========================================================================
Program: Medical Imaging & Interaction Toolkit
Language: C++
Date: $Date$
Version: $Revision: 1.12 $
Copyright (c) German Cancer Research Center, Division of Medical and
Biological Informatics. All rights reserved.
See MITKCopyright.txt or http://www.mitk.org/copyright.html for details.
This software is distributed WITHOUT ANY WARRANTY; without even
the implied warranty of MERCHANTABILITY or FITNESS FOR A PARTICULAR
PURPOSE. See the above copyright notices for more information.
=========================================================================*/
#include "mitkPropertyListSerializer.h"
#include "mitkBasePropertySerializer.h"
#include <tinyxml.h>
#include "mitkStandardFileLocations.h"
#include <itksys/SystemTools.hxx>
mitk::PropertyListSerializer::PropertyListSerializer()
: m_FilenameHint("unnamed")
, m_WorkingDirectory("")
{
}
mitk::PropertyListSerializer::~PropertyListSerializer()
{
}
std::string mitk::PropertyListSerializer::Serialize()
{
m_FailedProperties = PropertyList::New();
if ( m_PropertyList.IsNull() || m_PropertyList->IsEmpty() )
{
MITK_ERROR << "Not serializing NULL or empty PropertyList";
return "";
}
// tmpname
static unsigned long count = 1;
unsigned long n = count++;
std::ostringstream name;
for (int i = 0; i < 6; ++i)
{
name << char('a' + (n % 26));
n /= 26;
}
std::string filename;
filename.append(name.str());
std::string fullname(m_WorkingDirectory);
fullname += "/";
fullname += filename;
fullname = itksys::SystemTools::ConvertToOutputPath(fullname.c_str());
TiXmlDocument document;
TiXmlDeclaration* decl = new TiXmlDeclaration( "1.0", "", "" ); // TODO what to write here? encoding? etc....
document.LinkEndChild( decl );
TiXmlElement* version = new TiXmlElement("Version");
version->SetAttribute("Writer", __FILE__ );
version->SetAttribute("Revision", "$Revision: 17055 $" );
version->SetAttribute("FileVersion", 1 );
document.LinkEndChild(version);
// add XML contents
const PropertyList::PropertyMap* propmap = m_PropertyList->GetMap();
for ( PropertyList::PropertyMap::const_iterator iter = propmap->begin();
iter != propmap->end();
++iter )
{
std::string key = iter->first;
- const BaseProperty* property = iter->second.first;
+ const BaseProperty* property = iter->second;
TiXmlElement* element = SerializeOneProperty( key, property );
if (element)
{
document.LinkEndChild( element );
// TODO test serializer for error
}
else
{
m_FailedProperties->ReplaceProperty( key, const_cast<BaseProperty*>(property) );
}
}
// save XML file
if ( !document.SaveFile( fullname ) )
{
MITK_ERROR << "Could not write PropertyList to " << fullname << "\nTinyXML reports '" << document.ErrorDesc() << "'";
return "";
}
return filename;
}
TiXmlElement* mitk::PropertyListSerializer::SerializeOneProperty( const std::string& key, const BaseProperty* property )
{
TiXmlElement* keyelement = new TiXmlElement("property");
keyelement->SetAttribute("key", key);
keyelement->SetAttribute("type", property->GetNameOfClass());
// construct name of serializer class
std::string serializername(property->GetNameOfClass());
serializername += "Serializer";
std::list<itk::LightObject::Pointer> allSerializers = itk::ObjectFactoryBase::CreateAllInstance(serializername.c_str());
if (allSerializers.size() < 1)
{
MITK_ERROR << "No serializer found for " << property->GetNameOfClass() << ". Skipping object";
m_FailedProperties->ReplaceProperty( key, const_cast<BaseProperty*>(property) );
}
if (allSerializers.size() > 1)
{
MITK_WARN << "Multiple serializers found for " << property->GetNameOfClass() << "Using arbitrarily the first one.";
}
for ( std::list<itk::LightObject::Pointer>::iterator iter = allSerializers.begin();
iter != allSerializers.end();
++iter )
{
if (BasePropertySerializer* serializer = dynamic_cast<BasePropertySerializer*>( iter->GetPointer() ) )
{
serializer->SetProperty(property);
try
{
TiXmlElement* valueelement = serializer->Serialize();
if (valueelement)
{
keyelement->LinkEndChild( valueelement );
// \TODO: put 'return keyelement;' here?
}
else
{
m_FailedProperties->ReplaceProperty( key, const_cast<BaseProperty*>(property) );
}
}
catch (std::exception& e)
{
MITK_ERROR << "Serializer " << serializer->GetNameOfClass() << " failed: " << e.what();
m_FailedProperties->ReplaceProperty( key, const_cast<BaseProperty*>(property) );
// \TODO: log only if all potential serializers fail?
}
break;
}
}
return keyelement;
}
mitk::PropertyList* mitk::PropertyListSerializer::GetFailedProperties()
{
if (m_FailedProperties.IsNotNull() && !m_FailedProperties->IsEmpty())
{
return m_FailedProperties;
}
else
{
return NULL;
}
}
diff --git a/Modules/ToFHardware/mitkToFCameraDevice.cpp b/Modules/ToFHardware/mitkToFCameraDevice.cpp
index 5c11df0b8f..4fe8068c55 100644
--- a/Modules/ToFHardware/mitkToFCameraDevice.cpp
+++ b/Modules/ToFHardware/mitkToFCameraDevice.cpp
@@ -1,106 +1,136 @@
/*=========================================================================
Program: Medical Imaging & Interaction Toolkit
Module: $RCSfile$
Language: C++
Date: $Date: 2010-05-27 16:06:53 +0200 (Do, 27 Mai 2010) $
Version: $Revision: $
Copyright (c) German Cancer Research Center, Division of Medical and
Biological Informatics. All rights reserved.
See MITKCopyright.txt or http://www.mitk.org/copyright.html for details.
This software is distributed WITHOUT ANY WARRANTY; without even
the implied warranty of MERCHANTABILITY or FITNESS FOR A PARTICULAR
PURPOSE. See the above copyright notices for more information.
=========================================================================*/
#include "mitkToFCameraDevice.h"
namespace mitk
{
ToFCameraDevice::ToFCameraDevice():m_CaptureWidth(204),m_CaptureHeight(204),m_PixelNumber(41616),m_SourceDataSize(0),m_CameraActive(false),
m_ThreadID(0),m_CameraConnected(false),m_MaxBufferSize(100),m_BufferSize(1),m_CurrentPos(-1),m_FreePos(0),m_ImageSequence(0)
{
this->m_AmplitudeArray = NULL;
this->m_IntensityArray = NULL;
this->m_DistanceArray = NULL;
this->m_PropertyList = mitk::PropertyList::New();
this->m_MultiThreader = itk::MultiThreader::New();
this->m_ImageMutex = itk::FastMutexLock::New();
this->m_CameraActiveMutex = itk::FastMutexLock::New();
}
ToFCameraDevice::~ToFCameraDevice()
{
+ CleanupPixelArrays();
}
void ToFCameraDevice::SetBoolProperty( const char* propertyKey, bool boolValue )
{
SetProperty(propertyKey, mitk::BoolProperty::New(boolValue));
}
void ToFCameraDevice::SetIntProperty( const char* propertyKey, int intValue )
{
SetProperty(propertyKey, mitk::IntProperty::New(intValue));
}
void ToFCameraDevice::SetFloatProperty( const char* propertyKey, float floatValue )
{
SetProperty(propertyKey, mitk::FloatProperty::New(floatValue));
}
void ToFCameraDevice::SetStringProperty( const char* propertyKey, const char* stringValue )
{
SetProperty(propertyKey, mitk::StringProperty::New(stringValue));
}
void ToFCameraDevice::SetProperty( const char *propertyKey, BaseProperty* propertyValue )
{
this->m_PropertyList->SetProperty(propertyKey, propertyValue);
}
BaseProperty* ToFCameraDevice::GetProperty(const char *propertyKey)
{
return this->m_PropertyList->GetProperty(propertyKey);
}
bool ToFCameraDevice::GetBoolProperty(BaseProperty* propertyValue, bool& boolValue)
{
mitk::BoolProperty::Pointer boolprop = dynamic_cast<mitk::BoolProperty*>(propertyValue);
if(boolprop.IsNull())
return false;
boolValue = boolprop->GetValue();
return true;
}
bool ToFCameraDevice::GetStringProperty(BaseProperty* propertyValue, std::string& string)
{
mitk::StringProperty::Pointer stringProp = dynamic_cast<mitk::StringProperty*>(propertyValue);
if(stringProp.IsNull())
{
return false;
}
else
{
string = stringProp->GetValue();
return true;
}
}
bool ToFCameraDevice::GetIntProperty(BaseProperty* propertyValue, int& integer)
{
mitk::IntProperty::Pointer intProp = dynamic_cast<mitk::IntProperty*>(propertyValue);
if(intProp.IsNull())
{
return false;
}
else
{
integer = intProp->GetValue();
return true;
}
}
+
+ void ToFCameraDevice::CleanupPixelArrays()
+ {
+ if (m_IntensityArray)
+ {
+ delete [] m_IntensityArray;
+ }
+ if (m_DistanceArray)
+ {
+ delete [] m_DistanceArray;
+ }
+ if (m_AmplitudeArray)
+ {
+ delete [] m_AmplitudeArray;
+ }
+ }
+
+ void ToFCameraDevice::AllocatePixelArrays()
+ {
+ // free memory if it was already allocated
+ CleanupPixelArrays();
+ // allocate buffer
+ this->m_IntensityArray = new float[this->m_PixelNumber];
+ for(int i=0; i<this->m_PixelNumber; i++) {this->m_IntensityArray[i]=0.0;}
+ this->m_DistanceArray = new float[this->m_PixelNumber];
+ for(int i=0; i<this->m_PixelNumber; i++) {this->m_DistanceArray[i]=0.0;}
+ this->m_AmplitudeArray = new float[this->m_PixelNumber];
+ for(int i=0; i<this->m_PixelNumber; i++) {this->m_AmplitudeArray[i]=0.0;}
+ }
}
diff --git a/Modules/ToFHardware/mitkToFCameraDevice.h b/Modules/ToFHardware/mitkToFCameraDevice.h
index 233345fc18..cb447e2910 100644
--- a/Modules/ToFHardware/mitkToFCameraDevice.h
+++ b/Modules/ToFHardware/mitkToFCameraDevice.h
@@ -1,208 +1,217 @@
/*=========================================================================
Program: Medical Imaging & Interaction Toolkit
Module: $RCSfile$
Language: C++
Date: $Date: 2010-05-27 16:06:53 +0200 (Do, 27 Mai 2010) $
Version: $Revision: $
Copyright (c) German Cancer Research Center, Division of Medical and
Biological Informatics. All rights reserved.
See MITKCopyright.txt or http://www.mitk.org/copyright.html for details.
This software is distributed WITHOUT ANY WARRANTY; without even
the implied warranty of MERCHANTABILITY or FITNESS FOR A PARTICULAR
PURPOSE. See the above copyright notices for more information.
=========================================================================*/
#ifndef __mitkToFCameraDevice_h
#define __mitkToFCameraDevice_h
#include "mitkToFHardwareExports.h"
#include "mitkCommon.h"
#include "mitkStringProperty.h"
#include "mitkProperties.h"
#include "mitkPropertyList.h"
#include "itkObject.h"
#include "itkObjectFactory.h"
#include "itkMultiThreader.h"
#include "itkFastMutexLock.h"
namespace mitk
{
/**
* @brief Virtual interface and base class for all Time-of-Flight devices.
*
* @ingroup ToFHardware
*/
class MITK_TOFHARDWARE_EXPORT ToFCameraDevice : public itk::Object
{
public:
mitkClassMacro(ToFCameraDevice, itk::Object);
/*!
\brief opens a connection to the ToF camera
*/
virtual bool ConnectCamera() = 0;
/*!
\brief closes the connection to the camera
*/
virtual bool DisconnectCamera() = 0;
/*!
\brief starts the continuous updating of the camera.
A separate thread updates the source data, the main thread processes the source data and creates images and coordinates
*/
virtual void StartCamera() = 0;
/*!
\brief stops the continuous updating of the camera
*/
virtual void StopCamera() = 0;
/*!
\brief returns true if the camera is connected and started
*/
virtual bool IsCameraActive() = 0;
/*!
\brief updates the camera for image acquisition
*/
virtual void UpdateCamera() = 0;
/*!
\brief gets the amplitude data from the ToF camera as the strength of the active illumination of every pixel
These values can be used to determine the quality of the distance values. The higher the amplitude value, the higher the accuracy of the according distance value
\param imageSequence the actually captured image sequence number
\param amplitudeArray contains the returned amplitude data as an array.
*/
virtual void GetAmplitudes(float* amplitudeArray, int& imageSequence) = 0;
/*!
\brief gets the intensity data from the ToF camera as a greyscale image
\param intensityArray contains the returned intensities data as an array.
\param imageSequence the actually captured image sequence number
*/
virtual void GetIntensities(float* intensityArray, int& imageSequence) = 0;
/*!
\brief gets the distance data from the ToF camera measuring the distance between the camera and the different object points in millimeters
\param distanceArray contains the returned distances data as an array.
\param imageSequence the actually captured image sequence number
*/
virtual void GetDistances(float* distanceArray, int& imageSequence) = 0;
/*!
\brief gets the 3 images (distance, amplitude, intensity) from the ToF camera. Caution! The user is responsible for allocating and deleting the images.
\param distanceArray contains the returned distance data as an array.
\param amplitudeArray contains the returned amplitude data as an array.
\param intensityArray contains the returned intensity data as an array.
\param sourceDataArray contains the complete source data from the camera device.
\param requiredImageSequence the required image sequence number
\param capturedImageSequence the actually captured image sequence number
*/
virtual void GetAllImages(float* distanceArray, float* amplitudeArray, float* intensityArray, char* sourceDataArray,
int requiredImageSequence, int& capturedImageSequence) = 0;
// TODO: Buffer size currently set to 1. Once Buffer handling is working correctly, method may be reactivated
// /*!
// \brief pure virtual method resetting the buffer using the specified bufferSize. Has to be implemented by sub-classes
// \param bufferSize buffer size the buffer should be reset to
// */
// virtual void ResetBuffer(int bufferSize) = 0;
//TODO add/correct documentation for requiredImageSequence and capturedImageSequence in the GetAllImages, GetDistances, GetIntensities and GetAmplitudes methods.
/*!
\brief get the currently set capture width
\return capture width
*/
itkGetMacro(CaptureWidth, int);
/*!
\brief get the currently set capture height
\return capture height
*/
itkGetMacro(CaptureHeight, int);
/*!
\brief get the currently set source data size
\return source data size
*/
itkGetMacro(SourceDataSize, int);
/*!
\brief get the currently set buffer size
\return buffer size
*/
itkGetMacro(BufferSize, int);
/*!
\brief get the currently set max buffer size
\return max buffer size
*/
itkGetMacro(MaxBufferSize, int);
/*!
\brief set a bool property in the property list
*/
void SetBoolProperty( const char* propertyKey, bool boolValue );
/*!
\brief set an int property in the property list
*/
void SetIntProperty( const char* propertyKey, int intValue );
/*!
\brief set a float property in the property list
*/
void SetFloatProperty( const char* propertyKey, float floatValue );
/*!
\brief set a string property in the property list
*/
void SetStringProperty( const char* propertyKey, const char* stringValue );
/*!
\brief set a BaseProperty property in the property list
*/
virtual void SetProperty( const char *propertyKey, BaseProperty* propertyValue );
/*!
\brief get a BaseProperty from the property list
*/
virtual BaseProperty* GetProperty( const char *propertyKey );
/*!
\brief get a bool from the property list
*/
static bool GetBoolProperty(BaseProperty* propertyValue, bool& boolValue);
/*!
\brief get a string from the property list
*/
static bool GetStringProperty(BaseProperty* propertyValue, std::string& string);
/*!
\brief get an int from the property list
*/
static bool GetIntProperty(BaseProperty* propertyValue, int& integer);
protected:
ToFCameraDevice();
~ToFCameraDevice();
+ /*!
+ \brief method for allocating memory for pixel arrays m_IntensityArray, m_DistanceArray and m_AmplitudeArray
+ */
+ virtual void AllocatePixelArrays();
+ /*!
+ \brief method for cleanup memory allocated for pixel arrays m_IntensityArray, m_DistanceArray and m_AmplitudeArray
+ */
+ virtual void CleanupPixelArrays();
+
float* m_IntensityArray; ///< float array holding the intensity image
float* m_DistanceArray; ///< float array holding the distance image
float* m_AmplitudeArray; ///< float array holding the amplitude image
int m_BufferSize; ///< buffer size of the image buffer needed for loss-less acquisition of range data
int m_MaxBufferSize; ///< maximal buffer size needed for initialization of data arrays. Default value is 100.
int m_CurrentPos; ///< current position in the buffer which will be retrieved by the Get methods
int m_FreePos; ///< current position in the buffer which will be filled with data acquired from the hardware
int m_CaptureWidth; ///< width of the range image (x dimension)
int m_CaptureHeight; ///< height of the range image (y dimension)
int m_PixelNumber; ///< number of pixels in the range image (m_CaptureWidth*m_CaptureHeight)
int m_SourceDataSize; ///< size of the PMD source data
itk::MultiThreader::Pointer m_MultiThreader; ///< itk::MultiThreader used for thread handling
itk::FastMutexLock::Pointer m_ImageMutex; ///< mutex for images provided by the range camera
itk::FastMutexLock::Pointer m_CameraActiveMutex; ///< mutex for the cameraActive flag
int m_ThreadID; ///< ID of the started thread
bool m_CameraActive; ///< flag indicating if the camera is currently active or not. Caution: thread safe access only!
bool m_CameraConnected; ///< flag indicating if the camera is successfully connected or not. Caution: thread safe access only!
int m_ImageSequence; ///< counter for acquired images
PropertyList::Pointer m_PropertyList; ///< a list of the corresponding properties
private:
};
} //END mitk namespace
#endif
diff --git a/Modules/ToFHardware/mitkToFCameraMITKPlayerDevice.cpp b/Modules/ToFHardware/mitkToFCameraMITKPlayerDevice.cpp
index 760a077256..5462df4087 100644
--- a/Modules/ToFHardware/mitkToFCameraMITKPlayerDevice.cpp
+++ b/Modules/ToFHardware/mitkToFCameraMITKPlayerDevice.cpp
@@ -1,362 +1,370 @@
/*=========================================================================
Program: Medical Imaging & Interaction Toolkit
Module: $RCSfile$
Language: C++
Date: $Date: 2010-05-27 16:06:53 +0200 (Do, 27 Mai 2010) $
Version: $Revision: $
Copyright (c) German Cancer Research Center, Division of Medical and
Biological Informatics. All rights reserved.
See MITKCopyright.txt or http://www.mitk.org/copyright.html for details.
This software is distributed WITHOUT ANY WARRANTY; without even
the implied warranty of MERCHANTABILITY or FITNESS FOR A PARTICULAR
PURPOSE. See the above copyright notices for more information.
=========================================================================*/
#include "mitkToFCameraMITKPlayerDevice.h"
#include "mitkToFCameraMITKPlayerController.h"
#include "mitkRealTimeClock.h"
#include "itkMultiThreader.h"
#include <itksys/SystemTools.hxx>
namespace mitk
{
- ToFCameraMITKPlayerDevice::ToFCameraMITKPlayerDevice()
+ ToFCameraMITKPlayerDevice::ToFCameraMITKPlayerDevice() :
+ m_DistanceDataBuffer(NULL), m_IntensityDataBuffer(NULL), m_AmplitudeDataBuffer(NULL)
{
m_Controller = ToFCameraMITKPlayerController::New();
}
ToFCameraMITKPlayerDevice::~ToFCameraMITKPlayerDevice()
{
DisconnectCamera();
+ CleanUpDataBuffers();
}
bool ToFCameraMITKPlayerDevice::ConnectCamera()
{
bool ok = m_Controller->OpenCameraConnection();
if (ok)
{
this->m_CaptureWidth = m_Controller->GetCaptureWidth();
this->m_CaptureHeight = m_Controller->GetCaptureHeight();
this->m_PixelNumber = this->m_CaptureWidth * this->m_CaptureHeight;
- // allocate buffer
- this->m_IntensityArray = new float[this->m_PixelNumber];
- for(int i=0; i<this->m_PixelNumber; i++) {this->m_IntensityArray[i]=0.0;}
- this->m_DistanceArray = new float[this->m_PixelNumber];
- for(int i=0; i<this->m_PixelNumber; i++) {this->m_DistanceArray[i]=0.0;}
- this->m_AmplitudeArray = new float[this->m_PixelNumber];
- for(int i=0; i<this->m_PixelNumber; i++) {this->m_AmplitudeArray[i]=0.0;}
-
- this->m_DistanceDataBuffer = new float*[this->m_MaxBufferSize];
- for(int i=0; i<this->m_MaxBufferSize; i++)
- {
- this->m_DistanceDataBuffer[i] = new float[this->m_PixelNumber];
- }
- this->m_AmplitudeDataBuffer = new float*[this->m_MaxBufferSize];
- for(int i=0; i<this->m_MaxBufferSize; i++)
- {
- this->m_AmplitudeDataBuffer[i] = new float[this->m_PixelNumber];
- }
- this->m_IntensityDataBuffer = new float*[this->m_MaxBufferSize];
- for(int i=0; i<this->m_MaxBufferSize; i++)
- {
- this->m_IntensityDataBuffer[i] = new float[this->m_PixelNumber];
- }
+ AllocatePixelArrays();
+ AllocateDataBuffers();
m_CameraConnected = true;
}
return ok;
}
bool ToFCameraMITKPlayerDevice::DisconnectCamera()
{
bool ok = m_Controller->CloseCameraConnection();
-
- // free buffer if camera was connected
- if (m_CameraConnected)
+ if (ok)
{
- delete [] m_IntensityArray;
- delete [] m_DistanceArray;
- delete [] m_AmplitudeArray;
-
- for(int i=0; i<this->m_MaxBufferSize; i++)
- {
- delete[] this->m_DistanceDataBuffer[i];
- }
- delete[] this->m_DistanceDataBuffer;
- for(int i=0; i<this->m_MaxBufferSize; i++)
- {
- delete[] this->m_AmplitudeDataBuffer[i];
- }
- delete[] this->m_AmplitudeDataBuffer;
- for(int i=0; i<this->m_MaxBufferSize; i++)
- {
- delete[] this->m_IntensityDataBuffer[i];
- }
- delete[] this->m_IntensityDataBuffer;
-
m_CameraConnected = false;
}
return ok;
}
void ToFCameraMITKPlayerDevice::StartCamera()
{
if (m_CameraConnected)
{
// get the first image
this->m_Controller->UpdateCamera();
this->m_ImageMutex->Lock();
this->m_Controller->GetDistances(this->m_DistanceDataBuffer[this->m_FreePos]);
this->m_Controller->GetAmplitudes(this->m_AmplitudeDataBuffer[this->m_FreePos]);
this->m_Controller->GetIntensities(this->m_IntensityDataBuffer[this->m_FreePos]);
this->m_FreePos = (this->m_FreePos+1) % this->m_BufferSize;
this->m_CurrentPos = (this->m_CurrentPos+1) % this->m_BufferSize;
this->m_ImageSequence++;
this->m_ImageMutex->Unlock();
this->m_CameraActiveMutex->Lock();
this->m_CameraActive = true;
this->m_CameraActiveMutex->Unlock();
this->m_ThreadID = this->m_MultiThreader->SpawnThread(this->Acquire, this);
// wait a little to make sure that the thread is started
itksys::SystemTools::Delay(10);
}
else
{
MITK_INFO<<"Camera not connected";
}
}
void ToFCameraMITKPlayerDevice::StopCamera()
{
m_CameraActiveMutex->Lock();
m_CameraActive = false;
m_CameraActiveMutex->Unlock();
itksys::SystemTools::Delay(100);
if (m_MultiThreader.IsNotNull())
{
m_MultiThreader->TerminateThread(m_ThreadID);
}
// wait a little to make sure that the thread is terminated
itksys::SystemTools::Delay(100);
}
bool ToFCameraMITKPlayerDevice::IsCameraActive()
{
m_CameraActiveMutex->Lock();
bool ok = m_CameraActive;
m_CameraActiveMutex->Unlock();
return ok;
}
void ToFCameraMITKPlayerDevice::UpdateCamera()
{
m_Controller->UpdateCamera();
}
ITK_THREAD_RETURN_TYPE ToFCameraMITKPlayerDevice::Acquire(void* pInfoStruct)
{
/* extract this pointer from Thread Info structure */
struct itk::MultiThreader::ThreadInfoStruct * pInfo = (struct itk::MultiThreader::ThreadInfoStruct*)pInfoStruct;
if (pInfo == NULL)
{
return ITK_THREAD_RETURN_VALUE;
}
if (pInfo->UserData == NULL)
{
return ITK_THREAD_RETURN_VALUE;
}
ToFCameraMITKPlayerDevice* toFCameraDevice = (ToFCameraMITKPlayerDevice*)pInfo->UserData;
if (toFCameraDevice!=NULL)
{
mitk::RealTimeClock::Pointer realTimeClock;
realTimeClock = mitk::RealTimeClock::New();
int n = 100;
double t1, t2;
t1 = realTimeClock->GetCurrentStamp();
bool overflow = false;
bool printStatus = false;
while (toFCameraDevice->IsCameraActive())
{
// update the ToF camera
toFCameraDevice->UpdateCamera();
// get image data from controller and write it to the according buffer
toFCameraDevice->m_Controller->GetDistances(toFCameraDevice->m_DistanceDataBuffer[toFCameraDevice->m_FreePos]);
toFCameraDevice->m_Controller->GetAmplitudes(toFCameraDevice->m_AmplitudeDataBuffer[toFCameraDevice->m_FreePos]);
toFCameraDevice->m_Controller->GetIntensities(toFCameraDevice->m_IntensityDataBuffer[toFCameraDevice->m_FreePos]);
toFCameraDevice->Modified();
/*!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!
TODO Buffer Handling currently only works for buffer size 1
!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!*/
toFCameraDevice->m_ImageMutex->Lock();
toFCameraDevice->m_FreePos = (toFCameraDevice->m_FreePos+1) % toFCameraDevice->m_BufferSize;
toFCameraDevice->m_CurrentPos = (toFCameraDevice->m_CurrentPos+1) % toFCameraDevice->m_BufferSize;
toFCameraDevice->m_ImageSequence++;
if (toFCameraDevice->m_FreePos == toFCameraDevice->m_CurrentPos)
{
// buffer overflow
//MITK_INFO << "Buffer overflow!! ";
//toFCameraDevice->m_CurrentPos = (toFCameraDevice->m_CurrentPos+1) % toFCameraDevice->m_BufferSize;
//toFCameraDevice->m_ImageSequence++;
overflow = true;
}
if (toFCameraDevice->m_ImageSequence % n == 0)
{
printStatus = true;
}
toFCameraDevice->m_ImageMutex->Unlock();
if (overflow)
{
//itksys::SystemTools::Delay(10);
overflow = false;
}
/*!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!
END TODO Buffer Handling currently only works for buffer size 1
!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!*/
// print current framerate
if (printStatus)
{
t2 = realTimeClock->GetCurrentStamp() - t1;
MITK_INFO << " Framerate (fps): " << n / (t2/1000) << " Sequence: " << toFCameraDevice->m_ImageSequence;
t1 = realTimeClock->GetCurrentStamp();
printStatus = false;
}
} // end of while loop
}
return ITK_THREAD_RETURN_VALUE;
}
// TODO: Buffer size currently set to 1. Once Buffer handling is working correctly, method may be reactivated
// void ToFCameraMITKPlayerDevice::ResetBuffer(int bufferSize)
// {
// this->m_BufferSize = bufferSize;
// this->m_CurrentPos = -1;
// this->m_FreePos = 0;
// }
void ToFCameraMITKPlayerDevice::GetAmplitudes(float* amplitudeArray, int& imageSequence)
{
m_ImageMutex->Lock();
/*!!!!!!!!!!!!!!!!!!!!!!
TODO Buffer handling???
!!!!!!!!!!!!!!!!!!!!!!!!*/
// write amplitude image data to float array
for (int i=0; i<this->m_PixelNumber; i++)
{
amplitudeArray[i] = this->m_AmplitudeDataBuffer[this->m_CurrentPos][i];
}
imageSequence = this->m_ImageSequence;
m_ImageMutex->Unlock();
}
void ToFCameraMITKPlayerDevice::GetIntensities(float* intensityArray, int& imageSequence)
{
m_ImageMutex->Lock();
/*!!!!!!!!!!!!!!!!!!!!!!
TODO Buffer handling???
!!!!!!!!!!!!!!!!!!!!!!!!*/
// write intensity image data to float array
for (int i=0; i<this->m_PixelNumber; i++)
{
intensityArray[i] = this->m_IntensityDataBuffer[this->m_CurrentPos][i];
}
imageSequence = this->m_ImageSequence;
m_ImageMutex->Unlock();
}
void ToFCameraMITKPlayerDevice::GetDistances(float* distanceArray, int& imageSequence)
{
m_ImageMutex->Lock();
/*!!!!!!!!!!!!!!!!!!!!!!
TODO Buffer handling???
!!!!!!!!!!!!!!!!!!!!!!!!*/
// write distance image data to float array
for (int i=0; i<this->m_PixelNumber; i++)
{
distanceArray[i] = this->m_DistanceDataBuffer[this->m_CurrentPos][i];
}
imageSequence = this->m_ImageSequence;
m_ImageMutex->Unlock();
}
void ToFCameraMITKPlayerDevice::GetAllImages(float* distanceArray, float* amplitudeArray, float* intensityArray, char* sourceDataArray,
int requiredImageSequence, int& capturedImageSequence)
{
/*!!!!!!!!!!!!!!!!!!!!!!
TODO Document this method!
!!!!!!!!!!!!!!!!!!!!!!!!*/
m_ImageMutex->Lock();
//check for empty buffer
if (this->m_ImageSequence < 0)
{
// buffer empty
MITK_INFO << "Buffer empty!! ";
capturedImageSequence = this->m_ImageSequence;
m_ImageMutex->Unlock();
return;
}
// determine position of image in buffer
int pos = 0;
if ((requiredImageSequence < 0) || (requiredImageSequence > this->m_ImageSequence))
{
capturedImageSequence = this->m_ImageSequence;
pos = this->m_CurrentPos;
}
else if (requiredImageSequence <= this->m_ImageSequence - this->m_BufferSize)
{
capturedImageSequence = (this->m_ImageSequence - this->m_BufferSize) + 1;
pos = (this->m_CurrentPos + 1) % this->m_BufferSize;
}
else // (requiredImageSequence > this->m_ImageSequence - this->m_BufferSize) && (requiredImageSequence <= this->m_ImageSequence)
{
capturedImageSequence = requiredImageSequence;
pos = (this->m_CurrentPos + (10-(this->m_ImageSequence - requiredImageSequence))) % this->m_BufferSize;
}
// write image data to float arrays
for (int i=0; i<this->m_PixelNumber; i++)
{
distanceArray[i] = this->m_DistanceDataBuffer[pos][i];
amplitudeArray[i] = this->m_AmplitudeDataBuffer[pos][i];
intensityArray[i] = this->m_IntensityDataBuffer[pos][i];
}
m_ImageMutex->Unlock();
}
void ToFCameraMITKPlayerDevice::SetInputFileName(std::string inputFileName)
{
this->m_InputFileName = inputFileName;
this->m_Controller->SetInputFileName(inputFileName);
}
void ToFCameraMITKPlayerDevice::SetProperty( const char *propertyKey, BaseProperty* propertyValue )
{
this->m_PropertyList->SetProperty(propertyKey, propertyValue);
ToFCameraMITKPlayerController::Pointer myController = dynamic_cast<mitk::ToFCameraMITKPlayerController*>(this->m_Controller.GetPointer());
std::string strValue;
GetStringProperty(propertyValue, strValue);
if (strcmp(propertyKey, "DistanceImageFileName") == 0)
{
myController->SetDistanceImageFileName(strValue);
}
else if (strcmp(propertyKey, "AmplitudeImageFileName") == 0)
{
myController->SetAmplitudeImageFileName(strValue);
}
else if (strcmp(propertyKey, "IntensityImageFileName") == 0)
{
myController->SetIntensityImageFileName(strValue);
}
}
+ void ToFCameraMITKPlayerDevice::CleanUpDataBuffers()
+ {
+ if (m_DistanceDataBuffer)
+ {
+ for(int i=0; i<this->m_MaxBufferSize; i++)
+ {
+ delete[] this->m_DistanceDataBuffer[i];
+ }
+ delete[] this->m_DistanceDataBuffer;
+ }
+ if (m_AmplitudeDataBuffer)
+ {
+ for(int i=0; i<this->m_MaxBufferSize; i++)
+ {
+ delete[] this->m_AmplitudeDataBuffer[i];
+ }
+ delete[] this->m_AmplitudeDataBuffer;
+ }
+ if (m_IntensityDataBuffer)
+ {
+ for(int i=0; i<this->m_MaxBufferSize; i++)
+ {
+ delete[] this->m_IntensityDataBuffer[i];
+ }
+ delete[] this->m_IntensityDataBuffer;
+ }
+ }
+
+ void ToFCameraMITKPlayerDevice::AllocateDataBuffers()
+ {
+ // free memory if it was already allocated
+ this->CleanUpDataBuffers();
+ // allocate buffers
+ this->m_DistanceDataBuffer = new float*[this->m_MaxBufferSize];
+ for(int i=0; i<this->m_MaxBufferSize; i++)
+ {
+ this->m_DistanceDataBuffer[i] = new float[this->m_PixelNumber];
+ }
+ this->m_AmplitudeDataBuffer = new float*[this->m_MaxBufferSize];
+ for(int i=0; i<this->m_MaxBufferSize; i++)
+ {
+ this->m_AmplitudeDataBuffer[i] = new float[this->m_PixelNumber];
+ }
+ this->m_IntensityDataBuffer = new float*[this->m_MaxBufferSize];
+ for(int i=0; i<this->m_MaxBufferSize; i++)
+ {
+ this->m_IntensityDataBuffer[i] = new float[this->m_PixelNumber];
+ }
+ }
}
diff --git a/Modules/ToFHardware/mitkToFCameraMITKPlayerDevice.h b/Modules/ToFHardware/mitkToFCameraMITKPlayerDevice.h
index 4bb760fc62..f6f03e683c 100644
--- a/Modules/ToFHardware/mitkToFCameraMITKPlayerDevice.h
+++ b/Modules/ToFHardware/mitkToFCameraMITKPlayerDevice.h
@@ -1,141 +1,149 @@
/*=========================================================================
Program: Medical Imaging & Interaction Toolkit
Module: $RCSfile$
Language: C++
Date: $Date: 2010-05-27 16:06:53 +0200 (Do, 27 Mai 2010) $
Version: $Revision: $
Copyright (c) German Cancer Research Center, Division of Medical and
Biological Informatics. All rights reserved.
See MITKCopyright.txt or http://www.mitk.org/copyright.html for details.
This software is distributed WITHOUT ANY WARRANTY; without even
the implied warranty of MERCHANTABILITY or FITNESS FOR A PARTICULAR
PURPOSE. See the above copyright notices for more information.
=========================================================================*/
#ifndef __mitkToFCameraMITKPlayerDevice_h
#define __mitkToFCameraMITKPlayerDevice_h
#include "mitkToFHardwareExports.h"
#include "mitkCommon.h"
#include "mitkToFCameraDevice.h"
#include "mitkToFCameraMITKPlayerController.h"
#include "itkObject.h"
#include "itkObjectFactory.h"
#include "itkMultiThreader.h"
#include "itkFastMutexLock.h"
namespace mitk
{
/**
* @brief Device class representing a player for MITK-ToF images.
*
* @ingroup ToFHardware
*/
class MITK_TOFHARDWARE_EXPORT ToFCameraMITKPlayerDevice : public ToFCameraDevice
{
public:
mitkClassMacro( ToFCameraMITKPlayerDevice , ToFCameraDevice );
itkNewMacro( Self );
/*!
\brief opens a connection to the ToF camera
*/
virtual bool ConnectCamera();
/*!
\brief closes the connection to the camera
*/
virtual bool DisconnectCamera();
/*!
\brief starts the continuous updating of the camera.
A separate thread updates the source data, the main thread processes the source data and creates images and coordinates
*/
virtual void StartCamera();
/*!
\brief stops the continuous updating of the camera
*/
virtual void StopCamera();
/*!
\brief returns whether the camera is currently active or not
*/
virtual bool IsCameraActive();
/*!
\brief gets the amplitude data from the ToF camera as the strength of the active illumination of every pixel. Caution! The user is responsible for allocating and deleting the images.
These values can be used to determine the quality of the distance values. The higher the amplitude value, the higher the accuracy of the according distance value
\param imageSequence the actually captured image sequence number
\param amplitudeArray contains the returned amplitude data as an array.
*/
virtual void GetAmplitudes(float* amplitudeArray, int& imageSequence);
/*!
\brief gets the intensity data from the ToF camera as a greyscale image. Caution! The user is responsible for allocating and deleting the images.
\param intensityArray contains the returned intensities data as an array.
\param imageSequence the actually captured image sequence number
*/
virtual void GetIntensities(float* intensityArray, int& imageSequence);
/*!
\brief gets the distance data from the ToF camera measuring the distance between the camera and the different object points in millimeters. Caution! The user is responsible for allocating and deleting the images.
\param distanceArray contains the returned distances data as an array.
\param imageSequence the actually captured image sequence number
*/
virtual void GetDistances(float* distanceArray, int& imageSequence);
/*!
\brief gets the 3 images (distance, amplitude, intensity) from the ToF camera. Caution! The user is responsible for allocating and deleting the images.
\param distanceArray contains the returned distance data as an array.
\param amplitudeArray contains the returned amplitude data as an array.
\param intensityArray contains the returned intensity data as an array.
\param sourceDataArray contains the complete source data from the camera device.
\param requiredImageSequence the required image sequence number
\param capturedImageSequence the actually captured image sequence number
*/
virtual void GetAllImages(float* distanceArray, float* amplitudeArray, float* intensityArray, char* sourceDataArray,
int requiredImageSequence, int& capturedImageSequence);
// TODO: Buffer size currently set to 1. Once Buffer handling is working correctly, method may be reactivated
// /*!
// \brief pure virtual method resetting the buffer using the specified bufferSize. Has to be implemented by sub-classes
// \param bufferSize buffer size the buffer should be reset to
// */
// virtual void ResetBuffer(int bufferSize) = 0;
//TODO add/correct documentation for requiredImageSequence and capturedImageSequence in the GetAllImages, GetDistances, GetIntensities and GetAmplitudes methods.
/*!
\brief Set file name where the data is recorded
\param inputFileName name of input file which should be played
*/
virtual void SetInputFileName(std::string inputFileName);
/*!
\brief set a BaseProperty
*/
virtual void SetProperty( const char *propertyKey, BaseProperty* propertyValue );
protected:
ToFCameraMITKPlayerDevice();
~ToFCameraMITKPlayerDevice();
/*!
\brief updates the camera for image acquisition
*/
virtual void UpdateCamera();
/*!
\brief Thread method continuously acquiring images from the specified input file
*/
static ITK_THREAD_RETURN_TYPE Acquire(void* pInfoStruct);
+ /*!
+ \brief Clean up memory (pixel buffers)
+ */
+ void CleanUpDataBuffers();
+ /*!
+ \brief Allocate pixel buffers
+ */
+ void AllocateDataBuffers();
ToFCameraMITKPlayerController::Pointer m_Controller; ///< member holding the corresponding controller
std::string m_InputFileName; ///< member holding the file name of the current input file
private:
float** m_DistanceDataBuffer; ///< buffer holding the last distance images
float** m_AmplitudeDataBuffer; ///< buffer holding the last amplitude images
float** m_IntensityDataBuffer; ///< buffer holding the last intensity images
};
} //END mitk namespace
#endif
diff --git a/Modules/ToFHardware/mitkToFCameraPMDDevice.cpp b/Modules/ToFHardware/mitkToFCameraPMDDevice.cpp
index 95a12fe3e7..2402f2f93f 100644
--- a/Modules/ToFHardware/mitkToFCameraPMDDevice.cpp
+++ b/Modules/ToFHardware/mitkToFCameraPMDDevice.cpp
@@ -1,406 +1,415 @@
/*=========================================================================
Program: Medical Imaging & Interaction Toolkit
Module: $RCSfile$
Language: C++
Date: $Date: 2010-05-27 16:06:53 +0200 (Do, 27 Mai 2010) $
Version: $Revision: $
Copyright (c) German Cancer Research Center, Division of Medical and
Biological Informatics. All rights reserved.
See MITKCopyright.txt or http://www.mitk.org/copyright.html for details.
This software is distributed WITHOUT ANY WARRANTY; without even
the implied warranty of MERCHANTABILITY or FITNESS FOR A PARTICULAR
PURPOSE. See the above copyright notices for more information.
=========================================================================*/
#include "mitkToFCameraPMDDevice.h"
#include "mitkRealTimeClock.h"
#include "itkMultiThreader.h"
#include <itksys/SystemTools.hxx>
namespace mitk
{
- ToFCameraPMDDevice::ToFCameraPMDDevice()
+ ToFCameraPMDDevice::ToFCameraPMDDevice() :
+ m_SourceDataArray(NULL), m_SourceDataBuffer(NULL)
{
}
ToFCameraPMDDevice::~ToFCameraPMDDevice()
{
+ this->CleanUpSourceData();
}
bool ToFCameraPMDDevice::ConnectCamera()
{
bool ok = false;
if (m_Controller)
{
ok = m_Controller->OpenCameraConnection();
if (ok)
{
this->m_CaptureWidth = m_Controller->GetCaptureWidth();
this->m_CaptureHeight = m_Controller->GetCaptureHeight();
this->m_SourceDataSize = m_Controller->GetSourceDataStructSize();
this->m_PixelNumber = this->m_CaptureWidth * this->m_CaptureHeight;
- // allocate buffer
- this->m_IntensityArray = new float[this->m_PixelNumber];
- for(int i=0; i<this->m_PixelNumber; i++) {this->m_IntensityArray[i]=0.0;}
- this->m_DistanceArray = new float[this->m_PixelNumber];
- for(int i=0; i<this->m_PixelNumber; i++) {this->m_DistanceArray[i]=0.0;}
- this->m_AmplitudeArray = new float[this->m_PixelNumber];
- for(int i=0; i<this->m_PixelNumber; i++) {this->m_AmplitudeArray[i]=0.0;}
- this->m_SourceDataArray = new char[this->m_SourceDataSize];
- for(int i=0; i<this->m_SourceDataSize; i++) {this->m_SourceDataArray[i]=0;}
-
- this->m_SourceDataBuffer = new char*[this->m_MaxBufferSize];
- for(int i=0; i<this->m_MaxBufferSize; i++)
- {
- this->m_SourceDataBuffer[i] = new char[this->m_SourceDataSize];
- }
+ // allocate buffers
+ AllocatePixelArrays();
+ this->AllocateSourceData();
m_CameraConnected = true;
}
}
return ok;
}
bool ToFCameraPMDDevice::DisconnectCamera()
{
bool ok = false;
if (m_Controller)
{
ok = m_Controller->CloseCameraConnection();
- // clean-up only if camera was connected
- if (m_CameraConnected)
+ if (ok)
{
- MITK_INFO<<"free buffer";
- // free buffer
- delete [] m_IntensityArray;
- delete [] m_DistanceArray;
- delete [] m_AmplitudeArray;
- delete [] m_SourceDataArray;
- for(int i=0; i<this->m_MaxBufferSize; i++)
- {
- delete[] this->m_SourceDataBuffer[i];
- }
- delete[] this->m_SourceDataBuffer;
m_CameraConnected = false;
}
}
return ok;
}
void ToFCameraPMDDevice::StartCamera()
{
if (m_CameraConnected)
{
// get the first image
this->m_Controller->UpdateCamera();
this->m_ImageMutex->Lock();
//this->m_Controller->GetSourceData(this->m_SourceDataArray);
this->m_Controller->GetSourceData(this->m_SourceDataBuffer[this->m_FreePos]);
this->m_FreePos = (this->m_FreePos+1) % this->m_BufferSize;
this->m_CurrentPos = (this->m_CurrentPos+1) % this->m_BufferSize;
this->m_ImageSequence++;
this->m_ImageMutex->Unlock();
this->m_CameraActiveMutex->Lock();
this->m_CameraActive = true;
this->m_CameraActiveMutex->Unlock();
this->m_ThreadID = this->m_MultiThreader->SpawnThread(this->Acquire, this);
// wait a little to make sure that the thread is started
itksys::SystemTools::Delay(10);
}
else
{
MITK_INFO<<"Camera not connected";
}
}
void ToFCameraPMDDevice::StopCamera()
{
m_CameraActiveMutex->Lock();
m_CameraActive = false;
m_CameraActiveMutex->Unlock();
itksys::SystemTools::Delay(100);
if (m_MultiThreader.IsNotNull())
{
m_MultiThreader->TerminateThread(m_ThreadID);
}
// wait a little to make sure that the thread is terminated
itksys::SystemTools::Delay(10);
}
bool ToFCameraPMDDevice::IsCameraActive()
{
m_CameraActiveMutex->Lock();
bool ok = m_CameraActive;
m_CameraActiveMutex->Unlock();
return ok;
}
void ToFCameraPMDDevice::UpdateCamera()
{
if (m_Controller)
{
m_Controller->UpdateCamera();
}
}
ITK_THREAD_RETURN_TYPE ToFCameraPMDDevice::Acquire(void* pInfoStruct)
{
/* extract this pointer from Thread Info structure */
struct itk::MultiThreader::ThreadInfoStruct * pInfo = (struct itk::MultiThreader::ThreadInfoStruct*)pInfoStruct;
if (pInfo == NULL)
{
return ITK_THREAD_RETURN_VALUE;
}
if (pInfo->UserData == NULL)
{
return ITK_THREAD_RETURN_VALUE;
}
ToFCameraPMDDevice* toFCameraDevice = (ToFCameraPMDDevice*)pInfo->UserData;
if (toFCameraDevice!=NULL)
{
mitk::RealTimeClock::Pointer realTimeClock;
realTimeClock = mitk::RealTimeClock::New();
double t1, t2;
t1 = realTimeClock->GetCurrentStamp();
int n = 100;
bool overflow = false;
bool printStatus = false;
while (toFCameraDevice->IsCameraActive())
{
// update the ToF camera
toFCameraDevice->UpdateCamera();
// get the source data from the camera and write it at the next free position in the buffer
toFCameraDevice->m_Controller->GetSourceData(toFCameraDevice->m_SourceDataBuffer[toFCameraDevice->m_FreePos]);
// call modified to indicate that cameraDevice was modified
toFCameraDevice->Modified();
/*!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!
TODO Buffer Handling currently only works for buffer size 1
!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!*/
toFCameraDevice->m_ImageMutex->Lock();
//toFCameraDevice->m_ImageSequence++;
toFCameraDevice->m_FreePos = (toFCameraDevice->m_FreePos+1) % toFCameraDevice->m_BufferSize;
toFCameraDevice->m_CurrentPos = (toFCameraDevice->m_CurrentPos+1) % toFCameraDevice->m_BufferSize;
toFCameraDevice->m_ImageSequence++;
if (toFCameraDevice->m_FreePos == toFCameraDevice->m_CurrentPos)
{
// buffer overflow
//MITK_INFO << "Buffer overflow!! ";
//toFCameraDevice->m_CurrentPos = (toFCameraDevice->m_CurrentPos+1) % toFCameraDevice->m_BufferSize;
//toFCameraDevice->m_ImageSequence++;
overflow = true;
}
if (toFCameraDevice->m_ImageSequence % n == 0)
{
printStatus = true;
}
toFCameraDevice->m_ImageMutex->Unlock();
if (overflow)
{
//itksys::SystemTools::Delay(10);
overflow = false;
}
/*!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!
END TODO Buffer Handling currently only works for buffer size 1
!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!*/
// print current framerate
if (printStatus)
{
t2 = realTimeClock->GetCurrentStamp() - t1;
//MITK_INFO << "t2: " << t2 <<" Time (s) for 1 image: " << (t2/1000) / n << " Framerate (fps): " << n / (t2/1000) << " Sequence: " << toFCameraDevice->m_ImageSequence;
MITK_INFO << " Framerate (fps): " << n / (t2/1000) << " Sequence: " << toFCameraDevice->m_ImageSequence;
t1 = realTimeClock->GetCurrentStamp();
printStatus = false;
}
} // end of while loop
}
return ITK_THREAD_RETURN_VALUE;
}
// TODO: Buffer size currently set to 1. Once Buffer handling is working correctly, method may be reactivated
// void ToFCameraPMDDevice::ResetBuffer(int bufferSize)
// {
// this->m_BufferSize = bufferSize;
// this->m_CurrentPos = -1;
// this->m_FreePos = 0;
// }
void ToFCameraPMDDevice::GetAmplitudes(float* amplitudeArray, int& imageSequence)
{
m_ImageMutex->Lock();
if (m_CameraActive)
{
// 1) copy the image buffer
// 2) Flip around y- axis (vertical axis)
this->m_Controller->GetAmplitudes(this->m_SourceDataBuffer[this->m_CurrentPos], this->m_AmplitudeArray);
for (int i=0; i<this->m_CaptureHeight; i++)
{
for (int j=0; j<this->m_CaptureWidth; j++)
{
amplitudeArray[i*this->m_CaptureWidth+j] = this->m_AmplitudeArray[(i+1)*this->m_CaptureWidth-1-j];
}
}
imageSequence = this->m_ImageSequence;
}
else
{
MITK_WARN("ToF") << "Warning: Data can only be acquired if camera is active.";
}
m_ImageMutex->Unlock();
}
void ToFCameraPMDDevice::GetIntensities(float* intensityArray, int& imageSequence)
{
m_ImageMutex->Lock();
if (m_CameraActive)
{
// 1) copy the image buffer
// 2) Flip around y- axis (vertical axis)
this->m_Controller->GetIntensities(this->m_SourceDataBuffer[this->m_CurrentPos], this->m_IntensityArray);
for (int i=0; i<this->m_CaptureHeight; i++)
{
for (int j=0; j<this->m_CaptureWidth; j++)
{
intensityArray[i*this->m_CaptureWidth+j] = this->m_IntensityArray[(i+1)*this->m_CaptureWidth-1-j];
}
}
imageSequence = this->m_ImageSequence;
}
else
{
MITK_WARN("ToF") << "Warning: Data can only be acquired if camera is active.";
}
m_ImageMutex->Unlock();
}
void ToFCameraPMDDevice::GetDistances(float* distanceArray, int& imageSequence)
{
m_ImageMutex->Lock();
if (m_CameraActive)
{
// 1) copy the image buffer
// 2) convert the distance values from m to mm
// 3) Flip around y- axis (vertical axis)
this->m_Controller->GetDistances(this->m_SourceDataBuffer[this->m_CurrentPos], this->m_DistanceArray);
for (int i=0; i<this->m_CaptureHeight; i++)
{
for (int j=0; j<this->m_CaptureWidth; j++)
{
distanceArray[i*this->m_CaptureWidth+j] = 1000 * this->m_DistanceArray[(i+1)*this->m_CaptureWidth-1-j];
}
}
imageSequence = this->m_ImageSequence;
}
else
{
MITK_WARN("ToF") << "Warning: Data can only be acquired if camera is active.";
}
m_ImageMutex->Unlock();
}
void ToFCameraPMDDevice::GetAllImages(float* distanceArray, float* amplitudeArray, float* intensityArray, char* sourceDataArray,
int requiredImageSequence, int& capturedImageSequence)
{
if (m_CameraActive)
{
m_ImageMutex->Lock();
// 1) copy the image buffer
// 2) convert the distance values from m to mm
// 3) Flip around y- axis (vertical axis)
// check for empty buffer
if (this->m_ImageSequence < 0)
{
// buffer empty
MITK_INFO << "Buffer empty!! ";
capturedImageSequence = this->m_ImageSequence;
m_ImageMutex->Unlock();
return;
}
// determine position of image in buffer
int pos = 0;
if ((requiredImageSequence < 0) || (requiredImageSequence > this->m_ImageSequence))
{
capturedImageSequence = this->m_ImageSequence;
pos = this->m_CurrentPos;
//MITK_INFO << "Required image not found! Required: " << requiredImageSequence << " delivered/current: " << this->m_ImageSequence;
}
else if (requiredImageSequence <= this->m_ImageSequence - this->m_BufferSize)
{
capturedImageSequence = (this->m_ImageSequence - this->m_BufferSize) + 1;
pos = (this->m_CurrentPos + 1) % this->m_BufferSize;
//MITK_INFO << "Out of buffer! Required: " << requiredImageSequence << " delivered: " << capturedImageSequence << " current: " << this->m_ImageSequence;
}
else // (requiredImageSequence > this->m_ImageSequence - this->m_BufferSize) && (requiredImageSequence <= this->m_ImageSequence)
{
capturedImageSequence = requiredImageSequence;
pos = (this->m_CurrentPos + (10-(this->m_ImageSequence - requiredImageSequence))) % this->m_BufferSize;
}
m_ImageMutex->Unlock();
this->m_Controller->GetDistances(this->m_SourceDataBuffer[pos], this->m_DistanceArray);
this->m_Controller->GetAmplitudes(this->m_SourceDataBuffer[pos], this->m_AmplitudeArray);
this->m_Controller->GetIntensities(this->m_SourceDataBuffer[pos], this->m_IntensityArray);
int u, v;
for (int i=0; i<this->m_CaptureHeight; i++)
{
for (int j=0; j<this->m_CaptureWidth; j++)
{
u = i*this->m_CaptureWidth+j;
v = (i+1)*this->m_CaptureWidth-1-j;
distanceArray[u] = 1000 * this->m_DistanceArray[v]; // unit in minimeter
//distanceArray[u] = this->m_DistanceArray[v]; // unit in meter
amplitudeArray[u] = this->m_AmplitudeArray[v];
intensityArray[u] = this->m_IntensityArray[v];
}
}
memcpy(sourceDataArray, this->m_SourceDataBuffer[this->m_CurrentPos], this->m_SourceDataSize);
}
else
{
MITK_WARN("ToF") << "Warning: Data can only be acquired if camera is active.";
}
}
ToFCameraPMDController::Pointer ToFCameraPMDDevice::GetController()
{
return this->m_Controller;
}
void ToFCameraPMDDevice::SetProperty( const char *propertyKey, BaseProperty* propertyValue )
{
ToFCameraDevice::SetProperty(propertyKey,propertyValue);
this->m_PropertyList->SetProperty(propertyKey, propertyValue);
if (strcmp(propertyKey, "ModulationFrequency") == 0)
{
int modulationFrequency = 0;
GetIntProperty(propertyValue, modulationFrequency);
m_Controller->SetModulationFrequency(modulationFrequency);
}
else if (strcmp(propertyKey, "IntegrationTime") == 0)
{
int integrationTime = 0;
GetIntProperty(propertyValue, integrationTime);
m_Controller->SetIntegrationTime(integrationTime);
}
}
+
+ void ToFCameraPMDDevice::AllocateSourceData()
+ {
+ // clean up if array and data have already been allocated
+ CleanUpSourceData();
+ // (re-) allocate memory
+ this->m_SourceDataArray = new char[this->m_SourceDataSize];
+ for(int i=0; i<this->m_SourceDataSize; i++) {this->m_SourceDataArray[i]=0;}
+
+ this->m_SourceDataBuffer = new char*[this->m_MaxBufferSize];
+ for(int i=0; i<this->m_MaxBufferSize; i++)
+ {
+ this->m_SourceDataBuffer[i] = new char[this->m_SourceDataSize];
+ }
+ }
+
+ void ToFCameraPMDDevice::CleanUpSourceData()
+ {
+ if (m_SourceDataArray)
+ {
+ delete[] m_SourceDataArray;
+ }
+ if (m_SourceDataBuffer)
+ {
+ for(int i=0; i<this->m_MaxBufferSize; i++)
+ {
+ delete[] this->m_SourceDataBuffer[i];
+ }
+ delete[] this->m_SourceDataBuffer;
+ }
+ }
}
diff --git a/Modules/ToFHardware/mitkToFCameraPMDDevice.h b/Modules/ToFHardware/mitkToFCameraPMDDevice.h
index e8cf253720..46f1f17d90 100644
--- a/Modules/ToFHardware/mitkToFCameraPMDDevice.h
+++ b/Modules/ToFHardware/mitkToFCameraPMDDevice.h
@@ -1,146 +1,155 @@
/*=========================================================================
Program: Medical Imaging & Interaction Toolkit
Module: $RCSfile$
Language: C++
Date: $Date: 2010-05-27 16:06:53 +0200 (Do, 27 Mai 2010) $
Version: $Revision: $
Copyright (c) German Cancer Research Center, Division of Medical and
Biological Informatics. All rights reserved.
See MITKCopyright.txt or http://www.mitk.org/copyright.html for details.
This software is distributed WITHOUT ANY WARRANTY; without even
the implied warranty of MERCHANTABILITY or FITNESS FOR A PARTICULAR
PURPOSE. See the above copyright notices for more information.
=========================================================================*/
#ifndef __mitkToFCameraPMDDevice_h
#define __mitkToFCameraPMDDevice_h
#include "mitkToFHardwareExports.h"
#include "mitkCommon.h"
#include "mitkToFCameraDevice.h"
#include "mitkToFCameraPMDController.h"
#include "itkObject.h"
#include "itkObjectFactory.h"
#include "itkMultiThreader.h"
#include "itkFastMutexLock.h"
namespace mitk
{
/**
* @brief Interface for all representations of PMD ToF devices.
* ToFCameraPMDDevice internally holds an instance of ToFCameraPMDController and starts a thread
* that continuously grabs images from the controller. A buffer structure buffers the last acquired images
* to provide the image data loss-less.
*
* @ingroup ToFHardware
*/
class MITK_TOFHARDWARE_EXPORT ToFCameraPMDDevice : public ToFCameraDevice
{
public:
mitkClassMacro( ToFCameraPMDDevice , ToFCameraDevice );
itkNewMacro( Self );
/*!
\brief opens a connection to the ToF camera
*/
virtual bool ConnectCamera();
/*!
\brief closes the connection to the camera
*/
virtual bool DisconnectCamera();
/*!
\brief starts the continuous updating of the camera.
A separate thread updates the source data, the main thread processes the source data and creates images and coordinates
*/
virtual void StartCamera();
/*!
\brief stops the continuous updating of the camera
*/
virtual void StopCamera();
/*!
\brief updates the camera for image acquisition
*/
virtual void UpdateCamera();
/*!
\brief returns whether the camera is currently active or not
*/
virtual bool IsCameraActive();
/*!
\brief gets the amplitude data from the ToF camera as the strength of the active illumination of every pixel. Caution! The user is responsible for allocating and deleting the images.
These values can be used to determine the quality of the distance values. The higher the amplitude value, the higher the accuracy of the according distance value
\param imageSequence the actually captured image sequence number
\param amplitudeArray contains the returned amplitude data as an array.
*/
virtual void GetAmplitudes(float* amplitudeArray, int& imageSequence);
/*!
\brief gets the intensity data from the ToF camera as a greyscale image. Caution! The user is responsible for allocating and deleting the images.
\param intensityArray contains the returned intensities data as an array.
\param imageSequence the actually captured image sequence number
*/
virtual void GetIntensities(float* intensityArray, int& imageSequence);
/*!
\brief gets the distance data from the ToF camera measuring the distance between the camera and the different object points in millimeters. Caution! The user is responsible for allocating and deleting the images.
\param distanceArray contains the returned distances data as an array.
\param imageSequence the actually captured image sequence number
*/
virtual void GetDistances(float* distanceArray, int& imageSequence);
/*!
\brief gets the 3 images (distance, amplitude, intensity) from the ToF camera. Caution! The user is responsible for allocating and deleting the images.
\param distanceArray contains the returned distance data as an array.
\param amplitudeArray contains the returned amplitude data as an array.
\param intensityArray contains the returned intensity data as an array.
\param sourceDataArray contains the complete source data from the camera device.
\param requiredImageSequence the required image sequence number
\param capturedImageSequence the actually captured image sequence number
*/
virtual void GetAllImages(float* distanceArray, float* amplitudeArray, float* intensityArray, char* sourceDataArray,
int requiredImageSequence, int& capturedImageSequence);
// TODO: Buffer size currently set to 1. Once Buffer handling is working correctly, method may be reactivated
// /*!
// \brief pure virtual method resetting the buffer using the specified bufferSize. Has to be implemented by sub-classes
// \param bufferSize buffer size the buffer should be reset to
// */
// virtual void ResetBuffer(int bufferSize) = 0;
//TODO add/correct documentation for requiredImageSequence and capturedImageSequence in the GetAllImages, GetDistances, GetIntensities and GetAmplitudes methods.
/*!
\brief returns the corresponding camera controller
*/
ToFCameraPMDController::Pointer GetController();
/*!
\brief set a BaseProperty
*/
virtual void SetProperty( const char *propertyKey, BaseProperty* propertyValue );
protected:
ToFCameraPMDDevice();
~ToFCameraPMDDevice();
+ /*!
+ \brief method for allocating m_SourceDataArray and m_SourceDataBuffer
+ */
+ virtual void AllocateSourceData();
+ /*!
+ \brief method for cleaning up memory allocated for m_SourceDataArray and m_SourceDataBuffer
+ */
+ virtual void CleanUpSourceData();
+
/*!
\brief Thread method continuously acquiring images from the ToF hardware
*/
static ITK_THREAD_RETURN_TYPE Acquire(void* pInfoStruct);
/*!
\brief moves the position pointer m_CurrentPos to the next position in the buffer if that's not the next free position to prevent reading from an empty buffer
*/
void GetNextPos();
ToFCameraPMDController::Pointer m_Controller; ///< corresponding CameraController
char** m_SourceDataBuffer; ///< buffer holding the last acquired images
char* m_SourceDataArray; ///< array holding the current PMD source data
private:
};
} //END mitk namespace
#endif
diff --git a/Modules/ToFHardware/mitkToFImageGrabber.cpp b/Modules/ToFHardware/mitkToFImageGrabber.cpp
index 732785011d..69b7519b1e 100644
--- a/Modules/ToFHardware/mitkToFImageGrabber.cpp
+++ b/Modules/ToFHardware/mitkToFImageGrabber.cpp
@@ -1,236 +1,252 @@
/*=========================================================================
Program: Medical Imaging & Interaction Toolkit
Module: $RCSfile$
Language: C++
Date: $Date: 2010-05-27 16:06:53 +0200 (Do, 27 Mai 2010) $
Version: $Revision: $
Copyright (c) German Cancer Research Center, Division of Medical and
Biological Informatics. All rights reserved.
See MITKCopyright.txt or http://www.mitk.org/copyright.html for details.
This software is distributed WITHOUT ANY WARRANTY; without even
the implied warranty of MERCHANTABILITY or FITNESS FOR A PARTICULAR
PURPOSE. See the above copyright notices for more information.
=========================================================================*/
#include "mitkToFImageGrabber.h"
#include "mitkToFCameraPMDCamCubeDevice.h"
#include "itkCommand.h"
namespace mitk
{
ToFImageGrabber::ToFImageGrabber():m_CaptureWidth(204),m_CaptureHeight(204),m_PixelNumber(41616),m_ImageSequence(0),
- m_IntensityArray(NULL), m_DistanceArray(NULL), m_AmplitudeArray(NULL)
+ m_IntensityArray(NULL), m_DistanceArray(NULL), m_AmplitudeArray(NULL), m_SourceDataArray(NULL)
{
// Create the output. We use static_cast<> here because we know the default
// output must be of type TOutputImage
OutputImageType::Pointer output0 = static_cast<OutputImageType*>(this->MakeOutput(0).GetPointer());
OutputImageType::Pointer output1 = static_cast<OutputImageType*>(this->MakeOutput(1).GetPointer());
OutputImageType::Pointer output2 = static_cast<OutputImageType*>(this->MakeOutput(2).GetPointer());
mitk::ImageSource::SetNumberOfRequiredOutputs(3);
mitk::ImageSource::SetNthOutput(0, output0.GetPointer());
mitk::ImageSource::SetNthOutput(1, output1.GetPointer());
mitk::ImageSource::SetNthOutput(2, output2.GetPointer());
}
ToFImageGrabber::~ToFImageGrabber()
{
if (m_IntensityArray||m_AmplitudeArray||m_DistanceArray)
{
if (m_ToFCameraDevice)
{
m_ToFCameraDevice->RemoveObserver(m_DeviceObserverTag);
}
this->DisconnectCamera();
+ this->CleanUpImageArrays();
}
}
mitk::ImageSource::DataObjectPointer mitk::ImageSource::MakeOutput(unsigned int)
{
return static_cast<itk::DataObject*>(OutputImageType::New().GetPointer());
}
void ToFImageGrabber::GenerateData()
{
int requiredImageSequence = 0;
int capturedImageSequence = 0;
mitk::Image::Pointer distanceImage = this->GetOutput(0);
mitk::Image::Pointer amplitudeImage = this->GetOutput(1);
mitk::Image::Pointer intensityImage = this->GetOutput(2);
if (!distanceImage->IsInitialized())
{
distanceImage->ReleaseData();
amplitudeImage->ReleaseData();
intensityImage->ReleaseData();
unsigned int dimensions[2];
dimensions[0] = this->m_ToFCameraDevice->GetCaptureWidth();
dimensions[1] = this->m_ToFCameraDevice->GetCaptureHeight();
distanceImage->Initialize(mitk::PixelType(typeid(float)), 2, dimensions, 1);
amplitudeImage->Initialize(mitk::PixelType(typeid(float)), 2, dimensions, 1);
intensityImage->Initialize(mitk::PixelType(typeid(float)), 2, dimensions, 1);
}
- this->m_ToFCameraDevice->GetAllImages(this->m_DistanceArray, this->m_AmplitudeArray, this->m_IntensityArray, this->m_SourceDataArray,
- requiredImageSequence, this->m_ImageSequence );
- capturedImageSequence = this->m_ImageSequence;
-
- if (m_DistanceArray)
+ if (m_DistanceArray&&m_AmplitudeArray&&m_IntensityArray)
{
+ this->m_ToFCameraDevice->GetAllImages(this->m_DistanceArray, this->m_AmplitudeArray, this->m_IntensityArray, this->m_SourceDataArray,
+ requiredImageSequence, this->m_ImageSequence );
+
+ capturedImageSequence = this->m_ImageSequence;
distanceImage->SetSlice(this->m_DistanceArray, 0, 0, 0);
- }
- if (m_AmplitudeArray)
- {
amplitudeImage->SetSlice(this->m_AmplitudeArray, 0, 0, 0);
- }
- if (m_IntensityArray)
- {
intensityImage->SetSlice(this->m_IntensityArray, 0, 0, 0);
}
}
bool ToFImageGrabber::ConnectCamera()
{
bool ok = m_ToFCameraDevice->ConnectCamera();
if (ok)
{
m_CaptureWidth = m_ToFCameraDevice->GetCaptureWidth();
m_CaptureHeight = m_ToFCameraDevice->GetCaptureHeight();
m_PixelNumber = m_CaptureWidth * m_CaptureHeight;
m_SourceDataSize = m_ToFCameraDevice->GetSourceDataSize();
-
- // allocate buffer
- m_IntensityArray = new float[m_PixelNumber];
- m_DistanceArray = new float[m_PixelNumber];
- m_AmplitudeArray = new float[m_PixelNumber];
- m_SourceDataArray = new char[m_SourceDataSize];
+ AllocateImageArrays();
}
return ok;
}
bool ToFImageGrabber::DisconnectCamera()
{
bool success = m_ToFCameraDevice->DisconnectCamera();
- // free buffer
- if (m_IntensityArray||m_DistanceArray||m_AmplitudeArray)
- {
- delete [] m_IntensityArray;
- delete [] m_DistanceArray;
- delete [] m_AmplitudeArray;
- m_IntensityArray = NULL;
- m_DistanceArray = NULL;
- m_AmplitudeArray = NULL;
- }
return success;
}
void ToFImageGrabber::StartCamera()
{
m_ToFCameraDevice->StartCamera();
}
void ToFImageGrabber::StopCamera()
{
m_ToFCameraDevice->StopCamera();
}
bool ToFImageGrabber::IsCameraActive()
{
return m_ToFCameraDevice->IsCameraActive();
}
void ToFImageGrabber::SetCameraDevice(ToFCameraDevice* aToFCameraDevice)
{
m_ToFCameraDevice = aToFCameraDevice;
itk::SimpleMemberCommand<ToFImageGrabber>::Pointer modifiedCommand = itk::SimpleMemberCommand<ToFImageGrabber>::New();
modifiedCommand->SetCallbackFunction(this, &ToFImageGrabber::OnToFCameraDeviceModified);
m_DeviceObserverTag = m_ToFCameraDevice->AddObserver(itk::ModifiedEvent(), modifiedCommand);
this->Modified();
}
ToFCameraDevice* ToFImageGrabber::GetCameraDevice()
{
return m_ToFCameraDevice;
}
int ToFImageGrabber::GetCaptureWidth()
{
return m_CaptureWidth;
}
int ToFImageGrabber::GetCaptureHeight()
{
return m_CaptureHeight;
}
int ToFImageGrabber::GetPixelNumber()
{
return m_PixelNumber;
}
int ToFImageGrabber::SetModulationFrequency(int modulationFrequency)
{
this->m_ToFCameraDevice->SetProperty("ModulationFrequency",mitk::IntProperty::New(modulationFrequency));
this->Modified();
return modulationFrequency;
}
int ToFImageGrabber::SetIntegrationTime(int integrationTime)
{
this->m_ToFCameraDevice->SetProperty("IntegrationTime",mitk::IntProperty::New(integrationTime));
this->Modified();
return integrationTime;
}
int ToFImageGrabber::GetIntegrationTime()
{
int integrationTime = 0;
BaseProperty* property = this->m_ToFCameraDevice->GetProperty("IntegrationTime");
this->m_ToFCameraDevice->GetIntProperty(property,integrationTime);
return integrationTime;
}
int ToFImageGrabber::GetModulationFrequency()
{
int modulationFrequency = 0;
BaseProperty* property = this->m_ToFCameraDevice->GetProperty("ModulationFrequency");
this->m_ToFCameraDevice->GetIntProperty(property,modulationFrequency);
return modulationFrequency;
}
void ToFImageGrabber::SetBoolProperty( const char* propertyKey, bool boolValue )
{
SetProperty(propertyKey, mitk::BoolProperty::New(boolValue));
}
void ToFImageGrabber::SetIntProperty( const char* propertyKey, int intValue )
{
SetProperty(propertyKey, mitk::IntProperty::New(intValue));
}
void ToFImageGrabber::SetFloatProperty( const char* propertyKey, float floatValue )
{
SetProperty(propertyKey, mitk::FloatProperty::New(floatValue));
}
void ToFImageGrabber::SetStringProperty( const char* propertyKey, const char* stringValue )
{
SetProperty(propertyKey, mitk::StringProperty::New(stringValue));
}
void ToFImageGrabber::SetProperty( const char *propertyKey, BaseProperty* propertyValue )
{
this->m_ToFCameraDevice->SetProperty(propertyKey, propertyValue);
}
void ToFImageGrabber::OnToFCameraDeviceModified()
{
this->Modified();
}
+
+ void ToFImageGrabber::CleanUpImageArrays()
+ {
+ // free buffer
+ if (m_IntensityArray)
+ {
+ delete [] m_IntensityArray;
+ m_IntensityArray = NULL;
+ }
+ if (m_DistanceArray)
+ {
+ delete [] m_DistanceArray;
+ m_DistanceArray = NULL;
+ }
+ if (m_AmplitudeArray)
+ {
+ delete [] m_AmplitudeArray;
+ m_AmplitudeArray = NULL;
+ }
+ if (m_SourceDataArray)
+ {
+ delete [] m_SourceDataArray;
+ m_SourceDataArray = NULL;
+ }
+ }
+
+ void ToFImageGrabber::AllocateImageArrays()
+ {
+ // cleanup memory if necessary
+ this->CleanUpImageArrays();
+ // allocate buffer
+ m_IntensityArray = new float[m_PixelNumber];
+ m_DistanceArray = new float[m_PixelNumber];
+ m_AmplitudeArray = new float[m_PixelNumber];
+ m_SourceDataArray = new char[m_SourceDataSize];
+ }
}
diff --git a/Modules/ToFHardware/mitkToFImageGrabber.h b/Modules/ToFHardware/mitkToFImageGrabber.h
index 0cbb604351..fa02437c58 100644
--- a/Modules/ToFHardware/mitkToFImageGrabber.h
+++ b/Modules/ToFHardware/mitkToFImageGrabber.h
@@ -1,164 +1,173 @@
/*=========================================================================
Program: Medical Imaging & Interaction Toolkit
Module: $RCSfile$
Language: C++
Date: $Date: 2010-05-27 16:06:53 +0200 (Do, 27 Mai 2010) $
Version: $Revision: $
Copyright (c) German Cancer Research Center, Division of Medical and
Biological Informatics. All rights reserved.
See MITKCopyright.txt or http://www.mitk.org/copyright.html for details.
This software is distributed WITHOUT ANY WARRANTY; without even
the implied warranty of MERCHANTABILITY or FITNESS FOR A PARTICULAR
PURPOSE. See the above copyright notices for more information.
=========================================================================*/
#ifndef __mitkToFImageGrabber_h
#define __mitkToFImageGrabber_h
#include "mitkToFHardwareExports.h"
#include "mitkCommon.h"
#include "mitkImageSource.h"
#include "mitkToFCameraDevice.h"
#include "itkObject.h"
#include "itkObjectFactory.h"
namespace mitk
{
/**Documentation
* \brief Image source providing ToF images. Interface for filters provided in ToFProcessing module
*
* This class internally holds a ToFCameraDevice to access the images acquired by a ToF camera.
* A pre-configured instance for a specific ToF camera (e.g. PMD CamCube 3) can be obtained using
* the class ToFImageGrabberCreator.
* Provided images include: distance image (output 0), amplitude image (output 1), intensity image (output 2)
*
* \ingroup ToFHardware
*/
class MITK_TOFHARDWARE_EXPORT ToFImageGrabber : public mitk::ImageSource
{
public:
mitkClassMacro( ToFImageGrabber , ImageSource );
itkNewMacro( Self );
/*!
\brief Establish a connection to the ToF camera
\param device specifies the actually used ToF Camera. 0: PMD O3D, 1: PMD CamCube 2.0
*/
virtual bool ConnectCamera();
/*!
\brief Disconnects the ToF camera
*/
virtual bool DisconnectCamera();
/*!
\brief Starts the continuous updating of the camera.
A separate thread updates the source data, the main thread processes the source data and creates images and coordinates
*/
virtual void StartCamera();
/*!
\brief Stops the continuous updating of the camera
*/
virtual void StopCamera();
/*!
\brief Returns true if the camera is connected and started
*/
virtual bool IsCameraActive();
/*!
\brief Sets the ToF device, the image grabber is grabbing the images from
\param aToFCameraDevice device internally used for grabbing the images from the camera
*/
void SetCameraDevice(ToFCameraDevice* aToFCameraDevice);
/*!
\brief Get the currently set ToF camera device
\return device currently used for grabbing images from the camera
*/
ToFCameraDevice* GetCameraDevice();
/*!
\brief Set the modulation frequency used by the ToF camera.
For default values see the corresponding device classes
\param modulationFrequency modulation frequency in Hz
*/
int SetModulationFrequency(int modulationFrequency);
/*!
\brief Get the modulation frequency used by the ToF camera.
\return modulation frequency in MHz
*/
int GetModulationFrequency();
/*!
\brief Set the integration time used by the ToF camera.
For default values see the corresponding device classes
\param integrationTime integration time in ms
*/
int SetIntegrationTime(int integrationTime);
/*!
\brief Get the integration time in used by the ToF camera.
\return integration time in ms
*/
int GetIntegrationTime();
/*!
\brief Get the dimension in x direction of the ToF image
\return width of the image
*/
int GetCaptureWidth();
/*!
\brief Get the dimension in y direction of the ToF image
\return height of the image
*/
int GetCaptureHeight();
/*!
\brief Get the number of pixel in the ToF image
\return number of pixel
*/
int GetPixelNumber();
// properties
void SetBoolProperty( const char* propertyKey, bool boolValue );
void SetIntProperty( const char* propertyKey, int intValue );
void SetFloatProperty( const char* propertyKey, float floatValue );
void SetStringProperty( const char* propertyKey, const char* stringValue );
void SetProperty( const char *propertyKey, BaseProperty* propertyValue );
protected:
///
/// called when the ToFCameraDevice was modified
///
void OnToFCameraDeviceModified();
+ /*!
+ \brief clean up memory allocated for the image arrays m_IntensityArray, m_DistanceArray, m_AmplitudeArray and m_SourceDataArray
+ */
+ virtual void CleanUpImageArrays();
+ /*!
+ \brief Allocate memory for the image arrays m_IntensityArray, m_DistanceArray, m_AmplitudeArray and m_SourceDataArray
+ */
+ virtual void AllocateImageArrays();
+
ToFCameraDevice::Pointer m_ToFCameraDevice; ///< Device allowing acces to ToF image data
int m_CaptureWidth; ///< Width of the captured ToF image
int m_CaptureHeight; ///< Height of the captured ToF image
int m_PixelNumber; ///< Number of pixels in the image
int m_ImageSequence; ///< counter for currently acquired images
int m_SourceDataSize; ///< size of the source data in bytes
float* m_IntensityArray; ///< member holding the current intensity array
float* m_DistanceArray; ///< member holding the current distance array
float* m_AmplitudeArray; ///< member holding the current amplitude array
char* m_SourceDataArray;///< member holding the current source data array
unsigned long m_DeviceObserverTag; ///< tag of the oberver for the the ToFCameraDevice
ToFImageGrabber();
~ToFImageGrabber();
/*!
\brief Method generating the outputs of this filter. Called in the updated process of the pipeline.
0: distance image
1: amplitude image
2: intensity image
*/
void GenerateData();
private:
};
} //END mitk namespace
#endif
diff --git a/Modules/ToFProcessing/Testing/mitkToFDistanceImageToPointSetFilterTest.cpp b/Modules/ToFProcessing/Testing/mitkToFDistanceImageToPointSetFilterTest.cpp
index ec880a2ed3..1bf58df03a 100644
--- a/Modules/ToFProcessing/Testing/mitkToFDistanceImageToPointSetFilterTest.cpp
+++ b/Modules/ToFProcessing/Testing/mitkToFDistanceImageToPointSetFilterTest.cpp
@@ -1,231 +1,259 @@
/*=========================================================================
Program: Medical Imaging & Interaction Toolkit
Language: C++
Date: $Date: $
Version: $Revision: $
Copyright (c) German Cancer Research Center, Division of Medical and
Biological Informatics. All rights reserved.
See MITKCopyright.txt or http://www.mitk.org/copyright.html for details.
This software is distributed WITHOUT ANY WARRANTY; without even
the implied warranty of MERCHANTABILITY or FITNESS FOR A PARTICULAR
PURPOSE. See the above copyright notices for more information.
=========================================================================*/
#include <mitkTestingMacros.h>
#include <mitkToFDistanceImageToPointSetFilter.h>
+#include <mitkToFDistanceImageToSurfaceFilter.h>
#include <mitkImage.h>
#include <mitkPointSet.h>
+#include <mitkSurface.h>
#include <mitkToFProcessingCommon.h>
#include <mitkVector.h>
#include <itkImage.h>
#include <itkImageRegionIterator.h>
+#include <vtkPolyData.h>
+
/**Documentation
* test for the class "ToFDistanceImageToPointSetFilter".
*/
mitk::PointSet::Pointer CreateTestPointSet()
{
mitk::PointSet::Pointer subSet = mitk::PointSet::New();
mitk::Point3D point;
point[0] = 10;
point[1] = 20;
point[2] = 0;
subSet->InsertPoint(0,point);
point[0] = 100;
point[1] = 150;
point[2] = 0;
subSet->InsertPoint(1,point);
point[0] = 110;
point[1] = 30;
point[2] = 0;
subSet->InsertPoint(2,point);
point[0] = 40;
point[1] = 200;
point[2] = 0;
subSet->InsertPoint(3,point);
return subSet;
}
inline static mitk::Image::Pointer CreateTestImageWithPointSet(mitk::ScalarType pixelValue, unsigned int dimX, unsigned int dimY, mitk::PointSet::Pointer subSet)
{
typedef itk::Image<mitk::ScalarType,2> ItkImageType2D;
typedef itk::ImageRegionIterator<ItkImageType2D> ItkImageRegionIteratorType2D;
ItkImageType2D::Pointer image = ItkImageType2D::New();
ItkImageType2D::IndexType start;
start[0] = 0;
start[1] = 0;
ItkImageType2D::SizeType size;
size[0] = dimX;
size[1] = dimY;
ItkImageType2D::RegionType region;
region.SetSize(size);
region.SetIndex( start);
ItkImageType2D::SpacingType spacing;
spacing[0] = 1.0;
spacing[1] = 1.0;
image->SetRegions( region );
image->SetSpacing ( spacing );
image->Allocate();
//Obtaining image data from ToF camera//
//Correlate inten values to PixelIndex//
ItkImageRegionIteratorType2D imageIterator(image,image->GetLargestPossibleRegion());
imageIterator.GoToBegin();
while (!imageIterator.IsAtEnd())
{
imageIterator.Set(pixelValue);
++imageIterator;
}
// distances varying from pixelValue
std::vector<mitk::ScalarType> distances;
distances.push_back(50);
distances.push_back(500);
distances.push_back(2050);
distances.push_back(300);
// set the pixel values for the subset
for (unsigned int i=0; i<subSet->GetSize(); i++)
{
mitk::Point3D point = subSet->GetPoint(i);
ItkImageType2D::IndexType index;
index[0] = point[0];
index[1] = point[1];
mitk::ScalarType distance = distances.at(i);
image->SetPixel(index,distance);
}
mitk::Image::Pointer mitkImage = mitk::Image::New();
mitk::CastToMitkImage(image,mitkImage);
return mitkImage;
}
+bool PointSetsEqual(mitk::PointSet::Pointer pointSet1, mitk::PointSet::Pointer pointSet2)
+{
+ bool pointSetsEqual = true;
+ if (pointSet1->GetSize()==pointSet2->GetSize())
+ {
+ for (unsigned int i=0; i<pointSet1->GetSize(); i++)
+ {
+ mitk::Point3D expectedPoint = pointSet1->GetPoint(i);
+ mitk::Point3D resultPoint = pointSet2->GetPoint(i);
+ if (!mitk::Equal(expectedPoint,resultPoint))
+ {
+ pointSetsEqual = false;
+ }
+ }
+ }
+ else
+ {
+ pointSetsEqual = false;
+ }
+ return pointSetsEqual;
+}
+
int mitkToFDistanceImageToPointSetFilterTest(int /* argc */, char* /*argv*/[])
{
MITK_TEST_BEGIN("ToFDistanceImageToPointSetFilter");
mitk::ToFDistanceImageToPointSetFilter::Pointer filter = mitk::ToFDistanceImageToPointSetFilter::New();
//create test sub set
MITK_INFO<<"Create test pointset";
mitk::PointSet::Pointer subSet = CreateTestPointSet();
//create test image
unsigned int dimX = 204;
unsigned int dimY = 204;
MITK_INFO<<"Create test image";
mitk::Image::Pointer image = CreateTestImageWithPointSet(1000.0f,dimX,dimY,subSet);
//initialize intrinsic parameters
//initialize intrinsic parameters with some arbitrary values
mitk::ToFProcessingCommon::ToFPoint2D interPixelDistance;
interPixelDistance[0] = 0.04564;
interPixelDistance[1] = 0.0451564;
mitk::ToFProcessingCommon::ToFScalarType focalLengthX = 295.78960;
mitk::ToFProcessingCommon::ToFScalarType focalLengthY = 296.348535;
mitk::ToFProcessingCommon::ToFScalarType focalLength = (focalLengthX*interPixelDistance[0]+focalLengthY*interPixelDistance[1])/2.0;
mitk::ToFProcessingCommon::ToFScalarType k1=-0.36,k2=-0.14,p1=0.001,p2=-0.00;
mitk::ToFProcessingCommon::ToFPoint2D principalPoint;
principalPoint[0] = 103.576546;
principalPoint[1] = 100.1532;
mitk::CameraIntrinsics::Pointer cameraIntrinsics = mitk::CameraIntrinsics::New();
cameraIntrinsics->SetFocalLength(focalLengthX,focalLengthY);
cameraIntrinsics->SetPrincipalPoint(principalPoint[0],principalPoint[1]);
cameraIntrinsics->SetDistorsionCoeffs(k1,k2,p1,p2);
// test SetCameraIntrinsics()
filter->SetCameraIntrinsics(cameraIntrinsics);
MITK_TEST_CONDITION_REQUIRED((focalLengthX==filter->GetCameraIntrinsics()->GetFocalLengthX()),"Testing SetCameraIntrinsics with focalLength");
mitk::ToFProcessingCommon::ToFPoint2D pp;
pp[0] = filter->GetCameraIntrinsics()->GetPrincipalPointX();
pp[1] = filter->GetCameraIntrinsics()->GetPrincipalPointY();
MITK_TEST_CONDITION_REQUIRED(mitk::Equal(principalPoint,pp),"Testing SetCameraIntrinsics with principalPoint()");
// test SetInterPixelDistance()
filter->SetInterPixelDistance(interPixelDistance);
mitk::ToFProcessingCommon::ToFPoint2D ipD = filter->GetInterPixelDistance();
MITK_TEST_CONDITION_REQUIRED(mitk::Equal(ipD,interPixelDistance),"Testing Set/GetInterPixelDistance()");
// test Set/GetInput()
filter->SetInput(image);
MITK_TEST_CONDITION_REQUIRED((image==filter->GetInput()),"Testing Set/GetInput()");
// test filter without subset
MITK_INFO<<"Test filter without subset";
mitk::PointSet::Pointer expectedResult = mitk::PointSet::New();
unsigned int counter = 0;
- for (unsigned int i=0; i<dimX; i++)
+ for (unsigned int j=0; j<dimY; j++)
{
- for (unsigned int j=0; j<dimY; j++)
+ for (unsigned int i=0; i<dimX; i++)
{
mitk::Index3D index;
index[0] = i;
index[1] = j;
index[2] = 0;
mitk::ScalarType distance = image->GetPixelValueByIndex(index);
mitk::Point3D coordinate = mitk::ToFProcessingCommon::IndexToCartesianCoordinates(i,j,distance,focalLength,interPixelDistance,principalPoint);
expectedResult->InsertPoint(counter,coordinate);
counter++;
}
}
filter->Update();
mitk::PointSet::Pointer result = filter->GetOutput();
MITK_TEST_CONDITION_REQUIRED((expectedResult->GetSize()==result->GetSize()),"Test if point set size is equal");
- bool pointSetsEqual = true;
- for (unsigned int i=0; i<expectedResult->GetSize(); i++)
+ MITK_TEST_CONDITION_REQUIRED(PointSetsEqual(expectedResult,result),"Testing filter without subset");
+
+ // compare filter result with ToFDistanceImageToSurfaceFilter
+ mitk::ToFDistanceImageToSurfaceFilter::Pointer surfaceFilter = mitk::ToFDistanceImageToSurfaceFilter::New();
+ surfaceFilter->SetInput(image);
+ surfaceFilter->SetInterPixelDistance(interPixelDistance);
+ surfaceFilter->SetCameraIntrinsics(cameraIntrinsics);
+ mitk::Surface::Pointer surface = surfaceFilter->GetOutput();
+ surface->Update();
+ // create point set from surface
+ vtkPolyData* polyData = surface->GetVtkPolyData();
+ int numberOfPoints = polyData->GetNumberOfPoints();
+ mitk::PointSet::Pointer pointSet = mitk::PointSet::New();
+ for (int i=0; i<numberOfPoints; i++)
{
- mitk::Point3D expectedPoint = expectedResult->GetPoint(i);
- mitk::Point3D resultPoint = result->GetPoint(i);
- if (!mitk::Equal(expectedPoint,resultPoint))
- {
- //MITK_INFO << "erwartet " << expectedPoint;
- //MITK_INFO << "result " << resultPoint;
- pointSetsEqual = false;
- }
+ double* currentPoint = polyData->GetPoint(i);
+ mitk::Point3D point;
+ point[0] = currentPoint[0];
+ point[1] = currentPoint[1];
+ point[2] = currentPoint[2];
+ pointSet->InsertPoint(i,point);
}
- MITK_TEST_CONDITION_REQUIRED(pointSetsEqual,"Testing filter without subset");
-
+ MITK_TEST_CONDITION_REQUIRED((pointSet->GetSize()==result->GetSize()),"Test if point set size is equal");
+ MITK_TEST_CONDITION_REQUIRED(PointSetsEqual(pointSet,result),"Compare with surface points");
+
// test filter with subset
MITK_INFO<<"Test filter with subset";
filter = mitk::ToFDistanceImageToPointSetFilter::New();
filter->SetInput(image);
filter->SetInterPixelDistance(interPixelDistance);
filter->SetCameraIntrinsics(cameraIntrinsics);
expectedResult = mitk::PointSet::New();
counter = 0;
for (unsigned int i=0; i<subSet->GetSize(); i++)
{
mitk::Point3D point = subSet->GetPoint(i);
mitk::Index3D index;
index[0] = point[0];
index[1] = point[1];
index[2] = 0;
mitk::ScalarType distance = image->GetPixelValueByIndex(index);
mitk::Point3D coordinate = mitk::ToFProcessingCommon::IndexToCartesianCoordinates(point[0],point[1],
distance,focalLength,interPixelDistance,principalPoint);
expectedResult->InsertPoint(counter,coordinate);
counter++;
}
filter->SetSubset(subSet);
filter->Modified();
filter->Update();
result = filter->GetOutput();
MITK_TEST_CONDITION_REQUIRED((expectedResult->GetSize()==result->GetSize()),"Test if point set size is equal");
- pointSetsEqual = true;
- for (unsigned int i=0; i<expectedResult->GetSize(); i++)
- {
- mitk::Point3D expectedPoint = expectedResult->GetPoint(i);
- mitk::Point3D resultPoint = result->GetPoint(i);
- if (!mitk::Equal(expectedPoint,resultPoint))
- {
- pointSetsEqual = false;
- }
- }
- MITK_TEST_CONDITION_REQUIRED(pointSetsEqual,"Testing filter without subset");
+ MITK_TEST_CONDITION_REQUIRED(PointSetsEqual(expectedResult,result),"Testing filter with subset");
+
MITK_TEST_END();
}
diff --git a/Modules/ToFProcessing/mitkToFDistanceImageToPointSetFilter.cpp b/Modules/ToFProcessing/mitkToFDistanceImageToPointSetFilter.cpp
index 89e00f14ee..bcaa2c7db8 100644
--- a/Modules/ToFProcessing/mitkToFDistanceImageToPointSetFilter.cpp
+++ b/Modules/ToFProcessing/mitkToFDistanceImageToPointSetFilter.cpp
@@ -1,176 +1,180 @@
/*=========================================================================
Program: Medical Imaging & Interaction Toolkit
Module: $RCSfile$
Language: C++
Date: $Date$
Version: $Revision$
Copyright (c) German Cancer Research Center, Division of Medical and
Biological Informatics. All rights reserved.
See MITKCopyright.txt or http://www.mitk.org/copyright.html for details.
This software is distributed WITHOUT ANY WARRANTY; without even
the implied warranty of MERCHANTABILITY or FITNESS FOR A PARTICULAR
PURPOSE. See the above copyright notices for more information.
=========================================================================*/
#include "mitkToFDistanceImageToPointSetFilter.h"
+#include "mitkImageDataItem.h"
#include "mitkPointSet.h"
#include "mitkToFProcessingCommon.h"
mitk::ToFDistanceImageToPointSetFilter::ToFDistanceImageToPointSetFilter()
: m_CameraIntrinsics(), m_Subset(NULL), m_InterPixelDistance()
{
m_InterPixelDistance.Fill(0.045);
m_CameraIntrinsics = mitk::CameraIntrinsics::New();
m_CameraIntrinsics->SetFocalLength(295.78960196187319,296.1255427948447);
m_CameraIntrinsics->SetPrincipalPoint(113.29063841714108,97.243216122015184);
m_CameraIntrinsics->SetDistorsionCoeffs(-0.36874385358645773f,-0.14339503290129013,0.0033210108720361795,-0.004277703352074105);
}
mitk::ToFDistanceImageToPointSetFilter::~ToFDistanceImageToPointSetFilter()
{
}
void mitk::ToFDistanceImageToPointSetFilter::SetInput(const mitk::Image* distanceImage )
{
this->SetInput(0,distanceImage);
}
void mitk::ToFDistanceImageToPointSetFilter::SetInput( unsigned int idx,const mitk::Image* distanceImage )
{
if ((distanceImage == NULL) && (idx == this->GetNumberOfInputs() - 1)) // if the last input is set to NULL, reduce the number of inputs by one
{
this->SetNumberOfInputs(this->GetNumberOfInputs() - 1);
}
else
{
this->ProcessObject::SetNthInput(idx, const_cast<mitk::Image*>(distanceImage)); // Process object is not const-correct so the const_cast is required here
this->CreateOutputsForAllInputs();
}
}
mitk::Image* mitk::ToFDistanceImageToPointSetFilter::GetInput()
{
return this->GetInput(0);
}
mitk::Image* mitk::ToFDistanceImageToPointSetFilter::GetInput( unsigned int idx )
{
if (this->GetNumberOfInputs() < 1)
return NULL;
return static_cast< mitk::Image*>(this->ProcessObject::GetInput(idx));
}
void mitk::ToFDistanceImageToPointSetFilter::SetSubset(std::vector<mitk::Index3D> subset)
{
// check if points of PointSet are inside the input image
mitk::Image::Pointer input = this->GetInput();
unsigned int xDim = input->GetDimension(0);
unsigned int yDim = input->GetDimension(1);
bool pointSetValid = true;
for (unsigned int i=0; i<subset.size(); i++)
{
mitk::Index3D currentIndex = subset.at(i);
if (currentIndex[0]<0||currentIndex[0]>xDim||currentIndex[1]<0||currentIndex[1]>yDim)
{
pointSetValid = false;
}
}
if (pointSetValid)
{
m_Subset = subset;
}
else
{
MITK_ERROR<<"One or more indizes are located outside the image domain";
}
}
void mitk::ToFDistanceImageToPointSetFilter::SetSubset( mitk::PointSet::Pointer pointSet)
{
std::vector<mitk::Index3D> subset;
for (unsigned int i=0; i<pointSet->GetSize(); i++)
{
mitk::Point3D currentPoint = pointSet->GetPoint(i);
mitk::Index3D currentIndex;
currentIndex[0] = currentPoint[0];
currentIndex[1] = currentPoint[1];
currentIndex[2] = currentPoint[2];
subset.push_back(currentIndex);
}
this->SetSubset(subset);
}
void mitk::ToFDistanceImageToPointSetFilter::GenerateData()
{
mitk::ToFProcessingCommon::ToFScalarType focalLength = (m_CameraIntrinsics->GetFocalLengthX()*m_InterPixelDistance[0]+m_CameraIntrinsics->GetFocalLengthY()*m_InterPixelDistance[1])/2.0;
mitk::ToFProcessingCommon::ToFPoint2D principalPoint;
principalPoint[0] = m_CameraIntrinsics->GetPrincipalPointX();
principalPoint[1] = m_CameraIntrinsics->GetPrincipalPointY();
mitk::PointSet::Pointer output = this->GetOutput();
assert(output);
mitk::Image::Pointer input = this->GetInput();
assert(input);
+
//compute subset of points if input PointSet is defined
if (m_Subset.size()!=0)
{
for (unsigned int i=0; i<m_Subset.size(); i++)
{
mitk::Index3D currentIndex = m_Subset.at(i);;
mitk::ToFProcessingCommon::ToFScalarType distance = (double)input->GetPixelValueByIndex(currentIndex);
mitk::Point3D currentPoint =
mitk::ToFProcessingCommon::IndexToCartesianCoordinates(currentIndex,distance,focalLength,m_InterPixelDistance,principalPoint);
output->InsertPoint(i,currentPoint);
}
}
else //compute PointSet holding cartesian coordinates for every image point
{
unsigned int xDimension = input->GetDimension(0);
unsigned int yDimension = input->GetDimension(1);
int pointCount = 0;
- for (int i=0; i<xDimension; i++)
+ for (int j=0; j<yDimension; j++)
{
- for (int j=0; j<yDimension; j++)
+ for (int i=0; i<xDimension; i++)
{
mitk::Index3D pixel;
pixel[0] = i;
pixel[1] = j;
pixel[2] = 0;
+
mitk::ToFProcessingCommon::ToFScalarType distance = (double)input->GetPixelValueByIndex(pixel);
+
mitk::Point3D currentPoint =
mitk::ToFProcessingCommon::IndexToCartesianCoordinates(i,j,distance,focalLength,m_InterPixelDistance,principalPoint);
- if (distance!=0)
+ if (distance>mitk::eps)
{
output->InsertPoint( pointCount, currentPoint );
pointCount++;
}
}
}
}
}
void mitk::ToFDistanceImageToPointSetFilter::CreateOutputsForAllInputs()
{
this->SetNumberOfOutputs(this->GetNumberOfInputs()); // create outputs for all inputs
for (unsigned int idx = 0; idx < this->GetNumberOfOutputs(); ++idx)
if (this->GetOutput(idx) == NULL)
{
DataObjectPointer newOutput = this->MakeOutput(idx);
this->SetNthOutput(idx, newOutput);
}
this->Modified();
}
void mitk::ToFDistanceImageToPointSetFilter::GenerateOutputInformation()
{
this->GetOutput();
itkDebugMacro(<<"GenerateOutputInformation()");
}
diff --git a/Modules/ToFProcessing/mitkToFProcessingCommon.cpp b/Modules/ToFProcessing/mitkToFProcessingCommon.cpp
index 0b3ce7fa16..aadda2efb2 100644
--- a/Modules/ToFProcessing/mitkToFProcessingCommon.cpp
+++ b/Modules/ToFProcessing/mitkToFProcessingCommon.cpp
@@ -1,59 +1,66 @@
/*=========================================================================
Program: Medical Imaging & Interaction Toolkit
Module: $RCSfile$
Language: C++
Date: $Date$
Version: $Revision$
Copyright (c) German Cancer Research Center, Division of Medical and
Biological Informatics. All rights reserved.
See MITKCopyright.txt or http://www.mitk.org/copyright.html for details.
This software is distributed WITHOUT ANY WARRANTY; without even
the implied warranty of MERCHANTABILITY or FITNESS FOR A PARTICULAR
PURPOSE. See the above copyright notices for more information.
=========================================================================*/
#include "mitkToFProcessingCommon.h"
namespace mitk
{
-
-ToFProcessingCommon::ToFPoint3D ToFProcessingCommon::IndexToCartesianCoordinates(unsigned int i, unsigned int j, ToFScalarType distance, ToFScalarType focalLength,
- ToFPoint2D interPixelDistance, ToFPoint2D principalPoint)
-{
- ToFPoint3D cartesianCoordinates;
-
- // calculate image coordinates in mm;
- ToFScalarType imageX = (( i - principalPoint[0] ) * interPixelDistance[0]);
- ToFScalarType imageY = (( j - principalPoint[1] ) * interPixelDistance[1]);
-
- //distance from pinhole to pixel
- ToFScalarType d = sqrt(imageX*imageX + imageY*imageY + focalLength*focalLength);
-
- cartesianCoordinates[0] = (distance-d)*imageX / d; //Strahlensatz: x / imageX = (distance-d) / d
- cartesianCoordinates[1] = (distance-d)*imageY / d; //Strahlensatz: y / imageY = (distance-d) / d
- cartesianCoordinates[2] = ((distance*focalLength) / d) - focalLength; //Strahlensatz: z+f / f = distance / d.
-
- return cartesianCoordinates;
-}
-
-ToFProcessingCommon::ToFPoint3D ToFProcessingCommon::CartesianToIndexCoordinates(ToFPoint3D cartesianPoint, ToFScalarType focalLength,
- ToFPoint2D interPixelDistance, ToFPoint2D principalPoint)
-{
- ToFPoint3D indexCoordinatesAndDistanceValue;
-
- ToFScalarType imageX = focalLength/cartesianPoint[2] * cartesianPoint[0];
- ToFScalarType imageY = focalLength/cartesianPoint[2] * cartesianPoint[1];
-
- indexCoordinatesAndDistanceValue[0] = imageX/interPixelDistance[0] + principalPoint[0];
- indexCoordinatesAndDistanceValue[1] = imageY/interPixelDistance[1] + principalPoint[1];
-
- ToFScalarType d = sqrt(imageX*imageX + imageY*imageY + focalLength*focalLength);
-
- indexCoordinatesAndDistanceValue[2] = d*(cartesianPoint[2]+focalLength) / focalLength;
- return indexCoordinatesAndDistanceValue;
-}
-
+ ToFProcessingCommon::ToFPoint3D ToFProcessingCommon::IndexToCartesianCoordinates(unsigned int i, unsigned int j, ToFScalarType distance, ToFScalarType focalLength,
+ ToFScalarType interPixelDistanceX, ToFScalarType interPixelDistanceY,
+ ToFScalarType principalPointX, ToFScalarType principalPointY)
+ {
+ ToFPoint3D cartesianCoordinates;
+
+ // calculate image coordinates in mm;
+ ToFScalarType imageX = (( i - principalPointX ) * interPixelDistanceX);
+ ToFScalarType imageY = (( j - principalPointY ) * interPixelDistanceY);
+
+ //distance from pinhole to pixel
+ ToFScalarType d = sqrt(imageX*imageX + imageY*imageY + focalLength*focalLength);
+
+ cartesianCoordinates[0] = (distance-d)*imageX / d; //Strahlensatz: x / imageX = (distance-d) / d
+ cartesianCoordinates[1] = (distance-d)*imageY / d; //Strahlensatz: y / imageY = (distance-d) / d
+ cartesianCoordinates[2] = ((distance*focalLength) / d) - focalLength; //Strahlensatz: z+f / f = distance / d.
+
+ return cartesianCoordinates;
+ }
+
+ ToFProcessingCommon::ToFPoint3D ToFProcessingCommon::CartesianToIndexCoordinates(ToFScalarType cartesianPointX, ToFScalarType cartesianPointY,ToFScalarType cartesianPointZ,
+ ToFScalarType focalLength, ToFScalarType interPixelDistanceX, ToFScalarType interPixelDistanceY,
+ ToFScalarType principalPointX, ToFScalarType principalPointY, bool calculateDistance)
+ {
+ ToFPoint3D indexCoordinatesAndDistanceValue;
+
+ ToFScalarType imageX = focalLength/cartesianPointZ * cartesianPointX;
+ ToFScalarType imageY = focalLength/cartesianPointZ * cartesianPointY;
+
+ indexCoordinatesAndDistanceValue[0] = imageX/interPixelDistanceX + principalPointX;
+ indexCoordinatesAndDistanceValue[1] = imageY/interPixelDistanceY + principalPointY;
+
+ ToFScalarType d = sqrt(imageX*imageX + imageY*imageY + focalLength*focalLength);
+
+ if (calculateDistance)
+ {
+ indexCoordinatesAndDistanceValue[2] = d*(cartesianPointZ+focalLength) / focalLength;
+ }
+ else
+ {
+ indexCoordinatesAndDistanceValue[2] = 0.0;
+ }
+ return indexCoordinatesAndDistanceValue;
+ }
}
diff --git a/Modules/ToFProcessing/mitkToFProcessingCommon.h b/Modules/ToFProcessing/mitkToFProcessingCommon.h
index 6f6f4ba142..1283ea504c 100644
--- a/Modules/ToFProcessing/mitkToFProcessingCommon.h
+++ b/Modules/ToFProcessing/mitkToFProcessingCommon.h
@@ -1,90 +1,160 @@
/*=========================================================================
Program: Medical Imaging & Interaction Toolkit
Module: $RCSfile$
Language: C++
Date: $Date$
Version: $Revision$
Copyright (c) German Cancer Research Center, Division of Medical and
Biological Informatics. All rights reserved.
See MITKCopyright.txt or http://www.mitk.org/copyright.html for details.
This software is distributed WITHOUT ANY WARRANTY; without even
the implied warranty of MERCHANTABILITY or FITNESS FOR A PARTICULAR
PURPOSE. See the above copyright notices for more information.
=========================================================================*/
#ifndef MITKTOFPROCESSINGCOMMON_H
#define MITKTOFPROCESSINGCOMMON_H
#include "mitkToFProcessingExports.h"
#include "mitkVector.h"
#include <vnl/vnl_math.h>
namespace mitk
{
/**
* @brief Helper class providing functions which are useful for multiple usage
*
* Currently the following methods are provided:
* <ul>
* <li> Conversion from 2D image coordinates to 3D world coordinates (IndexToCartesianCoordinates())
* <li> Conversion from 3D world coordinates to 2D image coordinates (CartesianToIndexCoordinates())
* </ul>
*
*
* @ingroup ToFProcessing
*/
class mitkToFProcessing_EXPORT ToFProcessingCommon
{
public:
typedef double ToFScalarType;
- typedef itk::Point<double, 2> ToFPoint2D;
- typedef itk::Point<double, 3> ToFPoint3D;
-
+ typedef itk::Point<ToFScalarType, 2> ToFPoint2D;
+ typedef itk::Point<ToFScalarType, 3> ToFPoint3D;
+ typedef itk::Vector<ToFScalarType, 2> ToFVector2D;
+ typedef itk::Vector<ToFScalarType, 3> ToFVector3D;
/*!
- \brief Convert index based distances to cartesian coordinates
- \param i index in x direction of image plane
- \param j index in y direction of image plane
- \param distance distance value at given index in mm
- \param focalLength focal length of optical system in mm (mostly obtained from camera calibration)
- \param interPixelDistance distance between adjacent pixels in mm
- \param principalPoint coordinates of principal point on image plane in pixel
- \return cartesian coordinates for current index will be written here
- */
+ \brief Convert index based distances to cartesian coordinates
+ \param i index in x direction of image plane
+ \param j index in y direction of image plane
+ \param distance distance value at given index in mm
+ \param focalLength focal length of optical system in mm (mostly obtained from camera calibration)
+ \param interPixelDistanceX distance in x direction between adjacent pixels in mm
+ \param interPixelDistanceY distance in y direction between adjacent pixels in mm
+ \param principalPointX x coordinate of principal point on image plane in pixel
+ \param principalPointY y coordinate of principal point on image plane in pixel
+ \return cartesian coordinates for current index will be written here
+ */
static ToFPoint3D IndexToCartesianCoordinates(unsigned int i, unsigned int j, ToFScalarType distance, ToFScalarType focalLength,
- ToFPoint2D interPixelDistance, ToFPoint2D principalPoint);
+ ToFScalarType interPixelDistanceX, ToFScalarType interPixelDistanceY, ToFScalarType principalPointX, ToFScalarType principalPointY);
+
/*!
- \brief Convert index based distances to cartesian coordinates
- \param index index coordinates
- \param distance distance value at given index in mm
- \param focalLength focal length of optical system (mostly obtained from camera calibration)
- \param interPixelDistance distance between adjacent pixels in mm for x and y direction
- \param principalPoint coordinates of principal point on image plane in pixel
- \return cartesian coordinates for current index will be written here
- */
+ \brief Convert index based distances to cartesian coordinates
+ \param i index in x direction of image plane
+ \param j index in y direction of image plane
+ \param distance distance value at given index in mm
+ \param focalLength focal length of optical system in mm (mostly obtained from camera calibration)
+ \param interPixelDistance distance between adjacent pixels in mm
+ \param principalPoint coordinates of principal point on image plane in pixel
+ \return cartesian coordinates for current index will be written here
+ */
+ inline static ToFPoint3D IndexToCartesianCoordinates(unsigned int i, unsigned int j, ToFScalarType distance, ToFScalarType focalLength,
+ ToFPoint2D interPixelDistance, ToFPoint2D principalPoint)
+ {
+ return IndexToCartesianCoordinates(i,j,distance,focalLength,interPixelDistance[0],interPixelDistance[1],principalPoint[0],principalPoint[1]);
+ }
+ /*!
+ \brief Convert index based distances to cartesian coordinates
+ \param index index coordinates
+ \param distance distance value at given index in mm
+ \param focalLength focal length of optical system (mostly obtained from camera calibration)
+ \param interPixelDistance distance between adjacent pixels in mm for x and y direction
+ \param principalPoint coordinates of principal point on image plane in pixel
+ \return cartesian coordinates for current index will be written here
+ */
inline static ToFPoint3D IndexToCartesianCoordinates(mitk::Index3D index, ToFScalarType distance, ToFScalarType focalLength,
- ToFPoint2D interPixelDistance, ToFPoint2D principalPoint)
+ ToFPoint2D interPixelDistance, ToFPoint2D principalPoint)
{
return IndexToCartesianCoordinates(index[0],index[1],distance,focalLength,interPixelDistance,principalPoint);
}
+ /*!
+ \brief Convenience method to convert index based distances to cartesian coordinates using array as input
+ \param i index in x direction of image plane
+ \param j index in y direction of image plane
+ \param distance distance value at given index in mm
+ \param focalLength focal length of optical system in mm (mostly obtained from camera calibration)
+ \param interPixelDistance distance between adjacent pixels in mm
+ \param principalPoint coordinates of principal point on image plane in pixel
+ \return cartesian coordinates for current index will be written here
+ */
+ inline static ToFPoint3D IndexToCartesianCoordinates(unsigned int i, unsigned int j, ToFScalarType distance, ToFScalarType focalLength,
+ ToFScalarType interPixelDistance[2], ToFScalarType principalPoint[2])
+ {
+ return IndexToCartesianCoordinates(i,j,distance,focalLength,interPixelDistance[0],interPixelDistance[1],principalPoint[0],principalPoint[1]);
+ }
+ /*!
+ \brief Convert index based distances to cartesian coordinates
+ \param cartesianPointX x coordinate of point (of a surface or point set) to convert in 3D coordinates
+ \param cartesianPointY y coordinate of point (of a surface or point set) to convert in 3D coordinates
+ \param cartesianPointZ z coordinate of point (of a surface or point set) to convert in 3D coordinates
+ \param focalLength focal length of optical system in mm (mostly obtained from camera calibration)
+ \param interPixelDistanceX distance in x direction between adjacent pixels in mm
+ \param interPixelDistanceY distance in y direction between adjacent pixels in mm
+ \param principalPointX x coordinate of principal point on image plane in pixel
+ \param principalPointY y coordinate of principal point on image plane in pixel
+ \param calculateDistance if this flag is set, the distance value is stored in the z position of the output otherwise z=0
+ \return a ToFPoint3D. (int)ToFPoint3D[0]+0.5 and (int)ToFPoint3D[0]+0.5 will return the x and y index coordinates. ToFPoint3D[2] contains the distance value
+ */
+ static ToFPoint3D CartesianToIndexCoordinates(ToFScalarType cartesianPointX, ToFScalarType cartesianPointY,ToFScalarType cartesianPointZ,
+ ToFScalarType focalLength, ToFScalarType interPixelDistanceX, ToFScalarType interPixelDistanceY,
+ ToFScalarType principalPointX, ToFScalarType principalPointY, bool calculateDistance=true);
/*!
- \brief Convert index based distances to cartesian coordinates
- \param cartesianPoint point (of a surface or point set) to convert in 3D coordinates
- \param distance distance value at given index in mm
- \param focalLength focal length of optical system in mm (mostly obtained from camera calibration)
- \param interPixelDistance distance between adjacent pixels in mm for x and y direction
- \param principalPoint coordinates of principal point on image plane in pixel
- \return a ToFPoint3D. (int)ToFPoint3D[0]+0.5 and (int)ToFPoint3D[0]+0.5 will return the x and y index coordinates. ToFPoint3D[2] contains the distance value
- */
- static ToFPoint3D CartesianToIndexCoordinates(ToFPoint3D cartesianPoint, ToFScalarType focalLength,
- ToFPoint2D interPixelDistance, ToFPoint2D principalPoint);
+ \brief Convenience method to convert index based distances to cartesian coordinates using arrays
+ \param cartesianPoint point (of a surface or point set) to convert in 3D coordinates
+ \param focalLength focal length of optical system in mm (mostly obtained from camera calibration)
+ \param interPixelDistance distance between adjacent pixels in mm for x and y direction
+ \param principalPoint coordinates of principal point on image plane in pixel
+ \param calculateDistance if this flag is set, the distance value is stored in the z position of the output otherwise z=0
+ \return a ToFPoint3D. (int)ToFPoint3D[0]+0.5 and (int)ToFPoint3D[0]+0.5 will return the x and y index coordinates. ToFPoint3D[2] contains the distance value
+ */
+ inline static ToFPoint3D CartesianToIndexCoordinates(ToFScalarType cartesianPoint[3], ToFScalarType focalLength,
+ ToFScalarType interPixelDistance[2], ToFScalarType principalPoint[2],
+ bool calculateDistance=true)
+ {
+ return CartesianToIndexCoordinates(cartesianPoint[0],cartesianPoint[1],cartesianPoint[2],focalLength,
+ interPixelDistance[0],interPixelDistance[1],principalPoint[0],principalPoint[1],calculateDistance);
+ }
+ /*!
+ \brief Convert index based distances to cartesian coordinates
+ \param cartesianPoint point (of a surface or point set) to convert in 3D coordinates
+ \param focalLength focal length of optical system in mm (mostly obtained from camera calibration)
+ \param interPixelDistance distance between adjacent pixels in mm for x and y direction
+ \param principalPoint coordinates of principal point on image plane in pixel
+ \param calculateDistance if this flag is set, the distance value is stored in the z position of the output otherwise z=0
+ \return a ToFPoint3D. (int)ToFPoint3D[0]+0.5 and (int)ToFPoint3D[0]+0.5 will return the x and y index coordinates. ToFPoint3D[2] contains the distance value
+ */
+ inline static ToFPoint3D CartesianToIndexCoordinates(ToFPoint3D cartesianPoint, ToFScalarType focalLength,
+ ToFPoint2D interPixelDistance, ToFPoint2D principalPoint, bool calculateDistance=true)
+ {
+ return CartesianToIndexCoordinates(cartesianPoint[0],cartesianPoint[1],cartesianPoint[2],focalLength,
+ interPixelDistance[0],interPixelDistance[1],principalPoint[0],principalPoint[1],calculateDistance);
+ }
};
}
#endif
diff --git a/Modules/ToFProcessing/mitkToFSurfaceVtkMapper3D.cpp b/Modules/ToFProcessing/mitkToFSurfaceVtkMapper3D.cpp
index 79244eccf6..8f8d93480e 100644
--- a/Modules/ToFProcessing/mitkToFSurfaceVtkMapper3D.cpp
+++ b/Modules/ToFProcessing/mitkToFSurfaceVtkMapper3D.cpp
@@ -1,532 +1,532 @@
/*=========================================================================
Program: Medical Imaging & Interaction Toolkit
Language: C++
Date: $Date: 2010-05-26 14:10:28 +0200 (Mi, 26 Mai 2010) $
Version: $Revision: 23106 $
Copyright (c) German Cancer Research Center, Division of Medical and
Biological Informatics. All rights reserved.
See MITKCopyright.txt or http://www.mitk.org/copyright.html for details.
This software is distributed WITHOUT ANY WARRANTY; without even
the implied warranty of MERCHANTABILITY or FITNESS FOR A PARTICULAR
PURPOSE. See the above copyright notices for more information.
=========================================================================*/
#include "mitkToFSurfaceVtkMapper3D.h"
#include "mitkDataNode.h"
#include "mitkProperties.h"
#include "mitkColorProperty.h"
#include "mitkLookupTableProperty.h"
#include "mitkVtkRepresentationProperty.h"
#include "mitkVtkInterpolationProperty.h"
#include "mitkVtkScalarModeProperty.h"
#include "mitkClippingProperty.h"
#include "mitkShaderProperty.h"
#include "mitkShaderRepository.h"
#include <vtkActor.h>
#include <vtkProperty.h>
#include <vtkPolyData.h>
#include <vtkPolyDataMapper.h>
#include <vtkPolyDataNormals.h>
#include <vtkPointData.h>
#include <vtkPlaneCollection.h>
#include <vtkTexture.h>
#include <vtkBMPReader.h>
#include <vtkImageData.h>
#include <vtkUnsignedCharArray.h>
//const mitk::ToFSurface* mitk::ToFSurfaceVtkMapper3D::GetInput()
const mitk::Surface* mitk::ToFSurfaceVtkMapper3D::GetInput()
{
//return static_cast<const mitk::ToFSurface * > ( GetData() );
return static_cast<const mitk::Surface * > ( GetData() );
}
mitk::ToFSurfaceVtkMapper3D::ToFSurfaceVtkMapper3D()
{
// m_Prop3D = vtkActor::New();
m_GenerateNormals = false;
this->m_Texture = NULL;
this->m_TextureWidth = 0;
this->m_TextureHeight = 0;
this->m_VtkScalarsToColors = NULL;
}
mitk::ToFSurfaceVtkMapper3D::~ToFSurfaceVtkMapper3D()
{
// m_Prop3D->Delete();
}
-void mitk::ToFSurfaceVtkMapper3D::GenerateData(mitk::BaseRenderer* renderer)
+void mitk::ToFSurfaceVtkMapper3D::GenerateDataForRenderer(mitk::BaseRenderer* renderer)
{
LocalStorage *ls = m_LSH.GetLocalStorage(renderer);
bool visible = IsVisible(renderer);
if(visible==false)
{
ls->m_Actor->VisibilityOff();
return;
}
//
// set the input-object at time t for the mapper
//
//mitk::ToFSurface::Pointer input = const_cast< mitk::ToFSurface* >( this->GetInput() );
mitk::Surface::Pointer input = const_cast< mitk::Surface* >( this->GetInput() );
vtkPolyData * polydata = input->GetVtkPolyData( this->GetTimestep() );
if(polydata == NULL)
{
ls->m_Actor->VisibilityOff();
return;
}
if ( m_GenerateNormals )
{
ls->m_VtkPolyDataNormals->SetInput( polydata );
ls->m_VtkPolyDataMapper->SetInput( ls->m_VtkPolyDataNormals->GetOutput() );
}
else
{
ls->m_VtkPolyDataMapper->SetInput( polydata );
}
//
// apply properties read from the PropertyList
//
ApplyProperties(ls->m_Actor, renderer);
if(visible)
ls->m_Actor->VisibilityOn();
//
// TOF extension for visualization (color/texture mapping)
//
if (this->m_VtkScalarsToColors)
{
// set the color transfer funtion if applied
ls->m_VtkPolyDataMapper->SetLookupTable(this->m_VtkScalarsToColors);
}
if (this->m_Texture)
{
// create a vtk image as basic for texture
vtkImageData* imageData = vtkImageData::New();
int width = this->m_TextureWidth;
int height = this->m_TextureHeight;
imageData->SetDimensions(width, height, 1);
imageData->SetScalarTypeToUnsignedChar();
imageData->SetNumberOfScalarComponents(3); // RGB
imageData->SetSpacing(0.0, 0.0, 0.0);
imageData->SetOrigin(width/2, height/2, 0.0);
imageData->AllocateScalars(); // allocate storage for image data
imageData->SetScalarType( VTK_UNSIGNED_CHAR );
// create a vtk array to hold the input unsigned char* texture (e.g. from the video camera)
vtkDataArray *scalars;
scalars = vtkUnsignedCharArray::New();
scalars->SetNumberOfComponents(3);
scalars->SetVoidArray(this->GetTexture(), width*height*3, 1);
// prepare the image data from vtk array
imageData->GetPointData()->SetScalars(scalars);
scalars->Delete();
// create vtk texture
vtkTexture *aTexture = vtkTexture::New();
aTexture->SetInput(imageData);
aTexture->InterpolateOn();
ls->m_Actor->SetTexture(aTexture);
aTexture->Delete();
}
else
{
// remove the texture
ls->m_Actor->SetTexture(0);
}
}
void mitk::ToFSurfaceVtkMapper3D::ResetMapper( BaseRenderer* renderer )
{
LocalStorage *ls = m_LSH.GetLocalStorage(renderer);
ls->m_Actor->VisibilityOff();
}
void mitk::ToFSurfaceVtkMapper3D::ApplyMitkPropertiesToVtkProperty(mitk::DataNode *node, vtkProperty* property, mitk::BaseRenderer* renderer)
{
// Colors
{
double ambient [3] = { 0.5,0.5,0.0 };
double diffuse [3] = { 0.5,0.5,0.0 };
double specular[3] = { 1.0,1.0,1.0 };
float coeff_ambient = 0.5f;
float coeff_diffuse = 0.5f;
float coeff_specular= 0.5f;
float power_specular=10.0f;
// Color
{
mitk::ColorProperty::Pointer p;
node->GetProperty(p, "color", renderer);
if(p.IsNotNull())
{
mitk::Color c = p->GetColor();
ambient[0]=c.GetRed(); ambient[1]=c.GetGreen(); ambient[2]=c.GetBlue();
diffuse[0]=c.GetRed(); diffuse[1]=c.GetGreen(); diffuse[2]=c.GetBlue();
// Setting specular color to the same, make physically no real sense, however vtk rendering slows down, if these colors are different.
specular[0]=c.GetRed(); specular[1]=c.GetGreen(); specular[2]=c.GetBlue();
}
}
// Ambient
{
mitk::ColorProperty::Pointer p;
node->GetProperty(p, "material.ambientColor", renderer);
if(p.IsNotNull())
{
mitk::Color c = p->GetColor();
ambient[0]=c.GetRed(); ambient[1]=c.GetGreen(); ambient[2]=c.GetBlue();
}
}
// Diffuse
{
mitk::ColorProperty::Pointer p;
node->GetProperty(p, "material.diffuseColor", renderer);
if(p.IsNotNull())
{
mitk::Color c = p->GetColor();
diffuse[0]=c.GetRed(); diffuse[1]=c.GetGreen(); diffuse[2]=c.GetBlue();
}
}
// Specular
{
mitk::ColorProperty::Pointer p;
node->GetProperty(p, "material.specularColor", renderer);
if(p.IsNotNull())
{
mitk::Color c = p->GetColor();
specular[0]=c.GetRed(); specular[1]=c.GetGreen(); specular[2]=c.GetBlue();
}
}
// Ambient coeff
{
node->GetFloatProperty("material.ambientCoefficient", coeff_ambient, renderer);
}
// Diffuse coeff
{
node->GetFloatProperty("material.diffuseCoefficient", coeff_diffuse, renderer);
}
// Specular coeff
{
node->GetFloatProperty("material.specularCoefficient", coeff_specular, renderer);
}
// Specular power
{
node->GetFloatProperty("material.specularPower", power_specular, renderer);
}
property->SetAmbient( coeff_ambient );
property->SetDiffuse( coeff_diffuse );
property->SetSpecular( coeff_specular );
property->SetSpecularPower( power_specular );
property->SetAmbientColor( ambient );
property->SetDiffuseColor( diffuse );
property->SetSpecularColor( specular );
}
// Render mode
{
// Opacity
{
float opacity = 1.0f;
if( node->GetOpacity(opacity,renderer) )
property->SetOpacity( opacity );
}
// Wireframe line width
{
float lineWidth = 1;
node->GetFloatProperty("material.wireframeLineWidth", lineWidth, renderer);
property->SetLineWidth( lineWidth );
}
// Representation
{
mitk::VtkRepresentationProperty::Pointer p;
node->GetProperty(p, "material.representation", renderer);
if(p.IsNotNull())
property->SetRepresentation( p->GetVtkRepresentation() );
}
// Interpolation
{
mitk::VtkInterpolationProperty::Pointer p;
node->GetProperty(p, "material.interpolation", renderer);
if(p.IsNotNull())
property->SetInterpolation( p->GetVtkInterpolation() );
}
}
}
void mitk::ToFSurfaceVtkMapper3D::ApplyProperties(vtkActor* /*actor*/, mitk::BaseRenderer* renderer)
{
LocalStorage *ls = m_LSH.GetLocalStorage(renderer);
// Applying shading properties
{
Superclass::ApplyProperties( ls->m_Actor, renderer ) ;
// VTK Properties
ApplyMitkPropertiesToVtkProperty( this->GetDataNode(), ls->m_Actor->GetProperty(), renderer );
// Shaders
mitk::ShaderRepository::GetGlobalShaderRepository()->ApplyProperties(this->GetDataNode(),ls->m_Actor,renderer,ls->m_ShaderTimestampUpdate);
}
mitk::LookupTableProperty::Pointer lookupTableProp;
this->GetDataNode()->GetProperty(lookupTableProp, "LookupTable", renderer);
if (lookupTableProp.IsNotNull() )
{
ls->m_VtkPolyDataMapper->SetLookupTable(lookupTableProp->GetLookupTable()->GetVtkLookupTable());
}
mitk::LevelWindow levelWindow;
if(this->GetDataNode()->GetLevelWindow(levelWindow, renderer, "levelWindow"))
{
ls->m_VtkPolyDataMapper->SetScalarRange(levelWindow.GetLowerWindowBound(),levelWindow.GetUpperWindowBound());
}
else
if(this->GetDataNode()->GetLevelWindow(levelWindow, renderer))
{
ls->m_VtkPolyDataMapper->SetScalarRange(levelWindow.GetLowerWindowBound(),levelWindow.GetUpperWindowBound());
}
bool scalarVisibility = false;
this->GetDataNode()->GetBoolProperty("scalar visibility", scalarVisibility);
ls->m_VtkPolyDataMapper->SetScalarVisibility( (scalarVisibility ? 1 : 0) );
if(scalarVisibility)
{
mitk::VtkScalarModeProperty* scalarMode;
if(this->GetDataNode()->GetProperty(scalarMode, "scalar mode", renderer))
{
ls->m_VtkPolyDataMapper->SetScalarMode(scalarMode->GetVtkScalarMode());
}
else
ls->m_VtkPolyDataMapper->SetScalarModeToDefault();
bool colorMode = false;
this->GetDataNode()->GetBoolProperty("color mode", colorMode);
ls->m_VtkPolyDataMapper->SetColorMode( (colorMode ? 1 : 0) );
float scalarsMin = 0;
if (dynamic_cast<mitk::FloatProperty *>(this->GetDataNode()->GetProperty("ScalarsRangeMinimum")) != NULL)
scalarsMin = dynamic_cast<mitk::FloatProperty*>(this->GetDataNode()->GetProperty("ScalarsRangeMinimum"))->GetValue();
float scalarsMax = 1.0;
if (dynamic_cast<mitk::FloatProperty *>(this->GetDataNode()->GetProperty("ScalarsRangeMaximum")) != NULL)
scalarsMax = dynamic_cast<mitk::FloatProperty*>(this->GetDataNode()->GetProperty("ScalarsRangeMaximum"))->GetValue();
ls->m_VtkPolyDataMapper->SetScalarRange(scalarsMin,scalarsMax);
}
// deprecated settings
bool deprecatedUseCellData = false;
this->GetDataNode()->GetBoolProperty("deprecated useCellDataForColouring", deprecatedUseCellData);
bool deprecatedUsePointData = false;
this->GetDataNode()->GetBoolProperty("deprecated usePointDataForColouring", deprecatedUsePointData);
if (deprecatedUseCellData)
{
ls->m_VtkPolyDataMapper->SetColorModeToDefault();
ls->m_VtkPolyDataMapper->SetScalarRange(0,255);
ls->m_VtkPolyDataMapper->ScalarVisibilityOn();
ls->m_VtkPolyDataMapper->SetScalarModeToUseCellData();
ls->m_Actor->GetProperty()->SetSpecular (1);
ls->m_Actor->GetProperty()->SetSpecularPower (50);
ls->m_Actor->GetProperty()->SetInterpolationToPhong();
}
else if (deprecatedUsePointData)
{
float scalarsMin = 0;
if (dynamic_cast<mitk::FloatProperty *>(this->GetDataNode()->GetProperty("ScalarsRangeMinimum")) != NULL)
scalarsMin = dynamic_cast<mitk::FloatProperty*>(this->GetDataNode()->GetProperty("ScalarsRangeMinimum"))->GetValue();
float scalarsMax = 0.1;
if (dynamic_cast<mitk::FloatProperty *>(this->GetDataNode()->GetProperty("ScalarsRangeMaximum")) != NULL)
scalarsMax = dynamic_cast<mitk::FloatProperty*>(this->GetDataNode()->GetProperty("ScalarsRangeMaximum"))->GetValue();
ls->m_VtkPolyDataMapper->SetScalarRange(scalarsMin,scalarsMax);
ls->m_VtkPolyDataMapper->SetColorModeToMapScalars();
ls->m_VtkPolyDataMapper->ScalarVisibilityOn();
ls->m_Actor->GetProperty()->SetSpecular (1);
ls->m_Actor->GetProperty()->SetSpecularPower (50);
ls->m_Actor->GetProperty()->SetInterpolationToPhong();
}
int deprecatedScalarMode = VTK_COLOR_MODE_DEFAULT;
if(this->GetDataNode()->GetIntProperty("deprecated scalar mode", deprecatedScalarMode, renderer))
{
ls->m_VtkPolyDataMapper->SetScalarMode(deprecatedScalarMode);
ls->m_VtkPolyDataMapper->ScalarVisibilityOn();
ls->m_Actor->GetProperty()->SetSpecular (1);
ls->m_Actor->GetProperty()->SetSpecularPower (50);
//m_Actor->GetProperty()->SetInterpolationToPhong();
}
// Check whether one or more ClippingProperty objects have been defined for
// this node. Check both renderer specific and global property lists, since
// properties in both should be considered.
const PropertyList::PropertyMap *rendererProperties = this->GetDataNode()->GetPropertyList( renderer )->GetMap();
const PropertyList::PropertyMap *globalProperties = this->GetDataNode()->GetPropertyList( NULL )->GetMap();
// Add clipping planes (if any)
ls->m_ClippingPlaneCollection->RemoveAllItems();
PropertyList::PropertyMap::const_iterator it;
for ( it = rendererProperties->begin(); it != rendererProperties->end(); ++it )
{
- this->CheckForClippingProperty( renderer,(*it).second.first.GetPointer() );
+ this->CheckForClippingProperty( renderer,(*it).second.GetPointer() );
}
for ( it = globalProperties->begin(); it != globalProperties->end(); ++it )
{
- this->CheckForClippingProperty( renderer,(*it).second.first.GetPointer() );
+ this->CheckForClippingProperty( renderer,(*it).second.GetPointer() );
}
if ( ls->m_ClippingPlaneCollection->GetNumberOfItems() > 0 )
{
ls->m_VtkPolyDataMapper->SetClippingPlanes( ls->m_ClippingPlaneCollection );
}
else
{
ls->m_VtkPolyDataMapper->RemoveAllClippingPlanes();
}
}
vtkProp *mitk::ToFSurfaceVtkMapper3D::GetVtkProp(mitk::BaseRenderer *renderer)
{
LocalStorage *ls = m_LSH.GetLocalStorage(renderer);
return ls->m_Actor;
}
void mitk::ToFSurfaceVtkMapper3D::CheckForClippingProperty( mitk::BaseRenderer* renderer, mitk::BaseProperty *property )
{
LocalStorage *ls = m_LSH.GetLocalStorage(renderer);
// m_Prop3D = ls->m_Actor;
ClippingProperty *clippingProperty = dynamic_cast< ClippingProperty * >( property );
if ( (clippingProperty != NULL)
&& (clippingProperty->GetClippingEnabled()) )
{
const Point3D &origin = clippingProperty->GetOrigin();
const Vector3D &normal = clippingProperty->GetNormal();
vtkPlane *clippingPlane = vtkPlane::New();
clippingPlane->SetOrigin( origin[0], origin[1], origin[2] );
clippingPlane->SetNormal( normal[0], normal[1], normal[2] );
ls->m_ClippingPlaneCollection->AddItem( clippingPlane );
clippingPlane->UnRegister( NULL );
}
}
void mitk::ToFSurfaceVtkMapper3D::SetDefaultPropertiesForVtkProperty(mitk::DataNode* node, mitk::BaseRenderer* renderer, bool overwrite)
{
// Shading
{
node->AddProperty( "material.wireframeLineWidth", mitk::FloatProperty::New(1.0f) , renderer, overwrite );
node->AddProperty( "material.ambientCoefficient" , mitk::FloatProperty::New(0.05f) , renderer, overwrite );
node->AddProperty( "material.diffuseCoefficient" , mitk::FloatProperty::New(0.9f) , renderer, overwrite );
node->AddProperty( "material.specularCoefficient", mitk::FloatProperty::New(1.0f) , renderer, overwrite );
node->AddProperty( "material.specularPower" , mitk::FloatProperty::New(16.0f) , renderer, overwrite );
//node->AddProperty( "material.ambientColor" , mitk::ColorProperty::New(1.0f,1.0f,1.0f), renderer, overwrite );
//node->AddProperty( "material.diffuseColor" , mitk::ColorProperty::New(1.0f,1.0f,1.0f), renderer, overwrite );
//node->AddProperty( "material.specularColor" , mitk::ColorProperty::New(1.0f,1.0f,1.0f), renderer, overwrite );
node->AddProperty( "material.representation" , mitk::VtkRepresentationProperty::New() , renderer, overwrite );
node->AddProperty( "material.interpolation" , mitk::VtkInterpolationProperty::New() , renderer, overwrite );
}
// Shaders
{
mitk::ShaderRepository::GetGlobalShaderRepository()->AddDefaultProperties(node,renderer,overwrite);
}
}
void mitk::ToFSurfaceVtkMapper3D::SetDefaultProperties(mitk::DataNode* node, mitk::BaseRenderer* renderer, bool overwrite)
{
node->AddProperty( "color", mitk::ColorProperty::New(1.0f,1.0f,1.0f), renderer, overwrite );
node->AddProperty( "opacity", mitk::FloatProperty::New(1.0), renderer, overwrite );
mitk::ToFSurfaceVtkMapper3D::SetDefaultPropertiesForVtkProperty(node,renderer,overwrite); // Shading
node->AddProperty( "scalar visibility", mitk::BoolProperty::New(false), renderer, overwrite );
node->AddProperty( "color mode", mitk::BoolProperty::New(false), renderer, overwrite );
node->AddProperty( "scalar mode", mitk::VtkScalarModeProperty::New(), renderer, overwrite );
mitk::Surface::Pointer surface = dynamic_cast<Surface*>(node->GetData());
if(surface.IsNotNull())
{
if((surface->GetVtkPolyData() != 0) && (surface->GetVtkPolyData()->GetPointData() != NULL) && (surface->GetVtkPolyData()->GetPointData()->GetScalars() != 0))
{
node->AddProperty( "scalar visibility", mitk::BoolProperty::New(true), renderer, overwrite );
node->AddProperty( "color mode", mitk::BoolProperty::New(true), renderer, overwrite );
}
}
Superclass::SetDefaultProperties(node, renderer, overwrite);
}
void mitk::ToFSurfaceVtkMapper3D::SetImmediateModeRenderingOn(int /*on*/)
{
/*
if (m_VtkPolyDataMapper != NULL)
m_VtkPolyDataMapper->SetImmediateModeRendering(on);
*/
}
void mitk::ToFSurfaceVtkMapper3D::SetTexture(unsigned char* texture)
{
this->m_Texture = texture;
}
unsigned char* mitk::ToFSurfaceVtkMapper3D::GetTexture()
{
return this->m_Texture;
}
void mitk::ToFSurfaceVtkMapper3D::SetVtkScalarsToColors(vtkScalarsToColors* vtkScalarsToColors)
{
this->m_VtkScalarsToColors = vtkScalarsToColors;
}
vtkScalarsToColors* mitk::ToFSurfaceVtkMapper3D::GetVtkScalarsToColors()
{
return this->m_VtkScalarsToColors;
}
diff --git a/Modules/ToFProcessing/mitkToFSurfaceVtkMapper3D.h b/Modules/ToFProcessing/mitkToFSurfaceVtkMapper3D.h
index 058defe90a..48e9d655fb 100644
--- a/Modules/ToFProcessing/mitkToFSurfaceVtkMapper3D.h
+++ b/Modules/ToFProcessing/mitkToFSurfaceVtkMapper3D.h
@@ -1,186 +1,186 @@
/*=========================================================================
Program: Medical Imaging & Interaction Toolkit
Language: C++
Date: $Date: 2010-03-18 14:08:01 +0100 (Do, 18 Mrz 2010) $
Version: $Revision: 21794 $
Copyright (c) German Cancer Research Center, Division of Medical and
Biological Informatics. All rights reserved.
See MITKCopyright.txt or http://www.mitk.org/copyright.html for details.
This software is distributed WITHOUT ANY WARRANTY; without even
the implied warranty of MERCHANTABILITY or FITNESS FOR A PARTICULAR
PURPOSE. See the above copyright notices for more information.
=========================================================================*/
#ifndef MITKTOFSURFACEDATAVTKMAPPER3D_H_HEADER_INCLUDED_C1907273
#define MITKTOFSURFACEDATAVTKMAPPER3D_H_HEADER_INCLUDED_C1907273
#include "mitkCommon.h"
#include "mitkVtkMapper3D.h"
#include "mitkSurface.h"
#include "mitkBaseRenderer.h"
#include <vtkActor.h>
#include <vtkOpenGLPolyDataMapper.h>
#include <vtkPainterPolyDataMapper.h>
#include <vtkPolyDataMapper.h>
#include <vtkPolyDataNormals.h>
#include <vtkPlaneCollection.h>
#include <vtkScalarsToColors.h>
#include "mitkToFProcessingExports.h"
namespace mitk {
//##Documentation
//## @brief Vtk-based mapper for Surface
//##
//## @ingroup Mapper
/**
* @brief Vtk-based mapper for Surface
*
* Properties that can be set for surfaces and influence the surfaceVTKMapper3D are:
*
* - \b "color": (ColorProperty) Diffuse color of the surface object (this property will be read when material.diffuseColor is not defined)
* - \b "Opacity": (FloatProperty) Opacity of the surface object
* - \b "material.ambientColor": (ColorProperty) Ambient color of the surface object
* - \b "material.ambientCoefficient": ( FloatProperty) Ambient coefficient of the surface object
* - \b "material.diffuseColor": ( ColorProperty) Diffuse color of the surface object
* - \b "material.diffuseCoefficient": (FloatProperty) Diffuse coefficient of the surface object
* - \b "material.specularColor": (ColorProperty) Specular Color of the surface object
* - \b "material.specularCoefficient": (FloatProperty) Specular coefficient of the surface object
* - \b "material.specularPower": (FloatProperty) Specular power of the surface object
* - \b "material.interpolation": (VtkInterpolationProperty) Interpolation
* - \b "material.representation": (VtkRepresentationProperty*) Representation
* - \b "material.wireframeLineWidth": (FloatProperty) Width in pixels of the lines drawn.
* - \b "scalar visibility": (BoolProperty) If the scarlars of the surface are visible
* Properties to look for are:
*
* - \b "scalar visibility": if set to on, scalars assigned to the data are shown
* Turn this on if using a lookup table.
* - \b "ScalarsRangeMinimum": Optional. Can be used to store the scalar min, e.g.
* for the level window settings.
* - \b "ScalarsRangeMaximum": Optional. See above.
*
* There might be still some other, deprecated properties. These will not be documented anymore.
* Please check the source if you really need them.
*
* @ingroup Mapper
*/
class mitkToFProcessing_EXPORT ToFSurfaceVtkMapper3D : public VtkMapper3D
{
public:
mitkClassMacro(ToFSurfaceVtkMapper3D, VtkMapper3D);
itkNewMacro(Self);
itkSetMacro(GenerateNormals, bool);
itkGetMacro(GenerateNormals, bool);
//enable ImmediateModeRendering for vtkMapping
//yet to solve bug 1398
void SetImmediateModeRenderingOn(int on = 1);
itkGetMacro(ImmediateModeRenderingOn, int);
//virtual const mitk::ToFSurface* GetInput();
virtual const mitk::Surface* GetInput();
virtual vtkProp *GetVtkProp(mitk::BaseRenderer *renderer);
virtual void ApplyProperties(vtkActor* actor, mitk::BaseRenderer* renderer);
static void SetDefaultProperties(mitk::DataNode* node, mitk::BaseRenderer* renderer = NULL, bool overwrite = false);
void SetTexture(unsigned char*);
unsigned char* GetTexture();
itkSetMacro(TextureWidth, int);
itkSetMacro(TextureHeight, int);
void SetVtkScalarsToColors(vtkScalarsToColors* vtkScalarsToColors);
vtkScalarsToColors* GetVtkScalarsToColors();
protected:
ToFSurfaceVtkMapper3D();
virtual ~ToFSurfaceVtkMapper3D();
- virtual void GenerateData(mitk::BaseRenderer* renderer);
+ virtual void GenerateDataForRenderer(mitk::BaseRenderer* renderer);
virtual void ResetMapper( mitk::BaseRenderer* renderer );
/** Checks whether the specified property is a ClippingProperty and if yes,
* adds it to m_ClippingPlaneCollection (internal method). */
virtual void CheckForClippingProperty( mitk::BaseRenderer* renderer, mitk::BaseProperty *property );
bool m_GenerateNormals;
//enable ImmediateModeRendering for the vtkMapper
int m_ImmediateModeRenderingOn;
unsigned char* m_Texture; // pointer to the texture/video image
int m_TextureWidth; // width of the texture/video image
int m_TextureHeight; // height of the texture/video image
vtkScalarsToColors* m_VtkScalarsToColors; // vtk color transfer funtion
public:
class LocalStorage : public mitk::Mapper::BaseLocalStorage
{
public:
vtkActor* m_Actor;
vtkPolyDataMapper *m_VtkPolyDataMapper;
vtkPolyDataNormals *m_VtkPolyDataNormals;
vtkPlaneCollection *m_ClippingPlaneCollection;
itk::TimeStamp m_ShaderTimestampUpdate;
LocalStorage()
{
m_VtkPolyDataMapper = vtkOpenGLPolyDataMapper::New();
m_VtkPolyDataNormals = vtkPolyDataNormals::New();
m_Actor = vtkActor::New();
m_ClippingPlaneCollection = vtkPlaneCollection::New();
m_Actor->SetMapper(m_VtkPolyDataMapper);
}
~LocalStorage()
{
m_VtkPolyDataMapper->Delete();
m_VtkPolyDataNormals->Delete();
m_Actor->Delete();
m_ClippingPlaneCollection->Delete();
}
};
mitk::Mapper::LocalStorageHandler<LocalStorage> m_LSH;
static void ApplyMitkPropertiesToVtkProperty(mitk::DataNode *node, vtkProperty* property, mitk::BaseRenderer* renderer);
static void SetDefaultPropertiesForVtkProperty(mitk::DataNode* node, mitk::BaseRenderer* renderer, bool overwrite);
};
} // namespace mitk
#endif /* MITKTOFSURFACEDATAVTKMAPPER3D_H_HEADER_INCLUDED_C1907273 */
diff --git a/SuperBuild.cmake b/SuperBuild.cmake
index a433482fa9..e8656255ee 100644
--- a/SuperBuild.cmake
+++ b/SuperBuild.cmake
@@ -1,241 +1,239 @@
#-----------------------------------------------------------------------------
# Convenient macro allowing to download a file
#-----------------------------------------------------------------------------
MACRO(downloadFile url dest)
FILE(DOWNLOAD ${url} ${dest} STATUS status)
LIST(GET status 0 error_code)
LIST(GET status 1 error_msg)
IF(error_code)
MESSAGE(FATAL_ERROR "error: Failed to download ${url} - ${error_msg}")
ENDIF()
ENDMACRO()
#-----------------------------------------------------------------------------
# MITK Prerequisites
#-----------------------------------------------------------------------------
#----------------------------- Qt ---------------------------
if(MITK_USE_QT)
find_package(Qt4 REQUIRED)
set(vtk_QT_ARGS
-DDESIRED_QT_VERSION:STRING=4
-DVTK_USE_GUISUPPORT:BOOL=ON
-DVTK_USE_QVTK_QTOPENGL:BOOL=ON
-DVTK_USE_QT:BOOL=ON
-DQT_QMAKE_EXECUTABLE:FILEPATH=${QT_QMAKE_EXECUTABLE}
)
endif()
#-----------------------------------------------------------------------------
# External project settings
#-----------------------------------------------------------------------------
INCLUDE(ExternalProject)
SET(ep_base "${CMAKE_BINARY_DIR}/CMakeExternals")
SET_PROPERTY(DIRECTORY PROPERTY EP_BASE ${ep_base})
SET(ep_install_dir ${ep_base}/Install)
#SET(ep_build_dir ${ep_base}/Build)
SET(ep_source_dir ${ep_base}/Source)
#SET(ep_parallelism_level)
SET(ep_build_shared_libs ON)
SET(ep_build_testing OFF)
# Compute -G arg for configuring external projects with the same CMake generator:
IF(CMAKE_EXTRA_GENERATOR)
SET(gen "${CMAKE_EXTRA_GENERATOR} - ${CMAKE_GENERATOR}")
ELSE()
SET(gen "${CMAKE_GENERATOR}")
ENDIF()
# Use this value where semi-colons are needed in ep_add args:
set(sep "^^")
##
IF(MSVC90 OR MSVC10)
SET(ep_common_C_FLAGS "${CMAKE_C_FLAGS} /bigobj /MP")
SET(ep_common_CXX_FLAGS "${CMAKE_CXX_FLAGS} /bigobj /MP")
ELSE()
SET(ep_common_C_FLAGS "${CMAKE_C_FLAGS} -DLINUX_EXTRA")
SET(ep_common_CXX_FLAGS "${CMAKE_CXX_FLAGS} -DLINUX_EXTRA")
ENDIF()
SET(ep_common_args
-DBUILD_TESTING:BOOL=${ep_build_testing}
-DCMAKE_INSTALL_PREFIX:PATH=${ep_install_dir}
-DBUILD_SHARED_LIBS:BOOL=ON
-DCMAKE_BUILD_TYPE:STRING=${CMAKE_BUILD_TYPE}
-DCMAKE_C_COMPILER:FILEPATH=${CMAKE_C_COMPILER}
-DCMAKE_CXX_COMPILER:FILEPATH=${CMAKE_CXX_COMPILER}
-DCMAKE_C_FLAGS:STRING=${ep_common_C_FLAGS}
-DCMAKE_CXX_FLAGS:STRING=${ep_common_CXX_FLAGS}
#debug flags
-DCMAKE_CXX_FLAGS_DEBUG:STRING=${CMAKE_CXX_FLAGS_DEBUG}
-DCMAKE_C_FLAGS_DEBUG:STRING=${CMAKE_C_FLAGS_DEBUG}
#release flags
-DCMAKE_CXX_FLAGS_RELEASE:STRING=${CMAKE_CXX_FLAGS_RELEASE}
-DCMAKE_C_FLAGS_RELEASE:STRING=${CMAKE_C_FLAGS_RELEASE}
#relwithdebinfo
-DCMAKE_CXX_FLAGS_RELWITHDEBINFO:STRING=${CMAKE_CXX_FLAGS_RELWITHDEBINFO}
-DCMAKE_C_FLAGS_RELWITHDEBINFO:STRING=${CMAKE_C_FLAGS_RELWITHDEBINFO}
)
#-----------------------------------------------------------------------------
# ExternalProjects
#-----------------------------------------------------------------------------
SET(external_projects
VTK
GDCM
ITK
Boost
DCMTK
CTK
OpenCV
MITKData
)
# Include external projects
FOREACH(p ${external_projects})
INCLUDE(CMakeExternals/${p}.cmake)
ENDFOREACH()
#-----------------------------------------------------------------------------
# Set superbuild boolean args
#-----------------------------------------------------------------------------
SET(mitk_cmake_boolean_args
BUILD_SHARED_LIBS
WITH_COVERAGE
BUILD_TESTING
MITK_USE_QT
- MITK_INSTALL_RPATH_RELATIVE
MITK_BUILD_ALL_PLUGINS
MITK_BUILD_TUTORIAL
MITK_USE_Boost
MITK_USE_BLUEBERRY
MITK_USE_CTK
MITK_USE_DCMTK
MITK_USE_OpenCV
)
-
-#-----------------------------------------------------------------------------
-# Generate cmake variable names for MITK bundles
-#-----------------------------------------------------------------------------
-
-INCLUDE(mitkSuperBuildPlugins)
-FOREACH(plugin ${MITK_SUPERBUILD_PLUGINS})
- LIST(APPEND mitk_cmake_boolean_args MITK_BUILD_${plugin})
- OPTION(MITK_BUILD_${plugin} "Build the MITK ${plugin} plugin" OFF)
-ENDFOREACH()
#-----------------------------------------------------------------------------
# Create the final variable containing superbuild boolean args
#-----------------------------------------------------------------------------
SET(mitk_superbuild_boolean_args)
FOREACH(mitk_cmake_arg ${mitk_cmake_boolean_args})
LIST(APPEND mitk_superbuild_boolean_args -D${mitk_cmake_arg}:BOOL=${${mitk_cmake_arg}})
ENDFOREACH()
IF(MITK_BUILD_ALL_PLUGINS)
LIST(APPEND mitk_superbuild_boolean_args -DBLUEBERRY_BUILD_ALL_PLUGINS:BOOL=ON)
ENDIF()
#-----------------------------------------------------------------------------
# MITK Utilities
#-----------------------------------------------------------------------------
set(proj MITK-Utilities)
ExternalProject_Add(${proj}
DOWNLOAD_COMMAND ""
CONFIGURE_COMMAND ""
BUILD_COMMAND ""
INSTALL_COMMAND ""
DEPENDS
# Mandatory dependencies
${VTK_DEPENDS}
${ITK_DEPENDS}
# Optionnal dependencies
${Boost_DEPENDS}
${CTK_DEPENDS}
${DCMTK_DEPENDS}
${OpenCV_DEPENDS}
${MITK-Data_DEPENDS}
)
#-----------------------------------------------------------------------------
# MITK Configure
#-----------------------------------------------------------------------------
IF(MITK_INITIAL_CACHE_FILE)
SET(mitk_initial_cache_arg -C "${MITK_INITIAL_CACHE_FILE}")
ENDIF()
SET(proj MITK-Configure)
+STRING(REPLACE ";" "^^" MITK_MODULES_TO_BUILD_PARAM "${MITK_MODULES_TO_BUILD}")
+MESSAGE("PARAM: ${MITK_MODULES_TO_BUILD_PARAM}")
ExternalProject_Add(${proj}
+ LIST_SEPARATOR ^^
DOWNLOAD_COMMAND ""
CMAKE_GENERATOR ${gen}
- CMAKE_ARGS
+ CMAKE_CACHE_ARGS
${ep_common_args}
${mitk_superbuild_boolean_args}
-DMITK_USE_SUPERBUILD:BOOL=OFF
-DMITK_CMAKE_LIBRARY_OUTPUT_DIRECTORY:PATH=${MITK_CMAKE_LIBRARY_OUTPUT_DIRECTORY}
-DMITK_CMAKE_RUNTIME_OUTPUT_DIRECTORY:PATH=${MITK_CMAKE_RUNTIME_OUTPUT_DIRECTORY}
-DMITK_CMAKE_ARCHIVE_OUTPUT_DIRECTORY:PATH=${MITK_CMAKE_ARCHIVE_OUTPUT_DIRECTORY}
-DCTEST_USE_LAUNCHERS:BOOL=${CTEST_USE_LAUNCHERS}
+ -DMITK_CTEST_SCRIPT_MODE:STRING=${MITK_CTEST_SCRIPT_MODE}
-DMITK_SUPERBUILD_BINARY_DIR:PATH=${MITK_BINARY_DIR}
-DQT_QMAKE_EXECUTABLE:FILEPATH=${QT_QMAKE_EXECUTABLE}
-DMITK_KWSTYLE_EXECUTABLE:FILEPATH=${MITK_KWSTYLE_EXECUTABLE}
+ -DMITK_MODULES_TO_BUILD:INTERNAL=${MITK_MODULES_TO_BUILD_PARAM}
-DCTK_DIR:PATH=${CTK_DIR}
-DDCMTK_DIR:PATH=${DCMTK_DIR}
-DVTK_DIR:PATH=${VTK_DIR} # FindVTK expects VTK_DIR
-DITK_DIR:PATH=${ITK_DIR} # FindITK expects ITK_DIR
-DOpenCV_DIR:PATH=${OpenCV_DIR}
-DGDCM_DIR:PATH=${GDCM_DIR}
-DBOOST_ROOT:PATH=${BOOST_ROOT}
-DMITK_DATA_DIR:PATH=${MITK_DATA_DIR}
+ -DMITK_ACCESSBYITK_INTEGRAL_PIXEL_TYPES:STRING=${MITK_ACCESSBYITK_INTEGRAL_PIXEL_TYPES}
+ -DMITK_ACCESSBYITK_FLOATING_PIXEL_TYPES:STRING=${MITK_ACCESSBYITK_FLOATING_PIXEL_TYPES}
+ -DMITK_ACCESSBYITK_COMPOSITE_PIXEL_TYPES:STRING=${MITK_ACCESSBYITK_COMPOSITE_PIXEL_TYPES}
+ -DMITK_ACCESSBYITK_DIMENSIONS:STRING=${MITK_ACCESSBYITK_DIMENSIONS}
${mitk_initial_cache_arg}
SOURCE_DIR ${CMAKE_CURRENT_SOURCE_DIR}
BINARY_DIR ${CMAKE_BINARY_DIR}/MITK-build
BUILD_COMMAND ""
INSTALL_COMMAND ""
DEPENDS
MITK-Utilities
)
#-----------------------------------------------------------------------------
# MITK
#-----------------------------------------------------------------------------
#MESSAGE(STATUS SUPERBUILD_EXCLUDE_MITKBUILD_TARGET:${SUPERBUILD_EXCLUDE_MITKBUILD_TARGET})
IF(NOT DEFINED SUPERBUILD_EXCLUDE_MITKBUILD_TARGET OR NOT SUPERBUILD_EXCLUDE_MITKBUILD_TARGET)
SET(proj MITK-build)
ExternalProject_Add(${proj}
DOWNLOAD_COMMAND ""
CMAKE_GENERATOR ${gen}
SOURCE_DIR ${CMAKE_CURRENT_SOURCE_DIR}
BINARY_DIR MITK-build
INSTALL_COMMAND ""
DEPENDS
"MITK-Configure"
)
ENDIF()
#-----------------------------------------------------------------------------
# Custom target allowing to drive the build of MITK project itself
#-----------------------------------------------------------------------------
ADD_CUSTOM_TARGET(MITK
COMMAND ${CMAKE_COMMAND} --build ${CMAKE_CURRENT_BINARY_DIR}/MITK-build
WORKING_DIRECTORY ${CMAKE_CURRENT_BINARY_DIR}/MITK-build
)
diff --git a/Utilities/IIL4MITK/picimage.cpp b/Utilities/IIL4MITK/picimage.cpp
index 2149c18eff..69a5aa75b4 100644
--- a/Utilities/IIL4MITK/picimage.cpp
+++ b/Utilities/IIL4MITK/picimage.cpp
@@ -1,633 +1,633 @@
#include <assert.h>
#include "texture.h"
#include "picimage.h"
#include <cmath>
iil4mitkPicImage::iil4mitkPicImage (unsigned int size)
: iil4mitkImage(size), _pic (NULL), _min (0.0), _max (0.0), _colors (NULL), _binary (false), _mask (false), _outline(false), _outlineWidth(1.0)
{
}
iil4mitkPicImage::~iil4mitkPicImage ()
{
}
void
-iil4mitkPicImage::setImage (mitkIpPicDescriptor* pic, int model)
+iil4mitkPicImage::setPicImage (mitkIpPicDescriptor* pic, int model)
{
assert (pic);
assert (pic->dim >= 2);
_pic = pic;
iil4mitkImage::setImage (pic->n[0], pic->n[1], model, (unsigned char *) pic->data);
}
mitkIpPicDescriptor*
iil4mitkPicImage::image () const
{
return _pic;
}
void
iil4mitkPicImage::setExtrema (const float minimum, const float maximum)
{
// assert (minimum < maximum);
_min = minimum;
_max = maximum;
invalidateTextures ();
}
void
iil4mitkPicImage::setWindow (const float level, const float window)
{
// assert (window > 0);
_min = level - window / 2.0;
_max = _min + window;
invalidateTextures ();
}
float
iil4mitkPicImage::minimum () const
{
return _min;
}
float
iil4mitkPicImage::maximum () const
{
return _max;
}
float
iil4mitkPicImage::level () const
{
return (_min + _max) / 2.0;
}
float
iil4mitkPicImage::window () const
{
return (_max - _min);
}
void
iil4mitkPicImage::setOpacityExtrema (const float minimum, const float maximum)
{
// assert (minimum < maximum);
_minOpac = minimum;
_maxOpac = maximum;
invalidateTextures ();
}
void
iil4mitkPicImage::setOpacityWindow (const float level, const float window)
{
// assert (window > 0);
_minOpac = level - window / 2.0;
_maxOpac = _minOpac + window;
invalidateTextures ();
}
float
iil4mitkPicImage::minimumOpacity () const
{
return _minOpac;
}
float
iil4mitkPicImage::maximumOpacity () const
{
return _maxOpac;
}
float
iil4mitkPicImage::levelOpacity () const
{
return (_minOpac + _maxOpac) / 2.0;
}
float
iil4mitkPicImage::windowOpacity () const
{
return (_maxOpac - _minOpac);
}
void
iil4mitkPicImage::setColors (const unsigned char* colors)
{
_colors = colors;
}
const unsigned char*
iil4mitkPicImage::colors () const
{
return _colors;
}
void
iil4mitkPicImage::setBinary (const bool on)
{
if (_binary != on) {
if (on) {
_mask = false;
}
_binary = on;
invalidateTextures ();
}
}
bool
iil4mitkPicImage::binary () const
{
return _binary;
}
void
iil4mitkPicImage::setOutline (const bool on)
{
if (_binary) {
_outline = on;
}
}
void
iil4mitkPicImage::setOutlineWidth(float width)
{
if (_binary) {
_outlineWidth = width;
}
}
bool
iil4mitkPicImage::outline () const
{
return _outline;
}
void
iil4mitkPicImage::setMask (const bool on)
{
if (_mask != on) {
if (on) {
_binary = false;
}
_mask = on;
invalidateTextures ();
}
}
bool
iil4mitkPicImage::mask () const
{
return _mask;
}
void
iil4mitkPicImage::clear ()
{
_pic = NULL;
_min = _max = 0.0;
_minOpac = _maxOpac = 0.0;
_colors = NULL;
_binary = false;
_mask = false;
_outline = false;
iil4mitkImage::clear ();
}
iil4mitkPicImage*
iil4mitkPicImage::find (const iil4mitkItem* item)
{
iil4mitkPicImage* result = NULL;
if (!item) return NULL;
if ( dynamic_cast<const iil4mitkPicImage*>(item)!=NULL ) {
result = const_cast<iil4mitkPicImage*>(dynamic_cast<const iil4mitkPicImage*>(item));
}
return result;
}
#define MASK_INTENSITIES(TYPE, PIC) \
{ \
TYPE* source = (TYPE *) src; \
unsigned char* dest = dst; \
register float a; \
if (model () == INTENSITY) \
while (dest < eol) { \
a = source [0] * scale - bias; \
*dest = (a > 255.0 ? 0 : (a < 0.0 ? 0 : 255)); \
source++; \
dest++; \
} else \
if (model () == INTENSITY_ALPHA) \
while (dest < eol) { \
a = source [0] * scale - bias; \
dest [1] = dest [0] = (a > 255.0 ? 0 : (a < 0.0 ? 0 : 255)); \
source++; \
dest += 2; \
} \
}
#define BINARY_INTENSITIES(TYPE, PIC) \
{ \
TYPE* source = (TYPE *) src; \
unsigned char* dest = dst; \
register float a; \
if (model () == INTENSITY) \
while (dest < eol) { \
a = source [0] * scale - bias; \
*dest = (a > 255.0 ? 255 : (a < 0.0 ? 0 : 255)); \
source++; \
dest++; \
} else \
if (model () == INTENSITY_ALPHA) \
while (dest < eol) { \
a = source [0] * scale - bias; \
dest [0] = (a > 255.0 ? 255 : (a < 0.0 ? 0 : 255)); \
dest [1] = (a > 0.0 ? 255 : 0); \
source++; \
dest += 2; \
} \
}
#define LIMIT_INTENSITIES(TYPE, PIC) \
{ \
TYPE* source = (TYPE *) src; \
unsigned char* dest = dst; \
register unsigned int i; \
register float a,b,c,d; \
if (model () == INTENSITY) \
while (dest < eol) { \
a = source [0] * scale - bias; \
*dest = (a > 255.0 ? 255 : (a < 0.0 ? 0 : (unsigned char) a)); \
source++; \
dest++; \
} else \
if (model () == INTENSITY_ALPHA) \
while (dest < eol) { \
a = source [0] * scale - bias; \
dest [0] = (a > 255.0 ? 255 : (a < 0.0 ? 0 : (unsigned char) a)); \
dest [1] = (a > 0.0 ? 255 : 0); \
source++; \
dest += 2; \
} else \
if ((model () == COLOR) && _colors) \
while (dest < eol) { \
a = source [0] * scale - bias; \
i = (a > 255.0 ? 255 : (a < 0.0 ? 0 : (unsigned char) a)); \
dest [0] = _colors [i*3]; \
dest [1] = _colors [i*3+1]; \
dest [2] = _colors [i*3+2]; \
source++; \
dest += 3; \
} else \
if ((model () == COLOR_ALPHA) && _colors) \
while (dest < eol) { \
a = source [0] * scale - bias; \
i = (a > 255.0 ? 255 : (a < 0.0 ? 0 : (unsigned char) a)); \
dest [0] = _colors [i*4 ]; \
dest [1] = _colors [i*4+1]; \
dest [2] = _colors [i*4+2]; \
dest [3] = _colors [i*4+3]; \
source++; \
dest += 4; \
} else \
if ((model () == COLOR) && !_colors) \
while (dest < eol) { \
a = source [0] * scale - bias; \
b = source [slice] * scale - bias; \
c = source [2*slice] * scale - bias; \
dest [0] = (a > 255.0 ? 255 : (a < 0.0 ? 0 : (unsigned char) a)); \
dest [1] = (b > 255.0 ? 255 : (b < 0.0 ? 0 : (unsigned char) b)); \
dest [2] = (c > 255.0 ? 255 : (c < 0.0 ? 0 : (unsigned char) c)); \
source++; \
dest += 3; \
} \
if ((model () == COLOR_ALPHA) && !_colors) \
{ \
a = source [0] * scale - bias; \
b = source [slice] * scale - bias; \
c = source [2*slice] * scale - bias; \
d = source [3*slice] * scale - bias; \
dest [0] = (a > 255.0 ? 255 : (a < 0.0 ? 0 : (unsigned char) a)); \
dest [1] = (b > 255.0 ? 255 : (b < 0.0 ? 0 : (unsigned char) b)); \
dest [2] = (c > 255.0 ? 255 : (c < 0.0 ? 0 : (unsigned char) c)); \
dest [3] = (d > 255.0 ? 255 : (d < 0.0 ? 0 : (unsigned char) d)); \
source++; \
dest += 4; \
} \
}
// prototype
#ifdef USE_MMX
#define MAXSHORT 32767
static void extrema (unsigned char* dst, short* src, const unsigned int num, const short minimum, const short maximum)
{
const short low = -1024;
const short up = MAXSHORT - (maximum - low);
const short down = (minimum - low) + up;
const short scale = (255.0f/(float) (maximum-minimum)) * 256;
const short values [] = {
low, // lowest value
low,
low,
low,
up, // saturate above
up,
up,
up,
down, // saturate below
down,
down,
down,
scale, // scale
scale,
scale,
scale
};
const unsigned int n = num / 16;
__asm__ __volatile__ (
".align 16 \n\t"
"l1: \n\t"
"prefetcht0 64(%1) \n\t"
"movq (%1),%%mm0 \n\t"
"movq 8(%1),%%mm1 \n\t"
"psubsw (%2),%%mm0 \n\t"
"psubsw (%2),%%mm1 \n\t"
"paddsw 8(%2),%%mm0 \n\t"
"paddsw 8(%2),%%mm1 \n\t"
"psubusw 16(%2),%%mm0 \n\t"
"psubusw 16(%2),%%mm1 \n\t"
"pmullw 24(%2),%%mm0 \n\t"
"pmullw 24(%2),%%mm1 \n\t"
"psrlw $8,%%mm0 \n\t"
"psrlw $8,%%mm1 \n\t"
"packuswb %%mm1,%%mm0 \n\t"
"movntq %%mm0,(%0) \n\t"
"movq 16(%1),%%mm2 \n\t"
"movq 24(%1),%%mm3 \n\t"
"psubsw (%2),%%mm2 \n\t"
"psubsw (%2),%%mm3 \n\t"
"paddsw 8(%2),%%mm2 \n\t"
"paddsw 8(%2),%%mm3 \n\t"
"psubusw 16(%2),%%mm2 \n\t"
"psubusw 16(%2),%%mm3 \n\t"
"pmullw 24(%2),%%mm2 \n\t"
"pmullw 24(%2),%%mm3 \n\t"
"psrlw $8,%%mm2 \n\t"
"psrlw $8,%%mm3 \n\t"
"packuswb %%mm3,%%mm2 \n\t"
"movntq %%mm2,8(%0) \n\t"
"emms \n\t"
"add $16,%0 \n\t"
"add $32,%1 \n\t"
"dec %3 \n\t"
"jnz l1 \n\t"
"emms \n\t"
:
:"r" (dst), "r" (src), "r" (values), "r" (n)
);
}
#endif
#ifndef PIC_IMAGE_PI
#define PIC_IMAGE_PI 3.141592653589
#endif
// Convert color pixels from (R,G,B) to (H,S,I).
// Reference: "Digital Image Processing, 2nd. edition", R. Gonzalez and R. Woods. Prentice Hall, 2002.
template<class T>
void RGBtoHSI(T* RGB, T* HSI) {
T R = RGB[0],
G = RGB[1],
B = RGB[2],
nR = (R<0?0:(R>255?255:R))/255,
nG = (G<0?0:(G>255?255:G))/255,
nB = (B<0?0:(B>255?255:B))/255,
m = nR<nG?(nR<nB?nR:nB):(nG<nB?nG:nB),
theta = (T)(std::acos(0.5f*((nR-nG)+(nR-nB))/std::sqrt(std::pow(nR-nG,2)+(nR-nB)*(nG-nB)))*180/PIC_IMAGE_PI),
sum = nR + nG + nB;
T H = 0, S = 0, I = 0;
if (theta>0) H = (nB<=nG)?theta:360-theta;
if (sum>0) S = 1 - 3/sum*m;
I = sum/3;
HSI[0] = (T)H;
HSI[1] = (T)S;
HSI[2] = (T)I;
}
// Convert color pixels from (H,S,I) to (R,G,B).
template<class T>
void HSItoRGB(T* HSI, T* RGB) {
T H = (T)HSI[0],
S = (T)HSI[1],
I = (T)HSI[2],
a = I*(1-S),
R = 0, G = 0, B = 0;
if (H<120) {
B = a;
R = (T)(I*(1+S*std::cos(H*PIC_IMAGE_PI/180)/std::cos((60-H)*PIC_IMAGE_PI/180)));
G = 3*I-(R+B);
} else if (H<240) {
H-=120;
R = a;
G = (T)(I*(1+S*std::cos(H*PIC_IMAGE_PI/180)/std::cos((60-H)*PIC_IMAGE_PI/180)));
B = 3*I-(R+G);
} else {
H-=240;
G = a;
B = (T)(I*(1+S*std::cos(H*PIC_IMAGE_PI/180)/std::cos((60-H)*PIC_IMAGE_PI/180)));
R = 3*I-(G+B);
}
R*=255; G*=255; B*=255;
RGB[0] = (T)(R<0?0:(R>255?255:R));
RGB[1] = (T)(G<0?0:(G>255?255:G));
RGB[2] = (T)(B<0?0:(B>255?255:B));
}
void iil4mitkPicImage::copyImage (unsigned int x, unsigned int y, unsigned int w, unsigned int h, unsigned char* data, unsigned int width, unsigned int, unsigned int xoffset, unsigned int yoffset)
{
assert (_pic);
// assert (_min <= _max);
unsigned int slice = _pic->n[0] * _pic->n[1] * (_pic->bpe / 8);
float scale = (_max -_min > 0 ? 255.0 / (_max - _min) : 0.0);
float bias = _min * scale;
float scaleOpac = (_maxOpac -_minOpac > 0 ? 255.0 / (_maxOpac - _minOpac) : 0.0);
float biasOpac = _minOpac * scaleOpac;
unsigned char *src = (unsigned char *) _pic->data + (y * _pic->n[0] + x) * (_pic->bpe/8);
unsigned char *dst = data + (yoffset * width + xoffset) * (bpe () / 8);
unsigned char *eol = dst + w * (bpe () / 8);
//printf ("updateTexture: start = (%u/%u), end = (%u/%u), length = (%u/%u)\n", x, y, x+w-1, y+h-1, w, h);
for (unsigned int i = 0; i < h; i++) {
// copy current line
if (model () == RGB)
{
unsigned char* source = (unsigned char *) src;
unsigned char* dest = dst;
while (dest < eol)
{
if(_min!=0 || _max!=255)
{
// level/window mechanism for intensity in HSI space
double rgb[3], hsi[3];
rgb[0] = source[0];
rgb[1] = source[1];
rgb[2] = source[2];
RGBtoHSI<double>(rgb,hsi);
hsi[2] = hsi[2] * 255.0 * scale - bias;
hsi[2] = (hsi[2] > 255.0 ? 255 : (hsi[2] < 0.0 ? 0 : hsi[2]));
hsi[2] /= 255.0;
HSItoRGB<double>(hsi,rgb);
dest[0] = (unsigned char)rgb[0];
dest[1] = (unsigned char)rgb[1];
dest[2] = (unsigned char)rgb[2];
source+=3;
dest+=3;
}
else
{
*dest = *source;
++source;
++dest;
}
}
}
else if (model () == RGBA)
{
unsigned char* source = (unsigned char *) src;
unsigned char* dest = dst;
while (dest < eol)
{
if(_min!=0 || _max!=255 || _minOpac!=0 || _maxOpac!=255)
{
double rgb[3], alpha, hsi[3];
// level/window mechanism for intensity in HSI space
rgb[0] = source[0];
rgb[1] = source[1];
rgb[2] = source[2];
alpha = source[3];
RGBtoHSI<double>(rgb,hsi);
hsi[2] = hsi[2] * 255.0 * scale - bias;
hsi[2] = (hsi[2] > 255.0 ? 255 : (hsi[2] < 0.0 ? 0 : hsi[2]));
hsi[2] /= 255.0;
HSItoRGB<double>(hsi,rgb);
// level/window mechanism for opacity
alpha = alpha * scaleOpac - biasOpac;
alpha = (alpha > 255.0 ? 255 : (alpha < 0.0 ? 0 : alpha));
dest[0] = (unsigned char)rgb[0];
dest[1] = (unsigned char)rgb[1];
dest[2] = (unsigned char)rgb[2];
dest[3] = (unsigned char)alpha;
source+=4;
dest+=4;
}
else
{
*dest = *source;
++source;
++dest;
}
}
} else
if (mask ()) {
mitkIpPicFORALL(MASK_INTENSITIES, _pic);
} else
if (binary ()) {
mitkIpPicFORALL(BINARY_INTENSITIES, _pic);
} else {
#ifdef USE_MMX
if (mitkIpPicDR(_pic->type, _pic->bpe) == mitkIpPicDR(mitkIpPicInt, 16)) {
unsigned char* d = dst;
unsigned char* s = src;
if (w / 16) {
extrema (dst, (short *) src, w, (short) _min, (short) _max);
}
if (w % 16) {
mitkIpPicFORALL(LIMIT_INTENSITIES, _pic);
dst = d;
src = s;
}
} else {
mitkIpPicFORALL(LIMIT_INTENSITIES, _pic);
}
#else
mitkIpPicFORALL(LIMIT_INTENSITIES, _pic);
#endif
}
// go to next line
src += _pic->n[0] * (_pic->bpe/8);
dst += width * (bpe () / 8);
eol = dst + w * (bpe () / 8);
}
}
void
iil4mitkPicImage::display (iil4mitkWidget* widget)
{
if (!_outline) {
iil4mitkImage::display( widget );
}
else {
glMatrixMode (GL_MODELVIEW);
glPushMatrix ();
glColor4f ( red(), green(), blue(), alpha() );
//glColor4f( 1.0, 0.0, 0.0, 1.0 );
glTranslatef( x(), y(), 0.0 );
glLineWidth(_outlineWidth);
glBegin( GL_LINES );
int line = _pic->n[0];
float fLine = (float)line;
float x=0.0, y=0.0;
mitkIpInt1_t *current;
mitkIpInt1_t *end = ((mitkIpInt1_t*)_pic->data) + (_pic->n[0]*_pic->n[1]);
int ii = 0, nn = _pic->n[0]*_pic->n[1];
for (current = (mitkIpInt1_t*)_pic->data; current<end; current++, ii++) {
if (*current != 0) {
if (ii >= line && *(current-line) == 0) {
glVertex3f( x, y, 0.0 );
glVertex3f( x+1.0, y, 0.0 );
}
if (ii <= nn-line && *(current+line) == 0) {
glVertex3f( x, y+1.0, 0.0 );
glVertex3f( x+1.0, y+1.0, 0.0 );
}
if (ii > 1 && *(current-1) == 0) {
glVertex3f( x, y, 0.0 );
glVertex3f( x, y+1.0, 0.0 );
}
if (ii < nn-1 && *(current+1) == 0) {
glVertex3f( x+1.0, y, 0.0 );
glVertex3f( x+1.0, y+1.0, 0.0 );
}
}
x += 1.0;
if (x >= fLine) {
x = 0.0;
y += 1.0;
}
}
glEnd ();
glLineWidth(1.0f);
glPopMatrix ();
}
}
diff --git a/Utilities/IIL4MITK/picimage.h b/Utilities/IIL4MITK/picimage.h
index 696f875c9a..6408df5deb 100644
--- a/Utilities/IIL4MITK/picimage.h
+++ b/Utilities/IIL4MITK/picimage.h
@@ -1,226 +1,226 @@
#ifndef _PIC_IMAGE_H_
#define _PIC_IMAGE_H_
#include <mitkIpPic.h>
#include "image.h"
/*!
\brief The class adds support for PIC images by providing a proper interface
to map the intensity range to the physical one of the display.
*/
class iil4mitkPicImage : public iil4mitkImage {
public:
/*!
\brief The constructor.
*/
iil4mitkPicImage (unsigned int size = 128);
/*!
\brief The destructor.
*/
virtual ~iil4mitkPicImage ();
/*!
\brief Sets the PIC image.
@param pic the PIC image
@param model the color model
\note Is the model needed here?
*/
- void setImage (mitkIpPicDescriptor* pic, int model = INTENSITY);
+ void setPicImage (mitkIpPicDescriptor* pic, int model = INTENSITY);
/*!
\brief Gets the PIC image.
*/
mitkIpPicDescriptor* image () const;
/*!
\brief Sets the range of the intensities which will be displayed.
@param minimum the minimal intensity
@param maximum the maximal intensity
*/
void setExtrema (const float minimum, const float maximum);
/*!
\brief Sets the range of the intensities which will be displayed.
@param level the level of the window
@param window the width of the window
*/
void setWindow (const float level, const float window);
/*!
\brief Gets the minimal intensity which will be displayed.
*/
float minimum () const;
/*!
\brief Gets the maximal intensity which will be displayed.
*/
float maximum () const;
/*!
\brief Gets the level of the window which limits the
displayed intensities.
*/
float level () const;
/*!
\brief Gets the width of the window which limits the
displayed intensities.
*/
float window () const;
/*!
\brief Sets the range of opacity values which will be displayed.
@param minimum the minimal opacity
@param maximum the maximal opacity
*/
void setOpacityExtrema (const float minimum, const float maximum);
/*!
\brief Sets the range of the opacities which will be displayed.
@param level the level of the window
@param window the width of the window
*/
void setOpacityWindow (const float level, const float window);
/*!
\brief Gets the minimal opacity which will be displayed.
*/
float minimumOpacity () const;
/*!
\brief Gets the maximal opacity which will be displayed.
*/
float maximumOpacity () const;
/*!
\brief Gets the level of the window which limits the
displayed opacities.
*/
float levelOpacity () const;
/*!
\brief Gets the width of the window which limits the
displayed opacities.
*/
float windowOpacity () const;
/*!
\brief Sets the color map which assigns each intensity
a color according to the color model.
@param colors the array of colors using either the
RGB format or RGBA format which depends on the color
model.
*/
void setColors (const unsigned char* colors);
/*!
\brief Gets the color map.
*/
const unsigned char* colors () const;
/*!
\brief Sets the binary flag which forces the data
to be converted into a binary image.
*/
void setBinary (const bool on);
/*!
\brief Checks if the binary flag is set.
*/
bool binary () const;
/*!
\brief Sets the outline flag which forces the data
to be displayed as outline. Only possible with binary data!
*/
void setOutline (const bool on);
/*!
\brief Sets the line width used to draw the binary
outline. Requires the outline flag to be set via setOutline(true) first.
*/
void setOutlineWidth (float width);
/*!
\brief Checks if the outline flag is set.
*/
bool outline () const;
/*!
\brief Sets the mask flag which ensures that
only pixels are displayed which are in the
intensity window.
*/
void setMask (const bool on);
/*!
\brief Checks if the mask flag is set.
*/
bool mask () const;
public:
virtual void clear ();
virtual void display (iil4mitkWidget* widget);
public:
/*!
\brief Gets the first image of the item tree.
*/
static iil4mitkPicImage* find (const iil4mitkItem* item);
protected:
virtual void copyImage (unsigned int x, unsigned int y, unsigned int w, unsigned int h, unsigned char* data, unsigned int width, unsigned int height, unsigned int xoffset, unsigned int yoffset);
private:
/*!
\brief The PIC image.
*/
mitkIpPicDescriptor* _pic;
/*!
\brief The extremal values.
*/
float _min, _max;
/*!
\brief The extremal opacity values.
*/
float _minOpac, _maxOpac;
/*!
\brief The color map.
*/
const unsigned char* _colors;
/*!
\brief The binary flag. If the flag is set, the data
will be displayed as a binary image.
*/
bool _binary;
/*!
\brief The mask flag. If the flag is set, the data
which is in the defined intensity window will be shown
as a binary image. In contrast to the binary flag,
the upper values are set to zero.
*/
bool _mask;
/*!
\brief The outline flag. If the flag is set, the binary data
will be displayed with lines showing the outline.
*/
bool _outline;
/*!
\brief If the outline flag is set, this attribute controls the line width
*/
float _outlineWidth;
};
#endif
diff --git a/mitkConfig.h.in b/mitkConfig.h.in
index 8ca3344777..76743f7327 100644
--- a/mitkConfig.h.in
+++ b/mitkConfig.h.in
@@ -1,20 +1,43 @@
/*
mitkConfig.h
this file is generated. Do not change!
*/
+
+#ifndef MITKCONFIG_H
+#define MITKCONFIG_H
+
#define MITK_ROOT "${PROJECT_SOURCE_DIR}/"
#cmakedefine MITK_BUILD_SHARED_CORE
#cmakedefine USE_ITKZLIB
#cmakedefine MITK_CHILI_PLUGIN
#cmakedefine MITK_USE_TD_MOUSE
+#define MITK_ACCESSBYITK_INTEGRAL_PIXEL_TYPES @MITK_ACCESSBYITK_INTEGRAL_PIXEL_TYPES@
+#define MITK_ACCESSBYITK_FLOATING_PIXEL_TYPES @MITK_ACCESSBYITK_FLOATING_PIXEL_TYPES@
+#define MITK_ACCESSBYITK_COMPOSITE_PIXEL_TYPES @MITK_ACCESSBYITK_COMPOSITE_PIXEL_TYPES@
+#define MITK_ACCESSBYITK_PIXEL_TYPES @MITK_ACCESSBYITK_PIXEL_TYPES@
+
+#define MITK_ACCESSBYITK_INTEGRAL_PIXEL_TYPES_SEQ @MITK_ACCESSBYITK_INTEGRAL_PIXEL_TYPES_SEQ@
+#define MITK_ACCESSBYITK_FLOATING_PIXEL_TYPES_SEQ @MITK_ACCESSBYITK_FLOATING_PIXEL_TYPES_SEQ@
+#define MITK_ACCESSBYITK_COMPOSITE_PIXEL_TYPES_SEQ @MITK_ACCESSBYITK_COMPOSITE_PIXEL_TYPES_SEQ@
+#define MITK_ACCESSBYITK_PIXEL_TYPES_SEQ @MITK_ACCESSBYITK_PIXEL_TYPES_SEQ@
+
+#define MITK_ACCESSBYITK_DIMENSIONS @MITK_ACCESSBYITK_DIMENSIONS@
+#define MITK_ACCESSBYITK_DIMENSIONS_SEQ @MITK_ACCESSBYITK_DIMENSIONS_SEQ@
+
+#define MITK_ACCESSBYITK_INTEGRAL_TYPES_DIMN_SEQ(dim) @MITK_ACCESSBYITK_INTEGRAL_TYPES_DIMN_SEQ@
+#define MITK_ACCESSBYITK_FLOATING_TYPES_DIMN_SEQ(dim) @MITK_ACCESSBYITK_FLOATING_TYPES_DIMN_SEQ@
+#define MITK_ACCESSBYITK_COMPOSITE_TYPES_DIMN_SEQ(dim) @MITK_ACCESSBYITK_COMPOSITE_TYPES_DIMN_SEQ@
+#define MITK_ACCESSBYITK_TYPES_DIMN_SEQ(dim) @MITK_ACCESSBYITK_TYPES_DIMN_SEQ@
+
#define MITK_CHILI_PLUGIN_SDK_IPPIC_H "@MITK_CHILI_PLUGIN_SDK_IPPIC_H@"
#define MITK_CHILI_PLUGIN_SDK_IPTYPES_H "@MITK_CHILI_PLUGIN_SDK_IPTYPES_H@"
#define MITK_DOXYGEN_OUTPUT_DIR "@MITK_DOXYGEN_OUTPUT_DIR@"
#define MITK_HELPPAGES_OUTPUT_DIR "@MITK_HELPPAGES_OUTPUT_DIR@"
#define MITK_VERSION_MAJOR @MITK_VERSION_MAJOR@
#define MITK_VERSION_MINOR @MITK_VERSION_MINOR@
#define MITK_VERSION_PATCH @MITK_VERSION_PATCH@
#define MITK_VERSION_STRING "@MITK_VERSION_STRING@"
+#endif // MITKCONFIG_H
diff --git a/mitkVersion.h.in b/mitkVersion.h.in
index ae0b3e454f..22e09c05bf 100644
--- a/mitkVersion.h.in
+++ b/mitkVersion.h.in
@@ -1,8 +1,8 @@
/*
mitkVersion.h
this file is generated. Do not change!
*/
-#define MITK_REVISION "@MITK_WC_REVISION_HASH@"
-#define MITK_REVISION_NAME "@MITK_WC_REVISION_NAME@"
+#define MITK_REVISION "@MITK_REVISION_ID@"
+#define MITK_REVISION_NAME "@MITK_REVISION_NAME@"

File Metadata

Mime Type
application/octet-stream
Expires
Tue, Oct 1, 3:19 AM (2 d)
Storage Engine
chunks
Storage Format
Chunks
Storage Handle
a2sDt3diCD3G
Default Alt Text
(5 MB)

Event Timeline