diff --git a/Plugins/org.mitk.core.ext/src/internal/mitkCoreExtActivator.cpp b/Plugins/org.mitk.core.ext/src/internal/mitkCoreExtActivator.cpp
index 695c963ce2..446c3d8ee6 100755
--- a/Plugins/org.mitk.core.ext/src/internal/mitkCoreExtActivator.cpp
+++ b/Plugins/org.mitk.core.ext/src/internal/mitkCoreExtActivator.cpp
@@ -1,78 +1,77 @@
-/*=========================================================================
+/*===================================================================
-Program: BlueBerry Platform
-Language: C++
-Date: $Date$
-Version: $Revision: 17020 $
+The Medical Imaging Interaction Toolkit (MITK)
-Copyright (c) German Cancer Research Center, Division of Medical and
-Biological Informatics. All rights reserved.
-See MITKCopyright.txt or http://www.mitk.org/copyright.html for details.
+Copyright (c) German Cancer Research Center,
+Division of Medical and Biological Informatics.
+All rights reserved.
-This software is distributed WITHOUT ANY WARRANTY; without even
-the implied warranty of MERCHANTABILITY or FITNESS FOR A PARTICULAR
-PURPOSE. See the above copyright notices for more information.
+This software is distributed WITHOUT ANY WARRANTY; without
+even the implied warranty of MERCHANTABILITY or FITNESS FOR
+A PARTICULAR PURPOSE.
-=========================================================================*/
+See LICENSE.txt or http://www.mitk.org for details.
+
+===================================================================*/
#include "mitkCoreExtActivator.h"
#include "mitkPicFileReader.h"
#include
#include "mitkCoreExtConstants.h"
#include "mitkInputDeviceRegistry.h"
#include
#include
#include
namespace mitk
{
void CoreExtActivator::start(ctkPluginContext* context)
{
Q_UNUSED(context)
// see bug 10816
// don't let the linker optimize the dependency away
mitk::PicFileReader::New();
RegisterCoreExtObjectFactory();
this->StartInputDeviceModules();
}
void CoreExtActivator::stop(ctkPluginContext* context)
{
Q_UNUSED(context)
}
void mitk::CoreExtActivator::StartInputDeviceModules()
{
IInputDeviceRegistry::Pointer inputDeviceRegistry(new mitk::InputDeviceRegistry());
berry::Platform::GetServiceRegistry().RegisterService(
mitk::CoreExtConstants::INPUTDEVICE_SERVICE,
inputDeviceRegistry);
// Gets the last setting of the preferences; if a device was selected,
// it will still be activated after a restart
berry::IPreferencesService::Pointer prefService = berry::Platform::GetServiceRegistry()
.GetServiceById(berry::IPreferencesService::ID);
berry::IPreferences::Pointer extPreferencesNode =
prefService->GetSystemPreferences()->Node(CoreExtConstants::INPUTDEVICE_PREFERENCES);
// Initializes the modules
std::vector descriptors(inputDeviceRegistry->GetInputDevices());
for (std::vector::const_iterator it = descriptors.begin();
it != descriptors.end(); ++it)
{
if (extPreferencesNode->GetBool((*it)->GetID(), false))
{
IInputDevice::Pointer temp = (*it)->CreateInputDevice();
temp->RegisterInputDevice();
}
}
} // end method StartInputDeviceModules
} // end namespace mitk
Q_EXPORT_PLUGIN2(org_mitk_core_ext, mitk::CoreExtActivator)
diff --git a/Plugins/org.mitk.core.ext/src/internal/mitkCoreExtActivator.h b/Plugins/org.mitk.core.ext/src/internal/mitkCoreExtActivator.h
index 4e3d873dee..8e4af29c03 100755
--- a/Plugins/org.mitk.core.ext/src/internal/mitkCoreExtActivator.h
+++ b/Plugins/org.mitk.core.ext/src/internal/mitkCoreExtActivator.h
@@ -1,64 +1,63 @@
-/*=========================================================================
+/*===================================================================
-Program: MITK Platform
-Language: C++
-Date: $Date$
-Version: $Revision: 17020 $
+The Medical Imaging Interaction Toolkit (MITK)
-Copyright (c) German Cancer Research Center, Division of Medical and
-Biological Informatics. All rights reserved.
-See MITKCopyright.txt or http://www.mitk.org/copyright.html for details.
+Copyright (c) German Cancer Research Center,
+Division of Medical and Biological Informatics.
+All rights reserved.
-This software is distributed WITHOUT ANY WARRANTY; without even
-the implied warranty of MERCHANTABILITY or FITNESS FOR A PARTICULAR
-PURPOSE. See the above copyright notices for more information.
+This software is distributed WITHOUT ANY WARRANTY; without
+even the implied warranty of MERCHANTABILITY or FITNESS FOR
+A PARTICULAR PURPOSE.
-=========================================================================*/
+See LICENSE.txt or http://www.mitk.org for details.
+
+===================================================================*/
#ifndef MITKCOREEXTACTIVATOR_H_
#define MITKCOREEXTACTIVATOR_H_
#include
#include
#include
namespace mitk
{
/**
* @brief The activator class for the org.mitk.core.ext plug-in.
* @ingroup org_mitk_core_ext_internal
*
* When the plug-in is started by the framework, it calls a global function to initialize
* the mitkCoreExt module.
*
*/
class MITK_LOCAL CoreExtActivator : public QObject, public ctkPluginActivator
{
Q_OBJECT
Q_INTERFACES(ctkPluginActivator)
public:
/**
* Starts this plug-in and registers object factories.
*
* @param context
* The context for the plug-in.
*/
void start(ctkPluginContext* context);
void stop(ctkPluginContext* context);
private:
/**
* Activates the input device modules.
*/
void StartInputDeviceModules();
}; // end class CoreExtActivator
} //end namespace mitk
#endif /* MITKCOREEXTACTIVATOR_H_ */
diff --git a/Plugins/org.mitk.core.ext/src/mitkCoreExtConstants.cpp b/Plugins/org.mitk.core.ext/src/mitkCoreExtConstants.cpp
index f492b8291f..f3d2d2474f 100644
--- a/Plugins/org.mitk.core.ext/src/mitkCoreExtConstants.cpp
+++ b/Plugins/org.mitk.core.ext/src/mitkCoreExtConstants.cpp
@@ -1,31 +1,30 @@
-/*=========================================================================
+/*===================================================================
-Program: Medical Imaging & Interaction Toolkit
-Language: C++
-Date: $Date$
-Version: $Revision$
+The Medical Imaging Interaction Toolkit (MITK)
-Copyright (c) German Cancer Research Center, Division of Medical and
-Biological Informatics. All rights reserved.
-See MITKCopyright.txt or http://www.mitk.org/copyright.html for details.
+Copyright (c) German Cancer Research Center,
+Division of Medical and Biological Informatics.
+All rights reserved.
-This software is distributed WITHOUT ANY WARRANTY; without even
-the implied warranty of MERCHANTABILITY or FITNESS FOR A PARTICULAR
-PURPOSE. See the above copyright notices for more information.
+This software is distributed WITHOUT ANY WARRANTY; without
+even the implied warranty of MERCHANTABILITY or FITNESS FOR
+A PARTICULAR PURPOSE.
-=========================================================================*/
+See LICENSE.txt or http://www.mitk.org for details.
+
+===================================================================*/
#include
#include "mitkIInputDeviceRegistry.h"
const std::string mitk::CoreExtConstants::INPUTDEVICE_SERVICE = "org.mitk.core.ext.services.inputdeviceregistry";
const std::string mitk::CoreExtConstants::INPUTDEVICE_PREFERENCES = "org.mitk.core.ext.preferences.inputdevices";
const std::string mitk::CoreExtConstants::INPUTDEVICE_EXTENSION_NAME = "org.mitk.core.ext.inputdevices";
const std::string mitk::CoreExtConstants::INPUTDEVICE_XMLATTRIBUTE_CLASS = "class";
const std::string mitk::CoreExtConstants::INPUTDEVICE_XMLATTRIBUTE_DESCRIPTION = "description";
const std::string mitk::CoreExtConstants::INPUTDEVICE_XMLATTRIBUTE_NAME = "name";
const std::string mitk::CoreExtConstants::INPUTDEVICE_XMLATTRIBUTE_ID = "id";
const std::string mitk::CoreExtConstants::WIIMOTE_SURFACEINTERACTION = "Surface Interaction";
const std::string mitk::CoreExtConstants::WIIMOTE_HEADTRACKING = "Headtracking";
const std::string mitk::CoreExtConstants::WIIMOTE_XMLATTRIBUTE_NAME = "org.mitk.inputdevices.wiimote";
diff --git a/Plugins/org.mitk.core.ext/src/mitkCoreExtConstants.h b/Plugins/org.mitk.core.ext/src/mitkCoreExtConstants.h
index 4b7cae4abd..7c75b53d78 100644
--- a/Plugins/org.mitk.core.ext/src/mitkCoreExtConstants.h
+++ b/Plugins/org.mitk.core.ext/src/mitkCoreExtConstants.h
@@ -1,54 +1,53 @@
-/*=========================================================================
+/*===================================================================
-Program: Medical Imaging & Interaction Toolkit
-Language: C++
-Date: $Date$
-Version: $Revision$
+The Medical Imaging Interaction Toolkit (MITK)
-Copyright (c) German Cancer Research Center, Division of Medical and
-Biological Informatics. All rights reserved.
-See MITKCopyright.txt or http://www.mitk.org/copyright.html for details.
+Copyright (c) German Cancer Research Center,
+Division of Medical and Biological Informatics.
+All rights reserved.
-This software is distributed WITHOUT ANY WARRANTY; without even
-the implied warranty of MERCHANTABILITY or FITNESS FOR A PARTICULAR
-PURPOSE. See the above copyright notices for more information.
+This software is distributed WITHOUT ANY WARRANTY; without
+even the implied warranty of MERCHANTABILITY or FITNESS FOR
+A PARTICULAR PURPOSE.
-=========================================================================*/
+See LICENSE.txt or http://www.mitk.org for details.
+
+===================================================================*/
#ifndef MITKCOREEXTCONSTANTS_H_
#define MITKCOREEXTCONSTANTS_H_
#include
#include
namespace mitk
{
/**
* The CoreExt Constants contains a list of unique ids in the following form:
* "org.mitk.mybundle.mytype.propername"
*
* This ids have the purpose of connecting the plugin.xml of each bundle to the
* appropriate classes.
*
* Additionally it includes names of tags, which are used in XML files
* regarding any input device.
*
* @ingroup org_mitk_core_ext
*/
struct MITKCOREEXT_EXPORT CoreExtConstants
{
static const std::string INPUTDEVICE_SERVICE;
static const std::string INPUTDEVICE_PREFERENCES;
static const std::string INPUTDEVICE_EXTENSION_NAME;
static const std::string INPUTDEVICE_XMLATTRIBUTE_CLASS;
static const std::string INPUTDEVICE_XMLATTRIBUTE_DESCRIPTION;
static const std::string INPUTDEVICE_XMLATTRIBUTE_NAME;
static const std::string INPUTDEVICE_XMLATTRIBUTE_ID;
static const std::string WIIMOTE_SURFACEINTERACTION;
static const std::string WIIMOTE_HEADTRACKING;
static const std::string WIIMOTE_XMLATTRIBUTE_NAME;
};
}
#endif /*MITKCOREEXTCONSTANTS_H_*/
diff --git a/Plugins/org.mitk.core.ext/src/mitkIInputDevice.h b/Plugins/org.mitk.core.ext/src/mitkIInputDevice.h
index ca8ae7603a..18409df634 100644
--- a/Plugins/org.mitk.core.ext/src/mitkIInputDevice.h
+++ b/Plugins/org.mitk.core.ext/src/mitkIInputDevice.h
@@ -1,57 +1,56 @@
-/*=========================================================================
+/*===================================================================
-Program: Medical Imaging & Interaction Toolkit
-Language: C++
-Date: $Date$
-Version: $Revision$
+The Medical Imaging Interaction Toolkit (MITK)
-Copyright (c) German Cancer Research Center, Division of Medical and
-Biological Informatics. All rights reserved.
-See MITKCopyright.txt or http://www.mitk.org/copyright.html for details.
+Copyright (c) German Cancer Research Center,
+Division of Medical and Biological Informatics.
+All rights reserved.
-This software is distributed WITHOUT ANY WARRANTY; without even
-the implied warranty of MERCHANTABILITY or FITNESS FOR A PARTICULAR
-PURPOSE. See the above copyright notices for more information.
+This software is distributed WITHOUT ANY WARRANTY; without
+even the implied warranty of MERCHANTABILITY or FITNESS FOR
+A PARTICULAR PURPOSE.
-=========================================================================*/
+See LICENSE.txt or http://www.mitk.org for details.
+
+===================================================================*/
#ifndef MITKIINPUTDEVICE_H_
#define MITKIINPUTDEVICE_H_
#include
#include
#include
namespace mitk
{
/**
* An input device provides a method to register and unregister itself. Meaning
* for example adding listeners and instianciate classes necessary to use the input device.
*
* @noimplement This interface is not intended to be implemented by clients.
* @ingroup org_mitk_core_ext
*/
struct IInputDevice : public berry::Object
{
berryInterfaceMacro(IInputDevice, mitk)
/**
* Register the input device at one or more instances.
*/
virtual bool RegisterInputDevice() = 0;
/**
* Unregister the input device at one or more instances.
*/
virtual bool UnRegisterInputDevice() = 0;
virtual ~IInputDevice() {}
}; // end struct IInputDevice
} // end namespace mitk
Q_DECLARE_INTERFACE(mitk::IInputDevice, "org.mitk.IInputDevice")
#endif /*MITKIINPUTDEVICE_H_*/
diff --git a/Plugins/org.mitk.core.ext/src/mitkIInputDeviceDescriptor.h b/Plugins/org.mitk.core.ext/src/mitkIInputDeviceDescriptor.h
index 25126d6239..a6fad2681c 100644
--- a/Plugins/org.mitk.core.ext/src/mitkIInputDeviceDescriptor.h
+++ b/Plugins/org.mitk.core.ext/src/mitkIInputDeviceDescriptor.h
@@ -1,95 +1,94 @@
-/*=========================================================================
+/*===================================================================
-Program: BlueBerry Platform
-Language: C++
-Date: $Date: 2010-01-16 19:57:43 +0100 (Sat, 16 Jan 2010) $
-Version: $Revision: 21070 $
+The Medical Imaging Interaction Toolkit (MITK)
-Copyright (c) German Cancer Research Center, Division of Medical and
-Biological Informatics. All rights reserved.
-See MITKCopyright.txt or http://www.mitk.org/copyright.html for details.
+Copyright (c) German Cancer Research Center,
+Division of Medical and Biological Informatics.
+All rights reserved.
-This software is distributed WITHOUT ANY WARRANTY; without even
-the implied warranty of MERCHANTABILITY or FITNESS FOR A PARTICULAR
-PURPOSE. See the above copyright notices for more information.
+This software is distributed WITHOUT ANY WARRANTY; without
+even the implied warranty of MERCHANTABILITY or FITNESS FOR
+A PARTICULAR PURPOSE.
-=========================================================================*/
+See LICENSE.txt or http://www.mitk.org for details.
+
+===================================================================*/
#ifndef MITKIINPUTDEVICEDESCRIPTOR_H_
#define MITKIINPUTDEVICEDESCRIPTOR_H_
#include
#include
#include
#include
#include "mitkIInputDevice.h"
namespace mitk
{
/**
* This is an input device descriptor. It provides a "description" of a given
* input device, so that the input device can later be constructed and registered.
*
* The input device registry provides facilities to map from an extension
* to a IInputDeviceDescriptor.
*
*
* This interface is not intended to be implemented by clients.
*
*
* @see mitk::IInputDeviceRegistry
* @ingroup org_mitk_core_ext
*/
struct IInputDeviceDescriptor : public berry::Object
{
berryInterfaceMacro(IInputDeviceDescriptor, mitk);
/**
* Creates an instance of an input device defined in the descriptor.
*
* @return the input device
*/
virtual IInputDevice::Pointer CreateInputDevice() = 0;
/**
* Returns the description of this input device.
*
* @return the description
*/
virtual std::string GetDescription() const = 0;
/**
* Returns the id of this input device.
*
* @return the id
*/
virtual std::string GetID() const = 0;
/**
* Returns the name of this input device.
*
* @return the name
*/
virtual std::string GetName() const = 0;
// /**
// * Returns the descriptor for the icon to show for this view.
// */
//virtual SmartPointer GetImageDescriptor() const = 0;
/**
* Equals this class with the given parameter.
*
* @param object
* the object for the equation
* @return true, if the objects are equal :: false, if they differ in any way
*/
virtual bool operator==(const Object* object) const = 0;
}; // end struct IInputDeviceDescriptor
} //end namespace mitk
#endif /*MITKIINPUTDEVICEDESCRIPTOR_H_*/
diff --git a/Plugins/org.mitk.core.ext/src/mitkIInputDeviceRegistry.h b/Plugins/org.mitk.core.ext/src/mitkIInputDeviceRegistry.h
index 2c02905d65..4c1f1e0bf9 100644
--- a/Plugins/org.mitk.core.ext/src/mitkIInputDeviceRegistry.h
+++ b/Plugins/org.mitk.core.ext/src/mitkIInputDeviceRegistry.h
@@ -1,77 +1,76 @@
-/*=========================================================================
+/*===================================================================
-Program: Medical Imaging & Interaction Toolkit
-Language: C++
-Date: $Date$
-Version: $Revision$
+The Medical Imaging Interaction Toolkit (MITK)
-Copyright (c) German Cancer Research Center, Division of Medical and
-Biological Informatics. All rights reserved.
-See MITKCopyright.txt or http://www.mitk.org/copyright.html for details.
+Copyright (c) German Cancer Research Center,
+Division of Medical and Biological Informatics.
+All rights reserved.
-This software is distributed WITHOUT ANY WARRANTY; without even
-the implied warranty of MERCHANTABILITY or FITNESS FOR A PARTICULAR
-PURPOSE. See the above copyright notices for more information.
+This software is distributed WITHOUT ANY WARRANTY; without
+even the implied warranty of MERCHANTABILITY or FITNESS FOR
+A PARTICULAR PURPOSE.
-=========================================================================*/
+See LICENSE.txt or http://www.mitk.org for details.
+
+===================================================================*/
#ifndef MITKIINPUTDEVICEREGISTRY_H_
#define MITKIINPUTDEVICEREGISTRY_H_
#include
#include
#include
#include
#include
#include "mitkIInputDeviceDescriptor.h"
namespace mitk
{
/**
*
* The input device registry maintains a list of input devices explicitly registered
* against the view extension point.
*
* The description of a given input device is kept in a IInputDeviceDescriptor
.
*
*
* This interface is not intended to be implemented by clients.
*
*
* @see mitk::IInputDeviceDescriptor
* @noimplement This interface is not intended to be implemented by clients.
* @ingroup org_mitk_core_ext
*/
struct MITKCOREEXT_EXPORT IInputDeviceRegistry: public berry::Service
{
berryInterfaceMacro(IInputDeviceRegistry, mitk)
/**
* Return an input device descriptor with the given extension id. If no input device exists,
* with the id return null
.
*
* @param id
* the id to search for
* @return the descriptor or null
*/
virtual IInputDeviceDescriptor::Pointer Find(const std::string& id) const = 0;
/**
* Return a list of input devices defined in the registry.
*
* @return the input devices.
*/
virtual std::vector GetInputDevices() const = 0;
virtual ~IInputDeviceRegistry() {}
}; // end struct IInputDeviceRegistry
} // end namespace mitk
Q_DECLARE_INTERFACE(mitk::IInputDeviceRegistry, "org.mitk.service.IInputDeviceRegistry")
#endif /*MITKIINPUTDEVICEREGISTRY_H_*/
diff --git a/Plugins/org.mitk.core.ext/src/mitkInputDeviceDescriptor.cpp b/Plugins/org.mitk.core.ext/src/mitkInputDeviceDescriptor.cpp
index d98d818f4b..3074328660 100644
--- a/Plugins/org.mitk.core.ext/src/mitkInputDeviceDescriptor.cpp
+++ b/Plugins/org.mitk.core.ext/src/mitkInputDeviceDescriptor.cpp
@@ -1,84 +1,83 @@
-/*=========================================================================
+/*===================================================================
-Program: Medical Imaging & Interaction Toolkit
-Language: C++
-Date: $Date$
-Version: $Revision$
+The Medical Imaging Interaction Toolkit (MITK)
-Copyright (c) German Cancer Research Center, Division of Medical and
-Biological Informatics. All rights reserved.
-See MITKCopyright.txt or http://www.mitk.org/copyright.html for details.
+Copyright (c) German Cancer Research Center,
+Division of Medical and Biological Informatics.
+All rights reserved.
-This software is distributed WITHOUT ANY WARRANTY; without even
-the implied warranty of MERCHANTABILITY or FITNESS FOR A PARTICULAR
-PURPOSE. See the above copyright notices for more information.
+This software is distributed WITHOUT ANY WARRANTY; without
+even the implied warranty of MERCHANTABILITY or FITNESS FOR
+A PARTICULAR PURPOSE.
-=========================================================================*/
+See LICENSE.txt or http://www.mitk.org for details.
+
+===================================================================*/
#include "mitkInputDeviceDescriptor.h"
#include "mitkCoreExtConstants.h"
mitk::InputDeviceDescriptor::InputDeviceDescriptor(berry::IConfigurationElement::Pointer inputDeviceExtensionPoint)
: IInputDeviceDescriptor(), m_InputDeviceExtensionPoint(inputDeviceExtensionPoint)
{
}
mitk::InputDeviceDescriptor::~InputDeviceDescriptor()
{
}
mitk::IInputDevice::Pointer mitk::InputDeviceDescriptor::CreateInputDevice()
{
if(this->m_InputDevice == 0)
{
// "class" refers to xml attribute in a xml tag
this->m_InputDevice = this->m_InputDeviceExtensionPoint
->CreateExecutableExtension(mitk::CoreExtConstants::INPUTDEVICE_XMLATTRIBUTE_CLASS);
if (this->m_InputDevice == 0)
{
// support legacy BlueBerry extensions
this->m_InputDevice = this->m_InputDeviceExtensionPoint
->CreateExecutableExtension(
mitk::CoreExtConstants::INPUTDEVICE_XMLATTRIBUTE_CLASS,
IInputDevice::GetManifestName());
}
}
return this->m_InputDevice;
}
std::string mitk::InputDeviceDescriptor::GetID() const
{
std::string idOfExtensionPoint;
this->m_InputDeviceExtensionPoint->GetAttribute(mitk::CoreExtConstants::INPUTDEVICE_XMLATTRIBUTE_ID,idOfExtensionPoint);
return idOfExtensionPoint;
}
std::string mitk::InputDeviceDescriptor::GetDescription() const
{
std::vector
descriptions(this->m_InputDeviceExtensionPoint->GetChildren(mitk::CoreExtConstants::INPUTDEVICE_XMLATTRIBUTE_DESCRIPTION));
if(!descriptions.empty())
{
return descriptions[0]->GetValue();
}
return "";
}
std::string mitk::InputDeviceDescriptor::GetName() const
{
std::string name;
this->m_InputDeviceExtensionPoint->GetAttribute(mitk::CoreExtConstants::INPUTDEVICE_XMLATTRIBUTE_NAME,name);
return name;
}
bool mitk::InputDeviceDescriptor::operator==(const Object* object) const
{
if (const InputDeviceDescriptor* other = dynamic_cast(object))
{
return this->GetID() == other->GetID();
}
return false;
}
diff --git a/Plugins/org.mitk.core.ext/src/mitkInputDeviceDescriptor.h b/Plugins/org.mitk.core.ext/src/mitkInputDeviceDescriptor.h
index ca40817db1..2b030df9f2 100644
--- a/Plugins/org.mitk.core.ext/src/mitkInputDeviceDescriptor.h
+++ b/Plugins/org.mitk.core.ext/src/mitkInputDeviceDescriptor.h
@@ -1,88 +1,87 @@
-/*=========================================================================
+/*===================================================================
-Program: Medical Imaging & Interaction Toolkit
-Language: C++
-Date: $Date$
-Version: $Revision$
+The Medical Imaging Interaction Toolkit (MITK)
-Copyright (c) German Cancer Research Center, Division of Medical and
-Biological Informatics. All rights reserved.
-See MITKCopyright.txt or http://www.mitk.org/copyright.html for details.
+Copyright (c) German Cancer Research Center,
+Division of Medical and Biological Informatics.
+All rights reserved.
-This software is distributed WITHOUT ANY WARRANTY; without even
-the implied warranty of MERCHANTABILITY or FITNESS FOR A PARTICULAR
-PURPOSE. See the above copyright notices for more information.
+This software is distributed WITHOUT ANY WARRANTY; without
+even the implied warranty of MERCHANTABILITY or FITNESS FOR
+A PARTICULAR PURPOSE.
-=========================================================================*/
+See LICENSE.txt or http://www.mitk.org for details.
+
+===================================================================*/
#ifndef MITKINPUTDEVICEDESCRIPTOR_H_
#define MITKINPUTDEVICEDESCRIPTOR_H_
#include
#include
#include "mitkIInputDeviceDescriptor.h"
#include "mitkIInputDevice.h"
namespace mitk
{
/**
* Documentation in the interface.
*
* @see mitk::IInputDeviceDescriptor
* @ingroup org_mitk_core_ext
*/
class InputDeviceDescriptor : public IInputDeviceDescriptor
{
public:
/**
* Initialize the Input Device Descriptor with the given extension point.
*
* @param inputDeviceExtensionPoint
* element, that refers to a extension point (type, id, name, class)
*/
InputDeviceDescriptor(berry::IConfigurationElement::Pointer inputDeviceExtensionPoint);
/**
* Default destructor
*/
~InputDeviceDescriptor();
/**
* @see mitk::IInputDeviceDescriptor::CreateInputDevice()
*/
mitk::IInputDevice::Pointer CreateInputDevice();
/**
* @see mitk::IInputDeviceDescriptor::GetDescription()
*/
std::string GetDescription() const;
/**
* @see mitk::IInputDeviceDescriptor::GetID()
*/
std::string GetID() const;
/**
* @see mitk::IInputDeviceDescriptor::GetName()
*/
std::string GetName() const;
/**
* @see mitk::IInputDeviceDescriptor::operator==(const Object* object)
*/
bool operator==(const Object* object) const;
private:
// IConfigurationElements are used to access xml files (here: plugin.xml)
berry::IConfigurationElement::Pointer m_InputDeviceExtensionPoint;
mitk::IInputDevice::Pointer m_InputDevice;
}; // end class
} // end namespace
#endif /*MITKINPUTDEVICEDESCRIPTOR_H_*/
diff --git a/Plugins/org.mitk.core.ext/src/mitkInputDeviceRegistry.cpp b/Plugins/org.mitk.core.ext/src/mitkInputDeviceRegistry.cpp
index 28966b038e..a062b8cabe 100644
--- a/Plugins/org.mitk.core.ext/src/mitkInputDeviceRegistry.cpp
+++ b/Plugins/org.mitk.core.ext/src/mitkInputDeviceRegistry.cpp
@@ -1,86 +1,85 @@
-/*=========================================================================
+/*===================================================================
-Program: Medical Imaging & Interaction Toolkit
-Language: C++
-Date: $Date$
-Version: $Revision$
+The Medical Imaging Interaction Toolkit (MITK)
-Copyright (c) German Cancer Research Center, Division of Medical and
-Biological Informatics. All rights reserved.
-See MITKCopyright.txt or http://www.mitk.org/copyright.html for details.
+Copyright (c) German Cancer Research Center,
+Division of Medical and Biological Informatics.
+All rights reserved.
-This software is distributed WITHOUT ANY WARRANTY; without even
-the implied warranty of MERCHANTABILITY or FITNESS FOR A PARTICULAR
-PURPOSE. See the above copyright notices for more information.
+This software is distributed WITHOUT ANY WARRANTY; without
+even the implied warranty of MERCHANTABILITY or FITNESS FOR
+A PARTICULAR PURPOSE.
-=========================================================================*/
+See LICENSE.txt or http://www.mitk.org for details.
+
+===================================================================*/
#include
#include
#include
#include
#include
#include "mitkCoreExtConstants.h"
mitk::InputDeviceRegistry::InputDeviceRegistry()
{
//initialize the registry by copying all available extension points into a local variable
berry::IExtensionPointService::Pointer extensionPointService = berry::Platform::GetExtensionPointService();
std::vector allExtensionsInputDevices
= extensionPointService->GetConfigurationElementsFor(mitk::CoreExtConstants::INPUTDEVICE_EXTENSION_NAME);
for(std::vector::const_iterator it = allExtensionsInputDevices.begin();
it != allExtensionsInputDevices.end();++it)
{
InputDeviceDescriptorPtr temp(new mitk::InputDeviceDescriptor(*it));
// The equation with the end means, that if there is no such element and
// the pointer will be at end (not the last element, actually after it)
if(this->m_ListRegisteredDevices.find(temp->GetID()) == this->m_ListRegisteredDevices.end())
{
m_ListRegisteredDevices.insert(std::make_pair(temp->GetID(),temp));
}
else
{
throw std::runtime_error("The Input Device ID: "+temp->GetID()+" is already registered.");
}
}
}
mitk::InputDeviceRegistry::~InputDeviceRegistry()
{
}
mitk::InputDeviceRegistry::InputDeviceDescriptorPtr mitk::InputDeviceRegistry::Find(const std::string &id) const
{
Poco::HashMap::ConstIterator result = this->m_ListRegisteredDevices.find(id);
// first = key, second = element or vice versa, if inserted different in the hash map
if(result != this->m_ListRegisteredDevices.end()) return result->second;
return InputDeviceDescriptorPtr(0);
}
std::vector mitk::InputDeviceRegistry::GetInputDevices() const
{
std::vector temp;
for(Poco::HashMap::ConstIterator it = m_ListRegisteredDevices.begin();
it != m_ListRegisteredDevices.end();++it)
{
// first = key, second = element or vice versa, if inserted different in the hash map
temp.push_back(it->second);
}
return temp;
}
bool mitk::InputDeviceRegistry::IsA(const std::type_info& type) const
{
std::string name(GetType().name());
return name == type.name() || berry::Service::IsA(type);
}
const std::type_info& mitk::InputDeviceRegistry::GetType() const
{
return typeid(IInputDeviceRegistry);
}
diff --git a/Plugins/org.mitk.core.ext/src/mitkInputDeviceRegistry.h b/Plugins/org.mitk.core.ext/src/mitkInputDeviceRegistry.h
index 3e990240fd..775d107477 100644
--- a/Plugins/org.mitk.core.ext/src/mitkInputDeviceRegistry.h
+++ b/Plugins/org.mitk.core.ext/src/mitkInputDeviceRegistry.h
@@ -1,67 +1,66 @@
-/*=========================================================================
+/*===================================================================
-Program: Medical Imaging & Interaction Toolkit
-Language: C++
-Date: $Date$
-Version: $Revision$
+The Medical Imaging Interaction Toolkit (MITK)
-Copyright (c) German Cancer Research Center, Division of Medical and
-Biological Informatics. All rights reserved.
-See MITKCopyright.txt or http://www.mitk.org/copyright.html for details.
+Copyright (c) German Cancer Research Center,
+Division of Medical and Biological Informatics.
+All rights reserved.
-This software is distributed WITHOUT ANY WARRANTY; without even
-the implied warranty of MERCHANTABILITY or FITNESS FOR A PARTICULAR
-PURPOSE. See the above copyright notices for more information.
+This software is distributed WITHOUT ANY WARRANTY; without
+even the implied warranty of MERCHANTABILITY or FITNESS FOR
+A PARTICULAR PURPOSE.
-=========================================================================*/
+See LICENSE.txt or http://www.mitk.org for details.
+
+===================================================================*/
#ifndef MITKSPACENAVIGATORREGISTRY_H_
#define MITKSPACENAVIGATORREGISTRY_H_
#include
#include
#include
#include
#include
namespace mitk
{
/**
* Documentation in the interface.
*
* @see mitk::IInputDeviceRegistry
* @ingroup org_mitk_core_ext
*/
class InputDeviceRegistry : public IInputDeviceRegistry
{
public:
bool IsA(const std::type_info& type) const;
const std::type_info& GetType() const;
// easier maintenance
typedef IInputDeviceDescriptor::Pointer InputDeviceDescriptorPtr;
InputDeviceRegistry();
~InputDeviceRegistry();
/**
* @see mitk::IInputDeviceRegistry::Find(const std::string& id)
*/
InputDeviceDescriptorPtr Find(const std::string& id) const;
/**
* @see mitk::IInputDeviceRegistry´::GetInputDevices()
*/
std::vector GetInputDevices() const;
protected:
private:
Poco::HashMap m_ListRegisteredDevices;
}; // end class InputDeviceRegistry
} // end namespace mitk
#endif /*MITKSPACENAVIGATORREGISTRY_H_*/
diff --git a/Plugins/org.mitk.core.jobs/src/internal/mitkDataStorageAccessRule.cpp b/Plugins/org.mitk.core.jobs/src/internal/mitkDataStorageAccessRule.cpp
index d7160aa205..14929dfc76 100644
--- a/Plugins/org.mitk.core.jobs/src/internal/mitkDataStorageAccessRule.cpp
+++ b/Plugins/org.mitk.core.jobs/src/internal/mitkDataStorageAccessRule.cpp
@@ -1,197 +1,196 @@
-/*=========================================================================
+/*===================================================================
-Program: Medical Imaging & Interaction Toolkit
-Language: C++
-Date: $Date$
-Version: $Revision: 18503 $
+The Medical Imaging Interaction Toolkit (MITK)
-Copyright (c) German Cancer Research Center, Division of Medical and
-Biological Informatics. All rights reserved.
-See MITKCopyright.txt or http://www.mitk.org/copyright.html for details.
+Copyright (c) German Cancer Research Center,
+Division of Medical and Biological Informatics.
+All rights reserved.
-This software is distributed WITHOUT ANY WARRANTY; without even
-the implied warranty of MERCHANTABILITY or FITNESS FOR A PARTICULAR
-PURPOSE. See the above copyright notices for more information.
+This software is distributed WITHOUT ANY WARRANTY; without
+even the implied warranty of MERCHANTABILITY or FITNESS FOR
+A PARTICULAR PURPOSE.
-=========================================================================*/
+See LICENSE.txt or http://www.mitk.org for details.
+
+===================================================================*/
#include "mitkDataStorageAccessRule.h"
#include
mitk::DataStorageAccessRule
::DataStorageAccessRule (mitk::DataStorage::Pointer myDataStorage, mitk::DataNode::Pointer myDataNode,
mitk::DataStorageAccessRule::RuleType myRule)
:m_Rule(myRule),
m_sptrMyDataStorage(myDataStorage),
m_sptrMyDataNode(myDataNode)
{
mitk::DataStorage::SetOfObjects::ConstPointer
sptr_parentsNodesFirstRule = m_sptrMyDataStorage->GetSources(m_sptrMyDataNode);
// checks if the DataNode does exists within the specified DataTree, if not an
// Poco NotFoundException is thrown since the rule is useless
bool exsists = false ;
for(mitk::DataStorage::SetOfObjects::const_iterator it =
sptr_parentsNodesFirstRule->begin(); it != sptr_parentsNodesFirstRule->end(); ++ it)
{
if (*it == m_sptrMyDataNode ) exsists = true ;
}
if (exsists == false) throw Poco::NotFoundException() ;
}
bool
mitk::DataStorageAccessRule
::Contains(berry::ISchedulingRule::Pointer rule) const
{
DataStorageAccessRule::Pointer sptr_temp = rule.Cast();
// test if the ISchedulingRule is a DataStorageAccessRule
if( sptr_temp == 0 ) return false ;
// test if the DataStorageAccessRule object is exactly the instance
else {
if ( this == sptr_temp.GetPointer() ) return true ;
return false ;
}
}
bool
mitk::DataStorageAccessRule
::IsConflicting(berry::ISchedulingRule::Pointer sptr_otherISchedulingRule) const
{
// test if the stored dataNode
// cast to check if the ISchedulingRule is a DataStorageAccessRule
DataStorageAccessRule::Pointer sptr_DataStorageAccessRule = sptr_otherISchedulingRule.Cast();
// checks if the Rule of the type ISchedulingRule is a DataStorageAccessRule
if(sptr_DataStorageAccessRule == 0) return false ;
// the rule to be compared with is a DataStorageAccessRule
else
{
// testing if both jobs holding each rule do operate on the same DataStorage if not false is returned
if( !CompareDataStorages(sptr_DataStorageAccessRule->GetDataStorage()) ) return false ;
// checks if to rules to be compared are two add rules
if (m_Rule == ADD_RULE && m_Rule == sptr_DataStorageAccessRule->GetRuleType())
return CompareTwoAddorRemoveRules() ;
// checks if to the two rules to be compared are two remove rules
if(m_Rule == REMOVE_RULE && m_Rule == sptr_DataStorageAccessRule->GetRuleType())
return CompareTwoAddorRemoveRules() ;
// an add and remove rule needs to be compared
else
{
return CompareAddandRemoveRules(sptr_DataStorageAccessRule) ;
}
}
}
bool
mitk::DataStorageAccessRule
::CompareAddandRemoveRules(mitk::DataStorageAccessRule::Pointer sptr_otherDataStorageAccessRule) const
{
mitk::DataStorage::SetOfObjects::ConstPointer
sptr_parentsNodesFirstRule = m_sptrMyDataStorage->GetSources(m_sptrMyDataNode);
// checks if the DataStorageNode of to be compared DataStorageAccessRule is a parent node
// if so the job holding this DataStorageAccessRule need to wait until the operation on the parent node is performed
for(mitk::DataStorage::SetOfObjects::const_iterator it =
sptr_parentsNodesFirstRule->begin(); it != sptr_parentsNodesFirstRule->end(); ++ it)
{
if (*it == sptr_otherDataStorageAccessRule->GetDataNode()) return true ;
}
mitk::DataStorage::SetOfObjects::ConstPointer
sptr_derivedNodesRule = m_sptrMyDataStorage->GetDerivations(m_sptrMyDataNode);
// checks if the DataStorage node of to be compared DataStorageAccessRule is a child node
// if so the job holding this DataStorageAccessRule needs to wait until the operation on the parent node is performed
for(mitk::DataStorage::SetOfObjects::const_iterator it =
sptr_derivedNodesRule->begin(); it != sptr_derivedNodesRule->end(); ++it)
{
if(*it == sptr_otherDataStorageAccessRule->GetDataNode()) return true ;
}
// jobs operating on nodes on different branches do not cause conflicts thus they can be performed in different
// threads concurrently
return false ;
}
bool
mitk::DataStorageAccessRule
::CompareDataStorages(mitk::DataStorage::Pointer otherDataStorage) const
{
if(m_sptrMyDataStorage == otherDataStorage) return true ;
else return false;
}
bool
mitk::DataStorageAccessRule
::CompareTwoAddorRemoveRules() const
{
return false ;
}
bool
mitk::DataStorageAccessRule
::TestDataNode(mitk::DataNode::Pointer /*dataTreeToBeStored*/) const
{
mitk::DataStorage::SetOfObjects::ConstPointer tempAllNodes = m_sptrMyDataStorage->GetAll();
for(mitk::DataStorage::SetOfObjects::const_iterator it = tempAllNodes->begin(); it !=tempAllNodes->end(); ++ it){
if (m_sptrMyDataNode == *it ) return true ;
}
return false ;
}
mitk::DataNode::Pointer
mitk::DataStorageAccessRule
::GetDataNode() const
{
return mitk::DataStorageAccessRule::m_sptrMyDataNode ;
}
mitk::DataStorage::Pointer
mitk::DataStorageAccessRule
::GetDataStorage() const
{
return mitk::DataStorageAccessRule::m_sptrMyDataStorage ;
}
mitk::DataStorageAccessRule::RuleType
mitk::DataStorageAccessRule
::GetRuleType() const
{
if (m_Rule == ADD_RULE)
return ( mitk::DataStorageAccessRule::ADD_RULE ) ;
else {
return ( mitk::DataStorageAccessRule::REMOVE_RULE ) ;
}
}
diff --git a/Plugins/org.mitk.core.jobs/src/mitkDataStorageAccessRule.h b/Plugins/org.mitk.core.jobs/src/mitkDataStorageAccessRule.h
index a77a81d62f..a6fd080021 100644
--- a/Plugins/org.mitk.core.jobs/src/mitkDataStorageAccessRule.h
+++ b/Plugins/org.mitk.core.jobs/src/mitkDataStorageAccessRule.h
@@ -1,159 +1,158 @@
-/*=========================================================================
+/*===================================================================
-Program: Medical Imaging & Interaction Toolkit
-Language: C++
-Date: $Date$
-Version: $Revision$
+The Medical Imaging Interaction Toolkit (MITK)
-Copyright (c) German Cancer Research Center, Division of Medical and
-Biological Informatics. All rights reserved.
-See MITKCopyright.txt or http://www.mitk.org/copyright.html for details.
+Copyright (c) German Cancer Research Center,
+Division of Medical and Biological Informatics.
+All rights reserved.
-This software is distributed WITHOUT ANY WARRANTY; without even
-the implied warranty of MERCHANTABILITY or FITNESS FOR A PARTICULAR
-PURPOSE. See the above copyright notices for more information.
+This software is distributed WITHOUT ANY WARRANTY; without
+even the implied warranty of MERCHANTABILITY or FITNESS FOR
+A PARTICULAR PURPOSE.
-=========================================================================*/
+See LICENSE.txt or http://www.mitk.org for details.
+
+===================================================================*/
#ifndef MITKDATASTORAGEACCESSRULE_H_HEADER_INCLUDED_
#define MITKDATASTORAGEACCESSRULE_H_HEADER_INCLUDED_
#include
#include "berryISchedulingRule.h"
#include "berryObject.h"
#include "mitkDataNode.h"
#include "mitkDataStorage.h"
#include "mitkStandaloneDataStorage.h"
namespace mitk {
/**
*@class DataStorageAccessRule
*
*@brief The DataStorageAccessRule inherits from the ISchedulingRule class. DataStorageAccessRule are used to restrict the adding and
* removing of DataStorage nodes in multi-threaded scenarios. Only DataStorageNodes within different branches can be modified
* concurrently. The idea and its restrictions is explained in the sections and diagrams below.
*
*
the IsScheduling(...) method :
* returns true or false depending if conflictions with another rule are found
*
*
*
*
* the rule behavior if jobs holing add rules of an DataTree node
*
* two add rules are always allowed since there are no conflictions when adding nodes concurrently. The final order the nodes are finally added has
* to be checked by the programmer of the particular job
*
*
* the rule behavior when two jobs holding remove rules of a DataNode
*
* two jobs holding remove rules can be executed concurrently since all removing scenarios do not cause conflictions. If two jobs are
* trying to remove the same DataTree node the job by itself needs to check if the node is still available before executing the removing
* command
*
*
* the rule behavior of a jobs that is holding an add rule compared with a job that is holding a remove rule on a
* DataNode
*
* adding and removing of DataTree nodes concurrently can cause serious errors and needs to be restricted. Performing add and remove
* operations on different DataStorage branches can be done concurrently since no conflictions are expected.
* the performing of add and remove operation on the same DataNode, its parent nodes or child nodes of the same branch
* by different jobs is not allowed. Jobs holding rules that are trying to perform such operations are blocked until the running job is done.
*
*
*
*
*
the Contains method (...) method :
* only necessary for a specific type of scheduling rules. Has to be used if IScheduling rules are composed into hierarchies.
* In such scenarios the contains(...) method specifies the hierarchical relationships among the locks. For example if a method tries to acquire a specific * rule to lock a specific directory it needs to check if no job is holding a rule for one or more subdirectories. For all cases in which no composing of
* IScheduling rules is needed the Contains(...) method only needs to check if two jobs are holding exactly the same IScheduling rule on the same object.
* Normally this can be achieved by just calling the IsConflicting(...) method.
*
*
*@author Jan Woerner
*/
class MITK_JOBS_EXPORT DataStorageAccessRule : public berry::ISchedulingRule {
public:
enum RuleType {ADD_RULE = 0, REMOVE_RULE} ;
RuleType m_Rule;
berryObjectMacro(DataStorageAccessRule)
DataStorageAccessRule (mitk::DataStorage::Pointer myDataStorage, mitk::DataNode::Pointer myDataNode,
DataStorageAccessRule::RuleType myRule) ;
bool Contains (berry::ISchedulingRule::Pointer otherISchedulingRule) const;
bool IsConflicting (berry::ISchedulingRule::Pointer otherISchedulingRule) const;
private:
/**
* Returns false, identifying no conflictions between two DataStorageAccessRules.
* Two add and remove rules do work together. From importance is that jobs using this rule need to check if the
* node operating on is still available or already deleted by another job. The DataStorageAccessRule only checks if conflictions could
* occur if the removing or adding of nodes is performed currently.
*/
bool CompareTwoAddorRemoveRules() const ;
/**
* searches for conflictions of an add DataStorageAccessRule with a remove DataStorageAccess rule
* if the add and remove rule do operate in different branches, no conflictions are expected and false is returned
*/
bool CompareAddandRemoveRules(mitk::DataStorageAccessRule::Pointer sptr_otherDataStorageAccessRule) const;
/**
* for internal use only,
* checks if the jobs that are to be compared do hold DataStorageAccessRule on the same
* DataStorage. Jobs that do operate on different DataStorage do not conflict and false is returned
*/
bool CompareDataStorages(mitk::DataStorage::Pointer otherDataStorage) const;
/**
* for internal use only
* validates if the DataTree node of a particular DataStorageAccess rule belongs to the DataStorage specified within the particular rule.
* if not the rule is invalid and false is returned. No conflictions can be expected
*/
bool TestDataNode(mitk::DataNode::Pointer dataTreeToBeStored) const;
/**
* returns a pointer to the specified DataStorage node
*/
mitk::DataNode::Pointer GetDataNode() const;
/**
* returns a pointer to the specified DataStorage
*/
mitk::DataStorage::Pointer GetDataStorage() const;
mitk::DataStorageAccessRule::RuleType GetRuleType() const;
DataStorage::Pointer m_sptrMyDataStorage ;
DataNode::Pointer m_sptrMyDataNode ;
};
}
#endif /*MITKDATASTORAGEACCESSRULE_H_HEADER_INCLUDED_ */
diff --git a/Plugins/org.mitk.core.services/src/internal/mitkDataStorageReference.cpp b/Plugins/org.mitk.core.services/src/internal/mitkDataStorageReference.cpp
index 939955f942..2841cde2aa 100644
--- a/Plugins/org.mitk.core.services/src/internal/mitkDataStorageReference.cpp
+++ b/Plugins/org.mitk.core.services/src/internal/mitkDataStorageReference.cpp
@@ -1,56 +1,55 @@
-/*=========================================================================
+/*===================================================================
-Program: Medical Imaging & Interaction Toolkit
-Language: C++
-Date: $Date$
-Version: $Revision$
+The Medical Imaging Interaction Toolkit (MITK)
-Copyright (c) German Cancer Research Center, Division of Medical and
-Biological Informatics. All rights reserved.
-See MITKCopyright.txt or http://www.mitk.org/copyright.html for details.
+Copyright (c) German Cancer Research Center,
+Division of Medical and Biological Informatics.
+All rights reserved.
-This software is distributed WITHOUT ANY WARRANTY; without even
-the implied warranty of MERCHANTABILITY or FITNESS FOR A PARTICULAR
-PURPOSE. See the above copyright notices for more information.
+This software is distributed WITHOUT ANY WARRANTY; without
+even the implied warranty of MERCHANTABILITY or FITNESS FOR
+A PARTICULAR PURPOSE.
-=========================================================================*/
+See LICENSE.txt or http://www.mitk.org for details.
+
+===================================================================*/
#include "mitkDataStorageReference.h"
namespace mitk {
DataStorageReference::DataStorageReference(DataStorage::Pointer dataStorage, bool isDefault)
: m_Default(isDefault), m_DataStorage(dataStorage)
{
}
DataStorage::Pointer DataStorageReference::GetDataStorage() const
{
return m_DataStorage;
}
bool DataStorageReference::IsDefault() const
{
return m_Default;
}
QString DataStorageReference::GetLabel() const
{
return m_Label;
}
void DataStorageReference::SetLabel(const QString& label)
{
m_Label = label;
}
bool DataStorageReference::operator==(const berry::Object* o) const
{
const DataStorageReference* other = dynamic_cast(o);
if (other == 0) return false;
return (m_DataStorage == other->m_DataStorage);
}
}
diff --git a/Plugins/org.mitk.core.services/src/internal/mitkDataStorageReference.h b/Plugins/org.mitk.core.services/src/internal/mitkDataStorageReference.h
index 152e5c8615..63dfb82b99 100644
--- a/Plugins/org.mitk.core.services/src/internal/mitkDataStorageReference.h
+++ b/Plugins/org.mitk.core.services/src/internal/mitkDataStorageReference.h
@@ -1,50 +1,49 @@
-/*=========================================================================
+/*===================================================================
-Program: Medical Imaging & Interaction Toolkit
-Language: C++
-Date: $Date$
-Version: $Revision$
+The Medical Imaging Interaction Toolkit (MITK)
-Copyright (c) German Cancer Research Center, Division of Medical and
-Biological Informatics. All rights reserved.
-See MITKCopyright.txt or http://www.mitk.org/copyright.html for details.
+Copyright (c) German Cancer Research Center,
+Division of Medical and Biological Informatics.
+All rights reserved.
-This software is distributed WITHOUT ANY WARRANTY; without even
-the implied warranty of MERCHANTABILITY or FITNESS FOR A PARTICULAR
-PURPOSE. See the above copyright notices for more information.
+This software is distributed WITHOUT ANY WARRANTY; without
+even the implied warranty of MERCHANTABILITY or FITNESS FOR
+A PARTICULAR PURPOSE.
-=========================================================================*/
+See LICENSE.txt or http://www.mitk.org for details.
+
+===================================================================*/
#ifndef MITKDATASTORAGEREFERENCE_H_
#define MITKDATASTORAGEREFERENCE_H_
#include "../mitkIDataStorageReference.h"
namespace mitk
{
class DataStorageReference : public IDataStorageReference
{
public:
DataStorageReference(DataStorage::Pointer dataStorage, bool isDefault = false);
DataStorage::Pointer GetDataStorage() const;
bool IsDefault() const;
QString GetLabel() const;
void SetLabel(const QString& label);
bool operator==(const berry::Object* o) const;
private:
bool m_Default;
QString m_Label;
DataStorage::Pointer m_DataStorage;
};
}
#endif /*MITKDATASTORAGEREFERENCE_H_*/
diff --git a/Plugins/org.mitk.core.services/src/internal/mitkDataStorageService.cpp b/Plugins/org.mitk.core.services/src/internal/mitkDataStorageService.cpp
index cbda248971..5268bf78a3 100644
--- a/Plugins/org.mitk.core.services/src/internal/mitkDataStorageService.cpp
+++ b/Plugins/org.mitk.core.services/src/internal/mitkDataStorageService.cpp
@@ -1,104 +1,103 @@
-/*=========================================================================
+/*===================================================================
-Program: Medical Imaging & Interaction Toolkit
-Language: C++
-Date: $Date$
-Version: $Revision$
+The Medical Imaging Interaction Toolkit (MITK)
-Copyright (c) German Cancer Research Center, Division of Medical and
-Biological Informatics. All rights reserved.
-See MITKCopyright.txt or http://www.mitk.org/copyright.html for details.
+Copyright (c) German Cancer Research Center,
+Division of Medical and Biological Informatics.
+All rights reserved.
-This software is distributed WITHOUT ANY WARRANTY; without even
-the implied warranty of MERCHANTABILITY or FITNESS FOR A PARTICULAR
-PURPOSE. See the above copyright notices for more information.
+This software is distributed WITHOUT ANY WARRANTY; without
+even the implied warranty of MERCHANTABILITY or FITNESS FOR
+A PARTICULAR PURPOSE.
-=========================================================================*/
+See LICENSE.txt or http://www.mitk.org for details.
+
+===================================================================*/
#include "mitkDataStorageService.h"
#include "mitkDataStorageReference.h"
#include "mitkStandaloneDataStorage.h"
namespace mitk {
DataStorageService::DataStorageService()
{
m_DefaultDataStorageRef = this->CreateDataStorage("Default DataStorage");
m_ActiveDataStorageRef = m_DefaultDataStorageRef;
}
bool
DataStorageService::IsA(const std::type_info& type) const
{
std::string name(GetType().name());
return name == type.name() || Service::IsA(type);
}
const std::type_info&
DataStorageService::GetType() const
{
return typeid(IDataStorageService);
}
IDataStorageReference::Pointer DataStorageService::CreateDataStorage(const QString& label)
{
StandaloneDataStorage::Pointer dataStorage = mitk::StandaloneDataStorage::New();
DataStorageReference::Pointer ref(new DataStorageReference(dataStorage.GetPointer()));
ref->SetLabel(label);
m_DataStorageReferences.insert(ref);
return ref;
}
std::vector DataStorageService::GetDataStorageReferences() const
{
std::vector res;
res.reserve(m_DataStorageReferences.size()+1);
res.push_back(m_DefaultDataStorageRef);
res.insert(res.end(), m_DataStorageReferences.begin(), m_DataStorageReferences.end());
return res;
}
IDataStorageReference::Pointer DataStorageService::GetDefaultDataStorage() const
{
return m_DefaultDataStorageRef;
}
IDataStorageReference::Pointer DataStorageService::GetDataStorage() const
{
if (m_ActiveDataStorageRef.IsNotNull()) return m_ActiveDataStorageRef;
return m_DefaultDataStorageRef;
}
IDataStorageReference::Pointer DataStorageService::GetActiveDataStorage() const
{
return m_ActiveDataStorageRef;
}
void DataStorageService::SetActiveDataStorage(IDataStorageReference::Pointer dataStorageRef)
{
if (dataStorageRef.IsNull()) m_ActiveDataStorageRef = m_DefaultDataStorageRef;
else m_ActiveDataStorageRef = dataStorageRef;
}
void DataStorageService::AddDataStorageReference(IDataStorageReference::Pointer dataStorageRef)
{
if (dataStorageRef.IsNull() || dataStorageRef->IsDefault()) return;
m_DataStorageReferences.insert(dataStorageRef);
}
bool DataStorageService::RemoveDataStorageReference(IDataStorageReference::Pointer dataStorageRef)
{
if (m_ActiveDataStorageRef == dataStorageRef)
{
m_ActiveDataStorageRef = 0;
}
return m_DataStorageReferences.erase(dataStorageRef);
}
}
diff --git a/Plugins/org.mitk.core.services/src/internal/mitkDataStorageService.h b/Plugins/org.mitk.core.services/src/internal/mitkDataStorageService.h
index a299807dc0..6fabb74a7a 100644
--- a/Plugins/org.mitk.core.services/src/internal/mitkDataStorageService.h
+++ b/Plugins/org.mitk.core.services/src/internal/mitkDataStorageService.h
@@ -1,60 +1,59 @@
-/*=========================================================================
+/*===================================================================
-Program: Medical Imaging & Interaction Toolkit
-Language: C++
-Date: $Date$
-Version: $Revision$
+The Medical Imaging Interaction Toolkit (MITK)
-Copyright (c) German Cancer Research Center, Division of Medical and
-Biological Informatics. All rights reserved.
-See MITKCopyright.txt or http://www.mitk.org/copyright.html for details.
+Copyright (c) German Cancer Research Center,
+Division of Medical and Biological Informatics.
+All rights reserved.
-This software is distributed WITHOUT ANY WARRANTY; without even
-the implied warranty of MERCHANTABILITY or FITNESS FOR A PARTICULAR
-PURPOSE. See the above copyright notices for more information.
+This software is distributed WITHOUT ANY WARRANTY; without
+even the implied warranty of MERCHANTABILITY or FITNESS FOR
+A PARTICULAR PURPOSE.
-=========================================================================*/
+See LICENSE.txt or http://www.mitk.org for details.
+
+===================================================================*/
#ifndef MITKDATASTORAGESERVICE_H_
#define MITKDATASTORAGESERVICE_H_
#include "../mitkIDataStorageService.h"
namespace mitk {
class DataStorageService : public QObject, public IDataStorageService
{
Q_OBJECT
Q_INTERFACES(mitk::IDataStorageService)
public:
DataStorageService();
bool IsA(const std::type_info& type) const;
const std::type_info& GetType() const;
IDataStorageReference::Pointer CreateDataStorage(const QString& label);
std::vector GetDataStorageReferences() const;
IDataStorageReference::Pointer GetDefaultDataStorage() const;
IDataStorageReference::Pointer GetDataStorage() const;
IDataStorageReference::Pointer GetActiveDataStorage() const;
void SetActiveDataStorage(IDataStorageReference::Pointer dataStorageRef);
void AddDataStorageReference(IDataStorageReference::Pointer dataStorageRef);
bool RemoveDataStorageReference(IDataStorageReference::Pointer dataStorageRef);
private:
IDataStorageReference::Pointer m_ActiveDataStorageRef;
IDataStorageReference::Pointer m_DefaultDataStorageRef;
std::set m_DataStorageReferences;
};
}
#endif /*MITKDATASTORAGESERVICE_H_*/
diff --git a/Plugins/org.mitk.core.services/src/internal/mitkPluginActivator.cpp b/Plugins/org.mitk.core.services/src/internal/mitkPluginActivator.cpp
index 300dba3806..30d39d3ded 100644
--- a/Plugins/org.mitk.core.services/src/internal/mitkPluginActivator.cpp
+++ b/Plugins/org.mitk.core.services/src/internal/mitkPluginActivator.cpp
@@ -1,41 +1,40 @@
-/*=========================================================================
+/*===================================================================
-Program: Medical Imaging & Interaction Toolkit
-Language: C++
-Date: $Date$
-Version: $Revision$
+The Medical Imaging Interaction Toolkit (MITK)
-Copyright (c) German Cancer Research Center, Division of Medical and
-Biological Informatics. All rights reserved.
-See MITKCopyright.txt or http://www.mitk.org/copyright.html for details.
+Copyright (c) German Cancer Research Center,
+Division of Medical and Biological Informatics.
+All rights reserved.
-This software is distributed WITHOUT ANY WARRANTY; without even
-the implied warranty of MERCHANTABILITY or FITNESS FOR A PARTICULAR
-PURPOSE. See the above copyright notices for more information.
+This software is distributed WITHOUT ANY WARRANTY; without
+even the implied warranty of MERCHANTABILITY or FITNESS FOR
+A PARTICULAR PURPOSE.
-=========================================================================*/
+See LICENSE.txt or http://www.mitk.org for details.
+
+===================================================================*/
#include "mitkPluginActivator.h"
#include "internal/mitkDataStorageService.h"
namespace mitk
{
const std::string org_mitk_core_services_Activator::PLUGIN_ID = "org.mitk.core.services";
void org_mitk_core_services_Activator::start(ctkPluginContext* context)
{
DataStorageService* service = new DataStorageService();
dataStorageService = IDataStorageService::Pointer(service);
context->registerService(service);
}
void org_mitk_core_services_Activator::stop(ctkPluginContext* /*context*/)
{
dataStorageService = 0;
}
}
Q_EXPORT_PLUGIN2(org_mitk_core_services, mitk::org_mitk_core_services_Activator)
diff --git a/Plugins/org.mitk.core.services/src/internal/mitkPluginActivator.h b/Plugins/org.mitk.core.services/src/internal/mitkPluginActivator.h
index aad76afeff..2f80ac4e5e 100644
--- a/Plugins/org.mitk.core.services/src/internal/mitkPluginActivator.h
+++ b/Plugins/org.mitk.core.services/src/internal/mitkPluginActivator.h
@@ -1,51 +1,50 @@
-/*=========================================================================
+/*===================================================================
-Program: Medical Imaging & Interaction Toolkit
-Language: C++
-Date: $Date$
-Version: $Revision$
+The Medical Imaging Interaction Toolkit (MITK)
-Copyright (c) German Cancer Research Center, Division of Medical and
-Biological Informatics. All rights reserved.
-See MITKCopyright.txt or http://www.mitk.org/copyright.html for details.
+Copyright (c) German Cancer Research Center,
+Division of Medical and Biological Informatics.
+All rights reserved.
-This software is distributed WITHOUT ANY WARRANTY; without even
-the implied warranty of MERCHANTABILITY or FITNESS FOR A PARTICULAR
-PURPOSE. See the above copyright notices for more information.
+This software is distributed WITHOUT ANY WARRANTY; without
+even the implied warranty of MERCHANTABILITY or FITNESS FOR
+A PARTICULAR PURPOSE.
-=========================================================================*/
+See LICENSE.txt or http://www.mitk.org for details.
+
+===================================================================*/
#ifndef MITKCORESERVICESPLUGIN_H_
#define MITKCORESERVICESPLUGIN_H_
#include
#include
#include "mitkIDataStorageService.h"
namespace mitk
{
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/Plugins/org.mitk.core.services/src/mitkIDataStorageReference.h b/Plugins/org.mitk.core.services/src/mitkIDataStorageReference.h
index 5a681dabf1..b2e7fd45fb 100644
--- a/Plugins/org.mitk.core.services/src/mitkIDataStorageReference.h
+++ b/Plugins/org.mitk.core.services/src/mitkIDataStorageReference.h
@@ -1,51 +1,50 @@
-/*=========================================================================
+/*===================================================================
-Program: Medical Imaging & Interaction Toolkit
-Language: C++
-Date: $Date$
-Version: $Revision$
+The Medical Imaging Interaction Toolkit (MITK)
-Copyright (c) German Cancer Research Center, Division of Medical and
-Biological Informatics. All rights reserved.
-See MITKCopyright.txt or http://www.mitk.org/copyright.html for details.
+Copyright (c) German Cancer Research Center,
+Division of Medical and Biological Informatics.
+All rights reserved.
-This software is distributed WITHOUT ANY WARRANTY; without even
-the implied warranty of MERCHANTABILITY or FITNESS FOR A PARTICULAR
-PURPOSE. See the above copyright notices for more information.
+This software is distributed WITHOUT ANY WARRANTY; without
+even the implied warranty of MERCHANTABILITY or FITNESS FOR
+A PARTICULAR PURPOSE.
-=========================================================================*/
+See LICENSE.txt or http://www.mitk.org for details.
+
+===================================================================*/
#ifndef MITKIDATASTORAGEREFERENCE_H_
#define MITKIDATASTORAGEREFERENCE_H_
#include
#include
#include
#include
namespace mitk
{
/**
* \ingroup org_mitk_core_services
*/
struct MITK_CORE_SERVICES_PLUGIN IDataStorageReference : public berry::Object
{
berryInterfaceMacro(IDataStorageReference, mitk);
virtual DataStorage::Pointer GetDataStorage() const = 0;
virtual bool IsDefault() const = 0;
virtual QString GetLabel() const = 0;
virtual void SetLabel(const QString& label) = 0;
virtual bool operator==(const berry::Object* o) const = 0;
};
}
#endif /*MITKIDATASTORAGEREFERENCE_H_*/
diff --git a/Plugins/org.mitk.core.services/src/mitkIDataStorageService.cpp b/Plugins/org.mitk.core.services/src/mitkIDataStorageService.cpp
index 2cd8ea72e7..28d3441f0c 100644
--- a/Plugins/org.mitk.core.services/src/mitkIDataStorageService.cpp
+++ b/Plugins/org.mitk.core.services/src/mitkIDataStorageService.cpp
@@ -1,25 +1,24 @@
-/*=========================================================================
+/*===================================================================
-Program: Medical Imaging & Interaction Toolkit
-Language: C++
-Date: $Date$
-Version: $Revision$
+The Medical Imaging Interaction Toolkit (MITK)
-Copyright (c) German Cancer Research Center, Division of Medical and
-Biological Informatics. All rights reserved.
-See MITKCopyright.txt or http://www.mitk.org/copyright.html for details.
+Copyright (c) German Cancer Research Center,
+Division of Medical and Biological Informatics.
+All rights reserved.
-This software is distributed WITHOUT ANY WARRANTY; without even
-the implied warranty of MERCHANTABILITY or FITNESS FOR A PARTICULAR
-PURPOSE. See the above copyright notices for more information.
+This software is distributed WITHOUT ANY WARRANTY; without
+even the implied warranty of MERCHANTABILITY or FITNESS FOR
+A PARTICULAR PURPOSE.
-=========================================================================*/
+See LICENSE.txt or http://www.mitk.org for details.
+
+===================================================================*/
#include "mitkIDataStorageService.h"
namespace mitk
{
const std::string IDataStorageService::ID = "org.mitk.core.services.datastorage";
}
diff --git a/Plugins/org.mitk.core.services/src/mitkIDataStorageService.h b/Plugins/org.mitk.core.services/src/mitkIDataStorageService.h
index 254dade2f2..68a2fd41a6 100644
--- a/Plugins/org.mitk.core.services/src/mitkIDataStorageService.h
+++ b/Plugins/org.mitk.core.services/src/mitkIDataStorageService.h
@@ -1,60 +1,59 @@
-/*=========================================================================
+/*===================================================================
-Program: Medical Imaging & Interaction Toolkit
-Language: C++
-Date: $Date$
-Version: $Revision$
+The Medical Imaging Interaction Toolkit (MITK)
-Copyright (c) German Cancer Research Center, Division of Medical and
-Biological Informatics. All rights reserved.
-See MITKCopyright.txt or http://www.mitk.org/copyright.html for details.
+Copyright (c) German Cancer Research Center,
+Division of Medical and Biological Informatics.
+All rights reserved.
-This software is distributed WITHOUT ANY WARRANTY; without even
-the implied warranty of MERCHANTABILITY or FITNESS FOR A PARTICULAR
-PURPOSE. See the above copyright notices for more information.
+This software is distributed WITHOUT ANY WARRANTY; without
+even the implied warranty of MERCHANTABILITY or FITNESS FOR
+A PARTICULAR PURPOSE.
-=========================================================================*/
+See LICENSE.txt or http://www.mitk.org for details.
+
+===================================================================*/
#ifndef MITKIDATASTORAGESERVICE_H_
#define MITKIDATASTORAGESERVICE_H_
#include
#include
#include "mitkIDataStorageReference.h"
#include
#include
namespace mitk
{
/**
* \ingroup org_mitk_core_services
*/
struct MITK_CORE_SERVICES_PLUGIN IDataStorageService : public berry::Service
{
berryInterfaceMacro(IDataStorageService, berry);
static const std::string ID;
virtual IDataStorageReference::Pointer CreateDataStorage(const QString& label) = 0;
virtual std::vector GetDataStorageReferences() const = 0;
virtual IDataStorageReference::Pointer GetDefaultDataStorage() const = 0;
virtual IDataStorageReference::Pointer GetDataStorage() const = 0;
virtual IDataStorageReference::Pointer GetActiveDataStorage() const = 0;
virtual void SetActiveDataStorage(IDataStorageReference::Pointer dataStorageRef) = 0;
virtual void AddDataStorageReference(IDataStorageReference::Pointer dataStorageRef) = 0;
virtual bool RemoveDataStorageReference(IDataStorageReference::Pointer dataStorageRef) = 0;
};
}
Q_DECLARE_INTERFACE(mitk::IDataStorageService, "org.mitk.service.IDataStorageService")
#endif /*MITKIDATASTORAGESERVICE_H_*/
diff --git a/Plugins/org.mitk.diffusionimaging/src/internal/mitkDiffusionImagingActivator.cpp b/Plugins/org.mitk.diffusionimaging/src/internal/mitkDiffusionImagingActivator.cpp
index 9608bb65d1..af97560c40 100644
--- a/Plugins/org.mitk.diffusionimaging/src/internal/mitkDiffusionImagingActivator.cpp
+++ b/Plugins/org.mitk.diffusionimaging/src/internal/mitkDiffusionImagingActivator.cpp
@@ -1,63 +1,62 @@
-/*=========================================================================
+/*===================================================================
-Program: Medical Imaging & Interaction Toolkit
-Language: C++
-Date: $Date: 2009-07-14 19:11:20 +0200 (Tue, 14 Jul 2009) $
-Version: $Revision: 18127 $
+The Medical Imaging Interaction Toolkit (MITK)
-Copyright (c) German Cancer Research Center, Division of Medical and
-Biological Informatics. All rights reserved.
-See MITKCopyright.txt or http://www.mitk.org/copyright.html for details.
+Copyright (c) German Cancer Research Center,
+Division of Medical and Biological Informatics.
+All rights reserved.
-This software is distributed WITHOUT ANY WARRANTY; without even
-the implied warranty of MERCHANTABILITY or FITNESS FOR A PARTICULAR
-PURPOSE. See the above copyright notices for more information.
+This software is distributed WITHOUT ANY WARRANTY; without
+even the implied warranty of MERCHANTABILITY or FITNESS FOR
+A PARTICULAR PURPOSE.
-=========================================================================*/
+See LICENSE.txt or http://www.mitk.org for details.
+
+===================================================================*/
#include "mitkDiffusionImagingActivator.h"
#include "mitkDiffusionImagingObjectFactory.h"
#include "QmitkNodeDescriptorManager.h"
#include "mitkNodePredicateDataType.h"
#include
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));
mitk::NodePredicateDataType::Pointer isFiberBundleX = mitk::NodePredicateDataType::New("FiberBundleX");
manager->AddDescriptor(new QmitkNodeDescriptor(QObject::tr("FiberBundleX"), QString(":/QmitkDiffusionImaging/FiberBundleX.png"), isFiberBundleX, manager));
mitk::NodePredicateDataType::Pointer isConnectomicsNetwork = mitk::NodePredicateDataType::New("ConnectomicsNetwork");
manager->AddDescriptor(new QmitkNodeDescriptor(QObject::tr("ConnectomicsNetwork"), QString(":/QmitkDiffusionImaging/ConnectomicsNetwork.png"), isConnectomicsNetwork, manager));
}
void
mitk::DiffusionImagingActivator::stop(ctkPluginContext* context)
{
Q_UNUSED(context)
}
Q_EXPORT_PLUGIN2(org_mitk_diffusionimaging, mitk::DiffusionImagingActivator)
diff --git a/Plugins/org.mitk.diffusionimaging/src/internal/mitkDiffusionImagingActivator.h b/Plugins/org.mitk.diffusionimaging/src/internal/mitkDiffusionImagingActivator.h
index ae4c4aada8..0c529b9035 100644
--- a/Plugins/org.mitk.diffusionimaging/src/internal/mitkDiffusionImagingActivator.h
+++ b/Plugins/org.mitk.diffusionimaging/src/internal/mitkDiffusionImagingActivator.h
@@ -1,55 +1,54 @@
-/*=========================================================================
+/*===================================================================
- Program: MITK Platform
- Language: C++
- Date: $Date: 2009-05-19 15:45:39 +0200 (Di, 19 Mai 2009) $
- Version: $Revision: 17020 $
+The Medical Imaging Interaction Toolkit (MITK)
- Copyright (c) German Cancer Research Center, Division of Medical and
- Biological Informatics. All rights reserved.
- See MITKCopyright.txt or http://www.mitk.org/copyright.html for details.
+Copyright (c) German Cancer Research Center,
+Division of Medical and Biological Informatics.
+All rights reserved.
- This software is distributed WITHOUT ANY WARRANTY; without even
- the implied warranty of MERCHANTABILITY or FITNESS FOR A PARTICULAR
- PURPOSE. See the above copyright notices for more information.
+This software is distributed WITHOUT ANY WARRANTY; without
+even the implied warranty of MERCHANTABILITY or FITNESS FOR
+A PARTICULAR PURPOSE.
- =========================================================================*/
+See LICENSE.txt or http://www.mitk.org for details.
+
+===================================================================*/
#ifndef MITKDIFFUSIONIMAGINGACTIVATOR_H_
#define MITKDIFFUSIONIMAGINGACTIVATOR_H_
#include
#include
namespace mitk
{
/**
* \ingroup org_mitk_diffusionimaging_internal
*
* \brief The plug-in activator for the diffusion imaging module
*
* When the plug-in is started by the framework, it initialzes diffusion imaging
* specific things.
*/
class MITK_LOCAL DiffusionImagingActivator :
public QObject, public ctkPluginActivator
{
Q_OBJECT
Q_INTERFACES(ctkPluginActivator)
public:
/**
* Registers diffusion imaging object factories.
*/
void start(ctkPluginContext* context);
void stop(ctkPluginContext* context);
};
}
#endif /* MITKDIFFUSIONIMAGINGACTIVATOR_H_ */
diff --git a/Plugins/org.mitk.gui.common/src/internal/org_mitk_gui_common_Activator.cpp b/Plugins/org.mitk.gui.common/src/internal/org_mitk_gui_common_Activator.cpp
index fc603d63b6..e12bd11c2e 100644
--- a/Plugins/org.mitk.gui.common/src/internal/org_mitk_gui_common_Activator.cpp
+++ b/Plugins/org.mitk.gui.common/src/internal/org_mitk_gui_common_Activator.cpp
@@ -1,47 +1,46 @@
-/*=========================================================================
+/*===================================================================
-Program: Medical Imaging & Interaction Toolkit
-Language: C++
-Date: $Date$
-Version: $Revision$
+The Medical Imaging Interaction Toolkit (MITK)
-Copyright (c) German Cancer Research Center, Division of Medical and
-Biological Informatics. All rights reserved.
-See MITKCopyright.txt or http://www.mitk.org/copyright.html for details.
+Copyright (c) German Cancer Research Center,
+Division of Medical and Biological Informatics.
+All rights reserved.
-This software is distributed WITHOUT ANY WARRANTY; without even
-the implied warranty of MERCHANTABILITY or FITNESS FOR A PARTICULAR
-PURPOSE. See the above copyright notices for more information.
+This software is distributed WITHOUT ANY WARRANTY; without
+even the implied warranty of MERCHANTABILITY or FITNESS FOR
+A PARTICULAR PURPOSE.
-=========================================================================*/
+See LICENSE.txt or http://www.mitk.org for details.
+
+===================================================================*/
#include "org_mitk_gui_common_Activator.h"
#include
namespace mitk {
ctkPluginContext* org_mitk_gui_common_Activator::m_Context = 0;
void org_mitk_gui_common_Activator::start(ctkPluginContext* context)
{
m_Context = context;
}
void org_mitk_gui_common_Activator::stop(ctkPluginContext* context)
{
Q_UNUSED(context)
m_Context = 0;
}
ctkPluginContext *org_mitk_gui_common_Activator::GetContext()
{
return m_Context;
}
}
Q_EXPORT_PLUGIN2(org_mitk_gui_common, mitk::org_mitk_gui_common_Activator)
diff --git a/Plugins/org.mitk.gui.common/src/internal/org_mitk_gui_common_Activator.h b/Plugins/org.mitk.gui.common/src/internal/org_mitk_gui_common_Activator.h
index c5aa6faca9..cfdc1cd1dd 100644
--- a/Plugins/org.mitk.gui.common/src/internal/org_mitk_gui_common_Activator.h
+++ b/Plugins/org.mitk.gui.common/src/internal/org_mitk_gui_common_Activator.h
@@ -1,49 +1,48 @@
-/*=========================================================================
+/*===================================================================
-Program: Medical Imaging & Interaction Toolkit
-Language: C++
-Date: $Date$
-Version: $Revision$
+The Medical Imaging Interaction Toolkit (MITK)
-Copyright (c) German Cancer Research Center, Division of Medical and
-Biological Informatics. All rights reserved.
-See MITKCopyright.txt or http://www.mitk.org/copyright.html for details.
+Copyright (c) German Cancer Research Center,
+Division of Medical and Biological Informatics.
+All rights reserved.
-This software is distributed WITHOUT ANY WARRANTY; without even
-the implied warranty of MERCHANTABILITY or FITNESS FOR A PARTICULAR
-PURPOSE. See the above copyright notices for more information.
+This software is distributed WITHOUT ANY WARRANTY; without
+even the implied warranty of MERCHANTABILITY or FITNESS FOR
+A PARTICULAR PURPOSE.
-=========================================================================*/
+See LICENSE.txt or http://www.mitk.org for details.
+
+===================================================================*/
#ifndef MITKPLUGINACTIVATOR_H
#define MITKPLUGINACTIVATOR_H
#include
namespace mitk {
class org_mitk_gui_common_Activator :
public QObject, public ctkPluginActivator
{
Q_OBJECT
Q_INTERFACES(ctkPluginActivator)
public:
void start(ctkPluginContext* context);
void stop(ctkPluginContext* context);
static ctkPluginContext* GetContext();
private:
static ctkPluginContext* m_Context;
}; // org_mitk_gui_common_Activator
typedef org_mitk_gui_common_Activator PluginActivator;
}
#endif // MITKPLUGINACTIVATOR_H
diff --git a/Plugins/org.mitk.gui.common/src/mitkDataNodeObject.cpp b/Plugins/org.mitk.gui.common/src/mitkDataNodeObject.cpp
index 19a7c6263f..48efd5edd5 100644
--- a/Plugins/org.mitk.gui.common/src/mitkDataNodeObject.cpp
+++ b/Plugins/org.mitk.gui.common/src/mitkDataNodeObject.cpp
@@ -1,50 +1,49 @@
-/*=========================================================================
+/*===================================================================
- Program: Medical Imaging & Interaction Toolkit
- Language: C++
- Date: $Date$
- Version: $Revision$
+The Medical Imaging Interaction Toolkit (MITK)
- Copyright (c) German Cancer Research Center, Division of Medical and
- Biological Informatics. All rights reserved.
- See MITKCopyright.txt or http://www.mitk.org/copyright.html for details.
+Copyright (c) German Cancer Research Center,
+Division of Medical and Biological Informatics.
+All rights reserved.
- This software is distributed WITHOUT ANY WARRANTY; without even
- the implied warranty of MERCHANTABILITY or FITNESS FOR A PARTICULAR
- PURPOSE. See the above copyright notices for more information.
+This software is distributed WITHOUT ANY WARRANTY; without
+even the implied warranty of MERCHANTABILITY or FITNESS FOR
+A PARTICULAR PURPOSE.
- =========================================================================*/
+See LICENSE.txt or http://www.mitk.org for details.
+
+===================================================================*/
#include "mitkDataNodeObject.h"
namespace mitk
{
DataNodeObject::DataNodeObject() :
m_Node(0)
{
}
DataNodeObject::DataNodeObject(DataNode::Pointer node) :
m_Node(node)
{
}
DataNode::Pointer DataNodeObject::GetDataNode() const
{
return m_Node;
}
bool DataNodeObject::operator==(const berry::Object* obj) const
{
if (const DataNodeObject* other = dynamic_cast(obj))
{
return m_Node == other->m_Node;
}
return false;
}
}
diff --git a/Plugins/org.mitk.gui.common/src/mitkDataNodeObject.h b/Plugins/org.mitk.gui.common/src/mitkDataNodeObject.h
index 53f31c2c10..502647d67f 100644
--- a/Plugins/org.mitk.gui.common/src/mitkDataNodeObject.h
+++ b/Plugins/org.mitk.gui.common/src/mitkDataNodeObject.h
@@ -1,58 +1,57 @@
-/*=========================================================================
+/*===================================================================
- Program: Medical Imaging & Interaction Toolkit
- Language: C++
- Date: $Date$
- Version: $Revision$
+The Medical Imaging Interaction Toolkit (MITK)
- Copyright (c) German Cancer Research Center, Division of Medical and
- Biological Informatics. All rights reserved.
- See MITKCopyright.txt or http://www.mitk.org/copyright.html for details.
+Copyright (c) German Cancer Research Center,
+Division of Medical and Biological Informatics.
+All rights reserved.
- This software is distributed WITHOUT ANY WARRANTY; without even
- the implied warranty of MERCHANTABILITY or FITNESS FOR A PARTICULAR
- PURPOSE. See the above copyright notices for more information.
+This software is distributed WITHOUT ANY WARRANTY; without
+even the implied warranty of MERCHANTABILITY or FITNESS FOR
+A PARTICULAR PURPOSE.
- =========================================================================*/
+See LICENSE.txt or http://www.mitk.org for details.
+
+===================================================================*/
#ifndef MITKDATATREENODEOBJECT_H_
#define MITKDATATREENODEOBJECT_H_
#include
#include
#include
#include
namespace mitk
{
/**
* \ingroup org_mitk_gui_common
*/
class MITK_GUI_COMMON_PLUGIN DataNodeObject : public berry::Object
{
public:
berryObjectMacro(mitk::DataNodeObject)
DataNodeObject();
DataNodeObject(DataNode::Pointer node);
DataNode::Pointer GetDataNode() const;
bool operator==(const berry::Object* obj) const;
private:
DataNode::Pointer m_Node;
};
}
#endif /* MITKDATATREENODEOBJECT_H_ */
diff --git a/Plugins/org.mitk.gui.common/src/mitkDataNodeSelection.cpp b/Plugins/org.mitk.gui.common/src/mitkDataNodeSelection.cpp
index afe696f36f..718fa1dabb 100644
--- a/Plugins/org.mitk.gui.common/src/mitkDataNodeSelection.cpp
+++ b/Plugins/org.mitk.gui.common/src/mitkDataNodeSelection.cpp
@@ -1,91 +1,90 @@
-/*=========================================================================
+/*===================================================================
-Program: Medical Imaging & Interaction Toolkit
-Language: C++
-Date: $Date$
-Version: $Revision$
+The Medical Imaging Interaction Toolkit (MITK)
-Copyright (c) German Cancer Research Center, Division of Medical and
-Biological Informatics. All rights reserved.
-See MITKCopyright.txt or http://www.mitk.org/copyright.html for details.
+Copyright (c) German Cancer Research Center,
+Division of Medical and Biological Informatics.
+All rights reserved.
-This software is distributed WITHOUT ANY WARRANTY; without even
-the implied warranty of MERCHANTABILITY or FITNESS FOR A PARTICULAR
-PURPOSE. See the above copyright notices for more information.
+This software is distributed WITHOUT ANY WARRANTY; without
+even the implied warranty of MERCHANTABILITY or FITNESS FOR
+A PARTICULAR PURPOSE.
-=========================================================================*/
+See LICENSE.txt or http://www.mitk.org for details.
+
+===================================================================*/
#include "mitkDataNodeSelection.h"
#include "mitkDataNodeObject.h"
namespace mitk
{
DataNodeSelection::DataNodeSelection() :
m_Selection(new ContainerType())
{
}
DataNodeSelection::DataNodeSelection(DataNode::Pointer node) :
m_Selection(new ContainerType())
{
DataNodeObject::Pointer obj(new DataNodeObject(node));
m_Selection->push_back(obj);
}
DataNodeSelection::DataNodeSelection(const std::vector& nodes) :
m_Selection(new ContainerType())
{
for (std::vector::const_iterator i = nodes.begin(); i != nodes.end(); ++i)
{
DataNodeObject::Pointer obj(new DataNodeObject(*i));
m_Selection->push_back(obj);
}
}
berry::Object::Pointer DataNodeSelection::GetFirstElement() const
{
if (m_Selection->empty())
return berry::Object::Pointer();
return *(m_Selection->begin());
}
berry::IStructuredSelection::iterator DataNodeSelection::Begin() const
{
return m_Selection->begin();
}
berry::IStructuredSelection::iterator DataNodeSelection::End() const
{
return m_Selection->end();
}
int DataNodeSelection::Size() const
{
return m_Selection->size();
}
berry::IStructuredSelection::ContainerType::Pointer DataNodeSelection::ToVector() const
{
return m_Selection;
}
bool DataNodeSelection::IsEmpty() const
{
return m_Selection->empty();
}
bool DataNodeSelection::operator==(const berry::Object* obj) const
{
if (const berry::IStructuredSelection* other = dynamic_cast(obj))
{
return m_Selection == other->ToVector();
}
return false;
}
}
diff --git a/Plugins/org.mitk.gui.common/src/mitkDataNodeSelection.h b/Plugins/org.mitk.gui.common/src/mitkDataNodeSelection.h
index ebd5a3c66b..e01d30ce6c 100644
--- a/Plugins/org.mitk.gui.common/src/mitkDataNodeSelection.h
+++ b/Plugins/org.mitk.gui.common/src/mitkDataNodeSelection.h
@@ -1,66 +1,65 @@
-/*=========================================================================
+/*===================================================================
- Program: Medical Imaging & Interaction Toolkit
- Language: C++
- Date: $Date$
- Version: $Revision$
+The Medical Imaging Interaction Toolkit (MITK)
- Copyright (c) German Cancer Research Center, Division of Medical and
- Biological Informatics. All rights reserved.
- See MITKCopyright.txt or http://www.mitk.org/copyright.html for details.
+Copyright (c) German Cancer Research Center,
+Division of Medical and Biological Informatics.
+All rights reserved.
- This software is distributed WITHOUT ANY WARRANTY; without even
- the implied warranty of MERCHANTABILITY or FITNESS FOR A PARTICULAR
- PURPOSE. See the above copyright notices for more information.
+This software is distributed WITHOUT ANY WARRANTY; without
+even the implied warranty of MERCHANTABILITY or FITNESS FOR
+A PARTICULAR PURPOSE.
- =========================================================================*/
+See LICENSE.txt or http://www.mitk.org for details.
+
+===================================================================*/
#ifndef MITKDATATREENODESELECTION_H_
#define MITKDATATREENODESELECTION_H_
#include
#include
#include
namespace mitk {
/**
* \ingroup org_mitk_gui_common
*/
class MITK_GUI_COMMON_PLUGIN DataNodeSelection : public virtual berry::IStructuredSelection
{
public:
berryObjectMacro(DataNodeSelection);
DataNodeSelection();
DataNodeSelection(DataNode::Pointer node);
DataNodeSelection(const std::vector& nodes);
virtual Object::Pointer GetFirstElement() const;
virtual iterator Begin() const;
virtual iterator End() const;
virtual int Size() const;
virtual ContainerType::Pointer ToVector() const;
/**
* @see berry::ISelection::IsEmpty()
*/
bool IsEmpty() const;
bool operator==(const berry::Object* obj) const;
protected:
ContainerType::Pointer m_Selection;
};
}
#endif /* MITKDATATREENODESELECTION_H_ */
diff --git a/Plugins/org.mitk.gui.common/src/mitkDataStorageEditorInput.cpp b/Plugins/org.mitk.gui.common/src/mitkDataStorageEditorInput.cpp
index 8f1acbe999..c30ab0fe88 100644
--- a/Plugins/org.mitk.gui.common/src/mitkDataStorageEditorInput.cpp
+++ b/Plugins/org.mitk.gui.common/src/mitkDataStorageEditorInput.cpp
@@ -1,72 +1,71 @@
-/*=========================================================================
+/*===================================================================
-Program: Medical Imaging & Interaction Toolkit
-Language: C++
-Date: $Date$
-Version: $Revision$
+The Medical Imaging Interaction Toolkit (MITK)
-Copyright (c) German Cancer Research Center, Division of Medical and
-Biological Informatics. All rights reserved.
-See MITKCopyright.txt or http://www.mitk.org/copyright.html for details.
+Copyright (c) German Cancer Research Center,
+Division of Medical and Biological Informatics.
+All rights reserved.
-This software is distributed WITHOUT ANY WARRANTY; without even
-the implied warranty of MERCHANTABILITY or FITNESS FOR A PARTICULAR
-PURPOSE. See the above copyright notices for more information.
+This software is distributed WITHOUT ANY WARRANTY; without
+even the implied warranty of MERCHANTABILITY or FITNESS FOR
+A PARTICULAR PURPOSE.
-=========================================================================*/
+See LICENSE.txt or http://www.mitk.org for details.
+
+===================================================================*/
#include "mitkDataStorageEditorInput.h"
#include
#include
namespace mitk
{
DataStorageEditorInput::DataStorageEditorInput()
{
}
DataStorageEditorInput::DataStorageEditorInput(IDataStorageReference::Pointer ref)
{
m_DataStorageRef = ref;
}
bool DataStorageEditorInput::Exists() const
{
return true;
}
std::string DataStorageEditorInput::GetName() const
{
return "DataStorage Scene";
}
std::string DataStorageEditorInput::GetToolTipText() const
{
return "";
}
bool DataStorageEditorInput::operator==(const berry::Object* o) const
{
if (const DataStorageEditorInput* input = dynamic_cast(o))
return this->m_DataStorageRef == input->m_DataStorageRef;
return false;
}
IDataStorageReference::Pointer
DataStorageEditorInput::GetDataStorageReference()
{
if (m_DataStorageRef.IsNull())
{
berry::ServiceRegistry& serviceRegistry = berry::Platform::GetServiceRegistry();
IDataStorageService::Pointer dataService = serviceRegistry.GetServiceById(IDataStorageService::ID);
if (!dataService) return IDataStorageReference::Pointer(0);
m_DataStorageRef = dataService->GetDefaultDataStorage();
}
return m_DataStorageRef;
}
}
diff --git a/Plugins/org.mitk.gui.common/src/mitkDataStorageEditorInput.h b/Plugins/org.mitk.gui.common/src/mitkDataStorageEditorInput.h
index aa7f239073..f9af03a772 100644
--- a/Plugins/org.mitk.gui.common/src/mitkDataStorageEditorInput.h
+++ b/Plugins/org.mitk.gui.common/src/mitkDataStorageEditorInput.h
@@ -1,60 +1,59 @@
-/*=========================================================================
+/*===================================================================
-Program: Medical Imaging & Interaction Toolkit
-Language: C++
-Date: $Date$
-Version: $Revision$
+The Medical Imaging Interaction Toolkit (MITK)
-Copyright (c) German Cancer Research Center, Division of Medical and
-Biological Informatics. All rights reserved.
-See MITKCopyright.txt or http://www.mitk.org/copyright.html for details.
+Copyright (c) German Cancer Research Center,
+Division of Medical and Biological Informatics.
+All rights reserved.
-This software is distributed WITHOUT ANY WARRANTY; without even
-the implied warranty of MERCHANTABILITY or FITNESS FOR A PARTICULAR
-PURPOSE. See the above copyright notices for more information.
+This software is distributed WITHOUT ANY WARRANTY; without
+even the implied warranty of MERCHANTABILITY or FITNESS FOR
+A PARTICULAR PURPOSE.
-=========================================================================*/
+See LICENSE.txt or http://www.mitk.org for details.
+
+===================================================================*/
#ifndef MITKDATASTORAGEEDITORINPUT_H_
#define MITKDATASTORAGEEDITORINPUT_H_
#include
#include
#include
namespace mitk
{
/**
* \ingroup org_mitk_gui_common
*
* \brief An editor input based on a mitk::DataStorage.
*
* This editor input is usually used in render window editors inheriting from
* QmitkAbstractRenderEditor.
*/
class MITK_GUI_COMMON_PLUGIN DataStorageEditorInput : public berry::IEditorInput
{
public:
berryObjectMacro(DataStorageEditorInput);
DataStorageEditorInput();
DataStorageEditorInput(IDataStorageReference::Pointer ref);
bool Exists() const;
std::string GetName() const;
std::string GetToolTipText() const;
IDataStorageReference::Pointer GetDataStorageReference();
bool operator==(const berry::Object*) const;
private:
IDataStorageReference::Pointer m_DataStorageRef;
};
}
#endif /*MITKDATASTORAGEEDITORINPUT_H_*/
diff --git a/Plugins/org.mitk.gui.common/src/mitkILifecycleAwarePart.h b/Plugins/org.mitk.gui.common/src/mitkILifecycleAwarePart.h
index e53ded00d0..615b2fd83c 100644
--- a/Plugins/org.mitk.gui.common/src/mitkILifecycleAwarePart.h
+++ b/Plugins/org.mitk.gui.common/src/mitkILifecycleAwarePart.h
@@ -1,59 +1,58 @@
-/*=========================================================================
+/*===================================================================
-Program: Medical Imaging & Interaction Toolkit
-Language: C++
-Date: $Date$
-Version: $Revision: 18127 $
+The Medical Imaging Interaction Toolkit (MITK)
-Copyright (c) German Cancer Research Center, Division of Medical and
-Biological Informatics. All rights reserved.
-See MITKCopyright.txt or http://www.mitk.org/copyright.html for details.
+Copyright (c) German Cancer Research Center,
+Division of Medical and Biological Informatics.
+All rights reserved.
-This software is distributed WITHOUT ANY WARRANTY; without even
-the implied warranty of MERCHANTABILITY or FITNESS FOR A PARTICULAR
-PURPOSE. See the above copyright notices for more information.
+This software is distributed WITHOUT ANY WARRANTY; without
+even the implied warranty of MERCHANTABILITY or FITNESS FOR
+A PARTICULAR PURPOSE.
-=========================================================================*/
+See LICENSE.txt or http://www.mitk.org for details.
+
+===================================================================*/
#ifndef MITKILIFECYCLEAWAREPART_H
#define MITKILIFECYCLEAWAREPART_H
namespace mitk {
/**
* \ingroup org_mitk_gui_common
*
* \brief Interface for a MITK Workbench part which wants to be notified about lifecycle changes.
*
* This interface is intended to be implemented by subclasses of berry::IWorkbenchPart. MITK Workbench parts
* implementing this interface will be notified about their lifecycle changes. The same effect could
* be achieved by registering a custom berry::IPartListener.
*
* \note There are no "Closed()" or "Opened()" methods. These correspond to the constructor and
* desctructor of the Workbench part class.
*
* \see berry::IPartListener
* \see mitk::IZombieViewPart
*/
struct ILifecycleAwarePart
{
virtual ~ILifecycleAwarePart() {}
/** \see berry::IPartListener::PartActivated */
virtual void Activated() = 0;
/** \see berry::IPartListener::PartDeactivated */
virtual void Deactivated() = 0;
/** \see berry::IPartListener::PartVisible */
virtual void Visible() = 0;
/** \see berry::IPartListener::PartHidden */
virtual void Hidden() = 0;
};
}
#endif // MITKILIFECYCLEAWAREPART_H
diff --git a/Plugins/org.mitk.gui.common/src/mitkILinkedRenderWindowPart.h b/Plugins/org.mitk.gui.common/src/mitkILinkedRenderWindowPart.h
index 2cc427f485..911f82cf5e 100644
--- a/Plugins/org.mitk.gui.common/src/mitkILinkedRenderWindowPart.h
+++ b/Plugins/org.mitk.gui.common/src/mitkILinkedRenderWindowPart.h
@@ -1,91 +1,90 @@
-/*=========================================================================
+/*===================================================================
- Program: Medical Imaging & Interaction Toolkit
- Language: C++
- Date: $Date$
- Version: $Revision$
+The Medical Imaging Interaction Toolkit (MITK)
- Copyright (c) German Cancer Research Center, Division of Medical and
- Biological Informatics. All rights reserved.
- See MITKCopyright.txt or http://www.mitk.org/copyright.html for details.
+Copyright (c) German Cancer Research Center,
+Division of Medical and Biological Informatics.
+All rights reserved.
- This software is distributed WITHOUT ANY WARRANTY; without even
- the implied warranty of MERCHANTABILITY or FITNESS FOR A PARTICULAR
- PURPOSE. See the above copyright notices for more information.
+This software is distributed WITHOUT ANY WARRANTY; without
+even the implied warranty of MERCHANTABILITY or FITNESS FOR
+A PARTICULAR PURPOSE.
- =========================================================================*/
+See LICENSE.txt or http://www.mitk.org for details.
+
+===================================================================*/
#ifndef MITKILINKEDRENDERWINDOWPART_H
#define MITKILINKEDRENDERWINDOWPART_H
#include "mitkIRenderWindowPart.h"
namespace mitk {
class SlicesRotator;
class SlicesSwiveller;
/**
* \ingroup org_mitk_gui_common
*
* \brief Extends the IRenderWindowPart interface with methods for controlling linked
* render windows.
*
* This inteface should be implemented by subclasses of berry::IWorkbenchPart if they
* provided several linked QmitkRenderWindow instances.
*/
struct ILinkedRenderWindowPart : public virtual IRenderWindowPart {
/**
* Get the mitk::SlicesRotator.
*
* \return A mitk::SlicesRotator instance if rotating slices is supported;
* NULL
otherwise.
*/
virtual mitk::SlicesRotator* GetSlicesRotator() const = 0;
/**
* Get the mitk::SlicesSwiveller.
*
* \return A mitk::SlicesSwiveller instance if swivelling slices is supported;
* NULL
otherwise.
*/
virtual mitk::SlicesSwiveller* GetSlicesSwiveller() const = 0;
/**
* Enable or disable the slicing planes linking the QmitkRenderWindow instances.
*
* \param enable true
if the slicing planes should be enabled;
* false
otherwise.
*/
virtual void EnableSlicingPlanes(bool enable) = 0;
/**
* Get the enabled status of the slicing planes.
*
* \return true
if the slicing planes are enabled; false
* otherwise.
*/
virtual bool IsSlicingPlanesEnabled() const = 0;
/**
* Enable or disalbe linked navigation.
*
* \param enable If true
, setting the selected position in one QmitkRenderWindow
* affects the positions in the linked windows. If false
, linked navigation
* is disabled.
*/
virtual void EnableLinkedNavigation(bool enable) = 0;
/**
* Get the enabled status of linked navigation.
*
* \return true
if linked navigation is enabled; false
* otherwise.
*/
virtual bool IsLinkedNavigationEnabled() const = 0;
};
}
#endif // MITKILINKEDRENDERWINDOWPART_H
diff --git a/Plugins/org.mitk.gui.common/src/mitkIRenderWindowPart.cpp b/Plugins/org.mitk.gui.common/src/mitkIRenderWindowPart.cpp
index 9e9677284c..c6d11755e2 100644
--- a/Plugins/org.mitk.gui.common/src/mitkIRenderWindowPart.cpp
+++ b/Plugins/org.mitk.gui.common/src/mitkIRenderWindowPart.cpp
@@ -1,27 +1,26 @@
-/*=========================================================================
+/*===================================================================
- Program: Medical Imaging & Interaction Toolkit
- Language: C++
- Date: $Date$
- Version: $Revision$
+The Medical Imaging Interaction Toolkit (MITK)
- Copyright (c) German Cancer Research Center, Division of Medical and
- Biological Informatics. All rights reserved.
- See MITKCopyright.txt or http://www.mitk.org/copyright.html for details.
+Copyright (c) German Cancer Research Center,
+Division of Medical and Biological Informatics.
+All rights reserved.
- This software is distributed WITHOUT ANY WARRANTY; without even
- the implied warranty of MERCHANTABILITY or FITNESS FOR A PARTICULAR
- PURPOSE. See the above copyright notices for more information.
+This software is distributed WITHOUT ANY WARRANTY; without
+even the implied warranty of MERCHANTABILITY or FITNESS FOR
+A PARTICULAR PURPOSE.
- =========================================================================*/
+See LICENSE.txt or http://www.mitk.org for details.
+
+===================================================================*/
#include "mitkIRenderWindowPart.h"
namespace mitk {
const QString IRenderWindowPart::DECORATION_BORDER = "border";
const QString IRenderWindowPart::DECORATION_LOGO = "logo";
const QString IRenderWindowPart::DECORATION_MENU = "menu";
const QString IRenderWindowPart::DECORATION_BACKGROUND = "background";
}
diff --git a/Plugins/org.mitk.gui.common/src/mitkIRenderWindowPart.h b/Plugins/org.mitk.gui.common/src/mitkIRenderWindowPart.h
index cee4fc9374..b557f214bb 100644
--- a/Plugins/org.mitk.gui.common/src/mitkIRenderWindowPart.h
+++ b/Plugins/org.mitk.gui.common/src/mitkIRenderWindowPart.h
@@ -1,191 +1,190 @@
-/*=========================================================================
+/*===================================================================
- Program: Medical Imaging & Interaction Toolkit
- Language: C++
- Date: $Date$
- Version: $Revision$
+The Medical Imaging Interaction Toolkit (MITK)
- Copyright (c) German Cancer Research Center, Division of Medical and
- Biological Informatics. All rights reserved.
- See MITKCopyright.txt or http://www.mitk.org/copyright.html for details.
+Copyright (c) German Cancer Research Center,
+Division of Medical and Biological Informatics.
+All rights reserved.
- This software is distributed WITHOUT ANY WARRANTY; without even
- the implied warranty of MERCHANTABILITY or FITNESS FOR A PARTICULAR
- PURPOSE. See the above copyright notices for more information.
+This software is distributed WITHOUT ANY WARRANTY; without
+even the implied warranty of MERCHANTABILITY or FITNESS FOR
+A PARTICULAR PURPOSE.
- =========================================================================*/
+See LICENSE.txt or http://www.mitk.org for details.
+
+===================================================================*/
#ifndef MITKIRENDERWINDOWPART_H
#define MITKIRENDERWINDOWPART_H
#include
#include
#include
#include
#include
#include
#include
class QmitkRenderWindow;
namespace mitk {
struct IRenderingManager;
class SliceNavigationController;
/**
* \ingroup org_mitk_gui_common
*
* \brief Interface for a MITK Workbench Part providing a render window.
*
* This interface allows generic access to Workbench parts which provide some
* kind of render window. The interface is intended to be implemented by
* subclasses of berry::IWorkbenchPart. Usually, the interface is implemented
* by a Workbench editor.
*
* A IRenderWindowPart provides zero or more QmitkRenderWindow instances which can
* be controlled via this interface. QmitkRenderWindow instances have an associated
* \e id, which is implementation specific. However, implementations should consider
* to use one of the following ids for certain QmitkRenderWindow instances to maximize
* reusability (they are free to map multiple ids to one QmitkRenderWindow internally):
*
* - transversal
* - sagittal
* - coronal
* - 3d
*
*
* \see ILinkedRenderWindowPart
* \see IRenderWindowPartListener
* \see QmitkAbstractRenderEditor
*/
struct MITK_GUI_COMMON_PLUGIN IRenderWindowPart {
static const QString DECORATION_BORDER; // = "border"
static const QString DECORATION_LOGO; // = "logo"
static const QString DECORATION_MENU; // = "menu"
static const QString DECORATION_BACKGROUND; // = "background;
virtual ~IRenderWindowPart() {}
/**
* Get the currently active (focused) render window.
* Focus handling is implementation specific.
*
* \return The active QmitkRenderWindow instance; NULL
* if no render window is active.
*/
virtual QmitkRenderWindow* GetActiveRenderWindow() const = 0;
/**
* Get all render windows with their ids.
*
* \return A hash map mapping the render window id to the QmitkRenderWindow instance.
*/
virtual QHash GetRenderWindows() const = 0;
/**
* Get a render window with a specific id.
*
* \param id The render window id.
* \return The QmitkRenderWindow instance for id
*/
virtual QmitkRenderWindow* GetRenderWindow(const QString& id) const = 0;
/**
* Get the rendering manager used by this render window part.
*
* \return The current IRenderingManager instance or NULL
* if no rendering manager is used.
*/
virtual mitk::IRenderingManager* GetRenderingManager() const = 0;
/**
* Request an update of all render windows.
*
* \param requestType Specifies the type of render windows for which an update
* will be requested.
*/
virtual void RequestUpdate(mitk::RenderingManager::RequestType requestType = mitk::RenderingManager::REQUEST_UPDATE_ALL) = 0;
/**
* Force an immediate update of all render windows.
*
* \param requestType Specifies the type of render windows for which an immediate update
* will be requested.
*/
virtual void ForceImmediateUpdate(mitk::RenderingManager::RequestType requestType = mitk::RenderingManager::REQUEST_UPDATE_ALL) = 0;
/**
* Get the SliceNavigationController for controlling time positions.
*
* \return A SliceNavigationController if the render window supports this
* operation; otherwise returns NULL
.
*/
virtual mitk::SliceNavigationController* GetTimeNavigationController() const = 0;
/**
* Get the selected position in the render window with id id
* or in the active render window if id
is NULL.
*
* \param id The render window id.
* \return The currently selected position in world coordinates.
*/
virtual mitk::Point3D GetSelectedPosition(const QString& id = QString()) const = 0;
/**
* Set the selected position in the render window with id id
* or in the active render window if id
is NULL.
*
* \param pos The position in world coordinates which should be selected.
* \param id The render window id in which the selection should take place.
*/
virtual void SetSelectedPosition(const mitk::Point3D& pos, const QString& id = QString()) = 0;
/**
* Enable \e decorations like colored borders, menu widgets, logos, text annotations, etc.
*
* Decorations are implementation specific. A set of standardized decoration names is listed
* in GetDecorations().
*
* \param enable If true
enable the decorations specified in decorations
,
* otherwise disable them.
* \param decorations A list of decoration names. If empty, all supported decorations are affected.
*
* \see GetDecorations()
*/
virtual void EnableDecorations(bool enable, const QStringList& decorations = QStringList()) = 0;
/**
* Return if a specific decoration is enabled.
*
* \return true
if the decoration is enabled, false
if it is disabled
* or unknown.
*
* \see GetDecorations()
*/
virtual bool IsDecorationEnabled(const QString& decoration) const = 0;
/**
* Get a list of supported decorations.
*
* The following decoration names are standardized and should not be used for other decoration types:
*
* - \e DECORATION_BORDER Any border decorations like colored rectangles, etc.
*
- \e DECORATION_MENU Menus associated with render windows
*
- \e DECORATION_BACKGROUND All kinds of backgrounds (patterns, gradients, etc.) except for solid colored backgrounds
*
- \e DECORATION_LOGO Any kind of logo overlayed on the rendered scene
*
*
* \return A list of supported decoration names.
*/
virtual QStringList GetDecorations() const = 0;
};
}
Q_DECLARE_INTERFACE(mitk::IRenderWindowPart, "org.mitk.ui.IRenderWindowPart")
#endif // MITKIRENDERWINDOWPART_H
diff --git a/Plugins/org.mitk.gui.common/src/mitkIRenderWindowPartListener.h b/Plugins/org.mitk.gui.common/src/mitkIRenderWindowPartListener.h
index b7abf8b0a2..332e88bed9 100644
--- a/Plugins/org.mitk.gui.common/src/mitkIRenderWindowPartListener.h
+++ b/Plugins/org.mitk.gui.common/src/mitkIRenderWindowPartListener.h
@@ -1,59 +1,58 @@
-/*=========================================================================
+/*===================================================================
-Program: Medical Imaging & Interaction Toolkit
-Language: C++
-Date: $Date$
-Version: $Revision: 18127 $
+The Medical Imaging Interaction Toolkit (MITK)
-Copyright (c) German Cancer Research Center, Division of Medical and
-Biological Informatics. All rights reserved.
-See MITKCopyright.txt or http://www.mitk.org/copyright.html for details.
+Copyright (c) German Cancer Research Center,
+Division of Medical and Biological Informatics.
+All rights reserved.
-This software is distributed WITHOUT ANY WARRANTY; without even
-the implied warranty of MERCHANTABILITY or FITNESS FOR A PARTICULAR
-PURPOSE. See the above copyright notices for more information.
+This software is distributed WITHOUT ANY WARRANTY; without
+even the implied warranty of MERCHANTABILITY or FITNESS FOR
+A PARTICULAR PURPOSE.
-=========================================================================*/
+See LICENSE.txt or http://www.mitk.org for details.
+
+===================================================================*/
#ifndef MITKIRENDERWINDOWPARTLISTENER_H
#define MITKIRENDERWINDOWPARTLISTENER_H
namespace mitk {
struct IRenderWindowPart;
/**
* \ingroup org_mitk_gui_common
*
* \brief Interface for berry::IViewPart implementations to be notified about mitk::IRenderWindowPart lifecycle changes.
*
* This interface is intended to be implemented by subclasses of berry::IWorkbenchPart. If implemented,
* the interface methods are called automatically if a Workbench part which implementes mitk::IRenderWindowPart
* is activated or deactivated.
*
* The notion of activated and deactivated is slightly different from the usual Workbench part lifecycle.
*/
struct IRenderWindowPartListener
{
virtual ~IRenderWindowPartListener() {}
/**
* Called when a IRenderWindowPart is activated or if it becomes visible and no
* other IRenderWindowPart was activated before.
*
* \param renderWindowPart The newly activated IRenderWindowPart.
*/
virtual void RenderWindowPartActivated(mitk::IRenderWindowPart* renderWindowPart) = 0;
/**
* Called when a IRenderWindowPart becomes invisible and if it was active before.
*
* \param renderWindowPart The deactivated IRenderWindowPart.
*/
virtual void RenderWindowPartDeactivated(mitk::IRenderWindowPart* renderWindowPart) = 0;
};
}
#endif // MITKIRENDERWINDOWPARTLISTENER_H
diff --git a/Plugins/org.mitk.gui.common/src/mitkIRenderingManager.cpp b/Plugins/org.mitk.gui.common/src/mitkIRenderingManager.cpp
index 987637c780..7d20c87714 100644
--- a/Plugins/org.mitk.gui.common/src/mitkIRenderingManager.cpp
+++ b/Plugins/org.mitk.gui.common/src/mitkIRenderingManager.cpp
@@ -1,190 +1,189 @@
-/*=========================================================================
+/*===================================================================
-Program: Medical Imaging & Interaction Toolkit
-Language: C++
-Date: $Date$
-Version: $Revision$
+The Medical Imaging Interaction Toolkit (MITK)
-Copyright (c) German Cancer Research Center, Division of Medical and
-Biological Informatics. All rights reserved.
-See MITKCopyright.txt or http://www.mitk.org/copyright.html for details.
+Copyright (c) German Cancer Research Center,
+Division of Medical and Biological Informatics.
+All rights reserved.
-This software is distributed WITHOUT ANY WARRANTY; without even
-the implied warranty of MERCHANTABILITY or FITNESS FOR A PARTICULAR
-PURPOSE. See the above copyright notices for more information.
+This software is distributed WITHOUT ANY WARRANTY; without
+even the implied warranty of MERCHANTABILITY or FITNESS FOR
+A PARTICULAR PURPOSE.
-=========================================================================*/
+See LICENSE.txt or http://www.mitk.org for details.
+
+===================================================================*/
#include "mitkIRenderingManager.h"
namespace mitk {
struct RenderingManagerInterface : public IRenderingManager
{
RenderingManagerInterface(RenderingManager::Pointer manager)
: m_RM(manager)
{}
QList GetAllRegisteredVtkRenderWindows() const
{
RenderingManager::RenderWindowVector vec(m_RM->GetAllRegisteredRenderWindows());
QList result;
for (RenderingManager::RenderWindowVector::iterator i = vec.begin();
i != vec.end(); ++i)
{
result.append(*i);
}
return result;
}
void RequestUpdate( vtkRenderWindow *renderWindow )
{
m_RM->RequestUpdate(renderWindow);
}
void ForceImmediateUpdate( vtkRenderWindow *renderWindow )
{
m_RM->ForceImmediateUpdate(renderWindow);
}
void RequestUpdateAll( RenderingManager::RequestType type )
{
m_RM->RequestUpdateAll(type);
}
void ForceImmediateUpdateAll( RenderingManager::RequestType type )
{
m_RM->ForceImmediateUpdateAll(type);
}
bool InitializeViews( const Geometry3D *geometry,
RenderingManager::RequestType type = RenderingManager::REQUEST_UPDATE_ALL,
bool preserveRoughOrientationInWorldSpace = false )
{
return m_RM->InitializeViews( geometry, type, preserveRoughOrientationInWorldSpace);
}
bool InitializeViews( RenderingManager::RequestType type )
{
return m_RM->InitializeViews(type);
}
bool InitializeView( vtkRenderWindow *renderWindow, const Geometry3D *geometry,
bool initializeGlobalTimeSNC = false)
{
return m_RM->InitializeView(renderWindow, geometry, initializeGlobalTimeSNC);
}
bool InitializeView( vtkRenderWindow *renderWindow )
{
return m_RM->InitializeView(renderWindow);
}
const SliceNavigationController *GetTimeNavigationController() const
{
return m_RM->GetTimeNavigationController();
}
SliceNavigationController *GetTimeNavigationController()
{
return m_RM->GetTimeNavigationController();
}
bool IsRendering() const
{
return m_RM->IsRendering();
}
void AbortRendering()
{
m_RM->AbortRendering();
}
void SetLODIncreaseBlocked(bool blocked)
{
m_RM->SetLODIncreaseBlocked(blocked);
}
bool GetLODIncreaseBlocked() const
{
return m_RM->GetLODIncreaseBlocked();
}
void SetLODAbortMechanismEnabled(bool abort)
{
m_RM->SetLODAbortMechanismEnabled(abort);
}
bool GetLODAbortMechanismEnabled() const
{
return m_RM->GetLODAbortMechanismEnabled();
}
void SetDepthPeelingEnabled(bool enabled)
{
m_RM->SetDepthPeelingEnabled(enabled);
}
void SetMaxNumberOfPeels(int maxNumber)
{
m_RM->SetMaxNumberOfPeels(maxNumber);
}
int GetNextLOD( BaseRenderer* renderer ) const
{
return m_RM->GetNextLOD(renderer);
}
void SetMaximumLOD( unsigned int max )
{
m_RM->SetMaximumLOD(max);
}
void SetShading( bool state, unsigned int lod )
{
m_RM->SetShading(state, lod);
}
bool GetShading( unsigned int lod )
{
return m_RM->GetShading(lod);
}
void SetClippingPlaneStatus( bool status )
{
m_RM->SetClippingPlaneStatus(status);
}
bool GetClippingPlaneStatus()
{
return m_RM->GetClippingPlaneStatus();
}
void SetShadingValues( float ambient, float diffuse,
float specular, float specpower )
{
m_RM->SetShadingValues(ambient, diffuse, specular, specpower);
}
QList GetShadingValues() const
{
RenderingManager::FloatVector vec(m_RM->GetShadingValues());
QList result;
for (RenderingManager::FloatVector::iterator i = vec.begin();
i != vec.end(); ++i)
{
result.push_back(*i);
}
return result;
}
const RenderingManager::Pointer m_RM;
};
IRenderingManager* MakeRenderingManagerInterface(RenderingManager::Pointer manager)
{
return new RenderingManagerInterface(manager);
}
}
diff --git a/Plugins/org.mitk.gui.common/src/mitkIRenderingManager.h b/Plugins/org.mitk.gui.common/src/mitkIRenderingManager.h
index ef9ab0973b..f919b6d560 100644
--- a/Plugins/org.mitk.gui.common/src/mitkIRenderingManager.h
+++ b/Plugins/org.mitk.gui.common/src/mitkIRenderingManager.h
@@ -1,159 +1,158 @@
-/*=========================================================================
+/*===================================================================
-Program: Medical Imaging & Interaction Toolkit
-Language: C++
-Date: $Date$
-Version: $Revision$
+The Medical Imaging Interaction Toolkit (MITK)
-Copyright (c) German Cancer Research Center, Division of Medical and
-Biological Informatics. All rights reserved.
-See MITKCopyright.txt or http://www.mitk.org/copyright.html for details.
+Copyright (c) German Cancer Research Center,
+Division of Medical and Biological Informatics.
+All rights reserved.
-This software is distributed WITHOUT ANY WARRANTY; without even
-the implied warranty of MERCHANTABILITY or FITNESS FOR A PARTICULAR
-PURPOSE. See the above copyright notices for more information.
+This software is distributed WITHOUT ANY WARRANTY; without
+even the implied warranty of MERCHANTABILITY or FITNESS FOR
+A PARTICULAR PURPOSE.
-=========================================================================*/
+See LICENSE.txt or http://www.mitk.org for details.
+
+===================================================================*/
#ifndef MITKIRENDERINGMANAGER_H
#define MITKIRENDERINGMANAGER_H
#include
#include
#include
#include
namespace mitk {
/**
* \ingroup org_mitk_gui_common
*
* \brief An interface for accessing a mitk::RenderingManager instance.
*
* This interface acts as a wrapper to a mitk::RenderingManager instance, hiding some
* methods from the user.
*
* \see MakeRenderingManagerInterface
*/
struct IRenderingManager {
virtual ~IRenderingManager() {}
/** Get a list of all registered RenderWindows */
virtual QList GetAllRegisteredVtkRenderWindows() const = 0;
/**
* Requests an update for the specified RenderWindow, to be executed as
* soon as the main loop is ready for rendering.
*/
virtual void RequestUpdate( vtkRenderWindow *renderWindow ) = 0;
/** Immediately executes an update of the specified RenderWindow. */
virtual void ForceImmediateUpdate( vtkRenderWindow *renderWindow ) = 0;
/**
* Requests all currently registered RenderWindows to be updated.
* If only 2D or 3D windows should be updated, this can be specified
* via the parameter requestType.
*/
virtual void RequestUpdateAll( RenderingManager::RequestType type = RenderingManager::REQUEST_UPDATE_ALL ) = 0;
/**
* Immediately executes an update of all registered RenderWindows.
* If only 2D or 3D windows should be updated, this can be specified
* via the parameter requestType.
*/
virtual void ForceImmediateUpdateAll( RenderingManager::RequestType type = RenderingManager::REQUEST_UPDATE_ALL ) = 0;
/** Initializes the windows specified by requestType to the given geometry. */
virtual bool InitializeViews( const Geometry3D *geometry,
RenderingManager::RequestType type = RenderingManager::REQUEST_UPDATE_ALL,
bool preserveRoughOrientationInWorldSpace = false ) = 0;
/**
* Initializes the windows to the default viewing direction
* (geomtry information is NOT changed).
*/
virtual bool InitializeViews( RenderingManager::RequestType type = RenderingManager::REQUEST_UPDATE_ALL ) = 0;
/**
* Initializes the specified window to the given geometry. Set
* "initializeGlobalTimeSNC" to true in order to use this geometry as
* global TimeSlicedGeometry.
*/
virtual bool InitializeView( vtkRenderWindow *renderWindow, const Geometry3D *geometry,
bool initializeGlobalTimeSNC = false) = 0;
/**
* Initializes the specified window to the default viewing direction
* (geomtry information is NOT changed).
*/
virtual bool InitializeView( vtkRenderWindow *renderWindow ) = 0;
/** Gets the SliceNavigationController responsible for time-slicing. */
virtual const SliceNavigationController *GetTimeNavigationController() const = 0;
/** Gets the SliceNavigationController responsible for time-slicing. */
virtual SliceNavigationController *GetTimeNavigationController() = 0;
virtual bool IsRendering() const = 0;
virtual void AbortRendering() = 0;
/** En-/Disable LOD increase globally. */
virtual void SetLODIncreaseBlocked(bool blocked) = 0;
/** Get LOD blocked status. */
virtual bool GetLODIncreaseBlocked() const = 0;
/** En-/Disable LOD abort mechanism. */
virtual void SetLODAbortMechanismEnabled(bool abort) = 0;
/** Get LOD abort mechanism status. */
virtual bool GetLODAbortMechanismEnabled() const = 0;
/** En-/Disable depth peeling for all renderers */
virtual void SetDepthPeelingEnabled(bool enabled) = 0;
/** Set maximum number of peels for all renderers */
virtual void SetMaxNumberOfPeels(int maxNumber) = 0;
virtual int GetNextLOD( BaseRenderer* renderer ) const = 0;
/** Set current LOD (NULL means all renderers)*/
virtual void SetMaximumLOD( unsigned int max ) = 0;
virtual void SetShading( bool state, unsigned int lod ) = 0;
virtual bool GetShading( unsigned int lod ) = 0;
virtual void SetClippingPlaneStatus( bool status ) = 0;
virtual bool GetClippingPlaneStatus() = 0;
virtual void SetShadingValues( float ambient, float diffuse,
float specular, float specpower ) = 0;
virtual QList GetShadingValues() const = 0;
};
}
Q_DECLARE_INTERFACE(mitk::IRenderingManager, "org.mitk.ui.IRenderingManager")
namespace mitk {
/**
* Create a IRenderManager interface for a given RenderingManager. Ownership of the
* returned pointer is transferred to the caller of this function.
*
* \param manager The RenderingManager instance for which to create a interface.
* \return A pointer to the interface object. The caller is responsible for deleting the pointer.
*/
MITK_GUI_COMMON_PLUGIN IRenderingManager* MakeRenderingManagerInterface(RenderingManager::Pointer manager);
}
#endif // MITKIRENDERINGMANAGER_H
diff --git a/Plugins/org.mitk.gui.common/src/mitkIZombieViewPart.h b/Plugins/org.mitk.gui.common/src/mitkIZombieViewPart.h
index 0eedfbf4aa..3e43c0db76 100644
--- a/Plugins/org.mitk.gui.common/src/mitkIZombieViewPart.h
+++ b/Plugins/org.mitk.gui.common/src/mitkIZombieViewPart.h
@@ -1,60 +1,59 @@
-/*=========================================================================
+/*===================================================================
-Program: Medical Imaging & Interaction Toolkit
-Language: C++
-Date: $Date$
-Version: $Revision: 18127 $
+The Medical Imaging Interaction Toolkit (MITK)
-Copyright (c) German Cancer Research Center, Division of Medical and
-Biological Informatics. All rights reserved.
-See MITKCopyright.txt or http://www.mitk.org/copyright.html for details.
+Copyright (c) German Cancer Research Center,
+Division of Medical and Biological Informatics.
+All rights reserved.
-This software is distributed WITHOUT ANY WARRANTY; without even
-the implied warranty of MERCHANTABILITY or FITNESS FOR A PARTICULAR
-PURPOSE. See the above copyright notices for more information.
+This software is distributed WITHOUT ANY WARRANTY; without
+even the implied warranty of MERCHANTABILITY or FITNESS FOR
+A PARTICULAR PURPOSE.
-=========================================================================*/
+See LICENSE.txt or http://www.mitk.org for details.
+
+===================================================================*/
#ifndef MITKIZOMBIEVIEWPART_H
#define MITKIZOMBIEVIEWPART_H
#include "mitkILifecycleAwarePart.h"
namespace mitk {
/**
* \ingroup org_mitk_gui_common
*
* \brief Interface for MITK Workbench Views with special \e Zombie state handling.
*
* Some MITK Views need to change the application state in a way which should not be affected
* by this View's activated/deactivated state. Examples are setting special interactors or removing
* the crosshair from a QmitkRenderWindow. Such MITK Views are called \emph{Zombie Views} because
* they partially outlive their own deactivation. Zombie Views are usually mutually exclusive.
*
* To ease the handling of Zombie Views, this interface acts as a marker to declare the implementing
* class being a Zombie View, meaning that it will change some application state when it is activated
* but will not reset it when deactivated.
*
* If a Zombie View is activated, the previously active Zombie View is notified by calling its
* ActivatedZombieView() method. It should then reset the application state.
*
* \see ILifecycleAwarePart
*/
struct IZombieViewPart : public virtual ILifecycleAwarePart
{
/**
* Called when another Zombie View was activated. This usually means that this part
* should clean up its Zombie state.
*
* \param zombieView The newly activate Zombie View.
*/
virtual void ActivatedZombieView(berry::IWorkbenchPartReference::Pointer zombieView) = 0;
};
}
#endif // MITKIZOMBIEVIEWPART_H
diff --git a/Plugins/org.mitk.gui.common/src/mitkWorkbenchUtil.cpp b/Plugins/org.mitk.gui.common/src/mitkWorkbenchUtil.cpp
index 25acbd33ba..654fa26e1c 100644
--- a/Plugins/org.mitk.gui.common/src/mitkWorkbenchUtil.cpp
+++ b/Plugins/org.mitk.gui.common/src/mitkWorkbenchUtil.cpp
@@ -1,255 +1,254 @@
-/*=========================================================================
+/*===================================================================
-Program: Medical Imaging & Interaction Toolkit
-Language: C++
-Date: $Date$
-Version: $Revision$
+The Medical Imaging Interaction Toolkit (MITK)
-Copyright (c) German Cancer Research Center, Division of Medical and
-Biological Informatics. All rights reserved.
-See MITKCopyright.txt or http://www.mitk.org/copyright.html for details.
+Copyright (c) German Cancer Research Center,
+Division of Medical and Biological Informatics.
+All rights reserved.
-This software is distributed WITHOUT ANY WARRANTY; without even
-the implied warranty of MERCHANTABILITY or FITNESS FOR A PARTICULAR
-PURPOSE. See the above copyright notices for more information.
+This software is distributed WITHOUT ANY WARRANTY; without
+even the implied warranty of MERCHANTABILITY or FITNESS FOR
+A PARTICULAR PURPOSE.
-=========================================================================*/
+See LICENSE.txt or http://www.mitk.org for details.
+
+===================================================================*/
#include "mitkWorkbenchUtil.h"
#include
#include
#include
#include
#include "mitkIDataStorageService.h"
#include "mitkDataStorageEditorInput.h"
#include "mitkRenderingManager.h"
#include "mitkIRenderWindowPart.h"
#include "mitkIRenderingManager.h"
#include "mitkProperties.h"
#include "mitkNodePredicateData.h"
#include "mitkNodePredicateNot.h"
#include "mitkNodePredicateProperty.h"
#include "mitkIOUtil.h"
#include "mitkWorkbenchUtil.h"
#include
#include
#include
#include "internal/org_mitk_gui_common_Activator.h"
namespace mitk {
struct WorkbenchUtilPrivate {
/**
* Get the editor descriptor for a given name using the editorDescriptor
* passed in as a default as a starting point.
*
* @param name
* The name of the element to open.
* @param editorReg
* The editor registry to do the lookups from.
* @param defaultDescriptor
* IEditorDescriptor or null
* @return IEditorDescriptor
* @throws PartInitException
* if no valid editor can be found
*/
static berry::IEditorDescriptor::Pointer GetEditorDescriptor(const QString& name,
berry::IEditorRegistry* editorReg,
berry::IEditorDescriptor::Pointer defaultDescriptor)
{
if (defaultDescriptor.IsNotNull())
{
return defaultDescriptor;
}
berry::IEditorDescriptor::Pointer editorDesc = defaultDescriptor;
// next check the OS for in-place editor (OLE on Win32)
if (editorReg->IsSystemInPlaceEditorAvailable(name.toStdString()))
{
editorDesc = editorReg->FindEditor(berry::IEditorRegistry::SYSTEM_INPLACE_EDITOR_ID);
}
// next check with the OS for an external editor
if (editorDesc.IsNull() && editorReg->IsSystemExternalEditorAvailable(name.toStdString()))
{
editorDesc = editorReg->FindEditor(berry::IEditorRegistry::SYSTEM_EXTERNAL_EDITOR_ID);
}
// if no valid editor found, bail out
if (editorDesc.IsNull())
{
throw berry::PartInitException("No editor found");
}
return editorDesc;
}
};
void WorkbenchUtil::LoadFiles(const QStringList &fileNames, berry::IWorkbenchWindow::Pointer window)
{
if (fileNames.empty())
return;
mitk::IDataStorageReference::Pointer dataStorageRef;
{
ctkPluginContext* context = mitk::PluginActivator::GetContext();
mitk::IDataStorageService* dss = 0;
ctkServiceReference dsRef = context->getServiceReference();
if (dsRef)
{
dss = context->getService(dsRef);
}
if (!dss)
{
QString msg = "IDataStorageService service not available. Unable to open files.";
MITK_WARN << msg.toStdString();
QMessageBox::warning(QApplication::activeWindow(), "Unable to open files", msg);
return;
}
// Get the active data storage (or the default one, if none is active)
dataStorageRef = dss->GetDataStorage();
context->ungetService(dsRef);
}
mitk::DataStorage::Pointer dataStorage = dataStorageRef->GetDataStorage();
// Do the actual work of loading the data into the data storage
std::vector fileNames2;
ctk::qListToSTLVector(fileNames, fileNames2);
const bool dsmodified = mitk::IOUtil::LoadFiles(fileNames2, *dataStorage);
// Check if there is an open perspective. If not, open the default perspective.
if (window->GetActivePage().IsNull())
{
std::string defaultPerspId = window->GetWorkbench()->GetPerspectiveRegistry()->GetDefaultPerspective();
window->GetWorkbench()->ShowPerspective(defaultPerspId, window);
}
try
{
// Activate the editor using the same data storage or open the default editor
mitk::DataStorageEditorInput::Pointer input(new mitk::DataStorageEditorInput(dataStorageRef));
berry::IEditorPart::Pointer editor = mitk::WorkbenchUtil::OpenEditor(window->GetActivePage(), input, true);
mitk::IRenderWindowPart* renderEditor = dynamic_cast(editor.GetPointer());
mitk::IRenderingManager* renderingManager = renderEditor == 0 ? 0 : renderEditor->GetRenderingManager();
if(dsmodified && renderingManager)
{
// 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
renderingManager->InitializeViews(bounds);
}
}
catch (const berry::PartInitException& e)
{
QString msg = "An error occurred when displaying the file(s): %1";
QMessageBox::warning(QApplication::activeWindow(), "Error displaying file",
msg.arg(QString::fromStdString(e.message())));
}
}
berry::IEditorPart::Pointer WorkbenchUtil::OpenEditor(berry::IWorkbenchPage::Pointer page,
berry::IEditorInput::Pointer input,
const QString &editorId, bool activate)
{
// sanity checks
if (page.IsNull())
{
throw std::invalid_argument("page argument must not be NULL");
}
// open the editor on the input
return page->OpenEditor(input, editorId.toStdString(), activate);
}
berry::IEditorPart::Pointer WorkbenchUtil::OpenEditor(berry::IWorkbenchPage::Pointer page,
mitk::DataStorageEditorInput::Pointer input,
bool activate,
bool determineContentType)
{
// sanity checks
if (page.IsNull())
{
throw std::invalid_argument("page argument must not be NULL");
}
// open the editor on the data storage
QString name = QString::fromStdString(input->GetName()) + ".mitk";
berry::IEditorDescriptor::Pointer editorDesc =
WorkbenchUtilPrivate::GetEditorDescriptor(name,
berry::PlatformUI::GetWorkbench()->GetEditorRegistry(),
GetDefaultEditor(name, determineContentType));
return page->OpenEditor(input, editorDesc->GetId(), activate);
}
berry::IEditorDescriptor::Pointer WorkbenchUtil::GetEditorDescriptor(
const QString& name, bool /*inferContentType*/)
{
if (name.isEmpty())
{
throw std::invalid_argument("name argument must not be empty");
}
// no used for now
//IContentType contentType = inferContentType ? Platform
// .getContentTypeManager().findContentTypeFor(name) : null;
berry::IEditorRegistry* editorReg = berry::PlatformUI::GetWorkbench()->GetEditorRegistry();
return WorkbenchUtilPrivate::GetEditorDescriptor(name, editorReg,
editorReg->GetDefaultEditor(name.toStdString() /*, contentType*/));
}
berry::IEditorDescriptor::Pointer WorkbenchUtil::GetDefaultEditor(const QString& name,
bool /*determineContentType*/)
{
// Try file specific editor.
berry::IEditorRegistry* editorReg = berry::PlatformUI::GetWorkbench()->GetEditorRegistry();
try
{
QString editorID; // = file.getPersistentProperty(EDITOR_KEY);
if (!editorID.isEmpty())
{
berry::IEditorDescriptor::Pointer desc = editorReg->FindEditor(editorID.toStdString());
if (desc.IsNotNull())
{
return desc;
}
}
}
catch (const berry::CoreException& e)
{
// do nothing
}
// IContentType contentType = null;
// if (determineContentType)
// {
// contentType = getContentType(file);
// }
// Try lookup with filename
return editorReg->GetDefaultEditor(name.toStdString()); //, contentType);
}
} // namespace mitk
diff --git a/Plugins/org.mitk.gui.common/src/mitkWorkbenchUtil.h b/Plugins/org.mitk.gui.common/src/mitkWorkbenchUtil.h
index f66e3f5ad0..d4583d7dc1 100644
--- a/Plugins/org.mitk.gui.common/src/mitkWorkbenchUtil.h
+++ b/Plugins/org.mitk.gui.common/src/mitkWorkbenchUtil.h
@@ -1,175 +1,174 @@
-/*=========================================================================
+/*===================================================================
-Program: Medical Imaging & Interaction Toolkit
-Language: C++
-Date: $Date$
-Version: $Revision$
+The Medical Imaging Interaction Toolkit (MITK)
-Copyright (c) German Cancer Research Center, Division of Medical and
-Biological Informatics. All rights reserved.
-See MITKCopyright.txt or http://www.mitk.org/copyright.html for details.
+Copyright (c) German Cancer Research Center,
+Division of Medical and Biological Informatics.
+All rights reserved.
-This software is distributed WITHOUT ANY WARRANTY; without even
-the implied warranty of MERCHANTABILITY or FITNESS FOR A PARTICULAR
-PURPOSE. See the above copyright notices for more information.
+This software is distributed WITHOUT ANY WARRANTY; without
+even the implied warranty of MERCHANTABILITY or FITNESS FOR
+A PARTICULAR PURPOSE.
-=========================================================================*/
+See LICENSE.txt or http://www.mitk.org for details.
+
+===================================================================*/
#ifndef MITKWORKBENCHUTIL_H
#define MITKWORKBENCHUTIL_H
#include
#include "mitkDataStorageEditorInput.h"
#include
#include
namespace mitk {
/**
* @ingroup org_mitk_gui_common
*
* @brief Utility class for loading data and opening editors in a MITK Workbench.
*
* @note Infering the content type is not yet supported (ignore the comments about it
* in the method documentation).
*/
struct MITK_GUI_COMMON_PLUGIN WorkbenchUtil
{
/**
* Loads the set of given files into the active data storage of the given Workbench window.
*
* If the window already has an editor open on the active datastorage then that editor
* is activated; otherwise the default editor for the "mitk" extension is activated.
*
* @param fileNames
* A list of file names with absolute path.
* @param wnd
* The Workbench window in which the data will be loaded.
*
* @see mitk::IDataNodeReader
*/
static void LoadFiles(const QStringList& fileNames, berry::IWorkbenchWindow::Pointer wnd);
/**
* Opens an editor on the given object.
*
* If the page already has an editor open on the target object then that
* editor is brought to front; otherwise, a new editor is opened. If
* activate == true
the editor will be activated.
*
*
* @param page
* the page in which the editor will be opened
* @param input
* the editor input
* @param editorId
* the id of the editor extension to use
* @param activate
* if true
the editor will be activated
* @return an open editor or null
if an external editor was
* opened
* @exception PartInitException
* if the editor could not be initialized
* @see IWorkbenchPage#OpenEditor(IEditorInput::Pointer, std::string, bool)
*/
static berry::IEditorPart::Pointer OpenEditor(berry::IWorkbenchPage::Pointer page,
berry::IEditorInput::Pointer input,
const QString& editorId, bool activate = false);
/**
* Opens an editor on the given file resource. This method will attempt to
* resolve the editor based on content-type bindings as well as traditional
* name/extension bindings if determineContentType
is
* true
.
*
* If the page already has an editor open on the target object then that
* editor is brought to front; otherwise, a new editor is opened. If
* activate == true
the editor will be activated.
*
*
* @param page
* the page in which the editor will be opened
* @param input
* the editor input
* @param activate
* if true
the editor will be activated
* @param determineContentType
* attempt to resolve the content type for this file
* @return an open editor or null
if an external editor was
* opened
* @exception PartInitException
* if the editor could not be initialized
* @see IWorkbenchPage#OpenEditor(IEditorInput::Pointer,std::string,bool)
*/
static berry::IEditorPart::Pointer OpenEditor(berry::IWorkbenchPage::Pointer page,
mitk::DataStorageEditorInput::Pointer input,
bool activate = false,
bool determineContentType = false);
/**
* Returns an editor descriptor appropriate for opening a file resource with
* the given name.
*
* The editor descriptor is determined using a multi-step process. This
* method will attempt to infer the content type of the file if
* inferContentType
is true
.
*
*
* - The file is consulted for a persistent property named
*
IDE.EDITOR_KEY
containing the preferred editor id to be
* used.
* - The workbench editor registry is consulted to determine if an editor
* extension has been registered for the file type. If so, an instance of
* the editor extension is opened on the file. See
*
IEditorRegistry#GetDefaultEditor(std::string)
.
* - The operating system is consulted to determine if an in-place
* component editor is available (e.g. OLE editor on Win32 platforms).
* - The operating system is consulted to determine if an external editor
* is available.
*
*
*
* @param name
* the file name
* @param inferContentType
* attempt to infer the content type from the file name if this
* is true
* @return an editor descriptor, appropriate for opening the file
* @throws PartInitException
* if no editor can be found
*/
static berry::IEditorDescriptor::Pointer GetEditorDescriptor(
const QString& name, bool inferContentType = true);
/**
* Returns the default editor for a given file. This method will attempt to
* resolve the editor based on content-type bindings as well as traditional
* name/extension bindings if determineContentType
is
* true
.
*
* A default editor id may be registered for a specific file using
* setDefaultEditor
. If the given file has a registered
* default editor id the default editor will derived from it. If not, the
* default editor is determined by taking the file name for the file and
* obtaining the default editor for that name.
*
*
* @param file
* the file
* @param determineContentType
* determine the content type for the given file
* @return the descriptor of the default editor, or null
if
* not found
*/
static berry::IEditorDescriptor::Pointer GetDefaultEditor(const QString& file,
bool determineContentType);
};
}
#endif // MITKWORKBENCHUTIL_H
diff --git a/Plugins/org.mitk.gui.qt.application/src/QmitkCloseProjectAction.cpp b/Plugins/org.mitk.gui.qt.application/src/QmitkCloseProjectAction.cpp
index fb9652c3f8..2d4ce1bc99 100644
--- a/Plugins/org.mitk.gui.qt.application/src/QmitkCloseProjectAction.cpp
+++ b/Plugins/org.mitk.gui.qt.application/src/QmitkCloseProjectAction.cpp
@@ -1,129 +1,128 @@
-/*=========================================================================
+/*===================================================================
-Program: Medical Imaging & Interaction Toolkit
-Language: C++
-Date: $Date: 2009-10-07 16:14:59 +0200 (Mi, 07 Okt 2009) $
-Version: $Revision: 19343 $
+The Medical Imaging Interaction Toolkit (MITK)
-Copyright (c) German Cancer Research Center, Division of Medical and
-Biological Informatics. All rights reserved.
-See MITKCopyright.txt or http://www.mitk.org/copyright.html for details.
+Copyright (c) German Cancer Research Center,
+Division of Medical and Biological Informatics.
+All rights reserved.
-This software is distributed WITHOUT ANY WARRANTY; without even
-the implied warranty of MERCHANTABILITY or FITNESS FOR A PARTICULAR
-PURPOSE. See the above copyright notices for more information.
+This software is distributed WITHOUT ANY WARRANTY; without
+even the implied warranty of MERCHANTABILITY or FITNESS FOR
+A PARTICULAR PURPOSE.
-=========================================================================*/
+See LICENSE.txt or http://www.mitk.org for details.
+
+===================================================================*/
#include "QmitkCloseProjectAction.h"
#include "internal/org_mitk_gui_qt_application_Activator.h"
#include
#include
#include
#include
#include
#include
#include
#include
QmitkCloseProjectAction::QmitkCloseProjectAction(berry::IWorkbenchWindow::Pointer window)
: QAction(0)
{
this->init(window);
}
QmitkCloseProjectAction::QmitkCloseProjectAction(const QIcon & icon, berry::IWorkbenchWindow::Pointer window)
: QAction(0)
{
this->setIcon(icon);
this->init(window);
}
void QmitkCloseProjectAction::init(berry::IWorkbenchWindow::Pointer window)
{
m_Window = window;
this->setParent(static_cast(m_Window->GetShell()->GetControl()));
this->setText("&Close Project...");
this->setToolTip("Close Project will remove all data objects from the application. This will free up the memory that is used by the data.");
m_Window = window;
this->connect(this, SIGNAL(triggered(bool)), this, SLOT(Run()));
}
void QmitkCloseProjectAction::Run()
{
try
{
ctkPluginContext* context = mitk::PluginActivator::GetContext();
mitk::IDataStorageService* dss = 0;
ctkServiceReference dsRef = context->getServiceReference();
if (dsRef)
{
dss = context->getService(dsRef);
}
if (!dss)
{
MITK_WARN << "IDataStorageService service not available. Unable to close project.";
context->ungetService(dsRef);
return;
}
mitk::IDataStorageReference::Pointer dataStorageRef = dss->GetActiveDataStorage();
if (dataStorageRef.IsNull())
{
// No active data storage set (i.e. not editor with a DataStorageEditorInput is active).
dataStorageRef = dss->GetDefaultDataStorage();
}
mitk::DataStorage::Pointer dataStorage = dataStorageRef->GetDataStorage();
if (dataStorage.IsNull())
{
MITK_WARN << "No data storage available. Cannot close project.";
return;
}
//check if we got the default datastorage and if there is anything else then helper object in the storage
if(dataStorageRef->IsDefault() &&
dataStorage->GetSubset(mitk::NodePredicateNot::New(mitk::NodePredicateProperty::New("helper object", mitk::BoolProperty::New(true))))->empty())
{
return;
}
/* Ask, if the user is sure about that */
QString msg = "Are you sure that you want to close the current project (%1)?\nThis will remove all data objects.";
if (QMessageBox::question(NULL, "Remove all data?", msg.arg(dataStorageRef->GetLabel()),
QMessageBox::Yes | QMessageBox::No) != QMessageBox::Yes)
{
return;
}
/* Remove everything */
mitk::DataStorage::SetOfObjects::ConstPointer nodesToRemove = dataStorage->GetAll();
dataStorage->Remove(nodesToRemove);
// Remove the datastorage from the data storage service
dss->RemoveDataStorageReference(dataStorageRef);
// Close all editors with this data storage as input
mitk::DataStorageEditorInput::Pointer dsInput(new mitk::DataStorageEditorInput(dataStorageRef));
std::vector dsEditors =
m_Window->GetActivePage()->FindEditors(dsInput, std::string(), berry::IWorkbenchPage::MATCH_INPUT);
if (!dsEditors.empty())
{
std::list editorsToClose;
editorsToClose.assign(dsEditors.begin(), dsEditors.end());
m_Window->GetActivePage()->CloseEditors(editorsToClose, false);
}
}
catch (std::exception& e)
{
MITK_ERROR << "Exception caught during closing project: " << e.what();
QMessageBox::warning(NULL, "Error", QString("An error occurred during Close Project: %1").arg(e.what()));
}
}
diff --git a/Plugins/org.mitk.gui.qt.application/src/QmitkCloseProjectAction.h b/Plugins/org.mitk.gui.qt.application/src/QmitkCloseProjectAction.h
index 5858850f4a..0b27ca5008 100644
--- a/Plugins/org.mitk.gui.qt.application/src/QmitkCloseProjectAction.h
+++ b/Plugins/org.mitk.gui.qt.application/src/QmitkCloseProjectAction.h
@@ -1,51 +1,50 @@
-/*=========================================================================
+/*===================================================================
-Program: Medical Imaging & Interaction Toolkit
-Language: C++
-Date: $Date: 2009-10-09 16:36:23 +0200 (Fr, 09 Okt 2009) $
-Version: $Revision: 19414 $
+The Medical Imaging Interaction Toolkit (MITK)
-Copyright (c) German Cancer Research Center, Division of Medical and
-Biological Informatics. All rights reserved.
-See MITKCopyright.txt or http://www.mitk.org/copyright.html for details.
+Copyright (c) German Cancer Research Center,
+Division of Medical and Biological Informatics.
+All rights reserved.
-This software is distributed WITHOUT ANY WARRANTY; without even
-the implied warranty of MERCHANTABILITY or FITNESS FOR A PARTICULAR
-PURPOSE. See the above copyright notices for more information.
+This software is distributed WITHOUT ANY WARRANTY; without
+even the implied warranty of MERCHANTABILITY or FITNESS FOR
+A PARTICULAR PURPOSE.
-=========================================================================*/
+See LICENSE.txt or http://www.mitk.org for details.
+
+===================================================================*/
#ifndef QmitkCloseProjectAction_H_
#define QmitkCloseProjectAction_H_
#ifdef __MINGW32__
// We need to include winbase.h here in order to declare
// atomic intrinsics like InterlockedIncrement correctly.
// Otherwhise, they would be declared wrong within qatomic_windows.h .
#include
#endif
#include
#include
#include
/**
* \ingroup org_mitk_gui_qt_application
*/
class MITK_QT_APP QmitkCloseProjectAction : public QAction
{
Q_OBJECT
public:
QmitkCloseProjectAction(berry::IWorkbenchWindow::Pointer window);
QmitkCloseProjectAction(const QIcon & icon, berry::IWorkbenchWindow::Pointer window);
protected slots:
void Run();
private:
void init(berry::IWorkbenchWindow::Pointer window);
berry::IWorkbenchWindow::Pointer m_Window;
};
#endif /*QmitkCloseProjectAction_H_*/
diff --git a/Plugins/org.mitk.gui.qt.application/src/QmitkDefaultDropTargetListener.cpp b/Plugins/org.mitk.gui.qt.application/src/QmitkDefaultDropTargetListener.cpp
index c21a8bda76..af185b2761 100644
--- a/Plugins/org.mitk.gui.qt.application/src/QmitkDefaultDropTargetListener.cpp
+++ b/Plugins/org.mitk.gui.qt.application/src/QmitkDefaultDropTargetListener.cpp
@@ -1,54 +1,53 @@
-/*=========================================================================
+/*===================================================================
-Program: Medical Imaging & Interaction Toolkit
-Language: C++
-Date: $Date$
-Version: $Revision$
+The Medical Imaging Interaction Toolkit (MITK)
-Copyright (c) German Cancer Research Center, Division of Medical and
-Biological Informatics. All rights reserved.
-See MITKCopyright.txt or http://www.mitk.org/copyright.html for details.
+Copyright (c) German Cancer Research Center,
+Division of Medical and Biological Informatics.
+All rights reserved.
-This software is distributed WITHOUT ANY WARRANTY; without even
-the implied warranty of MERCHANTABILITY or FITNESS FOR A PARTICULAR
-PURPOSE. See the above copyright notices for more information.
+This software is distributed WITHOUT ANY WARRANTY; without
+even the implied warranty of MERCHANTABILITY or FITNESS FOR
+A PARTICULAR PURPOSE.
-=========================================================================*/
+See LICENSE.txt or http://www.mitk.org for details.
+
+===================================================================*/
#include "QmitkDefaultDropTargetListener.h"
#include
#include
#include
#include
#include
#include
berry::IDropTargetListener::Events::Types QmitkDefaultDropTargetListener::GetDropTargetEventTypes() const
{
return Events::DROP;
}
void QmitkDefaultDropTargetListener::DropEvent(QDropEvent *event)
{
qDebug() << event->mimeData()->formats();
qDebug() << event->mimeData()->text();
QList fileNames = event->mimeData()->urls();
if (fileNames.empty())
return;
QStringList fileNames2;
//TODO Qt 4.7 API
//fileNames2.reserve(fileNames.size());
foreach(QUrl url, fileNames)
{
fileNames2.push_back(url.toLocalFile());
}
mitk::WorkbenchUtil::LoadFiles(fileNames2,
berry::PlatformUI::GetWorkbench()->GetActiveWorkbenchWindow());
event->accept();
}
diff --git a/Plugins/org.mitk.gui.qt.application/src/QmitkDefaultDropTargetListener.h b/Plugins/org.mitk.gui.qt.application/src/QmitkDefaultDropTargetListener.h
index bfefd59d52..9a26723dbb 100644
--- a/Plugins/org.mitk.gui.qt.application/src/QmitkDefaultDropTargetListener.h
+++ b/Plugins/org.mitk.gui.qt.application/src/QmitkDefaultDropTargetListener.h
@@ -1,39 +1,38 @@
-/*=========================================================================
+/*===================================================================
-Program: Medical Imaging & Interaction Toolkit
-Language: C++
-Date: $Date$
-Version: $Revision$
+The Medical Imaging Interaction Toolkit (MITK)
-Copyright (c) German Cancer Research Center, Division of Medical and
-Biological Informatics. All rights reserved.
-See MITKCopyright.txt or http://www.mitk.org/copyright.html for details.
+Copyright (c) German Cancer Research Center,
+Division of Medical and Biological Informatics.
+All rights reserved.
-This software is distributed WITHOUT ANY WARRANTY; without even
-the implied warranty of MERCHANTABILITY or FITNESS FOR A PARTICULAR
-PURPOSE. See the above copyright notices for more information.
+This software is distributed WITHOUT ANY WARRANTY; without
+even the implied warranty of MERCHANTABILITY or FITNESS FOR
+A PARTICULAR PURPOSE.
-=========================================================================*/
+See LICENSE.txt or http://www.mitk.org for details.
+
+===================================================================*/
#ifndef QMITKDEFAULTDROPTARGETLISTENER_H
#define QMITKDEFAULTDROPTARGETLISTENER_H
#include
#include
/**
* \ingroup org_mitk_gui_qt_application
*/
class MITK_QT_APP QmitkDefaultDropTargetListener : public berry::IDropTargetListener
{
public:
Events::Types GetDropTargetEventTypes() const;
void DropEvent(QDropEvent* event);
};
#endif // QMITKDEFAULTDROPTARGETLISTENER_H
diff --git a/Plugins/org.mitk.gui.qt.application/src/QmitkFileExitAction.cpp b/Plugins/org.mitk.gui.qt.application/src/QmitkFileExitAction.cpp
index 1b60840103..1013549b93 100644
--- a/Plugins/org.mitk.gui.qt.application/src/QmitkFileExitAction.cpp
+++ b/Plugins/org.mitk.gui.qt.application/src/QmitkFileExitAction.cpp
@@ -1,44 +1,43 @@
-/*=========================================================================
+/*===================================================================
-Program: Medical Imaging & Interaction Toolkit
-Language: C++
-Date: $Date: 2009-08-26 18:11:29 +0200 (Mi, 26 Aug 2009) $
-Version: $Revision: 18726 $
+The Medical Imaging Interaction Toolkit (MITK)
-Copyright (c) German Cancer Research Center, Division of Medical and
-Biological Informatics. All rights reserved.
-See MITKCopyright.txt or http://www.mitk.org/copyright.html for details.
+Copyright (c) German Cancer Research Center,
+Division of Medical and Biological Informatics.
+All rights reserved.
-This software is distributed WITHOUT ANY WARRANTY; without even
-the implied warranty of MERCHANTABILITY or FITNESS FOR A PARTICULAR
-PURPOSE. See the above copyright notices for more information.
+This software is distributed WITHOUT ANY WARRANTY; without
+even the implied warranty of MERCHANTABILITY or FITNESS FOR
+A PARTICULAR PURPOSE.
-=========================================================================*/
+See LICENSE.txt or http://www.mitk.org for details.
+
+===================================================================*/
#include "QmitkFileExitAction.h"
#include
#include
#include
#include
#include
#include
#include
QmitkFileExitAction::QmitkFileExitAction(berry::IWorkbenchWindow::Pointer window)
: QAction(0)
{
m_Window = window.GetPointer();
this->setParent(static_cast(m_Window->GetShell()->GetControl()));
this->setText("&Exit");
this->connect(this, SIGNAL(triggered(bool)), this, SLOT(Run()));
}
void QmitkFileExitAction::Run()
{
berry::PlatformUI::GetWorkbench()->Close();
}
diff --git a/Plugins/org.mitk.gui.qt.application/src/QmitkFileExitAction.h b/Plugins/org.mitk.gui.qt.application/src/QmitkFileExitAction.h
index 0a91fcb022..49258e4878 100644
--- a/Plugins/org.mitk.gui.qt.application/src/QmitkFileExitAction.h
+++ b/Plugins/org.mitk.gui.qt.application/src/QmitkFileExitAction.h
@@ -1,48 +1,47 @@
-/*=========================================================================
+/*===================================================================
-Program: Medical Imaging & Interaction Toolkit
-Language: C++
-Date: $Date: 2009-08-04 15:43:53 +0200 (Di, 04 Aug 2009) $
-Version: $Revision: 18435 $
+The Medical Imaging Interaction Toolkit (MITK)
-Copyright (c) German Cancer Research Center, Division of Medical and
-Biological Informatics. All rights reserved.
-See MITKCopyright.txt or http://www.mitk.org/copyright.html for details.
+Copyright (c) German Cancer Research Center,
+Division of Medical and Biological Informatics.
+All rights reserved.
-This software is distributed WITHOUT ANY WARRANTY; without even
-the implied warranty of MERCHANTABILITY or FITNESS FOR A PARTICULAR
-PURPOSE. See the above copyright notices for more information.
+This software is distributed WITHOUT ANY WARRANTY; without
+even the implied warranty of MERCHANTABILITY or FITNESS FOR
+A PARTICULAR PURPOSE.
-=========================================================================*/
+See LICENSE.txt or http://www.mitk.org for details.
+
+===================================================================*/
#ifndef QMITKFILEEXITACTION_H_
#define QMITKFILEEXITACTION_H_
#include
#include
#include
/**
* \ingroup org_mitk_gui_qt_application
*/
class MITK_QT_APP QmitkFileExitAction : public QAction
{
Q_OBJECT
public:
QmitkFileExitAction(berry::IWorkbenchWindow::Pointer window);
protected slots:
void Run();
private:
berry::IWorkbenchWindow* m_Window;
};
#endif /*QMITKFILEOPENACTION_H_*/
diff --git a/Plugins/org.mitk.gui.qt.application/src/QmitkFileOpenAction.cpp b/Plugins/org.mitk.gui.qt.application/src/QmitkFileOpenAction.cpp
index fc795fd08b..287e678551 100644
--- a/Plugins/org.mitk.gui.qt.application/src/QmitkFileOpenAction.cpp
+++ b/Plugins/org.mitk.gui.qt.application/src/QmitkFileOpenAction.cpp
@@ -1,121 +1,120 @@
-/*=========================================================================
+/*===================================================================
-Program: Medical Imaging & Interaction Toolkit
-Language: C++
-Date: $Date$
-Version: $Revision$
+The Medical Imaging Interaction Toolkit (MITK)
-Copyright (c) German Cancer Research Center, Division of Medical and
-Biological Informatics. All rights reserved.
-See MITKCopyright.txt or http://www.mitk.org/copyright.html for details.
+Copyright (c) German Cancer Research Center,
+Division of Medical and Biological Informatics.
+All rights reserved.
-This software is distributed WITHOUT ANY WARRANTY; without even
-the implied warranty of MERCHANTABILITY or FITNESS FOR A PARTICULAR
-PURPOSE. See the above copyright notices for more information.
+This software is distributed WITHOUT ANY WARRANTY; without
+even the implied warranty of MERCHANTABILITY or FITNESS FOR
+A PARTICULAR PURPOSE.
-=========================================================================*/
+See LICENSE.txt or http://www.mitk.org for details.
+
+===================================================================*/
#include "QmitkFileOpenAction.h"
#include "internal/org_mitk_gui_qt_application_Activator.h"
#include
#include
#include
#include
#include
#include
#include
#include
#include
#include
#include
class QmitkFileOpenActionPrivate
{
public:
QmitkFileOpenActionPrivate()
: m_PrefServiceTracker(mitk::PluginActivator::GetContext())
{}
void init ( berry::IWorkbenchWindow::Pointer window, QmitkFileOpenAction* action )
{
m_PrefServiceTracker.open();
m_Window = window;
action->setParent(static_cast(m_Window.Lock()->GetShell()->GetControl()));
action->setText("&Open...");
action->setToolTip("Open data files (images, surfaces,...)");
QObject::connect(action, SIGNAL(triggered(bool)), action, SLOT(Run()));
}
berry::IPreferences::Pointer GetPreferences() const
{
berry::IPreferencesService* prefService = m_PrefServiceTracker.getService();
if (prefService)
{
return prefService->GetSystemPreferences()->Node("/General");
}
return berry::IPreferences::Pointer(0);
}
QString getLastFileOpenPath() const
{
berry::IPreferences::Pointer prefs = GetPreferences();
if(prefs.IsNotNull())
{
return QString::fromStdString(prefs->Get("LastFileOpenPath", ""));
}
return QString();
}
void setLastFileOpenPath(const QString& path) const
{
berry::IPreferences::Pointer prefs = GetPreferences();
if(prefs.IsNotNull())
{
prefs->Put("LastFileOpenPath", path.toStdString());
prefs->Flush();
}
}
berry::IWorkbenchWindow::WeakPtr m_Window;
ctkServiceTracker m_PrefServiceTracker;
};
QmitkFileOpenAction::QmitkFileOpenAction(berry::IWorkbenchWindow::Pointer window)
: QAction(0), d(new QmitkFileOpenActionPrivate)
{
d->init(window, this);
}
QmitkFileOpenAction::QmitkFileOpenAction(const QIcon & icon, berry::IWorkbenchWindow::Pointer window)
: QAction(0), d(new QmitkFileOpenActionPrivate)
{
d->init(window, this);
this->setIcon(icon);
}
QmitkFileOpenAction::~QmitkFileOpenAction()
{
}
void QmitkFileOpenAction::Run()
{
// Ask the user for a list of files to open
QStringList fileNames = QFileDialog::getOpenFileNames(NULL, "Open",
d->getLastFileOpenPath(),
mitk::CoreObjectFactory::GetInstance()->GetFileExtensions());
if (fileNames.empty())
return;
d->setLastFileOpenPath(fileNames.front());
mitk::WorkbenchUtil::LoadFiles(fileNames, d->m_Window.Lock());
}
diff --git a/Plugins/org.mitk.gui.qt.application/src/QmitkFileOpenAction.h b/Plugins/org.mitk.gui.qt.application/src/QmitkFileOpenAction.h
index 20e6f8bc54..2b6c5648ce 100644
--- a/Plugins/org.mitk.gui.qt.application/src/QmitkFileOpenAction.h
+++ b/Plugins/org.mitk.gui.qt.application/src/QmitkFileOpenAction.h
@@ -1,63 +1,62 @@
-/*=========================================================================
+/*===================================================================
-Program: Medical Imaging & Interaction Toolkit
-Language: C++
-Date: $Date$
-Version: $Revision$
+The Medical Imaging Interaction Toolkit (MITK)
-Copyright (c) German Cancer Research Center, Division of Medical and
-Biological Informatics. All rights reserved.
-See MITKCopyright.txt or http://www.mitk.org/copyright.html for details.
+Copyright (c) German Cancer Research Center,
+Division of Medical and Biological Informatics.
+All rights reserved.
-This software is distributed WITHOUT ANY WARRANTY; without even
-the implied warranty of MERCHANTABILITY or FITNESS FOR A PARTICULAR
-PURPOSE. See the above copyright notices for more information.
+This software is distributed WITHOUT ANY WARRANTY; without
+even the implied warranty of MERCHANTABILITY or FITNESS FOR
+A PARTICULAR PURPOSE.
-=========================================================================*/
+See LICENSE.txt or http://www.mitk.org for details.
+
+===================================================================*/
#ifndef QMITKFILEOPENACTION_H_
#define QMITKFILEOPENACTION_H_
#ifdef __MINGW32__
// We need to inlclude winbase.h here in order to declare
// atomic intrinsics like InterlockedIncrement correctly.
// Otherwhise, they would be declared wrong within qatomic_windows.h .
#include
#endif
#include
#include
#include
#include
#include
class QmitkFileOpenActionPrivate;
/**
* \ingroup org_mitk_gui_qt_application
*/
class MITK_QT_APP QmitkFileOpenAction : public QAction
{
Q_OBJECT
public:
QmitkFileOpenAction(berry::IWorkbenchWindow::Pointer window);
QmitkFileOpenAction(const QIcon & icon, berry::IWorkbenchWindow::Pointer window);
~QmitkFileOpenAction();
protected slots:
virtual void Run();
private:
const QScopedPointer d;
};
#endif /*QMITKFILEOPENACTION_H_*/
diff --git a/Plugins/org.mitk.gui.qt.application/src/QmitkPreferencesDialog.cpp b/Plugins/org.mitk.gui.qt.application/src/QmitkPreferencesDialog.cpp
index ac320171e0..c2adbc1d42 100644
--- a/Plugins/org.mitk.gui.qt.application/src/QmitkPreferencesDialog.cpp
+++ b/Plugins/org.mitk.gui.qt.application/src/QmitkPreferencesDialog.cpp
@@ -1,444 +1,443 @@
-/*=========================================================================
+/*===================================================================
-Program: Medical Imaging & Interaction Toolkit
-Language: C++
-Date: $Date$
-Version: $Revision$
+The Medical Imaging Interaction Toolkit (MITK)
-Copyright (c) German Cancer Research Center, Division of Medical and
-Biological Informatics. All rights reserved.
-See MITKCopyright.txt or http://www.mitk.org/copyright.html for details.
+Copyright (c) German Cancer Research Center,
+Division of Medical and Biological Informatics.
+All rights reserved.
-This software is distributed WITHOUT ANY WARRANTY; without even
-the implied warranty of MERCHANTABILITY or FITNESS FOR A PARTICULAR
-PURPOSE. See the above copyright notices for more information.
+This software is distributed WITHOUT ANY WARRANTY; without
+even the implied warranty of MERCHANTABILITY or FITNESS FOR
+A PARTICULAR PURPOSE.
-=========================================================================*/
+See LICENSE.txt or http://www.mitk.org for details.
+
+===================================================================*/
#include "QmitkPreferencesDialog.h"
#include "berryPlatform.h"
#include "berryIConfigurationElement.h"
#include "berryIExtensionPointService.h"
#include "berryIExtension.h"
#include
#include
#include
#include
#include
#include
#include
#include
using namespace std;
class QmitkPreferencesDialogPrivate : public Ui::QmitkPreferencesDialog
{
public:
///
/// Just a stub class for holding information on prefpages (metadata)
///
struct PrefPage
{
PrefPage(std::string _id, std::string _name, std::string _category
, std::string _className, std::string _keywords, berry::IConfigurationElement::Pointer _confElem)
: id(_id), name(_name), category(_category), className(_className), keywords(_keywords),
prefPage(0), confElem(_confElem), treeWidgetItem(0)
{}
bool operator==(const PrefPage& other)
{ return id == other.id; }
bool operator<(const PrefPage& other)
{ return name < other.name; }
std::string id;
std::string name;
std::string category;
std::string className;
std::string keywords;
berry::IQtPreferencePage* prefPage;
berry::IConfigurationElement::Pointer confElem;
QTreeWidgetItem* treeWidgetItem;
};
QmitkPreferencesDialogPrivate()
: m_CurrentPage(0)
{
// m_PreferencesService
m_PreferencesService =
berry::Platform::GetServiceRegistry().GetServiceById(berry::IPreferencesService::ID);
// m_PrefPages
berry::IExtensionPointService::Pointer extensionPointService = berry::Platform::GetExtensionPointService();
berry::IConfigurationElement::vector prefPages(extensionPointService->GetConfigurationElementsFor("org.blueberry.ui.preferencePages"));
berry::IConfigurationElement::vector keywordExts(extensionPointService->GetConfigurationElementsFor("org.blueberry.ui.keywords"));
berry::IConfigurationElement::vector::iterator prefPagesIt;
std::string id;
std::string name;
std::string category;
std::string className;
std::vector keywords;
vector keywordRefs;
berry::IConfigurationElement::vector::iterator keywordRefsIt;
berry::IConfigurationElement::vector::iterator keywordExtsIt;
string keywordRefId;
string keywordId;
string keywordLabels;
for (prefPagesIt = prefPages.begin(); prefPagesIt != prefPages.end(); ++prefPagesIt)
{
keywords.clear();
id.clear();
name.clear();
className.clear();
category.clear();
keywordRefId.clear();
keywordId.clear();
keywordLabels.clear();
if((*prefPagesIt)->GetAttribute("id", id)
&& (*prefPagesIt)->GetAttribute("name", name)
&& (*prefPagesIt)->GetAttribute("class", className))
{
(*prefPagesIt)->GetAttribute("category", category);
//# collect keywords
keywordRefs = (*prefPagesIt)->GetChildren("keywordreference"); // get all keyword references
for (keywordRefsIt = keywordRefs.begin()
; keywordRefsIt != keywordRefs.end(); ++keywordRefsIt) // iterate over all refs
{
(*keywordRefsIt)->GetAttribute("id", keywordRefId); // get referenced id
for (keywordExtsIt = keywordExts.begin(); keywordExtsIt != keywordExts.end(); ++keywordExtsIt) // iterate over all keywords
{
(*keywordExtsIt)->GetAttribute("id", keywordId); // get keyword id
if(keywordId == keywordRefId) // if referenced id is equals the current keyword id
{
//# collect all keywords from label attribute with a tokenizer
std::string currLabel;
(*keywordExtsIt)->GetAttribute("label", currLabel);
std::transform(currLabel.begin(), currLabel.end(), currLabel.begin(), ::tolower);
if (!currLabel.empty()) keywordLabels += std::string(" ") + currLabel;
//break; // break here; possibly search for other referenced keywords
}
}
}
// add information as PrefPage
m_PrefPages.push_back(PrefPage(id, name, category, className, keywordLabels, berry::IConfigurationElement::Pointer(*prefPagesIt)));
}
}
}
///
/// The Preferences Service to retrieve and store preferences.
///
berry::IPreferencesService::WeakPtr m_PreferencesService;
///
/// Saves all treewidgetitems in a map, the key is the id of the preferencepage.
///
std::vector m_PrefPages;
std::size_t m_CurrentPage;
};
QmitkPreferencesDialog::QmitkPreferencesDialog(QWidget * parent, Qt::WindowFlags f)
: QDialog(parent, f), d(new QmitkPreferencesDialogPrivate)
{
d->setupUi(this);
QObject::connect(d->m_Keyword, SIGNAL(editingFinished()), this, SLOT(OnKeywordEditingFinished()));
QObject::connect(d->m_Keyword, SIGNAL(textChanged(QString)), this, SLOT(OnKeywordTextChanged(QString)));
QObject::connect(d->m_PreferencesTree, SIGNAL(itemSelectionChanged()), this, SLOT(OnPreferencesTreeItemSelectionChanged()));
QPushButton* importButton = d->buttonBox->addButton("Import...", QDialogButtonBox::ActionRole);
QObject::connect(importButton, SIGNAL(clicked()), this, SLOT(OnImportButtonClicked()));
QPushButton* exportButton = d->buttonBox->addButton("Export...", QDialogButtonBox::ActionRole);
QObject::connect(exportButton, SIGNAL(clicked()), this, SLOT(OnExportButtonClicked()));
QObject::connect(this, SIGNAL(accepted()), this, SLOT(OnDialogAccepted()));
QObject::connect(this, SIGNAL(rejected()), this, SLOT(OnDialogRejected()));
d->buttonBox->button(QDialogButtonBox::Cancel)->setDefault(true);
this->UpdateTree();
}
QmitkPreferencesDialog::~QmitkPreferencesDialog()
{
}
void QmitkPreferencesDialog::SetSelectedPage(const std::string& id)
{
for(vector::iterator it = d->m_PrefPages.begin(); it != d->m_PrefPages.end(); ++it)
{
if(it->id == id)
{
d->m_PreferencesTree->setCurrentItem(it->treeWidgetItem);
break;
}
}
}
void QmitkPreferencesDialog::OnImportButtonClicked()
{
int answer = QMessageBox::question(this, "Importing Preferences"
, "All existing preferences will be overwritten!\nAre you sure that you want to import other preferences?", QMessageBox::Yes | QMessageBox::No );
if(answer == QMessageBox::No)
return;
try
{
berry::IPreferencesService::Pointer prefService = d->m_PreferencesService.Lock();
if(prefService.IsNotNull())
{
berry::IBerryPreferencesService::Pointer berryPrefService = prefService.Cast();
if(berryPrefService != 0)
{
static QString importDir = "";
QString fileName = QFileDialog::getOpenFileName(this, tr("Choose file to import preferences"),
importDir, tr("XML files (*.xml)"));
if(!fileName.isEmpty())
{
importDir = QFileInfo(fileName).absoluteDir().path();
Poco::File f(fileName.toLocal8Bit().data());
berryPrefService->ImportPreferences(f, "");
berry::IQtPreferencePage* prefPage = d->m_PrefPages[d->m_CurrentPage].prefPage;
if(prefPage)
prefPage->Update();
MITK_INFO("QmitkPreferencesDialog") << "Preferences successfully imported from " << f.path();
}
}
}
}
catch (Poco::Exception& pe)
{
QMessageBox::critical(this, "Error Importing", pe.message().c_str());
MITK_ERROR("QmitkPreferencesDialog") << pe.what();
}
catch (std::exception& e)
{
QMessageBox::critical(this, "Error Importing", e.what());
MITK_ERROR("QmitkPreferencesDialog") << e.what();
}
}
void QmitkPreferencesDialog::OnExportButtonClicked()
{
try
{
berry::IPreferencesService::Pointer prefService = d->m_PreferencesService.Lock();
if(prefService.IsNotNull())
{
berry::IBerryPreferencesService::Pointer berryPrefService = prefService.Cast();
if(berryPrefService != 0)
{
SavePreferences();
static QString exportDir = "";
QString fileName = QFileDialog::getSaveFileName(this, tr("Choose file to export preferences"),
exportDir, tr("XML files (*.xml)"));
if(!fileName.isEmpty())
{
if(QFileInfo(fileName).suffix() != ".xml")
{
fileName += ".xml";
}
exportDir = QFileInfo(fileName).absoluteDir().path();
Poco::File f(fileName.toLocal8Bit().data());
berryPrefService->ExportPreferences(f, "");
MITK_INFO("QmitkPreferencesDialog") << "Preferences successfully exported to " << f.path();
}
}
}
}
catch (Poco::Exception& pe)
{
QMessageBox::critical(this, "Error Exporting", pe.message().c_str());
MITK_ERROR("QmitkPreferencesDialog") << pe.what();
}
catch (std::exception& e)
{
QMessageBox::critical(this, "Error Exporting", e.what());
MITK_ERROR("QmitkPreferencesDialog") << e.what();
}
}
void QmitkPreferencesDialog::SavePreferences()
{
berry::IQtPreferencePage* prefPage = 0;
for(vector::iterator it = d->m_PrefPages.begin(); it != d->m_PrefPages.end(); ++it)
{
prefPage = it->prefPage;
if(prefPage) {
prefPage->PerformOk();
}
}
/**
* Every preference page has its own preferences, which should stay the same after a system restart.
* Therefore this method flushes all the preferences, every time a change in the preferences is
* performed and confirmed.
*
*/
berry::IPreferencesService::Pointer prefService = d->m_PreferencesService.Lock();
if (prefService)
{
prefService->GetSystemPreferences()->Flush();
}
}
void QmitkPreferencesDialog::OnDialogAccepted()
{
this->SavePreferences();
}
void QmitkPreferencesDialog::OnDialogRejected()
{
berry::IQtPreferencePage* prefPage = d->m_PrefPages[d->m_CurrentPage].prefPage;
if(prefPage)
prefPage->PerformCancel();
}
void QmitkPreferencesDialog::OnKeywordTextChanged(const QString & /*s*/)
{
// search for text
this->UpdateTree();
}
void QmitkPreferencesDialog::OnKeywordEditingFinished()
{
}
//bool QmitkPreferencesDialog::eventFilter( QObject *obj, QEvent *event )
//{
// if(obj == d->m_Keyword)
// {
// if(event->type() == QEvent::FocusIn && d->m_Keyword->text() == "search ...")
// {
// d->m_Keyword->setText("");
// d->m_Keyword->setStyleSheet("color: black;");
// }
// else if(event->type() == QEvent::FocusOut && d->m_Keyword->text() == "")
// {
// d->m_Keyword->setText("search ...");
// d->m_Keyword->setStyleSheet("color: gray;");
// }
// }
// return true;
//}
void QmitkPreferencesDialog::OnPreferencesTreeItemSelectionChanged()
{
if(d->m_PreferencesTree == 0)
return;
// TODO: create page and show it
QList selectedItems = d->m_PreferencesTree->selectedItems();
if(selectedItems.size()>0)
{
d->m_CurrentPage = 0;
for(vector::iterator it = d->m_PrefPages.begin(); it != d->m_PrefPages.end(); ++it, ++d->m_CurrentPage)
{
if(it->treeWidgetItem == selectedItems.at(0))
{
d->m_Headline->setText(QString::fromStdString(it->name));
if(it->prefPage == 0)
{
berry::IPreferencePage* page = it->confElem->CreateExecutableExtension("class");
if (page == 0)
{
// support legacy BlueBerry extensions
page = it->confElem->CreateExecutableExtension("class", berry::IPreferencePage::GetManifestName());
}
it->prefPage = dynamic_cast(page);
it->prefPage->CreateQtControl(d->m_PreferencesPanel);
d->m_PreferencesPanel->addWidget(it->prefPage->GetQtControl());
}
d->m_PreferencesPanel->setCurrentWidget(it->prefPage->GetQtControl());
break;
}
}
}
}
void QmitkPreferencesDialog::UpdateTree()
{
if(d->m_PreferencesTree == 0)
return;
//m_PreferencesTree->clear();
string keyword = d->m_Keyword->text().toLower().toStdString();
map items;
for(vector::iterator it = d->m_PrefPages.begin();
it != d->m_PrefPages.end(); ++it)
{
if(it->treeWidgetItem == 0)
{
if(it->category.empty())
{
it->treeWidgetItem = new QTreeWidgetItem(d->m_PreferencesTree);
}
else
{
it->treeWidgetItem = new QTreeWidgetItem(items[it->category]);
}
it->treeWidgetItem->setText(0, QString::fromStdString(it->name));
items[it->id] = it->treeWidgetItem;
}
// hide treeWidgetItem if keyword not matches
if(!keyword.empty())
{
if( it->keywords.find(keyword) == string::npos )
it->treeWidgetItem->setHidden(true);
else
{
//#make the whole branch visible
QTreeWidgetItem* treeWidgetParent = it->treeWidgetItem->parent();
while(treeWidgetParent!=0)
{
treeWidgetParent->setHidden(false);
treeWidgetParent->setExpanded(true);
treeWidgetParent = treeWidgetParent->parent();
}
it->treeWidgetItem->setHidden(false);
QFont f = it->treeWidgetItem->font(0);
f.setBold(true);
it->treeWidgetItem->setFont(0, f);
}
}
else
{
QFont f = it->treeWidgetItem->font(0);
f.setBold(false);
it->treeWidgetItem->setFont(0, f);
it->treeWidgetItem->setHidden(false);
}
}
if(d->m_PrefPages.size()>0)
{
if(d->m_PrefPages.front().treeWidgetItem != 0)
d->m_PrefPages.front().treeWidgetItem->setSelected(true);
}
}
diff --git a/Plugins/org.mitk.gui.qt.application/src/QmitkPreferencesDialog.h b/Plugins/org.mitk.gui.qt.application/src/QmitkPreferencesDialog.h
index 059c6a8486..cf46122e96 100644
--- a/Plugins/org.mitk.gui.qt.application/src/QmitkPreferencesDialog.h
+++ b/Plugins/org.mitk.gui.qt.application/src/QmitkPreferencesDialog.h
@@ -1,69 +1,68 @@
-/*=========================================================================
+/*===================================================================
-Program: Medical Imaging & Interaction Toolkit
-Language: C++
-Date: $Date$
-Version: $Revision$
+The Medical Imaging Interaction Toolkit (MITK)
-Copyright (c) German Cancer Research Center, Division of Medical and
-Biological Informatics. All rights reserved.
-See MITKCopyright.txt or http://www.mitk.org/copyright.html for details.
+Copyright (c) German Cancer Research Center,
+Division of Medical and Biological Informatics.
+All rights reserved.
-This software is distributed WITHOUT ANY WARRANTY; without even
-the implied warranty of MERCHANTABILITY or FITNESS FOR A PARTICULAR
-PURPOSE. See the above copyright notices for more information.
+This software is distributed WITHOUT ANY WARRANTY; without
+even the implied warranty of MERCHANTABILITY or FITNESS FOR
+A PARTICULAR PURPOSE.
-=========================================================================*/
+See LICENSE.txt or http://www.mitk.org for details.
+
+===================================================================*/
#ifndef BERRYQMITKPREFERENCESDIALOG_H_
#define BERRYQMITKPREFERENCESDIALOG_H_
#include
#include
#include
class QmitkPreferencesDialogPrivate;
/**
* \ingroup org_mitk_gui_qt_application
*/
class MITK_QT_APP QmitkPreferencesDialog : public QDialog
{
Q_OBJECT
public:
QmitkPreferencesDialog(QWidget * parent = 0, Qt::WindowFlags f = 0);
~QmitkPreferencesDialog();
void SetSelectedPage(const std::string& id);
protected slots:
void OnImportButtonClicked();
void OnExportButtonClicked();
void OnDialogAccepted();
void OnDialogRejected();
void OnKeywordTextChanged(const QString & s);
void OnKeywordEditingFinished();
void OnPreferencesTreeItemSelectionChanged();
protected:
//bool eventFilter(QObject *obj, QEvent *event);
void UpdateTree();
///
/// Saves all preferencepages.
///
void SavePreferences();
QScopedPointer d;
};
#endif /* BERRYQMITKPREFERENCESDIALOG_H_ */
diff --git a/Plugins/org.mitk.gui.qt.application/src/QmitkStatusBar.cpp b/Plugins/org.mitk.gui.qt.application/src/QmitkStatusBar.cpp
index 2824b312ac..bc7ed0a150 100755
--- a/Plugins/org.mitk.gui.qt.application/src/QmitkStatusBar.cpp
+++ b/Plugins/org.mitk.gui.qt.application/src/QmitkStatusBar.cpp
@@ -1,94 +1,93 @@
-/*=========================================================================
+/*===================================================================
-Program: Medical Imaging & Interaction Toolkit
-Language: C++
-Date: $Date$
-Version: $Revision$
+The Medical Imaging Interaction Toolkit (MITK)
-Copyright (c) German Cancer Research Center, Division of Medical and
-Biological Informatics. All rights reserved.
-See MITKCopyright.txt or http://www.mitk.org/copyright.html for details.
+Copyright (c) German Cancer Research Center,
+Division of Medical and Biological Informatics.
+All rights reserved.
-This software is distributed WITHOUT ANY WARRANTY; without even
-the implied warranty of MERCHANTABILITY or FITNESS FOR A PARTICULAR
-PURPOSE. See the above copyright notices for more information.
+This software is distributed WITHOUT ANY WARRANTY; without
+even the implied warranty of MERCHANTABILITY or FITNESS FOR
+A PARTICULAR PURPOSE.
-=========================================================================*/
+See LICENSE.txt or http://www.mitk.org for details.
+
+===================================================================*/
#include "QmitkStatusBar.h"
#include
#include
#include
#include
#include
#include
/**
* Display the text in the statusbar of the applikation
*/
void QmitkStatusBar::DisplayText(const char* t)
{
m_StatusBar->showMessage(t);
// TODO bug #1357
//qApp->processEvents(); // produces crashes!
}
/**
* Display the text in the statusbar of the applikation for ms seconds
*/
void QmitkStatusBar::DisplayText(const char* t, int ms)
{
m_StatusBar->showMessage(t, ms);
// TODO bug #1357
//qApp->processEvents(); // produces crashes!
}
/**
* Show the grey value text in the statusbar
*/
void QmitkStatusBar::DisplayGreyValueText(const char* t)
{
QString text(t);
m_GreyValueLabel->setText(text);
}
/**
* Clear the text in the StatusBar
*/
void QmitkStatusBar::Clear()
{
if (m_StatusBar != NULL)
m_StatusBar->clearMessage();
// TODO bug #1357
//qApp->processEvents(); // produces crashes!
}
/**
* enable or disable the QSizeGrip
*/
void QmitkStatusBar::SetSizeGripEnabled(bool enable)
{
if (m_StatusBar != NULL)
m_StatusBar->setSizeGripEnabled(enable);
}
QmitkStatusBar::QmitkStatusBar(QStatusBar* instance)
:StatusBarImplementation()
{
m_StatusBar = instance;
m_GreyValueLabel = new QLabel(m_StatusBar,0);
int xResolution = QApplication::desktop()->screenGeometry(0).width()-100;
m_GreyValueLabel->setMaximumSize(QSize(xResolution,50));
m_GreyValueLabel->setSizePolicy(QSizePolicy::Maximum,QSizePolicy::Fixed);
m_StatusBar->addPermanentWidget(m_GreyValueLabel);
mitk::StatusBar::SetImplementation(this);
}
QmitkStatusBar::~QmitkStatusBar()
{
}
diff --git a/Plugins/org.mitk.gui.qt.application/src/QmitkStatusBar.h b/Plugins/org.mitk.gui.qt.application/src/QmitkStatusBar.h
index bb95f8c1da..ab6caf4972 100755
--- a/Plugins/org.mitk.gui.qt.application/src/QmitkStatusBar.h
+++ b/Plugins/org.mitk.gui.qt.application/src/QmitkStatusBar.h
@@ -1,85 +1,84 @@
-/*=========================================================================
+/*===================================================================
-Program: Medical Imaging & Interaction Toolkit
-Language: C++
-Date: $Date$
-Version: $Revision$
+The Medical Imaging Interaction Toolkit (MITK)
-Copyright (c) German Cancer Research Center, Division of Medical and
-Biological Informatics. All rights reserved.
-See MITKCopyright.txt or http://www.mitk.org/copyright.html for details.
+Copyright (c) German Cancer Research Center,
+Division of Medical and Biological Informatics.
+All rights reserved.
-This software is distributed WITHOUT ANY WARRANTY; without even
-the implied warranty of MERCHANTABILITY or FITNESS FOR A PARTICULAR
-PURPOSE. See the above copyright notices for more information.
+This software is distributed WITHOUT ANY WARRANTY; without
+even the implied warranty of MERCHANTABILITY or FITNESS FOR
+A PARTICULAR PURPOSE.
-=========================================================================*/
+See LICENSE.txt or http://www.mitk.org for details.
+
+===================================================================*/
#ifndef QMITKSTATUSBAR_H
#define QMITKSTATUSBAR_H
#include
#include
#include
#include
#include
/**
* \ingroup org_mitk_gui_qt_application
*
* \brief QT-Toolkit/GUI dependent class that provides to send a Message to the QT's StatusBar
*
* A delay time can be set.
*
* All mitk-classes will call this class for output:
* mitk::StatusBar::GetInstance();
*/
class MITK_QT_APP QmitkStatusBar : public mitk::StatusBarImplementation
{
public:
mitkClassMacro(QmitkStatusBar, mitk::StatusBarImplementation);
//##Documentation
//##@brief Constructor;
//## holds param instance internaly and connects this to the mitkStatusBar
QmitkStatusBar(QStatusBar* instance);
//##Documentation
//##@brief Destructor
virtual ~QmitkStatusBar();
//##Documentation
//## @brief Send a string to the applications StatusBar (QStatusBar).
virtual void DisplayText(const char* t);
virtual void DisplayText(const char* t, int ms);
//##Documentation
//## @brief Send a string as an error message to StatusBar.
//## The implementation calls DisplayText()
virtual void DisplayErrorText(const char *t) { this->DisplayText(t); };
virtual void DisplayWarningText(const char *t) { this->DisplayText(t); };
virtual void DisplayWarningText(const char *t, int ms) { this->DisplayText(t, ms); };
virtual void DisplayGenericOutputText(const char *t) {this->DisplayText(t);}
virtual void DisplayDebugText(const char *t) { this->DisplayText(t); };
virtual void DisplayGreyValueText(const char *t);
//##Documentation
//## @brief removes any temporary message being shown.
virtual void Clear();
//##Documentation
//## @brief Set the QSizeGrip of the window
//## (the triangle in the lower right Windowcorner for changing the size)
//## to enabled or disabled
virtual void SetSizeGripEnabled(bool enable);
private:
//static Pointer m_Instance;
QStatusBar* m_StatusBar;
QLabel* m_GreyValueLabel;
};
#endif /* define QMITKSTATUSBAR_H */
diff --git a/Plugins/org.mitk.gui.qt.application/src/internal/QmitkEditorsPreferencePage.cpp b/Plugins/org.mitk.gui.qt.application/src/internal/QmitkEditorsPreferencePage.cpp
index 24a52130b2..1d7ebb74ea 100644
--- a/Plugins/org.mitk.gui.qt.application/src/internal/QmitkEditorsPreferencePage.cpp
+++ b/Plugins/org.mitk.gui.qt.application/src/internal/QmitkEditorsPreferencePage.cpp
@@ -1,58 +1,57 @@
-/*=========================================================================
+/*===================================================================
-Program: Medical Imaging & Interaction Toolkit
-Language: C++
-Date: $Date: 2009-07-07 16:57:15 +0200 (Di, 07 Jul 2009) $
-Version: $Revision: 18019 $
+The Medical Imaging Interaction Toolkit (MITK)
-Copyright (c) German Cancer Research Center, Division of Medical and
-Biological Informatics. All rights reserved.
-See MITKCopyright.txt or http://www.mitk.org/copyright.html for details.
+Copyright (c) German Cancer Research Center,
+Division of Medical and Biological Informatics.
+All rights reserved.
-This software is distributed WITHOUT ANY WARRANTY; without even
-the implied warranty of MERCHANTABILITY or FITNESS FOR A PARTICULAR
-PURPOSE. See the above copyright notices for more information.
+This software is distributed WITHOUT ANY WARRANTY; without
+even the implied warranty of MERCHANTABILITY or FITNESS FOR
+A PARTICULAR PURPOSE.
-=========================================================================*/
+See LICENSE.txt or http://www.mitk.org for details.
+
+===================================================================*/
#include "QmitkEditorsPreferencePage.h"
#include
QmitkEditorsPreferencePage::QmitkEditorsPreferencePage()
: m_MainControl(0)
{
}
void QmitkEditorsPreferencePage::Init(berry::IWorkbench::Pointer )
{
}
void QmitkEditorsPreferencePage::CreateQtControl(QWidget* parent)
{
//empty page
m_MainControl = new QWidget(parent);
QVBoxLayout *layout = new QVBoxLayout;
m_MainControl->setLayout(layout);
this->Update();
}
QWidget* QmitkEditorsPreferencePage::GetQtControl() const
{
return m_MainControl;
}
bool QmitkEditorsPreferencePage::PerformOk()
{
return true;
}
void QmitkEditorsPreferencePage::PerformCancel()
{
}
void QmitkEditorsPreferencePage::Update()
{
}
diff --git a/Plugins/org.mitk.gui.qt.application/src/internal/QmitkEditorsPreferencePage.h b/Plugins/org.mitk.gui.qt.application/src/internal/QmitkEditorsPreferencePage.h
index f2fb32aea4..919e60d90c 100644
--- a/Plugins/org.mitk.gui.qt.application/src/internal/QmitkEditorsPreferencePage.h
+++ b/Plugins/org.mitk.gui.qt.application/src/internal/QmitkEditorsPreferencePage.h
@@ -1,75 +1,74 @@
-/*=========================================================================
+/*===================================================================
-Program: Medical Imaging & Interaction Toolkit
-Language: C++
-Date: $Date: 2009-02-10 14:14:32 +0100 (Di, 10 Feb 2009) $
-Version: $Revision: 16224 $
+The Medical Imaging Interaction Toolkit (MITK)
-Copyright (c) German Cancer Research Center, Division of Medical and
-Biological Informatics. All rights reserved.
-See MITKCopyright.txt or http://www.mitk.org/copyright.html for details.
+Copyright (c) German Cancer Research Center,
+Division of Medical and Biological Informatics.
+All rights reserved.
-This software is distributed WITHOUT ANY WARRANTY; without even
-the implied warranty of MERCHANTABILITY or FITNESS FOR A PARTICULAR
-PURPOSE. See the above copyright notices for more information.
+This software is distributed WITHOUT ANY WARRANTY; without
+even the implied warranty of MERCHANTABILITY or FITNESS FOR
+A PARTICULAR PURPOSE.
-=========================================================================*/
+See LICENSE.txt or http://www.mitk.org for details.
+
+===================================================================*/
#ifndef QMITKEDITORSPREFERENCEPAGE_H_
#define QMITKEDITORSPREFERENCEPAGE_H_
#include "berryIQtPreferencePage.h"
#include
class QWidget;
class QmitkEditorsPreferencePage : public QObject, public berry::IQtPreferencePage
{
Q_OBJECT
Q_INTERFACES(berry::IPreferencePage)
public:
/**
* Default constructor
*/
QmitkEditorsPreferencePage();
/**
* @see berry::IPreferencePage::Init(berry::IWorkbench::Pointer workbench)
*/
void Init(berry::IWorkbench::Pointer workbench);
/**
* @see berry::IPreferencePage::CreateQtControl(void* parent)
*/
void CreateQtControl(QWidget* widget);
/**
* @see berry::IPreferencePage::CreateQtControl()
*/
QWidget* GetQtControl() const;
/**
* @see berry::IPreferencePage::PerformOk()
*/
virtual bool PerformOk();
/**
* @see berry::IPreferencePage::PerformCancel()
*/
virtual void PerformCancel();
/**
* @see berry::IPreferencePage::Update()
*/
virtual void Update();
protected:
QWidget* m_MainControl;
};
#endif /* QMITKEDITORSPREFERENCEPAGE_H_ */
diff --git a/Plugins/org.mitk.gui.qt.application/src/internal/QmitkGeneralPreferencePage.cpp b/Plugins/org.mitk.gui.qt.application/src/internal/QmitkGeneralPreferencePage.cpp
index 6df2a4f89f..9718f36ef7 100644
--- a/Plugins/org.mitk.gui.qt.application/src/internal/QmitkGeneralPreferencePage.cpp
+++ b/Plugins/org.mitk.gui.qt.application/src/internal/QmitkGeneralPreferencePage.cpp
@@ -1,58 +1,57 @@
-/*=========================================================================
+/*===================================================================
-Program: Medical Imaging & Interaction Toolkit
-Language: C++
-Date: $Date: 2009-07-07 16:57:15 +0200 (Di, 07 Jul 2009) $
-Version: $Revision: 18019 $
+The Medical Imaging Interaction Toolkit (MITK)
-Copyright (c) German Cancer Research Center, Division of Medical and
-Biological Informatics. All rights reserved.
-See MITKCopyright.txt or http://www.mitk.org/copyright.html for details.
+Copyright (c) German Cancer Research Center,
+Division of Medical and Biological Informatics.
+All rights reserved.
-This software is distributed WITHOUT ANY WARRANTY; without even
-the implied warranty of MERCHANTABILITY or FITNESS FOR A PARTICULAR
-PURPOSE. See the above copyright notices for more information.
+This software is distributed WITHOUT ANY WARRANTY; without
+even the implied warranty of MERCHANTABILITY or FITNESS FOR
+A PARTICULAR PURPOSE.
-=========================================================================*/
+See LICENSE.txt or http://www.mitk.org for details.
+
+===================================================================*/
#include "QmitkGeneralPreferencePage.h"
#include
QmitkGeneralPreferencePage::QmitkGeneralPreferencePage()
: m_MainControl(0)
{
}
void QmitkGeneralPreferencePage::Init(berry::IWorkbench::Pointer )
{
}
void QmitkGeneralPreferencePage::CreateQtControl(QWidget* parent)
{
//empty page
m_MainControl = new QWidget(parent);
QVBoxLayout *layout = new QVBoxLayout;
m_MainControl->setLayout(layout);
this->Update();
}
QWidget* QmitkGeneralPreferencePage::GetQtControl() const
{
return m_MainControl;
}
bool QmitkGeneralPreferencePage::PerformOk()
{
return true;
}
void QmitkGeneralPreferencePage::PerformCancel()
{
}
void QmitkGeneralPreferencePage::Update()
{
}
diff --git a/Plugins/org.mitk.gui.qt.application/src/internal/QmitkGeneralPreferencePage.h b/Plugins/org.mitk.gui.qt.application/src/internal/QmitkGeneralPreferencePage.h
index e4573d58b1..6b34c1039a 100644
--- a/Plugins/org.mitk.gui.qt.application/src/internal/QmitkGeneralPreferencePage.h
+++ b/Plugins/org.mitk.gui.qt.application/src/internal/QmitkGeneralPreferencePage.h
@@ -1,75 +1,74 @@
-/*=========================================================================
+/*===================================================================
-Program: Medical Imaging & Interaction Toolkit
-Language: C++
-Date: $Date: 2009-02-10 14:14:32 +0100 (Di, 10 Feb 2009) $
-Version: $Revision: 16224 $
+The Medical Imaging Interaction Toolkit (MITK)
-Copyright (c) German Cancer Research Center, Division of Medical and
-Biological Informatics. All rights reserved.
-See MITKCopyright.txt or http://www.mitk.org/copyright.html for details.
+Copyright (c) German Cancer Research Center,
+Division of Medical and Biological Informatics.
+All rights reserved.
-This software is distributed WITHOUT ANY WARRANTY; without even
-the implied warranty of MERCHANTABILITY or FITNESS FOR A PARTICULAR
-PURPOSE. See the above copyright notices for more information.
+This software is distributed WITHOUT ANY WARRANTY; without
+even the implied warranty of MERCHANTABILITY or FITNESS FOR
+A PARTICULAR PURPOSE.
-=========================================================================*/
+See LICENSE.txt or http://www.mitk.org for details.
+
+===================================================================*/
#ifndef QMITKGENERALPREFERENCEPAGE_H_
#define QMITKGENERALPREFERENCEPAGE_H_
#include "berryIQtPreferencePage.h"
#include
class QWidget;
class QmitkGeneralPreferencePage : public QObject, public berry::IQtPreferencePage
{
Q_OBJECT
Q_INTERFACES(berry::IPreferencePage)
public:
/**
* Default constructor
*/
QmitkGeneralPreferencePage();
/**
* @see berry::IPreferencePage::Init(berry::IWorkbench::Pointer workbench)
*/
void Init(berry::IWorkbench::Pointer workbench);
/**
* @see berry::IPreferencePage::CreateQtControl(void* parent)
*/
void CreateQtControl(QWidget* widget);
/**
* @see berry::IPreferencePage::CreateQtControl()
*/
QWidget* GetQtControl() const;
/**
* @see berry::IPreferencePage::PerformOk()
*/
virtual bool PerformOk();
/**
* @see berry::IPreferencePage::PerformCancel()
*/
virtual void PerformCancel();
/**
* @see berry::IPreferencePage::Update()
*/
virtual void Update();
protected:
QWidget* m_MainControl;
};
#endif /* QMITKGENERALPREFERENCEPAGE_H_ */
diff --git a/Plugins/org.mitk.gui.qt.application/src/internal/org_mitk_gui_qt_application_Activator.cpp b/Plugins/org.mitk.gui.qt.application/src/internal/org_mitk_gui_qt_application_Activator.cpp
index 2a5b308f08..03bbad77f4 100644
--- a/Plugins/org.mitk.gui.qt.application/src/internal/org_mitk_gui_qt_application_Activator.cpp
+++ b/Plugins/org.mitk.gui.qt.application/src/internal/org_mitk_gui_qt_application_Activator.cpp
@@ -1,70 +1,69 @@
-/*=========================================================================
+/*===================================================================
-Program: Medical Imaging & Interaction Toolkit
-Language: C++
-Date: $Date$
-Version: $Revision$
+The Medical Imaging Interaction Toolkit (MITK)
-Copyright (c) German Cancer Research Center, Division of Medical and
-Biological Informatics. All rights reserved.
-See MITKCopyright.txt or http://www.mitk.org/copyright.html for details.
+Copyright (c) German Cancer Research Center,
+Division of Medical and Biological Informatics.
+All rights reserved.
-This software is distributed WITHOUT ANY WARRANTY; without even
-the implied warranty of MERCHANTABILITY or FITNESS FOR A PARTICULAR
-PURPOSE. See the above copyright notices for more information.
+This software is distributed WITHOUT ANY WARRANTY; without
+even the implied warranty of MERCHANTABILITY or FITNESS FOR
+A PARTICULAR PURPOSE.
-=========================================================================*/
+See LICENSE.txt or http://www.mitk.org for details.
+
+===================================================================*/
#include "org_mitk_gui_qt_application_Activator.h"
#include "QmitkGeneralPreferencePage.h"
#include "QmitkEditorsPreferencePage.h"
#include
#include
#include
namespace mitk {
ctkPluginContext* org_mitk_gui_qt_application_Activator::m_Context = 0;
void org_mitk_gui_qt_application_Activator::start(ctkPluginContext* context)
{
this->m_Context = context;
BERRY_REGISTER_EXTENSION_CLASS(QmitkGeneralPreferencePage, context)
BERRY_REGISTER_EXTENSION_CLASS(QmitkEditorsPreferencePage, context)
QFile file(":/org.mitk.gui.qt.common/StateMachine.xml");
if(file.exists() && file.open(QIODevice::ReadOnly | QIODevice::Text) )
{
QByteArray contents = file.readAll();
QString string(contents);
file.close();
mitk::GlobalInteraction::GetInstance()->Initialize("global", string.toStdString());
}
else throw std::exception();
QmitkRegisterClasses();
}
void org_mitk_gui_qt_application_Activator::stop(ctkPluginContext* context)
{
Q_UNUSED(context)
this->m_Context = 0;
}
ctkPluginContext* org_mitk_gui_qt_application_Activator::GetContext()
{
return m_Context;
}
}
Q_EXPORT_PLUGIN2(org_mitk_gui_qt_application, mitk::org_mitk_gui_qt_application_Activator)
diff --git a/Plugins/org.mitk.gui.qt.application/src/internal/org_mitk_gui_qt_application_Activator.h b/Plugins/org.mitk.gui.qt.application/src/internal/org_mitk_gui_qt_application_Activator.h
index 4bd05dfeca..6006f253fa 100644
--- a/Plugins/org.mitk.gui.qt.application/src/internal/org_mitk_gui_qt_application_Activator.h
+++ b/Plugins/org.mitk.gui.qt.application/src/internal/org_mitk_gui_qt_application_Activator.h
@@ -1,49 +1,48 @@
-/*=========================================================================
+/*===================================================================
-Program: Medical Imaging & Interaction Toolkit
-Language: C++
-Date: $Date$
-Version: $Revision$
+The Medical Imaging Interaction Toolkit (MITK)
-Copyright (c) German Cancer Research Center, Division of Medical and
-Biological Informatics. All rights reserved.
-See MITKCopyright.txt or http://www.mitk.org/copyright.html for details.
+Copyright (c) German Cancer Research Center,
+Division of Medical and Biological Informatics.
+All rights reserved.
-This software is distributed WITHOUT ANY WARRANTY; without even
-the implied warranty of MERCHANTABILITY or FITNESS FOR A PARTICULAR
-PURPOSE. See the above copyright notices for more information.
+This software is distributed WITHOUT ANY WARRANTY; without
+even the implied warranty of MERCHANTABILITY or FITNESS FOR
+A PARTICULAR PURPOSE.
-=========================================================================*/
+See LICENSE.txt or http://www.mitk.org for details.
+
+===================================================================*/
#ifndef MITKPLUGINACTIVATOR_H
#define MITKPLUGINACTIVATOR_H
#include
namespace mitk {
class org_mitk_gui_qt_application_Activator :
public QObject, public ctkPluginActivator
{
Q_OBJECT
Q_INTERFACES(ctkPluginActivator)
public:
void start(ctkPluginContext* context);
void stop(ctkPluginContext* context);
static ctkPluginContext* GetContext();
private:
static ctkPluginContext* m_Context;
}; // org_mitk_gui_common_Activator
typedef org_mitk_gui_qt_application_Activator PluginActivator;
}
#endif // MITKPLUGINACTIVATOR_H
diff --git a/Plugins/org.mitk.gui.qt.basicimageprocessing/src/internal/QmitkBasicImageProcessingView.cpp b/Plugins/org.mitk.gui.qt.basicimageprocessing/src/internal/QmitkBasicImageProcessingView.cpp
index 54aaa8e522..7c60e905b8 100644
--- a/Plugins/org.mitk.gui.qt.basicimageprocessing/src/internal/QmitkBasicImageProcessingView.cpp
+++ b/Plugins/org.mitk.gui.qt.basicimageprocessing/src/internal/QmitkBasicImageProcessingView.cpp
@@ -1,1054 +1,1053 @@
-/*=========================================================================
+/*===================================================================
-Program: Medical Imaging & Interaction Toolkit
-Language: C++
-Date: $Date$
-Version: $Revision: 10185 $
+The Medical Imaging Interaction Toolkit (MITK)
-Copyright (c) German Cancer Research Center, Division of Medical and
-Biological Informatics. All rights reserved.
-See MITKCopyright.txt or http://www.mitk.org/copyright.html for details.
+Copyright (c) German Cancer Research Center,
+Division of Medical and Biological Informatics.
+All rights reserved.
-This software is distributed WITHOUT ANY WARRANTY; without even
-the implied warranty of MERCHANTABILITY or FITNESS FOR A PARTICULAR
-PURPOSE. See the above copyright notices for more information.
+This software is distributed WITHOUT ANY WARRANTY; without
+even the implied warranty of MERCHANTABILITY or FITNESS FOR
+A PARTICULAR PURPOSE.
-=========================================================================*/
+See LICENSE.txt or http://www.mitk.org for details.
+
+===================================================================*/
#include "QmitkBasicImageProcessingView.h"
// QT includes (GUI)
#include
#include
#include
#include
#include
#include
#include
// Berry includes (selection service)
#include
#include
// MITK includes (GUI)
#include "QmitkStdMultiWidget.h"
#include "QmitkDataNodeSelectionProvider.h"
#include "mitkDataNodeObject.h"
// MITK includes (general)
#include "mitkNodePredicateDataType.h"
#include "mitkNodePredicateDimension.h"
#include "mitkNodePredicateAnd.h"
#include "mitkImageTimeSelector.h"
#include "mitkVectorImageMapper2D.h"
#include "mitkProperties.h"
// Includes for image casting between ITK and MITK
#include "mitkImageCast.h"
#include "mitkITKImageImport.h"
// ITK includes (general)
#include
// Morphological Operations
#include
#include
#include
#include
#include
// Smoothing
#include
#include
#include
// Threshold
#include
// Inversion
#include
// Derivatives
#include
#include
#include
// Resampling
#include
#include
// Image Arithmetics
#include
#include
#include
#include
// Boolean operations
#include
#include
#include
// Convenient Definitions
typedef itk::Image ImageType;
typedef itk::Image FloatImageType;
typedef itk::Image, 3> VectorImageType;
typedef itk::BinaryBallStructuringElement BallType;
typedef itk::GrayscaleDilateImageFilter DilationFilterType;
typedef itk::GrayscaleErodeImageFilter ErosionFilterType;
typedef itk::GrayscaleMorphologicalOpeningImageFilter OpeningFilterType;
typedef itk::GrayscaleMorphologicalClosingImageFilter ClosingFilterType;
typedef itk::MedianImageFilter< ImageType, ImageType > MedianFilterType;
typedef itk::DiscreteGaussianImageFilter< ImageType, ImageType> GaussianFilterType;
typedef itk::TotalVariationDenoisingImageFilter TotalVariationFilterType;
typedef itk::TotalVariationDenoisingImageFilter VectorTotalVariationFilterType;
typedef itk::BinaryThresholdImageFilter< ImageType, ImageType > ThresholdFilterType;
typedef itk::InvertIntensityImageFilter< ImageType, ImageType > InversionFilterType;
typedef itk::GradientMagnitudeRecursiveGaussianImageFilter< ImageType, ImageType > GradientFilterType;
typedef itk::LaplacianImageFilter< FloatImageType, FloatImageType > LaplacianFilterType;
typedef itk::SobelEdgeDetectionImageFilter< FloatImageType, FloatImageType > SobelFilterType;
typedef itk::ResampleImageFilter< ImageType, ImageType > ResampleImageFilterType;
typedef itk::AddImageFilter< ImageType, ImageType, ImageType > AddFilterType;
typedef itk::SubtractImageFilter< ImageType, ImageType, ImageType > SubtractFilterType;
typedef itk::MultiplyImageFilter< ImageType, ImageType, ImageType > MultiplyFilterType;
typedef itk::DivideImageFilter< ImageType, ImageType, FloatImageType > DivideFilterType;
typedef itk::OrImageFilter< ImageType, ImageType > OrImageFilterType;
typedef itk::AndImageFilter< ImageType, ImageType > AndImageFilterType;
typedef itk::XorImageFilter< ImageType, ImageType > XorImageFilterType;
QmitkBasicImageProcessing::QmitkBasicImageProcessing()
: QmitkFunctionality(),
m_Controls(NULL),
m_SelectedImageNode(NULL),
m_TimeStepperAdapter(NULL),
m_SelectionListener(NULL)
{
}
QmitkBasicImageProcessing::~QmitkBasicImageProcessing()
{
//berry::ISelectionService* s = GetSite()->GetWorkbenchWindow()->GetSelectionService();
//if(s)
// s->RemoveSelectionListener(m_SelectionListener);
}
void QmitkBasicImageProcessing::CreateQtPartControl(QWidget *parent)
{
if (m_Controls == NULL)
{
m_Controls = new Ui::QmitkBasicImageProcessingViewControls;
m_Controls->setupUi(parent);
this->CreateConnections();
//setup predictaes for combobox
mitk::NodePredicateDimension::Pointer dimensionPredicate = mitk::NodePredicateDimension::New(3);
mitk::NodePredicateDataType::Pointer imagePredicate = mitk::NodePredicateDataType::New("Image");
m_Controls->m_ImageSelector2->SetDataStorage(this->GetDefaultDataStorage());
m_Controls->m_ImageSelector2->SetPredicate(mitk::NodePredicateAnd::New(dimensionPredicate, imagePredicate));
}
m_Controls->gbTwoImageOps->hide();
m_SelectedImageNode = mitk::DataStorageSelection::New(this->GetDefaultDataStorage(), false);
}
void QmitkBasicImageProcessing::CreateConnections()
{
if ( m_Controls )
{
connect( (QObject*)(m_Controls->cbWhat1), SIGNAL( activated(int) ), this, SLOT( SelectAction(int) ) );
connect( (QObject*)(m_Controls->btnDoIt), SIGNAL(clicked()),(QObject*) this, SLOT(StartButtonClicked()));
connect( (QObject*)(m_Controls->cbWhat2), SIGNAL( activated(int) ), this, SLOT( SelectAction2(int) ) );
connect( (QObject*)(m_Controls->btnDoIt2), SIGNAL(clicked()),(QObject*) this, SLOT(StartButton2Clicked()));
connect( (QObject*)(m_Controls->rBOneImOp), SIGNAL( clicked() ), this, SLOT( ChangeGUI() ) );
connect( (QObject*)(m_Controls->rBTwoImOp), SIGNAL( clicked() ), this, SLOT( ChangeGUI() ) );
}
m_TimeStepperAdapter = new QmitkStepperAdapter((QObject*) m_Controls->sliceNavigatorTime,
GetActiveStdMultiWidget()->GetTimeNavigationController()->GetTime(), "sliceNavigatorTimeFromBIP");
}
void QmitkBasicImageProcessing::Activated()
{
QmitkFunctionality::Activated();
this->m_Controls->cbWhat1->clear();
this->m_Controls->cbWhat1->insertItem( NOACTIONSELECTED, QString( QApplication::translate("QmitkBasicImageProcessingViewControls", "Please select operation", 0, QApplication::UnicodeUTF8) ));
this->m_Controls->cbWhat1->insertItem( CATEGORY_DENOISING, QString( QApplication::translate("QmitkBasicImageProcessingViewControls", "--- Denoising ---", 0, QApplication::UnicodeUTF8) ));
this->m_Controls->cbWhat1->insertItem( GAUSSIAN, QString( QApplication::translate("QmitkBasicImageProcessingViewControls", "Gaussian", 0, QApplication::UnicodeUTF8) ));
this->m_Controls->cbWhat1->insertItem( MEDIAN, QString( QApplication::translate("QmitkBasicImageProcessingViewControls", "Median", 0, QApplication::UnicodeUTF8) ));
this->m_Controls->cbWhat1->insertItem( TOTALVARIATION, QString( QApplication::translate("QmitkBasicImageProcessingViewControls", "Total Variation", 0, QApplication::UnicodeUTF8) ));
this->m_Controls->cbWhat1->insertItem( CATEGORY_MORPHOLOGICAL, QString( QApplication::translate("QmitkBasicImageProcessingViewControls", "--- Morphological ---", 0, QApplication::UnicodeUTF8) ));
this->m_Controls->cbWhat1->insertItem( DILATION, QString( QApplication::translate("QmitkBasicImageProcessingViewControls", "Dilation", 0, QApplication::UnicodeUTF8) ));
this->m_Controls->cbWhat1->insertItem( EROSION, QString( QApplication::translate("QmitkBasicImageProcessingViewControls", "Erosion", 0, QApplication::UnicodeUTF8) ));
this->m_Controls->cbWhat1->insertItem( OPENING, QString( QApplication::translate("QmitkBasicImageProcessingViewControls", "Opening", 0, QApplication::UnicodeUTF8) ));
this->m_Controls->cbWhat1->insertItem( CLOSING, QString( QApplication::translate("QmitkBasicImageProcessingViewControls", "Closing", 0, QApplication::UnicodeUTF8) ));
this->m_Controls->cbWhat1->insertItem( CATEGORY_EDGE_DETECTION, QString( QApplication::translate("QmitkBasicImageProcessingViewControls", "--- Edge Detection ---", 0, QApplication::UnicodeUTF8) ));
this->m_Controls->cbWhat1->insertItem( GRADIENT, QString( QApplication::translate("QmitkBasicImageProcessingViewControls", "Gradient", 0, QApplication::UnicodeUTF8) ));
this->m_Controls->cbWhat1->insertItem( LAPLACIAN, QString( QApplication::translate("QmitkBasicImageProcessingViewControls", "Laplacian (2nd Derivative)", 0, QApplication::UnicodeUTF8) ));
this->m_Controls->cbWhat1->insertItem( SOBEL, QString( QApplication::translate("QmitkBasicImageProcessingViewControls", "Sobel Operator", 0, QApplication::UnicodeUTF8) ));
this->m_Controls->cbWhat1->insertItem( CATEGORY_MISC, QString( QApplication::translate("QmitkBasicImageProcessingViewControls", "--- Misc ---", 0, QApplication::UnicodeUTF8) ));
this->m_Controls->cbWhat1->insertItem( THRESHOLD, QString( QApplication::translate("QmitkBasicImageProcessingViewControls", "Threshold", 0, QApplication::UnicodeUTF8) ));
this->m_Controls->cbWhat1->insertItem( INVERSION, QString( QApplication::translate("QmitkBasicImageProcessingViewControls", "Image Inversion", 0, QApplication::UnicodeUTF8) ));
this->m_Controls->cbWhat1->insertItem( DOWNSAMPLING, QString( QApplication::translate("QmitkBasicImageProcessingViewControls", "Downsampling", 0, QApplication::UnicodeUTF8) ));
this->m_Controls->cbWhat2->clear();
this->m_Controls->cbWhat2->insertItem( TWOIMAGESNOACTIONSELECTED, QString( QApplication::translate("QmitkBasicImageProcessingViewControls", "Please select on operation", 0, QApplication::UnicodeUTF8) ) );
this->m_Controls->cbWhat2->insertItem( CATEGORY_ARITHMETIC, QString( QApplication::translate("QmitkBasicImageProcessingViewControls", "--- Arithmetric operations ---", 0, QApplication::UnicodeUTF8) ) );
this->m_Controls->cbWhat2->insertItem( ADD, QString( QApplication::translate("QmitkBasicImageProcessingViewControls", "Add to Image 1:", 0, QApplication::UnicodeUTF8) ) );
this->m_Controls->cbWhat2->insertItem( SUBTRACT, QString( QApplication::translate("QmitkBasicImageProcessingViewControls", "Subtract from Image 1:", 0, QApplication::UnicodeUTF8) ) );
this->m_Controls->cbWhat2->insertItem( MULTIPLY, QString( QApplication::translate("QmitkBasicImageProcessingViewControls", "Multiply with Image 1:", 0, QApplication::UnicodeUTF8) ) );
this->m_Controls->cbWhat2->insertItem( DIVIDE, QString( QApplication::translate("QmitkBasicImageProcessingViewControls", "Divide Image 1 by:", 0, QApplication::UnicodeUTF8) ) );
this->m_Controls->cbWhat2->insertItem( CATEGORY_BOOLEAN, QString( QApplication::translate("QmitkBasicImageProcessingViewControls", "--- Boolean operations ---", 0, QApplication::UnicodeUTF8) ) );
this->m_Controls->cbWhat2->insertItem( AND, QString( QApplication::translate("QmitkBasicImageProcessingViewControls", "AND", 0, QApplication::UnicodeUTF8) ) );
this->m_Controls->cbWhat2->insertItem( OR, QString( QApplication::translate("QmitkBasicImageProcessingViewControls", "OR", 0, QApplication::UnicodeUTF8) ) );
this->m_Controls->cbWhat2->insertItem( XOR, QString( QApplication::translate("QmitkBasicImageProcessingViewControls", "XOR", 0, QApplication::UnicodeUTF8) ) );
}
//datamanager selection changed
void QmitkBasicImageProcessing::OnSelectionChanged(std::vector nodes)
{
//any nodes there?
if (!nodes.empty())
{
// reset GUI
this->ResetOneImageOpPanel();
m_Controls->sliceNavigatorTime->setEnabled(false);
m_Controls->leImage1->setText("Select an Image in Data Manager");
m_Controls->tlWhat1->setEnabled(false);
m_Controls->cbWhat1->setEnabled(false);
m_Controls->tlWhat2->setEnabled(false);
m_Controls->cbWhat2->setEnabled(false);
m_SelectedImageNode->RemoveAllNodes();
//get the selected Node
mitk::DataNode* _DataNode = nodes.front();
*m_SelectedImageNode = _DataNode;
//try to cast to image
mitk::Image::Pointer tempImage = dynamic_cast(m_SelectedImageNode->GetNode()->GetData());
//no image
if( tempImage.IsNull() || (tempImage->IsInitialized() == false) )
{
m_Controls->leImage1->setText("Not an image.");
return;
}
//2D image
if( tempImage->GetDimension() < 3)
{
m_Controls->leImage1->setText("2D images are not supported.");
return;
}
//image
m_Controls->leImage1->setText(QString(m_SelectedImageNode->GetNode()->GetName().c_str()));
// button coding
if ( tempImage->GetDimension() > 3 )
{
m_Controls->sliceNavigatorTime->setEnabled(true);
m_Controls->tlTime->setEnabled(true);
}
m_Controls->tlWhat1->setEnabled(true);
m_Controls->cbWhat1->setEnabled(true);
m_Controls->tlWhat2->setEnabled(true);
m_Controls->cbWhat2->setEnabled(true);
}
}
void QmitkBasicImageProcessing::ChangeGUI()
{
if(m_Controls->rBOneImOp->isChecked())
{
m_Controls->gbTwoImageOps->hide();
m_Controls->gbOneImageOps->show();
}
else if(m_Controls->rBTwoImOp->isChecked())
{
m_Controls->gbOneImageOps->hide();
m_Controls->gbTwoImageOps->show();
}
}
void QmitkBasicImageProcessing::ResetOneImageOpPanel()
{
m_Controls->tlParam1->setText("Param1");
m_Controls->tlParam2->setText("Param2");
m_Controls->cbWhat1->setCurrentIndex(0);
m_Controls->tlTime->setEnabled(false);
this->ResetParameterPanel();
m_Controls->btnDoIt->setEnabled(false);
m_Controls->cbHideOrig->setEnabled(false);
}
void QmitkBasicImageProcessing::ResetParameterPanel()
{
m_Controls->tlParam->setEnabled(false);
m_Controls->tlParam1->setEnabled(false);
m_Controls->tlParam2->setEnabled(false);
m_Controls->sbParam1->setEnabled(false);
m_Controls->sbParam2->setEnabled(false);
m_Controls->sbParam1->setValue(0);
m_Controls->sbParam2->setValue(0);
}
void QmitkBasicImageProcessing::ResetTwoImageOpPanel()
{
m_Controls->cbWhat2->setCurrentIndex(0);
m_Controls->tlImage2->setEnabled(false);
m_Controls->m_ImageSelector2->setEnabled(false);
m_Controls->btnDoIt2->setEnabled(false);
}
void QmitkBasicImageProcessing::SelectAction(int action)
{
if ( ! m_SelectedImageNode->GetNode() ) return;
// Prepare GUI
this->ResetParameterPanel();
m_Controls->btnDoIt->setEnabled(false);
m_Controls->cbHideOrig->setEnabled(false);
QString text1 = "No Parameters";
QString text2 = "No Parameters";
// check which operation the user has selected and set parameters and GUI accordingly
switch (action)
{
case 2:
{
m_SelectedAction = GAUSSIAN;
m_Controls->tlParam1->setEnabled(true);
m_Controls->sbParam1->setEnabled(true);
text1 = "&Variance:";
m_Controls->sbParam1->setMinimum( 0 );
m_Controls->sbParam1->setMaximum( 200 );
m_Controls->sbParam1->setValue( 2 );
break;
}
case 3:
{
m_SelectedAction = MEDIAN;
m_Controls->tlParam1->setEnabled(true);
m_Controls->sbParam1->setEnabled(true);
text1 = "&Radius:";
m_Controls->sbParam1->setMinimum( 0 );
m_Controls->sbParam1->setMaximum( 200 );
m_Controls->sbParam1->setValue( 3 );
break;
}
case 4:
{
m_SelectedAction = TOTALVARIATION;
m_Controls->tlParam1->setEnabled(true);
m_Controls->sbParam1->setEnabled(true);
m_Controls->tlParam2->setEnabled(true);
m_Controls->sbParam2->setEnabled(true);
text1 = "Number Iterations:";
text2 = "Regularization\n(Lambda/1000):";
m_Controls->sbParam1->setMinimum( 1 );
m_Controls->sbParam1->setMaximum( 1000 );
m_Controls->sbParam1->setValue( 40 );
m_Controls->sbParam2->setMinimum( 0 );
m_Controls->sbParam2->setMaximum( 100000 );
m_Controls->sbParam2->setValue( 1 );
break;
}
case 6:
{
m_SelectedAction = DILATION;
m_Controls->tlParam1->setEnabled(true);
m_Controls->sbParam1->setEnabled(true);
text1 = "&Radius:";
m_Controls->sbParam1->setMinimum( 0 );
m_Controls->sbParam1->setMaximum( 200 );
m_Controls->sbParam1->setValue( 3 );
break;
}
case 7:
{
m_SelectedAction = EROSION;
m_Controls->tlParam1->setEnabled(true);
m_Controls->sbParam1->setEnabled(true);
text1 = "&Radius:";
m_Controls->sbParam1->setMinimum( 0 );
m_Controls->sbParam1->setMaximum( 200 );
m_Controls->sbParam1->setValue( 3 );
break;
}
case 8:
{
m_SelectedAction = OPENING;
m_Controls->tlParam1->setEnabled(true);
m_Controls->sbParam1->setEnabled(true);
text1 = "&Radius:";
m_Controls->sbParam1->setMinimum( 0 );
m_Controls->sbParam1->setMaximum( 200 );
m_Controls->sbParam1->setValue( 3 );
break;
}
case 9:
{
m_SelectedAction = CLOSING;
m_Controls->tlParam1->setEnabled(true);
m_Controls->sbParam1->setEnabled(true);
text1 = "&Radius:";
m_Controls->sbParam1->setMinimum( 0 );
m_Controls->sbParam1->setMaximum( 200 );
m_Controls->sbParam1->setValue( 3 );
break;
}
case 11:
{
m_SelectedAction = GRADIENT;
m_Controls->tlParam1->setEnabled(true);
m_Controls->sbParam1->setEnabled(true);
text1 = "Sigma of Gaussian Kernel:\n(in Image Spacing Units)";
m_Controls->sbParam1->setMinimum( 0 );
m_Controls->sbParam1->setMaximum( 200 );
m_Controls->sbParam1->setValue( 2 );
break;
}
case 12:
{
m_SelectedAction = LAPLACIAN;
break;
}
case 13:
{
m_SelectedAction = SOBEL;
break;
}
case 15:
{
m_SelectedAction = THRESHOLD;
m_Controls->tlParam1->setEnabled(true);
m_Controls->sbParam1->setEnabled(true);
m_Controls->tlParam2->setEnabled(true);
m_Controls->sbParam2->setEnabled(true);
text1 = "Lower threshold:";
text2 = "Upper threshold:";
m_Controls->sbParam1->setMinimum( -100000 );
m_Controls->sbParam1->setMaximum( 100000 );
m_Controls->sbParam1->setValue( 0 );
m_Controls->sbParam2->setMinimum( -100000 );
m_Controls->sbParam2->setMaximum( 100000 );
m_Controls->sbParam2->setValue( 300 );
break;
}
case 16:
{
m_SelectedAction = INVERSION;
break;
}
case 17:
{
m_SelectedAction = DOWNSAMPLING;
m_Controls->tlParam1->setEnabled(true);
m_Controls->sbParam1->setEnabled(true);
text1 = "Downsampling by Factor:";
m_Controls->sbParam1->setMinimum( 1 );
m_Controls->sbParam1->setMaximum( 100 );
m_Controls->sbParam1->setValue( 2 );
break;
}
default: return;
}
m_Controls->tlParam->setEnabled(true);
m_Controls->tlParam1->setText(text1);
m_Controls->tlParam2->setText(text2);
m_Controls->btnDoIt->setEnabled(true);
m_Controls->cbHideOrig->setEnabled(true);
}
void QmitkBasicImageProcessing::StartButtonClicked()
{
if(!m_SelectedImageNode->GetNode()) return;
this->BusyCursorOn();
mitk::Image::Pointer newImage;
try
{
newImage = dynamic_cast(m_SelectedImageNode->GetNode()->GetData());
}
catch ( std::exception &e )
{
QString exceptionString = "An error occured during image loading:\n";
exceptionString.append( e.what() );
QMessageBox::warning( NULL, "Basic Image Processing", exceptionString , QMessageBox::Ok, QMessageBox::NoButton );
this->BusyCursorOff();
return;
}
// check if input image is valid, casting does not throw exception when casting from 'NULL-Object'
if ( (! newImage) || (newImage->IsInitialized() == false) )
{
this->BusyCursorOff();
QMessageBox::warning( NULL, "Basic Image Processing", "Input image is broken or not initialized. Returning.", QMessageBox::Ok, QMessageBox::NoButton );
return;
}
// check if operation is done on 4D a image time step
if(newImage->GetDimension() > 3)
{
mitk::ImageTimeSelector::Pointer timeSelector = mitk::ImageTimeSelector::New();
timeSelector->SetInput(newImage);
timeSelector->SetTimeNr( ((QmitkSliderNavigatorWidget*)m_Controls->sliceNavigatorTime)->GetPos() );
timeSelector->Update();
newImage = timeSelector->GetOutput();
}
// check if image or vector image
ImageType::Pointer itkImage = ImageType::New();
VectorImageType::Pointer itkVecImage = VectorImageType::New();
int isVectorImage = newImage->GetPixelType().GetNumberOfComponents();
if(isVectorImage > 1)
{
CastToItkImage( newImage, itkVecImage );
}
else
{
CastToItkImage( newImage, itkImage );
}
std::stringstream nameAddition("");
int param1 = m_Controls->sbParam1->value();
int param2 = m_Controls->sbParam2->value();
try{
switch (m_SelectedAction)
{
case GAUSSIAN:
{
GaussianFilterType::Pointer gaussianFilter = GaussianFilterType::New();
gaussianFilter->SetInput( itkImage );
gaussianFilter->SetVariance( param1 );
gaussianFilter->UpdateLargestPossibleRegion();
newImage = mitk::ImportItkImage(gaussianFilter->GetOutput());
nameAddition << "_Gaussian_var_" << param1;
std::cout << "Gaussian filtering successful." << std::endl;
break;
}
case MEDIAN:
{
MedianFilterType::Pointer medianFilter = MedianFilterType::New();
MedianFilterType::InputSizeType size;
size.Fill(param1);
medianFilter->SetRadius( size );
medianFilter->SetInput(itkImage);
medianFilter->UpdateLargestPossibleRegion();
newImage = mitk::ImportItkImage(medianFilter->GetOutput());
nameAddition << "_Median_radius_" << param1;
std::cout << "Median Filtering successful." << std::endl;
break;
}
case TOTALVARIATION:
{
if(isVectorImage > 1)
{
VectorTotalVariationFilterType::Pointer TVFilter
= VectorTotalVariationFilterType::New();
TVFilter->SetInput( itkVecImage.GetPointer() );
TVFilter->SetNumberIterations(param1);
TVFilter->SetLambda(double(param2)/1000.);
TVFilter->UpdateLargestPossibleRegion();
newImage = mitk::ImportItkImage(TVFilter->GetOutput());
}
else
{
FloatImageType::Pointer fImage = FloatImageType::New();
CastToItkImage( newImage, fImage );
TotalVariationFilterType::Pointer TVFilter
= TotalVariationFilterType::New();
TVFilter->SetInput( fImage.GetPointer() );
TVFilter->SetNumberIterations(param1);
TVFilter->SetLambda(double(param2)/1000.);
TVFilter->UpdateLargestPossibleRegion();
newImage = mitk::ImportItkImage(TVFilter->GetOutput());
}
nameAddition << "_TV_Iter_" << param1 << "_L_" << param2;
std::cout << "Total Variation Filtering successful." << std::endl;
break;
}
case DILATION:
{
BallType binaryBall;
binaryBall.SetRadius( param1 );
binaryBall.CreateStructuringElement();
DilationFilterType::Pointer dilationFilter = DilationFilterType::New();
dilationFilter->SetInput( itkImage );
dilationFilter->SetKernel( binaryBall );
dilationFilter->UpdateLargestPossibleRegion();
newImage = mitk::ImportItkImage(dilationFilter->GetOutput());
nameAddition << "_Dilated_by_" << param1;
std::cout << "Dilation successful." << std::endl;
break;
}
case EROSION:
{
BallType binaryBall;
binaryBall.SetRadius( param1 );
binaryBall.CreateStructuringElement();
ErosionFilterType::Pointer erosionFilter = ErosionFilterType::New();
erosionFilter->SetInput( itkImage );
erosionFilter->SetKernel( binaryBall );
erosionFilter->UpdateLargestPossibleRegion();
newImage = mitk::ImportItkImage(erosionFilter->GetOutput());
nameAddition << "_Eroded_by_" << param1;
std::cout << "Erosion successful." << std::endl;
break;
}
case OPENING:
{
BallType binaryBall;
binaryBall.SetRadius( param1 );
binaryBall.CreateStructuringElement();
OpeningFilterType::Pointer openFilter = OpeningFilterType::New();
openFilter->SetInput( itkImage );
openFilter->SetKernel( binaryBall );
openFilter->UpdateLargestPossibleRegion();
newImage = mitk::ImportItkImage(openFilter->GetOutput());
nameAddition << "_Opened_by_" << param1;
std::cout << "Opening successful." << std::endl;
break;
}
case CLOSING:
{
BallType binaryBall;
binaryBall.SetRadius( param1 );
binaryBall.CreateStructuringElement();
ClosingFilterType::Pointer closeFilter = ClosingFilterType::New();
closeFilter->SetInput( itkImage );
closeFilter->SetKernel( binaryBall );
closeFilter->UpdateLargestPossibleRegion();
newImage = mitk::ImportItkImage(closeFilter->GetOutput());
nameAddition << "_Closed_by_" << param1;
std::cout << "Closing successful." << std::endl;
break;
}
case GRADIENT:
{
GradientFilterType::Pointer gradientFilter = GradientFilterType::New();
gradientFilter->SetInput( itkImage );
gradientFilter->SetSigma( param1 );
gradientFilter->UpdateLargestPossibleRegion();
newImage = mitk::ImportItkImage(gradientFilter->GetOutput());
nameAddition << "_Gradient_sigma_" << param1;
std::cout << "Gradient calculation successful." << std::endl;
break;
}
case LAPLACIAN:
{
FloatImageType::Pointer fImage = FloatImageType::New();
CastToItkImage( newImage, fImage );
LaplacianFilterType::Pointer laplacianFilter = LaplacianFilterType::New();
laplacianFilter->SetInput( fImage );
laplacianFilter->UpdateLargestPossibleRegion();
newImage = mitk::ImportItkImage(laplacianFilter->GetOutput());
nameAddition << "_Second_Derivative";
std::cout << "Laplacian filtering successful." << std::endl;
break;
}
case SOBEL:
{
FloatImageType::Pointer fImage = FloatImageType::New();
CastToItkImage( newImage, fImage );
SobelFilterType::Pointer sobelFilter = SobelFilterType::New();
sobelFilter->SetInput( fImage );
sobelFilter->UpdateLargestPossibleRegion();
newImage = mitk::ImportItkImage(sobelFilter->GetOutput());
nameAddition << "_Sobel";
std::cout << "Edge Detection successful." << std::endl;
break;
}
case THRESHOLD:
{
ThresholdFilterType::Pointer thFilter = ThresholdFilterType::New();
thFilter->SetLowerThreshold(param1 < param2 ? param1 : param2);
thFilter->SetUpperThreshold(param2 > param1 ? param2 : param1);
thFilter->SetInsideValue(1);
thFilter->SetOutsideValue(0);
thFilter->SetInput(itkImage);
thFilter->UpdateLargestPossibleRegion();
newImage = mitk::ImportItkImage(thFilter->GetOutput());
nameAddition << "_Threshold";
std::cout << "Thresholding successful." << std::endl;
break;
}
case INVERSION:
{
InversionFilterType::Pointer invFilter = InversionFilterType::New();
mitk::ScalarType min = newImage->GetScalarValueMin();
mitk::ScalarType max = newImage->GetScalarValueMax();
invFilter->SetMaximum( max + min );
invFilter->SetInput(itkImage);
invFilter->UpdateLargestPossibleRegion();
newImage = mitk::ImportItkImage(invFilter->GetOutput());
nameAddition << "_Inverted";
std::cout << "Image inversion successful." << std::endl;
break;
}
case DOWNSAMPLING:
{
ResampleImageFilterType::Pointer downsampler = ResampleImageFilterType::New();
downsampler->SetInput( itkImage );
typedef itk::NearestNeighborInterpolateImageFunction< ImageType, double > InterpolatorType;
InterpolatorType::Pointer interpolator = InterpolatorType::New();
downsampler->SetInterpolator( interpolator );
downsampler->SetDefaultPixelValue( 0 );
ResampleImageFilterType::SpacingType spacing = itkImage->GetSpacing();
spacing *= (double) param1;
downsampler->SetOutputSpacing( spacing );
downsampler->SetOutputOrigin( itkImage->GetOrigin() );
downsampler->SetOutputDirection( itkImage->GetDirection() );
ResampleImageFilterType::SizeType size = itkImage->GetLargestPossibleRegion().GetSize();
for ( int i = 0; i < 3; ++i )
{
size[i] /= param1;
}
downsampler->SetSize( size );
downsampler->UpdateLargestPossibleRegion();
newImage = mitk::ImportItkImage(downsampler->GetOutput());
nameAddition << "_Downsampled_by_" << param1;
std::cout << "Downsampling successful." << std::endl;
break;
}
default:
this->BusyCursorOff();
return;
}
}
catch (...)
{
this->BusyCursorOff();
QMessageBox::warning(NULL, "Warning", "Problem when applying filter operation. Check your input...");
return;
}
newImage->DisconnectPipeline();
// adjust level/window to new image
mitk::LevelWindow levelwindow;
levelwindow.SetAuto( newImage );
mitk::LevelWindowProperty::Pointer levWinProp = mitk::LevelWindowProperty::New();
levWinProp->SetLevelWindow( levelwindow );
// compose new image name
std::string name = m_SelectedImageNode->GetNode()->GetName();
if (name.find(".pic.gz") == name.size() -7 )
{
name = name.substr(0,name.size() -7);
}
name.append( nameAddition.str() );
// create final result MITK data storage node
mitk::DataNode::Pointer result = mitk::DataNode::New();
result->SetProperty( "levelwindow", levWinProp );
result->SetProperty( "name", mitk::StringProperty::New( name.c_str() ) );
result->SetData( newImage );
// for vector images, a different mapper is needed
if(isVectorImage > 1)
{
mitk::VectorImageMapper2D::Pointer mapper =
mitk::VectorImageMapper2D::New();
result->SetMapper(1,mapper);
}
// reset GUI to ease further processing
this->ResetOneImageOpPanel();
// add new image to data storage and set as active to ease further processing
GetDefaultDataStorage()->Add( result, m_SelectedImageNode->GetNode() );
if ( m_Controls->cbHideOrig->isChecked() == true )
m_SelectedImageNode->GetNode()->SetProperty( "visible", mitk::BoolProperty::New(false) );
// TODO!! m_Controls->m_ImageSelector1->SetSelectedNode(result);
// show the results
mitk::RenderingManager::GetInstance()->RequestUpdateAll();
this->BusyCursorOff();
}
void QmitkBasicImageProcessing::SelectAction2(int operation)
{
// check which operation the user has selected and set parameters and GUI accordingly
switch (operation)
{
case 2:
m_SelectedOperation = ADD;
break;
case 3:
m_SelectedOperation = SUBTRACT;
break;
case 4:
m_SelectedOperation = MULTIPLY;
break;
case 5:
m_SelectedOperation = DIVIDE;
break;
case 7:
m_SelectedOperation = AND;
break;
case 8:
m_SelectedOperation = OR;
break;
case 9:
m_SelectedOperation = XOR;
break;
default:
this->ResetTwoImageOpPanel();
return;
}
m_Controls->tlImage2->setEnabled(true);
m_Controls->m_ImageSelector2->setEnabled(true);
m_Controls->btnDoIt2->setEnabled(true);
}
void QmitkBasicImageProcessing::StartButton2Clicked()
{
mitk::Image::Pointer newImage1 = dynamic_cast
(m_SelectedImageNode->GetNode()->GetData());
mitk::Image::Pointer newImage2 = dynamic_cast
(m_Controls->m_ImageSelector2->GetSelectedNode()->GetData());
// check if images are valid
if( (!newImage1) || (!newImage2) || (newImage1->IsInitialized() == false) || (newImage2->IsInitialized() == false) )
{
itkGenericExceptionMacro(<< "At least one of the input images are broken or not initialized. Returning");
return;
}
this->BusyCursorOn();
this->ResetTwoImageOpPanel();
// check if 4D image and use filter on correct time step
int time = ((QmitkSliderNavigatorWidget*)m_Controls->sliceNavigatorTime)->GetPos();
if(time>=0)
{
mitk::ImageTimeSelector::Pointer timeSelector = mitk::ImageTimeSelector::New();
timeSelector->SetInput(newImage1);
timeSelector->SetTimeNr( time );
timeSelector->UpdateLargestPossibleRegion();
newImage1 = timeSelector->GetOutput();
newImage1->DisconnectPipeline();
timeSelector->SetInput(newImage2);
timeSelector->SetTimeNr( time );
timeSelector->UpdateLargestPossibleRegion();
newImage2 = timeSelector->GetOutput();
newImage2->DisconnectPipeline();
}
// reset GUI for better usability
this->ResetTwoImageOpPanel();
ImageType::Pointer itkImage1 = ImageType::New();
ImageType::Pointer itkImage2 = ImageType::New();
CastToItkImage( newImage1, itkImage1 );
CastToItkImage( newImage2, itkImage2 );
// Remove temp image
newImage2 = NULL;
std::string nameAddition = "";
try
{
switch (m_SelectedOperation)
{
case ADD:
{
AddFilterType::Pointer addFilter = AddFilterType::New();
addFilter->SetInput1( itkImage1 );
addFilter->SetInput2( itkImage2 );
addFilter->UpdateLargestPossibleRegion();
newImage1 = mitk::ImportItkImage(addFilter->GetOutput());
nameAddition = "_Added";
}
break;
case SUBTRACT:
{
SubtractFilterType::Pointer subFilter = SubtractFilterType::New();
subFilter->SetInput1( itkImage1 );
subFilter->SetInput2( itkImage2 );
subFilter->UpdateLargestPossibleRegion();
newImage1 = mitk::ImportItkImage(subFilter->GetOutput());
nameAddition = "_Subtracted";
}
break;
case MULTIPLY:
{
MultiplyFilterType::Pointer multFilter = MultiplyFilterType::New();
multFilter->SetInput1( itkImage1 );
multFilter->SetInput2( itkImage2 );
multFilter->UpdateLargestPossibleRegion();
newImage1 = mitk::ImportItkImage(multFilter->GetOutput());
nameAddition = "_Multiplied";
}
break;
case DIVIDE:
{
DivideFilterType::Pointer divFilter = DivideFilterType::New();
divFilter->SetInput1( itkImage1 );
divFilter->SetInput2( itkImage2 );
divFilter->UpdateLargestPossibleRegion();
newImage1 = mitk::ImportItkImage(divFilter->GetOutput());
nameAddition = "_Divided";
}
break;
case AND:
{
AndImageFilterType::Pointer andFilter = AndImageFilterType::New();
andFilter->SetInput1( itkImage1 );
andFilter->SetInput2( itkImage2 );
andFilter->UpdateLargestPossibleRegion();
newImage1 = mitk::ImportItkImage(andFilter->GetOutput());
nameAddition = "_AND";
break;
}
case OR:
{
OrImageFilterType::Pointer orFilter = OrImageFilterType::New();
orFilter->SetInput1( itkImage1 );
orFilter->SetInput2( itkImage2 );
orFilter->UpdateLargestPossibleRegion();
newImage1 = mitk::ImportItkImage(orFilter->GetOutput());
nameAddition = "_OR";
break;
}
case XOR:
{
XorImageFilterType::Pointer xorFilter = XorImageFilterType::New();
xorFilter->SetInput1( itkImage1 );
xorFilter->SetInput2( itkImage2 );
xorFilter->UpdateLargestPossibleRegion();
newImage1 = mitk::ImportItkImage(xorFilter->GetOutput());
nameAddition = "_XOR";
break;
}
default:
std::cout << "Something went wrong..." << std::endl;
this->BusyCursorOff();
return;
}
}
catch (...)
{
this->BusyCursorOff();
QMessageBox::warning(NULL, "Warning", "Problem when applying arithmetic operation to two images. Check dimensions of input images.");
return;
}
// disconnect pipeline; images will not be reused
newImage1->DisconnectPipeline();
itkImage1 = NULL;
itkImage2 = NULL;
// adjust level/window to new image and compose new image name
mitk::LevelWindow levelwindow;
levelwindow.SetAuto( newImage1 );
mitk::LevelWindowProperty::Pointer levWinProp = mitk::LevelWindowProperty::New();
levWinProp->SetLevelWindow( levelwindow );
std::string name = m_SelectedImageNode->GetNode()->GetName();
if (name.find(".pic.gz") == name.size() -7 )
{
name = name.substr(0,name.size() -7);
}
// create final result MITK data storage node
mitk::DataNode::Pointer result = mitk::DataNode::New();
result->SetProperty( "levelwindow", levWinProp );
result->SetProperty( "name", mitk::StringProperty::New( (name + nameAddition ).c_str() ));
result->SetData( newImage1 );
GetDefaultDataStorage()->Add( result, m_SelectedImageNode->GetNode() );
// show only the newly created image
m_SelectedImageNode->GetNode()->SetProperty( "visible", mitk::BoolProperty::New(false) );
m_Controls->m_ImageSelector2->GetSelectedNode()->SetProperty( "visible", mitk::BoolProperty::New(false) );
// show the newly created image
mitk::RenderingManager::GetInstance()->RequestUpdateAll();
this->BusyCursorOff();
}
diff --git a/Plugins/org.mitk.gui.qt.basicimageprocessing/src/internal/QmitkBasicImageProcessingView.h b/Plugins/org.mitk.gui.qt.basicimageprocessing/src/internal/QmitkBasicImageProcessingView.h
index 410743505e..1885ba8a0c 100644
--- a/Plugins/org.mitk.gui.qt.basicimageprocessing/src/internal/QmitkBasicImageProcessingView.h
+++ b/Plugins/org.mitk.gui.qt.basicimageprocessing/src/internal/QmitkBasicImageProcessingView.h
@@ -1,185 +1,184 @@
-/*=========================================================================
+/*===================================================================
-Program: Medical Imaging & Interaction Toolkit
-Language: C++
-Date: $Date$
-Version: $Revision: 10185 $
+The Medical Imaging Interaction Toolkit (MITK)
-Copyright (c) German Cancer Research Center, Division of Medical and
-Biological Informatics. All rights reserved.
-See MITKCopyright.txt or http://www.mitk.org/copyright.html for details.
+Copyright (c) German Cancer Research Center,
+Division of Medical and Biological Informatics.
+All rights reserved.
-This software is distributed WITHOUT ANY WARRANTY; without even
-the implied warranty of MERCHANTABILITY or FITNESS FOR A PARTICULAR
-PURPOSE. See the above copyright notices for more information.
+This software is distributed WITHOUT ANY WARRANTY; without
+even the implied warranty of MERCHANTABILITY or FITNESS FOR
+A PARTICULAR PURPOSE.
-=========================================================================*/
+See LICENSE.txt or http://www.mitk.org for details.
+
+===================================================================*/
#if !defined(QmitkBasicImageProcessingView_H__INCLUDED)
#define QmitkBasicImageProcessingView_H__INCLUDED
#include "QmitkFunctionality.h"
#include
#include "ui_QmitkBasicImageProcessingViewControls.h"
#include "QmitkStepperAdapter.h"
#include
#include
/*!
\brief This module allows to use some basic image processing filters for preprocessing, image enhancement and testing purposes
Several basic ITK image processing filters, like denoising, morphological and edge detection
are encapsulated in this module and can be selected via a list and an intuitive parameter input.
The selected filter will be applied on the image, and a new image showing the output is displayed
as result.
Also, some image arithmetic operations are available.
Images can be 3D or 4D.
In the 4D case, the filters work on the 3D image selected via the
time slider. The result is also a 3D image.
\sa QmitkFunctionality, QObject
\class QmitkBasicImageProcessing
\author Tobias Schwarz
\version 1.0 (3M3)
\date 2009-05-10
\ingroup Bundles
*/
class BASICIMAGEPROCESSING_EXPORT QmitkBasicImageProcessing : public QmitkFunctionality
{
Q_OBJECT
public:
/*!
\brief default constructor
*/
QmitkBasicImageProcessing();
QmitkBasicImageProcessing(const QmitkBasicImageProcessing& other)
{
Q_UNUSED(other)
throw std::runtime_error("Copy constructor not implemented");
}
/*!
\brief default destructor
*/
virtual ~QmitkBasicImageProcessing();
/*!
\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();
virtual void Activated();
/*!
\brief Invoked when the DataManager selection changed
*/
virtual void OnSelectionChanged(std::vector nodes);
protected slots:
/*
* When an action is selected in the "one image ops" list box
*/
void SelectAction(int action);
/*
* When an action is selected in the "two image ops" list box
*/
void SelectAction2(int operation);
/*
* The "Execute" button in the "one image ops" box was triggered
*/
void StartButtonClicked();
/*
* The "Execute" button in the "two image ops" box was triggered
*/
void StartButton2Clicked();
/*
* Switch between the one and the two image operations GUI
*/
void ChangeGUI();
private:
/*
* After a one image operation, reset the "one image ops" panel
*/
void ResetOneImageOpPanel();
/*
* Helper method to reset the parameter set panel
*/
void ResetParameterPanel();
/*
* After a two image operation, reset the "two image ops" panel
*/
void ResetTwoImageOpPanel();
/*!
* controls containing sliders for scrolling through the slices
*/
Ui::QmitkBasicImageProcessingViewControls *m_Controls;
//mitk::DataNode* m_SelectedImageNode;
mitk::DataStorageSelection::Pointer m_SelectedImageNode;
QmitkStepperAdapter* m_TimeStepperAdapter;
berry::ISelectionListener::Pointer m_SelectionListener;
enum ActionType {
NOACTIONSELECTED,
CATEGORY_DENOISING,
GAUSSIAN,
MEDIAN,
TOTALVARIATION,
CATEGORY_MORPHOLOGICAL,
DILATION,
EROSION,
OPENING,
CLOSING,
CATEGORY_EDGE_DETECTION,
GRADIENT,
LAPLACIAN,
SOBEL,
CATEGORY_MISC,
THRESHOLD,
INVERSION,
DOWNSAMPLING,
} m_SelectedAction;
enum OperationType{
TWOIMAGESNOACTIONSELECTED,
CATEGORY_ARITHMETIC,
ADD,
SUBTRACT,
MULTIPLY,
DIVIDE,
CATEGORY_BOOLEAN,
AND,
OR,
XOR
} m_SelectedOperation;
};
#endif // !defined(QmitkBasicImageProcessing_H__INCLUDED)
diff --git a/Plugins/org.mitk.gui.qt.common.legacy/src/QmitkFunctionality.cpp b/Plugins/org.mitk.gui.qt.common.legacy/src/QmitkFunctionality.cpp
index e261421d69..e517f2549c 100755
--- a/Plugins/org.mitk.gui.qt.common.legacy/src/QmitkFunctionality.cpp
+++ b/Plugins/org.mitk.gui.qt.common.legacy/src/QmitkFunctionality.cpp
@@ -1,357 +1,356 @@
-/*=========================================================================
+/*===================================================================
- Program: Medical Imaging & Interaction Toolkit
- Language: C++
- Date: $Date$
- Version: $Revision$
+The Medical Imaging Interaction Toolkit (MITK)
- Copyright (c) German Cancer Research Center, Division of Medical and
- Biological Informatics. All rights reserved.
- See MITKCopyright.txt or http://www.mitk.org/copyright.html for details.
+Copyright (c) German Cancer Research Center,
+Division of Medical and Biological Informatics.
+All rights reserved.
- This software is distributed WITHOUT ANY WARRANTY; without even
- the implied warranty of MERCHANTABILITY or FITNESS FOR A PARTICULAR
- PURPOSE. See the above copyright notices for more information.
+This software is distributed WITHOUT ANY WARRANTY; without
+even the implied warranty of MERCHANTABILITY or FITNESS FOR
+A PARTICULAR PURPOSE.
- =========================================================================*/
+See LICENSE.txt or http://www.mitk.org for details.
+
+===================================================================*/
#include "QmitkFunctionality.h"
#include "internal/QmitkFunctionalityUtil.h"
// other includes
#include
// mitk Includes
#include
#include
// berry Includes
#include
#include
#include
// Qmitk Includes
#include
// Qt Includes
#include
#include
#include
#include
QmitkFunctionality::QmitkFunctionality()
: m_Parent(0)
, m_Active(false)
, m_Visible(false)
, m_SelectionProvider(0)
, m_HandlesMultipleDataStorages(false)
, m_InDataStorageChanged(false)
{
m_PreferencesService =
berry::Platform::GetServiceRegistry().GetServiceById(berry::IPreferencesService::ID);
}
void QmitkFunctionality::SetHandleMultipleDataStorages(bool multiple)
{
m_HandlesMultipleDataStorages = multiple;
}
bool QmitkFunctionality::HandlesMultipleDataStorages() const
{
return m_HandlesMultipleDataStorages;
}
mitk::DataStorage::Pointer
QmitkFunctionality::GetDataStorage() const
{
mitk::IDataStorageService::Pointer service =
berry::Platform::GetServiceRegistry().GetServiceById(mitk::IDataStorageService::ID);
if (service.IsNotNull())
{
if (m_HandlesMultipleDataStorages)
return service->GetActiveDataStorage()->GetDataStorage();
else
return service->GetDefaultDataStorage()->GetDataStorage();
}
return 0;
}
mitk::DataStorage::Pointer QmitkFunctionality::GetDefaultDataStorage() const
{
mitk::IDataStorageService::Pointer service =
berry::Platform::GetServiceRegistry().GetServiceById(mitk::IDataStorageService::ID);
return service->GetDefaultDataStorage()->GetDataStorage();
}
void QmitkFunctionality::CreatePartControl(void* parent)
{
// scrollArea
QScrollArea* scrollArea = new QScrollArea;
//QVBoxLayout* scrollAreaLayout = new QVBoxLayout(scrollArea);
scrollArea->setFrameShadow(QFrame::Plain);
scrollArea->setFrameShape(QFrame::NoFrame);
scrollArea->setHorizontalScrollBarPolicy(Qt::ScrollBarAsNeeded);
scrollArea->setVerticalScrollBarPolicy(Qt::ScrollBarAsNeeded);
// m_Parent
m_Parent = new QWidget;
//m_Parent->setSizePolicy(QSizePolicy(QSizePolicy::MinimumExpanding, QSizePolicy::MinimumExpanding));
this->CreateQtPartControl(m_Parent);
//scrollAreaLayout->addWidget(m_Parent);
//scrollArea->setLayout(scrollAreaLayout);
// set the widget now
scrollArea->setWidgetResizable(true);
scrollArea->setWidget(m_Parent);
// add the scroll area to the real parent (the view tabbar)
QWidget* parentQWidget = static_cast(parent);
QVBoxLayout* parentLayout = new QVBoxLayout(parentQWidget);
parentLayout->setMargin(0);
parentLayout->setSpacing(0);
parentLayout->addWidget(scrollArea);
// finally set the layout containing the scroll area to the parent widget (= show it)
parentQWidget->setLayout(parentLayout);
this->AfterCreateQtPartControl();
}
void QmitkFunctionality::AfterCreateQtPartControl()
{
// REGISTER DATASTORAGE LISTENER
this->GetDefaultDataStorage()->AddNodeEvent.AddListener( mitk::MessageDelegate1
( this, &QmitkFunctionality::NodeAddedProxy ) );
this->GetDefaultDataStorage()->ChangedNodeEvent.AddListener( mitk::MessageDelegate1
( this, &QmitkFunctionality::NodeChangedProxy ) );
this->GetDefaultDataStorage()->RemoveNodeEvent.AddListener( mitk::MessageDelegate1
( this, &QmitkFunctionality::NodeRemovedProxy ) );
// REGISTER PREFERENCES LISTENER
berry::IBerryPreferences::Pointer prefs = this->GetPreferences().Cast();
if(prefs.IsNotNull())
prefs->OnChanged.AddListener(berry::MessageDelegate1(this, &QmitkFunctionality::OnPreferencesChanged));
// REGISTER FOR WORKBENCH SELECTION EVENTS
m_BlueBerrySelectionListener = berry::ISelectionListener::Pointer(new berry::SelectionChangedAdapter(this
, &QmitkFunctionality::BlueBerrySelectionChanged));
this->GetSite()->GetWorkbenchWindow()->GetSelectionService()->AddPostSelectionListener(/*"org.mitk.views.datamanager",*/ m_BlueBerrySelectionListener);
// REGISTER A SELECTION PROVIDER
QmitkFunctionalitySelectionProvider::Pointer _SelectionProvider
= QmitkFunctionalitySelectionProvider::New(this);
m_SelectionProvider = _SelectionProvider.GetPointer();
this->GetSite()->SetSelectionProvider(berry::ISelectionProvider::Pointer(m_SelectionProvider));
// EMULATE INITIAL SELECTION EVENTS
// by default a a multi widget is always available
this->StdMultiWidgetAvailable(*this->GetActiveStdMultiWidget());
// send datamanager selection
this->OnSelectionChanged(this->GetDataManagerSelection());
// send preferences changed event
this->OnPreferencesChanged(this->GetPreferences().Cast().GetPointer());
}
void QmitkFunctionality::ClosePart()
{
}
void QmitkFunctionality::ClosePartProxy()
{
this->GetDefaultDataStorage()->AddNodeEvent.RemoveListener( mitk::MessageDelegate1
( this, &QmitkFunctionality::NodeAddedProxy ) );
this->GetDefaultDataStorage()->RemoveNodeEvent.RemoveListener( mitk::MessageDelegate1
( this, &QmitkFunctionality::NodeRemovedProxy) );
this->GetDefaultDataStorage()->ChangedNodeEvent.RemoveListener( mitk::MessageDelegate1
( this, &QmitkFunctionality::NodeChangedProxy ) );
berry::IBerryPreferences::Pointer prefs = this->GetPreferences().Cast