diff --git a/CMake/moduleExports.h.in b/CMake/moduleExports.h.in index cbb04bbe2e..8e12255d76 100644 --- a/CMake/moduleExports.h.in +++ b/CMake/moduleExports.h.in @@ -1,35 +1,50 @@ /*========================================================================= Program: Medical Imaging & Interaction Toolkit Language: C++ Date: $Date: 2009-05-19 21:14:21 +0200 (Di, 19 Mai 2009) $ Version: $Revision: 17326 $ Copyright (c) German Cancer Research Center, Division of Medical and Biological Informatics. All rights reserved. See MITKCopyright.txt or http://www.mitk.org/copyright.html for details. This software is distributed WITHOUT ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the above copyright notices for more information. =========================================================================*/ + +#include + #ifndef @MODULE_NAME@_EXPORTS_H #define @MODULE_NAME@_EXPORTS_H - #if defined(WIN32) + + /** + * provide a macro for adding compiler specific export/import declarations + * to classes. + * This is needed for the export of symbols, when you build a DLL. Then write + * + * class @MODULE_EXPORT_DEFINE@ ClassName : public SomeClass {}; + */ + #ifdef MITK_BUILD_STATIC + #define @MODULE_EXPORT_DEFINE@ + #define @MODULE_NAME@_LOCAL + #else #ifdef @MODULE_PROVIDES@_EXPORTS - #define @MODULE_EXPORT_DEFINE@ __declspec(dllexport) + #define @MODULE_EXPORT_DEFINE@ MITK_EXPORT #else - #define @MODULE_EXPORT_DEFINE@ __declspec(dllimport) + #define @MODULE_EXPORT_DEFINE@ MITK_IMPORT #endif - #else - #define @MODULE_EXPORT_DEFINE@ + #define @MODULE_NAME@_LOCAL MITK_LOCAL #endif + #ifndef _CMAKE_MODULENAME #ifdef @MODULE_PROVIDES@_EXPORTS #define _CMAKE_MODULENAME "@MODULE_NAME@" #endif #endif + #endif diff --git a/Core/Code/Algorithms/mitkBaseProcess.h b/Core/Code/Algorithms/mitkBaseProcess.h index 0cf24129e0..951d6e11ab 100644 --- a/Core/Code/Algorithms/mitkBaseProcess.h +++ b/Core/Code/Algorithms/mitkBaseProcess.h @@ -1,110 +1,110 @@ /*========================================================================= Program: Medical Imaging & Interaction Toolkit Language: C++ Date: $Date$ Version: $Revision$ Copyright (c) German Cancer Research Center, Division of Medical and Biological Informatics. All rights reserved. See MITKCopyright.txt or http://www.mitk.org/copyright.html for details. This software is distributed WITHOUT ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the above copyright notices for more information. =========================================================================*/ #ifndef BASEPROCESS_H_HEADER_INCLUDED_C19BE6FC #define BASEPROCESS_H_HEADER_INCLUDED_C19BE6FC #if(_MSC_VER==1200) #include #endif -#include "mitkCommon.h" +#include #include namespace mitk { class BaseData; //##Documentation //## @brief Superclass of all classes generating some kind of mitk::BaseData. //## //## Superclass of all classes generating some kind of mitk::BaseData. //## In itk and vtk the generated result of a ProcessObject is only guaranteed //## to be up-to-date, when Update() of the ProcessObject or the generated //## DataObject is called immediately before access of the data stored in the //## DataObject. This is also true for subclasses of mitk::BaseProcess. But //## many of the subclasses of mitk::BaseProcess define additional access //## functions to the generated output that guarantee an up-to-date result, see //## for example mitk::ImageSource. //## @ingroup Process class MITK_CORE_EXPORT BaseProcess : public itk::ProcessObject { public: mitkClassMacro(BaseProcess, itk::ProcessObject); //##Documentation //## @brief Access itk::ProcessObject::m_Updating //## //## m_Updating indicates when the pipeline is executing. //## It prevents infinite recursion when pipelines have loops. //## \sa itk::ProcessObject::m_Updating bool Updating() const { return m_Updating; } //##Documentation //## @brief Helps to deal with the weak-pointer-problem. virtual void UnRegister() const; //##Documentation //## @brief Helps to deal with the weak-pointer-problem. virtual int GetExternalReferenceCount() const; protected: BaseProcess(); virtual ~BaseProcess(); //##Documentation //## @brief Protected methods for setting outputs. //## //## Subclasses make use of them for getting output. //## These are only overwritten because of itk::DataObject::ConnectSource being //## private and non-virtual: the important stuff is done in //## mitk::BaseData::ConnectSource. virtual void SetNthOutput(unsigned int num, itk::DataObject *output); //##Documentation //## @brief Protected methods for setting outputs. //## //## Subclasses make use of them for getting output. //## These are only overwritten because of itk::DataObject::ConnectSource being //## private and non-virtual: the important stuff is done in //## mitk::BaseData::ConnectSource. virtual void AddOutput(itk::DataObject *output); private: //##Documentation //## @brief Helps to deal with the weak-pointer-problem. mutable bool m_Unregistering; //##Documentation //## @brief Helps to deal with the weak-pointer-problem. mutable bool m_CalculatingExternalReferenceCount; //##Documentation //## @brief Helps to deal with the weak-pointer-problem. mutable int m_ExternalReferenceCount; }; } // namespace mitk #endif /* BASEPROCESS_H_HEADER_INCLUDED_C19BE6FC */ diff --git a/Core/Code/Algorithms/mitkCoreObjectFactory.h b/Core/Code/Algorithms/mitkCoreObjectFactory.h index 29ce06a5c9..4d3634e3e5 100755 --- a/Core/Code/Algorithms/mitkCoreObjectFactory.h +++ b/Core/Code/Algorithms/mitkCoreObjectFactory.h @@ -1,63 +1,63 @@ /*========================================================================= Program: Medical Imaging & Interaction Toolkit Language: C++ Date: $Date$ Version: $Revision$ Copyright (c) German Cancer Research Center, Division of Medical and Biological Informatics. All rights reserved. See MITKCopyright.txt or http://www.mitk.org/copyright.html for details. This software is distributed WITHOUT ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the above copyright notices for more information. =========================================================================*/ #ifndef COREOBJECTFACTORY_H_INCLUDED #define COREOBJECTFACTORY_H_INCLUDED #include -#include "mitkCommon.h" +#include #include "mitkCoreObjectFactoryBase.h" #include "mitkFileWriterWithInformation.h" namespace mitk { class Event; class MITK_CORE_EXPORT CoreObjectFactory : public CoreObjectFactoryBase { public: mitkClassMacro(CoreObjectFactory,CoreObjectFactoryBase); itkFactorylessNewMacro(CoreObjectFactory); virtual Mapper::Pointer CreateMapper(mitk::DataNode* node, MapperSlotId slotId); virtual void SetDefaultProperties(mitk::DataNode* node); virtual const char* GetFileExtensions(); virtual MultimapType GetFileExtensionsMap(); virtual const char* GetSaveFileExtensions(); virtual MultimapType GetSaveFileExtensionsMap(); virtual FileWriterList GetFileWriters(); virtual void MapEvent(const mitk::Event* event, const int eventID); virtual void RegisterExtraFactory(CoreObjectFactoryBase* factory); virtual void UnRegisterExtraFactory(CoreObjectFactoryBase* factory); static Pointer GetInstance(); protected: CoreObjectFactory(); void MergeFileExtensions(MultimapType& fileExtensionsMap, MultimapType inputMap); void CreateFileExtensionsMap(); void CreateSaveFileExtensions(); typedef std::set ExtraFactoriesContainer; ExtraFactoriesContainer m_ExtraFactories; static FileWriterList m_FileWriters; std::string m_FileExtensions; MultimapType m_FileExtensionsMap; std::string m_SaveFileExtensions; MultimapType m_SaveFileExtensionsMap; }; } // namespace mitk #endif diff --git a/Core/Code/Algorithms/mitkCoreObjectFactoryBase.h b/Core/Code/Algorithms/mitkCoreObjectFactoryBase.h index 0d5768393e..7a2f41b2ce 100644 --- a/Core/Code/Algorithms/mitkCoreObjectFactoryBase.h +++ b/Core/Code/Algorithms/mitkCoreObjectFactoryBase.h @@ -1,79 +1,79 @@ /*========================================================================= Program: Medical Imaging & Interaction Toolkit Language: C++ Date: $Date$ Version: $Revision$ Copyright (c) German Cancer Research Center, Division of Medical and Biological Informatics. All rights reserved. See MITKCopyright.txt or http://www.mitk.org/copyright.html for details. This software is distributed WITHOUT ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the above copyright notices for more information. =========================================================================*/ #ifndef COREOBJECTFACTORYBASE_H_INCLUDED #define COREOBJECTFACTORYBASE_H_INCLUDED // the mbilog header is necessary for CMake test drivers. // Since the EXTRA_INCLUDE parameter of CREATE_TEST_SOURCELIST only // allows one extra include file, we specify mitkLog.h here so it will // be available to all classes implementing this interface. #include "mitkLog.h" -#include "mitkCommon.h" +#include #include "mitkMapper.h" #include #include #include "mitkFileWriterWithInformation.h" namespace mitk { class DataNode; //## @brief base-class for factories of certain mitk objects. //## @ingroup Algorithms //## This interface can be implemented by factories which add new mapper classes or extend the //## data tree deserialization mechanism. class MITK_CORE_EXPORT CoreObjectFactoryBase : public itk::Object { public: typedef std::list FileWriterList; typedef std::multimap MultimapType; mitkClassMacro(CoreObjectFactoryBase,itk::Object); virtual Mapper::Pointer CreateMapper(mitk::DataNode* node, MapperSlotId slotId) = 0; virtual void SetDefaultProperties(mitk::DataNode* node) = 0; virtual const char* GetFileExtensions() = 0; virtual MultimapType GetFileExtensionsMap() = 0; virtual const char* GetSaveFileExtensions() = 0; virtual MultimapType GetSaveFileExtensionsMap() = 0; virtual const char* GetITKSourceVersion() const { return ITK_SOURCE_VERSION; } virtual const char* GetDescription() const { return "Core Object Factory"; } FileWriterList GetFileWriters() { return m_FileWriters; } protected: /** * @brief create a string from a map that contains the file extensions * @param fileExtensionsMap input map with the file extensions, e.g. ("*.dcm", "DICOM files")("*.dc3", "DICOM files") * @param fileExtensions the converted output string, suitable for the QT QFileDialog widget * e.g. "all (*.dcm *.DCM *.dc3 ... *.vti *.hdr *.nrrd *.nhdr );;Q-Ball Images (*.hqbi *qbi)" */ static void CreateFileExtensions(MultimapType fileExtensionsMap, std::string& fileExtensions); FileWriterList m_FileWriters; }; } #endif diff --git a/Core/Code/Algorithms/mitkITKImageImport.h b/Core/Code/Algorithms/mitkITKImageImport.h index b36b6e9dd2..99c43f9d10 100644 --- a/Core/Code/Algorithms/mitkITKImageImport.h +++ b/Core/Code/Algorithms/mitkITKImageImport.h @@ -1,178 +1,178 @@ /*========================================================================= Program: Medical Imaging & Interaction Toolkit Language: C++ Date: $Date$ Version: $Revision$ Copyright (c) German Cancer Research Center, Division of Medical and Biological Informatics. All rights reserved. See MITKCopyright.txt or http://www.mitk.org/copyright.html for details. This software is distributed WITHOUT ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the above copyright notices for more information. =========================================================================*/ #ifndef MITKITKIMAGEIMPORT_H_HEADER_INCLUDED_C1E4861D #define MITKITKIMAGEIMPORT_H_HEADER_INCLUDED_C1E4861D -#include "mitkCommon.h" +#include #include "mitkImageSource.h" #include "itkImageToImageFilterDetail.h" namespace mitk { //##Documentation //## @brief Pipelined import of itk::Image //## //## The image data contained in the itk::Image is referenced, //## not copied. //## The easiest way of use is by the function //## mitk::ImportItkImage //## \code //## mitkImage = mitk::ImportItkImage(itkImage); //## \endcode //## \sa ImportItkImage //## @ingroup Adaptor template class MITK_EXPORT ITKImageImport : public ImageSource { public: mitkClassMacro(ITKImageImport,ImageSource); itkNewMacro(Self); //##Documentation //## \brief The type of the input image. typedef TInputImage InputImageType; typedef typename InputImageType::Pointer InputImagePointer; typedef typename InputImageType::ConstPointer InputImageConstPointer; typedef typename InputImageType::RegionType InputImageRegionType; typedef typename InputImageType::PixelType InputImagePixelType; /** ImageDimension constants */ itkStaticConstMacro(InputImageDimension, unsigned int, TInputImage::ImageDimension); itkStaticConstMacro(RegionDimension, unsigned int, mitk::SlicedData::RegionDimension); //##Documentation //## \brief Set the input itk::Image of this image importer. InputImageType * GetInput(void); //##Documentation //## \brief Set the input itk::Image of this image importer. void SetInput(const InputImageType*); //##Documentation //## \brief Set the Geometry of the result image (optional) //## //## The Geometry has to fit the dimension and size of //## the input image. The Geometry will be cloned, not //## referenced! //## //## Providing the Geometry is optional. //## The default behavior is to set the geometry by //## the itk::Image::GetDirection() information. void SetGeometry(const Geometry3D* geometry); protected: ITKImageImport(); virtual ~ITKImageImport(); virtual void GenerateOutputInformation(); virtual void GenerateInputRequestedRegion(); virtual void GenerateData(); virtual void SetNthOutput(unsigned int num, itk::DataObject *output); /** Typedef for the region copier function object that converts an * output region to an input region. */ typedef itk::ImageToImageFilterDetail::ImageRegionCopier OutputToInputRegionCopierType; Geometry3D::Pointer m_Geometry; }; //##Documentation //## @brief Imports an itk::Image (with a specific type) as an mitk::Image. //## @ingroup Adaptor //## //## Instantiates instance of ITKImageImport. //## mitk::ITKImageImport does not cast pixel types etc., it just imports //## image data. If you get a compile error, try image.GetPointer(). //## //## \param update: if \a true, fill mitk::Image, which will execute the //## up-stream pipeline connected to the input itk::Image. Otherwise you //## need to make sure that Update() is called on the mitk::Image before //## its data is being used, e.g., by connecting it to an mitk-pipeline //## and call Update of a downstream filter at some time. //## \sa itk::Image::CastToMitkImage template Image::Pointer ImportItkImage(const itk::SmartPointer& itkimage, const Geometry3D* geometry = NULL, bool update = true); //##Documentation //## @brief Imports an itk::Image (with a specific type) as an mitk::Image. //## @ingroup Adaptor //## //## Instantiates instance of ITKImageImport //## mitk::ITKImageImport does not cast pixel types etc., it just imports //## image data. If you get a compile error, try image.GetPointer(). //## //## \param update: if \a true, fill mitk::Image, which will execute the //## up-stream pipeline connected to the input itk::Image. Otherwise you //## need to make sure that Update() is called on the mitk::Image before //## its data is being used, e.g., by connecting it to an mitk-pipeline //## and call Update of a downstream filter at some time. //## \sa itk::Image::CastToMitkImage //## \sa GrabItkImageMemory template Image::Pointer ImportItkImage(const ItkOutputImageType* itkimage, const Geometry3D* geometry = NULL, bool update = true); //##Documentation //## @brief Grabs the memory of an itk::Image (with a specific type) //## and puts it into an mitk::Image. //## @ingroup Adaptor //## //## The memory is managed by the mitk::Image after calling this //## function. The itk::Image remains valid until the mitk::Image //## decides to free the memory. //## \param update: if \a true, fill mitk::Image, which will execute the //## up-stream pipeline connected to the input itk::Image. Otherwise you //## need to make sure that Update() is called on the mitk::Image before //## its data is being used, e.g., by connecting it to an mitk-pipeline //## and call Update of a downstream filter at some time. //## \sa ImportItkImage template Image::Pointer GrabItkImageMemory(itk::SmartPointer& itkimage, mitk::Image* mitkImage = NULL, const Geometry3D* geometry = NULL, bool update = true); //##Documentation //## @brief Grabs the memory of an itk::Image (with a specific type) //## and puts it into an mitk::Image. //## @ingroup Adaptor //## //## The memory is managed by the mitk::Image after calling this //## function. The itk::Image remains valid until the mitk::Image //## decides to free the memory. //## \param update: if \a true, fill mitk::Image, which will execute the //## up-stream pipeline connected to the input itk::Image. Otherwise you //## need to make sure that Update() is called on the mitk::Image before //## its data is being used, e.g., by connecting it to an mitk-pipeline //## and call Update of a downstream filter at some time. //## \sa ImportItkImage template Image::Pointer GrabItkImageMemory(ItkOutputImageType* itkimage, mitk::Image* mitkImage = NULL, const Geometry3D* geometry = NULL, bool update = true); } // namespace mitk #ifndef MITK_MANUAL_INSTANTIATION #include "mitkITKImageImport.txx" #endif #endif /* MITKITKIMAGEIMPORT_H_HEADER_INCLUDED_C1E4861D */ diff --git a/Core/Code/Algorithms/mitkImageCast.h b/Core/Code/Algorithms/mitkImageCast.h index 72a47220c1..9ebcc15377 100644 --- a/Core/Code/Algorithms/mitkImageCast.h +++ b/Core/Code/Algorithms/mitkImageCast.h @@ -1,41 +1,41 @@ /*========================================================================= Program: Medical Imaging & Interaction Toolkit Language: C++ Date: $Date$ Version: $Revision$ Copyright (c) German Cancer Research Center, Division of Medical and Biological Informatics. All rights reserved. See MITKCopyright.txt or http://www.mitk.org/copyright.html for details. This software is distributed WITHOUT ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the above copyright notices for more information. =========================================================================*/ #ifndef MITKIMAGECAST_H_HEADER_INCLUDED #define MITKIMAGECAST_H_HEADER_INCLUDED -#include +#include #include #include namespace mitk { #ifndef DOXYGEN_SKIP template < typename TPixel, unsigned int VImageDimension, class ItkOutputImageType > void _CastToItkImage2Access( itk::Image* itkInputImage, itk::SmartPointer& itkOutputImage); #endif //DOXYGEN_SKIP //##Documentation //## @brief Cast an mitk::Image to an itk::Image with a specific type. You don't have to initialize the itk::Image<..>::Pointer. //## @ingroup Adaptor template extern void MITK_CORE_EXPORT CastToItkImage(const mitk::Image * mitkImage, itk::SmartPointer& itkOutputImage); } #endif // of MITKIMAGECAST_H_HEADER_INCLUDED diff --git a/Core/Code/Algorithms/mitkImageChannelSelector.h b/Core/Code/Algorithms/mitkImageChannelSelector.h index 458b0f37a8..1d71ba2a92 100644 --- a/Core/Code/Algorithms/mitkImageChannelSelector.h +++ b/Core/Code/Algorithms/mitkImageChannelSelector.h @@ -1,61 +1,61 @@ /*========================================================================= Program: Medical Imaging & Interaction Toolkit Language: C++ Date: $Date$ Version: $Revision$ Copyright (c) German Cancer Research Center, Division of Medical and Biological Informatics. All rights reserved. See MITKCopyright.txt or http://www.mitk.org/copyright.html for details. This software is distributed WITHOUT ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the above copyright notices for more information. =========================================================================*/ #ifndef IMAGECHANNELSELECTOR_H_HEADER_INCLUDED_C1E4F4E7 #define IMAGECHANNELSELECTOR_H_HEADER_INCLUDED_C1E4F4E7 -#include "mitkCommon.h" +#include #include "mitkSubImageSelector.h" namespace mitk { //##Documentation //## @brief Provides access to a channel of the input image //## //## If the input is generated by a ProcessObject, only the required data is //## requested. //## @ingroup Process class MITK_CORE_EXPORT ImageChannelSelector : public SubImageSelector { public: mitkClassMacro(ImageChannelSelector,SubImageSelector); itkNewMacro(Self); itkGetConstMacro(ChannelNr,int); itkSetMacro(ChannelNr,int); protected: ImageChannelSelector(); virtual ~ImageChannelSelector(); virtual void GenerateOutputInformation(); virtual void GenerateInputRequestedRegion(); virtual void GenerateData(); int m_ChannelNr; }; } // namespace mitk #endif /* IMAGECHANNELSELECTOR_H_HEADER_INCLUDED_C1E4F4E7 */ diff --git a/Core/Code/Algorithms/mitkImageSliceSelector.h b/Core/Code/Algorithms/mitkImageSliceSelector.h index 4d6b1261e6..1bc170211a 100644 --- a/Core/Code/Algorithms/mitkImageSliceSelector.h +++ b/Core/Code/Algorithms/mitkImageSliceSelector.h @@ -1,73 +1,73 @@ /*========================================================================= Program: Medical Imaging & Interaction Toolkit Language: C++ Date: $Date$ Version: $Revision$ Copyright (c) German Cancer Research Center, Division of Medical and Biological Informatics. All rights reserved. See MITKCopyright.txt or http://www.mitk.org/copyright.html for details. This software is distributed WITHOUT ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the above copyright notices for more information. =========================================================================*/ #ifndef IMAGESLICESELECTOR_H_HEADER_INCLUDED_C1E4BE7B #define IMAGESLICESELECTOR_H_HEADER_INCLUDED_C1E4BE7B -#include "mitkCommon.h" +#include #include "mitkSubImageSelector.h" namespace mitk { //##Documentation //## @brief Provides access to a slice of the input image //## //## If the input is generated by a ProcessObject, only the required data is //## requested. //## @ingroup Process class MITK_CORE_EXPORT ImageSliceSelector : public SubImageSelector { public: mitkClassMacro(ImageSliceSelector,SubImageSelector); itkNewMacro(Self); itkGetConstMacro(SliceNr,int); itkSetMacro(SliceNr,int); itkGetConstMacro(TimeNr,int); itkSetMacro(TimeNr,int); itkGetConstMacro(ChannelNr,int); itkSetMacro(ChannelNr,int); protected: virtual void GenerateOutputInformation(); virtual void GenerateInputRequestedRegion(); virtual void GenerateData(); ImageSliceSelector(); virtual ~ImageSliceSelector(); int m_SliceNr; int m_TimeNr; int m_ChannelNr; }; } // namespace mitk #endif /* IMAGESLICESELECTOR_H_HEADER_INCLUDED_C1E4BE7B */ diff --git a/Core/Code/Algorithms/mitkImageSource.h b/Core/Code/Algorithms/mitkImageSource.h index 0fecc9ffab..981eff4a8a 100644 --- a/Core/Code/Algorithms/mitkImageSource.h +++ b/Core/Code/Algorithms/mitkImageSource.h @@ -1,263 +1,263 @@ /*========================================================================= Program: Medical Imaging & Interaction Toolkit Language: C++ Date: $Date$ Version: $Revision$ Copyright (c) German Cancer Research Center, Division of Medical and Biological Informatics. All rights reserved. See MITKCopyright.txt or http://www.mitk.org/copyright.html for details. This software is distributed WITHOUT ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the above copyright notices for more information. =========================================================================*/ #ifndef IMAGESOURCE_H_HEADER_INCLUDED_C1E7D6EC #define IMAGESOURCE_H_HEADER_INCLUDED_C1E7D6EC -#include "mitkCommon.h" +#include #include "mitkBaseProcess.h" #include "mitkImage.h" namespace mitk { //##Documentation //## @brief Superclass of all classes generating Images (instances of class //## Image) as output. //## //## In itk and vtk the generated result of a ProcessObject is only guaranteed //## to be up-to-date, when Update() of the ProcessObject or the generated //## DataObject is called immediately before access of the data stored in the //## DataObject. This is also true for subclasses of mitk::BaseProcess and thus //## for mitk::ImageSource. But there are also three access methods provided //## that guarantee an up-to-date result (by first calling Update and then //## returning the result of GetOutput()): GetData(), GetPic() and //## GetVtkImageData(). //## @ingroup Process class MITK_CORE_EXPORT ImageSource : public BaseProcess { public: mitkClassMacro(ImageSource,BaseProcess); /** @brief Smart Pointer type to a DataObject. */ typedef itk::DataObject::Pointer DataObjectPointer; /** @brief Method for creation through the object factory. */ itkNewMacro(Self); /** @brief Some convenient typedefs. */ typedef mitk::Image OutputImageType; typedef OutputImageType::Pointer OutputImagePointer; typedef SlicedData::RegionType OutputImageRegionType; /** @brief Get the image output of this process object. */ OutputImageType * GetOutput(void); OutputImageType * GetOutput(unsigned int idx); /** @brief Set the image output of this process object. * * This call is slated * to be removed from ITK. You should GraftOutput() and possible * DataObject::DisconnectPipeline() to properly change the output. */ void SetOutput(OutputImageType *output); /** @brief Graft the specified DataObject onto this ProcessObject's output. * * This method grabs a handle to the specified DataObject's bulk * data to used as its output's own bulk data. It also copies the * region ivars (RequestedRegion, BufferedRegion, * LargestPossibleRegion) and meta-data (Spacing, Origin) from the * specified data object into this filter's output data object. Most * importantly, however, it leaves the Source ivar untouched so the * original pipeline routing is intact. This method is used when a * process object is implemented using a mini-pipeline which is * defined in its GenerateData() method. The usage is: * * \code * // setup the mini-pipeline to process the input to this filter * firstFilterInMiniPipeline->SetInput( this->GetInput() ); * // setup the mini-pipeline to calculate the correct regions * // and write to the appropriate bulk data block * lastFilterInMiniPipeline->GraftOutput( this->GetOutput() ); * * // execute the mini-pipeline * lastFilterInMiniPipeline->Update(); * * // graft the mini-pipeline output back onto this filter's output. * // this is needed to get the appropriate regions passed back. * this->GraftOutput( lastFilterInMiniPipeline->GetOutput() ); * \endcode * * For proper pipeline execution, a filter using a mini-pipeline * must implement the GenerateInputRequestedRegion(), * GenerateOutputRequestedRegion(), GenerateOutputInformation() and * EnlargeOutputRequestedRegion() methods as necessary to reflect * how the mini-pipeline will execute (in other words, the outer * filter's pipeline mechanism must be consistent with what the * mini-pipeline will do). * */ virtual void GraftOutput(OutputImageType *output); /** @brief Graft the specified data object onto this ProcessObject's idx'th * output. * * This is the similar to GraftOutput method except is * allows you specify which output is affected. The specified index * must be a valid output number (less than * ProcessObject::GetNumberOfOutputs()). See the GraftOutput for * general usage information. */ virtual void GraftNthOutput(unsigned int idx, OutputImageType *output); /** @brief Make a DataObject of the correct type to used as the specified * output. * * Every ProcessObject subclass must be able to create a * DataObject that can be used as a specified output. This method * is automatically called when DataObject::DisconnectPipeline() is * called. DataObject::DisconnectPipeline, disconnects a data object * from being an output of its current source. When the data object * is disconnected, the ProcessObject needs to construct a replacement * output data object so that the ProcessObject is in a valid state. * So DataObject::DisconnectPipeline eventually calls * ProcessObject::MakeOutput. Note that MakeOutput always returns a * SmartPointer to a DataObject. If a subclass of ImageSource has * multiple outputs of different types, then that class must provide * an implementation of MakeOutput(). */ virtual DataObjectPointer MakeOutput(unsigned int idx); virtual void* GetData(); virtual mitkIpPicDescriptor* GetPic(); virtual vtkImageData* GetVtkImageData(); protected: ImageSource(); virtual ~ImageSource() {} /** @brief A version of GenerateData() specific for image processing * filters. * * This implementation will split the processing across * multiple threads. The buffer is allocated by this method. Then * the BeforeThreadedGenerateData() method is called (if * provided). Then, a series of threads are spawned each calling * ThreadedGenerateData(). After all the threads have completed * processing, the AfterThreadedGenerateData() method is called (if * provided). If an image processing filter cannot be threaded, the * filter should provide an implementation of GenerateData(). That * implementation is responsible for allocating the output buffer. * If a filter an be threaded, it should NOT provide a * GenerateData() method but should provide a ThreadedGenerateData() * instead. * * \sa ThreadedGenerateData() */ virtual void GenerateData(); /** @brief If an imaging filter can be implemented as a multithreaded * algorithm, the filter will provide an implementation of * ThreadedGenerateData(). * * This superclass will automatically split * the output image into a number of pieces, spawn multiple threads, * and call ThreadedGenerateData() in each thread. Prior to spawning * threads, the BeforeThreadedGenerateData() method is called. After * all the threads have completed, the AfterThreadedGenerateData() * method is called. If an image processing filter cannot support * threading, that filter should provide an implementation of the * GenerateData() method instead of providing an implementation of * ThreadedGenerateData(). If a filter provides a GenerateData() * method as its implementation, then the filter is responsible for * allocating the output data. If a filter provides a * ThreadedGenerateData() method as its implementation, then the * output memory will allocated automatically by this superclass. * The ThreadedGenerateData() method should only produce the output * specified by "outputThreadRegion" * parameter. ThreadedGenerateData() cannot write to any other * portion of the output image (as this is responsibility of a * different thread). * * \sa GenerateData(), SplitRequestedRegion() */ virtual void ThreadedGenerateData(const OutputImageRegionType& outputRegionForThread, int threadId ); /** @brief This method is intentionally left blank. * * ImageSource's need not * Initialize their containers. The Image::Allocate() method (called * from GenerateData()) will resize the container if more memory is * needed. Otherwise, the memory can be reused. */ virtual void PrepareOutputs(); /** @brief The GenerateData method normally allocates the buffers for all of the * outputs of a filter. * * Some filters may want to override this default * behavior. For example, a filter may have multiple outputs with * varying resolution. Or a filter may want to process data in place by * grafting its input to its output.*/ virtual void AllocateOutputs(); /** @brief If an imaging filter needs to perform processing after the buffer * has been allocated but before threads are spawned, the filter can * can provide an implementation for BeforeThreadedGenerateData(). * * The execution flow in the default GenerateData() method will be: * 1) Allocate the output buffer * 2) Call BeforeThreadedGenerateData() * 3) Spawn threads, calling ThreadedGenerateData() in each thread. * 4) Call AfterThreadedGenerateData() * Note that this flow of control is only available if a filter provides * a ThreadedGenerateData() method and NOT a GenerateData() method. */ virtual void BeforeThreadedGenerateData() {}; /** @brief If an imaging filter needs to perform processing after all * processing threads have completed, the filter can can provide an * implementation for AfterThreadedGenerateData(). * * The execution * flow in the default GenerateData() method will be: * 1) Allocate the output buffer * 2) Call BeforeThreadedGenerateData() * 3) Spawn threads, calling ThreadedGenerateData() in each thread. * 4) Call AfterThreadedGenerateData() * Note that this flow of control is only available if a filter provides * a ThreadedGenerateData() method and NOT a GenerateData() method. */ virtual void AfterThreadedGenerateData() {}; /** @brief Split the output's RequestedRegion into "num" pieces, returning * region "i" as "splitRegion". * * This method is called "num" times. The * regions must not overlap. The method returns the number of pieces that * the routine is capable of splitting the output RequestedRegion, * i.e. return value is less than or equal to "num". */ virtual int SplitRequestedRegion(int i, int num, OutputImageRegionType& splitRegion); /** @brief Static function used as a "callback" by the MultiThreader. * * The threading library will call this routine for each thread, which will delegate the * control to ThreadedGenerateData(). */ static ITK_THREAD_RETURN_TYPE ThreaderCallback( void *arg ); /** @brief Internal structure used for passing image data into the threading library */ struct ThreadStruct { Pointer Filter; }; private: void operator=(const Self&); //purposely not implemented }; } // namespace mitk #endif /* IMAGESOURCE_H_HEADER_INCLUDED_C1E7D6EC */ diff --git a/Core/Code/Algorithms/mitkImageTimeSelector.h b/Core/Code/Algorithms/mitkImageTimeSelector.h index dee67b53a2..5f3e5ff489 100644 --- a/Core/Code/Algorithms/mitkImageTimeSelector.h +++ b/Core/Code/Algorithms/mitkImageTimeSelector.h @@ -1,66 +1,66 @@ /*========================================================================= Program: Medical Imaging & Interaction Toolkit Language: C++ Date: $Date$ Version: $Revision$ Copyright (c) German Cancer Research Center, Division of Medical and Biological Informatics. All rights reserved. See MITKCopyright.txt or http://www.mitk.org/copyright.html for details. This software is distributed WITHOUT ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the above copyright notices for more information. =========================================================================*/ #ifndef IMAGETIMESELECTOR_H_HEADER_INCLUDED_C1E4861D #define IMAGETIMESELECTOR_H_HEADER_INCLUDED_C1E4861D -#include "mitkCommon.h" +#include #include "mitkSubImageSelector.h" namespace mitk { //##Documentation //## @brief Provides access to a volume at a specific time of the input image //## //## If the input is generated by a ProcessObject, only the required data is //## requested. //## @ingroup Process class MITK_CORE_EXPORT ImageTimeSelector : public SubImageSelector { public: mitkClassMacro(ImageTimeSelector,SubImageSelector); itkNewMacro(Self); itkGetConstMacro(TimeNr,int); itkSetMacro(TimeNr,int); itkGetConstMacro(ChannelNr,int); itkSetMacro(ChannelNr,int); protected: ImageTimeSelector(); virtual ~ImageTimeSelector(); virtual void GenerateOutputInformation(); virtual void GenerateInputRequestedRegion(); virtual void GenerateData(); int m_TimeNr; int m_ChannelNr; }; } // namespace mitk #endif /* IMAGETIMESELECTOR_H_HEADER_INCLUDED_C1E4861D */ diff --git a/Core/Code/Algorithms/mitkImageToImageFilter.h b/Core/Code/Algorithms/mitkImageToImageFilter.h index a5650394cc..cc233a466b 100644 --- a/Core/Code/Algorithms/mitkImageToImageFilter.h +++ b/Core/Code/Algorithms/mitkImageToImageFilter.h @@ -1,85 +1,85 @@ /*========================================================================= Program: Medical Imaging & Interaction Toolkit Language: C++ Date: $Date$ Version: $Revision$ Copyright (c) German Cancer Research Center, Division of Medical and Biological Informatics. All rights reserved. See MITKCopyright.txt or http://www.mitk.org/copyright.html for details. This software is distributed WITHOUT ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the above copyright notices for more information. =========================================================================*/ #ifndef IMAGETOIMAGEFILTER_H_HEADER_INCLUDED_C1E5E869 #define IMAGETOIMAGEFILTER_H_HEADER_INCLUDED_C1E5E869 -#include "mitkCommon.h" +#include #include "mitkImageSource.h" namespace mitk { //##Documentation //## @brief Superclass of all classes having one or more Images as input and //## generating Images as output //## @ingroup Process class MITK_CORE_EXPORT ImageToImageFilter : public ImageSource { public: mitkClassMacro(ImageToImageFilter,ImageSource); /** Method for creation through the object factory. */ itkNewMacro(Self); /** Superclass typedefs. */ typedef Superclass::OutputImageRegionType OutputImageRegionType; /** Some convenient typedefs. */ typedef mitk::Image InputImageType; typedef InputImageType::Pointer InputImagePointer; typedef InputImageType::ConstPointer InputImageConstPointer; typedef SlicedData::RegionType InputImageRegionType; /** Set/Get the image input of this process object. */ virtual void SetInput( const InputImageType *image); virtual void SetInput( unsigned int, const InputImageType * image); const InputImageType * GetInput(void); const InputImageType * GetInput(unsigned int idx); protected: ImageToImageFilter(); virtual ~ImageToImageFilter(); virtual void PrintSelf(std::ostream& os, itk::Indent indent) const; /** What is the input requested region that is required to produce the * output requested region? The base assumption for image processing * filters is that the input requested region can be set to match the * output requested region. If a filter requires more input (for instance * a filter that uses neighborhoods needs more input than output to avoid * introducing artificial boundary conditions) or less input (for instance * a magnify filter) will have to override this method. In doing so, it * should call its superclass' implementation as its first step. Note that * this imaging filters operate differently than the classes to this * point in the class hierachy. Up till now, the base assumption has been * that the largest possible region will be requested of the input. * * \sa ProcessObject::GenerateInputRequestedRegion(), * ImageSource::GenerateInputRequestedRegion() */ virtual void GenerateInputRequestedRegion(); private: void operator=(const Self&); //purposely not implemented }; } // namespace mitk #endif /* IMAGETOIMAGEFILTER_H_HEADER_INCLUDED_C1E5E869 */ diff --git a/Core/Code/Algorithms/mitkPointSetToPointSetFilter.h b/Core/Code/Algorithms/mitkPointSetToPointSetFilter.h index 0565db3d4d..489ef0e879 100644 --- a/Core/Code/Algorithms/mitkPointSetToPointSetFilter.h +++ b/Core/Code/Algorithms/mitkPointSetToPointSetFilter.h @@ -1,93 +1,93 @@ /*========================================================================= Program: Medical Imaging & Interaction Toolkit Module: $RCSfile$ Language: C++ Date: $Date$ Version: $Revision$ Copyright (c) German Cancer Research Center, Division of Medical and Biological Informatics. All rights reserved. See MITKCopyright.txt or http://www.mitk.org/copyright.html for details. This software is distributed WITHOUT ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the above copyright notices for more information. =========================================================================*/ #ifndef _mitkpointsettopointsetfilter_h #define _mitkpointsettopointsetfilter_h -#include "mitkCommon.h" +#include #include "mitkPointSetSource.h" namespace mitk { /** * @brief Superclass of all classes/algorithms having one or more PointSets * as input and output * @ingroup Process */ class MITK_CORE_EXPORT PointSetToPointSetFilter : public PointSetSource { public: mitkClassMacro( PointSetToPointSetFilter, PointSetSource ); itkNewMacro( Self ); typedef mitk::PointSet InputType; typedef mitk::PointSet OutputType; typedef InputType::Pointer InputTypePointer; typedef InputType::ConstPointer InputTypeConstPointer; /** * Sets the input of this process object * @param input the input */ virtual void SetInput( const InputType* input ); /** * Sets the input n'th of this process object * @param idx the number associated with the given input */ virtual void SetInput( const unsigned int& idx, const InputType* input ); /** * @returns the input tree of the process object */ const InputType * GetInput( void ); /** * @param idx the index of the input to return * @returns the input object with the given index */ const InputType * GetInput( const unsigned int& idx ); protected: /** * A default constructor */ PointSetToPointSetFilter(); /** * The destructor */ virtual ~PointSetToPointSetFilter(); private: void operator=( const Self& ); //purposely not implemented } ; } //end of namespace mitk #endif diff --git a/Core/Code/Algorithms/mitkRGBToRGBACastImageFilter.h b/Core/Code/Algorithms/mitkRGBToRGBACastImageFilter.h index b999b959f4..4270d6cb2e 100644 --- a/Core/Code/Algorithms/mitkRGBToRGBACastImageFilter.h +++ b/Core/Code/Algorithms/mitkRGBToRGBACastImageFilter.h @@ -1,86 +1,86 @@ /*========================================================================= Program: Medical Imaging & Interaction Toolkit Language: C++ Date: $Date: 2009-05-13 18:06:46 +0200 (Mi, 13 Mai 2009) $ Version: $Revision: 17258 $ Copyright (c) German Cancer Research Center, Division of Medical and Biological Informatics. All rights reserved. See MITKCopyright.txt or http://www.mitk.org/copyright.html for details. This software is distributed WITHOUT ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the above copyright notices for more information. =========================================================================*/ #ifndef MITKRGBTORGBACASTIMAGEFILTER_H_HEADER_INCLUDED #define MITKRGBTORGBACASTIMAGEFILTER_H_HEADER_INCLUDED -#include "mitkCommon.h" +#include #include "mitkImageToImageFilter.h" #include "mitkImageTimeSelector.h" namespace itk { template class ITK_EXPORT Image; } namespace mitk { //##Documentation //## @brief //## @ingroup Process class MITK_CORE_EXPORT RGBToRGBACastImageFilter : public ImageToImageFilter { public: mitkClassMacro(RGBToRGBACastImageFilter, ImageToImageFilter); itkNewMacro(Self); /** Static convenience method to check if the passed mitk::Image is * an RGB image in the sense of this converter filter. * * Returns falsefor RGBA and all other images. */ static bool IsRGBImage( const mitk::Image *image ); protected: // Typedefs for supported RGB pixel types typedef itk::RGBPixel< unsigned char > UCRGBPixelType; typedef itk::RGBPixel< unsigned short > USRGBPixelType; typedef itk::RGBPixel< float > FloatRGBPixelType; typedef itk::RGBPixel< double > DoubleRGBPixelType; RGBToRGBACastImageFilter(); ~RGBToRGBACastImageFilter(); virtual void GenerateInputRequestedRegion(); virtual void GenerateOutputInformation(); virtual void GenerateData(); template < typename TPixel, unsigned int VImageDimension > void InternalCast( itk::Image< TPixel, VImageDimension > *itkImage, mitk::RGBToRGBACastImageFilter *addComponentFilter, typename TPixel::ComponentType defaultAlpha ); mitk::ImageTimeSelector::Pointer m_InputTimeSelector; mitk::ImageTimeSelector::Pointer m_OutputTimeSelector; //##Description //## @brief Time when Header was last initialized itk::TimeStamp m_TimeOfHeaderInitialization; }; } // namespace mitk #endif /* MITKRGBTORGBACASTIMAGEFILTER_H_HEADER_INCLUDED */ diff --git a/Core/Code/Algorithms/mitkSubImageSelector.h b/Core/Code/Algorithms/mitkSubImageSelector.h index 49e41ff45f..c37deed11b 100644 --- a/Core/Code/Algorithms/mitkSubImageSelector.h +++ b/Core/Code/Algorithms/mitkSubImageSelector.h @@ -1,63 +1,63 @@ /*========================================================================= Program: Medical Imaging & Interaction Toolkit Language: C++ Date: $Date$ Version: $Revision$ Copyright (c) German Cancer Research Center, Division of Medical and Biological Informatics. All rights reserved. See MITKCopyright.txt or http://www.mitk.org/copyright.html for details. This software is distributed WITHOUT ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the above copyright notices for more information. =========================================================================*/ #ifndef SUBIMAGESELECTOR_H_HEADER_INCLUDED_C1E4F463 #define SUBIMAGESELECTOR_H_HEADER_INCLUDED_C1E4F463 -#include "mitkCommon.h" +#include #include "mitkImageToImageFilter.h" #include "mitkImageDataItem.h" #include "mitkBaseData.h" namespace mitk { //##Documentation //## @brief Base class of all classes providing access to parts of an image //## //## Base class of all classes providing access to parts of an image, e.g., to //## a slice (mitk::ImageSilceSelector) or a volume at a specific time //## (mitk::ImageTimeSelector). If the input is generated by a ProcessObject, //## only the required data is requested. //## @ingroup Process class MITK_CORE_EXPORT SubImageSelector : public ImageToImageFilter { public: /** Run-time type information (and related methods). */ mitkClassMacro(SubImageSelector,ImageToImageFilter); itkNewMacro(Self); virtual void SetPosNr(int p); SubImageSelector(); virtual ~SubImageSelector(); protected: mitk::Image::ImageDataItemPointer GetSliceData(int s = 0, int t = 0, int n = 0); mitk::Image::ImageDataItemPointer GetVolumeData(int t = 0, int n = 0); mitk::Image::ImageDataItemPointer GetChannelData(int n = 0); void SetSliceItem(mitk::Image::ImageDataItemPointer dataItem, int s = 0, int t = 0, int n = 0); void SetVolumeItem(mitk::Image::ImageDataItemPointer dataItem, int t = 0, int n = 0); void SetChannelItem(mitk::Image::ImageDataItemPointer dataItem, int n = 0); }; } // namespace mitk #endif /* SUBIMAGESELECTOR_H_HEADER_INCLUDED_C1E4F463 */ diff --git a/Core/Code/Algorithms/mitkUIDGenerator.h b/Core/Code/Algorithms/mitkUIDGenerator.h index 0ec7784675..0549a17a4b 100644 --- a/Core/Code/Algorithms/mitkUIDGenerator.h +++ b/Core/Code/Algorithms/mitkUIDGenerator.h @@ -1,50 +1,50 @@ /*========================================================================= Program: Medical Imaging & Interaction Toolkit Language: C++ Date: $Date$ Version: $Revision$ Copyright (c) German Cancer Research Center, Division of Medical and Biological Informatics. All rights reserved. See MITKCopyright.txt or http://www.mitk.org/copyright.html for details. This software is distributed WITHOUT ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the above copyright notices for more information. =========================================================================*/ #ifndef MITK_UID_GENERATOR_INDCLUDED_FASAWE #define MITK_UID_GENERATOR_INDCLUDED_FASAWE #include -#include "mitkCommon.h" +#include namespace mitk { /*! \brief Generated unique IDs Creates (somehow most of the time) unique IDs from a given prefix, the current date/time and a random part. The prefix is given to the constructor, together with the desired length of the random part (minimum 5 digits). You will get another quite unique ID each time you call GetUID. */ class MITK_CORE_EXPORT UIDGenerator { public: UIDGenerator(const char* prefix = "UID_", unsigned int lengthOfRandomPart = 8); std::string GetUID(); private: std::string m_Prefix; unsigned int m_LengthOfRandomPart; }; } #endif diff --git a/Core/Code/Algorithms/mitkVolumeCalculator.h b/Core/Code/Algorithms/mitkVolumeCalculator.h index 7032ad06d3..d525b16f64 100644 --- a/Core/Code/Algorithms/mitkVolumeCalculator.h +++ b/Core/Code/Algorithms/mitkVolumeCalculator.h @@ -1,74 +1,74 @@ /*========================================================================= Program: Medical Imaging & Interaction Toolkit Language: C++ Date: $Date$ Version: $Revision$ Copyright (c) German Cancer Research Center, Division of Medical and Biological Informatics. All rights reserved. See MITKCopyright.txt or http://www.mitk.org/copyright.html for details. This software is distributed WITHOUT ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the above copyright notices for more information. =========================================================================*/ #ifndef VOLUME_CALCULATOR_H_HEADER_INCLUDED #define VOLUME_CALCULATOR_H_HEADER_INCLUDED #include "itkObject.h" #include "itkObjectFactory.h" #include "itkImage.h" -#include "mitkCommon.h" +#include #include "mitkImage.h" #include "mitkImageTimeSelector.h" namespace mitk { /** * @brief Calculates the volume of a mitk::Image. * The given volume is in milliliters or as a voxel count. * Voxels are counted if their gray value is above a threshold (see SetThreshold), the default threshold is 0. * * The filter works for 2D, 3D and 3D+t. In the 3D+t case a vector of volumes is provided (see GetVolumes()). */ class MITK_CORE_EXPORT VolumeCalculator : public itk::Object { public: mitkClassMacro(VolumeCalculator,itk::Object); itkNewMacro(Self); itkSetObjectMacro(Image,Image); itkSetMacro(Threshold,int); itkGetMacro(Volume,float); itkGetMacro(VoxelCount,unsigned long int); std::vector GetVolumes(); void ComputeVolume(); void ComputeVolumeFromImageStatistics(); static float ComputeVolume(Vector3D spacing, unsigned int voxelCount); protected: VolumeCalculator(); virtual ~VolumeCalculator(); template < typename TPixel, unsigned int VImageDimension > void InternalCompute(itk::Image< TPixel, VImageDimension >* itkImage); Image::ConstPointer m_Image; int m_Threshold; float m_Volume; unsigned long int m_VoxelCount; std::vector m_Volumes; ImageTimeSelector::Pointer m_TimeSelector; }; } // namespace mitk #endif /* VOLUME_CALCULATOR_H_HEADER_INCLUDED */ diff --git a/Core/Code/CMakeLists.txt b/Core/Code/CMakeLists.txt index 13b2764f14..2600d7a628 100644 --- a/Core/Code/CMakeLists.txt +++ b/Core/Code/CMakeLists.txt @@ -1,52 +1,53 @@ FIND_PACKAGE(OpenGL) IF(NOT OPENGL_FOUND) MESSAGE("GL is required for MITK rendering") ENDIF(NOT OPENGL_FOUND ) SET(TOOL_CPPS "") MITK_CREATE_MODULE( Mitk INCLUDE_DIRS Algorithms DataManagement Controllers Interactions IO Rendering ${MITK_BINARY_DIR} INTERNAL_INCLUDE_DIRS ${OPENGL_INCLUDE_DIR} ${IPSEGMENTATION_INCLUDE_DIR} ${ANN_INCLUDE_DIR} PROVIDES mitkCore DEPENDS mitkIpFunc mbilog tinyxml DEPENDS_INTERNAL IIL4MITK pic2vtk PACKAGE_DEPENDS ITK VTK + EXPORT_DEFINE MITK_CORE_EXPORT ) # this is needed for libraries which link to mitkCore and need # symbols from explicitly instantiated templates like # mitk::SurfaceVtkWriter which is referenced in # QmitkCommonFunctionality in the QmitkExt library. IF(MINGW) GET_TARGET_PROPERTY(_mitkCore_MINGW_linkflags mitkCore LINK_FLAGS) IF(NOT _mitkCore_MINGW_linkflags) SET(_mitkCore_MINGW_linkflags "") ENDIF(NOT _mitkCore_MINGW_linkflags) SET_TARGET_PROPERTIES(mitkCore PROPERTIES LINK_FLAGS "${_mitkCore_MINGW_linkflags} -Wl,--export-all-symbols") ENDIF(MINGW) TARGET_LINK_LIBRARIES(mitkCore ${LIBRARIES_FOR_${KITNAME}_CORE} ${IPFUNC_LIBRARY} ipSegmentation ann) TARGET_LINK_LIBRARIES(mitkCore ${OPENGL_LIBRARIES} ) IF(MSVC_IDE OR MSVC_VERSION OR MINGW) TARGET_LINK_LIBRARIES(mitkCore psapi.lib) ENDIF(MSVC_IDE OR MSVC_VERSION OR MINGW) # verify ITK has been built with GDCM >= 2.0.14 set(GDCM_FULL_VERSION "${GDCM_MAJOR_VERSION}.${GDCM_MINOR_VERSION}.${GDCM_BUILD_VERSION}") set(MITK_REQUIRED_GDCM_VERSION "2.0.14") if(GDCM_FULL_VERSION VERSION_LESS MITK_REQUIRED_GDCM_VERSION) message(SEND_ERROR "mitkCore: MITK requires ITK with at least GDCM version ${MITK_REQUIRED_GDCM_VERSION}.\nFound version ${GDCM_FULL_VERSION} (GDCM NOT found if you don't see a version here)") else(GDCM_FULL_VERSION VERSION_LESS MITK_REQUIRED_GDCM_VERSION) message(STATUS "mitkCore: Found GDCM version ${GDCM_FULL_VERSION}") endif(GDCM_FULL_VERSION VERSION_LESS MITK_REQUIRED_GDCM_VERSION) # build tests? OPTION(BUILD_TESTING "Build the MITK Core tests." ON) IF(BUILD_TESTING) ENABLE_TESTING() ADD_SUBDIRECTORY(Testing) ENDIF(BUILD_TESTING) diff --git a/Core/Code/Controllers/mitkBaseController.h b/Core/Code/Controllers/mitkBaseController.h index 3e50c4882a..89c43502d5 100644 --- a/Core/Code/Controllers/mitkBaseController.h +++ b/Core/Code/Controllers/mitkBaseController.h @@ -1,81 +1,81 @@ /*========================================================================= Program: Medical Imaging & Interaction Toolkit Language: C++ Date: $Date$ Version: $Revision$ Copyright (c) German Cancer Research Center, Division of Medical and Biological Informatics. All rights reserved. See MITKCopyright.txt or http://www.mitk.org/copyright.html for details. This software is distributed WITHOUT ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the above copyright notices for more information. =========================================================================*/ #ifndef BASECONTROLLER_H_HEADER_INCLUDED_C1E745A3 #define BASECONTROLLER_H_HEADER_INCLUDED_C1E745A3 -#include "mitkCommon.h" +#include #include "mitkStepper.h" #include "mitkStateMachine.h" #include namespace mitk { class BaseRenderer; //##Documentation //## @brief Baseclass for renderer slice-/camera-control //## //## Tells the render (subclass of BaseRenderer) which slice (subclass //## SliceNavigationController) or from which direction (subclass //## CameraController) it has to render. Contains two Stepper for stepping //## through the slices or through different camera views (e.g., for the //## creation of a movie around the data), respectively, and through time, if //## there is 3D+t data. //## @note not yet implemented //## @ingroup NavigationControl class MITK_CORE_EXPORT BaseController : public StateMachine { public: /** Standard class typedefs. */ mitkClassMacro(BaseController, StateMachine); itkNewMacro(Self); /** Method for creation through ::New */ mitkNewMacro1Param(Self, const char *); //##Documentation //## @brief Get the Stepper through the slices mitk::Stepper* GetSlice(); //##Documentation //## @brief Get the Stepper through the time mitk::Stepper* GetTime(); protected: /** * @brief Default Constructor **/ BaseController(const char * type = NULL); /** * @brief Default Destructor **/ virtual ~BaseController(); //## @brief Stepper through the time Stepper::Pointer m_Time; //## @brief Stepper through the slices Stepper::Pointer m_Slice; unsigned long m_LastUpdateTime; }; } // namespace mitk #endif /* BASECONTROLLER_H_HEADER_INCLUDED_C1E745A3 */ diff --git a/Core/Code/Controllers/mitkCallbackFromGUIThread.h b/Core/Code/Controllers/mitkCallbackFromGUIThread.h index f3a484a2e3..faa332cd19 100644 --- a/Core/Code/Controllers/mitkCallbackFromGUIThread.h +++ b/Core/Code/Controllers/mitkCallbackFromGUIThread.h @@ -1,205 +1,205 @@ /*========================================================================= Program: Medical Imaging & Interaction Toolkit Language: C++ Date: $Date$ Version: $Revision$ Copyright (c) German Cancer Research Center, Division of Medical and Biological Informatics. All rights reserved. See MITKCopyright.txt or http://www.mitk.org/copyright.html for details. This software is distributed WITHOUT ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the above copyright notices for more information. =========================================================================*/ #ifndef MITK_CALLBACK_WITHIN_GUI_TREAD_H_INCLUDGEWQ #define MITK_CALLBACK_WITHIN_GUI_TREAD_H_INCLUDGEWQ #include #include -#include "mitkCommon.h" +#include namespace mitk { /*! \brief Used by CallbackFromGUIThread to pass parameters. */ template class CallbackEventOneParameter : public itk::AnyEvent { public: typedef CallbackEventOneParameter Self; typedef itk::AnyEvent Superclass; CallbackEventOneParameter(const T t ) : m_Data(t) {} virtual ~CallbackEventOneParameter() {} virtual const char * GetEventName() const { return "CallbackEventOneParameter"; } virtual bool CheckEvent(const ::itk::EventObject* e) const { return dynamic_cast(e); } virtual ::itk::EventObject* MakeObject() const { return new Self( m_Data ); } const T GetData() const { return m_Data; } CallbackEventOneParameter(const Self& s) : itk::AnyEvent(s), m_Data(s.m_Data) {}; protected: const T m_Data; private: void operator=(const Self&); }; /*! \brief Toolkit specific implementation of mitk::CallbackFromGUIThread For any toolkit, this class has to be sub-classed. One instance of that sub-class has to be registered with mitk::CallbackFromGUIThread. See the (very simple) implmentation of QmitkCallbackFromGUIThread for an example. */ class MITK_CORE_EXPORT CallbackFromGUIThreadImplementation { public: /// Change the current application cursor virtual void CallThisFromGUIThread(itk::Command*, itk::EventObject*) = 0; virtual ~CallbackFromGUIThreadImplementation() {}; protected: private: }; /*! \brief Allows threads to call some method from within the GUI thread. This class is useful for use with GUI toolkits that are not thread-safe, e.g. Qt. Any thread that needs to work with the GUI at some time during its execution (e.g. at the end, to display some results) can use this class to ask for a call to a member function from the GUI thread. Usage example We assume that you have a class ThreadedClass, that basically lives in a thread that is different from the GUI thread. Now this class has to change some element of the GUI to indicate its status. This could be dangerous (with Qt it is for sure). The solution is, that ThreadedClass asks mitk::CallbackFromGUIThread to call a method from the GUI thread (main thread). Here is part of the header of ThreadedClass: \code class ThreadedClass : public ParentClass { public: ... // All you need // This function runs in its own thread ! void ThreadedFunction(); // This should be called from the GUI thread void ChangeGUIElementsToIndicateProgress(const itk::EventObject&); ... }; \endcode \code #include "mitkCallbackFromGUIThread.h" #include // This method runs in a thread of its own! So it can't manipulate GUI elements directly without causing trouble void ThreadedClass::ThreadedFunction() { ... // Create a command object (passing parameters comes later) itk::ReceptorMemberCommand::Pointer command = itk::ReceptorMemberCommand::New(); command->SetCallbackFunction(this, &ThreadedClass::ChangeGUIElementsToIndicateProgress); // Ask to execute that command from the GUI thread mitk::CallbackFromGUIThread::GetInstance()->CallThisFromGUIThread(command); ... } // Do dangerous GUI changing stuff here void ThreadedClass::ChangeGUIElementsToIndicateProgress(const itk::EventObject& e) { Application::GetButtonGrid()->AddButton("Stop"); // this is pseudo code } \endcode This obviously won't allow you to pass parameters to ChangeGUIElementsToIndicateProgress. If you need to do that, you have to create a kind of itk::EventObject that can be asked for a parameter (this solution is not nice, if you see a better solution, please mail to mitk-users@lists.sourceforge.net). The itk::EventObject has to be created with "new" (which can also be done by calling MakeObject on an existing EventObject). \code const mitk::OneParameterEvent* event = new mitk::OneParameterEvent(1); // this class is not yet defined but will be itk::ReceptorMemberCommand::Pointer command = itk::ReceptorMemberCommand::New(); command->SetCallbackFunction(this, &ThreadedClass::ChangeGUIElementsToIndicateProgress); mitk::CallbackFromGUIThread::GetInstance()->CallThisFromGUIThread(command, event); // DO NOT delete event now. This will be done by CallThisFromGUIThread after the command will executed. \endcode \todo Create a set of "normal" parameter-event-objects that people might want to use. */ class MITK_CORE_EXPORT CallbackFromGUIThread { public: /// This class is a singleton. static CallbackFromGUIThread* GetInstance(); /// To be called by a toolkit specific CallbackFromGUIThreadImplementation. static void RegisterImplementation(CallbackFromGUIThreadImplementation* implementation); /// Change the current application cursor void CallThisFromGUIThread(itk::Command*, itk::EventObject* e = NULL); protected: /// Purposely hidden - singleton CallbackFromGUIThread(); private: static CallbackFromGUIThreadImplementation* m_Implementation; static CallbackFromGUIThread* m_Instance; }; } // namespace #endif diff --git a/Core/Code/Controllers/mitkCameraController.h b/Core/Code/Controllers/mitkCameraController.h index e93697d569..d2c2227589 100644 --- a/Core/Code/Controllers/mitkCameraController.h +++ b/Core/Code/Controllers/mitkCameraController.h @@ -1,93 +1,93 @@ /*========================================================================= Program: Medical Imaging & Interaction Toolkit Language: C++ Date: $Date$ Version: $Revision$ Copyright (c) German Cancer Research Center, Division of Medical and Biological Informatics. All rights reserved. See MITKCopyright.txt or http://www.mitk.org/copyright.html for details. This software is distributed WITHOUT ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the above copyright notices for more information. =========================================================================*/ #ifndef CAMERACONTROLLER_H_HEADER_INCLUDED_C1C53722 #define CAMERACONTROLLER_H_HEADER_INCLUDED_C1C53722 -#include "mitkCommon.h" +#include #include "mitkBaseController.h" #include "mitkDisplayPositionEvent.h" #include "mitkKeyEvent.h" namespace mitk { //##Documentation //## @brief controls the camera used by the associated BaseRenderer //## //## Subclass of BaseController. Controls the camera used by the associated //## BaseRenderer. //## @ingroup NavigationControl class MITK_CORE_EXPORT CameraController : public BaseController { public: enum StandardView { ANTERIOR,POSTERIOR,SINISTER,DEXTER,CRANIAL,CAUDAL }; mitkClassMacro(CameraController, BaseController); mitkNewMacro1Param(Self, const char*); itkSetMacro(Renderer,BaseRenderer*); itkSetMacro(ZoomFactor,double); itkGetConstMacro(Renderer,const BaseRenderer*); itkGetConstMacro(ZoomFactor,double); //##Documentation //## @brief Implemented in sub-classes. virtual void Resize(int w, int h); //##Documentation //## @brief Implemented in sub-classes. virtual void MousePressEvent(mitk::MouseEvent*); //##Documentation //## @brief Implemented in sub-classes. virtual void MouseReleaseEvent(mitk::MouseEvent*); //##Documentation //## @brief Implemented in sub-classes. virtual void MouseMoveEvent(mitk::MouseEvent*); //##Documentation //## @brief Implemented in sub-classes. virtual void KeyPressEvent(mitk::KeyEvent*); virtual void SetViewToAnterior(); virtual void SetViewToPosterior(); virtual void SetViewToSinister(); virtual void SetViewToDexter(); virtual void SetViewToCranial(); virtual void SetViewToCaudal(); virtual void SetStandardView(StandardView view); protected: /** * @brief Default Constructor **/ CameraController(const char * type = NULL); /** * @brief Default Destructor **/ virtual ~CameraController(); const BaseRenderer* m_Renderer; double m_ZoomFactor; ///< zoom factor used for the standard view camera }; } // namespace mitk #endif /* CAMERACONTROLLER_H_HEADER_INCLUDED_C1C53722 */ diff --git a/Core/Code/Controllers/mitkCameraRotationController.h b/Core/Code/Controllers/mitkCameraRotationController.h index 003748f099..637d7ff600 100644 --- a/Core/Code/Controllers/mitkCameraRotationController.h +++ b/Core/Code/Controllers/mitkCameraRotationController.h @@ -1,59 +1,59 @@ /*========================================================================= Program: Medical Imaging & Interaction Toolkit Language: C++ Date: $Date$ Version: $Revision$ Copyright (c) German Cancer Research Center, Division of Medical and Biological Informatics. All rights reserved. See MITKCopyright.txt or http://www.mitk.org/copyright.html for details. This software is distributed WITHOUT ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the above copyright notices for more information. =========================================================================*/ #ifndef CAMERAROTATIONCONTROLLER_H_HEADER_INCLUDED_NXYCBIU #define CAMERAROTATIONCONTROLLER_H_HEADER_INCLUDED_NXYCBIU -#include "mitkCommon.h" +#include #include "mitkBaseController.h" class vtkCamera; class vtkRenderWindow; namespace mitk { class MITK_CORE_EXPORT CameraRotationController : public BaseController { public: mitkClassMacro(CameraRotationController,BaseController); itkNewMacro(Self); mitkNewMacro1Param(Self, const char *); void RotateCamera(); void AcquireCamera(); void SetRenderWindow(vtkRenderWindow * renWin) { m_RenderWindow = renWin; } virtual bool ExecuteAction( Action* action, mitk::StateEvent const* stateEvent ); protected: CameraRotationController(const char * type = NULL); virtual ~CameraRotationController(); private: int m_LastStepperValue; vtkCamera* m_Camera; vtkRenderWindow* m_RenderWindow; }; } #endif diff --git a/Core/Code/Controllers/mitkFocusManager.h b/Core/Code/Controllers/mitkFocusManager.h index 221e6b4add..6f8fd71f89 100755 --- a/Core/Code/Controllers/mitkFocusManager.h +++ b/Core/Code/Controllers/mitkFocusManager.h @@ -1,144 +1,144 @@ /*========================================================================= Program: Medical Imaging & Interaction Toolkit Language: C++ Date: $Date$ Version: $Revision$ Copyright (c) German Cancer Research Center, Division of Medical and Biological Informatics. All rights reserved. See MITKCopyright.txt or http://www.mitk.org/copyright.html for details. This software is distributed WITHOUT ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the above copyright notices for more information. =========================================================================*/ #ifndef MITKFOCUSMANAGER_H_HEADER_INCLUDED_C135A197 #define MITKFOCUSMANAGER_H_HEADER_INCLUDED_C135A197 -#include "mitkCommon.h" +#include #include "mitkBaseRenderer.h" #include #include namespace mitk { //##Documentation //## @brief manages a list of BaseRenderer. //## //## A focuspointer can be set and read. //## GoToNext can be used to switch through the list. //## if the switch m_Loop is set to true, GetNext loops through the list; after //## the last it goes to the first. //## if it is not set, it returnes NULL if it steps behind the last Widget. //## @ingroup Interaction class MITK_CORE_EXPORT FocusManager : public itk::Object { public: mitkClassMacro(FocusManager, itk::Object); itkNewMacro(Self); //##Documentation //##@brief Element, that can be focused and held here. //## //## has to be an itk-Objekct in order to use itk-Smartpointer! typedef mitk::BaseRenderer FocusElement; typedef itk::WeakPointer FocusElementWeakPointer; typedef std::vector FocusElementList; typedef std::vector::iterator FocusListIterator; //##Documentation //## Destructor ~FocusManager(); //##Documentation //## Adds the widget into the set of managed Widgets after the focused //## widget and sets the focus to the added one if the list was empty before bool AddElement(FocusElement* element); //##Documentation //## removes the given widget from the list. //## true if found and removed, else false //## afterwards the focused widget is the one behind the deleted //## or if the deleted was the last, then the one before the deleted //## that way you can delete sequentialy from the back on or from front to back bool RemoveElement(FocusElement* element); //##Documentation //## returns the focused Widget FocusElement* GetFocused() const; //##Documentation //## searches the given Widget in List; //## if found, sets the focus to this widget and returns true bool SetFocused(FocusElement* element); //##Documentation //## returns, if this focused widget points behind the end of the List bool IsLast(); //##Documentation //## returns true, if the focused widget is the first in the list bool IsFirst(); //##Documentation //## returns the first widget in list const FocusElement* GetFirst() const; //##Documentation //## returns the last widget in list const FocusElement* GetLast() const; //##Documentation //## sets the focus to the next in list //## loops the list, if switch loop is true //## returns true if successful, else false bool GoToNext(); //##Documentation //## returns an iterator, that points to the //## beginning of the list //## no changes are made to the current focused element FocusListIterator GetIter(); //##Documentation //## Sets the LoopMode. //## if set to true-> the one after the last is the first void SetLoop(bool loop); friend class GlobalInteraction; protected: //##Documentation //## Constructor FocusManager(); private: //##Documentation //## stores the Widgets FocusElementList m_FocusList; //##Documentation //## holds the focused Widget itk::WeakPointer m_FocElement; //##Documentation //## switch which sets the LoopMode. //## if true, then the next after the last one is the first bool m_Loop; }; //##Documentation //## @brief connect to this Event to get noticed when the focus changes itkEventMacro( FocusEvent , itk::AnyEvent ); } // namespace mitk #endif /* MITKFOCUSMANAGER_H_HEADER_INCLUDED_C135A197 */ diff --git a/Core/Code/Controllers/mitkLimitedLinearUndo.h b/Core/Code/Controllers/mitkLimitedLinearUndo.h index 928c82fd24..18018648a6 100644 --- a/Core/Code/Controllers/mitkLimitedLinearUndo.h +++ b/Core/Code/Controllers/mitkLimitedLinearUndo.h @@ -1,139 +1,139 @@ /*========================================================================= Program: Medical Imaging & Interaction Toolkit Language: C++ Date: $Date$ Version: $Revision$ Copyright (c) German Cancer Research Center, Division of Medical and Biological Informatics. All rights reserved. See MITKCopyright.txt or http://www.mitk.org/copyright.html for details. This software is distributed WITHOUT ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the above copyright notices for more information. =========================================================================*/ #ifndef LIMITEDLINEARUNDO_H_HEADER_INCLUDED_C16E9C96 #define LIMITEDLINEARUNDO_H_HEADER_INCLUDED_C16E9C96 // MITK header -#include "mitkCommon.h" +#include #include "mitkOperationEvent.h" #include "mitkUndoModel.h" // STL header #include // ITK header #include namespace mitk { //##Documentation //## @brief A linear undo model with one undo and one redo stack. //## //## Derived from UndoModel AND itk::Object. Invokes ITK-events to signal listening //## GUI elements, whether each of the stacks is empty or not (to enable/disable button, ...) class MITK_CORE_EXPORT LimitedLinearUndo : public UndoModel { public: typedef std::vector UndoContainer; typedef std::vector::reverse_iterator UndoContainerRevIter; mitkClassMacro(LimitedLinearUndo, UndoModel); itkNewMacro(Self); virtual bool SetOperationEvent(UndoStackItem* stackItem); //##Documentation //## @brief Undoes the last changes //## //## Reads the top element of the Undo-Stack, //## executes the operation, //## swaps the OperationEvent-Undo with the Operation //## and sets it to Redo-Stack virtual bool Undo(); virtual bool Undo(bool); //##Documentation //## @brief Undoes all changes until ObjectEventID oeid virtual bool Undo(int oeid); //##Documentation //## @brief Undoes the last changes //## //## Reads the top element of the Redo-Stack, //## executes the operation, //## swaps the OperationEvent-Operation with the Undo-Operation //## and sets it to Undo-Stack virtual bool Redo(); virtual bool Redo(bool); //##Documentation //## @brief Redoes all changes until ObjectEventID oeid virtual bool Redo(int oeid); //##Documentation //## @brief Clears UndoList and RedoList virtual void Clear(); //##Documentation //## @brief Clears the RedoList virtual void ClearRedoList(); //##Documentation //## @brief True, if RedoList is empty virtual bool RedoListEmpty(); //##Documentation //## @brief Returns the ObjectEventId of the //## top element in the OperationHistory virtual int GetLastObjectEventIdInList(); //##Documentation //## @brief Returns the GroupEventId of the //## top element in the OperationHistory virtual int GetLastGroupEventIdInList(); //##Documentation //## @brief Returns the last specified OperationEvent in Undo-list //## corresponding to the given values; if nothing found, then returns NULL virtual OperationEvent* GetLastOfType(OperationActor* destination, OperationType opType); protected: //##Documentation //## Constructor LimitedLinearUndo(); //##Documentation //## Destructor virtual ~LimitedLinearUndo(); //## @brief Convenience method to free the memory of //## elements in the list and to clear the list void ClearList(UndoContainer* list); UndoContainer m_UndoList; UndoContainer m_RedoList; private: int FirstObjectEventIdOfCurrentGroup(UndoContainer& stack); }; /// Some itk events to notify listening GUI elements, when the undo or redo stack is empty (diable undo button) /// or when there are items in the stack (enable button) itkEventMacro( UndoStackEvent, itk::ModifiedEvent ); itkEventMacro( UndoEmptyEvent, UndoStackEvent ); itkEventMacro( RedoEmptyEvent, UndoStackEvent ); itkEventMacro( UndoNotEmptyEvent, UndoStackEvent ); itkEventMacro( RedoNotEmptyEvent, UndoStackEvent ); /// Additional unused events, if anybody wants to put an artificial limit to the possible number of items in the stack itkEventMacro( UndoFullEvent, UndoStackEvent ); itkEventMacro( RedoFullEvent, UndoStackEvent ); } //namespace mitk #endif /* LIMITEDLINEARUNDO_H_HEADER_INCLUDED_C16E9C96 */ diff --git a/Core/Code/Controllers/mitkOperationEvent.h b/Core/Code/Controllers/mitkOperationEvent.h index 0cced60811..615743a281 100644 --- a/Core/Code/Controllers/mitkOperationEvent.h +++ b/Core/Code/Controllers/mitkOperationEvent.h @@ -1,211 +1,211 @@ /*========================================================================= Program: Medical Imaging & Interaction Toolkit Language: C++ Date: $Date$ Version: $Revision$ Copyright (c) German Cancer Research Center, Division of Medical and Biological Informatics. All rights reserved. See MITKCopyright.txt or http://www.mitk.org/copyright.html for details. This software is distributed WITHOUT ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the above copyright notices for more information. =========================================================================*/ #ifndef OPERATIONEVENT_H_HEADER_INCLUDED_C16E83FC #define OPERATIONEVENT_H_HEADER_INCLUDED_C16E83FC -#include "mitkCommon.h" +#include #include "mitkOperation.h" #include "mitkOperationActor.h" #include "mitkUndoModel.h" #include #include namespace mitk { //##Documentation //## @brief Represents an entry of the undo or redo stack. //## //## This basic entry includes a textual description of the item and a pair of IDs. Static //## member functions handle creation and incrementing of these IDs. //## //## The ObjectEventID is increased by the global EventMapper for most of the events (see //## code for details). Incrementation of the IDs is done in two steps. First the //## EventMapper sets a flag via (possibly multiple calls of) IncCurrObjectEventID(), then //## ExecuteIncrement() does the actual incementation. //## //## The GroupEventID is intended for logical grouping of several related Operations. //## Currently this is used only by PointSetInteractor. How this is done and when to use //## GroupEventIDs is still undocumented. //## @ingroup Undo class MITK_CORE_EXPORT UndoStackItem { public: UndoStackItem(std::string description = ""); virtual ~UndoStackItem(); //##Documentation //## @brief For combining operations in groups //## //## This ID is used in the undo mechanism. //## For separation of the seperate operations //## If the GroupEventId of two OperationEvents is equal, //## then they share one group and will be undone in case of Undo(fine==false) static int GetCurrGroupEventId(); //##Documentation //## @brief For combining operations in Objects //## //## This ID is used in the Undo-Mechanism. //## For separation of the seperate operations //## If the ObjectEventId of two OperationEvents is equal, //## then they share one Object and will be undone in all cases of Undo(true and false). //## they shal not be seperated, because they were produced to realize one object-change. //## for example: OE_statechange and OE_addlastpoint static int GetCurrObjectEventId(); //##Documentation //## @brief Returns the GroupEventId for this object int GetGroupEventId(); //##Documentation //## @brief Returns the ObjectEventId for this object int GetObjectEventId(); //##Documentation //## @brief Returns the textual description of this object std::string GetDescription(); virtual void ReverseOperations(); virtual void ReverseAndExecute(); //##Documentation //## @brief Sets the current ObjectEventId to be incremended when ExecuteIncrement is called //## For example if a button click generates operations the ObjectEventId has to be incremented to be able to undo the operations. //## Difference between ObjectEventId and GroupEventId: The ObjectEventId capsulates all operations caused by one event. //## A GroupEventId capsulates several ObjectEventIds so that several operations caused by several events can be undone with one Undo call. static void IncCurrObjectEventId(); //##Documentation //## @brief Sets the current GroupEventId to be incremended when ExecuteIncrement is called //## For example if a button click generates operations the GroupEventId has to be incremented to be able to undo the operations. //## Difference between ObjectEventId and GroupEventId: The ObjectEventId capsulates all operations caused by one event. //## A GroupEventId capsulates several ObjectEventIds so that several operations caused by several events can be undone with one Undo call. static void IncCurrGroupEventId(); //##Documentation //## @brief Executes the incrementation of objectEventId and groupEventId if they are set to be incremented static void ExecuteIncrement(); protected: //##Documentation //## @brief true, if operation and undooperation have been swaped/changed bool m_Reversed; private: static int m_CurrObjectEventId; static int m_CurrGroupEventId; static bool m_IncrObjectEventId; static bool m_IncrGroupEventId; int m_ObjectEventId; int m_GroupEventId; std::string m_Description; UndoStackItem(UndoStackItem&); // hide copy constructor void operator=(const UndoStackItem&); // hide operator= }; //##Documentation //## @brief Represents a pair of operations: undo and the according redo. //## //## Additionally to the base class UndoStackItem, which only provides a description of an //## item, OperationEvent does the actual accounting of the undo/redo stack. This class //## holds two Operation objects (operation and its inverse operation) and the corresponding //## OperationActor. The operations may be swapped by the //## undo models, when an OperationEvent is moved from their undo to their redo //## stack or vice versa. //## //## Note, that memory management of operation and undooperation is done by this class. //## Memory of both objects is freed in the destructor. For this, the method IsValid() is needed which holds //## information of the state of m_Destination. In case the object referenced by m_Destination is already deleted, //## isValid() returns false. //## In more detail if the destination happens to be an itk::Object (often the case), OperationEvent is informed as soon //## as the object is deleted - from this moment on the OperationEvent gets invalid. You should //## check this flag before you call anything on destination //## //## @ingroup Undo class MITK_CORE_EXPORT OperationEvent : public UndoStackItem { public: //## @brief default constructor OperationEvent(OperationActor* destination, Operation* operation, Operation* undoOperation, std::string description = "" ); //## @brief default destructor //## //## removes observers if destination is valid //## and frees memory referenced by m_Operation and m_UndoOperation virtual ~OperationEvent(); //## @brief Returns the operation Operation* GetOperation(); //## @brief Returns the destination of the operations OperationActor* GetDestination(); friend class UndoModel; //## @brief Swaps the two operations and sets a flag, //## that it has been swapped and doOp is undoOp and undoOp is doOp virtual void ReverseOperations(); //##reverses and executes both operations (used, when moved from undo to redo stack) virtual void ReverseAndExecute(); //## @brief returns true if the destination still is present //## and false if it already has been deleted virtual bool IsValid(); protected: void OnObjectDeleted(); private: // Has to be observed for itk::DeleteEvents. // When destination is deleted, this stack item is invalid! OperationActor* m_Destination; //## reference to the operation Operation* m_Operation; //## reference to the undo operation Operation* m_UndoOperation; //## hide copy constructor OperationEvent(OperationEvent&); //## hide operator= void operator=(const OperationEvent&); //observertag used to listen to m_Destination unsigned long m_DeleteTag; //## stores if destination is valid or already has been freed bool m_Invalid; }; } //namespace mitk #endif /* OPERATIONEVENT_H_HEADER_INCLUDED_C16E83FC */ diff --git a/Core/Code/Controllers/mitkProgressBar.h b/Core/Code/Controllers/mitkProgressBar.h index 2d9ca2737d..385b1fddaf 100644 --- a/Core/Code/Controllers/mitkProgressBar.h +++ b/Core/Code/Controllers/mitkProgressBar.h @@ -1,86 +1,86 @@ /*========================================================================= Program: Medical Imaging & Interaction Toolkit Language: C++ Date: $Date$ Version: $Revision$ Copyright (c) German Cancer Research Center, Division of Medical and Biological Informatics. All rights reserved. See MITKCopyright.txt or http://www.mitk.org/copyright.html for details. This software is distributed WITHOUT ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the above copyright notices for more information. =========================================================================*/ #ifndef MITKPROGRESSBAR_H #define MITKPROGRESSBAR_H #include -#include "mitkCommon.h" +#include namespace mitk { class ProgressBarImplementation; //##Documentation //## @brief Sending a message to the applications ProgressBar //## //## Holds a GUI dependent ProgressBarImplementation and sends the progress further. //## All mitk-classes use this class to display progress on GUI-ProgressBar. //## The mainapplication has to set the internal held ProgressBarImplementation with SetImplementationInstance(..). //## @ingroup Interaction class MITK_CORE_EXPORT ProgressBar : public itk::Object { public: itkTypeMacro(ProgressBar, itk::Object); //##Documentation //## @brief static method to get the GUI dependent ProgressBar-instance //## so the methods for steps to do and progress can be called //## No reference counting, cause of decentral static use! static ProgressBar* GetInstance(); //##Documentation //## @brief Supply a GUI- dependent ProgressBar. Has to be set by the application //## to connect the application dependent subclass of mitkProgressBar void RegisterImplementationInstance(ProgressBarImplementation* implementation); void UnregisterImplementationInstance(ProgressBarImplementation* implementation); //##Documentation //## @brief Adds steps to totalSteps. void AddStepsToDo(unsigned int steps); //##Documentation //## @brief Sets the current amount of progress to current progress + steps. //## @param: steps the number of steps done since last Progress(int steps) call. void Progress(unsigned int steps = 1); //##Documentation //## @brief Sets whether the current progress value is displayed. void SetPercentageVisible (bool visible); protected: typedef std::vector< ProgressBarImplementation* > ProgressBarImplementationsList; typedef ProgressBarImplementationsList::iterator ProgressBarImplementationsListIterator; ProgressBar(); virtual ~ProgressBar(); ProgressBarImplementationsList m_Implementations; static ProgressBar* m_Instance; }; }// end namespace mitk #endif /* define MITKPROGRESSBAR_H */ diff --git a/Core/Code/Controllers/mitkProgressBarImplementation.h b/Core/Code/Controllers/mitkProgressBarImplementation.h index 40d8119c7a..44dbf7c591 100644 --- a/Core/Code/Controllers/mitkProgressBarImplementation.h +++ b/Core/Code/Controllers/mitkProgressBarImplementation.h @@ -1,58 +1,58 @@ /*========================================================================= Program: Medical Imaging & Interaction Toolkit Language: C++ Date: $Date$ Version: $Revision$ Copyright (c) German Cancer Research Center, Division of Medical and Biological Informatics. All rights reserved. See MITKCopyright.txt or http://www.mitk.org/copyright.html for details. This software is distributed WITHOUT ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the above copyright notices for more information. =========================================================================*/ #ifndef MITKPROGRESSBARIMPLEMENTATION_H #define MITKPROGRESSBARIMPLEMENTATION_H -#include "mitkCommon.h" +#include namespace mitk { //##Documentation //## @brief GUI indepentent Interface for all Gui depentent implementations of a ProgressBar. class MITK_CORE_EXPORT ProgressBarImplementation { public: //##Documentation //## @brief Constructor ProgressBarImplementation(){}; //##Documentation //## @brief Destructor virtual ~ProgressBarImplementation(){}; //##Documentation //## @brief Sets whether the current progress value is displayed. virtual void SetPercentageVisible (bool visible) =0; //##Documentation //## @brief Adds steps to totalSteps. virtual void AddStepsToDo(unsigned int steps) =0; //##Documentation //## @brief Sets the current amount of progress to current progress + steps. //## @param steps the number of steps done since last Progress(int steps) call. virtual void Progress(unsigned int steps) =0; }; }// end namespace mitk #endif /* define MITKPROGRESSBARIMPLEMENTATION_H */ diff --git a/Core/Code/Controllers/mitkReferenceCountWatcher.h b/Core/Code/Controllers/mitkReferenceCountWatcher.h index b6c8a5ab9b..b3cea990b9 100644 --- a/Core/Code/Controllers/mitkReferenceCountWatcher.h +++ b/Core/Code/Controllers/mitkReferenceCountWatcher.h @@ -1,108 +1,108 @@ /*========================================================================= Program: Medical Imaging & Interaction Toolkit Language: C++ Date: $Date$ Version: $Revision$ Copyright (c) German Cancer Research Center, Division of Medical and Biological Informatics. All rights reserved. See MITKCopyright.txt or http://www.mitk.org/copyright.html for details. This software is distributed WITHOUT ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the above copyright notices for more information. =========================================================================*/ #include "itkCommand.h" -#include "mitkCommon.h" +#include namespace mitk { //##Documentation //## @brief Keeps track of the reference count of an object even if //## it is destroyed. //## //## Example usage: //## \code //## SomeFilter* filter = GetSomeFilter(); //## ReferenceCountWatcher::Pointer filterWatcher; //## filterWatcher = new ReferenceCountWatcher(filter, "name of filter"); //## filterWatcher->GetReferenceCount(); //## \endcode //## @ingroup Testing class ReferenceCountWatcher : public itk::Object { public: typedef itk::SimpleMemberCommand CommandType; mitkClassMacro(ReferenceCountWatcher, itk::Object); protected: //##Documentation //## @brief Object to be watched itk::Object* m_Object; //##Documentation //## @brief Optional comment, e.g. for debugging output std::string m_Comment; //##Documentation //## @brief If \a true, \a m_Object is no longer valid //## and the returned reference count will be 0. bool m_Deleted; //##Documentation //## @brief itk::Command to get a notification when the object //## is deleted. CommandType::Pointer m_DeleteCommand; public: //##Documentation //## @brief Constructor requiring object to be watched and allowing //## an optional comment. ReferenceCountWatcher(itk::Object* o, const char *comment="") : m_Object(o), m_Comment(comment), m_Deleted(false), m_ObserverTag(0) { m_DeleteCommand = CommandType::New(); m_DeleteCommand->SetCallbackFunction(this, &ReferenceCountWatcher::DeleteObserver); if(m_Object!=NULL) m_ObserverTag = m_Object->AddObserver(itk::DeleteEvent(), m_DeleteCommand); m_ReferenceCountLock.Lock(); m_ReferenceCount = 0; m_ReferenceCountLock.Unlock(); } //##Documentation //## @brief Destructor: remove observer ~ReferenceCountWatcher() { if((m_Deleted == false) && (m_Object != NULL)) { m_Object->RemoveObserver(m_ObserverTag); } } //##Documentation //## @brief Return the reference count of the watched object or //## 0 if it has been destroyed int GetReferenceCount() const { if(m_Object == NULL) return -1; if(m_Deleted) return 0; return m_Object->GetReferenceCount(); } //##Documentation //## @brief Return the optional string comment itkGetStringMacro(Comment); protected: //##Documentation //## @brief Callback called on itk::DeleteEvent() of wathched object. void DeleteObserver() { m_Deleted = true; } unsigned long m_ObserverTag; }; } diff --git a/Core/Code/Controllers/mitkRenderingManager.h b/Core/Code/Controllers/mitkRenderingManager.h index d0ad81618d..f33001e967 100644 --- a/Core/Code/Controllers/mitkRenderingManager.h +++ b/Core/Code/Controllers/mitkRenderingManager.h @@ -1,416 +1,416 @@ /*========================================================================= Program: Medical Imaging & Interaction Toolkit Language: C++ Date: $Date$ Version: $Revision$ Copyright (c) German Cancer Research Center, Division of Medical and Biological Informatics. All rights reserved. See MITKCopyright.txt or http://www.mitk.org/copyright.html for details. This software is distributed WITHOUT ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the above copyright notices for more information. =========================================================================*/ #ifndef MITKRENDERINGMANAGER_H_HEADER_INCLUDED_C135A197 #define MITKRENDERINGMANAGER_H_HEADER_INCLUDED_C135A197 -#include "mitkCommon.h" +#include #include #include #include #include #include "mitkPropertyList.h" #include "mitkProperties.h" class vtkRenderWindow; class vtkObject; namespace mitk { class RenderingManager; class RenderingManagerFactory; class Geometry3D; class SliceNavigationController; class BaseRenderer; class DataStorage; class GlobalInteraction; /** * \brief Manager for coordinating the rendering process. * * RenderingManager is a central instance retrieving and executing * RenderWindow update requests. Its main purpose is to coordinate * distributed requests which cannot be aware of each other - lacking the * knowledge of whether they are really necessary or not. For example, two * objects might determine that a specific RenderWindow needs to be updated. * This would result in one unnecessary update, if both executed the update * on their own. * * The RenderingManager addresses this by letting each such object * request an update, and waiting for other objects to possibly * issue the same request. The actual update will then only be executed at a * well-defined point in the main event loop (this may be each time after * event processing is done). * * Convinience methods for updating all RenderWindows which have been * registered with the RenderingManager exist. If theses methods are not * used, it is not required to register (add) RenderWindows prior to using * the RenderingManager. * * The methods #ForceImmediateUpdate() and #ForceImmediateUpdateAll() can * be used to force the RenderWindow update execution without any delay, * bypassing the request functionality. * * The interface of RenderingManager is platform independent. Platform * specific subclasses have to be implemented, though, to supply an * appropriate event issueing for controlling the update execution process. * See method documentation for a description of how this can be done. * * \sa TestingRenderingManager An "empty" RenderingManager implementation which * can be used in tests etc. * */ class MITK_CORE_EXPORT RenderingManager : public itk::Object { public: mitkClassMacro(RenderingManager,itk::Object); typedef std::vector< vtkRenderWindow* > RenderWindowVector; typedef std::vector< float > FloatVector; typedef std::vector< bool > BoolVector; typedef itk::SmartPointer< DataStorage > DataStoragePointer; typedef itk::SmartPointer< GlobalInteraction > GlobalInteractionPointer; enum RequestType { REQUEST_UPDATE_ALL = 0, REQUEST_UPDATE_2DWINDOWS, REQUEST_UPDATE_3DWINDOWS }; static Pointer New(); /** Set the object factory which produces the desired platform specific * RenderingManager singleton instance. */ static void SetFactory( RenderingManagerFactory *factory ); /** Get the object factory which produces the platform specific * RenderingManager instances. */ static const RenderingManagerFactory *GetFactory(); /** Returns true if a factory has already been set. */ static bool HasFactory(); /** Get the RenderingManager singleton instance. */ static RenderingManager *GetInstance(); /** Returns true if the singleton instance does already exist. */ static bool IsInstantiated(); /** Adds a RenderWindow. This is required if the methods #RequestUpdateAll * or #ForceImmediateUpdate are to be used. */ void AddRenderWindow( vtkRenderWindow *renderWindow ); /** Removes a RenderWindow. */ void RemoveRenderWindow( vtkRenderWindow *renderWindow ); /** Get a list of all registered RenderWindows */ const RenderWindowVector &GetAllRegisteredRenderWindows(); /** Requests an update for the specified RenderWindow, to be executed as * soon as the main loop is ready for rendering. */ void RequestUpdate( vtkRenderWindow *renderWindow ); /** Immediately executes an update of the specified RenderWindow. */ void ForceImmediateUpdate( vtkRenderWindow *renderWindow ); /** 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. */ void RequestUpdateAll( RequestType type = REQUEST_UPDATE_ALL ); /** 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. */ void ForceImmediateUpdateAll( RequestType type = REQUEST_UPDATE_ALL ); /** Initializes the windows specified by requestType to the geometry of the * given DataStorage. */ //virtual bool InitializeViews( const DataStorage *storage, const DataNode* node = NULL, // RequestType type = REQUEST_UPDATE_ALL, bool preserveRoughOrientationInWorldSpace = false ); /** Initializes the windows specified by requestType to the given * geometry. PLATFORM SPECIFIC. */ virtual bool InitializeViews( const Geometry3D *geometry, RequestType type = REQUEST_UPDATE_ALL, bool preserveRoughOrientationInWorldSpace = false ); /** Initializes the windows to the default viewing direction * (geomtry information is NOT changed). PLATFORM SPECIFIC. */ virtual bool InitializeViews( RequestType type = REQUEST_UPDATE_ALL ); /** Initializes the specified window to the geometry of the given * DataNode. Set "initializeGlobalTimeSNC" to true in order to use this * geometry as global TimeSlicedGeometry. PLATFORM SPECIFIC. */ //virtual bool InitializeView( vtkRenderWindow *renderWindow, const DataStorage* ds, const DataNode* node = NULL, bool initializeGlobalTimeSNC = false ); /** Initializes the specified window to the given geometry. Set * "initializeGlobalTimeSNC" to true in order to use this geometry as * global TimeSlicedGeometry. PLATFORM SPECIFIC. */ virtual bool InitializeView( vtkRenderWindow *renderWindow, const Geometry3D *geometry, bool initializeGlobalTimeSNC = false); /** Initializes the specified window to the default viewing direction * (geomtry information is NOT changed). PLATFORM SPECIFIC. */ virtual bool InitializeView( vtkRenderWindow *renderWindow ); /** Sets the (global) SliceNavigationController responsible for * time-slicing. */ void SetTimeNavigationController( SliceNavigationController *nc ); /** Gets the (global) SliceNavigationController responsible for * time-slicing. */ const SliceNavigationController *GetTimeNavigationController() const; /** Gets the (global) SliceNavigationController responsible for * time-slicing. */ SliceNavigationController *GetTimeNavigationController(); virtual ~RenderingManager(); /** Executes all pending requests. This method has to be called by the * system whenever a RenderingManager induced request event occurs in * the system pipeline (see concrete RenderingManager implementations). */ virtual void ExecutePendingRequests(); bool IsRendering() const; void AbortRendering(); /** En-/Disable LOD increase globally. */ itkSetMacro( LODIncreaseBlocked, bool ); /** En-/Disable LOD increase globally. */ itkGetMacro( LODIncreaseBlocked, bool ); /** En-/Disable LOD increase globally. */ itkBooleanMacro( LODIncreaseBlocked ); /** En-/Disable LOD abort mechanism. */ itkSetMacro( LODAbortMechanismEnabled, bool ); /** En-/Disable LOD abort mechanism. */ itkGetMacro( LODAbortMechanismEnabled, bool ); /** En-/Disable LOD abort mechanism. */ itkBooleanMacro( LODAbortMechanismEnabled ); /** En-/Disable depth peeling for all renderers */ void SetDepthPeelingEnabled(bool enabled); /** Set maximum number of peels for all renderers */ void SetMaxNumberOfPeels(int maxNumber); /** Force a sub-class to start a timer for a pending hires-rendering request */ virtual void StartOrResetTimer() {}; /** To be called by a sub-class from a timer callback */ void ExecutePendingHighResRenderingRequest(); virtual void DoStartRendering() {}; virtual void DoMonitorRendering() {}; virtual void DoFinishAbortRendering() {}; int GetNextLOD( BaseRenderer* renderer ); /** Set current LOD (NULL means all renderers)*/ void SetMaximumLOD( unsigned int max ); void SetShading( bool state, unsigned int lod ); bool GetShading( unsigned int lod ); void SetClippingPlaneStatus( bool status ); bool GetClippingPlaneStatus(); void SetShadingValues( float ambient, float diffuse, float specular, float specpower ); FloatVector &GetShadingValues(); /** Returns a property list */ PropertyList::Pointer GetPropertyList() const; /** returns a property from m_PropertyList */ BaseProperty* GetProperty(const char *propertyKey) const; /** retu"Use flexible zooming and padding"rns sets or adds (if not present) a property in m_PropertyList */ void SetProperty(const char *propertyKey, BaseProperty* propertyValue); /** * \brief Setter / Getter for internal DataStorage * * Sets / returns the mitk::DataStorage that is used internally. This instance holds all mitk::DataNodes that are * rendered by the registered BaseRenderers. * * If this DataStorage is changed at runtime by calling SetDataStorage(), * all currently registered BaseRenderers are automatically given the correct instance. * When a new BaseRenderer is added, it is automatically initialized with the currently active DataStorage. */ void SetDataStorage( mitk::DataStorage* storage ); /** * \brief Setter / Getter for internal DataStorage * * Sets / returns the mitk::DataStorage that is used internally. This instance holds all mitk::DataNodes that are * rendered by the registered BaseRenderers. * * If this DataStorage is changed at runtime by calling SetDataStorage(), * all currently registered BaseRenderers are automatically given the correct instance. * When a new BaseRenderer is added, it is automatically initialized with the currently active DataStorage. */ mitk::DataStorage* GetDataStorage(); /** * \brief Setter / Getter for internal GloabInteraction * * Sets / returns the instance of mitk::GlobalInteraction that is internally held. * It'S not actually used by this class but offers it to all registered BaseRenderers. * These need it for their own internal initialization of the FocusManager and the corresponding EventMappers. */ void SetGlobalInteraction( mitk::GlobalInteraction* globalInteraction ); /** * \brief Setter / Getter for internal GloabInteraction * * Sets / returns the instance of mitk::GlobalInteraction that is internally held. * It'S not actually used by this class but offers it to all registered BaseRenderers. * These need it for their own internal initialization of the FocusManager and the corresponding EventMappers. */ mitk::GlobalInteraction* GetGlobalInteraction(); itkSetMacro(ConstrainedPaddingZooming, bool); protected: enum { RENDERING_INACTIVE = 0, RENDERING_REQUESTED, RENDERING_INPROGRESS }; RenderingManager(); /** Abstract method for generating a system specific event for rendering * request. This method is called whenever an update is requested */ virtual void GenerateRenderingRequestEvent() = 0; virtual void InitializePropertyList(); bool m_UpdatePending; typedef std::map< BaseRenderer *, unsigned int > RendererIntMap; typedef std::map< BaseRenderer *, bool > RendererBoolMap; RendererBoolMap m_RenderingAbortedMap; RendererIntMap m_NextLODMap; unsigned int m_MaxLOD; bool m_LODIncreaseBlocked; bool m_LODAbortMechanismEnabled; BoolVector m_ShadingEnabled; bool m_ClippingPlaneEnabled; FloatVector m_ShadingValues; static void RenderingStartCallback( vtkObject *caller, unsigned long eid, void *clientdata, void *calldata ); static void RenderingProgressCallback( vtkObject *caller, unsigned long eid, void *clientdata, void *calldata ); static void RenderingEndCallback( vtkObject *caller, unsigned long eid, void *clientdata, void *calldata ); typedef std::map< vtkRenderWindow *, int > RenderWindowList; RenderWindowList m_RenderWindowList; RenderWindowVector m_AllRenderWindows; struct RenderWindowCallbacks { vtkCallbackCommand* commands[3u]; }; typedef std::map RenderWindowCallbacksList; RenderWindowCallbacksList m_RenderWindowCallbacksList; SliceNavigationController *m_TimeNavigationController; static RenderingManager::Pointer s_Instance; static RenderingManagerFactory *s_RenderingManagerFactory; PropertyList::Pointer m_PropertyList; DataStoragePointer m_DataStorage; GlobalInteractionPointer m_GlobalInteraction; bool m_ConstrainedPaddingZooming; private: void InternalViewInitialization( mitk::BaseRenderer *baseRenderer, const mitk::Geometry3D *geometry, bool boundingBoxInitialized, int mapperID ); }; itkEventMacro( RenderingManagerEvent, itk::AnyEvent ); itkEventMacro( RenderingManagerViewsInitializedEvent, RenderingManagerEvent ); /** * Generic RenderingManager implementation for "non-rendering-plattform", * e.g. for tests. Its factory (TestingRenderingManagerFactory) is * automatically on start-up and is used by default if not other * RenderingManagerFactory is instantiated explicitly thereafter. * (see mitkRenderingManager.cpp) */ class MITK_CORE_EXPORT TestingRenderingManager : public RenderingManager { public: mitkClassMacro(TestingRenderingManager,RenderingManager); itkNewMacro(Self); protected: virtual void GenerateRenderingRequestEvent() { }; }; } // namespace mitk #endif /* MITKRenderingManager_H_HEADER_INCLUDED_C135A197 */ diff --git a/Core/Code/Controllers/mitkSliceNavigationController.h b/Core/Code/Controllers/mitkSliceNavigationController.h index cb42aa791c..4f1443afa7 100644 --- a/Core/Code/Controllers/mitkSliceNavigationController.h +++ b/Core/Code/Controllers/mitkSliceNavigationController.h @@ -1,508 +1,508 @@ /*========================================================================= Program: Medical Imaging & Interaction Toolkit Language: C++ Date: $Date$ Version: $Revision$ Copyright (c) German Cancer Research Center, Division of Medical and Biological Informatics. All rights reserved. See MITKCopyright.txt or http://www.mitk.org/copyright.html for details. This software is distributed WITHOUT ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the above copyright notices for more information. =========================================================================*/ #ifndef SLICENAVIGATIONCONTROLLER_H_HEADER_INCLUDED_C1C55A2F #define SLICENAVIGATIONCONTROLLER_H_HEADER_INCLUDED_C1C55A2F -#include "mitkCommon.h" +#include #include "mitkBaseController.h" #include "mitkRenderingManager.h" #include "mitkTimeSlicedGeometry.h" #include "mitkMessage.h" #include #include #include #include namespace mitk { #define mitkTimeSlicedGeometryEventMacro( classname , super ) \ class MITK_CORE_EXPORT classname : public super { \ public: \ typedef classname Self; \ typedef super Superclass; \ classname(TimeSlicedGeometry* aTimeSlicedGeometry, unsigned int aPos) \ : Superclass(aTimeSlicedGeometry, aPos) {} \ virtual ~classname() {} \ virtual const char * GetEventName() const { return #classname; } \ virtual bool CheckEvent(const ::itk::EventObject* e) const \ { return dynamic_cast(e); } \ virtual ::itk::EventObject* MakeObject() const \ { return new Self(GetTimeSlicedGeometry(), GetPos()); } \ private: \ void operator=(const Self&); \ } class PlaneGeometry; class Geometry3D; class BaseRenderer; /** * \brief Controls the selection of the slice the associated BaseRenderer * will display * * A SliceNavigationController takes a Geometry3D as input world geometry * (TODO what are the exact requirements?) and generates a TimeSlicedGeometry * as output. The TimeSlicedGeometry holds a number of SlicedGeometry3Ds and * these in turn hold a series of Geometry2Ds. One of these Geometry2Ds is * selected as world geometry for the BaseRenderers associated to 2D views. * * The SliceNavigationController holds has Steppers (one for the slice, a * second for the time step), which control the selection of a single * Geometry2D from the TimeSlicedGeometry. SliceNavigationController generates * ITK events to tell observers, like a BaseRenderer, when the selected slice * or timestep changes. * * SliceNavigationControllers are registered as listeners to GlobalInteraction * by the QmitkStdMultiWidget. In ExecuteAction, the controllers react to * PositionEvents by setting the steppers to the slice which is nearest to the * point of the PositionEvent. * * Example: * \code * // Initialization * sliceCtrl = mitk::SliceNavigationController::New(); * * // Tell the navigator the geometry to be sliced (with geometry a * // Geometry3D::ConstPointer) * sliceCtrl->SetInputWorldGeometry(geometry.GetPointer()); * * // Tell the navigator in which direction it shall slice the data * sliceCtrl->SetViewDirection(mitk::SliceNavigationController::Transversal); * * // Connect one or more BaseRenderer to this navigator, i.e.: events sent * // by the navigator when stepping through the slices (e.g. by * // sliceCtrl->GetSlice()->Next()) will be received by the BaseRenderer * // (in this example only slice-changes, see also ConnectGeometryTimeEvent * // and ConnectGeometryEvents.) * sliceCtrl->ConnectGeometrySliceEvent(renderer.GetPointer()); * * //create a world geometry and send the information to the connected renderer(s) * sliceCtrl->Update(); * \endcode * * * You can connect visible navigators to a SliceNavigationController, e.g., a * QmitkSliderNavigator (for Qt): * * \code * // Create the visible navigator (a slider with a spin-box) * QmitkSliderNavigator* navigator = * new QmitkSliderNavigator(parent, "slidernavigator"); * * // Connect the navigator to the slice-stepper of the * // SliceNavigationController. For initialization (position, mininal and * // maximal values) the values of the SliceNavigationController are used. * // Thus, accessing methods of a navigator is normally not necessary, since * // everything can be set via the (Qt-independent) SliceNavigationController. * // The QmitkStepperAdapter converts the Qt-signals to Qt-independent * // itk-events. * new QmitkStepperAdapter(navigator, sliceCtrl->GetSlice(), "navigatoradaptor"); * \endcode * * If you do not want that all renderwindows are updated when a new slice is * selected, you can use a specific RenderingManager, which updates only those * renderwindows that should be updated. This is sometimes useful when a 3D view * does not need to be updated when the slices in some 2D views are changed. * QmitkSliderNavigator (for Qt): * * \code * // create a specific RenderingManager * mitk::RenderingManager::Pointer myManager = mitk::RenderingManager::New(); * * // tell the RenderingManager to update only renderwindow1 and renderwindow2 * myManager->AddRenderWindow(renderwindow1); * myManager->AddRenderWindow(renderwindow2); * * // tell the SliceNavigationController of renderwindow1 and renderwindow2 * // to use the specific RenderingManager instead of the global one * renderwindow1->GetSliceNavigationController()->SetRenderingManager(myManager); * renderwindow2->GetSliceNavigationController()->SetRenderingManager(myManager); * \endcode * * \todo implement for non-evenly-timed geometry! * \ingroup NavigationControl */ class MITK_CORE_EXPORT SliceNavigationController : public BaseController { public: mitkClassMacro(SliceNavigationController,BaseController); itkNewMacro(Self); mitkNewMacro1Param(Self, const char *); /** * \brief Possible view directions, \a Original will uses * the Geometry2D instances in a SlicedGeometry3D provided * as input world geometry (by SetInputWorldGeometry). */ enum ViewDirection{Transversal, Sagittal, Frontal, Original}; /** * \brief Set the input world geometry out of which the * geometries for slicing will be created. */ void SetInputWorldGeometry(const mitk::Geometry3D* geometry); itkGetConstObjectMacro(InputWorldGeometry, mitk::Geometry3D); /** * \brief Access the created geometry */ itkGetConstObjectMacro(CreatedWorldGeometry, mitk::Geometry3D); /** * \brief Set the desired view directions * * \sa ViewDirection * \sa Update(ViewDirection viewDirection, bool top = true, * bool frontside = true, bool rotated = false) */ itkSetEnumMacro(ViewDirection, ViewDirection); itkGetEnumMacro(ViewDirection, ViewDirection); /** * \brief Set the default view direction * * This is used to re-initialize the view direction of the SNC to the * default value with SetViewDirectionToDefault() * * \sa ViewDirection * \sa Update(ViewDirection viewDirection, bool top = true, * bool frontside = true, bool rotated = false) */ itkSetEnumMacro(DefaultViewDirection, ViewDirection); itkGetEnumMacro(DefaultViewDirection, ViewDirection); virtual void SetViewDirectionToDefault(); /** * \brief Do the actual creation and send it to the connected * observers (renderers) * */ virtual void Update(); /** * \brief Extended version of Update, additionally allowing to * specify the direction/orientation of the created geometry. * */ virtual void Update(ViewDirection viewDirection, bool top = true, bool frontside = true, bool rotated = false); /** * \brief Send the created geometry to the connected * observers (renderers) * * Called by Update(). */ virtual void SendCreatedWorldGeometry(); /** * \brief Tell observers to re-read the currently selected 2D geometry * * Called by mitk::SlicesRotator during rotation. */ virtual void SendCreatedWorldGeometryUpdate(); /** * \brief Send the currently selected slice to the connected * observers (renderers) * * Called by Update(). */ virtual void SendSlice(); /** * \brief Send the currently selected time to the connected * observers (renderers) * * Called by Update(). */ virtual void SendTime(); /** * \brief Set the RenderingManager to be used * * If \a NULL, the default RenderingManager will be used. */ itkSetObjectMacro(RenderingManager, RenderingManager); mitk::RenderingManager* GetRenderingManager() const; itkEventMacro( UpdateEvent, itk::AnyEvent ); class MITK_CORE_EXPORT TimeSlicedGeometryEvent : public itk::AnyEvent { public: typedef TimeSlicedGeometryEvent Self; typedef itk::AnyEvent Superclass; TimeSlicedGeometryEvent( TimeSlicedGeometry* aTimeSlicedGeometry, unsigned int aPos) : m_TimeSlicedGeometry(aTimeSlicedGeometry), m_Pos(aPos) {} virtual ~TimeSlicedGeometryEvent() {} virtual const char * GetEventName() const { return "TimeSlicedGeometryEvent"; } virtual bool CheckEvent(const ::itk::EventObject* e) const { return dynamic_cast(e); } virtual ::itk::EventObject* MakeObject() const { return new Self(m_TimeSlicedGeometry, m_Pos); } TimeSlicedGeometry* GetTimeSlicedGeometry() const { return m_TimeSlicedGeometry; } unsigned int GetPos() const { return m_Pos; } private: TimeSlicedGeometry::Pointer m_TimeSlicedGeometry; unsigned int m_Pos; // TimeSlicedGeometryEvent(const Self&); void operator=(const Self&); //just hide }; mitkTimeSlicedGeometryEventMacro( GeometrySendEvent,TimeSlicedGeometryEvent ); mitkTimeSlicedGeometryEventMacro( GeometryUpdateEvent, TimeSlicedGeometryEvent ); mitkTimeSlicedGeometryEventMacro( GeometryTimeEvent, TimeSlicedGeometryEvent ); mitkTimeSlicedGeometryEventMacro( GeometrySliceEvent, TimeSlicedGeometryEvent ); template void ConnectGeometrySendEvent(T* receiver) { typedef typename itk::ReceptorMemberCommand::Pointer ReceptorMemberCommandPointer; ReceptorMemberCommandPointer eventReceptorCommand = itk::ReceptorMemberCommand::New(); eventReceptorCommand->SetCallbackFunction(receiver, &T::SetGeometry); AddObserver(GeometrySendEvent(NULL,0), eventReceptorCommand); } template void ConnectGeometryUpdateEvent(T* receiver) { typedef typename itk::ReceptorMemberCommand::Pointer ReceptorMemberCommandPointer; ReceptorMemberCommandPointer eventReceptorCommand = itk::ReceptorMemberCommand::New(); eventReceptorCommand->SetCallbackFunction(receiver, &T::UpdateGeometry); AddObserver(GeometryUpdateEvent(NULL,0), eventReceptorCommand); } template void ConnectGeometrySliceEvent(T* receiver, bool connectSendEvent=true) { typedef typename itk::ReceptorMemberCommand::Pointer ReceptorMemberCommandPointer; ReceptorMemberCommandPointer eventReceptorCommand = itk::ReceptorMemberCommand::New(); eventReceptorCommand->SetCallbackFunction(receiver, &T::SetGeometrySlice); AddObserver(GeometrySliceEvent(NULL,0), eventReceptorCommand); if(connectSendEvent) ConnectGeometrySendEvent(receiver); } template void ConnectGeometryTimeEvent(T* receiver, bool connectSendEvent=true) { typedef typename itk::ReceptorMemberCommand::Pointer ReceptorMemberCommandPointer; ReceptorMemberCommandPointer eventReceptorCommand = itk::ReceptorMemberCommand::New(); eventReceptorCommand->SetCallbackFunction(receiver, &T::SetGeometryTime); AddObserver(GeometryTimeEvent(NULL,0), eventReceptorCommand); if(connectSendEvent) ConnectGeometrySendEvent(receiver); } template void ConnectGeometryEvents(T* receiver) { //connect sendEvent only once ConnectGeometrySliceEvent(receiver, false); ConnectGeometryTimeEvent(receiver); } Message<> crosshairPositionEvent; /** * \brief To connect multiple SliceNavigationController, we can * act as an observer ourselves: implemented interface * \warning not implemented */ virtual void SetGeometry(const itk::EventObject & geometrySliceEvent); /** * \brief To connect multiple SliceNavigationController, we can * act as an observer ourselves: implemented interface */ virtual void SetGeometrySlice(const itk::EventObject & geometrySliceEvent); /** * \brief To connect multiple SliceNavigationController, we can * act as an observer ourselves: implemented interface */ virtual void SetGeometryTime(const itk::EventObject & geometryTimeEvent); /** \brief Positions the SNC according to the specified point */ void SelectSliceByPoint( const mitk::Point3D &point ); /** \brief Returns the TimeSlicedGeometry created by the SNC. */ const mitk::TimeSlicedGeometry *GetCreatedWorldGeometry(); /** \brief Returns the Geometry3D of the currently selected time step. */ const mitk::Geometry3D *GetCurrentGeometry3D(); /** \brief Returns the currently selected Plane in the current * Geometry3D (if existent). */ const mitk::PlaneGeometry *GetCurrentPlaneGeometry(); /** \brief Sets the BaseRenderer associated with this SNC (if any). While * the BaseRenderer is not directly used by SNC, this is a convenience * method to enable BaseRenderer access via the SNC. */ void SetRenderer( BaseRenderer *renderer ); /** \brief Gets the BaseRenderer associated with this SNC (if any). While * the BaseRenderer is not directly used by SNC, this is a convenience * method to enable BaseRenderer access via the SNC. Returns NULL if no * BaseRenderer has been specified*/ BaseRenderer *GetRenderer() const; /** \brief Re-orients the slice stack to include the plane specified by * the given point an normal vector. */ void ReorientSlices( const mitk::Point3D &point, const mitk::Vector3D &normal ); virtual bool ExecuteAction( Action* action, mitk::StateEvent const* stateEvent); void ExecuteOperation(Operation* operation); /** * \brief Feature option to lock planes during mouse interaction. * This option flag disables the mouse event which causes the center * cross to move near by. */ itkSetMacro(SliceLocked, bool); itkGetMacro(SliceLocked, bool); itkBooleanMacro(SliceLocked); /** * \brief Feature option to lock slice rotation. * * This option flag disables separately the rotation of a slice which is * implemented in mitkSliceRotator. */ itkSetMacro(SliceRotationLocked, bool); itkGetMacro(SliceRotationLocked, bool); itkBooleanMacro(SliceRotationLocked); /** * \brief Adjusts the numerical range of the slice stepper according to * the current geometry orientation of this SNC's SlicedGeometry. */ void AdjustSliceStepperRange(); protected: SliceNavigationController(const char * type = NULL); virtual ~SliceNavigationController(); template static void buildstring( mitkIpPicDescriptor *pic, itk::Point p, std::string &s, T = 0) { std::string value; std::stringstream stream; stream.imbue(std::locale::classic()); stream<=0 && p[1] >=0 && p[2]>=0) && (unsigned int)p[0] < pic->n[0] && (unsigned int)p[1] < pic->n[1] && (unsigned int)p[2] < pic->n[2] ) { if(pic->bpe!=24) { stream<<(((T*) pic->data)[ p[0] + p[1]*pic->n[0] + p[2]*pic->n[0]*pic->n[1] ]); } else { stream<<(((T*) pic->data)[p[0]*3 + 0 + p[1]*pic->n[0]*3 + p[2]*pic->n[0]*pic->n[1]*3 ]); stream<<(((T*) pic->data)[p[0]*3 + 1 + p[1]*pic->n[0]*3 + p[2]*pic->n[0]*pic->n[1]*3 ]); stream<<(((T*) pic->data)[p[0]*3 + 2 + p[1]*pic->n[0]*3 + p[2]*pic->n[0]*pic->n[1]*3 ]); } s = stream.str(); } else { s+= "point out of data"; } }; mitk::Geometry3D::ConstPointer m_InputWorldGeometry; mitk::Geometry3D::Pointer m_ExtendedInputWorldGeometry; mitk::TimeSlicedGeometry::Pointer m_CreatedWorldGeometry; ViewDirection m_ViewDirection; ViewDirection m_DefaultViewDirection; mitk::RenderingManager::Pointer m_RenderingManager; mitk::BaseRenderer *m_Renderer; itkSetMacro(Top, bool); itkGetMacro(Top, bool); itkBooleanMacro(Top); itkSetMacro(FrontSide, bool); itkGetMacro(FrontSide, bool); itkBooleanMacro(FrontSide); itkSetMacro(Rotated, bool); itkGetMacro(Rotated, bool); itkBooleanMacro(Rotated); bool m_Top; bool m_FrontSide; bool m_Rotated; bool m_BlockUpdate; bool m_SliceLocked; bool m_SliceRotationLocked; unsigned int m_OldPos; }; } // namespace mitk #endif /* SLICENAVIGATIONCONTROLLER_H_HEADER_INCLUDED_C1C55A2F */ diff --git a/Core/Code/Controllers/mitkStatusBar.h b/Core/Code/Controllers/mitkStatusBar.h index 95178d97f0..b078d5e7e8 100755 --- a/Core/Code/Controllers/mitkStatusBar.h +++ b/Core/Code/Controllers/mitkStatusBar.h @@ -1,85 +1,85 @@ /*========================================================================= Program: Medical Imaging & Interaction Toolkit Language: C++ Date: $Date$ Version: $Revision$ Copyright (c) German Cancer Research Center, Division of Medical and Biological Informatics. All rights reserved. See MITKCopyright.txt or http://www.mitk.org/copyright.html for details. This software is distributed WITHOUT ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the above copyright notices for more information. =========================================================================*/ #ifndef MITKSTATUSBAR_H #define MITKSTATUSBAR_H #include -#include "mitkCommon.h" +#include #include "mitkStatusBarImplementation.h" namespace mitk { //##Documentation //## @brief Sending a message to the applications StatusBar //## //## Holds a GUI dependent StatusBarImplementation and sends the text further. //## nearly equal to itk::OutputWindow, //## no Window, but one line of text and a delay for clear. //## all mitk-classes use this class to display text on GUI-StatusBar. //## The mainapplication has to set the internal held StatusBarImplementation with SetInstance(..). //## @ingroup Interaction class MITK_CORE_EXPORT StatusBar : public itk::Object { public: itkTypeMacro(StatusBar, itk::Object); //##Documentation //## @brief static method to get the GUI dependent StatusBar-instance //## so the methods DisplayText, etc. can be called //## No reference counting, cause of decentral static use! static StatusBar* GetInstance(); //##Documentation //## @brief Supply a GUI- dependent StatusBar. Has to be set by the application //## to connect the application dependent subclass of mitkStatusBar //## if you create an instance, then call ->Delete() on the supplied //## instance after setting it. static void SetImplementation(StatusBarImplementation* instance); //##Documentation //## @brief Send a string to the applications StatusBar void DisplayText(const char* t); //##Documentation //## @brief Send a string with a time delay to the applications StatusBar void DisplayText(const char* t, int ms); void DisplayErrorText(const char *t); void DisplayWarningText(const char *t); void DisplayWarningText(const char *t, int ms); void DisplayGenericOutputText(const char *t); void DisplayDebugText(const char *t); void DisplayGreyValueText(const char *t); //##Documentation //## @brief removes any temporary message being shown. void Clear(); //##Documentation //## @brief Set the SizeGrip of the window //## (the triangle in the lower right Windowcorner for changing the size) //## to enabled or disabled void SetSizeGripEnabled(bool enable); protected: StatusBar(); virtual ~StatusBar(); static StatusBarImplementation* m_Implementation; static StatusBar* m_Instance; }; }// end namespace mitk #endif /* define MITKSTATUSBAR_H */ diff --git a/Core/Code/Controllers/mitkStatusBarImplementation.h b/Core/Code/Controllers/mitkStatusBarImplementation.h index c654b68af3..dd3c62d19c 100644 --- a/Core/Code/Controllers/mitkStatusBarImplementation.h +++ b/Core/Code/Controllers/mitkStatusBarImplementation.h @@ -1,63 +1,63 @@ /*========================================================================= Program: Medical Imaging & Interaction Toolkit Language: C++ Date: $Date$ Version: $Revision$ Copyright (c) German Cancer Research Center, Division of Medical and Biological Informatics. All rights reserved. See MITKCopyright.txt or http://www.mitk.org/copyright.html for details. This software is distributed WITHOUT ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the above copyright notices for more information. =========================================================================*/ #ifndef MITKSTATUSBARIMPLEMENTATION_H #define MITKSTATUSBARIMPLEMENTATION_H -#include "mitkCommon.h" +#include namespace mitk { //##Documentation //## @brief GUI indepentent Interface for all Gui depentent implementations of a StatusBar. class MITK_CORE_EXPORT StatusBarImplementation { public: //##Documentation //## @brief Constructor StatusBarImplementation(){}; //##Documentation //## @brief Destructor virtual ~StatusBarImplementation(){}; //##Documentation //## @brief Send a string to the applications StatusBar virtual void DisplayText(const char* t)=0; //##Documentation //## @brief Send a string with a time delay to the applications StatusBar virtual void DisplayText(const char* t, int ms) = 0; virtual void DisplayErrorText(const char *t) = 0; virtual void DisplayWarningText(const char *t) = 0; virtual void DisplayWarningText(const char *t, int ms) = 0; virtual void DisplayGenericOutputText(const char *t) = 0; virtual void DisplayDebugText(const char *t) = 0; virtual void DisplayGreyValueText(const char *t) = 0; //##Documentation //## @brief removes any temporary message being shown. virtual void Clear() = 0; //##Documentation //## @brief Set the SizeGrip of the window //## (the triangle in the lower right Windowcorner for changing the size) //## to enabled or disabled virtual void SetSizeGripEnabled(bool enable) = 0; }; }// end namespace mitk #endif /* define MITKSTATUSBARIMPLEMENTATION_H */ diff --git a/Core/Code/Controllers/mitkStepper.h b/Core/Code/Controllers/mitkStepper.h index 5b42cb1704..8daebbeb23 100644 --- a/Core/Code/Controllers/mitkStepper.h +++ b/Core/Code/Controllers/mitkStepper.h @@ -1,151 +1,151 @@ /*========================================================================= Program: Medical Imaging & Interaction Toolkit Language: C++ Date: $Date$ Version: $Revision$ Copyright (c) German Cancer Research Center, Division of Medical and Biological Informatics. All rights reserved. See MITKCopyright.txt or http://www.mitk.org/copyright.html for details. This software is distributed WITHOUT ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the above copyright notices for more information. =========================================================================*/ #ifndef STEPPER_H_HEADER_INCLUDED_C1E77191 #define STEPPER_H_HEADER_INCLUDED_C1E77191 -#include "mitkCommon.h" +#include #include "mitkVector.h" #include #include #include namespace mitk { /** * \brief Helper class to step through a list * * A helper class to step through a list. Does not contain the list, just the * position in the list (between 0 and GetSteps()). Provides methods like * First (go to the first element), Next (go to the next one), etc. * * Besides the actual number of steps, the stepper can also hold a stepping * range, indicating the scalar values corresponding to the covered steps. * For example, steppers are generally used to slice a dataset with a plane; * Hereby, Steps indicates the total number of steps (positions) available for * the plane, Pos indicates the current step, and Range indicates the physical * minimum and maximum values for the plane, in this case a value in mm. * * The range can also be supplied with a unit name (a string) which can be * used by classes providing information about the stepping (e.g. graphical * sliders). * * \ingroup NavigationControl */ class MITK_CORE_EXPORT Stepper : public itk::Object { public: mitkClassMacro(Stepper, itk::Object); itkNewMacro(Self); itkGetMacro(Pos, unsigned int); virtual void SetPos(unsigned int pos) { // copied from itkMacro.h, itkSetClampMacro(...) unsigned int newPos; if ( m_Steps != 0 ) { newPos = (pos > m_Steps-1 ? m_Steps-1 : pos); } else { newPos = 0; } if (this->m_Pos != newPos ) { this->m_Pos = newPos ; this->Modified(); } } itkGetMacro(Steps, unsigned int); itkSetMacro(Steps, unsigned int); itkGetMacro(AutoRepeat, bool); itkSetMacro(AutoRepeat, bool); itkBooleanMacro(AutoRepeat); /** Causes the stepper to shift direction when the boundary is reached */ itkSetMacro(PingPong, bool); itkGetMacro(PingPong, bool); itkBooleanMacro(PingPong); /** If set to true, the Next() decreases the stepper and Previous() * decreases it */ itkSetMacro(InverseDirection, bool); itkGetMacro(InverseDirection, bool); itkBooleanMacro(InverseDirection); void SetRange( ScalarType min, ScalarType max ); void InvalidateRange(); ScalarType GetRangeMin() const; ScalarType GetRangeMax() const; bool HasValidRange() const; void RemoveRange(); bool HasRange() const; void SetUnitName( const char *unitName ); const char *GetUnitName() const; void RemoveUnitName(); bool HasUnitName() const; virtual void Next(); virtual void Previous(); virtual void First(); virtual void Last(); protected: Stepper(); virtual ~Stepper(); void Increase(); void Decrease(); unsigned int m_Pos; unsigned int m_Steps; bool m_AutoRepeat; bool m_PingPong; bool m_InverseDirection; ScalarType m_RangeMin; ScalarType m_RangeMax; bool m_RangeValid; bool m_HasRange; std::string m_UnitName; bool m_HasUnitName; }; } // namespace mitk #endif /* STEPPER_H_HEADER_INCLUDED_C1E77191 */ diff --git a/Core/Code/Controllers/mitkTestManager.h b/Core/Code/Controllers/mitkTestManager.h index b783712450..83d239f79b 100644 --- a/Core/Code/Controllers/mitkTestManager.h +++ b/Core/Code/Controllers/mitkTestManager.h @@ -1,45 +1,45 @@ /*========================================================================= Program: Medical Imaging & Interaction Toolkit Language: C++ Date: $Date$ Version: $Revision: 12626 $ Copyright (c) German Cancer Research Center, Division of Medical and Biological Informatics. All rights reserved. See MITKCopyright.txt or http://www.mitk.org/copyright.html for details. This software is distributed WITHOUT ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the above copyright notices for more information. =========================================================================*/ #ifndef MITK_TESTMANAGER_H_INCLUDED #define MITK_TESTMANAGER_H_INCLUDED -#include "mitkCommon.h" +#include namespace mitk { class MITK_CORE_EXPORT TestManager { public: TestManager() : m_FailedTests(0), m_PassedTests(0) {} static TestManager* GetInstance(); /** \brief Must be called at the beginning of a test run. */ void Initialize(); int NumberOfFailedTests(); int NumberOfPassedTests(); /** \brief Tell manager a subtest failed */ void TestFailed(); /** \brief Tell manager a subtest passed */ void TestPassed(); virtual ~TestManager() {} protected: int m_FailedTests; int m_PassedTests; }; } #endif // MITK_TESTMANAGER_H_INCLUDED diff --git a/Core/Code/Controllers/mitkUndoController.h b/Core/Code/Controllers/mitkUndoController.h index 998244a071..e4647e6158 100644 --- a/Core/Code/Controllers/mitkUndoController.h +++ b/Core/Code/Controllers/mitkUndoController.h @@ -1,135 +1,135 @@ /*========================================================================= Program: Medical Imaging & Interaction Toolkit Language: C++ Date: $Date$ Version: $Revision$ Copyright (c) German Cancer Research Center, Division of Medical and Biological Informatics. All rights reserved. See MITKCopyright.txt or http://www.mitk.org/copyright.html for details. This software is distributed WITHOUT ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the above copyright notices for more information. =========================================================================*/ #ifndef UNDOCONTROLLER_H_HEADER_INCLUDED_C16EFF79 #define UNDOCONTROLLER_H_HEADER_INCLUDED_C16EFF79 -#include "mitkCommon.h" +#include #include "mitkUndoModel.h" #include "mitkOperationEvent.h" #include namespace mitk { //## @ingroup Undo class MITK_CORE_EXPORT UndoController { public: //different UndoModels: enum UndoType{LIMITEDLINEARUNDO=10, VERBOSE_LIMITEDLINEARUNDO=11, TREEUNDO=20}; typedef std::map UndoModelMap; typedef std::map::iterator UndoModelMapIter; //##Documentation //## @brief Default UndoModel to use. static const UndoType DEFAULTUNDOMODEL; //##Documentation //## Constructor; Adds the new UndoType or if undoType exists , //## switches it to undoType; for UndoTypes see definitionmitkInteractionConst.h UndoController(UndoType undoType = DEFAULTUNDOMODEL); virtual ~UndoController(); bool SetOperationEvent(UndoStackItem* operationEvent); //##Documentation //## @brief calls the UndoMechanism to undo the last change bool Undo(); //##Documentation //## @brief calls the UndoMechanism to undo the last change //## //## the UndoMechanism has the possibility to undo the last changes in two different ways: //## first it can Undo a group of operations done at last (e.g. build up a new object; Undo leads to deleting that object); //## or it can Undo a set of operations, that belong together(statechange with Action), //## that way it is possible recall the last set point after you have finished to build up a new object //## @param fine: if set to true, then undo all operations with the same objectEventId //## if set to false, then undo all operations with the same GroupEventId bool Undo(bool fine); //##Documentation //## @brief calls the RedoMechanism to redo the operations undone //## //## read the Documentation of Undo! bool Redo(); //##Documentation //## @brief calls the RedoMechanism to redo the operations undone //## //## read the Documentation of Undo! //## only with the possibility to fine redo, like fine undo bool Redo(bool fine); //##Documentation //## @brief Clears the Undo and the RedoList void Clear(); //##Documentation //## @brief Clears the RedoList void ClearRedoList(); //##Documentation //## @brief returns true, if the RedoList is empty bool RedoListEmpty(); bool SwitchUndoModel(UndoType undoType); bool AddUndoModel(UndoType undoType); bool RemoveUndoModel(UndoType undoType); //##Documentation //## @brief returns the ObjectEventId of the //## top Element in the OperationHistory of the selected //## UndoModel int GetLastObjectEventIdInList(); //##Documentation //## @brief returns the GroupEventId of the //## top Element in the OperationHistory of the selected //## UndoModel int GetLastGroupEventIdInList(); //##Documentation //## @brief returns the last specified OperationEvent in Undo-list //## corresponding to the given value; if nothing found, then returns NULL OperationEvent* GetLastOfType(OperationActor* destination, OperationType opType); //##Documentation //## @brief gives access to the currently used UndoModel //## Introduced to access special functions of more specific UndoModels, //## especially to retrieve text descriptions of the undo/redo stack static UndoModel* GetCurrentUndoModel(); private: //##Documentation //## current selected UndoModel static UndoModel::Pointer m_CurUndoModel; //##Documentation //## current selected Type of m_CurUndoModel static UndoType m_CurUndoType; //##Documentation //## different UndoModels to select and activate static UndoModelMap m_UndoModelList; }; }//namespace mitk #endif /* UNDOCONTROLLER_H_HEADER_INCLUDED_C16EFF79 */ diff --git a/Core/Code/Controllers/mitkVerboseLimitedLinearUndo.h b/Core/Code/Controllers/mitkVerboseLimitedLinearUndo.h index 6b0418a36f..17e647d153 100644 --- a/Core/Code/Controllers/mitkVerboseLimitedLinearUndo.h +++ b/Core/Code/Controllers/mitkVerboseLimitedLinearUndo.h @@ -1,63 +1,63 @@ /*========================================================================= Program: Medical Imaging & Interaction Toolkit Language: C++ Date: $Date$ Version: $Revision$ Copyright (c) German Cancer Research Center, Division of Medical and Biological Informatics. All rights reserved. See MITKCopyright.txt or http://www.mitk.org/copyright.html for details. This software is distributed WITHOUT ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the above copyright notices for more information. =========================================================================*/ #ifndef VERBOSELIMITEDLINEARUNDO_H_HEADER_INCLUDED_C16E96 #define VERBOSELIMITEDLINEARUNDO_H_HEADER_INCLUDED_C16E96 // MITK header -#include "mitkCommon.h" +#include #include "mitkLimitedLinearUndo.h" // STL header #include #include #include #include namespace mitk { class UndoStackItem; /** * @brief A limited linear undo model providing GUI elements with stack status information. * * Basically does the same, as LimitedLinearUndo class, but it allows you to retrieve a string list, which describes * the undo stack or the redo stack. This can be used for display by GUI elements. */ class MITK_CORE_EXPORT VerboseLimitedLinearUndo : public LimitedLinearUndo { public: mitkClassMacro(VerboseLimitedLinearUndo, LimitedLinearUndo); itkNewMacro(Self); typedef std::pair StackDescriptionItem; typedef std::vector StackDescription; /// a list of pairs (int,string), representing a stack with ObjectEventIDs and descriptions virtual bool SetOperationEvent(UndoStackItem* undoStackItem); virtual StackDescription GetUndoDescriptions(); virtual StackDescription GetRedoDescriptions(); protected: VerboseLimitedLinearUndo(); virtual ~VerboseLimitedLinearUndo(); }; } // namespace mitk #endif /* VERBOSELIMITEDLINEARUNDO_H_HEADER_INCLUDED_C16E96 */ diff --git a/Core/Code/Controllers/mitkVtkInteractorCameraController.h b/Core/Code/Controllers/mitkVtkInteractorCameraController.h index be8eba8632..c908ac3ac9 100644 --- a/Core/Code/Controllers/mitkVtkInteractorCameraController.h +++ b/Core/Code/Controllers/mitkVtkInteractorCameraController.h @@ -1,71 +1,71 @@ /*========================================================================= Program: Medical Imaging & Interaction Toolkit Language: C++ Date: $Date$ Version: $Revision$ Copyright (c) German Cancer Research Center, Division of Medical and Biological Informatics. All rights reserved. See MITKCopyright.txt or http://www.mitk.org/copyright.html for details. This software is distributed WITHOUT ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the above copyright notices for more information. =========================================================================*/ #ifndef MITKVTKINTERACTORCAMERACONTROLLER_H_HEADER_INCLUDED_C1C53722 #define MITKVTKINTERACTORCAMERACONTROLLER_H_HEADER_INCLUDED_C1C53722 -#include "mitkCommon.h" +#include #include "mitkCameraController.h" #include "vtkRenderWindowInteractor.h" class vtkRenderWindow; namespace mitk { //##Documentation //## @brief vtk-based camera controller //## @ingroup NavigationControl class MITK_CORE_EXPORT VtkInteractorCameraController : public CameraController { public: mitkClassMacro(VtkInteractorCameraController, CameraController); itkNewMacro(Self); //##Documentation //## @brief Returns the vtkRenderWindowInteractor used internally by this CameraController vtkRenderWindowInteractor* GetVtkInteractor(); virtual void Resize(int w, int h); virtual void MousePressEvent(mitk::MouseEvent*); virtual void MouseReleaseEvent(mitk::MouseEvent*); virtual void MouseMoveEvent(mitk::MouseEvent*); virtual void KeyPressEvent(mitk::KeyEvent*); //##Documentation //## @brief Set the BaseRenderer to be controlled by this vtk-based camera controller virtual void SetRenderer(const mitk::BaseRenderer* renderer); protected: /** * @brief Default Constructor **/ VtkInteractorCameraController(const char* type = NULL); /** * @brief Default Destructor **/ virtual ~VtkInteractorCameraController(); // virtual bool ExecuteAction(Action* action, mitk::StateEvent const* stateEvent); vtkRenderWindowInteractor* m_VtkInteractor; }; } // namespace mitk #endif /* MITKVTKINTERACTORCAMERACONTROLLER_H_HEADER_INCLUDED_C1C53722 */ diff --git a/Core/Code/Controllers/mitkVtkLayerController.h b/Core/Code/Controllers/mitkVtkLayerController.h index f8c1fc4ec8..e66d9ad15e 100644 --- a/Core/Code/Controllers/mitkVtkLayerController.h +++ b/Core/Code/Controllers/mitkVtkLayerController.h @@ -1,127 +1,127 @@ /*========================================================================= Program: Medical Imaging & Interaction Toolkit Language: C++ Date: $Date$ Version: $Revision$ Copyright (c) German Cancer Research Center, Division of Medical and Biological Informatics. All rights reserved. See MITKCopyright.txt or http://www.mitk.org/copyright.html for details. This software is distributed WITHOUT ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the above copyright notices for more information. =========================================================================*/ #ifndef MITKVTKLAYERCONTROLLER_H_HEADER_INCLUDED_C1EDO02D #define MITKVTKLAYERCONTROLLER_H_HEADER_INCLUDED_C1EDO02D #include #include -#include "mitkCommon.h" +#include class vtkRenderWindow; class vtkRenderer; namespace mitk { /** * Manages the VTK layer hierarchy * of a vtkRenderWindow. * For simple access the layers are divided into three * main groups: background, scene and foreground layers. * Renderers can be registered via the insert... functions and * removed via the RemoveRenderer function. */ class MITK_CORE_EXPORT VtkLayerController { public: static VtkLayerController* GetInstance(vtkRenderWindow* renWin); static void AddInstance(vtkRenderWindow* renWin, vtkRenderer * mitkSceneRenderer); static void RemoveInstance(vtkRenderWindow* renWin); VtkLayerController(vtkRenderWindow* renderWindow); virtual ~VtkLayerController(); /** * Returns the current vtkRenderer of the Scene */ vtkRenderer* GetSceneRenderer(); /** * Connects a VTK renderer with a vtk renderwindow. The renderer will be rendered in the background. * With forceAbsoluteBackground set true a renderer can be placed at the absolute background of the scene. * Multiple calls with forceAbsoluteBackground set true will set the latest registered renderer as background. */ void InsertBackgroundRenderer(vtkRenderer* renderer, bool forceAbsoluteBackground); /** * Connects a VTK renderer with a vtk renderwindow. The renderer will be rendered in the foreground. * With forceAbsoluteBackground set true a renderer can be placed at the absolute foreground of the scene. * Multiple calls with forceAbsoluteForeground set true will set the latest registered renderer as foreground. */ void InsertForegroundRenderer(vtkRenderer* renderer, bool forceAbsoluteForeground); /** * Connects a VTK renderer with a vtk renderwindow. The renderer will be rendered between background renderers and * foreground renderers. */ void InsertSceneRenderer(vtkRenderer* renderer); /** * Connects a VtkRenderWindow with the layer controller. */ void SetRenderWindow(vtkRenderWindow* renwin); /** * A renderer which has been inserted via a insert... function can be removed from the vtkRenderWindow with * RemoveRenderer. */ void RemoveRenderer(vtkRenderer* renderer); /** * Returns true if a renderer has been inserted */ bool IsRendererInserted(vtkRenderer* renderer); /** * Returns the number of renderers in the renderwindow. */ unsigned int GetNumberOfRenderers(); void SetEraseForAllRenderers(int i); protected: vtkRenderWindow* m_RenderWindow; private: /** * Internally used to sort all registered renderers and to connect the with the vtkRenderWindow. * Mention that VTK Version 5 and above is rendering higher numbers in the background and VTK * Verison < 5 in the foreground. */ void UpdateLayers(); // Layer Management typedef std::vector RendererVectorType; RendererVectorType m_BackgroundRenderers; RendererVectorType m_SceneRenderers; RendererVectorType m_ForegroundRenderers; typedef std::map vtkLayerControllerMapType; static vtkLayerControllerMapType s_LayerControllerMap; }; } // Namespace MITK #endif /* MITKVTKLAYERCONTROLLER_H_HEADER_INCLUDED_C1EDO02D */ diff --git a/Core/Code/DataManagement/itkVtkAbstractTransform.h b/Core/Code/DataManagement/itkVtkAbstractTransform.h index 71a8755c89..300fb95961 100644 --- a/Core/Code/DataManagement/itkVtkAbstractTransform.h +++ b/Core/Code/DataManagement/itkVtkAbstractTransform.h @@ -1,95 +1,95 @@ /*========================================================================= Program: Medical Imaging & Interaction Toolkit Language: C++ Date: $Date$ Version: $Revision$ Copyright (c) German Cancer Research Center, Division of Medical and Biological Informatics. All rights reserved. See MITKCopyright.txt or http://www.mitk.org/copyright.html for details. This software is distributed WITHOUT ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the above copyright notices for more information. =========================================================================*/ #ifndef MITKVTKABSTRACTTRANSFORM_H_HEADER_INCLUDED_C1C68A2C #define MITKVTKABSTRACTTRANSFORM_H_HEADER_INCLUDED_C1C68A2C -#include "mitkCommon.h" +#include #include "itkTransform.h" class vtkAbstractTransform; namespace itk { //##Documentation //## @brief Adapter from vtkAbstractTransform to itk::Transform //## @ingroup Geometry template class VtkAbstractTransform : public itk::Transform { public: typedef VtkAbstractTransform Self; typedef Transform< TScalarType, 3, 3 > Superclass; typedef SmartPointer Pointer; typedef SmartPointer ConstPointer; typedef typename Superclass::OutputPointType OutputPointType; typedef typename Superclass::OutputVectorType OutputVectorType; typedef typename Superclass::OutputVnlVectorType OutputVnlVectorType; typedef typename Superclass::OutputCovariantVectorType OutputCovariantVectorType; typedef typename Superclass::InputPointType InputPointType; typedef typename Superclass::InputVectorType InputVectorType; typedef typename Superclass::InputVnlVectorType InputVnlVectorType; typedef typename Superclass::InputCovariantVectorType InputCovariantVectorType; itkNewMacro(Self); //##Documentation //## @brief Get the vtkAbstractTransform (stored in m_VtkAbstractTransform) virtual vtkAbstractTransform* GetVtkAbstractTransform() const; //##Documentation //## @brief Get the inverse vtkAbstractTransform (stored in m_InverseVtkAbstractTransform) virtual vtkAbstractTransform* GetInverseVtkAbstractTransform() const; //##Documentation //## @brief Set the vtkAbstractTransform (stored in m_VtkAbstractTransform) virtual void SetVtkAbstractTransform(vtkAbstractTransform* aVtkAbstractTransform); virtual OutputPointType TransformPoint(const InputPointType & ) const; virtual OutputVectorType TransformVector(const InputVectorType &) const; virtual OutputVnlVectorType TransformVector(const InputVnlVectorType &) const; virtual OutputCovariantVectorType TransformCovariantVector(const InputCovariantVectorType &) const; virtual InputPointType BackTransform(const OutputPointType &point ) const; virtual InputVectorType BackTransform(const OutputVectorType &vector) const; virtual InputVnlVectorType BackTransform(const OutputVnlVectorType &vector) const; virtual InputCovariantVectorType BackTransform(const OutputCovariantVectorType &vector) const; virtual unsigned long GetMTime() const; protected: VtkAbstractTransform(); virtual ~VtkAbstractTransform(); //##Documentation //## @brief Instance of the vtkAbstractTransform vtkAbstractTransform* m_VtkAbstractTransform; //##Documentation //## @brief Instance of the vtkAbstractTransform vtkAbstractTransform* m_InverseVtkAbstractTransform; mutable unsigned long m_LastVtkAbstractTransformTimeStamp; }; } // namespace itk #ifndef MITK_MANUAL_INSTANTIATION #include "itkVtkAbstractTransform.txx" #endif #endif /* MITKVTKABSTRACTTRANSFORM_H_HEADER_INCLUDED_C1C68A2C */ diff --git a/Core/Code/DataManagement/mitkAbstractTransformGeometry.h b/Core/Code/DataManagement/mitkAbstractTransformGeometry.h index 3a409d5bfb..e04caf4e1f 100644 --- a/Core/Code/DataManagement/mitkAbstractTransformGeometry.h +++ b/Core/Code/DataManagement/mitkAbstractTransformGeometry.h @@ -1,180 +1,180 @@ /*========================================================================= Program: Medical Imaging & Interaction Toolkit Language: C++ Date: $Date$ Version: $Revision$ Copyright (c) German Cancer Research Center, Division of Medical and Biological Informatics. All rights reserved. See MITKCopyright.txt or http://www.mitk.org/copyright.html for details. This software is distributed WITHOUT ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the above copyright notices for more information. =========================================================================*/ #ifndef MITKVTKABSTRACTTRANSFORMPLANEGEOMETRY_H_HEADER_INCLUDED_C1C68A2C #define MITKVTKABSTRACTTRANSFORMPLANEGEOMETRY_H_HEADER_INCLUDED_C1C68A2C -#include "mitkCommon.h" +#include #include "mitkGeometry2D.h" #include "mitkPlaneGeometry.h" #include "itkVtkAbstractTransform.h" class vtkAbstractTransform; namespace mitk { //##Documentation //## @brief Describes a geometry defined by an vtkAbstractTransform and a plane //## //## vtkAbstractTransform is the most general transform in vtk (superclass for //## all vtk geometric transformations). It defines an arbitrary 3D transformation, //## i.e., a transformation of 3D space into 3D space. In contrast, //## AbstractTransformGeometry (since it is a subclass of Geometry2D) describes a //## 2D manifold in 3D space. The 2D manifold is defined as the manifold that results //## from transforming a rectangle (given in m_Plane as a PlaneGeometry) by the //## vtkAbstractTransform (given in m_VtkAbstractTransform). //## The PlaneGeometry m_Plane is used to define the parameter space. 2D coordinates are //## first mapped by the PlaneGeometry and the resulting 3D coordinates are put into //## the vtkAbstractTransform. //## @note This class is the superclass of concrete geometries. Since there is no //## write access to the vtkAbstractTransform and m_Plane, this class is somehow //## abstract. For full write access from extern, use ExternAbstractTransformGeometry. //## @note The bounds of the PlaneGeometry are used as the parametric bounds. //## @sa ExternAbstractTransformGeometry //## @ingroup Geometry class MITK_CORE_EXPORT AbstractTransformGeometry : public Geometry2D { public: mitkClassMacro(AbstractTransformGeometry, Geometry2D); itkNewMacro(Self); //##Documentation //## @brief Get the vtkAbstractTransform (stored in m_VtkAbstractTransform) virtual vtkAbstractTransform* GetVtkAbstractTransform() const; virtual unsigned long GetMTime() const; //##Documentation //## @brief Get the rectangular area that is used for transformation by //## m_VtkAbstractTransform and therewith defines the 2D manifold described by //## AbstractTransformGeometry itkGetConstObjectMacro(Plane, PlaneGeometry); virtual bool Project(const mitk::Point3D &pt3d_mm, mitk::Point3D &projectedPt3d_mm) const; virtual bool Map(const mitk::Point3D &pt3d_mm, mitk::Point2D &pt2d_mm) const; virtual void Map(const mitk::Point2D &pt2d_mm, mitk::Point3D &pt3d_mm) const; virtual bool Project(const mitk::Point3D & atPt3d_mm, const mitk::Vector3D &vec3d_mm, mitk::Vector3D &projectedVec3d_mm) const; virtual bool Map(const mitk::Point3D & atPt3d_mm, const mitk::Vector3D &vec3d_mm, mitk::Vector2D &vec2d_mm) const; virtual void Map(const mitk::Point2D & atPt2d_mm, const mitk::Vector2D &vec2d_mm, mitk::Vector3D &vec3d_mm) const; virtual void IndexToWorld(const mitk::Point2D &pt_units, mitk::Point2D &pt_mm) const; virtual void WorldToIndex(const mitk::Point2D &pt_mm, mitk::Point2D &pt_units) const; //##Documentation //## @brief Convert (continuous or discrete) index coordinates of a \em vector //## \a vec_units to world coordinates (in mm) //## @deprecated First parameter (Point2D) is not used. If possible, please use void IndexToWorld(const mitk::Vector2D& vec_units, mitk::Vector2D& vec_mm) const. //## For further information about coordinates types, please see the Geometry documentation virtual void IndexToWorld(const mitk::Point2D &atPt2d_units, const mitk::Vector2D &vec_units, mitk::Vector2D &vec_mm) const; //##Documentation //## @brief Convert (continuous or discrete) index coordinates of a \em vector //## \a vec_units to world coordinates (in mm) //## For further information about coordinates types, please see the Geometry documentation virtual void IndexToWorld(const mitk::Vector2D &vec_units, mitk::Vector2D &vec_mm) const; //##Documentation //## @brief Convert world coordinates (in mm) of a \em vector //## \a vec_mm to (continuous!) index coordinates. //## @deprecated First parameter (Point2D) is not used. If possible, please use void WorldToIndex(const mitk::Vector2D& vec_mm, mitk::Vector2D& vec_units) const. //## For further information about coordinates types, please see the Geometry documentation virtual void WorldToIndex(const mitk::Point2D &atPt2d_mm, const mitk::Vector2D &vec_mm, mitk::Vector2D &vec_units) const; //##Documentation //## @brief Convert world coordinates (in mm) of a \em vector //## \a vec_mm to (continuous!) index coordinates. //## For further information about coordinates types, please see the Geometry documentation virtual void WorldToIndex(const mitk::Vector2D &vec_mm, mitk::Vector2D &vec_units) const; virtual bool IsAbove(const Point3D& pt3d_mm) const; virtual mitk::ScalarType GetParametricExtentInMM(int direction) const; virtual const Transform3D* GetParametricTransform() const; //##Documentation //## @brief Change the parametric bounds to @a oversampling times //## the bounds of m_Plane. //## //## The change is done once (immediately). Later changes of the bounds //## of m_Plane will not influence the parametric bounds. (Consequently, //## there is no method to get the oversampling.) virtual void SetOversampling(float oversampling); virtual void Initialize(); //##Documentation //## @brief Calculates the standard part of a Geometry3D //## (IndexToWorldTransform and bounding box) around the //## curved geometry. Has to be implemented in subclasses. //## //## \sa SetFrameGeometry virtual void CalculateFrameGeometry(); //##Documentation //## @brief Set the frame geometry which is used as the standard //## part of an Geometry3D (IndexToWorldTransform and bounding box) //## //## Maybe used as a hint within which the interpolation shall occur //## by concrete sub-classes. //## \sa CalculateFrameGeometry virtual void SetFrameGeometry(const mitk::Geometry3D* frameGeometry); virtual AffineGeometryFrame3D::Pointer Clone() const; protected: AbstractTransformGeometry(); AbstractTransformGeometry(const AbstractTransformGeometry& other); virtual ~AbstractTransformGeometry(); //##Documentation //## @brief Set the vtkAbstractTransform (stored in m_VtkAbstractTransform) //## //## Protected in this class, made public in ExternAbstractTransformGeometry. virtual void SetVtkAbstractTransform(vtkAbstractTransform* aVtkAbstractTransform); //##Documentation //## @brief Set the rectangular area that is used for transformation by //## m_VtkAbstractTransform and therewith defines the 2D manifold described by //## ExternAbstractTransformGeometry //## //## Protected in this class, made public in ExternAbstractTransformGeometry. //## @note The bounds of the PlaneGeometry are used as the parametric bounds. //## @note The PlaneGeometry is cloned, @em not linked/referenced. virtual void SetPlane(const mitk::PlaneGeometry* aPlane); //##Documentation //## @brief The rectangular area that is used for transformation by //## m_VtkAbstractTransform and therewith defines the 2D manifold described by //## AbstractTransformGeometry. mitk::PlaneGeometry::Pointer m_Plane; itk::VtkAbstractTransform::Pointer m_ItkVtkAbstractTransform; mitk::Geometry3D::Pointer m_FrameGeometry; }; } // namespace mitk #endif /* MITKVTKABSTRACTTRANSFORMPLANEGEOMETRY_H_HEADER_INCLUDED_C1C68A2C */ diff --git a/Core/Code/DataManagement/mitkAnnotationProperty.h b/Core/Code/DataManagement/mitkAnnotationProperty.h index d87976acd3..30474030d4 100644 --- a/Core/Code/DataManagement/mitkAnnotationProperty.h +++ b/Core/Code/DataManagement/mitkAnnotationProperty.h @@ -1,79 +1,79 @@ /*========================================================================= Program: Medical Imaging & Interaction Toolkit Language: C++ Date: $Date: 2008-04-14 19:45:53 +0200 (Mo, 14 Apr 2008) $ Version: $Revision: 14081 $ Copyright (c) German Cancer Research Center, Division of Medical and Biological Informatics. All rights reserved. See MITKCopyright.txt or http://www.mitk.org/copyright.html for details. This software is distributed WITHOUT ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the above copyright notices for more information. =========================================================================*/ #ifndef MITKANNOTATIONPROPERTY_H_HEADER_INCLUDED #define MITKANNOTATIONPROPERTY_H_HEADER_INCLUDED -#include "mitkCommon.h" +#include #include "mitkBaseProperty.h" #include "mitkVector.h" #include #include namespace mitk { /** * \brief Property for annotations * \ingroup DataManagement */ class MITK_CORE_EXPORT AnnotationProperty : public BaseProperty { public: mitkClassMacro(AnnotationProperty, BaseProperty); typedef std::string ValueType; itkNewMacro( AnnotationProperty ); mitkNewMacro2Param( AnnotationProperty, const char *, const Point3D & ); mitkNewMacro2Param( AnnotationProperty, const std::string &, const Point3D & ); mitkNewMacro4Param( AnnotationProperty, const char *, ScalarType, ScalarType, ScalarType ); mitkNewMacro4Param( AnnotationProperty, const std::string &, ScalarType, ScalarType, ScalarType ); itkGetStringMacro( Label ); itkSetStringMacro( Label ); const Point3D &GetPosition() const; void SetPosition( const Point3D &position ); virtual bool operator==(const BaseProperty& property ) const; virtual std::string GetValueAsString() const; virtual BaseProperty& operator=(const BaseProperty& other) { return Superclass::operator=(other); } \ protected: std::string m_Label; Point3D m_Position; AnnotationProperty(); AnnotationProperty( const char *label, const Point3D &position ); AnnotationProperty( const std::string &label, const Point3D &position ); AnnotationProperty( const char *label, ScalarType x, ScalarType y, ScalarType z ); AnnotationProperty( const std::string &label, ScalarType x, ScalarType y, ScalarType z ); }; } // namespace mitk #endif /* MITKANNOTATIONPROPERTY_H_HEADER_INCLUDED */ diff --git a/Core/Code/DataManagement/mitkApplicationCursor.h b/Core/Code/DataManagement/mitkApplicationCursor.h index c3d6170093..d69283ab14 100644 --- a/Core/Code/DataManagement/mitkApplicationCursor.h +++ b/Core/Code/DataManagement/mitkApplicationCursor.h @@ -1,104 +1,104 @@ /*========================================================================= Program: Medical Imaging & Interaction Toolkit Language: C++ Date: $Date$ Version: $Revision$ Copyright (c) German Cancer Research Center, Division of Medical and Biological Informatics. All rights reserved. See MITKCopyright.txt or http://www.mitk.org/copyright.html for details. This software is distributed WITHOUT ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the above copyright notices for more information. =========================================================================*/ #ifndef MITK_APPLICATION_CURSOR_H_DEFINED_AND_ALL_IS_GOOD #define MITK_APPLICATION_CURSOR_H_DEFINED_AND_ALL_IS_GOOD -#include "mitkCommon.h" +#include #include "mitkVector.h" namespace mitk { /*! \brief Toolkit specific implementation of mitk::ApplicationCursor For any toolkit, this class has to be sub-classed. One instance of that sub-class has to be registered with mitk::ApplicationCursor. See the (very simple) implmentation of QmitkApplicationCursor for an example. */ class MITK_CORE_EXPORT ApplicationCursorImplementation { public: /// Change the current application cursor virtual void PushCursor(const char* XPM[], int hotspotX, int hotspotY) = 0; /// Restore the previous cursor virtual void PopCursor() = 0; /// Get absolute mouse position on screen virtual const Point2I GetCursorPosition() = 0; /// Set absolute mouse position on screen virtual void SetCursorPosition(const Point2I&) = 0; virtual ~ApplicationCursorImplementation() {}; protected: private: }; /*! \brief Allows to override the application's cursor. Base class for classes that allow to override the applications cursor with context dependent cursors. Accepts cursors in the XPM format. The behaviour is stack-like. You can push your cursor on top of the stack and later pop it to reset the cursor to its former state. This is mimicking Qt's Application::setOverrideCuror() behaviour, but should be ok for most cases where you want to switch a cursor. */ class MITK_CORE_EXPORT ApplicationCursor { public: /// This class is a singleton. static ApplicationCursor* GetInstance(); /// To be called by a toolkit specific ApplicationCursorImplementation. static void RegisterImplementation(ApplicationCursorImplementation* implementation); /// Change the current application cursor void PushCursor(const char* XPM[], int hotspotX = -1, int hotspotY = -1); /// Restore the previous cursor void PopCursor(); /// Get absolute mouse position on screen /// \return (-1, -1) if querying mouse position is not possible const Point2I GetCursorPosition(); /// Set absolute mouse position on screen void SetCursorPosition(const Point2I&); protected: /// Purposely hidden - singleton ApplicationCursor(); private: static ApplicationCursorImplementation* m_Implementation; }; } // namespace #endif diff --git a/Core/Code/DataManagement/mitkBaseData.h b/Core/Code/DataManagement/mitkBaseData.h index 937f7a4712..385300a1c4 100644 --- a/Core/Code/DataManagement/mitkBaseData.h +++ b/Core/Code/DataManagement/mitkBaseData.h @@ -1,388 +1,388 @@ /*========================================================================= Program: Medical Imaging & Interaction Toolkit Language: C++ Date: $Date$ Version: $Revision$ Copyright (c) German Cancer Research Center, Division of Medical and Biological Informatics. All rights reserved. See MITKCopyright.txt or http://www.mitk.org/copyright.html for details. This software is distributed WITHOUT ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the above copyright notices for more information. =========================================================================*/ #ifndef BASEDATA_H_HEADER_INCLUDED_C1EBB6FA #define BASEDATA_H_HEADER_INCLUDED_C1EBB6FA #include #include "mitkBaseProcess.h" #include "mitkTimeSlicedGeometry.h" -#include "mitkCommon.h" +#include #include "mitkOperationActor.h" #include "mitkPropertyList.h" namespace mitk { class BaseProcess; //##Documentation //## @brief Base of all data objects //## //## Base of all data objects, e.g., images, contours, surfaces etc. Inherits //## from itk::DataObject and thus can be included in a pipeline. //## Inherits also from OperationActor and can be used as a destination for Undo //## @ingroup Data class MITK_CORE_EXPORT BaseData : public itk::DataObject, public OperationActor { public: mitkClassMacro(BaseData,itk::DataObject); //##Documentation //## @brief Return the TimeSlicedGeometry of the data as const pointer. //## //## \warning No update will be called. Use GetUpdatedGeometry() if you cannot //## be sure that the geometry is up-to-date. //## //## Normally used in GenerateOutputInformation of subclasses of BaseProcess. const mitk::TimeSlicedGeometry* GetTimeSlicedGeometry() const { return m_TimeSlicedGeometry.GetPointer(); } //##Documentation //## @brief Return the TimeSlicedGeometry of the data as pointer. //## //## \warning No update will be called. Use GetUpdatedGeometry() if you cannot //## be sure that the geometry is up-to-date. //## //## Normally used in GenerateOutputInformation of subclasses of BaseProcess. mitk::TimeSlicedGeometry* GetTimeSlicedGeometry() { return m_TimeSlicedGeometry.GetPointer(); } //##Documentation //## @brief Return the Geometry3D of the data. //## //## The method does not simply return the value of the m_TimeSlicedGeometry //## member. Before doing this, it makes sure that the TimeSlicedGeometry //## is up-to-date (by setting the update extent to largest possible and //## calling UpdateOutputInformation). const mitk::TimeSlicedGeometry* GetUpdatedTimeSlicedGeometry(); //##Documentation //## @brief Expands the TimeSlicedGeometry to a number of TimeSteps. //## //## The method expands the TimeSlicedGeometry to the given number of TimeSteps, //## filling newly created elements with empty geometries. Sub-classes should override //## this method to handle the elongation of their data vectors, too. //## Note that a shrinking is neither possible nor intended. virtual void Expand( unsigned int timeSteps ); //##Documentation //## @brief Return the Geometry3D of the data at time \a t. //## //## The method does not simply return //## m_TimeSlicedGeometry->GetGeometry(t). //## Before doing this, it makes sure that the Geometry3D is up-to-date //## (by setting the update extent appropriately and calling //## UpdateOutputInformation). //## //## @todo Appropriate setting of the update extent is missing. const mitk::Geometry3D* GetUpdatedGeometry(int t=0); //##Documentation //## @brief Return the geometry, which is a TimeSlicedGeometry, of the data //## as non-const pointer. //## //## \warning No update will be called. Use GetUpdatedGeometry() if you cannot //## be sure that the geometry is up-to-date. //## //## Normally used in GenerateOutputInformation of subclasses of BaseProcess. mitk::Geometry3D* GetGeometry(int t=0) const { if(m_TimeSlicedGeometry.IsNull()) return NULL; return m_TimeSlicedGeometry->GetGeometry3D(t); } //##Documentation //## @brief Helps to deal with the weak-pointer-problem. virtual void UnRegister() const; //##Documentation //## @brief for internal use only. Helps to deal with the //## weak-pointer-problem. virtual int GetExternalReferenceCount() const; //##Documentation //## @brief Update the information for this BaseData (the geometry in particular) //## so that it can be used as an output of a BaseProcess. //## //## This method is used in the pipeline mechanism to propagate information and //## initialize the meta data associated with a BaseData. Any implementation //## of this method in a derived class is assumed to call its source's //## BaseProcess::UpdateOutputInformation() which determines modified //## times, LargestPossibleRegions, and any extra meta data like spacing, //## origin, etc. Default implementation simply call's it's source's //## UpdateOutputInformation(). //## \note Implementations of this methods in derived classes must take care //## that the geometry is updated by calling //## GetTimeSlicedGeometry()->UpdateInformation() //## \em after calling its source's BaseProcess::UpdateOutputInformation(). void UpdateOutputInformation(); //##Documentation //## @brief Set the RequestedRegion to the LargestPossibleRegion. //## //## This forces a filter to produce all of the output in one execution //## (i.e. not streaming) on the next call to Update(). void SetRequestedRegionToLargestPossibleRegion()=0; //##Documentation //## @brief Determine whether the RequestedRegion is outside of the BufferedRegion. //## //## This method returns true if the RequestedRegion //## is outside the BufferedRegion (true if at least one pixel is //## outside). This is used by the pipeline mechanism to determine //## whether a filter needs to re-execute in order to satisfy the //## current request. If the current RequestedRegion is already //## inside the BufferedRegion from the previous execution (and the //## current filter is up to date), then a given filter does not need //## to re-execute bool RequestedRegionIsOutsideOfTheBufferedRegion()=0; //##Documentation //## @brief Verify that the RequestedRegion is within the LargestPossibleRegion. //## //## If the RequestedRegion is not within the LargestPossibleRegion, //## then the filter cannot possibly satisfy the request. This method //## returns true if the request can be satisfied (even if it will be //## necessary to process the entire LargestPossibleRegion) and //## returns false otherwise. This method is used by //## PropagateRequestedRegion(). PropagateRequestedRegion() throws a //## InvalidRequestedRegionError exception if the requested region is //## not within the LargestPossibleRegion. virtual bool VerifyRequestedRegion() = 0; //##Documentation //## @brief Copy information from the specified data set. //## //## This method is part of the pipeline execution model. By default, a //## BaseProcess will copy meta-data from the first input to all of its //## outputs. See ProcessObject::GenerateOutputInformation(). Each //## subclass of DataObject is responsible for being able to copy //## whatever meta-data it needs from another DataObject. //## The default implementation of this method copies the time sliced geometry //## and the property list of an object. If a subclass overrides this //## method, it should always call its superclass' version. void CopyInformation(const itk::DataObject* data); //##Documentation //## @brief Check whether the data has been initialized, i.e., //## at least the Geometry and other header data has been set //## //## \warning Set to \a true by default for compatibility reasons. //## Set m_Initialized=false in constructors of sub-classes that //## support distinction between initialized and uninitialized state. virtual bool IsInitialized() const; //##Documentation //## @brief Calls ClearData() and InitializeEmpty(); //## \warning Only use in subclasses that reimplemented these methods. //## Just calling Clear from BaseData will reset an object to a not initialized, //## invalid state. virtual void Clear(); //##Documentation //## @brief Check whether object contains data (at //## a specified time), e.g., a set of points may be empty //## //## \warning Returns IsInitialized()==false by default for //## compatibility reasons. Override in sub-classes that //## support distinction between empty/non-empty state. virtual bool IsEmptyTimeStep(unsigned int t) const; //##Documentation //## @brief Check whether object contains data (at //## least at one point in time), e.g., a set of points //## may be empty //## //## \warning Returns IsInitialized()==false by default for //## compatibility reasons. Override in sub-classes that //## support distinction between empty/non-empty state. virtual bool IsEmpty() const; //##Documentation //## @brief Set the requested region from this data object to match the requested //## region of the data object passed in as a parameter. //## //## This method is implemented in the concrete subclasses of BaseData. void SetRequestedRegion(itk::DataObject *data)=0; //##Documentation //##@brief overwrite if the Data can be called by an Interactor (StateMachine). //## //## Empty by default. Overwrite and implement all the necessary operations here //## and get the necessary information from the parameter operation. void ExecuteOperation(Operation* operation); //##Documentation //## @brief Set the Geometry3D of the data, which will be referenced (not copied!). //## Assumes the data object has only 1 time step ( is a 3D object ). //## //## For convenience (and historic) reasons, it is also possible to set a complete //## mitk::TimeSlicedGeometry*, which will be referenced (not copied!). //## //## @warning This method will normally be called internally by the sub-class of BaseData //## during initialization. //## \sa SetClonedGeometry virtual void SetGeometry(Geometry3D* aGeometry3D); //##Documentation //## @brief Set a clone of the provided geometry as Geometry3D of the data. //## Assumes the data object has only 1 time step ( is a 3D object ) //## //## \sa SetGeometry virtual void SetClonedGeometry(const Geometry3D* aGeometry3D); //##Documentation //## @brief Set a clone of the provided geometry as Geometry3D of a given time step. //## //## \sa SetGeometry virtual void SetClonedGeometry(const Geometry3D* aGeometry3D, unsigned int time); //##Documentation //## @brief Get the data's property list //## @sa GetProperty //## @sa m_PropertyList mitk::PropertyList::Pointer GetPropertyList() const; //##Documentation //## @brief Set the data's property list //## @sa SetProperty //## @sa m_PropertyList void SetPropertyList(PropertyList* propertyList); //##Documentation //## @brief Get the property (instance of BaseProperty) with key @a propertyKey from the PropertyList, //## and set it to this, respectively; //## @sa GetPropertyList //## @sa m_PropertyList //## @sa m_MapOfPropertyLists mitk::BaseProperty::Pointer GetProperty(const char *propertyKey) const; void SetProperty(const char *propertyKey, BaseProperty* property); //##Documentation //## @brief Convenience method for setting the origin of //## the Geometry3D instances of all time steps //## //## \warning Geometries contained in the Geometry3D will //## \em not be changed, e.g. in case the Geometry3D is a //## SlicedGeometry3D the origin will \em not be propagated //## to the contained slices. The sub-class SlicedData //## does this for the case that the SlicedGeometry3D is //## evenly spaced. virtual void SetOrigin(const Point3D& origin); /** \brief Get the process object that generated this data object. * * If there is no process object, then the data object has * been disconnected from the pipeline, or the data object * was created manually. (Note: we cannot use the GetObjectMacro() * defined in itkMacro because the mutual dependency of * DataObject and ProcessObject causes compile problems. Also, * a forward reference smart pointer is returned, not a smart pointer, * because of the circular dependency between the process and data object.) * * GetSource() returns a SmartPointerForwardReference and not a WeakPointer * because it is assumed the code calling GetSource() wants to hold a * long term reference to the source. */ itk::SmartPointerForwardReference GetSource() const; //##Documentation //## @brief Get the number of time steps from the Timeslicedgeometry //## As the base data has not a data vector given by itself, the number //## of time steps is defined over the time sliced geometry. In sub classes, //## a better implementation could be over the length of the data vector. unsigned int GetTimeSteps() const { return m_TimeSlicedGeometry->GetTimeSteps(); }; //##Documentation //## @brief Get the modified time of the last change of the contents //## this data object or its geometry. virtual unsigned long GetMTime() const; protected: BaseData(); BaseData(const BaseData &other); ~BaseData(); //##Documentation //## @brief Initialize the TimeSlicedGeometry for a number of time steps. //## The TimeSlicedGeometry is initialized empty and evenly timed. //## In many cases it will be necessary to overwrite this in sub-classes. virtual void InitializeTimeSlicedGeometry( unsigned int timeSteps = 1 ); //##Documentation //## @brief reset to non-initialized state, release memory virtual void ClearData(); //##Documentation //## @brief Pure virtual; Must be used in subclasses to get a data object to a //## valid state. Should at least create one empty object and call //## Superclass::InitializeTimeSlicedGeometry() to ensure an existing valid geometry virtual void InitializeEmpty(){}; virtual void PrintSelf(std::ostream& os, itk::Indent indent) const; bool m_RequestedRegionInitialized; bool m_LastRequestedRegionWasOutsideOfTheBufferedRegion; mutable itk::SmartPointer m_SmartSourcePointer; mutable unsigned int m_SourceOutputIndexDuplicate; //##Documentation //## @brief for internal use only. Helps to deal with the //## weak-pointer-problem. virtual void ConnectSource(itk::ProcessObject *arg, unsigned int idx) const; bool m_Initialized; private: //##Documentation //## @brief Helps to deal with the weak-pointer-problem. mutable bool m_Unregistering; //##Documentation //## @brief Helps to deal with the weak-pointer-problem. mutable bool m_CalculatingExternalReferenceCount; //##Documentation //## @brief Helps to deal with the weak-pointer-problem. mutable int m_ExternalReferenceCount; //##Documentation //## @brief PropertyList, f.e. to hold pic-tags, tracking-data,.. //## PropertyList::Pointer m_PropertyList; TimeSlicedGeometry::Pointer m_TimeSlicedGeometry; //##Documentation //## @brief Helps to deal with the weak-pointer-problem. friend class mitk::BaseProcess; }; } // namespace mitk #endif /* BASEDATA_H_HEADER_INCLUDED_C1EBB6FA */ diff --git a/Core/Code/DataManagement/mitkBaseProperty.h b/Core/Code/DataManagement/mitkBaseProperty.h index b7f4785a21..598a29ec72 100644 --- a/Core/Code/DataManagement/mitkBaseProperty.h +++ b/Core/Code/DataManagement/mitkBaseProperty.h @@ -1,73 +1,73 @@ /*========================================================================= Program: Medical Imaging & Interaction Toolkit Language: C++ Date: $Date$ Version: $Revision$ Copyright (c) German Cancer Research Center, Division of Medical and Biological Informatics. All rights reserved. See MITKCopyright.txt or http://www.mitk.org/copyright.html for details. This software is distributed WITHOUT ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the above copyright notices for more information. =========================================================================*/ #ifndef BASEPROPERTY_H_HEADER_INCLUDED_C1F4DF54 #define BASEPROPERTY_H_HEADER_INCLUDED_C1F4DF54 #include #include -#include "mitkCommon.h" +#include namespace mitk { /*! \brief Abstract base class for properties \ingroup DataManagement Base class for properties. Properties are arbitrary additional information (to define a new type of information you have to define a subclass of BaseProperty) that can be added to a PropertyList. Concrete subclasses of BaseProperty should define Set-/Get-methods to assess the property value, which should be stored by value (not by reference). Subclasses must implement an operator==(const BaseProperty& property), which is used by PropertyList to check whether a property has been changed. */ class MITK_CORE_EXPORT BaseProperty : public itk::Object { public: mitkClassMacro(BaseProperty,itk::Object); /*! @brief Subclasses must implement this operator==. Operator== which is used by PropertyList to check whether a property has been changed. */ virtual bool operator==(const BaseProperty& property) const = 0; virtual BaseProperty& operator=(const BaseProperty& property); virtual std::string GetValueAsString() const; virtual bool Assignable(const BaseProperty& ) const; protected: BaseProperty(); virtual ~BaseProperty(); friend class PropertyList; // for VALUE static std::string VALUE; }; } // namespace mitk #endif /* BASEPROPERTY_H_HEADER_INCLUDED_C1F4DF54 */ diff --git a/Core/Code/DataManagement/mitkClippingProperty.h b/Core/Code/DataManagement/mitkClippingProperty.h index 1f656c6183..f5afb820fa 100644 --- a/Core/Code/DataManagement/mitkClippingProperty.h +++ b/Core/Code/DataManagement/mitkClippingProperty.h @@ -1,77 +1,77 @@ /*========================================================================= Program: Medical Imaging & Interaction Toolkit Language: C++ Date: $Date: 2008-04-14 19:45:53 +0200 (Mo, 14 Apr 2008) $ Version: $Revision: 14081 $ Copyright (c) German Cancer Research Center, Division of Medical and Biological Informatics. All rights reserved. See MITKCopyright.txt or http://www.mitk.org/copyright.html for details. This software is distributed WITHOUT ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the above copyright notices for more information. =========================================================================*/ #ifndef MITKCLIPPINGPROPERTY_H_HEADER_INCLUDED #define MITKCLIPPINGPROPERTY_H_HEADER_INCLUDED -#include "mitkCommon.h" +#include #include "mitkBaseProperty.h" #include "mitkVector.h" #include #include namespace mitk { /** * \brief Property for clipping datasets; currently only * clipping planes are possible * \ingroup DataManagement */ class MITK_CORE_EXPORT ClippingProperty : public BaseProperty { public: mitkClassMacro(ClippingProperty, BaseProperty); virtual BaseProperty& operator=(const BaseProperty& other) { return Superclass::operator=(other); } typedef std::string ValueType; itkNewMacro( ClippingProperty ); mitkNewMacro2Param( ClippingProperty, const Point3D &, const Vector3D & ); bool GetClippingEnabled() const; void SetClippingEnabled( bool enabled ); const Point3D &GetOrigin() const; void SetOrigin( const Point3D &origin ); const Vector3D &GetNormal() const; void SetNormal( const Vector3D &normal ); virtual bool operator==(const BaseProperty& property ) const; virtual std::string GetValueAsString() const; protected: bool m_ClippingEnabled; Point3D m_Origin; Vector3D m_Normal; ClippingProperty(); ClippingProperty( const Point3D &origin, const Vector3D &normal ); }; } // namespace mitk #endif /* MITKCLIPPINGPROPERTY_H_HEADER_INCLUDED */ diff --git a/Core/Code/DataManagement/mitkColorProperty.h b/Core/Code/DataManagement/mitkColorProperty.h index fe0c672bfb..c285f50640 100644 --- a/Core/Code/DataManagement/mitkColorProperty.h +++ b/Core/Code/DataManagement/mitkColorProperty.h @@ -1,78 +1,78 @@ /*========================================================================= Program: Medical Imaging & Interaction Toolkit Language: C++ Date: $Date$ Version: $Revision$ Copyright (c) German Cancer Research Center, Division of Medical and Biological Informatics. All rights reserved. See MITKCopyright.txt or http://www.mitk.org/copyright.html for details. This software is distributed WITHOUT ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the above copyright notices for more information. =========================================================================*/ #ifndef MITKCOLORPROPERTY_H_HEADER_INCLUDED_C17953D1 #define MITKCOLORPROPERTY_H_HEADER_INCLUDED_C17953D1 -#include "mitkCommon.h" +#include #include "mitkBaseProperty.h" #include namespace mitk { //##Documentation //## @brief Standard RGB color typedef (float) //## //## Standard RGB color typedef to get rid of template argument (float). //## @ingroup Property typedef itk::RGBPixel< float > Color; //##Documentation //## @brief RGB color property //## //## @ingroup DataManagement class MITK_CORE_EXPORT ColorProperty : public BaseProperty { protected: mitk::Color m_Color; ColorProperty(); ColorProperty(const float red, const float green, const float blue); ColorProperty(const float color[3]); ColorProperty(const mitk::Color & color); public: mitkClassMacro(ColorProperty, BaseProperty); itkNewMacro(ColorProperty); mitkNewMacro1Param(ColorProperty, const float*); mitkNewMacro1Param(ColorProperty, const mitk::Color&); mitkNewMacro3Param(ColorProperty, const float, const float, const float); virtual ~ColorProperty(); virtual bool Assignable(const BaseProperty& other) const; virtual BaseProperty& operator=(const BaseProperty& other); virtual bool operator==(const BaseProperty& property) const; const mitk::Color & GetColor() const; const mitk::Color & GetValue() const; std::string GetValueAsString() const; void SetColor(const mitk::Color & color ); void SetColor( float red, float green, float blue ); }; } // namespace mitk #endif /* MITKCOLORPROPERTY_H_HEADER_INCLUDED_C17953D1 */ diff --git a/Core/Code/DataManagement/mitkCommon.h b/Core/Code/DataManagement/mitkCommon.h index 67215556b3..cc9b00d995 100644 --- a/Core/Code/DataManagement/mitkCommon.h +++ b/Core/Code/DataManagement/mitkCommon.h @@ -1,132 +1,126 @@ /*========================================================================= Program: Medical Imaging & Interaction Toolkit Language: C++ Date: $Date$ Version: $Revision$ Copyright (c) German Cancer Research Center, Division of Medical and Biological Informatics. All rights reserved. See MITKCopyright.txt or http://www.mitk.org/copyright.html for details. This software is distributed WITHOUT ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the above copyright notices for more information. =========================================================================*/ #ifndef MITK_COMMON_H_DEFINED #define MITK_COMMON_H_DEFINED #ifdef _MSC_VER // This warns about truncation to 255 characters in debug/browse info #pragma warning (disable : 4786) #pragma warning (disable : 4068 ) /* disable unknown pragma warnings */ #endif //add only those headers here that are really necessary for all classes! #include "itkObject.h" #include "mitkConfig.h" #include "mitkLogMacros.h" #ifndef MITK_UNMANGLE_IPPIC #define mitkIpPicDescriptor mitkIpPicDescriptor #endif typedef unsigned int MapperSlotId; #define mitkClassMacro(className,SuperClassName) \ typedef className Self; \ typedef SuperClassName Superclass; \ typedef itk::SmartPointer Pointer; \ typedef itk::SmartPointer ConstPointer; \ itkTypeMacro(className,SuperClassName) /** * Macro for Constructors with one parameter for classes derived from itk::Lightobject **/ #define mitkNewMacro1Param(classname,type) \ static Pointer New(type _arg) \ { \ Pointer smartPtr = new classname ( _arg ); \ smartPtr->UnRegister(); \ return smartPtr; \ } \ /** * Macro for Constructors with two parameters for classes derived from itk::Lightobject **/ #define mitkNewMacro2Param(classname,typea,typeb) \ static Pointer New(typea _arga, typeb _argb) \ { \ Pointer smartPtr = new classname ( _arga, _argb ); \ smartPtr->UnRegister(); \ return smartPtr; \ } \ /** * Macro for Constructors with three parameters for classes derived from itk::Lightobject **/ #define mitkNewMacro3Param(classname,typea,typeb,typec) \ static Pointer New(typea _arga, typeb _argb, typec _argc) \ { \ Pointer smartPtr = new classname ( _arga, _argb, _argc ); \ smartPtr->UnRegister(); \ return smartPtr; \ } \ /** * Macro for Constructors with three parameters for classes derived from itk::Lightobject **/ #define mitkNewMacro4Param(classname,typea,typeb,typec,typed) \ static Pointer New(typea _arga, typeb _argb, typec _argc, typed _argd) \ { \ Pointer smartPtr = new classname ( _arga, _argb, _argc, _argd ); \ smartPtr->UnRegister(); \ return smartPtr; \ } \ /** Get a smart const pointer to an object. Creates the member * Get"name"() (e.g., GetPoints()). */ #define mitkGetObjectMacroConst(name,type) \ virtual type * Get##name () const \ { \ itkDebugMacro("returning " #name " address " << this->m_##name ); \ return this->m_##name.GetPointer(); \ } /** Creates a Clone() method for "Classname". Returns a smartPtr of a clone of the calling object*/ #define mitkCloneMacro(classname) \ virtual Pointer Clone() const \ { \ Pointer smartPtr = new classname(*this); \ return smartPtr; \ } -/** provide a macro for adding MS specific __declspec(dllexport/-import) - * to classes. - * This is needed for the export of symbols, when you build a DLL. Then write - * - * class MITK_EXPORT ClassName : public SomeClass {}; - */ +/** + * Macros for import/export declarations + */ #if defined(WIN32) - #ifdef mitkCore_EXPORTS - #define MITK_CORE_EXPORT __declspec(dllexport) - #else - #define MITK_CORE_EXPORT __declspec(dllimport) - #endif - #ifdef Qmitk_EXPORTS - #define QMITK_EXPORT __declspec(dllexport) + #define MITK_EXPORT __declspec(dllexport) + #define MITK_IMPORT __declspec(dllimport) + #define MITK_LOCAL +#else + #if __GNUC__ >= 4 + #define MITK_EXPORT __attribute__ ((visibility ("default"))) + #define MITK_IMPORT __attribute__ ((visibility ("default"))) + #define MITK_LOCAL __attribute__ ((visibility ("hidden"))) #else - #define QMITK_EXPORT __declspec(dllimport) + #define MITK_EXPORT + #define MITK_IMPORT + #define MITK_LOCAL #endif -#else - #define MITK_CORE_EXPORT - #define QMITK_EXPORT #endif -// legacy support for designer plugin -#define MITK_EXPORT - -#endif +#endif // MITK_COMMON_H_DEFINED diff --git a/Core/Code/DataManagement/mitkDataStorage.h b/Core/Code/DataManagement/mitkDataStorage.h index 054ee81f9f..cb0e449d64 100644 --- a/Core/Code/DataManagement/mitkDataStorage.h +++ b/Core/Code/DataManagement/mitkDataStorage.h @@ -1,395 +1,395 @@ /*========================================================================= Program: Medical Imaging & Interaction Toolkit Language: C++ Date: $Date$ Version: $Revision$ Copyright (c) German Cancer Research Center, Division of Medical and Biological Informatics. All rights reserved. See MITKCopyright.txt or http://www.mitk.org/copyright.html for details. This software is distributed WITHOUT ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the above copyright notices for more information. =========================================================================*/ #ifndef MITKDATASTORAGE_H_HEADER_INCLUDED_ #define MITKDATASTORAGE_H_HEADER_INCLUDED_ #include "itkObject.h" -#include "mitkCommon.h" +#include #include "mitkMessage.h" #include "itkVectorContainer.h" #include "mitkDataNode.h" #include "mitkGeometry3D.h" #include "itkSimpleFastMutexLock.h" #include namespace mitk { class NodePredicateBase; class DataNode; class BaseRenderer; //##Documentation //## @brief Data management class that handles 'was created by' relations //## //## The DataStorage provides data storage and management functionality. //## It handles a 'was created by' relation by associating each data object with a //## set of source objects, that this object was created from. //## Thus, nodes are stored in a noncyclical directed graph data structure. //## If a new node is added to the DataStorage, AddNodeEvent is emitted. //## If a node is removed, RemoveNodeEvent is emitted. //## //## //## \ingroup DataStorage class MITK_CORE_EXPORT DataStorage : public itk::Object { public: mitkClassMacro(DataStorage, itk::Object); //##Documentation //## @brief A Container of objects that is used as a result set of GetSubset() query operations (Set of SmartPointers to DataNodes). typedef itk::VectorContainer SetOfObjects; //##Documentation //## @brief Adds a DataNode containing a data object to its internal storage //## //## This Method adds a new data object to the DataStorage. The new object is //## passed in the first parameter. The second parameter is a set //## of source objects, that were used to create this object. The new object will have //## a 'was created from' relation to its source objects. //## the addition of a new object will fire the notification mechanism. //## If the node parameter is NULL or if the DataNode has already been added, //## an exception will be thrown. virtual void Add(mitk::DataNode* node, const mitk::DataStorage::SetOfObjects* parents = NULL) = 0; //##Documentation //## @brief Convenience method to add a node that has one parent //## void Add(mitk::DataNode* node, mitk::DataNode* parent); //##Documentation //## @brief Removes node from the DataStorage //## virtual void Remove(const mitk::DataNode* node) = 0; //##Documentation //## @brief Checks if a node exists in the DataStorage //## virtual bool Exists(const mitk::DataNode* node) const = 0; //##Documentation //## @brief Removes a set of nodes from the DataStorage //## void Remove(const mitk::DataStorage::SetOfObjects* nodes); //##Documentation //## @brief returns a set of data objects that meet the given condition(s) //## //## GetSubset returns a set of objects with a specific data type that meet the condition(s) //## specified in the condition parameter. Conditions can be //## - data type of the data object //## - is source object of specific object (e.g. all source objects of node x) //## - has property with specific value (e.g. OrganType is Liver) //## - negation of any condition //## - conjunction of a set of conditions //## - disjunction of a set of conditions //## Conditions are implemented as predicates using the Composite Design Pattern //## (see definition of NodePredicateBase for details). //## The method returns a set of SmartPointers to the DataNodes that fulfill the //## conditions. A set of all objects can be retrieved with the GetAll() method; SetOfObjects::ConstPointer GetSubset(const NodePredicateBase* condition) const; //##Documentation //## @brief returns a set of source objects for a given node that meet the given condition(s). //## virtual SetOfObjects::ConstPointer GetSources(const mitk::DataNode* node, const NodePredicateBase* condition = NULL, bool onlyDirectSources = true) const = 0; //##Documentation //## @brief returns a set of derived objects for a given node. //## //## GetDerivations() returns a set of objects that are derived from the DataNode node. //## This means, that node was used to create the returned objects. If the parameter //## onlyDirectDerivations is set to true (default value), only objects that directly have //## node as one of their source objects will be returned. Otherwise, objects that are //## derived from derivations of node are returned too. //## The derived objects can be filtered with a predicate object as described in the GetSubset() //## method by providing a predicate as the condition parameter. virtual SetOfObjects::ConstPointer GetDerivations(const mitk::DataNode* node, const NodePredicateBase* condition = NULL, bool onlyDirectDerivations = true) const = 0; //##Documentation //## @brief returns a set of all data objects that are stored in the data storage //## virtual SetOfObjects::ConstPointer GetAll() const = 0; //##Documentation //## @brief Convenience method to get the first node that matches the predicate condition //## mitk::DataNode* GetNode(const NodePredicateBase* condition = NULL) const; //##Documentation //## @brief Convenience method to get the first node with a given name //## mitk::DataNode* GetNamedNode(const char* name) const; //##Documentation //## @brief Convenience method to get the first node with a given name //## mitk::DataNode* GetNamedNode(const std::string name) const { return this->GetNamedNode(name.c_str()); } //##Documentation //## @brief Convenience method to get the first node with a given name that is derived from sourceNode //## mitk::DataNode* GetNamedDerivedNode(const char* name, const mitk::DataNode* sourceNode, bool onlyDirectDerivations = true) const; //##Documentation //## @brief Convenience method to get the first data object of a given data type with a given name //## template DataType* GetNamedObject(const char* name) const { if (name == NULL) return NULL; mitk::DataNode* n = this->GetNamedNode(name); if (n == NULL) return NULL; else return dynamic_cast(n->GetData()); } //##Documentation //## @brief Convenience method to get the first data object of a given data type with a given name //## template DataType* GetNamedObject(const std::string name) const { return this->GetNamedObject(name.c_str()); } //##Documentation //## @brief Convenience method to get the first data object of a given data type with a given name that is derived from a specific node //## template DataType* GetNamedDerivedObject(const char* name, const mitk::DataNode* sourceNode, bool onlyDirectDerivations = true) const { if (name == NULL) return NULL; mitk::DataNode* n = this->GetNamedDerivedNode(name, sourceNode, onlyDirectDerivations); if (n == NULL) return NULL; else return dynamic_cast(n->GetData()); } //##Documentation //## @brief Returns a list of used grouptags //## const DataNode::GroupTagList GetGroupTags() const; /*ITK Mutex */ mutable itk::SimpleFastMutexLock m_MutexOne; /* Public Events */ typedef Message1 DataStorageEvent; //##Documentation //## @brief AddEvent is emitted whenever a new node has been added to the DataStorage. //## //## Observers should register to this event by calling myDataStorage->AddNodeEvent.AddListener(myObject, MyObject::MyMethod). //## After registering, myObject->MyMethod() will be called every time a new node has been added to the DataStorage. //## Observers should unregister by calling myDataStorage->AddNodeEvent.RemoveListener(myObject, MyObject::MyMethod). //## Note: AddEvents are _not_ emitted if a node is added to DataStorage by adding it to the the underlying DataTree! // member variable is not needed to be locked in multi threaded scenarios since the DataStorageEvent is a typedef for // a Message1 object which is thread safe DataStorageEvent AddNodeEvent; //##Documentation //## @brief RemoveEvent is emitted directly before a node is removed from the DataStorage. //## //## Observers should register to this event by calling myDataStorage->RemoveNodeEvent.AddListener(myObject, MyObject::MyMethod). //## After registering, myObject->MyMethod() will be called every time a new node has been added to the DataStorage. //## Observers should unregister by calling myDataStorage->RemoveNodeEvent.RemoveListener(myObject, MyObject::MyMethod). //## Note: RemoveEvents are also emitted if a node was removed from the DataStorage by deleting it from the underlying DataTree // member variable is not needed to be locked in multi threaded scenarios since the DataStorageEvent is a typedef for // a Message1 object which is thread safe DataStorageEvent RemoveNodeEvent; //##Documentation //## @brief ChangedEvent is emitted directly after a node was changed. //## //## Observers should register to this event by calling myDataStorage->ChangedNodeEvent.AddListener(myObject, MyObject::MyMethod). //## After registering, myObject->MyMethod() will be called every time a new node has been changed. //## Observers should unregister by calling myDataStorage->ChangedNodeEvent.RemoveListener(myObject, MyObject::MyMethod). //## Internally the DataStorage listens to itk::ModifiedEvents on the nodes and forwards them //## to the listeners of this event. // member variable is not needed to be locked in multi threaded scenarios since the DataStorageEvent is a typedef for // a Message1 object which is thread safe DataStorageEvent ChangedNodeEvent; //##Documentation //## @brief DeleteNodeEvent is emitted directly before a node is deleted. //## //## Observers should register to this event by calling myDataStorage->DeleteNodeEvent.AddListener(myObject, MyObject::MyMethod). //## After registering, myObject->MyMethod() will be called when a node is deleted. //## Observers should unregister by calling myDataStorage->DeleteNodeEvent.RemoveListener(myObject, MyObject::MyMethod). //## Internally the DataStorage listens to itk::DeleteEvents on the nodes and forwards them //## to the listeners of this event. // member variable is not needed to be locked in multi threaded scenarios since the DataStorageEvent is a typedef for // a Message1 object which is thread safe DataStorageEvent DeleteNodeEvent; //##Documentation //## @brief Compute the axis-parallel bounding geometry of the input objects //## //## Throws std::invalid_argument exception if input is NULL //## @param input set of objects of the DataStorage to be included in the bounding geometry //## @param boolPropertyKey if a BoolProperty with this boolPropertyKey exists for a node (for @a renderer) //## and is set to @a false, the node is ignored for the bounding-box calculation. //## @param renderer see @a boolPropertyKey //## @param boolPropertyKey2 a second condition that is applied additionally to @a boolPropertyKey mitk::TimeSlicedGeometry::Pointer ComputeBoundingGeometry3D( const SetOfObjects* input, const char* boolPropertyKey = NULL, mitk::BaseRenderer* renderer = NULL, const char* boolPropertyKey2 = NULL); //##Documentation //## @brief Compute the axis-parallel bounding geometry of the data tree //## (bounding box, minimal spacing of the considered nodes, live-span) //## //## it -> an iterator to a data tree structure //## @param boolPropertyKey if a BoolProperty with this boolPropertyKey exists for a node (for @a renderer) //## and is set to @a false, the node is ignored for the bounding-box calculation. //## @param renderer see @a boolPropertyKey //## @param boolPropertyKey2 a second condition that is applied additionally to @a boolPropertyKey mitk::TimeSlicedGeometry::Pointer ComputeBoundingGeometry3D( const char* boolPropertyKey = NULL, mitk::BaseRenderer* renderer = NULL, const char* boolPropertyKey2 = NULL); //##Documentation //## @brief Compute the axis-parallel bounding geometry of all visible parts of the //## data tree bounding box, minimal spacing of the considered nodes, live-span) //## //## Simply calls ComputeBoundingGeometry3D(it, "visible", renderer, boolPropertyKey). //## it -> an iterator of a data tree structure //## @param renderer the reference to the renderer //## @param boolPropertyKey if a BoolProperty with this boolPropertyKey exists for a node (for @a renderer) //## and is set to @a false, the node is ignored for the bounding-box calculation. mitk::TimeSlicedGeometry::Pointer ComputeVisibleBoundingGeometry3D( mitk::BaseRenderer* renderer = NULL, const char* boolPropertyKey = NULL); //##Documentation //## @brief Compute the bounding box of data tree structure //## it -> an iterator to a data tree structure //## @param boolPropertyKey if a BoolProperty with this boolPropertyKey exists for a node (for @a renderer) //## and is set to @a false, the node is ignored for the bounding-box calculation. //## @param renderer see @a boolPropertyKey //## @param boolPropertyKey2 a second condition that is applied additionally to @a boolPropertyKey mitk::BoundingBox::Pointer ComputeBoundingBox( const char* boolPropertyKey = NULL, mitk::BaseRenderer* renderer = NULL, const char* boolPropertyKey2 = NULL); //##Documentation //## \brief Compute the bounding box of all visible parts of the data tree structure, for general //## rendering or renderer specific visibility property checking //## //## Simply calls ComputeBoundingBox(it, "visible", renderer, boolPropertyKey). //## it -> an iterator of a data tree structure //## @param renderer the reference to the renderer //## @param boolPropertyKey if a BoolProperty with this boolPropertyKey exists for a node (for @a renderer) //## and is set to @a false, the node is ignored for the bounding-box calculation. mitk::BoundingBox::Pointer ComputeVisibleBoundingBox( mitk::BaseRenderer* renderer = NULL, const char* boolPropertyKey = NULL) { return ComputeBoundingBox( "visible", renderer, boolPropertyKey); } //##Documentation //## @brief Compute the time-bounds of the contents of a data tree structure //## //## The methods returns only [-infinity, +infinity], if all data-objects have an infinite live-span. Otherwise, //## all data-objects with infinite live-span are ignored. //## it -> an iterator to a data tree structure //## @param boolPropertyKey if a BoolProperty with this boolPropertyKey exists for a node (for @a renderer) //## and is set to @a false, the node is ignored for the time-bounds calculation. //## @param renderer see @a boolPropertyKey //## @param boolPropertyKey2 a second condition that is applied additionally to @a boolPropertyKey mitk::TimeBounds ComputeTimeBounds( const char* boolPropertyKey, mitk::BaseRenderer* renderer, const char* boolPropertyKey2); //##Documentation //## @brief Compute the time-bounds of all visible parts of the data tree structure, for general //## rendering or renderer specific visibility property checking //## //## The methods returns only [-infinity, +infinity], if all data-objects have an infinite live-span. Otherwise, //## all data-objects with infinite live-span are ignored. //## Simply calls ComputeTimeBounds(it, "visible", renderer, boolPropertyKey). //## @param it an iterator to a data tree structure //## @param boolPropertyKey if a BoolProperty with this boolPropertyKey exists for a node (for @a renderer) //## and is set to @a false, the node is ignored for the time-bounds calculation. //## @param renderer see @a boolPropertyKey mitk::TimeBounds ComputeTimeBounds( mitk::BaseRenderer* renderer, const char* boolPropertyKey) { return ComputeTimeBounds( "visible", renderer, boolPropertyKey); } protected: //##Documentation //## @brief EmitAddNodeEvent emits the AddNodeEvent //## //## This method should be called by subclasses to emit the AddNodeEvent void EmitAddNodeEvent(const mitk::DataNode* node); //##Documentation //## @brief EmitRemoveNodeEvent emits the RemoveNodeEvent //## //## This method should be called by subclasses to emit the RemoveNodeEvent void EmitRemoveNodeEvent(const mitk::DataNode* node); //##Documentation //## @brief OnNodeModified listens to modified events of DataNodes. //## //## The node is hidden behind the caller parameter, which has to be casted first. //## If the cast succeeds the ChangedNodeEvent is emitted with this node. void OnNodeModifiedOrDeleted( const itk::Object *caller, const itk::EventObject &event ); //##Documentation //## @brief Adds a Modified-Listener to the given Node. void AddListeners(const mitk::DataNode* _Node); //##Documentation //## @brief Removes a Modified-Listener from the given Node. void RemoveListeners(const mitk::DataNode* _Node); //##Documentation //## @brief Saves Modified-Observer Tags for each node in order to remove the event listeners again. std::map m_NodeModifiedObserverTags; //##Documentation //## @brief Saves Delete-Observer Tags for each node in order to remove the event listeners again. std::map m_NodeDeleteObserverTags; //##Documentation //## @brief If this class changes nodes itself, set this to TRUE in order //## to suppress NodeChangedEvent to be emitted. bool m_BlockNodeModifiedEvents; //##Documentation //## @brief Standard Constructor for ::New() instantiation DataStorage(); //##Documentation //## @brief Standard Destructor virtual ~DataStorage(); //##Documentation //## @brief Filters a SetOfObjects by the condition. If no condition is provided, the original set is returned SetOfObjects::ConstPointer FilterSetOfObjects(const SetOfObjects* set, const NodePredicateBase* condition) const; //##Documentation //## @brief Prints the contents of the DataStorage to os. Do not call directly, call ->Print() instead virtual void PrintSelf(std::ostream& os, itk::Indent indent) const; }; } // namespace mitk #endif /* MITKDATASTORAGE_H_HEADER_INCLUDED_ */ diff --git a/Core/Code/DataManagement/mitkGenericLookupTable.h b/Core/Code/DataManagement/mitkGenericLookupTable.h index 5ef973dc1a..efd4ddf098 100644 --- a/Core/Code/DataManagement/mitkGenericLookupTable.h +++ b/Core/Code/DataManagement/mitkGenericLookupTable.h @@ -1,150 +1,150 @@ /*========================================================================= Program: Medical Imaging & Interaction Toolkit Language: C++ Date: $Date: 2008-06-24 19:37:48 +0200 (Di, 24 Jun 2008) $ Version: $Revision: 14641 $ Copyright (c) German Cancer Research Center, Division of Medical and Biological Informatics. All rights reserved. See MITKCopyright.txt or http://www.mitk.org/copyright.html for details. This software is distributed WITHOUT ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the above copyright notices for more information. =========================================================================*/ #ifndef MITKGENERICLOOKUPTABLE_H_HEADER_INCLUDED_C1061CEE #define MITKGENERICLOOKUPTABLE_H_HEADER_INCLUDED_C1061CEE #include #include #include #include #include #include "mitkVector.h" -#include "mitkCommon.h" +#include namespace mitk { /** * @brief Template class for generating lookup-tables * * This class template can be instantiated for all classes/internal types that fulfills * these requirements: * - an operator<< so that the properties value can be put into a std::stringstream * - an operator== so that two properties can be checked for equality * * The main purpose of this class is to be used in conjunction with * GenericLookupTableProperty. This enables passing of arbitrary lookup * tables to mappers to configure the rendering process. */ template class GenericLookupTable { public: typedef unsigned int IdentifierType; typedef T ValueType; typedef std::map< IdentifierType, ValueType > LookupTableType; typedef GenericLookupTable Self; GenericLookupTable() {} virtual ~GenericLookupTable() { } virtual const char *GetNameOfClass() const { return "GenericLookupTable"; } void SetTableValue( IdentifierType id, ValueType value ) { m_LookupTable[id] = value; } bool ValueExists(IdentifierType id) const { typename LookupTableType::const_iterator it = m_LookupTable.find(id); return (it != m_LookupTable.end()); } ValueType GetTableValue( IdentifierType id ) const { typename LookupTableType::const_iterator it = m_LookupTable.find(id); if (it != m_LookupTable.end()) return it->second; else throw std::range_error("id does not exist in the lookup table"); } const LookupTableType& GetLookupTable() const { return m_LookupTable; } bool operator==( const Self& lookupTable ) const { return (m_LookupTable == lookupTable.m_LookupTable); } bool operator!=( const Self& lookupTable ) const { return !(m_LookupTable == lookupTable.m_LookupTable); } virtual Self& operator=(const Self& other) // \TODO: this needs to be unit tested! { if ( this == &other ) { return *this; } else { m_LookupTable.clear(); m_LookupTable = other.m_LookupTable; return *this; } } protected: LookupTableType m_LookupTable; }; } // namespace mitk /** * Generates a specialized subclass of mitk::GenericLookupTable. * This way, GetNameOfClass() returns the value provided by LookupTableName. * Please see mitkProperties.h for examples. * @param LookupTableName the name of the instantiation of GenericLookupTable * @param Type the value type of the GenericLookupTable */ #define mitkSpecializeGenericLookupTable(LookupTableName,Type) \ class MITK_CORE_EXPORT LookupTableName: public GenericLookupTable< Type > \ { \ public: \ typedef LookupTableName Self; \ typedef GenericLookupTable< Type > Superclass; \ virtual const char *GetNameOfClass() const \ {return #LookupTableName;} \ LookupTableName() {} \ virtual Superclass& operator=(const Superclass& other) { return Superclass::operator=(other); } \ virtual ~LookupTableName() {} \ }; \ std::ostream& operator<<(std::ostream& stream, const LookupTableName& /*l*/); /** * Generates the ostream << operator for the lookuptable. This definition * of a global function must be in a cpp file, therefore it is split from the * class declaration macro mitkSpecializeGenericLookupTable. */ #define mitkSpecializeGenericLookupTableOperator(LookupTableName) \ std::ostream& mitk::operator<<(std::ostream& stream, const LookupTableName& /*l*/) \ { \ return stream; \ }; #endif diff --git a/Core/Code/DataManagement/mitkGenericProperty.h b/Core/Code/DataManagement/mitkGenericProperty.h index fd3e0201fb..5f8ab1cef8 100644 --- a/Core/Code/DataManagement/mitkGenericProperty.h +++ b/Core/Code/DataManagement/mitkGenericProperty.h @@ -1,150 +1,150 @@ /*========================================================================= Program: Medical Imaging & Interaction Toolkit Language: C++ Date: $Date$ Version: $Revision$ Copyright (c) German Cancer Research Center, Division of Medical and Biological Informatics. All rights reserved. See MITKCopyright.txt or http://www.mitk.org/copyright.html for details. This software is distributed WITHOUT ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the above copyright notices for more information. =========================================================================*/ #ifndef MITKGENERICPROPERTY_H_HEADER_INCLUDED_C1061CEE #define MITKGENERICPROPERTY_H_HEADER_INCLUDED_C1061CEE #include #include #include #include "mitkVector.h" -#include "mitkCommon.h" +#include #include "mitkBaseProperty.h" namespace mitk { /*! @ brief Template class for generating properties for int, float, bool, etc. This class template can be instantiated for all classes/internal types that fulfills these requirements: - an operator<< so that the properties value can be put into a std::stringstream - an operator== so that two properties can be checked for equality Note: you must use the macro mitkSpecializeGenericProperty to provide specializations for concrete types (e.g. BoolProperty). Please see mitkProperties.h for examples. If you don't use the mitkSpecializeGenericProperty Macro, GetNameOfClass() returns a wrong name. */ template class GenericProperty : public BaseProperty { public: mitkClassMacro(GenericProperty, BaseProperty); mitkNewMacro1Param(GenericProperty, T); typedef T ValueType; virtual ~GenericProperty() { } itkSetMacro(Value,T); itkGetConstMacro(Value,T); virtual bool operator==(const BaseProperty& other) const { try { const Self *otherProp = dynamic_cast(&other); if(otherProp==NULL) return false; if (this->m_Value == otherProp->m_Value) return true; } catch (std::bad_cast) { // nothing to do now - just return false } return false; } virtual std::string GetValueAsString() const { std::stringstream myStr; myStr << GetValue() ; return myStr.str(); } virtual bool Assignable(const BaseProperty& other) const { try { dynamic_cast(other); // dear compiler, please don't optimize this away! return true; } catch (std::bad_cast) { } return false; } virtual BaseProperty& operator=(const BaseProperty& other) { try { const Self& otherProp( dynamic_cast(other) ); if (this->m_Value != otherProp.m_Value) { this->m_Value = otherProp.m_Value; this->Modified(); } } catch (std::bad_cast) { // nothing to do then } return *this; } protected: GenericProperty() {} GenericProperty(T x) : m_Value(x) {} T m_Value; }; } // namespace mitk /** * Generates a specialized subclass of mitk::GenericProperty. * This way, GetNameOfClass() returns the value provided by PropertyName. * Please see mitkProperties.h for examples. * @param PropertyName the name of the instantiation of GenericProperty * @param Type the value type of the GenericProperty */ #define mitkSpecializeGenericProperty(PropertyName,Type,DefaultValue) \ class MITK_CORE_EXPORT PropertyName: public GenericProperty< Type > \ { \ public: \ mitkClassMacro(PropertyName, GenericProperty< Type >); \ itkNewMacro(PropertyName); \ mitkNewMacro1Param(PropertyName, Type); \ virtual ~PropertyName() {} \ virtual BaseProperty& operator=(const BaseProperty& other) { return Superclass::operator=(other); } \ protected: \ PropertyName() { m_Value = DefaultValue; } \ PropertyName(Type x) : GenericProperty(x) {} \ }; #endif /* MITKGENERICPROPERTY_H_HEADER_INCLUDED_C1061CEE */ diff --git a/Core/Code/DataManagement/mitkGeometry2D.h b/Core/Code/DataManagement/mitkGeometry2D.h index be4e082542..da0410306e 100644 --- a/Core/Code/DataManagement/mitkGeometry2D.h +++ b/Core/Code/DataManagement/mitkGeometry2D.h @@ -1,264 +1,264 @@ /*========================================================================= Program: Medical Imaging & Interaction Toolkit Language: C++ Date: $Date$ Version: $Revision$ Copyright (c) German Cancer Research Center, Division of Medical and Biological Informatics. All rights reserved. See MITKCopyright.txt or http://www.mitk.org/copyright.html for details. This software is distributed WITHOUT ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the above copyright notices for more information. =========================================================================*/ #ifndef GEOMETRY2D_H_HEADER_INCLUDED_C1F4D8E0 #define GEOMETRY2D_H_HEADER_INCLUDED_C1F4D8E0 -#include "mitkCommon.h" +#include #include "mitkGeometry3D.h" namespace mitk { /** * \brief Describes the geometry of a two-dimensional object * * Describes a two-dimensional manifold, i.e., to put it simply, * an object that can be described using a 2D coordinate-system. * * Geometry2D can map points between 3D world coordinates * (in mm) and the described 2D coordinate-system (in mm) by first projecting * the 3D point onto the 2D manifold and then calculating the 2D-coordinates * (in mm). These 2D-mm-coordinates can be further converted into * 2D-unit-coordinates (e.g., pixels), giving a parameter representation of * the object with parameter values inside a rectangle * (e.g., [0,0]..[width, height]), which is the bounding box (bounding range * in z-direction always [0]..[1]). * * A Geometry2D describes the 2D representation within a 3D object and is * therefore itself a Geometry3D (derived from Geometry3D). For example, * a single CT-image (slice) is 2D in the sense that you can access the * pixels using 2D-coordinates, but is also 3D, as the pixels are really * voxels, thus have an extension (thickness) in the 3rd dimension. * * Most often, instances of Geometry2D will be used to descibe a plane, * which is represented by the sub-class PlaneGeometry, but curved * surfaces are also possible. * * Optionally, a reference Geometry3D can be specified, which usually would * be the geometry associated with the underlying dataset. This is currently * used for calculating the intersection of inclined / rotated planes * (represented as Geometry2D) with the bounding box of the associated * Geometry3D. * * \warning The Geometry2Ds are not necessarily up-to-date and not even * initialized. As described in the previous paragraph, one of the * Generate-/Copy-/UpdateOutputInformation methods have to initialize it. * mitk::BaseData::GetGeometry2D() makes sure, that the Geometry2D is * up-to-date before returning it (by setting the update extent appropriately * and calling UpdateOutputInformation). * * Rule: everything is in mm (or ms for temporal information) if not * stated otherwise. * \ingroup Geometry */ class MITK_CORE_EXPORT Geometry2D : public mitk::Geometry3D { public: mitkClassMacro(Geometry2D, mitk::Geometry3D); itkNewMacro(Self); /** * \brief Project a 3D point given in mm (\a pt3d_mm) onto the 2D * geometry. The result is a 2D point in mm (\a pt2d_mm). * * The result is a 2D point in mm (\a pt2d_mm) relative to the upper-left * corner of the geometry. To convert this point into units (e.g., pixels * in case of an image), use WorldToIndex. * \return true projection was possible * \sa Project(const mitk::Point3D &pt3d_mm, mitk::Point3D * &projectedPt3d_mm) */ virtual bool Map(const mitk::Point3D &pt3d_mm, mitk::Point2D &pt2d_mm) const; /** * \brief Converts a 2D point given in mm (\a pt2d_mm) relative to the * upper-left corner of the geometry into the corresponding * world-coordinate (a 3D point in mm, \a pt3d_mm). * * To convert a 2D point given in units (e.g., pixels in case of an * image) into a 2D point given in mm (as required by this method), use * IndexToWorld. */ virtual void Map(const mitk::Point2D &pt2d_mm, mitk::Point3D &pt3d_mm) const; /** * \brief Convert a 2D point given in units (e.g., pixels in case of an * image) into a 2D point given in mm */ virtual void IndexToWorld( const mitk::Point2D &pt_units, mitk::Point2D &pt_mm) const; /** * \brief Convert a 2D point given in mm into a 2D point given in mm * (e.g., pixels in case of an image) */ virtual void WorldToIndex( const mitk::Point2D &pt_mm, mitk::Point2D &pt_units) const; /** * \brief Convert a 2D vector given in units (e.g., pixels in case of an * image) into a 2D vector given in mm * \warning strange: in contrast to vtkTransform the class itk::Transform * does not have the parameter, \em where the vector that is to be * transformed is located. This method here should also need this * information for general transforms. */ virtual void IndexToWorld( const mitk::Point2D &atPt2d_units, const mitk::Vector2D &vec_units, mitk::Vector2D &vec_mm) const; /** * \brief Convert a 2D vector given in mm into a 2D point vector in mm * (e.g., pixels in case of an image) * \warning strange: in contrast to vtkTransform the class itk::Transform * does not have the parameter, \em where the vector that is to be * transformed is located. This method here should also need this * information for general transforms. */ virtual void WorldToIndex( const mitk::Point2D &atPt2d_mm, const mitk::Vector2D &vec_mm, mitk::Vector2D &vec_units) const; /** * \brief Set the width and height of this 2D-geometry in units by calling * SetBounds. This does \a not change the extent in mm! * * For an image, this is the number of pixels in x-/y-direction. * \note In contrast to calling SetBounds directly, this does \a not change * the extent in mm! */ virtual void SetSizeInUnits(mitk::ScalarType width, mitk::ScalarType height); /** * \brief Project a 3D point given in mm (\a pt3d_mm) onto the 2D * geometry. The result is a 3D point in mm (\a projectedPt3d_mm). * * \return true projection was possible */ virtual bool Project(const mitk::Point3D &pt3d_mm, mitk::Point3D &projectedPt3d_mm) const; /** * \brief Project a 3D vector given in mm (\a vec3d_mm) onto the 2D * geometry. The result is a 2D vector in mm (\a vec2d_mm). * * The result is a 2D vector in mm (\a vec2d_mm) relative to the * upper-left * corner of the geometry. To convert this point into units (e.g., pixels * in case of an image), use WorldToIndex. * \return true projection was possible * \sa Project(const mitk::Vector3D &vec3d_mm, mitk::Vector3D * &projectedVec3d_mm) */ virtual bool Map(const mitk::Point3D & atPt3d_mm, const mitk::Vector3D &vec3d_mm, mitk::Vector2D &vec2d_mm) const; /** * \brief Converts a 2D vector given in mm (\a vec2d_mm) relative to the * upper-left corner of the geometry into the corresponding * world-coordinate (a 3D vector in mm, \a vec3d_mm). * * To convert a 2D vector given in units (e.g., pixels in case of an * image) into a 2D vector given in mm (as required by this method), use * IndexToWorld. */ virtual void Map(const mitk::Point2D & atPt2d_mm, const mitk::Vector2D &vec2d_mm, mitk::Vector3D &vec3d_mm) const; /** * \brief Project a 3D vector given in mm (\a vec3d_mm) onto the 2D * geometry. The result is a 3D vector in mm (\a projectedVec3d_mm). * * \return true projection was possible */ virtual bool Project(const mitk::Point3D & atPt3d_mm, const mitk::Vector3D &vec3d_mm, mitk::Vector3D &projectedVec3d_mm) const; /** * \brief Distance of the point from the geometry * (bounding-box \em not considered) * */ inline ScalarType Distance(const Point3D& pt3d_mm) const { return fabs(SignedDistance(pt3d_mm)); } /** * \brief Signed distance of the point from the geometry * (bounding-box \em not considered) * */ virtual ScalarType SignedDistance(const Point3D& pt3d_mm) const; /** * \brief Test if the point is above the geometry * (bounding-box \em not considered) * */ virtual bool IsAbove(const Point3D& pt3d_mm) const; virtual void SetIndexToWorldTransform(mitk::AffineTransform3D* transform); virtual void SetExtentInMM(int direction, ScalarType extentInMM); virtual AffineGeometryFrame3D::Pointer Clone() const; /** * \brief Set the geometrical frame of reference in which this Geometry2D * is placed. * * This would usually be the Geometry3D of the underlying dataset, but * setting it is optional. */ void SetReferenceGeometry( mitk::Geometry3D *geometry ); /** * \brief Get the geometrical frame of reference for this Geometry2D. */ Geometry3D *GetReferenceGeometry() const; bool HasReferenceGeometry() const; protected: Geometry2D(); Geometry2D(const Geometry2D& other); virtual ~Geometry2D(); virtual void PrintSelf(std::ostream& os, itk::Indent indent) const; /** * \brief factor to convert x-coordinates from mm to units and vice versa * */ mutable mitk::ScalarType m_ScaleFactorMMPerUnitX; /** * \brief factor to convert y-coordinates from mm to units and vice versa * */ mutable mitk::ScalarType m_ScaleFactorMMPerUnitY; mitk::Geometry3D *m_ReferenceGeometry; }; } // namespace mitk #endif /* GEOMETRY2D_H_HEADER_INCLUDED_C1F4D8E0 */ diff --git a/Core/Code/DataManagement/mitkGeometry2DData.h b/Core/Code/DataManagement/mitkGeometry2DData.h index a786634458..a38ddf7f35 100644 --- a/Core/Code/DataManagement/mitkGeometry2DData.h +++ b/Core/Code/DataManagement/mitkGeometry2DData.h @@ -1,78 +1,78 @@ /*========================================================================= Program: Medical Imaging & Interaction Toolkit Language: C++ Date: $Date$ Version: $Revision$ Copyright (c) German Cancer Research Center, Division of Medical and Biological Informatics. All rights reserved. See MITKCopyright.txt or http://www.mitk.org/copyright.html for details. This software is distributed WITHOUT ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the above copyright notices for more information. =========================================================================*/ #ifndef MITKGEOMETRY2DDATA_H_HEADER_INCLUDED_C19C01E2 #define MITKGEOMETRY2DDATA_H_HEADER_INCLUDED_C19C01E2 -#include "mitkCommon.h" +#include #include "mitkBaseData.h" #include "mitkGeometryData.h" #include "mitkGeometry2D.h" namespace mitk { //##Documentation //## @brief Data class containing Geometry2D objects //## @ingroup Geometry //## class MITK_CORE_EXPORT Geometry2DData : public GeometryData { public: mitkClassMacro(Geometry2DData, GeometryData); itkNewMacro(Self); //##Documentation //## @brief Set the reference to a Geometry2D that is stored //## by the object //## //## @warning Accepts only instances of Geometry2D or sub-classes. virtual void SetGeometry(mitk::Geometry3D *geometry); //##Documentation //## @brief Set the reference to the Geometry2D that is stored //## by the object virtual void SetGeometry2D(mitk::Geometry2D* geometry2d); //##Documentation //## @brief Get the reference to the Geometry2D that is stored //## by the object virtual mitk::Geometry2D * GetGeometry2D() const { return static_cast(GetGeometry()); }; virtual void UpdateOutputInformation(); virtual void SetRequestedRegionToLargestPossibleRegion(); virtual bool RequestedRegionIsOutsideOfTheBufferedRegion(); virtual bool VerifyRequestedRegion(); virtual void SetRequestedRegion(itk::DataObject *data); virtual void CopyInformation(const itk::DataObject *data); protected: Geometry2DData(); virtual ~Geometry2DData(); }; } // namespace mitk #endif /* MITKGEOMETRY2DDATA_H_HEADER_INCLUDED_C19C01E2 */ diff --git a/Core/Code/DataManagement/mitkGeometry3D.h b/Core/Code/DataManagement/mitkGeometry3D.h index 1fad8d0fc5..9c846f4d48 100644 --- a/Core/Code/DataManagement/mitkGeometry3D.h +++ b/Core/Code/DataManagement/mitkGeometry3D.h @@ -1,662 +1,662 @@ /*========================================================================= Program: Medical Imaging & Interaction Toolkit Language: C++ Date: $Date$ Version: $Revision$ Copyright (c) German Cancer Research Center, Division of Medical and Biological Informatics. All rights reserved. See MITKCopyright.txt or http://www.mitk.org/copyright.html for details. This software is distributed WITHOUT ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the above copyright notices for more information. =========================================================================*/ #ifndef GEOMETRY3D_H_HEADER_INCLUDED_C1EBD0AD #define GEOMETRY3D_H_HEADER_INCLUDED_C1EBD0AD -#include "mitkCommon.h" +#include #include "mitkVector.h" #include "mitkOperationActor.h" #include #include #include #include class vtkLinearTransform; class vtkMatrixToLinearTransform; class vtkMatrix4x4; namespace mitk { //##Documentation //## @brief Standard 3D-BoundingBox typedef //## //## Standard 3D-BoundingBox typedef to get rid of template arguments (3D, type). typedef itk::BoundingBox BoundingBox; //##Documentation //## @brief Standard typedef for time-bounds typedef itk::FixedArray TimeBounds; typedef itk::FixedArray FixedArrayType; typedef itk::AffineGeometryFrame AffineGeometryFrame3D; //##Documentation //## @brief Describes the geometry of a data object //## //## At least, it can return the bounding box of the data object. //## //## The class holds //## \li a bounding box which is axes-parallel in intrinsic coordinates //## (often integer indices of pixels), to be accessed by //## GetBoundingBox() //## \li a transform to convert intrinsic coordinates into a //## world-coordinate system with coordinates in millimeters //## and milliseconds (all are floating point values), to //## be accessed by GetIndexToWorldTransform() //## \li a life span, i.e. a bounding box in time in ms (with //## start and end time), to be accessed by GetTimeBounds(). //## The default is minus infinity to plus infinity. //## //## Geometry3D and its sub-classes allow converting between //## intrinsic coordinates (called index or unit coordinates) //## and world-coordinates (called world or mm coordinates), //## e.g. WorldToIndex. //## In case you need integer index coordinates, provide an //## mitk::Index3D (or itk::Index) as target variable to //## WorldToIndex, otherwise you will get a continuous index //## (floating point values). //## //## An important sub-class is SlicedGeometry3D, which descibes //## data objects consisting of slices, e.g., objects of type Image. //## Conversions between world coordinates (in mm) and unit coordinates //## (e.g., pixels in the case of an Image) can be performed. //## //## For more information on related classes, see \ref Geometry. //## //## Geometry3D instances referring to an Image need a slightly //## different definition of corners, see SetImageGeometry. This //## is usualy automatically called by Image. //## //## Geometry3D have to be initialized in the method GenerateOutputInformation() //## of BaseProcess (or CopyInformation/ UpdateOutputInformation of BaseData, //## if possible, e.g., by analyzing pic tags in Image) subclasses. See also //## itk::ProcessObject::GenerateOutputInformation(), //## itk::DataObject::CopyInformation() and //## itk::DataObject::UpdateOutputInformation(). //## //## Rule: everything is in mm (ms) if not stated otherwise. //## @ingroup Geometry class MITK_CORE_EXPORT Geometry3D : public AffineGeometryFrame3D, public OperationActor { public: mitkClassMacro(Geometry3D, AffineGeometryFrame3D); typedef itk::QuaternionRigidTransform< ScalarType > QuaternionTransformType; typedef QuaternionTransformType::VnlQuaternionType VnlQuaternionType; /** Method for creation through the object factory. */ itkNewMacro(Self); // a bit of a misuse, but we want only doxygen to see the following: #ifdef DOXYGEN_SKIP //##Documentation //## @brief Get the transformation used to convert from index //## to world coordinates itkGetObjectMacro(IndexToWorldTransform, AffineTransform3D); #endif //## @brief Set the transformation used to convert from index //## to world coordinates virtual void SetIndexToWorldTransform(mitk::AffineTransform3D* transform); //##Documentation //## @brief Convenience method for setting the ITK transform //## (m_IndexToWorldTransform) via an vtkMatrix4x4 //## \sa SetIndexToWorldTransform virtual void SetIndexToWorldTransformByVtkMatrix(vtkMatrix4x4* vtkmatrix); #ifdef DOXYGEN_SKIP //##Documentation //## @brief Get bounding box (in index/unit coordinates) itkGetConstObjectMacro(BoundingBox, BoundingBoxType); //##Documentation //## @brief Get bounding box (in index/unit coordinates) as a BoundsArrayType const BoundsArrayType GetBounds() const { assert(m_BoundingBox.IsNotNull()); return m_BoundingBox->GetBounds(); } //##Documentation //## \brief Set the bounding box (in index/unit coordinates) //## //## Only possible via the BoundsArray to make clear that a //## copy of the bounding-box is stored, not a reference to it. virtual void SetBounds(const BoundsArrayType& bounds); #endif //##Documentation //## @brief Set the bounding box (in index/unit coordinates) via a float array virtual void SetFloatBounds(const float bounds[6]); //##Documentation //## @brief Set the bounding box (in index/unit coordinates) via a double array virtual void SetFloatBounds(const double bounds[6]); //##Documentation //## @brief When switching from an Image Geometry to a normal Geometry (and the other way around), you have to change the origin as well (See Geometry Documentation)! This function will change the "isImageGeometry" bool flag and changes the origin respectively. virtual void ChangeImageGeometryConsideringOriginOffset( const bool isAnImageGeometry ); //##Documentation //## @brief Get the time bounds (in ms) itkGetConstReferenceMacro(TimeBounds, TimeBounds); //##Documentation //## @brief Set the time bounds (in ms) virtual void SetTimeBounds(const TimeBounds& timebounds); //##Documentation //## @brief Get the position of the corner number \a id (in world coordinates) //## //## See SetImageGeometry for how a corner is defined on images. Point3D GetCornerPoint(int id) const; //##Documentation //## @brief Get the position of a corner (in world coordinates) //## //## See SetImageGeometry for how a corner is defined on images. Point3D GetCornerPoint(bool xFront=true, bool yFront=true, bool zFront=true) const; //##Documentation //## @brief Get vector along bounding-box in the specified @a direction in mm //## //## The length of the vector is the size of the bounding-box in the //## specified @a direction in mm //## \sa GetMatrixColumn Vector3D GetAxisVector(unsigned int direction) const { Vector3D frontToBack; frontToBack.Set_vnl_vector(m_IndexToWorldTransform->GetMatrix().GetVnlMatrix().get_column(direction)); frontToBack *= GetExtent(direction); return frontToBack; } //##Documentation //## @brief Get the center of the bounding-box in mm //## Point3D GetCenter() const { assert(m_BoundingBox.IsNotNull()); return m_IndexToWorldTransform->TransformPoint(m_BoundingBox->GetCenter()); } //##Documentation //## @brief Get the squared length of the diagonal of the bounding-box in mm //## double GetDiagonalLength2() const { Vector3D diagonalvector = GetCornerPoint()-GetCornerPoint(false, false, false); return diagonalvector.GetSquaredNorm(); } //##Documentation //## @brief Get the length of the diagonal of the bounding-box in mm //## double GetDiagonalLength() const { return sqrt(GetDiagonalLength2()); } //##Documentation //## @brief Get a VnlVector along bounding-box in the specified //## @a direction, length is spacing //## //## \sa GetAxisVector VnlVector GetMatrixColumn(unsigned int direction) const { return m_IndexToWorldTransform->GetMatrix().GetVnlMatrix().get_column(direction); } #ifdef DOXYGEN_SKIP //##Documentation //## @brief Get the extent of the bounding box (in index/unit coordinates) //## //## To access the extent in mm use GetExtentInMM ScalarType GetExtent(unsigned int direction) const; #endif //##Documentation //## @brief Get the extent of the bounding-box in the specified @a direction in mm //## //## Equals length of GetAxisVector(direction). ScalarType GetExtentInMM(int direction) const { return m_IndexToWorldTransform->GetMatrix().GetVnlMatrix().get_column(direction).magnitude()*GetExtent(direction); } //##Documentation //## @brief Set the extent of the bounding-box in the specified @a direction in mm //## //## @note This changes the matrix in the transform, @a not the bounds, which are given in units! virtual void SetExtentInMM(int direction, ScalarType extentInMM); //##Documentation //## @brief Get the m_IndexToWorldTransform as a vtkLinearTransform vtkLinearTransform* GetVtkTransform() const { return (vtkLinearTransform*)m_VtkIndexToWorldTransform; } //##Documentation //## @brief Set the origin, i.e. the upper-left corner of the plane //## virtual void SetOrigin(const Point3D& origin); //##Documentation //## @brief Translate the origin by a vector //## virtual void Translate(const Vector3D& vector); //##Documentation //## @brief Set the transform to identity //## virtual void SetIdentity(); //##Documentation //## @brief Compose new IndexToWorldTransform with a given transform. //## //## This method composes m_IndexToWorldTransform with another transform, //## modifying self to be the composition of self and other. //## If the argument pre is true, then other is precomposed with self; //## that is, the resulting transformation consists of first applying //## other to the source, followed by self. If pre is false or omitted, //## then other is post-composed with self; that is the resulting //## transformation consists of first applying self to the source, //## followed by other. virtual void Compose( const AffineGeometryFrame3D::TransformType * other, bool pre = 0 ); //##Documentation //## @brief Compose new IndexToWorldTransform with a given vtkMatrix4x4. //## //## Converts the vtkMatrix4x4 into a itk-transform and calls the previous method. virtual void Compose( const vtkMatrix4x4 * vtkmatrix, bool pre = 0 ); //##Documentation //## @brief Get the origin, e.g. the upper-left corner of the plane const Point3D& GetOrigin() const { return m_Origin; } //##Documentation //## @brief Get the origin as VnlVector //## //## \sa GetOrigin VnlVector GetOriginVnl() const { return const_cast(this)->m_Origin.Get_vnl_vector(); } //##Documentation //## @brief Convert world coordinates (in mm) of a \em point to (continuous!) index coordinates //## \warning If you need (discrete) integer index coordinates (e.g., for iterating easily over an image), //## use WorldToIndex(const mitk::Point3D& pt_mm, itk::Index &index). //## For further information about coordinates types, please see the Geometry documentation void WorldToIndex(const mitk::Point3D& pt_mm, mitk::Point3D& pt_units) const; //##Documentation //## @brief Convert (continuous or discrete) index coordinates of a \em point to world coordinates (in mm) //## For further information about coordinates types, please see the Geometry documentation void IndexToWorld(const mitk::Point3D& pt_units, mitk::Point3D& pt_mm) const; //##Documentation //## @brief Convert world coordinates (in mm) of a \em vector //## \a vec_mm to (continuous!) index coordinates. //## @deprecated First parameter (Point3D) is not used. If possible, please use void WorldToIndex(const mitk::Vector3D& vec_mm, mitk::Vector3D& vec_units) const. //## For further information about coordinates types, please see the Geometry documentation void WorldToIndex(const mitk::Point3D& atPt3d_mm, const mitk::Vector3D& vec_mm, mitk::Vector3D& vec_units) const; //##Documentation //## @brief Convert world coordinates (in mm) of a \em vector //## \a vec_mm to (continuous!) index coordinates. //## For further information about coordinates types, please see the Geometry documentation void WorldToIndex(const mitk::Vector3D& vec_mm, mitk::Vector3D& vec_units) const; //##Documentation //## @brief Convert (continuous or discrete) index coordinates of a \em vector //## \a vec_units to world coordinates (in mm) //## @deprecated First parameter (Point3D) is not used. If possible, please use void IndexToWorld(const mitk::Vector3D& vec_units, mitk::Vector3D& vec_mm) const. //## For further information about coordinates types, please see the Geometry documentation void IndexToWorld(const mitk::Point3D& atPt3d_units, const mitk::Vector3D& vec_units, mitk::Vector3D& vec_mm) const; //##Documentation //## @brief Convert (continuous or discrete) index coordinates of a \em vector //## \a vec_units to world coordinates (in mm) //## For further information about coordinates types, please see the Geometry documentation void IndexToWorld(const mitk::Vector3D& vec_units, mitk::Vector3D& vec_mm) const; //##Documentation //## @brief Convert world coordinates (in mm) of a \em point to (discrete!) index coordinates. //## This method rounds to integer indices! //## For further information about coordinates types, please see the Geometry documentation template void WorldToIndex(const mitk::Point3D& pt_mm, itk::Index &index) const { typedef itk::Index IndexType; mitk::Point3D pt_units; this->WorldToIndex(pt_mm, pt_units); int i, dim=index.GetIndexDimension(); if(dim>3) { index.Fill(0); dim=3; } for(i=0;i( pt_units[i] ); index[i]=itk::Math::RoundHalfIntegerUp( pt_units[i] ); } } //##Documentation //## @brief Deprecated for use with ITK version 3.10 or newer. //## Convert world coordinates (in mm) of a \em point to //## ITK physical coordinates (in mm, but without a possible rotation) //## //## This method is useful if you have want to access an mitk::Image //## via an itk::Image. ITK v3.8 and older did not support rotated (tilted) //## images, i.e., ITK images are always parallel to the coordinate axes. //## When accessing a (possibly rotated) mitk::Image via an itk::Image //## the rotational part of the transformation in the Geometry3D is //## simply discarded; in other word: only the origin and spacing is //## used by ITK, not the complete matrix available in MITK. //## With WorldToItkPhysicalPoint you can convert an MITK world //## coordinate (including the rotation) into a coordinate that //## can be used with the ITK image as a ITK physical coordinate //## (excluding the rotation). template void WorldToItkPhysicalPoint(const mitk::Point3D& pt_mm, itk::Point& itkPhysicalPoint) const { mitk::vtk2itk(pt_mm, itkPhysicalPoint); } //##Documentation //## @brief Deprecated for use with ITK version 3.10 or newer. //## Convert ITK physical coordinates of a \em point (in mm, //## but without a rotation) into MITK world coordinates (in mm) //## //## For more information, see WorldToItkPhysicalPoint. template void ItkPhysicalPointToWorld(const itk::Point& itkPhysicalPoint, mitk::Point3D& pt_mm) const { mitk::vtk2itk(itkPhysicalPoint, pt_mm); } //##Documentation //## @brief Initialize the Geometry3D virtual void Initialize(); //##Documentation //## @brief Is this an ImageGeometry? //## //## For more information, see SetImageGeometry itkGetConstMacro(ImageGeometry, bool); //##Documentation //## @brief Define that this Geometry3D is refering to an Image //## //## A geometry referring to an Image needs a slightly different //## definition of the position of the corners (see GetCornerPoint). //## The position of a voxel is defined by the position of its center. //## If we would use the origin (position of the (center of) the first //## voxel) as a corner and display this point, it would seem to be //## \em not at the corner but a bit within the image. Even worse for //## the opposite corner of the image: here the corner would appear //## outside the image (by half of the voxel diameter). Thus, we have //## to correct for this and to be able to do that, we need to know //## that the Geometry3D is referring to an Image. itkSetMacro(ImageGeometry, bool); itkBooleanMacro(ImageGeometry); //##Documentation //## @brief Is this Geometry3D in a state that is valid? virtual bool IsValid() const { return m_Valid; } //##Documentation //## @brief Test whether the point \a p (world coordinates in mm) is //## inside the bounding box bool IsInside(const mitk::Point3D& p) const { mitk::Point3D index; WorldToIndex(p, index); return IsIndexInside(index); } //##Documentation //## @brief Test whether the point \a p ((continous!)index coordinates in units) is //## inside the bounding box bool IsIndexInside(const mitk::Point3D& index) const { bool inside = false; //if it is an image geometry, we need to convert the index to discrete values //this is done by applying the rounding function also used in WorldToIndex (see line 323) if (m_ImageGeometry) { mitk::Point3D discretIndex; discretIndex[0]=itk::Math::RoundHalfIntegerUp( index[0] ); discretIndex[1]=itk::Math::RoundHalfIntegerUp( index[1] ); discretIndex[2]=itk::Math::RoundHalfIntegerUp( index[2] ); inside = m_BoundingBox->IsInside(discretIndex); //we have to check if the index is at the upper border of each dimension, // because the boundingbox is not centerbased if (inside) { const BoundingBox::BoundsArrayType& bounds = m_BoundingBox->GetBounds(); if((discretIndex[0] == bounds[1]) || (discretIndex[1] == bounds[3]) || (discretIndex[2] == bounds[5])) inside = false; } } else inside = m_BoundingBox->IsInside(index); return inside; } //##Documentation //## @brief Convenience method for working with ITK indices template bool IsIndexInside(const itk::Index &index) const { int i, dim=index.GetIndexDimension(); Point3D pt_index; pt_index.Fill(0); for ( i = 0; i < dim; ++i ) { pt_index[i] = index[i]; } return IsIndexInside(pt_index); } //##Documentation //## @brief Get the spacing (size of a pixel). //## itkGetConstReferenceMacro(Spacing, mitk::Vector3D); //##Documentation //## @brief Get the spacing as a float[3] array. const float* GetFloatSpacing() const; //##Documentation //## @brief Set the spacing (m_Spacing) virtual void SetSpacing(const mitk::Vector3D& aSpacing); //##Documentation //## @brief Get the DICOM FrameOfReferenceID referring to the //## used world coordinate system itkGetConstMacro(FrameOfReferenceID, unsigned int); //##Documentation //## @brief Set the DICOM FrameOfReferenceID referring to the //## used world coordinate system itkSetMacro(FrameOfReferenceID, unsigned int); //##Documentation //## @brief Copy the ITK transform //## (m_IndexToWorldTransform) to the VTK transform //## \sa SetIndexToWorldTransform void TransferItkToVtkTransform(); //##Documentation //## @brief Copy the VTK transform //## to the ITK transform (m_IndexToWorldTransform) //## \sa SetIndexToWorldTransform void TransferVtkToItkTransform(); //##Documentation //## @brief Get the parametric bounding-box //## //## See AbstractTransformGeometry for an example usage of this. itkGetConstObjectMacro(ParametricBoundingBox, BoundingBox); //##Documentation //## @brief Get the parametric bounds //## //## See AbstractTransformGeometry for an example usage of this. const BoundingBox::BoundsArrayType& GetParametricBounds() const { assert(m_ParametricBoundingBox.IsNotNull()); return m_ParametricBoundingBox->GetBounds(); } //##Documentation //## @brief Get the parametric extent //## //## See AbstractTransformGeometry for an example usage of this. mitk::ScalarType GetParametricExtent(int direction) const { assert(direction>=0 && direction<3); assert(m_ParametricBoundingBox.IsNotNull()); BoundingBoxType::BoundsArrayType bounds = m_ParametricBoundingBox->GetBounds(); return bounds[direction*2+1]-bounds[direction*2]; } //##Documentation //## @brief Get the parametric extent in mm //## //## See AbstractTransformGeometry for an example usage of this. virtual mitk::ScalarType GetParametricExtentInMM(int direction) const { return GetExtentInMM(direction); } //##Documentation //## @brief Get the parametric transform //## //## See AbstractTransformGeometry for an example usage of this. virtual const Transform3D* GetParametricTransform() const { return m_IndexToWorldTransform; } //##Documentation //## @brief Calculates a bounding-box around the geometry relative //## to a coordinate system defined by a transform //## mitk::BoundingBox::Pointer CalculateBoundingBoxRelativeToTransform(const mitk::AffineTransform3D* transform) const; //##Documentation //## @brief clones the geometry //## //## Overwrite in all sub-classes. //## Normally looks like: //## \code //## Self::Pointer newGeometry = new Self(*this); //## newGeometry->UnRegister(); //## return newGeometry.GetPointer(); //## \endcode virtual AffineGeometryFrame3D::Pointer Clone() const; //##Documentation //##@brief executes affine operations (translate, rotate, scale) virtual void ExecuteOperation(Operation* operation); protected: Geometry3D(); Geometry3D(const Geometry3D& other); static const char* GetTransformAsString( TransformType* transformType ); virtual ~Geometry3D(); virtual void PrintSelf(std::ostream& os, itk::Indent indent) const; virtual void BackTransform(const mitk::Point3D& in, mitk::Point3D& out) const; //##Documentation //## @brief Deprecated virtual void BackTransform(const mitk::Point3D& at, const mitk::Vector3D& in, mitk::Vector3D& out) const; //Without redundant parameter Point3D virtual void BackTransform(const mitk::Vector3D& in, mitk::Vector3D& out) const; //##Documentation //## @brief Set the parametric bounds //## //## Protected in this class, made public in some sub-classes, e.g., //## ExternAbstractTransformGeometry. virtual void SetParametricBounds(const BoundingBox::BoundsArrayType& bounds); /** Resets sub-transforms that compose m_IndexToWorldTransform, by using * the current value of m_IndexToWorldTransform and setting the rotation * component to zero. */ virtual void ResetSubTransforms(); mutable mitk::BoundingBox::Pointer m_ParametricBoundingBox; mutable mitk::TimeBounds m_TimeBounds; vtkMatrix4x4* m_VtkMatrix; bool m_ImageGeometry; //##Documentation //## @brief Spacing of the data. Only significant if the geometry describes //## an Image (m_ImageGeometry==true). mitk::Vector3D m_Spacing; bool m_Valid; unsigned int m_FrameOfReferenceID; static const std::string INDEX_TO_OBJECT_TRANSFORM; static const std::string OBJECT_TO_NODE_TRANSFORM; static const std::string INDEX_TO_NODE_TRANSFORM; static const std::string INDEX_TO_WORLD_TRANSFORM; private: mutable TransformType::Pointer m_InvertedTransform; mutable unsigned long m_IndexToWorldTransformLastModified; VnlQuaternionType m_RotationQuaternion; float m_FloatSpacing[3]; vtkMatrixToLinearTransform* m_VtkIndexToWorldTransform; //##Documentation //## @brief Origin, i.e. upper-left corner of the plane //## Point3D m_Origin; }; } // namespace mitk #endif /* GEOMETRY3D_H_HEADER_INCLUDED_C1EBD0AD */ diff --git a/Core/Code/DataManagement/mitkImage.h b/Core/Code/DataManagement/mitkImage.h index 2889acfde0..34dd869f26 100644 --- a/Core/Code/DataManagement/mitkImage.h +++ b/Core/Code/DataManagement/mitkImage.h @@ -1,663 +1,663 @@ /*========================================================================= Program: Medical Imaging & Interaction Toolkit Language: C++ Date: $Date$ Version: $Revision$ Copyright (c) German Cancer Research Center, Division of Medical and Biological Informatics. All rights reserved. See MITKCopyright.txt or http://www.mitk.org/copyright.html for details. This software is distributed WITHOUT ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the above copyright notices for more information. =========================================================================*/ #ifndef MITKIMAGE_H_HEADER_INCLUDED_C1C2FCD2 #define MITKIMAGE_H_HEADER_INCLUDED_C1C2FCD2 -#include "mitkCommon.h" +#include #include "mitkSlicedData.h" #include "mitkPixelType.h" #include "mitkBaseData.h" #include "mitkLevelWindow.h" #include "mitkPlaneGeometry.h" #include "mitkImageDataItem.h" #ifndef __itkHistogram_h #include #endif class vtkImageData; namespace mitk { class SubImageSelector; //class ImageDataItem; class ImageTimeSelector; //##Documentation //## @brief Image class for storing images //## //## Can be asked for header information, the data vector, //## the mitkIpPicDescriptor struct or vtkImageData objects. If not the complete //## data is required, the appropriate SubImageSelector class should be used //## for access. //## Image organizes sets of slices (s x 2D), volumes (t x 3D) and channels (n //## x ND). Channels are for different kind of data, e.g., morphology in //## channel 0, velocities in channel 1. All channels must have the same Geometry! In //## particular, the dimensions of all channels are the same, only the pixel-type //## may differ between channels. //## //## For importing ITK images use of mitk::ITKImageImport is recommended, see //## \ref Adaptor. //## //## For ITK v3.8 and older: Converting coordinates from the ITK physical //## coordinate system (which does not support rotated images) to the MITK world //## coordinate system should be performed via the Geometry3D of the Image, see //## Geometry3D::WorldToItkPhysicalPoint. //## @ingroup Data class MITK_CORE_EXPORT Image : public SlicedData { friend class SubImageSelector; public: mitkClassMacro(Image, SlicedData); itkNewMacro(Self); mitkCloneMacro(Image); /** Smart Pointer type to a ImageDataItem. */ typedef itk::SmartPointerForwardReference ImageDataItemPointer; //## @param ImportMemoryManagementType This parameter is evaluated when setting new data to an image. //## The different options are: //## CopyMemory: Data to be set is copied and assigned to a new memory block. Data memory block will be freed on deletion of mitk::Image. //## MamageMemory: Data to be set will be referenced, and Data memory block will be freed on deletion of mitk::Image. //## Reference Memory: Data to be set will be referenced, but Data memory block will not be freed on deletion of mitk::Image. //## DontManageMemory = ReferenceMemory. enum ImportMemoryManagementType { CopyMemory, ManageMemory, ReferenceMemory, DontManageMemory = ReferenceMemory }; //##Documentation //## @brief Vector container of SmartPointers to ImageDataItems; //## Class is only for internal usage to allow convenient access to all slices over iterators; //## See documentation of ImageDataItem for details. typedef std::vector ImageDataItemPointerArray; typedef itk::Statistics::Histogram HistogramType; public: //##Documentation //## @brief Returns the PixelType of channel @a n. const mitk::PixelType& GetPixelType(int n = 0) const; //##Documentation //## @brief Get dimension of the image //## unsigned int GetDimension() const; //##Documentation //## @brief Get the size of dimension @a i (e.g., i=0 results in the number of pixels in x-direction). //## //## @sa GetDimensions() unsigned int GetDimension(int i) const; //## @brief Get the data vector of the complete image, i.e., of all channels linked together. //## //## If you only want to access a slice, volume at a specific time or single channel //## use one of the SubImageSelector classes. virtual void* GetData(); //## @brief Get the pixel value at one specific index position. //## @brief Get the pixel value at one specific position. //## //## The pixel type is always being converted to double. double GetPixelValueByIndex(const mitk::Index3D& position, unsigned int timestep = 0); //## @brief Get the pixel value at one specific world position. //## //## The pixel type is always being converted to double. double GetPixelValueByWorldCoordinate(const mitk::Point3D& position, unsigned int timestep = 0); //##Documentation //## @brief Get a volume at a specific time @a t of channel @a n as a vtkImageData. virtual vtkImageData* GetVtkImageData(int t = 0, int n = 0); //##Documentation //## @brief Get the complete image, i.e., all channels linked together, as a @a mitkIpPicDescriptor. //## //## If you only want to access a slice, volume at a specific time or single channel //## use one of the SubImageSelector classes. virtual mitkIpPicDescriptor* GetPic(); //##Documentation //## @brief Check whether slice @a s at time @a t in channel @a n is set virtual bool IsSliceSet(int s = 0, int t = 0, int n = 0) const; //##Documentation //## @brief Check whether volume at time @a t in channel @a n is set virtual bool IsVolumeSet(int t = 0, int n = 0) const; //##Documentation //## @brief Check whether the channel @a n is set virtual bool IsChannelSet(int n = 0) const; //##Documentation //## @brief Set @a data as slice @a s at time @a t in channel @a n. It is in //## the responsibility of the caller to ensure that the data vector @a data //## is really a slice (at least is not smaller than a slice), since there is //## no chance to check this. //## //## The data is copied to an array managed by the image. If the image shall //## reference the data, use SetImportSlice with ImportMemoryManagementType //## set to ReferenceMemory. For importing ITK images use of mitk:: //## ITKImageImport is recommended. //## @sa SetPicSlice, SetImportSlice, SetImportVolume virtual bool SetSlice(const void *data, int s = 0, int t = 0, int n = 0); //##Documentation //## @brief Set @a data as volume at time @a t in channel @a n. It is in //## the responsibility of the caller to ensure that the data vector @a data //## is really a volume (at least is not smaller than a volume), since there is //## no chance to check this. //## //## The data is copied to an array managed by the image. If the image shall //## reference the data, use SetImportVolume with ImportMemoryManagementType //## set to ReferenceMemory. For importing ITK images use of mitk:: //## ITKImageImport is recommended. //## @sa SetPicVolume, SetImportVolume virtual bool SetVolume(const void *data, int t = 0, int n = 0); //##Documentation //## @brief Set @a data in channel @a n. It is in //## the responsibility of the caller to ensure that the data vector @a data //## is really a channel (at least is not smaller than a channel), since there is //## no chance to check this. //## //## The data is copied to an array managed by the image. If the image shall //## reference the data, use SetImportChannel with ImportMemoryManagementType //## set to ReferenceMemory. For importing ITK images use of mitk:: //## ITKImageImport is recommended. //## @sa SetPicChannel, SetImportChannel virtual bool SetChannel(const void *data, int n = 0); //##Documentation //## @brief Set @a data as slice @a s at time @a t in channel @a n. It is in //## the responsibility of the caller to ensure that the data vector @a data //## is really a slice (at least is not smaller than a slice), since there is //## no chance to check this. //## //## The data is managed according to the parameter \a importMemoryManagement. //## @sa SetPicSlice virtual bool SetImportSlice(void *data, int s = 0, int t = 0, int n = 0, ImportMemoryManagementType importMemoryManagement = CopyMemory ); //##Documentation //## @brief Set @a data as volume at time @a t in channel @a n. It is in //## the responsibility of the caller to ensure that the data vector @a data //## is really a volume (at least is not smaller than a volume), since there is //## no chance to check this. //## //## The data is managed according to the parameter \a importMemoryManagement. //## @sa SetPicVolume virtual bool SetImportVolume(void *data, int t = 0, int n = 0, ImportMemoryManagementType importMemoryManagement = CopyMemory ); //##Documentation //## @brief Set @a data in channel @a n. It is in //## the responsibility of the caller to ensure that the data vector @a data //## is really a channel (at least is not smaller than a channel), since there is //## no chance to check this. //## //## The data is managed according to the parameter \a importMemoryManagement. //## @sa SetPicChannel virtual bool SetImportChannel(void *data, int n = 0, ImportMemoryManagementType importMemoryManagement = CopyMemory ); //##Documentation //## @brief Set @a pic as slice @a s at time @a t in channel @a n. //## //## The data is copied to an array managed by the image. //## @todo The corresponding @a Geomety3D and depending @a Geometry2D entries //## are updated according to the information provided in the tags of @a pic. //## @return @a false : dimensions and/or data-type of @a pic does not //## comply with image //## @a true success virtual bool SetPicSlice(const mitkIpPicDescriptor *pic, int s = 0, int t = 0, int n = 0, ImportMemoryManagementType importMemoryManagement = CopyMemory ); //##Documentation //## @brief Set @a pic as volume at time @a t in channel @a n. //## //## The data is copied to an array managed by the image. //## @todo The corresponding @a Geomety3D and depending @a Geometry2D entries //## are updated according to the information provided in the tags of @a pic. //## @return @a false : dimensions and/or data-type of @a pic does not //## comply with image //## @a true success virtual bool SetPicVolume(const mitkIpPicDescriptor *pic, int t = 0, int n = 0, ImportMemoryManagementType importMemoryManagement = CopyMemory ); //##Documentation //## @brief Set @a pic in channel @a n. //## //## The data is copied to an array managed by the image. //## @todo The corresponding @a Geomety3D and depending @a Geometry2D entries //## are updated according to the information provided in the tags of @a pic. //## @return @a false : dimensions and/or data-type of @a pic does not //## comply with image //## @a true success virtual bool SetPicChannel(const mitkIpPicDescriptor *pic, int n = 0, ImportMemoryManagementType importMemoryManagement = CopyMemory ); //##Documentation //## initialize new (or re-initialize) image information //## @warning Initialize() by pic assumes a plane, evenly spaced geometry starting at (0,0,0). virtual void Initialize(const mitk::PixelType& type, unsigned int dimension, unsigned int *dimensions, unsigned int channels = 1); //##Documentation //## initialize new (or re-initialize) image information by a Geometry3D //## //## @param tDim override time dimension (@a n[3]) if @a geometry is a TimeSlicedGeometry (if >0) virtual void Initialize(const mitk::PixelType& type, const mitk::Geometry3D& geometry, unsigned int channels = 1, int tDim=-1); //##Documentation //## initialize new (or re-initialize) image information by a Geometry2D and number of slices //## //## Initializes the bounding box according to the width/height of the //## Geometry2D and @a sDim via SlicedGeometry3D::InitializeEvenlySpaced. //## The spacing is calculated from the Geometry2D. //## @param tDim override time dimension (@a n[3]) if @a geometry is a TimeSlicedGeometry (if >0) //## \sa SlicedGeometry3D::InitializeEvenlySpaced virtual void Initialize(const mitk::PixelType& type, int sDim, const mitk::Geometry2D& geometry2d, bool flipped = false, unsigned int channels = 1, int tDim=-1); //##Documentation //## initialize new (or re-initialize) image information by another //## mitk-image. //## Only the header is used, not the data vector! //## virtual void Initialize(const mitk::Image* image); //##Documentation //## initialize new (or re-initialize) image information by @a pic. //## Dimensions and @a Geometry3D /@a Geometry2D are set according //## to the tags in @a pic. //## Only the header is used, not the data vector! Use SetPicVolume(pic) //## to set the data vector. //## //## @param tDim override time dimension (@a n[3]) in @a pic (if >0) //## @param sDim override z-space dimension (@a n[2]) in @a pic (if >0) //## @warning Initialize() by pic assumes a plane, evenly spaced geometry starting at (0,0,0). virtual void Initialize(const mitkIpPicDescriptor* pic, int channels = 1, int tDim = -1, int sDim = -1); //##Documentation //## initialize new (or re-initialize) image information by @a vtkimagedata, //## a vtk-image. //## Only the header is used, not the data vector! Use //## SetVolume(vtkimage->GetScalarPointer()) to set the data vector. //## //## @param tDim override time dimension in @a vtkimagedata (if >0 and <) //## @param sDim override z-space dimension in @a vtkimagedata (if >0 and <) virtual void Initialize(vtkImageData* vtkimagedata, int channels = 1, int tDim = -1, int sDim = -1); //##Documentation //## initialize new (or re-initialize) image information by @a itkimage, //## a templated itk-image. //## Only the header is used, not the data vector! Use //## SetVolume(itkimage->GetBufferPointer()) to set the data vector. //## //## @param tDim override time dimension in @a itkimage (if >0 and <) //## @param sDim override z-space dimension in @a itkimage (if >0 and <) template void InitializeByItk(const itkImageType* itkimage, int channels = 1, int tDim = -1, int sDim=-1) { if(itkimage==NULL) return; MITK_DEBUG << "Initializing MITK image from ITK image."; // build array with dimensions in each direction with at least 4 entries m_Dimension=itkimage->GetImageDimension(); unsigned int i, *tmpDimensions=new unsigned int[m_Dimension>4?m_Dimension:4]; for(i=0;iGetLargestPossibleRegion().GetSize().GetSize()[i]; if(m_Dimension<4) { unsigned int *p; for(i=0,p=tmpDimensions+m_Dimension;i<4-m_Dimension;++i, ++p) *p=1; } // overwrite number of slices if sDim is set if((m_Dimension>2) && (sDim>=0)) tmpDimensions[2]=sDim; // overwrite number of time points if tDim is set if((m_Dimension>3) && (tDim>=0)) tmpDimensions[3]=tDim; // rough initialization of Image Initialize(mitk::PixelType(typeid(typename itkImageType::PixelType)), m_Dimension, tmpDimensions, channels); const typename itkImageType::SpacingType & itkspacing = itkimage->GetSpacing(); MITK_DEBUG << "ITK spacing " << itkspacing; // access spacing of itk::Image Vector3D spacing; FillVector3D(spacing, itkspacing[0], 1.0, 1.0); if(m_Dimension >= 2) spacing[1]=itkspacing[1]; if(m_Dimension >= 3) spacing[2]=itkspacing[2]; // access origin of itk::Image Point3D origin; const typename itkImageType::PointType & itkorigin = itkimage->GetOrigin(); MITK_DEBUG << "ITK origin " << itkorigin; FillVector3D(origin, itkorigin[0], 0.0, 0.0); if(m_Dimension>=2) origin[1]=itkorigin[1]; if(m_Dimension>=3) origin[2]=itkorigin[2]; // access direction of itk::Image and include spacing const typename itkImageType::DirectionType & itkdirection = itkimage->GetDirection(); MITK_DEBUG << "ITK direction " << itkdirection; mitk::Matrix3D matrix; matrix.SetIdentity(); unsigned int j, itkDimMax3 = (m_Dimension >= 3? 3 : m_Dimension); // check if spacing has no zero entry and itkdirection has no zero columns bool itkdirectionOk = true; mitk::ScalarType columnSum; for( j=0; j < itkDimMax3; ++j ) { columnSum = 0.0; for ( i=0; i < itkDimMax3; ++i) { columnSum += fabs(itkdirection[i][j]); } if(columnSum < mitk::eps) { itkdirectionOk = false; } if ( (spacing[j] < - mitk::eps) // (normally sized) negative value && (j==2) && (m_Dimensions[2] == 1) ) { // Negative spacings can occur when reading single DICOM slices with ITK via GDCMIO // In these cases spacing is not determind by ITK correctly (because it distinguishes correctly // between slice thickness and inter slice distance -- slice distance is meaningless for // single slices). // I experienced that ITK produced something meaningful nonetheless because is is // evaluating the tag "(0018,0088) Spacing between slices" as a fallback. This tag is not // reliable (http://www.itk.org/pipermail/insight-users/2005-September/014711.html) // but gives at least a hint. // In real world cases I experienced that this tag contained the correct inter slice distance // with a negative sign, so we just invert such negative spacings. MITK_WARN << "Illegal value of itk::Image::GetSpacing()[" << j <<"]=" << spacing[j] << ". Using inverted value " << -spacing[j]; spacing[j] = -spacing[j]; } else if (spacing[j] < mitk::eps) // value near zero { MITK_ERROR << "Illegal value of itk::Image::GetSpacing()[" << j <<"]=" << spacing[j] << ". Using 1.0 instead."; spacing[j] = 1.0; } } if(itkdirectionOk == false) { MITK_ERROR << "Illegal matrix returned by itk::Image::GetDirection():" << itkdirection << " Using identity instead."; for ( i=0; i < itkDimMax3; ++i) for( j=0; j < itkDimMax3; ++j ) if ( i == j ) matrix[i][j] = spacing[j]; else matrix[i][j] = 0.0; } else { for ( i=0; i < itkDimMax3; ++i) for( j=0; j < itkDimMax3; ++j ) matrix[i][j] = itkdirection[i][j]*spacing[j]; } // re-initialize PlaneGeometry with origin and direction PlaneGeometry* planeGeometry = static_cast(GetSlicedGeometry(0)->GetGeometry2D(0)); planeGeometry->SetOrigin(origin); planeGeometry->GetIndexToWorldTransform()->SetMatrix(matrix); // re-initialize SlicedGeometry3D SlicedGeometry3D* slicedGeometry = GetSlicedGeometry(0); slicedGeometry->InitializeEvenlySpaced(planeGeometry, m_Dimensions[2]); slicedGeometry->SetSpacing(spacing); // re-initialize TimeSlicedGeometry GetTimeSlicedGeometry()->InitializeEvenlyTimed(slicedGeometry, m_Dimensions[3]); // clean-up delete [] tmpDimensions; this->Initialize(); }; //##Documentation //## @brief Check whether slice @a s at time @a t in channel @a n is valid, i.e., //## is (or can be) inside of the image virtual bool IsValidSlice(int s = 0, int t = 0, int n = 0) const; //##Documentation //## @brief Check whether volume at time @a t in channel @a n is valid, i.e., //## is (or can be) inside of the image virtual bool IsValidVolume(int t = 0, int n = 0) const; //##Documentation //## @brief Check whether the channel @a n is valid, i.e., //## is (or can be) inside of the image virtual bool IsValidChannel(int n = 0) const; //##Documentation //## @brief Returns true if an image is rotated, i.e. its geometry's //## transformation matrix has nonzero elements besides the diagonal. //## Non-diagonal elements are checked if larger then 1/1000 of the matrix' trace. bool IsRotated() const; //##Documentation //## @brief Get the sizes of all dimensions as an integer-array. //## //## @sa GetDimension(int i); unsigned int* GetDimensions() const; //##Documentation //## @brief Sets a geometry to an image. virtual void SetGeometry(Geometry3D* aGeometry3D); virtual const HistogramType* GetScalarHistogram(int t=0) const; //##Documentation //## \brief Get the minimum for scalar images virtual ScalarType GetScalarValueMin(int t=0) const; //##Documentation //## \brief Get the maximum for scalar images virtual ScalarType GetScalarValueMax(int t=0) const; //##Documentation //## \brief Get the second smallest value for scalar images virtual ScalarType GetScalarValue2ndMin(int t=0) const; //##Documentation //## \brief Get the smallest value for scalar images, but do not recompute it first virtual mitk::ScalarType GetScalarValueMinNoRecompute( unsigned int t = 0 ) const { if ( t < m_ScalarMin.size() ) return m_ScalarMin[t]; else return itk::NumericTraits::max(); } //##Documentation //## \brief Get the second smallest value for scalar images, but do not recompute it first virtual mitk::ScalarType GetScalarValue2ndMinNoRecompute( unsigned int t = 0 ) const { if ( t < m_Scalar2ndMin.size() ) return m_Scalar2ndMin[t]; else return itk::NumericTraits::max(); } //##Documentation //## \brief Get the second largest value for scalar images virtual ScalarType GetScalarValue2ndMax(int t=0) const; //##Documentation //## \brief Get the largest value for scalar images, but do not recompute it first virtual mitk::ScalarType GetScalarValueMaxNoRecompute( unsigned int t = 0 ) const { if ( t < m_ScalarMax.size() ) return m_ScalarMax[t]; else return itk::NumericTraits::NonpositiveMin(); } //##Documentation //## \brief Get the second largest value for scalar images, but do not recompute it first virtual mitk::ScalarType GetScalarValue2ndMaxNoRecompute( unsigned int t = 0 ) const { if ( t < m_Scalar2ndMax.size() ) return m_Scalar2ndMax[t]; else return itk::NumericTraits::NonpositiveMin(); } //##Documentation //## \brief Get the count of voxels with the smallest scalar value in the dataset mitk::ScalarType GetCountOfMinValuedVoxels(int t = 0) const; //##Documentation //## \brief Get the count of voxels with the largest scalar value in the dataset mitk::ScalarType GetCountOfMaxValuedVoxels(int t = 0) const; //##Documentation //## \brief Get the count of voxels with the largest scalar value in the dataset virtual unsigned int GetCountOfMaxValuedVoxelsNoRecompute( unsigned int t = 0 ) const { if ( t < m_CountOfMaxValuedVoxels.size() ) return m_CountOfMaxValuedVoxels[t]; else return 0; } //##Documentation //## \brief Get the count of voxels with the smallest scalar value in the dataset virtual unsigned int GetCountOfMinValuedVoxelsNoRecompute( unsigned int t = 0 ) const { if ( t < m_CountOfMinValuedVoxels.size() ) return m_CountOfMinValuedVoxels[t]; else return 0; } //##Documentation //## @warning for internal use only virtual ImageDataItemPointer GetSliceData(int s = 0, int t = 0, int n = 0, void *data = NULL, ImportMemoryManagementType importMemoryManagement = CopyMemory); //##Documentation //## @warning for internal use only virtual ImageDataItemPointer GetVolumeData(int t = 0, int n = 0, void *data = NULL, ImportMemoryManagementType importMemoryManagement = CopyMemory); //##Documentation //## @warning for internal use only virtual ImageDataItemPointer GetChannelData(int n = 0, void *data = NULL, ImportMemoryManagementType importMemoryManagement = CopyMemory); template < typename ItkImageType > friend void _ComputeExtremaInItkImage(ItkImageType* itkImage, mitk::Image * mitkImage, int t); protected: int GetSliceIndex(int s = 0, int t = 0, int n = 0) const; int GetVolumeIndex(int t = 0, int n = 0) const; void ComputeOffsetTable(); virtual void Expand( unsigned int timeSteps ); virtual bool IsValidTimeStep(int t) const; virtual void ResetImageStatistics() const; virtual void ComputeImageStatistics(int t=0) const; virtual ImageDataItemPointer AllocateSliceData(int s = 0, int t = 0, int n = 0, void *data = NULL, ImportMemoryManagementType importMemoryManagement = CopyMemory); virtual ImageDataItemPointer AllocateVolumeData(int t = 0, int n = 0, void *data = NULL, ImportMemoryManagementType importMemoryManagement = CopyMemory); virtual ImageDataItemPointer AllocateChannelData(int n = 0, void *data = NULL, ImportMemoryManagementType importMemoryManagement = CopyMemory); Image(); Image(const Image &other); virtual ~Image(); virtual void Clear(); //## @warning Has to be called by every Initialize method! virtual void Initialize(); ImageTimeSelector* GetTimeSelector() const; virtual void PrintSelf(std::ostream& os, itk::Indent indent) const; mutable ImageDataItemPointerArray m_Channels; mutable ImageDataItemPointerArray m_Volumes; mutable ImageDataItemPointerArray m_Slices; unsigned int m_Dimension; unsigned int *m_Dimensions; size_t *m_OffsetTable; ImageDataItemPointer m_CompleteData; PixelType m_PixelType; mutable itk::Object::Pointer m_HistogramGeneratorObject; mutable itk::Object::Pointer m_TimeSelectorForExtremaObject; mutable std::vector m_CountOfMinValuedVoxels; mutable std::vector m_CountOfMaxValuedVoxels; mutable std::vector m_ScalarMin; mutable std::vector m_ScalarMax; mutable std::vector m_Scalar2ndMin; mutable std::vector m_Scalar2ndMax; itk::TimeStamp m_LastRecomputeTimeStamp; }; //##Documentation //## @brief Cast an itk::Image (with a specific type) to an mitk::Image. //## //## CastToMitkImage does not cast pixel types etc., just image data //## Needs "mitkImage.h" header included. //## If you get a compile error, try image.GetPointer(); //## @ingroup Adaptor //## \sa mitkITKImageImport template void CastToMitkImage(const itk::SmartPointer& itkimage, itk::SmartPointer& mitkoutputimage) { if(mitkoutputimage.IsNull()) { mitkoutputimage = mitk::Image::New(); } mitkoutputimage->InitializeByItk(itkimage.GetPointer()); mitkoutputimage->SetChannel(itkimage->GetBufferPointer()); } //##Documentation //## @brief Cast an itk::Image (with a specific type) to an mitk::Image. //## //## CastToMitkImage does not cast pixel types etc., just image data //## Needs "mitkImage.h" header included. //## If you get a compile error, try image.GetPointer(); //## @ingroup Adaptor //## \sa mitkITKImageImport template void CastToMitkImage(const ItkOutputImageType* itkimage, itk::SmartPointer& mitkoutputimage) { if(mitkoutputimage.IsNull()) { mitkoutputimage = mitk::Image::New(); } mitkoutputimage->InitializeByItk(itkimage); mitkoutputimage->SetChannel(itkimage->GetBufferPointer()); } } // namespace mitk #endif /* MITKIMAGE_H_HEADER_INCLUDED_C1C2FCD2 */ diff --git a/Core/Code/DataManagement/mitkImageDataItem.h b/Core/Code/DataManagement/mitkImageDataItem.h index 9cc0ad757d..2b232e75a3 100644 --- a/Core/Code/DataManagement/mitkImageDataItem.h +++ b/Core/Code/DataManagement/mitkImageDataItem.h @@ -1,137 +1,137 @@ /*========================================================================= Program: Medical Imaging & Interaction Toolkit Language: C++ Date: $Date$ Version: $Revision$ Copyright (c) German Cancer Research Center, Division of Medical and Biological Informatics. All rights reserved. See MITKCopyright.txt or http://www.mitk.org/copyright.html for details. This software is distributed WITHOUT ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the above copyright notices for more information. =========================================================================*/ #ifndef IMAGEDATAITEM_H #define IMAGEDATAITEM_H -#include "mitkCommon.h" +#include #include "mitkPixelType.h" class vtkImageData; namespace mitk { //##Documentation //## @brief Internal class for managing references on sub-images //## //## ImageDataItem is a container for image data which is used internal in //## mitk::Image to handle the communication between the different data types for images //## used in MITK (ipPicDescriptor, mitk::Image, vtkImageData). Common for these image data //## types is the actual image data, but they differ in representation of pixel type etc. //## The class is also used to convert ipPic images to vtkImageData. //## //## The class is mainly used to extract sub-images inside of mitk::Image, like single slices etc. //## It should not be used outside of this. //## //## @param manageMemory Determines if image data is removed while destruction of ImageDataItem or not. //## @ingroup Data class MITK_CORE_EXPORT ImageDataItem : public itk::LightObject { public: mitkClassMacro(ImageDataItem, itk::LightObject); ImageDataItem(const ImageDataItem& aParent, unsigned int dimension, void *data = NULL, bool manageMemory = false, size_t offset = 0); ~ImageDataItem(); ImageDataItem(const mitk::PixelType& type, unsigned int dimension, unsigned int *dimensions, void *data, bool manageMemory); ImageDataItem(const ImageDataItem &other); void* GetData() const { return m_Data; } bool IsComplete() const { return m_IsComplete; } void SetComplete(bool complete) { m_IsComplete = complete; } int GetOffset() const { return m_Offset; } PixelType GetPixelType() const { return m_PixelType; } ImageDataItem::ConstPointer GetParent() const { return m_Parent; } mitkIpPicDescriptor* GetPicDescriptor() const { return m_PicDescriptor; } //## Returns a vtkImageData; if non is present, a new one is constructed. vtkImageData* GetVtkImageData() const { if(m_VtkImageData==NULL) ConstructVtkImageData(); return m_VtkImageData; } // Returns if image data should be deleted on destruction of ImageDataItem. bool GetManageMemory() const { return m_ManageMemory; } virtual void ConstructVtkImageData() const; unsigned long GetSize() const { return m_Size; } virtual void Modified() const; protected: unsigned char* m_Data; PixelType m_PixelType; bool m_ManageMemory; mitkIpPicDescriptor* m_PicDescriptor; mutable vtkImageData* m_VtkImageData; int m_Offset; bool m_IsComplete; unsigned long m_Size; private: ImageDataItem::ConstPointer m_Parent; template unsigned char *ConvertTensorsToRGB() const; }; } // namespace mitk #endif /* IMAGEDATAITEM_H */ diff --git a/Core/Code/DataManagement/mitkLandmarkProjector.h b/Core/Code/DataManagement/mitkLandmarkProjector.h index 6fc52583b1..aa7bf5df38 100644 --- a/Core/Code/DataManagement/mitkLandmarkProjector.h +++ b/Core/Code/DataManagement/mitkLandmarkProjector.h @@ -1,118 +1,118 @@ /*========================================================================= Program: Medical Imaging & Interaction Toolkit Language: C++ Date: $Date$ Version: $Revision$ Copyright (c) German Cancer Research Center, Division of Medical and Biological Informatics. All rights reserved. See MITKCopyright.txt or http://www.mitk.org/copyright.html for details. This software is distributed WITHOUT ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the above copyright notices for more information. =========================================================================*/ #ifndef MITKLANDMARKPROJECTOR_H_HEADER_INCLUDED_C1C68A2C #define MITKLANDMARKPROJECTOR_H_HEADER_INCLUDED_C1C68A2C -#include "mitkCommon.h" +#include #include "itkObject.h" #include "mitkPlaneGeometry.h" #include "mitkPointSet.h" class vtkAbstractTransform; namespace mitk { //##Documentation //## @brief Base-class of landmark-projectors, which project the target landmarks //## to create source landmarks. //## //## @ingroup Geometry class MITK_CORE_EXPORT LandmarkProjector : public itk::Object { public: mitkClassMacro(LandmarkProjector, itk::Object); //##Documentation //## @brief Set the interpolating (world-space-to-world-space) transform, //## which uses the landmarks. //## //## \sa GetCompleteAbstractTransform virtual void SetInterpolatingAbstractTransform(vtkAbstractTransform* anInterpolatingAbstractTransform); //##Documentation //## @brief Get the interpolating (world-space-to-world-space) transform, //## which uses the landmarks. //## //## \sa GetCompleteAbstractTransform //## \sa ComputeCompleteAbstractTransform itkGetConstMacro(InterpolatingAbstractTransform, vtkAbstractTransform*); //##Documentation //## @brief Set frame geometry within which the interpolation shall occur. //## //## Used as a hint, may be ignored depending on the concrete sub-classes. itkSetConstObjectMacro(FrameGeometry, mitk::Geometry3D); //##Documentation //## @brief Get frame geometry within which the interpolation shall occur. //## //## Used as a hint, may be ignored depending on the concrete sub-classes. itkGetConstObjectMacro(FrameGeometry, mitk::Geometry3D); //##Documentation //## @brief Get the parameter plane for use in AbstractTransformGeometry::SetPlane. //## itkGetConstObjectMacro(ParameterPlane, mitk::PlaneGeometry); //##Documentation //## @brief Get the projected landmarks. //## //## @note Valid only after calling ProjectLandmarks. itkGetConstObjectMacro(ProjectedLandmarks, mitk::PointSet::DataType::PointsContainer); //##Documentation //## @brief Get the final target landmarks to use for the interpolating transform. //## //## @note Valid only after calling ProjectLandmarks. itkGetConstObjectMacro(FinalTargetLandmarks, mitk::PointSet::DataType::PointsContainer); //##Documentation //## @brief Get the transform from parameter space to world space incorporating //## the given interpolating transform, which uses the landmarks. //## //## \sa ComputeCompleteAbstractTransform //## \sa SetInterpolatingAbstractTransform virtual vtkAbstractTransform* GetCompleteAbstractTransform() const; virtual void ProjectLandmarks(const mitk::PointSet::DataType::PointsContainer* targetLandmarks) = 0; protected: LandmarkProjector(); virtual ~LandmarkProjector(); //##Documentation //## @brief Compute the transform from parameter space to world space incorporating //## the given interpolating transform, which uses the landmarks. //## //## Called after a new interpolating transform is set via //## SetInterpolatingAbstractTransform(). //## \sa SetInterpolatingAbstractTransform //## \sa GetCompleteAbstractTransform virtual void ComputeCompleteAbstractTransform() = 0; vtkAbstractTransform* m_InterpolatingAbstractTransform; vtkAbstractTransform* m_CompleteAbstractTransform; mitk::Geometry3D::ConstPointer m_FrameGeometry; mutable mitk::PlaneGeometry::ConstPointer m_ParameterPlane; mitk::PointSet::DataType::PointsContainer::Pointer m_WritableFinalTargetLandmarks; mitk::PointSet::DataType::PointsContainer::ConstPointer m_FinalTargetLandmarks; mitk::PointSet::DataType::PointsContainer::Pointer m_ProjectedLandmarks; }; } // namespace mitk #endif /* MITKLANDMARKPROJECTOR_H_HEADER_INCLUDED_C1C68A2C */ diff --git a/Core/Code/DataManagement/mitkLevelWindow.h b/Core/Code/DataManagement/mitkLevelWindow.h index 8dc6ac2cf5..94594e349e 100644 --- a/Core/Code/DataManagement/mitkLevelWindow.h +++ b/Core/Code/DataManagement/mitkLevelWindow.h @@ -1,246 +1,246 @@ /*========================================================================= Program: Medical Imaging & Interaction Toolkit Language: C++ Date: $Date$ Version: $Revision$ Copyright (c) German Cancer Research Center, Division of Medical and Biological Informatics. All rights reserved. See MITKCopyright.txt or http://www.mitk.org/copyright.html for details. This software is distributed WITHOUT ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the above copyright notices for more information. =========================================================================*/ #ifndef LEVELWINDOW_H_HEADER_INCLUDED_C1F4F02C #define LEVELWINDOW_H_HEADER_INCLUDED_C1F4F02C #include "mitkVector.h" -#include "mitkCommon.h" +#include struct mitkIpPicDescriptor; namespace mitk { class Image; //##Documentation //## @brief Class to store level/window values //## //## Current min and max value are stored in m_LowerWindowBound and m_UpperWindowBound. //## The maximum and minimum of valid value range is stored in //## m_RangeMin and m_RangeMax. //## m_DefaultLevel amd m_DefaultWindow store the initial Level/Window values for the image. //## m_DefaultRangeMin and m_DefaultRangeMax store the initial minrange and maxrange for the image. //## //## See documentation of SetAuto for information on how the //## level window is initialized from an image. //## //## @ingroup DataManagement class MITK_CORE_EXPORT LevelWindow { public: LevelWindow(ScalarType level=127.5, ScalarType window=255.0); LevelWindow(const mitk::LevelWindow& levWin); virtual ~LevelWindow(); /*! * \brief method that returns the level value, i.e. the center of * the current grey value interval */ ScalarType GetLevel() const; /*! * \brief returns the current window size, i.e the range size of the current grey value interval */ ScalarType GetWindow() const; /*! * \brief method returns the default level value for the image */ ScalarType GetDefaultLevel() const; /*! * \brief returns the default window size for the image */ ScalarType GetDefaultWindow() const; /*! * \brief Resets the level and the window value to the default values */ void ResetDefaultLevelWindow(); /*! * Returns the minimum Value of the window */ ScalarType GetLowerWindowBound() const; /*! * Returns the upper window bound value of the window */ ScalarType GetUpperWindowBound() const; /*! * To set the level and the window value */ void SetLevelWindow(ScalarType level, ScalarType window); /*! * Set the lower and upper bound of the window */ void SetWindowBounds(ScalarType lowerBound, ScalarType upperBound); /*! * sets the window to its maximum Size in scaleRange */ void SetToMaxWindowSize(); /*! * Set the range minimum and maximum value */ void SetRangeMinMax(ScalarType min, ScalarType max); /*! * Get the range minimum value */ ScalarType GetRangeMin() const; /*! * Get the range maximum value */ ScalarType GetRangeMax() const; /*! * Get the default range minimum value */ ScalarType GetDefaultLowerBound() const; /*! * Get the default range maximum value */ ScalarType GetDefaultUpperBound() const; /*! * \brief the default min and max range for image will be reset */ void ResetDefaultRangeMinMax(); /**! * \brief returns the size of the grey value range */ ScalarType GetRange() const; /*! * set the default level and window value */ void SetDefaultLevelWindow(ScalarType level, ScalarType window); /*! * set the default Bounderies */ void SetDefaultBoundaries(ScalarType low, ScalarType up); /**! * \brief sets level/window to the min/max greyvalues of the given Image */ void SetAuto(const mitk::Image* image, bool tryPicTags = true, bool guessByCentralSlice = true); /** * If a level window is set to fixed, the set and get methods won't accept * modifications to the level window settings anymore. This behaviour can * be turned of by setting fixed to false; */ void SetFixed( bool fixed ); /** * Returns whether the level window settings are fixed (@see SetFixed(bool)) or not */ bool GetFixed() const; /** * Returns whether the level window settings are fixed (@see SetFixed(bool)) or not */ bool IsFixed() const; /*! * \brief equality operator implementation that allows to compare two level windows */ virtual bool operator==(const LevelWindow& levWin) const; /*! * \brief non equality operator implementation that allows to compare two level windows */ virtual bool operator!=(const LevelWindow& levWin) const; /*! * \brief implementation necessary because operator made * private in itk::Object */ virtual LevelWindow& operator=(const LevelWindow& levWin); protected: /**! * \brief sets level/window according to the tags in the given mitkIpPicDescriptor * \return @a true if tags where found */ bool SetAutoByPicTags(const mitkIpPicDescriptor* pic); /*! * lower bound of current window */ ScalarType m_LowerWindowBound; /*! * upper bound of current window */ ScalarType m_UpperWindowBound; /*! * minimum gray value of the window */ ScalarType m_RangeMin; /*! * maximum gray value of the window */ ScalarType m_RangeMax; /*! * default minimum gray value of the window */ ScalarType m_DefaultLowerBound; /*! * default maximum gray value of the window */ ScalarType m_DefaultUpperBound; /*! * Defines whether the level window settings may be changed after * initialization or not. */ bool m_Fixed; /*! * confidence tests * * if m_LowerWindowBound > m_UpperWindowBound, then the values for m_LowerWindowBound and m_UpperWindowBound will be exchanged * * if m_LowerWindowBound < m_RangeMin, m_LowerWindowBound will be set to m_RangeMin. m_UpperWindowBound will be decreased the same as m_LowerWindowBound will be increased, but minimum value for m_UpperWindowBound is also m_RangeMin. * * if m_UpperWindowBound > m_RangeMax, m_UpperWindowBound will be set to m_RangeMax. m_LowerWindowBound will be increased the same as m_UpperWindowBound will be decreased, but maximum value for m_LowerWindowBound is also m_RangeMax. * */ inline void EnsureConsistency(); }; } // namespace mitk #endif /* LEVELWINDOW_H_HEADER_INCLUDED_C1F4F02C */ diff --git a/Core/Code/DataManagement/mitkLevelWindowPreset.h b/Core/Code/DataManagement/mitkLevelWindowPreset.h index 952d795abe..c5cf7144e4 100644 --- a/Core/Code/DataManagement/mitkLevelWindowPreset.h +++ b/Core/Code/DataManagement/mitkLevelWindowPreset.h @@ -1,63 +1,63 @@ /*========================================================================= Program: Medical Imaging & Interaction Toolkit Language: C++ Date: $Date$ Version: $Revision$ Copyright (c) German Cancer Research Center, Division of Medical and Biological Informatics. All rights reserved. See MITKCopyright.txt or http://www.mitk.org/copyright.html for details. This software is distributed WITHOUT ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the above copyright notices for more information. =========================================================================*/ #ifndef LEVELWINDOWPRESET_H_HEADER #define LEVELWINDOWPRESET_H_HEADER #include -#include +#include #include #include namespace mitk { class MITK_CORE_EXPORT LevelWindowPreset : public vtkXMLParser { public: static LevelWindowPreset *New(); vtkTypeMacro(LevelWindowPreset,vtkXMLParser); bool LoadPreset(); bool LoadPreset(std::string fileName); double getLevel(std::string name); double getWindow(std::string window); std::map& getLevelPresets(); std::map& getWindowPresets(); void newPresets(std::map newLevel, std::map newWindow); protected: LevelWindowPreset(); ~LevelWindowPreset(); private: //##Documentation //## @brief method used in XLM-Reading; gets called when a start-tag is read void StartElement (const char *elementName, const char **atts); //void saveXML(mitk::XMLWriter& xmlWriter); void save(); //##Documentation //## @brief reads an XML-String-Attribute std::string ReadXMLStringAttribut( std::string name, const char** atts); static const std::string PRESET; std::map m_Level; std::map m_Window; std::string m_XmlFileName; }; } #endif diff --git a/Core/Code/DataManagement/mitkLookupTable.h b/Core/Code/DataManagement/mitkLookupTable.h index 461c3eef2c..f6ac488630 100644 --- a/Core/Code/DataManagement/mitkLookupTable.h +++ b/Core/Code/DataManagement/mitkLookupTable.h @@ -1,132 +1,132 @@ /*========================================================================= Program: Medical Imaging & Interaction Toolkit Language: C++ Date: $Date$ Version: $Revision$ Copyright (c) German Cancer Research Center, Division of Medical and Biological Informatics. All rights reserved. See MITKCopyright.txt or http://www.mitk.org/copyright.html for details. This software is distributed WITHOUT ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the above copyright notices for more information. =========================================================================*/ #ifndef MITKLookupTable_H_HEADER_INCLUDED_C1EBD53D #define MITKLookupTable_H_HEADER_INCLUDED_C1EBD53D -#include "mitkCommon.h" +#include #include "vtkLookupTable.h" #include #include class vtkColorTransferFunction; class vtkPiecewiseFunction; namespace mitk { //## //##Documentation //## @brief LookupTable containing a vtkLookupTable //## @ingroup Data //## class MITK_CORE_EXPORT LookupTable : public itk::DataObject { public: /** *@brief Some convenient typedefs. */ typedef unsigned char RawLookupTableType; mitkClassMacro( LookupTable, itk::DataObject ); itkNewMacro( Self ); /** * @returns the associated vtkLookupTable */ virtual vtkLookupTable* GetVtkLookupTable() const; virtual RawLookupTableType * GetRawLookupTable() const; virtual void SetVtkLookupTable( vtkLookupTable* lut ); virtual void ChangeOpacityForAll( float opacity ); virtual void ChangeOpacity(int index, float opacity ); /*! * \brief equality operator implementation */ virtual bool operator==( const mitk::LookupTable& LookupTable ) const; /*! * \brief non equality operator implementation */ virtual bool operator!=( const LookupTable& LookupTable ) const; /*! * \brief implementation necessary because operator made * private in itk::Object */ virtual LookupTable& operator=( const LookupTable& LookupTable ); /** * Updates the output information of the current object by calling * updateOutputInformation of the data objects source object. */ virtual void UpdateOutputInformation( ); /** * Sets the requested Region to the largest possible region. * This method is not implemented, since this is the default * behaviour of the itk pipeline and we do not support the * requested-region mechanism for lookup-tables */ virtual void SetRequestedRegionToLargestPossibleRegion( ); /** * Checks, if the requested region lies outside of the buffered region by * calling verifyRequestedRegion(). */ virtual bool RequestedRegionIsOutsideOfTheBufferedRegion( ); /** * Checks if the requested region is completely contained in * the buffered region. Since we always want to process the lookup * table as a whole, this method always returns true */ virtual bool VerifyRequestedRegion( ); /** * This method has no effect for lookup tables, since we do * not support the region-mechanism */ virtual void SetRequestedRegion( itk::DataObject *data ); LookupTable(); virtual ~LookupTable(); void CreateColorTransferFunction(vtkColorTransferFunction*& colorFunction); void CreateOpacityTransferFunction(vtkPiecewiseFunction*& opacityFunction); void CreateGradientTransferFunction(vtkPiecewiseFunction*& gradientFunction); protected: vtkLookupTable* m_LookupTable; private: }; } // namespace mitk #endif /* LookupTable_H_HEADER_INCLUDED_C1EBD53D */ diff --git a/Core/Code/DataManagement/mitkMaterial.h b/Core/Code/DataManagement/mitkMaterial.h index 2ad2d200b5..82f25d2d46 100644 --- a/Core/Code/DataManagement/mitkMaterial.h +++ b/Core/Code/DataManagement/mitkMaterial.h @@ -1,478 +1,478 @@ /*========================================================================= Program: Medical Imaging & Interaction Toolkit Language: C++ Date: $Date$ Version: $Revision$ Copyright (c) German Cancer Research Center, Division of Medical and Biological Informatics. All rights reserved. See MITKCopyright.txt or http://www.mitk.org/copyright.html for details. This software is distributed WITHOUT ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the above copyright notices for more information. =========================================================================*/ #ifndef _MITK_MATERIAL_H_ #define _MITK_MATERIAL_H_ -#include "mitkCommon.h" +#include #include #include #include #include #include namespace mitk { /** * Encapsulates 3D visualization properties which are forwarded to vtk for * color mapping. This includes color, specular coefficient and power, opacity * interpolation type (flat, gouraud, phong) and representation (points, * wireframe or surface). * * @see vtkProperty */ class MITK_CORE_EXPORT Material : public itk::Object { public: mitkClassMacro( Material, itk::Object ); typedef itk::RGBPixel Color; enum InterpolationType { Flat, Gouraud, Phong }; enum RepresentationType { Points, Wireframe, Surface }; /** * Constructor. Materials are set to the following default values: * Color (0.5, 0.5, 0.5) color coefficient 1.0, specular color (1.0, 1.0, 1.0), * specular coefficient 1.0, specular power 10, opacity 1.0, interpolation * Gouraud, representation Surface. * @param node optinally a data tree node may be defined to which the properties * are forwarded. Please note, that if this node doesn't have the * needed properties associated, they will be added. */ static Pointer New() { Pointer smartPtr = new Material( ); smartPtr->UnRegister(); return smartPtr; } /** * Constructor. All values besides the given ones are set to defaults as * described in the default constructor * @param color the material color in RGB. Each RGB value should be in the * range [0..1] * @param opacity the opacity of the material. 0.0 means fully transparent * and 1.0 means solid. * @param node optinally a data tree node may be defined to which the properties * are forwarded. Please note, that if this node doesn't have the * needed properties associated, they will be added. */ static Pointer New( Color color, vtkFloatingPointType opacity = 1.0f) { Pointer smartPtr = new Material(color, opacity ); smartPtr->UnRegister(); return smartPtr; } /** * Constructor. All values besides the given ones are set to defaults as * described in the default constructor * @param red the red component of the materials color (range [0..1]) * @param green the green component of the materials color (range [0..1]) * @param blue the blue component of the materials color (range [0..1]) * @param opacity the opacity of the material. 0.0 means fully transparent * and 1.0 means solid. * @param node optionally a data tree node may be defined to which the properties * are forwarded. Please note, that if this node doesn't have the * needed properties associated, they will be added. */ static Pointer New( vtkFloatingPointType red, vtkFloatingPointType green, vtkFloatingPointType blue, vtkFloatingPointType opacity = 1.0f) { Pointer smartPtr = new Material(red, green, blue, opacity ); smartPtr->UnRegister(); return smartPtr; } /** * Constructor. All values besides the given ones are set to defaults as * described in the default constructor * @param red the red component of the materials color (range [0..1]) * @param green the green component of the materials color (range [0..1]) * @param blue the blue component of the materials color (range [0..1]) * @param colorCoefficient a scaling factor for the color coefficient which * will be multiplied with each color component (range [0..1]). * @param specularCoefficient controls in combination with the specular power * how shiny the material will appear (range [0..1]). * @param specularPower controls in combination with the specular coefficient * how shiny the material will appear (range [0..inf]). * @param opacity the opacity of the material. 0.0 means fully transparent * and 1.0 means solid. * @param node optionally a data tree node may be defined to which the properties * are forwarded. Please note, that if this node doesn't have the * needed properties associated, they will be added. */ static Pointer New( vtkFloatingPointType red, vtkFloatingPointType green, vtkFloatingPointType blue, vtkFloatingPointType colorCoefficient, vtkFloatingPointType specularCoefficient, vtkFloatingPointType specularPower, vtkFloatingPointType opacity ) { Pointer smartPtr = new Material(red, green, blue, colorCoefficient, specularCoefficient, specularPower, opacity ); smartPtr->UnRegister(); return smartPtr; } /** * Constructor. All values besides the given ones are set to defaults as * described in the default constructor * * @param color the material color in RGB. Each RGB value should be in the * range [0..1] * @param colorCoefficient a scaling factor for the color coefficient which * will be multiplied with each color component (range [0..1]). * @param specularCoefficient controls in combination with the specular power * how shiny the material will appear (range [0..1]). * @param specularPower controls in combination with the specular coefficient * how shiny the material will appear (range [0..inf]). * @param opacity the opacity of the material. 0.0 means fully transparent * and 1.0 means solid. * @param node optionally a data tree node may be defined to which the properties * are forwarded. Please note, that if this node doesn't have the * needed properties associated, they will be added. */ static Pointer New( Color color, vtkFloatingPointType colorCoefficient, vtkFloatingPointType specularCoefficient, vtkFloatingPointType specularPower, vtkFloatingPointType opacity ) { Pointer smartPtr = new Material(color, colorCoefficient, specularCoefficient, specularPower, opacity ); smartPtr->UnRegister(); return smartPtr; } /** * Copy constructor */ mitkNewMacro1Param(Material, const Material&); /** * Copy constructor, provided for convinience. The values are copied from property * and afterwards the values provided for red green blue and opacity are written into the object. */ static Pointer New( const Material& property, vtkFloatingPointType red, vtkFloatingPointType green, vtkFloatingPointType blue, vtkFloatingPointType opacity = 1.0, std::string name = "" ) { Pointer smartPtr = new Material(property, red, green, blue, opacity, name ); smartPtr->UnRegister(); return smartPtr; } virtual bool Assignable(const Material& other) const; virtual Material& operator=(const Material& other); /* Sets the materials color in RGB space. The rgb components have to be * in the range [0..1] * @param color the new color of the material */ virtual void SetColor( Color color ); /** * Sets the materials color in RGB space. The rgb components have to be * in the range [0..1] * @param red the red component of the materials color (range [0..1]) * @param green the green component of the materials color (range [0..1]) * @param blue the blue component of the materials color (range [0..1]) */ virtual void SetColor( vtkFloatingPointType red, vtkFloatingPointType green, vtkFloatingPointType blue ); /** * Sets a attenuation coefficient for the color. A value of 0 results in * a black object. VAlid range is [0..1] * @param coefficient the color attenuation coefficient */ virtual void SetColorCoefficient( vtkFloatingPointType coefficient ); /** * Sets the specular color * @param color the specular color in RGB. Each RGB value should be in the * range [0..1] */ virtual void SetSpecularColor( Color color ); /** * Sets the specular color * @param red the red component of the specular color (range [0..1]) * @param green the green component of the specular color (range [0..1]) * @param blue the blue component of the specular color (range [0..1]) */ virtual void SetSpecularColor( vtkFloatingPointType red, vtkFloatingPointType green, vtkFloatingPointType blue ); /** * Sets the specular coefficient which controls the shininess of the object * together with the specular power * @param specularCoefficient the new specular coefficient. Valid range * is [0..1] */ virtual void SetSpecularCoefficient( vtkFloatingPointType specularCoefficient ); /** * Sets the specular power which controls the shininess of the object * together with the specular coefficient * @param specularCoefficient the new specular coefficient. Valid range * is [0..inf] */ virtual void SetSpecularPower( vtkFloatingPointType specularPower ); /** * Sets the opacity of the material, which controls how transparent the * object appears. Valid range is [0..1], where 0 means fully transparent * and 1 means a solid surface. * @param opacity the new opacity of the material */ virtual void SetOpacity( vtkFloatingPointType opacity ); /** * Sets the surface interpolation method of the object rendered using the * given materials. Valid Interopation types are Flat, Gouraud and Phong. * See any computer graphics book for their meaning * @param interpolation the interpolation method used for rendering of * surfaces. */ virtual void SetInterpolation( InterpolationType interpolation ); /** * Sets the surface representation method of the object rendered using the * given materials. Valid Interopation types are Points, Wireframe and * Surface. * @param representation the representation method used for rendering of * surfaces. */ virtual void SetRepresentation( RepresentationType representation ); /** * Set/Get the width of a Line. The width is expressed in screen units. The default is 1.0. */ virtual void SetLineWidth( float lineWidth ); /** * @returns the color of the material */ virtual Color GetColor() const; /** * @returns the color coefficient of the material. Range is [0..1] */ virtual vtkFloatingPointType GetColorCoefficient() const; /** * @returns the specular color of the material in rgb values, which * range from 0 .. 1 */ virtual Color GetSpecularColor() const; /** * @returns the specular coefficient used for rendering. Range is [0..1] */ virtual vtkFloatingPointType GetSpecularCoefficient() const; /** * @returns the specular power. Ranges from 0 to infinity */ virtual vtkFloatingPointType GetSpecularPower() const; /** * @returns the opacity of the material. Ranges from 0 to 1 */ virtual vtkFloatingPointType GetOpacity() const; /** * @returns the interpolation method used for rendering. */ virtual InterpolationType GetInterpolation() const; /** * @returns the representation type used for rendering. */ virtual RepresentationType GetRepresentation() const; /** * @returns the interpolation method used for rendering using the predefined * vtk constants. */ virtual int GetVtkInterpolation() const; /** * @returns the representation type used for rendering using the predefined * vtk constants. */ virtual int GetVtkRepresentation() const; /** * @returns the line width used for wireframe rendering as a fraction of screen units */ virtual float GetLineWidth() const; /** * Fills the current materials with the properties of the * given material. * @param property the materials which should be copied in the * current materials * @param copyDataNode If set to true, the data tree node and renderer * associated with the material property are also copied. Otherwise * these member variables will be left untouched */ virtual void Initialize( const Material& property ); /** * comparison operator which uses the member variables for * comparison */ virtual bool operator==( const Material& property ) const; /** * Dumps the properties to the out stream out */ void PrintSelf ( std::ostream &os, itk::Indent ) const; /** * Sets an optional name which may be associated with the material property * Please note, that this name is NOT forwarded to the data tree node * as the node name */ itkSetMacro( Name, std::string ); /** * returns the name associated with the material property */ itkGetConstMacro( Name, std::string ); protected: /** * Constructor. Materials are set to the following default values: * Color (0.5, 0.5, 0.5) color coefficient 1.0, specular color (1.0, 1.0, 1.0), * specular coefficient 1.0, specular power 10, opacity 1.0, interpolation * Gouraud, representation Surface. * @param node optinally a data tree node may be defined to which the properties * are forwarded. Please note, that if this node doesn't have the * needed properties associated, they will be added. */ Material( ); /** * Constructor. All values besides the given ones are set to defaults as * described in the default constructor * @param color the material color in RGB. Each RGB value should be in the * range [0..1] * @param opacity the opacity of the material. 0.0 means fully transparent * and 1.0 means solid. * @param node optinally a data tree node may be defined to which the properties * are forwarded. Please note, that if this node doesn't have the * needed properties associated, they will be added. */ Material( Color color, vtkFloatingPointType opacity = 1.0f ); /** * Constructor. All values besides the given ones are set to defaults as * described in the default constructor * @param red the red component of the materials color (range [0..1]) * @param green the green component of the materials color (range [0..1]) * @param blue the blue component of the materials color (range [0..1]) * @param opacity the opacity of the material. 0.0 means fully transparent * and 1.0 means solid. * @param node optionally a data tree node may be defined to which the properties * are forwarded. Please note, that if this node doesn't have the * needed properties associated, they will be added. */ Material( vtkFloatingPointType red, vtkFloatingPointType green, vtkFloatingPointType blue, vtkFloatingPointType opacity = 1.0f ); /** * Constructor. All values besides the given ones are set to defaults as * described in the default constructor * @param red the red component of the materials color (range [0..1]) * @param green the green component of the materials color (range [0..1]) * @param blue the blue component of the materials color (range [0..1]) * @param colorCoefficient a scaling factor for the color coefficient which * will be multiplied with each color component (range [0..1]). * @param specularCoefficient controls in combination with the specular power * how shiny the material will appear (range [0..1]). * @param specularPower controls in combination with the specular coefficient * how shiny the material will appear (range [0..inf]). * @param opacity the opacity of the material. 0.0 means fully transparent * and 1.0 means solid. * @param node optionally a data tree node may be defined to which the properties * are forwarded. Please note, that if this node doesn't have the * needed properties associated, they will be added. */ Material( vtkFloatingPointType red, vtkFloatingPointType green, vtkFloatingPointType blue, vtkFloatingPointType colorCoefficient, vtkFloatingPointType specularCoefficient, vtkFloatingPointType specularPower, vtkFloatingPointType opacity ); /** * Constructor. All values besides the given ones are set to defaults as * described in the default constructor * * @param color the material color in RGB. Each RGB value should be in the * range [0..1] * @param colorCoefficient a scaling factor for the color coefficient which * will be multiplied with each color component (range [0..1]). * @param specularCoefficient controls in combination with the specular power * how shiny the material will appear (range [0..1]). * @param specularPower controls in combination with the specular coefficient * how shiny the material will appear (range [0..inf]). * @param opacity the opacity of the material. 0.0 means fully transparent * and 1.0 means solid. * @param node optionally a data tree node may be defined to which the properties * are forwarded. Please note, that if this node doesn't have the * needed properties associated, they will be added. */ Material( Color color, vtkFloatingPointType colorCoefficient, vtkFloatingPointType specularCoefficient, vtkFloatingPointType specularPower, vtkFloatingPointType opacity ); /** * Copy constructor */ Material( const Material& property ); /** * Copy constructor, provided for convinience. The values are copied from property * and afterwards the values provided for red green blue and opacity are written into the object. */ Material( const Material& property, vtkFloatingPointType red, vtkFloatingPointType green, vtkFloatingPointType blue, vtkFloatingPointType opacity = 1.0, std::string name = ""); virtual void InitializeStandardValues(); virtual void Update(); std::string m_Name; Color m_Color; Color m_SpecularColor; vtkFloatingPointType m_ColorCoefficient; vtkFloatingPointType m_SpecularCoefficient; vtkFloatingPointType m_SpecularPower; vtkFloatingPointType m_Opacity; float m_LineWidth; InterpolationType m_Interpolation; RepresentationType m_Representation; }; typedef itk::VectorContainer< unsigned int, Material::Pointer > MaterialVectorContainer; } #endif diff --git a/Core/Code/DataManagement/mitkMemoryUtilities.h b/Core/Code/DataManagement/mitkMemoryUtilities.h index 77cde547b3..081c478bee 100644 --- a/Core/Code/DataManagement/mitkMemoryUtilities.h +++ b/Core/Code/DataManagement/mitkMemoryUtilities.h @@ -1,99 +1,99 @@ /*========================================================================= Program: Medical Imaging & Interaction Toolkit Language: C++ Date: $Date$ Version: $Revision$ Copyright (c) German Cancer Research Center, Division of Medical and Biological Informatics. All rights reserved. See MITKCopyright.txt or http://www.mitk.org/copyright.html for details. This software is distributed WITHOUT ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the above copyright notices for more information. =========================================================================*/ #ifndef _MITK_MEMORY_UTILITIES_H_ #define _MITK_MEMORY_UTILITIES_H_ #include #include -#include "mitkCommon.h" +#include namespace mitk { class MITK_CORE_EXPORT MemoryUtilities { public: /** * Returns the memory usage of the current process in bytes. * On linux, this refers to the virtual memory allocated by * the process (the VIRT column in top). * On windows, this refery to the size in bytes of the working * set pages (the "Speicherauslastung" column in the task manager). */ static size_t GetProcessMemoryUsage(); /** * Returns the total size of phyiscal memory in bytes */ static size_t GetTotalSizeOfPhysicalRam(); /** * Allocates an array of a given number of elements. Each element * has a size of sizeof(ElementType). The function returns NULL, if the array * could not be allocated. * @param numberOfElements the number of elements of the array * @param noThrow if set to false, an exception is thrown if memory allocation * fails. If set to true, a itk::MemoryAllocationError is thrown * @returns a pointer to the allocated array. If noThrow == true, NULL is returned * if memory allocation failed. */ template static ElementType* AllocateElements(size_t numberOfElements, bool noThrow = false ) { // Encapsulate all image memory allocation here to throw an // exception when memory allocation fails even when the compiler // does not do this by default. ElementType* data = NULL; try { data = new ElementType[numberOfElements]; } catch(...) { data = NULL; } if( ( data == NULL ) && ( noThrow == false ) ) { throw itk::MemoryAllocationError(__FILE__, __LINE__, "Failed to allocate memory.", ITK_LOCATION); } return data; } /** * Deletes an array of elements previously allocated by AllocateElements. * @param elements the array to delete. Not that NULL is an accepted value. */ template static void DeleteElements(ElementType* elements) { if ( elements != NULL ) { delete[] elements; } } protected: #ifndef _MSC_VER static int ReadStatmFromProcFS( int* size, int* res, int* shared, int* text, int* sharedLibs, int* stack, int* dirtyPages ); #endif }; } //end of namespace mitk #endif diff --git a/Core/Code/DataManagement/mitkModalityProperty.h b/Core/Code/DataManagement/mitkModalityProperty.h index 7b5bec4af1..650027473c 100644 --- a/Core/Code/DataManagement/mitkModalityProperty.h +++ b/Core/Code/DataManagement/mitkModalityProperty.h @@ -1,57 +1,57 @@ /*========================================================================= Program: Medical Imaging & Interaction Toolkit Language: C++ Date: $Date: 2009-05-15 10:46:54 +0200 (Fr, 15 Mai 2009) $ Version: $Revision: 17272 $ Copyright (c) German Cancer Research Center, Division of Medical and Biological Informatics. All rights reserved. See MITKCopyright.txt or http://www.mitk.org/copyright.html for details. This software is distributed WITHOUT ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the above copyright notices for more information. =========================================================================*/ #ifndef mitkModalityProperty_h_Included #define mitkModalityProperty_h_Included -#include "mitkCommon.h" +#include #include "mitkEnumerationProperty.h" #include namespace mitk { /** \brief Enumerates all known modalities \ingroup DataManagement */ class MITK_CORE_EXPORT ModalityProperty : public EnumerationProperty { public: mitkClassMacro(ModalityProperty, EnumerationProperty); itkNewMacro(ModalityProperty); mitkNewMacro1Param(ModalityProperty, const IdType&); mitkNewMacro1Param(ModalityProperty, const std::string&); virtual BaseProperty& operator=(const BaseProperty& other) { return Superclass::operator=(other); } protected: ModalityProperty(); ModalityProperty( const IdType& value ); ModalityProperty( const std::string& value ); virtual ~ModalityProperty(); virtual void AddEnumerationTypes(); }; } // namespace #endif diff --git a/Core/Code/DataManagement/mitkModeOperation.h b/Core/Code/DataManagement/mitkModeOperation.h index 4d4053336d..d869c53bd5 100644 --- a/Core/Code/DataManagement/mitkModeOperation.h +++ b/Core/Code/DataManagement/mitkModeOperation.h @@ -1,52 +1,52 @@ /*========================================================================= Program: Medical Imaging & Interaction Toolkit Language: C++ Date: $Date$ Version: $Revision$ Copyright (c) German Cancer Research Center, Division of Medical and Biological Informatics. All rights reserved. See MITKCopyright.txt or http://www.mitk.org/copyright.html for details. This software is distributed WITHOUT ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the above copyright notices for more information. =========================================================================*/ #ifndef MODEOPERATION_H_HEADER_INCLUDED #define MODEOPERATION_H_HEADER_INCLUDED -#include "mitkCommon.h" +#include #include "mitkOperation.h" #include namespace mitk { // class Operation; //##Documentation //## @brief class that holds the information for a change of the modus of an interactor object //## //## @ingroup Undo class MITK_CORE_EXPORT ModeOperation : public Operation { public: typedef Interactor::ModeType ModeType; mitkClassMacro(ModeOperation, Operation); //##Documentation //## Constructor ModeOperation(OperationType operationType, ModeType mode); virtual ~ModeOperation(); ModeType GetMode(); protected: ModeType m_Mode; }; }//namespace mitk #endif /* MODEOPERATION_H_HEADER_INCLUDED */ diff --git a/Core/Code/DataManagement/mitkNodePredicateBase.h b/Core/Code/DataManagement/mitkNodePredicateBase.h index 3c882f264c..67a1107b0b 100644 --- a/Core/Code/DataManagement/mitkNodePredicateBase.h +++ b/Core/Code/DataManagement/mitkNodePredicateBase.h @@ -1,58 +1,58 @@ /*========================================================================= Program: Medical Imaging & Interaction Toolkit Language: C++ Date: $Date$ Version: $Revision$ Copyright (c) German Cancer Research Center, Division of Medical and Biological Informatics. All rights reserved. See MITKCopyright.txt or http://www.mitk.org/copyright.html for details. This software is distributed WITHOUT ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the above copyright notices for more information. =========================================================================*/ #ifndef MITKNODEPREDICATEBASE_H_HEADER_INCLUDED_ #define MITKNODEPREDICATEBASE_H_HEADER_INCLUDED_ -#include "mitkCommon.h" +#include #include "itkObject.h" namespace mitk { class DataNode; //##Documentation //## @brief Interface for evaluation conditions used in the DataStorage class GetSubset() method //## //## Classes that inherit this interface can be used as predicates in the GetSubset() method //## of mitk::DataStorage. By combining different predicate objects, the user can form complex //## queries like "give me all nodes that either contain a surface object or a binary segmentation //## and that are tagged as Organtype == 'Liver'". //## @warning NodePredicates are now derived from itk::Object and make thus use of the smart pointer concept. //## As a result predicates should only store raw pointers because for one thing they are not owners //## of these objects and should not keep them alive. //## //## @ingroup DataStorage class MITK_CORE_EXPORT NodePredicateBase: public itk::Object { public: mitkClassMacro(NodePredicateBase,itk::Object); //##Documentation //## @brief Standard Destructor virtual ~NodePredicateBase(); //##Documentation //## @brief This method will be used to evaluate the node. Has to be overwritten in subclasses virtual bool CheckNode(const mitk::DataNode* node) const = 0; }; } // namespace mitk #endif /* MITKNODEPREDICATEBASE_H_HEADER_INCLUDED_ */ diff --git a/Core/Code/DataManagement/mitkPlaneGeometry.h b/Core/Code/DataManagement/mitkPlaneGeometry.h index ba64a4d029..7b2c6a0477 100644 --- a/Core/Code/DataManagement/mitkPlaneGeometry.h +++ b/Core/Code/DataManagement/mitkPlaneGeometry.h @@ -1,422 +1,422 @@ /*========================================================================= Program: Medical Imaging & Interaction Toolkit Language: C++ Date: $Date$ Version: $Revision$ Copyright (c) German Cancer Research Center, Division of Medical and Biological Informatics. All rights reserved. See MITKCopyright.txt or http://www.mitk.org/copyright.html for details. This software is distributed WITHOUT ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the above copyright notices for more information. =========================================================================*/ #ifndef PLANEGEOMETRY_H_HEADER_INCLUDED_C1C68A2C #define PLANEGEOMETRY_H_HEADER_INCLUDED_C1C68A2C -#include "mitkCommon.h" +#include #include "mitkGeometry2D.h" #include namespace mitk { template < class TCoordRep, unsigned int NPointDimension > class Line; typedef Line Line3D; /** * \brief Describes a two-dimensional, rectangular plane * * \ingroup Geometry */ class MITK_CORE_EXPORT PlaneGeometry : public Geometry2D { public: mitkClassMacro(PlaneGeometry,Geometry2D); /** Method for creation through the object factory. */ itkNewMacro(Self); enum PlaneOrientation { Transversal, Sagittal, Frontal }; virtual void IndexToWorld(const Point2D &pt_units, Point2D &pt_mm) const; virtual void WorldToIndex(const Point2D &pt_mm, Point2D &pt_units) const; //##Documentation //## @brief Convert (continuous or discrete) index coordinates of a \em vector //## \a vec_units to world coordinates (in mm) //## @deprecated First parameter (Point2D) is not used. If possible, please use void IndexToWorld(const mitk::Vector2D& vec_units, mitk::Vector2D& vec_mm) const. //## For further information about coordinates types, please see the Geometry documentation virtual void IndexToWorld(const mitk::Point2D &atPt2d_untis, const mitk::Vector2D &vec_units, mitk::Vector2D &vec_mm) const; //##Documentation //## @brief Convert (continuous or discrete) index coordinates of a \em vector //## \a vec_units to world coordinates (in mm) //## For further information about coordinates types, please see the Geometry documentation virtual void IndexToWorld(const mitk::Vector2D &vec_units, mitk::Vector2D &vec_mm) const; //##Documentation //## @brief Convert world coordinates (in mm) of a \em vector //## \a vec_mm to (continuous!) index coordinates. //## @deprecated First parameter (Point2D) is not used. If possible, please use void WorldToIndex(const mitk::Vector2D& vec_mm, mitk::Vector2D& vec_units) const. //## For further information about coordinates types, please see the Geometry documentation virtual void WorldToIndex(const mitk::Point2D &atPt2d_mm, const mitk::Vector2D &vec_mm, mitk::Vector2D &vec_units) const; //##Documentation //## @brief Convert world coordinates (in mm) of a \em vector //## \a vec_mm to (continuous!) index coordinates. //## For further information about coordinates types, please see the Geometry documentation virtual void WorldToIndex(const mitk::Vector2D &vec_mm, mitk::Vector2D &vec_units) const; virtual void Initialize(); /** * \brief Initialize a plane with orientation \a planeorientation * (default: transversal) with respect to \a geometry3D (default: identity). * Spacing also taken from \a geometry3D. * * \warning A former version of this method created a geometry with unit * spacing. For unit spacing use * * \code * // for in-plane unit spacing: * thisgeometry->SetSizeInUnits(thisgeometry->GetExtentInMM(0), * thisgeometry->GetExtentInMM(1)); * // additionally, for unit spacing in normal direction (former version * // did not do this): * thisgeometry->SetExtentInMM(2, 1.0); * \endcode */ virtual void InitializeStandardPlane( const Geometry3D* geometry3D, PlaneOrientation planeorientation = Transversal, ScalarType zPosition = 0, bool frontside=true, bool rotated=false ); /** * \brief Initialize a plane with orientation \a planeorientation * (default: transversal) with respect to \a geometry3D (default: identity). * Spacing also taken from \a geometry3D. * * \param top if \a true, create plane at top, otherwise at bottom * (for PlaneOrientation Transversal, for other plane locations respectively) */ virtual void InitializeStandardPlane( const Geometry3D* geometry3D, bool top, PlaneOrientation planeorientation = Transversal, bool frontside=true, bool rotated=false ); /** * \brief Initialize a plane with orientation \a planeorientation * (default: transversal) with respect to \a transform (default: identity) * given width and height in units. * */ virtual void InitializeStandardPlane( ScalarType width, ScalarType height, const AffineTransform3D* transform = NULL, PlaneOrientation planeorientation = Transversal, ScalarType zPosition = 0, bool frontside=true, bool rotated=false ); /** * \brief Initialize plane with orientation \a planeorientation * (default: transversal) given width, height and spacing. * */ virtual void InitializeStandardPlane( ScalarType width, ScalarType height, const Vector3D & spacing, PlaneOrientation planeorientation = Transversal, ScalarType zPosition = 0, bool frontside = true, bool rotated = false ); /** * \brief Initialize plane by width and height in pixels, right-/down-vector * (itk) to describe orientation in world-space (vectors will be normalized) * and spacing (default: 1.0 mm in all directions). * * The vectors are normalized and multiplied by the respective spacing before * they are set in the matrix. */ virtual void InitializeStandardPlane( ScalarType width, ScalarType height, const Vector3D& rightVector, const Vector3D& downVector, const Vector3D *spacing = NULL ); /** * \brief Initialize plane by width and height in pixels, * right-/down-vector (vnl) to describe orientation in world-space (vectors * will be normalized) and spacing (default: 1.0 mm in all directions). * * The vectors are normalized and multiplied by the respective spacing * before they are set in the matrix. */ virtual void InitializeStandardPlane( ScalarType width, ScalarType height, const VnlVector& rightVector, const VnlVector& downVector, const Vector3D * spacing = NULL ); /** * \brief Initialize plane by right-/down-vector (itk) and spacing * (default: 1.0 mm in all directions). * * The length of the right-/-down-vector is used as width/height in units, * respectively. Then, the vectors are normalized and multiplied by the * respective spacing before they are set in the matrix. */ virtual void InitializeStandardPlane( const Vector3D& rightVector, const Vector3D& downVector, const Vector3D * spacing = NULL ); /** * \brief Initialize plane by right-/down-vector (vnl) and spacing * (default: 1.0 mm in all directions). * * The length of the right-/-down-vector is used as width/height in units, * respectively. Then, the vectors are normalized and multiplied by the * respective spacing before they are set in the matrix. */ virtual void InitializeStandardPlane( const VnlVector& rightVector, const VnlVector& downVector, const Vector3D * spacing = NULL ); /** * \brief Initialize plane by origin and normal (size is 1.0 mm in * all directions, direction of right-/down-vector valid but * undefined). * */ virtual void InitializePlane( const Point3D& origin, const Vector3D& normal); /** * \brief Initialize plane by right-/down-vector. * * \warning The vectors are set into the matrix as they are, * \em without normalization! */ void SetMatrixByVectors( const VnlVector& rightVector, const VnlVector& downVector, ScalarType thickness=1.0 ); /** * \brief Change \a transform so that the third column of the * transform-martix is perpendicular to the first two columns * */ static void EnsurePerpendicularNormal( AffineTransform3D* transform ); /** * \brief Normal of the plane * */ Vector3D GetNormal() const; /** * \brief Normal of the plane as VnlVector * */ VnlVector GetNormalVnl() const; virtual ScalarType SignedDistance( const Point3D& pt3d_mm ) const; virtual bool IsAbove( const Point3D& pt3d_mm ) const; /** * \brief Distance of the point from the plane * (bounding-box \em not considered) * */ ScalarType DistanceFromPlane( const Point3D& pt3d_mm ) const ; /** * \brief Signed distance of the point from the plane * (bounding-box \em not considered) * * > 0 : point is in the direction of the direction vector. */ inline ScalarType SignedDistanceFromPlane( const Point3D& pt3d_mm ) const { ScalarType len = GetNormalVnl().two_norm(); if( len == 0 ) return 0; return (pt3d_mm-GetOrigin())*GetNormal() / len; } /** * \brief Distance of the plane from another plane * (bounding-box \em not considered) * * Result is 0 if planes are not parallel. */ ScalarType DistanceFromPlane(const PlaneGeometry* plane) const { return fabs(SignedDistanceFromPlane(plane)); } /** * \brief Signed distance of the plane from another plane * (bounding-box \em not considered) * * Result is 0 if planes are not parallel. */ inline ScalarType SignedDistanceFromPlane( const PlaneGeometry *plane ) const { if(IsParallel(plane)) { return SignedDistance(plane->GetOrigin()); } return 0; } /** * \brief Calculate the intersecting line of two planes * * \return \a true planes are intersecting * \return \a false planes do not intersect */ bool IntersectionLine( const PlaneGeometry *plane, Line3D &crossline ) const; /** * \brief Calculate two points where another plane intersects the border of this plane * * \return number of intersection points (0..2). First interection point (if existing) * is returned in \a lineFrom, second in \a lineTo. */ unsigned int IntersectWithPlane2D(const PlaneGeometry *plane, Point2D &lineFrom, Point2D &lineTo ) const ; /** * \brief Calculate the angle between two planes * * \return angle in radiants */ double Angle( const PlaneGeometry *plane ) const; /** * \brief Calculate the angle between the plane and a line * * \return angle in radiants */ double Angle( const Line3D &line ) const; /** * \brief Calculate intersection point between the plane and a line * * \param intersectionPoint intersection point * \return \a true if \em unique intersection exists, i.e., if line * is \em not on or parallel to the plane */ bool IntersectionPoint( const Line3D &line, Point3D &intersectionPoint ) const; /** * \brief Calculate line parameter of intersection point between the * plane and a line * * \param t parameter of line: intersection point is * line.GetPoint()+t*line.GetDirection() * \return \a true if \em unique intersection exists, i.e., if line * is \em not on or parallel to the plane */ bool IntersectionPointParam( const Line3D &line, double &t ) const; /** * \brief Returns whether the plane is parallel to another plane * * @return true iff the normal vectors both point to the same or exactly oposit direction */ bool IsParallel( const PlaneGeometry *plane ) const; /** * \brief Returns whether the point is on the plane * (bounding-box \em not considered) */ bool IsOnPlane( const Point3D &point ) const; /** * \brief Returns whether the line is on the plane * (bounding-box \em not considered) */ bool IsOnPlane( const Line3D &line ) const; /** * \brief Returns whether the plane is on the plane * (bounding-box \em not considered) * * @return true iff the normal vector of the planes point to the same or the exactly oposit direction and * the distance of the planes is < eps * */ bool IsOnPlane( const PlaneGeometry *plane ) const; /** * \brief Returns the lot from the point to the plane */ Point3D ProjectPointOntoPlane( const Point3D &pt ) const; virtual void SetIndexToWorldTransform( AffineTransform3D *transform); virtual void SetBounds( const BoundingBox::BoundsArrayType &bounds ); AffineGeometryFrame3D::Pointer Clone() const; /** Implements operation to re-orient the plane */ virtual void ExecuteOperation( Operation *operation ); protected: PlaneGeometry(); virtual ~PlaneGeometry(); virtual void PrintSelf( std::ostream &os, itk::Indent indent ) const; private: /** * \brief Compares plane with another plane: \a true if IsOnPlane * (bounding-box \em not considered) */ virtual bool operator==( const PlaneGeometry * ) const { return false; }; /** * \brief Compares plane with another plane: \a false if IsOnPlane * (bounding-box \em not considered) */ virtual bool operator!=( const PlaneGeometry * ) const { return false; }; }; } // namespace mitk #endif /* PLANEGEOMETRY_H_HEADER_INCLUDED_C1C68A2C */ diff --git a/Core/Code/DataManagement/mitkPlaneOperation.h b/Core/Code/DataManagement/mitkPlaneOperation.h index 10d6ba976f..1ceff99b27 100644 --- a/Core/Code/DataManagement/mitkPlaneOperation.h +++ b/Core/Code/DataManagement/mitkPlaneOperation.h @@ -1,54 +1,54 @@ /*========================================================================= Program: Medical Imaging & Interaction Toolkit Language: C++ Date: $Date$ Version: $Revision$ Copyright (c) German Cancer Research Center, Division of Medical and Biological Informatics. All rights reserved. See MITKCopyright.txt or http://www.mitk.org/copyright.html for details. This software is distributed WITHOUT ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the above copyright notices for more information. =========================================================================*/ #ifndef MITKPlaneOperation_H #define MITKPlaneOperation_H -#include "mitkCommon.h" +#include #include "mitkPointOperation.h" #include "mitkVector.h" namespace mitk { /** * @brief Operation for setting a plane (defined by its origin and normal) * * @ingroup Undo */ class MITK_CORE_EXPORT PlaneOperation : public PointOperation { public: PlaneOperation( OperationType operationType, Point3D point, Vector3D normal ); virtual ~PlaneOperation(); Vector3D GetNormal(); private: Vector3D m_Normal; }; } //namespace mitk #endif /* MITKPlaneOperation_H */ diff --git a/Core/Code/DataManagement/mitkPointOperation.h b/Core/Code/DataManagement/mitkPointOperation.h index 459c751065..fabb5fe608 100755 --- a/Core/Code/DataManagement/mitkPointOperation.h +++ b/Core/Code/DataManagement/mitkPointOperation.h @@ -1,85 +1,85 @@ /*========================================================================= Program: Medical Imaging & Interaction Toolkit Language: C++ Date: $Date$ Version: $Revision$ Copyright (c) German Cancer Research Center, Division of Medical and Biological Informatics. All rights reserved. See MITKCopyright.txt or http://www.mitk.org/copyright.html for details. This software is distributed WITHOUT ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the above copyright notices for more information. =========================================================================*/ #ifndef MITKPOINTOPERATION_H #define MITKPOINTOPERATION_H -#include "mitkCommon.h" +#include #include "mitkOperation.h" #include "mitkVector.h" namespace mitk { //##Documentation //## @brief Operation that handles all actions on one Point. //## //## Stores everything for Adding, Moving and Deleting a Point. //## @ingroup Undo class MITK_CORE_EXPORT PointOperation : public Operation { public: //##Documentation //##@brief Operation that handles all actions on one Point. //## //## @param operationType is the type of the operation (see mitkOperation.h; e.g. move or add; Information for StateMachine::ExecuteOperation()); //## @param point is the information of the point to add or is the information to change a point into //## @param index is e.g. the position in a list which describes the element to change PointOperation(OperationType operationType, Point3D point, int index = -1, bool selected = true, PointSpecificationType type = PTUNDEFINED); //##Documentation //##@brief Operation that handles all actions on one Point. //## //## @param operationType is the type of the operation (see mitkOperation.h; e.g. move or add; Information for StateMachine::ExecuteOperation()); //## @param point is the information of the point to add or is the information to change a point into //## @param index is e.g. the position in a list which describes the element to change PointOperation(OperationType operationType, ScalarType timeInMS, Point3D point, int index = -1, bool selected = true, PointSpecificationType type = PTUNDEFINED); virtual ~PointOperation(); Point3D GetPoint(); int GetIndex(); bool GetSelected(); PointSpecificationType GetPointType(); ScalarType GetTimeInMS() const; private: Point3D m_Point; //##Documentation //##@brief to declare an index where to store the point in data int m_Index; //to declare weather the point is selected or deselected bool m_Selected; //##Documentation //##@brief to describe the type of the point. See enum PointSpecification for different types PointSpecificationType m_Type; ScalarType m_TimeInMS; }; }//namespace mitk #endif /* MITKPOINTOPERATION_H*/ diff --git a/Core/Code/DataManagement/mitkPropertyList.h b/Core/Code/DataManagement/mitkPropertyList.h index e8d4409c3c..714907ae8b 100644 --- a/Core/Code/DataManagement/mitkPropertyList.h +++ b/Core/Code/DataManagement/mitkPropertyList.h @@ -1,208 +1,208 @@ /*========================================================================= Program: Medical Imaging & Interaction Toolkit Language: C++ Date: $Date$ Version: $Revision$ Copyright (c) German Cancer Research Center, Division of Medical and Biological Informatics. All rights reserved. See MITKCopyright.txt or http://www.mitk.org/copyright.html for details. This software is distributed WITHOUT ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the above copyright notices for more information. =========================================================================*/ #ifndef PROPERTYLIST_H_HEADER_INCLUDED_C1C77D8D #define PROPERTYLIST_H_HEADER_INCLUDED_C1C77D8D -#include "mitkCommon.h" +#include #include "mitkBaseProperty.h" #include "mitkGenericProperty.h" #include "mitkUIDGenerator.h" #include #include #include namespace mitk { class XMLWriter; /** * @brief Key-value list holding instances of BaseProperty * * This list is meant to hold an arbitrary list of "properties", * which should describe the object associated with this list. * * Usually you will use PropertyList as part of a DataNode * object - in this context the properties describe the data object * held by the DataNode (e.g. whether the object is rendered at * all, which color is used for rendering, what name should be * displayed for the object, etc.) * * The values in the list are not fixed, you may introduce any kind * of property that seems useful - all you have to do is inherit * from BaseProperty. * * The list is organized as a key-value pairs, i.e. * * \li "name" : pointer to a StringProperty * \li "visible" : pointer to a BoolProperty * \li "color" : pointer to a ColorProperty * \li "volume" : pointer to a FloatProperty * * Please see the documentation of SetProperty and ReplaceProperty for two * quite different semantics. Normally SetProperty is what you want - this * method will try to change the value of an existing property and will * not allow you to replace e.g. a ColorProperty with an IntProperty. * * @ingroup DataManagement */ class MITK_CORE_EXPORT PropertyList : public itk::Object { public: mitkClassMacro(PropertyList, itk::Object); /** * Method for creation through the object factory. */ itkNewMacro(Self); /** * Map structure to hold the properties: the map key is a string, * the value consists of the actual property object (BaseProperty). */ typedef std::map< std::string, BaseProperty::Pointer> PropertyMap; typedef std::pair< std::string, BaseProperty::Pointer> PropertyMapElementType; /** * @brief Get a property by its name. */ mitk::BaseProperty* GetProperty(const std::string& propertyKey) const; /** * @brief Set a property in the list/map by value. * * The actual OBJECT holding the value of the property is not replaced, but its value * is modified to match that of @a property. To really replace the object holding the * property - which would make sense if you want to change the type (bool, string) of the property * - call ReplaceProperty. */ void SetProperty(const std::string& propertyKey, BaseProperty* property); /** * @brief Set a property object in the list/map by reference. * * The actual OBJECT holding the value of the property is replaced by this function. * This is useful if you want to change the type of the property, like from BoolProperty to StringProperty. * Another use is to share one and the same property object among several ProperyList/DataNode objects, which * makes them appear synchronized. */ void ReplaceProperty(const std::string& propertyKey, BaseProperty* property); /** * @brief Set a property object in the list/map by reference. */ void ConcatenatePropertyList(PropertyList *pList, bool replace = false); //##Documentation //## @brief Convenience access method for GenericProperty properties //## (T being the type of the second parameter) //## @return @a true property was found template bool GetPropertyValue(const char* propertyKey, T & value) const { GenericProperty* gp= dynamic_cast*>(GetProperty(propertyKey)); if ( gp != NULL ) { value = gp->GetValue(); return true; } return false; } /** * @brief Convenience method to access the value of a BoolProperty */ bool GetBoolProperty(const char* propertyKey, bool& boolValue) const; /** * @brief Convenience method to set the value of a BoolProperty */ void SetBoolProperty( const char* propertyKey, bool boolValue); /** * @brief Convenience method to access the value of an IntProperty */ bool GetIntProperty(const char* propertyKey, int &intValue) const; /** * @brief Convenience method to set the value of an IntProperty */ void SetIntProperty(const char* propertyKey, int intValue); /** * @brief Convenience method to access the value of a FloatProperty */ bool GetFloatProperty(const char* propertyKey, float &floatValue) const; /** * @brief Convenience method to set the value of a FloatProperty */ void SetFloatProperty( const char* propertyKey, float floatValue); /** * @brief Convenience method to access the value of a StringProperty */ bool GetStringProperty(const char* propertyKey, std::string& stringValue) const; /** * @brief Convenience method to set the value of a StringProperty */ void SetStringProperty( const char* propertyKey, const char* stringValue); /** * @brief Get the timestamp of the last change of the map or the last change of one of * the properties store in the list (whichever is later). */ virtual unsigned long GetMTime() const; /** * @brief Remove a property from the list/map. */ bool DeleteProperty(const std::string& propertyKey); const PropertyMap* GetMap() const { return &m_Properties; } bool IsEmpty() const { return m_Properties.empty(); } virtual Pointer Clone(); virtual void Clear(); protected: PropertyList(); virtual ~PropertyList(); /** * @brief Map of properties. */ PropertyMap m_Properties; }; } // namespace mitk #endif /* PROPERTYLIST_H_HEADER_INCLUDED_C1C77D8D */ diff --git a/Core/Code/DataManagement/mitkSlicedData.h b/Core/Code/DataManagement/mitkSlicedData.h index 1320cd43f1..b237897c71 100644 --- a/Core/Code/DataManagement/mitkSlicedData.h +++ b/Core/Code/DataManagement/mitkSlicedData.h @@ -1,223 +1,223 @@ /*========================================================================= Program: Medical Imaging & Interaction Toolkit Language: C++ Date: $Date$ Version: $Revision$ Copyright (c) German Cancer Research Center, Division of Medical and Biological Informatics. All rights reserved. See MITKCopyright.txt or http://www.mitk.org/copyright.html for details. This software is distributed WITHOUT ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the above copyright notices for more information. =========================================================================*/ #ifndef SLICEDDATA_H_HEADER_INCLUDED #define SLICEDDATA_H_HEADER_INCLUDED -#include "mitkCommon.h" +#include #include "mitkBaseData.h" #include "mitkTimeSlicedGeometry.h" #include "mitkSlicedGeometry3D.h" #include "itkIndex.h" #include "itkOffset.h" #include "itkSize.h" #include "itkImageRegion.h" namespace mitk { class SlicedGeometry3D; //##Documentation //## @brief Super class of data objects consisting of slices //## //## Super class of data objects consisting of slices, e.g., images or a stack //## of contours. (GetGeometry will return a Geometry3D containing Geometry2D //## objects). //## //## SlicedData-objects have geometries of type SlicedGeometry3D or sub-classes. //## @ingroup Data class MITK_CORE_EXPORT SlicedData : public BaseData { public: mitkClassMacro(SlicedData, BaseData); itkStaticConstMacro(RegionDimension, unsigned int, 5); /** Region typedef support. A region is used to specify a subset of a @a SlicedData. */ typedef itk::ImageRegion RegionType; /** Index typedef support. An index is used to access pixel values. */ typedef itk::Index IndexType; typedef IndexType::IndexValueType IndexValueType; /** Offset typedef support. An offset represent relative position * between indices. */ typedef itk::Offset OffsetType; typedef OffsetType::OffsetValueType OffsetValueType; /** Size typedef support. A size is used to define region bounds. */ typedef itk::Size SizeType; typedef SizeType::SizeValueType SizeValueType; //##Documentation //## Update the information for this DataObject so that it can be used as //## an output of a ProcessObject. This method is used in the pipeline //## mechanism to propagate information and initialize the meta data //## associated with a itk::DataObject. Any implementation of this method //## in a derived class of itk::DataObject is assumed to call its source's //## ProcessObject::UpdateOutputInformation() which determines modified //## times, LargestPossibleRegions, and any extra meta data like spacing, //## origin, etc. virtual void UpdateOutputInformation(); virtual void PrepareForNewData(); //##Documentation //## Set the RequestedRegion to the LargestPossibleRegion. This forces a //## filter to produce all of the output in one execution (i.e. not //## streaming) on the next call to Update(). virtual void SetRequestedRegionToLargestPossibleRegion(); //##Documentation //## Determine whether the RequestedRegion is outside of the //## BufferedRegion. This method returns true if the RequestedRegion is //## outside the BufferedRegion (true if at least one pixel is outside). //## This is used by the pipeline mechanism to determine whether a filter //## needs to re-execute in order to satisfy the current request. If the //## current RequestedRegion is already inside the BufferedRegion from the //## previous execution (and the current filter is up to date), then a //## given filter does not need to re-execute virtual bool RequestedRegionIsOutsideOfTheBufferedRegion(); //##Documentation //## @brief Verify that the RequestedRegion is within the //## LargestPossibleRegion. //## //## Verify that the RequestedRegion is within the LargestPossibleRegion. //## If the RequestedRegion is not within the LargestPossibleRegion, //## then the filter cannot possibly satisfy the request. This method //## returns true if the request can be satisfied (even if it will be //## necessary to process the entire LargestPossibleRegion) and //## returns false otherwise. This method is used by //## PropagateRequestedRegion(). PropagateRequestedRegion() throws a //## InvalidRequestedRegionError exception if the requested region is //## not within the LargestPossibleRegion. virtual bool VerifyRequestedRegion(); //##Documentation //## Set the requested region from this data object to match the requested //## region of the data object passed in as a parameter. This method is //## implemented in the concrete subclasses of DataObject. virtual void SetRequestedRegion(itk::DataObject *data); //##Documentation //## Set the requested region from this data object to match the requested //## region of the data object passed in as a parameter. This method is //## implemented in the concrete subclasses of DataObject. virtual void SetRequestedRegion(SlicedData::RegionType *region); const RegionType& GetLargestPossibleRegion() const { return m_LargestPossibleRegion; } //##Documentation //## Get the region object that defines the size and starting index //## for the region of the image requested (i.e., the region of the //## image to be operated on by a filter). virtual const RegionType& GetRequestedRegion() const { return m_RequestedRegion; } virtual bool IsSliceSet(int s = 0, int t = 0, int n = 0) const = 0; virtual bool IsVolumeSet(int t = 0, int n = 0) const = 0; virtual bool IsChannelSet(int n = 0) const = 0; virtual void CopyInformation(const itk::DataObject *data); //##Documentation //## @brief Get the number of channels unsigned int GetNumberOfChannels() const { return m_LargestPossibleRegion.GetSize(4); } ////##Documentation ////## @brief Return the Geometry2D of the slice (@a s, @a t). ////## ////## The method does not simply call GetGeometry()->GetGeometry2D(). Before doing this, it ////## makes sure that the Geometry2D is up-to-date before returning it (by ////## setting the update extent appropriately and calling ////## UpdateOutputInformation). ////## ////## @warning GetGeometry2D not yet completely implemented. ////## @todo Appropriate setting of the update extent is missing. //virtual const mitk::Geometry2D* GetGeometry2D(int s, int t=0) const; //##Documentation //## @brief Convenience access method for the geometry, which is of type SlicedGeometry3D (or a sub-class of it). //## //## @em No update will be called. Normally used in GenerateOutputInformation of //## subclasses of BaseProcess. SlicedGeometry3D* GetSlicedGeometry(unsigned int t=0) const; //##Documentation //## @brief Convenience access method for the geometry, which is of type SlicedGeometry3D (or a sub-class of it). //## //## The method does not simply return the value of the m_Geometry3D member. //## Before doing this, it makes sure that the Geometry3D is up-to-date before //## returning it (by setting the update extent appropriately and calling //## UpdateOutputInformation). //## //## @warning GetGeometry not yet completely implemented. //## @todo Appropriate setting of the update extent is missing. const SlicedGeometry3D* GetUpdatedSlicedGeometry(unsigned int t=0); //##Documentation //## @brief Set the Geometry3D of the data, which will be referenced (not copied!). It //## has to be a sub-class of SlicedGeometry3D. //## //## @warning This method will normally be called internally by the sub-class of SlicedData //## during initialization. virtual void SetGeometry(Geometry3D* aGeometry3D); //##Documentation //## @brief Convenience method for setting the origin of //## the SlicedGeometry3D instances of all time steps //## //## In case the SlicedGeometry3D is evenly spaced, //## the origin of the first slice is set to \a origin. //## \sa mitk::BaseData::SetOrigin virtual void SetOrigin(const Point3D& origin); //##Documentation //## @brief Convenience method for setting the spacing of //## the SlicedGeometry3D instances of all time steps virtual void SetSpacing(const float aSpacing[3]); //##Documentation //## @brief Convenience method for setting the spacing of //## the SlicedGeometry3D instances of all time steps virtual void SetSpacing(mitk::Vector3D aSpacing); protected: SlicedData(); SlicedData(const SlicedData &other); virtual ~SlicedData(); RegionType m_LargestPossibleRegion; RegionType m_RequestedRegion; RegionType m_BufferedRegion; bool m_UseLargestPossibleRegion; }; } // namespace mitk #endif /* SLICEDDATA_H_HEADER_INCLUDED */ diff --git a/Core/Code/DataManagement/mitkSmartPointerProperty.h b/Core/Code/DataManagement/mitkSmartPointerProperty.h index cee49e5c69..3a8ac8c7c2 100644 --- a/Core/Code/DataManagement/mitkSmartPointerProperty.h +++ b/Core/Code/DataManagement/mitkSmartPointerProperty.h @@ -1,93 +1,93 @@ /*========================================================================= Program: Medical Imaging & Interaction Toolkit Language: C++ Date: $Date$ Version: $Revision$ Copyright (c) German Cancer Research Center, Division of Medical and Biological Informatics. All rights reserved. See MITKCopyright.txt or http://www.mitk.org/copyright.html for details. This software is distributed WITHOUT ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the above copyright notices for more information. =========================================================================*/ #ifndef MITKSMARTPOINTERPROPERTY_H_HEADER_INCLUDED_C126B791 #define MITKSMARTPOINTERPROPERTY_H_HEADER_INCLUDED_C126B791 -#include "mitkCommon.h" +#include #include "mitkBaseProperty.h" #include "mitkUIDGenerator.h" #include #include #include namespace mitk { //##Documentation //## @brief Property containing a smart-pointer //## @ingroup DataManagement class MITK_CORE_EXPORT SmartPointerProperty : public BaseProperty { public: mitkClassMacro(SmartPointerProperty, BaseProperty); itkNewMacro(SmartPointerProperty); mitkNewMacro1Param(SmartPointerProperty, itk::Object*); virtual bool operator==(const BaseProperty&) const; virtual ~SmartPointerProperty(); itk::Object::Pointer GetSmartPointer() const; void SetSmartPointer(itk::Object*); /// mainly for XML output virtual std::string GetValueAsString() const; virtual bool Assignable(const BaseProperty&) const; virtual BaseProperty& operator=(const BaseProperty& property); static void PostProcessXMLReading(); /// Return the number of SmartPointerProperties that reference the object given as parameter static unsigned int GetReferenceCountFor(itk::Object*); static std::string GetReferenceUIDFor(itk::Object*); static void RegisterPointerTarget(itk::Object*, const std::string uid); protected: SmartPointerProperty(itk::Object* = NULL); itk::Object::Pointer m_SmartPointer; private: typedef std::map ReferenceCountMapType; typedef std::map ReferencesUIDMapType; typedef std::map ReadInSmartPointersMapType; typedef std::map ReadInTargetsMapType; /// for each itk::Object* count how many SmartPointerProperties point to it static ReferenceCountMapType m_ReferenceCount; static ReferencesUIDMapType m_ReferencesUID; static ReadInSmartPointersMapType m_ReadInInstances; static ReadInTargetsMapType m_ReadInTargets; /// to generate unique IDs for the objects pointed at (during XML writing) static UIDGenerator m_UIDGenerator; }; } // namespace mitk #endif /* MITKSMARTPOINTERPROPERTY_H_HEADER_INCLUDED_C126B791 */ diff --git a/Core/Code/DataManagement/mitkStateTransitionOperation.h b/Core/Code/DataManagement/mitkStateTransitionOperation.h index 76212ef9b6..bfc35f029c 100755 --- a/Core/Code/DataManagement/mitkStateTransitionOperation.h +++ b/Core/Code/DataManagement/mitkStateTransitionOperation.h @@ -1,65 +1,65 @@ /*========================================================================= Program: Medical Imaging & Interaction Toolkit Language: C++ Date: $Date$ Version: $Revision$ Copyright (c) German Cancer Research Center, Division of Medical and Biological Informatics. All rights reserved. See MITKCopyright.txt or http://www.mitk.org/copyright.html for details. This software is distributed WITHOUT ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the above copyright notices for more information. =========================================================================*/ #ifndef STATETRANSITIONOPERATION_H_HEADER_INCLUDED_C1695462 #define STATETRANSITIONOPERATION_H_HEADER_INCLUDED_C1695462 -#include "mitkCommon.h" +#include #include "mitkOperation.h" #include "mitkState.h" namespace mitk { //##Documentation //## @brief operation, that changes the stateMachine and sets a state according to a //## transition to an other state. //## //## @ingroup Undo class MITK_CORE_EXPORT StateTransitionOperation : public Operation { public: /** * @brief default constructor * @param[in] operationType The type of the operation * @param[in] state The state to be stored * @param[in] time The time according to the state; obligatory when there is only one timestep. **/ StateTransitionOperation(OperationType operationType, State* state, unsigned int time = 0); /** * @brief default constructor **/ ~StateTransitionOperation(); /** * @brief Return the state **/ State* GetState(); /** * @brief Return the time **/ unsigned int GetTime(); private: State::Pointer m_State; unsigned int m_Time; }; }//namespace mitk #endif /* STATETRANSITIONOPERATION_H_HEADER_INCLUDED_C1695462 */ diff --git a/Core/Code/DataManagement/mitkStringProperty.h b/Core/Code/DataManagement/mitkStringProperty.h index 967fc8c75e..893fcacc19 100644 --- a/Core/Code/DataManagement/mitkStringProperty.h +++ b/Core/Code/DataManagement/mitkStringProperty.h @@ -1,66 +1,66 @@ /*========================================================================= Program: Medical Imaging & Interaction Toolkit Language: C++ Date: $Date$ Version: $Revision$ Copyright (c) German Cancer Research Center, Division of Medical and Biological Informatics. All rights reserved. See MITKCopyright.txt or http://www.mitk.org/copyright.html for details. This software is distributed WITHOUT ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the above copyright notices for more information. =========================================================================*/ #ifndef MITKSTRINGPROPERTY_H_HEADER_INCLUDED_C1C02491 #define MITKSTRINGPROPERTY_H_HEADER_INCLUDED_C1C02491 #include -#include "mitkCommon.h" +#include #include "mitkBaseProperty.h" #include namespace mitk { /** * @brief Property for strings * @ingroup DataManagement */ class MITK_CORE_EXPORT StringProperty : public BaseProperty { protected: std::string m_Value; StringProperty( const char* string = 0 ); StringProperty( const std::string& s ); public: mitkClassMacro(StringProperty, BaseProperty); typedef std::string ValueType; itkNewMacro(StringProperty); mitkNewMacro1Param(StringProperty, const char*); mitkNewMacro1Param(StringProperty, const std::string&) itkGetStringMacro(Value); itkSetStringMacro(Value); virtual bool operator==(const BaseProperty& property ) const; virtual std::string GetValueAsString() const; bool Assignable(const BaseProperty& other) const; virtual BaseProperty& operator=(const BaseProperty& other); static const char* PATH; }; } // namespace mitk #endif diff --git a/Core/Code/DataManagement/mitkSurfaceOperation.h b/Core/Code/DataManagement/mitkSurfaceOperation.h index 0811533fe1..d2f2e7afb0 100644 --- a/Core/Code/DataManagement/mitkSurfaceOperation.h +++ b/Core/Code/DataManagement/mitkSurfaceOperation.h @@ -1,54 +1,54 @@ /*========================================================================= Program: Medical Imaging & Interaction Toolkit Language: C++ Date: $Date$ Version: $Revision: $ Copyright (c) German Cancer Research Center, Division of Medical and Biological Informatics. All rights reserved. See MITKCopyright.txt or http://www.mitk.org/copyright.html for details. This software is distributed WITHOUT ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the above copyright notices for more information. =========================================================================*/ #pragma once -#include "mitkCommon.h" +#include #include "mitkOperation.h" #include namespace mitk { /* * @brief Operation that stores polydata for changing surfaces */ class MITK_CORE_EXPORT SurfaceOperation : public Operation { public: /* * Constructor * @param operationType type of the operation (OpSURFACECHANGED) * @param polyData the polydata object to replace in the surface * @param t the time step */ SurfaceOperation(mitk::OperationType operationType, vtkPolyData* polyData, unsigned int t); virtual ~SurfaceOperation(); vtkPolyData* GetVtkPolyData(); unsigned int GetTimeStep(); private: vtkPolyData* m_polyData; unsigned int m_timeStep; }; }; // end namespace mitk diff --git a/Core/Code/DataManagement/mitkTransferFunction.h b/Core/Code/DataManagement/mitkTransferFunction.h index 87880a49c2..295344a797 100644 --- a/Core/Code/DataManagement/mitkTransferFunction.h +++ b/Core/Code/DataManagement/mitkTransferFunction.h @@ -1,193 +1,193 @@ /*========================================================================= Program: Medical Imaging & Interaction Toolkit Language: C++ Date: $Date$ Version: $Revision$ Copyright (c) German Cancer Research Center, Division of Medical and Biological Informatics. All rights reserved. See MITKCopyright.txt or http://www.mitk.org/copyright.html for details. This software is distributed WITHOUT ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the above copyright notices for more information. =========================================================================*/ #ifndef MITK_TRANSFER_FUNCTION_H_HEADER_INCLUDED #define MITK_TRANSFER_FUNCTION_H_HEADER_INCLUDED #include "mitkHistogramGenerator.h" -#include "mitkCommon.h" +#include #include "mitkImage.h" #include #include #include #include #include #include #include #include #include namespace mitk { /** * \brief Wrapper class for VTK scalar opacity, gradient opacity, and color * transfer functions. * * Holds a copy of each of the three standard VTK transfer functions (scalar * opacity, gradient opacity, color) and provides an interface for manipulating * their control points. Each original function can be retrieved by a Get() * method. * * NOTE: Currently, transfer function initialization based on histograms or * computed-tomography-presets is also provided by this class, but will likely * be separated into a specific initializer class. */ class MITK_CORE_EXPORT TransferFunction : public itk::Object { public: typedef std::vector > ControlPoints; typedef std::vector > > RGBControlPoints; mitkClassMacro(TransferFunction, itk::DataObject); itkNewMacro(Self); /** \brief Get/Set min/max of transfer function range for initialization. */ itkSetMacro(Min,int); /** \brief Get/Set min/max of transfer function range for initialization. */ itkSetMacro(Max,int); /** \brief Get/Set min/max of transfer function range for initialization. */ itkGetMacro(Min,int); /** \brief Get/Set min/max of transfer function range for initialization. */ itkGetMacro(Max,int); /** \brief Get/Set wrapped vtk transfer function. */ itkGetMacro(ScalarOpacityFunction,vtkPiecewiseFunction*); /** \brief Get/Set wrapped vtk transfer function. */ itkGetMacro(GradientOpacityFunction,vtkPiecewiseFunction*); /** \brief Get/Set wrapped vtk transfer function. */ itkGetMacro(ColorTransferFunction,vtkColorTransferFunction*); /** \brief Get histogram used for transfer function initialization. */ itkGetConstObjectMacro(Histogram,HistogramGenerator::HistogramType); /** \brief Initialize transfer function based on the histogram of an mitk::Image. */ void InitializeByMitkImage(const mitk::Image* image); /** \brief Initialize transfer function based on the specified histogram. */ void InitializeByItkHistogram(const itk::Statistics::Histogram* histogram); /** \brief Initialize the internal histogram and min/max range based on the * specified mitk::Image. */ void InitializeHistogram( const mitk::Image* image ); /** \brief Insert control points and values into the scalar opacity transfer * function. */ void SetScalarOpacityPoints(TransferFunction::ControlPoints points); /** \brief Insert control points and values into the gradient opacity transfer * function. */ void SetGradientOpacityPoints(TransferFunction::ControlPoints points); /** \brief Insert control points and RGB values into the color transfer * function. */ void SetRGBPoints(TransferFunction::RGBControlPoints rgbpoints); /** \brief Add a single control point to the scalar opacity transfer function. */ void AddScalarOpacityPoint(double x, double value); /** \brief Add a single control point to the gradient opacity transfer function. */ void AddGradientOpacityPoint(double x, double value); /** \brief Add a single control point to the color opacity transfer function. */ void AddRGBPoint(double x, double r, double g, double b); /** \brief Get a copy of the scalar opacity transfer function control-points. */ TransferFunction::ControlPoints &GetScalarOpacityPoints(); /** \brief Get a copy of the gradient opacity transfer function control-points. */ TransferFunction::ControlPoints &GetGradientOpacityPoints(); /** \brief Get a copy of the color transfer function control-points. */ TransferFunction::RGBControlPoints &GetRGBPoints(); /** \brief Remove the specified control point from the scalar opacity transfer * function. */ int RemoveScalarOpacityPoint(double x); /** \brief Remove the specified control point from the gradient opacity transfer * function. */ int RemoveGradientOpacityPoint(double x); /** \brief Remove the specified control point from the color transfer function. */ int RemoveRGBPoint(double x); /** \brief Removes all control points from the scalar opacity transfer function. */ void ClearScalarOpacityPoints(); /** \brief Removes all control points from the gradient opacity transfer * function. */ void ClearGradientOpacityPoints(); /** \brief Removes all control points from the color transfer function. */ void ClearRGBPoints(); bool operator==(Self& other); protected: TransferFunction(); virtual ~TransferFunction(); /** Wrapped VTK scalar opacity transfer function */ vtkSmartPointer m_ScalarOpacityFunction; /** Wrapped VTK gradient opacity transfer function */ vtkSmartPointer m_GradientOpacityFunction; /** Wrapped VTK color transfer function */ vtkSmartPointer m_ColorTransferFunction; /** Current range of transfer function (used for initialization) */ int m_Min; /** Current range of transfer function (used for initialization) */ int m_Max; /** Specified or calculated histogram (used for initialization) */ mitk::HistogramGenerator::HistogramType::ConstPointer m_Histogram; private: /** Temporary STL style copy of VTK internal control points */ TransferFunction::ControlPoints m_ScalarOpacityPoints; /** Temporary STL style copy of VTK internal control points */ TransferFunction::ControlPoints m_GradientOpacityPoints; /** Temporary STL style copy of VTK internal control points */ TransferFunction::RGBControlPoints m_RGBPoints; }; } #endif /* MITK_TRANSFER_FUNCTION_H_HEADER_INCLUDED */ diff --git a/Core/Code/DataManagement/mitkTransferFunctionInitializer.h b/Core/Code/DataManagement/mitkTransferFunctionInitializer.h index 90779a403a..d644e09a4b 100644 --- a/Core/Code/DataManagement/mitkTransferFunctionInitializer.h +++ b/Core/Code/DataManagement/mitkTransferFunctionInitializer.h @@ -1,99 +1,99 @@ /*========================================================================= Program: Medical Imaging & Interaction Toolkit Language: C++ Date: $Date: 2010-05-10 18:06:04 +0200 (Mo, 10 Mai 2010) $ Version: $Revision: 22790 $ Copyright (c) German Cancer Research Center, Division of Medical and Biological Informatics. All rights reserved. See MITKCopyright.txt or http://www.mitk.org/copyright.html for details. This software is distributed WITHOUT ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the above copyright notices for more information. =========================================================================*/ #ifndef MITK_TRANSFER_FUNCTION_MODE_CREATOR_H_HEADER_INCLUDED #define MITK_TRANSFER_FUNCTION_MODE_CREATOR_H_HEADER_INCLUDED #include #include #include #include "mitkTransferFunction.h" #include #include -#include "mitkCommon.h" +#include namespace mitk { /** * \brief Wrapper class for VTK scalar opacity, gradient opacity, and color * transfer functions. * * Holds a copy of each of the three standard VTK transfer functions (scalar * opacity, gradient opacity, color) and provides an interface for manipulating * their control points. Each original function can be retrieved by a Get() * method. * * NOTE: Currently, transfer function initialization based on histograms or * computed-tomography-presets is also provided by this class, but will likely * be separated into a specific initializer class. */ class MITK_CORE_EXPORT TransferFunctionInitializer : public itk::Object { public: mitkClassMacro(TransferFunctionInitializer, itk::Object); itkNewMacro( TransferFunctionInitializer ); mitkNewMacro1Param(TransferFunctionInitializer, TransferFunction::Pointer); static void GetPresetNames(std::vector& presetNames); void SetTransferFunction(TransferFunction::Pointer transferFunction); mitk::TransferFunction::Pointer GetTransferFunction(); void SetTransferFunctionMode(int mode); void InitTransferFunctionMode(); protected: TransferFunctionInitializer(TransferFunction::Pointer transferFunction = NULL); virtual ~TransferFunctionInitializer(); private: int m_Mode; mitk::TransferFunction::Pointer m_transferFunction; //Define Transfer Function enum TransferFunctionMode{ TF_CT_DEFAULT, TF_CT_BLACK_WHITE, TF_CT_THORAX_LARGE, TF_CT_THORAX_SMALL, TF_CT_BONE, TF_CT_BONE_GRADIENT, TF_CT_CARDIAC, TF_MR_GENERIC }; //remove all old points void RemoveAllPoints(); void SetModified(); void SetCtDefaultMode(); void SetCtBlackWhiteMode(); void SetCtThoraxLargeMode(); void SetCtThoraxSmallMode(); void SetCtBoneMode(); void SetCtBoneGradientMode(); void SetCtCardiacMode(); void SetMrGenericMode(); }; } #endif /* MITK_TRANSFER_FUNCTION_MODE_CREATOR_H_HEADER_INCLUDED */ diff --git a/Core/Code/DataManagement/mitkVector.h b/Core/Code/DataManagement/mitkVector.h index 295f9faa91..e09c49ee0b 100644 --- a/Core/Code/DataManagement/mitkVector.h +++ b/Core/Code/DataManagement/mitkVector.h @@ -1,436 +1,436 @@ /*========================================================================= Program: Medical Imaging & Interaction Toolkit Language: C++ Date: $Date$ Version: $Revision$ Copyright (c) German Cancer Research Center, Division of Medical and Biological Informatics. All rights reserved. See MITKCopyright.txt or http://www.mitk.org/copyright.html for details. This software is distributed WITHOUT ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the above copyright notices for more information. =========================================================================*/ #ifndef MITKVECTOR_H_HEADER_INCLUDED_C1EBD0AD #define MITKVECTOR_H_HEADER_INCLUDED_C1EBD0AD #include #include #include #include #include #include #include #include -#include "mitkCommon.h" +#include #ifndef DOXYGEN_SKIP namespace mitk { typedef float ScalarType; typedef itk::Matrix Matrix3D; typedef itk::Matrix Matrix4D; typedef vnl_matrix_fixed VnlMatrix3D; typedef itk::Transform Transform3D; typedef vnl_vector VnlVector; typedef vnl_vector_ref VnlVectorRef; typedef itk::Point Point2D; typedef itk::Point Point3D; typedef itk::Point Point4D; typedef itk::Point Point2I; typedef itk::Point Point3I; typedef itk::Point Point4I; typedef itk::Vector Vector2D; typedef itk::Vector Vector3D; typedef itk::Index<3> Index3D; typedef itk::ContinuousIndex ContinuousIndex3D; typedef vnl_quaternion Quaternion; //##Documentation //##@brief enumeration of the type a point can be enum PointSpecificationType { PTUNDEFINED = 0, PTSTART, PTCORNER, PTEDGE, PTEND }; typedef itk::NumericTraits ScalarTypeNumericTraits; MITK_CORE_EXPORT extern const ScalarType eps; MITK_CORE_EXPORT extern const ScalarType sqrteps; MITK_CORE_EXPORT extern const double large; template class VectorTraits { public: typedef T ValueType; }; template <> class VectorTraits { public: typedef ScalarType ValueType; }; template<> class VectorTraits { public: typedef double ValueType; }; template<> class VectorTraits< itk::Index<5> > { public: typedef itk::Index<5>::IndexValueType ValueType; }; template<> class VectorTraits< itk::Index<3> > { public: typedef itk::Index<3>::IndexValueType ValueType; }; template<> class VectorTraits< long int [3]> { public: typedef long int ValueType; }; template<> class VectorTraits< float [3]> { public: typedef float ValueType; }; template<> class VectorTraits< double [3]> { public: typedef double ValueType; }; template<> class VectorTraits< vnl_vector_fixed > { public: typedef ScalarType ValueType; }; template<> class VectorTraits< long unsigned int[3]> { public: typedef long unsigned int ValueType; }; template<> class VectorTraits< unsigned int *> { public: typedef unsigned int ValueType; }; template<> class VectorTraits< ScalarType[4] > { public: typedef ScalarType ValueType; }; template<> class VectorTraits< itk::Vector > { public: typedef float ValueType; }; template<> class VectorTraits< itk::Point > { public: typedef float ValueType; }; template<> class VectorTraits< itk::Point > { public: typedef float ValueType; }; template<> class VectorTraits< itk::Vector > { public: typedef double ValueType; }; template<> class VectorTraits< itk::Point > { public: typedef double ValueType; }; template<> class VectorTraits< itk::Vector > { public: typedef int ValueType; }; template<> class VectorTraits< itk::Point > { public: typedef int ValueType; }; template inline void itk2vtk(const Tin& in, Tout& out) { out[0]=(typename VectorTraits::ValueType)(in[0]); out[1]=(typename VectorTraits::ValueType)(in[1]); out[2]=(typename VectorTraits::ValueType)(in[2]); } template inline void vtk2itk(const Tin& in, Tout& out) { out[0]=(typename VectorTraits::ValueType)(in[0]); out[1]=(typename VectorTraits::ValueType)(in[1]); out[2]=(typename VectorTraits::ValueType)(in[2]); } template inline void FillVector3D(Tout& out, ScalarType x, ScalarType y, ScalarType z) { out[0] = (typename VectorTraits::ValueType)x; out[1] = (typename VectorTraits::ValueType)y; out[2] = (typename VectorTraits::ValueType)z; } template inline void FillVector4D(Tout& out, ScalarType x, ScalarType y, ScalarType z, ScalarType t) { out[0] = (typename VectorTraits::ValueType)x; out[1] = (typename VectorTraits::ValueType)y; out[2] = (typename VectorTraits::ValueType)z; out[3] = (typename VectorTraits::ValueType)t; } template inline void vnl2vtk(const vnl_vector& in, Tout *out) { unsigned int i; for(i=0; i inline void vtk2vnl(const Tin *in, vnl_vector& out) { unsigned int i; for(i=0; i inline void vtk2vnlref(const Tin *in, vnl_vector_ref& out) { unsigned int i; for(i=0; i inline void vnl2vtk(const vnl_vector_fixed& in, Tout *out) { unsigned int i; for(i=0; i inline void vtk2vnl(const Tin *in, vnl_vector_fixed& out) { unsigned int i; for(i=0; i itk::Vector operator+(const itk::Vector &vector, const itk::Point &point) { itk::Vector sub; for( unsigned int i=0; i inline itk::Vector& operator+=(itk::Vector &vector, const itk::Point &point) { for( unsigned int i=0; i itk::Vector operator-(const itk::Vector &vector, const itk::Point &point) { itk::Vector sub; for( unsigned int i=0; i inline itk::Vector& operator-=(itk::Vector &vector, const itk::Point &point) { for( unsigned int i=0; i inline bool MatrixEqualRMS(const vnl_matrix_fixed& matrix1,const vnl_matrix_fixed& matrix2,mitk::ScalarType epsilon=mitk::eps) { if ( (matrix1.rows() == matrix2.rows()) && (matrix1.cols() == matrix2.cols()) ) { vnl_matrix_fixed differenceMatrix = matrix1-matrix2; if (differenceMatrix.rms() inline bool MatrixEqualRMS(const itk::Matrix& matrix1,const itk::Matrix& matrix2,mitk::ScalarType epsilon=mitk::eps) { return mitk::MatrixEqualRMS(matrix1.GetVnlMatrix(),matrix2.GetVnlMatrix(),epsilon); } /*! \brief Check for element-wise matrix equality with a user defined accuracy. \param matrix1 first vnl matrix \param matrix2 second vnl matrix \epsilon user defined accuracy bounds */ template inline bool MatrixEqualElementWise(const vnl_matrix_fixed& matrix1,const vnl_matrix_fixed& matrix2,mitk::ScalarType epsilon=mitk::eps) { if ( (matrix1.rows() == matrix2.rows()) && (matrix1.cols() == matrix2.cols()) ) { for( unsigned int r=0; repsilon) { return false; } } } return true; } else { return false; } } /*! \brief Check for element-wise matrix equality with a user defined accuracy. \param matrix1 first itk matrix \param matrix2 second itk matrix \epsilon user defined accuracy bounds */ template inline bool MatrixEqualElementWise(const itk::Matrix& matrix1,const itk::Matrix& matrix2,mitk::ScalarType epsilon=mitk::eps) { return mitk::MatrixEqualElementWise(matrix1.GetVnlMatrix(),matrix2.GetVnlMatrix(),epsilon); } template inline bool Equal(const itk::Vector& vector1, const itk::Vector& vector2) { typename itk::Vector::VectorType diff = vector1-vector2; return diff.GetSquaredNorm() < mitk::eps; } template inline bool Equal(const itk::Point& vector1, const itk::Point& vector2) { typename itk::Point::VectorType diff = vector1-vector2; return diff.GetSquaredNorm() < mitk::eps; } inline bool Equal(const mitk::VnlVector& vector1, const mitk::VnlVector& vector2) { mitk::VnlVector diff = vector1-vector2; return diff.squared_magnitude() < mitk::eps; } inline bool Equal(double scalar1, double scalar2) { return fabs(scalar1-scalar2) < mitk::eps; } template inline bool Equal(const vnl_vector_fixed & vector1, const vnl_vector_fixed& vector2) { vnl_vector_fixed diff = vector1-vector2; return diff.squared_magnitude() < mitk::eps; } template inline void TransferMatrix(const itk::Matrix& in, itk::Matrix& out) { for (unsigned int i = 0; i < in.RowDimensions; ++i) for (unsigned int j = 0; j < in.ColumnDimensions; ++j) out[i][j] = in[i][j]; } } // namespace mitk #endif //DOXYGEN_SKIP /* * This part of the code has been shifted here to avoid compiler clashes * caused by including before the declaration of * the Equal() methods above. This problem occurs when using MSVC and is * probably related to a compiler bug. */ #include namespace mitk { typedef itk::AffineGeometryFrame::TransformType AffineTransform3D; } #define mitkSetConstReferenceMacro(name,type) \ virtual void Set##name (const type & _arg) \ { \ itkDebugMacro("setting " << #name " to " << _arg ); \ if (this->m_##name != _arg) \ { \ this->m_##name = _arg; \ this->Modified(); \ } \ } #define mitkSetVectorMacro(name,type) \ mitkSetConstReferenceMacro(name,type) #define mitkGetVectorMacro(name,type) \ itkGetConstReferenceMacro(name,type) #endif /* MITKVECTOR_H_HEADER_INCLUDED_C1EBD0AD */ diff --git a/Core/Code/DataManagement/mitkWeakPointer.h b/Core/Code/DataManagement/mitkWeakPointer.h index bc1ea3fbcf..f565a4b98c 100644 --- a/Core/Code/DataManagement/mitkWeakPointer.h +++ b/Core/Code/DataManagement/mitkWeakPointer.h @@ -1,227 +1,227 @@ /*========================================================================= Program: Medical Imaging & Interaction Toolkit Language: C++ Date: $Date$ Version: $Revision: 14123 $ Copyright (c) German Cancer Research Center, Division of Medical and Biological Informatics. All rights reserved. See MITKCopyright.txt or http://www.mitk.org/copyright.html for details. This software is distributed WITHOUT ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the above copyright notices for more information. =========================================================================*/ #ifndef __mitkWeakPointer_h #define __mitkWeakPointer_h -#include "mitkCommon.h" +#include #include "mitkMessage.h" #include #include namespace mitk { /** \class WeakPointer * \brief Implements a weak reference to an object. * * Extends the standard itk WeakPointer by listening to delete events of itk::Objects. * When an itk::Object is deleted the WeakPointer sets its internal Pointer to 0. * This enables checking against 0 and avoids crashes by accessing changed memory. * Furthermore it dispatches Modified events with the mitkMessageDelegate system which is * much easier to use. */ template class WeakPointer { public: /** Extract infoirmation from template parameter. */ typedef TObjectType ObjectType; typedef Message1 itkObjectEvent; //##Documentation //## @brief AddEvent is emitted when the object pointed to gets deleted itkObjectEvent ObjectDelete; //##Documentation //## @brief AddEvent is emitted when the object pointed to gets modified itkObjectEvent ObjectModified; /** Constructor. */ WeakPointer () : m_DeleteObserverTag(-1) , m_ModifiedObserverTag(-1) , m_Pointer(0) { } /** Copy constructor. */ WeakPointer (const WeakPointer &p) : m_DeleteObserverTag(-1) , m_ModifiedObserverTag(-1) , m_Pointer(p.m_Pointer) { this->AddDeleteAndModifiedObserver(); } /** Constructor to pointer p. */ WeakPointer (ObjectType *p) : m_DeleteObserverTag(-1), m_ModifiedObserverTag(-1), m_Pointer(p) { this->AddDeleteAndModifiedObserver(); } /** Destructor. */ ~WeakPointer () { this->RemoveDeleteAndModifiedObserver(); m_Pointer = 0; } /** Overload operator ->. */ ObjectType *operator -> () const { return m_Pointer; } /** Return pointer to object. */ operator ObjectType * () const { return m_Pointer; } /** Template comparison operators. */ template bool operator == (R r) const { return (m_Pointer == (ObjectType*)r); } template bool operator != (R r) const { return (m_Pointer != (ObjectType*)r); } /** Access function to pointer. */ ObjectType *GetPointer () const { return m_Pointer; } /** Comparison of pointers. Less than comparison. */ bool operator < (const WeakPointer &r) const { return (void*)m_Pointer < (void*) r.m_Pointer; } /** Comparison of pointers. Greater than comparison. */ bool operator > (const WeakPointer &r) const { return (void*)m_Pointer > (void*) r.m_Pointer; } /** Comparison of pointers. Less than or equal to comparison. */ bool operator <= (const WeakPointer &r) const { return (void*)m_Pointer <= (void*) r.m_Pointer; } /** Comparison of pointers. Greater than or equal to comparison. */ bool operator >= (const WeakPointer &r) const { return (void*)m_Pointer >= (void*) r.m_Pointer; } /** Test if the pointer has been initialized */ bool IsNotNull() const { return m_Pointer != 0; } bool IsNull() const { return m_Pointer == 0; } /** Overload operator assignment. */ WeakPointer &operator = (const WeakPointer &r) { return this->operator = (r.GetPointer()); } /** Overload operator assignment. */ WeakPointer &operator = (ObjectType *r) { this->RemoveDeleteAndModifiedObserver(); m_Pointer = r; this->AddDeleteAndModifiedObserver(); return *this; } /** Function to print object pointed to. */ ObjectType *Print (std::ostream& os) const { // This prints the object pointed to by the pointer (*m_Pointer).Print(os); return m_Pointer; } /// /// \brief Gets called when the object is deleted or modified. /// void OnObjectDelete( const itk::Object *caller, const itk::EventObject & ) { // do not unsubscribe from this object. this would invalidate the iterator of the // event listener vector (in itk::Object) and would lead to a crash // instead: do nothing->object is going to be dead soon... //this->RemoveDeleteAndModifiedObserver(); m_Pointer = 0; m_DeleteObserverTag = -1; m_ModifiedObserverTag = -1; ObjectDelete.Send(caller); } void OnObjectModified( const itk::Object *caller, const itk::EventObject & ) { ObjectModified.Send(caller); } private: void AddDeleteAndModifiedObserver() { if(m_DeleteObserverTag == -1 && m_ModifiedObserverTag == -1 && m_Pointer != 0) { // add observer for delete event typename itk::MemberCommand >::Pointer onObjectDelete = itk::MemberCommand >::New(); onObjectDelete->SetCallbackFunction(this, &WeakPointer::OnObjectDelete); m_DeleteObserverTag = m_Pointer->AddObserver(itk::DeleteEvent(), onObjectDelete); // add observer for modified event typename itk::MemberCommand >::Pointer onObjectModified = itk::MemberCommand >::New(); onObjectModified->SetCallbackFunction(this, &WeakPointer::OnObjectModified); m_ModifiedObserverTag = m_Pointer->AddObserver(itk::ModifiedEvent(), onObjectModified); } } void RemoveDeleteAndModifiedObserver() { if(m_DeleteObserverTag >= 0 && m_ModifiedObserverTag >= 0 && m_Pointer != 0) { m_Pointer->RemoveObserver(m_DeleteObserverTag); m_Pointer->RemoveObserver(m_ModifiedObserverTag); m_DeleteObserverTag = -1; m_ModifiedObserverTag = -1; } } long m_DeleteObserverTag; long m_ModifiedObserverTag; /** The pointer to the object referred to by this smart pointer. */ ObjectType* m_Pointer; }; template std::ostream& operator<< (std::ostream& os, WeakPointer p) { p.Print(os); return os; } } // end namespace mitk #endif diff --git a/Core/Code/DataManagement/mitkWeakPointerProperty.h b/Core/Code/DataManagement/mitkWeakPointerProperty.h index bea8d5de23..15c1f773cb 100644 --- a/Core/Code/DataManagement/mitkWeakPointerProperty.h +++ b/Core/Code/DataManagement/mitkWeakPointerProperty.h @@ -1,58 +1,58 @@ /*========================================================================= Program: Medical Imaging & Interaction Toolkit Language: C++ Date: $Date$ Version: $Revision$ Copyright (c) German Cancer Research Center, Division of Medical and Biological Informatics. All rights reserved. See MITKCopyright.txt or http://www.mitk.org/copyright.html for details. This software is distributed WITHOUT ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the above copyright notices for more information. =========================================================================*/ #ifndef MITKWEAKPOINTERPROPERTY_H_HEADER_INCLUDED_C126B791 #define MITKWEAKPOINTERPROPERTY_H_HEADER_INCLUDED_C126B791 -#include "mitkCommon.h" +#include #include "mitkBaseProperty.h" #include "itkWeakPointer.h" namespace mitk { //##Documentation //## @brief Property containing a smart-pointer //## //## @ingroup DataManagement class MITK_CORE_EXPORT WeakPointerProperty : public BaseProperty { public: mitkClassMacro(WeakPointerProperty, BaseProperty); mitkNewMacro1Param(WeakPointerProperty, itk::Object*); virtual bool operator==(const BaseProperty& property) const; virtual BaseProperty& operator=(const BaseProperty& other) { return Superclass::operator=(other); } virtual ~WeakPointerProperty(); itk::Object::Pointer GetWeakPointer() const; void SetWeakPointer(itk::Object* pointer); protected: itk::WeakPointer m_WeakPointer; WeakPointerProperty(itk::Object* pointer); }; } // namespace mitk #endif /* MITKWEAKPOINTERPROPERTY_H_HEADER_INCLUDED_C126B791 */ diff --git a/Core/Code/IO/mitkFileReader.h b/Core/Code/IO/mitkFileReader.h index 32fa453155..f6574d6c2b 100644 --- a/Core/Code/IO/mitkFileReader.h +++ b/Core/Code/IO/mitkFileReader.h @@ -1,107 +1,107 @@ /*========================================================================= Program: Medical Imaging & Interaction Toolkit Language: C++ Date: $Date$ Version: $Revision$ Copyright (c) German Cancer Research Center, Division of Medical and Biological Informatics. All rights reserved. See MITKCopyright.txt or http://www.mitk.org/copyright.html for details. This software is distributed WITHOUT ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the above copyright notices for more information. =========================================================================*/ #ifndef FILEREADER_H_HEADER_INCLUDED_C1E7E521 #define FILEREADER_H_HEADER_INCLUDED_C1E7E521 -#include "mitkCommon.h" +#include namespace mitk { //##Documentation //## @brief Interface class of readers that read from files //## @ingroup Process class MITK_CORE_EXPORT FileReader { public: //##Documentation //## @brief Get the specified the file to load. //## //## Either the FileName or FilePrefix plus FilePattern are used to read. virtual const char* GetFileName() const = 0; //##Documentation //## @brief Specify the file to load. //## //## Either the FileName or FilePrefix plus FilePattern are used to read. virtual void SetFileName(const char* aFileName) = 0; //##Documentation //## @brief Get the specified file prefix for the file(s) to load. //## //## You should specify either a FileName or FilePrefix. Use FilePrefix if //## the data is stored in multiple files. virtual const char* GetFilePrefix() const = 0; //##Documentation //## @brief Specify file prefix for the file(s) to load. //## //## You should specify either a FileName or FilePrefix. Use FilePrefix if //## the data is stored in multiple files. virtual void SetFilePrefix(const char* aFilePrefix) = 0; //##Documentation //## @brief Get the specified file pattern for the file(s) to load. The //## sprintf format used to build filename from FilePrefix and number. //## //## You should specify either a FileName or FilePrefix. Use FilePrefix if //## the data is stored in multiple files. virtual const char* GetFilePattern() const = 0; /** @brief Specified file pattern for the file(s) to load. The sprintf format used to build filename from FilePrefix and number. You should specify either a FileName or FilePrefix. Use FilePrefix if the data is stored in multiple files. */ virtual void SetFilePattern(const char* aFilePattern) = 0; /** @brief Specifies, whether the file reader also can read a file from a memory buffer */ virtual bool CanReadFromMemory( ); /** @brief Set/Get functions to advise the file reader to use a memory array for reading a file*/ virtual void SetReadFromMemory( bool read ); virtual bool GetReadFromMemory( ); /** @brief To be used along with a call of SetReadFromMemory(true). This sets the memory buffer and the size from which the reader will read.*/ virtual void SetMemoryBuffer(const char* dataArray, unsigned int size); protected: FileReader(); virtual ~FileReader(); bool m_CanReadFromMemory; bool m_ReadFromMemory; const char* m_MemoryBuffer; unsigned int m_MemorySize; public: protected: }; } // namespace mitk #endif /* FILEREADER_H_HEADER_INCLUDED_C1E7E521 */ diff --git a/Core/Code/IO/mitkFileSeriesReader.h b/Core/Code/IO/mitkFileSeriesReader.h index 984c9aa4ad..e3452b30f7 100644 --- a/Core/Code/IO/mitkFileSeriesReader.h +++ b/Core/Code/IO/mitkFileSeriesReader.h @@ -1,65 +1,65 @@ /*========================================================================= Program: Medical Imaging & Interaction Toolkit Language: C++ Date: $Date$ Version: $Revision$ Copyright (c) German Cancer Research Center, Division of Medical and Biological Informatics. All rights reserved. See MITKCopyright.txt or http://www.mitk.org/copyright.html for details. This software is distributed WITHOUT ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the above copyright notices for more information. =========================================================================*/ #ifndef __MITK_FILE_SERIES_READER__H_ #define __MITK_FILE_SERIES_READER__H_ -#include +#include #include #include #include namespace mitk { /** * Provides a function which generates a list of files from * a given prefix and pattern. * Subclasses may use this function to load a series of files. */ class MITK_CORE_EXPORT FileSeriesReader : public FileReader { public: mitkClassMacro( FileSeriesReader, FileReader ); typedef std::vector< std::string > MatchedFileNames; virtual MatchedFileNames GetMatchedFileNames( ); protected: FileSeriesReader(); virtual ~FileSeriesReader(); virtual bool GenerateFileList(); std::string m_FileName; std::string m_FilePrefix; std::string m_FilePattern; MatchedFileNames m_MatchedFileNames; }; } #endif diff --git a/Core/Code/IO/mitkFileWriter.h b/Core/Code/IO/mitkFileWriter.h index 946b752abb..ae305d0e17 100644 --- a/Core/Code/IO/mitkFileWriter.h +++ b/Core/Code/IO/mitkFileWriter.h @@ -1,166 +1,166 @@ /*========================================================================= Program: Medical Imaging & Interaction Toolkit Language: C++ Date: $Date$ Version: $Revision$ Copyright (c) German Cancer Research Center, Division of Medical and Biological Informatics. All rights reserved. See MITKCopyright.txt or http://www.mitk.org/copyright.html for details. This software is distributed WITHOUT ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the above copyright notices for more information. =========================================================================*/ #ifndef FILEWRITER_H_HEADER_INCLUDED #define FILEWRITER_H_HEADER_INCLUDED -#include "mitkCommon.h" +#include #include #include namespace mitk { //##Documentation //## @brief Interface class of writers that write data to files //## @ingroup Process class MITK_CORE_EXPORT FileWriter : public itk::ProcessObject { public: mitkClassMacro(FileWriter,itk::ProcessObject); //##Documentation //## @brief Get the specified the file to write //## //## Either the FileName or FilePrefix plus FilePattern are used to write. virtual const char* GetFileName() const = 0; //##Documentation //## @brief Specify the file to write. //## //## Either the FileName or FilePrefix plus FilePattern are used to write. virtual void SetFileName(const char* aFileName) = 0; //##Documentation //## @brief Get the specified file prefix for the file(s) to write. //## //## You should specify either a FileName or FilePrefix. Use FilePrefix if //## the data is stored in multiple files. virtual const char* GetFilePrefix() const = 0; //##Documentation //## @brief Specify file prefix for the file(s) to write. //## //## You should specify either a FileName or FilePrefix. Use FilePrefix if //## the data is stored in multiple files. virtual void SetFilePrefix(const char* aFilePrefix) = 0; //##Documentation //## @brief Get the specified file pattern for the file(s) to write. The //## sprintf format used to build filename from FilePrefix and number. //## //## You should specify either a FileName or FilePrefix. Use FilePrefix if //## the data is stored in multiple files. virtual const char* GetFilePattern() const = 0; //##Documentation //## @brief Specified file pattern for the file(s) to write. The sprintf //## format used to build filename from FilePrefix and number. //## //## You should specify either a FileName or FilePrefix. Use FilePrefix if //## the data is stored in multiple files. virtual void SetFilePattern(const char* aFilePattern) = 0; //##Documentation //## @brief Return the extension to be added to the filename. virtual std::string GetFileExtension(); //##Documentation //## @brief Checks if given extension is valid for file writer bool IsExtensionValid(std::string extension); //##Documentation //## @brief Return the possible file extensions for the data type associated with the writer virtual std::vector GetPossibleFileExtensions() = 0; //##Documentation //## @brief possible file extensions for the data type associated with the writer as string virtual std::string GetPossibleFileExtensionsAsString(); //##Documentation //## @brief Check if the Writer can write this type of data of the //## DataTreenode. virtual bool CanWriteDataType( DataNode* ); //##Documentation //## @brief Return the MimeType of the saved File. virtual std::string GetWritenMIMEType(); //##Documentation //## @brief Set the DataTreenode as Input. Important: The Writer //## always have a SetInput-Function. virtual void SetInput( DataNode* ); virtual void Write() = 0; /** @brief Specifies, whether the file writer also can write a file to a memory buffer */ virtual bool CanWriteToMemory( ); /** @brief Set/Get functions to advise the file writer to use tis internal memory array as file writing destination*/ virtual void SetWriteToMemory( bool write ); virtual bool GetWriteToMemory( ); /** @brief To be used along with a call of SetWriteToMemory(true). This returns the memory buffer where the file was written.*/ virtual const char* GetMemoryPointer(); /** @brief To be used along with a call of SetWriteToMemory(true). This returns the size of the memory buffer where the file was written.*/ virtual unsigned int GetMemorySize(); /** @brief CAUTION: It's up to the user to call this function to release the memory buffer after use in case the file writer has written to its memory array.*/ virtual void ReleaseMemory(); protected: FileWriter(); virtual ~FileWriter(); bool m_CanWriteToMemory; bool m_WriteToMemory; char * m_MemoryBuffer; unsigned int m_MemoryBufferSize; }; #define mitkWriterMacro \ virtual void Write() \ { \ if ( this->GetInput() == NULL ) \ { \ itkExceptionMacro(<<"Write:Please specify an input!"); \ return; \ } \ /* Fill in image information.*/ \ this->UpdateOutputInformation(); \ (*(this->GetInputs().begin()))->SetRequestedRegionToLargestPossibleRegion();\ this->PropagateRequestedRegion(NULL); \ this->UpdateOutputData(NULL); \ } \ \ virtual void Update() \ { \ Write(); \ } } // namespace mitk #endif /* FILEWRITER_H_HEADER_INCLUDED */ diff --git a/Core/Code/IO/mitkImageGenerator.h b/Core/Code/IO/mitkImageGenerator.h index 97b41ae210..86131bcac8 100644 --- a/Core/Code/IO/mitkImageGenerator.h +++ b/Core/Code/IO/mitkImageGenerator.h @@ -1,110 +1,110 @@ /*========================================================================= Copyright (c) German Cancer Research Center, Division of Medical and Biological Informatics. All rights reserved. See MITKCopyright.txt or http://www.mitk.org/copyright.html for details. This software is distributed WITHOUT ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the above copyright notices for more information. =========================================================================*/ #ifndef ImageGenerator_H_HEADER_INCLUDED #define ImageGenerator_H_HEADER_INCLUDED -#include "mitkCommon.h" +#include #include #include namespace mitk { //##Documentation //## @brief generator for random MITK images //## This is a helper class to generate MITK images filled with random values. //## The parameters dimX, dimY, dimZ, and dimT are used to set the dimensions of the MITK image. //## Default parameters are dimT = 1 and dimZ = 1 which is a 2D image (or a 4D image with just 1 slice and 1 time step). //## The parameters randomMax and randomMin are boundary values for the random generator. //## In other words: the generator will generate values between randomMin and randomMax. //## @ingroup IO class MITK_CORE_EXPORT ImageGenerator { public: template static mitk::Image::Pointer GenerateRandomImage(unsigned int dimX, unsigned int dimY, unsigned int dimZ = 1, unsigned int dimT = 1, const double randomMax = 1000.0f, const double randMin = 0.0f) { //set the data type according to the template mitk::PixelType type; type.Initialize(typeid(TPixelType)); //initialize the MITK image with given dimenion and data type mitk::Image::Pointer output = mitk::Image::New(); unsigned int* dimensions = new unsigned int[4]; unsigned int numberOfDimensions = 0; unsigned int bufferSize = 0; //check which dimension is needed if(dimT <= 1) { if(dimZ <= 1) { //2D numberOfDimensions = 2; dimensions[0] = dimX; dimensions[1] = dimY; bufferSize = dimX*dimY; } else { //3D numberOfDimensions = 3; dimensions[0] = dimX; dimensions[1] = dimY; dimensions[2] = dimZ; bufferSize = dimX*dimY*dimZ; } } else { //4D numberOfDimensions = 4; dimensions[0] = dimX; dimensions[1] = dimY; dimensions[2] = dimZ; dimensions[3] = dimT; bufferSize = dimX*dimY*dimZ*dimT; } output->Initialize(type, numberOfDimensions, dimensions); //get a pointer to the image buffer to write into TPixelType* imageBuffer = (TPixelType*)output->GetData(); //initialize the random generator itk::Statistics::MersenneTwisterRandomVariateGenerator::Pointer randomGenerator = itk::Statistics::MersenneTwisterRandomVariateGenerator::New(); randomGenerator->Initialize(); //fill the buffer for each pixel/voxel for(unsigned int i = 0; i < bufferSize; i++) { if(type == typeid(int)) //call integer function { imageBuffer[i] = (TPixelType)randomGenerator->GetIntegerVariate((int)randomMax); //TODO random generator does not support integer values in a given range (e.g. from 5-10) //range is always [0, (int)randomMax] }else if((type == typeid(double)) || (type == typeid(float))) //call integer function { imageBuffer[i] = (TPixelType)randomGenerator->GetUniformVariate(randMin,randomMax); }else if(type == typeid(unsigned char)) { //use the integer randomGenerator with mod 256 to generate unsigned char values imageBuffer[i] = (unsigned char) ((int)randomGenerator->GetIntegerVariate((int)randomMax)) % 256; }else{ MITK_ERROR << "Datatype not supported yet."; //TODO call different methods for other datatypes } } return output; } }; } // namespace mitk #endif /* ImageGenerator_H_HEADER_INCLUDED */ diff --git a/Core/Code/IO/mitkItkImageFileReader.h b/Core/Code/IO/mitkItkImageFileReader.h index f836ce3c93..81a44176b0 100644 --- a/Core/Code/IO/mitkItkImageFileReader.h +++ b/Core/Code/IO/mitkItkImageFileReader.h @@ -1,67 +1,67 @@ /*========================================================================= Program: Medical Imaging & Interaction Toolkit Language: C++ Date: $Date$ Version: $Revision$ Copyright (c) German Cancer Research Center, Division of Medical and Biological Informatics. All rights reserved. See MITKCopyright.txt or http://www.mitk.org/copyright.html for details. This software is distributed WITHOUT ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the above copyright notices for more information. =========================================================================*/ #ifndef ItkImageFileReader_H_HEADER_INCLUDED #define ItkImageFileReader_H_HEADER_INCLUDED -#include "mitkCommon.h" +#include #include "mitkFileReader.h" #include "mitkImageSource.h" namespace mitk { //##Documentation //## @brief Reader to read file formats supported by itk //## @ingroup IO class MITK_CORE_EXPORT ItkImageFileReader : public ImageSource, public FileReader { public: mitkClassMacro(ItkImageFileReader, FileReader); /** Method for creation through the object factory. */ itkNewMacro(Self); itkSetStringMacro(FileName); itkGetStringMacro(FileName); itkSetStringMacro(FilePrefix); itkGetStringMacro(FilePrefix); itkSetStringMacro(FilePattern); itkGetStringMacro(FilePattern); static bool CanReadFile(const std::string filename, const std::string filePrefix, const std::string filePattern); protected: virtual void GenerateData(); ItkImageFileReader(); ~ItkImageFileReader(); std::string m_FileName; std::string m_FilePrefix; std::string m_FilePattern; }; } // namespace mitk #endif /* ItkImageFileReader_H_HEADER_INCLUDED */ diff --git a/Core/Code/IO/mitkLog.h b/Core/Code/IO/mitkLog.h index 1d21a9c3a2..87170dd129 100644 --- a/Core/Code/IO/mitkLog.h +++ b/Core/Code/IO/mitkLog.h @@ -1,63 +1,63 @@ /*========================================================================= Program: Medical Imaging & Interaction Toolkit Language: C++ Date: $Date: 2009-05-12 19:56:03 +0200 (Tue, 12 May 2009) $ Version: $Revision: 17179 $ Copyright (c) German Cancer Research Center, Division of Medical and Biological Informatics. All rights reserved. See MITKCopyright.txt or http://www.mitk.org/copyright.html for details. This software is distributed WITHOUT ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the above copyright notices for more information. =========================================================================*/ #ifndef _MITK_LOG_H #define _MITK_LOG_H -#include +#include namespace mitk { /*! \brief mbilog backend implementation for mitk */ class MITK_CORE_EXPORT LoggingBackend : public mbilog::AbstractBackend { public: /** \brief overloaded method for receiving log message from mbilog */ void ProcessMessage(const mbilog::LogMessage& ); /** \brief registers MITK logging backend at mbilog */ static void Register(); /** \brief Unregisters MITK logging backend at mbilog */ static void Unregister(); /** \brief Sets extra log file path (additionally to the console log) */ static void SetLogFile(const char *file); /** \brief Enables an additional logging output window by means of itk::outputwindow * This might be relevant for showing log output in applications with no default output console */ static void EnableAdditionalConsoleWindow(bool enable); /** \brief Automatically extracts and removes the "--logfile " parameters from the standard C main(argc,argv) parameter list and calls SetLogFile if needed */ static void CatchLogFileCommandLineParameter(int &argc,char **argv); }; } #endif diff --git a/Core/Code/IO/mitkLookupTableProperty.h b/Core/Code/IO/mitkLookupTableProperty.h index 89744d02ac..12bc89cde6 100755 --- a/Core/Code/IO/mitkLookupTableProperty.h +++ b/Core/Code/IO/mitkLookupTableProperty.h @@ -1,66 +1,66 @@ /*========================================================================= Program: Medical Imaging & Interaction Toolkit Language: C++ Date: $Date$ Version: $Revision$ Copyright (c) German Cancer Research Center, Division of Medical and Biological Informatics. All rights reserved. See MITKCopyright.txt or http://www.mitk.org/copyright.html for details. This software is distributed WITHOUT ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the above copyright notices for more information. =========================================================================*/ #ifndef MITKLookupTablePROPERTY_H_HEADER_INCLUDED_C10EEAA8 #define MITKLookupTablePROPERTY_H_HEADER_INCLUDED_C10EEAA8 -#include "mitkCommon.h" +#include #include "mitkBaseProperty.h" #include "mitkLookupTable.h" namespace mitk { //##Documentation //## @brief Property for LookupTable data //## //## @ingroup DataManagement class MITK_CORE_EXPORT LookupTableProperty : public BaseProperty { protected: LookupTable::Pointer m_LookupTable; LookupTableProperty(); LookupTableProperty(const mitk::LookupTable::Pointer lut); // LookupTableProperty(const mitk::LookupTable& aLookupTable); public: mitkClassMacro(LookupTableProperty, BaseProperty); itkNewMacro(LookupTableProperty); mitkNewMacro1Param(LookupTableProperty, const mitk::LookupTable::Pointer); virtual BaseProperty& operator=(const BaseProperty& other) { return Superclass::operator=(other); } virtual ~LookupTableProperty(); virtual bool operator==(const BaseProperty& property) const; itkGetObjectMacro(LookupTable, LookupTable ); void SetLookupTable(const mitk::LookupTable::Pointer aLookupTable); }; } // namespace mitk #endif /* MITKLookupTablePROPERTY_H_HEADER_INCLUDED_C10EEAA8 */ diff --git a/Core/Code/IO/mitkOperation.h b/Core/Code/IO/mitkOperation.h index 9dc04dbb39..ef1964f188 100644 --- a/Core/Code/IO/mitkOperation.h +++ b/Core/Code/IO/mitkOperation.h @@ -1,67 +1,67 @@ /*========================================================================= Program: Medical Imaging & Interaction Toolkit Language: C++ Date: $Date$ Version: $Revision$ Copyright (c) German Cancer Research Center, Division of Medical and Biological Informatics. All rights reserved. See MITKCopyright.txt or http://www.mitk.org/copyright.html for details. This software is distributed WITHOUT ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the above copyright notices for more information. =========================================================================*/ #ifndef OPERATION_H_HEADER_INCLUDED_C16E7D9E #define OPERATION_H_HEADER_INCLUDED_C16E7D9E -#include "mitkCommon.h" +#include namespace mitk { typedef int OperationType ; //##Documentation //## @brief Base class of all Operation-classes //## //## @ingroup Undo class MITK_CORE_EXPORT Operation { public: //##Documentation //## Constructor Operation(OperationType operationType); virtual ~Operation(); OperationType GetOperationType(); protected: OperationType m_OperationType; }; class MITK_CORE_EXPORT OperationEndEvent : public itk::EndEvent { public: typedef OperationEndEvent Self; typedef itk::EndEvent Superclass; OperationEndEvent(Operation* operation = NULL) : m_Operation(operation) {} virtual ~OperationEndEvent() {} virtual const char * GetEventName() const { return "OperationEndEvent"; } virtual bool CheckEvent(const ::itk::EventObject* e) const { return dynamic_cast(e); } virtual ::itk::EventObject* MakeObject() const { return new Self(m_Operation); } Operation* GetOperation() const { return m_Operation; } private: Operation* m_Operation; OperationEndEvent(const Self&); void operator=(const Self&); }; }//namespace mitk #endif /* OPERATION_H_HEADER_INCLUDED_C16E7D9E */ diff --git a/Core/Code/IO/mitkOperationActor.h b/Core/Code/IO/mitkOperationActor.h index 865a741239..c84e8be301 100644 --- a/Core/Code/IO/mitkOperationActor.h +++ b/Core/Code/IO/mitkOperationActor.h @@ -1,52 +1,52 @@ /*========================================================================= Program: Medical Imaging & Interaction Toolkit Language: C++ Date: $Date$ Version: $Revision$ Copyright (c) German Cancer Research Center, Division of Medical and Biological Informatics. All rights reserved. See MITKCopyright.txt or http://www.mitk.org/copyright.html for details. This software is distributed WITHOUT ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the above copyright notices for more information. =========================================================================*/ #ifndef OPERATIONACTOR_H_HEADER_INCLUDED_C16E28BD #define OPERATIONACTOR_H_HEADER_INCLUDED_C16E28BD -#include "mitkCommon.h" +#include namespace mitk { class Operation; class OperationEvent; /** Macro for checking the type of an operation*/ #define mitkCheckOperationTypeMacro(OperationType, operation, newOperationName) \ mitk::OperationType *newOperationName= dynamic_cast(operation);\ if (newOperationName == NULL)\ {\ itkWarningMacro("Recieved wrong type of operation!");\ return;\ }\ //##Documentation //## @brief abstract class, that can be used by Undo to undo an operation. //## //## @ingroup Undo class MITK_CORE_EXPORT OperationActor { public: virtual ~OperationActor() {}; virtual void ExecuteOperation(Operation* operation) = 0; }; } #endif /* OPERATIONACTOR_H_HEADER_INCLUDED_C16E28BD */ diff --git a/Core/Code/IO/mitkPicFileReader.h b/Core/Code/IO/mitkPicFileReader.h index 4afbeb85c3..d9f44383c6 100644 --- a/Core/Code/IO/mitkPicFileReader.h +++ b/Core/Code/IO/mitkPicFileReader.h @@ -1,80 +1,80 @@ /*========================================================================= Program: Medical Imaging & Interaction Toolkit Language: C++ Date: $Date$ Version: $Revision$ Copyright (c) German Cancer Research Center, Division of Medical and Biological Informatics. All rights reserved. See MITKCopyright.txt or http://www.mitk.org/copyright.html for details. This software is distributed WITHOUT ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the above copyright notices for more information. =========================================================================*/ #ifndef PICFILEREADER_H_HEADER_INCLUDED_C1F48A22 #define PICFILEREADER_H_HEADER_INCLUDED_C1F48A22 -#include "mitkCommon.h" +#include #include "mitkFileReader.h" #include "mitkImageSource.h" namespace mitk { //##Documentation //## @brief Reader to read files in DKFZ-pic-format //## @ingroup IO class MITK_CORE_EXPORT PicFileReader : public ImageSource, public FileReader { public: mitkClassMacro(PicFileReader, FileReader); /** Method for creation through the object factory. */ itkNewMacro(Self); itkSetStringMacro(FileName); itkGetStringMacro(FileName); itkSetStringMacro(FilePrefix); itkGetStringMacro(FilePrefix); itkSetStringMacro(FilePattern); itkGetStringMacro(FilePattern); virtual void EnlargeOutputRequestedRegion(itk::DataObject *output); static void ConvertHandedness(mitkIpPicDescriptor* pic); static bool CanReadFile(const std::string filename, const std::string filePrefix, const std::string filePattern); protected: virtual void GenerateData(); virtual void GenerateOutputInformation(); PicFileReader(); ~PicFileReader(); //##Description //## @brief Time when Header was last read itk::TimeStamp m_ReadHeaderTime; int m_StartFileIndex; std::string m_FileName; std::string m_FilePrefix; std::string m_FilePattern; }; } // namespace mitk #endif /* PICFILEREADER_H_HEADER_INCLUDED_C1F48A22 */ diff --git a/Core/Code/IO/mitkPicHelper.h b/Core/Code/IO/mitkPicHelper.h index 09c4618d08..f726d5f56f 100644 --- a/Core/Code/IO/mitkPicHelper.h +++ b/Core/Code/IO/mitkPicHelper.h @@ -1,53 +1,53 @@ /*========================================================================= Program: Medical Imaging & Interaction Toolkit Language: C++ Date: $Date$ Version: $Revision$ Copyright (c) German Cancer Research Center, Division of Medical and Biological Informatics. All rights reserved. See MITKCopyright.txt or http://www.mitk.org/copyright.html for details. This software is distributed WITHOUT ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the above copyright notices for more information. =========================================================================*/ #ifndef MITKPICHELPER_H_HEADER_INCLUDED_C1F4DAB4 #define MITKPICHELPER_H_HEADER_INCLUDED_C1F4DAB4 -#include "mitkCommon.h" +#include #include "mitkVector.h" #include namespace mitk { class SlicedGeometry3D; //##Documentation //## @brief Internal class for managing references on sub-images //## @ingroup Data class MITK_CORE_EXPORT PicHelper { public: static const char *GetNameOfClass() { return "PicHelper"; } static bool GetSpacing(const mitkIpPicDescriptor* pic, Vector3D & spacing); static bool SetSpacing(const mitkIpPicDescriptor* pic, SlicedGeometry3D* slicedgeometry); static bool GetTimeSpacing(const mitkIpPicDescriptor* pic, float& timeSpacing); static void InitializeEvenlySpaced(const mitkIpPicDescriptor* pic, unsigned int slices, SlicedGeometry3D* slicedgeometry); static bool SetGeometry2D(const mitkIpPicDescriptor* pic, int s, SlicedGeometry3D* slicedgeometry); }; } // namespace mitk #endif /* MITKPICHELPER_H_HEADER_INCLUDED_C1F4DAB4 */ diff --git a/Core/Code/IO/mitkPicVolumeTimeSeriesReader.h b/Core/Code/IO/mitkPicVolumeTimeSeriesReader.h index adf30ad738..54d1a05f47 100644 --- a/Core/Code/IO/mitkPicVolumeTimeSeriesReader.h +++ b/Core/Code/IO/mitkPicVolumeTimeSeriesReader.h @@ -1,70 +1,70 @@ /*========================================================================= Program: Medical Imaging & Interaction Toolkit Language: C++ Date: $Date$ Version: $Revision$ Copyright (c) German Cancer Research Center, Division of Medical and Biological Informatics. All rights reserved. See MITKCopyright.txt or http://www.mitk.org/copyright.html for details. This software is distributed WITHOUT ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the above copyright notices for more information. =========================================================================*/ #ifndef _PIC_VOLUME_TIME_SERIES_READER__H_ #define _PIC_VOLUME_TIME_SERIES_READER__H_ -#include "mitkCommon.h" +#include #include "mitkFileSeriesReader.h" #include "mitkImageSource.h" #include namespace mitk { //##Documentation //## @brief Reader to read a series of volume files in DKFZ-pic-format //## @ingroup IO class MITK_CORE_EXPORT PicVolumeTimeSeriesReader : public ImageSource, public FileSeriesReader { public: mitkClassMacro( PicVolumeTimeSeriesReader, FileReader ); /** Method for creation through the object factory. */ itkNewMacro( Self ); itkSetStringMacro(FileName); itkGetStringMacro(FileName); itkSetStringMacro(FilePrefix); itkGetStringMacro(FilePrefix); itkSetStringMacro(FilePattern); itkGetStringMacro(FilePattern); static bool CanReadFile(const std::string filename, const std::string filePrefix, const std::string filePattern); protected: virtual void GenerateData(); virtual void GenerateOutputInformation(); PicVolumeTimeSeriesReader(); ~PicVolumeTimeSeriesReader(); //##Description //## @brief Time when Header was last read itk::TimeStamp m_ReadHeaderTime; }; } // namespace mitk #endif diff --git a/Core/Code/IO/mitkPixelType.h b/Core/Code/IO/mitkPixelType.h index 0b32eea625..c6e1b78b9b 100644 --- a/Core/Code/IO/mitkPixelType.h +++ b/Core/Code/IO/mitkPixelType.h @@ -1,169 +1,169 @@ /*========================================================================= Program: Medical Imaging & Interaction Toolkit Language: C++ Date: $Date$ Version: $Revision$ Copyright (c) German Cancer Research Center, Division of Medical and Biological Informatics. All rights reserved. See MITKCopyright.txt or http://www.mitk.org/copyright.html for details. This software is distributed WITHOUT ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the above copyright notices for more information. =========================================================================*/ #ifndef PIXELTYPE_H_HEADER_INCLUDED_C1EBF565 #define PIXELTYPE_H_HEADER_INCLUDED_C1EBF565 -#include "mitkCommon.h" +#include #include #include namespace mitk { //##Documentation //## @brief Class for defining the data type of pixels //## //## To obtain additional type information not provided by this class //## itk::ImageIOBase can be used by passing the return value of //## PixelType::GetItkTypeId() to itk::ImageIOBase::SetPixelTypeInfo //## and using the itk::ImageIOBase methods GetComponentType, //## GetComponentTypeAsString, GetPixelType, GetPixelTypeAsString. //## @ingroup Data class MITK_CORE_EXPORT PixelType { public: itkTypeMacro(PixelType, None); typedef itk::ImageIOBase::IOPixelType ItkIOPixelType; PixelType(const std::type_info& aTypeId, int numberOfComponents = 1, ItkIOPixelType anItkIoPixelType = itk::ImageIOBase::UNKNOWNPIXELTYPE); PixelType(mitkIpPicType_t type, int bpe, int numberOfComponents = 1); PixelType(const mitkIpPicDescriptor* pic); PixelType(const mitk::PixelType & aPixelType); /** \brief Get the \a type_info of the scalar (!) type. Each element * may contain m_NumberOfComponents (more than one) of these scalars. * * \sa GetItkTypeId */ inline const std::type_info * GetTypeId() const { return m_TypeId; } /** \brief Get the \a type_info of the ITK-type representing an * element. Can be \a NULL in case the ITK-type is unknown. * * \sa GetTypeId */ inline const std::type_info * GetItkTypeId() const { return m_ItkTypeId; } /** \brief Get the \a mitkIpPicType_t of the scalar (!) component type. Each element * may contain m_NumberOfComponents (more than one) of these scalars. * * \sa GetItkTypeId * \sa GetTypeId */ inline mitkIpPicType_t GetType() const { return m_Type; } /** \brief Get the number of bits per element (of an * element) * * A vector of double with three components will return * 8*sizeof(double)*3. * \sa GetBitsPerComponent * \sa GetItkTypeId * \sa GetTypeId */ inline int GetBpe() const { return m_Bpe; } /** \brief Get the number of components of which each element consists * * Each pixel can consist of multiple components, e.g. RGB. */ inline int GetNumberOfComponents() const { return m_NumberOfComponents; } /** \brief Get the number of bits per components * \sa GetBitsPerComponent */ inline int GetBitsPerComponent() const { return m_BitsPerComponent; } /** \brief Get the typename of the ITK-type representing an * element as a human-readable string * * \sa GetItkTypeId */ std::string GetItkTypeAsString() const; inline PixelType& operator=(const PixelType& aPixelType) { m_TypeId=aPixelType.GetTypeId(); m_ItkTypeId=aPixelType.GetItkTypeId(); m_Type=aPixelType.GetType(); m_Bpe=aPixelType.GetBpe(); m_NumberOfComponents = aPixelType.GetNumberOfComponents(); m_BitsPerComponent = aPixelType.GetBitsPerComponent(); return *this; } bool operator==(const PixelType& rhs) const; bool operator!=(const PixelType& rhs) const; bool operator==(const std::type_info& typeId) const; bool operator!=(const std::type_info& typeId) const; PixelType(); void Initialize(const std::type_info& aTypeId, int numberOfCompontents = 1, ItkIOPixelType anItkIoPixelType = itk::ImageIOBase::UNKNOWNPIXELTYPE); void Initialize(mitkIpPicType_t type, int bpe, int numberOfComponents = 1); virtual ~PixelType() {} private: /** \brief the \a type_info of the scalar (!) component type. Each element * may contain m_NumberOfComponents (more than one) of these scalars. * * \sa m_ItkTypeId */ const std::type_info* m_TypeId; /** \brief the \a type_info of the ITK-type representing an * element * * \sa m_TypeId */ const std::type_info* m_ItkTypeId; mitkIpPicType_t m_Type; int m_Bpe; int m_NumberOfComponents; int m_BitsPerComponent; }; } // namespace mitk #endif /* PIXELTYPE_H_HEADER_INCLUDED_C1EBF565 */ diff --git a/Core/Code/IO/mitkRawImageFileReader.h b/Core/Code/IO/mitkRawImageFileReader.h index e8d276d2d7..4ca70779f0 100644 --- a/Core/Code/IO/mitkRawImageFileReader.h +++ b/Core/Code/IO/mitkRawImageFileReader.h @@ -1,111 +1,111 @@ /*========================================================================= Program: Medical Imaging & Interaction Toolkit Language: C++ Date: $Date$ Version: $Revision$ Copyright (c) German Cancer Research Center, Division of Medical and Biological Informatics. All rights reserved. See MITKCopyright.txt or http://www.mitk.org/copyright.html for details. This software is distributed WITHOUT ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the above copyright notices for more information. =========================================================================*/ #ifndef RawImageFileReader_H_HEADER_INCLUDED #define RawImageFileReader_H_HEADER_INCLUDED #include "itkVector.h" -#include "mitkCommon.h" +#include #include "mitkFileReader.h" #include "mitkImageSource.h" namespace mitk { //##Documentation //## @brief Reader to read raw image files /** The user must set the dimensionality, the dimensions and the pixel type. If they are incorrect, the image will not be opened or the visualization will be incorrect. */ //## @ingroup IO class MITK_CORE_EXPORT RawImageFileReader : public ImageSource, public FileReader { public: mitkClassMacro(RawImageFileReader, FileReader); /** Method for creation through the object factory. */ itkNewMacro(Self); itkSetMacro(FileName, std::string); itkSetStringMacro(FileName); itkGetMacro(FileName, std::string); itkGetStringMacro(FileName); itkSetMacro(FilePrefix, std::string); itkSetStringMacro(FilePrefix); itkGetMacro(FilePrefix, std::string); itkGetStringMacro(FilePrefix); itkSetMacro(FilePattern, std::string); itkSetStringMacro(FilePattern); itkGetMacro(FilePattern, std::string); itkGetStringMacro(FilePattern); /** Supported pixel types. */ typedef enum {UCHAR,SCHAR,USHORT,SSHORT, UINT, SINT, FLOAT, DOUBLE} IOPixelType; itkSetMacro(PixelType, IOPixelType); /** Endianity of bits. */ typedef enum {LITTLE, BIG} EndianityType; itkSetMacro(Endianity, EndianityType); itkSetMacro(Dimensionality, int); itkGetMacro(Dimensionality, int); /** Image dimensions must be set one by one, starting from dimension 0. */ void SetDimensions(unsigned int i, unsigned int dim); unsigned int GetDimensions(unsigned int i) const; static bool CanReadFile(const std::string filename, const std::string filePrefix, const std::string filePattern); protected: RawImageFileReader(); ~RawImageFileReader(); virtual void GenerateData(); template < typename TPixel, unsigned int VImageDimensions > void TypedGenerateData(); /** Name of file to be read.*/ std::string m_FileName; /** File prefix. */ std::string m_FilePrefix; /** File pattern. */ std::string m_FilePattern; /** Pixel type of image to be read. Must be of type IOPixelType. */ IOPixelType m_PixelType; /** Dimensionality of file to be read. Can be 2 or 3. */ int m_Dimensionality; /** Endianity. Must be set to LITTLE or BIG. Default is BIG. */ EndianityType m_Endianity; /** Vector containing dimensions of image to be read. */ itk::Vector m_Dimensions; }; } // namespace mitk #endif /* RawImageFileReader_H_HEADER_INCLUDED */ diff --git a/Core/Code/IO/mitkSTLFileReader.h b/Core/Code/IO/mitkSTLFileReader.h index 98b72282a2..7bbea7bd47 100644 --- a/Core/Code/IO/mitkSTLFileReader.h +++ b/Core/Code/IO/mitkSTLFileReader.h @@ -1,59 +1,59 @@ /*========================================================================= Program: Medical Imaging & Interaction Toolkit Language: C++ Date: $Date$ Version: $Revision$ Copyright (c) German Cancer Research Center, Division of Medical and Biological Informatics. All rights reserved. See MITKCopyright.txt or http://www.mitk.org/copyright.html for details. This software is distributed WITHOUT ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the above copyright notices for more information. =========================================================================*/ #ifndef STLFileReader_H_HEADER_INCLUDED #define STLFileReader_H_HEADER_INCLUDED -#include "mitkCommon.h" +#include #include "mitkSurfaceSource.h" namespace mitk { //##Documentation //## @brief Reader to read files in stl-format //## @ingroup IO class MITK_CORE_EXPORT STLFileReader : public SurfaceSource { public: mitkClassMacro(STLFileReader, SurfaceSource); /** Method for creation through the object factory. */ itkNewMacro(Self); itkSetStringMacro(FileName); itkGetStringMacro(FileName); itkSetStringMacro(FilePrefix); itkGetStringMacro(FilePrefix); itkSetStringMacro(FilePattern); itkGetStringMacro(FilePattern); static bool CanReadFile(const std::string filename, const std::string filePrefix, const std::string filePattern); protected: virtual void GenerateData(); STLFileReader(); ~STLFileReader(); std::string m_FileName, m_FilePrefix, m_FilePattern; }; } // namespace mitk #endif /* STLFileReader_H_HEADER_INCLUDED */ diff --git a/Core/Code/IO/mitkStandardFileLocations.h b/Core/Code/IO/mitkStandardFileLocations.h index 859427450c..a8a9f6694b 100644 --- a/Core/Code/IO/mitkStandardFileLocations.h +++ b/Core/Code/IO/mitkStandardFileLocations.h @@ -1,117 +1,117 @@ /*========================================================================= Program: Medical Imaging & Interaction Toolkit Language: C++ Date: $Date$ Version: $Revision$ Copyright (c) German Cancer Research Center, Division of Medical and Biological Informatics. All rights reserved. See MITKCopyright.txt or http://www.mitk.org/copyright.html for details. This software is distributed WITHOUT ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the above copyright notices for more information. =========================================================================*/ #ifndef MITK_STANDARD_FILE_LOCATIONS_H_INCLUDED_SWDG #define MITK_STANDARD_FILE_LOCATIONS_H_INCLUDED_SWDG #include #include #include -#include "mitkCommon.h" +#include namespace mitk { /*! \brief Provides a method to look for configuration and option files etc. Call mitk::StandardFileLocations::FindFile(filename) to look for configuration files. Call mitk::StandardFileLocations::GetOptionDirectory() to look for/save option files. */ class MITK_CORE_EXPORT StandardFileLocations : public itk::Object { public: typedef StandardFileLocations Self; typedef itk::Command Superclass; typedef itk::SmartPointer Pointer; /*! \brief Adds a directory into the search queue: \ Use this function in combination with FindFile(), after adding some \ directories, they will also be searched for the requested file \param dir directory you want to be searched in \param insertInFrontOfSearchList wheather this search request shall be processed first */ void AddDirectoryForSearch(const char * dir, bool insertInFrontOfSearchList = true); /*! \brief Remove a directory from the search queue: \ Use this function in combination with FindFile(). \ \param dir directory you want to be searched in */ void RemoveDirectoryForSearch(const char * dir); /*! \brief looks for a file in several standard locations \param filename The file you want to fine, without any path \param pathInSourceDir Where in the source tree hierarchy would that file be? \return The absolute path to the file including the filename This method appends several standard locations to the end of the searchqueue (if they not already exist) and then searches for the file within all directories contained in the search queue: 1. Add the directory specified in the environment variable MITKCONF 2. Add the .mitk directory in the home folder of the user 3. Add the current working directory 4. Add the (current working directory)/bin directory 5. Add the directory specified in pathInSourceDir, that is relative to the source code directory root (which is determined at compile time) Already added directories in the searchqueue by using AddDirectoryForSearch before calling FindFile are still searched first, because above mentioned standard locations are always appended at the end of the list. */ std::string FindFile(const char* filename, const char* pathInSourceDir = NULL ); /*! \brief Return directory of/for option files \return The absolute path to the directory for option files. This method looks for the directory of/for option files in two ways. The logic is as follows 1. If there is an environment variable MITKOPTIONS, then use that directory. 2. Use .mitk-subdirectory in home directory of the user The directory will be created if it does not exist. */ std::string GetOptionDirectory(); static StandardFileLocations* GetInstance(); protected: itkNewMacro( Self ); typedef std::vector FileSearchVectorType; FileSearchVectorType m_SearchDirectories; StandardFileLocations(); virtual ~StandardFileLocations(); std::string SearchDirectoriesForFile(const char * filename); private: // Private Copy Constructor StandardFileLocations( const StandardFileLocations& ); }; } // namespace #endif diff --git a/Core/Code/IO/mitkVtiFileReader.h b/Core/Code/IO/mitkVtiFileReader.h index 432f401211..18ef9fe44d 100644 --- a/Core/Code/IO/mitkVtiFileReader.h +++ b/Core/Code/IO/mitkVtiFileReader.h @@ -1,71 +1,71 @@ /*========================================================================= Program: Medical Imaging & Interaction Toolkit Language: C++ Date: $Date$ Version: $Revision$ Copyright (c) German Cancer Research Center, Division of Medical and Biological Informatics. All rights reserved. See MITKCopyright.txt or http://www.mitk.org/copyright.html for details. This software is distributed WITHOUT ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the above copyright notices for more information. =========================================================================*/ #ifndef VtiFileReader_H_HEADER_INCLUDED #define VtiFileReader_H_HEADER_INCLUDED -#include "mitkCommon.h" +#include #include "mitkFileReader.h" #include "mitkImageSource.h" namespace mitk { //##Documentation //## @brief Reader to read image files in vtk file format //## @ingroup IO class MITK_CORE_EXPORT VtiFileReader : public ImageSource, public FileReader { public: mitkClassMacro(VtiFileReader, FileReader); /** Method for creation through the object factory. */ itkNewMacro(Self); itkSetStringMacro(FileName); itkGetStringMacro(FileName); itkSetStringMacro(FilePrefix); itkGetStringMacro(FilePrefix); itkSetStringMacro(FilePattern); itkGetStringMacro(FilePattern); static bool CanReadFile(const std::string filename, const std::string filePrefix, const std::string filePattern); protected: VtiFileReader(); ~VtiFileReader(); virtual void GenerateData(); //##Description //## @brief Time when Header was last read //itk::TimeStamp m_ReadHeaderTime; protected: std::string m_FileName; std::string m_FilePrefix; std::string m_FilePattern; }; } // namespace mitk #endif /* VtiFileReader_H_HEADER_INCLUDED */ diff --git a/Core/Code/IO/mitkVtkImageReader.h b/Core/Code/IO/mitkVtkImageReader.h index 25e4287237..e365de44d1 100644 --- a/Core/Code/IO/mitkVtkImageReader.h +++ b/Core/Code/IO/mitkVtkImageReader.h @@ -1,71 +1,71 @@ /*========================================================================= Program: Medical Imaging & Interaction Toolkit Language: C++ Date: $Date$ Version: $Revision$ Copyright (c) German Cancer Research Center, Division of Medical and Biological Informatics. All rights reserved. See MITKCopyright.txt or http://www.mitk.org/copyright.html for details. This software is distributed WITHOUT ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the above copyright notices for more information. =========================================================================*/ #ifndef VtkImageReader_H_HEADER_INCLUDED #define VtkImageReader_H_HEADER_INCLUDED -#include "mitkCommon.h" +#include #include "mitkFileReader.h" #include "mitkImageSource.h" namespace mitk { //##Documentation //## @brief Reader to read image files in vtk file format //## @ingroup IO class MITK_CORE_EXPORT VtkImageReader : public ImageSource, public FileReader { public: mitkClassMacro(VtkImageReader, FileReader); /** Method for creation through the object factory. */ itkNewMacro(Self); itkSetStringMacro(FileName); itkGetStringMacro(FileName); itkSetStringMacro(FilePrefix); itkGetStringMacro(FilePrefix); itkSetStringMacro(FilePattern); itkGetStringMacro(FilePattern); static bool CanReadFile(const std::string filename, const std::string filePrefix, const std::string filePattern); protected: VtkImageReader(); ~VtkImageReader(); virtual void GenerateData(); //##Description //## @brief Time when Header was last read //itk::TimeStamp m_ReadHeaderTime; protected: std::string m_FileName; std::string m_FilePrefix; std::string m_FilePattern; }; } // namespace mitk #endif /* VtkImageReader_H_HEADER_INCLUDED */ diff --git a/Core/Code/IO/mitkVtkSurfaceReader.h b/Core/Code/IO/mitkVtkSurfaceReader.h index 5413cdb118..5d2cf744f6 100644 --- a/Core/Code/IO/mitkVtkSurfaceReader.h +++ b/Core/Code/IO/mitkVtkSurfaceReader.h @@ -1,59 +1,59 @@ /*========================================================================= Program: Medical Imaging & Interaction Toolkit Language: C++ Date: $Date$ Version: $Revision$ Copyright (c) German Cancer Research Center, Division of Medical and Biological Informatics. All rights reserved. See MITKCopyright.txt or http://www.mitk.org/copyright.html for details. This software is distributed WITHOUT ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the above copyright notices for more information. =========================================================================*/ #ifndef VtkSurfaceReader_H_HEADER_INCLUDED #define VtkSurfaceReader_H_HEADER_INCLUDED -#include "mitkCommon.h" +#include #include "mitkSurfaceSource.h" namespace mitk { //##Documentation //## @brief Reader to read surface files in vtk-format //## @ingroup IO class MITK_CORE_EXPORT VtkSurfaceReader : public SurfaceSource { public: mitkClassMacro(VtkSurfaceReader, SurfaceSource); /** Method for creation through the object factory. */ itkNewMacro(Self); itkSetStringMacro(FileName); itkGetStringMacro(FileName); itkSetStringMacro(FilePrefix); itkGetStringMacro(FilePrefix); itkSetStringMacro(FilePattern); itkGetStringMacro(FilePattern); static bool CanReadFile(const std::string filename, const std::string filePrefix, const std::string filePattern); protected: virtual void GenerateData(); VtkSurfaceReader(); ~VtkSurfaceReader(); std::string m_FileName, m_FilePrefix, m_FilePattern; }; } // namespace mitk #endif /* VtkSurfaceReader_H_HEADER_INCLUDED */ diff --git a/Core/Code/Interactions/mitkAction.h b/Core/Code/Interactions/mitkAction.h index ba19f5cca2..687c9a54de 100644 --- a/Core/Code/Interactions/mitkAction.h +++ b/Core/Code/Interactions/mitkAction.h @@ -1,83 +1,83 @@ /*========================================================================= Program: Medical Imaging & Interaction Toolkit Language: C++ Date: $Date$ Version: $Revision$ Copyright (c) German Cancer Research Center, Division of Medical and Biological Informatics. All rights reserved. See MITKCopyright.txt or http://www.mitk.org/copyright.html for details. This software is distributed WITHOUT ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the above copyright notices for more information. =========================================================================*/ #ifndef ACTION_H_HEADER_INCLUDED_C19AE06B #define ACTION_H_HEADER_INCLUDED_C19AE06B -#include "mitkCommon.h" +#include #include "mitkPropertyList.h" #include #include namespace mitk { //##Documentation //## @brief represents an action, that is executed after a certain event (in statemachine-mechanism) //## //## @ingroup Interaction class MITK_CORE_EXPORT Action : public itk::Object { public: mitkClassMacro(Action, itk::Object); /** * @brief static New method to use SmartPointer **/ mitkNewMacro1Param(Self, int); /** * @brief Adds a property to the list of properties. **/ void AddProperty(const char* propertyKey, BaseProperty* property); /** * @brief Returns the Id of this action. **/ int GetActionId() const; /** * @brief returns the specified property **/ mitk::BaseProperty* GetProperty( const char *propertyKey ) const; protected: /** * @brief Default Constructor. * Set the actionId. **/ Action( int actionId ); /** * @brief Default Destructor **/ ~Action(); private: /** * @brief The Id of this action. **/ int m_ActionId; /** * @brief An action can also have several properties that are needed to execute a special action. **/ PropertyList::Pointer m_PropertiesList; }; } // namespace mitk #endif /* ACTION_H_HEADER_INCLUDED_C19AE06B */ diff --git a/Core/Code/Interactions/mitkAffineInteractor.h b/Core/Code/Interactions/mitkAffineInteractor.h index 53db21774b..dd8a3e3760 100755 --- a/Core/Code/Interactions/mitkAffineInteractor.h +++ b/Core/Code/Interactions/mitkAffineInteractor.h @@ -1,82 +1,82 @@ /*========================================================================= Program: Medical Imaging & Interaction Toolkit Language: C++ Date: $Date$ Version: $Revision$ Copyright (c) German Cancer Research Center, Division of Medical and Biological Informatics. All rights reserved. See MITKCopyright.txt or http://www.mitk.org/copyright.html for details. This software is distributed WITHOUT ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the above copyright notices for more information. =========================================================================*/ #ifndef MITKAFFINEINTERACTOR_H_HEADER_INCLUDED_C188C29F #define MITKAFFINEINTERACTOR_H_HEADER_INCLUDED_C188C29F -#include "mitkCommon.h" +#include #include "mitkInteractor.h" #include "mitkVector.h" namespace mitk { class DisplayPositionEvent; //##Documentation //## @brief Interactor for Affine transformations translate, rotate and scale //## //## An object of this class can translate, rotate and scale the data objects //## by modifying its geometry. //## @ingroup Interaction //create events for interactions itkEventMacro(AffineInteractionEvent, itk::AnyEvent); itkEventMacro(ScaleEvent, AffineInteractionEvent); itkEventMacro(RotateEvent, AffineInteractionEvent); itkEventMacro(TranslateEvent, AffineInteractionEvent); class MITK_CORE_EXPORT AffineInteractor : public Interactor { public: mitkClassMacro(AffineInteractor,Interactor); // itkNewMacro(Self); mitkNewMacro2Param(Self, const char*, DataNode*); protected: // AffineInteractor(); //obsolete //##Documentation //## @brief Constructor //## //## @param dataNode is the node, this Interactor is connected to //## @param type is the type of StateMachine like declared in the XML-Configure-File AffineInteractor(const char * type, DataNode* dataNode); //##Documentation //## @brief Destructor ~AffineInteractor(){}; virtual bool ExecuteAction(Action* action, mitk::StateEvent const* stateEvent); //##Documentation //## @brief calculates how good the data this state machine handles is hit by the event. //## //## Returns a value between 0 and 1. //## (Used by GlobalInteraction to decide which DESELECTED state machine to send the event to.) //## //## \WARNING This is interactor currently does not work for interaction in 3D. Try using mitkAffineInteractor3D instead. virtual float CanHandleEvent(StateEvent const* stateEvent) const; bool CheckSelected(const mitk::Point3D& worldPoint, int timestep); bool ConvertDisplayEventToWorldPosition(mitk::DisplayPositionEvent const* displayEvent, mitk::Point3D& worldPoint); mitk::Point3D m_LastMousePosition; }; } // namespace mitk #endif /* MITKAFFINEINTERACTOR_H_HEADER_INCLUDED_C188C29F */ diff --git a/Core/Code/Interactions/mitkCoordinateSupplier.h b/Core/Code/Interactions/mitkCoordinateSupplier.h index afd347509d..f6f3840dd1 100755 --- a/Core/Code/Interactions/mitkCoordinateSupplier.h +++ b/Core/Code/Interactions/mitkCoordinateSupplier.h @@ -1,66 +1,66 @@ /*========================================================================= Program: Medical Imaging & Interaction Toolkit Language: C++ Date: $Date$ Version: $Revision$ Copyright (c) German Cancer Research Center, Division of Medical and Biological Informatics. All rights reserved. See MITKCopyright.txt or http://www.mitk.org/copyright.html for details. This software is distributed WITHOUT ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the above copyright notices for more information. =========================================================================*/ #ifndef MITKCOORDINATESUPPLIER_H #define MITKCOORDINATESUPPLIER_H -#include "mitkCommon.h" +#include #include "mitkStateMachine.h" #include "mitkVector.h" namespace mitk { class Operation; class OperationActor; //##Documentation //## @brief Interactor //## //## sends a Point, that can be processed in its own OperationActor //## @ingroup Interaction class MITK_CORE_EXPORT CoordinateSupplier : public StateMachine { public: mitkClassMacro(CoordinateSupplier, StateMachine); mitkNewMacro2Param(Self, const char*, OperationActor*); itkGetConstReferenceMacro(CurrentPoint, Point3D); protected: //##Documentation //## @brief Constructor with needed arguments //## @param type: string, that describes the StateMachine-Scheme to take from all SM (see XML-File) //## @param operationActor: the Data, operations (+ points) are send to CoordinateSupplier(const char * type, OperationActor* operationActor); ~CoordinateSupplier(); //##Documentation //## @brief executes the actions that are sent to this statemachine //## derived from StateMachine virtual bool ExecuteAction(Action* action, mitk::StateEvent const* stateEvent); private: OperationActor* m_Destination; Point3D m_OldPoint; Point3D m_CurrentPoint; }; } // namespace mitk #endif /* MITKCOORDINATESUPPLIER_H */ diff --git a/Core/Code/Interactions/mitkCrosshairPositionEvent.h b/Core/Code/Interactions/mitkCrosshairPositionEvent.h index a380ce9a30..dd95ab8186 100644 --- a/Core/Code/Interactions/mitkCrosshairPositionEvent.h +++ b/Core/Code/Interactions/mitkCrosshairPositionEvent.h @@ -1,36 +1,36 @@ /*========================================================================= Program: Medical Imaging & Interaction Toolkit Language: C++ Date: $Date$ Version: $Revision$ Copyright (c) German Cancer Research Center, Division of Medical and Biological Informatics. All rights reserved. See MITKCopyright.txt or http://www.mitk.org/copyright.html for details. This software is distributed WITHOUT ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the above copyright notices for more information. =========================================================================*/ #ifndef mitkCrosshairPositionEvent_h #define mitkCrosshairPositionEvent_h -#include "mitkCommon.h" +#include #include "mitkEvent.h" namespace mitk { /** A special mitk::Event thrown by the SliceNavigationController on mouse scroll */ class MITK_CORE_EXPORT CrosshairPositionEvent : public Event { public: CrosshairPositionEvent(BaseRenderer* sender); }; } #endif diff --git a/Core/Code/Interactions/mitkDisplayCoordinateOperation.h b/Core/Code/Interactions/mitkDisplayCoordinateOperation.h index c7b28f39d9..c6ee2db2a6 100644 --- a/Core/Code/Interactions/mitkDisplayCoordinateOperation.h +++ b/Core/Code/Interactions/mitkDisplayCoordinateOperation.h @@ -1,82 +1,82 @@ /*========================================================================= Program: Medical Imaging & Interaction Toolkit Language: C++ Date: $Date$ Version: $Revision$ Copyright (c) German Cancer Research Center, Division of Medical and Biological Informatics. All rights reserved. See MITKCopyright.txt or http://www.mitk.org/copyright.html for details. This software is distributed WITHOUT ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the above copyright notices for more information. =========================================================================*/ #ifndef MITKDISPLAYCOORDINATEOPERATION_H_HEADER_INCLUDED_C10E33D0 #define MITKDISPLAYCOORDINATEOPERATION_H_HEADER_INCLUDED_C10E33D0 -#include "mitkCommon.h" +#include #include "mitkBaseRenderer.h" #include "mitkVector.h" #include "mitkOperation.h" #define mitkGetMacro(name,type) \ virtual type Get##name () \ { \ return this->m_##name; \ } namespace mitk { //##Documentation //## @brief Operation with informations necessary for operations of DisplayVectorInteractor //## @ingroup Undo class MITK_CORE_EXPORT DisplayCoordinateOperation : public Operation { public: DisplayCoordinateOperation(mitk::OperationType operationType, mitk::BaseRenderer* renderer, const mitk::Point2D& startDisplayCoordinate, const mitk::Point2D& lastDisplayCoordinate, const mitk::Point2D& currentDisplayCoordinate ); DisplayCoordinateOperation(mitk::OperationType operationType, mitk::BaseRenderer* renderer, const mitk::Point2D& startDisplayCoordinate, const mitk::Point2D& lastDisplayCoordinate, const mitk::Point2D& currentDisplayCoordinate, const mitk::Point2D& startCoordinateInMM ); virtual ~DisplayCoordinateOperation(); mitk::BaseRenderer* GetRenderer(); mitkGetMacro(StartDisplayCoordinate, mitk::Point2D); mitkGetMacro(LastDisplayCoordinate, mitk::Point2D); mitkGetMacro(CurrentDisplayCoordinate, mitk::Point2D); mitkGetMacro(StartCoordinateInMM, mitk::Point2D); mitk::Vector2D GetLastToCurrentDisplayVector(); mitk::Vector2D GetStartToCurrentDisplayVector(); mitk::Vector2D GetStartToLastDisplayVector(); private: mitk::BaseRenderer::Pointer m_Renderer; const mitk::Point2D m_StartDisplayCoordinate; const mitk::Point2D m_LastDisplayCoordinate; const mitk::Point2D m_CurrentDisplayCoordinate; const mitk::Point2D m_StartCoordinateInMM; }; } #endif /* MITKDISPLAYCOORDINATEOPERATION_H_HEADER_INCLUDED_C10E33D0 */ diff --git a/Core/Code/Interactions/mitkDisplayPositionEvent.h b/Core/Code/Interactions/mitkDisplayPositionEvent.h index e7b78b88f6..6e30002bdd 100644 --- a/Core/Code/Interactions/mitkDisplayPositionEvent.h +++ b/Core/Code/Interactions/mitkDisplayPositionEvent.h @@ -1,81 +1,81 @@ /*========================================================================= Program: Medical Imaging & Interaction Toolkit Language: C++ Date: $Date$ Version: $Revision$ Copyright (c) German Cancer Research Center, Division of Medical and Biological Informatics. All rights reserved. See MITKCopyright.txt or http://www.mitk.org/copyright.html for details. This software is distributed WITHOUT ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the above copyright notices for more information. =========================================================================*/ #ifndef DISPLAYPOSITIONEVENT_H_HEADER_INCLUDED_C184F366 #define DISPLAYPOSITIONEVENT_H_HEADER_INCLUDED_C184F366 -#include "mitkCommon.h" +#include #include "mitkEvent.h" #include "mitkVector.h" #include "mitkDataNode.h" namespace mitk { /** * \brief Event that stores coordinates * * Stores display position of the mouse. * * If requested, the correspondent 3D world position in mm is calculated via * picking (delegated to the BaseRenderer). Additionally, the mitk::BaseData or * mitk::DataNode corresponding to the picked object in the (3D) scene can * be retrieved. * \ingroup Interaction */ class MITK_CORE_EXPORT DisplayPositionEvent : public Event { public: /** \brief Constructor with all necessary arguments. * * \param sender is the renderer that caused that event * \param type, button, buttonState, key: information from the Event * \param displPosition is the 2D Position of the mouse */ DisplayPositionEvent(BaseRenderer* sender, int type, int button, int buttonState, int key, const Point2D& displPosition); const Point2D& GetDisplayPosition() const { return m_DisplayPosition; } void SetDisplayPosition(const Point2D& displPosition) { m_DisplayPosition = displPosition; } const Point3D& GetWorldPosition() const; /** Returns node with object at the current position (NULL if not applicable) */ mitk::DataNode *GetPickedObjectNode() const; /** Returns object at the current position (NULL if not applicable) */ mitk::BaseData *GetPickedObject() const; protected: Point2D m_DisplayPosition; mutable Point3D m_WorldPosition; mutable bool m_WorldPositionIsSet; mutable mitk::DataNode::Pointer m_PickedObjectNode; mutable bool m_PickedObjectIsSet; }; typedef DisplayPositionEvent MouseEvent; } // namespace mitk #endif /* DISPLAYPOSITIONozsiEVENT_H_HEADER_INCLUDED_C184F366 */ diff --git a/Core/Code/Interactions/mitkDisplayVectorInteractor.h b/Core/Code/Interactions/mitkDisplayVectorInteractor.h index cb91905703..c9963de278 100644 --- a/Core/Code/Interactions/mitkDisplayVectorInteractor.h +++ b/Core/Code/Interactions/mitkDisplayVectorInteractor.h @@ -1,80 +1,80 @@ /*========================================================================= Program: Medical Imaging & Interaction Toolkit Language: C++ Date: $Date$ Version: $Revision$ Copyright (c) German Cancer Research Center, Division of Medical and Biological Informatics. All rights reserved. See MITKCopyright.txt or http://www.mitk.org/copyright.html for details. This software is distributed WITHOUT ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the above copyright notices for more information. =========================================================================*/ #ifndef MITKDISPLAYVECTORINTERACTOR_H_HEADER_INCLUDED_C10DC4EB #define MITKDISPLAYVECTORINTERACTOR_H_HEADER_INCLUDED_C10DC4EB -#include "mitkCommon.h" +#include #include "mitkBaseRenderer.h" #include "mitkStateMachine.h" namespace mitk { class Operation; class OperationActor; /** *@brief Interactor for displaying different slices in orthogonal views. * This includes the interaction of Zooming and Panning. * @ingroup Interaction **/ class MITK_CORE_EXPORT DisplayVectorInteractor : public StateMachine { public: mitkClassMacro(DisplayVectorInteractor, StateMachine); mitkNewMacro2Param(Self, const char*, OperationActor*); /** * @brief Method derived from OperationActor to recieve and execute operations **/ virtual void ExecuteOperation(Operation* operation); protected: /** * @brief Default Constructor **/ DisplayVectorInteractor(const char * type, mitk::OperationActor* destination=NULL); /** * @brief Default Destructor **/ virtual ~DisplayVectorInteractor(); /** * @brief Method derived from StateMachine to implement the own actions **/ virtual bool ExecuteAction(Action* action, mitk::StateEvent const* stateEvent); private: BaseRenderer::Pointer m_Sender; mitk::Point2D m_StartDisplayCoordinate; mitk::Point2D m_LastDisplayCoordinate; mitk::Point2D m_CurrentDisplayCoordinate; mitk::Point2D m_StartCoordinateInMM; OperationActor* m_Destination; }; } // namespace mitk #endif /* MITKDISPLAYVECTORINTERACTOR_H_HEADER_INCLUDED_C10DC4EB */ diff --git a/Core/Code/Interactions/mitkDisplayVectorInteractorLevelWindow.h b/Core/Code/Interactions/mitkDisplayVectorInteractorLevelWindow.h index 21b53a688a..7880012606 100644 --- a/Core/Code/Interactions/mitkDisplayVectorInteractorLevelWindow.h +++ b/Core/Code/Interactions/mitkDisplayVectorInteractorLevelWindow.h @@ -1,93 +1,93 @@ /*========================================================================= Program: Medical Imaging & Interaction Toolkit Language: C++ Date: $Date: 2009-05-28 17:19:30 +0200 (Thu, 28 May 2009) $ Version: $Revision: 17495 $ Copyright (c) German Cancer Research Center, Division of Medical and Biological Informatics. All rights reserved. See MITKCopyright.txt or http://www.mitk.org/copyright.html for details. This software is distributed WITHOUT ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the above copyright notices for more information. =========================================================================*/ #ifndef MITKDisplayVectorInteractorLevelWindow_H_HEADER_INCLUDED_C10DC4EB #define MITKDisplayVectorInteractorLevelWindow_H_HEADER_INCLUDED_C10DC4EB -#include "mitkCommon.h" +#include #include "mitkBaseRenderer.h" #include "mitkStateMachine.h" namespace mitk { class Operation; class OperationActor; /** * @brief Interactor for adjusting both level- and window-values for an image * * This class implements an Interactor for adjusting the LevelWindow. It is defined by the 'LevelWindow'-statemachine which maps 'initmove' to right mousebutton pressed, * 'levelwindow' to right mousebutton and move and 'finishmove' to right mousebutton released. * * Using this tool, it is possible to increase the 'level'-value of the selected image * ( if no image has the 'selected'-property == true, the first image in the DataStorage is used ) * by moving the mouse right and decreasing the level by moving the mouse to the left. * * The 'window'-value and also be adjusted by moving the mouse-curser up (increase) and down (decrease). * * @ingroup MITK_CORE_EXPORT **/ class MITK_CORE_EXPORT DisplayVectorInteractorLevelWindow : public StateMachine { public: mitkClassMacro(DisplayVectorInteractorLevelWindow, StateMachine); mitkNewMacro1Param(Self, const char*); //static Pointer New(const char* type) //{ // Pointer smartPtr = new DisplayVectorInteractorLevelWindow ( type ); // smartPtr->UnRegister(); // return smartPtr; //} /** * @brief Method derived from OperationActor to recieve and execute operations **/ virtual void ExecuteOperation(Operation* operation); protected: /** * @brief Default Constructor **/ DisplayVectorInteractorLevelWindow(const char * type); /** * @brief Default Destructor **/ virtual ~DisplayVectorInteractorLevelWindow(); /** * @brief Method derived from StateMachine to implement the own actions **/ virtual bool ExecuteAction(Action* action, mitk::StateEvent const* stateEvent); private: BaseRenderer::Pointer m_Sender; mitk::Point2D m_StartDisplayCoordinate; mitk::Point2D m_LastDisplayCoordinate; mitk::Point2D m_CurrentDisplayCoordinate; }; } // namespace mitk #endif /* MITKDISPLAYVECTORINTERACTOR_H_HEADER_INCLUDED_C10DC4EB */ diff --git a/Core/Code/Interactions/mitkDisplayVectorInteractorScroll.h b/Core/Code/Interactions/mitkDisplayVectorInteractorScroll.h index 4332212738..c0d7de9e93 100644 --- a/Core/Code/Interactions/mitkDisplayVectorInteractorScroll.h +++ b/Core/Code/Interactions/mitkDisplayVectorInteractorScroll.h @@ -1,118 +1,118 @@ /*========================================================================= Program: Medical Imaging & Interaction Toolkit Language: C++ Date: $Date: 2009-05-28 17:19:30 +0200 (Thu, 28 May 2009) $ Version: $Revision: 17495 $ Copyright (c) German Cancer Research Center, Division of Medical and Biological Informatics. All rights reserved. See MITKCopyright.txt or http://www.mitk.org/copyright.html for details. This software is distributed WITHOUT ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the above copyright notices for more information. =========================================================================*/ #ifndef MITKDISPLAYVECTORINTERACTORSCROLL_H_HEADER_INCLUDED_C10DC4EB #define MITKDISPLAYVECTORINTERACTORSCROLL_H_HEADER_INCLUDED_C10DC4EB -#include "mitkCommon.h" +#include #include "mitkBaseRenderer.h" #include "mitkStateMachine.h" namespace mitk { class Operation; class OperationActor; /** * @brief Interactor for scrolling through the slices of an image * * This class implements an Interactor for slice-scrolling. It is defined by the 'Scroll'-statemachine which maps 'initmove' to left mousebutton pressed, * 'scroll' to left mousebutton and move and 'finishmove' to left mousebutton released. * * Thus it is possible to scroll through the slices of an image rapidly, without using the mousewheel. * * @ingroup MITK_CORE_EXPORT **/ class MITK_CORE_EXPORT DisplayVectorInteractorScroll : public StateMachine { public: mitkClassMacro(DisplayVectorInteractorScroll, StateMachine); mitkNewMacro2Param(Self, const char*, OperationActor*); itkEventMacro( InteractionEvent, itk::AnyEvent ); itkEventMacro( StartInteractionEvent, InteractionEvent ); itkEventMacro( EndInteractionEvent, InteractionEvent ); /** * @brief Method derived from OperationActor to recieve and execute operations **/ virtual void ExecuteOperation(Operation* operation); /** * \brief Defines how many slices are scrolled per pixel that the mouse cursor has moved */ void SetIndexToSliceModifier( int modifier ); void SetAutoRepeat( bool autoRepeat ); void SetInvertScrollingDirection( bool ); protected: /** * @brief Default Constructor **/ DisplayVectorInteractorScroll(const char * type, mitk::OperationActor* destination=NULL); /** * @brief Default Destructor **/ virtual ~DisplayVectorInteractorScroll(); /** * @brief Method derived from StateMachine to implement the own actions **/ virtual bool ExecuteAction(Action* action, mitk::StateEvent const* stateEvent); private: BaseRenderer::Pointer m_Sender; mitk::Point2D m_StartDisplayCoordinate; mitk::Point2D m_LastDisplayCoordinate; mitk::Point2D m_CurrentDisplayCoordinate; OperationActor* m_Destination; /** * \brief Modifier that defines how many slices are scrolled per pixel that the mouse has moved * * This modifier defines how many slices the scene is scrolled per pixel that the mouse cursor has moved. * By default the modifier is 4. This means that when the user moves the cursor by 4 pixels in Y-direction * the scene is scrolled by one slice. If the user has moved the the cursor by 20 pixels, the scene is * scrolled by 5 slices. * * If the cursor has moved less than m_IndexToSliceModifier pixels the scene is scrolled by one slice. */ int m_IndexToSliceModifier; /** * \brief Defines if it is possible to scroll endlessly * * If AutoRepeat is on, scrolling further than the last slice will restart at the first slice and vice versa */ bool m_AutoRepeat; bool m_InvertScrollingDirection; }; } // namespace mitk #endif /* MITKDISPLAYVECTORINTERACTOR_H_HEADER_INCLUDED_C10DC4EB */ diff --git a/Core/Code/Interactions/mitkEvent.h b/Core/Code/Interactions/mitkEvent.h index 7455c5a9bf..c16d289f9a 100644 --- a/Core/Code/Interactions/mitkEvent.h +++ b/Core/Code/Interactions/mitkEvent.h @@ -1,77 +1,77 @@ /*========================================================================= Program: Medical Imaging & Interaction Toolkit Language: C++ Date: $Date$ Version: $Revision$ Copyright (c) German Cancer Research Center, Division of Medical and Biological Informatics. All rights reserved. See MITKCopyright.txt or http://www.mitk.org/copyright.html for details. This software is distributed WITHOUT ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the above copyright notices for more information. =========================================================================*/ #ifndef EVENT_H_HEADER_INCLUDED_C1889CEE #define EVENT_H_HEADER_INCLUDED_C1889CEE -#include "mitkCommon.h" +#include namespace mitk { class BaseRenderer; //##Documentation //## @brief represents an Event with all its information //## //## Class, that stores mouse as well as key-events. Type stores the type of //## event, that has been activated (KeyPress, MouseMove...), Button and Key //## represent the cause of this event and ButtonState holds the Modifiers, //## that might have been pressed during the appearance of this event. //## Ether Button (Mouse) or Key (Keyboard) is set. if both are set //## accidentally then the button is accepted. //## @ingroup Interaction class MITK_CORE_EXPORT Event { public: //##Documentation //## @param sender Needed for DisplayCoordinateOperation in DisplayVectorInteractor....???? if not needed, then set on NULL //## @param type Type of Event: Mouse or Key Event? (look in mitkInteractionConst.h) //## @param button Mouse button //## @param buttonState Which other key has been pressed? (Mouse/Keyboard modifier-keys) //## @param key Pressed key Event(mitk::BaseRenderer* sender, int type, int button, int buttonState, int key); virtual ~Event(); mitk::BaseRenderer* GetSender() const; int GetType() const; int GetButton() const; int GetKey() const; bool operator==(const Event& event) const; int GetButtonState() const; protected: mitk::BaseRenderer* m_Sender; int m_Type; int m_Button; int m_ButtonState; int m_Key; }; } // namespace mitk #endif /* EVENT_H_HEADER_INCLUDED_C1889CEE */ diff --git a/Core/Code/Interactions/mitkEventDescription.h b/Core/Code/Interactions/mitkEventDescription.h index a08d829148..64fbcb2f21 100644 --- a/Core/Code/Interactions/mitkEventDescription.h +++ b/Core/Code/Interactions/mitkEventDescription.h @@ -1,53 +1,53 @@ /*========================================================================= Program: Medical Imaging & Interaction Toolkit Language: C++ Date: $Date$ Version: $Revision$ Copyright (c) German Cancer Research Center, Division of Medical and Biological Informatics. All rights reserved. See MITKCopyright.txt or http://www.mitk.org/copyright.html for details. This software is distributed WITHOUT ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the above copyright notices for more information. =========================================================================*/ #ifndef EVENTDESCRIPTION_H_HEADER_INCLUDED_C188FC4D #define EVENTDESCRIPTION_H_HEADER_INCLUDED_C188FC4D -#include "mitkCommon.h" +#include #include "mitkEvent.h" #include namespace mitk { //##Documentation //## @brief adds additional Information (Name and EventID) to an Event //## //## A name and an ID is added to the information of an event, so the event can //## be processed futher on. //## @ingroup Interaction class MITK_CORE_EXPORT EventDescription : public Event { public: EventDescription(int type, int button, int buttonState,int key, std::string name, int id); std::string GetName() const; int GetId() const; private: std::string m_Name; int m_Id; }; } // namespace mitk #endif /* EVENTDESCRIPTION_H_HEADER_INCLUDED_C188FC4D */ diff --git a/Core/Code/Interactions/mitkEventMapper.h b/Core/Code/Interactions/mitkEventMapper.h index 50880fecc1..028ccb6109 100644 --- a/Core/Code/Interactions/mitkEventMapper.h +++ b/Core/Code/Interactions/mitkEventMapper.h @@ -1,197 +1,197 @@ /*========================================================================= Program: Medical Imaging & Interaction Toolkit Language: C++ Date: $Date$ Version: $Revision$ Copyright (c) German Cancer Research Center, Division of Medical and Biological Informatics. All rights reserved. See MITKCopyright.txt or http://www.mitk.org/copyright.html for details. This software is distributed WITHOUT ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the above copyright notices for more information. =========================================================================*/ #ifndef EVENTMAPPER_H_HEADER_INCLUDED #define EVENTMAPPER_H_HEADER_INCLUDED #include -#include +#include #include #include namespace mitk { struct ltstr { bool operator()(const char* s1, const char* s2) const { return strcmp(s1, s2) < 0; } }; typedef std::string msgString; //for friendship wor to set the stateevent after calculating class GlobalInteraction; class StateMachine; class StateEvent; class EventMapperAddOn; //##Documentation //## @brief Maps an Event to its description //## //## EventMapping: //## This class mapps the Events, usually given by the OS or here by QT, to a MITK internal EventId. //## It loads all information from the xml-file (possible, understandable Events with the mitkEventID). //## If an event appears, the method MapEvent is called with the event params. //## This Method looks up the event params, and tries to find an mitkEventId to it. //## If yes, then sends the event and the found ID to the globalStateMachine, which handles all //## further operations of that event. //## For Undo-Mechanism a statechanging StateMachine::HandleEvent is connected to an ObjectEventID and an GroupEventId. //## That way a fine an raw Undo is possible (fine for ObjectID by ObjectID, raw for GroupID for GroupID) //## Here the ObjectEventID gets increased, //## not the GroupEventId(must get increased by a StateMachine, that has the information when a new Group of operation starts) //## @ingroup Interaction class MITK_CORE_EXPORT EventMapper : public vtkXMLParser { public: static EventMapper *New(); vtkTypeMacro(EventMapper,vtkXMLParser); typedef std::vector EventDescriptionVec; typedef std::vector::iterator EventDescriptionVecIter; typedef std::map ConstMap; typedef std::map::iterator ConstMapIter; typedef std::vector< itk::SmartPointer > AddOnVectorType; //##Documentation //## searches the Event in m_EventDescription //## and if included transmits the event to globalInteraction. //## If specified, a custom instance of GlobalInteraction will be used, //## otherwise the method will retrieve the default (singleton) instance. //## the optional parameter should be used in a conference to avoid a //## feedback static bool MapEvent(Event* event, GlobalInteraction* globalInteraction = NULL, int mitkPostedEventID=0 ); //##Documentation //## Searches for the event within stateEvent in the internal map of event descriptions //## If entry found the stateEvent ID is adapted //## maps the Event in m_EventDescription with the ID //## and if found returns true, //## if not found it returns false static bool RefreshStateEvent(StateEvent* stateEvent); //##Documentation //## loads an XML-File containing events and adds definition to internal mapping list //## //## Several files can be loaded. Event descriptions have to be unique or a warning will be displayed. //## If the same file is loaded twice, //## it will only be parsed the first time. //## If a file A, then a file B and then file A is to be loaded, warnings //## will be displayed when loading file A the second time. bool LoadBehavior(std::string fileName); //##Documentation //## loads Events into m_EventDescriptions from xml string //## also involved: EventMapper::startEvent(...) bool LoadBehaviorString(std::string xmlString); //##Documentation //## Try to load standard behavior file "StateMachine.xml" //## //## Search strategy: //## \li try environment variable "MITKCONF" (path to "StateMachine.xml") //## \li try "./StateMachine.xml" //## \li try via source directory (using MITKROOT from cmake-created //## mitkConfig.h) "MITKROOT/Interactions/mitkBaseInteraction/StateMachine.xml" bool LoadStandardBehavior(); //##Documentation //## reads a Tag from an XML-file //## adds Events to m_EventDescription std::string GetStyleName() const; //friendship because of SetStateEvent for computing WorldCoordinates friend class mitk::GlobalInteraction; /** * @brief adds a new EventMapper addon */ void AddEventMapperAddOn(mitk::EventMapperAddOn* newAddOn); /** * @brief removes an EventMapper addon */ void RemoveEventMapperAddOn(mitk::EventMapperAddOn* unusedAddOn); protected: EventMapper(); ~EventMapper(); //##Documentation //##@brief method only for GlobalInteraction to change the Event (from DiplayPositionEvent to PositionEvent) static void SetStateEvent(Event* event); private: //##Documentation //## @brief method used in XLM-Reading; gets called when a start-tag is read void StartElement (const char *elementName, const char **atts); //##Documentation //## @brief reads an XML-String-Attribute std::string ReadXMLStringAttribut( std::string name, const char** atts); //##Documentation //## @brief reads an XML-Integer-Attribute int ReadXMLIntegerAttribut( std::string name, const char** atts ); //##Documentation //## @brief converts the strings given by the XML-Behaviour-File to int inline int convertConstString2ConstInt(std::string input); //static std::string Convert2String(int input); //static std::string Convert2String(double input); //static std::string Convert2String(float input); //##Documentation //## @brief maps the strings to int for convertion from XML-Behaviour-File ConstMap m_EventConstMap; //##Documentation //## @brief stores the information for the connection between QT-Events and the internal EventId. //## gets this information from xml-File static EventDescriptionVec m_EventDescriptions; static std::string m_XmlFileName; static StateEvent m_StateEvent; //##Documentation //## @brief stores the name of the Event-Style loaded static std::string m_StyleName; static const std::string STYLE; static const std::string NAME; static const std::string ID; static const std::string TYPE; static const std::string BUTTON; static const std::string BUTTONSTATE; static const std::string KEY; static const std::string EVENTS; static const std::string EVENT; /** * @brief all available EventMapper addons consisting of one or more input devices */ AddOnVectorType m_AddOnVector; }; } // namespace mitk #endif /* EVENTMAPPER_H_HEADER_INCLUDED_C187864A */ diff --git a/Core/Code/Interactions/mitkGlobalInteraction.h b/Core/Code/Interactions/mitkGlobalInteraction.h index 846ca9b3aa..a642f297d0 100755 --- a/Core/Code/Interactions/mitkGlobalInteraction.h +++ b/Core/Code/Interactions/mitkGlobalInteraction.h @@ -1,275 +1,275 @@ /*========================================================================= Program: Medical Imaging & Interaction Toolkit Language: C++ Date: $Date$ Version: $Revision$ Copyright (c) German Cancer Research Center, Division of Medical and Biological Informatics. All rights reserved. See MITKCopyright.txt or http://www.mitk.org/copyright.html for details. This software is distributed WITHOUT ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the above copyright notices for more information. =========================================================================*/ #ifndef GLOBALINTERACTION_H_HEADER_INCLUDED_C152938A #define GLOBALINTERACTION_H_HEADER_INCLUDED_C152938A #include "mitkFocusManager.h" -#include "mitkCommon.h" +#include #include "mitkStateMachineFactory.h" #include "mitkEventMapper.h" #include "mitkInteractor.h" namespace mitk { class PositionEvent; //##Documentation //## @brief handles all global Events //## //## superior statemachine, that spreads the events to all other interactors //## //## Initialization //## Attention: GlobalInteraction must be initialized by the Initialize() method //## before usage by giving it an XML scheme. Possibilities are giving it an empty string (default), //## the filename of an XML file or the actual XML content as std::string. If an empty string is given, //## the content is tried to be loaded from the default file location. //## //## Concept of sending events: //## In this concept of interaction, the statemachines can be divided into two main statemachines: //## Listeners and interactors. //## Listeners only receive the event to process it, but don't change any data. They want to listen to all events. //## Interactors do change data according to the received event. They do not need to receive all events, only //## those they are interested in. //## //## To divide these two types of statemachine this class holds three lists and one map: //## m_ListenerList, m_InteractorList, m_SelectedList and m_JurisdictionMap //## The list m_ListenerList holds all listeners. //## m_InteractorList holds all interactors, and the List m_SelectedList holds all machines, that were set to SELECTED or SUBSELECTED. //## m_JurisdictionMap maps values returned from CanHandleEvent to the asked Interactors. //## Through this map stepping through interactors, that were not selected and could handle that event, can be done. //## //## First the listeners are informed with the event. //## Then the selected or subselected interactors are asked if they can handle that event. //## They can handle it, if the mode of the interactor after HandleEvent(..) is still in SMSELECTED or SMSUBSELECTED. //## They can't handle it, if the mode changed to SMDESELECTED. Then the interactor is removed from the selected-list. //## In that case, all interactors are asked to calculate and return their area of jurisdiction. //## An iterator is held on one interactor in the map. With the iterator, the map can be looped through so //## so that several geometric objects, that lie on top of each other, can be selected. //## @ingroup Interaction class MITK_CORE_EXPORT GlobalInteraction : public StateMachine { public: mitkClassMacro(GlobalInteraction, StateMachine); itkNewMacro(Self); typedef std::vector StateMachineList; typedef std::vector StateMachineCPointerList; typedef StateMachineList::iterator StateMachineListIter; typedef StateMachineCPointerList::iterator StateMachineCPointerListIter; typedef std::vector InteractorList; typedef InteractorList::iterator InteractorListIter; typedef std::multimap > InteractorMap; typedef InteractorMap::iterator InteractorMapIter; //##Documentation //## @brief add an Interactor to the list of all interactors that are asked for handling an event //## //## returns true in case of success void AddInteractor(Interactor* interactor); //##Documentation //## @brief remove a certain Interactor from the set of interactors that are asked for handling an event //## //## returns true in case of success bool RemoveInteractor(Interactor* interactor); //##Documentation //## @brief returns true, if the given interactor is already added to the Interactor-List bool InteractorRegistered (Interactor* interactor); //##Documentation //## @brief add a Listener to the list of all Listeners that are informed of an event //## //## returns true in case of success void AddListener(StateMachine* listener); //##Documentation //## @brief remove a certain Listener from the set of Listeners that are informed of an event //## //## returns true in case of success bool RemoveListener(StateMachine* listener); //##Documentation //## @brief returns true, if the given interactor is already added to the Listener-List bool ListenerRegistered (StateMachine* listener); //##Documentation //## @brief adds an element in the list in FocusManager //## //## true if success, false if the element is already in list bool AddFocusElement(FocusManager::FocusElement* element); //##Documentation //## @brief Removes an element in FocusManager //## //## true if success, false if the element was not in the list bool RemoveFocusElement(FocusManager::FocusElement* element); //##Documentation //## @brief Returns the focused Element in FocusManager FocusManager::FocusElement* GetFocus(); //##Documentation //## @brief Sets the given Element to focused //## //## returns true if the given element was found and focused bool SetFocus(FocusManager::FocusElement* element); //##Documentation //## @brief Returns the pointer to the FocusManager //## //## to add the observer for an event FocusManager* GetFocusManager(); //##Documentation //## @brief Returns the pointer to the EventMapper //## //## to add an addon EventMapper* GetEventMapper(); /** * @brief Return StateMachineFactory **/ StateMachineFactory* GetStateMachineFactory(); /** * @brief Returns the StartState of the StateMachine with the name type; * * Asks member StateMachineFactory for the StartState. * Returns NULL if no entry with name type is found. **/ State* GetStartState(const char* type); //##Documentation //## @brief Returns the global (singleton) instance of //## GlobalInteraction. Create it, if it does not exist. static GlobalInteraction* GetInstance(); //##Documentation //## @brief Initializes the global (singleton) instance of //## GlobalInteraction via an XML string. Must! be done before usage. Can be done only once. //## Can be used with an empty string (default), a file name with path, or the actual XML content as string. bool Initialize(const char* globalInteractionName, const std::string XMLBehaviorInput = ""); //##Documentation //## @brief Check if GlobalInteraction has already been initialized. Init must! be done before usage. bool IsInitialized() {return m_IsInitialized;}; //so that the interactors can call AddToSelectedInteractors() and RemoveFromSelectedInteractors() friend class Interactor; protected: /** * @brief Default Constructor with type to load the StateMachinePattern of the StateMachine * @param XMLbehaviorFile the file which contains the statemachine and event patterns * @param type the name of the statemachine pattern this class shall use **/ GlobalInteraction(); /** * @brief Default destructor. **/ ~GlobalInteraction(); virtual bool ExecuteAction(Action* action, mitk::StateEvent const* stateEvent); /* *@brief adds the given interactor to the list of selected interactors. * This list is asked first to handle an event. */ virtual bool AddToSelectedInteractors(Interactor* interactor); /* *@brief removes the given interactor from the list of selected interactors * This list is asked first to handle an event. */ virtual bool RemoveFromSelectedInteractors(Interactor* interactor); private: //##Documentation //##@brief informing all statemachines that are held in the list m_ListenerList void InformListeners(mitk::StateEvent const* stateEvent); //##Documentation //##@brief asking the selected Interactor if an event can be handled //## //## returns false if no Interactor could handle the event bool AskSelected(mitk::StateEvent const* stateEvent); //##Documentation //##@brief asking next interactor of m_JurisdictionMap bool AskCurrentInteractor(mitk::StateEvent const* stateEvent); //##Documentation //##@brief filling m_JurisdictionMap //## //## @ params swell: if the calculated jurisdiction value is above swell, then add it to the map void FillJurisdictionMap(mitk::StateEvent const* stateEvent, float threshold); void RemoveFlaggedListeners(); StateMachineCPointerList m_ListenersFlaggedForRemoval; //##Documentation //## @brief list of all listening statemachines, that want to receive all events StateMachineList m_ListenerList; //##Documentation //## @brief list of all interactors (statemachine, that change data) InteractorList m_InteractorList; //##Documentation //## @brief list of all interactors, that are in Mode SELECTED or SUBSELECTED InteractorList m_SelectedList; //##Documentation //## @brief map for sorting all interactors by the value returned from CanHandleEvent(..). //## //## With that list certain interactors can be looped through like diving through layers InteractorMap m_JurisdictionMap; //##Documentation //## @brief iterator on an entry in m_JurisdictionMap for stepping through interactors InteractorMapIter m_CurrentInteractorIter; //##Documentation //## @brief holds a list of BaseRenderer and one focused FocusManager::Pointer m_FocusManager; /** * @brief StatemachineFactory loads statemachine patterns and provides start states **/ StateMachineFactory* m_StateMachineFactory; /** * @brief EventMapper loads event patterns **/ EventMapper* m_EventMapper; bool m_CurrentlyInInformListenersLoop; bool m_CurrentlyInInformInteractorsLoop; bool m_IsInitialized; }; } // namespace mitk #endif /* GLOBALINTERACTION_H_HEADER_INCLUDED_C152938A */ diff --git a/Core/Code/Interactions/mitkInteractor.h b/Core/Code/Interactions/mitkInteractor.h index 1b32f23d5e..ece08ffb6a 100755 --- a/Core/Code/Interactions/mitkInteractor.h +++ b/Core/Code/Interactions/mitkInteractor.h @@ -1,171 +1,171 @@ /*========================================================================= Program: Medical Imaging & Interaction Toolkit Language: C++ Date: $Date$ Version: $Revision$ Copyright (c) German Cancer Research Center, Division of Medical and Biological Informatics. All rights reserved. See MITKCopyright.txt or http://www.mitk.org/copyright.html for details. This software is distributed WITHOUT ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the above copyright notices for more information. =========================================================================*/ #ifndef INTERACTOR_H_HEADER_INCLUDED #define INTERACTOR_H_HEADER_INCLUDED -#include "mitkCommon.h" +#include #include "mitkStateMachine.h" #include "mitkGeometry3D.h" #include namespace mitk { class DataNode; class BaseData; //##Documentation //## @brief Interface for an Interactor. //## //## The Interactor is held with a SmartPointer by a DataNode //## and holds its Node with a Pointer. That way Smartpointer doesn't build a circle. //## Different Modes: In order to not send Events to all StateMachines, a StateMachine can be //## in three different modes: //## DESELECTED: this statemachine doesn't wait for an event //## SELECTED: this statemachine just has handled an event and waits for the next one //## SUBSELECTED: depricate; was used for hierarchical statemachines before. //## Guidelines for the modevalues: Selected if the coresponding data is selected, deselected if deselect of data. //## //## In moving the machine is selected. After a new insert the machine is selected, since the data is also selected //## In method ExecuteAction(..) the different actions are divided up through switch/case statements. Each block has to check //## the appropriate type of event to process the actions. Especially in guarding states (a state, that checks certain conditions (e.g. is picked) //## the according Event must be called to continue in states. No return false here! //## @ingroup Interaction class MITK_CORE_EXPORT Interactor : public StateMachine { public: mitkClassMacro(Interactor, StateMachine); /** * @brief NewMacro with two parameters for calling itk::Lightobject::New(..) method **/ mitkNewMacro2Param(Self, const char*, DataNode*); //##Documentation //##@brief Enumeration of the different modes an Interactor can be into. //## See class documentation for further details enum SMMode { SMDESELECTED = 0, SMSELECTED, SMSUBSELECTED }; typedef SMMode ModeType; //##Documentation //## @brief Get the Mode of the Interactor. Use enum SMMode for return parameter SMMode GetMode() const; //##Documentation //## @brief Check the interaction mode bool IsNotSelected() const; //##Documentation //## @brief Check the interaction mode bool IsSelected() const; //##Documentation //## @brief calculates how good the data, this statemachine handles, is hit by the event. //## //## Returns a value between 0 and 1 //## where 0 represents not responsible and 1 represents definitive responsible! //## Standard function to override if needed. //## (Used by GlobalInteraction to decide which DESELECTED statemachine to send the event to.) virtual float CanHandleEvent(StateEvent const* stateEvent) const; /** * @brief Updates the current TimeStep according to the associated data and calls Superclass::HandleEvent() **/ bool HandleEvent(StateEvent const* stateEvent); /** * @brief Method to call if the associated data has changed by the user (loading of data) * This method is called by DataNode::SetData() to tell the interactor to reinitialize. * This method should be overwritten by specialized interactors. * (e.g. PointSetInteractor: go to the right state according to number of loaded points) * Note: It will not be called when the data gets modified (e.g. adding / removing points to a PointSet) **/ virtual void DataChanged(){}; //##Documentation //## @brief adds handling of operations used for mode change. Unrecognized Operations are send to Superclass. //## *ATTENTION*: THIS METHOD SHOULD NOT BE CALLED FROM OTHER CLASSES DIRECTLY! virtual void ExecuteOperation(Operation* operation); static const std::string XML_NODE_NAME; protected: /** * @brief Constructor * @param dataNode is the node, this Interactor is connected to * @param type is the type of StateMachine like declared in the XML-Configure-File * * Interactor connects itself to the DataNode-Interactor-pointer through call of SetInteractor(this) **/ Interactor(const char * type, DataNode* dataNode); /** * @brief Destructor **/ ~Interactor(){} bool OnModeSelect(Action* action, StateEvent const*); bool OnModeDeselect(Action* action, StateEvent const*); bool OnModeSubSelect(Action* action, StateEvent const*); //##Documentation virtual const std::string& GetXMLNodeName() const; //##Documentation //## @brief creates a ModeOperation with the transmitted mode and sends it to this. Undo supported! void CreateModeOperation(ModeType mode); //##Documentation //## @brief convenience method for accessing the data contained in the //## node to which this interactor is associated to BaseData* GetData() const; //##Documentation //## @brief Used by friend class DataNode virtual void SetDataNode( DataNode* dataNode ); /** * @brief Derived from superclass to also check if enough timesteps are instantiated in m_CurrentStateVector * The number of timesteps is read from the dedicated data. * @param[in] timeStep The timeStep that the statemachine has to be set to **/ virtual void UpdateTimeStep(unsigned int timeStep); //##Documentation //## @brief Pointer to the data, this object handles the Interaction for DataNode* m_DataNode; //##Documentation //## @brief Mode of Selection ModeType m_Mode; friend class DataNode; }; }//namespace mitk #endif /* INTERACTOR_H_HEADER_INCLUDED */ diff --git a/Core/Code/Interactions/mitkKeyEvent.h b/Core/Code/Interactions/mitkKeyEvent.h index 929eefb273..8107d0c8b2 100644 --- a/Core/Code/Interactions/mitkKeyEvent.h +++ b/Core/Code/Interactions/mitkKeyEvent.h @@ -1,79 +1,79 @@ /*========================================================================= Program: Medical Imaging & Interaction Toolkit Language: C++ Date: $Date: 2009-05-12 21:01:03 +0200 (Di, 12 Mai 2009) $ Version: $Revision: 17190 $ Copyright (c) German Cancer Research Center, Division of Medical and Biological Informatics. All rights reserved. See MITKCopyright.txt or http://www.mitk.org/copyright.html for details. This software is distributed WITHOUT ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the above copyright notices for more information. =========================================================================*/ #ifndef KeyEvent_H_HEADER_INCLUDED_C184F366 #define KeyEvent_H_HEADER_INCLUDED_C184F366 -#include "mitkCommon.h" +#include #include "mitkEvent.h" #include "mitkVector.h" namespace mitk { //##Documentation //## @brief Event that stores coordinates and the key which is pressed //## //## Stores display position of the mouse. If requested, the correspondent //## 3D world position in mm is calculated via picking (delegated to the //## BaseRenderer). //## @ingroup Interaction class MITK_CORE_EXPORT KeyEvent : public Event { public: //##Documentation //## @brief Constructor with all necessary arguments. //## //## @param sender is the renderer that caused that event //## @param type, button, buttonState, key: information from the Event //## @param displPosition is the 2D Position of the mouse KeyEvent(BaseRenderer* sender, int type, int button, int buttonState, int key, std::string text, const Point2D& displPosition); const Point2D& GetDisplayPosition() const { return m_DisplayPosition; } void SetDisplayPosition(const Point2D& displPosition) { m_DisplayPosition = displPosition; } const Point3D& GetWorldPosition() const; int GetKey() const { return m_Key; } const char* GetText() const { return m_Text.c_str(); } int GetType() const { return m_Type; } protected: Point2D m_DisplayPosition; int m_Key; std::string m_Text; mutable Point3D m_WorldPosition; mutable bool m_WorldPositionIsSet; }; } // namespace mitk #endif /* DISPLAYPOSITIONozsiEVENT_H_HEADER_INCLUDED_C184F366 */ diff --git a/Core/Code/Interactions/mitkMouseMovePointSetInteractor.h b/Core/Code/Interactions/mitkMouseMovePointSetInteractor.h index 92583aa4e9..9f7aa6dec6 100644 --- a/Core/Code/Interactions/mitkMouseMovePointSetInteractor.h +++ b/Core/Code/Interactions/mitkMouseMovePointSetInteractor.h @@ -1,70 +1,70 @@ /*========================================================================= Program: Medical Imaging & Interaction Toolkit Language: C++ Date: $Date$ Version: $Revision: 17179 $ Copyright (c) German Cancer Research Center, Division of Medical and Biological Informatics. All rights reserved. See MITKCopyright.txt or http://www.mitk.org/copyright.html for details. This software is distributed WITHOUT ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the above copyright notices for more information. =========================================================================*/ #ifndef MITKMOUSEMOVEPOINTSETINTERACTOR_H_HEADER_INCLUDED_C11202FF #define MITKMOUSEMOVEPOINTSETINTERACTOR_H_HEADER_INCLUDED_C11202FF -#include "mitkCommon.h" +#include #include "mitkVector.h" #include namespace mitk { class DataNode; /** * \brief Interaction with a single point by mouse movement. * * A new point is added by mouse movement, an existing point will be removed before adding a new one. * \ingroup Interaction */ class MITK_CORE_EXPORT MouseMovePointSetInteractor : public PointSetInteractor { public: mitkClassMacro(MouseMovePointSetInteractor, Interactor); mitkNewMacro3Param(Self, const char*, DataNode*, int); mitkNewMacro2Param(Self, const char*, DataNode*); /** * \brief calculates how good the data, this statemachine handles, is hit * by the event. * * overwritten, cause we don't look at the boundingbox, we look at each point * and want to accept mouse movement for setting points */ virtual float CanHandleEvent(StateEvent const* stateEvent) const; protected: /** * \brief Constructor with Param n for limited Set of Points * * if no n is set, then the number of points is unlimited* */ MouseMovePointSetInteractor(const char * type, DataNode* dataNode, int n = -1); /** * \brief Default Destructor **/ virtual ~MouseMovePointSetInteractor(); private: }; } #endif /* MITKMOUSEMOVEPOINTSETINTERACTOR_H_HEADER_INCLUDED_C11202FF */ diff --git a/Core/Code/Interactions/mitkNodeDepententPointSetInteractor.h b/Core/Code/Interactions/mitkNodeDepententPointSetInteractor.h index 9dc8a2ecbb..f69784922e 100644 --- a/Core/Code/Interactions/mitkNodeDepententPointSetInteractor.h +++ b/Core/Code/Interactions/mitkNodeDepententPointSetInteractor.h @@ -1,78 +1,78 @@ /*========================================================================= Program: Medical Imaging & Interaction Toolkit Language: C++ Date: $Date: 2010-10-04 14:49:09 +0200 (Mo, 04 Okt 2010) $ Version: $Revision: 26576 $ Copyright (c) German Cancer Research Center, Division of Medical and Biological Informatics. All rights reserved. See MITKCopyright.txt or http://www.mitk.org/copyright.html for details. This software is distributed WITHOUT ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the above copyright notices for more information. =========================================================================*/ #ifndef MITKNodeDepententPointSetInteractor_H_HEADER_INCLUDED #define MITKNodeDepententPointSetInteractor_H_HEADER_INCLUDED -#include "mitkCommon.h" +#include #include "mitkVector.h" #include #include #include namespace mitk { /** * \brief PointSetInteraction that is dependent on the visibility property of a data node. * * The interactor checks if the renderwindow specific property "visible" of a different node (e.g. image) * specified by @param dependentDataNode is true. The specific renderwindow is specified by the sender of the event. * If the property is true the the object behaves as described by PointSetInteractor. * If not, interaction is blocked. * * This class shows how to write an interactor, that is dependent on a special property of the associated node. * See bug #6047 for further information and a patch to test this class embedded in tutorial Step 5. * \ingroup Interaction */ class MITK_CORE_EXPORT NodeDepententPointSetInteractor : public PointSetInteractor { public: mitkClassMacro(NodeDepententPointSetInteractor, PointSetInteractor); mitkNewMacro4Param(Self, const char*, DataNode*, DataNode*, int); mitkNewMacro3Param(Self, const char*, DataNode*, DataNode*); /** * \brief Checks visibility of the specified node (e.g. image), * returns 0 if node is not visible in sending render window * If Sender within stateEvent is NULL a value of 0 is returned. */ virtual float CanHandleEvent(StateEvent const* stateEvent) const; protected: /** * \brief Constructor with Param n for limited Set of Points * * If no n is set, then the number of points is unlimited * n=0 is not supported. In this case, n is set to 1. */ NodeDepententPointSetInteractor(const char * type, DataNode* dataNode, DataNode* dependentDataNode, int n = -1); /** * \brief Default Destructor **/ virtual ~NodeDepententPointSetInteractor(); public: mitk::DataNode::Pointer m_DependentDataNode; }; } #endif /* MITKNodeDepententPointSetInteractor_H_HEADER_INCLUDED */ diff --git a/Core/Code/Interactions/mitkPointSetInteractor.h b/Core/Code/Interactions/mitkPointSetInteractor.h index fc09c4256e..371653e85b 100644 --- a/Core/Code/Interactions/mitkPointSetInteractor.h +++ b/Core/Code/Interactions/mitkPointSetInteractor.h @@ -1,129 +1,129 @@ /*========================================================================= Program: Medical Imaging & Interaction Toolkit Language: C++ Date: $Date$ Version: $Revision$ Copyright (c) German Cancer Research Center, Division of Medical and Biological Informatics. All rights reserved. See MITKCopyright.txt or http://www.mitk.org/copyright.html for details. This software is distributed WITHOUT ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the above copyright notices for more information. =========================================================================*/ #ifndef MITKPOINTSETINTERACTOR_H_HEADER_INCLUDED_C11202FF #define MITKPOINTSETINTERACTOR_H_HEADER_INCLUDED_C11202FF -#include "mitkCommon.h" +#include #include "mitkVector.h" #include namespace mitk { class DataNode; /** * \brief Interaction with a set of points. * * Points can be added, removed and moved. * In case the interaction shall be done on a * loaded set of points, the associated data * object (mitkPointSet) needs to be loaded * prior to the instanciation of this object. * The number of points are checked and the internal * statemachine set to the apropriate state. * The management of 0 points is not supported. * In this case, the amount of managed points is set to 1. * \ingroup Interaction */ class MITK_CORE_EXPORT PointSetInteractor : public Interactor { public: mitkClassMacro(PointSetInteractor, Interactor); mitkNewMacro3Param(Self, const char*, DataNode*, int); mitkNewMacro2Param(Self, const char*, DataNode*); /** * @brief Clears all the elements from the given timeStep in the list with undo-functionality and * resets the statemachine */ void Clear( unsigned int timeStep = 0, ScalarType timeInMS = 0.0 ); itkGetMacro( Precision, unsigned int ); itkSetMacro( Precision, unsigned int ); /** * \brief calculates how good the data, this statemachine handles, is hit * by the event. * * overwritten, cause we don't look at the boundingbox, we look at each point */ virtual float CanHandleEvent(StateEvent const* stateEvent) const; /** *@brief If data changed then initialize according to numbers of loaded points **/ virtual void DataChanged(); protected: /** * \brief Constructor with Param n for limited Set of Points * * If no n is set, then the number of points is unlimited * n=0 is not supported. In this case, n is set to 1. */ PointSetInteractor(const char * type, DataNode* dataNode, int n = -1); /** * \brief Default Destructor **/ virtual ~PointSetInteractor(); /** * @brief Convert the given Actions to Operations and send to data and UndoController */ virtual bool ExecuteAction( Action* action, mitk::StateEvent const* stateEvent ); /** \brief Deselects the Points in the PointSet. * supports Undo if enabled */ void UnselectAll( unsigned int timeStep = 0, ScalarType timeInMS = 0.0 ); /** * \brief Selects the point. * supports Undo if enabled. * \param position Needed for declaring operations */ void SelectPoint( int position, unsigned int timeStep = 0, ScalarType timeInMS = 0.0 ); /** \brief to calculate a direction vector from last point and actual * point */ Point3D m_LastPoint; /** \brief summ-vector for Movement */ Vector3D m_SumVec; /** \brief to store the value of precision to pick a point */ unsigned int m_Precision; private: /** * \brief the number of possible points in this object * * if -1, then no limit set */ int m_N; /** * @brief Init the StatateMachine according to the current number of points in case of a loaded pointset. **/ void InitAccordingToNumberOfPoints(); }; } #endif /* MITKPOINTSETINTERACTOR_H_HEADER_INCLUDED_C11202FF */ diff --git a/Core/Code/Interactions/mitkPositionEvent.h b/Core/Code/Interactions/mitkPositionEvent.h index 636f7dbeaf..19d08ef702 100644 --- a/Core/Code/Interactions/mitkPositionEvent.h +++ b/Core/Code/Interactions/mitkPositionEvent.h @@ -1,51 +1,51 @@ /*========================================================================= Program: Medical Imaging & Interaction Toolkit Language: C++ Date: $Date$ Version: $Revision$ Copyright (c) German Cancer Research Center, Division of Medical and Biological Informatics. All rights reserved. See MITKCopyright.txt or http://www.mitk.org/copyright.html for details. This software is distributed WITHOUT ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the above copyright notices for more information. =========================================================================*/ #ifndef POSITIONEVENT_H_HEADER_INCLUDED_C184F366 #define POSITIONEVENT_H_HEADER_INCLUDED_C184F366 -#include "mitkCommon.h" +#include #include "mitkDisplayPositionEvent.h" #include "mitkVector.h" namespace mitk { //##Documentation //## @brief Event that stores coordinates //## //## Stores display position of the mouse and 3D world position in mm. //## @ingroup Interaction class MITK_CORE_EXPORT PositionEvent : public DisplayPositionEvent { public: //##Documentation //## @brief Constructor with all necessary arguments. //## //## @param sender: the widget, that caused that event, so that it can be asked for worldCoordinates. changed later to a focus //## @param type, button, buttonState, key: information from the Event //## @param displPosition: the 2D Position e.g. from the mouse //## @param worldPosition: the 3D position e.g. from a picking PositionEvent(BaseRenderer* sender, int type, int button, int buttonState, int key, const Point2D& displPosition, const Point3D& worldPosition); }; } // namespace mitk #endif /* POSITIONEVENT_H_HEADER_INCLUDED_C184F366 */ diff --git a/Core/Code/Interactions/mitkPositionTracker.h b/Core/Code/Interactions/mitkPositionTracker.h index 93ee3caf94..a796c89e5e 100755 --- a/Core/Code/Interactions/mitkPositionTracker.h +++ b/Core/Code/Interactions/mitkPositionTracker.h @@ -1,54 +1,54 @@ /*========================================================================= Program: Medical Imaging & Interaction Toolkit Language: C++ Date: $Date$ Version: $Revision$ Copyright (c) German Cancer Research Center, Division of Medical and Biological Informatics. All rights reserved. See MITKCopyright.txt or http://www.mitk.org/copyright.html for details. This software is distributed WITHOUT ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the above copyright notices for more information. =========================================================================*/ #ifndef MITKPositionTracker_H #define MITKPositionTracker_H -#include "mitkCommon.h" +#include #include "mitkStateMachine.h" namespace mitk { class Operation; class OperationActor; //##Documentation //## @brief Interactor for Mouse Tracking //## //## Tracks a Point from an input device (usaly mouse pointer) //## @ingroup Interaction class MITK_CORE_EXPORT PositionTracker : public StateMachine { public: mitkClassMacro(PositionTracker, StateMachine); mitkNewMacro2Param(Self, const char*, OperationActor*); protected: //##Documentation //## @brief Constructor with needed arguments //## @param type: string, that describes the StateMachine-Scheme to take from all SM (see XML-File) //## @param operationActor: the Data, operations (+ points) are send to PositionTracker(const char * type, OperationActor* operationActor); //##Documentation //## @brief executes the actions that are sent to this statemachine //## derived from StateMachine virtual bool ExecuteAction(Action* action, mitk::StateEvent const* stateEvent); }; } // namespace mitk #endif /* MITKPositionTracker_H */ diff --git a/Core/Code/Interactions/mitkState.h b/Core/Code/Interactions/mitkState.h index fd18eb0156..d9dd25a159 100755 --- a/Core/Code/Interactions/mitkState.h +++ b/Core/Code/Interactions/mitkState.h @@ -1,134 +1,134 @@ /*========================================================================= Program: Medical Imaging & Interaction Toolkit Language: C++ Date: $Date$ Version: $Revision$ Copyright (c) German Cancer Research Center, Division of Medical and Biological Informatics. All rights reserved. See MITKCopyright.txt or http://www.mitk.org/copyright.html for details. This software is distributed WITHOUT ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the above copyright notices for more information. =========================================================================*/ #ifndef STATE_H_HEADER_INCLUDED_C19A8A5D #define STATE_H_HEADER_INCLUDED_C19A8A5D -#include "mitkCommon.h" +#include #include #include #include #include #include #include #include "mitkTransition.h" namespace mitk { /** * @brief represents one state with all its necessary information * * Name and ID are stored. Also methods for building up, connecting and * parsing for well formed statemachines are present. * This class holds a map of transitions to next States. * @ingroup Interaction **/ class MITK_CORE_EXPORT State : public itk::Object { public: mitkClassMacro(State, itk::Object); /** * @brief static New method to use SmartPointer **/ mitkNewMacro2Param(Self, std::string, int); typedef std::map StateMap; typedef std::map > TransitionMap; typedef StateMap::iterator StateMapIter; typedef TransitionMap::iterator TransMapIter; typedef TransitionMap::const_iterator TransMapConstIter; /** * @brief Add a transition to the map of transitions. * * Instances of all added transitions are freed in destructor of this class. **/ bool AddTransition( Transition* transition ); /** * @brief hashmap-lookup and returning the Transition. Returns NULL Pointer if not located **/ const Transition* GetTransition(int eventId) const; /** * @brief Returns the name. **/ std::string GetName() const; /** * @brief Returns the Id. **/ int GetId() const; /** * @brief Returns a set of all next States. E.g. to parse through all States. **/ std::set GetAllNextStates() const; /** * @brief Check, if this event (eventId) leads to a state. **/ bool IsValidEvent(int eventId) const; /** * @brief Searches dedicated States of all Transitions and sets *nextState of these Transitions. * Required for this is a List of all build States of that StateMachine (allStates). This way the StateMachine can be build up. **/ bool ConnectTransitions(StateMap* allStates); protected: /** * @brief Default Constructor. Use ::New instead! * Set the name and the Id of the state. * Name is to maintain readability during debug and Id is to identify this state inside the StateMachinePattern **/ State(std::string name, int id); /** * @brief Default Destructor **/ ~State(); private: /** * @brief Name of this State to support readability during debug **/ std::string m_Name; /** * @brief Id of this State important for interaction mechanism in StateMachinePattern * * All states inside a StateMachinePattern (construct of several states connected with transitions and actions) have to have an own id with which it is identifyable. **/ int m_Id; /** * @brief map of transitions that lead from this state to the next state **/ TransitionMap m_Transitions; }; } // namespace mitk #endif /* STATE_H_HEADER_INCLUDED_C19A8A5D */ diff --git a/Core/Code/Interactions/mitkStateEvent.h b/Core/Code/Interactions/mitkStateEvent.h index 354a1de677..e0b0e5c4dd 100644 --- a/Core/Code/Interactions/mitkStateEvent.h +++ b/Core/Code/Interactions/mitkStateEvent.h @@ -1,67 +1,67 @@ /*========================================================================= Program: Medical Imaging & Interaction Toolkit Language: C++ Date: $Date$ Version: $Revision$ Copyright (c) German Cancer Research Center, Division of Medical and Biological Informatics. All rights reserved. See MITKCopyright.txt or http://www.mitk.org/copyright.html for details. This software is distributed WITHOUT ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the above copyright notices for more information. =========================================================================*/ #ifndef STATEEVENT_H_HEADER_INCLUDED_C188E5BF #define STATEEVENT_H_HEADER_INCLUDED_C188E5BF -#include "mitkCommon.h" +#include namespace mitk { class Event; //##Documentation //## @brief Class holding an mitk-event and the mitk-event-number for a statechange //## //## Holds an event, with which a statechange of a statemachine shall be //## done. iD represents the mitk-event-number, event all further necessary information like //## the MousePosition or a key. //## Not derived from event to hold only one object stateevent, pass it to the statemachines, //## set the next event and reuse this object //## @ingroup Interaction class MITK_CORE_EXPORT StateEvent { public: StateEvent(); //##Documentation //## @brief Constructor //## @param id: mitk internal EventID //## @param event: the information about the appeared event StateEvent(int id, Event const* event = NULL ); ~StateEvent(); //##Documentation //## @brief to set the params and reuse an object void Set(int id, Event const* event); int GetId() const; mitk::Event const* GetEvent() const; private: int m_Id; mitk::Event const* m_Event; }; } // namespace mitk #endif /* STATEEVENT_H_HEADER_INCLUDED_C188E5BF */ diff --git a/Core/Code/Interactions/mitkStateMachine.h b/Core/Code/Interactions/mitkStateMachine.h index 1e9e4d7b68..9b0958201e 100644 --- a/Core/Code/Interactions/mitkStateMachine.h +++ b/Core/Code/Interactions/mitkStateMachine.h @@ -1,292 +1,292 @@ /*========================================================================= Program: Medical Imaging & Interaction Toolkit Language: C++ Date: $Date$ Version: $Revision$ Copyright (c) German Cancer Research Center, Division of Medical and Biological Informatics. All rights reserved. See MITKCopyright.txt or http://www.mitk.org/copyright.html for details. This software is distributed WITHOUT ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the above copyright notices for more information. =========================================================================*/ #ifndef STATEMACHINE_H_HEADER_INCLUDED_C18896BD #define STATEMACHINE_H_HEADER_INCLUDED_C18896BD -#include "mitkCommon.h" +#include #include #include "mitkOperationActor.h" #include #include "mitkState.h" #include "mitkUndoModel.h" namespace mitk { class Action; class StateEvent; class UndoController; // base class of statem machine functors class MITK_CORE_EXPORT TStateMachineFunctor { public: virtual bool DoAction(Action*, const StateEvent*)=0; // call using function virtual ~TStateMachineFunctor() {} }; // the template functor for arbitrary StateMachine derivations template class TSpecificStateMachineFunctor : public TStateMachineFunctor { public: // constructor - takes pointer to an object and pointer to a member and stores // them in two private variables TSpecificStateMachineFunctor(T* object, bool(T::*memberFunctionPointer)(Action*, const StateEvent*)) :m_Object(object), m_MemberFunctionPointer(memberFunctionPointer) { } virtual ~TSpecificStateMachineFunctor() {} // virtual destructor // override function "Call" virtual bool DoAction(Action* action, const StateEvent* stateEvent) { return (*m_Object.*m_MemberFunctionPointer)(action, stateEvent); // execute member function } private: T* m_Object; // pointer to object bool (T::*m_MemberFunctionPointer)(Action*, const StateEvent*); // pointer to member function }; /// Can be uses by derived classes of StateMachine to connect action IDs to methods /// Assumes that there is a typedef Classname Self in classes that use this macro #define CONNECT_ACTION(a, f) \ StateMachine::AddActionFunction(a, new TSpecificStateMachineFunctor(this, &Self::f)); #define STATEMACHINE_INFO MITK_INFO("StateMachine") #define STATEMACHINE_WARN MITK_WARN("StateMachine") #define STATEMACHINE_FATAL MITK_FATAL("StateMachine") #define STATEMACHINE_ERROR MITK_ERROR("StateMachine") #define STATEMACHINE_DEBUG MITK_DEBUG("StateMachine") /** @brief Superior statemachine @ingroup Interaction Realizes the methods, that every statemachine has to have. Undo can be enabled and disabled through EnableUndo. To implement your own state machine, you have to derive a class from mitk::StateMachine and either - override ExecuteAction() or - Write bool methods that take (Action*, const StateEvent*) as parameter and use the CONNECT_ACTION macro in your constructor The second version is recommended, since it provides more structured code. The following piece of code demonstrates how to use the CONNECT_ACTION macro. The important detail is to provide a typedef classname Self \code class LightSwitch : public StateMachine { public: mitkClassMacro(LightSwitch, StateMachine); // this creates the Self typedef LightSwitch(const char*); bool DoSwitchOn(Action*, const StateEvent*); bool DoSwitchOff(Action*, const StateEvent*); } LightSwitch::LightSwitch(const char* type) :StateMachine(type) { // make sure that AcSWITCHON and AcSWITCHOFF are defined int constants somewhere (e.g. mitkInteractionConst.h) CONNECT_ACTION( AcSWITCHON, DoSwitchOn ); CONNECT_ACTION( AcSWITCHOFF, DoSwitchOff ); } bool LightSwitch::DoSwitchOn(Action*, const StateEvent*) { std::cout << "Enlightenment" << std::endl; } bool LightSwitch::DoSwitchOff(Action*, const StateEvent*) { std::cout << "Confusion" << std::endl; } \endcode What CONNECT_ACTION does, is call StateMachine::AddActionFunction(...) to add some function pointer wrapping class (functor) to a std::map of StateMachine. Whenever StateMachines ExecuteAction is called, StateMachine will lookup the desired Action in its map and call the appropriate method in your derived class. **/ class MITK_CORE_EXPORT StateMachine : public itk::Object, public mitk::OperationActor { public: mitkClassMacro(StateMachine,itk::Object); /** * @brief New Macro with one parameter for creating this object with static New(..) method **/ mitkNewMacro1Param(Self, const char*); /** * @brief Map to connect action IDs with method calls. Use AddActionFunction or (even better) the CONNECT_ACTION macro to fill the map. **/ typedef std::map ActionFunctionsMapType; /** * @brief Type for a vector of StartStatePointers **/ typedef std::vector StartStateVectorType; /** * @brief Get the name and with this the type of the StateMachine **/ std::string GetType() const; /** * @brief handles an Event accordingly to its current State * * Statechange with Undo functionality; * EventMapper gives each event a new objectEventId * and a StateMachine::ExecuteAction can descide weather it gets a * new GroupEventId or not, depending on its state (e.g. finishedNewObject then new GroupEventId). * Object- and group-EventId can also be accessed through static methods from OperationEvent **/ virtual bool HandleEvent(StateEvent const* stateEvent); /** * @brief Enables or disabled Undo. **/ void EnableUndo(bool enable); /** * @brief A statemachine is also an OperationActor due to the UndoMechanism. * * The statechange is done in ExecuteOperation, so that the statechange can be undone by UndoMechanism. * Is set private here and in superclass it is set public, so UndoController * can reach ist, but it can't be overwritten by a subclass * *ATTENTION*: THIS METHOD SHOULD NOT BE CALLED FROM OTHER CLASSES DIRECTLY! **/ virtual void ExecuteOperation(Operation* operation); /** * @brief Friend so that UndoModel can call ExecuteOperation for Undo. **/ friend class UndoModel; friend class GlobalInteraction; protected: /** * @brief Default Constructor. Obsolete to instanciate it with this method! Use ::New(..) method instead. Set the "type" and with this the pattern of the StateMachine **/ StateMachine(const char * type); /** * @brief Default Destructor **/ ~StateMachine(); /** * @brief Adds the Function to ActionList. **/ void AddActionFunction(int action, TStateMachineFunctor* functor); /** * @brief Method called in HandleEvent after Statechange. * * Each statechange has actions, which can be assigned by it's number. * If you are developing a new statemachine, declare all your operations here and send them to Undo-Controller and to the Data. * Object- and group-EventId can also be accessed through static methods from OperationEvent **/ virtual bool ExecuteAction(Action* action, StateEvent const* stateEvent); /** * @brief returns the current state **/ const State* GetCurrentState(unsigned int timeStep = 0) const; /** * @brief if true, then UndoFunctionality is enabled * * Default value is true; **/ bool m_UndoEnabled; /** * @brief Friend protected function of OperationEvent; that way all StateMachines can set GroupEventId to be incremented! **/ void IncCurrGroupEventId(); /** * @brief holds an UndoController, that can be accessed from all StateMachines. For ExecuteAction **/ UndoController* m_UndoController; /** * @brief Resets the current state from the given timeStep to the StartState with undo functionality! Use carefully! * @param[in] timeStep If the statemachine has several timesteps to take care of, specify the according timestep **/ void ResetStatemachineToStartState(unsigned int timeStep = 0); /** * @brief Check if the number of timeSteps is equal to the number of stored StartStates. Nothing is changed if the number is equal. **/ void ExpandStartStateVector(unsigned int timeSteps); /** * @brief initializes m_CurrentStateVector **/ void InitializeStartStates(unsigned int timeSteps); /** * @brief Update the TimeStep of the statemachine with undo-support if undo enabled **/ virtual void UpdateTimeStep(unsigned int timeStep); /** * @brief Current TimeStep if the data which is to be interacted on, has more than 1 TimeStep **/ unsigned int m_TimeStep; private: /** * @brief The type of the StateMachine. This string specifies the StateMachinePattern that is loaded from the StateMachineFactory. **/ std::string m_Type; /** * @brief Points to the current state. **/ StartStateVectorType m_CurrentStateVector; /** * @brief Map of the added Functions **/ ActionFunctionsMapType m_ActionFunctionsMap; }; } // namespace mitk #endif /* STATEMACHINE_H_HEADER_INCLUDED_C18896BD */ diff --git a/Core/Code/Interactions/mitkStateMachineFactory.h b/Core/Code/Interactions/mitkStateMachineFactory.h index 27f14dab78..991e5cea5a 100755 --- a/Core/Code/Interactions/mitkStateMachineFactory.h +++ b/Core/Code/Interactions/mitkStateMachineFactory.h @@ -1,228 +1,228 @@ /*========================================================================= Program: Medical Imaging & Interaction Toolkit Language: C++ Date: $Date$ Version: $Revision$ Copyright (c) German Cancer Research Center, Division of Medical and Biological Informatics. All rights reserved. See MITKCopyright.txt or http://www.mitk.org/copyright.html for details. This software is distributed WITHOUT ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the above copyright notices for more information. =========================================================================*/ #ifndef STATEMACHINEFACTORY_H_HEADER_INCLUDED_C19AEDDD #define STATEMACHINEFACTORY_H_HEADER_INCLUDED_C19AEDDD -#include "mitkCommon.h" +#include #include "mitkState.h" #include "mitkTransition.h" #include "mitkAction.h" #include #include #include namespace mitk { /** *@brief builds up all specifiyed statemachines and hold them for later access * * According to the XML-File every different statemachine is build up. A new * instance of a new StateMachine grabs a StartState of one certain * state machine. Two instances of one kind of state machine share that * state machine. * During buildprocess at runtime each state machine is parsed for well formed style. * Currently different interaction styles are not yet supported. * To add individual state machine patterns, call LoadBehavior(...) * and it will be parsed added to the internal list of patterns * * @ingroup Interaction **/ class MITK_CORE_EXPORT StateMachineFactory : public vtkXMLParser { public: static StateMachineFactory *New(); vtkTypeMacro(StateMachineFactory,vtkXMLParser); /** * @brief Typedef for all states that are defined as start-states **/ typedef std::map StartStateMap; typedef StartStateMap::iterator StartStateMapIter; /** * @brief Typedef to be used for parsing all states of one statemachine **/ typedef std::set HistorySet; typedef HistorySet::iterator HistorySetIter; /** * @brief This type holds all states of one statemachine. **/ typedef std::map StateMachineMapType; /** * @brief this type holds all states of all statemachines so that a specific state can be accessed for persistence **/ typedef std::map AllStateMachineMapType; /** * @brief Returns the StartState of the StateMachine with the name type; * * Returns NULL if no entry with name type is found. * Here a Smartpointer is returned to ensure, that StateMachines are also considered during reference counting. **/ State* GetStartState(const char* type); /** * @brief loads the xml file filename and generates the necessary instances **/ bool LoadBehavior(std::string fileName); /** * @brief loads the xml string and generates the necessary instances **/ bool LoadBehaviorString(std::string xmlString); /** * @brief Try to load standard behavior file "StateMachine.xml" * * Search strategy: * \li try environment variable "MITKCONF" (path to "StateMachine.xml") * \li try "./StateMachine.xml" * \li try via source directory (using MITKROOT from cmake-created * mitkConfig.h) "MITKROOT/Interactions/mitkBaseInteraction/StateMachine.xml" **/ bool LoadStandardBehavior(); const std::string& GetLastLoadedBehavior() { return m_LastLoadedBehavior; } /** * @brief Adds the given pattern to the internal list of patterns * * Method to support addition of externaly loaded patterns. * Instances of states, transitions and actions are maintained within this class and freed on destruction. * The states already have to be connected by transitions and actions and checked for errors. * @params type name of the pattern to add. Will be used during initialization of a new interactor. * @params startState the start state of this pattern. * @params allStatesOfStateMachine a map of state ids and its states to hold their reference and delete them in destructor **/ bool AddStateMachinePattern(const char * type, mitk::State* startState, StateMachineMapType* allStatesOfStateMachine); /** * brief To enable StateMachine to access states **/ friend class StateMachine; protected: /** * @brief Default Constructor **/ StateMachineFactory(); /** * @brief Default Destructor **/ ~StateMachineFactory(); /** * @brief Derived from XMLReader **/ void StartElement (const char* elementName, const char **atts); /** * @brief Derived from XMLReader **/ void EndElement (const char* elementName); private: /** * @brief Derived from XMLReader **/ std::string ReadXMLStringAttribut( std::string name, const char** atts); /** * @brief Derived from XMLReader **/ float ReadXMLFloatAttribut( std::string name, const char** atts ); /** * @brief Derived from XMLReader **/ double ReadXMLDoubleAttribut( std::string name, const char** atts ); /** * @brief Derived from XMLReader **/ int ReadXMLIntegerAttribut( std::string name, const char** atts ); /** * @brief Derived from XMLReader **/ bool ReadXMLBooleanAttribut( std::string name, const char** atts ); /** * @brief Returns a Pointer to the desired state if found. **/ mitk::State* GetState( const char* type, int StateId ); /** * @brief Sets the pointers in Transition (setNextState(..)) according to the extracted xml-file content **/ bool ConnectStates(mitk::State::StateMap* states); /** * @brief Recusive method, that parses this pattern of the stateMachine and returns true if correct **/ bool RParse(mitk::State::StateMap* states, mitk::State::StateMapIter thisState, HistorySet *history); /** * @brief Holds all created States that are defined as StartState **/ StartStateMap m_StartStates; /** * @brief Holds all States of one StateMachine to build up the pattern. **/ mitk::State::StateMap m_AllStatesOfOneStateMachine; /** * @brief A pointer to a State to help building up the pattern **/ State::Pointer m_AktState; /** * @brief A pointer to a Transition to help building up the pattern **/ itk::WeakPointer m_AktTransition; /** * @brief A pointer to an Action to help building up the pattern **/ Action::Pointer m_AktAction; /** * @brief map to hold all statemachines to call GetState for friends **/ AllStateMachineMapType m_AllStateMachineMap; std::string m_LastLoadedBehavior; std::string m_AktStateMachineName; /** * @brief Variable to skip a state machine pattern if the state machine name is not unique **/ bool m_SkipStateMachine; }; } // namespace mitk #endif /* STATEMACHINEFACTORY_H_HEADER_INCLUDED_C19AEDDD */ diff --git a/Core/Code/Interactions/mitkTransition.h b/Core/Code/Interactions/mitkTransition.h index 6357da23a7..cec6b4ccac 100755 --- a/Core/Code/Interactions/mitkTransition.h +++ b/Core/Code/Interactions/mitkTransition.h @@ -1,141 +1,141 @@ /*========================================================================= Program: Medical Imaging & Interaction Toolkit Language: C++ Date: $Date$ Version: $Revision$ Copyright (c) German Cancer Research Center, Division of Medical and Biological Informatics. All rights reserved. See MITKCopyright.txt or http://www.mitk.org/copyright.html for details. This software is distributed WITHOUT ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the above copyright notices for more information. =========================================================================*/ #ifndef TRANSITION_H_HEADER_INCLUDED_C19AE06B #define TRANSITION_H_HEADER_INCLUDED_C19AE06B -#include "mitkCommon.h" +#include #include #include #include #include "mitkAction.h" namespace mitk { class State; /** * @brief Connection of two states * * A transition connects two states. * Several actions are stored, that have to be executed after the statechange. * @ingroup Interaction **/ class MITK_CORE_EXPORT Transition { public: typedef std::vector< mitk::Action::Pointer > ActionVectorType; typedef ActionVectorType::iterator ActionVectorIterator; typedef const ActionVectorIterator ActionVectorConstIterator; /** * @brief Add the action to this object. **/ void AddAction( Action* action ); /** * @brief Return the name of this object. **/ std::string GetName() const; /** * @brief Get the next state of this object. **/ State* GetNextState() const; /** * @brief Get the Id of the next state of this object. **/ int GetNextStateId() const; /** * @brief Get the eventId of this object. **/ int GetEventId() const; /** * @brief Get the number of actions. **/ unsigned int GetActionCount() const; /** * @brief Get an interator on the first action in list. **/ ActionVectorIterator GetActionBeginIterator() const; /** * @brief Get an interator behind the last action in list. **/ ActionVectorConstIterator GetActionEndIterator() const; /** * @brief Returns true if the given eventId is equal to this eventId. **/ bool IsEvent(int eventId) const; /** * @brief Set the next state of this object. **/ void SetNextState(State* state); /** * @brief Default Constructor * Sets the necessary informations name (to enhance readability during debug), * nextStateId (the Id of the next state) and eventId (the Id of the event that causes the statechange). **/ Transition(std::string name, int nextStateId, int eventId); /** * @brief Default Denstructor **/ ~Transition(); private: /** * @brief For better debugging and reading it stores the name of this. **/ std::string m_Name; /** * @brief a Pointer to the next state of this object. **/ itk::WeakPointer m_NextState; /** * @brief The Id of the next state. **/ int m_NextStateId; /** * @brief The eventId which is associated to this object. **/ int m_EventId; /** * @brief The list of actions, that are executed if this transition is done. **/ mutable std::vector m_Actions; }; } // namespace mitk #endif /* TRANSITION_H_HEADER_INCLUDED_C19AE06B */ diff --git a/Core/Code/Interactions/mitkWheelEvent.h b/Core/Code/Interactions/mitkWheelEvent.h index 75d88d3737..a4fb989bf7 100644 --- a/Core/Code/Interactions/mitkWheelEvent.h +++ b/Core/Code/Interactions/mitkWheelEvent.h @@ -1,56 +1,56 @@ /*========================================================================= Program: Medical Imaging & Interaction Toolkit Language: C++ Date: $Date: 2009-05-12 19:56:03 +0200 (Di, 12 Mai 2009) $ Version: $Revision: 17179 $ Copyright (c) German Cancer Research Center, Division of Medical and Biological Informatics. All rights reserved. See MITKCopyright.txt or http://www.mitk.org/copyright.html for details. This software is distributed WITHOUT ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the above copyright notices for more information. =========================================================================*/ #ifndef WheelEvent_H_HEADER_INCLUDED_C184F366 #define WheelEvent_H_HEADER_INCLUDED_C184F366 -#include "mitkCommon.h" +#include #include "mitkDisplayPositionEvent.h" #include "mitkVector.h" namespace mitk { //##Documentation //## @brief Event that stores coordinates and rotation on mouse wheel events //## //## Stores display position of the mouse and 3D world position in mm. //## @ingroup Interaction class MITK_CORE_EXPORT WheelEvent : public DisplayPositionEvent { public: //##Documentation //## @brief Constructor with all necessary arguments. //## //## @param sender: the widget, that caused that event, so that it can be asked for worldCoordinates. changed later to a focus //## @param type, button, buttonState, key: information from the Event //## @param displPosition: the 2D Position e.g. from the mouse //## @param worldPosition: the 3D position e.g. from a picking //## @param delta: the movement of the mousewheel WheelEvent(BaseRenderer* sender, int type, int button, int buttonState, int key, const Point2D& displPosition, int delta); int GetDelta() const; protected: int m_Delta; }; } // namespace mitk #endif /* WheelEvent_H_HEADER_INCLUDED_C184F366 */ diff --git a/Core/Code/Rendering/mitkGLMapper2D.h b/Core/Code/Rendering/mitkGLMapper2D.h index 2890c2ac3c..5671548f17 100644 --- a/Core/Code/Rendering/mitkGLMapper2D.h +++ b/Core/Code/Rendering/mitkGLMapper2D.h @@ -1,67 +1,67 @@ /*========================================================================= Program: Medical Imaging & Interaction Toolkit Language: C++ Date: $Date$ Version: $Revision$ Copyright (c) German Cancer Research Center, Division of Medical and Biological Informatics. All rights reserved. See MITKCopyright.txt or http://www.mitk.org/copyright.html for details. This software is distributed WITHOUT ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the above copyright notices for more information. =========================================================================*/ #ifndef MITKGLMAPPER2D_H_HEADER_INCLUDED_C197C872 #define MITKGLMAPPER2D_H_HEADER_INCLUDED_C197C872 -#include "mitkCommon.h" +#include #include "mitkMapper2D.h" #include "mitkBaseRenderer.h" namespace mitk { //##Documentation //## @brief Base class of all OpenGL-based 2D-Mappers //## //## Those must implement the abstract method Paint(BaseRenderer). //## @ingroup Mapper class MITK_CORE_EXPORT GLMapper2D : public Mapper2D { public: //##Documentation //## @brief Do the painting into the @a renderer virtual void Paint(mitk::BaseRenderer *renderer) = 0; //##Documentation //## @brief Apply color and opacity read from the PropertyList virtual void ApplyProperties(mitk::BaseRenderer* renderer); void MitkRenderOpaqueGeometry(mitk::BaseRenderer* renderer); void MitkRenderTranslucentGeometry(mitk::BaseRenderer* renderer); void MitkRenderOverlay(mitk::BaseRenderer* renderer); void MitkRenderVolumetricGeometry(mitk::BaseRenderer* renderer); /** * \brief Returns whether this is an vtk-based mapper */ virtual bool IsVtkBased() const { return false; } protected: GLMapper2D(); virtual ~GLMapper2D(); }; } // namespace mitk #endif /* MITKGLMAPPER2D_H_HEADER_INCLUDED_C197C872 */ diff --git a/Core/Code/Rendering/mitkGeometry2DDataMapper2D.h b/Core/Code/Rendering/mitkGeometry2DDataMapper2D.h index 86b4cbf3d8..8914e38533 100644 --- a/Core/Code/Rendering/mitkGeometry2DDataMapper2D.h +++ b/Core/Code/Rendering/mitkGeometry2DDataMapper2D.h @@ -1,96 +1,96 @@ /*========================================================================= Program: Medical Imaging & Interaction Toolkit Language: C++ Date: $Date$ Version: $Revision$ Copyright (c) German Cancer Research Center, Division of Medical and Biological Informatics. All rights reserved. See MITKCopyright.txt or http://www.mitk.org/copyright.html for details. This software is distributed WITHOUT ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the above copyright notices for more information. =========================================================================*/ #ifndef MITKGEOMETRY2DDATAMAPPER2D_H_HEADER_INCLUDED_C19C0BFB #define MITKGEOMETRY2DDATAMAPPER2D_H_HEADER_INCLUDED_C19C0BFB -#include "mitkCommon.h" +#include #include "mitkGLMapper2D.h" #include "mitkSurfaceGLMapper2D.h" #include "mitkDataStorage.h" #include "mitkDataNode.h" #include "mitkWeakPointer.h" namespace mitk { class BaseRenderer; /** * \brief OpenGL-based mapper to display a Geometry2D in a 2D window * * Currently implemented for mapping on PlaneGeometry. * The result is normally a line. An important usage of this class is to show * the orientation of the slices displayed in other 2D windows. * * * Properties that can be set and influence the Geometry2DDataMapper2D are: * * - \b "PlaneOrientationProperty": (PlaneOrientationProperty) * \todo implement for AbstractTransformGeometry. * \ingroup Mapper */ class MITK_CORE_EXPORT Geometry2DDataMapper2D : public GLMapper2D { public: mitkClassMacro(Geometry2DDataMapper2D, GLMapper2D); itkNewMacro(Self); /** * \brief Get the Geometry2DData to map */ const Geometry2DData *GetInput(); virtual void Paint( BaseRenderer *renderer ); virtual void SetDatastorageAndGeometryBaseNode(mitk::DataStorage::Pointer ds, mitk::DataNode::Pointer parent); /** Applies properties specific to this mapper */ virtual void ApplyProperties( BaseRenderer *renderer ); protected: Geometry2DDataMapper2D(); virtual ~Geometry2DDataMapper2D(); virtual void GenerateData(); void DrawOrientationArrow( Point2D &outerPoint, Point2D &innerPoint, const PlaneGeometry *planeGeometry, const PlaneGeometry *rendererPlaneGeometry, const DisplayGeometry *displayGeometry, bool positiveOrientation = true ); SurfaceGLMapper2D::Pointer m_SurfaceMapper; mitk::WeakPointer m_DataStorage; ///< DataStorage that will be searched for sub nodes DataNode::Pointer m_ParentNode; ///< parent node that will be used to search for sub nodes typedef std::vector NodesVectorType; NodesVectorType m_OtherGeometry2Ds; bool m_RenderOrientationArrows; bool m_ArrowOrientationPositive; }; } // namespace mitk #endif /* MITKGEOMETRY2DDATAMAPPER2D_H_HEADER_INCLUDED_C19C0BFB */ diff --git a/Core/Code/Rendering/mitkGeometry2DDataVtkMapper3D.h b/Core/Code/Rendering/mitkGeometry2DDataVtkMapper3D.h index fd05eb282a..b48fd24c4e 100644 --- a/Core/Code/Rendering/mitkGeometry2DDataVtkMapper3D.h +++ b/Core/Code/Rendering/mitkGeometry2DDataVtkMapper3D.h @@ -1,234 +1,234 @@ /*========================================================================= Program: Medical Imaging & Interaction Toolkit Language: C++ Date: $Date$ Version: $Revision$ Copyright (c) German Cancer Research Center, Division of Medical and Biological Informatics. All rights reserved. See MITKCopyright.txt or http://www.mitk.org/copyright.html for details. This software is distributed WITHOUT ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the above copyright notices for more information. =========================================================================*/ #ifndef MITKGEOMETRY2DDATAVTKMAPPER3D_H_HEADER_INCLUDED_C196C71F #define MITKGEOMETRY2DDATAVTKMAPPER3D_H_HEADER_INCLUDED_C196C71F -#include "mitkCommon.h" +#include #include "mitkVtkMapper3D.h" #include "mitkDataStorage.h" #include "mitkGeometry2DDataToSurfaceFilter.h" #include "mitkWeakPointer.h" #include #include class vtkActor; class vtkPolyDataMapper; class vtkDataSetMapper; class vtkLookupTable; class vtkAssembly; class vtkFeatureEdges; class vtkTubeFilter; class vtkTransformPolyDataFilter; class vtkHedgeHog; namespace mitk { class Geometry2DData; class BaseRenderer; class ImageMapperGL2D; class DataStorage; /** * \brief Vtk-based mapper to display a Geometry2D in a 3D window * \ingroup Mapper * * Uses a Geometry2DDataToSurfaceFilter object to create a vtkPolyData representation of a given Geometry2D instance. * Geometry2D may either contain a common flat plane or a curved plane (ThinPlateSplineCurvedGeometry). * * The vtkPolyData object is then decorated by a colored tube on the edges and by image textures if possible * (currently this requires that there is a 2D render window rendering the same geometry as this mapper). * * Properties that influence rendering are: * * - \b "color": (ColorProperty) Color of the tubed frame. * - \b "xresolution": (FloatProperty) Resolution (=number of tiles) in x direction. Only relevant for ThinPlateSplineCurvedGeometry * - \b "yresolution": (FloatProperty) Resolution (=number of tiles) in y direction. Only relevant for ThinPlateSplineCurvedGeometry * - \b "draw normals 3D": (BoolProperty) If true, a vtkHedgeHog is used to display normals for the generated surface object. Useful to distinguish front and back of a plane. Hedgehogs are colored according to "front color" and "back color" * - \b "color two sides": (BoolProperty) If true, front and back side of the plane are colored differently ("front color" and "back color") * - \b "invert normals": (BoolProperty) Inverts front/back for display. * - \b "front color": (ColorProperty) Color for front side of the plane * - \b "back color": (ColorProperty) Color for back side of the plane * - \b "material.representation": (BoolProperty) Choose the representation to draw the mesh in (Surface, Wireframe, Point Cloud) * - \b "surfacegeometry": TODO: Add documentation * - \b "LookupTable": (LookupTableProperty) Set the lookuptable to render with. * * Note: The following properties are set for each image individually, and thus, also influence the rendering of this mapper: * * - \b "texture interpolation": (BoolProperty) Turn on/off the texture interpolation of each image * - \b "use color": (BoolProperty) Decide whether we want to use the color property or a lookuptable. * - \b "binary": (BoolProperty) Binary image handling: Color the value=1.0 with the color property and make the background (value=0.0) of the image translucent. * - \b "layer": (IntProperty) Controls what image is considered "on top" of another. In the case that two should inhabit the same space, higher layer occludes lower layer. * - \b "opacity": (FloatProperty) Set the opacity for each rendered image. * - \b "color": (FloatProperty) Set the color for each rendered image. * * The internal filter pipeline which combines a (sometimes deformed) 2D surface * with a nice frame and image textures is illustrated in the following sketch: * * \image html mitkGeometry2DDataVtkMapper3D.png "Internal filter pipeline" * */ class MITK_CORE_EXPORT Geometry2DDataVtkMapper3D : public VtkMapper3D { public: mitkClassMacro(Geometry2DDataVtkMapper3D, VtkMapper3D); itkNewMacro(Geometry2DDataVtkMapper3D); /** * Overloaded since the displayed color-frame of the image mustn't be * transformed after generation of poly data, but before (vertex coordinates * only) */ virtual vtkProp *GetVtkProp(mitk::BaseRenderer *renderer); virtual void UpdateVtkTransform(mitk::BaseRenderer *renderer); /** * \brief Get the Geometry2DData to map */ virtual const Geometry2DData *GetInput(); /** * \brief All images found when traversing the (sub-) tree starting at * \a iterator which are resliced by an ImageMapperGL2D will be mapped. * This method is used to set the data storage to traverse. This offers * the possibility to use this mapper for other data storages (not only * the default data storage). */ virtual void SetDataStorageForTexture(mitk::DataStorage* storage); protected: typedef std::multimap< int, vtkActor * > LayerSortedActorList; Geometry2DDataVtkMapper3D(); virtual ~Geometry2DDataVtkMapper3D(); virtual void GenerateDataForRenderer(BaseRenderer* renderer); void ProcessNode( DataNode * node, BaseRenderer* renderer, Surface * surface, LayerSortedActorList &layerSortedActors ); void ImageMapperDeletedCallback( itk::Object *caller, const itk::EventObject &event ); /** \brief general PropAssembly to hold the entire scene */ vtkAssembly *m_Prop3DAssembly; /** \brief PropAssembly to hold the planes */ vtkAssembly *m_ImageAssembly; Geometry2DDataToSurfaceFilter::Pointer m_SurfaceCreator; BoundingBox::Pointer m_SurfaceCreatorBoundingBox; BoundingBox::PointsContainer::Pointer m_SurfaceCreatorPointsContainer; /** \brief Edge extractor for tube-shaped frame */ vtkFeatureEdges *m_Edges; /** \brief Filter to apply object transform to the extracted edges */ vtkTransformPolyDataFilter *m_EdgeTransformer; /** \brief Source to create the tube-shaped frame */ vtkTubeFilter *m_EdgeTuber; /** \brief Mapper for the tube-shaped frame */ vtkPolyDataMapper *m_EdgeMapper; /** \brief Actor for the tube-shaped frame */ vtkActor *m_EdgeActor; /** \brief Mapper for black plane background */ vtkPolyDataMapper *m_BackgroundMapper; /** \brief Actor for black plane background */ vtkActor *m_BackgroundActor; /** \brief Transforms the suface before applying the glyph filter */ vtkTransformPolyDataFilter* m_NormalsTransformer; /** \brief Mapper for normals representation (thin lines) */ vtkPolyDataMapper* m_FrontNormalsMapper; vtkPolyDataMapper* m_BackNormalsMapper; /** \brief Generates lines for surface normals */ vtkHedgeHog* m_FrontHedgeHog; vtkHedgeHog* m_BackHedgeHog; /** \brief Actor to hold the normals arrows */ vtkActor* m_FrontNormalsActor; vtkActor* m_BackNormalsActor; /** Cleans the polyline in order to avoid phantom boundaries */ vtkCleanPolyData *m_Cleaner; /** Internal flag, if actors for normals are already added to m_Prop3DAssembly*/ bool m_NormalsActorAdded; /** \brief The DataStorage defines which part of the data tree is traversed for renderering. */ mitk::WeakPointer m_DataStorage; /** A default grayscale lookup-table, used for reference */ vtkLookupTable *m_DefaultLookupTable; class MITK_CORE_EXPORT ActorInfo { public: vtkActor * m_Actor; // we do not need a smart-pointer, because we delete our // connection, when the referenced mapper is destroyed itk::Object* m_Sender; unsigned long m_ObserverID; void Initialize(vtkActor* actor, itk::Object* sender, itk::Command* command); ActorInfo(); ~ActorInfo(); }; /** \brief List holding the vtkActor to map the image into 3D for each * ImageMapper */ typedef std::map< ImageMapperGL2D *, ActorInfo > ActorList; ActorList m_ImageActors; struct LookupTableProperties { LookupTableProperties() : LookupTableSource( NULL ), windowMin( 0.0 ), windowMax( 4096.0 ) {} vtkLookupTable *LookupTableSource; vtkFloatingPointType windowMin; vtkFloatingPointType windowMax; }; typedef std::map< ImageMapperGL2D *, LookupTableProperties > LookupTablePropertiesList; /** \brief List holding some lookup table properties of the previous pass */ LookupTablePropertiesList m_LookupTableProperties; // responsiblity to remove the observer upon its destruction typedef itk::MemberCommand< Geometry2DDataVtkMapper3D > MemberCommandType; MemberCommandType::Pointer m_ImageMapperDeletedCommand; }; } // namespace mitk #endif /* MITKGEOMETRY2DDATAVTKMAPPER3D_H_HEADER_INCLUDED_C196C71F */ diff --git a/Core/Code/Rendering/mitkImageMapperGL2D.h b/Core/Code/Rendering/mitkImageMapperGL2D.h index d7aea797f8..b659b55515 100644 --- a/Core/Code/Rendering/mitkImageMapperGL2D.h +++ b/Core/Code/Rendering/mitkImageMapperGL2D.h @@ -1,298 +1,298 @@ /*========================================================================= Program: Medical Imaging & Interaction Toolkit Language: C++ Date: $Date$ Version: $Revision$ Copyright (c) German Cancer Research Center, Division of Medical and Biological Informatics. All rights reserved. See MITKCopyright.txt or http://www.mitk.org/copyright.html for details. This software is distributed WITHOUT ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the above copyright notices for more information. =========================================================================*/ #ifndef MITKIMAGEMAPPER2D_H_HEADER_INCLUDED_C10E906E #define MITKIMAGEMAPPER2D_H_HEADER_INCLUDED_C10E906E -#include "mitkCommon.h" +#include #include "mitkGLMapper2D.h" #include "mitkBaseRenderer.h" #include #include #include #include #include class iil4mitkPicImage; class Vtk2itk; class vtkImageReslice; class vtkLookupTable; class vtkGeneralTransform; class vtkImageChangeInformation; class vtkPoints; class vtkMitkThickSlicesFilter; namespace mitk { /** \brief Mapper to resample and display 2D slices of a 3D image. * * Currently implemented for mapping on PlaneGeometry and * AbstractTransformGeometry. The resulting 2D image (by reslicing the * underlying 3D input image appropriately) can either be directly rendered * in a 2D view or just be calculated to be used later on by another * rendering entity, e.g. in texture mapping in a 3D view. * * This results in a flipped version when used for texture mapping. Furthermore, * not the complete rectangular area described by the Geometry2D from the renderer * is resampled, @em if the Geometry2D is larger than the image dimension in the * requested direction. This results in a stretched version when used for texture * mapping. * * Properties that can be set for images and influence the imageMapper2D are: * * - \b "modality": (mitkModalityProperty) Modality of the image * - \b "opacity": (FloatProperty) Opacity of the image * - \b "color": (ColorProperty) Color of the image * - \b "use color": (BoolProperty) Use the color of the image or not * - \b "binary": (BoolProperty) is the image a binary image or not * - \b "outline binary": (BoolProperty) show outline of the image or not * - \b "texture interpolation": (BoolProperty) texture interpolation of the image * - \b "reslice interpolation": (VtkResliceInterpolationProperty) reslice interpolation of the image * - \b "in plane resample extent by geometry": (BoolProperty) Do it or not * - \b "bounding box": (BoolProperty) Is the Bounding Box of the image shown or not * - \b "layer": (IntProperty) Layer of the image * - \b "volume annotation color": (ColorProperty) color of the volume annotation * - \b "volume annotation unit": (StringProperty) annotation unit as string (does not implicit convert the unit!) unit is ml/cm3 * The default properties are: * - \b "opacity", mitk::FloatProperty::New(0.3f), renderer, overwrite ) * - \b "color", ColorProperty::New(1.0,0.0,0.0), renderer, overwrite ) * - \b "use color", mitk::BoolProperty::New( true ), renderer, overwrite ) * - \b "binary", mitk::BoolProperty::New( true ), renderer, overwrite ) * - \b "outline binary", mitk::BoolProperty::New( false ), renderer, overwrite ) * - \b "texture interpolation", mitk::BoolProperty::New( mitk::DataNodeFactory::m_TextureInterpolationActive ) ) * - \b "reslice interpolation", mitk::VtkResliceInterpolationProperty::New() ) * - \b "in plane resample extent by geometry", mitk::BoolProperty::New( false ) ) * - \b "bounding box", mitk::BoolProperty::New( false ) ) * - \b "layer", mitk::IntProperty::New(10), renderer, overwrite) * If the modality-property is set for an image, the mapper uses modality-specific default properties, * e.g. color maps, if they are defined. * \ingroup Mapper */ class MITK_CORE_EXPORT ImageMapperGL2D : public GLMapper2D { public: /** Standard class typedefs. */ mitkClassMacro( ImageMapperGL2D,GLMapper2D ); /** Method for creation through the object factory. */ itkNewMacro(Self); /** Some convenient typedefs. */ typedef mitk::Image InputImageType; typedef InputImageType::Pointer InputImagePointer; typedef InputImageType::ConstPointer InputImageConstPointer; typedef SlicedData::RegionType InputImageRegionType; /** \brief Get the Image to map */ const InputImageType *GetInput(void); /** \brief Calls Update() for all associated renderers. */ virtual void GenerateAllData(); /** \brief Renders the (priorly) resampled image onto the screen. */ virtual void Paint( mitk::BaseRenderer *renderer ); /** \brief Checks whether this mapper needs to update itself and generate * data. */ virtual void Update(mitk::BaseRenderer * renderer); virtual void ApplyProperties(mitk::BaseRenderer* renderer); /** \brief Internal storage class for data needed for rendering into a * renderer */ class MITK_CORE_EXPORT RendererInfo { /** \brief internal id of the renderer the data is stored for */ int m_RendererID; /** \brief stored iil4mitkPicImage containing the texture to display for * 2D rendering (cf. m_Image) */ iil4mitkPicImage* m_iil4mitkImage; mitk::BaseRenderer* m_Renderer; public: /** \brief timestamp of last update of stored data */ itk::TimeStamp m_LastUpdateTime; /** \brief stored data as a mitkIpPicDescriptor */ mitkIpPicDescriptor *m_Pic; /** \brief number of pixels per mm in x- and y-direction of the resampled */ Vector2D m_PixelsPerMM; /** \brief Extent (in pixels) of the image */ Vector2D m_Extent; /** \brief Overlap (in pixels) to ensure coverage of rotated images also */ Vector2D m_Overlap; /** \brief Using unit spacing for resampling makes life easier */ vtkImageChangeInformation *m_UnitSpacingImageFilter; /** \brief The actual reslicer (one per renderer) */ vtkImageReslice *m_Reslicer; /** \brief Thickslices post filtering */ vtkMitkThickSlicesFilter *m_TSFilter; /** \brief Extracted image for 3D rendering (cf. m_iil4mitkImage) */ vtkImageData *m_Image; /** \brief Reference geometry associated with the world geometry */ const Geometry3D *m_ReferenceGeometry; bool m_TextureInterpolation; /** \brief stores the id of the observer for delete event of renderer */ unsigned long m_ObserverID; RendererInfo(); ~RendererInfo(); inline bool IsInitialized() const { return m_RendererID >= 0; } void Initialize( int rendererID, mitk::BaseRenderer *renderer, unsigned long observerID ); void Set_iil4mitkImage(iil4mitkPicImage* iil4mitkImage); inline iil4mitkPicImage* Get_iil4mitkImage() const { return m_iil4mitkImage; } inline int GetRendererID() const { return m_RendererID; } void RemoveObserver(); void Squeeze(); }; // RendererInfo /** \brief Get the internal id of the renderer * \sa RendererInfo */ virtual int GetAssociatedChannelNr( mitk::BaseRenderer *renderer ); /** \brief Get the RendererInfo for \a renderer */ const RendererInfo *GetRendererInfo( mitk::BaseRenderer *renderer ) { return &this->AccessRendererInfo(renderer); } /** \brief Release memory allocated for buffering */ virtual void Clear(); static void SetDefaultProperties(mitk::DataNode* node, mitk::BaseRenderer* renderer = NULL, bool overwrite = false); protected: ImageMapperGL2D(); virtual ~ImageMapperGL2D(); /** Does the actual resampling, without rendering the image yet. */ virtual void GenerateDataForRenderer(mitk::BaseRenderer *renderer); /** \brief Get the RendererInfo for @a renderer */ inline RendererInfo & AccessRendererInfo( mitk::BaseRenderer* renderer ) { RendererInfo& rendererInfo = m_RendererInfo[renderer]; if(rendererInfo.IsInitialized()==false) { // Add observer for renderer reset events (RendererInfo will // automatically be removed from list when a Renderer is deleted) // // Note: observer ID is passed to rendererInfo, which will take // responsiblity to remove the observer upon its destruction typedef itk::MemberCommand< ImageMapperGL2D > MemberCommandType; MemberCommandType::Pointer deleteRendererCommand = MemberCommandType::New(); deleteRendererCommand->SetCallbackFunction( this, &ImageMapperGL2D::DeleteRendererCallback ); unsigned long observerID = renderer->AddObserver( BaseRenderer::RendererResetEvent(), deleteRendererCommand ); // Initialize RendererInfo rendererInfo.Initialize( ImageMapperGL2D::numRenderer++, renderer, observerID ); } return rendererInfo; } void DeleteRendererCallback( itk::Object *object, const itk::EventObject & ); double CalculateSpacing( const mitk::Geometry3D *geometry, const mitk::Vector3D &d ) const; bool LineIntersectZero( vtkPoints *points, int p1, int p2, vtkFloatingPointType *bounds ); bool CalculateClippedPlaneBounds( const Geometry3D *boundingGeometry, const PlaneGeometry *planeGeometry, vtkFloatingPointType *bounds ); /** \brief Number of renderers data is stored for * \todo General concept for keeping data for rendering required * \todo static? */ static int numRenderer; protected: typedef std::map RendererInfoMap; /** \brief Map of instances of RendererInfo * \sa RendererInfo */ RendererInfoMap m_RendererInfo; vtkGeneralTransform *m_ComposedResliceTransform; private: int m_iil4mitkMode; }; } // namespace mitk #endif /* MITKIMAGEMAPPER2D_H_HEADER_INCLUDED_C10E906E */ diff --git a/Core/Code/Rendering/mitkMapper.h b/Core/Code/Rendering/mitkMapper.h index 3fb236c201..aa709684dd 100644 --- a/Core/Code/Rendering/mitkMapper.h +++ b/Core/Code/Rendering/mitkMapper.h @@ -1,283 +1,283 @@ /*========================================================================= Program: Medical Imaging & Interaction Toolkit Language: C++ Date: $Date$ Version: $Revision$ Copyright (c) German Cancer Research Center, Division of Medical and Biological Informatics. All rights reserved. See MITKCopyright.txt or http://www.mitk.org/copyright.html for details. This software is distributed WITHOUT ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the above copyright notices for more information. =========================================================================*/ #ifndef MAPPER_H_HEADER_INCLUDED_C1E6EA08 #define MAPPER_H_HEADER_INCLUDED_C1E6EA08 -#include "mitkCommon.h" +#include #include "mitkBaseRenderer.h" #include "mitkLevelWindow.h" #include #include //Just included to get VTK version #include class vtkWindow; class vtkProp; namespace mitk { class BaseRenderer; class BaseData; class DataNode; /** \brief Interface for accessing (templated) LocalStorageHandler instances. */ class BaseLocalStorageHandler { public: virtual ~BaseLocalStorageHandler() {} virtual void ClearLocalStorage(mitk::BaseRenderer *renderer,bool unregisterFromBaseRenderer=true )=0; }; //##Documentation //## @brief Base class of all mappers, 2D as well as 3D //## //## Base class of all Mappers, 2D as well as 3D. //## Subclasses of mitk::Mapper control the creation of rendering primitives //## that interface to the graphics library (e.g., OpenGL, vtk). //## @todo Should Mapper be a subclass of ImageSource? //## @ingroup Mapper class MITK_CORE_EXPORT Mapper : public itk::Object { public: mitkClassMacro(Mapper, itk::Object); //##Documentation //## @brief Set the DataNode containing the data to map itkSetObjectMacro(DataNode, DataNode); //##Documentation //## @brief Get the data to map //## //## Returns the mitk::BaseData object associated with this mapper. //## @returns the mitk::BaseData associated with this mapper. BaseData* GetData() const; //##Documentation //## @brief Get the DataNode containing the data to map virtual DataNode* GetDataNode() const; //##Documentation //## @brief Convenience access method for color properties (instances of //## ColorProperty) //## @return @a true property was found virtual bool GetColor(float rgb[3], BaseRenderer* renderer, const char* name = "color") const; //##Documentation //## @brief Convenience access method for visibility properties (instances //## of BoolProperty) //## @return @a true property was found //## @sa IsVisible virtual bool GetVisibility(bool &visible, BaseRenderer* renderer, const char* name = "visible") const; //##Documentation //## @brief Convenience access method for opacity properties (instances of //## FloatProperty) //## @return @a true property was found virtual bool GetOpacity(float &opacity, BaseRenderer* renderer, const char* name = "opacity") const; //##Documentation //## @brief Convenience access method for color properties (instances of //## LevelWindoProperty) //## @return @a true property was found virtual bool GetLevelWindow(LevelWindow &levelWindow, BaseRenderer* renderer, const char* name = "levelwindow") const; //##Documentation //## @brief Convenience access method for visibility properties (instances //## of BoolProperty). Return value is the visibility. Default is //## visible==true, i.e., true is returned even if the property (@a //## propertyKey) is not found. //## //## Thus, the return value has a different meaning than in the //## GetVisibility method! //## @sa GetVisibility virtual bool IsVisible(BaseRenderer* renderer, const char* name = "visible") const; virtual void Update(BaseRenderer* renderer); virtual void MitkRenderOverlay(BaseRenderer* renderer) = 0; virtual void MitkRenderOpaqueGeometry(BaseRenderer* renderer) = 0; virtual void MitkRenderTranslucentGeometry(BaseRenderer* renderer) = 0; virtual void MitkRenderVolumetricGeometry(BaseRenderer* renderer) = 0; /** * \brief Returns whether this is an vtk-based mapper */ virtual bool IsVtkBased() const = 0; /** \brief Returns true if this mapper owns the specified vtkProp for * the given BaseRenderer. * * Note: returns false by default; should be implemented for VTK-based * Mapper subclasses. */ virtual bool HasVtkProp( const vtkProp* /*prop*/, BaseRenderer* /*renderer*/ ) { return false; } /** * \brief Release vtk-based graphics resources. Must be overwritten in * subclasses if vtkProps are used. */ virtual void ReleaseGraphicsResources(vtkWindow*) { }; /** \brief Set default values of properties used by this mapper * to \a node * * \param node The node for which the properties are set * \param overwrite overwrite existing properties (default: \a false) * \param renderer defines which property list of node is used * (default: \a NULL, i.e. default property list) */ static void SetDefaultProperties(DataNode* node, BaseRenderer* renderer = NULL, bool overwrite = false); /** \brief Returns the current time step as calculated from the renderer */ int GetTimestep() const {return m_TimeStep;}; /** Returns true if this Mapper currently allows for Level-of-Detail rendering. * This reflects whether this Mapper currently invokes StartEvent, EndEvent, and * ProgressEvent on BaseRenderer. */ virtual bool IsLODEnabled( BaseRenderer * /*renderer*/ ) const { return false; } protected: Mapper(); virtual ~Mapper(); //##Documentation //## @brief Generate the data needed for rendering (independent of a specific renderer) virtual void GenerateData(); //##Documentation //## @brief Generate the data needed for rendering into @a renderer virtual void GenerateDataForRenderer(BaseRenderer* renderer); //## Updates the time step, which is sometimes needed in subclasses virtual void CalculateTimeStep( BaseRenderer* renderer ); //## Reset the mapper (i.e., make sure that nothing is displayed) if no //## valid data is present. //## //## To be implemented in sub-classes. virtual void ResetMapper( BaseRenderer* /*renderer*/ ) { }; itk::WeakPointer m_DataNode; //##Documentation //## @brief timestamp of last update of stored data itk::TimeStamp m_LastUpdateTime; private: //## The current time step of the dataset to be rendered, for use in subclasses //## The momentary timestep can be accessed via the GetTimestep() method. int m_TimeStep; public: /** \brief Base class for mapper specific rendering ressources. */ class BaseLocalStorage { }; /** \brief Templated class for management of LocalStorage implementations in Mappers. * * The LocalStorageHandler is responsible for providing a LocalStorage to a * concrete mitk::Mapper subclass. Each RenderWindow / mitk::BaseRenderer is * assigned its own LocalStorage instance so that all contained ressources * (actors, shaders, textures, ...) are provided individually per window. * */ template class LocalStorageHandler : public mitk::BaseLocalStorageHandler { protected: std::map m_BaseRenderer2LS; public: /** \brief deallocates a local storage for a specifc BaseRenderer (if the * BaseRenderer is itself deallocating it in its destructor, it has to set * unregisterFromBaseRenderer=false) */ virtual void ClearLocalStorage(mitk::BaseRenderer *renderer,bool unregisterFromBaseRenderer=true ) { //MITK_INFO << "deleting a localstorage on a mapper request"; if(unregisterFromBaseRenderer) renderer->UnregisterLocalStorageHandler( this ); L *l = m_BaseRenderer2LS[renderer]; m_BaseRenderer2LS.erase( renderer ); delete l; } /** \brief Retrieves a LocalStorage for a specific BaseRenderer. * * Should be used by mappers in GenerateData() and ApplyProperties() */ L *GetLocalStorage(mitk::BaseRenderer *forRenderer) { L *l = m_BaseRenderer2LS[ forRenderer ]; if(!l) { //MITK_INFO << "creating new localstorage"; l = new L; m_BaseRenderer2LS[ forRenderer ] = l; forRenderer->RegisterLocalStorageHandler( this ); } return l; } ~LocalStorageHandler() { typename std::map::iterator it; for ( it=m_BaseRenderer2LS.begin() ; it != m_BaseRenderer2LS.end(); it++ ) { (*it).first->UnregisterLocalStorageHandler(this); delete (*it).second; } m_BaseRenderer2LS.clear(); } }; }; } // namespace mitk #endif /* MAPPER_H_HEADER_INCLUDED_C1E6EA08 */ diff --git a/Core/Code/Rendering/mitkPointSetGLMapper2D.h b/Core/Code/Rendering/mitkPointSetGLMapper2D.h index 8ad12f4ffd..af86f391a9 100755 --- a/Core/Code/Rendering/mitkPointSetGLMapper2D.h +++ b/Core/Code/Rendering/mitkPointSetGLMapper2D.h @@ -1,94 +1,94 @@ /*========================================================================= Program: Medical Imaging & Interaction Toolkit Language: C++ Date: $Date$ Version: $Revision$ Copyright (c) German Cancer Research Center, Division of Medical and Biological Informatics. All rights reserved. See MITKCopyright.txt or http://www.mitk.org/copyright.html for details. This software is distributed WITHOUT ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the above copyright notices for more information. =========================================================================*/ #ifndef MITKPointSetMAPPER2D_H_HEADER_INCLUDED #define MITKPointSetMAPPER2D_H_HEADER_INCLUDED -#include "mitkCommon.h" +#include #include "mitkGLMapper2D.h" namespace mitk { class BaseRenderer; class PointSet; /** * @brief OpenGL-based mapper to display a mitk::PointSet in a 2D window. * * This mapper can actually more than just draw a number of points of a * mitk::PointSet. If you set the right properties of the mitk::DataNode, * which contains the point set, then this mapper will also draw lines * connecting the points, and calculate and display distances and angles * between adjacent points. Here is a complete list of boolean properties, * which might be of interest: * * - \b "show contour": Draw not only the points but also the connections between * them (default false) * - \b "line width": IntProperty which gives the width of the contour lines * - \b "show points": Wheter or not to draw the actual points (default true) * - \b "show distances": Wheter or not to calculate and print the distance * between adjacent points (default false) * - \b "show angles": Wheter or not to calculate and print the angle between * adjacent points (default false) * - \b "show distant lines": When true, the mapper will also draw contour * lines that are far away form the current slice (default true) * - \b "label": StringProperty with a label for this point set * * BUG 1321 - possible new features: * point-2d-size (length of lines in cross/diamond) * point-linewidth * * @ingroup Mapper */ class MITK_CORE_EXPORT PointSetGLMapper2D : public GLMapper2D { public: mitkClassMacro(PointSetGLMapper2D, GLMapper2D); itkNewMacro(Self); /** @brief Get the PointDataList to map */ virtual const mitk::PointSet * GetInput(void); virtual void Paint(mitk::BaseRenderer * renderer); virtual void ApplyProperties(mitk::BaseRenderer* renderer); static void SetDefaultProperties(mitk::DataNode* node, mitk::BaseRenderer* renderer = NULL, bool overwrite = false); protected: PointSetGLMapper2D(); virtual ~PointSetGLMapper2D(); bool m_Polygon; bool m_ShowPoints; bool m_ShowDistances; int m_DistancesDecimalDigits; bool m_ShowAngles; bool m_ShowDistantLines; int m_LineWidth; int m_PointLineWidth; int m_Point2DSize; }; } // namespace mitk #endif /* MITKPointSetMapper2D_H_HEADER_INCLUDED */ diff --git a/Core/Code/Rendering/mitkPointSetVtkMapper3D.h b/Core/Code/Rendering/mitkPointSetVtkMapper3D.h index e56181d05e..320f38499b 100755 --- a/Core/Code/Rendering/mitkPointSetVtkMapper3D.h +++ b/Core/Code/Rendering/mitkPointSetVtkMapper3D.h @@ -1,158 +1,158 @@ /*========================================================================= Program: Medical Imaging & Interaction Toolkit Language: C++ Date: $Date$ Version: $Revision$ Copyright (c) German Cancer Research Center, Division of Medical and Biological Informatics. All rights reserved. See MITKCopyright.txt or http://www.mitk.org/copyright.html for details. This software is distributed WITHOUT ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the above copyright notices for more information. =========================================================================*/ #ifndef MITKPointSetVtkMAPPER3D_H_HEADER_INCLUDED_C1907273 #define MITKPointSetVtkMAPPER3D_H_HEADER_INCLUDED_C1907273 -#include "mitkCommon.h" +#include #include "mitkVtkMapper3D.h" #include "mitkBaseRenderer.h" class vtkActor; class vtkPropAssembly; class vtkAppendPolyData; class vtkPolyData; class vtkTubeFilter; class vtkPolyDataMapper; namespace mitk { class PointSet; /** * @brief Vtk-based mapper for PointSet * * Due to the need of different colors for selected * and unselected points and the facts, that we also have a contour and * labels for the points, the vtk structure is build up the following way: * * We have two AppendPolyData, one selected, and one unselected and one * for a contour between the points. Each one is connected to an own * PolyDaraMapper and an Actor. The different color for the unselected and * selected state and for the contour is read from properties. * * "unselectedcolor", "selectedcolor" and "contourcolor" are the strings, * that are looked for. Pointlabels are added besides the selected or the * deselected points. * * Then the three Actors are combined inside a vtkPropAssembly and this * object is returned in GetProp() and so hooked up into the rendering * pipeline. * Properties that can be set for point sets and influence the PointSetVTKMapper3D are: * * - \b "color": (ColorProperty*) Color of the point set * - \b "Opacity": (FloatProperty) Opacity of the point set * - \b "show contour": (BoolProperty) If the contour of the points are visible * - \b "contourSizeProp":(FloatProperty) Contour size of the points The default properties are: * - \b "line width": (IntProperty::New(2), renderer, overwrite ) * - \b "pointsize": (FloatProperty::New(1.0), renderer, overwrite) * - \b "selectedcolor": (ColorProperty::New(1.0f, 0.0f, 0.0f), renderer, overwrite) //red * - \b "color": (ColorProperty::New(1.0f, 1.0f, 0.0f), renderer, overwrite) //yellow * - \b "show contour": (BoolProperty::New(false), renderer, overwrite ) * - \b "contourcolor": (ColorProperty::New(1.0f, 0.0f, 0.0f), renderer, overwrite) * - \b "contoursize": (FloatProperty::New(0.5), renderer, overwrite ) * - \b "close contour": (BoolProperty::New(false), renderer, overwrite ) * - \b "show points": (BoolProperty::New(true), renderer, overwrite ) * - \b "updateDataOnRender": (BoolProperty::New(true), renderer, overwrite ) *Other properties looked for are: * * - \b "show contour": if set to on, lines between the points are shown * - \b "close contour": if set to on, the open strip is closed (first point * connected with last point) * - \b "pointsize": size of the points mapped * - \b "label": text of the Points to show besides points * - \b "contoursize": size of the contour drawn between the points * (if not set, the pointsize is taken) * * @ingroup Mapper */ class MITK_CORE_EXPORT PointSetVtkMapper3D : public VtkMapper3D { public: mitkClassMacro(PointSetVtkMapper3D, VtkMapper3D); itkNewMacro(Self); virtual const mitk::PointSet* GetInput(); //overwritten from VtkMapper3D to be able to return a //m_PointsAssembly which is much faster than a vtkAssembly virtual vtkProp* GetVtkProp(mitk::BaseRenderer* renderer); virtual void UpdateVtkTransform(mitk::BaseRenderer* renderer); static void SetDefaultProperties(mitk::DataNode* node, mitk::BaseRenderer* renderer = NULL, bool overwrite = false); void ReleaseGraphicsResources(vtkWindow *renWin); protected: PointSetVtkMapper3D(); virtual ~PointSetVtkMapper3D(); virtual void GenerateData(); virtual void GenerateDataForRenderer(mitk::BaseRenderer* renderer); virtual void ResetMapper( BaseRenderer* renderer ); virtual void ApplyProperties(vtkActor* actor, mitk::BaseRenderer* renderer); virtual void CreateContour(mitk::BaseRenderer* renderer); virtual void CreateVTKRenderObjects(); vtkAppendPolyData *m_vtkSelectedPointList; vtkAppendPolyData *m_vtkUnselectedPointList; // vtkAppendPolyData *m_vtkContourPolyData; vtkPolyDataMapper *m_VtkSelectedPolyDataMapper; vtkPolyDataMapper *m_VtkUnselectedPolyDataMapper; // vtkPolyDataMapper *m_vtkContourPolyDataMapper; vtkActor *m_SelectedActor; vtkActor *m_UnselectedActor; vtkActor *m_ContourActor; vtkPropAssembly *m_PointsAssembly; //help for contour between points vtkAppendPolyData *m_vtkTextList; //vtkPolyData *m_Contour; //vtkTubeFilter *m_TubeFilter; //variables to be able to log, how many inputs have been added to PolyDatas unsigned int m_NumberOfSelectedAdded; unsigned int m_NumberOfUnselectedAdded; //variables to check if an update of the vtk objects is needed ScalarType m_PointSize; ScalarType m_ContourRadius; }; } // namespace mitk #endif /* MITKPointSetVtkMAPPER3D_H_HEADER_INCLUDED_C1907273 */ diff --git a/Core/Code/Rendering/mitkPolyDataGLMapper2D.h b/Core/Code/Rendering/mitkPolyDataGLMapper2D.h index 3d3ce79471..2f1d34be09 100644 --- a/Core/Code/Rendering/mitkPolyDataGLMapper2D.h +++ b/Core/Code/Rendering/mitkPolyDataGLMapper2D.h @@ -1,110 +1,110 @@ /*========================================================================= Program: Medical Imaging & Interaction Toolkit Language: C++ Date: $Date$ Version: $Revision$ Copyright (c) German Cancer Research Center, Division of Medical and Biological Informatics. All rights reserved. See MITKCopyright.txt or http://www.mitk.org/copyright.html for details. This software is distributed WITHOUT ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the above copyright notices for more information. =========================================================================*/ #ifndef MitkPolyDataGLMapper2D_H #define MitkPolyDataGLMapper2D_H -#include "mitkCommon.h" +#include #include "mitkGLMapper2D.h" class vtkCutter; class vtkPlane; class vtkLookupTable; class vtkPolyData; class vtkScalarsToColors; class vtkPolyDataMapper; namespace mitk { class BaseRenderer; /** * @brief OpenGL-based mapper to display a 2d cut through a poly data * OpenGL-based mapper to display a 2D cut through a poly data. The result is * normally a line. This class can be added to any data object, which is * rendered in 3D via a vtkPolyData. */ class MITK_CORE_EXPORT PolyDataGLMapper2D : public GLMapper2D { public: mitkClassMacro( PolyDataGLMapper2D, GLMapper2D ); itkNewMacro( Self ); /** * Sets if the cut lines are colored by mapping cell data */ itkSetMacro( ColorByCellData, bool ); /** * Sets if the cut lines are colored by mapping point data */ itkSetMacro( ColorByPointData, bool ); /** * Renders a cut through a poly-data by lines. * @param renderer the render to render in. */ virtual void Paint( mitk::BaseRenderer * renderer ); protected: PolyDataGLMapper2D(); virtual ~PolyDataGLMapper2D(); /** * Determines, if the associated BaseData is mapped three-dimensionally (mapper-slot id 2) * with a class convertable to vtkPolyDataMapper(). * @returns NULL if it is not convertable or the appropriate PolyDataMapper otherwise */ virtual vtkPolyDataMapper* GetVtkPolyDataMapper(); /** * Determines the poly data object to be cut. * returns the poly data if possible, otherwise NULL. */ virtual vtkPolyData* GetVtkPolyData( ); /** * Determines the LookupTable used by the associated vtkMapper. * returns the LUT if possible, otherwise NULL. */ virtual vtkScalarsToColors* GetVtkLUT( ); /** * Checks if this mapper can be used to generate cuts through the associated * base data. * @return true if yes or false if not. */ virtual bool IsConvertibleToVtkPolyData(); vtkPlane* m_Plane; vtkCutter* m_Cutter; bool m_ColorByCellData; bool m_ColorByPointData; }; } // namespace mitk #endif /* MitkPolyDataGLMapper2D_H */ diff --git a/Core/Code/Rendering/mitkRenderWindow.h b/Core/Code/Rendering/mitkRenderWindow.h index 4325f4d7ca..ec5dfac5a2 100644 --- a/Core/Code/Rendering/mitkRenderWindow.h +++ b/Core/Code/Rendering/mitkRenderWindow.h @@ -1,85 +1,85 @@ /*========================================================================= Program: Medical Imaging & Interaction Toolkit Language: C++ Date: $Date: 2010-06-30 15:12:34 +0200 (Mi, 30. Jun 2010) $ Version: $Revision: 24176 $ Copyright (c) German Cancer Research Center, Division of Medical and Biological Informatics. All rights reserved. See MITKCopyright.txt or http://www.mitk.org/copyright.html for details. This software is distributed WITHOUT ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the above copyright notices for more information. =========================================================================*/ #ifndef MITKRENDERWINDOW_H_HEADER_INCLUDED_C1C40D66ASDF #define MITKRENDERWINDOW_H_HEADER_INCLUDED_C1C40D66ASDF -#include "mitkCommon.h" +#include #include "mitkRenderWindowBase.h" namespace mitk { class vtkEventProvider; /** * \brief mitkRenderWindow integrates the MITK rendering mechanism into VTK and * is NOT QT dependent * * * \ingroup Renderer */ class MITK_CORE_EXPORT RenderWindow: public mitk::RenderWindowBase, public itk::Object { public: mitkClassMacro(RenderWindow, itk::Object); itkNewMacro(Self); mitkNewMacro1Param(Self, vtkRenderWindow*); mitkNewMacro2Param(Self, vtkRenderWindow*, const char*); mitkNewMacro3Param(Self, vtkRenderWindow*, const char*, mitk::RenderingManager*); virtual ~RenderWindow(); virtual vtkRenderWindow* GetVtkRenderWindow(); virtual vtkRenderWindowInteractor* GetVtkRenderWindowInteractor(); // Set Layout Index to define the Layout Type void SetLayoutIndex( unsigned int layoutIndex ); // Get Layout Index to define the Layout Type unsigned int GetLayoutIndex(); //MenuWidget need to update the Layout Design List when Layout had changed void LayoutDesignListChanged( int layoutDesignIndex ); void FullScreenMode( bool state ); protected: RenderWindow(vtkRenderWindow * existingRenderWindow = NULL , const char* name = "unnamed renderer", mitk::RenderingManager* rm = NULL ); void ResetView(); vtkRenderWindow * m_vtkRenderWindow; vtkRenderWindowInteractor * m_vtkRenderWindowInteractor; vtkEventProvider * m_vtkMitkEventProvider; private: }; } //namespace #endif /* MITKRENDERWINDOW_H_HEADER_INCLUDED_C1C40D66ASDF */ diff --git a/Core/Code/Rendering/mitkRenderWindowBase.h b/Core/Code/Rendering/mitkRenderWindowBase.h index 6773d0fd65..46de2865a6 100644 --- a/Core/Code/Rendering/mitkRenderWindowBase.h +++ b/Core/Code/Rendering/mitkRenderWindowBase.h @@ -1,101 +1,101 @@ /*========================================================================= Program: Medical Imaging & Interaction Toolkit Language: C++ Date: $Date: 2010-06-30 15:12:34 +0200 (Mi, 30. Jun 2010) $ Version: $Revision: 24176 $ Copyright (c) German Cancer Research Center, Division of Medical and Biological Informatics. All rights reserved. See MITKCopyright.txt or http://www.mitk.org/copyright.html for details. This software is distributed WITHOUT ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the above copyright notices for more information. =========================================================================*/ #ifndef MITKRENDERWINDOWBASE_H_HEADER_INCLUDED_C1C40D66ASDF #define MITKRENDERWINDOWBASE_H_HEADER_INCLUDED_C1C40D66ASDF -#include "mitkCommon.h" +#include #include "mitkVtkPropRenderer.h" #include "vtkMitkRenderProp.h" #include "mitkSliceNavigationController.h" #include "mitkCameraRotationController.h" namespace mitk { /** * \brief Base class of MITK RenderWindows * * This class sets up the MITK rendering mechanism and it's integration into VTK. * * Currently, there are two specific implementations of this abstract class: * QmitkRenderWindow, inerhits from the QVTKWidget and is the matured way for MITK rendering * mitkRenderWindow is a new, QT-independent RenderWindow implementation * * \ingroup Renderer */ class MITK_CORE_EXPORT RenderWindowBase { public: //mitkClassMacro(RenderWindowBase,itk::Object); //itkNewMacro(Self); virtual ~RenderWindowBase(); void InitRenderer(); virtual mitk::SliceNavigationController * GetSliceNavigationController(); virtual mitk::CameraRotationController * GetCameraRotationController(); virtual mitk::BaseController * GetController(); virtual mitk::VtkPropRenderer* GetRenderer(); virtual vtkRenderWindow* GetVtkRenderWindow() = 0; virtual vtkRenderWindowInteractor* GetVtkRenderWindowInteractor() = 0; void SetProcessWheelEvents( bool state ); bool GetProcessWheelEvents(); void SetInvertScrollingDirection( bool ); virtual void mousePressMitkEvent(mitk::MouseEvent *me); virtual void mouseReleaseMitkEvent(mitk::MouseEvent *me); virtual void mouseMoveMitkEvent(mitk::MouseEvent *me); virtual void wheelMitkEvent(mitk::WheelEvent *we); virtual void keyPressMitkEvent(mitk::KeyEvent* mke); virtual void resizeMitkEvent(int width, int height); protected: RenderWindowBase(); // helper functions: within constructors and destructors classes are not polymorph. void Initialize( mitk::RenderingManager* renderingManager = NULL, const char* name = "unnamed renderer" ); void Destroy(); mitk::VtkPropRenderer::Pointer m_Renderer; vtkMitkRenderProp* m_RenderProp; bool m_InResize; bool m_ProcessWheelEvents; bool m_InvertScrollingDirection; private: }; } #endif /* MITKRENDERWINDOWBASE_H_HEADER_INCLUDED_C1C40D66ASDF */ diff --git a/Core/Code/Rendering/mitkShaderRepository.h b/Core/Code/Rendering/mitkShaderRepository.h index 5e1207f3e6..cf5321d7cf 100644 --- a/Core/Code/Rendering/mitkShaderRepository.h +++ b/Core/Code/Rendering/mitkShaderRepository.h @@ -1,167 +1,167 @@ /*========================================================================= Program: Medical Imaging & Interaction Toolkit Language: C++ Date: $Date: 2008-02-08 13:23:19 +0100 (Fri, 08 Feb 2008) $ Version: $Revision: 13561 $ Copyright (c) German Cancer Research Center, Division of Medical and Biological Informatics. All rights reserved. See MITKCopyright.txt or http://www.mitk.org/copyright.html for details. This software is distributed WITHOUT ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the above copyright notices for more information. =========================================================================*/ #ifndef _MITKSHADERREPOSITORY_H_ #define _MITKSHADERREPOSITORY_H_ -#include "mitkCommon.h" +#include #include "itkObject.h" #include "itkObjectFactory.h" #include #include "mitkBaseRenderer.h" #include "mitkDataNode.h" namespace mitk { /** * \brief Management class for vtkShader XML descriptions. * * Looks for all XML shader files in a given directory and adds default properties * for each shader object (shader uniforms) to the specified mitk::DataNode. * * Additionally, it provides a utility function for applying properties for shaders * in mappers. */ class MITK_CORE_EXPORT ShaderRepository : public itk::Object { public: mitkClassMacro( ShaderRepository, itk::Object ); itkNewMacro( Self ); static ShaderRepository *GetGlobalShaderRepository(); class Shader : public itk::Object { public: mitkClassMacro( Shader, itk::Object ); itkNewMacro( Self ); class Uniform : public itk::Object { public: mitkClassMacro( Uniform, itk::Object ); itkNewMacro( Self ); enum Type { glsl_none, glsl_float, glsl_vec2, glsl_vec3, glsl_vec4, glsl_int, glsl_ivec2, glsl_ivec3, glsl_ivec4 }; /** * Constructor */ Uniform(); /** * Destructor */ ~Uniform(); Type type; std::string name; int defaultInt[4]; float defaultFloat[4]; void LoadFromXML(vtkXMLDataElement *e); }; std::list uniforms; /** * Constructor */ Shader(); /** * Destructor */ ~Shader(); std::string name; std::string path; void LoadPropertiesFromPath(); Uniform *GetUniform(char * /*id*/) { return 0; } std::list *GetUniforms() { return &uniforms; } }; protected: std::list shaders; void LoadShaders(); /** * Constructor */ ShaderRepository(); /** * Destructor */ ~ShaderRepository(); public: std::list *GetShaders() { return &shaders; } Shader *GetShader(const char *id); /** \brief Adds all parsed shader uniforms to property list of the given DataNode; * used by mappers. */ void AddDefaultProperties(mitk::DataNode* node, mitk::BaseRenderer* renderer, bool overwrite); /** \brief Applies shader and shader specific variables of the specified DataNode * to the VTK object by updating the shader variables of its vtkProperty. */ void ApplyProperties(mitk::DataNode* node, vtkActor *actor, mitk::BaseRenderer* renderer,itk::TimeStamp &MTime); /** \brief Loads a shader from a given file. Make sure that this file is in the XML shader format. */ void LoadShader(std::string filename); }; } //end of namespace mitk #endif diff --git a/Core/Code/Rendering/mitkSurfaceGLMapper2D.h b/Core/Code/Rendering/mitkSurfaceGLMapper2D.h index 435c92b807..e1c3f6881b 100644 --- a/Core/Code/Rendering/mitkSurfaceGLMapper2D.h +++ b/Core/Code/Rendering/mitkSurfaceGLMapper2D.h @@ -1,156 +1,156 @@ /*========================================================================= Program: Medical Imaging & Interaction Toolkit Language: C++ Date: $Date$ Version: $Revision$ Copyright (c) German Cancer Research Center, Division of Medical and Biological Informatics. All rights reserved. See MITKCopyright.txt or http://www.mitk.org/copyright.html for details. This software is distributed WITHOUT ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the above copyright notices for more information. =========================================================================*/ #ifndef MITKSURFACEDATAMAPPER2D_H_HEADER_INCLUDED_C10EB2E8 #define MITKSURFACEDATAMAPPER2D_H_HEADER_INCLUDED_C10EB2E8 -#include "mitkCommon.h" +#include #include "mitkGLMapper2D.h" #include "mitkSurface.h" class vtkCutter; class vtkPlane; class vtkLookupTable; class vtkLinearTransform; class vtkPKdTree; class vtkStripper; namespace mitk { class BaseRenderer; class Geometry2D; class DisplayGeometry; /** * @brief OpenGL-based mapper to display a Surface in a 2D window. * * Displays a 2D cut through a Surface object (vtkPolyData). This * is basically done in two steps: * * 1. Cut a slice out of a (input) vtkPolyData object. The slice may be a flat plane (PlaneGeometry) * or a curved plane (ThinPlateSplineCurvedGeometry). The actual cutting is done by a vtkCutter. * The result of cutting is a (3D) vtkPolyData object, which contains only points and lines * describing the cut. * * 2. Paint the cut out slice by means of OpenGL. To do this, all lines of the cut object are traversed. * For each line segment, both end points are transformed from 3D into the 2D system of the associated * renderer and then drawn by OpenGL. * * There is a mode to display normals of the input surface object (see properties below). If this mode * is on, then the drawing of the 2D cut is slightly more complicated. For each line segment of the cut, * we take the end point (p2d) of this line and search the input vtkPolyData object for the closest point to p2d (p3D-input). * We then read out the surface normal for p3D-input. We map this normal into our 2D coordinate system and * then draw a line from p2d to (p2d+mapped normal). This drawing of surface normals will only work if the * input vtkPolyData actually HAS normals. If you have a vtkPolyData without normals, use the vtkPolyDataNormals * filter to generate normals. * * Properties that influence rendering are: * * - \b "color": (ColorProperty) Color of surface object * - \b "line width": (IntProperty) Width in pixels of the lines drawn. * - \b "scalar visibility": (BoolProperty) Whether point/cell data values (from vtkPolyData) should be used to influence colors * - \b "scalar mode": (BoolProperty) If "scalar visibility" is on, whether to use point data or cell data for coloring. * - \b "LookupTable": (LookupTableProperty) A lookup table to translate point/cell data values (from vtkPolyData) to colors * - \b "ScalarsRangeMinimum": (FloatProperty) Range of the lookup table * - \b "ScalarsRangeMaximum": (FloatProperty) Range of the lookup table * - \b "draw normals 2D": (BoolProperty) If true, normals are drawn (if present in vtkPolyData) * - \b "invert normals": (BoolProperty) Inverts front/back for display. * - \b "front color": (ColorProperty) Color for normals display on front side of the plane * - \b "front normal length (px)": (FloatProperty) Length of the front side normals in pixels. * - \b "back color": (ColorProperty) Color for normals display on back side of the plane * - \b "back normal length (px)": (FloatProperty) Length of the back side normals in pixels. * */ class MITK_CORE_EXPORT SurfaceGLMapper2D : public GLMapper2D { public: mitkClassMacro(SurfaceGLMapper2D, GLMapper2D); itkNewMacro(Self); const Surface* GetInput(void); virtual void Paint(BaseRenderer* renderer); /** * @brief The Surface to map can be explicitly set by this method. * * If it is set, it is used instead of the data stored in the DataNode. * This enables to use the mapper also internally from other mappers. */ itkSetConstObjectMacro(Surface, Surface); /** * @brief Get the Surface set explicitly. * * @return NULL is returned if no Surface is set to be used instead of DataNode::GetData(). * @sa SetSurface */ itkGetConstObjectMacro(Surface, Surface); /** *\brief Overwritten to initialize lookup table for point scalar data */ void SetDataNode( DataNode* node ); /** * \brief Generate OpenGL primitives for the VTK contour held in contour. */ void PaintCells(BaseRenderer* renderer, vtkPolyData* contour, const Geometry2D* worldGeometry, const DisplayGeometry* displayGeometry, vtkLinearTransform* vtktransform, vtkLookupTable* lut = NULL, vtkPolyData* original3DObject = NULL); static void SetDefaultProperties(DataNode* node, BaseRenderer* renderer = NULL, bool overwrite = false); virtual void ApplyProperties(BaseRenderer* renderer); protected: SurfaceGLMapper2D(); virtual ~SurfaceGLMapper2D(); vtkPlane* m_Plane; vtkCutter* m_Cutter; Surface::ConstPointer m_Surface; vtkLookupTable* m_LUT; int m_LineWidth; vtkPKdTree* m_PointLocator; vtkStripper* m_Stripper; bool m_DrawNormals; float m_FrontSideColor[4]; float m_BackSideColor[4]; float m_LineColor[4]; float m_FrontNormalLengthInPixels; float m_BackNormalLengthInPixels; }; } // namespace mitk #endif /* MITKSURFACEDATAMAPPER2D_H_HEADER_INCLUDED_C10EB2E8 */ diff --git a/Core/Code/Rendering/mitkSurfaceVtkMapper3D.h b/Core/Code/Rendering/mitkSurfaceVtkMapper3D.h index 6cc22e20f7..0a80c598d3 100644 --- a/Core/Code/Rendering/mitkSurfaceVtkMapper3D.h +++ b/Core/Code/Rendering/mitkSurfaceVtkMapper3D.h @@ -1,162 +1,162 @@ /*========================================================================= Program: Medical Imaging & Interaction Toolkit Language: C++ Date: $Date$ Version: $Revision$ Copyright (c) German Cancer Research Center, Division of Medical and Biological Informatics. All rights reserved. See MITKCopyright.txt or http://www.mitk.org/copyright.html for details. This software is distributed WITHOUT ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the above copyright notices for more information. =========================================================================*/ #ifndef MITKSURFACEDATAVTKMAPPER3D_H_HEADER_INCLUDED_C1907273 #define MITKSURFACEDATAVTKMAPPER3D_H_HEADER_INCLUDED_C1907273 -#include "mitkCommon.h" +#include #include "mitkVtkMapper3D.h" #include "mitkSurface.h" #include "mitkBaseRenderer.h" #include #include #include #include #include #include namespace mitk { //##Documentation //## @brief Vtk-based mapper for Surface //## //## @ingroup Mapper /** * @brief Vtk-based mapper for Surface * * Properties that can be set for surfaces and influence the surfaceVTKMapper3D are: * * - \b "color": (ColorProperty) Diffuse color of the surface object (this property will be read when material.diffuseColor is not defined) * - \b "Opacity": (FloatProperty) Opacity of the surface object * - \b "material.ambientColor": (ColorProperty) Ambient color of the surface object * - \b "material.ambientCoefficient": ( FloatProperty) Ambient coefficient of the surface object * - \b "material.diffuseColor": ( ColorProperty) Diffuse color of the surface object * - \b "material.diffuseCoefficient": (FloatProperty) Diffuse coefficient of the surface object * - \b "material.specularColor": (ColorProperty) Specular Color of the surface object * - \b "material.specularCoefficient": (FloatProperty) Specular coefficient of the surface object * - \b "material.specularPower": (FloatProperty) Specular power of the surface object * - \b "material.interpolation": (VtkInterpolationProperty) Interpolation * - \b "material.representation": (VtkRepresentationProperty*) Representation * - \b "material.wireframeLineWidth": (FloatProperty) Width in pixels of the lines drawn. * - \b "scalar visibility": (BoolProperty) If the scarlars of the surface are visible * Properties to look for are: * * - \b "scalar visibility": if set to on, scalars assigned to the data are shown * Turn this on if using a lookup table. * - \b "ScalarsRangeMinimum": Optional. Can be used to store the scalar min, e.g. * for the level window settings. * - \b "ScalarsRangeMaximum": Optional. See above. * * There might be still some other, deprecated properties. These will not be documented anymore. * Please check the source if you really need them. * * @ingroup Mapper */ class MITK_CORE_EXPORT SurfaceVtkMapper3D : public VtkMapper3D { public: mitkClassMacro(SurfaceVtkMapper3D, VtkMapper3D); itkNewMacro(Self); itkSetMacro(GenerateNormals, bool); itkGetMacro(GenerateNormals, bool); //enable ImmediateModeRendering for vtkMapping //yet to solve bug 1398 void SetImmediateModeRenderingOn(int on = 1); itkGetMacro(ImmediateModeRenderingOn, int); virtual const mitk::Surface* GetInput(); virtual vtkProp *GetVtkProp(mitk::BaseRenderer *renderer); virtual void ApplyProperties(vtkActor* actor, mitk::BaseRenderer* renderer); static void SetDefaultProperties(mitk::DataNode* node, mitk::BaseRenderer* renderer = NULL, bool overwrite = false); protected: SurfaceVtkMapper3D(); virtual ~SurfaceVtkMapper3D(); virtual void GenerateDataForRenderer(mitk::BaseRenderer* renderer); virtual void ResetMapper( mitk::BaseRenderer* renderer ); /** Checks whether the specified property is a ClippingProperty and if yes, * adds it to m_ClippingPlaneCollection (internal method). */ virtual void CheckForClippingProperty( mitk::BaseRenderer* renderer, mitk::BaseProperty *property ); bool m_GenerateNormals; //enable ImmediateModeRendering for the vtkMapper int m_ImmediateModeRenderingOn; public: class LocalStorage : public mitk::Mapper::BaseLocalStorage { public: vtkActor* m_Actor; vtkPolyDataMapper *m_VtkPolyDataMapper; vtkPolyDataNormals *m_VtkPolyDataNormals; vtkPlaneCollection *m_ClippingPlaneCollection; itk::TimeStamp m_ShaderTimestampUpdate; LocalStorage() { m_VtkPolyDataMapper = vtkOpenGLPolyDataMapper::New(); m_VtkPolyDataNormals = vtkPolyDataNormals::New(); m_Actor = vtkActor::New(); m_ClippingPlaneCollection = vtkPlaneCollection::New(); m_Actor->SetMapper(m_VtkPolyDataMapper); } ~LocalStorage() { m_VtkPolyDataMapper->Delete(); m_VtkPolyDataNormals->Delete(); m_Actor->Delete(); m_ClippingPlaneCollection->Delete(); } }; mitk::Mapper::LocalStorageHandler m_LSH; static void ApplyMitkPropertiesToVtkProperty(mitk::DataNode *node, vtkProperty* property, mitk::BaseRenderer* renderer); static void SetDefaultPropertiesForVtkProperty(mitk::DataNode* node, mitk::BaseRenderer* renderer, bool overwrite); }; } // namespace mitk #endif /* MITKSURFACEDATAVTKMAPPER3D_H_HEADER_INCLUDED_C1907273 */ diff --git a/Core/Code/Rendering/mitkVolumeDataVtkMapper3D.h b/Core/Code/Rendering/mitkVolumeDataVtkMapper3D.h index bd3351d229..35b53da41b 100644 --- a/Core/Code/Rendering/mitkVolumeDataVtkMapper3D.h +++ b/Core/Code/Rendering/mitkVolumeDataVtkMapper3D.h @@ -1,151 +1,151 @@ /*========================================================================= Program: Medical Imaging & Interaction Toolkit Language: C++ Date: $Date$ Version: $Revision$ Copyright (c) German Cancer Research Center, Division of Medical and Biological Informatics. All rights reserved. See MITKCopyright.txt or http://www.mitk.org/copyright.html for details. This software is distributed WITHOUT ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the above copyright notices for more information. =========================================================================*/ #ifndef MITKVOLUMEDATAVTKMAPPER3D_H_HEADER_INCLUDED #define MITKVOLUMEDATAVTKMAPPER3D_H_HEADER_INCLUDED -#include "mitkCommon.h" +#include #include "mitkVtkMapper3D.h" #include "mitkBaseRenderer.h" #include "mitkImage.h" #include #include #include #include #include #include #include class vtkAssembly; class vtkVolumeRayCastMapper; class vtkFixedPointVolumeRayCastMapper; class vtkVolumeTextureMapper2D; class vtkVolumeMapper; class vtkVolume; class vtkObject; class vtkImageShiftScale; class vtkImageChangeInformation; class vtkLODProp3D; class vtkImageResample; class vtkCubeSource; class vtkPolyDataMapper; class vtkActor; namespace mitk { /************************************************************************/ /* Properties that influence the mapper are: * * - \b "level window": for the level window of the volume data * - \b "LookupTable" : for the lookup table of the volume data * - \b "TransferFunction" (mitk::TransferFunctionProperty): for the used transfer function of the volume data ************************************************************************/ //##Documentation //## @brief Vtk-based mapper for VolumeData //## //## @ingroup Mapper class MITK_CORE_EXPORT VolumeDataVtkMapper3D : public VtkMapper3D { public: mitkClassMacro(VolumeDataVtkMapper3D, VtkMapper3D); itkNewMacro(Self); virtual const mitk::Image* GetInput(); virtual void ApplyProperties(vtkActor* actor, mitk::BaseRenderer* renderer); virtual void EnableMask(); virtual void DisableMask(); Image::Pointer GetMask(); bool SetMask(const Image* mask); virtual void UpdateMask(); static void SetDefaultProperties(mitk::DataNode* node, mitk::BaseRenderer* renderer = NULL, bool overwrite = false); /** Returns true if this Mapper currently allows for Level-of-Detail rendering. * This reflects whether this Mapper currently invokes StartEvent, EndEvent, and * ProgressEvent on BaseRenderer. */ virtual bool IsLODEnabled( BaseRenderer *renderer = NULL ) const; virtual vtkProp *GetVtkProp(mitk::BaseRenderer *renderer); protected: VolumeDataVtkMapper3D(); virtual ~VolumeDataVtkMapper3D(); virtual void GenerateDataForRenderer(mitk::BaseRenderer* renderer); void CreateDefaultTransferFunctions(); void UpdateTransferFunctions( mitk::BaseRenderer *renderer ); void SetPreferences(); void SetClippingPlane(vtkRenderWindowInteractor* interactor); void DelClippingPlane(); vtkImageShiftScale* m_ImageCast; vtkImageChangeInformation* m_UnitSpacingImageFilter; vtkVolumeProperty* m_VolumePropertyLow; vtkVolumeProperty* m_VolumePropertyMed; vtkVolumeProperty* m_VolumePropertyHigh; vtkVolumeTextureMapper2D* m_T2DMapper; vtkVolumeRayCastMapper* m_HiResMapper; vtkImageResample* m_Resampler; vtkLODProp3D* m_VolumeLOD; vtkCubeSource *m_BoundingBox; vtkPolyDataMapper *m_BoundingBoxMapper; vtkActor *m_BoundingBoxActor; vtkAssembly *m_Prop3DAssembly; vtkPlane* m_ClippingPlane; vtkImplicitPlaneWidget* m_PlaneWidget; vtkImageData *m_Mask; vtkImageMask *m_ImageMaskFilter; vtkPiecewiseFunction *m_DefaultOpacityTransferFunction; vtkPiecewiseFunction *m_DefaultGradientTransferFunction; vtkColorTransferFunction *m_DefaultColorTransferFunction; int m_LowResID; int m_MedResID; int m_HiResID; bool m_PlaneSet; double m_PlaneNormalA; double m_PlaneNormalB; double m_PlaneNormalC; std::set< vtkRenderWindow * > m_RenderWindowInitialized; }; } // namespace mitk #endif /* MITKVOLUMEDATAVTKMAPPER3D_H_HEADER_INCLUDED */ diff --git a/Core/Code/Rendering/mitkVtkEventProvider.h b/Core/Code/Rendering/mitkVtkEventProvider.h index 2a86abda76..42ab4d88f6 100644 --- a/Core/Code/Rendering/mitkVtkEventProvider.h +++ b/Core/Code/Rendering/mitkVtkEventProvider.h @@ -1,78 +1,78 @@ /*========================================================================= Program: Medical Imaging & Interaction Toolkit Language: C++ Date: $Date: 2010-07-22 16:45:18 +0200 (Do, 04 Mai 2006) $ Version: $Revision: 6790 $ Copyright (c) German Cancer Research Center, Division of Medical and Biological Informatics. All rights reserved. See MITKCopyright.txt or http://www.mitk.org/copyright.html for details. This software is distributed WITHOUT ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the above copyright notices for more information. =========================================================================*/ #ifndef VTKMITKEVENTPROVIDER_H_HEADER_INCLUDED_C1C53723 #define VTKMITKEVENTPROVIDER_H_HEADER_INCLUDED_C1C53723 -#include "mitkCommon.h" +#include #include "mitkRenderWindow.h" #include "vtkInteractorObserver.h" namespace mitk { /** * \brief Integrates into the VTK event mechanism to generate MITK specific events. * This class is NON-QT dependent pandon to the current MITK event handling code in QmitkRenderWindow. * \ingroup Renderer */ class MITK_CORE_EXPORT vtkEventProvider : public vtkInteractorObserver { public: static vtkEventProvider *New(); vtkTypeRevisionMacro(vtkEventProvider,vtkInteractorObserver); // Satisfy the superclass API. Enable/disable listening for events. virtual void SetEnabled(int); virtual void SetInteractor(vtkRenderWindowInteractor* iren); // Interface to MITK virtual void SetMitkRenderWindow(mitk::RenderWindow* renWin); mitk::RenderWindow* GetRenderWindow(); protected: vtkEventProvider(); ~vtkEventProvider(); //methods for processing events - callback for the observer/command pattern of vtkCommand static void ProcessEvents(vtkObject* object, unsigned long event, void* clientdata, void* calldata); mitk::RenderWindow* m_RenderWindow; // adds the MITK interaction event types to the VTK observer/command pattern void AddInteractionEvent(unsigned long ievent); // removes the MITK interaction event types void RemoveInteractionEvent(unsigned long ievent); typedef std::vector InteractionEventsVectorType; InteractionEventsVectorType m_InteractionEventsVector; private: vtkEventProvider(const vtkEventProvider&); // Not implemented. void operator=(const vtkEventProvider&); // Not implemented. }; } #endif /* VTKMITKEVENTPROVIDER_H_HEADER_INCLUDED_C1C53723 */ diff --git a/Core/Code/Rendering/mitkVtkMapper3D.h b/Core/Code/Rendering/mitkVtkMapper3D.h index bdee69880e..bf7e42051a 100644 --- a/Core/Code/Rendering/mitkVtkMapper3D.h +++ b/Core/Code/Rendering/mitkVtkMapper3D.h @@ -1,113 +1,113 @@ /*========================================================================= Program: Medical Imaging & Interaction Toolkit Language: C++ Date: $Date$ Version: $Revision$ Copyright (c) German Cancer Research Center, Division of Medical and Biological Informatics. All rights reserved. See MITKCopyright.txt or http://www.mitk.org/copyright.html for details. This software is distributed WITHOUT ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the above copyright notices for more information. =========================================================================*/ #ifndef BASEVTKMAPPER3D_H_HEADER_INCLUDED #define BASEVTKMAPPER3D_H_HEADER_INCLUDED -#include "mitkCommon.h" +#include #include "mitkMapper.h" #include "mitkMapper3D.h" #include "mitkBaseRenderer.h" #include "vtkMapper.h" class vtkProp; class vtkProp3D; class vtkActor; class vtkProp3DCollection; namespace mitk { //##Documentation //## @brief Base class of all vtk-based 3D-Mappers //## //## GetProp() returns m_Prop3D, which should be //## initialized by sub-classes (e.g., by setting //## it to an vtkActor). //## @ingroup Mapper class MITK_CORE_EXPORT VtkMapper3D : public Mapper3D { public: mitkClassMacro(VtkMapper3D, Mapper3D); virtual vtkProp *GetVtkProp(mitk::BaseRenderer *renderer) = 0; static void SetVtkMapperImmediateModeRendering(vtkMapper *mapper); virtual void MitkRenderOpaqueGeometry(mitk::BaseRenderer* renderer); virtual void MitkRenderTranslucentGeometry(mitk::BaseRenderer* renderer); virtual void MitkRenderOverlay(mitk::BaseRenderer* renderer); virtual void MitkRenderVolumetricGeometry(mitk::BaseRenderer* renderer); //##Documentation //## @brief Set the vtkTransform of the m_Prop3D for //## the current time step of \a renderer //## //## Called by mitk::VtkPropRenderer::Update before rendering //## virtual void UpdateVtkTransform(mitk::BaseRenderer *renderer); //##Documentation //## @brief Apply color and opacity read from the PropertyList virtual void ApplyProperties(vtkActor* actor, mitk::BaseRenderer* renderer); /** * \brief Release vtk-based graphics resources. Must be overwritten in * subclasses if vtkProps additional to m_Prop3D are used. */ virtual void ReleaseGraphicsResources(vtkWindow *renWin); /** \brief Returns true if this mapper owns the specified vtkProp for * the given BaseRenderer. * * Note: returns false by default; should be implemented for VTK-based * Mapper subclasses. */ virtual bool HasVtkProp( const vtkProp *prop, BaseRenderer *renderer ); /** * \brief Returns whether this is an vtk-based mapper */ virtual bool IsVtkBased() const { return true; } protected: VtkMapper3D(); virtual ~VtkMapper3D(); /** Checks whether the specified property is a AnnotationProperty and if yes, * adds it to m_LabelActorCollection (internal method). */ // virtual void CheckForAnnotationProperty( mitk::BaseProperty *property, BaseRenderer *renderer ); public: itkGetObjectMacro(Geometry,Geometry3D); itkSetObjectMacro(Geometry,Geometry3D); protected: Geometry3D::Pointer m_Geometry; LevelWindow m_LevelWindow; //vtkProp3D *m_Prop3D; //vtkProp3DCollection *m_LabelActorCollection; }; } // namespace mitk #endif /* BASEVTKMAPPER3D_H_HEADER_INCLUDED */ diff --git a/Core/Code/Rendering/mitkVtkPropRenderer.h b/Core/Code/Rendering/mitkVtkPropRenderer.h index 6333e5df51..ed0f05e192 100644 --- a/Core/Code/Rendering/mitkVtkPropRenderer.h +++ b/Core/Code/Rendering/mitkVtkPropRenderer.h @@ -1,187 +1,187 @@ /*========================================================================= Program: Medical Imaging & Interaction Toolkit Language: C++ Date: $Date: 2007-09-22 12:01:41 +0200 (Sa, 22 Sep 2007) $ Version: $Revision: 12241 $ Copyright (c) German Cancer Research Center, Division of Medical and Biological Informatics. All rights reserved. See MITKCopyright.txt or http://www.mitk.org/copyright.html for details. This software is distributed WITHOUT ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the above copyright notices for more information. =========================================================================*/ #ifndef MITKVtkPropRenderer_H_HEADER_INCLUDED_C1C29F6D #define MITKVtkPropRenderer_H_HEADER_INCLUDED_C1C29F6D -#include "mitkCommon.h" +#include #include "mitkBaseRenderer.h" #include "mitkDataStorage.h" #include "mitkRenderingManager.h" #include #include #include class vtkRenderWindow; class vtkLight; class vtkLightKit; class vtkWorldPointPicker; class vtkPointPicker; class vtkCellPicker; class vtkTextActor; class vtkTextProperty; class vtkAssemblyPath; namespace mitk { class Mapper; /*! \brief VtkPropRenderer VtkPropRenderer organizes the MITK rendering process. The MITK rendering process is completely integrated into the VTK rendering pipeline. The vtkMitkRenderProp is a custom vtkProp derived class, which implements the rendering interface between MITK and VTK. It redirects render() calls to the VtkPropRenderer, which is responsible for rendering of the datatreenodes. VtkPropRenderer replaces the old OpenGLRenderer. \sa rendering \ingroup rendering */ class MITK_CORE_EXPORT VtkPropRenderer : public BaseRenderer { // Workaround for Displaylistbug private: bool didCount; void checkState(); // Workaround END public: mitkClassMacro(VtkPropRenderer,BaseRenderer); mitkNewMacro3Param(VtkPropRenderer, const char*, vtkRenderWindow *, mitk::RenderingManager* ); typedef std::map MappersMapType; // Render - called by vtkMitkRenderProp, returns the number of props rendered enum RenderType{Opaque,Translucent,Overlay,Volumetric}; int Render(RenderType type); // Active current renderwindow virtual void MakeCurrent(); virtual void SetDataStorage( mitk::DataStorage* storage ); ///< set the datastorage that will be used for rendering virtual void InitRenderer(vtkRenderWindow* renderwindow); virtual void Update(mitk::DataNode* datatreenode); virtual void SetMapperID(const MapperSlotId mapperId); // Size virtual void InitSize(int w, int h); virtual void Resize(int w, int h); // Picking enum PickingMode{ WorldPointPicking, PointPicking }; itkSetEnumMacro( PickingMode, PickingMode ); itkGetEnumMacro( PickingMode, PickingMode ); virtual void PickWorldPoint(const Point2D& displayPoint, Point3D& worldPoint) const; virtual mitk::DataNode *PickObject( const Point2D &displayPosition, Point3D &worldPosition ) const; // Simple text rendering method int WriteSimpleText(std::string text, double posX, double posY, double color1 = 0.0, double color2 = 1.0, double color3 = 0.0); vtkTextProperty * GetTextLabelProperty(int text_id); // Initialization / geometry handling /** This method calculates the bounds of the DataStorage (if it contains any * valid data), creates a geometry from these bounds and sets it as world * geometry of the renderer. * * Call this method to re-initialize the renderer to the current DataStorage * (e.g. after loading an additional dataset), to ensure that the view is * aligned correctly. */ virtual bool SetWorldGeometryToDataStorageBounds(); /** * \brief Used by vtkPointPicker/vtkPicker. * This will query a list of all objects in MITK and provide every vtk based mapper to the picker. */ void InitPathTraversal(); /** * \brief Used by vtkPointPicker/vtkPicker. * This will query a list of all objects in MITK and provide every vtk based mapper to the picker. */ vtkAssemblyPath* GetNextPath(); const vtkWorldPointPicker *GetWorldPointPicker() const; const vtkPointPicker *GetPointPicker() const; const vtkCellPicker *GetCellPicker() const; /** * \brief Release vtk-based graphics resources. Called by * vtkMitkRenderProp::ReleaseGraphicsResources. */ virtual void ReleaseGraphicsResources(vtkWindow *renWin); MappersMapType GetMappersMap() const; static bool useImmediateModeRendering(); protected: VtkPropRenderer( const char* name = "VtkPropRenderer", vtkRenderWindow * renWin = NULL, mitk::RenderingManager* rm = NULL ); virtual ~VtkPropRenderer(); virtual void Update(); private: // switch between orthogonal opengl projection (2D rendering via mitk::GLMapper2D) and perspective projection (3D rendering) void Enable2DOpenGL(); void Disable2DOpenGL(); // prepare all mitk::mappers for rendering void PrepareMapperQueue(); bool m_InitNeeded; bool m_ResizeNeeded; bool m_VtkMapperPresent; bool m_NewRenderer; // Picking vtkWorldPointPicker * m_WorldPointPicker; vtkPointPicker * m_PointPicker; vtkCellPicker * m_CellPicker; PickingMode m_PickingMode; // Explicit use of SmartPointer to avoid circular #includes itk::SmartPointer< mitk::Mapper > m_CurrentWorldGeometry2DMapper; vtkLightKit* m_LightKit; // sorted list of mappers MappersMapType m_MappersMap; // rendering of text vtkRenderer * m_TextRenderer; typedef std::map TextMapType; TextMapType m_TextCollection; DataStorage::SetOfObjects::ConstPointer m_PickingObjects; DataStorage::SetOfObjects::const_iterator m_PickingObjectsIterator; }; } // namespace mitk #endif /* MITKVtkPropRenderer_H_HEADER_INCLUDED_C1C29F6D */ diff --git a/Core/Code/Rendering/vtkMitkRectangleProp.h b/Core/Code/Rendering/vtkMitkRectangleProp.h index 88975c3949..a5e25e9b35 100644 --- a/Core/Code/Rendering/vtkMitkRectangleProp.h +++ b/Core/Code/Rendering/vtkMitkRectangleProp.h @@ -1,57 +1,57 @@ /*========================================================================= Program: Medical Imaging & Interaction Toolkit Language: C++ Date: $Date: 2006-05-04 16:45:18 +0200 (Do, 04 Mai 2006) $ Version: $Revision: 6790 $ Copyright (c) German Cancer Research Center, Division of Medical and Biological Informatics. All rights reserved. See MITKCopyright.txt or http://www.mitk.org/copyright.html for details. This software is distributed WITHOUT ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the above copyright notices for more information. =========================================================================*/ #ifndef vtkMitkRectangleProp_H_HEADER_INCLUDED_C1C53723 #define vtkMitkRectangleProp_H_HEADER_INCLUDED_C1C53723 #include "vtkActor2D.h" #include "vtkRenderWindow.h" -#include "mitkCommon.h" +#include class MITK_CORE_EXPORT vtkMitkRectangleProp : public vtkProp { public: static vtkMitkRectangleProp* New(); vtkTypeMacro(vtkMitkRectangleProp,vtkProp); int RenderOpaqueGeometry(vtkViewport* viewport); int RenderTranslucentGeometry(vtkViewport* viewport); int RenderOverlay(vtkViewport* viewport); void SetRenderWindow(vtkRenderWindow* renWin); void SetColor(float col1, float col2, float col3); double* GetBounds(); protected: vtkMitkRectangleProp(); virtual ~vtkMitkRectangleProp(); void Enable2DOpenGL(); void Disable2DOpenGL(); vtkRenderWindow* m_RenderWindow; float m_Color[3]; }; #endif /* vtkMitkRectangleProp_H_HEADER_INCLUDED_C1C53723 */ diff --git a/Core/Code/Rendering/vtkMitkThickSlicesFilter.h b/Core/Code/Rendering/vtkMitkThickSlicesFilter.h index 0734b86a28..cf82b21a13 100644 --- a/Core/Code/Rendering/vtkMitkThickSlicesFilter.h +++ b/Core/Code/Rendering/vtkMitkThickSlicesFilter.h @@ -1,109 +1,109 @@ /*========================================================================= Program: Medical Imaging & Interaction Toolkit Language: C++ Date: $Date: 2009-07-14 19:11:20 +0200 (Tue, 14 Jul 2009) $ Version: $Revision: 18127 $ Copyright (c) German Cancer Research Center, Division of Medical and Biological Informatics. All rights reserved. See MITKCopyright.txt or http://www.mitk.org/copyright.html for details. This software is distributed WITHOUT ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the above copyright notices for more information. =========================================================================*/ // .NAME vtkMitkThickSlicesFilter - Computes the gradient vector. // .SECTION Description // vtkMitkThickSlicesFilter computes the gradient vector of an image. The // vector results are stored as scalar components. The Dimensionality // determines whether to perform a 2d or 3d gradient. The default is // two dimensional XY gradient. OutputScalarType is always // double. Gradient is computed using central differences. #ifndef __vtkMitkThickSlicesFilter_h #define __vtkMitkThickSlicesFilter_h -#include "mitkCommon.h" +#include #include "vtkThreadedImageAlgorithm.h" class MITK_CORE_EXPORT vtkMitkThickSlicesFilter : public vtkThreadedImageAlgorithm { public: static vtkMitkThickSlicesFilter *New(); vtkTypeRevisionMacro(vtkMitkThickSlicesFilter,vtkThreadedImageAlgorithm); void PrintSelf(ostream& os, vtkIndent indent); // Description: // Determines how the input is interpreted (set of 2d slices ...) vtkSetClampMacro(Dimensionality,int,2,3); vtkGetMacro(Dimensionality,int); // Description: // Get/Set whether to handle boundaries. If enabled, boundary // pixels are treated as duplicated so that central differencing // works for the boundary pixels. If disabled, the output whole // extent of the image is reduced by one pixel. vtkSetMacro(HandleBoundaries, int); vtkGetMacro(HandleBoundaries, int); vtkBooleanMacro(HandleBoundaries, int); enum { MIP=0, SUM, WEIGHTED }; protected: vtkMitkThickSlicesFilter(); ~vtkMitkThickSlicesFilter() {}; int HandleBoundaries; int Dimensionality; virtual int RequestInformation (vtkInformation*, vtkInformationVector**, vtkInformationVector*); virtual int RequestUpdateExtent(vtkInformation*, vtkInformationVector**, vtkInformationVector*); virtual int RequestData(vtkInformation*, vtkInformationVector**, vtkInformationVector*); void ThreadedRequestData(vtkInformation*, vtkInformationVector**, vtkInformationVector*, vtkImageData*** inData, vtkImageData** outData, int outExt[6], int threadId); int m_CurrentMode; private: vtkMitkThickSlicesFilter(const vtkMitkThickSlicesFilter&); // Not implemented. void operator=(const vtkMitkThickSlicesFilter&); // Not implemented. public: void SetThickSliceMode( int mode) { m_CurrentMode = mode; } int GetThickSliceMode() { return m_CurrentMode; } }; #endif diff --git a/CoreUI/Qmitk/CMakeLists.txt b/CoreUI/Qmitk/CMakeLists.txt index 5175d635f4..fc028ccf7b 100644 --- a/CoreUI/Qmitk/CMakeLists.txt +++ b/CoreUI/Qmitk/CMakeLists.txt @@ -1,7 +1,8 @@ MITK_CREATE_MODULE( Qmitk DEPENDS Mitk PACKAGE_DEPENDS QT QVTK SUBPROJECTS MITK-CoreUI + EXPORT_DEFINE QMITK_EXPORT QT_MODULE ) diff --git a/CoreUI/Qmitk/QmitkApplicationCursor.h b/CoreUI/Qmitk/QmitkApplicationCursor.h index 5ef1bc6580..2a34f77784 100644 --- a/CoreUI/Qmitk/QmitkApplicationCursor.h +++ b/CoreUI/Qmitk/QmitkApplicationCursor.h @@ -1,47 +1,48 @@ /*========================================================================= Program: Medical Imaging & Interaction Toolkit Language: C++ Date: $Date$ Version: $Revision$ Copyright (c) German Cancer Research Center, Division of Medical and Biological Informatics. All rights reserved. See MITKCopyright.txt or http://www.mitk.org/copyright.html for details. This software is distributed WITHOUT ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the above copyright notices for more information. =========================================================================*/ #ifndef QMITK_APPLICATION_CURSOR_H_INCLUDED #define QMITK_APPLICATION_CURSOR_H_INCLUDED +#include #include "mitkApplicationCursor.h" /*! \brief Qt specific implementation of ApplicationCursorImplementation This class very simply calls the QApplication's methods setOverrideCursor() and restoreOverrideCursor(). */ class QMITK_EXPORT QmitkApplicationCursor : public mitk::ApplicationCursorImplementation { public: // Will be instantiated automatically from QmitkApplicationCursor.cpp once QmitkApplicationCursor(); virtual void PushCursor(const char* XPM[], int hotspotX, int hotspotY); virtual void PopCursor(); virtual const mitk::Point2I GetCursorPosition(); virtual void SetCursorPosition(const mitk::Point2I&); protected: private: }; #endif diff --git a/CoreUI/Qmitk/QmitkDataStorageComboBox.h b/CoreUI/Qmitk/QmitkDataStorageComboBox.h index 579b4cb163..d056311bab 100644 --- a/CoreUI/Qmitk/QmitkDataStorageComboBox.h +++ b/CoreUI/Qmitk/QmitkDataStorageComboBox.h @@ -1,240 +1,242 @@ /*========================================================================= Program: Medical Imaging & Interaction Toolkit Language: C++ Date: $Date$ Version: $Revision: 18127 $ Copyright (c) German Cancer Research Center, Division of Medical and Biological Informatics. All rights reserved. See MITKCopyright.txt or http://www.mitk.org/copyright.html for details. This software is distributed WITHOUT ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the above copyright notices for more information. =========================================================================*/ #ifndef QmitkDataStorageComboBox_h #define QmitkDataStorageComboBox_h +#include + // Own Includes #include "mitkDataStorage.h" #include "mitkDataNode.h" #include "mitkWeakPointer.h" #include "mitkNodePredicateBase.h" // Toolkit Includes #include #include // Forward Declartions /// /// \class QmitkDataStorageComboBox /// \author Michael Mueller /// \version 4.0 /// \date 2009-02-09 /// \ingroup Widgets /// \brief Displays all or a subset (defined by a predicate) of nodes of the Data Storage. /// /// Dont forget that this class inherits from QComboBox and you can therefore use the whole API of QComboBox. /// class QMITK_EXPORT QmitkDataStorageComboBox : public QComboBox { //#CLASS-MACROS,FRIENDS Q_OBJECT //#CTORS/DTOR public: /// /// \brief Ctor for an empty combobox. Use setDataStorage and setPredicate afterwards. /// QmitkDataStorageComboBox(QWidget* parent = 0, bool _AutoSelectNewNodes=false); /// /// \brief Ctor for constructing QmitkDataStorageComboBox with given DataStorageComboBox and given _Predicate. /// QmitkDataStorageComboBox( mitk::DataStorage* _DataStorage, const mitk::NodePredicateBase* _Predicate, QWidget* parent = 0, bool _AutoSelectNewNodes=false); /// /// \brief Standard Dtor. Nothing to do here. /// ~QmitkDataStorageComboBox(); /// /// \brief Seaches for a given node and returns a valid index or -1 if the node was not found. /// int Find( const mitk::DataNode* _DataNode ) const; //#PUBLIC GETTER public: /// /// \brief Get the DataStorage this ComboBox listens to. /// mitk::DataStorage::Pointer GetDataStorage() const; /// /// \brief Return the predicate (may be NULL) that is responsible for the _DataNode selection of this ComboBox. /// const mitk::NodePredicateBase::ConstPointer GetPredicate() const; /// /// \brief Returns the _DataNode at Index index or 0 if the index is out of bounds. /// mitk::DataNode::Pointer GetNode(int index) const; /// /// \brief Returns the selected _DataNode or 0 if there is none. /// mitk::DataNode::Pointer GetSelectedNode() const; /// /// \brief Returns all nodes that are stored in this combobox. /// mitk::DataStorage::SetOfObjects::ConstPointer GetNodes() const; /// /// Returns the AutoSelectNewItems. /// \see SetAutoSelectNewItems /// virtual bool GetAutoSelectNewItems(); //#PUBLIC SETTER public: /// /// \brief Set the DataStorage this ComboBox should listen to. /// /// If DataStorage is 0 nothing will be shown. If DataStorage is re-set the combobox will be resetted. void SetDataStorage(mitk::DataStorage* dataStorage); /// /// \brief Set the predicate for this ComboBox. (QmitkDataStorageComboBox is now owner of the predicate) /// /// If predicate is NULL all nodes will be selected. If predicate changes the whole combobox will be resetted. void SetPredicate(const mitk::NodePredicateBase* _Predicate); /// /// Adds a node to the ComboBox. Gets called everytime a DataStorage Add Event was thrown. /// virtual void AddNode(const mitk::DataNode* _DataNode); /// /// Removes a node from the ComboBox at a specified index (if the index exists). Gets called when a DataStorage Remove Event was thrown. /// virtual void RemoveNode(int index); /// /// Removes a node from the ComboBox. Gets called when a DataStorage Remove Event was thrown. /// virtual void RemoveNode(const mitk::DataNode* _DataNode); /// /// Set a _DataNode in the ComboBox at the specified index (if the index exists). /// Internally the method just calls RemoveNode(unsigned int) /// virtual void SetNode(int index, const mitk::DataNode* _DataNode); /// /// Replaces a _DataNode in the combobox by an _OtherDataNode. /// Internally the method just calls SetNode(unsigned int, mitk::DataNode*) /// virtual void SetNode(const mitk::DataNode* _DataNode, const mitk::DataNode* _OtherDataNode); /// /// Sets AutoSelectNewItems flag. If set to true new Nodes will be automatically selected. Default is false. /// virtual void SetAutoSelectNewItems(bool _AutoSelectNewItems); /// /// \brief Called when a node is deleted or the name property of the node was modified. Calls RemoveNode or SetNode then. /// virtual void OnDataNodeDeleteOrModified(const itk::Object *caller, const itk::EventObject &event); signals: /// /// \brief Throw a signal when the _DataNode selection changed. /// void OnSelectionChanged(const mitk::DataNode*); //#PROTECTED GETTER protected: /// /// \brief Checks if the given index is within the range of the m_Nodes vector. /// bool HasIndex(unsigned int index) const; //#PROTECTED SETTER protected slots: /// /// \brief Slot for signal when the user selects another item. /// void OnCurrentIndexChanged(int); //#PUBLIC SETTER public slots: /// /// \brief Slot for signal when user wants to set a node as current selected node. /// void SetSelectedNode(mitk::DataNode::Pointer item); protected: /// /// \brief Inserts a new node at the given index. If the index does not exist, the _DataNode is simply appended to the combobox. /// /// This function is used by AddNode() and SetNode() because they just to the same: /// 1. If node is replaced (that is when index exists), /// the itk::Event observer will be removed /// 2. Check Node against Predicate /// 3. Register for itk::Events on the node /// 4. Insert Node and show in combobox virtual void InsertNode(int index, const mitk::DataNode* _DataNode); /// /// \brief Init-function this class with the given dataStorage and _Predicate. This function is called by all ctors. /// void Init(); /// /// \brief Reset function whenever datastorage or predicate changes. /// void Reset(); protected: //#PROTECTED MEMBER VARS /// /// Pointer to the DataStorage from which the nodes are selected (remember: in BlueBerry there /// might be more than one DataStorage). /// mitk::WeakPointer m_DataStorage; /// /// \brief Holds the predicate that is responsible for the _DataNode selection of this ComboBox. /// If the predicate is 0, every _DataNode will be selected. /// mitk::NodePredicateBase::ConstPointer m_Predicate; /// /// Holds all selected Nodes. Dont hold smart pointer as we are in a GUI class. /// std::vector m_Nodes; /// /// \brief Holds the tags of the node-modified observers. (must be updated everytime m_Nodes changes) /// std::vector m_NodesModifiedObserverTags; /// /// \brief Holds the tags of the node-modified observers. (must be updated everytime m_Nodes changes) /// std::vector m_NodesDeleteObserverTags; /// /// \brief Maps a a specific node to (Name-)property. This is needed because we have to find the assiociated node /// whenever the name property of a node changed. /// std::map m_PropertyToNode; /// /// \brief Event function guard. Each function which is called by an event mechanism /// first checks if this is true in order to avoid endless loops. bool m_BlockEvents; /// /// \brief If set to "true" new Nodes will be automatically selected. bool m_AutoSelectNewNodes; }; #endif // QmitkDataStorageComboBox_h diff --git a/CoreUI/Qmitk/QmitkDataStorageListModel.h b/CoreUI/Qmitk/QmitkDataStorageListModel.h index 5f688357e6..a5d78ec61e 100755 --- a/CoreUI/Qmitk/QmitkDataStorageListModel.h +++ b/CoreUI/Qmitk/QmitkDataStorageListModel.h @@ -1,125 +1,126 @@ /*========================================================================= Program: MITK Language: C++ Date: $Date$ Version: $Revision$ Copyright (c) German Cancer Research Center, Division of Medical and Biological Informatics. All rights reserved. See MITKCopyright.txt or http://www.mitk.org/copyright.html for details. This software is distributed WITHOUT ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the above copyright notices for more information. =========================================================================*/ #ifndef QMITKDATASTORAGELISTMODEL_H_ #define QMITKDATASTORAGELISTMODEL_H_ +#include + //# Own includes // mitk #include "mitkDataStorage.h" #include "mitkNodePredicateBase.h" -#include "mitkCommon.h" // Qmitk //# Toolkit includes // Qt #include // stl #include class QMITK_EXPORT QmitkDataStorageListModel: public QAbstractListModel { public: //# Ctors / Dtor /// /// The NodePredicate is owned by the model /// QmitkDataStorageListModel(mitk::DataStorage::Pointer dataStorage = 0, mitk::NodePredicateBase* pred = 0, QObject* parent = 0); ~QmitkDataStorageListModel(); //# Getter / Setter void SetDataStorage(mitk::DataStorage::Pointer dataStorage); mitk::DataStorage::Pointer GetDataStorage() const; void SetPredicate(mitk::NodePredicateBase* pred); mitk::NodePredicateBase* GetPredicate() const; std::vector GetDataNodes() const; mitk::DataNode::Pointer getNode(const QModelIndex &index) const; //# From QAbstractListModel Qt::ItemFlags flags(const QModelIndex& index) const; QVariant data(const QModelIndex& index, int role = Qt::DisplayRole) const; QVariant headerData(int section, Qt::Orientation orientation, int role = Qt::DisplayRole) const; int rowCount(const QModelIndex& parent = QModelIndex()) const; /// /// Called when a DataStorage Add Event was thrown. May be reimplemented /// by deriving classes. /// virtual void NodeAdded(const mitk::DataNode* node); /// /// Called when a DataStorage Remove Event was thrown. May be reimplemented /// by deriving classes. /// virtual void NodeRemoved(const mitk::DataNode* node); /// /// \brief Called when a itk::Object that is hold as a member variable was /// modified in order to react to it. /// virtual void OnModified(const itk::Object *caller, const itk::EventObject &event); /// /// \brief Called when a itk::Object that is hold as a member variable is about to be /// deleted in order to react to it. /// virtual void OnDelete(const itk::Object *caller, const itk::EventObject &event); protected: /// /// \brief Resets the whole model. Get all nodes matching the predicate from the data storage. /// void reset(); /// /// Holds the predicate that defines this SubSet of Nodes. If m_Predicate /// is NULL all Nodes will be selected. *Attention: this class owns the predicate and deletes it* /// mitk::NodePredicateBase::Pointer m_NodePredicate; /// /// Pointer to the DataStorage from which the nodes are selected (remember: in BlueBerry there /// might be more than one DataStorage). /// mitk::DataStorage* m_DataStorage; /// /// \brief Holds the tag of the datastorage-delete observer. /// unsigned long m_DataStorageDeleteObserverTag; /// /// Holds all selected Nodes. Dont hold smart pointer as we are in a GUI class. /// std::vector m_DataNodes; /// /// \brief Holds the tags of the node-modified observers. /// std::vector m_DataNodesModifiedObserversTags; /// /// Saves if this model is currently working on events to prevent endless event loops. /// bool m_BlockEvents; }; #endif /* QMITKDATASTORAGELISTMODEL_H_ */ diff --git a/CoreUI/Qmitk/QmitkDataStorageTableModel.h b/CoreUI/Qmitk/QmitkDataStorageTableModel.h index b0b570c44b..1ad244aac3 100644 --- a/CoreUI/Qmitk/QmitkDataStorageTableModel.h +++ b/CoreUI/Qmitk/QmitkDataStorageTableModel.h @@ -1,227 +1,229 @@ /*========================================================================= Program: Medical Imaging & Interaction Toolkit Language: C++ Date: $Date$ Version: $Revision: 18127 $ Copyright (c) German Cancer Research Center, Division of Medical and Biological Informatics. All rights reserved. See MITKCopyright.txt or http://www.mitk.org/copyright.html for details. This software is distributed WITHOUT ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the above copyright notices for more information. =========================================================================*/ #ifndef QmitkDataStorageTableModel_h #define QmitkDataStorageTableModel_h +#include + /// Own includes. #include "mitkDataStorage.h" #include "mitkBaseProperty.h" #include "mitkWeakPointer.h" #include "mitkNodePredicateBase.h" /// Toolkit includes. #include /// Forward declarations. /// /// \class QmitkDataStorageTableModel /// /// \brief A table model for a set of DataNodes defined by a predicate. /// \TODO make columns interchangeable, select which properties to show as columns /// class QMITK_EXPORT QmitkDataStorageTableModel : public QAbstractTableModel { Q_OBJECT //#Ctors/Dtor public: /// /// Constructs a new QmitkDataStorageTableModel and sets a predicate that defines /// this list. /// \see setPredicate() /// QmitkDataStorageTableModel(mitk::DataStorage::Pointer _DataStorage, mitk::NodePredicateBase* _Predicate = 0 , QObject* parent = 0 ); /// /// Standard dtor. Delete predicate, disconnect from DataStorage. /// virtual ~QmitkDataStorageTableModel(); //# Public GETTER public: /// /// Get the DataStorage. /// const mitk::DataStorage::Pointer GetDataStorage() const; /// /// Get the predicate. /// mitk::NodePredicateBase::Pointer GetPredicate() const; /// /// Get node at a specific model index. Another way to implement this, is /// by introducing a new role like "DateTreeNode" and capture /// that in the data function. /// mitk::DataNode::Pointer GetNode(const QModelIndex &index) const; /// /// Overridden from QAbstractTableModel. Returns the header data at section /// for given orientation and role. /// virtual QVariant headerData(int section, Qt::Orientation orientation, int role) const; /// /// Overridden from QAbstractTableModel. Returns what can be done /// with an item. /// virtual Qt::ItemFlags flags(const QModelIndex &index) const; /// /// Overridden from QAbstractTableModel. Returns the node count. /// virtual int rowCount(const QModelIndex &parent) const; /// /// Overridden from QAbstractTableModel. Returns the number of features (columns) to display. /// virtual int columnCount(const QModelIndex &parent) const; /// /// Overridden from QAbstractTableModel. Returns the data at index for given role. /// virtual QVariant data(const QModelIndex &index, int role) const; //# Public SETTERS public: /// /// Sets the DataStorage. /// void SetDataStorage(mitk::DataStorage::Pointer _DataStorage); /// /// Sets the predicate. QmitkDataStorageTableModel is owner of the predicate! /// void SetPredicate(mitk::NodePredicateBase* _Predicate); /// /// Adds a node to this model. /// There are two constraints for nodes in this model: /// 1. If a predicate is set (not null) the node will be checked against it. /// 2. The node has to have a data object (no one wants to see empty nodes). /// Also adds event listeners to the node. /// virtual void AddNode(const mitk::DataNode* node); /// /// Removes a node from this model. Also removes any event listener from the node. /// virtual void RemoveNode(const mitk::DataNode* node); /// /// Returns a copy of the node-vector that is shown by this model /// virtual std::vector GetNodeSet() const; /// /// \brief Called when a single property was changed. /// The function searches through the list of nodes in this model for the changed /// property. If the property was found a dataChanged signal is emitted forcing /// all observing views to request the data again. /// virtual void PropertyModified(const itk::Object *caller, const itk::EventObject &event); /// /// Overridden from QAbstractTableModel. Sets data at index for given role. /// bool setData(const QModelIndex &index, const QVariant &value, int role); /// /// \brief Reimplemented sort function from QAbstractTableModel to enable sorting on the table. /// void sort ( int column, Qt::SortOrder order = Qt::AscendingOrder ); //#PROTECTED INNER CLASSES protected: /// /// \struct DataNodeCompareFunction /// \brief A struct that inherits from std::binary_function. You can use it in std::sort algorithm for sorting the node list elements. /// struct DataNodeCompareFunction : public std::binary_function { /// /// \brief Specifies field of the property with which it will be sorted. /// enum CompareCriteria { CompareByName = 0, CompareByClassName, CompareByVisibility }; /// /// \brief Specifies Ascending/descending ordering. /// enum CompareOperator { Less = 0, Greater }; /// /// \brief Creates a PropertyDataSetCompareFunction. A CompareCriteria and a CompareOperator must be given. /// DataNodeCompareFunction(CompareCriteria _CompareCriteria = CompareByName, CompareOperator _CompareOperator = Less); /// /// \brief The reimplemented compare function. /// bool operator()(const mitk::DataNode::Pointer& _Left , const mitk::DataNode::Pointer& _Right) const; protected: CompareCriteria m_CompareCriteria; CompareOperator m_CompareOperator; }; //#Protected SETTER protected: /// /// Called when DataStorage or Predicate changed. Resets whole model and reads all nodes /// in again. /// virtual void Reset(); //#Protected MEMBER VARIABLES protected: /// /// Pointer to the DataStorage from which the nodes are selected (remember: in BlueBerry there /// might be more than one DataStorage). /// Store it in a weak pointer. This is a GUI class which should not hold a strong reference /// to any non-GUI Object. /// mitk::WeakPointer m_DataStorage; /// /// Holds the predicate that defines this SubSet of Nodes. If m_Predicate /// is NULL all Nodes will be selected. /// mitk::NodePredicateBase::Pointer m_Predicate; /// /// Holds all selected Nodes. /// std::vector m_NodeSet; /// /// \brief Maps a property to an observer tag. /// std::map m_NamePropertyModifiedObserverTags; /// /// \brief Maps a property to an observer tag. /// std::map m_VisiblePropertyModifiedObserverTags; /// /// Saves if this model is currently working on events to prevent endless event loops. /// bool m_BlockEvents; /// /// \brief The property is true when the property list is sorted in descending order. /// bool m_SortDescending; }; #endif diff --git a/CoreUI/Qmitk/QmitkDataStorageTreeModel.h b/CoreUI/Qmitk/QmitkDataStorageTreeModel.h index dc5d6a32bd..1782e74923 100644 --- a/CoreUI/Qmitk/QmitkDataStorageTreeModel.h +++ b/CoreUI/Qmitk/QmitkDataStorageTreeModel.h @@ -1,279 +1,281 @@ /*========================================================================= Program: MITK Language: C++ Date: $Date: 2008-08-13 16:56:36 +0200 (Mi, 13 Aug 2008) $ Version: $Revision: 14972 $ Copyright (c) German Cancer Research Center, Division of Medical and Biological Informatics. All rights reserved. See MITKCopyright.txt or http://www.mitk.org/copyright.html for details. This software is distributed WITHOUT ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the above copyright notices for more information. =========================================================================*/ #ifndef QMITKDATASTORAGETREEMODEL_H_ #define QMITKDATASTORAGETREEMODEL_H_ +#include + #include #include #include #include #include "QmitkEnums.h" #include "QmitkCustomVariants.h" #include #include #include class QMITK_EXPORT QmitkDataStorageTreeModel : public QAbstractItemModel { //# CONSTANTS,TYPEDEFS public: static const std::string COLUMN_NAME; static const std::string COLUMN_TYPE; static const std::string COLUMN_VISIBILITY; //# CTORS,DTOR public: QmitkDataStorageTreeModel(mitk::DataStorage* _DataStorage , bool _PlaceNewNodesOnTop=false , bool _ShowHelperObjects=false , bool _ShowNodesContainingNoData=false , QObject* parent = 0); ~QmitkDataStorageTreeModel(); //# GETTER public: /// /// Get node at a specific model index. /// This function is used to get a node from a QModelIndex /// mitk::DataNode::Pointer GetNode(const QModelIndex &index) const; /// /// Returns a copy of the node-vector that is shown by this model /// virtual std::vector GetNodeSet() const; /// /// Get the DataStorage. /// const mitk::DataStorage::Pointer GetDataStorage() const; /// /// Get the top placement flag /// bool GetPlaceNewNodesOnTopFlag() { return m_PlaceNewNodesOnTop; } /// /// Get the helper object visibility flag /// bool GetShowHelperObjectsFlag() { return m_ShowHelperObjects; } /// /// Get the visibility flag for showing nodes that contain no data /// bool GetShowNodesContainingNoDataFlag() { return m_ShowNodesContainingNoData; } /// /// Set the top placement flag /// void SetPlaceNewNodesOnTop(bool _PlaceNewNodesOnTop); //# (Re-)implemented from QAbstractItemModel //# Read model Qt::ItemFlags flags(const QModelIndex& index) const; QVariant data ( const QModelIndex & index, int role = Qt::DisplayRole ) const; QVariant headerData(int section, Qt::Orientation orientation, int role = Qt::DisplayRole) const; int rowCount ( const QModelIndex & parent = QModelIndex() ) const; int columnCount ( const QModelIndex & parent = QModelIndex() ) const; //# hierarchical model /// /// called whenever the model or the view needs to create a QModelIndex for a particular /// child item (or a top-level item if parent is an invalid QModelIndex) /// QModelIndex index ( int row, int column, const QModelIndex & parent = QModelIndex() ) const; QModelIndex parent ( const QModelIndex & index ) const; //# editable model bool setData(const QModelIndex &index, const QVariant &value, int role = Qt::EditRole); bool setHeaderData(int section, Qt::Orientation orientation, const QVariant &value, int role = Qt::EditRole); bool dropMimeData(const QMimeData *data, Qt::DropAction action, int row, int column, const QModelIndex &parent); Qt::DropActions supportedDropActions() const; Qt::DropActions supportedDragActions() const; QStringList mimeTypes() const; QMimeData * mimeData(const QModelIndexList & indexes) const; //# End of QAbstractItemModel //# SETTER public: /// /// Sets the DataStorage. The whole model will be resetted. /// void SetDataStorage(mitk::DataStorage* _DataStorage); /// /// Notify that the DataStorage was deleted. The whole model will be resetted. /// void SetDataStorageDeleted(const itk::Object* _DataStorage); /// /// Adds a node to this model. /// If a predicate is set (not null) the node will be checked against it.The node has to have a data object (no one wants to see empty nodes). /// virtual void AddNode(const mitk::DataNode* node); /// /// Removes a node from this model. Also removes any event listener from the node. /// virtual void RemoveNode(const mitk::DataNode* node); /// /// Sets a node to modfified. Called by the DataStorage /// virtual void SetNodeModified(const mitk::DataNode* node); /// /// \return an index for the given datatreenode in the tree. If the node is not found /// QModelIndex GetIndex(const mitk::DataNode*) const; /// /// Show or hide helper objects /// void SetShowHelperObjects(bool _ShowHelperObjects); /// /// Show or hide objects that contain no data /// void SetShowNodesContainingNoData(bool _ShowNodesContainingNoData); /// /// Update the visibility of data nodes according to the preference settings /// void UpdateNodeVisibility(); //# MISC protected: /// /// Helper class to represent a tree structure of DataNodes /// class TreeItem { public: /// /// Constructs a new TreeItem with the given DataNode (must not be 0) /// TreeItem(mitk::DataNode* _DataNode, TreeItem* _Parent=0); /// /// Removes itself as child from its parent-> Does not delete its children /// \sa Delete() /// virtual ~TreeItem(); /// /// Find the index of an item /// int IndexOfChild(const TreeItem* item) const; /// /// \child The child at pos index or 0 if it not exists /// TreeItem* GetChild(int index) const; /// /// Find the TreeItem containing a special tree node (recursive tree function) /// TreeItem* Find( const mitk::DataNode* _DataNode) const; /// /// Get the amount of children /// int GetChildCount() const; /// /// \return the index of this node in its parent list /// int GetIndex() const; /// /// \return the parent of this tree item /// TreeItem* GetParent() const; /// /// Return the DataNode associated with this node /// mitk::DataNode::Pointer GetDataNode() const; /// /// Get all children as vector /// std::vector GetChildren() const; /// /// add another item as a child of this (only if not already in that list) /// void AddChild( TreeItem* item); /// /// remove another item as child from this /// void RemoveChild( TreeItem* item); /// /// inserts a child at the given position. if pos is not in range /// the element is added at the end /// void InsertChild( TreeItem* item, int index=-1 ); /// Sets the parent on the treeitem void SetParent(TreeItem* _Parent); /// /// Deletes the whole tree branch /// void Delete(); protected: TreeItem* m_Parent; std::vector m_Children; mitk::DataNode::Pointer m_DataNode; }; /// /// Adjusts the LayerProperty according to the nodes position /// void AdjustLayerProperty(); /// /// invoked after m_DataStorage or m_Predicate changed /// TreeItem* TreeItemFromIndex(const QModelIndex &index) const; /// /// Gives a ModelIndex for the Tree Item /// QModelIndex IndexFromTreeItem(TreeItem*) const; /// /// Returns the first element in the nodes sources list (if available) or 0 /// mitk::DataNode* GetParentNode(const mitk::DataNode* node) const; /// /// Adds all Childs in parent to vec. Before a child is added the function is called recursively /// void TreeToVector(TreeItem* parent, std::vector& vec) const; /// /// Adds all Childs in parent to vec. Before a child is added the function is called recursively /// void TreeToNodeSet(TreeItem* parent, std::vector& vec) const; /// /// Update Tree Model according to predicates /// void Update(); //# ATTRIBUTES protected: mitk::WeakPointer m_DataStorage; mitk::NodePredicateBase::Pointer m_Predicate; bool m_PlaceNewNodesOnTop; bool m_ShowHelperObjects; bool m_ShowNodesContainingNoData; TreeItem* m_Root; }; #endif /* QMITKDATASTORAGETREEMODEL_H_ */ diff --git a/CoreUI/Qmitk/QmitkEventAdapter.h b/CoreUI/Qmitk/QmitkEventAdapter.h index 00263fb8f2..7e804db9f2 100644 --- a/CoreUI/Qmitk/QmitkEventAdapter.h +++ b/CoreUI/Qmitk/QmitkEventAdapter.h @@ -1,36 +1,38 @@ /*========================================================================= Program: Medical Imaging & Interaction Toolkit Language: C++ Date: $Date$ Version: $Revision$ Copyright (c) German Cancer Research Center, Division of Medical and Biological Informatics. All rights reserved. See MITKCopyright.txt or http://www.mitk.org/copyright.html for details. This software is distributed WITHOUT ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the above copyright notices for more information. =========================================================================*/ #ifndef QMITKEVENTADAPTER_H_ #define QMITKEVENTADAPTER_H_ +#include + #include #include #include #include #include class QMITK_EXPORT QmitkEventAdapter { public: static mitk::MouseEvent AdaptMouseEvent(mitk::BaseRenderer* sender, QMouseEvent* mouseEvent); static mitk::WheelEvent AdaptWheelEvent(mitk::BaseRenderer* sender, QWheelEvent* wheelEvent); static mitk::KeyEvent AdaptKeyEvent(mitk::BaseRenderer* sender, QKeyEvent* keyEvent, const QPoint& point); }; #endif /*QMITKEVENTADAPTER_H_*/ diff --git a/CoreUI/Qmitk/QmitkLevelWindowPresetDefinitionDialog.h b/CoreUI/Qmitk/QmitkLevelWindowPresetDefinitionDialog.h index f6fe3fc952..a22f40e34c 100644 --- a/CoreUI/Qmitk/QmitkLevelWindowPresetDefinitionDialog.h +++ b/CoreUI/Qmitk/QmitkLevelWindowPresetDefinitionDialog.h @@ -1,108 +1,108 @@ /*========================================================================= Program: Medical Imaging & Interaction Toolkit Language: C++ Date: $Date$ Version: $Revision$ Copyright (c) German Cancer Research Center, Division of Medical and Biological Informatics. All rights reserved. See MITKCopyright.txt or http://www.mitk.org/copyright.html for details. This software is distributed WITHOUT ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the above copyright notices for more information. =========================================================================*/ #ifndef QMITKLEVELWINDOWPRESETDEFINITIONDIALOG_H_ #define QMITKLEVELWINDOWPRESETDEFINITIONDIALOG_H_ +#include + #include "ui_QmitkLevelWindowPresetDefinition.h" #include #include #include #include -#include - class QMITK_EXPORT QmitkLevelWindowPresetDefinitionDialog : public QDialog, public Ui::QmitkLevelWindowPresetDefinition { Q_OBJECT public: QmitkLevelWindowPresetDefinitionDialog(QWidget* parent = 0, Qt::WindowFlags f = 0); ~QmitkLevelWindowPresetDefinitionDialog(); void setPresets(std::map& level, std::map& window, QString initLevel, QString initWindow); std::map getLevelPresets(); std::map getWindowPresets(); protected slots: void addPreset(); void removePreset(); void changePreset(); void ListViewSelectionChanged(const QItemSelection&, const QItemSelection&); void sortPresets(int index); protected: class PresetTableModel : public QAbstractTableModel { public: struct Entry { std::string name; double level; double window; Entry(const std::string& n, double l, double w) : name(n), level(l), window(w) {} }; PresetTableModel(std::map& levels, std::map& windows, QObject* parent = 0); int rowCount(const QModelIndex&) const; int columnCount(const QModelIndex&) const; QVariant data(const QModelIndex& index, int) const; QVariant headerData(int section, Qt::Orientation orientation, int) const; void addPreset(std::string& name, double level, double window); void removePreset(const QModelIndex&); void changePreset(int row, std::string& name, double level, double window); void getLevels(std::map& levels); void getWindows(std::map& windows); bool contains(std::string& name); Entry getPreset(const QModelIndex&) const; private: std::vector m_Entries; }; void resizeEvent(QResizeEvent* event); void showEvent(QShowEvent* event); void resizeColumns(); PresetTableModel* m_TableModel; QSortFilterProxyModel m_SortModel; }; #endif /*QMITKLEVELWINDOWPRESETDEFINITIONDIALOG_H_*/ diff --git a/CoreUI/Qmitk/QmitkLevelWindowRangeChangeDialog.h b/CoreUI/Qmitk/QmitkLevelWindowRangeChangeDialog.h index 421ccffbd4..180ed92806 100644 --- a/CoreUI/Qmitk/QmitkLevelWindowRangeChangeDialog.h +++ b/CoreUI/Qmitk/QmitkLevelWindowRangeChangeDialog.h @@ -1,49 +1,49 @@ /*========================================================================= Program: Medical Imaging & Interaction Toolkit Language: C++ Date: $Date$ Version: $Revision$ Copyright (c) German Cancer Research Center, Division of Medical and Biological Informatics. All rights reserved. See MITKCopyright.txt or http://www.mitk.org/copyright.html for details. This software is distributed WITHOUT ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the above copyright notices for more information. =========================================================================*/ #ifndef QMITKLEVELWINDOWRANGECHANGEDIALOG_H_ #define QMITKLEVELWINDOWRANGECHANGEDIALOG_H_ +#include + #include "ui_QmitkLevelWindowRangeChange.h" #include -#include - class QMITK_EXPORT QmitkLevelWindowRangeChangeDialog : public QDialog, public Ui::QmitkLevelWindowRangeChange { Q_OBJECT public: QmitkLevelWindowRangeChangeDialog(QWidget* parent = 0, Qt::WindowFlags f = 0); int getLowerLimit(); int getUpperLimit(); void setLowerLimit( int rangeMin ); void setUpperLimit( int rangeMax ); protected slots: void inputValidator(); }; #endif /*QMITKLEVELWINDOWRANGECHANGEDIALOG_H_*/ diff --git a/CoreUI/Qmitk/QmitkLevelWindowWidget.h b/CoreUI/Qmitk/QmitkLevelWindowWidget.h index cddd2be533..33e667db63 100644 --- a/CoreUI/Qmitk/QmitkLevelWindowWidget.h +++ b/CoreUI/Qmitk/QmitkLevelWindowWidget.h @@ -1,39 +1,41 @@ /*========================================================================= Program: Medical Imaging & Interaction Toolkit Language: C++ Date: $Date$ Version: $Revision$ Copyright (c) German Cancer Research Center, Division of Medical and Biological Informatics. All rights reserved. See MITKCopyright.txt or http://www.mitk.org/copyright.html for details. This software is distributed WITHOUT ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the above copyright notices for more information. =========================================================================*/ #ifndef QMITKLEVELWINDOWWIDGET_H_ #define QMITKLEVELWINDOWWIDGET_H_ +#include + #include "ui_QmitkLevelWindowWidget.h" #include class QMITK_EXPORT QmitkLevelWindowWidget : public QWidget, public Ui::QmitkLevelWindow { Q_OBJECT public: QmitkLevelWindowWidget(QWidget* parent = 0, Qt::WindowFlags f = 0); mitk::LevelWindowManager* GetManager(); public slots: void SetDataStorage( mitk::DataStorage* ds ); protected: //unsigned long m_ObserverTag; mitk::LevelWindowManager::Pointer m_Manager; }; #endif /*QMITKLEVELWINDOWWIDGET_H_*/ diff --git a/CoreUI/Qmitk/QmitkLevelWindowWidgetContextMenu.h b/CoreUI/Qmitk/QmitkLevelWindowWidgetContextMenu.h index facd80da1b..1071402264 100644 --- a/CoreUI/Qmitk/QmitkLevelWindowWidgetContextMenu.h +++ b/CoreUI/Qmitk/QmitkLevelWindowWidgetContextMenu.h @@ -1,119 +1,121 @@ /*========================================================================= Program: Medical Imaging & Interaction Toolkit Language: C++ Date: $Date$ Version: $Revision$ Copyright (c) German Cancer Research Center, Division of Medical and Biological Informatics. All rights reserved. See MITKCopyright.txt or http://www.mitk.org/copyright.html for details. This software is distributed WITHOUT ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the above copyright notices for more information. =========================================================================*/ #ifndef QMITKLEVELWINDOWWIDGETCONTEXTMENU_H #define QMITKLEVELWINDOWWIDGETCONTEXTMENU_H +#include + #include #include #include /** \class QmitkLevelWindowWidgetContextMenu QmitkLevelWindowWidgetContextMenu.h QmitkLevelWindowWidgetContextMenu.h \ingroup Widgets \brief Provides a contextmenu for Level/Window functionality. Either creates a new contextmenu with standard functions or adds Level/Window standard functions to an predefined contextmenu. */ class QMITK_EXPORT QmitkLevelWindowWidgetContextMenu : public QWidget { Q_OBJECT public: /// constructor QmitkLevelWindowWidgetContextMenu(QWidget * parent, Qt::WindowFlags f = 0 ); virtual ~QmitkLevelWindowWidgetContextMenu(); /*! * data structure which reads and writes presets defined in a XML-file */ mitk::LevelWindowPreset* m_LevelWindowPreset; /*! * data structure which stores the values manipulated * by a QmitkLevelWindowWidgetContextMenu */ mitk::LevelWindow m_LevelWindow; /// submenu with all presets for contextmenu QMenu* m_PresetSubmenu; /// submenu with all images for contextmenu QMenu* m_ImageSubmenu; /// pointer to the object which manages all Level/Window changes on images and holds the LevelWindowProperty /// of the current image mitk::LevelWindowManager* m_Manager; /// map to hold all image-properties, one can get the image which is selected in the contextmenu /// with the QAction representing the image for the contextmenu std::map m_Images; /*! * returns the contextmenu with standard functions for Level/Window * * input is a prefilled contextmenu to which standard functions will be added */ void getContextMenu(QMenu* contextmenu); /// returns the contextmenu with standard functions for Level/Window void getContextMenu(); /// lets this object know about the LevelWindowManager to get all images and tell about changes void setLevelWindowManager(mitk::LevelWindowManager* levelWindowManager); protected: /// ID of preset selected in contextmenu QAction* m_PresetAction; /// ID of image selected in contextmenu QAction* m_ImageAction; protected slots: /// sets level and window value of the current image to the values defined for the selected preset void setPreset(QAction* presetAction); /// calls the mitkLevelWindow SetAuto method with guessByCentralSlice false, so that the greyvalues from whole image will be considered void useAllGreyvaluesFromImage(); /// sets the level window slider to be fixed void setFixed(); /// adds a new Preset for presets-contextmenu void addPreset(); /// resets the current images Level/Window to its default values void setDefaultLevelWindow(); /// resets the current images scalerange to its default values void setDefaultScaleRange(); /// changes the current images scalerange void changeScaleRange(); /// sets the selected image or the topmost layer image to the new current image void setImage(QAction* imageAction); /// sets the window to its maximum Size to fit the scalerange void setMaximumWindow(); }; #endif diff --git a/CoreUI/Qmitk/QmitkLineEditLevelWindowWidget.h b/CoreUI/Qmitk/QmitkLineEditLevelWindowWidget.h index 8b254ea2fc..fd109f559f 100644 --- a/CoreUI/Qmitk/QmitkLineEditLevelWindowWidget.h +++ b/CoreUI/Qmitk/QmitkLineEditLevelWindowWidget.h @@ -1,119 +1,121 @@ /*========================================================================= Program: Medical Imaging & Interaction Toolkit Language: C++ Date: $Date$ Version: $Revision$ Copyright (c) German Cancer Research Center, Division of Medical and Biological Informatics. All rights reserved. See MITKCopyright.txt or http://www.mitk.org/copyright.html for details. This software is distributed WITHOUT ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the above copyright notices for more information. =========================================================================*/ #ifndef QMITKLINEEDITLEVELWINDOWWIDGET #define QMITKLINEEDITLEVELWINDOWWIDGET +#include + #include #include class QmitkLevelWindowWidgetContextMenu; class QLineEdit; /** \class QmitkLineEditLevelWindowWidget QmitkLineEditLevelWindowWidget.h QmitkLineEditLevelWindowWidget.h \ingroup Widgets \brief Provides a widget with two lineedit fields, one to change the window value of the current image and one to change the level value of the current image. */ class QMITK_EXPORT QmitkLineEditLevelWindowWidget : public QWidget { Q_OBJECT public: /// constructor QmitkLineEditLevelWindowWidget( QWidget * parent = 0, Qt::WindowFlags f = 0 ); /// destructor ~QmitkLineEditLevelWindowWidget(); /// inputfield for level value QLineEdit* m_LevelInput; /// inputfield for window value QLineEdit* m_WindowInput; /*! * data structure which stores the values manipulated * by a QmitkLineEditLevelWindowWidget */ mitk::LevelWindow m_LevelWindow; /// manager who is responsible to collect and deliver changes on Level/Window mitk::LevelWindowManager::Pointer m_Manager; /// sets the manager who is responsible to collect and deliver changes on Level/Window void setLevelWindowManager(mitk::LevelWindowManager* levelWindowManager); /// sets the DataStorage which holds all image-nodes void SetDataStorage( mitk::DataStorage* ds ); /// returns the manager who is responsible to collect and deliver changes on Level/Window mitk::LevelWindowManager* GetManager(); private: /// creates the contextmenu for this widget from class QmitkLevelWindowWidgetContextMenu void contextMenuEvent ( QContextMenuEvent * ); /// change notifications from the mitkLevelWindowManager void OnPropertyModified(const itk::EventObject& e); /*! * tests if new level + window/2 <= maxRange, if not level would be set to maxRange - window/2 * * tests if new level - window/2 >= maxRange, if not level would be set to minRange + window/2 * * window keeps its old value */ void validLevel(); /*! * tests if current level + window/2 <= maxRange, if not window/2 would be set to maxRange - level * * tests if current level - window/2 >= minRange, if not window/2 would be set to level - minRange * * level keeps its old value */ void validWindow(); public slots: /// called when return is pressed in levelinput field void SetLevelValue(); /// called when return is pressed in windowinput field void SetWindowValue(); // validator to accept only possible values for Level/Window in lineedits //void setValidator(); protected: unsigned long m_ObserverTag; bool m_IsObserverTagSet; /*! * data structure which creates the contextmenu for QmitkLineEditLevelWindowWidget */ QmitkLevelWindowWidgetContextMenu* m_Contextmenu; }; #endif // QMITKLINEEDITLEVELWINDOWWIDGET diff --git a/CoreUI/Qmitk/QmitkMemoryUsageIndicatorView.h b/CoreUI/Qmitk/QmitkMemoryUsageIndicatorView.h index 80741f4089..868708891d 100644 --- a/CoreUI/Qmitk/QmitkMemoryUsageIndicatorView.h +++ b/CoreUI/Qmitk/QmitkMemoryUsageIndicatorView.h @@ -1,53 +1,55 @@ /*========================================================================= Program: Medical Imaging & Interaction Toolkit Language: C++ Date: $Date$ Version: $Revision: 17224 $ Copyright (c) German Cancer Research Center, Division of Medical and Biological Informatics. All rights reserved. See MITKCopyright.txt or http://www.mitk.org/copyright.html for details. This software is distributed WITHOUT ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the above copyright notices for more information. =========================================================================*/ #ifndef QMITKMEMORYUSAGEINDICATORVIEW_WIDGET #define QMITKMEMORYUSAGEINDICATORVIEW_WIDGET +#include + #include #include #include "ui_QmitkMemoryUsageIndicator.h" class QMITK_EXPORT QmitkMemoryUsageIndicatorView : public QWidget, public Ui::QmitkMemoryUsageIndicator { Q_OBJECT public: /// constructor QmitkMemoryUsageIndicatorView( QWidget * parent=0, Qt::WindowFlags f = 0 ); /// destructor ~QmitkMemoryUsageIndicatorView(); protected slots: void UpdateMemoryUsage(); protected: std::string FormatMemorySize( size_t size ); std::string FormatPercentage( double val ); std::string GetMemoryDescription( size_t processSize, float percentage ); QPixmap m_LEDGreen; QPixmap m_LEDYellow; QPixmap m_LEDOrange; QPixmap m_LEDRed; char m_PreviousState; }; #endif //QMITKMEMORYUSAGEINDICATORVIEW_WIDGET diff --git a/CoreUI/Qmitk/QmitkNodeDescriptor.h b/CoreUI/Qmitk/QmitkNodeDescriptor.h index 0afb24b4d6..e4fef823c8 100644 --- a/CoreUI/Qmitk/QmitkNodeDescriptor.h +++ b/CoreUI/Qmitk/QmitkNodeDescriptor.h @@ -1,100 +1,102 @@ /*========================================================================= Program: Medical Imaging & Interaction Toolkit Language: C++ Date: $Date: 2009-07-14 19:11:20 +0200 (Tue, 14 Jul 2009) $ Version: $Revision: 18127 $ Copyright (c) German Cancer Research Center, Division of Medical and Biological Informatics. All rights reserved. See MITKCopyright.txt or http://www.mitk.org/copyright.html for details. This software is distributed WITHOUT ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the above copyright notices for more information. =========================================================================*/ #ifndef QmitkNodeDescriptor_h #define QmitkNodeDescriptor_h +#include + #include #include "mitkDataNode.h" #include #include #include #include #include #include /// /// \class QmitkNodeQmitkNodeDescriptor /// \brief QmitkNodeQmitkNodeDescriptor is Decorator class for the mitk::DataNode /// which enhances certain mitk::DataNode by additional infos needed by the GUI (Icon, ...) /// /// Moreover, QmitkNodeQmitkNodeDescriptor stores a Menu for actions that can be taken /// for a certain DataNode, e.g. for DataNodes containing images this menu /// can be filled with Image Filter Actions, etc. /// /// \sa QmitkDataNodeQmitkNodeDescriptorManager /// class QMITK_EXPORT QmitkNodeDescriptor : public QObject { Q_OBJECT public: /// /// Creates a new QmitkNodeQmitkNodeDescriptor /// QmitkNodeDescriptor(const QString& _ClassName, const QString& _PathToIcon , mitk::NodePredicateBase* _Predicate, QObject* parent); /// /// Deletes all actions /// virtual ~QmitkNodeDescriptor(); /// /// Returns a name for this class of DataNodes (e.g. "Image", "Image Mask", etc.) /// virtual QString GetClassName() const; /// /// Returns an Icon for this class of DataNodes /// virtual QIcon GetIcon() const; /// /// Returns an Icon for this class of DataNodes /// virtual QAction* GetSeparator() const; /// /// Check if this class describes the given node /// virtual bool CheckNode(const mitk::DataNode* node) const; /// /// Create and return an action with this descriptor as owner /// virtual void AddAction ( QAction * action, bool isBatchAction=true ); /// /// Remove and delete (!) an action /// virtual void RemoveAction(QAction* _Action); /// /// Get all actions associated with this class of nodes /// virtual QList GetActions() const; /// /// Get all actions for this descriptor class that can be executed on multiple nodes /// (no priot knowledge abpout the node is required) /// virtual QList GetBatchActions() const; public slots: /// Called when an action was destroyed void ActionDestroyed ( QObject * obj = 0 ); protected: QString m_ClassName; QString m_PathToIcon; mitk::NodePredicateBase::Pointer m_Predicate; QList m_Actions; QList m_BatchActions; QAction* m_Separator; }; #endif // QmitkNodeDescriptor_h diff --git a/CoreUI/Qmitk/QmitkNodeDescriptorManager.h b/CoreUI/Qmitk/QmitkNodeDescriptorManager.h index b7ae270ea8..5506aee32a 100644 --- a/CoreUI/Qmitk/QmitkNodeDescriptorManager.h +++ b/CoreUI/Qmitk/QmitkNodeDescriptorManager.h @@ -1,115 +1,117 @@ /*========================================================================= Program: Medical Imaging & Interaction Toolkit Language: C++ Date: $Date: 2009-07-14 19:11:20 +0200 (Tue, 14 Jul 2009) $ Version: $Revision: 18127 $ Copyright (c) German Cancer Research Center, Division of Medical and Biological Informatics. All rights reserved. See MITKCopyright.txt or http://www.mitk.org/copyright.html for details. This software is distributed WITHOUT ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the above copyright notices for more information. =========================================================================*/ #ifndef QmitkNodeDescriptorManager_h #define QmitkNodeDescriptorManager_h +#include + #include "QmitkNodeDescriptor.h" /// /// \class QmitkNodeDescriptorManager /// \brief QmitkNodeDescriptorManager manages a set of QmitkNodeDescriptors /// /// \sa QmitkNodeDescriptor /// class QMITK_EXPORT QmitkNodeDescriptorManager : public QObject { Q_OBJECT public: /// /// \return the solely instance of QmitkNodeDescriptorManager /// static QmitkNodeDescriptorManager* GetInstance(); /// /// Initializes the QmitkNodeDescriptorManager. /// Adds a few standard Descriptors. /// This Descriptors are added: /// - A QmitkNodeDescriptor for the class of "Image" DataNodes /// - A QmitkNodeDescriptor for the class of "Image Mask" DataNodes /// - A QmitkNodeDescriptor for the class of "Surface" DataNodes /// - A QmitkNodeDescriptor for the class of "PointSet" DataNodes /// virtual void Initialize(); /// /// Adds a new descriptor to the manager. The manager takes the ownership. /// void AddDescriptor(QmitkNodeDescriptor* _Descriptor); /// /// Removes and deletes a descriptor from the manager /// void RemoveDescriptor(QmitkNodeDescriptor* _Descriptor); /// /// Get the last descriptor in the descriptors list that matches the given node. /// *Attention*: More specialized Descriptors should therefore be appended at /// the end of the list, e.g. first add "Image", then add "Image Mask" /// /// \return a QmitkNodeDescriptor for the given node or a QmitkNodeDescriptor describing unknown nodes (never 0) /// \sa AddDescriptor() /// QmitkNodeDescriptor* GetDescriptor(const mitk::DataNode* _Node) const; /// /// Get the last QmitkNodeDescriptor for the given class name /// /// \return a QmitkNodeDescriptor for the given class name or 0 if there is no QmitkNodeDescriptor for _ClassName /// QmitkNodeDescriptor* GetDescriptor(const QString& _ClassName) const; /// /// \return The UnknownDataNodeDescriptor, which is the default Descriptor for all Nodes. /// QmitkNodeDescriptor* GetUnknownDataNodeDescriptor() const; /// /// Returns a list of all actions that are associated with the given node. /// If there are more than one Descriptors for this node all actions /// will be merged together. /// E.g. all actions from the "unknown" DataNodes will be added to /// this list. Generic Actions like Save, Load, etc. are stored there. /// QList GetActions(const mitk::DataNode* _Node) const; /// /// \return a list of actions associated with the given nodes /// QList GetActions( const std::vector& _Nodes ) const; /// /// Deletes all Descriptors in the list /// virtual ~QmitkNodeDescriptorManager(); protected: /// /// Creates the m_UnknownDataNodeDescriptor /// Calls Initialize /// QmitkNodeDescriptorManager(); protected: /// /// This is the standard QmitkNodeDescriptor matching every node /// QmitkNodeDescriptor* m_UnknownDataNodeDescriptor; /// /// Holds all user defined descriptors /// QList m_NodeDescriptors; }; #endif // QmitkNodeDescriptorManager_h diff --git a/CoreUI/Qmitk/QmitkProgressBar.h b/CoreUI/Qmitk/QmitkProgressBar.h index 331cb22243..91e630f37c 100644 --- a/CoreUI/Qmitk/QmitkProgressBar.h +++ b/CoreUI/Qmitk/QmitkProgressBar.h @@ -1,84 +1,86 @@ /*========================================================================= Program: Medical Imaging & Interaction Toolkit Language: C++ Date: $Date$ Version: $Revision$ Copyright (c) German Cancer Research Center, Division of Medical and Biological Informatics. All rights reserved. See MITKCopyright.txt or http://www.mitk.org/copyright.html for details. This software is distributed WITHOUT ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the above copyright notices for more information. =========================================================================*/ #ifndef QMITKPROGRESSBAR_H #define QMITKPROGRESSBAR_H + +#include + #include -#include #include //##Documentation //## @brief QT-Toolkit/GUI dependent class that provides the QT's ProgressBar //## //## All mitk-classes will call this class for output: //## mitk::ProgressBar::GetInstance(); class QMITK_EXPORT QmitkProgressBar : public QProgressBar, public mitk::ProgressBarImplementation { Q_OBJECT public: //##Documentation //##@brief Constructor; //## holds param instance internally and connects this to the mitkProgressBar QmitkProgressBar(QWidget * parent = 0, const char * name = 0); //##Documentation //##@brief Destructor virtual ~QmitkProgressBar(); //##Documentation //## @brief Sets whether the current progress value is displayed. virtual void SetPercentageVisible(bool visible); //##Documentation //## @brief Adds steps to totalSteps. virtual void AddStepsToDo(unsigned int steps); //##Documentation //## @brief Sets the current amount of progress to current progress + steps. //## @param: steps the number of steps done since last Progress(int steps) call. virtual void Progress(unsigned int steps); signals: void SignalAddStepsToDo(unsigned int steps); void SignalProgress(unsigned int steps); void SignalSetPercentageVisible(bool visible); protected slots: virtual void SlotAddStepsToDo(unsigned int steps); virtual void SlotProgress(unsigned int steps); virtual void SlotSetPercentageVisible(bool visible); private: //##Documentation //## @brief Reset the progress bar. The progress bar "rewinds" and shows no progress. void Reset(); unsigned int m_TotalSteps; unsigned int m_Progress; }; #endif /* define QMITKPROGRESSBAR_H */ diff --git a/CoreUI/Qmitk/QmitkPropertiesTableEditor.h b/CoreUI/Qmitk/QmitkPropertiesTableEditor.h index 263ef5f25f..815d8838b9 100644 --- a/CoreUI/Qmitk/QmitkPropertiesTableEditor.h +++ b/CoreUI/Qmitk/QmitkPropertiesTableEditor.h @@ -1,89 +1,91 @@ /*========================================================================= Program: Medical Imaging & Interaction Toolkit Language: C++ Date: $Date$ Version: $Revision: 18127 $ Copyright (c) German Cancer Research Center, Division of Medical and Biological Informatics. All rights reserved. See MITKCopyright.txt or http://www.mitk.org/copyright.html for details. This software is distributed WITHOUT ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the above copyright notices for more information. =========================================================================*/ #ifndef QmitkPropertiesTableEditor_h #define QmitkPropertiesTableEditor_h +#include + /// Own includes. #include "mitkDataNode.h" /// Toolkit includes. #include /// Forward declarations. class QmitkPropertiesTableModel; class QTableView; class QLineEdit; /// /// \class QmitkPropertiesTableEditor /// \brief Combines a QTableView along with a QmitkPropertiesTableModel to a reusable /// Property Editor component. /// /// \see QmitkPropertyDelegate class QMITK_EXPORT QmitkPropertiesTableEditor : public QWidget { Q_OBJECT public: /// /// Constructs a new QmitkDataStorageTableModel /// and sets the DataNode for this TableModel. QmitkPropertiesTableEditor(QWidget* parent = 0, Qt::WindowFlags f = 0,mitk::DataNode::Pointer _Node = 0); /// /// Standard dtor. Nothing to do here. virtual ~QmitkPropertiesTableEditor(); /// /// Convenience method. Sets the property list in the model. /// void SetPropertyList(mitk::PropertyList::Pointer _List); /// /// Get the model. /// QmitkPropertiesTableModel* getModel() const; QTableView* getTable() const; protected slots: void PropertyFilterKeyWordTextChanged(const QString & text); protected: /// /// Initialise empty GUI. /// virtual void init(); /// /// The table view that renders the property list. /// QTableView* m_NodePropertiesTableView; /// /// A text field in which the user can enter a filter keyword for the properties. Only properties containing with this keyword /// will be selected. /// QLineEdit* m_TxtPropertyFilterKeyWord; /// /// The property list table model. /// QmitkPropertiesTableModel* m_Model; }; #endif /* QMITKPROPERTIESTABLEMODEL_H_ */ diff --git a/CoreUI/Qmitk/QmitkPropertiesTableModel.h b/CoreUI/Qmitk/QmitkPropertiesTableModel.h index 8a21c120b8..0d9aad7dd8 100644 --- a/CoreUI/Qmitk/QmitkPropertiesTableModel.h +++ b/CoreUI/Qmitk/QmitkPropertiesTableModel.h @@ -1,251 +1,253 @@ /*========================================================================= Program: MITK Language: C++ Date: $Date$ Version: $Revision: 14921 $ Copyright (c) German Cancer Research Center, Division of Medical and Biological Informatics. All rights reserved. See MITKCopyright.txt or http://www.mitk.org/copyright.html for details. This software is distributed WITHOUT ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the above copyright notices for more information. =========================================================================*/ /// Header guard. #ifndef QmitkPropertiesTableModel_h #define QmitkPropertiesTableModel_h +#include + //# Own includes #include "mitkDataNode.h" #include "mitkWeakPointer.h" //# Toolkit includes #include #include #include //# Forward declarations /// /// \class QmitkPropertiesTableModel /// \brief A table model for showing and editing mitk::Properties. /// /// \see QmitkPropertyDelegate /// class QMITK_EXPORT QmitkPropertiesTableModel : public QAbstractTableModel { //# PUBLIC CTORS,DTOR,TYPEDEFS,CONSTANTS public: static const int PROPERTY_NAME_COLUMN = 0; static const int PROPERTY_VALUE_COLUMN = 1; /// /// Typedef for the complete Property Datastructure, which may be written as follows: /// Name->(mitk::BaseProperty::Pointer) /// typedef std::pair PropertyDataSet; /// /// Constructs a new QmitkDataStorageTableModel /// and sets the DataNode for this TableModel. QmitkPropertiesTableModel(QObject* parent = 0, mitk::PropertyList::Pointer _PropertyList=0); /// /// Standard dtor. Nothing to do here. virtual ~QmitkPropertiesTableModel(); //# PUBLIC GETTER public: /// /// Returns the property list of this table model. /// mitk::PropertyList::Pointer GetPropertyList() const; /// /// Overwritten from QAbstractTableModel. Returns the flags what can be done with the items (view, edit, ...) Qt::ItemFlags flags(const QModelIndex& index) const; /// /// Overwritten from QAbstractTableModel. Returns the flags what can be done with the items (view, edit, ...) QVariant headerData(int section, Qt::Orientation orientation, int role = Qt::DisplayRole) const; /// /// Overwritten from QAbstractTableModel. Returns the flags what can be done with the items (view, edit, ...) QVariant data(const QModelIndex& index, int role = Qt::DisplayRole) const; /// /// Overwritten from QAbstractTableModel. Returns the flags what can be done with the items (view, edit, ...) int rowCount(const QModelIndex& parent = QModelIndex()) const; /// /// Overwritten from QAbstractTableModel. Returns the number of columns. That is usually two in this model: /// the properties name and its value. int columnCount(const QModelIndex &parent) const; //# PUBLIC SETTER public: /// /// Sets the Property List to show. Resets the whole model. If _PropertyList is NULL the model is empty. /// void SetPropertyList(mitk::PropertyList* _PropertyList); /// /// \brief Gets called when the list is about to be deleted. /// virtual void PropertyListDelete(const itk::Object *_PropertyList); /// /// \brief Called when a single property was changed. Send a model changed event to the Qt-outer world. /// virtual void PropertyModified(const itk::Object *caller, const itk::EventObject &event); /// /// \brief Called when a single property was changed. Send a model changed event to the Qt-outer world. /// virtual void PropertyDelete(const itk::Object *caller, const itk::EventObject &event); /// /// \brief Set a keyword for filtering of properties. Only properties beginning with this string will be shown /// virtual void SetFilterPropertiesKeyWord(std::string _FilterKeyWord); /// /// Overridden from QAbstractTableModel. Sets data at index for given role. /// bool setData(const QModelIndex &index, const QVariant &value, int role); /// /// \brief Reimplemented sort function from QAbstractTableModel to enable sorting on the table. /// void sort ( int column, Qt::SortOrder order = Qt::AscendingOrder ); //#PROTECTED INNER CLASSES protected: /// /// \struct PropertyDataSetCompareFunction /// \brief A struct that inherits from std::binary_function. You can use it in std::sort algorithm for sorting the property list elements. /// struct PropertyDataSetCompareFunction : public std::binary_function { /// /// \brief Specifies field of the property with which it will be sorted. /// enum CompareCriteria { CompareByName = 0, CompareByValue }; /// /// \brief Specifies Ascending/descending ordering. /// enum CompareOperator { Less = 0, Greater }; /// /// \brief Creates a PropertyDataSetCompareFunction. A CompareCriteria and a CompareOperator must be given. /// PropertyDataSetCompareFunction(CompareCriteria _CompareCriteria = CompareByName, CompareOperator _CompareOperator = Less); /// /// \brief The reimplemented compare function. /// bool operator()(const PropertyDataSet& _Left , const PropertyDataSet& _Right) const; protected: CompareCriteria m_CompareCriteria; CompareOperator m_CompareOperator; }; /// /// An unary function for selecting Properties in a vector by a key word. /// struct PropertyListElementFilterFunction : public std::unary_function { PropertyListElementFilterFunction(const std::string& m_FilterKeyWord); /// /// \brief The reimplemented compare function. /// bool operator()(const PropertyDataSet& _Elem) const; protected: std::string m_FilterKeyWord; }; //# PROTECTED GETTER protected: /// /// \brief Searches for the specified property and returns the row of the element in this QTableModel. /// If any errors occur, the function returns -1. /// int FindProperty(const mitk::BaseProperty* _Property) const; //# PROTECTED SETTER protected: /// /// Adds a property dataset to the current selection. /// When a property is added a modified and delete listener /// is appended. /// void AddSelectedProperty(PropertyDataSet& _PropertyDataSet); /// /// Removes a property dataset from the current selection. /// When a property is removed the modified and delete listener /// are also removed. /// void RemoveSelectedProperty(unsigned int _Index); /// /// Reset is called when a new filter keyword is set or a new /// PropertyList is set. First of all, all priorly selected /// properties are removed. Then all properties to be /// selected (specified by the keyword) are added to the selection. /// void Reset(); //# PROTECTED MEMBERS protected: /// /// Holds the pointer to the properties list. Dont use smart pointers here. Instead: Listen /// to the delete event. mitk::WeakPointer m_PropertyList; /// /// Store the properties in a vector so that they may be sorted std::vector m_SelectedProperties; /// /// \brief Holds all tags of Modified Event Listeners. We need it to remove them again. /// std::vector m_PropertyModifiedObserverTags; /// /// \brief Holds all tags of Modified Event Listeners. We need it to remove them again. /// std::vector m_PropertyDeleteObserverTags; /// /// \brief Indicates if this class should neglect all incoming events because /// the class itself triggered the event (e.g. when a property was edited). /// bool m_BlockEvents; /// /// \brief The property is true when the property list is sorted in descending order. /// bool m_SortDescending; /// /// \brief If set to any value, only properties containing the specified keyword in their name will be shown. /// std::string m_FilterKeyWord; }; #endif /* QMITKPROPERTIESTABLEMODEL_H_ */ diff --git a/CoreUI/Qmitk/QmitkPropertyDelegate.h b/CoreUI/Qmitk/QmitkPropertyDelegate.h index e5404fcb85..09782e2142 100644 --- a/CoreUI/Qmitk/QmitkPropertyDelegate.h +++ b/CoreUI/Qmitk/QmitkPropertyDelegate.h @@ -1,87 +1,89 @@ /*========================================================================= Program: Medical Imaging & Interaction Toolkit Language: C++ Date: $Date$ Version: $Revision: 18127 $ Copyright (c) German Cancer Research Center, Division of Medical and Biological Informatics. All rights reserved. See MITKCopyright.txt or http://www.mitk.org/copyright.html for details. This software is distributed WITHOUT ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the above copyright notices for more information. =========================================================================*/ #ifndef QmitkPropertyDelegate_h #define QmitkPropertyDelegate_h +#include + /// Own includes. #include "mitkBaseProperty.h" /// Toolkit includes. #include /// Forward declarations. /// /// \class QmitkPropertyDelegate /// \brief An item delegate for rendering and editing mitk::Properties in a QTableView. /// /// \see QmitkPropertiesTableModel class QMITK_EXPORT QmitkPropertyDelegate : public QStyledItemDelegate { Q_OBJECT public: /// /// Creates a new PropertyDelegate. /// QmitkPropertyDelegate(QObject *parent = 0); /// /// Renders a specific property (overwritten from QItemDelegate) /// void paint(QPainter *painter, const QStyleOptionViewItem &option , const QModelIndex &index) const; /// /// Create an editor for a specific property (overwritten from QItemDelegate) /// QWidget *createEditor(QWidget *parent, const QStyleOptionViewItem &option , const QModelIndex &index) const; /// /// Create an editor for a specific property (overwritten from QItemDelegate) /// void setEditorData(QWidget *editor, const QModelIndex &index) const; /// /// When the user accepts input this func commits the data to the model (overwritten from QItemDelegate) /// void setModelData(QWidget *editor, QAbstractItemModel* model , const QModelIndex &index) const; /// /// \brief Fit an editor to some geometry (overwritten from QItemDelegate) /// void updateEditorGeometry(QWidget *editor, const QStyleOptionViewItem &option, const QModelIndex &index) const; protected: bool eventFilter( QObject *o, QEvent *e ); private slots: /// /// Invoked when the user accepts editor input, that is when he does not pushes ESC. /// void commitAndCloseEditor(); void showColorDialog(); void ComboBoxCurrentIndexChanged ( int index ) ; void SpinBoxValueChanged ( const QString& value ) ; }; #endif /* QMITKPROPERTIESTABLEMODEL_H_ */ diff --git a/CoreUI/Qmitk/QmitkRegisterClasses.h b/CoreUI/Qmitk/QmitkRegisterClasses.h index 2031b9c812..84ec442f1f 100644 --- a/CoreUI/Qmitk/QmitkRegisterClasses.h +++ b/CoreUI/Qmitk/QmitkRegisterClasses.h @@ -1,26 +1,26 @@ /*========================================================================= Program: Medical Imaging & Interaction Toolkit Language: C++ Date: $Date$ Version: $Revision$ Copyright (c) German Cancer Research Center, Division of Medical and Biological Informatics. All rights reserved. See MITKCopyright.txt or http://www.mitk.org/copyright.html for details. This software is distributed WITHOUT ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the above copyright notices for more information. =========================================================================*/ #ifndef QmitkRegisterClassesHIncluded #define QmitkRegisterClassesHIncluded -#include "mitkCommon.h" +#include QMITK_EXPORT void QmitkRegisterClasses(); #endif diff --git a/CoreUI/Qmitk/QmitkRenderWindow.h b/CoreUI/Qmitk/QmitkRenderWindow.h index eee25435e4..afa9e23277 100644 --- a/CoreUI/Qmitk/QmitkRenderWindow.h +++ b/CoreUI/Qmitk/QmitkRenderWindow.h @@ -1,152 +1,152 @@ /*========================================================================= Program: Medical Imaging & Interaction Toolkit Language: C++ Date: $Date$ Version: $Revision$ Copyright (c) German Cancer Research Center, Division of Medical and Biological Informatics. All rights reserved. See MITKCopyright.txt or http://www.mitk.org/copyright.html for details. This software is distributed WITHOUT ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the above copyright notices for more information. =========================================================================*/ #ifndef QMITKRENDERWINDOW_H_HEADER_INCLUDED_C1C40D66 #define QMITKRENDERWINDOW_H_HEADER_INCLUDED_C1C40D66 +#include -#include "mitkCommon.h" #include "mitkRenderWindowBase.h" #include "QVTKWidget.h" #include "QmitkRenderWindowMenu.h" /** * \brief MITK implementation of the QVTKWidget * \ingroup Renderer */ class QMITK_EXPORT QmitkRenderWindow : public QVTKWidget , public mitk::RenderWindowBase { Q_OBJECT public: QmitkRenderWindow(QWidget *parent = 0, QString name = "unnamed renderwindow", mitk::VtkPropRenderer* renderer = NULL, mitk::RenderingManager* renderingManager = NULL); virtual ~QmitkRenderWindow(); /** * \brief Whether Qt events should be passed to parent (default: true) * * With introduction of the QVTKWidget the behaviour regarding Qt events changed. * QVTKWidget "accepts" Qt events like mouse clicks (i.e. set an "accepted" flag). * When this flag is set, Qt fininshed handling of this event -- otherwise it is * reached through to the widget's parent. * * This reaching through to the parent was implicitly required by QmitkMaterialWidget / QmitkMaterialShowCase. * * The default behaviour of QmitkRenderWindow is now to clear the "accepted" flag * of Qt events after they were handled by QVTKWidget. This way parents can also * handle events. * * If you don't want this behaviour, call SetResendQtEvents(true) on your render window. */ virtual void SetResendQtEvents(bool resend); // Set Layout Index to define the Layout Type void SetLayoutIndex( unsigned int layoutIndex ); // Get Layout Index to define the Layout Type unsigned int GetLayoutIndex(); //MenuWidget need to update the Layout Design List when Layout had changed void LayoutDesignListChanged( int layoutDesignIndex ); void HideRenderWindowMenu( ); //Activate or Deactivate MenuWidget. void ActivateMenuWidget( bool state ); bool GetActivateMenuWidgetFlag() { return m_MenuWidgetActivated; } // Get it from the QVTKWidget parent virtual vtkRenderWindow* GetVtkRenderWindow() { return GetRenderWindow();} virtual vtkRenderWindowInteractor* GetVtkRenderWindowInteractor() { return NULL;} void FullScreenMode( bool state ); protected: // overloaded move handler virtual void moveEvent( QMoveEvent* event ); // overloaded show handler void showEvent( QShowEvent* event ); // overloaded resize handler virtual void resizeEvent(QResizeEvent* event); // overloaded mouse press handler virtual void mousePressEvent(QMouseEvent* event); // overloaded mouse move handler virtual void mouseMoveEvent(QMouseEvent* event); // overloaded mouse release handler virtual void mouseReleaseEvent(QMouseEvent* event); // overloaded key press handler virtual void keyPressEvent(QKeyEvent* event); // overloaded enter handler virtual void enterEvent(QEvent*); // overloaded leave handler virtual void leaveEvent(QEvent*); #ifndef QT_NO_WHEELEVENT // overload wheel mouse event virtual void wheelEvent(QWheelEvent*); #endif void AdjustRenderWindowMenuVisibility( const QPoint& pos ); signals: void ResetView(); // \brief int parameters are enum from QmitkStdMultiWidget void ChangeCrosshairRotationMode(int); void SignalLayoutDesignChanged( int layoutDesignIndex ); void moved(); void resized(); protected slots: void OnChangeLayoutDesign(int layoutDesignIndex); void OnWidgetPlaneModeChanged( int ); void DeferredHideMenu(); private: bool m_ResendQtEvents; QmitkRenderWindowMenu* m_MenuWidget; bool m_MenuWidgetActivated; unsigned int m_LayoutIndex; }; -#endif \ No newline at end of file +#endif diff --git a/CoreUI/Qmitk/QmitkRenderWindowMenu.h b/CoreUI/Qmitk/QmitkRenderWindowMenu.h index 10b4a7a823..9547b4b0ee 100644 --- a/CoreUI/Qmitk/QmitkRenderWindowMenu.h +++ b/CoreUI/Qmitk/QmitkRenderWindowMenu.h @@ -1,321 +1,321 @@ /*========================================================================= Program: Medical Imaging & Interaction Toolkit Language: C++ Date: $Date: 2009-05-12 20:04:59 +0200 (Di, 12 Mai 2009) $ Version: $Revision: 17180 $ Copyright (c) German Cancer Research Center, Division of Medical and Biological Informatics. All rights reserved. See MITKCopyright.txt or http://www.mitk.org/copyright.html for details. This software is distributed WITHOUT ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the above copyright notices for more information. =========================================================================*/ #ifndef QmitkRenderWindowMenu_h #define QmitkRenderWindowMenu_h #if defined(_WIN32) || defined(__APPLE__) #define QMITK_USE_EXTERNAL_RENDERWINDOW_MENU #endif -#include "mitkCommon.h" +#include #include "mitkBaseRenderer.h" #include #include #include #include #include #include #include /** * \brief The QmitkRenderWindowMenu is a popup Widget which shows up when the mouse curser enter a QmitkRenderWindow. * The Menu Widget is located in the right top corner of each RenderWindow. It includes different settings. For example * the layout design can be changed with the setting button. Switching between full-screen mode and layout design can be done * with the full-screen button. Splitting the Widget horizontal or vertical as well closing the Widget is not implemented yet. * The popup Widget can be deactivated with ActivateMenuWidget(false) in QmitkRenderWindow. * * \ingroup Renderer * * \sa QmitkRenderWindow * \sa QmitkStdMultiWidget * */ class QMITK_EXPORT QmitkRenderWindowMenu : public QWidget { Q_OBJECT public: QmitkRenderWindowMenu( QWidget* parent = 0, Qt::WFlags f = 0, mitk::BaseRenderer * b = 0 ); virtual ~QmitkRenderWindowMenu(); /*! Return visibility of settings menu. The menu is connected with m_SettingsButton and includes layout direction (transversal, coronal .. ) and layout design (standard layout, 2D images top, 3D bottom ... ). */ bool GetSettingsMenuVisibilty() { if( m_Settings == NULL) return false; else return m_Settings->isVisible(); } /*! Set layout index. Defines layout direction (transversal, coronal, sagital or threeD) of the parent. */ void SetLayoutIndex( unsigned int layoutIndex ); /*! Return layout direction of parent (transversal, coronal, sagital or threeD) */ unsigned int GetLayoutIndex() { return m_Layout; } /*! Update list of layout design (standard layout, 2D images top, 3D bottom ..). Set action of current layout design to disable and all other to enable. */ void UpdateLayoutDesignList( int layoutDesignIndex ); /*! Move menu widget to correct position (right upper corner). E.g. it is necessary when the full-screen mode is activated.*/ #ifdef QMITK_USE_EXTERNAL_RENDERWINDOW_MENU void MoveWidgetToCorrectPos(float opacity); #else void MoveWidgetToCorrectPos(float /*opacity*/); #endif void ChangeFullScreenMode( bool state ); void NotifyNewWidgetPlanesMode( int mode ); protected: /*! Create menu widget. The menu contains five QPushButtons (hori-split, verti-split, full-screen, settings and close button) and their signal/slot connection for handling. */ void CreateMenuWidget(); /*! Create settings menu which contains layout direction and the different layout designs. */ void CreateSettingsWidget(); /*! Reimplemented from QWidget. The paint event is a request to repaint all or part of a widget.*/ void paintEvent(QPaintEvent *event); /*! Update list of layout direction (transversal, coronal, sagital or threeD). Set action of currect layout direction to disable and all other to enable. Normaly the user can switch here between the different layout direction, but this is not supported yet. */ void UpdateLayoutList(); /*! Change Icon of full-screen button depending on full-screen mode. */ void ChangeFullScreenIcon(); int currentCrosshairRotationMode; public slots: void SetCrossHairVisibility( bool state ) ; signals: void ResetView(); // == "global reinit" // \brief int parameters are enum from QmitkStdMultiWidget void ChangeCrosshairRotationMode(int); /*! emit signal, when layout design changed by the setting menu.*/ void SignalChangeLayoutDesign( int layoutDesign ); public slots: void DeferredHideMenu( ); void DeferredShowMenu( ); void smoothHide( ); protected slots: /// /// this function is continously called by a timer /// to do the auto rotation /// void AutoRotateNextStep(); /// /// this function is invoked when the auto-rotate action /// is clicked /// void OnAutoRotationActionTriggered(); void enterEvent( QEvent* /*e*/ ); void leaveEvent( QEvent* /*e*/ ); void OnTSNumChanged(int); void OnCrosshairRotationModeSelected(QAction*); /*! slot for activating/deactivating the full-screen mode. The slot is connected to the clicked() event of m_FullScreenButton. Activating the full-screen maximize the current widget, deactivating restore If layout design changed by the settings menu, the full-Screen mode is automatically switch to false. */ void OnFullScreenButton( bool checked ); /*! Slot for opening setting menu. The slot is connected to the clicked() event of m_SettingsButton. The settings menu includes differen layout directions (transversal, coronal, saggital and 3D) as well all layout design (standard layout, 2D images top, 3D bottom ..)*/ void OnSettingsButton( bool checked ); /*! Slot for changing layout design to standard layout. The slot is connected to the triggered() signal of m_DefaultLayoutAction. */ void OnChangeLayoutToDefault(bool); /*! Slot for changing layout design to 2D images top, 3D bottom layout. The slot is connected to the triggered() signal of m_2DImagesUpLayoutAction. */ void OnChangeLayoutTo2DImagesUp(bool); /*! Slot for changing layout design to 2D images left, 3D right layout. The slot is connected to the triggered() signal of m_2DImagesLeftLayoutAction. */ void OnChangeLayoutTo2DImagesLeft(bool); /*! Slot for changing layout to Big 3D layout. The slot is connected to the triggered() signal of m_Big3DLayoutAction. */ void OnChangeLayoutToBig3D(bool); /*! Slot for changing layout design to Transversal plane layout. The slot is connected to the triggered() signal of m_Widget1LayoutAction. */ void OnChangeLayoutToWidget1(bool); /*! Slot for changing layout design to Sagittal plane layout. The slot is connected to the triggered() signal of m_Widget2LayoutAction. */ void OnChangeLayoutToWidget2(bool); /*! Slot for changing layout design to Coronal plane layout. The slot is connected to the triggered() signal of m_Widget3LayoutAction. */ void OnChangeLayoutToWidget3(bool); /*! Slot for changing layout design to Coronal top, 3D bottom layout. The slot is connected to the triggered() signal of m_RowWidget3And4LayoutAction. */ void OnChangeLayoutToRowWidget3And4(bool); /*! Slot for changing layout design to Coronal left, 3D right layout. The slot is connected to the triggered() signal of m_ColumnWidget3And4LayoutAction. */ void OnChangeLayoutToColumnWidget3And4(bool); /*! Slot for changing layout design to Sagittal top, Coronal n 3D bottom layout. The slot is connected to the triggered() signal of m_SmallUpperWidget2Big3and4LayoutAction. */ void OnChangeLayoutToSmallUpperWidget2Big3and4(bool); /*! Slot for changing layout design to Transversal n Sagittal left, 3D right layout. The slot is connected to the triggered() signal of m_2x2Dand3DWidgetLayoutAction. */ void OnChangeLayoutTo2x2Dand3DWidget(bool); /*! Slot for changing layout design to Transversal n 3D left, Sagittal right layout. The slot is connected to the triggered() signal of m_Left2Dand3DRight2DLayoutAction. */ void OnChangeLayoutToLeft2Dand3DRight2D(bool); void OnCrossHairMenuAboutToShow(); public: /*! enum for layout direction*/ enum { TRANSVERSAL, SAGITTAL, CORONAL, THREE_D }; /*! enum for layout design */ enum { LAYOUT_DEFAULT, LAYOUT_2DIMAGEUP, LAYOUT_2DIMAGELEFT, LAYOUT_BIG3D, LAYOUT_TRANSVERSAL, LAYOUT_SAGITTAL, LAYOUT_CORONAL, LAYOUT_2X2DAND3DWIDGET, LAYOUT_ROWWIDGET3AND4, LAYOUT_COLUMNWIDGET3AND4, LAYOUT_ROWWIDGETSMALL3ANDBIG4, //not in use in this class, but we need it here to synchronize with the SdtMultiWidget. LAYOUT_SMALLUPPERWIDGET2BIGAND4, LAYOUT_LEFT2DAND3DRIGHT2D }; void ShowMenu(); void HideMenu(); protected: QPushButton* m_CrosshairModeButton; //QAction* m_ShowHideCrosshairVisibilityAction; /*! QPushButton for activating/deactivating full-screen mode*/ QPushButton* m_FullScreenButton; /*! QPushButton for open the settings menu*/ QPushButton* m_SettingsButton; /*! QAction for Default layout design */ QAction* m_DefaultLayoutAction; /*! QAction for 2D images up layout design */ QAction* m_2DImagesUpLayoutAction; /*! QAction for 2D images left layout design */ QAction* m_2DImagesLeftLayoutAction; /*! QAction for big 3D layout design */ QAction* m_Big3DLayoutAction; /*! QAction for big transversal layout design */ QAction* m_Widget1LayoutAction; /*! QAction for big saggital layout design */ QAction* m_Widget2LayoutAction; /*! QAction for big coronal layout design */ QAction* m_Widget3LayoutAction; /*! QAction for coronal top, 3D bottom layout design */ QAction* m_RowWidget3And4LayoutAction; /*! QAction for coronal left, 3D right layout design */ QAction* m_ColumnWidget3And4LayoutAction; /*! QAction for sagittal top, coronal n 3D bottom layout design */ QAction* m_SmallUpperWidget2Big3and4LayoutAction; /*! QAction for transversal n sagittal left, 3D right layout design */ QAction* m_2x2Dand3DWidgetLayoutAction; /*! QAction for transversal n 3D left, sagittal right layout design*/ QAction* m_Left2Dand3DRight2DLayoutAction; QLabel *m_TSLabel; /*! QMenu containg all layout direction and layout design settings.*/ QMenu* m_Settings; QMenu* m_CrosshairMenu; /*! Index of layout direction. 0: transversal; 1: saggital; 2: coronal; 3: threeD */ unsigned int m_Layout; /*! Index of layout design. 0: LAYOUT_DEFAULT; 1: LAYOUT_2DIMAGEUP; 2: LAYOUT_2DIMAGELEFT; 3: LAYOUT_BIG3D 4: LAYOUT_TRANSVERSAL; 5: LAYOUT_SAGITTAL; 6: LAYOUT_CORONAL; 7: LAYOUT_2X2DAND3DWIDGET; 8: LAYOUT_ROWWIDGET3AND4; 9: LAYOUT_COLUMNWIDGET3AND4; 10: LAYOUT_ROWWIDGETSMALL3ANDBIG4; 11: LAYOUT_SMALLUPPERWIDGET2BIGAND4; 12: LAYOUT_LEFT2DAND3DRIGHT2D */ unsigned int m_LayoutDesign; /*! Store index of old layout design. It is used e.g. for the full-screen mode, when deactivating the mode the former layout design will restore.*/ unsigned int m_OldLayoutDesign; /*! Flag if full-screen mode is activated or deactivated. */ bool m_FullScreenMode; bool m_Entered; bool m_Hidden; private: mitk::BaseRenderer::Pointer m_Renderer; /// /// a timer for the auto rotate action /// QTimer m_AutoRotationTimer; }; #endif // QmitkRenderWindowMenu_H diff --git a/CoreUI/Qmitk/QmitkRenderingManager.h b/CoreUI/Qmitk/QmitkRenderingManager.h index a00ae68f17..d21c1da333 100644 --- a/CoreUI/Qmitk/QmitkRenderingManager.h +++ b/CoreUI/Qmitk/QmitkRenderingManager.h @@ -1,87 +1,89 @@ /*========================================================================= Program: Medical Imaging & Interaction Toolkit Language: C++ Date: $Date$ Version: $Revision$ Copyright (c) German Cancer Research Center, Division of Medical and Biological Informatics. All rights reserved. See MITKCopyright.txt or http://www.mitk.org/copyright.html for details. This software is distributed WITHOUT ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the above copyright notices for more information. =========================================================================*/ #ifndef QMITKRENDERINGMANAGER_H_HEADER_INCLUDED_C135A197 #define QMITKRENDERINGMANAGER_H_HEADER_INCLUDED_C135A197 +#include + #include "mitkRenderingManager.h" #include #include class QmitkRenderingManagerInternal; class QmitkRenderingManagerFactory; /** * \brief Qt specific implementation of mitk::RenderingManager. * * This implementation defines a QmitkRenderingRequestEvent to realize the * rendering request process. The event must be handled by the Qmitk * interface to Qt (QmitkRenderWindow). * * Note: it may be necessary to remove all pending RenderingRequestEvents * from the system's event processing pipeline during system shutdown to * make sure that dangling events do not lead to unexpected behavior. * * \ingroup Renderer */ class QMITK_EXPORT QmitkRenderingManager : public QObject, public mitk::RenderingManager { Q_OBJECT public: mitkClassMacro( QmitkRenderingManager, mitk::RenderingManager ); virtual ~QmitkRenderingManager(); virtual void DoMonitorRendering(); virtual void DoFinishAbortRendering(); virtual bool event( QEvent *event ); protected: itkFactorylessNewMacro(Self); QmitkRenderingManager(); virtual void GenerateRenderingRequestEvent(); virtual void StartOrResetTimer(); int pendingTimerCallbacks; protected slots: void TimerCallback(); private: friend class QmitkRenderingManagerFactory; }; class QmitkRenderingRequestEvent : public QEvent { public: enum Type { RenderingRequest = QEvent::MaxUser - 1024 }; QmitkRenderingRequestEvent() : QEvent( (QEvent::Type) RenderingRequest ) {}; }; #endif /* MITKRenderingManager_H_HEADER_INCLUDED_C135A197 */ diff --git a/CoreUI/Qmitk/QmitkRenderingManagerFactory.h b/CoreUI/Qmitk/QmitkRenderingManagerFactory.h index 6103cffa59..487439bd2a 100644 --- a/CoreUI/Qmitk/QmitkRenderingManagerFactory.h +++ b/CoreUI/Qmitk/QmitkRenderingManagerFactory.h @@ -1,50 +1,52 @@ /*========================================================================= Program: Medical Imaging & Interaction Toolkit Language: C++ Date: $Date$ Version: $Revision$ Copyright (c) German Cancer Research Center, Division of Medical and Biological Informatics. All rights reserved. See MITKCopyright.txt or http://www.mitk.org/copyright.html for details. This software is distributed WITHOUT ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the above copyright notices for more information. =========================================================================*/ #ifndef QMITKRENDERINGMANAGERFACTORY_H_HEADER_INCLUDED_C135A197 #define QMITKRENDERINGMANAGERFACTORY_H_HEADER_INCLUDED_C135A197 +#include + #include "mitkRenderingManagerFactory.h" /** * \brief Qt specific implementation of mitk::RenderingManagerFactory. * * This class create QmitkRenderingManager instances via * #CreateRenderingManager. * * A static instance of QmitkRenderingManagerFactory is created in * QmitkRenderWindow, forcing the usage of QmitkRenderingManager for the Qt * platform. * \ingroup Renderer */ class QMITK_EXPORT QmitkRenderingManagerFactory : public mitk::RenderingManagerFactory { public: QmitkRenderingManagerFactory(); ~QmitkRenderingManagerFactory(); virtual mitk::RenderingManager::Pointer CreateRenderingManager() const; private: }; #endif diff --git a/CoreUI/Qmitk/QmitkSliderLevelWindowWidget.h b/CoreUI/Qmitk/QmitkSliderLevelWindowWidget.h index 1990c75420..47ded1b59b 100644 --- a/CoreUI/Qmitk/QmitkSliderLevelWindowWidget.h +++ b/CoreUI/Qmitk/QmitkSliderLevelWindowWidget.h @@ -1,182 +1,184 @@ /*========================================================================= Program: Medical Imaging & Interaction Toolkit Language: C++ Date: $Date$ Version: $Revision$ Copyright (c) German Cancer Research Center, Division of Medical and Biological Informatics. All rights reserved. See MITKCopyright.txt or http://www.mitk.org/copyright.html for details. This software is distributed WITHOUT ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the above copyright notices for more information. =========================================================================*/ #ifndef QMITKSLIDERLEVELWINDOW_WIDGET #define QMITKSLIDERLEVELWINDOW_WIDGET +#include + #include #include class QmitkLevelWindowWidgetContextMenu; /** \class QmitkSliderLevelWindowWidget QmitkSliderLevelWindowWidget.h QmitkSliderLevelWindowWidget.h \ingroup Widgets \brief Provides a widget with a slider to change the level and window value of the current image. This documentation actually refers to the QmitkLevelWindowWidget and is only put in this class due to technical issues (should be moved later). The QmitkLevelWindowWidget is a kind of container for a QmitkSliderLevelWindowWidget (this is the cyan bar above the text input fields) and a QmitkLineEditLevelWindowWidget (with two text input fields). It holds a reference to a mitk::LevelWindowManager variable, which keeps the LevelWindowProperty of the currently selected image. Level/Window is manipulated by the text inputs and the Slider to adjust brightness/contrast of a single image. All changes on the slider or in the text input fields affect the current image by giving new values to LevelWindowManager. LevelWindowManager then sends a signal to tell other listeners about changes. Which image is changed is determined by mitkLevelWindowManager. If m_AutoTopMost is true, always the topmost image in data tree (layer property) is affected by changes. The image which is affected by changes can also be changed by QmitkLevelWindowWidgetContextMenu, the context menu for QmitkSliderLevelWindowWidget and QmitkLineEditLevelWindowWidget. There you have the possibility to set a certain image or always the topmost image in the data tree (layer property) to be affected by changes. The internal mitk::LevelWindow variable contains a range that is valid for a given image. It should not be possible to move the level/window parameters outside this range. The range can be changed and reset to its default values by QmitkLevelWindowWidgetContextMenu, the context menu for QmitkSliderLevelWindowWidget and QmitkLineEditLevelWindowWidget. Now for the behaviour of the text inputs: The upper one contains the value of the level (brightness), the lower one shows the window (contrast). The behaviour of the cyan bar is more obvious: the scale in the background shows the valid range. The cyan bar in front displays the currently selected level/window setting. You can change the level by dragging the bar with the left mouse button or clicking somewhere inside the scalerange with the left mouse button. The window is changed by moving the mouse on the upper or lower bound of the bar until the cursor becomes an vertical double-arrowed symbol. Then you can change the windowsize by clicking the left mouse button and move the mouse upwards or downwards. The bar becomes greater upwards as well as downwards. If you want to change the size of the window in only one direction you have to press the CTRL-key while doing the same as mentioned above. This information is also presented by a tooltip text when moving the mouse on the upper or lower bound of the bar. */ class QMITK_EXPORT QmitkSliderLevelWindowWidget : public QWidget { Q_OBJECT public: /// constructor QmitkSliderLevelWindowWidget( QWidget * parent=0, Qt::WindowFlags f = 0 ); /// destructor ~QmitkSliderLevelWindowWidget(); /*! * data structure which stores the values manipulated * by a QmitkSliderLevelWindowWidget */ mitk::LevelWindow m_LevelWindow; /// manager who is responsible to collect and deliver changes on Level/Window mitk::LevelWindowManager::Pointer m_Manager; /// sets the manager who is responsible to collect and deliver changes on Level/Window void setLevelWindowManager(mitk::LevelWindowManager* levelWindowManager); /// sets the DataStorage which holds all image-nodes void setDataStorage(mitk::DataStorage* ds); /// returns the manager who is responsible to collect and deliver changes on Level/Window mitk::LevelWindowManager* GetManager(); private: /// creates the contextmenu for this widget from class QmitkLevelWindowWidgetContextMenu void contextMenuEvent ( QContextMenuEvent * ); /// change notifications from the mitkLevelWindowManager void OnPropertyModified(const itk::EventObject& e); protected: /// recalculate the size and position of the slider bar virtual void update( ); /*! * helper for drawing the component */ QRect m_Rect; /*! * helper for drawing the component */ QPoint m_StartPos; bool m_Resize; bool m_Bottom; bool m_MouseDown; bool m_Leftbutton; bool m_CtrlPressed; int m_MoveHeight; bool m_ScaleVisible; QRect m_LowerBound; QRect m_UpperBound; unsigned long m_ObserverTag; bool m_IsObserverTagSet; QFont m_Font; /*! * data structure which creates the contextmenu for QmitkLineEditLevelWindowWidget */ QmitkLevelWindowWidgetContextMenu* m_Contextmenu; /*! * repaint the slider and the scale */ void paintEvent( QPaintEvent* e ); /*! * method implements the component behaviour * * checks if cursor is on upper or lower bound of slider bar and changes cursor symbol * * checks if left mouse button is pressed and if CTRL is pressed and changes sliderbar in movedirection accordingly */ void mouseMoveEvent( QMouseEvent* mouseEvent ); void enterEvent ( QEvent * event ); /*! * registers events when a mousebutton is pressed * * if leftbutton is pressed m_Leftbutton is set to true * * also checks if CTRL is pressed and sets the bool variable m_CtrlPressed */ void mousePressEvent( QMouseEvent* mouseEvent ); /*! * sets the variable m_MouseDown to false */ void mouseReleaseEvent( QMouseEvent* mouseEvent ); /*! * causes an update of the sliderbar when resizing the window */ void virtual resizeEvent ( QResizeEvent * event ); protected slots: /// hides the scale if "Hide Scale" is selected in contextmenu void hideScale(); /// shows the scale if "Show Scale" is selected in contextmenu void showScale(); }; #endif //QMITKSLIDERLEVELWINDOW_WIDGET diff --git a/CoreUI/Qmitk/QmitkStdMultiWidget.h b/CoreUI/Qmitk/QmitkStdMultiWidget.h index 35f01efef7..c499517380 100644 --- a/CoreUI/Qmitk/QmitkStdMultiWidget.h +++ b/CoreUI/Qmitk/QmitkStdMultiWidget.h @@ -1,311 +1,313 @@ /*========================================================================= Program: Medical Imaging & Interaction Toolkit Language: C++ Date: $Date$ Version: $Revision$ Copyright (c) German Cancer Research Center, Division of Medical and Biological Informatics. All rights reserved. See MITKCopyright.txt or http://www.mitk.org/copyright.html for details. This software is distributed WITHOUT ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the above copyright notices for more information. =========================================================================*/ #ifndef QMITKSTDMULTIWIDGET_H_ #define QMITKSTDMULTIWIDGET_H_ +#include + #include "mitkPositionTracker.h" #include "mitkDisplayVectorInteractor.h" #include "mitkSlicesRotator.h" #include "mitkSlicesSwiveller.h" #include "mitkRenderWindowFrame.h" #include "mitkManufacturerLogo.h" #include "mitkGradientBackground.h" #include "mitkCoordinateSupplier.h" #include "mitkDataStorage.h" #include #include #include #include #include #include "vtkTextProperty.h" #include "vtkCornerAnnotation.h" class QHBoxLayout; class QVBoxLayout; class QGridLayout; class QSpacerItem; class QmitkLevelWindowWidget; class QmitkRenderWindow; class QMITK_EXPORT QmitkStdMultiWidget : public QWidget { Q_OBJECT public: QmitkStdMultiWidget(QWidget* parent = 0, Qt::WindowFlags f = 0); virtual ~QmitkStdMultiWidget(); mitk::SliceNavigationController* GetTimeNavigationController(); void RequestUpdate(); void ForceImmediateUpdate(); mitk::DisplayVectorInteractor* GetMoveAndZoomInteractor(); QmitkRenderWindow* GetRenderWindow1() const; QmitkRenderWindow* GetRenderWindow2() const; QmitkRenderWindow* GetRenderWindow3() const; QmitkRenderWindow* GetRenderWindow4() const; const mitk::Point3D & GetLastLeftClickPosition() const; const mitk::Point3D GetCrossPosition() const; void EnablePositionTracking(); void DisablePositionTracking(); int GetLayout() const; mitk::SlicesRotator * GetSlicesRotator() const; mitk::SlicesSwiveller * GetSlicesSwiveller() const; void InitializeWidget(); /// called when the StdMultiWidget is closed to remove the 3 widget planes and the helper node from the DataStorage void RemovePlanesFromDataStorage(); void AddPlanesToDataStorage(); void SetDataStorage( mitk::DataStorage* ds ); /** \brief Listener to the CrosshairPositionEvent Ensures the CrosshairPositionEvent is handled only once and at the end of the Qt-Event loop */ void HandleCrosshairPositionEvent(); /// activate Menu Widget. true: activated, false: deactivated void ActivateMenuWidget( bool state ); protected: void UpdateAllWidgets(); void HideAllWidgetToolbars(); public slots: /// Receives the signal from HandleCrosshairPositionEvent, executes the StatusBar update void HandleCrosshairPositionEventDelayed(); void changeLayoutTo2DImagesUp(); void changeLayoutTo2DImagesLeft(); void changeLayoutToDefault(); void changeLayoutToBig3D(); void changeLayoutToWidget1(); void changeLayoutToWidget2(); void changeLayoutToWidget3(); void changeLayoutToRowWidget3And4(); void changeLayoutToColumnWidget3And4(); void changeLayoutToRowWidgetSmall3andBig4(); void changeLayoutToSmallUpperWidget2Big3and4(); void changeLayoutTo2x2Dand3DWidget(); void changeLayoutToLeft2Dand3DRight2D(); void changeLayoutTo2DUpAnd3DDown(); void Fit(); void InitPositionTracking(); void AddDisplayPlaneSubTree(); void EnableStandardLevelWindow(); void DisableStandardLevelWindow(); bool InitializeStandardViews( const mitk::Geometry3D * geometry ); void wheelEvent( QWheelEvent * e ); void mousePressEvent(QMouseEvent * e); void moveEvent( QMoveEvent* e ); void leaveEvent ( QEvent * e ); void EnsureDisplayContainsPoint( mitk::DisplayGeometry* displayGeometry, const mitk::Point3D& p); void MoveCrossToPosition(const mitk::Point3D& newPosition); void EnableNavigationControllerEventListening(); void DisableNavigationControllerEventListening(); void EnableGradientBackground(); void DisableGradientBackground(); void EnableDepartmentLogo(); void DisableDepartmentLogo(); void EnableColoredRectangles(); void DisableColoredRectangles(); void SetWidgetPlaneVisibility(const char* widgetName, bool visible, mitk::BaseRenderer *renderer=NULL); void SetWidgetPlanesVisibility(bool visible, mitk::BaseRenderer *renderer=NULL); void SetWidgetPlanesLocked(bool locked); void SetWidgetPlanesRotationLocked(bool locked); void SetWidgetPlanesRotationLinked( bool link ); void SetWidgetPlaneMode( int mode ); void SetGradientBackgroundColors( const mitk::Color & upper, const mitk::Color & lower ); void SetDepartmentLogoPath( const char * path ); void SetWidgetPlaneModeToSlicing( bool activate ); void SetWidgetPlaneModeToRotation( bool activate ); void SetWidgetPlaneModeToSwivel( bool activate ); void OnLayoutDesignChanged( int layoutDesignIndex ); void ResetCrosshair(); signals: void LeftMouseClicked(mitk::Point3D pointValue); void WheelMoved(QWheelEvent*); void WidgetPlanesRotationLinked(bool); void WidgetPlanesRotationEnabled(bool); void ViewsInitialized(); void WidgetPlaneModeSlicing(bool); void WidgetPlaneModeRotation(bool); void WidgetPlaneModeSwivel(bool); void WidgetPlaneModeChange(int); void WidgetNotifyNewCrossHairMode(int); void Moved(); public: /** Define RenderWindow (public)*/ QmitkRenderWindow* mitkWidget1; QmitkRenderWindow* mitkWidget2; QmitkRenderWindow* mitkWidget3; QmitkRenderWindow* mitkWidget4; QmitkLevelWindowWidget* levelWindowWidget; /********************************/ enum { PLANE_MODE_SLICING = 0, PLANE_MODE_ROTATION, PLANE_MODE_SWIVEL }; enum { LAYOUT_DEFAULT = 0, LAYOUT_2D_IMAGES_UP, LAYOUT_2D_IMAGES_LEFT, LAYOUT_BIG_3D, LAYOUT_WIDGET1, LAYOUT_WIDGET2, LAYOUT_WIDGET3, LAYOUT_2X_2D_AND_3D_WIDGET, LAYOUT_ROW_WIDGET_3_AND_4, LAYOUT_COLUMN_WIDGET_3_AND_4, LAYOUT_ROW_WIDGET_SMALL3_AND_BIG4 , LAYOUT_SMALL_UPPER_WIDGET2_BIG3_AND4,LAYOUT_2D_AND_3D_LEFT_2D_RIGHT_WIDGET, LAYOUT_2D_UP_AND_3D_DOWN}; enum { TRANSVERSAL, SAGITTAL, CORONAL, THREE_D }; protected: QHBoxLayout* QmitkStdMultiWidgetLayout; int m_Layout; int m_PlaneMode; mitk::RenderWindowFrame::Pointer m_RectangleRendering3; mitk::RenderWindowFrame::Pointer m_RectangleRendering2; mitk::RenderWindowFrame::Pointer m_RectangleRendering1; mitk::RenderWindowFrame::Pointer m_RectangleRendering4; mitk::ManufacturerLogo::Pointer m_LogoRendering1; mitk::ManufacturerLogo::Pointer m_LogoRendering2; mitk::ManufacturerLogo::Pointer m_LogoRendering3; mitk::ManufacturerLogo::Pointer m_LogoRendering4; mitk::GradientBackground::Pointer m_GradientBackground1; mitk::GradientBackground::Pointer m_GradientBackground2; mitk::GradientBackground::Pointer m_GradientBackground4; mitk::GradientBackground::Pointer m_GradientBackground3; mitk::DisplayVectorInteractor::Pointer m_MoveAndZoomInteractor; mitk::CoordinateSupplier::Pointer m_LastLeftClickPositionSupplier; mitk::PositionTracker::Pointer m_PositionTracker; mitk::SliceNavigationController::Pointer m_TimeNavigationController; mitk::SlicesRotator::Pointer m_SlicesRotator; mitk::SlicesSwiveller::Pointer m_SlicesSwiveller; mitk::DataNode::Pointer m_PositionTrackerNode; mitk::DataStorage::Pointer m_DataStorage; mitk::DataNode::Pointer m_PlaneNode1; mitk::DataNode::Pointer m_PlaneNode2; mitk::DataNode::Pointer m_PlaneNode3; mitk::DataNode::Pointer m_Node; QSplitter *m_MainSplit; QSplitter *m_LayoutSplit; QSplitter *m_SubSplit1; QSplitter *m_SubSplit2; QWidget *mitkWidget1Container; QWidget *mitkWidget2Container; QWidget *mitkWidget3Container; QWidget *mitkWidget4Container; struct { vtkCornerAnnotation *cornerText; vtkTextProperty *textProp; vtkRenderer *ren; } m_CornerAnnotaions[3]; bool m_PendingCrosshairPositionEvent; }; #endif /*QMITKSTDMULTIWIDGET_H_*/